Hi, Several modules already define a C macro that indicates the presence of the particular module:
close-stream.m4: AC_DEFINE([GNULIB_CLOSE_STREAM], [1], fcntl-safer.m4: AC_DEFINE([GNULIB_FCNTL_SAFER], [1], fts.m4: AC_DEFINE([_LGPL_PACKAGE], 1, gc-arcfour.m4: AC_DEFINE(GC_USE_ARCFOUR, 1, gc-arctwo.m4: AC_DEFINE(GC_USE_ARCTWO, 1, gc-des.m4: AC_DEFINE(GC_USE_DES, 1, [Define if you want to support DES through GC.]) gc-hmac-md5.m4: AC_DEFINE(GC_USE_HMAC_MD5, 1, gc-hmac-sha1.m4: AC_DEFINE(GC_USE_HMAC_SHA1, 1, gc-md2.m4: AC_DEFINE(GC_USE_MD2, 1, [Define if you want to support MD2 through GC.]) gc-md4.m4: AC_DEFINE(GC_USE_MD4, 1, [Define if you want to support MD4 through GC.]) gc-md5.m4: AC_DEFINE(GC_USE_MD5, 1, [Define if you want to support MD5 through GC.]) gc-random.m4: AC_DEFINE(GC_USE_RANDOM, 1, [Define if you want to support RNG through GC.]) gc-rijndael.m4: AC_DEFINE(GC_USE_RIJNDAEL, 1, gc-sha1.m4: AC_DEFINE(GC_USE_SHA1, 1, stdio-safer.m4: AC_DEFINE([GNULIB_FOPEN_SAFER], [1], fwriteerror:AC_DEFINE([GNULIB_FWRITEERROR], 1, Some more new modules need the same pattern as well. So I'm adding this automatic definition of macros to gnulib-tool; the macros will be defined through config.h. In the presence of multiple gnulib-tool invocations from the same directory with the same configure.ac file, such macros may indicate the wrong thing (because if you build libgnuA.a and libgnuB.a, the module may be compiled into libgnuA but not into libgnuB). But I think that judicious use of library dependencies can avoid most of the problems; and as a last resort, the remaining problems can be solved by splitting the configure.ac file. 2007-01-01 Bruno Haible <[EMAIL PROTECTED]> * gnulib-tool (func_emit_copyright_notice): Bump year. (func_get_autoconf_snippet): Emit a GNULIB_<modulename> macro. *** gnulib-20061223/gnulib-tool.bak 2006-12-23 21:15:28.000000000 +0100 --- gnulib-20061223/gnulib-tool 2007-01-01 14:23:14.000000000 +0100 *************** *** 1,6 **** #! /bin/sh # ! # Copyright (C) 2002-2006 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by --- 1,6 ---- #! /bin/sh # ! # Copyright (C) 2002-2007 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by *************** *** 192,198 **** # outputs to stdout a header for a generated file. func_emit_copyright_notice () { ! echo "# Copyright (C) 2004-2006 Free Software Foundation, Inc." echo "#" echo "# This file is free software, distributed under the terms of the GNU" echo "# General Public License. As a special exception to the GNU General" --- 192,198 ---- # outputs to stdout a header for a generated file. func_emit_copyright_notice () { ! echo "# Copyright (C) 2004-2007 Free Software Foundation, Inc." echo "#" echo "# This file is free software, distributed under the terms of the GNU" echo "# General Public License. As a special exception to the GNU General" *************** *** 939,944 **** --- 939,947 ---- { func_lookup_file "modules/$1" $SED -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file" + # Define a C macro indicating the presence of the given module. + echo " AC_DEFINE([GNULIB_"`echo "$1" | LC_ALL=C tr 'a-z' 'A-Z' | sed -e 's,[-./],_,g'`"], [1]," + echo " [Define to 1 when using the gnulib module $1.])" } # func_get_automake_snippet module