home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / lib / autoconf-1.11 / acspecific.m4 < prev   
M4 Source File  |  1995-01-18  |  42KB  |  1,415 lines

  1. dnl Macros that test for specific features.
  2. dnl This file is part of Autoconf.
  3. dnl Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
  4. dnl
  5. dnl This program is free software; you can redistribute it and/or modify
  6. dnl it under the terms of the GNU General Public License as published by
  7. dnl the Free Software Foundation; either version 2, or (at your option)
  8. dnl any later version.
  9. dnl
  10. dnl This program is distributed in the hope that it will be useful,
  11. dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. dnl GNU General Public License for more details.
  14. dnl
  15. dnl You should have received a copy of the GNU General Public License
  16. dnl along with this program; if not, write to the Free Software
  17. dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. dnl
  19. dnl Written by David MacKenzie, with help from
  20. dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
  21. dnl Roland McGrath, and Noah Friedman.
  22. dnl
  23. dnl
  24. dnl checks for programs
  25. dnl
  26. dnl
  27. define(AC_PROG_CC,
  28. [AC_BEFORE([$0], [AC_PROG_CPP])AC_PROVIDE([$0])AC_PROGRAM_CHECK(CC, gcc, gcc, cc)
  29. # Find out if we are using GNU C, under whatever name.
  30. cat > conftest.c <<EOF
  31. #ifdef __GNUC__
  32.   yes
  33. #endif
  34. EOF
  35. ${CC-cc} -E conftest.c > conftest.out 2>&1
  36. if egrep yes conftest.out >/dev/null 2>&1; then
  37.   GCC=1 # For later tests.
  38. fi
  39. rm -rf conftest*
  40. ])dnl
  41. dnl
  42. define(AC_PROG_CXX,
  43. [AC_BEFORE([$0], [AC_PROG_CXXCPP])AC_PROVIDE([$0])
  44. AC_PROGRAMS_CHECK(CXX, $CCC c++ g++ gcc CC cxx, gcc)
  45. # Find out if we are using GNU C++, under whatever name.
  46. cat > conftest.C <<EOF
  47. #ifdef __GNUC__
  48.   yes
  49. #endif
  50. EOF
  51. ${CXX-gcc} -E conftest.C > conftest.out 2>&1
  52. if egrep yes conftest.out >/dev/null 2>&1; then
  53.   GXX=1 # For later tests.
  54. fi
  55. rm -rf conftest*
  56. ])dnl
  57. dnl
  58. define(AC_GCC_TRADITIONAL,
  59. [AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_PROG_CPP])if test -n "$GCC"; then
  60.   AC_CHECKING(whether -traditional is needed)
  61. changequote(,)dnl
  62.   ac_pattern="Autoconf.*'x'"
  63. changequote([,])dnl
  64.   ac_prog='#include <sgtty.h>
  65. Autoconf TIOCGETP'
  66.   AC_PROGRAM_EGREP($ac_pattern, $ac_prog, ac_need_trad=1)
  67.  
  68.   if test -z "$ac_need_trad"; then
  69.     ac_prog='#include <termio.h>
  70. Autoconf TCGETA'
  71.     AC_PROGRAM_EGREP($ac_pattern, $ac_prog, ac_need_trad=1)
  72.   fi
  73.   test -n "$ac_need_trad" && CC="$CC -traditional"
  74. fi
  75. ])dnl
  76. dnl
  77. define(AC_MINUS_C_MINUS_O,
  78. [AC_CHECKING(whether $CC and cc understand -c and -o together)
  79. /bin/echo 'foo(){}' > conftest.c
  80. # Make sure it works both with $CC and with simple cc.
  81. # We do the test twice because some compilers refuse to overwrite an
  82. # existing .o file with -o, though they will create one.
  83. if ${CC-cc} -c conftest.c -o conftest.o >/dev/null 2>&1 \
  84.  && test -f conftest.o && ${CC-cc} -c conftest.c -o conftest.o >/dev/null 2>&1
  85. then
  86.   # Test first that cc exists at all.
  87.   if cc -c conftest.c >/dev/null 2>&1
  88.   then
  89.     if cc -c conftest.c -o conftest2.o >/dev/null 2>&1 && \
  90.        test -f conftest2.o && cc -c conftest.c -o conftest2.o >/dev/null 2>&1
  91.     then
  92.       :
  93.     else
  94.       AC_DEFINE(NO_MINUS_C_MINUS_O)
  95.     fi
  96.   fi
  97. else
  98.   AC_DEFINE(NO_MINUS_C_MINUS_O)
  99. fi
  100. rm -rf conftest*
  101. ])dnl
  102. dnl
  103. dnl Define SET_MAKE to set ${MAKE} if make doesn't.
  104. define(AC_SET_MAKE,
  105. [cat > conftestmake <<'EOF'
  106. all:
  107.     @/bin/echo 'ac_maketemp="${MAKE}"'
  108. EOF
  109. changequote(,)dnl
  110. # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
  111. eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
  112. changequote([,])dnl
  113. if test -n "$ac_maketemp"; then SET_MAKE=
  114. else SET_MAKE="MAKE=${MAKE-make}"; fi
  115. rm -f conftestmake
  116. AC_SUBST([SET_MAKE])dnl
  117. ])dnl
  118. dnl
  119. define(AC_PROG_RANLIB, [AC_PROGRAM_CHECK(RANLIB, ranlib, ranlib, :)])dnl
  120. dnl
  121. define(AC_PROG_AWK, [AC_PROGRAMS_CHECK(AWK, mawk gawk nawk awk,)])dnl
  122. dnl
  123. define(AC_PROG_YACC,[AC_PROGRAMS_CHECK(YACC, 'bison -y' byacc, yacc)])dnl
  124. dnl
  125. define(AC_PROG_CPP,
  126. [AC_PROVIDE([$0])AC_CHECKING(how to run the C preprocessor)
  127. if test -z "$CPP"; then
  128.   # This must be in double quotes, not single quotes, because CPP may get
  129.   # substituted into the Makefile and ``${CC-cc}'' will simply confuse
  130.   # make.  It must be expanded now.
  131.   CPP="${CC-cc} -E"
  132. dnl On the NeXT, cc -E runs the code through the compiler's parser,
  133. dnl not just through cpp.
  134.   AC_TEST_CPP([#include <stdio.h>
  135. Syntax Error], ,
  136.   CPP="${CC-cc} -E -traditional-cpp"
  137.   AC_TEST_CPP([#include <stdio.h>
  138. Syntax Error], ,CPP=/lib/cpp))
  139. fi
  140. AC_VERBOSE(setting CPP to $CPP)
  141. AC_SUBST(CPP)dnl
  142. ])dnl
  143. dnl
  144. define(AC_PROG_CXXCPP,
  145. [AC_PROVIDE([$0])AC_CHECKING(how to run the C++ preprocessor)
  146. AC_LANG_SAVE[]dnl
  147. AC_LANG_CPLUSPLUS[]dnl
  148. if test -z "$CXXCPP"; then
  149.   CXXCPP="${CXX-c++} -E"
  150.   AC_TEST_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp)
  151. fi
  152. AC_VERBOSE(setting CXXCPP to $CXXCPP)
  153. AC_LANG_RESTORE[]dnl
  154. AC_SUBST(CXXCPP)dnl
  155. ])dnl
  156. dnl
  157. dnl Require finding the C or C++ preprocessor, whichever is the
  158. dnl current language.
  159. define(AC_REQUIRE_CPP,
  160. [ifelse(AC_LANG,C,[AC_REQUIRE([AC_PROG_CPP])],[AC_REQUIRE([AC_PROG_CXXCPP])])])dnl
  161. dnl
  162. define(AC_PROG_LEX,
  163. [AC_PROVIDE([$0])AC_PROGRAM_CHECK(LEX, flex, flex, lex)
  164. if test -z "$LEXLIB"
  165. then
  166.   case "$LEX" in
  167.   flex*) AC_HAVE_LIBRARY(fl, LEXLIB="-lfl") ;;
  168.   *) LEXLIB="-ll" ;;
  169.   esac
  170. fi
  171. AC_VERBOSE(setting LEXLIB to $LEXLIB)
  172. AC_SUBST(LEXLIB)])dnl
  173. dnl
  174. define(AC_YYTEXT_POINTER,[dnl
  175. AC_REQUIRE_CPP()AC_REQUIRE([AC_PROG_LEX])dnl
  176. AC_CHECKING(for yytext declaration)
  177. # POSIX says lex can declare yytext either as a pointer or an array; the
  178. # default is implementation-dependent. Figure out which it is, since
  179. # not all implementations provide the %pointer and %array declarations.
  180. #
  181. # The minimal lex program is just a single line: %%.  But some broken lexes
  182. # (Solaris, I think it was) want two %% lines, so accommodate them.
  183.   /bin/echo '%%
  184. %%' | ${LEX}
  185. if test -f lex.yy.c; then
  186.   LEX_OUTPUT_ROOT=lex.yy
  187. elif test -f lexyy.c; then
  188.   LEX_OUTPUT_ROOT=lexyy
  189. else
  190.   # Don't know what to do here.
  191.   AC_ERROR(cannot find output from $LEX, giving up on yytext declaration)
  192.   LEX_OUTPUT_ROOT=
  193. fi
  194. if test -n "$LEX_OUTPUT_ROOT"; then
  195.   /bin/echo 'extern char *yytext; main () { exit (0); }' >>$LEX_OUTPUT_ROOT.c
  196.   ac_save_LIBS="$LIBS"
  197.   LIBS="$LIBS $LEXLIB"
  198.   AC_TEST_PROGRAM(`cat $LEX_OUTPUT_ROOT.c`, AC_DEFINE(YYTEXT_POINTER))
  199.   LIBS="$ac_save_LIBS"
  200.   rm -f "${LEX_OUTPUT_ROOT}.c"
  201. fi
  202. AC_SUBST(LEX_OUTPUT_ROOT)dnl
  203. ])dnl
  204. dnl
  205. define(AC_PROG_INSTALL,
  206. [# Make sure to not get the incompatible SysV /etc/install and
  207. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  208. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  209. # or the AFS install, which mishandles nonexistent args, or
  210. # /usr/ucb/install on SVR4, which tries to use the nonexistent group
  211. # `staff', or /sbin/install on IRIX which has incompatible command-line
  212. # syntax.  Sigh.
  213. #
  214. #     On most BSDish systems install is in /usr/bin, not /usr/ucb
  215. #     anyway.
  216. # This turns out not to be true, so the mere pathname isn't an indication
  217. # of whether the program works.  What we really need is a set of tests for
  218. # the install program to see if it actually works in all the required ways.
  219. #
  220. # Avoid using ./install, which might have been erroneously created
  221. # by make from ./install.sh.
  222. if test -z "${INSTALL}"; then
  223.   AC_CHECKING(for a BSD compatible install)
  224.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  225.   for ac_dir in $PATH; do
  226.     case "$ac_dir" in
  227.     ''|.|/gnu/etc) ;;
  228.     *)
  229.       # OSF1 and SCO ODT 3.0 have their own names for install.
  230.       for ac_prog in installbsd scoinst install; do
  231.         if test -f $ac_dir/$ac_prog; then
  232.       if test $ac_prog = install &&
  233.             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
  234.         # AIX install.  It has an incompatible calling convention.
  235.         # OSF/1 installbsd also uses dspmsg, but is usable.
  236.         :
  237.       else
  238.         INSTALL="$ac_dir/$ac_prog -c"
  239.         break 2
  240.       fi
  241.     fi
  242.       done
  243.       ;;
  244.     esac
  245.   done
  246.   IFS="$ac_save_ifs"
  247. fi
  248.  
  249. if test -z "$INSTALL"; then
  250.   # As a last resort, use the slow shell script.
  251.   for ac_dir in ${srcdir} ${srcdir}/.. ${srcdir}/../..; do
  252.     if test -f $ac_dir/install.sh; then
  253.       INSTALL="$ac_dir/install.sh -c"; break
  254.     fi
  255.   done
  256. fi
  257. if test -z "$INSTALL"; then
  258.   AC_ERROR([can not find install.sh in ${srcdir} or ${srcdir}/.. or ${srcdir}/../..])
  259. fi
  260. AC