+++ /dev/null
-dnl @synopsis AC_CREATE_PREFIX_CONFIG_H [(OUTPUT-HEADER [,PREFIX [,ORIG-HEADER]])]
-dnl
-dnl this is a new variant from ac_prefix_config_
-dnl this one will use a lowercase-prefix if
-dnl the config-define was starting with a lowercase-char, e.g.
-dnl #define const or #define restrict or #define off_t
-dnl (and this one can live in another directory, e.g. testpkg/config.h
-dnl therefore I decided to move the output-header to be the first arg)
-dnl
-dnl takes the usual config.h generated header file; looks for each of
-dnl the generated "#define SOMEDEF" lines, and prefixes the defined name
-dnl (ie. makes it "#define PREFIX_SOMEDEF". The result is written to
-dnl the output config.header file. The PREFIX is converted to uppercase
-dnl for the conversions.
-dnl
-dnl default OUTPUT-HEADER = $PACKAGE-config.h
-dnl default PREFIX = $PACKAGE
-dnl default ORIG-HEADER, derived from OUTPUT-HEADER
-dnl if OUTPUT-HEADER has a "/", use the basename
-dnl if OUTPUT-HEADER has a "-", use the section after it.
-dnl otherwise, just config.h
-dnl
-dnl In most cases, the configure.in will contain a line saying
-dnl AC_CONFIG_HEADER(config.h)
-dnl somewhere *before* AC_OUTPUT and a simple line saying
-dnl AC_PREFIX_CONFIG_HEADER
-dnl somewhere *after* AC_OUTPUT.
-dnl
-dnl example:
-dnl AC_INIT(config.h.in) # config.h.in as created by "autoheader"
-dnl AM_INIT_AUTOMAKE(testpkg, 0.1.1) # "#undef VERSION" and "PACKAGE"
-dnl AM_CONFIG_HEADER(config.h) # in config.h.in
-dnl AC_MEMORY_H # "#undef NEED_MEMORY_H"
-dnl AC_C_CONST_H # "#undef const"
-dnl AC_OUTPUT(Makefile) # creates the "config.h" now
-dnl AC_CREATE_PREFIX_CONFIG_H # creates "testpkg-config.h"
-dnl and the resulting "testpkg-config.h" contains lines like
-dnl #ifndef TESTPKG_VERSION
-dnl #define TESTPKG_VERSION "0.1.1"
-dnl #endif
-dnl #ifndef TESTPKG_NEED_MEMORY_H
-dnl #define TESTPKG_NEED_MEMORY_H 1
-dnl #endif
-dnl #ifndef _testpkg_const
-dnl #define _testpkg_const const
-dnl #endif
-dnl
-dnl and this "testpkg-config.h" can be installed along with other
-dnl header-files, which is most convenient when creating a shared
-dnl library (that has some headers) where some functionality is
-dnl dependent on the OS-features detected at compile-time. No
-dnl need to invent some "testpkg-confdefs.h.in" manually. :-)
-dnl
-dnl @version $Id: ac_create_prefix_config_h.m4,v 1.1 2004/08/24 00:21:09 robertc Exp $
-dnl @author Guido Draheim <guidod@gmx.de>
-
-AC_DEFUN([AC_CREATE_PREFIX_CONFIG_H],
-[changequote({, })dnl
-ac_prefix_conf_OUT=`echo ifelse($1, , $PACKAGE-config.h, $1)`
-ac_prefix_conf_DEF=`echo _$ac_prefix_conf_OUT | sed -e 'y:abcdefghijklmnopqrstuvwxyz./,-:ABCDEFGHIJKLMNOPQRSTUVWXYZ____:'`
-ac_prefix_conf_PKG=`echo ifelse($2, , $PACKAGE, $2)`
-ac_prefix_conf_LOW=`echo _$ac_prefix_conf_PKG | sed -e 'y:ABCDEFGHIJKLMNOPQRSTUVWXYZ-:abcdefghijklmnopqrstuvwxyz_:'`
-ac_prefix_conf_UPP=`echo $ac_prefix_conf_PKG | sed -e 'y:abcdefghijklmnopqrstuvwxyz-:ABCDEFGHIJKLMNOPQRSTUVWXYZ_:' -e '/^[0-9]/s/^/_/'`
-ac_prefix_conf_INP=`echo ifelse($3, , _, $3)`
-if test "$ac_prefix_conf_INP" = "_"; then
- case $ac_prefix_conf_OUT in
- */*) ac_prefix_conf_INP=`basename $ac_prefix_conf_OUT`
- ;;
- *-*) ac_prefix_conf_INP=`echo $ac_prefix_conf_OUT | sed -e 's/[a-zA-Z0-9_]*-//'`
- ;;
- *) ac_prefix_conf_INP=config.h
- ;;
- esac
-fi
-changequote([, ])dnl
-if test -z "$ac_prefix_conf_PKG" ; then
- AC_MSG_ERROR([no prefix for _PREFIX_PKG_CONFIG_H])
-else
- AC_MSG_RESULT(creating $ac_prefix_conf_OUT - prefix $ac_prefix_conf_UPP for $ac_prefix_conf_INP defines)
- if test -f $ac_prefix_conf_INP ; then
- AS_DIRNAME([/* automatically generated */], $ac_prefix_conf_OUT)
-changequote({, })dnl
- echo '#ifndef '$ac_prefix_conf_DEF >$ac_prefix_conf_OUT
- echo '#define '$ac_prefix_conf_DEF' 1' >>$ac_prefix_conf_OUT
- echo ' ' >>$ac_prefix_conf_OUT
- echo /'*' $ac_prefix_conf_OUT. Generated automatically at end of configure. '*'/ >>$ac_prefix_conf_OUT
-
- echo 's/#undef *\([A-Z_]\)/#undef '$ac_prefix_conf_UPP'_\1/' >conftest.sed
- echo 's/#undef *\([a-z]\)/#undef '$ac_prefix_conf_LOW'_\1/' >>conftest.sed
- echo 's/#define *\([A-Z_][A-Za-z0-9_]*\)\(.*\)/#ifndef '$ac_prefix_conf_UPP"_\\1 \\" >>conftest.sed
- echo '#define '$ac_prefix_conf_UPP"_\\1 \\2 \\" >>conftest.sed
- echo '#endif/' >>conftest.sed
- echo 's/#define *\([a-z][A-Za-z0-9_]*\)\(.*\)/#ifndef '$ac_prefix_conf_LOW"_\\1 \\" >>conftest.sed
- echo '#define '$ac_prefix_conf_LOW"_\\1 \\2 \\" >>conftest.sed
- echo '#endif/' >>conftest.sed
- sed -f conftest.sed $ac_prefix_conf_INP >>$ac_prefix_conf_OUT
- echo ' ' >>$ac_prefix_conf_OUT
- echo '/*' $ac_prefix_conf_DEF '*/' >>$ac_prefix_conf_OUT
- echo '#endif' >>$ac_prefix_conf_OUT
-changequote([, ])dnl
- else
- AC_MSG_ERROR([input file $ac_prefix_conf_IN does not exist, dnl
- skip generating $ac_prefix_conf_OUT])
- fi
- rm -f conftest.*
-fi])
-
--- /dev/null
+dnl @synopsis AX_PREFIX_CONFIG_H [(OUTPUT-HEADER [,PREFIX [,ORIG-HEADER]])]
+dnl
+dnl This is a new variant from ac_prefix_config_ this one will use a
+dnl lowercase-prefix if the config-define was starting with a
+dnl lowercase-char, e.g. "#define const", "#define restrict", or
+dnl "#define off_t", (and this one can live in another directory, e.g.
+dnl testpkg/config.h therefore I decided to move the output-header to
+dnl be the first arg)
+dnl
+dnl takes the usual config.h generated header file; looks for each of
+dnl the generated "#define SOMEDEF" lines, and prefixes the defined
+dnl name (ie. makes it "#define PREFIX_SOMEDEF". The result is written
+dnl to the output config.header file. The PREFIX is converted to
+dnl uppercase for the conversions.
+dnl
+dnl Defaults:
+dnl
+dnl OUTPUT-HEADER = $PACKAGE-config.h
+dnl PREFIX = $PACKAGE
+dnl ORIG-HEADER, from AM_CONFIG_HEADER(config.h)
+dnl
+dnl Your configure.ac script should contain both macros in this order,
+dnl and unlike the earlier variations of this prefix-macro it is okay
+dnl to place the AX_PREFIX_CONFIG_H call before the AC_OUTPUT
+dnl invokation.
+dnl
+dnl Example:
+dnl
+dnl AC_INIT(config.h.in) # config.h.in as created by "autoheader"
+dnl AM_INIT_AUTOMAKE(testpkg, 0.1.1) # makes #undef VERSION and PACKAGE
+dnl AM_CONFIG_HEADER(config.h) # prep config.h from config.h.in
+dnl AX_PREFIX_CONFIG_H(mylib/_config.h) # prep mylib/_config.h from it..
+dnl AC_MEMORY_H # makes "#undef NEED_MEMORY_H"
+dnl AC_C_CONST_H # makes "#undef const"
+dnl AC_OUTPUT(Makefile) # creates the "config.h" now
+dnl # and also mylib/_config.h
+dnl
+dnl if the argument to AX_PREFIX_CONFIG_H would have been omitted then
+dnl the default outputfile would have been called simply
+dnl "testpkg-config.h", but even under the name "mylib/_config.h" it
+dnl contains prefix-defines like
+dnl
+dnl #ifndef TESTPKG_VERSION
+dnl #define TESTPKG_VERSION "0.1.1"
+dnl #endif
+dnl #ifndef TESTPKG_NEED_MEMORY_H
+dnl #define TESTPKG_NEED_MEMORY_H 1
+dnl #endif
+dnl #ifndef _testpkg_const
+dnl #define _testpkg_const _const
+dnl #endif
+dnl
+dnl and this "mylib/_config.h" can be installed along with other
+dnl header-files, which is most convenient when creating a shared
+dnl library (that has some headers) where some functionality is
+dnl dependent on the OS-features detected at compile-time. No need to
+dnl invent some "mylib-confdefs.h.in" manually. :-)
+dnl
+dnl Note that some AC_DEFINEs that end up in the config.h file are
+dnl actually self-referential - e.g. AC_C_INLINE, AC_C_CONST, and the
+dnl AC_TYPE_OFF_T say that they "will define inline|const|off_t if the
+dnl system does not do it by itself". You might want to clean up about
+dnl these - consider an extra mylib/conf.h that reads something like:
+dnl
+dnl #include <mylib/_config.h>
+dnl #ifndef _testpkg_const
+dnl #define _testpkg_const const
+dnl #endif
+dnl
+dnl and then start using _testpkg_const in the header files. That is
+dnl also a good thing to differentiate whether some library-user has
+dnl starting to take up with a different compiler, so perhaps it could
+dnl read something like this:
+dnl
+dnl #ifdef _MSC_VER
+dnl #include <mylib/_msvc.h>
+dnl #else
+dnl #include <mylib/_config.h>
+dnl #endif
+dnl #ifndef _testpkg_const
+dnl #define _testpkg_const const
+dnl #endif
+dnl
+dnl @category Misc
+dnl @author Guido Draheim <guidod@gmx.de>
+dnl @author MÃ¥rten Svantesson <msv@kth.se>
+dnl @version 2005-06-08
+dnl @license GPLWithACException
+
+AC_DEFUN([AX_PREFIX_CONFIG_H],[AC_REQUIRE([AC_CONFIG_HEADER])
+AC_CONFIG_COMMANDS([ifelse($1,,$PACKAGE-config.h,$1)],[dnl
+AS_VAR_PUSHDEF([_OUT],[ac_prefix_conf_OUT])dnl
+AS_VAR_PUSHDEF([_DEF],[ac_prefix_conf_DEF])dnl
+AS_VAR_PUSHDEF([_PKG],[ac_prefix_conf_PKG])dnl
+AS_VAR_PUSHDEF([_LOW],[ac_prefix_conf_LOW])dnl
+AS_VAR_PUSHDEF([_UPP],[ac_prefix_conf_UPP])dnl
+AS_VAR_PUSHDEF([_INP],[ac_prefix_conf_INP])dnl
+m4_pushdef([_script],[conftest.prefix])dnl
+m4_pushdef([_symbol],[m4_cr_Letters[]m4_cr_digits[]_])dnl
+_OUT=`printf '%s\n' ifelse($1, , $PACKAGE-config.h, $1)`
+_DEF=`printf '%s\n' _$_OUT | sed -e "y:m4_cr_letters:m4_cr_LETTERS[]:" -e "s/@<:@^m4_cr_Letters@:>@/_/g"`
+_PKG=`printf '%s\n' ifelse($2, , $PACKAGE, $2)`
+_LOW=`printf '%s\n' _$_PKG | sed -e "y:m4_cr_LETTERS-:m4_cr_letters[]_:"`
+_UPP=`printf '%s\n' $_PKG | sed -e "y:m4_cr_letters-:m4_cr_LETTERS[]_:" -e "/^@<:@m4_cr_digits@:>@/s/^/_/"`
+_INP=`printf '%s\n' "ifelse($3,,,$3)" | sed -e 's/ *//'`
+if test ".$_INP" = "."; then
+ for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue
+ case "$ac_file" in
+ *.h) _INP=$ac_file ;;
+ *)
+ esac
+ test ".$_INP" != "." && break
+ done
+fi
+if test ".$_INP" = "."; then
+ case "$_OUT" in
+ */*) _INP=`basename "$_OUT"`
+ ;;
+ *-*) _INP=`printf '%s\n' "$_OUT" | sed -e "s/@<:@_symbol@:>@*-//"`
+ ;;
+ *) _INP=config.h
+ ;;
+ esac
+fi
+if test -z "$_PKG" ; then
+ AC_MSG_ERROR([no prefix for _PREFIX_PKG_CONFIG_H])
+else
+ if test ! -f "$_INP" ; then if test -f "$srcdir/$_INP" ; then
+ _INP="$srcdir/$_INP"
+ fi fi
+ AC_MSG_NOTICE(creating $_OUT - prefix $_UPP for $_INP defines)
+ if test -f $_INP ; then
+ printf '%s\n' "s/@%:@undef *\\(@<:@m4_cr_LETTERS[]_@:>@\\)/@%:@undef $_UPP""_\\1/" > _script
+ printf '%s\n' "s/@%:@undef *\\(@<:@m4_cr_letters@:>@\\)/@%:@undef $_LOW""_\\1/" >> _script
+ printf '%s\n' "s/@%:@def[]ine *\\(@<:@m4_cr_LETTERS[]_@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_UPP""_\\1 \\" >> _script
+ printf '%s\n' "@%:@def[]ine $_UPP""_\\1 \\2 \\" >> _script
+ printf '%s\n' "@%:@endif/" >>_script
+ printf '%s\n' "s/@%:@def[]ine *\\(@<:@m4_cr_letters@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_LOW""_\\1 \\" >> _script
+ printf '%s\n' "@%:@define $_LOW""_\\1 \\2 \\" >> _script
+ printf '%s\n' "@%:@endif/" >> _script
+ # now executing _script on _DEF input to create _OUT output file
+ printf '%s\n' "@%:@ifndef $_DEF" >$tmp/pconfig.h
+ printf '%s\n' "@%:@def[]ine $_DEF 1" >>$tmp/pconfig.h
+ printf '%s\n' ' ' >>$tmp/pconfig.h
+ printf '%s\n' /'*' $_OUT. Generated automatically at end of configure. '*'/ >>$tmp/pconfig.h
+
+ sed -f _script $_INP >>$tmp/pconfig.h
+ printf '%s\n' ' ' >>$tmp/pconfig.h
+ printf '%s\n' '/* once:' $_DEF '*/' >>$tmp/pconfig.h
+ printf '%s\n' "@%:@endif" >>$tmp/pconfig.h
+ if cmp -s $_OUT $tmp/pconfig.h 2>/dev/null; then
+ AC_MSG_NOTICE([$_OUT is unchanged])
+ else
+ ac_dir=`AS_DIRNAME(["$_OUT"])`
+ AS_MKDIR_P(["$ac_dir"])
+ rm -f "$_OUT"
+ mv $tmp/pconfig.h "$_OUT"
+ fi
+ cp _script _configs.sed
+ else
+ AC_MSG_ERROR([input file $_INP does not exist - skip generating $_OUT])
+ fi
+ rm -f conftest.*
+fi
+m4_popdef([_symbol])dnl
+m4_popdef([_script])dnl
+AS_VAR_POPDEF([_INP])dnl
+AS_VAR_POPDEF([_UPP])dnl
+AS_VAR_POPDEF([_LOW])dnl
+AS_VAR_POPDEF([_PKG])dnl
+AS_VAR_POPDEF([_DEF])dnl
+AS_VAR_POPDEF([_OUT])dnl
+],[PACKAGE="$PACKAGE"])])