From: Akim Demaille Date: Tue, 8 Feb 2000 09:34:19 +0000 (+0000) Subject: Use the style we promote. X-Git-Tag: autoconf-2.50~1218 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bfe8456484ddbb5be9c76bc4d5d1cdc9eade707a;p=thirdparty%2Fautoconf.git Use the style we promote. * doc/autoconf.texi (Header Templates): Promote #if over #ifdef; and #undef over #define in templates. * acspecific.m4 (AC_DECL_SYS_SIGLIST, AC_FUNC_MMAP, AC_FUNC_SETPGRP, AC_FUNC_VFORK, AC_FUNC_SELECT_ARGTYPES): Use #if, not #ifdef and #ifndef, indent CPP directives. --- diff --git a/ChangeLog b/ChangeLog index 3fb39e91f..3e41b454f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2000-02-08 Akim Demaille + + Use the style we promote. + + * doc/autoconf.texi (Header Templates): Promote #if over #ifdef; + and #undef over #define in templates. + * acspecific.m4 (AC_DECL_SYS_SIGLIST, AC_FUNC_MMAP, + AC_FUNC_SETPGRP, AC_FUNC_VFORK, AC_FUNC_SELECT_ARGTYPES): Use #if, + not #ifdef and #ifndef, indent CPP directives. + 2000-02-08 Akim Demaille Quote properly AC_SHELL_IFELSE and callers. diff --git a/acspecific.m4 b/acspecific.m4 index 15afd5c0d..a4c5ea652 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -1084,7 +1084,7 @@ AC_DEFUN(AC_DECL_SYS_SIGLIST, [AC_TRY_COMPILE([#include #include /* NetBSD declares sys_siglist in unistd.h. */ -#ifdef HAVE_UNISTD_H +#if HAVE_UNISTD_H # include #endif ], [char *msg = *(sys_siglist + 1);], @@ -1126,12 +1126,12 @@ fi AC_DEFUNCT(AC_UNISTD_H, [; instead use AC_CHECK_HEADERS(unistd.h)]) AC_DEFUNCT(AC_USG, - [; instead use AC_CHECK_HEADERS(string.h) and HAVE_STRING_H]) + [; instead use AC_CHECK_HEADERS(string.h) and HAVE_STRING_H]) # If memchr and the like aren't declared in , include . # To avoid problems, don't check for gcc2 built-ins. AC_DEFUNCT(AC_MEMORY_H, - [; instead use AC_CHECK_HEADERS(memory.h) and HAVE_MEMORY_H]) + [; instead use AC_CHECK_HEADERS(memory.h) and HAVE_MEMORY_H]) AC_DEFUNCT(AC_DIR_HEADER, [; instead use AC_HEADER_DIRENT]) @@ -1222,7 +1222,7 @@ AC_DEFUN(AC_TYPE_SIGNAL, [AC_TRY_COMPILE([#include #include #ifdef signal -#undef signal +# undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); @@ -1286,7 +1286,7 @@ AC_CACHE_CHECK(for working fnmatch, ac_cv_func_fnmatch_works, #endif int -main() +main () { exit (fnmatch ("a*", "abc", 0) != 0); }], @@ -1305,8 +1305,8 @@ AC_DEFUN(AC_FUNC_MMAP, [AC_CHECK_HEADERS(unistd.h) AC_CHECK_FUNCS(getpagesize) AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped, -[AC_TRY_RUN([ -/* Thanks to Mike Haertel and Jim Avera for this test. +[AC_TRY_RUN( +[/* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped @@ -1332,20 +1332,20 @@ AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped, #include /* This mess was copied from the GNU getpagesize.h. */ -#ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H +#if !HAVE_GETPAGESIZE +# if HAVE_UNISTD_H # include # endif /* Assume that all systems that can run configure have sys/param.h. */ -# ifndef HAVE_SYS_PARAM_H +# if !HAVE_SYS_PARAM_H # define HAVE_SYS_PARAM_H 1 # endif # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ -# ifdef HAVE_SYS_PARAM_H +# if HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE @@ -1513,7 +1513,7 @@ fi AC_DEFUN(AC_FUNC_SETPGRP, [AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void, AC_TRY_RUN( -[#ifdef HAVE_UNISTD_H +[#if HAVE_UNISTD_H # include #endif @@ -1568,10 +1568,10 @@ AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works, #include #include #include -#ifdef HAVE_UNISTD_H +#if HAVE_UNISTD_H # include #endif -#ifdef HAVE_VFORK_H +#if HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming @@ -2223,17 +2223,17 @@ AC_DEFUN(AC_FUNC_SELECT_ARGTYPES, for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do AC_TRY_COMPILE(dnl -[#ifdef HAVE_SYS_TYPES_H -#include +[#if HAVE_SYS_TYPES_H +# include #endif -#ifdef HAVE_SYS_TIME_H -#include +#if HAVE_SYS_TIME_H +# include #endif -#ifdef HAVE_SYS_SELECT_H -#include +#if HAVE_SYS_SELECT_H +# include #endif -#ifdef HAVE_SYS_SOCKET_H -#include +#if HAVE_SYS_SOCKET_H +# include #endif extern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl [ac_not_found=no ; break 3],ac_not_found=yes) diff --git a/autoconf.texi b/autoconf.texi index 905756f23..6ab36568a 100644 --- a/autoconf.texi +++ b/autoconf.texi @@ -690,7 +690,7 @@ Print the version number of Autoconf and exit. @item --trace=@var{macro} @itemx -t @var{macro} List the calls to @var{macro}. Multiple calls to @samp{--trace} list -several macros. It is adviced to use this feature instead of parsing +several macros. It is advised to use this feature instead of parsing @file{configure.in}. The output is composed of separated lines for each macro call. Each @@ -1309,8 +1309,8 @@ input file and may overwrite one of your boilerplates. @subsection Configuration Header Templates Your distribution should contain a template file that looks as you want -the final header file to look, including comments, with default values -in the @code{#define} statements. For example, suppose your +the final header file to look, including comments, with @code{#undef} +statements which are used as hooks. For example, suppose your @file{configure.in} makes these calls: @example @@ -1319,35 +1319,44 @@ AC_CHECK_HEADERS(unistd.h) @end example @noindent -Then you could have code like the following in @file{conf.h.in}. -On systems that have @file{unistd.h}, @code{configure} will change the 0 -to a 1. On other systems, it will leave the line unchanged. +Then you could have code like the following in @file{conf.h.in}. On +systems that have @file{unistd.h}, @code{configure} will @samp{#define} +@samp{HAVE_UNISTD_H} to 1. On other systems, the whole line will be +commented out (in case the system predefines that symbol). @example @group /* Define as 1 if you have unistd.h. */ -#define HAVE_UNISTD_H 0 +#undef HAVE_UNISTD_H @end group @end example -Alternately, if your code tests for configuration options using -@code{#ifdef} instead of @code{#if}, a default value can be to -@code{#undef} the variable instead of to define it to a value. On -systems that have @file{unistd.h}, @code{configure} will change the -second line to read @samp{#define HAVE_UNISTD_H 1}. On other systems, -it will comment that line out (in case the system predefines that -symbol). +You can then decode the configuration header using the preprocessor +directives: @example @group -/* Define if you have unistd.h. */ -#undef HAVE_UNISTD_H +#include "conf.h" + +#if HAVE_UNISTD_D +# include +#else +/* We are in trouble. */ +#endif @end group @end example -@node Invoking autoheader, , Header Templates, Configuration Headers +The use of old form templates, with @samp{#define} instead of +@samp{#undef} is strongly discouraged. + +Since it is a tedious task to keep a template header up to date, you may +use @code{autoheader} to generate it, see @ref{Invoking autoheader}. + + +@node Invoking autoheader,, Header Templates, Configuration Headers @subsection Using @code{autoheader} to Create @file{config.h.in} + The @code{autoheader} program can create a template file of C @samp{#define} statements for @code{configure} to use. If @file{configure.in} invokes @code{AC_CONFIG_HEADER(@var{file})}, @@ -6226,3 +6235,7 @@ easier to use, the macros are listed without their preceding @samp{AC_}. @contents @bye + +@c Local Variables: +@c ispell-local-dictionary: "american" +@c End: diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 905756f23..6ab36568a 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -690,7 +690,7 @@ Print the version number of Autoconf and exit. @item --trace=@var{macro} @itemx -t @var{macro} List the calls to @var{macro}. Multiple calls to @samp{--trace} list -several macros. It is adviced to use this feature instead of parsing +several macros. It is advised to use this feature instead of parsing @file{configure.in}. The output is composed of separated lines for each macro call. Each @@ -1309,8 +1309,8 @@ input file and may overwrite one of your boilerplates. @subsection Configuration Header Templates Your distribution should contain a template file that looks as you want -the final header file to look, including comments, with default values -in the @code{#define} statements. For example, suppose your +the final header file to look, including comments, with @code{#undef} +statements which are used as hooks. For example, suppose your @file{configure.in} makes these calls: @example @@ -1319,35 +1319,44 @@ AC_CHECK_HEADERS(unistd.h) @end example @noindent -Then you could have code like the following in @file{conf.h.in}. -On systems that have @file{unistd.h}, @code{configure} will change the 0 -to a 1. On other systems, it will leave the line unchanged. +Then you could have code like the following in @file{conf.h.in}. On +systems that have @file{unistd.h}, @code{configure} will @samp{#define} +@samp{HAVE_UNISTD_H} to 1. On other systems, the whole line will be +commented out (in case the system predefines that symbol). @example @group /* Define as 1 if you have unistd.h. */ -#define HAVE_UNISTD_H 0 +#undef HAVE_UNISTD_H @end group @end example -Alternately, if your code tests for configuration options using -@code{#ifdef} instead of @code{#if}, a default value can be to -@code{#undef} the variable instead of to define it to a value. On -systems that have @file{unistd.h}, @code{configure} will change the -second line to read @samp{#define HAVE_UNISTD_H 1}. On other systems, -it will comment that line out (in case the system predefines that -symbol). +You can then decode the configuration header using the preprocessor +directives: @example @group -/* Define if you have unistd.h. */ -#undef HAVE_UNISTD_H +#include "conf.h" + +#if HAVE_UNISTD_D +# include +#else +/* We are in trouble. */ +#endif @end group @end example -@node Invoking autoheader, , Header Templates, Configuration Headers +The use of old form templates, with @samp{#define} instead of +@samp{#undef} is strongly discouraged. + +Since it is a tedious task to keep a template header up to date, you may +use @code{autoheader} to generate it, see @ref{Invoking autoheader}. + + +@node Invoking autoheader,, Header Templates, Configuration Headers @subsection Using @code{autoheader} to Create @file{config.h.in} + The @code{autoheader} program can create a template file of C @samp{#define} statements for @code{configure} to use. If @file{configure.in} invokes @code{AC_CONFIG_HEADER(@var{file})}, @@ -6226,3 +6235,7 @@ easier to use, the macros are listed without their preceding @samp{AC_}. @contents @bye + +@c Local Variables: +@c ispell-local-dictionary: "american" +@c End: diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index 15afd5c0d..a4c5ea652 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -1084,7 +1084,7 @@ AC_DEFUN(AC_DECL_SYS_SIGLIST, [AC_TRY_COMPILE([#include #include /* NetBSD declares sys_siglist in unistd.h. */ -#ifdef HAVE_UNISTD_H +#if HAVE_UNISTD_H # include #endif ], [char *msg = *(sys_siglist + 1);], @@ -1126,12 +1126,12 @@ fi AC_DEFUNCT(AC_UNISTD_H, [; instead use AC_CHECK_HEADERS(unistd.h)]) AC_DEFUNCT(AC_USG, - [; instead use AC_CHECK_HEADERS(string.h) and HAVE_STRING_H]) + [; instead use AC_CHECK_HEADERS(string.h) and HAVE_STRING_H]) # If memchr and the like aren't declared in , include . # To avoid problems, don't check for gcc2 built-ins. AC_DEFUNCT(AC_MEMORY_H, - [; instead use AC_CHECK_HEADERS(memory.h) and HAVE_MEMORY_H]) + [; instead use AC_CHECK_HEADERS(memory.h) and HAVE_MEMORY_H]) AC_DEFUNCT(AC_DIR_HEADER, [; instead use AC_HEADER_DIRENT]) @@ -1222,7 +1222,7 @@ AC_DEFUN(AC_TYPE_SIGNAL, [AC_TRY_COMPILE([#include #include #ifdef signal -#undef signal +# undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); @@ -1286,7 +1286,7 @@ AC_CACHE_CHECK(for working fnmatch, ac_cv_func_fnmatch_works, #endif int -main() +main () { exit (fnmatch ("a*", "abc", 0) != 0); }], @@ -1305,8 +1305,8 @@ AC_DEFUN(AC_FUNC_MMAP, [AC_CHECK_HEADERS(unistd.h) AC_CHECK_FUNCS(getpagesize) AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped, -[AC_TRY_RUN([ -/* Thanks to Mike Haertel and Jim Avera for this test. +[AC_TRY_RUN( +[/* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped @@ -1332,20 +1332,20 @@ AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped, #include /* This mess was copied from the GNU getpagesize.h. */ -#ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H +#if !HAVE_GETPAGESIZE +# if HAVE_UNISTD_H # include # endif /* Assume that all systems that can run configure have sys/param.h. */ -# ifndef HAVE_SYS_PARAM_H +# if !HAVE_SYS_PARAM_H # define HAVE_SYS_PARAM_H 1 # endif # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ -# ifdef HAVE_SYS_PARAM_H +# if HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE @@ -1513,7 +1513,7 @@ fi AC_DEFUN(AC_FUNC_SETPGRP, [AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void, AC_TRY_RUN( -[#ifdef HAVE_UNISTD_H +[#if HAVE_UNISTD_H # include #endif @@ -1568,10 +1568,10 @@ AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works, #include #include #include -#ifdef HAVE_UNISTD_H +#if HAVE_UNISTD_H # include #endif -#ifdef HAVE_VFORK_H +#if HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming @@ -2223,17 +2223,17 @@ AC_DEFUN(AC_FUNC_SELECT_ARGTYPES, for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do AC_TRY_COMPILE(dnl -[#ifdef HAVE_SYS_TYPES_H -#include +[#if HAVE_SYS_TYPES_H +# include #endif -#ifdef HAVE_SYS_TIME_H -#include +#if HAVE_SYS_TIME_H +# include #endif -#ifdef HAVE_SYS_SELECT_H -#include +#if HAVE_SYS_SELECT_H +# include #endif -#ifdef HAVE_SYS_SOCKET_H -#include +#if HAVE_SYS_SOCKET_H +# include #endif extern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl [ac_not_found=no ; break 3],ac_not_found=yes)