From bff235c9189c0136a92b94a10ad6fd9bfdf041ab Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 28 Aug 2015 02:02:06 +0200 Subject: [PATCH 1/4] Recognize GTK3 port in helper autoconf macros. Allow "gtk3" as a value of --with-toolkit option and recognize it correctly when auto-detecting toolkit from `wx-config --selected-config` output. --- wxwin.m4 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wxwin.m4 b/wxwin.m4 index f8e5b704a2..0656111107 100644 --- a/wxwin.m4 +++ b/wxwin.m4 @@ -602,12 +602,12 @@ AC_DEFUN([WX_STANDARD_OPTIONS], TOOLKIT="$withval" dnl PORT must be one of the allowed values - if test "$TOOLKIT" != "gtk1" -a "$TOOLKIT" != "gtk2" -a \ + if test "$TOOLKIT" != "gtk1" -a "$TOOLKIT" != "gtk2" -a "$TOOLKIT" != "gtk3" -a \ "$TOOLKIT" != "msw" -a "$TOOLKIT" != "motif" -a \ "$TOOLKIT" != "osx_carbon" -a "$TOOLKIT" != "osx_cocoa" -a \ "$TOOLKIT" != "dfb" -a "$TOOLKIT" != "x11"; then AC_MSG_ERROR([ - Unrecognized option value (allowed values: auto, gtk1, gtk2, msw, motif, osx_carbon, osx_cocoa, dfb, x11) + Unrecognized option value (allowed values: auto, gtk1, gtk2, gtk3, msw, motif, osx_carbon, osx_cocoa, dfb, x11) ]) fi @@ -866,6 +866,7 @@ AC_DEFUN([WX_DETECT_STANDARD_OPTION_VALUES], WX_GTKPORT1=$(expr "$WX_SELECTEDCONFIG" : ".*gtk1.*") WX_GTKPORT2=$(expr "$WX_SELECTEDCONFIG" : ".*gtk2.*") + WX_GTKPORT3=$(expr "$WX_SELECTEDCONFIG" : ".*gtk3.*") WX_MSWPORT=$(expr "$WX_SELECTEDCONFIG" : ".*msw.*") WX_MOTIFPORT=$(expr "$WX_SELECTEDCONFIG" : ".*motif.*") WX_OSXCOCOAPORT=$(expr "$WX_SELECTEDCONFIG" : ".*osx_cocoa.*") @@ -876,6 +877,7 @@ AC_DEFUN([WX_DETECT_STANDARD_OPTION_VALUES], WX_PORT="unknown" if test "$WX_GTKPORT1" != "0"; then WX_PORT="gtk1"; fi if test "$WX_GTKPORT2" != "0"; then WX_PORT="gtk2"; fi + if test "$WX_GTKPORT3" != "0"; then WX_PORT="gtk3"; fi if test "$WX_MSWPORT" != "0"; then WX_PORT="msw"; fi if test "$WX_MOTIFPORT" != "0"; then WX_PORT="motif"; fi if test "$WX_OSXCOCOAPORT" != "0"; then WX_PORT="osx_cocoa"; fi From 6bfea22363687a60bb21f4dbbbbb139a001b1d8a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 31 Aug 2015 01:43:21 +0200 Subject: [PATCH 2/4] No real changes, just slightly simplify a macro in wxwin.m4 Remove the never used 4th and 5th arguments of _WX_SELECTEDCONFIG_CHECKFOR macro. Also update the comment to better explain what does the macro actually do: it doesn't "output the message" but rather sets a variable, with the message being an optional side effect. --- wxwin.m4 | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/wxwin.m4 b/wxwin.m4 index 0656111107..63b9f2af20 100644 --- a/wxwin.m4 +++ b/wxwin.m4 @@ -748,12 +748,12 @@ AC_DEFUN([WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS], dnl --------------------------------------------------------------------------- -dnl _WX_SELECTEDCONFIG_CHECKFOR([RESULTVAR], [STRING], [MSG] -dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl _WX_SELECTEDCONFIG_CHECKFOR([RESULTVAR], [STRING], [MSG]) dnl -dnl Outputs the given MSG. Then searches the given STRING in the wxWidgets -dnl additional CPP flags and put the result of the search in WX_$RESULTVAR -dnl also adding the "yes" or "no" message result to MSG. +dnl Sets WX_$RESULTVAR to the value of $RESULTVAR if it's different from +dnl "auto". If it is "auto", check for the presence of STRING in +dnl $WX_SELECTEDCONFIG (which is supposed to be set by caller) and set +dnl WX_$RESULTVAR to either 0 or 1, also outputting "yes" or "no" after MSG. dnl --------------------------------------------------------------------------- AC_DEFUN([_WX_SELECTEDCONFIG_CHECKFOR], [ @@ -772,11 +772,9 @@ AC_DEFUN([_WX_SELECTEDCONFIG_CHECKFOR], if test "$WX_$1" != "0"; then WX_$1=1 AC_MSG_RESULT([yes]) - ifelse([$4], , :, [$4]) else WX_$1=0 AC_MSG_RESULT([no]) - ifelse([$5], , :, [$5]) fi else From e36874d4f96438eebdc637c75c23e924e3278a70 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 31 Aug 2015 01:57:48 +0200 Subject: [PATCH 3/4] Fix nonsensical handling of TOOLKIT in wxwin.m4 The code set WX_PORT to $TOOLKIT only if the latter was empty which made no sense and also set WX_PORT to the never used nor documented anywhere else $PORT if $TOOLKIT was not empty which made even less of it. Just assign $TOOLKIT to WX_PORT if the former has a valid value. --- wxwin.m4 | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/wxwin.m4 b/wxwin.m4 index 63b9f2af20..6a3e9b27b0 100644 --- a/wxwin.m4 +++ b/wxwin.m4 @@ -899,14 +899,8 @@ AC_DEFUN([WX_DETECT_STANDARD_OPTION_VALUES], AC_MSG_RESULT([$WX_PORT]) else - dnl Use the setting given by the user - if test -z "$TOOLKIT" ; then - WX_PORT=$TOOLKIT - else - dnl try with PORT - WX_PORT=$PORT - fi + WX_PORT=$TOOLKIT fi AC_SUBST(WX_PORT) From d501395ee0c58c34d1fdf8ee3a5a71f6d837ed4a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 31 Aug 2015 02:16:01 +0200 Subject: [PATCH 4/4] Fix handling of unspecified build options in wxwin.m4 There were many problems if some options selecting the build of wxWidgets to use were not specified at all, i.e. if the corresponding string was not used in WX_STANDARD_OPTIONS() argument or if WX_STANDARD_OPTIONS() was not used at all (which is perfectly possible and allowed). In this case, the output of WX_STANDARD_OPTIONS_SUMMARY_MSG() was corrupted (e.g. it could output "WX_DEBUG is" without any value and "PORT:" value was empty) and, worse, as that macro is only cosmetic, WX_LIKE_LIBNAME() didn't work correctly neither, making it difficult to check for the libraries using it to construct their name (as many libraries from wxCode do). Get rid of all these problems by simply treating empty/undefined variables as meaning "auto detect" instead of having to set them to the special "auto" value first. This makes sense as now we have just 3 states: 0, 1 or null, instead of previous 4 (+ "auto") and is much more robust. --- wxwin.m4 | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/wxwin.m4 b/wxwin.m4 index 6a3e9b27b0..3e483c6e10 100644 --- a/wxwin.m4 +++ b/wxwin.m4 @@ -519,7 +519,7 @@ AC_DEFUN([WX_ARG_ENABLE_YESNOAUTO], $2=0 elif test "$enableval" = "auto" ; then AC_MSG_RESULT([will be automatically detected]) - $2="auto" + $2="" else AC_MSG_ERROR([ Unrecognized option value (allowed values: yes, no, auto) @@ -545,7 +545,7 @@ AC_DEFUN([WX_ARG_WITH_YESNOAUTO], $2=0 elif test "$withval" = "auto" ; then AC_MSG_RESULT([will be automatically detected]) - $2="auto" + $2="" else AC_MSG_ERROR([ Unrecognized option value (allowed values: yes, auto) @@ -597,7 +597,7 @@ AC_DEFUN([WX_STANDARD_OPTIONS], AC_MSG_CHECKING([for the --with-toolkit option]) if test "$withval" = "auto" ; then AC_MSG_RESULT([will be automatically detected]) - TOOLKIT="auto" + TOOLKIT="" else TOOLKIT="$withval" @@ -671,7 +671,7 @@ AC_DEFUN([WX_STANDARD_OPTIONS], AC_MSG_CHECKING([for the --with-wxversion option]) if test "$withval" = "auto" ; then AC_MSG_RESULT([will be automatically detected]) - WX_RELEASE="auto" + WX_RELEASE="" else wx_requested_major_version=`echo $withval | \ @@ -706,7 +706,7 @@ dnl --------------------------------------------------------------------------- dnl WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS dnl dnl Sets the WXCONFIG_FLAGS string using the SHARED,DEBUG,UNICODE variable values -dnl which are different from "auto". +dnl which were specified. dnl Thus this macro needs to be called only once all options have been set. dnl --------------------------------------------------------------------------- AC_DEFUN([WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS], @@ -730,11 +730,11 @@ AC_DEFUN([WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS], WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--unicode=no " fi - if test "$TOOLKIT" != "auto" ; then + if test -n "$TOOLKIT" ; then WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--toolkit=$TOOLKIT " fi - if test "$WX_RELEASE" != "auto" ; then + if test -n "$WX_RELEASE" ; then WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--version=$WX_RELEASE " fi @@ -750,14 +750,14 @@ AC_DEFUN([WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS], dnl --------------------------------------------------------------------------- dnl _WX_SELECTEDCONFIG_CHECKFOR([RESULTVAR], [STRING], [MSG]) dnl -dnl Sets WX_$RESULTVAR to the value of $RESULTVAR if it's different from -dnl "auto". If it is "auto", check for the presence of STRING in +dnl Sets WX_$RESULTVAR to the value of $RESULTVAR if it's defined. Otherwise, +dnl auto-detect the value by checking for the presence of STRING in dnl $WX_SELECTEDCONFIG (which is supposed to be set by caller) and set dnl WX_$RESULTVAR to either 0 or 1, also outputting "yes" or "no" after MSG. dnl --------------------------------------------------------------------------- AC_DEFUN([_WX_SELECTEDCONFIG_CHECKFOR], [ - if test "$$1" = "auto" ; then + if test -z "$$1" ; then dnl The user does not have particular preferences for this option; dnl so we will detect the wxWidgets relative build setting and use it @@ -821,19 +821,16 @@ AC_DEFUN([WX_DETECT_STANDARD_OPTION_VALUES], echo "[[dbg]] WX_SELECTEDCONFIG: $WX_SELECTEDCONFIG" fi - dnl we could test directly for WX_SHARED with a line like: dnl _WX_SELECTEDCONFIG_CHECKFOR([SHARED], [shared], dnl [if wxWidgets was built in SHARED mode]) dnl but wx-config --selected-config DOES NOT outputs the 'shared' dnl word when wx was built in shared mode; it rather outputs the dnl 'static' word when built in static mode. - if test $WX_SHARED = "1"; then + if test "$WX_SHARED" = "1"; then STATIC=0 - elif test $WX_SHARED = "0"; then + elif test "$WX_SHARED" = "0"; then STATIC=1 - elif test $WX_SHARED = "auto"; then - STATIC="auto" fi dnl Now set the WX_UNICODE, WX_DEBUG, WX_STATIC variables @@ -856,7 +853,7 @@ AC_DEFUN([WX_DETECT_STANDARD_OPTION_VALUES], AC_SUBST(WX_SHARED) dnl detect the WX_PORT to use - if test "$TOOLKIT" = "auto" ; then + if test -z "$TOOLKIT" ; then dnl The user does not have particular preferences for this option; dnl so we will detect the wxWidgets relative build setting and use it @@ -932,17 +929,17 @@ AC_DEFUN([WX_DETECT_STANDARD_OPTION_VALUES], fi dnl now we can finally update the DEBUG,UNICODE,SHARED options - dnl to their final values if they were set to 'auto' - if test "$DEBUG" = "auto"; then + dnl to their final values if they were not already set + if test -z "$DEBUG" ; then DEBUG=$WX_DEBUG fi - if test "$UNICODE" = "auto"; then + if test -z "$UNICODE" ; then UNICODE=$WX_UNICODE fi - if test "$SHARED" = "auto"; then + if test -z "$SHARED" ; then SHARED=$WX_SHARED fi - if test "$TOOLKIT" = "auto"; then + if test -z "$TOOLKIT" ; then TOOLKIT=$WX_PORT fi