autoconf
[Top][All Lists]
Advanced

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

Re: Use of config.h: summary of responses.


From: Russ Allbery
Subject: Re: Use of config.h: summary of responses.
Date: Mon, 13 Sep 2004 12:52:10 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through Obscurity, linux)

Dale Mellor <address@hidden> writes:

> I recieved about half a dozen responses to this and the overriding
> message is: config.h is worse than useless for packages which install
> libraries and public header files, so don't use it (bottom line is, the
> library developer has no control over the environment in which a library
> gets linked, and the environment that was in effect when the library was
> built is largely irrelevant). The situation might change in future, but
> it is unlikely. You'll just have to work out your own solutions to
> problems of conveying useful autoconf data to eventual application
> programs.

I've posted this on several occasions.  This strategy works great for me.

#! /bin/sh

##  $Id: mksystem,v 1.8 2004/01/12 06:09:27 rra Exp $
##
##  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/>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]