added AM_PATH_WXCONFIG macro and its installation

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12651 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2001-11-24 23:55:29 +00:00
parent 69d27ff78b
commit debc175a42
5 changed files with 211 additions and 3 deletions

View File

@ -400,6 +400,10 @@ afminstall: preinstall
$(INSTALL) -d $(datadir)/wx/$(VER_MAJMIN)/gs_afm
$(INSTALL_DATA) $(top_srcdir)/misc/afm/*.afm $(datadir)/wx/$(VER_MAJMIN)/afm
$(INSTALL_DATA) $(top_srcdir)/misc/gs_afm/*.afm $(datadir)/wx/$(VER_MAJMIN)/gs_afm
m4datainstall: preinstall
$(INSTALL) -d $(datadir)/aclocal
$(INSTALL_DATA) $(top_srcdir)/wxwin.m4 $(datadir)/aclocal
# this is the real install target: copies the library, wx-config and the
# headers to the installation directory
@ -461,7 +465,7 @@ preinstall_gl: $(build_libdir)/@WX_TARGET_LIBRARY_GL@
@if test ! -d $(libdir); then $(INSTALL) -d $(libdir); fi
@INSTALL_LIBRARY@ $(build_libdir)/@WX_TARGET_LIBRARY_GL@ $(libdir)/@WX_TARGET_LIBRARY_GL@
install: @AFMINSTALL@ @WX_ALL_INSTALLED@
install: @AFMINSTALL@ @WX_ALL_INSTALLED@ m4datainstall
@echo " "
@echo " The installation of wxWindows is finished. On certain"
@echo " platforms (e.g. Linux) you'll now have to run ldconfig"
@ -526,6 +530,7 @@ uninstall:
ALL_DIST: distclean
mkdir _dist_dir
mkdir $(DISTDIR)
cp $(WXDIR)/wxwin.m4 $(DISTDIR)
cp $(WXDIR)/aclocal.m4 $(DISTDIR)
cp $(WXDIR)/configure.in $(DISTDIR)
cp $(WXDIR)/configure $(DISTDIR)
@ -1454,7 +1459,7 @@ cleanall: clean
RPMTOP=_dist_dir/_rpm_top
rpm: dist
rpm: bzip-dist
@echo "*** Building RPMs ***"
-mkdir $(RPMTOP)
-mkdir $(RPMTOP)/SOURCES
@ -1462,7 +1467,7 @@ rpm: dist
-mkdir $(RPMTOP)/BUILD
-mkdir $(RPMTOP)/RPMS
-mkdir $(RPMTOP)/SRPMS
cp -f $(WXARCHIVE) $(RPMTOP)/SOURCES
cp -f $(WXARCHIVE_BZIP) $(RPMTOP)/SOURCES
rpm -ba --define "_topdir `pwd`/$(RPMTOP)" $(WXDIR)/wx$(TOOLKIT).spec
mv -f `find $(RPMTOP) -name "wx$(TARGET)*.rpm"` .

View File

@ -108,6 +108,7 @@ fi
%dir %{_libdir}/wx
%{_libdir}/wx/*
%{_bindir}/wxbase-%{ver2}-config
%{_datadir}/aclocal/*.m4
%files static
%defattr (-,root,root)

View File

@ -128,6 +128,7 @@ fi
%dir %{_libdir}/wx
%{_libdir}/wx/*
%{_bindir}/wxgtk-%{ver2}-config
%{_datadir}/aclocal/*.m4
%files gl
%defattr(-,root,root)

View File

@ -130,6 +130,7 @@ fi
%dir %{_libdir}/wx
%{_libdir}/wx/*
%{_bindir}/wxmotif-%{ver2}-config
%{_datadir}/aclocal/*.m4
%files gl
%defattr(-,root,root)

200
wxwin.m4 Normal file
View File

@ -0,0 +1,200 @@
dnl ---------------------------------------------------------------------------
dnl Macros for wxWindows detection. Typically used in configure.in as:
dnl
dnl AC_ARG_ENABLE(...)
dnl AC_ARG_WITH(...)
dnl ...
dnl AM_OPTIONS_WXCONFIG
dnl ...
dnl ...
dnl AM_PATH_WXCONFIG(2.3.2, wxWin=1)
dnl if test "$wxWin" != 1; then
dnl AC_MSG_ERROR([
dnl wxWindows must be installed on your system
dnl but wx-config script couldn't be found.
dnl
dnl Please check that wx-config is in path, the directory
dnl where wxWindows libraries are installed (returned by
dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or
dnl equivalent variable and wxWindows version is 2.3.2 or above.
dnl ])
dnl fi
dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
dnl
dnl LDFLAGS="$LDFLAGS $WX_LIBS"
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl AM_OPTIONS_WXCONFIG
dnl
dnl adds support for --wx-prefix, --wx-exec-prefix and --wx-config
dnl command line options
dnl ---------------------------------------------------------------------------
AC_DEFUN(AM_OPTIONS_WXCONFIG,
[
AC_ARG_WITH(wx-prefix, [ --with-wx-prefix=PREFIX Prefix where wxWindows is installed (optional)],
wx_config_prefix="$withval", wx_config_prefix="")
AC_ARG_WITH(wx-exec-prefix,[ --with-wx-exec-prefix=PREFIX Exec prefix where wxWindows is installed (optional)],
wx_config_exec_prefix="$withval", wx_config_exec_prefix="")
AC_ARG_WITH(wx-exec-prefix,[ --with-wx-config=CONFIG wx-config script to use (optional)],
wx_config_name="$withval", wx_config_name="")
])
dnl ---------------------------------------------------------------------------
dnl AM_PATH_WXCONFIG(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl Test for wxWindows, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC
dnl (the latter is for static linking against wxWindows). Set WX_CONFIG_NAME
dnl environment variable to override the default name of the wx-config script
dnl to use. Set WX_CONFIG_PATH to specify the full path to wx-config - in this
dnl case the macro won't even waste time on tests for its existence.
dnl ---------------------------------------------------------------------------
dnl
dnl Get the cflags and libraries from the wx-config script
dnl
AC_DEFUN(AM_PATH_WXCONFIG,
[
dnl do we have wx-config name: it can be wx-config or wxd-config or ...
if test x${WX_CONFIG_NAME+set} != xset ; then
WX_CONFIG_NAME=wx-config
fi
if test "x$wx_config_name" != x ; then
WX_CONFIG_NAME="$wx_config_name"
fi
dnl deal with optional prefixes
if test x$wx_config_exec_prefix != x ; then
wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix"
if test x${WX_CONFIG_NAME+set} != xset ; then
WX_CONFIG_PATH=$wx_config_exec_prefix/bin/$WX_CONFIG_NAME
fi
fi
if test x$wx_config_prefix != x ; then
wx_config_args="$wx_config_args --prefix=$wx_config_prefix"
if test x${WX_CONFIG_NAME+set} != xset ; then
WX_CONFIG_PATH=$wx_config_prefix/bin/$WX_CONFIG_NAME
fi
fi
dnl don't search the PATH if we already have the full name
if test "x$WX_CONFIG_PATH" = "x" ; then
AC_PATH_PROG(WX_CONFIG_PATH, $WX_CONFIG_NAME, no)
fi
if test "$WX_CONFIG_PATH" != "no" ; then
WX_VERSION=""
no_wx=""
min_wx_version=ifelse([$1], ,2.2.1,$1)
AC_MSG_CHECKING(for wxWindows version >= $min_wx_version)
WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args"
WX_VERSION=`$WX_CONFIG_WITH_ARGS --version`
wx_config_major_version=`echo $WX_VERSION | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
wx_config_minor_version=`echo $WX_VERSION | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
wx_config_micro_version=`echo $WX_VERSION | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
wx_requested_major_version=`echo $min_wx_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
wx_requested_minor_version=`echo $min_wx_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
wx_requested_micro_version=`echo $min_wx_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
wx_ver_ok=""
if test $wx_config_major_version -gt $wx_requested_major_version; then
wx_ver_ok=yes
else
if test $wx_config_major_version -eq $wx_requested_major_version; then
if test $wx_config_minor_version -gt $wx_requested_minor_version; then
wx_ver_ok=yes
else
if test $wx_config_minor_version -eq $wx_requested_minor_version; then
if test $wx_config_micro_version -ge $wx_requested_micro_version; then
wx_ver_ok=yes
fi
fi
fi
fi
fi
if test "x$wx_ver_ok" = x ; then
no_wx=yes
else
WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs`
WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs`
dnl starting with version 2.2.6 wx-config has --cppflags argument
wx_has_cppflags=""
if test $wx_config_major_version -gt 2; then
wx_has_cppflags=yes
else
if test $wx_config_major_version -eq 2; then
if test $wx_config_minor_version -gt 2; then
wx_has_cppflags=yes
else
if test $wx_config_minor_version -eq 2; then
if test $wx_config_micro_version -ge 6; then
wx_has_cppflags=yes
fi
fi
fi
fi
fi
if test "x$wx_has_cppflags" = x ; then
dnl no choice but to define all flags like CFLAGS
WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags`
WX_CPPFLAGS=$WX_CFLAGS
WX_CXXFLAGS=$WX_CFLAGS
WX_CFLAGS_ONLY=$WX_CFLAGS
WX_CXXFLAGS_ONLY=$WX_CFLAGS
else
dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS
WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags`
WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags`
WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags`
WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"`
WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"`
fi
fi
if test "x$no_wx" = x ; then
AC_MSG_RESULT(yes (version $WX_VERSION))
ifelse([$2], , :, [$2])
else
if test "x$WX_VERSION" = x; then
dnl no wx-config at all
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(no (version $WX_VERSION is not new enough))
fi
WX_CFLAGS=""
WX_CPPFLAGS=""
WX_CXXFLAGS=""
WX_LIBS=""
WX_LIBS_STATIC=""
ifelse([$3], , :, [$3])
fi
fi
AC_SUBST(WX_CPPFLAGS)
AC_SUBST(WX_CFLAGS)
AC_SUBST(WX_CXXFLAGS)
AC_SUBST(WX_CFLAGS_ONLY)
AC_SUBST(WX_CXXFLAGS_ONLY)
AC_SUBST(WX_LIBS)
AC_SUBST(WX_LIBS_STATIC)
AC_SUBST(WX_VERSION)
])