1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>
Autoconf Macro: ac_create_prefix_config_h
</title>
<link rel="stylesheet" type="text/css" href="ac-archive.css">
</head>
<body>
<table summary="web navigation" style="width:100%;">
<tbody>
<tr>
<td style="width:50%;" align="center">
<a href=
"http://autoconf-archive.cryp.to/ac_create_prefix_config_h.m4">Download
M4 Source</a>
</td>
<td style="width:50%;" align="center">
<a href="macros-by-category.html">Macro Index Page</a>
</td>
</tr>
</tbody>
</table>
<hr>
<h1>
ac_create_prefix_config_h
</h1>
<h2>
Obsolete Macro
</h2>
<p class="indent">
Use AX_PREFIX_CONFIG_H.
</p>
<h2>
Synopsis
</h2>
<p class="indent" style="white-space:nowrap;">
<code>AC_CREATE_PREFIX_CONFIG_H [(OUTPUT-HEADER [,PREFIX
[,ORIG-HEADER]])]</code>
</p>
<h2>
Description
</h2>
<div class="indent">
<p>
* this is a new variant from ac_prefix_config_ this one will use a
lowercase-prefix if the config-define was starting with a lowercase-char,
e.g.
</p>
<pre>
#define const or #define restrict or #define off_t
</pre>
<p>
(and this one can live in another directory, e.g. testpkg/config.h
therefore I decided to move the output-header to be the first arg)
</p>
<p>
takes the usual config.h generated header file; looks for each of the
generated "#define SOMEDEF" lines, and prefixes the defined name (ie. makes
it "#define PREFIX_SOMEDEF". The result is written to the output
config.header file. The PREFIX is converted to uppercase for the
conversions.
</p>
<p>
- default OUTPUT-HEADER = $PACKAGE-config.h - default PREFIX = $PACKAGE -
default ORIG-HEADER, derived from OUTPUT-HEADER
</p>
<pre>
if OUTPUT-HEADER has a "/", use the basename
if OUTPUT-HEADER has a "-", use the section after it.
otherwise, just config.h
</pre>
<p>
In most cases, the configure.in will contain a line saying
</p>
<pre>
AC_CONFIG_HEADER(config.h)
</pre>
<p>
somewhere *before* AC_OUTPUT and a simple line saying
</p>
<pre>
AC_PREFIX_CONFIG_HEADER
</pre>
<p>
somewhere *after* AC_OUTPUT.
</p>
<p>
example:
</p>
<pre>
AC_INIT(config.h.in) # config.h.in as created by "autoheader"
AM_INIT_AUTOMAKE(testpkg, 0.1.1) # "#undef VERSION" and "PACKAGE"
AM_CONFIG_HEADER(config.h) # in config.h.in
AC_MEMORY_H # "#undef NEED_MEMORY_H"
AC_C_CONST_H # "#undef const"
AC_OUTPUT(Makefile) # creates the "config.h" now
AC_CREATE_PREFIX_CONFIG_H # creates "testpkg-config.h"
and the resulting "testpkg-config.h" contains lines like
#ifndef TESTPKG_VERSION
#define TESTPKG_VERSION "0.1.1"
#endif
#ifndef TESTPKG_NEED_MEMORY_H
#define TESTPKG_NEED_MEMORY_H 1
#endif
#ifndef _testpkg_const
#define _testpkg_const const
#endif
and this "testpkg-config.h" can be installed along with other
header-files, which is most convenient when creating a shared
library (that has some headers) where some functionality is
dependent on the OS-features detected at compile-time. No
need to invent some "testpkg-confdefs.h.in" manually. :-)
</pre>
</div>
<h2>
Author
</h2>
<p class="indent">
Guido Draheim <guidod@gmx.de>
</p>
<h2>
Last Modified
</h2>
<p class="indent">
2005-01-25
</p>
<h2>
M4 Source Code
</h2>
<div class="indent">
<pre class="m4source">
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
AC_ECHO_MKFILE([/* 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])
</pre>
</div>
</body>
</html>
|