From: Francesco M. <fr...@us...> - 2007-07-26 22:08:37
|
Update of /cvsroot/wxlua/wxLua/build/autoconf In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv31205/build/autoconf Added Files: utils.m4 wxcodecheck.m4 Log Message: added the M4 macro files which were missing --- NEW FILE: utils.m4 --- dnl --------------------------------------------------------------------------- dnl Author: Francesco Montorsi dnl Creation date: 20/3/2007 dnl RCS-ID: $Id: utils.m4,v 1.1 2007/07/26 22:08:11 frm Exp $ dnl Purpose: Some generic M4 utilities dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- dnl UTILS_YESNO_OPTCHECK([name of the boolean variable to set], dnl [name of the --enable-option variable with yes/no values], dnl [name of the --enable option]) dnl dnl Converts the $3 variable, suppose to contain a yes/no value to a 1/0 dnl boolean variable and saves the result into $1. dnl Outputs also the standard checking-option message. dnl --------------------------------------------------------------------------- AC_DEFUN([UTILS_YESNO_OPTCHECK], [ AC_MSG_CHECKING([for the $3 option]) if [[ "x$$2" = "xyes" ]]; then AC_MSG_RESULT([yes]) $1=1 else AC_MSG_RESULT([no]) $1=0 fi ]) dnl --------------------------------------------------------------------------- dnl UTILS_BOOLOPT_SUMMARY([name of the boolean variable to show summary for], dnl [what to print when var is 1], dnl [what to print when var is 0]) dnl dnl Prints $2 when variable $1 == 1 and prints $3 when variable $1 == 0. dnl This macro mainly exists just to make configure.ac scripts more readable. dnl dnl NOTE: you need to use the [" my message"] syntax for 2nd and 3rd arguments dnl if you want that M4 avoid to throw away the spaces prefixed to the dnl argument value. dnl --------------------------------------------------------------------------- AC_DEFUN([UTILS_BOOLOPT_SUMMARY], [ if [[ "x$$1" = "x1" ]]; then echo $2 elif [[ "x$$1" = "x0" ]]; then echo $3 else echo "$1 is $$1" fi ]) # same as UTILS_BOOLOPT_SUMMARY but takes 2 bool options AC_DEFUN([UTILS_2BOOLOPT_SUMMARY], [ if [[ "x$$1" = "x1" -a "x$$2" = "x1" ]]; then echo $3 elif [[ "x$$1" = "x0" -o "x$$2" = "x0" ]]; then echo $4 else echo "$1 is $$1; $2 is $$2" fi ]) # same as UTILS_BOOLOPT_SUMMARY but takes 3 bool options AC_DEFUN([UTILS_3BOOLOPT_SUMMARY], [ if [[ "x$$1" = "x1" -a "x$$2" = "x1" -a "x$$3" = "x1" ]]; then echo $4 elif [[ "x$$1" = "x0" -o "x$$2" = "x0" -o "x$$3" = "x0" ]]; then echo $5 else echo "$1 is $$1; $2 is $$2; $3 is $$3" fi ]) dnl --------------------------------------------------------------------------- dnl UTILS_SAVE_COREVAR() dnl dnl Saves the CPPFLAGS, CXXFLAGS, CFLAGS and LIBS variables in some helper dnl variables which are used to restore them later (see UTILS_RESTORE_COREVAR) dnl --------------------------------------------------------------------------- AC_DEFUN([UTILS_SAVE_COREVAR], [ SAVED_CPPFLAGS="$CPPFLAGS" SAVED_CXXFLAGS="$CXXFLAGS" SAVED_CFLAGS="$CFLAGS" SAVED_LIBS="$LIBS" ]) dnl --------------------------------------------------------------------------- dnl UTILS_RESTORE_COREVAR() dnl dnl Loads into the CPPFLAGS, CXXFLAGS, CFLAGS and LIBS variables the values dnl of the helper variables set by UTILS_SAVE_COREVAR dnl --------------------------------------------------------------------------- AC_DEFUN([UTILS_RESTORE_COREVAR], [ CPPFLAGS="$SAVED_CPPFLAGS" CXXFLAGS="$SAVED_CXXFLAGS" CFLAGS="$SAVED_CFLAGS" LIBS="$SAVED_LIBS" ]) --- NEW FILE: wxcodecheck.m4 --- dnl --------------------------------------------------------------------------- dnl Author: Francesco Montorsi dnl Creation date: 14/9/2005 dnl RCS-ID: $Id: wxcodecheck.m4,v 1.1 2007/07/26 22:08:11 frm Exp $ dnl Purpose: Contains M4 macros intended to be used also by external dnl projects which depends from a wxCode component dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- dnl AM_SAVE_COREVAR() dnl dnl Saves the CPPFLAGS, CXXFLAGS, CFLAGS and LIBS variables in some helper dnl variables which are used to restore them later (see AM_RESTORE_COREVAR) dnl --------------------------------------------------------------------------- AC_DEFUN([AM_SAVE_COREVAR], [ SAVED_CPPFLAGS="$CPPFLAGS" SAVED_CXXFLAGS="$CXXFLAGS" SAVED_CFLAGS="$CFLAGS" SAVED_LIBS="$LIBS" ]) dnl --------------------------------------------------------------------------- dnl AM_RESTORE_COREVAR() dnl dnl Loads into the CPPFLAGS, CXXFLAGS, CFLAGS and LIBS variables the values dnl of the helper variables set by AM_SAVE_COREVAR dnl --------------------------------------------------------------------------- AC_DEFUN([AM_RESTORE_COREVAR], [ CPPFLAGS="$SAVED_CPPFLAGS" CXXFLAGS="$SAVED_CXXFLAGS" CFLAGS="$SAVED_CFLAGS" LIBS="$SAVED_LIBS" ]) dnl --------------------------------------------------------------------------- dnl AM_WXCODE_CHECKFOR_COMPONENT( dnl [name (mixed case) of the component to check], dnl [name of a header of the component to check (with 'wx/' prefix and '.h' suffix)], dnl [name of the library of the component to check (without 'lib' prefix and without .a/.so suffix)], dnl [a C++ line of code that forces the test program to be linked against the component in order to work], dnl [action if found], dnl [action if not found]) dnl dnl Creates a little test program to check for presence of a wxCode component. dnl Note that this macro does not automatically adds anything to the CPPFLAGS, dnl CFLAGS or LIBS variables. dnl --------------------------------------------------------------------------- AC_DEFUN([AM_WXCODE_CHECKFOR_COMPONENT], [ dnl save original flags into support variables AM_SAVE_COREVAR() dnl add to the compilation & link flags the wxWidgets flags dnl (we assume they have been set by AM_WXPRESETS) dnl dnl NOTE: this is very important since the test program dnl we will compile needs to be linked against wx dnl and the configure script will use these *FLAGS dnl variables and it cannot be told to use other flags. dnl dnl NOTE2: we don't want to put into *FLAGS variables the dnl WX_* variable values since the Makefile.in for dnl a wxpresets-based application already merges dnl the *FLAGS contents with WX_* vars dnl dnl NOTE3: the CXXFLAGS are merged with CPPFLAGS and dnl thus we don't need to add the WX_CPPFLAGS to both CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" CFLAGS="$CFLAGS $WX_CFLAGS_ONLY" dnl before WX_LIBS we want the lib of the component to check LIBS="$LIBS -l$3 $WX_LIBS" dnl check for this component presence if test -z "$COMPCHECK_MSG"; then dnl allow customized messages COMPCHECK_MSG="if $1 is available" fi AC_MSG_CHECKING([$COMPCHECK_MSG]) AC_LINK_IFELSE([ AC_LANG_PROGRAM([#include <$2>], [$4]) ], [$1_PRESENCE=1], [$1_PRESENCE=0]) if test "$$1_PRESENCE" = "1"; then AC_MSG_RESULT([yes]) $5 else AC_MSG_RESULT([no]) $6 fi dnl restore the original flags AM_RESTORE_COREVAR() ]) dnl --------------------------------------------------------------------------- dnl AM_WXCODE_CHECKFOR_COMPONENT_VERSION( dnl [name (mixed case) of the component to check], dnl [name of a header of the component to check (with 'wx/' prefix and '.h' suffix)], dnl [name of the library of the component to check (without 'lib' prefix and without .a/.so suffix)], dnl [a C++ line of code that forces the test program to be linked against the component in order to work], dnl * [major-version.minor-version], dnl * [versionsym-prefix], dnl * [versionsym-postfix], dnl [action if found], dnl [action if not found]) dnl dnl Like AM_WXCODE_CHECKFOR_COMPONENT (the only new arguments it takes are marked dnl with *) but also includes a version check against the component to check for. dnl Note that the given version MUST be composed of three digits separed by a dot, dnl i.e. a string in form "1.2.3" which will be checked against the string dnl dnl [versionsym-prefix]MAJOR[versionsym-postfix].\ dnl [versionsym-prefix]MINOR[versionsym-postfix].\ dnl [versionsym-prefix]RELEASE[versionsym-postfix] dnl dnl where *MAJOR*, *MINOR* and *RELEASE* are three symbols which should have dnl been #defined in the compdef.h header file (see template/include/wx/mycompdef.h). dnl --------------------------------------------------------------------------- AC_DEFUN([AM_WXCODE_CHECKFOR_COMPONENT_VERSION], [ dnl break version string in single digits major=`echo $5 | sed 's/\([[0-9]]\).\([[0-9]]\).\([[0-9]]\)/\1/'` minor=`echo $5 | sed 's/\([[0-9]]\).\([[0-9]]\).\([[0-9]]\)/\2/'` release=`echo $5 | sed 's/\([[0-9]]\).\([[0-9]]\).\([[0-9]]\)/\3/'` dnl cache the symbol names majsym="$6""MAJOR""$7" minsym="$6""MINOR""$7" relsym="$6""RELEASE""$7" dnl call our base macro adding the version check COMPCHECK_MSG="if $1 (version >= $5) is available" AM_WXCODE_CHECKFOR_COMPONENT([$1], [$2], [$3], [ $4 // version check #if defined($majsym) && defined($minsym) && defined($relsym) #if ($majsym > ($major) || \ ($majsym == ($major) && $minsym > ($minor)) || \ ($majsym == ($major) && $minsym == ($minor) && $relsym >= ($release))) // this component is recent enough #else #error $1 is too old ! At least version $5 is required #endif #else #error $1 does not define its version symbols $majsym, $minsym, $relsym #endif ], [$8], [$9]) ]) |