]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Use the style we promote.
authorAkim Demaille <akim@epita.fr>
Tue, 8 Feb 2000 09:34:19 +0000 (09:34 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 8 Feb 2000 09:34:19 +0000 (09:34 +0000)
* 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.

ChangeLog
acspecific.m4
autoconf.texi
doc/autoconf.texi
lib/autoconf/specific.m4

index 3fb39e91f4341966e4ece00c29de5e976283b0e6..3e41b454f91ad0feb1a8452fd100e025460a49d3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2000-02-08  Akim Demaille  <akim@epita.fr>
+
+       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  <akim@epita.fr>
 
        Quote properly AC_SHELL_IFELSE and callers.
index 15afd5c0d3df394eccb3cc8fdb736190869929b4..a4c5ea65272f0e09469122624387b9349445dcc4 100644 (file)
@@ -1084,7 +1084,7 @@ AC_DEFUN(AC_DECL_SYS_SIGLIST,
 [AC_TRY_COMPILE([#include <sys/types.h>
 #include <signal.h>
 /* NetBSD declares sys_siglist in unistd.h.  */
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 # include <unistd.h>
 #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 <string.h>, include <memory.h>.
 # 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 <sys/types.h>
 #include <signal.h>
 #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 <sys/mman.h>
 
 /* This mess was copied from the GNU getpagesize.h.  */
-#ifndef HAVE_GETPAGESIZE
-# ifdef HAVE_UNISTD_H
+#if !HAVE_GETPAGESIZE
+# if HAVE_UNISTD_H
 #  include <unistd.h>
 # 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 <sys/param.h>
 #   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 <unistd.h>
 #endif
 
@@ -1568,10 +1568,10 @@ AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 # include <unistd.h>
 #endif
-#ifdef HAVE_VFORK_H
+#if HAVE_VFORK_H
 # include <vfork.h>
 #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 <sys/types.h>
+[#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
 #endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
+#if HAVE_SYS_TIME_H
+# include <sys/time.h>
 #endif
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
+#if HAVE_SYS_SELECT_H
+# include <sys/select.h>
 #endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
 #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)
index 905756f2372a068eeea9d5a954a08a964c5cba80..6ab36568a9b5c45123e8d6635dd2ebd9f097826a 100644 (file)
@@ -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 <unistd.h>
+#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:
index 905756f2372a068eeea9d5a954a08a964c5cba80..6ab36568a9b5c45123e8d6635dd2ebd9f097826a 100644 (file)
@@ -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 <unistd.h>
+#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:
index 15afd5c0d3df394eccb3cc8fdb736190869929b4..a4c5ea65272f0e09469122624387b9349445dcc4 100644 (file)
@@ -1084,7 +1084,7 @@ AC_DEFUN(AC_DECL_SYS_SIGLIST,
 [AC_TRY_COMPILE([#include <sys/types.h>
 #include <signal.h>
 /* NetBSD declares sys_siglist in unistd.h.  */
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 # include <unistd.h>
 #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 <string.h>, include <memory.h>.
 # 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 <sys/types.h>
 #include <signal.h>
 #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 <sys/mman.h>
 
 /* This mess was copied from the GNU getpagesize.h.  */
-#ifndef HAVE_GETPAGESIZE
-# ifdef HAVE_UNISTD_H
+#if !HAVE_GETPAGESIZE
+# if HAVE_UNISTD_H
 #  include <unistd.h>
 # 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 <sys/param.h>
 #   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 <unistd.h>
 #endif
 
@@ -1568,10 +1568,10 @@ AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 # include <unistd.h>
 #endif
-#ifdef HAVE_VFORK_H
+#if HAVE_VFORK_H
 # include <vfork.h>
 #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 <sys/types.h>
+[#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
 #endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
+#if HAVE_SYS_TIME_H
+# include <sys/time.h>
 #endif
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
+#if HAVE_SYS_SELECT_H
+# include <sys/select.h>
 #endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
 #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)