* AC_CONFIG_AUX_DIR, AC_CANONICAL_SYSTEM, AC_CANONICAL_HOST, AC_LINK_FILES to
support deciding unguessable features based on the host and target types.
* AC_CONFIG_SUBDIRS to recursively configure a source tree.
+* AC_ARG_PROGRAM, which uses the options --program-prefix,
+ --program-suffix, and --program-transform-name to change the names
+ of programs being installed.
* AC_CHECK_TYPE, which checks whether sys/types.h defines a given type.
* AC_CHECK_LIB, which checks for a particular function in a library.
* AC_MSG_CHECKING and AC_MSG_RESULT to print test results, on a single line,
* AC_OUTPUT and AC_CONFIG_HEADER allow you to override the input-file names.
* AC_OUTPUT automatically substitutes the values of CFLAGS, CXXFLAGS,
CPPFLAGS, and LDFLAGS from the environment, with default values.
+* AC_PROG_CC and AC_PROG_CXX now set CFLAGS and CXXFLAGS, respectively.
* 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, AC_DEFINE_UNQUOTED, and AC_SUBST are more robust and smaller.
better maintained with them.
* AC_ARG_ARRAY removed because no one was likely using it.
* AC_HAVE_POUNDBANG replaced with AC_SYS_INTERPRETER, which doesn't
- take arguments.
+ take arguments, for consistency with all of the other specific checks.
** New utilities:
* autoscan to generate a preliminary configure.in for a package by
-*- outline -*-
-Things it would be nice to maybe do someday:
+Things it might be nice to do someday:
------------------------------------------------------------------------------
* Replace the current ad-hoc macros for Dynix, SCO, ISC, etc.
Perhaps there should be macros for certain functions (statfs, wait) or
classes of functions (POSIX, NIS) that do everything necessary, instead.
-Select the right CONFIG_SHELL automatically (Ultrix, Lynx esp.)
Select the right C compiler and POSIX/ANSI C options automatically.
------------------------------------------------------------------------------
+* Select the right CONFIG_SHELL automatically (for Ultrix, Lynx especially.)
+
+------------------------------------------------------------------------------
+
* Support copying and adding "dir" commands to .gdbinit.
------------------------------------------------------------------------------
[# Save the original args to write them into config.status later.
configure_args="[$]@"
-# Omit some internal, obsolete, or unimplemented options to make the
-# list less imposing.
+# Omit some internal or obsolete options to make the list less imposing.
changequote(, )dnl
ac_usage="Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
--no-create do not create output files
--quiet, --silent do not print \`checking...' messages
--version print the version of autoconf that created configure
-Directories:
+Directory and file names:
--exec-prefix=PREFIX install host dependent files in PREFIX [/usr/local]
--prefix=PREFIX install host independent files in PREFIX [/usr/local]
--srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
Host type:
--build=BUILD configure for building on BUILD [BUILD=HOST]
--host=HOST configure for HOST [guessed]
nonopt=NONE
no_recursion=
prefix=NONE
-program_prefix=
-program_suffix=
-program_transform_name=
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=NONE
silent=
srcdir=
target=NONE
running configure, to aid debugging if configure makes a mistake.
" 1>&AC_FD_CC
-# Save the original args if we used an alternate arg parser.
-ac_configure_temp="${configure_args-[$]@}"
+ac_configure_temp="$configure_args"
# Strip out --no-create and --no-recursion so they do not pile up.
# Also quote any args containing spaces.
configure_args=
])
+dnl ### Transforming program names.
+
+
+dnl AC_ARG_PROGRAM()
+AC_DEFUN(AC_ARG_PROGRAM,
+[test "${program_transform_name}" = NONE && program_transform_name=
+if test -n "${program_transform_name}"; then
+ # Double any \ or $.
+ echo 's,\\,\\\\,g; s,\$,$$,g' > conftestsed
+ program_transform_name="-e `echo ${program_transform_name} | sed -f conftestsed`"
+ rm -f conftestsed
+fi
+test "${program_prefix}" != NONE &&
+ program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
+# Use a double $ so make ignores it.
+test "${program_suffix}" != NONE &&
+ program_transform_name="-e s,\$\$,${program_suffix}, ${program_transform_name}"
+
+# sed with no file args requires a program.
+test "${program_transform_name}" = "" && program_transform_name="-e s,x,x,"
+AC_SUBST(program_transform_name)dnl
+])
+
+
dnl ### Version numbers
dnl Canonicalize the host, target, and build system types.
AC_DEFUN(AC_CANONICAL_SYSTEM,
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_BEFORE([$0], [AC_ARG_PROGRAM])
# Do some error checking and defaulting for the host and target type.
# The inputs are:
# configure --host=HOST --target=TARGET --build=BUILD NONOPT
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_CANONICAL_BUILD
+test "${host_alias}" != "${target_alias}" &&
+ test "${program_prefix}${program_suffix}${program_transform_name}" = \
+ NONENONENONE && program_prefix=${target_alias}-
])
dnl Subroutines of AC_CANONICAL_SYSTEM.
fi
])
+dnl AC_CHECK_HEADERS(HEADER-FILE... [, ACTION])
+AC_DEFUN(AC_CHECK_HEADERS,
+[for ac_hdr in $1
+do
+AC_CHECK_HEADER(${ac_hdr},
+[changequote(, )dnl
+ ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./' '[A-Z]__'`
+changequote([, ])dnl
+ AC_DEFINE_UNQUOTED(${ac_tr_hdr}) $2])dnl
+done
+])
+
dnl AC_CHECK_FUNC(FUNCTION, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
AC_DEFUN(AC_CHECK_FUNC,
[AC_MSG_CHECKING([for $1])
done
])
-dnl AC_CHECK_HEADERS(HEADER-FILE... [, ACTION])
-AC_DEFUN(AC_CHECK_HEADERS,
-[AC_REQUIRE_CPP()dnl Make sure the cpp check happens outside the loop.
-for ac_hdr in $1
-do
-AC_CHECK_HEADER(${ac_hdr},
-[changequote(, )dnl
- ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./' '[A-Z]__'`
-changequote([, ])dnl
- AC_DEFINE_UNQUOTED(${ac_tr_hdr}) $2])dnl
-done
-])
-
dnl AC_REPLACE_FUNCS(FUNCTION-NAME...)
AC_DEFUN(AC_REPLACE_FUNCS,
[for ac_func in $1
AC_MSG_RESULT($ac_cv_prog_gcc)
if test $ac_cv_prog_gcc = yes; then
GCC=yes
- test "${CFLAGS+set}" = set || CFLAGS='-g -O'
+ if test "${CFLAGS+set}" != set; then
+ AC_MSG_CHECKING(whether ${CC-cc} accepts -g)
+AC_CACHE_VAL(ac_cv_prog_gcc_g,
+[echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_gcc_g=yes
+else
+ ac_cv_prog_gcc_g=no
+fi
+rm -f conftest*
+])dnl
+ AC_MSG_RESULT($ac_cv_prog_gcc_g)
+ if test $ac_cv_prog_gcc_g = yes; then
+ CFLAGS="-g -O"
+ else
+ CFLAGS="-O"
+ fi
+ fi
else
GCC=
- test "${CFLAGS+set}" = set || CFLAGS='-g'
+ test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
])
fi])dnl
if test $ac_cv_prog_gxx = yes; then
GXX=yes
- test "${CXXFLAGS+set}" = set || CXXFLAGS='-g -O'
+ if test "${CXXFLAGS+set}" != set; then
+ AC_MSG_CHECKING(whether ${CXX-gcc} accepts -g)
+AC_CACHE_VAL(ac_cv_prog_gxx_g,
+[echo 'void f(){}' > conftest.cc
+if test -z "`${CXX-gcc} -g -c conftest.cc 2>&1`"; then
+ ac_cv_prog_gxx_g=yes
+else
+ ac_cv_prog_gxx_g=no
+fi
+rm -f conftest*
+])dnl
+ AC_MSG_RESULT($ac_cv_prog_gxx_g)
+ if test $ac_cv_prog_gxx_g = yes; then
+ CXXFLAGS="-g -O"
+ else
+ CXXFLAGS="-O"
+ fi
+ fi
else
GXX=
- test "${CXXFLAGS+set}" = set || CXXFLAGS='-g'
+ test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
fi
])
[AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
if test $ac_cv_prog_gcc = yes; then
- AC_MSG_CHECKING(whether -traditional is needed)
+ AC_MSG_CHECKING(whether ${CC-cc} needs -traditional)
AC_CACHE_VAL(ac_cv_prog_gcc_traditional,
[ ac_pattern="Autoconf.*'x'"
AC_EGREP_CPP($ac_pattern, [#include <sgtty.h>
AC_DEFUN(AC_PROG_INSTALL,
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
-# Make sure to not get an incompatible install:
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
''|.|/etc|/usr/sbin|/usr/etc|/sbin|/usr/afsws/bin|/usr/ucb) ;;
*)
# OSF1, X11, and SCO ODT 3.0 have their own names for install.
- for ac_prog in ginstall installbsd bsdinst scoinst install; do
+ for ac_prog in ginstall installbsd scoinst install; do
if test -f $ac_dir/$ac_prog; then
if test $ac_prog = install &&
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
])
AC_DEFUN(AC_HEADER_DIRENT,
-[ac_header_dir=no
-AC_CHECK_HEADERS(dirent.h sys/ndir.h sys/dir.h ndir.h,
- [ac_header_dir=$ac_hdr; break])
+[ac_header_dirent=no
+AC_CHECK_HEADERS_DIRENT(dirent.h sys/ndir.h sys/dir.h ndir.h,
+ [ac_header_dirent=$ac_hdr; break])
])
+dnl Like AC_CHECK_HEADER, except also make sure that HEADER-FILE
+dnl defines the type `DIR'. dirent.h on NextStep 3.2 doesn't.
+dnl AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND)
+AC_DEFUN(AC_CHECK_HEADER_DIRENT,
+[ac_safe=`echo "$1" | tr './' '__'`
+AC_MSG_CHECKING([for $1 that defines DIR])
+AC_CACHE_VAL(ac_cv_header_dirent_$ac_safe,
+[AC_TRY_LINK([#include <sys/types.h>
+#include <$1>], [DIR *dirp = 0;],
+ eval "ac_cv_header_dirent_$ac_safe=yes",
+ eval "ac_cv_header_dirent_$ac_safe=no")])dnl
+if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
+ AC_MSG_RESULT(yes)
+ $2
+else
+ AC_MSG_RESULT(no)
+fi
+])
+
+dnl Like AC_CHECK_HEADERS, except succeed only for a HEADER-FILE that
+dnl defines `DIR'.
+dnl AC_CHECK_HEADERS_DIRENT(HEADER-FILE... [, ACTION])
+AC_DEFUN(AC_CHECK_HEADERS_DIRENT,
+[for ac_hdr in $1
+do
+AC_CHECK_HEADER_DIRENT(${ac_hdr},
+[changequote(, )dnl
+ ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./' '[A-Z]__'`
+changequote([, ])dnl
+ AC_DEFINE_UNQUOTED(${ac_tr_hdr}) $2])dnl
+done])
+
AC_DEFUN(AC_FUNC_CLOSEDIR_VOID,
[AC_REQUIRE([AC_HEADER_DIRENT])dnl
AC_MSG_CHECKING(whether closedir returns void)
AC_CACHE_VAL(ac_cv_func_closedir_void,
[AC_TRY_RUN([#include <sys/types.h>
-#include <$ac_header_dir>
+#include <$ac_header_dirent>
int closedir(); main() { exit(closedir(opendir(".")) != 0); }],
ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes)])dnl
AC_MSG_RESULT($ac_cv_func_closedir_void)
dnl Obsolete.
AC_DEFUN(AC_DIR_HEADER,
-[ac_header_dir=no
+[ac_header_dirent=no
for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
- AC_CHECK_HEADER($ac_hdr, [ac_header_dir=$ac_hdr; break])
+ AC_CHECK_HEADER_DIRENT($ac_hdr, [ac_header_dirent=$ac_hdr; break])
done
-case "$ac_header_dir" in
+case "$ac_header_dirent" in
dirent.h) AC_DEFINE(DIRENT) ;;
sys/ndir.h) AC_DEFINE(SYSNDIR) ;;
sys/dir.h) AC_DEFINE(SYSDIR) ;;
AC_MSG_CHECKING(whether closedir returns void)
AC_CACHE_VAL(ac_cv_func_closedir_void,
[AC_TRY_RUN([#include <sys/types.h>
-#include <$ac_header_dir>
+#include <$ac_header_dirent>
int closedir(); main() { exit(closedir(opendir(".")) != 0); }],
ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes)])dnl
AC_MSG_RESULT($ac_cv_func_closedir_void)
[# If we cannot run a trivial program, we must be cross compiling.
AC_MSG_CHECKING(whether cross-compiling)
AC_CACHE_VAL(ac_cv_c_cross,
-[AC_TRY_RUN([main(){exit(0);}],
+[AC_TRY_RUN([main(){return(0);}],
ac_cv_c_cross=no, ac_cv_c_cross=yes, ac_cv_cross=yes)])dnl
cross_compiling=$ac_cv_c_cross
AC_MSG_RESULT($ac_cv_c_cross)
], [AC_MSG_RESULT(yes); XENIX=yes], [AC_MSG_RESULT(no); XENIX=])
if test "$XENIX" = yes; then
LIBS="$LIBS -lx"
- if test $ac_header_dir != sys/ndir.h; then
+ if test $ac_header_dirent != sys/ndir.h; then
LIBS="-ldir $LIBS" # Make sure -ldir precedes -lx.
fi
fi
* Input:: Where Autoconf should find files.
* Output:: Controlling Autoconf output files.
* Package Options:: Selecting optional features.
+* Transforming Names:: Changing program names when installing.
* Versions:: Version numbers in producing @code{configure}.
Existing Tests
Primitives For Building Tests
-* C System Output:: Checking output of C compiler system.
+* C System Output:: Checking output of the C compiler system.
* Setting Variables:: Setting shell and @code{make} variables.
* Printing Messages:: Notifying users of progress or problems.
* Language Choice:: Selecting which language to use for testing.
* Input:: Where Autoconf should find files.
* Output:: Controlling Autoconf output files.
* Package Options:: Selecting optional features.
+* Transforming Names:: Changing program names when installing.
* Versions:: Version numbers in producing @code{configure}.
@end menu
@var{extra-cmds}.
@end defmac
-@node Package Options, Versions, Output, Operation
+@node Package Options, Transforming Names, Output, Operation
@section Checking for Package Options
These macros check whether the user gave @code{configure} command line
support providing a help string.
@end defmac
-@node Versions, , Package Options, Operation
+@node Transforming Names, Versions, Package Options, Operation
+@section Transforming Program Names When Installing
+
+Autoconf supports giving @code{configure} the following command line
+options to change the names of programs being installed:
+
+@table @code
+@item --program-prefix=@var{prefix}
+prepend @var{prefix} to the names;
+
+@item --program-suffix=@var{suffix}
+append @var{suffix} to the names;
+
+@item --program-transform-name=@var{expression}
+perform @code{sed} substitution @var{expression} on the names. The main
+use for this option is to prevent the automatic addition of a target
+name prefix to program names (see below) by giving an empty
+@var{expression}. As another possibility,
+@samp{--program-transform-name='s,^\(........\).*,\1.exe,'} could be used to
+truncate installed program names to 8 characters and append @file{.exe}.
+@end table
+
+In order to use the values given to those options, @file{configure.in}
+must call the macro @code{AC_ARG_PROGRAM}.
+
+@defmac AC_ARG_PROGRAM
+@maindex ARG_PROGRAM
+Place in @file{Makefile} variable @code{program_transform_name} a
+sequence of @code{sed} commands for changing the names of installed
+programs.
+
+If any of the above options are given to @code{configure}, program names
+are transformed accordingly. Otherwise, if @code{AC_CANONICAL_SYSTEM}
+has been called and a @samp{--target} value is given that differs from
+the host type (specified with @samp{--host} or defaulted by
+@code{config.sub}), the target type followed by a dash is used as a
+prefix. Otherwise, no program name transformation is done.
+
+These transformations are useful with programs that can be part of a
+cross-compilation development environment. For example, a
+cross-assembler running on a Sun 4 configured with
+@samp{--target=i960-vxworks} is normally installed as
+@file{i960-vxworks-as}, rather than @file{as}, which could be confused
+with a native Sun 4 assembler.
+
+They can also force a program name to begin with @file{g}, if you don't
+want GNU programs installed on your system to shadow system programs by
+the same name. For example, if GNU @code{make} used this macro, you
+could configure it with @samp{--program-prefix=g} and when you ran
+@samp{make install}, it would be installed as
+@file{/usr/local/bin/gmake}.
+
+Use the variable @code{program_transform_name} as in this example for
+an assembler, compiled as @file{as.new}. The shell variable @code{t}
+is needed in case @code{program_transform_name} contains any shell
+special characters. With quoting and variable substitutions, whitespace
+still properly separates @code{sed} arguments, but other special
+characters have no effect.
+
+@example
+program_transform_name=@@program_transform_name@@
+install: all
+ name=`t='$(program_transform_name)'; echo as | sed $$t` ; \
+ $(INSTALL_PROGRAM) as.new $(bindir)/$$name
+@end example
+@end defmac
+
+
+@node Versions, , Transforming Names, Operation
@section Controlling Autoconf Versions
The following macros manage version numbers for @code{configure} scripts.
Determine a C compiler to use. If @code{CC} is not already set in the
environment, check for @code{gcc}, and use @code{cc} if it's not found.
Set @code{make} variable @code{CC} to the name of the compiler found.
-Set shell variable @code{GCC} to @samp{yes} if using the GNU C
-compiler, empty otherwise, and if @code{make} variable @code{CFLAGS} was
-not already set, set it to @samp{-g -O} for the GNU C compiler or
-@samp{-g} for other compilers.
+
+If using the GNU C compiler, set shell variable @code{GCC} to
+@samp{yes}, empty otherwise. If @code{make} variable @code{CFLAGS} was
+not already set, set it to @samp{-g -O} for the GNU C compiler
+(@samp{-O} on systems where GCC does not accept @samp{-g}), or @samp{-g}
+for other compilers.
@end defmac
@defmac AC_PROG_CC_C_O
variable @code{CXX} to its value. Otherwise search for a C++ compiler
under likely names (@code{c++}, @code{g++}, @code{gcc}, @code{CC}, and
@code{cxx}). If none of those checks succeed, as a last resort set
-@code{CXX} to @code{gcc}. Also set shell variable @code{GXX} to
-@samp{yes} if using the GNU C++ compiler, empty otherwise, and if
-@code{make} variable @code{CXXFLAGS} was not already set, set it to
-@samp{-g -O} for the GNU C++ compiler or @samp{-g} for other compilers.
+@code{CXX} to @code{gcc}.
+
+If using the GNU C++ compiler, set shell variable @code{GXX} to
+@samp{yes}, empty otherwise. If @code{make} variable @code{CXXFLAGS} was
+not already set, set it to @samp{-g -O} for the GNU C++ compiler
+(@samp{-O} on systems where G++ does not accept @samp{-g}), or @samp{-g}
+for other compilers.
@end defmac
@defmac AC_PROG_CXXCPP
be written as any of @samp{foo}, @samp{-lfoo}, or @samp{libfoo.a}. In
all of those cases, the compiler is passed @samp{-lfoo}. However,
@var{library} can not be a shell variable; it must be a literal name.
-
-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.
+This macro is considered obsolete.
@end defmac
@node Header Files, Typedefs, Libraries, Existing Tests
@cvindex HAVE_SYS_DIR_H
@cvindex HAVE_SYS_NDIR_H
Check for the the following header files, and for the first one that is
-found, define the listed C preprocessor macro:
+found and defines @samp{DIR}, define the listed C preprocessor macro:
@table @file
@item dirent.h
section below, the macros are listed in alphabetical order.
@menu
-* C System Output:: Checking output of C compiler system.
+* C System Output:: Checking output of the C compiler system.
* Setting Variables:: Setting shell and @code{make} variables.
* Printing Messages:: Notifying users of progress or problems.
* Language Choice:: Selecting which language to use for testing.
being used, such as @code{AC_PROG_CC}. So @code{AC_PROG_CC} contains:
@example
-AC_BEFORE([$0], [AC_PROG_CPP])
+AC_BEFORE([$0], [AC_PROG_CPP])dnl
@end example
@noindent
@ifinfo
@xref{Makefiles}, for more information on @samp{@@} substitutions.
@end ifinfo
-The variables that are defined by the Autoconf macros are:
+The variables that are automatically defined by the Autoconf macros are
+listed here. Some of the Autoconf macros define additional variables,
+which are mentioned in the descriptions for those macros.
@defvar exec_prefix
The installation prefix for architecture-specific files.
* Input:: Where Autoconf should find files.
* Output:: Controlling Autoconf output files.
* Package Options:: Selecting optional features.
+* Transforming Names:: Changing program names when installing.
* Versions:: Version numbers in producing @code{configure}.
Existing Tests
Primitives For Building Tests
-* C System Output:: Checking output of C compiler system.
+* C System Output:: Checking output of the C compiler system.
* Setting Variables:: Setting shell and @code{make} variables.
* Printing Messages:: Notifying users of progress or problems.
* Language Choice:: Selecting which language to use for testing.
* Input:: Where Autoconf should find files.
* Output:: Controlling Autoconf output files.
* Package Options:: Selecting optional features.
+* Transforming Names:: Changing program names when installing.
* Versions:: Version numbers in producing @code{configure}.
@end menu
@var{extra-cmds}.
@end defmac
-@node Package Options, Versions, Output, Operation
+@node Package Options, Transforming Names, Output, Operation
@section Checking for Package Options
These macros check whether the user gave @code{configure} command line
support providing a help string.
@end defmac
-@node Versions, , Package Options, Operation
+@node Transforming Names, Versions, Package Options, Operation
+@section Transforming Program Names When Installing
+
+Autoconf supports giving @code{configure} the following command line
+options to change the names of programs being installed:
+
+@table @code
+@item --program-prefix=@var{prefix}
+prepend @var{prefix} to the names;
+
+@item --program-suffix=@var{suffix}
+append @var{suffix} to the names;
+
+@item --program-transform-name=@var{expression}
+perform @code{sed} substitution @var{expression} on the names. The main
+use for this option is to prevent the automatic addition of a target
+name prefix to program names (see below) by giving an empty
+@var{expression}. As another possibility,
+@samp{--program-transform-name='s,^\(........\).*,\1.exe,'} could be used to
+truncate installed program names to 8 characters and append @file{.exe}.
+@end table
+
+In order to use the values given to those options, @file{configure.in}
+must call the macro @code{AC_ARG_PROGRAM}.
+
+@defmac AC_ARG_PROGRAM
+@maindex ARG_PROGRAM
+Place in @file{Makefile} variable @code{program_transform_name} a
+sequence of @code{sed} commands for changing the names of installed
+programs.
+
+If any of the above options are given to @code{configure}, program names
+are transformed accordingly. Otherwise, if @code{AC_CANONICAL_SYSTEM}
+has been called and a @samp{--target} value is given that differs from
+the host type (specified with @samp{--host} or defaulted by
+@code{config.sub}), the target type followed by a dash is used as a
+prefix. Otherwise, no program name transformation is done.
+
+These transformations are useful with programs that can be part of a
+cross-compilation development environment. For example, a
+cross-assembler running on a Sun 4 configured with
+@samp{--target=i960-vxworks} is normally installed as
+@file{i960-vxworks-as}, rather than @file{as}, which could be confused
+with a native Sun 4 assembler.
+
+They can also force a program name to begin with @file{g}, if you don't
+want GNU programs installed on your system to shadow system programs by
+the same name. For example, if GNU @code{make} used this macro, you
+could configure it with @samp{--program-prefix=g} and when you ran
+@samp{make install}, it would be installed as
+@file{/usr/local/bin/gmake}.
+
+Use the variable @code{program_transform_name} as in this example for
+an assembler, compiled as @file{as.new}. The shell variable @code{t}
+is needed in case @code{program_transform_name} contains any shell
+special characters. With quoting and variable substitutions, whitespace
+still properly separates @code{sed} arguments, but other special
+characters have no effect.
+
+@example
+program_transform_name=@@program_transform_name@@
+install: all
+ name=`t='$(program_transform_name)'; echo as | sed $$t` ; \
+ $(INSTALL_PROGRAM) as.new $(bindir)/$$name
+@end example
+@end defmac
+
+
+@node Versions, , Transforming Names, Operation
@section Controlling Autoconf Versions
The following macros manage version numbers for @code{configure} scripts.
Determine a C compiler to use. If @code{CC} is not already set in the
environment, check for @code{gcc}, and use @code{cc} if it's not found.
Set @code{make} variable @code{CC} to the name of the compiler found.
-Set shell variable @code{GCC} to @samp{yes} if using the GNU C
-compiler, empty otherwise, and if @code{make} variable @code{CFLAGS} was
-not already set, set it to @samp{-g -O} for the GNU C compiler or
-@samp{-g} for other compilers.
+
+If using the GNU C compiler, set shell variable @code{GCC} to
+@samp{yes}, empty otherwise. If @code{make} variable @code{CFLAGS} was
+not already set, set it to @samp{-g -O} for the GNU C compiler
+(@samp{-O} on systems where GCC does not accept @samp{-g}), or @samp{-g}
+for other compilers.
@end defmac
@defmac AC_PROG_CC_C_O
variable @code{CXX} to its value. Otherwise search for a C++ compiler
under likely names (@code{c++}, @code{g++}, @code{gcc}, @code{CC}, and
@code{cxx}). If none of those checks succeed, as a last resort set
-@code{CXX} to @code{gcc}. Also set shell variable @code{GXX} to
-@samp{yes} if using the GNU C++ compiler, empty otherwise, and if
-@code{make} variable @code{CXXFLAGS} was not already set, set it to
-@samp{-g -O} for the GNU C++ compiler or @samp{-g} for other compilers.
+@code{CXX} to @code{gcc}.
+
+If using the GNU C++ compiler, set shell variable @code{GXX} to
+@samp{yes}, empty otherwise. If @code{make} variable @code{CXXFLAGS} was
+not already set, set it to @samp{-g -O} for the GNU C++ compiler
+(@samp{-O} on systems where G++ does not accept @samp{-g}), or @samp{-g}
+for other compilers.
@end defmac
@defmac AC_PROG_CXXCPP
be written as any of @samp{foo}, @samp{-lfoo}, or @samp{libfoo.a}. In
all of those cases, the compiler is passed @samp{-lfoo}. However,
@var{library} can not be a shell variable; it must be a literal name.
-
-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.
+This macro is considered obsolete.
@end defmac
@node Header Files, Typedefs, Libraries, Existing Tests
@cvindex HAVE_SYS_DIR_H
@cvindex HAVE_SYS_NDIR_H
Check for the the following header files, and for the first one that is
-found, define the listed C preprocessor macro:
+found and defines @samp{DIR}, define the listed C preprocessor macro:
@table @file
@item dirent.h
section below, the macros are listed in alphabetical order.
@menu
-* C System Output:: Checking output of C compiler system.
+* C System Output:: Checking output of the C compiler system.
* Setting Variables:: Setting shell and @code{make} variables.
* Printing Messages:: Notifying users of progress or problems.
* Language Choice:: Selecting which language to use for testing.
being used, such as @code{AC_PROG_CC}. So @code{AC_PROG_CC} contains:
@example
-AC_BEFORE([$0], [AC_PROG_CPP])
+AC_BEFORE([$0], [AC_PROG_CPP])dnl
@end example
@noindent
@ifinfo
@xref{Makefiles}, for more information on @samp{@@} substitutions.
@end ifinfo
-The variables that are defined by the Autoconf macros are:
+The variables that are automatically defined by the Autoconf macros are
+listed here. Some of the Autoconf macros define additional variables,
+which are mentioned in the descriptions for those macros.
@defvar exec_prefix
The installation prefix for architecture-specific files.
[# Save the original args to write them into config.status later.
configure_args="[$]@"
-# Omit some internal, obsolete, or unimplemented options to make the
-# list less imposing.
+# Omit some internal or obsolete options to make the list less imposing.
changequote(, )dnl
ac_usage="Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
--no-create do not create output files
--quiet, --silent do not print \`checking...' messages
--version print the version of autoconf that created configure
-Directories:
+Directory and file names:
--exec-prefix=PREFIX install host dependent files in PREFIX [/usr/local]
--prefix=PREFIX install host independent files in PREFIX [/usr/local]
--srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
Host type:
--build=BUILD configure for building on BUILD [BUILD=HOST]
--host=HOST configure for HOST [guessed]
nonopt=NONE
no_recursion=
prefix=NONE
-program_prefix=
-program_suffix=
-program_transform_name=
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=NONE
silent=
srcdir=
target=NONE
running configure, to aid debugging if configure makes a mistake.
" 1>&AC_FD_CC
-# Save the original args if we used an alternate arg parser.
-ac_configure_temp="${configure_args-[$]@}"
+ac_configure_temp="$configure_args"
# Strip out --no-create and --no-recursion so they do not pile up.
# Also quote any args containing spaces.
configure_args=
])
+dnl ### Transforming program names.
+
+
+dnl AC_ARG_PROGRAM()
+AC_DEFUN(AC_ARG_PROGRAM,
+[test "${program_transform_name}" = NONE && program_transform_name=
+if test -n "${program_transform_name}"; then
+ # Double any \ or $.
+ echo 's,\\,\\\\,g; s,\$,$$,g' > conftestsed
+ program_transform_name="-e `echo ${program_transform_name} | sed -f conftestsed`"
+ rm -f conftestsed
+fi
+test "${program_prefix}" != NONE &&
+ program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
+# Use a double $ so make ignores it.
+test "${program_suffix}" != NONE &&
+ program_transform_name="-e s,\$\$,${program_suffix}, ${program_transform_name}"
+
+# sed with no file args requires a program.
+test "${program_transform_name}" = "" && program_transform_name="-e s,x,x,"
+AC_SUBST(program_transform_name)dnl
+])
+
+
dnl ### Version numbers
dnl Canonicalize the host, target, and build system types.
AC_DEFUN(AC_CANONICAL_SYSTEM,
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_BEFORE([$0], [AC_ARG_PROGRAM])
# Do some error checking and defaulting for the host and target type.
# The inputs are:
# configure --host=HOST --target=TARGET --build=BUILD NONOPT
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_CANONICAL_BUILD
+test "${host_alias}" != "${target_alias}" &&
+ test "${program_prefix}${program_suffix}${program_transform_name}" = \
+ NONENONENONE && program_prefix=${target_alias}-
])
dnl Subroutines of AC_CANONICAL_SYSTEM.
fi
])
+dnl AC_CHECK_HEADERS(HEADER-FILE... [, ACTION])
+AC_DEFUN(AC_CHECK_HEADERS,
+[for ac_hdr in $1
+do
+AC_CHECK_HEADER(${ac_hdr},
+[changequote(, )dnl
+ ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./' '[A-Z]__'`
+changequote([, ])dnl
+ AC_DEFINE_UNQUOTED(${ac_tr_hdr}) $2])dnl
+done
+])
+
dnl AC_CHECK_FUNC(FUNCTION, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
AC_DEFUN(AC_CHECK_FUNC,
[AC_MSG_CHECKING([for $1])
done
])
-dnl AC_CHECK_HEADERS(HEADER-FILE... [, ACTION])
-AC_DEFUN(AC_CHECK_HEADERS,
-[AC_REQUIRE_CPP()dnl Make sure the cpp check happens outside the loop.
-for ac_hdr in $1
-do
-AC_CHECK_HEADER(${ac_hdr},
-[changequote(, )dnl
- ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./' '[A-Z]__'`
-changequote([, ])dnl
- AC_DEFINE_UNQUOTED(${ac_tr_hdr}) $2])dnl
-done
-])
-
dnl AC_REPLACE_FUNCS(FUNCTION-NAME...)
AC_DEFUN(AC_REPLACE_FUNCS,
[for ac_func in $1
AC_MSG_RESULT($ac_cv_prog_gcc)
if test $ac_cv_prog_gcc = yes; then
GCC=yes
- test "${CFLAGS+set}" = set || CFLAGS='-g -O'
+ if test "${CFLAGS+set}" != set; then
+ AC_MSG_CHECKING(whether ${CC-cc} accepts -g)
+AC_CACHE_VAL(ac_cv_prog_gcc_g,
+[echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_gcc_g=yes
+else
+ ac_cv_prog_gcc_g=no
+fi
+rm -f conftest*
+])dnl
+ AC_MSG_RESULT($ac_cv_prog_gcc_g)
+ if test $ac_cv_prog_gcc_g = yes; then
+ CFLAGS="-g -O"
+ else
+ CFLAGS="-O"
+ fi
+ fi
else
GCC=
- test "${CFLAGS+set}" = set || CFLAGS='-g'
+ test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
])
fi])dnl
if test $ac_cv_prog_gxx = yes; then
GXX=yes
- test "${CXXFLAGS+set}" = set || CXXFLAGS='-g -O'
+ if test "${CXXFLAGS+set}" != set; then
+ AC_MSG_CHECKING(whether ${CXX-gcc} accepts -g)
+AC_CACHE_VAL(ac_cv_prog_gxx_g,
+[echo 'void f(){}' > conftest.cc
+if test -z "`${CXX-gcc} -g -c conftest.cc 2>&1`"; then
+ ac_cv_prog_gxx_g=yes
+else
+ ac_cv_prog_gxx_g=no
+fi
+rm -f conftest*
+])dnl
+ AC_MSG_RESULT($ac_cv_prog_gxx_g)
+ if test $ac_cv_prog_gxx_g = yes; then
+ CXXFLAGS="-g -O"
+ else
+ CXXFLAGS="-O"
+ fi
+ fi
else
GXX=
- test "${CXXFLAGS+set}" = set || CXXFLAGS='-g'
+ test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
fi
])
[AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
if test $ac_cv_prog_gcc = yes; then
- AC_MSG_CHECKING(whether -traditional is needed)
+ AC_MSG_CHECKING(whether ${CC-cc} needs -traditional)
AC_CACHE_VAL(ac_cv_prog_gcc_traditional,
[ ac_pattern="Autoconf.*'x'"
AC_EGREP_CPP($ac_pattern, [#include <sgtty.h>
AC_DEFUN(AC_PROG_INSTALL,
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
-# Make sure to not get an incompatible install:
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
''|.|/etc|/usr/sbin|/usr/etc|/sbin|/usr/afsws/bin|/usr/ucb) ;;
*)
# OSF1, X11, and SCO ODT 3.0 have their own names for install.
- for ac_prog in ginstall installbsd bsdinst scoinst install; do
+ for ac_prog in ginstall installbsd scoinst install; do
if test -f $ac_dir/$ac_prog; then
if test $ac_prog = install &&
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
])
AC_DEFUN(AC_HEADER_DIRENT,
-[ac_header_dir=no
-AC_CHECK_HEADERS(dirent.h sys/ndir.h sys/dir.h ndir.h,
- [ac_header_dir=$ac_hdr; break])
+[ac_header_dirent=no
+AC_CHECK_HEADERS_DIRENT(dirent.h sys/ndir.h sys/dir.h ndir.h,
+ [ac_header_dirent=$ac_hdr; break])
])
+dnl Like AC_CHECK_HEADER, except also make sure that HEADER-FILE
+dnl defines the type `DIR'. dirent.h on NextStep 3.2 doesn't.
+dnl AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND)
+AC_DEFUN(AC_CHECK_HEADER_DIRENT,
+[ac_safe=`echo "$1" | tr './' '__'`
+AC_MSG_CHECKING([for $1 that defines DIR])
+AC_CACHE_VAL(ac_cv_header_dirent_$ac_safe,
+[AC_TRY_LINK([#include <sys/types.h>
+#include <$1>], [DIR *dirp = 0;],
+ eval "ac_cv_header_dirent_$ac_safe=yes",
+ eval "ac_cv_header_dirent_$ac_safe=no")])dnl
+if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
+ AC_MSG_RESULT(yes)
+ $2
+else
+ AC_MSG_RESULT(no)
+fi
+])
+
+dnl Like AC_CHECK_HEADERS, except succeed only for a HEADER-FILE that
+dnl defines `DIR'.
+dnl AC_CHECK_HEADERS_DIRENT(HEADER-FILE... [, ACTION])
+AC_DEFUN(AC_CHECK_HEADERS_DIRENT,
+[for ac_hdr in $1
+do
+AC_CHECK_HEADER_DIRENT(${ac_hdr},
+[changequote(, )dnl
+ ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./' '[A-Z]__'`
+changequote([, ])dnl
+ AC_DEFINE_UNQUOTED(${ac_tr_hdr}) $2])dnl
+done])
+
AC_DEFUN(AC_FUNC_CLOSEDIR_VOID,
[AC_REQUIRE([AC_HEADER_DIRENT])dnl
AC_MSG_CHECKING(whether closedir returns void)
AC_CACHE_VAL(ac_cv_func_closedir_void,
[AC_TRY_RUN([#include <sys/types.h>
-#include <$ac_header_dir>
+#include <$ac_header_dirent>
int closedir(); main() { exit(closedir(opendir(".")) != 0); }],
ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes)])dnl
AC_MSG_RESULT($ac_cv_func_closedir_void)
dnl Obsolete.
AC_DEFUN(AC_DIR_HEADER,
-[ac_header_dir=no
+[ac_header_dirent=no
for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
- AC_CHECK_HEADER($ac_hdr, [ac_header_dir=$ac_hdr; break])
+ AC_CHECK_HEADER_DIRENT($ac_hdr, [ac_header_dirent=$ac_hdr; break])
done
-case "$ac_header_dir" in
+case "$ac_header_dirent" in
dirent.h) AC_DEFINE(DIRENT) ;;
sys/ndir.h) AC_DEFINE(SYSNDIR) ;;
sys/dir.h) AC_DEFINE(SYSDIR) ;;
AC_MSG_CHECKING(whether closedir returns void)
AC_CACHE_VAL(ac_cv_func_closedir_void,
[AC_TRY_RUN([#include <sys/types.h>
-#include <$ac_header_dir>
+#include <$ac_header_dirent>
int closedir(); main() { exit(closedir(opendir(".")) != 0); }],
ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes)])dnl
AC_MSG_RESULT($ac_cv_func_closedir_void)
[# If we cannot run a trivial program, we must be cross compiling.
AC_MSG_CHECKING(whether cross-compiling)
AC_CACHE_VAL(ac_cv_c_cross,
-[AC_TRY_RUN([main(){exit(0);}],
+[AC_TRY_RUN([main(){return(0);}],
ac_cv_c_cross=no, ac_cv_c_cross=yes, ac_cv_cross=yes)])dnl
cross_compiling=$ac_cv_c_cross
AC_MSG_RESULT($ac_cv_c_cross)
], [AC_MSG_RESULT(yes); XENIX=yes], [AC_MSG_RESULT(no); XENIX=])
if test "$XENIX" = yes; then
LIBS="$LIBS -lx"
- if test $ac_header_dir != sys/ndir.h; then
+ if test $ac_header_dirent != sys/ndir.h; then
LIBS="-ldir $LIBS" # Make sure -ldir precedes -lx.
fi
fi