2 # This file is part of the aMule Project.
4 # Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
6 # Any parts of this program derived from the xMule, lMule or eMule project,
7 # or contributed by third-party developers are copyrighted by their
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 # This package has been tested with GNU Autoconf 2.59, and not guaranteed to
26 # work with any other version. However, you only need to worry about it if
27 # you're cross-compiling.
29 # _AC_CHECK_BUILD_PREFIX
30 # -----------------------
31 # Checks and sets the build prefix, if it is given by --build.
32 AC_DEFUN([_AC_CHECK_BUILD_PREFIX],
34 test -n "$build_alias" && ac_build_prefix=$build_alias-
35 ]) # AC_CHECK_BUILD_PREFIX
38 # AC_PROG_BUILD_CC([COMPILER ...])
39 # --------------------------
40 # COMPILER ... is a space separated list of C compilers to search for.
41 # This just gives the user an opportunity to specify an alternative
42 # search list for the C compiler.
44 # IMPORTANT: Run all other compiler tests *before* calling this macro!
46 # This is a stripped-down check, it checks only what we need,
47 # i.e. BUILD_CC and BUILD_EXEEXT
49 AC_DEFUN([AC_PROG_BUILD_CC],
50 [AC_REQUIRE([_AC_CHECK_BUILD_PREFIX])dnl
51 dnl Set new names of important variables.
52 pushdef([ac_tool_prefix], [ac_build_prefix])dnl
53 pushdef([CC], [BUILD_CC])dnl
54 pushdef([EXEEXT], [BUILD_EXEEXT])dnl
55 pushdef([ac_cv_exeext], [ac_cv_build_exeext])dnl
56 pushdef([ac_exeext], [ac_build_exeext])dnl
57 dnl Don't use the values for the cross-compiler
58 pushdef([CPPFLAGS], [BUILD_CPPFLAGS])dnl
59 pushdef([CFLAGS], [BUILD_CFLAGS])dnl
60 pushdef([LDFLAGS], [BUILD_LDFLAGS])dnl
61 pushdef([LIBS], [BUILD_LIBS])dnl
63 # Even if we're cross-compiling, we want a compiler here
64 # that is not a cross-compiler.
65 saved_cross=$cross_compiling
68 dnl From now on, this is just a mere copy of Autoconf's AC_PROG_CC macro.
71 [AC_CHECK_TOOLS(CC, [$1])],
72 [AC_CHECK_TOOL(CC, gcc)
73 if test -z "$CC"; then
76 if test -z "$CC"; then
77 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
79 if test -z "$CC"; then
80 AC_CHECK_TOOLS(CC, cl)
84 test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH])
86 # Provide some information about the compiler.
87 echo "$as_me:$LINENO:" \
88 "checking for _AC_LANG compiler version" >&AS_MESSAGE_LOG_FD
89 ac_compiler=`set X $ac_compile; echo $[2]`
90 _AC_EVAL([$ac_compiler --version </dev/null >&AS_MESSAGE_LOG_FD])
91 _AC_EVAL([$ac_compiler -v </dev/null >&AS_MESSAGE_LOG_FD])
92 _AC_EVAL([$ac_compiler -V </dev/null >&AS_MESSAGE_LOG_FD])
94 dnl Forcibly include _AC_COMPILER_EXEEXT, to determine the build exeext.
96 dnl End of copy, here some parts are stripped out. We only want a working C
97 dnl compiler, and doesn't need the objext, the preprocessor, the dependency
98 dnl style, whether it's gnu or not, etc.
100 # Restore configuration environment
101 cross_compiling=$saved_cross
103 dnl Restore variable names.
107 popdef([CPPFLAGS])dnl
108 popdef([ac_exeext])dnl
109 popdef([ac_cv_exeext])dnl
112 popdef([ac_tool_prefix])dnl
114 dnl AC_LANG_POP(C) must be called after the variable names are restored, thus
115 dnl it will restore the correct (host) environment, not the build environment.
117 dnl Substitute variables for the build compiler
118 AC_SUBST(BUILD_EXEEXT)dnl
119 AC_SUBST(BUILD_CPPFLAGS)dnl
120 AC_SUBST(BUILD_CFLAGS)dnl
121 AC_SUBST(BUILD_LDFLAGS)dnl
122 ]) # AC_PROG_BUILD_CC