* AC_MSG_CHECKING and AC_MSG_RESULT to print test results, on a single line,
whether or not the test succeeds. They obsolete AC_CHECKING and AC_VERBOSE.
* AC_SUBST_FILE, to insert one file into another.
+* AC_SUBST_DEFAULT, to copy a variable from the configure environment into
+ Makefiles with a default fallback value.
** Changed macros:
* Many macros renamed, but old names are accepted for backward compatibility.
* AC_OUTPUT allows the optional environment variable CONFIG_STATUS to
override the file name "config.status".
* AC_OUTPUT and AC_CONFIG_HEADER allow you to override the input-file names.
+* AC_OUTPUT automatically substitutes the values of CFLAGS, CXXFLAGS, and
+ LDFLAGS from the environment, with default values.
* AC_PROG_INSTALL looks for install.sh in the directory specified by
AC_CONFIG_AUXDIR, or srcdir or srcdir/.. or srcdir/../.. by default.
* AC_DEFINE and AC_DEFINE_UNQUOTED are more robust and smaller.
------------------------------------------------------------------------------
-* Add AC_{INCLUDE,LIB}_DIR? (Noah Friedman's suggestion.)
+* Try it on Emacs configure.in, and adapt that to use the new features.
------------------------------------------------------------------------------
])dnl
dnl
dnl Try to have only one #! line, so the script doesn't look funny.
-dnl AC_BINSH()
-AC_DEFUN(AC_BINSH,
+dnl AC_INIT_BINSH()
+AC_DEFUN(AC_INIT_BINSH,
[#!/bin/sh
])dnl
dnl
dnl AC_INIT(UNIQUE-FILE-IN-SOURCE-DIR)
AC_DEFUN(AC_INIT,
-[AC_REQUIRE([AC_BINSH])dnl
+[AC_REQUIRE([AC_INIT_BINSH])dnl
AC_INIT_NOTICE
AC_INIT_PARSE_ARGS
AC_INIT_PREPARE($1)])dnl
AC_SUBST(prefix)dnl
AC_SUBST(exec_prefix)dnl
AC_SUBST(DEFS)dnl
+AC_SUBST_DEFAULT(CFLAGS, -g)dnl
+AC_SUBST_DEFAULT(CXXFLAGS, -g)dnl
+AC_SUBST_DEFAULT(LDFLAGS, )dnl
])dnl
dnl
dnl AC_ARG_ENABLE(FEATURE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE])
dnl
dnl AC_REVISION(REVISION-INFO)
AC_DEFUN(AC_REVISION,
-[AC_REQUIRE([AC_BINSH])dnl
+[AC_REQUIRE([AC_INIT_BINSH])dnl
[# From configure.in] translit([$1], $")])dnl
dnl
dnl Subroutines of AC_PREREQ.
divert(AC_DIVERSION_NORMAL)dnl
])])dnl
dnl
-dnl AC_SUBST_FILE(VARIABLE, FILE)
+dnl AC_SUBST_FILE(VARIABLE)
AC_DEFUN(AC_SUBST_FILE,
-[if test -f $2; then
- echo using $2 for $1)
- AC_INSERT_FILE($1, $2)
-elif test -f ${srcdir}/$2; then
- echo using ${srcdir}/$2 for $1)
- AC_INSERT_FILE($1, ${srcdir}/$2)
-fi
-])dnl
-dnl Internal subroutine of AC_SUBST_FILE.
-AC_DEFUN(AC_INSERT_FILE,
[ifdef([AC_SUBST_$1], ,
[define([AC_SUBST_$1], )dnl
divert(AC_DIVERSION_SED)dnl
divert(AC_DIVERSION_NORMAL)dnl
])])dnl
dnl
+dnl AC_SUBST_DEFAULT(VARIABLE [, DEFAULT-VALUE])
+AC_DEFUN(AC_SUBST_DEFAULT,
+[$1=${$1-"$2"}
+AC_SUBST($1)dnl
+])dnl
+dnl
dnl
dnl ### Printing messages
dnl
AC_DEFUN(AC_EGREP_CPP,
[AC_REQUIRE_CPP()dnl
cat > conftest.${ac_ext} <<EOF
+#line __LINE__ "configure"
#include "confdefs.h"
[$2]
EOF
AC_DEFUN(AC_TRY_LINK,
[dnl We use return because because C++ requires a prototype for exit.
cat > conftest.${ac_ext} <<EOF
+#line __LINE__ "configure"
#include "confdefs.h"
[$1]
int main() { return 0; }
])
else
cat > conftest.${ac_ext} <<EOF
+#line __LINE__ "configure"
#include "confdefs.h"
[$1]
EOF
AC_DEFUN(AC_TRY_CPP,
[AC_REQUIRE_CPP()dnl
cat > conftest.${ac_ext} <<EOF
+#line __LINE__ "configure"
#include "confdefs.h"
[$1]
EOF
dnl AC_CHECK_HEADER(HEADER-FILE, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
AC_DEFUN(AC_CHECK_HEADER,
[dnl Do the transliteration at runtime so arg 1 can be a shell variable.
-ac_var=`echo "$1" | tr './' '__'`
+ac_safe=`echo "$1" | tr './' '__'`
AC_MSG_CHECKING([for $1])
-AC_CACHE_VAL(ac_cv_header_$ac_var,
-[AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_var=yes",
- eval "ac_cv_header_$ac_var=no")])dnl
-if eval "test \"`echo '$ac_cv_header_'$ac_var`\" = yes"; then
+AC_CACHE_VAL(ac_cv_header_$ac_safe,
+[AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_safe=yes",
+ eval "ac_cv_header_$ac_safe=no")])dnl
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
done
ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
ifdef([AC_LIST_HEADERS],
[trap 'rm -fr $1 AC_LIST_HEADERS conftest*; exit 1' 1 2 15],
test -z "$ac_cv_path_install" && ac_cv_path_install="$ac_install_sh"])dnl
INSTALL="$ac_cv_path_install"
fi
-dnl We do this instead of AC_SUBST, to get relative paths right.
-ac_given_INSTALL=$INSTALL
+dnl We do special magic for INSTALL instead of AC_SUBST, to get
+dnl relative paths right.
AC_MSG_RESULT($INSTALL)
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
])dnl
dnl
AC_DEFUN(AC_HEADER_MAJOR,
-[AC_MSG_CHECKING([for major, minor and makedev header])
-AC_CACHE_VAL(ac_cv_header_major,
-[AC_TRY_LINK([#include <sys/types.h>],
-[return makedev(0, 0);], ac_cv_header_major=sys/types.h, ac_cv_header_major=no)
-if test $ac_cv_header_major = no; then
-AC_CHECK_HEADER(sys/mkdev.h, ac_cv_header_major=sys/mkdev.h)
-fi
-if test $ac_cv_header_major = no; then
-AC_CHECK_HEADER(sys/sysmacros.h, ac_cv_header_major=sys/sysmacros.h)
-fi])dnl
-AC_MSG_RESULT($ac_cv_header_major)
-case "$ac_cv_header_major" in
-sys/mkdev.h) AC_DEFINE(MAJOR_IN_MKDEV) ;;
-sys/sysmacros.h) AC_DEFINE(MAJOR_IN_SYSMACROS) ;;
-esac
+[AC_MSG_CHECKING(whether sys/types.h defines makedev)
+AC_CACHE_VAL(ac_cv_header_sys_types_h_makedev,
+[AC_TRY_LINK([#include <sys/types.h>], [return makedev(0, 0);],
+ ac_cv_header_sys_types_h_makedev=yes, ac_cv_header_sys_types_h_makedev=no)
+])dnl
+AC_MSG_RESULT($ac_cv_header_sys_types_h_makedev)
+
+if test $ac_cv_header_sys_types_h_makedev = no; then
+AC_CHECK_HEADER(sys/mkdev.h, [AC_DEFINE(MAJOR_IN_MKDEV)])
+
+ if test $ac_cv_header_sys_mkdev_h = no; then
+AC_CHECK_HEADER(sys/sysmacros.h, [AC_DEFINE(MAJOR_IN_SYSMACROS)])
+ fi
+fi
])dnl
dnl
AC_DEFUN(AC_HEADER_DIRENT,
status=1
fi
-case $# in
- 0) cat $tmpout > configure; chmod +x configure ;;
- 1) cat $tmpout ;;
-esac
+if test $# -eq 0; then
+ exec > configure; chmod +x configure
+fi
+
+# Put the real line numbers into configure to make config.log more helpful.
+awk '
+/__LINE__/ { printf "%d:", NR + 1 }
+ { print }
+' $tmpout | sed '
+/__LINE__/s/^\([0-9][0-9]*\):\(.*\)__LINE__\(.*\)$/\2\1\3/
+'
rm -f $tmpout
exit $status
status=1
fi
-case $# in
- 0) cat $tmpout > configure; chmod +x configure ;;
- 1) cat $tmpout ;;
-esac
+if test $# -eq 0; then
+ exec > configure; chmod +x configure
+fi
+
+# Put the real line numbers into configure to make config.log more helpful.
+awk '
+/__LINE__/ { printf "%d:", NR + 1 }
+ { print }
+' $tmpout | sed '
+/__LINE__/s/^\([0-9][0-9]*\):\(.*\)__LINE__\(.*\)$/\2\1\3/
+'
rm -f $tmpout
exit $status
@example
@group
#if STDC_HEADERS || HAVE_STRING_H
-#include <string.h>
+# include <string.h>
/* An ANSI string.h and pre-ANSI memory.h might conflict. */
-#if !STDC_HEADERS && HAVE_MEMORY_H
-#include <memory.h>
-#endif /* not STDC_HEADERS and HAVE_MEMORY_H */
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif /* not STDC_HEADERS and HAVE_MEMORY_H */
#else /* not STDC_HEADERS and not HAVE_STRING_H */
-#include <strings.h>
+# include <strings.h>
/* memory.h and strings.h conflict on some systems. */
-#ifndef strchr
-#define strchr index
-#endif
-#ifndef strrchr
-#define strrchr rindex
-#endif
-#ifndef memcpy
-#define memcpy(d, s, n) bcopy ((s), (d), (n))
-#endif
-#ifndef memcmp
-#define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
-#endif
+# ifndef strchr
+# define strchr index
+# endif
+# ifndef strrchr
+# define strrchr rindex
+# endif
+# ifndef memcpy
+# define memcpy(d, s, n) bcopy ((s), (d), (n))
+# endif
+# ifndef memcmp
+# define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
+# endif
#endif /* not STDC_HEADERS and not HAVE_STRING_H */
@end group
@end example
@group
/* AIX requires this to be the first thing in the file. */
#ifdef __GNUC__
-#define alloca __builtin_alloca
+# define alloca __builtin_alloca
#else /* not __GNUC__ */
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#else /* not HAVE_ALLOCA_H */
-#ifdef _AIX
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else /* not HAVE_ALLOCA_H */
+# ifdef _AIX
#pragma alloca
-#else /* not _AIX */
-#ifndef alloca /* predefined by HP cc +Olibcalls */
+# else /* not _AIX */
+# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
-#endif /* not defined(alloca) */
-#endif /* not _AIX */
-#endif /* not HAVE_ALLOCA_H */
+# endif /* not defined(alloca) */
+# endif /* not _AIX */
+# endif /* not HAVE_ALLOCA_H */
#endif /* not __GNUC__ */
@end group
@end example
@end example
@end defmac
-@defmac AC_SUBST_FILE (@var{variable}, @var{file})
+@defmac AC_SUBST_DEFAULT (@var{variable}, @var{default-value})
+@maindex SUBST_DEFAULT
+Like @code{AC_SUBST}, but if @var{variable} is not set in the
+environment when @code{configure} is run, give it the value
+@var{default-value}. @var{default-value} is evaluated in shell double
+quotes, so it may refer to other variables or even the output of a
+command. As an example, Autoconf automatically calls this macro like this:
+
+@example
+AC_SUBST_DEFAULT(CFLAGS, -g)dnl
+AC_SUBST_DEFAULT(CXXFLAGS, -g)dnl
+AC_SUBST_DEFAULT(LDFLAGS, )dnl
+@end example
+@end defmac
+
+@defmac AC_SUBST_FILE (@var{variable})
@maindex SUBST_FILE
-Substitute the contents of the file @file{@var{srcdir}/@var{file}} into
-@file{Makefile} variable @var{variable} when creating the output files
-(typically one or more @file{Makefile}s). This macro is useful for
-inserting @file{Makefile} fragments for particular host or tartet types
-into @file{Makefile}s.
+Substitute the contents of the file named by shell variable
+@var{variable} into @file{Makefile} variable @var{variable} when
+creating the output files (typically one or more @file{Makefile}s).
+This macro is useful for inserting @file{Makefile} fragments containing
+special dependencies or other @code{make} directives for particular host
+or target types into @file{Makefile}s.
+
+For example, @file{configure.in} could contain:
+
+@example
+AC_SUBST_FILE(host_frag)dnl
+host_frag=$srcdir/conf/sun4.mh
+@end example
+
+@noindent
+and then a @file{Makefile.in} could contain:
+
+@example
+@@host_frag@@
+@end example
@end defmac
@node Printing Messages, Language Choice, Setting Variables, General Purpose Macros
directory, this is the same as @code{srcdir}.
@end defvar
+@defvar CFLAGS
+Debugging, optimization, header file search directory, and other
+miscellaneous options for the C compiler. The default value is
+@samp{-g} if it is not set in the environment when @code{configure} runs.
+@code{configure} uses this variable when compiling programs to test
+for C features.
+@end defvar
+
+@defvar CXXFLAGS
+Debugging, optimization, header file search directory, and other
+miscellaneous options for the C++ compiler. The default value is
+@samp{-g} if it is not set in the environment when @code{configure} runs.
+@code{configure} uses this variable when compiling programs to test
+for C++ features.
+@end defvar
+
@defvar DEFS
@samp{-D} options to pass to the C compiler. If @code{AC_CONFIG_HEADER}
is called, @code{configure} replaces @samp{@@DEFS@@} with
-@samp{-DHAVE_CONFIG_H}, since the contents of @code{DEFS} would be
-redundant.
+@samp{-DHAVE_CONFIG_H} instead.
+@end defvar
+
+@defvar LDFLAGS
+Stripping, library search directories, and other miscellaneous options
+for the linker. The default value is empty if it is not set in the
+environment when @code{configure} runs.
+@code{configure} uses this variable when linking programs to test
+for C features.
@end defvar
@defvar LIBS
status=1
fi
-case $# in
- 0) cat $tmpout > configure; chmod +x configure ;;
- 1) cat $tmpout ;;
-esac
+if test $# -eq 0; then
+ exec > configure; chmod +x configure
+fi
+
+# Put the real line numbers into configure to make config.log more helpful.
+awk '
+/__LINE__/ { printf "%d:", NR + 1 }
+ { print }
+' $tmpout | sed '
+/__LINE__/s/^\([0-9][0-9]*\):\(.*\)__LINE__\(.*\)$/\2\1\3/
+'
rm -f $tmpout
exit $status
@example
@group
#if STDC_HEADERS || HAVE_STRING_H
-#include <string.h>
+# include <string.h>
/* An ANSI string.h and pre-ANSI memory.h might conflict. */
-#if !STDC_HEADERS && HAVE_MEMORY_H
-#include <memory.h>
-#endif /* not STDC_HEADERS and HAVE_MEMORY_H */
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif /* not STDC_HEADERS and HAVE_MEMORY_H */
#else /* not STDC_HEADERS and not HAVE_STRING_H */
-#include <strings.h>
+# include <strings.h>
/* memory.h and strings.h conflict on some systems. */
-#ifndef strchr
-#define strchr index
-#endif
-#ifndef strrchr
-#define strrchr rindex
-#endif
-#ifndef memcpy
-#define memcpy(d, s, n) bcopy ((s), (d), (n))
-#endif
-#ifndef memcmp
-#define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
-#endif
+# ifndef strchr
+# define strchr index
+# endif
+# ifndef strrchr
+# define strrchr rindex
+# endif
+# ifndef memcpy
+# define memcpy(d, s, n) bcopy ((s), (d), (n))
+# endif
+# ifndef memcmp
+# define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
+# endif
#endif /* not STDC_HEADERS and not HAVE_STRING_H */
@end group
@end example
@group
/* AIX requires this to be the first thing in the file. */
#ifdef __GNUC__
-#define alloca __builtin_alloca
+# define alloca __builtin_alloca
#else /* not __GNUC__ */
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#else /* not HAVE_ALLOCA_H */
-#ifdef _AIX
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else /* not HAVE_ALLOCA_H */
+# ifdef _AIX
#pragma alloca
-#else /* not _AIX */
-#ifndef alloca /* predefined by HP cc +Olibcalls */
+# else /* not _AIX */
+# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
-#endif /* not defined(alloca) */
-#endif /* not _AIX */
-#endif /* not HAVE_ALLOCA_H */
+# endif /* not defined(alloca) */
+# endif /* not _AIX */
+# endif /* not HAVE_ALLOCA_H */
#endif /* not __GNUC__ */
@end group
@end example
@end example
@end defmac
-@defmac AC_SUBST_FILE (@var{variable}, @var{file})
+@defmac AC_SUBST_DEFAULT (@var{variable}, @var{default-value})
+@maindex SUBST_DEFAULT
+Like @code{AC_SUBST}, but if @var{variable} is not set in the
+environment when @code{configure} is run, give it the value
+@var{default-value}. @var{default-value} is evaluated in shell double
+quotes, so it may refer to other variables or even the output of a
+command. As an example, Autoconf automatically calls this macro like this:
+
+@example
+AC_SUBST_DEFAULT(CFLAGS, -g)dnl
+AC_SUBST_DEFAULT(CXXFLAGS, -g)dnl
+AC_SUBST_DEFAULT(LDFLAGS, )dnl
+@end example
+@end defmac
+
+@defmac AC_SUBST_FILE (@var{variable})
@maindex SUBST_FILE
-Substitute the contents of the file @file{@var{srcdir}/@var{file}} into
-@file{Makefile} variable @var{variable} when creating the output files
-(typically one or more @file{Makefile}s). This macro is useful for
-inserting @file{Makefile} fragments for particular host or tartet types
-into @file{Makefile}s.
+Substitute the contents of the file named by shell variable
+@var{variable} into @file{Makefile} variable @var{variable} when
+creating the output files (typically one or more @file{Makefile}s).
+This macro is useful for inserting @file{Makefile} fragments containing
+special dependencies or other @code{make} directives for particular host
+or target types into @file{Makefile}s.
+
+For example, @file{configure.in} could contain:
+
+@example
+AC_SUBST_FILE(host_frag)dnl
+host_frag=$srcdir/conf/sun4.mh
+@end example
+
+@noindent
+and then a @file{Makefile.in} could contain:
+
+@example
+@@host_frag@@
+@end example
@end defmac
@node Printing Messages, Language Choice, Setting Variables, General Purpose Macros
directory, this is the same as @code{srcdir}.
@end defvar
+@defvar CFLAGS
+Debugging, optimization, header file search directory, and other
+miscellaneous options for the C compiler. The default value is
+@samp{-g} if it is not set in the environment when @code{configure} runs.
+@code{configure} uses this variable when compiling programs to test
+for C features.
+@end defvar
+
+@defvar CXXFLAGS
+Debugging, optimization, header file search directory, and other
+miscellaneous options for the C++ compiler. The default value is
+@samp{-g} if it is not set in the environment when @code{configure} runs.
+@code{configure} uses this variable when compiling programs to test
+for C++ features.
+@end defvar
+
@defvar DEFS
@samp{-D} options to pass to the C compiler. If @code{AC_CONFIG_HEADER}
is called, @code{configure} replaces @samp{@@DEFS@@} with
-@samp{-DHAVE_CONFIG_H}, since the contents of @code{DEFS} would be
-redundant.
+@samp{-DHAVE_CONFIG_H} instead.
+@end defvar
+
+@defvar LDFLAGS
+Stripping, library search directories, and other miscellaneous options
+for the linker. The default value is empty if it is not set in the
+environment when @code{configure} runs.
+@code{configure} uses this variable when linking programs to test
+for C features.
@end defvar
@defvar LIBS
environment. Using a Bourne-compatible shell, you can do that on the
command line like this:
@example
-CC=c89 LIBS=-lposix ./configure
+CC=c89 CFLAGS=-O2 LDFLAGS=-s LIBS=-lposix ./configure
@end example
@noindent
Or on systems that have the @code{env} program, you can do it like this:
@example
-env CC=c89 LIBS=-lposix ./configure
-@end example
-
-@noindent
-To select different optimizing or debugging options, you can override
-the @samp{make} variables @code{CFLAGS} and @code{LDFLAGS}:
-@example
-make CFLAGS=-O2 LDFLAGS=-s
+env CC=c89 CFLAGS=-O2 LDFLAGS=-s LIBS=-lposix ./configure
@end example
@node Build Directory
environment. Using a Bourne-compatible shell, you can do that on the
command line like this:
@example
-CC=c89 LIBS=-lposix ./configure
+CC=c89 CFLAGS=-O2 LDFLAGS=-s LIBS=-lposix ./configure
@end example
@noindent
Or on systems that have the @code{env} program, you can do it like this:
@example
-env CC=c89 LIBS=-lposix ./configure
-@end example
-
-@noindent
-To select different optimizing or debugging options, you can override
-the @samp{make} variables @code{CFLAGS} and @code{LDFLAGS}:
-@example
-make CFLAGS=-O2 LDFLAGS=-s
+env CC=c89 CFLAGS=-O2 LDFLAGS=-s LIBS=-lposix ./configure
@end example
@node Build Directory
])dnl
dnl
dnl Try to have only one #! line, so the script doesn't look funny.
-dnl AC_BINSH()
-AC_DEFUN(AC_BINSH,
+dnl AC_INIT_BINSH()
+AC_DEFUN(AC_INIT_BINSH,
[#!/bin/sh
])dnl
dnl
dnl AC_INIT(UNIQUE-FILE-IN-SOURCE-DIR)
AC_DEFUN(AC_INIT,
-[AC_REQUIRE([AC_BINSH])dnl
+[AC_REQUIRE([AC_INIT_BINSH])dnl
AC_INIT_NOTICE
AC_INIT_PARSE_ARGS
AC_INIT_PREPARE($1)])dnl
AC_SUBST(prefix)dnl
AC_SUBST(exec_prefix)dnl
AC_SUBST(DEFS)dnl
+AC_SUBST_DEFAULT(CFLAGS, -g)dnl
+AC_SUBST_DEFAULT(CXXFLAGS, -g)dnl
+AC_SUBST_DEFAULT(LDFLAGS, )dnl
])dnl
dnl
dnl AC_ARG_ENABLE(FEATURE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE])
dnl
dnl AC_REVISION(REVISION-INFO)
AC_DEFUN(AC_REVISION,
-[AC_REQUIRE([AC_BINSH])dnl
+[AC_REQUIRE([AC_INIT_BINSH])dnl
[# From configure.in] translit([$1], $")])dnl
dnl
dnl Subroutines of AC_PREREQ.
divert(AC_DIVERSION_NORMAL)dnl
])])dnl
dnl
-dnl AC_SUBST_FILE(VARIABLE, FILE)
+dnl AC_SUBST_FILE(VARIABLE)
AC_DEFUN(AC_SUBST_FILE,
-[if test -f $2; then
- echo using $2 for $1)
- AC_INSERT_FILE($1, $2)
-elif test -f ${srcdir}/$2; then
- echo using ${srcdir}/$2 for $1)
- AC_INSERT_FILE($1, ${srcdir}/$2)
-fi
-])dnl
-dnl Internal subroutine of AC_SUBST_FILE.
-AC_DEFUN(AC_INSERT_FILE,
[ifdef([AC_SUBST_$1], ,
[define([AC_SUBST_$1], )dnl
divert(AC_DIVERSION_SED)dnl
divert(AC_DIVERSION_NORMAL)dnl
])])dnl
dnl
+dnl AC_SUBST_DEFAULT(VARIABLE [, DEFAULT-VALUE])
+AC_DEFUN(AC_SUBST_DEFAULT,
+[$1=${$1-"$2"}
+AC_SUBST($1)dnl
+])dnl
+dnl
dnl
dnl ### Printing messages
dnl
AC_DEFUN(AC_EGREP_CPP,
[AC_REQUIRE_CPP()dnl
cat > conftest.${ac_ext} <<EOF
+#line __LINE__ "configure"
#include "confdefs.h"
[$2]
EOF
AC_DEFUN(AC_TRY_LINK,
[dnl We use return because because C++ requires a prototype for exit.
cat > conftest.${ac_ext} <<EOF
+#line __LINE__ "configure"
#include "confdefs.h"
[$1]
int main() { return 0; }
])
else
cat > conftest.${ac_ext} <<EOF
+#line __LINE__ "configure"
#include "confdefs.h"
[$1]
EOF
AC_DEFUN(AC_TRY_CPP,
[AC_REQUIRE_CPP()dnl
cat > conftest.${ac_ext} <<EOF
+#line __LINE__ "configure"
#include "confdefs.h"
[$1]
EOF
dnl AC_CHECK_HEADER(HEADER-FILE, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
AC_DEFUN(AC_CHECK_HEADER,
[dnl Do the transliteration at runtime so arg 1 can be a shell variable.
-ac_var=`echo "$1" | tr './' '__'`
+ac_safe=`echo "$1" | tr './' '__'`
AC_MSG_CHECKING([for $1])
-AC_CACHE_VAL(ac_cv_header_$ac_var,
-[AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_var=yes",
- eval "ac_cv_header_$ac_var=no")])dnl
-if eval "test \"`echo '$ac_cv_header_'$ac_var`\" = yes"; then
+AC_CACHE_VAL(ac_cv_header_$ac_safe,
+[AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_safe=yes",
+ eval "ac_cv_header_$ac_safe=no")])dnl
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
done
ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
ifdef([AC_LIST_HEADERS],
[trap 'rm -fr $1 AC_LIST_HEADERS conftest*; exit 1' 1 2 15],
test -z "$ac_cv_path_install" && ac_cv_path_install="$ac_install_sh"])dnl
INSTALL="$ac_cv_path_install"
fi
-dnl We do this instead of AC_SUBST, to get relative paths right.
-ac_given_INSTALL=$INSTALL
+dnl We do special magic for INSTALL instead of AC_SUBST, to get
+dnl relative paths right.
AC_MSG_RESULT($INSTALL)
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
])dnl
dnl
AC_DEFUN(AC_HEADER_MAJOR,
-[AC_MSG_CHECKING([for major, minor and makedev header])
-AC_CACHE_VAL(ac_cv_header_major,
-[AC_TRY_LINK([#include <sys/types.h>],
-[return makedev(0, 0);], ac_cv_header_major=sys/types.h, ac_cv_header_major=no)
-if test $ac_cv_header_major = no; then
-AC_CHECK_HEADER(sys/mkdev.h, ac_cv_header_major=sys/mkdev.h)
-fi
-if test $ac_cv_header_major = no; then
-AC_CHECK_HEADER(sys/sysmacros.h, ac_cv_header_major=sys/sysmacros.h)
-fi])dnl
-AC_MSG_RESULT($ac_cv_header_major)
-case "$ac_cv_header_major" in
-sys/mkdev.h) AC_DEFINE(MAJOR_IN_MKDEV) ;;
-sys/sysmacros.h) AC_DEFINE(MAJOR_IN_SYSMACROS) ;;
-esac
+[AC_MSG_CHECKING(whether sys/types.h defines makedev)
+AC_CACHE_VAL(ac_cv_header_sys_types_h_makedev,
+[AC_TRY_LINK([#include <sys/types.h>], [return makedev(0, 0);],
+ ac_cv_header_sys_types_h_makedev=yes, ac_cv_header_sys_types_h_makedev=no)
+])dnl
+AC_MSG_RESULT($ac_cv_header_sys_types_h_makedev)
+
+if test $ac_cv_header_sys_types_h_makedev = no; then
+AC_CHECK_HEADER(sys/mkdev.h, [AC_DEFINE(MAJOR_IN_MKDEV)])
+
+ if test $ac_cv_header_sys_mkdev_h = no; then
+AC_CHECK_HEADER(sys/sysmacros.h, [AC_DEFINE(MAJOR_IN_SYSMACROS)])
+ fi
+fi
])dnl
dnl
AC_DEFUN(AC_HEADER_DIRENT,