dnl --------------------------------------------------------------------------- dnl Support macros for makefiles generated by BAKEFILE. dnl --------------------------------------------------------------------------- dnl Lots of compiler & linker flags detection code contained here was taken from dnl wxWindows configure.in script (see http://www.wxwindows.org) dnl --------------------------------------------------------------------------- dnl AC_BAKEFILE_GNUMAKE dnl dnl Detects GNU make dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BUILDER_OPTIONS], [ dnl default options for modules: --enable-debug and --enable-shared #AC_CANONICAL_SYSTEM AC_PROG_CXX AC_BAKEFILE_DEPS AC_ARG_ENABLE(debug,[ --enable-debug compile with debug info]) if test "$enable_debug" == "yes"; then DEBUG=1; CXXFLAGS="-O0 -g3 -ggdb"; DEBUG_SUFFIX="d"; else DEBUG=0; CXXFLAGS="-O2 -g0"; fi; dnl debug suffix is defined in bakefiles too AC_SUBST(DEBUG_SUFFIX) AC_ARG_ENABLE(debug,[ --enable-profile compile with gprof profile info]) if test "$enable_profile" == "yes"; then CXXFLAGS="$CXXFLAGS -pg"; LDFLAGS="$LDFLAGS -pg"; fi; dnl debug suffix is defined in bakefiles too AC_SUBST(DEBUG_SUFFIX) AC_ARG_ENABLE(shared,[ --enable-shared compile shared library]) if test "$enable_shared" == "yes"; then SHARED=1; else SHARED=0; fi dnl all out mouldes should use cppunit to compile AC_ARG_ENABLE(tests,[ --enable-tests compile additional cppunit tests]) if test "$enable_tests" == "yes"; then AM_PATH_CPPUNIT(1.9.0) TESTS=1 else TESTS=0; fi; AC_SUBST(TESTS) dnl all out mouldes should use cppunit to compile AC_ARG_ENABLE(docs,[ --enable-docs generate documentation]) if test "$enable_docs" == "yes"; then DOCS=1 else DOCS=0; fi; AC_SUBST(DOCS) ]) dnl ------------------------------------------------------------------------------------ dnl AC_BUILDER_CUSTOM_LIB(MINIMUM-VERSION, CONFIGNAME, CFLAGS_SWITCH, LIBS_SWITCH, SUBST_NAME, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl ------------------------------------------------------------------------------------ AC_DEFUN([AC_BUILDER_CUSTOM_LIB], [ #set -x builder_lib_name=$2 builder_lib_config=$builder_lib_name-config no_prog="" AC_MSG_CHECKING([$2 library]) witharg=with_${builder_lib_name}_config; eval withval=\$$witharg; #set |grep with; if test "$withval" != "yes" -a "$withval" != ""; then BUILDER_LIB_CONFIG_PROG=$withval else if test "$BUILDER_LIB_CONFIG_PROG" == ""; then if which $builder_lib_config 2> /dev/null; then BUILDER_LIB_CONFIG_PROG=$builder_lib_config; else AC_MSG_RESULT([not found]) no_prog=yes BUILDER_LIB_CONFIG_PROG=no; fi fi fi lib_version_min=$1 if test "$BUILDER_LIB_CONFIG_PROG" = "no" ; then no_prog=yes else AC_MSG_CHECKING(for $builder_lib_config - version >= $lib_version_min) $5_CXXFLAGS=`$BUILDER_LIB_CONFIG_PROG $3` $5_LIBS=`$BUILDER_LIB_CONFIG_PROG $4` builder_lib_version=`$BUILDER_LIB_CONFIG_PROG --version` builder_lib_major_version=`echo $builder_lib_version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` builder_lib_minor_version=`echo $builder_lib_version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` builder_lib_micro_version=`echo $builder_lib_version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` builder_lib_major_min=`echo $lib_version_min | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` builder_lib_minor_min=`echo $lib_version_min | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` builder_lib_micro_min=`echo $lib_version_min | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` builder_lib_version_proper=`expr \ $builder_lib_major_version \> $builder_lib_major_min \| \ $builder_lib_major_version \= $builder_lib_major_min \& \ $builder_lib_minor_version \> $builder_lib_minor_min \| \ $builder_lib_major_version \= $builder_lib_major_min \& \ $builder_lib_minor_version \= $builder_lib_minor_min \& \ $builder_lib_micro_version \>= $builder_lib_micro_min ` if test $? -ne 0; then AC_MSG_ERROR([Cannot parse $builder_lib_version to version number]) fi if test "$builder_lib_version_proper" = "1" ; then AC_MSG_RESULT([$builder_lib_major_version.$builder_lib_minor_version.$builder_lib_micro_version]) else AC_MSG_RESULT(no) no_prog=yes fi fi BUILDER_LIB_CONFIG_PROG="" if test "x$no_prog" = x ; then ifelse([$6], , :, [$6]) else $5_CXXFLAGS="" $5_LIBS="" ifelse([$7], , :, [$7]) fi echo "adding SUBST for $5_CXXFLAGS" AC_SUBST($5_CXXFLAGS) echo "adding SUBST for $5_LIBS" AC_SUBST($5_LIBS) ]) dnl ------------------------------------------------------------------------------------ dnl AC_BUILDER_LIB(MINIMUM-VERSION, LIBNAME, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])) dnl ------------------------------------------------------------------------------------ AC_DEFUN([AC_BUILDER_LIB], [ AC_BUILDER_CUSTOM_LIB([$1],[$2],[--cxxflags],[--libs],[$2],[$3],[$4]) ]) dnl ------------------------------------------------------------------------------------ dnl AC_BUILDER_LIB(MINIMUM-VERSION, LIBNAME, [ACTION-IF-FOUND]) dnl ------------------------------------------------------------------------------------ AC_DEFUN([AC_BUILDER_REQUIRED_LIB], [ AC_BUILDER_LIB([$1],[$2],[$3],[ AC_MSG_ERROR([$2 library not found. Try --with-$2-config.]) ]) ]) AC_DEFUN([AC_BUILDER_WXLIB], [ AM_OPTIONS_WXCONFIG AM_PATH_WXCONFIG([2.8.0], [wxWin=1]) if test "$wxWin" != 1; then AC_MSG_ERROR([ wxWidgets must be installed on your system but wx-config script couldn't be found. Please check that wx-config is in path, the directory where wxWidgets libraries are installed (returned by 'wx-config --libs' command) is in LD_LIBRARY_PATH or equivalent variable and wxWidgets version is 2.8.0 or above. ]) fi #CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" wx_CXXFLAGS="$CXXFLAGS $WX_CPPFLAGS $WX_CXXFLAGS_ONLY" #wx_CFLAGS="$CFLAGS $WX_CFLAGS_ONLY" wx_LIBS="$LDFLAGS $WX_LIBS" wx_type=`$WX_CONFIG_PATH --basename`; echo $wx_CXXFLAGS; if [ echo $wx_type |grep wx_base > /dev/null ]; then AC_MSG_RESULT(wxWidgets compiled without GUI: configuring module for BASE programs) USE_GUI=0; else AC_MSG_RESULT(wxWidgets compiled with GUI: configuring module for GUI programs) USE_GUI=1; fi AC_SUBST(wx_CXXFLAGS) AC_SUBST(wx_LIBS) ]) dnl ------------------------------------------------------------------------------------ dnl AC_BUILDER_CRYPTOPP dnl ------------------------------------------------------------------------------------ dnl adds --with-crypto-headers and --with-crypto-lib to configure and substs cxxflags and libs variables AC_DEFUN([AC_BUILDER_CRYPTOPP], [ AC_ARG_WITH(crypto-headers,[--with-crypto-headers= specify where cryptopp headers are installed],[cryptopp_CXXFLAGS=-I$with_crypto_headers]) AC_ARG_WITH(crypto-lib,[--with-crypto-lib= specify dir where cryptopp library is installed],[cryptopp_LIBS=-L$with_crypto_lib]) cryptopp_LIBS="$cryptopp_LIBS -lcryptopp" AC_SUBST(cryptopp_CXXFLAGS) AC_SUBST(cryptopp_LIBS) ])