[AC_EGREP_CPP([You lose], [#include <sys/types.h>
#include <sys/stat.h>
#ifdef S_ISBLK
-#if S_ISBLK (S_IFDIR)
+# if S_ISBLK (S_IFDIR)
You lose.
-#endif
-#ifdef S_IFCHR
-#if S_ISBLK (S_IFCHR)
+# endif
+# ifdef S_IFCHR
+# if S_ISBLK (S_IFCHR)
You lose.
+# endif
+# endif
#endif
-#endif /* S_IFCHR */
-#endif /* S_ISBLK */
+
#ifdef S_ISLNK
-#if S_ISLNK (S_IFREG)
+# if S_ISLNK (S_IFREG)
You lose.
+# endif
#endif
-#endif /* S_ISLNK */
+
#ifdef S_ISSOCK
-#if S_ISSOCK (S_IFREG)
+# if S_ISSOCK (S_IFREG)
You lose.
+# endif
#endif
-#endif /* S_ISSOCK */
], ac_cv_header_stat_broken=yes, ac_cv_header_stat_broken=no)])dnl
AC_MSG_RESULT($ac_cv_header_stat_broken)
if test $ac_cv_header_stat_broken = yes; then
#include <sys/mman.h>
#ifdef BSD
-#ifndef BSD4_1
-#define HAVE_GETPAGESIZE
-#endif
+# ifndef BSD4_1
+# define HAVE_GETPAGESIZE
+# endif
#endif
+
#ifndef HAVE_GETPAGESIZE
-#include <sys/param.h>
-#ifdef EXEC_PAGESIZE
-#define getpagesize() EXEC_PAGESIZE
-#else
-#ifdef NBPG
-#define getpagesize() NBPG * CLSIZE
-#ifndef CLSIZE
-#define CLSIZE 1
-#endif /* no CLSIZE */
-#else /* no NBPG */
-#ifdef NBPC
-#define getpagesize() NBPC
-#else /* no NBPC */
-#define getpagesize() PAGESIZE /* SVR4 */
-#endif /* no NBPC */
-#endif /* no NBPG */
-#endif /* no EXEC_PAGESIZE */
-#endif /* not HAVE_GETPAGESIZE */
+# include <sys/param.h>
+# ifdef EXEC_PAGESIZE
+# define getpagesize() EXEC_PAGESIZE
+# else
+# ifdef NBPG
+# define getpagesize() NBPG * CLSIZE
+# ifndef CLSIZE
+# define CLSIZE 1
+# endif
+# else
+# ifdef NBPC
+# define getpagesize() NBPC
+# else
+# define getpagesize() PAGESIZE /* SVR4 */
+# endif
+# endif
+# endif
+#endif
#ifdef __osf__
-#define valloc malloc
+# define valloc malloc
#endif
-extern char *valloc();
-extern char *malloc();
+#ifdef __cplusplus
+extern "C" { char *valloc(int), *malloc(int); }
+#else
+char *valloc(), *malloc();
+#endif
int
main()
AC_MSG_CHECKING([for alloca])
AC_CACHE_VAL(ac_cv_func_alloca,
-[AC_TRY_LINK([#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else
-#if HAVE_ALLOCA_H
-#include <alloca.h>
+[AC_TRY_LINK([
+#ifdef __GNUC__
+# define alloca __builtin_alloca
#else
-#ifdef _AIX
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
#pragma alloca
-#else
-#ifndef alloca /* predefined by HP cc +Olibcalls */
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
-#endif
-#endif
-#endif
+# endif
+# endif
+# endif
#endif
], [char *p = (char *) alloca(1);],
ac_cv_func_alloca=yes, ac_cv_func_alloca=no)])dnl
This macro is equivalent to calling @code{AC_CHECK_LIB} with a
@var{function} argument of @code{main}. In addition, @var{library} can
be written as any of @samp{foo}, @samp{-lfoo}, or @samp{libfoo.a}. In
-all of those cases, the compiler is passed @samp{-lfoo}. This macro is
-considered obsolete, because some linkers (e.g., Apollo's) do not fail
-when asked to link with a nonexistent library if there are no unresolved
-sybols.
+all of those cases, the compiler is passed @samp{-lfoo}. However,
+@var{library} can not be a shell variable; it must be a constant.
+
+This macro is considered obsolete, because some linkers (e.g., Apollo's)
+do not fail when asked to link with a nonexistent library if there are
+no unresolved sybols.
@end defmac
@defmac AC_PATH_PROG (@var{variable}, @var{prog-to-check-for} @r{[}, @var{value-if-not-found}@r{]})
@noindent
@var{help-string} may be more than one line long, if more detail is
needed. Just make sure the columns line up in @samp{configure --help}.
-Avoid tabs in the help string.
+Avoid tabs in the help string. You'll need to enclose it in @samp{[}
+and @samp{]} in order to produce the leading spaces.
The name @var{feature} should consist only of alphanumeric characters
and dashes. The @var{feature} indicates an optional user-level
@noindent
@var{help-string} may be more than one line long, if more detail is
needed. Just make sure the columns line up in @samp{configure --help}.
-Avoid tabs in the help string.
+Avoid tabs in the help string. You'll need to enclose it in @samp{[}
+and @samp{]} in order to produce the leading spaces.
The name @var{package} should consist only of alphanumeric characters
and dashes. The @var{package} indicates another software package that
#endif
@end example
+Functions that test programs declare should also be conditionalized for
+C++, which requires @samp{extern "C"} prototypes. Make sure to not
+include any header files containing clashing prototypes.
+
+@example
+#ifdef __cplusplus
+extern "C" char *malloc(int);
+#else
+char *malloc();
+#endif
+@end example
+
Test programs can use @code{#if} or @code{#ifdef} to check the values of
preprocessor macros defined by tests that have already run. For
example, if you call @code{AC_HEADER_STDC}, then later on in
This macro is equivalent to calling @code{AC_CHECK_LIB} with a
@var{function} argument of @code{main}. In addition, @var{library} can
be written as any of @samp{foo}, @samp{-lfoo}, or @samp{libfoo.a}. In
-all of those cases, the compiler is passed @samp{-lfoo}. This macro is
-considered obsolete, because some linkers (e.g., Apollo's) do not fail
-when asked to link with a nonexistent library if there are no unresolved
-sybols.
+all of those cases, the compiler is passed @samp{-lfoo}. However,
+@var{library} can not be a shell variable; it must be a constant.
+
+This macro is considered obsolete, because some linkers (e.g., Apollo's)
+do not fail when asked to link with a nonexistent library if there are
+no unresolved sybols.
@end defmac
@defmac AC_PATH_PROG (@var{variable}, @var{prog-to-check-for} @r{[}, @var{value-if-not-found}@r{]})
@noindent
@var{help-string} may be more than one line long, if more detail is
needed. Just make sure the columns line up in @samp{configure --help}.
-Avoid tabs in the help string.
+Avoid tabs in the help string. You'll need to enclose it in @samp{[}
+and @samp{]} in order to produce the leading spaces.
The name @var{feature} should consist only of alphanumeric characters
and dashes. The @var{feature} indicates an optional user-level
@noindent
@var{help-string} may be more than one line long, if more detail is
needed. Just make sure the columns line up in @samp{configure --help}.
-Avoid tabs in the help string.
+Avoid tabs in the help string. You'll need to enclose it in @samp{[}
+and @samp{]} in order to produce the leading spaces.
The name @var{package} should consist only of alphanumeric characters
and dashes. The @var{package} indicates another software package that
#endif
@end example
+Functions that test programs declare should also be conditionalized for
+C++, which requires @samp{extern "C"} prototypes. Make sure to not
+include any header files containing clashing prototypes.
+
+@example
+#ifdef __cplusplus
+extern "C" char *malloc(int);
+#else
+char *malloc();
+#endif
+@end example
+
Test programs can use @code{#if} or @code{#ifdef} to check the values of
preprocessor macros defined by tests that have already run. For
example, if you call @code{AC_HEADER_STDC}, then later on in
[AC_EGREP_CPP([You lose], [#include <sys/types.h>
#include <sys/stat.h>
#ifdef S_ISBLK
-#if S_ISBLK (S_IFDIR)
+# if S_ISBLK (S_IFDIR)
You lose.
-#endif
-#ifdef S_IFCHR
-#if S_ISBLK (S_IFCHR)
+# endif
+# ifdef S_IFCHR
+# if S_ISBLK (S_IFCHR)
You lose.
+# endif
+# endif
#endif
-#endif /* S_IFCHR */
-#endif /* S_ISBLK */
+
#ifdef S_ISLNK
-#if S_ISLNK (S_IFREG)
+# if S_ISLNK (S_IFREG)
You lose.
+# endif
#endif
-#endif /* S_ISLNK */
+
#ifdef S_ISSOCK
-#if S_ISSOCK (S_IFREG)
+# if S_ISSOCK (S_IFREG)
You lose.
+# endif
#endif
-#endif /* S_ISSOCK */
], ac_cv_header_stat_broken=yes, ac_cv_header_stat_broken=no)])dnl
AC_MSG_RESULT($ac_cv_header_stat_broken)
if test $ac_cv_header_stat_broken = yes; then
#include <sys/mman.h>
#ifdef BSD
-#ifndef BSD4_1
-#define HAVE_GETPAGESIZE
-#endif
+# ifndef BSD4_1
+# define HAVE_GETPAGESIZE
+# endif
#endif
+
#ifndef HAVE_GETPAGESIZE
-#include <sys/param.h>
-#ifdef EXEC_PAGESIZE
-#define getpagesize() EXEC_PAGESIZE
-#else
-#ifdef NBPG
-#define getpagesize() NBPG * CLSIZE
-#ifndef CLSIZE
-#define CLSIZE 1
-#endif /* no CLSIZE */
-#else /* no NBPG */
-#ifdef NBPC
-#define getpagesize() NBPC
-#else /* no NBPC */
-#define getpagesize() PAGESIZE /* SVR4 */
-#endif /* no NBPC */
-#endif /* no NBPG */
-#endif /* no EXEC_PAGESIZE */
-#endif /* not HAVE_GETPAGESIZE */
+# include <sys/param.h>
+# ifdef EXEC_PAGESIZE
+# define getpagesize() EXEC_PAGESIZE
+# else
+# ifdef NBPG
+# define getpagesize() NBPG * CLSIZE
+# ifndef CLSIZE
+# define CLSIZE 1
+# endif
+# else
+# ifdef NBPC
+# define getpagesize() NBPC
+# else
+# define getpagesize() PAGESIZE /* SVR4 */
+# endif
+# endif
+# endif
+#endif
#ifdef __osf__
-#define valloc malloc
+# define valloc malloc
#endif
-extern char *valloc();
-extern char *malloc();
+#ifdef __cplusplus
+extern "C" { char *valloc(int), *malloc(int); }
+#else
+char *valloc(), *malloc();
+#endif
int
main()
AC_MSG_CHECKING([for alloca])
AC_CACHE_VAL(ac_cv_func_alloca,
-[AC_TRY_LINK([#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else
-#if HAVE_ALLOCA_H
-#include <alloca.h>
+[AC_TRY_LINK([
+#ifdef __GNUC__
+# define alloca __builtin_alloca
#else
-#ifdef _AIX
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
#pragma alloca
-#else
-#ifndef alloca /* predefined by HP cc +Olibcalls */
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
-#endif
-#endif
-#endif
+# endif
+# endif
+# endif
#endif
], [char *p = (char *) alloca(1);],
ac_cv_func_alloca=yes, ac_cv_func_alloca=no)])dnl