[Crystaldoc-cvs] crystaldoc/base/mk/autoconf checkbuild.m4,NONE,1.1 checkcppunit.m4,NONE,1.1 checkli
Status: Alpha
Brought to you by:
vknecht
Update of /cvsroot/crystaldoc/crystaldoc/base/mk/autoconf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10000/base/mk/autoconf Added Files: checkbuild.m4 checkcppunit.m4 checklib.m4 checklibtool.m4 checkpic.m4 checkprog.m4 checkpthread.m4 checkpython.m4 checktt2.m4 compiler.m4 config.guess config.sub crystal.m4 diagnose.m4 embed.m4 emit.m4 headercache.m4 installdirs.m4 install-sh jamcache.m4 Jamfile makecache.m4 mkdir.m4 packageinfo.m4 path.m4 progver.m4 qualify.m4 split.m4 textcache.m4 trim.m4 warnings.m4 Log Message: Addition of autoconf stuff --- NEW FILE: embed.m4 --- # embed.m4 -*- Autoconf -*- #============================================================================== # Copyright (C)2003,2005 by Eric Sunshine <sun...@su...> # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public # License for more details. # # You should have received a copy of the GNU Library General Public License # along with this library; if not, write to the Free Software Foundation, # Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # #============================================================================== AC_PREREQ([2.56]) #------------------------------------------------------------------------------ # CS_META_INFO_EMBED([EMITTER], [GPL-OKAY]) # Determine if plugin meta-information should be embedded or if it should # exist in a stand-alone .csplugin file, and check if necessary tools and # libraries are present. Sets the shell variable # enable_meta_info_embedding to "yes" if the user requested embedding or # if it was enabled by default; otherwise sets it to "no". # # If EMITTER is provided, then a subset of the following variables # (depending upon platform and availability) are recorded by invoking # CS_EMIT_BUILD_PROPERTY() with EMITTER. As a convenience, if EMITTER is # the literal value "emit" or "yes", then CS_EMIT_BUILD_RESULT()'s # default emitter will be used. # # EMBED_META := yes or no # EMBED_META.CFLAGS := compiler flags # EMBED_META.LFLAGS := linker flags # CMD.WINDRES := windres.exe # OBJCOPY.AVAILABLE := yes or no # CMD.OBJCOPY := objcopy.exe # LIBBFD.AVAILABLE := yes or no # LIBBFD.CFLAGS := libbfd compiler flags # LIBBFD.LFLAGS := libbfd linker flags # # In general, clients need only concern themselves with the various # EMBED_META-related variables. For building plugin modules, utilize # EMBED_META.CFLAGS when compiling, and EMBED_META.LFLAGS when linking. # # On Unix, embedding is accomplished via libbfd, which carries a GPL # license. Projects which carry licenses not compatible with GPL should # consider carefully before enabling embedding on Unix. If your project # is GPL-compatible, then set GPL-OKAY to "yes". This will enable # embedding on Unix by default. If not, then set it to "no" in order to # disable embedding on Unix by default. (The user can still override the # setting via the --enable-meta-info-embedding option.) #------------------------------------------------------------------------------ AC_DEFUN([CS_META_INFO_EMBED], [_CS_META_INFO_EMBED_ENABLE([$1], [$2]) AS_IF([test $enable_meta_info_embedding = yes], [_CS_META_INFO_EMBED_TOOLS([$1]) _CS_META_INFO_EMBED_BFD([$1])], [cs_embed_meta_info=no])]) #------------------------------------------------------------------------------ # _CS_META_INFO_EMBED_ENABLE([EMITTER], [GPL-OKAY]) # Helper for CS_META_INFO_EMBED which adds an # --enable-meta-info-embedding option to the configure script allowing # the user to control embedding. Sets the shell variable # enable_meta_info_embedding to yes or no. # # IMPLEMENTATION NOTES # # On Unix, embedding is disabled by default unless overridden via # GPL-OKAY because libbfd carries a GPL license which may be incompatible # with a project's own license (such as LGPL). #------------------------------------------------------------------------------ AC_DEFUN([_CS_META_INFO_EMBED_ENABLE], [AC_REQUIRE([CS_CHECK_HOST]) AC_MSG_CHECKING([whether to embed plugin meta-information]) case $cs_host_target in unix) cs_embed_meta_info_default=m4_default([$2],[no]) ;; *) cs_embed_meta_info_default=yes ;; esac AC_ARG_ENABLE([meta-info-embedding], [AC_HELP_STRING([--enable-meta-info-embedding], [store plugin meta-information directly inside plugin modules if supported by platform; if disabled, meta-information is stored in stand-alone .csplugin files; this is enabled by default for non-Unix platforms, and disabled by default for non-GPL projects on Unix platforms since the Unix implementation requires the GPL-licensed libbfd library; enable this option on Unix only if you are certain you want a GPL-licensed library infecting your project])], [], [enable_meta_info_embedding=$cs_embed_meta_info_default]) AC_MSG_RESULT([$enable_meta_info_embedding]) CS_EMIT_BUILD_PROPERTY([EMBED_META], [$enable_meta_info_embedding], [], [], CS_EMITTER_OPTIONAL([$1]))]) #------------------------------------------------------------------------------ # _CS_META_INFO_EMBED_TOOLS([EMITTER]) # Helper for CS_META_INFO_EMBED() which searches for tools required for # plugin meta-info embedding. #------------------------------------------------------------------------------ AC_DEFUN([_CS_META_INFO_EMBED_TOOLS], [CS_CHECK_TOOLS([WINDRES], [windres]) CS_EMIT_BUILD_PROPERTY([CMD.WINDRES], [$WINDRES], [], [], CS_EMITTER_OPTIONAL([$1])) CS_CHECK_TOOLS([OBJCOPY], [objcopy]) AS_IF([test -n "$OBJCOPY"], [CS_EMIT_BUILD_PROPERTY([OBJCOPY.AVAILABLE], [yes], [], [], CS_EMITTER_OPTIONAL([$1])) CS_EMIT_BUILD_PROPERTY([CMD.OBJCOPY], [$OBJCOPY], [], [], CS_EMITTER_OPTIONAL([$1]))])]) #------------------------------------------------------------------------------ # _CS_META_INFO_EMBED_BFD([EMITTER]) # Helper for CS_EMIT_BUILD_PROPERTY() which checks if libbfd is present # (which is part of GNU binutils). # # WARNING # # libbfd carries a GPL license which is incompatible with the LGPL # license of Crystal Space. On platforms for which libbfd can be used, # we check for and utilize this library only if explicitly requested by # the user via --enable-meta-info-embedding. # # IMPLEMENTATION NOTES # # It seems that some platforms have two version of libiberty installed: # one from binutils and one from gcc. The binutils version resides in # /usr/lib, whereas the gcc version resides in the gcc installation # directory. The gcc version, by default, takes precedence at link time # over the binutils version. Unfortunately, in broken cases, the gcc # version of libiberty is missing htab_create_alloc() which is required # by some libbfd functions. The extensive secondary check of libbfd # catches this anomalous case of broken gcc libiberty. It turns out that # it is possible to make the linker prefer the binutils version by # specifying -L/usr/lib, thus the extensive test attempts to do so in an # effort to resolve this unfortunate issue. # # Furthermore, recent versions of Mingw supply libbfd and libiberty. # Since Crystal Space uses native Win32 API for meta-information # embedding on Windows, we do not require these libraries on Windows. # More importantly, users do not want to see these GPL-licensed libraries # appear in the link statement for plugin modules, thus we explicitly # disable this test on Windows. #------------------------------------------------------------------------------ AC_DEFUN([_CS_META_INFO_EMBED_BFD], [AC_REQUIRE([AC_CANONICAL_HOST]) AS_IF([test $enable_meta_info_embedding = yes], [case $host_os in mingw*|cygwin*) cs_check_libbfd=no ;; *) cs_check_libbfd=yes ;; esac], [cs_check_libbfd=no]) AS_IF([test $cs_check_libbfd = yes], [CS_CHECK_LIB_WITH([bfd], [AC_LANG_PROGRAM([[#include <bfd.h>]], [bfd_init();])], [], [], [], [], [], [], [-liberty])], [cs_cv_libbfd=no]) AS_IF([test $cs_cv_libbfd = yes], [CS_CHECK_BUILD([if libbfd is usable], [cs_cv_libbfd_ok], [AC_LANG_PROGRAM([[#include <bfd.h>]], [bfd* p; asection* s; bfd_init(); p = bfd_openr(0,0); bfd_check_format(p,bfd_object); bfd_get_section_by_name(p,0); bfd_section_size(p,s); bfd_get_section_contents(p,s,0,0,0); bfd_close(p);])], [CS_CREATE_TUPLE() CS_CREATE_TUPLE([],[-L/usr/lib],[])], [], [], [], [], [$cs_cv_libbfd_cflags], [$cs_cv_libbfd_lflags], [$cs_cv_libbfd_libs])], [cs_cv_libbfd_ok=no]) AS_IF([test $cs_cv_libbfd_ok = yes], [CS_EMIT_BUILD_RESULT([cs_cv_libbfd_ok], [LIBBFD], CS_EMITTER_OPTIONAL([$1])) CS_EMIT_BUILD_PROPERTY([EMBED_META.CFLAGS], [$cs_cv_libbfd_ok_cflags], [+], [], CS_EMITTER_OPTIONAL([$1])) CS_EMIT_BUILD_PROPERTY([EMBED_META.LFLAGS], [$cs_cv_libbfd_ok_lflags $cs_cv_libbfd_ok_libs],[+], [], CS_EMITTER_OPTIONAL([$1]))])]) --- NEW FILE: checkbuild.m4 --- # checkbuild.m4 -*- Autoconf -*- #============================================================================== # Copyright (C)2003 by Eric Sunshine <sun...@su...> # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public # License for more details. # # You should have received a copy of the GNU Library General Public License # along with this library; if not, write to the Free Software Foundation, # Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # #============================================================================== AC_PREREQ([2.56]) #------------------------------------------------------------------------------ # CS_SPLIT_TUPLE(TUPLE, OUTPUT-VARIABLES) # Split a build-tuple into its component parts. A build tuple is # constructed by CS_CREATE_TUPLE() and is comprised of compiler flags, # linker flags, and library references. OUTPUT-VARIABLES is a # comma-delimited list of shell variables which should receive the # extracted compiler flags, linker flags, and library references, # respectively. #------------------------------------------------------------------------------ AC_DEFUN([CS_SPLIT_TUPLE], [CS_SPLIT([$1], [cs_dummy,$2], [@]) m4_map([_CS_SPLIT_TUPLE], [$2])]) AC_DEFUN([_CS_SPLIT_TUPLE], [$1=`echo $$1 | sed 'y%@%:@% %'` ]) #------------------------------------------------------------------------------ # CS_CREATE_TUPLE([CFLAGS], [LFLAGS], [LIBS]) # Construct a build-tuple which is comprised of compiler flags, linker # flags, and library references. Build tuples are encoded so as to # preserve whitespace in each component. This makes it possible for # macros (such as CS_BUILD_IFELSE) which employ build tuples to accept # whitespace-delimited lists of tuples, and for shell "for" statements to # iterate over tuple lists without compromising whitespace embedded # within individual flags or library references. #------------------------------------------------------------------------------ AC_DEFUN([CS_CREATE_TUPLE], [`echo @$1@$2@$3 | sed 'y% %@%:@%'`]) #------------------------------------------------------------------------------ # CS_LANG_CFLAGS # Return the literal string CFLAGS if the current language is C. Return # the literal string CXXFLAGS if the current language is C++. Generic # compiler test macros which need to modify or save the compiler flags # can invoke this macro to get the name of the compiler flags environment # variable (either CFLAGS or CXXFLAGS) depending upon the current # language. For example: # CS_LANG_CFLAGS="$CS_LANG_CFLAGS -Wall" # With C, this expands to: # CFLAGS="$CFLAGS -Wall" # With C++, it expands to: # CXXFLAGS="$CXXFLAGS -Wall" #------------------------------------------------------------------------------ AC_DEFUN([CS_LANG_CFLAGS], [AC_LANG_CASE([C], [CFLAGS], [C++], [CXXFLAGS])]) #------------------------------------------------------------------------------ # CS_BUILD_IFELSE([PROGRAM], [FLAGS], [LANGUAGE], [ACTION-IF-BUILT], # [ACTION-IF-NOT-BUILT], [OTHER-CFLAGS], [OTHER-LFLAGS], # [OTHER-LIBS], [INHIBIT-OTHER-FLAGS], [ERROR-REGEX]) # Try building a program using the supplied compiler flags, linker flags, # and library references. PROGRAM is typically a program composed via # AC_LANG_PROGRAM(). PROGRAM may be omitted if you are interested only # in learning if the compiler or linker respects certain flags. LANGUAGE # is typically either C or C++ and specifies which compiler to use for # the test. If LANGUAGE is omitted, C is used. FLAGS is a whitespace # delimited list of build tuples. Tuples are created with # CS_CREATE_TUPLE() and are composed of up to three elements each. The # first element represents compiler flags, the second linker flags, and # the third libraries used when linking the program. Each tuple from # FLAGS is attempted in order. If you want a build attempted with no # special flags prior to builds with specialized flags, create an empty # tuple with CS_CREATE_TUPLE() at the start of the FLAGS list. If the # build is successful, then the shell variables cs_build_ok is set to # "yes", cs_build_cflags, cs_build_lflags, and cs_build_libs are set to # the tuple elements which resulted in the successful build, and # ACTION-IF-BUILT is invoked. Upon successful build, no further tuples # are consulted. If no tuple results in a successful build, then # cs_build_ok is set to "no" and ACTION-IF-NOT-BUILT is invoked. # OTHER-CFLAGS, OTHER-LFLAGS, and OTHER-LIBS specify additional compiler # flags, linker flags, and libraries which should be used with each tuple # build attempt. Upon successful build, these additional flags are also # reflected in the variables cs_build_cflags, cs_build_lflags, and # cs_build_libs unless INHIBIT-OTHER-FLAGS is a non-empty string. The # optional ERROR-REGEX places an additional constraint upon the build # check. If specified, ERROR-REGEX, which is a standard `grep' regular # expression, is applied to output captured from the compiler and linker. # If ERROR-REGEX matches, then the build is deemed a failure, and # cs_build_ok is set to "no". This facility is useful for broken build # tools which emit an error message yet still return success as a result. # In such cases, it should be possible to detect the failure by scanning # the tools' output. # # IMPLEMENTATION NOTES # # In Autoconf 2.57 and earlier, AC_LINK_IFELSE() invokes AC_TRY_EVAL(), # which does not provide access to the captured output. To work around # this limitation, we temporarily re-define AC_TRY_EVAL() as # _AC_EVAL_STDERR(), which leaves the captured output in conftest.err # (which we must also delete). In Autoconf 2.58, however, # AC_LINK_IFELSE() instead already invokes _AC_EVAL_STDERR() on our # behalf, however we must be careful to apply ERROR-REGEX within the # invocation AC_LINK_IFELSE(), since AC_LINK_IFELSE() deletes # conftest.err before it returns. #------------------------------------------------------------------------------ AC_DEFUN([CS_BUILD_IFELSE], [AC_LANG_PUSH(m4_default([$3],[C])) cs_cflags_save="$CS_LANG_CFLAGS" cs_lflags_save="$LDFLAGS" cs_libs_save="$LIBS" cs_build_ok=no m4_ifval([$10], [m4_pushdef([AC_TRY_EVAL], [_AC_EVAL_STDERR]($$[1]))]) for cs_build_item in m4_default([$2],[CS_CREATE_TUPLE()]) do CS_SPLIT_TUPLE( [$cs_build_item],[cs_cflags_test,cs_lflags_test,cs_libs_test]) CS_LANG_CFLAGS="$cs_cflags_test $6 $cs_cflags_save" LDFLAGS="$cs_lflags_test $7 $cs_lflags_save" LIBS="$cs_libs_test $8 $cs_libs_save" AC_LINK_IFELSE(m4_default([$1], [AC_LANG_PROGRAM([],[])]), [m4_ifval([$10], [AS_IF([AC_TRY_COMMAND( [grep "AS_ESCAPE([$10])" conftest.err >/dev/null 2>&1])], [cs_build_ok=no], [cs_build_ok=yes])], [cs_build_ok=yes])]) AS_IF([test $cs_build_ok = yes], [break]) done m4_ifval([$10], [m4_popdef([AC_TRY_EVAL]) rm -f conftest.err]) CS_LANG_CFLAGS=$cs_cflags_save LDFLAGS=$cs_lflags_save LIBS=$cs_libs_save AC_LANG_POP(m4_default([$3],[C])) AS_IF([test $cs_build_ok = yes], [cs_build_cflags=CS_TRIM([$cs_cflags_test[]m4_ifval([$9],[],[ $6])]) cs_build_lflags=CS_TRIM([$cs_lflags_test[]m4_ifval([$9],[],[ $7])]) cs_build_libs=CS_TRIM([$cs_libs_test[]m4_ifval([$9],[],[ $8])]) $4], [$5])]) #------------------------------------------------------------------------------ # CS_CHECK_BUILD(MESSAGE, CACHE-VAR, [PROGRAM], [FLAGS], [LANGUAGE], # [ACTION-IF-BUILT], [ACTION-IF-NOT-BUILT], [IGNORE-CACHE], # [OTHER-CFLAGS], [OTHER-LFLAGS], [OTHER-LIBS], # [INHIBIT-OTHER-FLAGS], [ERROR-REGEX]) # Like CS_BUILD_IFELSE() but also prints "checking" and result messages, # and optionally respects the cache. Sets CACHE-VAR to "yes" upon # success, else "no" upon failure. Additionally, sets CACHE-VAR_cflags, # CACHE-VAR_lflags, and CACHE-VAR_libs to the values which resulted in a # successful build. If IGNORE-CACHE is "yes", then the cache variables # are ignored upon entry to this macro, however they are still set to # appropriate values upon exit. #------------------------------------------------------------------------------ AC_DEFUN([CS_CHECK_BUILD], [AS_IF([test "$8" != yes], [AC_CACHE_CHECK([$1], [$2], [CS_BUILD_IFELSE([$3], [$4], [$5], [$2=yes $2_cflags=$cs_build_cflags $2_lflags=$cs_build_lflags $2_libs=$cs_build_libs], [$2=no], [$9], [$10], [$11], [$12], [$13])])], [AC_MSG_CHECKING([$1]) CS_BUILD_IFELSE([$3], [$4], [$5], [$2=yes $2_cflags=$cs_build_cflags $2_lflags=$cs_build_lflags $2_libs=$cs_build_libs], [$2=no], [$9], [$10], [$11], [$12], [$13]) AC_MSG_RESULT([$$2])]) AS_IF([test $$2 = yes], [$6], [$2_cflags='' $2_lflags='' $2_libs='' $7])]) #------------------------------------------------------------------------------ # CS_CHECK_BUILD_FLAGS(MESSAGE, CACHE-VAR, FLAGS, [LANGUAGE], # [ACTION-IF-RECOGNIZED], [ACTION-IF-NOT-RECOGNIZED], # [OTHER-CFLAGS], [OTHER-LFLAGS], [OTHER-LIBS], # [ERROR-REGEX]) # Like CS_CHECK_BUILD(), but checks only if the compiler or linker # recognizes a command-line option or options. MESSAGE is the "checking" # message. CACHE-VAR is the shell cache variable which receives the flag # or flags recognized by the compiler or linker. FLAGS is a # whitespace-delimited list of build tuples created with # CS_CREATE_TUPLE(). Each tuple from FLAGS is attempted in order until # one is found which is recognized by the compiler. After that, no # further flags are checked. LANGUAGE is typically either C or C++ and # specifies which compiler to use for the test. If LANGUAGE is omitted, # C is used. If a command-line option is recognized, then CACHE-VAR is # set to the composite value of $cs_build_cflags, $cs_build_lflags, and # $cs_build_libs of the FLAGS element which succeeded (not including the # "other" flags) and ACTION-IF-RECOGNIZED is invoked. If no options are # recognized, then CACHE-VAR is set to the empty string, and # ACTION-IF-NOT-RECOGNIZED is invoked. As a convenience, in case # comparing CACHE-VAR against the empty string to test for failure is # undesirable, a second variable named CACHE-VAR_ok is set to the literal # "no" upon failure, and to the same value as CACHE-VAR upon success. #------------------------------------------------------------------------------ AC_DEFUN([CS_CHECK_BUILD_FLAGS], [AC_CACHE_CHECK([$1], [$2_ok], [CS_BUILD_IFELSE([], [$3], [$4], [$2=CS_TRIM([$cs_build_cflags $cs_build_lflags $cs_build_libs]) $2_ok="$$2"], [$2='' $2_ok=no], [$7], [$8], [$9], [Y], [$10])]) AS_IF([test "$$2_ok" != no], [$5], [$6])]) --- NEW FILE: mkdir.m4 --- # mkdir.m4 -*- Autoconf -*- #============================================================================== # Copyright (C)2003 by Eric Sunshine <sun...@su...> # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public # License for more details. # # You should have received a copy of the GNU Library General Public License # along with this library; if not, write to the Free Software Foundation, # Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # #============================================================================== AC_PREREQ([2.56]) #------------------------------------------------------------------------------ # CS_CHECK_MKDIR # Determine how to create a directory and a directory tree. Sets the # shell variable MKDIR to the command which creates a directory, and # MKDIRS to the command which creates a directory tree. Invokes # AC_SUBST() for MKDIR and MKDIRS. # # IMPLEMENTATION NOTES # We need to know the exact commands, so that we can emit them, thus the # AS_MKDIR_P function is not what we want to use here since it does not # provide access to the commands (and might not even discover suitable # commands). First try "mkdir -p", then try the older "mkdirs". # Finally, if the mkdir command failed to recognize -p, then it might # have created a directory named "-p", so clean up that bogus directory. #------------------------------------------------------------------------------ AC_DEFUN([CS_CHECK_MKDIR], [AC_CACHE_CHECK([how to create a directory], [cs_cv_shell_mkdir], [cs_cv_shell_mkdir='mkdir']) AC_SUBST([MKDIR], [$cs_cv_shell_mkdir]) AC_CACHE_CHECK([how to create a directory tree], [cs_cv_shell_mkdir_p], [if $cs_cv_shell_mkdir -p . 2>/dev/null; then cs_cv_shell_mkdir_p='mkdir -p' elif mkdirs . 2>/dev/null; then cs_cv_shell_mkdir_p='mkdirs' fi test -d ./-p && rmdir ./-p]) AS_VAR_SET_IF([cs_cv_shell_mkdir_p], [AC_SUBST([MKDIRS], [$cs_cv_shell_mkdir_p])], [CS_MSG_ERROR([do not know how to create a directory tree])])]) #------------------------------------------------------------------------------ # Replacement for AS_MKDIR_P() from m4sugar/m4sh.m4 which fixes two problems # which are present in Autoconf 2.57 and probably all earlier 2.5x versions. # This bug, along with a patch, was submitted to the Autoconf GNATS database by # Eric Sunshine as #227 on 17-Dec-2002. The bogus "-p" directory bug was fixed # for Autoconf 2.58 on 26-Sep-2003. The "mkdirs" optimization was not accepted # (since it is unnecessary; it's only an optimization). # # 1) Removes bogus "-p" directory which the stock AS_MKDIR_P() leaves laying # around in the working directory if the mkdir command does not recognize # the -p option. # 2) Takes advantage of the older "mkdirs" program if it exists and if "mkdir # -p" does not work. #------------------------------------------------------------------------------ m4_defun([_AS_MKDIR_P_PREPARE], [if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p' elif mkdirs . 2>/dev/null; then as_mkdir_p='mkdirs' else as_mkdir_p='' fi test -d ./-p && rmdir ./-p ])# _AS_MKDIR_P_PREPARE m4_define([AS_MKDIR_P], [AS_REQUIRE([_$0_PREPARE])dnl { if test -n "$as_mkdir_p"; then $as_mkdir_p $1 else as_dir=$1 as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`AS_DIRNAME("$as_dir")` done test ! -n "$as_dirs" || mkdir $as_dirs fi || AS_ERROR([cannot create directory $1]); } ])# AS_MKDIR_P --- NEW FILE: jamcache.m4 --- # jamcache.m4 -*- Autoconf -*- #============================================================================== # Copyright (C)2003 by Eric Sunshine <sun...@su...> # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public # License for more details. # # You should have received a copy of the GNU Library General Public License # along with this library; if not, write to the Free Software Foundation, # Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # #============================================================================== AC_PREREQ([2.56]) #------------------------------------------------------------------------------ # Text cache facility for Jam-style properties. The cache is stored in # the shell variable cs_jamfile_text. # # CS_JAMCONFIG_APPEND(TEXT) # Append text to the Jam text cache. This is a cover for # CS_TEXT_CACHE_APPEND(). # # CS_JAMCONFIG_PREPEND(TEXT) # Prepend text to the Jam text cache. This is a cover for # CS_TEXT_CACHE_PREPEND(). # # CS_JAMCONFIG_PROPERTY(KEY, VALUE, [APPEND], [UNCONDITIONAL]) # Append a line of the form "KEY ?= VALUE" to the Jam text cache. If the # APPEND argument is not the empty string, then VALUE is appended to the # existing value of KEY using the form "KEY += VALUE". If the # UNCONDITIONAL argument is not empty, then the value of KEY is set # unconditionally "KEY = VALUE", rather than via "KEY ?= VALUE". APPEND # takes precedence over UNCONDITIONAL. Note that if VALUE references # other Jam variables, for example $(OBJS), then be sure to protect the # value with AS_ESCAPE(). For example: # CS_JAMCONFIG_PROPERTY([ALLOBJS], [AS_ESCAPE([$(OBJS) $(LIBOBJS)])]) # # CS_JAMCONFIG_OUTPUT(FILENAME) # Instruct config.status to write the Jam text cache to the given # filename. This is a cover for CS_TEXT_CACHE_OUTPUT(). #------------------------------------------------------------------------------ AC_DEFUN([CS_JAMCONFIG_APPEND], [CS_TEXT_CACHE_APPEND([cs_jamconfig_text], [$1])]) AC_DEFUN([CS_JAMCONFIG_PREPEND], [CS_TEXT_CACHE_PREPEND([cs_jamconfig_text], [$1])]) AC_DEFUN([CS_JAMCONFIG_PROPERTY], [CS_JAMCONFIG_APPEND( [$1 m4_ifval([$3], [+=], m4_ifval([$4], [=], [?=])) \"$2\" ; ])]) AC_DEFUN([CS_JAMCONFIG_OUTPUT], [CS_TEXT_CACHE_OUTPUT([cs_jamconfig_text], [$1])]) --- NEW FILE: textcache.m4 --- # textcache.m4 -*- Autoconf -*- #============================================================================== # Copyright (C)2003 by Eric Sunshine <sun...@su...> # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public # License for more details. # # You should have received a copy of the GNU Library General Public License # along with this library; if not, write to the Free Software Foundation, # Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # #============================================================================== AC_PREREQ([2.56]) #------------------------------------------------------------------------------ # Text cache facility. These macros provide a way to incrementally store # arbitrary text in a shell variable, and to write the saved text to a file. # # CS_TEXT_CACHE_APPEND(VARIABLE, TEXT) # Append text to the contents of the named shell variable. If the text # contains references to shell variables (such as $foo), then those # references will be expanded. If expansion is not desired, then protect # the text with AS_ESCAPE(). # # CS_TEXT_CACHE_PREPEND(VARIABLE, TEXT) # Prepend text to the contents of the named shell variable. If the text # contains references to shell variables (such as $foo), then those # references will be expanded. If expansion is not desired, then protect # the text with AS_ESCAPE(). # # CS_TEXT_CACHE_OUTPUT(VARIABLE, FILENAME) # Instruct config.status to write the contents of the named shell # variable to the given filename. If the file resides in a directory, # the directory will be created, if necessary. If the output file # already exists, and if the cached text is identical to the contents of # the existing file, then the existing file is left alone, thus its time # stamp remains unmolested. This heuristic may help to minimize rebuilds # when the file is listed as a dependency in a makefile. # # *NOTE* # There is a bug in Autoconf 2.57 and probably all earlier 2.5x versions # which results in errors if AC_CONFIG_COMMANDS is invoked for a `tag' # which represents a file in a directory which does not yet exist. # Unfortunately, even invoking AS_MKDIR_P in the `cmd' portion of # AC_CONFIG_COMMANDS does not solve the problem because the generated # configure script attempts to access information about the directory # before AS_MKDIR_P has a chance to create it. This forces us to invoke # AS_MKDIR_P in the third argument to AC_CONFIG_COMMANDS (the # `init-cmds') rather than the second (the `cmds'). This is undesirable # because it means that the directory will be created anytime # config.status is invoked (even for a simple --help), rather than being # created only when requested to output the text cache. This bug was # submitted to the Autoconf GNATS database by Eric Sunshine as #228 on # 27-Dec-2002. It was fixed for Autoconf 2.58 on 26-Sep-2003. The # official fix makes the assumption that `tag' always represents a file # (as opposed to some generic target), and creates the file's directory # is not present. #------------------------------------------------------------------------------ AC_DEFUN([CS_TEXT_CACHE_APPEND], [$1="${$1}$2"]) AC_DEFUN([CS_TEXT_CACHE_PREPEND], [$1="$2${$1}"]) AC_DEFUN([CS_TEXT_CACHE_OUTPUT], [AC_CONFIG_COMMANDS([$2], [echo $ECHO_N "$$1$ECHO_C" > $tmp/tcache AS_IF([diff $2 $tmp/tcache >/dev/null 2>&1], [AC_MSG_NOTICE([$2 is unchanged])], [rm -f $2 cp $tmp/tcache $2]) rm -f $tmp/tcache], [$1='$$1' cs_dir=`AS_DIRNAME([$2])` AS_ESCAPE(AS_MKDIR_P([$cs_dir]), [$`\])])]) --- NEW FILE: checkpython.m4 --- # checkpython.m4 -*- Autoconf -*- #============================================================================== # Copyright (C)2003,2004 by Eric Sunshine <sun...@su...> # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public # License for more details. # # You should have received a copy of the GNU Library General Public License # along with this library; if not, write to the Free Software Foundation, # Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # #============================================================================== AC_PREREQ([2.56]) #------------------------------------------------------------------------------ # CS_CHECK_PYTHON([EMITTER], [SDK-CHECK-DEFAULT], [WITH-DESCRIPTION]) # Check for Python and a working Python SDK. Sets the shell variable # PYTHON to the name of the Python interpreter and invokes AC_SUBST(). # The shell variable cs_cv_python is set to "yes" if a working Python SDK # is discovered, else "no". If available, then the variables # cs_cv_python_cflags, cs_cv_python_lflags, and cs_cv_python_libs are # set. (As a convenience, these variables can be emitted to an output # file with CS_EMIT_BUILD_RESULT() by passing "cs_cv_python" as its # CACHE-VAR argument.) As a convenience, the shell variable # cs_cv_python_ext is set to the suffix of Python extension modules (with # leading dot; typically ".dll" or ".so"). The SDK check can be enabled # or disabled with --with[out]-python. SDK-CHECK-DEFAULT should be # "with" or "without". If SDK-CHECK-DEFAULT is "with" or if it is # ommitted, then --with-python is the default, else --without-python is # the default. WITH-DESCRIPTION is the description to use for the # --with[out]-python option. The literal string "use" (or "do not use") # is prepended to WITH-DESCRIPTION. If omitted, WITH-DESCRIPTION defaults # to "Python". If EMITTER is provided, then CS_EMIT_BUILD_RESULT() is # invoked with EMITTER in order to record the results in an output # file. As a convenience, if EMITTER is the literal value "emit" or # "yes", then CS_EMIT_BUILD_RESULT()'s default emitter will be used. # When EMITTER is provided, the following properties are emitted to the # output file: PTYHON (the actual interpreter), PYTHON.AVAILABLE ("yes" # or "no"), PYTHON.CFLAGS, PYTHON.LFLAGS, and PYTHON.MODULE_EXT. #------------------------------------------------------------------------------ AC_DEFUN([CS_CHECK_PYTHON], [AC_REQUIRE([CS_CHECK_PTHREAD]) CS_COMPILER_IGNORE_LONG_DOUBLE([C++], [cs_cv_prog_cxx_ignore_long_double]) AC_ARG_WITH([python], [AC_HELP_STRING([--]m4_if([$2],[without],[with],[without])[-python], m4_if([$2],[without],[use],[do not use]) m4_default([$3],[Python]))]) AS_IF([test -z "$with_python"], [with_python=m4_if([$2], [without], [no], [yes])]) CS_CHECK_PROGS([PYTHON], [python]) AC_SUBST([PYTHON]) CS_EMIT_BUILD_PROPERTY([PYTHON],[$PYTHON],[],[],CS_EMITTER_OPTIONAL([$1])) AS_IF([test -n "$PYTHON" && test "$with_python" != no], [AC_CACHE_CHECK([for python SDK], [cs_cv_python_sdk], [cs_pyver=`AC_RUN_LOG([$PYTHON -c 'import sys, string; \ print string.join(map(str,sys.version_info[[:2]]),".")'])` cs_cv_pybase="python${cs_pyver}" cs_cv_pybase_cflags=CS_RUN_PATH_NORMALIZE([$PYTHON -c \ 'import distutils.sysconfig; \ print "-I" + distutils.sysconfig.get_python_inc()']) cs_cv_pybase_cflags="$cs_cv_pybase_cflags \ $cs_cv_prog_cxx_ignore_long_double" # Depending upon platform and installation, link library might # reside in "${prefix}/lib", "get_python_lib()/config", or # "${prefix}/libs" on Windows. cs_cv_pybase_lflags=CS_RUN_PATH_NORMALIZE([$PYTHON -c \ 'import sys,distutils.sysconfig; \ print "-L" + distutils.sysconfig.get_python_lib(0,1) + \ " -L"+distutils.sysconfig.get_python_lib(0,1)+"/config" + \ " -L"+sys.prefix + "/lib" + " -L"+sys.prefix + "/libs"']) cs_cv_pybase_libs=CS_RUN_PATH_NORMALIZE([$PYTHON -c \ 'import distutils.sysconfig; \ print (distutils.sysconfig.get_config_var("LIBS") or "")+" "+ \ (distutils.sysconfig.get_config_var("SYSLIBS") or "")']) cs_cv_python_ext=`AC_RUN_LOG([$PYTHON -c \ 'import distutils.sysconfig; \ print (distutils.sysconfig.get_config_var("SO") or "")'])` AS_IF([test -n "$cs_pyver" && test -n "$cs_cv_pybase_cflags" && test -n "$cs_cv_pybase_lflags"], [cs_cv_python_sdk=yes], [cs_cv_python_sdk=no])]) # Check if Python SDK is usable. The most common library name is the # basename with a few decorations (for example, libpython2.2.a), # however some Windows libraries lack the decimal point (for example, # libpython22.a or python22.lib), so we must check for both variations. # Furthermore, MacOS/X 10.3 supplies a Python.framework, however, # earlier releases did not. Instead, Python on MacOS/X pre-10.3 uses a # one-level linker namespace, which means that loadable Python modules # do not link against the Python library; instead, unresolved symbols # in the modules are satisfied automatically by the Python executable # when the module is loaded into the executable. For this reason, # Python on MacOS/X does not even provide a Python link library. We # account for this by trying -bundle, rather than linking against the # library. AS_IF([test $cs_cv_python_sdk = yes], [CS_EMIT_BUILD_PROPERTY([PYTHON.MODULE_EXT], [$cs_cv_python_ext], [], [], CS_EMITTER_OPTIONAL([$1])) cs_pywinlib=`echo "$cs_cv_pybase" | sed 's/\.//g'` cs_pyflags="$cs_pyflags CS_CREATE_TUPLE([],[],[-framework Python])" cs_pyflags="$cs_pyflags CS_CREATE_TUPLE([],[],[-l$cs_cv_pybase])" cs_pyflags="$cs_pyflags CS_CREATE_TUPLE([],[],[-l$cs_pywinlib])" cs_pyflags="$cs_pyflags CS_CREATE_TUPLE( [],[-bundle -flat_namespace -undefined suppress])" CS_CHECK_BUILD([if python SDK is usable], [cs_cv_python], [AC_LANG_PROGRAM([[#include <Python.h>]], [Py_Initialize(); Py_Finalize();])], [$cs_pyflags], [], [CS_EMIT_BUILD_RESULT([cs_cv_python], [PYTHON], CS_EMITTER_OPTIONAL([$1]))], [], [], [$cs_cv_pybase_cflags $cs_cv_sys_pthread_cflags], [$cs_cv_pybase_lflags $cs_cv_sys_pthread_lflags], [$cs_cv_pybase_libs $cs_cv_sys_pthread_libs])], [cs_cv_python=no])], [cs_cv_python=no])]) #------------------------------------------------------------------------------ # CS_EMIT_CHECK_PYTHON([SDK-CHECK-DEFAULT], [WITH-DESCRIPTION], [EMITTER]) # DEPRECATED: Previously, layered EMITTER functionality atop # CS_CHECK_PYTHON() before CS_CHECK_PYTHON() supported emitters directly. #------------------------------------------------------------------------------ AC_DEFUN([CS_EMIT_CHECK_PYTHON], [CS_CHECK_PYTHON(m4_ifval([$3], [$3], [emit]), [$1], [$2])]) --- NEW FILE: diagnose.m4 --- # diagnose.m4 -*- Autoconf -*- #============================================================================== # Copyright (C)2003 by Eric Sunshine <sun...@su...> # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public # License for more details. # # You should have received a copy of the GNU Library General Public License # along with this library; if not, write to the Free Software Foundation, # Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # #============================================================================== AC_PREREQ([2.56]) #------------------------------------------------------------------------------ # CS_MSG_ERROR(ERROR-DESCRIPTION, [EXIT-STATUS]) # A convenience wrapper for AC_MSG_ERROR() which invokes AC_CACHE_SAVE() # before aborting the script. Saving the cache should make subsequent # re-invocations of the configure script faster once the user has # corrected the problem(s) which caused the failure. #------------------------------------------------------------------------------ AC_DEFUN([CS_MSG_ERROR], [AC_CACHE_SAVE AC_MSG_ERROR([$1], [$2])]) --- NEW FILE: warnings.m4 --- # warnings.m4 -*- Autoconf -*- #============================================================================== # Copyright (C)2005 by Eric Sunshine <sun...@su...> # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public # License for more details. # # You should have received a copy of the GNU Library General Public License # along with this library; if not, write to the Free Software Foundation, # Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # #============================================================================== AC_PREREQ([2.56]) #------------------------------------------------------------------------------ # CS_COMPILER_WARNINGS([LANGUAGE], [CACHE-VAR], [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # Check how to enable compilation warnings. If LANGUAGE is not provided, # then `C' is assumed (other options include `C++'). If CACHE-VAR is not # provided, then it defaults to the name # "cs_cv_prog_compiler_enable_warnings". If an option for enabling # warnings (such as `-Wall') is discovered, then it is assigned to # CACHE-VAR and ACTION-IF-FOUND is invoked; otherwise the empty string is # assigned to CACHE-VAR and ACTION-IF-NOT-FOUND is invoked. # # IMPLEMENTATION NOTES # # On some platforms, it is more appropriate to use -Wmost rather than # -Wall even if the compiler understands both, thus we attempt -Wmost # before -Wall. #------------------------------------------------------------------------------ AC_DEFUN([CS_COMPILER_WARNINGS], [CS_CHECK_BUILD_FLAGS( [how to enable m4_default([$1],[C]) compilation warnings], [m4_default([$2],[cs_cv_prog_compiler_enable_warnings])], [CS_CREATE_TUPLE([-Wmost]) CS_CREATE_TUPLE([-Wall])], [$1], [$3], [$4])]) #------------------------------------------------------------------------------ # CS_COMPILER_ERRORS([LANGUAGE], [CACHE-VAR], [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # Check how to promote compilation diganostics from warning to error # status. If LANGUAGE is not provided, then `C' is assumed (other options # include `C++'). If CACHE-VAR is not provided, then it defaults to the # name "cs_cv_prog_compiler_enable_errors". If an option for performing # this promotion (such as `-Werror') is discovered, then it is assigned # to CACHE-VAR and ACTION-IF-FOUND is invoked; otherwise the empty string # is assigned to CACHE-VAR and ACTION-IF-NOT-FOUND is invoked. #------------------------------------------------------------------------------ AC_DEFUN([CS_COMPILER_ERRORS], [CS_CHECK_BUILD_FLAGS( [how to treat m4_default([$1],[C]) warnings as errors], [m4_default([$2],[cs_cv_prog_compiler_enable_errors])], [CS_CREATE_TUPLE([-Werror])], [$1], [$3], [$4])]) #------------------------------------------------------------------------------ # CS_COMPILER_IGNORE_UNUSED([LANGUAGE], [CACHE-VAR], [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # Check how to instruct compiler to ignore unused variables and # arguments. This option may be useful for code generated by tools, such # as Swig, Bison, and Flex, over which the client has no control, yet # wishes to compile without excessive diagnostic spew. If LANGUAGE is # not provided, then `C' is assumed (other options include `C++'). If # CACHE-VAR is not provided, then it defaults to the name # "cs_cv_prog_compiler_ignore_unused". If an option (such as # `-Wno-unused') is discovered, then it is assigned to CACHE-VAR and # ACTION-IF-FOUND is invoked; otherwise the empty string is assigned to # CACHE-VAR and ACTION-IF-NOT-FOUND is invoked. #------------------------------------------------------------------------------ AC_DEFUN([CS_COMPILER_IGNORE_UNUSED], [CS_CHECK_BUILD_FLAGS( [how to suppress m4_default([$1],[C]) unused variable warnings], [m4_default([$2],[cs_cv_prog_compiler_ignore_unused])], [CS_CREATE_TUPLE([-Wno-unused])], [$1], [$3], [$4])]) #------------------------------------------------------------------------------ # CS_COMPILER_IGNORE_UNINITIALIZED([LANGUAGE], [CACHE-VAR], [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # Check how to instruct compiler to ignore uninitialized variables. This # option may be useful for code generated by tools, such as Swig, Bison, # and Flex, over which the client has no control, yet wishes to compile # without excessive diagnostic spew. If LANGUAGE is not provided, then # `C' is assumed (other options include `C++'). If CACHE-VAR is not # provided, then it defaults to the name # "cs_cv_prog_compiler_ignore_uninitialized". If an option (such as # `-Wno-uninitialized') is discovered, then it is assigned to CACHE-VAR # and ACTION-IF-FOUND is invoked; otherwise the empty string is assigned # to CACHE-VAR and ACTION-IF-NOT-FOUND is invoked. #------------------------------------------------------------------------------ AC_DEFUN([CS_COMPILER_IGNORE_UNINITIALIZED], [CS_CHECK_BUILD_FLAGS( [how to suppress m4_default([$1],[C]) uninitialized warnings], [m4_default([$2], [cs_cv_prog_compiler_ignore_uninitialized_variables])], [CS_CREATE_TUPLE([-Wno-uninitialized])], [$1], [$3], [$4])]) #------------------------------------------------------------------------------ # CS_COMPILER_IGNORE_PRAGMAS([LANGUAGE], [CACHE-VAR], [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # Check how to instruct compiler to ignore unrecognized #pragma # directives. This option may be useful for code which contains # unprotected #pragmas which are not understood by all compilers. If # LANGUAGE is not provided, then `C' is assumed (other options include # `C++'). If CACHE-VAR is not provided, then it defaults to the name # "cs_cv_prog_compiler_ignore_unknown_pragmas". If an option (such as # `-Wno-unknown-pragmas') is discovered, then it is assigned to CACHE-VAR # and ACTION-IF-FOUND is invoked; otherwise the empty string is assigned # to CACHE-VAR and ACTION-IF-NOT-FOUND is invoked. #------------------------------------------------------------------------------ AC_DEFUN([CS_COMPILER_IGNORE_PRAGMAS], [CS_CHECK_BUILD_FLAGS( [how to suppress m4_default([$1],[C]) unknown [#pragma] warnings], [m4_default([$2],[cs_cv_prog_compiler_ignore_unknown_pragmas])], [CS_CREATE_TUPLE([-Wno-unknown-pragmas])], [$1], [$3], [$4])]) #------------------------------------------------------------------------------ # CS_COMPILER_IGNORE_LONG_DOUBLE([LANGUAGE], [CACHE-VAR], [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # Check how to instruct compiler to suppress warnings about `long double' # usage. This option may be useful for code generated by tools, such as # Swig, Bison, and Flex, over which the client has no control, yet wishes # to compile without excessive diagnostic spew. If LANGUAGE is not # provided, then `C' is assumed (other options include `C++'). If # CACHE-VAR is not provided, then it defaults to the name # "cs_cv_prog_compiler_ignore_long_double". If an option (such as # `-Wno-long-double') is discovered, then it is assigned to CACHE-VAR and # ACTION-IF-FOUND is invoked; otherwise the empty string is assigned to # CACHE-VAR and ACTION-IF-NOT-FOUND is invoked. #------------------------------------------------------------------------------ AC_DEFUN([CS_COMPILER_IGNORE_LONG_DOUBLE], [CS_CHECK_BUILD_FLAGS( [how to suppress m4_default([$1],[C]) `long double' warnings], [m4_default([$2],[cs_cv_prog_compiler_ignore_long_double])], [CS_CREATE_TUPLE([-Wno-long-double])], [$1], [$3], [$4])]) --- NEW FILE: emit.m4 --- # emit.m4 -*- Autoconf -*- #============================================================================== # Copyright (C)2003-2005 by Eric Sunshine <sun...@su...> # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public # License for more details. # # You should have received a copy of the GNU Library General Public License # along with this library; if not, write to the Free Software Foundation, # Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # #============================================================================== AC_PREREQ([2.56]) #------------------------------------------------------------------------------ # CS_EMIT_BUILD_PROPERTY(KEY, VALUE, [APPEND], [EMPTY-OKAY], [EMITTER], # [UNCONDITIONAL]) # A utility function which invokes an emitter to record the KEY/VALUE # tuple if VALUE is not the empty string (after leading and trailing # whitespace is stripped). If EMPTY-OKAY is not an empty string, then the # property is emitted even if VALUE is empty; that is, it is emitted # unconditionally. If APPEND is the empty string, then the emitter sets # the key's value directly (though it may be overridden by the # environment), otherwise the emitter appends VALUE to the existing value # of the key. EMITTER is a macro name, such as CS_JAMCONFIG_PROPERTY or # CS_MAKEFILE_PROPERTY, which performs the actual task of emitting the # KEY/VALUE tuple; it should also accept APPEND as an optional third # argument. If EMITTER is omitted, CS_JAMCONFIG_PROPERTY is used. Some # emitters accept an optional fourth argument, UNCONDITIONAL, which # instructs it to set KEY's value unconditionally, even if KEY already # had been assigned a value via some other mechanism (such as imported # from the environment, or from Jambase, in the case of # CS_JAMCONFIG_PROPERTY). #------------------------------------------------------------------------------ AC_DEFUN([CS_EMIT_BUILD_PROPERTY], [cs_build_prop_val="$2" cs_build_prop_val=CS_TRIM([$cs_build_prop_val]) m4_ifval([$4], [CS_JAMCONFIG_PROPERTY([$1], [$cs_build_prop_val], [$3])], AS_IF([test -n "$cs_build_prop_val"], [m4_default([$5],[CS_JAMCONFIG_PROPERTY])( [$1], [$cs_build_prop_val], [$3], [$6])]))]) #------------------------------------------------------------------------------ # CS_EMIT_BUILD_RESULT(CACHE-VAR, PREFIX, [EMITTER]) # Record the results of CS_CHECK_BUILD() or CS_CHECK_LIB_WITH() via some # emitter. If CACHE-VAR indicates that the build succeeded, then the # following properties are emitted: # # PREFIX.AVAILABLE = yes # PREFIX.CFLAGS = $CACHE-VAR_cflags # PREFIX.LFLAGS = $CACHE-VAR_lflags $CACHE-VAR_libs # # EMITTER is a macro name, such as CS_JAMCONFIG_PROPERTY or # CS_MAKEFILE_PROPERTY, which performs the actual task of emitting the # KEY/VALUE tuple. If EMITTER is omitted, CS_JAMCONFIG_PROPERTY is used. #------------------------------------------------------------------------------ AC_DEFUN([CS_EMIT_BUILD_RESULT], [AS_IF([test "$$1" = yes], [CS_EMIT_BUILD_PROPERTY([$2.AVAILABLE], [yes], [], [], [$3]) CS_EMIT_BUILD_PROPERTY([$2.CFLAGS], [$$1_cflags], [], [], [$3]) CS_EMIT_BUILD_PROPERTY([$2.LFLAGS], [$$1_lflags $$1_libs], [], [], [$3])])]) #------------------------------------------------------------------------------ # CS_EMIT_BUILD_FLAGS(MESSAGE, CACHE-VAR, FLAGS, [LANGUAGE], EMITTER-KEY, # [APPEND], [ACTION-IF-RECOGNIZED], # [ACTION-IF-NOT-RECOGNIZED], [EMITTER]) # A convenience wrapper for CS_CHECK_BUILD_FLAGS() which also records the # results via CS_EMIT_BUILD_PROPERTY(). Checks if the compiler or linker # recognizes a command-line option. MESSAGE is the "checking" message. # CACHE-VAR is the shell cache variable which receives the flag # recognized by the compiler or linker, or "no" if the flag was not # recognized. FLAGS is a whitespace- delimited list of build tuples # created with CS_CREATE_TUPLE(). Each tuple from FLAGS is attempted in # order until one is found which is recognized by the compiler. After # that, no further flags are checked. LANGUAGE is typically either C or # C++ and specifies which compiler to use for the test. If LANGUAGE is # omitted, C is used. EMITTER-KEY is the name to pass as the emitter's # "key" argument if a usable flag is encountered. If APPEND is not the # empty string, then the discovered flag is appended to the existing # value of the EMITTER-KEY. If the command-line option was recognized, # then ACTION-IF-RECOGNIZED is invoked, otherwise # ACTION-IF-NOT-RECOGNIZED is invoked. EMITTER is a macro name, such as # CS_JAMCONFIG_PROPERTY or CS_MAKEFILE_PROPERTY, which performs the # actual task of emitting the KEY/VALUE tuple; it should also accept # APPEND as an optional third argument. If EMITTER is omitted, # CS_JAMCONFIG_PROPERTY is used. #------------------------------------------------------------------------------ AC_DEFUN([CS_EMIT_BUILD_FLAGS], [CS_CHECK_BUILD_FLAGS([$1], [$2], [$3], [$4], [CS_EMIT_BUILD_PROPERTY([$5], [$$2], [$6], [], [$9]) $7], [$8])]) #------------------------------------------------------------------------------ # CS_EMITTER_OPTIONAL([EMITTER]) # The CS_EMIT_FOO() macros optionally accept an emitter. If no emitter is # supplied to those macros, then a default emitter is chosen. Other # macros, however, which perform testing and optionally emit the results # may wish to interpret an omitted EMITTER as a request not to emit the # results. CS_EMITTER_OPTIONAL() is a convenience macro to help in these # cases. It should be passed to one of the CS_EMIT_FOO() macros in place # of the literal EMITTER argument. It functions by re-interpretating # EMITTER as follows: # # - If EMITTER is omitted, then CS_NULL_EMITTER is returned, effectively # disabling output by the CS_EMIT_FOO() macro. # - If EMITTER is the literal string "emit" or "yes", then it returns an # empty string, which signals to the CS_EMIT_FOO() macro that is should # use its default emitter. # - Any other value for EMITTER is passed along as-is to the # CS_EMIT_FOO() macro. #------------------------------------------------------------------------------ AC_DEFUN([CS_EMITTER_OPTIONAL], [m4_case([$1], [], [[CS_NULL_EMITTER]], [emit], [], [yes], [], [[$1]])]) #------------------------------------------------------------------------------ # CS_NULL_EMITTER(KEY, VALUE, [APPEND]) # A do-nothing emitter suitable for use as the EMITTER argument of one of # the CS_EMIT_FOO() macros. #------------------------------------------------------------------------------ AC_DEFUN([CS_NULL_EMITTER], [: ]) #------------------------------------------------------------------------------ # CS_SUBST_EMITTER(KEY, VALUE, [APPEND]) # An emitter wrapped around AC_SUBST(). Invokes # AC_SUBST(AS_TR_SH(KEY),VALUE). The APPEND argument is ignored. # Suitable for use as the EMITTER argument of one of the CS_EMIT_FOO() # macros. The call to AS_TR_SH() ensures that KEY is transformed into a # valid shell variable. For instance, if a macro attempts to emit # MYLIB.CFLAGS and MYLIB.LFLAGS via CS_SUBST_EMITTER(), then the names # will be transformed to MYLIB_CFLAGS and MYLIB_LFLAGS, respectively, for # the invocation of AC_SUBST(). #------------------------------------------------------------------------------ AC_DEFUN([CS_SUBST_EMITTER], [AC_SUBST(AS_TR_SH([$1]),[$2])]) #------------------------------------------------------------------------------ # CS_DEFINE_EMITTER(KEY, VALUE, [APPEND]) # An emitter wrapped around AC_DEFINE_UNQUOTED(). Invokes # AC_DEFINE_UNQUOTED(AS_TR_CPP(KEY),VALUE). The APPEND argument is # ignored. Suitable for use as the EMITTER argument of one of the # CS_EMIT_FOO() macros. The call to AS_TR_CPP() ensures that KEY is a # well-formed token for the C-preprocessor. #------------------------------------------------------------------------------ AC_DEFUN([CS_DEFINE_EMITTER], [AC_DEFINE_UNQUOTED(AS_TR_CPP([$1]),[$2], [Define when feature is available])]) --- NEW FILE: split.m4 --- # split.m4 -*- Autoconf -*- #============================================================================== # Copyright (C)2003 by Eric Sunshine <sun...@su...> # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public # License for more details. # # You should have received a copy of the GNU Library General Public License # along with this library; if not, write to the Free Software Foundation, # Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # #============================================================================== AC_PREREQ([2.56]) #------------------------------------------------------------------------------ # CS_SPLIT(LINE, [OUTPUT-VARIABLES], [DELIMITER], [FILLER]) # Split LINE into individual tokens. Tokens are delimited by DELIMITER, # which is the space character if omitted. OUTPUT-VARIABLES is a # comma-delimited list of shell variables which should receive the # extracted tokens. If there are too few tokens to fill the output # variables, then the excess variables will be assigned the empty string. # If there are too few output variables, then the excess tokens will be # ignored. If OUTPUT-VARIABLES is omitted, then the split tokens will be # assigned to the shell meta-variables $1, $2, $3, etc. When # OUTPUT-VARIABLES is omitted, FILLER is assigned to meta-variables in # cases where DELIMITER delimits a zero-length token. FILLER defaults # to "filler". For example, if DELIMITER is "+" and OUTPUT-VARIABLES is # omitted, given the line "one++three", $1 will be "one", $2 will be # "filler", and $3 will be "three". #------------------------------------------------------------------------------ AC_DEFUN([CS_SPLIT], [m4_define([cs_split_filler], m4_default([$4],[filler])) set cs_split_filler `echo "$1" | awk 'BEGIN { FS="m4_default([$3],[ ])" } { for (i=1; i <= NF; ++i) { if ($i == "") print "cs_split_filler"; else print $i } }'` shift m4_map([_CS_SPLIT], [$2])]) AC_DEFUN([_CS_SPLIT], [AS_IF([test $[@%:@] -eq 0], [$1=''], [AS_IF([test "$[1]" = cs_split_filler], [$1=''], [$1=$[1]]) shift])]) --- NEW FILE: checkprog.m4 --- # checkprog.m4 -*- Autoconf -*- #============================================================================== # Copyright (C)2004 by Eric Sunshine <sun...@su...> # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public # License for more details. # # You should have received a copy of the GNU Library General Public License # along with this library; if not, write to the Free Software Foundation, # Inc., 675 Mass Ave, Cambridge, MA 0... [truncated message content] |