configure.in

- add AC_HELP_STRING formatting
   - add --enable-profile flag, must be used to ensure that search performance
     does not degrade over time
   - debug is disabled by default
   - switch to wxwidgets 2.6

m4/wxwin.m4 : update to wxwidgets 2.6 m4 macro
This commit is contained in:
Antoine Fraboulet 2006-01-01 19:23:05 +00:00
parent 3ecf740432
commit ce94c42724
2 changed files with 232 additions and 85 deletions

View file

@ -33,17 +33,22 @@ if test "${ac_cv_c_Wall}" != "no"; then
fi fi
dnl Debug mode dnl Debug mode
AC_ARG_ENABLE(debug, AC_ARG_ENABLE([debug],AC_HELP_STRING([--enable-debug],[debug mode (default disabled)]))
[ --enable-debug debug mode (default enabled)]) if test "${enable_debug}" = "yes"; then
if test "${enable_debug}" != "no"; then CFLAGS="${CFLAGS} -g -DDEBUG"
CPPFLAGS="${CPPFLAGS} -DDEBUG" CPPFLAGS="${CPPFLAGS} -g -DDEBUG"
dnl CFLAGS="${CFLAGS} -O0"
dnl CXXFLAGS="${CXXFLAGS} -O0"
fi fi
dnl Regexp build dnl Profile mode
AC_ARG_ENABLE(dictools, AC_ARG_ENABLE([profile],AC_HELP_STRING([--enable-profile],[profile mode (default disabled)]))
[ --enable-dictools build independant dictionary tools (default enabled)]) if test "${enable_profile}" = "yes"; then
CFLAGS="${CFLAGS} -pg -DPROFILE"
CPPFLAGS="${CPPFLAGS} -pg -DPROFILE"
LDFLAGS="${LDFLAGS} -pg"
fi
dnl Regexp / Listdic / Compdic build enable
AC_ARG_ENABLE([dictools],AC_HELP_STRING([--enable-dictools],[build independant dictionary tools (default enabled)]))
AM_PROG_LEX AM_PROG_LEX
AC_PROG_YACC AC_PROG_YACC
AM_CONDITIONAL([BUILD_DICTOOLS], [test "${enable_dictools}" != "no"]) AM_CONDITIONAL([BUILD_DICTOOLS], [test "${enable_dictools}" != "no"])
@ -78,12 +83,11 @@ dnl Checks for libraries.
dnl -------------------------------------------------------------- dnl --------------------------------------------------------------
dnl Check for wxWidgets dnl Check for wxWidgets
AC_ARG_ENABLE(wxwidgets, AC_ARG_ENABLE([wxwidgets],AC_HELP_STRING([--enable-wxwidgets],[wxWidgets interface support (default disabled)]))
[ --enable-wxwidgets wxWidgets interface support (default disabled)])
if test "${enable_wxwidgets}" = "yes" if test "${enable_wxwidgets}" = "yes"
then then
AM_PATH_WXCONFIG(2.4.0, wxwin=1) AM_PATH_WXCONFIG(2.6.0, wxWin=1)
if test "${wxwin}" != 1; then if test "${wxWin}" != 1; then
AC_MSG_ERROR([ AC_MSG_ERROR([
wxWidgets must be installed on your system wxWidgets must be installed on your system
but wx-config script couldn't be found. but wx-config script couldn't be found.
@ -91,7 +95,7 @@ then
Please check that wx-config is in path, the directory Please check that wx-config is in path, the directory
where wxWidgets libraries are installed (returned by where wxWidgets libraries are installed (returned by
'wx-config --libs' command) is in LD_LIBRARY_PATH or 'wx-config --libs' command) is in LD_LIBRARY_PATH or
equivalent variable and wxWindows version is 2.4.0 or above. equivalent variable and wxWidgets version is 2.3.4 or above.
]) ])
fi fi
AM_CPPFLAGS="$AM_CPPFLAGS $WX_CPPFLAGS" AM_CPPFLAGS="$AM_CPPFLAGS $WX_CPPFLAGS"
@ -99,11 +103,10 @@ then
AM_CFLAGS="$AM_CFLAGS $WX_CFLAGS_ONLY" AM_CFLAGS="$AM_CFLAGS $WX_CFLAGS_ONLY"
AM_LDFLAGS="$AM_LDFLAGS $WX_LIBS" AM_LDFLAGS="$AM_LDFLAGS $WX_LIBS"
fi fi
AM_CONDITIONAL([BUILD_WXWIDGETS], [test "${wxwin}" = "1"]) AM_CONDITIONAL([BUILD_WXWIDGETS], [test "${wxWin}" = "1"])
dnl Check for ncurses dnl Check for ncurses
AC_ARG_ENABLE(ncurses, AC_ARG_ENABLE([ncurses],AC_HELP_STRING([--enable-ncurses],[ncurses interface support (default disabled)]))
[ --enable-ncurses ncurses interface support (default disabled)])
if test "${enable_ncurses}" = "yes" if test "${enable_ncurses}" = "yes"
then then
AC_CHECK_HEADERS(ncurses.h, want_ncurses=1, AC_CHECK_HEADERS(ncurses.h, want_ncurses=1,
@ -112,8 +115,7 @@ fi
AM_CONDITIONAL([BUILD_NCURSES], [test "${want_ncurses}" = "1"]) AM_CONDITIONAL([BUILD_NCURSES], [test "${want_ncurses}" = "1"])
dnl Enable/disable text version dnl Enable/disable text version
AC_ARG_ENABLE(text, AC_ARG_ENABLE([text],AC_HELP_STRING([--enable-text],[text interface support (default enabled)]))
[ --enable-text text interface support (default enabled)])
if test "${enable_text}" != "no" if test "${enable_text}" != "no"
then then
AC_CHECK_HEADERS(readline/readline.h, want_text=1, AC_CHECK_HEADERS(readline/readline.h, want_text=1,

View file

@ -1,5 +1,5 @@
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl Macros for wxWindows detection. Typically used in configure.in as: dnl Macros for wxWidgets detection. Typically used in configure.in as:
dnl dnl
dnl AC_ARG_ENABLE(...) dnl AC_ARG_ENABLE(...)
dnl AC_ARG_WITH(...) dnl AC_ARG_WITH(...)
@ -7,50 +7,96 @@ dnl ...
dnl AM_OPTIONS_WXCONFIG dnl AM_OPTIONS_WXCONFIG
dnl ... dnl ...
dnl ... dnl ...
dnl AM_PATH_WXCONFIG(2.3.4, wxWin=1) dnl AM_PATH_WXCONFIG(2.6.0, wxWin=1)
dnl if test "$wxWin" != 1; then dnl if test "$wxWin" != 1; then
dnl AC_MSG_ERROR([ dnl AC_MSG_ERROR([
dnl wxWindows must be installed on your system dnl wxWidgets must be installed on your system
dnl but wx-config script couldn't be found. dnl but wx-config script couldn't be found.
dnl dnl
dnl Please check that wx-config is in path, the directory dnl Please check that wx-config is in path, the directory
dnl where wxWindows libraries are installed (returned by dnl where wxWidgets libraries are installed (returned by
dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or
dnl equivalent variable and wxWindows version is 2.3.4 or above. dnl equivalent variable and wxWidgets version is 2.3.4 or above.
dnl ]) dnl ])
dnl fi dnl fi
dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY" dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY" dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
dnl dnl
dnl LDFLAGS="$LDFLAGS $WX_LIBS" dnl LIBS="$LIBS $WX_LIBS"
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl AM_OPTIONS_WXCONFIG dnl AM_OPTIONS_WXCONFIG
dnl dnl
dnl adds support for --wx-prefix, --wx-exec-prefix and --wx-config dnl adds support for --wx-prefix, --wx-exec-prefix, --with-wxdir and
dnl command line options dnl --wx-config command line options
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
AC_DEFUN([AM_OPTIONS_WXCONFIG], AC_DEFUN([AM_OPTIONS_WXCONFIG],
[ [
AC_ARG_WITH(wx-prefix, [ --with-wx-prefix=PREFIX Prefix where wxWindows is installed (optional)], AC_ARG_WITH(wxdir,
[ --with-wxdir=PATH Use uninstalled version of wxWidgets in PATH],
[ wx_config_name="$withval/wx-config"
wx_config_args="--inplace"])
AC_ARG_WITH(wx-config,
[ --with-wx-config=CONFIG wx-config script to use (optional)],
wx_config_name="$withval" )
AC_ARG_WITH(wx-prefix,
[ --with-wx-prefix=PREFIX Prefix where wxWidgets is installed (optional)],
wx_config_prefix="$withval", wx_config_prefix="") wx_config_prefix="$withval", wx_config_prefix="")
AC_ARG_WITH(wx-exec-prefix,[ --with-wx-exec-prefix=PREFIX Exec prefix where wxWindows is installed (optional)], AC_ARG_WITH(wx-exec-prefix,
[ --with-wx-exec-prefix=PREFIX
Exec prefix where wxWidgets is installed (optional)],
wx_config_exec_prefix="$withval", wx_config_exec_prefix="") wx_config_exec_prefix="$withval", wx_config_exec_prefix="")
AC_ARG_WITH(wx-config,[ --with-wx-config=CONFIG wx-config script to use (optional)], ])
wx_config_name="$withval", wx_config_name="")
dnl Helper macro for checking if wx version is at least $1.$2.$3, set's
dnl wx_ver_ok=yes if it is:
AC_DEFUN([_WX_PRIVATE_CHECK_VERSION],
[
wx_ver_ok=""
if test "x$WX_VERSION" != x ; then
if test $wx_config_major_version -gt $1; then
wx_ver_ok=yes
else
if test $wx_config_major_version -eq $1; then
if test $wx_config_minor_version -gt $2; then
wx_ver_ok=yes
else
if test $wx_config_minor_version -eq $2; then
if test $wx_config_micro_version -ge $3; then
wx_ver_ok=yes
fi
fi
fi
fi
fi
fi
]) ])
dnl --------------------------------------------------------------------------- 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
dnl Test for wxWindows, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC dnl Test for wxWidgets, 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 (the latter is for static linking against wxWidgets). Set WX_CONFIG_NAME
dnl environment variable to override the default name of the wx-config script 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 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 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 wxWidgets 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 wxWidgets 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 dnl
@ -62,6 +108,7 @@ AC_DEFUN([AM_PATH_WXCONFIG],
if test x${WX_CONFIG_NAME+set} != xset ; then if test x${WX_CONFIG_NAME+set} != xset ; then
WX_CONFIG_NAME=wx-config WX_CONFIG_NAME=wx-config
fi fi
if test "x$wx_config_name" != x ; then if test "x$wx_config_name" != x ; then
WX_CONFIG_NAME="$wx_config_name" WX_CONFIG_NAME="$wx_config_name"
fi fi
@ -75,6 +122,9 @@ AC_DEFUN([AM_PATH_WXCONFIG],
wx_config_args="$wx_config_args --prefix=$wx_config_prefix" wx_config_args="$wx_config_args --prefix=$wx_config_prefix"
WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin" WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin"
fi 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 dnl don't search the PATH if WX_CONFIG_NAME is absolute filename
if test -x "$WX_CONFIG_NAME" ; then if test -x "$WX_CONFIG_NAME" ; then
@ -87,14 +137,17 @@ AC_DEFUN([AM_PATH_WXCONFIG],
if test "$WX_CONFIG_PATH" != "no" ; then if test "$WX_CONFIG_PATH" != "no" ; then
WX_VERSION="" WX_VERSION=""
no_wx=""
min_wx_version=ifelse([$1], ,2.2.1,$1) 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 wxWidgets version >= $min_wx_version])
else
AC_MSG_CHECKING([for wxWidgets 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 | \ wx_config_major_version=`echo $WX_VERSION | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
wx_config_minor_version=`echo $WX_VERSION | \ wx_config_minor_version=`echo $WX_VERSION | \
@ -109,28 +162,26 @@ AC_DEFUN([AM_PATH_WXCONFIG],
wx_requested_micro_version=`echo $min_wx_version | \ wx_requested_micro_version=`echo $min_wx_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
wx_ver_ok="" _WX_PRIVATE_CHECK_VERSION([$wx_requested_major_version],
if test $wx_config_major_version -gt $wx_requested_major_version; then [$wx_requested_minor_version],
wx_ver_ok=yes [$wx_requested_micro_version])
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
if test "x$wx_ver_ok" = x ; then if test -n "$wx_ver_ok"; then
no_wx=yes
else AC_MSG_RESULT(yes (version $WX_VERSION))
WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs` 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 wxWidgets 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 dnl starting with version 2.2.6 wx-config has --cppflags argument
wx_has_cppflags="" wx_has_cppflags=""
@ -167,12 +218,11 @@ AC_DEFUN([AM_PATH_WXCONFIG],
WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"` WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"`
WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"` WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"`
fi fi
fi
if test "x$no_wx" = x ; then
AC_MSG_RESULT(yes (version $WX_VERSION))
ifelse([$2], , :, [$2]) ifelse([$2], , :, [$2])
else else
if test "x$WX_VERSION" = x; then if test "x$WX_VERSION" = x; then
dnl no wx-config at all dnl no wx-config at all
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
@ -186,7 +236,17 @@ AC_DEFUN([AM_PATH_WXCONFIG],
WX_LIBS="" WX_LIBS=""
WX_LIBS_STATIC="" WX_LIBS_STATIC=""
ifelse([$3], , :, [$3]) ifelse([$3], , :, [$3])
fi fi
else
WX_CFLAGS=""
WX_CPPFLAGS=""
WX_CXXFLAGS=""
WX_LIBS=""
WX_LIBS_STATIC=""
ifelse([$3], , :, [$3])
fi fi
AC_SUBST(WX_CPPFLAGS) AC_SUBST(WX_CPPFLAGS)
@ -198,3 +258,88 @@ AC_DEFUN([AM_PATH_WXCONFIG],
AC_SUBST(WX_LIBS_STATIC) AC_SUBST(WX_LIBS_STATIC)
AC_SUBST(WX_VERSION) AC_SUBST(WX_VERSION)
]) ])
dnl ---------------------------------------------------------------------------
dnl Get information on the wxrc program for making C++, Python and xrs
dnl resource files.
dnl
dnl AC_ARG_ENABLE(...)
dnl AC_ARG_WITH(...)
dnl ...
dnl AM_OPTIONS_WXCONFIG
dnl AM_OPTIONS_WXRC
dnl ...
dnl AM_PATH_WXCONFIG(2.6.0, wxWin=1)
dnl if test "$wxWin" != 1; then
dnl AC_MSG_ERROR([
dnl wxWidgets must be installed on your system
dnl but wx-config script couldn't be found.
dnl
dnl Please check that wx-config is in path, the directory
dnl where wxWidgets libraries are installed (returned by
dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or
dnl equivalent variable and wxWidgets version is 2.6.0 or above.
dnl ])
dnl fi
dnl
dnl AM_PATH_WXRC([HAVE_WXRC=1], [HAVE_WXRC=0])
dnl if test "x$HAVE_WXRC" != x1; then
dnl AC_MSG_ERROR([
dnl The wxrc program was not installed or not found.
dnl
dnl Please check the wxWidgets installation.
dnl ])
dnl fi
dnl
dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
dnl
dnl LDFLAGS="$LDFLAGS $WX_LIBS"
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl AM_PATH_WXRC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl Test for wxWidgets' wxrc program for creating either C++, Python or XRS
dnl resources. The variable WXRC will be set and substituted in the configure
dnl script and Makefiles.
dnl
dnl Example use:
dnl AM_PATH_WXRC([wxrc=1], [wxrc=0])
dnl ---------------------------------------------------------------------------
dnl
dnl wxrc program from the wx-config script
dnl
AC_DEFUN([AM_PATH_WXRC],
[
AC_ARG_VAR([WXRC], [Path to wxWidget's wxrc resource compiler])
if test "x$WX_CONFIG_NAME" = x; then
AC_MSG_ERROR([The wxrc tests must run after wxWidgets test.])
else
AC_MSG_CHECKING([for wxrc])
if test "x$WXRC" = x ; then
dnl wx-config --utility is a new addition to wxWidgets:
_WX_PRIVATE_CHECK_VERSION(2,5,3)
if test -n "$wx_ver_ok"; then
WXRC=`$WX_CONFIG_WITH_ARGS --utility=wxrc`
fi
fi
if test "x$WXRC" = x ; then
AC_MSG_RESULT([not found])
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT([$WXRC])
ifelse([$1], , :, [$1])
fi
AC_SUBST(WXRC)
fi
])