[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Solving the config.h nightmare ?
From: |
Russ Allbery |
Subject: |
Re: Solving the config.h nightmare ? |
Date: |
Sat, 22 Apr 2006 18:58:52 -0700 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) XEmacs/21.4.18 (linux) |
Ralf Wildenhues <address@hidden> 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 (address@hidden) <http://www.eyrie.org/~eagle/>
- Solving the config.h nightmare ?, Olivier Boudeville, 2006/04/22
- Re: Solving the config.h nightmare ?, Bob Friesenhahn, 2006/04/22
- Re: Solving the config.h nightmare ?, Bruce Korb, 2006/04/22
- Re: Solving the config.h nightmare ?, Olivier Boudeville, 2006/04/22
- Re: Solving the config.h nightmare ?, Ralf Wildenhues, 2006/04/22
- Re: Solving the config.h nightmare ?,
Russ Allbery <=
- Re: Solving the config.h nightmare ?, Bob Friesenhahn, 2006/04/22
- Re: Solving the config.h nightmare ?, Ralf Wildenhues, 2006/04/23
- Re: Solving the config.h nightmare ?, Russ Allbery, 2006/04/23
- Re: Solving the config.h nightmare ?, Ralf Wildenhues, 2006/04/23
- Re: Solving the config.h nightmare ?, Daniel Reed, 2006/04/23
- Re: Solving the config.h nightmare ?, Russ Allbery, 2006/04/23
- Re: Solving the config.h nightmare ?, Bob Friesenhahn, 2006/04/23
- Re: Solving the config.h nightmare ?, Daniel Reed, 2006/04/23
- Re: Solving the config.h nightmare ?, Bob Friesenhahn, 2006/04/23
- Re: Solving the config.h nightmare ?, Daniel Reed, 2006/04/23