Re: Solving the config.h nightmare ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ralf Wildenhues <Ralf.Wildenhues@xxxxxx> writes:
> * Olivier Boudeville wrote on Sat, Apr 22, 2006 at 11:51:41PM CEST:

>> it is an interesting solution indeed but I would rather not rely on my
>> hand-crafted stripped-down config.h maintaining ! I will try the
>> prefix-adding first.

> There's an easy solution to the maintenance problem: in your test suite,
> use the stripped-down hand-crafted header only, just as users of your
> library would.

Even your stripped-down version should rename the defines, since they may
otherwise conflict with other Autoconf-using software.  (Yes, usually they
will end up with the same values, but not always.)

For INN, I use the following awk script to generate the internal header
from the regular config.h:

#! /bin/sh

##  $Id: mksystem 6619 2004-01-12 06:09:27Z rra $
##
##  Create include/inn/system.h from include/config.h.
##
##  include/config.h is generated by autoconf and contains all of the test
##  results for a platform.  Most of these are only used when building INN,
##  but some of them are needed for various definitions in the header files
##  for INN's libraries.  We want to be able to install those header files
##  and their prerequisites, but we don't want to define the normal symbols
##  defined by autoconf since they're too likely to conflict with other
##  packages.
##
##  This script takes the path to awk as its first argument and the path to
##  include/config.h as its second argument and generates a file suitable
##  for being included as <inn/system.h>.  It contains only the autoconf
##  results needed for INN's API, and the symbols that might conflict with
##  autoconf results in other packages have INN_ prepended.

cat <<EOF
/* Automatically generated by mksystem from config.h; do not edit. */

/* This header contains information obtained by INN at configure time that
   is needed by INN headers.  Autoconf results that may conflict with the
   autoconf results of another package have INN_ prepended to the
   preprocessor symbols. */

#ifndef INN_SYSTEM_H
#define INN_SYSTEM_H 1

EOF

$1 '

/^#define HAVE_C99_VAMACROS/    { print $1 " INN_" $2 " " $3 }
/^#define HAVE_GNU_VAMACROS/    { print $1 " INN_" $2 " " $3 }
/^#define HAVE_INET6/           { print $1 " INN_" $2 " " $3 }
/^#define HAVE_INTTYPES_H/      { print $1 " INN_" $2 " " $3 }
/^#define HAVE_MSYNC_3_ARG/     { print $1 " INN_" $2 " " $3 }
/^#define HAVE_STDBOOL_H/       { print $1 " INN_" $2 " " $3 }
/^#define HAVE_SYS_BITTYPES_H/  { print $1 " INN_" $2 " " $3 }
/^#define HAVE__BOOL/           { print $1 " INN_" $2 " " $3 }

' $2

cat <<EOF

#endif /* INN_SYSTEM_H */
EOF

-- 
Russ Allbery (rra@xxxxxxxxxxxx)             <http://www.eyrie.org/~eagle/>


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux