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.
This commit is contained in:
Vadim Zeitlin 2015-08-31 02:16:01 +02:00
parent e36874d4f9
commit d501395ee0

View File

@ -519,7 +519,7 @@ AC_DEFUN([WX_ARG_ENABLE_YESNOAUTO],
$2=0 $2=0
elif test "$enableval" = "auto" ; then elif test "$enableval" = "auto" ; then
AC_MSG_RESULT([will be automatically detected]) AC_MSG_RESULT([will be automatically detected])
$2="auto" $2=""
else else
AC_MSG_ERROR([ AC_MSG_ERROR([
Unrecognized option value (allowed values: yes, no, auto) Unrecognized option value (allowed values: yes, no, auto)
@ -545,7 +545,7 @@ AC_DEFUN([WX_ARG_WITH_YESNOAUTO],
$2=0 $2=0
elif test "$withval" = "auto" ; then elif test "$withval" = "auto" ; then
AC_MSG_RESULT([will be automatically detected]) AC_MSG_RESULT([will be automatically detected])
$2="auto" $2=""
else else
AC_MSG_ERROR([ AC_MSG_ERROR([
Unrecognized option value (allowed values: yes, auto) Unrecognized option value (allowed values: yes, auto)
@ -597,7 +597,7 @@ AC_DEFUN([WX_STANDARD_OPTIONS],
AC_MSG_CHECKING([for the --with-toolkit option]) AC_MSG_CHECKING([for the --with-toolkit option])
if test "$withval" = "auto" ; then if test "$withval" = "auto" ; then
AC_MSG_RESULT([will be automatically detected]) AC_MSG_RESULT([will be automatically detected])
TOOLKIT="auto" TOOLKIT=""
else else
TOOLKIT="$withval" TOOLKIT="$withval"
@ -671,7 +671,7 @@ AC_DEFUN([WX_STANDARD_OPTIONS],
AC_MSG_CHECKING([for the --with-wxversion option]) AC_MSG_CHECKING([for the --with-wxversion option])
if test "$withval" = "auto" ; then if test "$withval" = "auto" ; then
AC_MSG_RESULT([will be automatically detected]) AC_MSG_RESULT([will be automatically detected])
WX_RELEASE="auto" WX_RELEASE=""
else else
wx_requested_major_version=`echo $withval | \ wx_requested_major_version=`echo $withval | \
@ -706,7 +706,7 @@ dnl ---------------------------------------------------------------------------
dnl WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS dnl WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS
dnl dnl
dnl Sets the WXCONFIG_FLAGS string using the SHARED,DEBUG,UNICODE variable values 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 Thus this macro needs to be called only once all options have been set.
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
AC_DEFUN([WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS], 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 " WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--unicode=no "
fi fi
if test "$TOOLKIT" != "auto" ; then if test -n "$TOOLKIT" ; then
WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--toolkit=$TOOLKIT " WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--toolkit=$TOOLKIT "
fi fi
if test "$WX_RELEASE" != "auto" ; then if test -n "$WX_RELEASE" ; then
WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--version=$WX_RELEASE " WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--version=$WX_RELEASE "
fi fi
@ -750,14 +750,14 @@ AC_DEFUN([WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS],
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl _WX_SELECTEDCONFIG_CHECKFOR([RESULTVAR], [STRING], [MSG]) dnl _WX_SELECTEDCONFIG_CHECKFOR([RESULTVAR], [STRING], [MSG])
dnl dnl
dnl Sets WX_$RESULTVAR to the value of $RESULTVAR if it's different from dnl Sets WX_$RESULTVAR to the value of $RESULTVAR if it's defined. Otherwise,
dnl "auto". If it is "auto", check for the presence of STRING in 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_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 WX_$RESULTVAR to either 0 or 1, also outputting "yes" or "no" after MSG.
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
AC_DEFUN([_WX_SELECTEDCONFIG_CHECKFOR], 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 The user does not have particular preferences for this option;
dnl so we will detect the wxWidgets relative build setting and use it 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" echo "[[dbg]] WX_SELECTEDCONFIG: $WX_SELECTEDCONFIG"
fi fi
dnl we could test directly for WX_SHARED with a line like: dnl we could test directly for WX_SHARED with a line like:
dnl _WX_SELECTEDCONFIG_CHECKFOR([SHARED], [shared], dnl _WX_SELECTEDCONFIG_CHECKFOR([SHARED], [shared],
dnl [if wxWidgets was built in SHARED mode]) dnl [if wxWidgets was built in SHARED mode])
dnl but wx-config --selected-config DOES NOT outputs the 'shared' 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 word when wx was built in shared mode; it rather outputs the
dnl 'static' word when built in static mode. dnl 'static' word when built in static mode.
if test $WX_SHARED = "1"; then if test "$WX_SHARED" = "1"; then
STATIC=0 STATIC=0
elif test $WX_SHARED = "0"; then elif test "$WX_SHARED" = "0"; then
STATIC=1 STATIC=1
elif test $WX_SHARED = "auto"; then
STATIC="auto"
fi fi
dnl Now set the WX_UNICODE, WX_DEBUG, WX_STATIC variables 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) AC_SUBST(WX_SHARED)
dnl detect the WX_PORT to use 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 The user does not have particular preferences for this option;
dnl so we will detect the wxWidgets relative build setting and use it 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 fi
dnl now we can finally update the DEBUG,UNICODE,SHARED options dnl now we can finally update the DEBUG,UNICODE,SHARED options
dnl to their final values if they were set to 'auto' dnl to their final values if they were not already set
if test "$DEBUG" = "auto"; then if test -z "$DEBUG" ; then
DEBUG=$WX_DEBUG DEBUG=$WX_DEBUG
fi fi
if test "$UNICODE" = "auto"; then if test -z "$UNICODE" ; then
UNICODE=$WX_UNICODE UNICODE=$WX_UNICODE
fi fi
if test "$SHARED" = "auto"; then if test -z "$SHARED" ; then
SHARED=$WX_SHARED SHARED=$WX_SHARED
fi fi
if test "$TOOLKIT" = "auto"; then if test -z "$TOOLKIT" ; then
TOOLKIT=$WX_PORT TOOLKIT=$WX_PORT
fi fi