67bb203341eea8178302f49aefa769c1028e2a75
[gcc.git] / zlib / acinclude.m4
1 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
2 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
3 # are probably using a cross compiler, which will not be able to fully
4 # link an executable. This should really be fixed in autoconf
5 # itself.
6
7 AC_DEFUN(LIB_AC_PROG_CC,
8 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
9 AC_CHECK_PROG(CC, gcc, gcc)
10 if test -z "$CC"; then
11 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
12 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
13 fi
14
15 AC_PROG_CC_GNU
16
17 if test $ac_cv_prog_gcc = yes; then
18 GCC=yes
19 dnl Check whether -g works, even if CFLAGS is set, in case the package
20 dnl plays around with CFLAGS (such as to build both debugging and
21 dnl normal versions of a library), tasteless as that idea is.
22 ac_test_CFLAGS="${CFLAGS+set}"
23 ac_save_CFLAGS="$CFLAGS"
24 CFLAGS=
25 AC_PROG_CC_G
26 if test "$ac_test_CFLAGS" = set; then
27 CFLAGS="$ac_save_CFLAGS"
28 elif test $ac_cv_prog_cc_g = yes; then
29 CFLAGS="-g -O2"
30 else
31 CFLAGS="-O2"
32 fi
33 else
34 GCC=
35 test "${CFLAGS+set}" = set || CFLAGS="-g"
36 fi
37 ])