home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / lib / autoconf / acspecific.m4 < prev    next >
M4 Source File  |  1994-12-22  |  59KB  |  1,971 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 As a special exception, the Free Software Foundation gives unlimited
  20. dnl permission to copy, distribute and modify the configure scripts that
  21. dnl are the output of Autoconf.  You need not follow the terms of the GNU
  22. dnl General Public License when using or distributing such scripts, even
  23. dnl though portions of the text of Autoconf appear in them.  The GNU
  24. dnl General Public License (GPL) does govern all other use of the material
  25. dnl that constitutes the Autoconf program.
  26. dnl
  27. dnl Certain portions of the Autoconf source text are designed to be copied
  28. dnl (in certain cases, depending on the input) into the output of
  29. dnl Autoconf.  We call these the "data" portions.  The rest of the Autoconf
  30. dnl source text consists of comments plus executable code that decides which
  31. dnl of the data portions to output in any given case.  We call these
  32. dnl comments and executable code the "non-data" portions.  Autoconf never
  33. dnl copies any of the non-data portions into its output.
  34. dnl
  35. dnl This special exception to the GPL applies to versions of Autoconf
  36. dnl released by the Free Software Foundation.  When you make and
  37. dnl distribute a modified version of Autoconf, you may extend this special
  38. dnl exception to the GPL to apply to your modified version as well, *unless*
  39. dnl your modified version has the potential to copy into its output some
  40. dnl of the text that was the non-data portion of the version that you started
  41. dnl with.  (In other words, unless your change moves or copies text from
  42. dnl the non-data portions to the data portions.)  If your modification has
  43. dnl such potential, you must delete any notice of this special exception
  44. dnl to the GPL from your modified version.
  45. dnl
  46. dnl Written by David MacKenzie, with help from
  47. dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
  48. dnl Roland McGrath, Noah Friedman, david d zuhn, and many others.
  49.  
  50.  
  51. dnl ### Checks for programs
  52.  
  53.  
  54. dnl Check whether to use -n, \c, or newline-tab to separate
  55. dnl checking messages from result messages.
  56. dnl Idea borrowed from dist 3.0.
  57. dnl Internal use only.
  58. AC_DEFUN(AC_PROG_ECHO_N,
  59. [if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  60.   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
  61.   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
  62.     ac_n= ac_c='
  63. ' ac_t='    '
  64.   else
  65.     ac_n=-n ac_c= ac_t=
  66.   fi
  67. else
  68.   ac_n= ac_c='\c' ac_t=
  69. fi
  70. ])
  71.  
  72. AC_DEFUN(AC_PROG_CC,
  73. [AC_BEFORE([$0], [AC_PROG_CPP])dnl
  74. AC_CHECK_PROG(CC, gcc, gcc, cc)
  75.  
  76. AC_MSG_CHECKING(whether we are using GNU C)
  77. AC_CACHE_VAL(ac_cv_prog_gcc,
  78. [dnl The semicolon is to pacify NeXT's syntax-checking cpp.
  79. cat > conftest.c <<EOF
  80. #ifdef __GNUC__
  81.   yes;
  82. #endif
  83. EOF
  84. if ${CC-cc} -E conftest.c 2>&AC_FD_CC | egrep yes >/dev/null 2>&1; then
  85.   ac_cv_prog_gcc=yes
  86. else
  87.   ac_cv_prog_gcc=no
  88. fi])dnl
  89. AC_MSG_RESULT($ac_cv_prog_gcc)
  90. if test $ac_cv_prog_gcc = yes; then
  91.   GCC=yes
  92.   if test "${CFLAGS+set}" != set; then
  93.     AC_MSG_CHECKING(whether ${CC-cc} accepts -g)
  94. AC_CACHE_VAL(ac_cv_prog_gcc_g,
  95. [echo 'void f(){}' > conftest.c
  96. if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
  97.   ac_cv_prog_gcc_g=yes
  98. else
  99.   ac_cv_prog_gcc_g=no
  100. fi
  101. rm -f conftest*
  102. ])dnl
  103.     AC_MSG_RESULT($ac_cv_prog_gcc_g)
  104.     if test $ac_cv_prog_gcc_g = yes; then
  105.       # Amiga hack - suppress automatically using -g for now
  106.       # Also default to using -O2
  107.       CFLAGS="-O2"
  108.     else
  109.       CFLAGS="-O2"
  110.     fi
  111.   fi
  112. else
  113.   GCC=
  114.   test "${CFLAGS+set}" = set || CFLAGS="-g"
  115. fi
  116. ])
  117.  
  118. AC_DEFUN(AC_PROG_CXX,
  119. [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
  120. AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx, gcc)
  121.  
  122. AC_MSG_CHECKING(whether we are using GNU C++)
  123. AC_CACHE_VAL(ac_cv_prog_gxx,
  124. [dnl The semicolon is to pacify NeXT's syntax-checking cpp.
  125. cat > conftest.C <<EOF
  126. #ifdef __GNUC__
  127.   yes;
  128. #endif
  129. EOF
  130. if ${CXX-g++} -E conftest.C 2>&AC_FD_CC | egrep yes >/dev/null 2>&1; then
  131.   ac_cv_prog_gxx=yes
  132. else
  133.   ac_cv_prog_gxx=no
  134. fi])dnl
  135. AC_MSG_RESULT($ac_cv_prog_gxx)
  136. if test $ac_cv_prog_gxx = yes; then
  137.   GXX=yes
  138.   if test "${CXXFLAGS+set}" != set; then
  139.     AC_MSG_CHECKING(whether ${CXX-g++} accepts -g)
  140. AC_CACHE_VAL(ac_cv_prog_gxx_g,
  141. [echo 'void f(){}' > conftest.cc
  142. if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
  143.   ac_cv_prog_gxx_g=yes
  144. else
  145.   ac_cv_prog_gxx_g=no
  146. fi
  147. rm -f conftest*
  148. ])dnl
  149.     AC_MSG_RESULT($ac_cv_prog_gxx_g)
  150.     if test $ac_cv_prog_gxx_g = yes; then
  151.       # Amiga hack - suppress automatically using -g for now
  152.       # Also default to using -O2
  153.       CXXFLAGS="-O2"
  154.     else
  155.       CXXFLAGS="-O2"
  156.     fi
  157.   fi
  158. else
  159.   GXX=
  160.   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
  161. fi
  162. ])
  163.  
  164. AC_DEFUN(AC_PROG_GCC_TRADITIONAL,
  165. [AC_REQUIRE([AC_PROG_CC])dnl
  166. AC_REQUIRE([AC_PROG_CPP])dnl
  167. if test $ac_cv_prog_gcc = yes; then
  168.   AC_MSG_CHECKING(whether ${CC-cc} needs -traditional)
  169. AC_CACHE_VAL(ac_cv_prog_gcc_traditional,
  170. [  ac_pattern="Autoconf.*'x'"
  171.   AC_EGREP_CPP($ac_pattern, [#include <sgtty.h>
  172. Autoconf TIOCGETP],
  173.   ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no)
  174.  
  175.   if test $ac_cv_prog_gcc_traditional = no; then
  176.     AC_EGREP_CPP($ac_pattern, [#include <termio.h>
  177. Autoconf TCGETA],
  178.     ac_cv_prog_gcc_traditional=yes)
  179.   fi])dnl
  180.   AC_MSG_RESULT($ac_cv_prog_gcc_traditional)
  181.   if test $ac_cv_prog_gcc_traditional = yes; then
  182.     CC="$CC -traditional"
  183.   fi
  184. fi
  185. ])
  186.  
  187. AC_DEFUN(AC_PROG_CC_C_O,
  188. [if test "x$CC" != xcc; then
  189.   AC_MSG_CHECKING(whether $CC and cc understand -c and -o together)
  190. else
  191.   AC_MSG_CHECKING(whether cc understands -c and -o together)
  192. fi
  193. set dummy $CC; ac_cc=[$]2
  194. AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,
  195. [eval ac_cv_prog_cc_${ac_cc}_c_o=no
  196. echo 'foo(){}' > conftest.c
  197. # Make sure it works both with $CC and with simple cc.
  198. # We do the test twice because some compilers refuse to overwrite an
  199. # existing .o file with -o, though they will create one.
  200. if ${CC-cc} -c conftest.c -o conftest.o 1>&AC_FD_CC 2>&AC_FD_CC &&
  201.   test -f conftest.o && ${CC-cc} -c conftest.c -o conftest.o 1>&AC_FD_CC 2>&AC_FD_CC
  202. then
  203.   if test "x$CC" != xcc; then
  204.     # Test first that cc exists at all.
  205.     if cc -c conftest.c 1>&AC_FD_CC 2>&AC_FD_CC
  206.     then
  207.       if cc -c conftest.c -o conftest2.o 1>&AC_FD_CC 2>&AC_FD_CC &&
  208.         test -f conftest2.o && cc -c conftest.c -o conftest2.o 1>&AC_FD_CC 2>&AC_FD_CC
  209.       then
  210.         eval ac_cv_prog_cc_${ac_cc}_c_o=yes
  211.       fi
  212.     fi
  213.   fi
  214. fi
  215. rm -f conftest*
  216. ])dnl
  217. if eval "test \"`/bin/echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then
  218.   AC_MSG_RESULT(yes)
  219. else
  220.   AC_MSG_RESULT(no)
  221.   AC_DEFINE(NO_MINUS_C_MINUS_O)
  222. fi
  223. ])
  224.  
  225. dnl Define SET_MAKE to set ${MAKE} if make doesn't.
  226. AC_DEFUN(AC_PROG_MAKE_SET,
  227. [AC_MSG_CHECKING(whether ${MAKE-make} sets \$MAKE)
  228. set dummy ${MAKE-make}; ac_make=[$]2
  229. AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,
  230. [cat > conftestmake <<\EOF
  231. all:
  232.     @/bin/echo 'ac_maketemp="${MAKE}"'
  233. EOF
  234. changequote(, )dnl
  235. # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
  236. eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
  237. changequote([, ])dnl
  238. if test -n "$ac_maketemp"; then
  239.   eval ac_cv_prog_make_${ac_make}_set=yes
  240. else
  241.   eval ac_cv_prog_make_${ac_make}_set=no
  242. fi
  243. rm -f conftestmake])dnl
  244. if eval "test \"`/bin/echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
  245.   AC_MSG_RESULT(yes)
  246.   SET_MAKE=
  247. else
  248.   AC_MSG_RESULT(no)
  249.   SET_MAKE="MAKE=${MAKE-make}"
  250. fi
  251. AC_SUBST([SET_MAKE])dnl
  252. ])
  253.  
  254. AC_DEFUN(AC_PROG_RANLIB,
  255. [AC_CHECK_PROG(RANLIB, ranlib, ranlib, :)])
  256.  
  257. dnl Check for mawk first since it's