home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
gnu
/
lib
/
autoconf-1.11
/
acspecific.m4
< prev
Wrap
M4 Source File
|
1995-01-18
|
42KB
|
1,415 lines
dnl Macros that test for specific features.
dnl This file is part of Autoconf.
dnl Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2, or (at your option)
dnl any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
dnl Written by David MacKenzie, with help from
dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
dnl Roland McGrath, and Noah Friedman.
dnl
dnl
dnl checks for programs
dnl
dnl
define(AC_PROG_CC,
[AC_BEFORE([$0], [AC_PROG_CPP])AC_PROVIDE([$0])AC_PROGRAM_CHECK(CC, gcc, gcc, cc)
# Find out if we are using GNU C, under whatever name.
cat > conftest.c <<EOF
#ifdef __GNUC__
yes
#endif
EOF
${CC-cc} -E conftest.c > conftest.out 2>&1
if egrep yes conftest.out >/dev/null 2>&1; then
GCC=1 # For later tests.
fi
rm -rf conftest*
])dnl
dnl
define(AC_PROG_CXX,
[AC_BEFORE([$0], [AC_PROG_CXXCPP])AC_PROVIDE([$0])
AC_PROGRAMS_CHECK(CXX, $CCC c++ g++ gcc CC cxx, gcc)
# Find out if we are using GNU C++, under whatever name.
cat > conftest.C <<EOF
#ifdef __GNUC__
yes
#endif
EOF
${CXX-gcc} -E conftest.C > conftest.out 2>&1
if egrep yes conftest.out >/dev/null 2>&1; then
GXX=1 # For later tests.
fi
rm -rf conftest*
])dnl
dnl
define(AC_GCC_TRADITIONAL,
[AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_PROG_CPP])if test -n "$GCC"; then
AC_CHECKING(whether -traditional is needed)
changequote(,)dnl
ac_pattern="Autoconf.*'x'"
changequote([,])dnl
ac_prog='#include <sgtty.h>
Autoconf TIOCGETP'
AC_PROGRAM_EGREP($ac_pattern, $ac_prog, ac_need_trad=1)
if test -z "$ac_need_trad"; then
ac_prog='#include <termio.h>
Autoconf TCGETA'
AC_PROGRAM_EGREP($ac_pattern, $ac_prog, ac_need_trad=1)
fi
test -n "$ac_need_trad" && CC="$CC -traditional"
fi
])dnl
dnl
define(AC_MINUS_C_MINUS_O,
[AC_CHECKING(whether $CC and cc understand -c and -o together)
/bin/echo 'foo(){}' > conftest.c
# Make sure it works both with $CC and with simple cc.
# We do the test twice because some compilers refuse to overwrite an
# existing .o file with -o, though they will create one.
if ${CC-cc} -c conftest.c -o conftest.o >/dev/null 2>&1 \
&& test -f conftest.o && ${CC-cc} -c conftest.c -o conftest.o >/dev/null 2>&1
then
# Test first that cc exists at all.
if cc -c conftest.c >/dev/null 2>&1
then
if cc -c conftest.c -o conftest2.o >/dev/null 2>&1 && \
test -f conftest2.o && cc -c conftest.c -o conftest2.o >/dev/null 2>&1
then
:
else
AC_DEFINE(NO_MINUS_C_MINUS_O)
fi
fi
else
AC_DEFINE(NO_MINUS_C_MINUS_O)
fi
rm -rf conftest*
])dnl
dnl
dnl Define SET_MAKE to set ${MAKE} if make doesn't.
define(AC_SET_MAKE,
[cat > conftestmake <<'EOF'
all:
@/bin/echo 'ac_maketemp="${MAKE}"'
EOF
changequote(,)dnl
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
changequote([,])dnl
if test -n "$ac_maketemp"; then SET_MAKE=
else SET_MAKE="MAKE=${MAKE-make}"; fi
rm -f conftestmake
AC_SUBST([SET_MAKE])dnl
])dnl
dnl
define(AC_PROG_RANLIB, [AC_PROGRAM_CHECK(RANLIB, ranlib, ranlib, :)])dnl
dnl
define(AC_PROG_AWK, [AC_PROGRAMS_CHECK(AWK, mawk gawk nawk awk,)])dnl
dnl
define(AC_PROG_YACC,[AC_PROGRAMS_CHECK(YACC, 'bison -y' byacc, yacc)])dnl
dnl
define(AC_PROG_CPP,
[AC_PROVIDE([$0])AC_CHECKING(how to run the C preprocessor)
if test -z "$CPP"; then
# This must be in double quotes, not single quotes, because CPP may get
# substituted into the Makefile and ``${CC-cc}'' will simply confuse
# make. It must be expanded now.
CPP="${CC-cc} -E"
dnl On the NeXT, cc -E runs the code through the compiler's parser,
dnl not just through cpp.
AC_TEST_CPP([#include <stdio.h>
Syntax Error], ,
CPP="${CC-cc} -E -traditional-cpp"
AC_TEST_CPP([#include <stdio.h>
Syntax Error], ,CPP=/lib/cpp))
fi
AC_VERBOSE(setting CPP to $CPP)
AC_SUBST(CPP)dnl
])dnl
dnl
define(AC_PROG_CXXCPP,
[AC_PROVIDE([$0])AC_CHECKING(how to run the C++ preprocessor)
AC_LANG_SAVE[]dnl
AC_LANG_CPLUSPLUS[]dnl
if test -z "$CXXCPP"; then
CXXCPP="${CXX-c++} -E"
AC_TEST_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp)
fi
AC_VERBOSE(setting CXXCPP to $CXXCPP)
AC_LANG_RESTORE[]dnl
AC_SUBST(CXXCPP)dnl
])dnl
dnl
dnl Require finding the C or C++ preprocessor, whichever is the
dnl current language.
define(AC_REQUIRE_CPP,
[ifelse(AC_LANG,C,[AC_REQUIRE([AC_PROG_CPP])],[AC_REQUIRE([AC_PROG_CXXCPP])])])dnl
dnl
define(AC_PROG_LEX,
[AC_PROVIDE([$0])AC_PROGRAM_CHECK(LEX, flex, flex, lex)
if test -z "$LEXLIB"
then
case "$LEX" in
flex*) AC_HAVE_LIBRARY(fl, LEXLIB="-lfl") ;;
*) LEXLIB="-ll" ;;
esac
fi
AC_VERBOSE(setting LEXLIB to $LEXLIB)
AC_SUBST(LEXLIB)])dnl
dnl
define(AC_YYTEXT_POINTER,[dnl
AC_REQUIRE_CPP()AC_REQUIRE([AC_PROG_LEX])dnl
AC_CHECKING(for yytext declaration)
# POSIX says lex can declare yytext either as a pointer or an array; the
# default is implementation-dependent. Figure out which it is, since
# not all implementations provide the %pointer and %array declarations.
#
# The minimal lex program is just a single line: %%. But some broken lexes
# (Solaris, I think it was) want two %% lines, so accommodate them.
/bin/echo '%%
%%' | ${LEX}
if test -f lex.yy.c; then
LEX_OUTPUT_ROOT=lex.yy
elif test -f lexyy.c; then
LEX_OUTPUT_ROOT=lexyy
else
# Don't know what to do here.
AC_ERROR(cannot find output from $LEX, giving up on yytext declaration)
LEX_OUTPUT_ROOT=
fi
if test -n "$LEX_OUTPUT_ROOT"; then
/bin/echo 'extern char *yytext; main () { exit (0); }' >>$LEX_OUTPUT_ROOT.c
ac_save_LIBS="$LIBS"
LIBS="$LIBS $LEXLIB"
AC_TEST_PROGRAM(`cat $LEX_OUTPUT_ROOT.c`, AC_DEFINE(YYTEXT_POINTER))
LIBS="$ac_save_LIBS"
rm -f "${LEX_OUTPUT_ROOT}.c"
fi
AC_SUBST(LEX_OUTPUT_ROOT)dnl
])dnl
dnl
define(AC_PROG_INSTALL,
[# Make sure to not get the incompatible SysV /etc/install and
# /usr/sbin/install, which might be in PATH before a BSD-like install,
# or the SunOS /usr/etc/install directory, or the AIX /bin/install,
# or the AFS install, which mishandles nonexistent args, or
# /usr/ucb/install on SVR4, which tries to use the nonexistent group
# `staff', or /sbin/install on IRIX which has incompatible command-line
# syntax. Sigh.
#
# On most BSDish systems install is in /usr/bin, not /usr/ucb
# anyway.
# This turns out not to be true, so the mere pathname isn't an indication
# of whether the program works. What we really need is a set of tests for
# the install program to see if it actually works in all the required ways.
#
# Avoid using ./install, which might have been erroneously created
# by make from ./install.sh.
if test -z "${INSTALL}"; then
AC_CHECKING(for a BSD compatible install)
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH; do
case "$ac_dir" in
''|.|/gnu/etc) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
for ac_prog in installbsd scoinst install; do
if test -f $ac_dir/$ac_prog; then
if test $ac_prog = install &&
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
# OSF/1 installbsd also uses dspmsg, but is usable.
:
else
INSTALL="$ac_dir/$ac_prog -c"
break 2
fi
fi
done
;;
esac
done
IFS="$ac_save_ifs"
fi
if test -z "$INSTALL"; then
# As a last resort, use the slow shell script.
for ac_dir in ${srcdir} ${srcdir}/.. ${srcdir}/../..; do
if test -f $ac_dir/install.sh; then
INSTALL="$ac_dir/install.sh -c"; break
fi
done
fi
if test -z "$INSTALL"; then
AC_ERROR([can not find install.sh in ${srcdir} or ${srcdir}/.. or ${srcdir}/../..])
fi
AC