X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5ff72dc4237107e7a1e65c54069f7c00a4f58a15..e926f2efc7d2f19c869d660d71f58bc413c81350:/wxwin.m4 diff --git a/wxwin.m4 b/wxwin.m4 index 41910b959c..c287fc609d 100644 --- a/wxwin.m4 +++ b/wxwin.m4 @@ -33,7 +33,7 @@ dnl adds support for --wx-prefix, --wx-exec-prefix, --with-wxdir and dnl --wx-config command line options dnl --------------------------------------------------------------------------- -AC_DEFUN(AM_OPTIONS_WXCONFIG, +AC_DEFUN([AM_OPTIONS_WXCONFIG], [ AC_ARG_WITH(wxdir, [ --with-wxdir=PATH Use uninstalled version of wxWindows in PATH], @@ -52,19 +52,33 @@ AC_DEFUN(AM_OPTIONS_WXCONFIG, ]) dnl --------------------------------------------------------------------------- -dnl AM_PATH_WXCONFIG(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl AM_PATH_WXCONFIG(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND +dnl [, WX-LIBS [, ADDITIONAL-WX-CONFIG-FLAGS]]]]) 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 Optional WX-LIBS argument contains comma- or space-separated list of +dnl wxWindows libraries to link against (it may include contrib libraries). If +dnl it is not specified then WX_LIBS and WX_LIBS_STATIC will contain flags to +dnl link with all of the core wxWindows libraries. +dnl +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 Example use: +dnl AM_PATH_WXCONFIG([2.6.0], [wxWin=1], [wxWin=0], [html,core,net] +dnl [--unicode --debug]) dnl --------------------------------------------------------------------------- dnl dnl Get the cflags and libraries from the wx-config script dnl -AC_DEFUN(AM_PATH_WXCONFIG, +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 @@ -84,6 +98,9 @@ AC_DEFUN(AM_PATH_WXCONFIG, wx_config_args="$wx_config_args --prefix=$wx_config_prefix" WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin" fi + if test "$cross_compiling" = "yes"; then + wx_config_args="$wx_config_args --host=$host_alias" + fi dnl don't search the PATH if WX_CONFIG_NAME is absolute filename if test -x "$WX_CONFIG_NAME" ; then @@ -96,14 +113,17 @@ AC_DEFUN(AM_PATH_WXCONFIG, 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) + 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 | \ @@ -119,27 +139,40 @@ 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 + if test -n "$wx_ver_ok"; then + + AC_MSG_RESULT(yes (version $WX_VERSION)) WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs` - WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --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 wxWindows static library]) + WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs 2>/dev/null` + if test "x$WX_LIBS_STATIC" = "x"; then + AC_MSG_RESULT(no) + else + AC_MSG_RESULT(yes) + fi dnl starting with version 2.2.6 wx-config has --cppflags argument wx_has_cppflags="" @@ -176,12 +209,11 @@ AC_DEFUN(AM_PATH_WXCONFIG, 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]) + ifelse([$2], , :, [$2]) + else + if test "x$WX_VERSION" = x; then dnl no wx-config at all AC_MSG_RESULT(no) @@ -195,6 +227,7 @@ AC_DEFUN(AM_PATH_WXCONFIG, WX_LIBS="" WX_LIBS_STATIC="" ifelse([$3], , :, [$3]) + fi fi