File: ac_prefix_config_h.html

package info (click to toggle)
autoconf-archive 20060312-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,180 kB
  • ctags: 13
  • sloc: sh: 455; makefile: 44
file content (144 lines) | stat: -rw-r--r-- 4,818 bytes parent folder | download
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
<!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_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_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_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_PREFIX_CONFIG_H [(PREFIX [,ORIG-HEADER [,OUTPUT-HEADER]])]</code>
  </p>
  <h2>
   Description
  </h2>
  <div class="indent">
   <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. If PREFIX is absent, $PACKAGE will be assumed. If the
    ORIG-HEADER is absent, "config.h" will be assumed. If the OUTPUT-HEADER is
    absent, "PREFIX-config.h" will be assumed.
   </p>
   <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_PREFIX_CONFIG_H                 # creates "testpkg-config.h"
        and the resulting "testpkg-config.h" contains lines like
  #define TESTPKG_VERSION "0.1.1"
  #define TESTPKG_NEED_MEMORY_H 1
  #define TESTPKG_const const

  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 &lt;guidod@gmx.de&gt;
  </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_PREFIX_CONFIG_H],
[changequote(&lt;&lt;, &gt;&gt;)dnl
ac_prefix_conf_PKG=`echo ifelse($1, , $PACKAGE, $1)`
ac_prefix_conf_PRE=`echo $ac_prefix_conf_PKG | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
ac_prefix_conf_PRE=`echo $ac_prefix_conf_PRE | sed -e '/^[0-9]/s/^/_/'`
ac_prefix_conf_INP=`echo ifelse($2, , config.h, $2)`
ac_prefix_conf_OUT=`echo ifelse($3, , $ac_prefix_conf_PKG-$ac_prefix_conf_INP, $3)`
ac_prefix_conf_DEF=`echo _$ac_prefix_conf_OUT | tr 'abcdefghijklmnopqrstuvwxyz./,-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ____'`
changequote([, ])dnl
if test -z "$ac_prefix_conf_PKG" ; then
   AC_MSG_ERROR([no prefix for _PREFIX_CONFIG_H])
else
  AC_MSG_RESULT(creating $ac_prefix_conf_OUT - prefix $ac_prefix_conf_PRE for $ac_prefix_conf_INP defines)
  if test -f $ac_prefix_conf_INP ; then
    echo '#ifndef '$ac_prefix_conf_DEF &gt;$ac_prefix_conf_OUT
    echo '#define '$ac_prefix_conf_DEF' 1' &gt;&gt;$ac_prefix_conf_OUT
    echo ' ' &gt;&gt;$ac_prefix_conf_OUT
    echo /'*' $ac_prefix_conf_OUT. Generated automatically at end of configure. '*'/ &gt;&gt;$ac_prefix_conf_OUT

    echo 's/#undef  */#undef '$ac_prefix_conf_PRE'_/' &gt;conftest.sed
    echo 's/#define  *\([A-Za-z0-9_]*\)\(.*\)/#ifndef '$ac_prefix_conf_PRE"_\\1 \\" &gt;&gt;conftest.sed
    echo '#define '$ac_prefix_conf_PRE"_\\1 \\2 \\" &gt;&gt;conftest.sed
    echo '#endif/' &gt;&gt;conftest.sed
    sed -f conftest.sed $ac_prefix_conf_INP &gt;&gt;$ac_prefix_conf_OUT
    echo ' ' &gt;&gt;$ac_prefix_conf_OUT
    echo '/*' $ac_prefix_conf_DEF '*/' &gt;&gt;$ac_prefix_conf_OUT
    echo '#endif' &gt;&gt;$ac_prefix_conf_OUT
  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>