]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Have --host=sun4 automatically look for CC=sun4-cc etc.
authorAkim Demaille <akim@epita.fr>
Wed, 24 May 2000 15:46:12 +0000 (15:46 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 24 May 2000 15:46:12 +0000 (15:46 +0000)
* 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.

ChangeLog
acgeneral.m4
aclang.m4
doc/autoconf.texi
lib/autoconf/c.m4
lib/autoconf/fortran.m4
lib/autoconf/general.m4
lib/autoconf/lang.m4
tests/Makefile.am
tests/Makefile.in

index a7ebec78c6c951f9cdef711c790d5f1127d434ca..4cc5da00e422074675f5758004a38892c68d20c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+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...
index 96ac36b14581cddf93c460b0f46bf7d714946e19..213ff55f5464b6518ed52c14060d17f1b441ff8c 100644 (file)
@@ -2638,6 +2638,31 @@ fi])
 ])
 
 
+# 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
index 8e3fa5624558128a806aaab2fa946161a871884b..c0a85ccf47d8b237d3453943355f80789ac03af3 100644 (file)
--- a/aclang.m4
+++ b/aclang.m4
@@ -490,9 +490,9 @@ AC_DEFUN([AC_PROG_CC],
 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
@@ -681,7 +681,7 @@ AC_SUBST(CXXCPP)dnl
 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
@@ -765,7 +765,7 @@ rm -f conftest*
 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
index b5f63e884e2009f7bbdc7ff66863e397de2a16bb..6505aeadca64434ba27cbda289bd6813e36e1b78 100644 (file)
@@ -2485,7 +2485,7 @@ that case, set @var{variable} using the absolute file name of the
 @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
@@ -2509,6 +2509,18 @@ sets @code{RANLIB} to @file{i386-gnu-ranlib} if that program exists in
 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
@@ -6120,26 +6132,24 @@ system types are involved.  The options to specify them are:
 @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
index 8e3fa5624558128a806aaab2fa946161a871884b..c0a85ccf47d8b237d3453943355f80789ac03af3 100644 (file)
@@ -490,9 +490,9 @@ AC_DEFUN([AC_PROG_CC],
 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
@@ -681,7 +681,7 @@ AC_SUBST(CXXCPP)dnl
 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
@@ -765,7 +765,7 @@ rm -f conftest*
 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
index 8e3fa5624558128a806aaab2fa946161a871884b..c0a85ccf47d8b237d3453943355f80789ac03af3 100644 (file)
@@ -490,9 +490,9 @@ AC_DEFUN([AC_PROG_CC],
 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
@@ -681,7 +681,7 @@ AC_SUBST(CXXCPP)dnl
 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
@@ -765,7 +765,7 @@ rm -f conftest*
 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
index 96ac36b14581cddf93c460b0f46bf7d714946e19..213ff55f5464b6518ed52c14060d17f1b441ff8c 100644 (file)
@@ -2638,6 +2638,31 @@ fi])
 ])
 
 
+# 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
index 8e3fa5624558128a806aaab2fa946161a871884b..c0a85ccf47d8b237d3453943355f80789ac03af3 100644 (file)
@@ -490,9 +490,9 @@ AC_DEFUN([AC_PROG_CC],
 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
@@ -681,7 +681,7 @@ AC_SUBST(CXXCPP)dnl
 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
@@ -765,7 +765,7 @@ rm -f conftest*
 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
index 836e0ee053f3b3b8232c4c1cb737e558b7fbf967..ff288ea3aeb14483e0215c089a3048217cc3ec25 100644 (file)
@@ -79,7 +79,7 @@ testsuite: atgeneral.m4 atspecific.m4 suite.m4 macros.m4 $(SUITE)
 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\
index 8c9d2132089efe7387df6dba92c7895735cfb87f..563a09ba038214682ef23402989ea7c474970e69 100644 (file)
@@ -109,7 +109,7 @@ PERL = perl
 #
 # 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.