AC-Archive
Autoconf Macro Archive

ac-archive.sf.net: - Project CVS - Download
Macro Index
- AM Support
- C++ Support
- C Support
- Fortran Support
- Java Support
- Cross Compilation
- Installed Packages
- Miscellaneous
- LaTeX Support
- Uncategorized
- archive macros
- adl's macros
- bkorb's macros
- guidod's macros
- latex's macros
- other's macros
- rleigh's macros
- obsoleted macros
- released macros
- search index

Documentation
- Contribute!
- History
- acincludedir m4
- acinclude (tool)
- macro howto
- ax tricks
- maintainers
- License
- Topics

generated...
2007年08月05日

(C) 2007 guidod
Synopsis
AC_PREFIX_CONFIG_H [(PREFIX [,ORIG-HEADER [,OUTPUT-HEADER]])]
, 
Version

2006年10月13日

Author

Guido U. Draheim <guidod@gmx.de>

License

GPLWithACException
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. As a special exception, the respective Autoconf Macro's copyright owner gives unlimited permission to copy, distribute and modify the configure scripts that are the output of Autoconf when processing the Macro. You need not follow the terms of the GNU General Public License when using or distributing such scripts

Category

cryp.to ac-archive's Obsoleted (obsoleted)

Documentation
  • obsoleted Use AX_PREFIX_CONFIG_H.

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.

In most cases, the configure.in will contain a line saying

 AC_CONFIG_HEADER(config.h)

somewhere *before* AC_OUTPUT and a simple line saying

 AC_PREFIX_CONFIG_HEADER

somewhere *after* AC_OUTPUT.

example:

 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. :-)
M4 Source Code
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])

AltStyle によって変換されたページ (->オリジナル) /