* acgeneral.m4 (AC_CHECK_TOOLS): New.
* aclang.m4 (AC_PROG_CXX, AC_PROG_CC, AC_PROG_F77): Use new
AC_CHECK_TOOLS macro instead of AC_CHECK_PROGS so that a cross
compiler is found by default with --host.
* doc/autoconf.texi (Generic Programs, Manual Configuration):
Describe new AC_CHECK_TOOLS macro. Fix unclear working about
AC_CHECK_PROGS.
* tests/Makefile.am (FILTER_MACROS): Adjust.
+2000-05-24 Mo DeJong <mdejong@cygnus.com>
+
+ Have --host=sun4 automatically look for CC=sun4-cc etc.
+
+ * acgeneral.m4 (AC_CHECK_TOOLS): New.
+ * aclang.m4 (AC_PROG_CXX, AC_PROG_CC, AC_PROG_F77): Use new
+ AC_CHECK_TOOLS macro instead of AC_CHECK_PROGS so that a cross
+ compiler is found by default with --host.
+ * doc/autoconf.texi (Generic Programs, Manual Configuration):
+ Describe new AC_CHECK_TOOLS macro. Fix unclear working about
+ AC_CHECK_PROGS.
+ * tests/Makefile.am (FILTER_MACROS): Adjust.
+
2000-04-07 Akim Demaille <akim@epita.fr>
The night of the living dead...
])
+# AC_CHECK_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
+# [PATH])
+# ------------------------------------------------------------------
+# Check for each compiler in PROGS-TO-CHECK-FOR with the cross
+# prefix. If none can be found with a cross prefix, then use
+# the first one that was found without the cross prefix.
+AC_DEFUN([AC_CHECK_TOOLS],
+[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
+ac_check_tools_first_found=
+for ac_prog in $2
+do
+AC_CHECK_PROG([$1], ${ac_tool_prefix}$ac_prog,
+ ${ac_tool_prefix}$ac_prog, , [$4])
+if test -z "$$1" && test -z "$ac_check_tools_first_found" ; then
+ AC_CHECK_PROG(ac_check_tools_first_found, $ac_prog, $ac_prog, , [$4])
+elif test -n "$$1" ; then
+ break
+fi
+done
+if test -z "$$1" ; then
+ $1=$ac_check_tools_first_found
+fi
+ifval([$3], [test -n "$$1" || $1="$3"
+])])
+
# AC_PREFIX_PROGRAM(PROGRAM)
# --------------------------
# Guess the value for the `prefix' variable by looking for
AC_LANG_PUSH(C)
AC_ARG_VAR([CFLAGS], [Extra flags for the C compiler])
ifval([$1],
- [AC_CHECK_PROGS(CC, [$1])],
+ [AC_CHECK_TOOLS(CC, [$1])],
[
- AC_CHECK_PROG(CC, gcc, gcc)
+ AC_CHECK_TOOL(CC, gcc)
if test -z "$CC"; then
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
if test -z "$CC"; then
AC_DEFUN([AC_PROG_CXX],
[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
AC_LANG_PUSH(C++)
-AC_CHECK_PROGS(CXX, $CCC m4_default([$1], [c++ g++ gpp CC cxx cc++ cl]), g++)
+AC_CHECK_TOOLS(CXX, $CCC m4_default([$1], [c++ g++ gpp CC cxx cc++ cl]), g++)
_AC_LANG_COMPILER_WORKS
_AC_PROG_CXX_GNU
AC_DEFUN([AC_PROG_F77],
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_LANG_PUSH(Fortran 77)
-AC_CHECK_PROGS(F77,
+AC_CHECK_TOOLS(F77,
m4_default([$1], [g77 f77 xlf cf77 fl32 fort77 f90 xlf90 f2c]))
_AC_LANG_COMPILER_WORKS
@defmac AC_CHECK_PROGS (@var{variable}, @var{progs-to-check-for}, @ovar{value-if-not-found}, @ovar{path})
@maindex CHECK_PROGS
Check for each program in the whitespace-separated list
-@var{progs-to-check-for} exists in @code{PATH}. If it is found, set
+@var{progs-to-check-for} exists on the @code{PATH}. If it is found, set
@var{variable} to the name of that program. Otherwise, continue
checking the next program in the list. If none of the programs in the
list are found, set @var{variable} to @var{value-if-not-found}; if
or to @samp{:} if neither program exists.
@end defmac
+@defmac AC_CHECK_TOOLS (@var{variable}, @var{progs-to-check-for}, @ovar{value-if-not-found}, @ovar{path})
+@maindex CHECK_TOOLS
+Like @code{AC_CHECK_TOOL}, each of the tools in the list @var{progs-to-check-for} are
+checked with a prefix of the host type as determined by @code{AC_CANONICAL_HOST},
+followed by a dash (@pxref{Canonicalizing}). If none of the tools can be found with a
+prefix, then the first one without a prefix is used. If a tool is found, set
+@var{variable} to the name of that program. If none of the tools in the
+list are found, set @var{variable} to @var{value-if-not-found}; if
+@var{value-if-not-found} is not specified, the value of @var{variable}
+is not changed. Calls @code{AC_SUBST} for @var{variable}.
+@end defmac
+
@defmac AC_PATH_PROG (@var{variable}, @var{prog-to-check-for}, @ovar{value-if-not-found}, @ovar{path})
@maindex PATH_PROG
Like @code{AC_CHECK_PROG}, but set @var{variable} to the entire
@table @code
@item --build=@var{build-type}
the type of system on which the package is being configured and
-compiled (rarely needed);
+compiled (rarely needed).
@item --host=@var{host-type}
-the type of system on which the package will run;
+the type of system on which the package will run.
@item --target=@var{target-type}
the type of system for which any compiler tools in the package will
-produce code.
+produce code (rarely needed).
@end table
By default, the build system type is guessed (by @code{config.guess}),
the host system is the build system, and the target is the host system.
-Using @samp{--host=@var{host-type}} enables cross-compilation to
-@var{host-type}. You still have to specify the names of the cross-tools
-you use, in particular the C compiler, on the @code{configure} command
+Using @samp{--host=@var{host-type}} enables cross-compilation.
line, e.g.,
@example
-./configure --host=m68k-coff CC=m68k-coff-gcc
+./configure --host=m68k-coff
@end example
@noindent
AC_LANG_PUSH(C)
AC_ARG_VAR([CFLAGS], [Extra flags for the C compiler])
ifval([$1],
- [AC_CHECK_PROGS(CC, [$1])],
+ [AC_CHECK_TOOLS(CC, [$1])],
[
- AC_CHECK_PROG(CC, gcc, gcc)
+ AC_CHECK_TOOL(CC, gcc)
if test -z "$CC"; then
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
if test -z "$CC"; then
AC_DEFUN([AC_PROG_CXX],
[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
AC_LANG_PUSH(C++)
-AC_CHECK_PROGS(CXX, $CCC m4_default([$1], [c++ g++ gpp CC cxx cc++ cl]), g++)
+AC_CHECK_TOOLS(CXX, $CCC m4_default([$1], [c++ g++ gpp CC cxx cc++ cl]), g++)
_AC_LANG_COMPILER_WORKS
_AC_PROG_CXX_GNU
AC_DEFUN([AC_PROG_F77],
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_LANG_PUSH(Fortran 77)
-AC_CHECK_PROGS(F77,
+AC_CHECK_TOOLS(F77,
m4_default([$1], [g77 f77 xlf cf77 fl32 fort77 f90 xlf90 f2c]))
_AC_LANG_COMPILER_WORKS
AC_LANG_PUSH(C)
AC_ARG_VAR([CFLAGS], [Extra flags for the C compiler])
ifval([$1],
- [AC_CHECK_PROGS(CC, [$1])],
+ [AC_CHECK_TOOLS(CC, [$1])],
[
- AC_CHECK_PROG(CC, gcc, gcc)
+ AC_CHECK_TOOL(CC, gcc)
if test -z "$CC"; then
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
if test -z "$CC"; then
AC_DEFUN([AC_PROG_CXX],
[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
AC_LANG_PUSH(C++)
-AC_CHECK_PROGS(CXX, $CCC m4_default([$1], [c++ g++ gpp CC cxx cc++ cl]), g++)
+AC_CHECK_TOOLS(CXX, $CCC m4_default([$1], [c++ g++ gpp CC cxx cc++ cl]), g++)
_AC_LANG_COMPILER_WORKS
_AC_PROG_CXX_GNU
AC_DEFUN([AC_PROG_F77],
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_LANG_PUSH(Fortran 77)
-AC_CHECK_PROGS(F77,
+AC_CHECK_TOOLS(F77,
m4_default([$1], [g77 f77 xlf cf77 fl32 fort77 f90 xlf90 f2c]))
_AC_LANG_COMPILER_WORKS
])
+# AC_CHECK_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
+# [PATH])
+# ------------------------------------------------------------------
+# Check for each compiler in PROGS-TO-CHECK-FOR with the cross
+# prefix. If none can be found with a cross prefix, then use
+# the first one that was found without the cross prefix.
+AC_DEFUN([AC_CHECK_TOOLS],
+[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
+ac_check_tools_first_found=
+for ac_prog in $2
+do
+AC_CHECK_PROG([$1], ${ac_tool_prefix}$ac_prog,
+ ${ac_tool_prefix}$ac_prog, , [$4])
+if test -z "$$1" && test -z "$ac_check_tools_first_found" ; then
+ AC_CHECK_PROG(ac_check_tools_first_found, $ac_prog, $ac_prog, , [$4])
+elif test -n "$$1" ; then
+ break
+fi
+done
+if test -z "$$1" ; then
+ $1=$ac_check_tools_first_found
+fi
+ifval([$3], [test -n "$$1" || $1="$3"
+])])
+
# AC_PREFIX_PROGRAM(PROGRAM)
# --------------------------
# Guess the value for the `prefix' variable by looking for
AC_LANG_PUSH(C)
AC_ARG_VAR([CFLAGS], [Extra flags for the C compiler])
ifval([$1],
- [AC_CHECK_PROGS(CC, [$1])],
+ [AC_CHECK_TOOLS(CC, [$1])],
[
- AC_CHECK_PROG(CC, gcc, gcc)
+ AC_CHECK_TOOL(CC, gcc)
if test -z "$CC"; then
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
if test -z "$CC"; then
AC_DEFUN([AC_PROG_CXX],
[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
AC_LANG_PUSH(C++)
-AC_CHECK_PROGS(CXX, $CCC m4_default([$1], [c++ g++ gpp CC cxx cc++ cl]), g++)
+AC_CHECK_TOOLS(CXX, $CCC m4_default([$1], [c++ g++ gpp CC cxx cc++ cl]), g++)
_AC_LANG_COMPILER_WORKS
_AC_PROG_CXX_GNU
AC_DEFUN([AC_PROG_F77],
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_LANG_PUSH(Fortran 77)
-AC_CHECK_PROGS(F77,
+AC_CHECK_TOOLS(F77,
m4_default([$1], [g77 f77 xlf cf77 fl32 fort77 f90 xlf90 f2c]))
_AC_LANG_COMPILER_WORKS
FILTER_MACROS = egrep -v -e \
`echo '^AC_ARG_VAR$$\
^AC_CANONICALIZE$$\
-^AC_CHECK_(DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|TYPE)S?$$\
+^AC_CHECK_(DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|TOOL|TYPE)S?$$\
^AC_CONFIG\
^AC_INIT\
^AC_LANG\
#
# Multiple `-e' to egrep are not portable, so join all the patterns together.
# We use the fact that automake will replace all the `\\\n' with ` '.
-FILTER_MACROS = egrep -v -e `echo '^AC_ARG_VAR$$ ^AC_CANONICALIZE$$ ^AC_CHECK_(DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|TYPE)S?$$ ^AC_CONFIG ^AC_INIT ^AC_LANG ^AC_LINKER_OPTION$$ ^AC_LINK_FILES$$ ^AC_LIST_MEMBER_OF$$ ^AC_OUTPUT$$ ^AC_PATH_(TOOL|PROG)S?$$ ^AC_REPLACE_FUNCS$$ ^AC_SEARCH_LIBS$$ ^AC_TRY ^AC_.*_IFELSE$$ ^AC_FD_CC$$ ^(AC_(PROG_CC|C_CONST|C_INLINE|C_VOLATILE))$$ ^AC_(CYGWIN|CYGWIN32|EMXOS2|MING32|EXEEXT|OBJEXT)$$ _AC_' | tr ' ' '|'`
+FILTER_MACROS = egrep -v -e `echo '^AC_ARG_VAR$$ ^AC_CANONICALIZE$$ ^AC_CHECK_(DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|TOOL|TYPE)S?$$ ^AC_CONFIG ^AC_INIT ^AC_LANG ^AC_LINKER_OPTION$$ ^AC_LINK_FILES$$ ^AC_LIST_MEMBER_OF$$ ^AC_OUTPUT$$ ^AC_PATH_(TOOL|PROG)S?$$ ^AC_REPLACE_FUNCS$$ ^AC_SEARCH_LIBS$$ ^AC_TRY ^AC_.*_IFELSE$$ ^AC_FD_CC$$ ^(AC_(PROG_CC|C_CONST|C_INLINE|C_VOLATILE))$$ ^AC_(CYGWIN|CYGWIN32|EMXOS2|MING32|EXEEXT|OBJEXT)$$ _AC_' | tr ' ' '|'`
# The files which contains macro we check for syntax.