From 8708fa7618baba4ef90051d09e4247339a6f9dde Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 18 Jul 2004 11:19:34 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28299 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- Makefile.in | 7 +- build/bakefiles/make_dist.mk | 1 + build/bakefiles/wx.bkl | 6 +- configure | 24 +++-- configure.in | 29 +++--- docs/changes.txt | 2 + wx-config-wrapper.in | 180 +++++++++++++++++++++++++++++++++++ wx-config.in | 31 ++---- wxwin.m4 | 64 +++++++------ 9 files changed, 268 insertions(+), 76 deletions(-) create mode 100755 wx-config-wrapper.in diff --git a/Makefile.in b/Makefile.in index 620d618369..bf616a6804 100644 --- a/Makefile.in +++ b/Makefile.in @@ -7411,8 +7411,10 @@ samples: install-wxconfig: $(INSTALL_DIR) $(DESTDIR)$(bindir) - $(INSTALL_PROGRAM) wx$(TOOLCHAIN_NAME)-config $(DESTDIR)$(bindir) - (cd $(DESTDIR)$(bindir) && rm -f wx-config && $(LN_S) wx$(TOOLCHAIN_NAME)-config wx-config) + $(INSTALL_DIR) $(DESTDIR)$(libdir)/wx/config + $(INSTALL_PROGRAM) lib/wx/config/$(TOOLCHAIN_NAME) $(DESTDIR)$(libdir)/wx/config + $(INSTALL_PROGRAM) wx-config $(DESTDIR)$(bindir) + (cd $(DESTDIR)$(bindir) && rm -f wx$(TOOLCHAIN_NAME)-config && $(LN_S) wx-config wx$(TOOLCHAIN_NAME)-config) locale_install: $(INSTALL_DIR) $(DESTDIR)$(datadir)/locale @@ -19826,6 +19828,7 @@ ALL_DIST: distrib_clean cp $(WXDIR)/install-sh $(DISTDIR) cp $(WXDIR)/mkinstalldirs $(DISTDIR) cp $(WXDIR)/wx-config.in $(DISTDIR) + cp $(WXDIR)/wx-config-wrapper.in $(DISTDIR) cp $(WXDIR)/version-script.in $(DISTDIR) cp $(WXDIR)/setup.h.in $(DISTDIR) cp $(WXDIR)/setup.h_vms $(DISTDIR) diff --git a/build/bakefiles/make_dist.mk b/build/bakefiles/make_dist.mk index e833be05a1..0f19679ac7 100644 --- a/build/bakefiles/make_dist.mk +++ b/build/bakefiles/make_dist.mk @@ -77,6 +77,7 @@ ALL_DIST: distrib_clean cp $(WXDIR)/install-sh $(DISTDIR) cp $(WXDIR)/mkinstalldirs $(DISTDIR) cp $(WXDIR)/wx-config.in $(DISTDIR) + cp $(WXDIR)/wx-config-wrapper.in $(DISTDIR) cp $(WXDIR)/version-script.in $(DISTDIR) cp $(WXDIR)/setup.h.in $(DISTDIR) cp $(WXDIR)/setup.h_vms $(DISTDIR) diff --git a/build/bakefiles/wx.bkl b/build/bakefiles/wx.bkl index c85d937d96..8e517de8d6 100644 --- a/build/bakefiles/wx.bkl +++ b/build/bakefiles/wx.bkl @@ -64,8 +64,10 @@ install $(INSTALL_DIR) $(DESTDIR)$(BINDIR) - $(INSTALL_PROGRAM) wx$(TOOLCHAIN_NAME)-config $(DESTDIR)$(BINDIR) - (cd $(DESTDIR)$(BINDIR) && rm -f wx-config && $(LN_S) wx$(TOOLCHAIN_NAME)-config wx-config) + $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/wx/config + $(INSTALL_PROGRAM) lib/wx/config/$(TOOLCHAIN_NAME) $(DESTDIR)$(LIBDIR)/wx/config + $(INSTALL_PROGRAM) wx-config $(DESTDIR)$(BINDIR) + (cd $(DESTDIR)$(BINDIR) && rm -f wx$(TOOLCHAIN_NAME)-config && $(LN_S) wx-config wx$(TOOLCHAIN_NAME)-config) diff --git a/configure b/configure index ee76cc8a71..d5a0eb60e3 100755 --- a/configure +++ b/configure @@ -41060,7 +41060,7 @@ fi ac_config_headers="$ac_config_headers setup.h" - ac_config_files="$ac_config_files wx-config version-script Makefile" + ac_config_files="$ac_config_files wx-config wx-config-wrapper version-script Makefile" ac_config_commands="$ac_config_commands default" @@ -41771,6 +41771,7 @@ do case "$ac_config_target" in # Handling of arguments. "wx-config" ) CONFIG_FILES="$CONFIG_FILES wx-config" ;; + "wx-config-wrapper" ) CONFIG_FILES="$CONFIG_FILES wx-config-wrapper" ;; "version-script" ) CONFIG_FILES="$CONFIG_FILES version-script" ;; "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "$mk" ) CONFIG_FILES="$CONFIG_FILES $mk" ;; @@ -42752,18 +42753,15 @@ esac echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in default ) - if test ! -h wx-config; then - chmod +x wx-config - mv wx-config wx${TOOLCHAIN_NAME}-config - ${LN_S} wx${TOOLCHAIN_NAME}-config wx-config - fi - if test ! -d lib; then mkdir lib fi if test ! -d lib/wx; then mkdir lib/wx fi + if test ! -d lib/wx/config; then + mkdir lib/wx/config + fi if test ! -d lib/wx/include; then mkdir lib/wx/include fi @@ -42776,6 +42774,18 @@ echo "$as_me: executing $ac_dest commands" >&6;} if test -f setup.h; then mv -f setup.h lib/wx/include/${TOOLCHAIN_NAME}/wx/setup.h fi + + if test -f wx-config; then + chmod +x wx-config + mv -f wx-config lib/wx/config/${TOOLCHAIN_NAME} + rm -f wx${TOOLCHAIN_NAME}-config + ${LN_S} wx-config wx${TOOLCHAIN_NAME}-config + fi + + if test -f wx-config-wrapper; then + chmod +x wx-config-wrapper + mv -f wx-config-wrapper wx-config + fi ;; esac done diff --git a/configure.in b/configure.in index c952639b43..ace3f1074a 100644 --- a/configure.in +++ b/configure.in @@ -6239,31 +6239,22 @@ dnl (the original file name may be overriden by appending another name after a dnl colon) AC_CONFIG_FILES([ wx-config + wx-config-wrapper version-script Makefile ]) AC_CONFIG_COMMANDS([default], [ - dnl This test is required to make the following idempotent. - dnl Otherwise running config.status or rerunning configure - dnl would stomp the wx-config link or try to move it onto - dnl itself. - dnl Use -h instead of -L to test for link (GD) - dnl -h is documented as obsolete under Mac OS X but works - dnl -L is obsolete under Solaris8 - if test ! -h wx-config; then - chmod +x wx-config - mv wx-config wx${TOOLCHAIN_NAME}-config - ${LN_S} wx${TOOLCHAIN_NAME}-config wx-config - fi - if test ! -d lib; then mkdir lib fi if test ! -d lib/wx; then mkdir lib/wx fi + if test ! -d lib/wx/config; then + mkdir lib/wx/config + fi if test ! -d lib/wx/include; then mkdir lib/wx/include fi @@ -6276,6 +6267,18 @@ AC_CONFIG_COMMANDS([default], if test -f setup.h; then mv -f setup.h lib/wx/include/${TOOLCHAIN_NAME}/wx/setup.h fi + + if test -f wx-config; then + chmod +x wx-config + mv -f wx-config lib/wx/config/${TOOLCHAIN_NAME} + rm -f wx${TOOLCHAIN_NAME}-config + ${LN_S} wx-config wx${TOOLCHAIN_NAME}-config + fi + + if test -f wx-config-wrapper; then + chmod +x wx-config-wrapper + mv -f wx-config-wrapper wx-config + fi ], [ TOOLCHAIN_NAME="${TOOLCHAIN_NAME}" diff --git a/docs/changes.txt b/docs/changes.txt index edae6b67be..2b8bf2bd60 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -221,6 +221,8 @@ Unix: - wxTaskBarIcon now supports freedesktop.org System Tray protocol - security fixes to wxSingleInstanceChecker +- wx-config script was modified to allow choosing from multiple installed + builds of wxWidgets wxGTK: diff --git a/wx-config-wrapper.in b/wx-config-wrapper.in new file mode 100755 index 0000000000..5fc351ca02 --- /dev/null +++ b/wx-config-wrapper.in @@ -0,0 +1,180 @@ +#!/bin/sh + +# ------------------------------------------------------------------------- +# Location of wx: +# ------------------------------------------------------------------------- + +update_prefixes() +{ + includedir="@includedir@" + libdir="@libdir@" +} +prefix="@prefix@" +exec_prefix="@exec_prefix@" +update_prefixes + +srcdir="@top_srcdir@" +builddir="@top_builddir_wxconfig@" + + +# ------------------------------------------------------------------------- +# Wrapper script: +# ------------------------------------------------------------------------- + +exec_prefix_set=no + +# return the absolute path prepending builddir to it if needed +makeabs() +{ + path=$1 + # TODO: this only works under Unix and even there it could be + # enhanced to remove ".." and "." + if [ `echo $path | sed 's/^\(.\).*/\1/'` != "/" ]; then + if [ $path = "." ]; then + path=$builddir + else + path="$builddir/$path" + fi + fi + + echo $path +} + +# these determine wx-config script to use: +m_toolkit='*' +m_univ='*' +m_unicode='*' +m_debug='*' +m_version='*.*' + +# lists all wx-config scripts that match criteria specified above +list_wx_config_scripts() +{ + mask="${m_toolkit}${m_univ}${m_unicode}${m_debug}-${m_version}" + + # if wx-config was called via wx$TOOLCHAIN_NAME-config symlink, + # try to extract the mask from it: + myname=`basename $0` + if test $myname != wx-config ; then + toolchain=`echo $myname | sed 's/wx\(.*\)-config/\1/'` + if test -f ${libdir}/wx/config/${toolchain} ; then + mask=$toolchain + fi + fi + + if test -d ${libdir}/wx/config ; then + (cd ${libdir}/wx/config/ && ls -1 $mask 2>/dev/null) + fi +} + +# find first wx-config script that matches criteria +find_wx_config_script() +{ + all_scripts=`list_wx_config_scripts` + # unless wxBase was explicitly requested, try to find a GUI version: + if test "$m_toolkit" != "base" ; then + script=`echo $all_scripts | tr ' ' '\n' | grep -v '^base' | head -n 1` + if test "x$script" != "x" ; then + echo ${libdir}/wx/config/${script} + fi + fi + + # otherwise (or if no GUI script was found), use alphabetically 1st script: + script=`echo $all_scripts | head -n 1` + if test -z "$script" ; then + echo "no suitable wx-config script found" >&2 + exit 1 + fi + echo ${libdir}/wx/config/${script} +} + + +# handle options: + +# arguments to pass to the real wx-config script: +args="" + +for i in $*; do + case "$i" in + -*=*) optarg=`echo "$i" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $i in + --inplace) + prefix=`makeabs $srcdir` + exec_prefix=`makeabs $builddir` + exec_prefix_set=yes + update_prefixes + args="$args --inplace" + ;; + --prefix=*) + prefix=$optarg + if test $exec_prefix_set = no ; then + exec_prefix=$optarg + fi + update_prefixes + ;; + --exec-prefix=*) + exec_prefix=$optarg + exec_prefix_set=yes + update_prefixes + ;; + + --list) + # list available wx versions: + list_wx_config_scripts + exit + ;; + + --toolkit=*) + m_toolkit=$optarg + ;; + --version=*) + m_version=$optarg + ;; + --unicode=*) + if test "x$optarg" = "xyes" ; then + m_unicode="u" + else + m_unicode="" + fi + ;; + --unicode) + m_unicode="u" + ;; + --debug=*) + if test "x$optarg" = "xyes" ; then + m_debug="d" + else + m_debug="" + fi + ;; + --debug) + m_debug="d" + ;; + --universal=*) + if test "x$optarg" = "xyes" ; then + m_univ="univ" + else + m_univ="" + fi + ;; + --universal) + m_univ="univ" + ;; + *) + args="$args $i" + ;; + esac +done + +args="$args --prefix=$prefix --exec-prefix=$exec_prefix" + +script=`find_wx_config_script`; +if test "x$script" != "x" ; then + $script $args + exit $? +else + exit 1 +fi diff --git a/wx-config.in b/wx-config.in index 3977e1037a..579bcf0d63 100755 --- a/wx-config.in +++ b/wx-config.in @@ -144,29 +144,13 @@ get_ldflags_gui() echo $flags_to_ret } -# return the absolute path prepending builddir to it if needed -makeabs() -{ - path=$1 - # TODO: this only works under Unix and even there it could be - # enhanced to remove ".." and "." - if [ `echo $path | sed 's/^\(.\).*/\1/'` != "/" ]; then - if [ $path = "." ]; then - path=$builddir - else - path="$builddir/$path" - fi - fi - - echo $path -} - usage() { cat <= $min_wx_version) + if test -z "$5" ; then + AC_MSG_CHECKING([for wxWindows version >= $min_wx_version]) + else + AC_MSG_CHECKING([for wxWindows version >= $min_wx_version ($5)]) + fi - WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args" + WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args $5 $4" - WX_VERSION=`$WX_CONFIG_WITH_ARGS --version` + WX_VERSION=`$WX_CONFIG_WITH_ARGS --version 2>/dev/null` wx_config_major_version=`echo $WX_VERSION | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` wx_config_minor_version=`echo $WX_VERSION | \ @@ -132,28 +137,29 @@ AC_DEFUN([AM_PATH_WXCONFIG], 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 + if test "x$WX_VERSION" != x ; then + 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 fi if test "x$wx_ver_ok" = x ; then no_wx=yes else - wx_libs_arg="--libs" - WX_LIBS=`$WX_CONFIG_WITH_ARGS $wx_libs_arg` - WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static $wx_libs_arg` + 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="" -- 2.45.2