* m4/minuso.m4 (AM_PROG_CC_C_O): Make sure AC_PROG_CC is never
[platform/upstream/automake.git] / m4 / minuso.m4
1 # serial 2
2
3 # AM_PROG_CC_C_O
4 # --------------
5 # Like AC_PROG_CC_C_O, but changed for automake.
6
7 # Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
8
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2, or (at your option)
12 # any later version.
13
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 # 02111-1307, USA.
23
24 AC_DEFUN([AM_PROG_CC_C_O],
25 [AC_REQUIRE([AC_PROG_CC_C_O])dnl
26 AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
27 AC_REQUIRE_AUX_FILE([compile])dnl
28 # FIXME: we rely on the cache variable name because
29 # there is no other way.
30 set dummy $CC
31 ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
32 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
33    # Losing compiler, so override with the script.
34    # FIXME: It is wrong to rewrite CC.
35    # But if we don't then we get into trouble of one sort or another.
36    # A longer-term fix would be to have automake use am__CC in this case,
37    # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
38    CC="$am_aux_dir/compile $CC"
39 fi
40 dnl Make sure AC_PROG_CC is never called again, or it will override our
41 dnl setting of CC.
42 m4_define([AC_PROG_CC],
43           [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
44 ])