Skip to content

Commit

Permalink
update wxwin.m4
Browse files Browse the repository at this point in the history
  • Loading branch information
wojdyr committed May 1, 2022
1 parent bc80e54 commit f9905b0
Showing 1 changed file with 56 additions and 60 deletions.
116 changes: 56 additions & 60 deletions m4/wxwin.m4
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ dnl If you want to support standard --enable-debug/unicode/shared options, you
dnl may do the following:
dnl
dnl ...
dnl AC_CANONICAL_SYSTEM
dnl AC_CANONICAL_TARGET
dnl
dnl # define configure options
dnl WX_CONFIG_OPTIONS
Expand Down Expand Up @@ -142,7 +142,8 @@ AC_DEFUN([_WX_PRIVATE_CHECK_VERSION],

dnl ---------------------------------------------------------------------------
dnl WX_CONFIG_CHECK(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
dnl [, WX-LIBS [, ADDITIONAL-WX-CONFIG-FLAGS]]]])
dnl [, WX-LIBS [, ADDITIONAL-WX-CONFIG-FLAGS
dnl [, WX-OPTIONAL-LIBS]]]]])
dnl
dnl Test for wxWidgets, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC
dnl (the latter is for static linking against wxWidgets). Set WX_CONFIG_NAME
Expand All @@ -159,6 +160,10 @@ dnl Optional ADDITIONAL-WX-CONFIG-FLAGS argument is appended to wx-config
dnl invocation command in present. It can be used to fine-tune lookup of
dnl best wxWidgets build available.
dnl
dnl Optional WX-OPTIONAL-LIBS argument contains comma- or space-separated list
dnl of wxWidgets libraries to link against if they are available.
dnl WX-OPTIONAL-LIBS is supported on version 2.9.0 and later.
dnl
dnl Example use:
dnl WX_CONFIG_CHECK([2.6.0], [wxWin=1], [wxWin=0], [html,core,net]
dnl [--unicode --debug])
Expand Down Expand Up @@ -210,8 +215,8 @@ AC_DEFUN([WX_CONFIG_CHECK],
AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version ($5)])
fi
dnl don't add the libraries ($4) to this variable as this would result in
dnl an error when it's used with --version below
dnl don't add the libraries (4th argument) to this variable as this would
dnl result in an error when it's used with --version below
WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args $5"
WX_VERSION=`$WX_CONFIG_WITH_ARGS --version 2>/dev/null`
Expand All @@ -235,14 +240,20 @@ AC_DEFUN([WX_CONFIG_CHECK],
if test -n "$wx_ver_ok"; then
AC_MSG_RESULT(yes (version $WX_VERSION))
WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs $4`
wx_optional_libs=""
_WX_PRIVATE_CHECK_VERSION(2,9,0)
if test -n "$wx_ver_ok" -a -n "$6"; then
wx_optional_libs="--optional-libs $6"
fi
WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs $4 $wx_optional_libs`
dnl is this even still appropriate? --static is a real option now
dnl and WX_CONFIG_WITH_ARGS is likely to contain it if that is
dnl what the user actually wants, making this redundant at best.
dnl For now keep it in case anyone actually used it in the past.
AC_MSG_CHECKING([for wxWidgets static library])
WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs $4 2>/dev/null`
WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs $4 $wx_optional_libs 2>/dev/null`
if test "x$WX_LIBS_STATIC" = "x"; then
AC_MSG_RESULT(no)
else
Expand Down Expand Up @@ -505,7 +516,7 @@ dnl $5 = additional action to do in case option is given with "yes" value
dnl ---------------------------------------------------------------------------
AC_DEFUN([WX_ARG_ENABLE_YESNOAUTO],
[AC_ARG_ENABLE($1,
AC_HELP_STRING([--enable-$1], [$3 (default is $4)]),
AS_HELP_STRING([--enable-$1],[$3 (default is $4)]),
[], [enableval="$4"])
dnl Show a message to the user about this option
Expand All @@ -519,7 +530,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)
Expand All @@ -529,7 +540,7 @@ AC_DEFUN([WX_ARG_ENABLE_YESNOAUTO],

AC_DEFUN([WX_ARG_WITH_YESNOAUTO],
[AC_ARG_WITH($1,
AC_HELP_STRING([--with-$1], [$3 (default is $4)]),
AS_HELP_STRING([--with-$1],[$3 (default is $4)]),
[], [withval="$4"])
dnl Show a message to the user about this option
Expand All @@ -545,7 +556,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)
Expand Down Expand Up @@ -589,25 +600,24 @@ AC_DEFUN([WX_STANDARD_OPTIONS],
ifelse(index([$1], [toolkit]), [-1],,
[
AC_ARG_WITH([toolkit],
AC_HELP_STRING([--with-toolkit],
[Build against a specific wxWidgets toolkit (default is auto)]),
AS_HELP_STRING([--with-toolkit],[Build against a specific wxWidgets toolkit (default is auto)]),
[], [withval="auto"])
dnl Show a message to the user about this option
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"
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
"$TOOLKIT" != "dfb" -a "$TOOLKIT" != "x11" -a "$TOOLKIT" != "base"; 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, base)
])
fi
Expand Down Expand Up @@ -663,15 +673,14 @@ AC_DEFUN([WX_STANDARD_OPTIONS],
ifelse(index([$1], [wxversion]), [-1],,
[
AC_ARG_WITH([wxversion],
AC_HELP_STRING([--with-wxversion],
[Build against a specific version of wxWidgets (default is auto)]),
AS_HELP_STRING([--with-wxversion],[Build against a specific version of wxWidgets (default is auto)]),
[], [withval="auto"])
dnl Show a message to the user about this option
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 | \
Expand Down Expand Up @@ -706,7 +715,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],
Expand All @@ -730,11 +739,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
Expand All @@ -748,16 +757,16 @@ 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 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
Expand All @@ -772,11 +781,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
Expand Down Expand Up @@ -823,19 +830,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
Expand All @@ -858,30 +862,34 @@ 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
AC_MSG_CHECKING([which wxWidgets toolkit was selected])
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.*")
WX_OSXCARBONPORT=$(expr "$WX_SELECTEDCONFIG" : ".*osx_carbon.*")
WX_X11PORT=$(expr "$WX_SELECTEDCONFIG" : ".*x11.*")
WX_DFBPORT=$(expr "$WX_SELECTEDCONFIG" : ".*dfb.*")
WX_BASEPORT=$(expr "$WX_SELECTEDCONFIG" : ".*base.*")
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
if test "$WX_OSXCARBONPORT" != "0"; then WX_PORT="osx_carbon"; fi
if test "$WX_X11PORT" != "0"; then WX_PORT="x11"; fi
if test "$WX_DFBPORT" != "0"; then WX_PORT="dfb"; fi
if test "$WX_BASEPORT" != "0"; then WX_PORT="base"; fi
dnl NOTE: backward-compatible check for wx2.8; in wx2.9 the mac
dnl ports are called 'osx_cocoa' and 'osx_carbon' (see above)
Expand All @@ -899,14 +907,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)
Expand Down Expand Up @@ -937,35 +939,29 @@ 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
DEBUG=$WX_DEBUG
fi
if test "$UNICODE" = "auto"; then
dnl now we can finally update the options to their final values if they
dnl were not already set
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
dnl in case the user needs a BUILD=debug/release var...
if test "$DEBUG" = "1"; then
BUILD="debug"
elif test "$DEBUG" = "0" -o "$DEBUG" = ""; then
BUILD="release"
fi
dnl respect the DEBUG variable adding the optimize/debug flags
dnl respect the DEBUG variable adding the optimize/debug flags and also
dnl define a BUILD variable in case the user wants to use it
dnl
dnl NOTE: the CXXFLAGS are merged together with the CPPFLAGS so we
dnl don't need to set them, too
if test "$DEBUG" = "1"; then
BUILD="debug"
CXXFLAGS="$CXXFLAGS -g -O0"
CFLAGS="$CFLAGS -g -O0"
else
elif test "$DEBUG" = "0"; then
BUILD="release"
CXXFLAGS="$CXXFLAGS -O2"
CFLAGS="$CFLAGS -O2"
fi
Expand Down

0 comments on commit f9905b0

Please sign in to comment.