home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / CLISP / CLISPSRC.TAR / clisp-1995-01-01 / src / autoconf-1.7 / acgeneral.m4 next >
Encoding:
M4 Source File  |  1994-12-14  |  24.8 KB  |  856 lines

  1. dnl Parameterized macros that do not check for something specific.
  2. dnl This file is part of Autoconf.
  3. dnl Copyright (C) 1992, 1993 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 Changed by Bruno Haible, 14 December 1994
  24. dnl
  25. changequote([,])dnl
  26. undefine([eval])dnl
  27. undefine([include])dnl
  28. undefine([shift])dnl
  29. undefine([format])dnl
  30. dnl
  31. ifdef([__gnu__], , [errprint(Autoconf requires GNU m4
  32. )exit(1)])dnl
  33. dnl
  34. dnl
  35. dnl Utility functions for stamping the configure script.
  36. dnl
  37. dnl
  38. define(AC_ACVERSION, 1.7)dnl
  39. dnl This is defined by the --version option of the autoconf script.
  40. ifdef([AC_PRINT_VERSION], [errprint(Autoconf version AC_ACVERSION
  41. )])dnl
  42. dnl
  43. dnl These are currently not used, for the sake of people who diff
  44. dnl configure scripts and don't want spurious differences.
  45. dnl But they are too clever to just delete.
  46. dnl
  47. define(AC_USER, [esyscmd(
  48. changequote({,})dnl
  49. # Extract the user name from the first pair of parentheses.
  50. ({sedcmd='s/[^(]*(\([^)]*\)).*/\1/';}
  51. changequote([,])dnl
  52. whoami || id|sed "$sedcmd") 2>/dev/null|tr -d '\012')])dnl
  53. dnl
  54. define(AC_HOST, [esyscmd((hostname || uname -n) 2>/dev/null|tr -d '\012')])dnl
  55. dnl
  56. define(AC_DATE, [esyscmd(date|tr -d '\012')])dnl
  57. dnl
  58. dnl
  59. dnl Controlling Autoconf operation
  60. dnl
  61. dnl
  62. dnl This is separate from AC_INIT to prevent GNU m4 1.0 from coredumping
  63. dnl when AC_CONFIG_HEADER is used.
  64. define(AC_NOTICE,
  65. [# Guess values for system-dependent variables and create Makefiles.
  66. # Generated automatically using autoconf.
  67. dnl [#] Generated automatically using autoconf version AC_ACVERSION
  68. dnl [#] by AC_USER@AC_HOST on AC_DATE
  69. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  70.  
  71. # This program is free software; you can redistribute it and/or modify
  72. # it under the terms of the GNU General Public License as published by
  73. # the Free Software Foundation; either version 2, or (at your option)
  74. # any later version.
  75.  
  76. # This program is distributed in the hope that it will be useful,
  77. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  78. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  79. # GNU General Public License for more details.
  80.  
  81. # You should have received a copy of the GNU General Public License
  82. # along with this program; if not, write to the Free Software
  83. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  84.  
  85. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp]
  86. #        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE[=VALUE]]
  87. # Ignores all args except --srcdir, --prefix, --exec-prefix, and
  88. # --with-PACKAGE[=VALUE] unless this script has special code to handle it.
  89. ])dnl
  90. dnl
  91. define(AC_PARSEARGS,
  92. [for arg
  93. do
  94.   # Handle --exec-prefix with a space before the argument.
  95.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  96.   # Handle --host with a space before the argument.
  97.   elif test x$next_host = xyes; then next_host=
  98.   # Handle --prefix with a space before the argument.
  99.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  100.   # Handle --srcdir with a space before the argument.
  101.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  102.   else
  103.     case $arg in
  104.      # For backward compatibility, recognize -exec-prefix and --exec_prefix.
  105.      -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
  106. changequote(,)dnl
  107.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  108. changequote([,])dnl
  109.      -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  110.     next_exec_prefix=yes ;;
  111.  
  112.      -gas | --gas | --ga | --g) ;;
  113.  
  114.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  115.      -host | --host | --hos | --ho | --h)
  116.     next_host=yes ;;
  117.  
  118.      -nfp | --nfp | --nf) ;;
  119.  
  120.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  121. changequote(,)dnl
  122.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  123. changequote([,])dnl
  124.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  125.     next_prefix=yes ;;
  126.  
  127.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  128. changequote(,)dnl
  129.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  130. changequote([,])dnl
  131.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  132.     next_srcdir=yes ;;
  133.  
  134.      -with-* | --with-*)
  135.        package=`echo $arg|sed -e 's/-*with-//' -e 's/=.*//'`
  136.        # Reject names that aren't valid shell variable names.
  137. changequote(,)dnl
  138.        if test -n "`echo $package| sed 's/[-a-zA-Z0-9_]//g'`"; then
  139. changequote([,])dnl
  140.          echo "configure: $package: invalid package name" >&2; exit 1
  141.        fi
  142.        package=`echo $package| sed 's/-/_/g'`
  143.        case "$arg" in
  144. changequote(,)dnl
  145.          *=*) val="`echo $arg|sed 's/[^=]*=//'`" ;;
  146. changequote([,])dnl
  147.          *) val=1 ;;
  148.        esac
  149.        eval "with_$package='$val'" ;;
  150.  
  151.      -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
  152.        verbose=yes ;;
  153.  
  154.      *) ;;
  155.     esac
  156.   fi
  157. done
  158. ])dnl
  159. dnl
  160. define(AC_INIT,
  161. [#!/bin/sh
  162. AC_NOTICE
  163. AC_PARSEARGS
  164. AC_PREPARE($1)])dnl
  165. dnl
  166. define(AC_PREPARE,
  167. [trap 'rm -fr conftest* confdefs* core; exit 1' 1 3 15
  168. trap 'rm -f confdefs*' 0
  169.  
  170. # NLS nuisances.
  171. # These must not be set unconditionally because not all systems understand
  172. # e.g. LANG=C (notably SCO).
  173. if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi
  174. if test "${LANG+set}"   = 'set' ; then LANG=C;   export LANG;   fi
  175.  
  176. if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  177.   if (echo -n testing; echo 1,2,3) | grep -e -n > /dev/null; then
  178.     ac_n= ac_c='
  179. ' ac_t='    ' ac_tt=
  180.   else
  181.     ac_n=-n ac_c= ac_t= ac_tt='
  182.      '
  183.   fi
  184. else
  185.   ac_n= ac_c='\c' ac_t= ac_tt='
  186.      '
  187. fi
  188.  
  189. rm -fr conftest* confdefs.h core
  190. # AIX cpp loses on an empty file, so make sure it contains at least a newline.
  191. echo > confdefs.h
  192. compile='${CC-cc} $CFLAGS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  193.  
  194. # A filename unique to this package, relative to the directory that
  195. # configure is in, which we can look for to find out if srcdir is correct.
  196. unique_file=$1
  197.  
  198. # Find the source files, if location was not specified.
  199. if test -z "$srcdir"; then
  200.   srcdirdefaulted=yes
  201.   # Try the directory containing this script, then `..'.
  202.   prog=[$]0
  203. changequote(,)dnl
  204.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  205. changequote([,])dnl
  206.   test "X$confdir" = "X$prog" && confdir=.
  207.   srcdir=$confdir
  208.   if test ! -r $srcdir/$unique_file; then
  209.     srcdir=..
  210.   fi
  211. fi
  212. if test ! -r $srcdir/$unique_file; then
  213.   if test x$srcdirdefaulted = xyes; then
  214.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  215.   else
  216.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  217.   fi
  218.   exit 1
  219. fi
  220. dnl # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  221. dnl # But we can't avoid them for `..', to make subdirectories work.
  222. dnl case $srcdir in
  223. dnl   .|/*|~*) ;;
  224. dnl   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  225. dnl esac
  226.  
  227. # Save the original args to write them into config.status later.
  228. configure_args="[$]*"
  229. ])dnl
  230. dnl
  231. define(AC_MSG_CHECKING,
  232. [echo $ac_n "checking $1""... $ac_c"])dnl
  233. dnl
  234. define(AC_MSG_RESULT,
  235. [echo "${ac_t}$1"])dnl
  236. dnl
  237. define(AC_MSG_RESULTPROTO,
  238. [ac_proto=`echo "$1" | tr -s ' ' | [sed -e 's/( /(/g']`
  239. AC_MSG_RESULT(${ac_tt}${ac_proto})])dnl
  240. dnl
  241. dnl Protects the argument from being diverted twice
  242. dnl if this macro is called twice for it.
  243. dnl Diversion 0 is the normal output.
  244. dnl Diversion 1 is sed substitutions for output files.
  245. dnl Diversion 2 is variable assignments for config.status.
  246. define(AC_SUBST,
  247. [ifdef([AC_SUBST_$1], ,
  248. [define([AC_SUBST_$1], )dnl
  249. divert(1)dnl
  250. s%@$1@%[$]$1%g
  251. divert(2)dnl
  252. $1='[$]$1'
  253. divert(0)dnl
  254. ])])dnl
  255. dnl
  256. define(AC_WITH,
  257. [[#] check whether --with-$1 was given
  258. withval="[$with_]patsubst($1,-,_)"
  259. if test -n "$withval"; then
  260.   ifelse([$2], , :, [$2])
  261. ifelse([$3], , , [else
  262.   $3
  263. ])dnl
  264. fi
  265. ])dnl
  266. dnl
  267. dnl Guess the value for the `prefix' variable by looking for
  268. dnl the argument program along PATH and taking its parent.
  269. dnl Example: if the argument is `gcc' and we find /usr/local/gnu/bin/gcc,
  270. dnl set `prefix' to /usr/local/gnu.
  271. define(AC_PREFIX,
  272. [if test -z "$prefix"
  273. then
  274.   AC_MSG_CHECKING(for $1 to derive installation directory prefix)
  275.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="$IFS:"
  276.   for dir in $PATH; do
  277.     test -z "$dir" && dir=.
  278.     if test $dir != . && test -f $dir/$1; then
  279. changequote(,)dnl
  280.       # Not all systems have dirname.
  281.       prefix=`echo $dir|sed 's%/[^/][^/]*$%%'`
  282. changequote([,])dnl
  283.       break
  284.     fi
  285.   done
  286.   IFS="$saveifs"
  287.   AC_MSG_RESULT(chose installation directory prefix ${prefix})
  288. fi
  289. ])dnl
  290. dnl
  291. define(AC_CONFIG_HEADER, [define(AC_CONFIG_NAMES, $1)])dnl
  292. dnl
  293. define(AC_DOREV, [#!/bin/sh
  294. # From configure.in $1
  295. ])dnl
  296. define(AC_REVISION, [AC_DOREV(translit($1,$"))])dnl
  297. dnl
  298. dnl
  299. dnl Several simple subroutines to do various flavors of quoting.
  300. dnl
  301. dnl Quote $1 against shell "s.
  302. define(AC_QUOTE_DQUOTE, [dnl We use \1 instead of \& to avoid an m4 1.0.3 bug.
  303. patsubst($1, changequote(,)\([$"`\\]\)changequote([,]), \\\1)])dnl
  304. dnl
  305. dnl Quote $1 against shell 's.
  306. define(AC_QUOTE_SQUOTE, [patsubst($1, ', '\\'')])dnl
  307. dnl
  308. dnl Quote $1 against shell here documents (<<EOF).
  309. define(AC_QUOTE_HERE, [changequote({,})dnl
  310. dnl We use \1 instead of \& to avoid an m4 1.0.3 bug.
  311. patsubst(patsubst($1, \(\\[$`\\]\), \\\1), \([$`]\), \\\1){}dnl
  312. changequote([,])])dnl
  313. dnl
  314. dnl Quote $1 against the right hand side of a sed substitution.
  315. define(AC_QUOTE_SED, [changequote({,})dnl
  316. dnl We use \1 instead of \& to avoid an m4 1.0.3 bug.
  317. dnl % and @ are commonly used as the sed s separator character.
  318. patsubst($1, \([&\\%@]\), \\\1){}dnl
  319. changequote([,])])dnl
  320. dnl
  321. dnl Quote $1 against tokenization.
  322. define(AC_QUOTE_TOKEN, [changequote({,})dnl
  323. patsubst($1, \([     ]\), \\\1){}dnl
  324. changequote([,])])dnl
  325. dnl
  326. dnl Subroutines of AC_DEFINE.  Does more quoting magic than any sane person
  327. dnl should be able to understand.  The point of it all is that what goes into
  328. dnl Makefile et al should be verbatim what was written in configure.in.
  329. define(AC_DEFINE_QUOTE, [dnl
  330. AC_QUOTE_TOKEN(AC_QUOTE_SQUOTE(AC_QUOTE_DQUOTE($1)))])dnl
  331. dnl
  332. define(AC_DEFINE_SEDQUOTE, [dnl
  333. AC_QUOTE_DQUOTE(AC_QUOTE_HERE(AC_QUOTE_HERE(AC_QUOTE_SED($1))))])dnl
  334. dnl
  335. dnl Don't compare $2 to a blank, so we can support "-Dfoo=".
  336. dnl If creating a configuration header file, we add
  337. dnl commands to SEDDEFS to define the variable.  SED[duef][ABCD]
  338. dnl get defined in config.status.  Here we just insert the
  339. dnl variable parts of the string: the variable name to define
  340. dnl and the value to give it.
  341. define(AC_DEFINE,[dnl
  342. dnl Uniformly use AC_DEFINE_[SED]QUOTE, so callers of AC_DEFINE_UNQUOTED
  343. dnl can use AC_QUOTE_* manually if they want to.
  344. ifelse($#, 2, [define([AC_VAL], $2)], [define([AC_VAL], 1)])dnl
  345. echo "[#][define]" $1 "AC_QUOTE_DQUOTE(AC_VAL)" >> confdefs.h
  346. dnl Define DEFS even if AC_CONFIG_NAMES for use in user case statements.
  347. DEFS="$DEFS -D$1=AC_QUOTE_DQUOTE(AC_VAL)"
  348. ifdef([AC_CONFIG_NAMES],
  349. SEDDEFS="dnl
  350. ${SEDDEFS}\${SEDdA}$1\${SEDdB}$1\${SEDdC}AC_DEFINE_SEDQUOTE(AC_VAL)\${SEDdD}
  351. \${SEDuA}$1\${SEDuB}$1\${SEDuC}AC_DEFINE_SEDQUOTE(AC_VAL)\${SEDuD}
  352. \${SEDeA}$1\${SEDeB}$1\${SEDeC}AC_DEFINE_SEDQUOTE(AC_VAL)\${SEDeD}
  353. \${SEDfA}$1\${SEDfB}$1\${SEDfC}AC_DEFINE_SEDQUOTE(AC_VAL)\${SEDfD}
  354. ")])dnl
  355. dnl
  356. dnl Unsafe version of AC_DEFINE.
  357. dnl Users are responsible for the quoting nightmare.
  358. dnl Well, not all of it.  We need to pull the identify function out to
  359. dnl the top level, because m4 doesn't really support nested functions;
  360. dnl it doesn't distinguish between the arguments to the outer
  361. dnl function, which should be expanded, and the arguments to the inner
  362. dnl function, which shouldn't yet.
  363. define(AC_IDENTITY,$1)dnl
  364. define(AC_DEFINE_UNQUOTED,[dnl
  365. pushdef([AC_QUOTE_DQUOTE],defn([AC_IDENTITY]))dnl
  366. pushdef([AC_DEFINE_SEDQUOTE],defn([AC_IDENTITY]))dnl
  367. AC_DEFINE($1,$2)dnl
  368. popdef([AC_DEFINE_SEDQUOTE])dnl
  369. popdef([AC_QUOTE_DQUOTE])dnl
  370. ])dnl
  371. dnl
  372. define(AC_BEFORE,
  373. [ifdef([AC_PROVIDE_$2], [errprint(__file__:__line__: [$2 was called before $1
  374. ])])])dnl
  375. dnl
  376. define(AC_REQUIRE,
  377. [ifdef([AC_PROVIDE_$1],,[indir([$1])
  378. ])])dnl
  379. dnl
  380. define(AC_PROVIDE,
  381. [define([AC_PROVIDE_$1],)])dnl
  382. dnl
  383. define(AC_OBSOLETE,
  384. [errprint(__file__:__line__: warning: [$1] is obsolete[$2]
  385. )])dnl
  386. dnl
  387. dnl
  388. dnl Checks for kinds of features
  389. dnl
  390. dnl
  391. define(AC_PROGRAM_CHECK,
  392. [if test -z "[$]$1"; then
  393.   # Extract the first word of `$2', so it can be a program name with args.
  394.   set dummy $2; word=[$]2
  395.   AC_MSG_CHECKING(for $word)
  396.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  397.   for dir in $PATH; do
  398.     test -z "$dir" && dir=.
  399.     if test -f $dir/$word; then
  400.       $1="$3"
  401.       break
  402.     fi
  403.   done
  404.   IFS="$saveifs"
  405. ifelse([$4],,, [  test -z "[$]$1" && $1="$4"
  406. ])dnl
  407.   AC_MSG_RESULT(using [$]$1)
  408. fi
  409. AC_SUBST($1)dnl
  410. ])dnl
  411. dnl
  412. define(AC_PROGRAMS_CHECK,
  413. [for p in $2
  414. do
  415. AC_PROGRAM_CHECK($1, [$]p, [$]p, )
  416. test -n "[$]$1" && break
  417. done
  418. ifelse([$3],,, [test -n "[$]$1" || $1="$3"
  419. ])])dnl
  420. dnl
  421. define(AC_HEADER_EGREP,
  422. [AC_REQUIRE([AC_PROG_CPP])AC_PROVIDE([$0])echo '#include "confdefs.h"
  423. #include <$2>' > conftest.c
  424. eval "$CPP conftest.c > conftest.out 2>&1"
  425. if egrep "$1" conftest.out >/dev/null 2>&1; then
  426.   ifelse([$3], , :, [$3])
  427. ifelse([$4], , , [else
  428.   $4
  429. ])dnl
  430. fi
  431. rm -f conftest*
  432. ])dnl
  433. dnl
  434. dnl Because this macro is used by AC_GCC_TRADITIONAL, which must come early,
  435. dnl it is not included in AC_BEFORE checks.
  436. define(AC_PROGRAM_EGREP,
  437. [AC_REQUIRE([AC_PROG_CPP])AC_PROVIDE([$0])cat > conftest.c <<EOF
  438. #include "confdefs.h"
  439. [$2]
  440. EOF
  441. eval "$CPP conftest.c > conftest.out 2>&1"
  442. if egrep "$1" conftest.out >/dev/null 2>&1; then
  443.   ifelse([$3], , :, [$3])
  444. ifelse([$4], , , [else
  445.   $4
  446. ])dnl
  447. fi
  448. rm -f conftest*
  449. ])dnl
  450. dnl
  451. define(AC_HEADER_CHECK,
  452. [AC_MSG_CHECKING([for $1])
  453. AC_TEST_CPP([#include <$1>], [AC_MSG_RESULT(yes)
  454. $2], [AC_MSG_RESULT(no)
  455. $3])
  456. ])dnl
  457. dnl
  458. define(AC_COMPILE_CHECK,
  459. [AC_PROVIDE([$0])dnl
  460. ifelse([$1], , , [AC_MSG_CHECKING(for $1)]
  461. )dnl
  462. cat > conftest.c <<EOF
  463. #include "confdefs.h"
  464. [$2]
  465. int main() { exit(0); }
  466. int t() { [$3] }
  467. EOF
  468. dnl Don't try to run the program, which would prevent cross-configuring.
  469. if eval $compile; then
  470. ifelse([$1], , , [  AC_MSG_RESULT(yes)
  471. ])dnl
  472.   ifelse([$4], , :, [$4])
  473. else
  474. ifelse([$1], , , [  AC_MSG_RESULT(no)
  475. ])dnl
  476.   ifelse([$5], , :, [$5])
  477. fi
  478. rm -f conftest*]
  479. )dnl
  480. dnl
  481. define(AC_TEST_PROGRAM,
  482. [AC_PROVIDE([$0])ifelse([$4], , , [AC_REQUIRE([AC_CROSS_CHECK])if test -n "$cross_compiling"
  483. then
  484.   $4
  485. else
  486. ])dnl
  487. cat > conftest.c <<EOF
  488. #include "confdefs.h"
  489. [$1]
  490. EOF
  491. eval $compile
  492. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  493.   ifelse([$2], , :, [$2])
  494. ifelse([$3], , , [else
  495.   $3
  496. ])dnl
  497. fi
  498. ifelse([$4], , , fi
  499. )dnl
  500. if test -f core; then
  501.   coredir=core`/bin/sh -c 'echo $$'`
  502.   mkdir $coredir
  503.   cp confdefs.h $coredir/confdefs.h
  504.   mv conftest.c $coredir/conftest.c
  505.   mv conftest $coredir/conftest
  506.   mv core $coredir/core
  507.   echo "warning: test program dumped core -- see subdirectory $coredir"
  508. fi
  509. rm -f conftest*])dnl
  510. dnl
  511. define(AC_TEST_CPP,
  512. [AC_REQUIRE([AC_PROG_CPP])cat > conftest.c <<EOF
  513. #include "confdefs.h"
  514. [$1]
  515. EOF
  516. dnl Some shells (Coherent) do redirections in the wrong order, so need
  517. dnl the parens.
  518. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  519. if test -z "$err"; then
  520.   ifelse([$2], , :, [$2])
  521. ifelse([$3], , , [else
  522.   $3
  523. ])dnl
  524. fi
  525. rm -f conftest*])dnl
  526. dnl
  527. define(AC_REPLACE_FUNCS,
  528. [for func in $1
  529. do
  530. AC_COMPILE_CHECK([${func}], [#include <ctype.h>], [
  531. /* The GNU C library defines this for functions which it implements
  532.     to always fail with ENOSYS.  Some functions are actually named
  533.     something starting with __ and the normal name is an alias.  */
  534. #if defined (__stub_${func}) || defined (__stub___${func})
  535. choke me
  536. #else
  537. /* Override any gcc2 internal prototype to avoid an error.  */
  538. extern
  539. #ifdef __cplusplus
  540. "C"
  541. #endif
  542. char ${func}(); ${func}();
  543. #endif
  544. ], , [LIBOBJS="$LIBOBJS ${func}.o"])
  545. done
  546. AC_SUBST(LIBOBJS)dnl
  547. ])dnl
  548. dnl
  549. define(AC_FUNC_CHECK,
  550. [ifelse([$3], , [AC_COMPILE_CHECK($1, [#include <ctype.h>
  551. #ifdef __cplusplus
  552. extern "C" char $1();
  553. #endif], [
  554. /* The GNU C library defines this for functions which it implements
  555.     to always fail with ENOSYS.  Some functions are actually named
  556.     something starting with __ and the normal name is an alias.  */
  557. #if defined (__stub_$1) || defined (__stub___$1)
  558. choke me
  559. #else
  560. #ifndef __cplusplus
  561. /* Override any gcc2 internal prototype to avoid an error.  */
  562. extern char $1();
  563. #endif
  564. $1();
  565. #endif
  566. ],
  567. $2)], [AC_COMPILE_CHECK($1, [#include <ctype.h>
  568. #ifdef __cplusplus
  569. extern "C" char $1();
  570. #endif], [
  571. /* The GNU C library defines this for functions which it implements
  572.     to always fail with ENOSYS.  Some functions are actually named
  573.     something starting with __ and the normal name is an alias.  */
  574. #if defined (__stub_$1) || defined (__stub___$1)
  575. choke me
  576. #else
  577. #ifndef __cplusplus
  578. /* Override any gcc2 internal prototype to avoid an error.  */
  579. extern char $1();
  580. #endif
  581. $1();
  582. #endif
  583. ],
  584. $2, $3)])dnl
  585. ])dnl
  586. dnl
  587. define(AC_HAVE_FUNCS,
  588. [for func in $1
  589. do
  590. changequote(,)dnl
  591. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  592. changequote([,])dnl
  593. AC_FUNC_CHECK(${func},
  594. AC_DEFINE(${trfunc}))dnl
  595. done
  596. ])dnl
  597. dnl
  598. define(AC_HAVE_HEADERS,
  599. [for hdr in $1
  600. do
  601. changequote(,)dnl
  602. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  603. changequote([,])dnl
  604. AC_HEADER_CHECK(${hdr},
  605. AC_DEFINE(${trhdr}))dnl
  606. done
  607. ])dnl
  608. dnl
  609. define(AC_HAVE_LIBRARY, [dnl
  610. changequote(/,/)dnl
  611. define(/libname/, dnl
  612. patsubst(patsubst($1, /lib\([^\.]*\)\.a/, /\1/), /-l/, //))dnl
  613. changequote([,])dnl
  614. LIBS_save="${LIBS}"
  615. LIBS="${LIBS} -l[]libname[]"
  616. have_lib=""
  617. AC_COMPILE_CHECK([-l[]libname[]], , [main();], [have_lib="1"])dnl
  618. LIBS="${LIBS_save}"
  619. ifelse($#, 1, [dnl
  620. if test -n "${have_lib}"; then
  621.    AC_DEFINE([HAVE_LIB]translit(libname, [a-z], [A-Z]))
  622.    LIBS="${LIBS} -l[]libname[]"
  623. fi
  624. undefine(libname)dnl
  625. ], [dnl
  626. if test -n "${have_lib}"; then
  627.    :; $2
  628. else
  629.    :; $3
  630. fi
  631. ])])dnl
  632. dnl
  633. dnl
  634. dnl The big finish
  635. dnl
  636. dnl
  637. define(AC_OUTPUT,
  638. [changequote(,)dnl
  639. # Set default prefixes.
  640. if test -n "$prefix"; then
  641.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  642.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  643. fi
  644. if test -n "$exec_prefix"; then
  645.   prsub="$prsub
  646. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%"
  647. fi
  648. # Quote sed substitution magic chars in DEFS.
  649. cat >conftest.def <<EOF
  650. $DEFS
  651. EOF
  652. escape_ampersand_and_backslash='s%[&\\]%\\&%g'
  653. DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
  654. rm -f conftest.def
  655. # Substitute for predefined variables.
  656. changequote([,])dnl
  657. AC_SUBST(LIBS)dnl
  658. AC_SUBST(srcdir)dnl
  659. dnl Substituting for DEFS would confuse sed if it contains multiple lines.
  660. ifdef([AC_CONFIG_NAMES],
  661. [divert(1)dnl
  662. s%@DEFS@%-DHAVE_CONFIG_H%],
  663. [divert(1)dnl
  664. s%@DEFS@%$DEFS%]
  665. [divert(2)dnl
  666. DEFS='$DEFS'
  667. ])dnl
  668. divert(2)dnl
  669. prefix='$prefix'
  670. exec_prefix='$exec_prefix'
  671. prsub='$prsub'
  672. extrasub='$extrasub'
  673. divert(0)dnl
  674.  
  675. trap 'rm -f config.status; exit 1' 1 3 15
  676. echo creating config.status
  677. rm -f config.status
  678. cat > config.status <<EOF
  679. #!/bin/sh
  680. # Generated automatically by configure.
  681. # Run this file to recreate the current configuration.
  682. # This directory was configured as follows,
  683. dnl hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
  684. dnl so uname gets run too.
  685. # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  686. #
  687. [#] [$]0 [$]configure_args
  688.  
  689. for arg
  690. do
  691.   case "[\$]arg" in
  692.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  693.     echo running [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]configure_args
  694.     exec [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]configure_args ;;
  695.     *) echo "Usage: config.status [--recheck]" 2>&1; exit 1 ;;
  696.   esac
  697. done
  698.  
  699. ifdef([AC_CONFIG_NAMES],
  700. [trap 'rm -fr $1 AC_CONFIG_NAMES conftest*; exit 1' 1 3 15],
  701. [trap 'rm -f $1; exit 1' 1 3 15])
  702. dnl Insert the variable assignments.
  703. undivert(2)dnl
  704. EOF
  705. cat >> config.status <<\EOF
  706.  
  707. top_srcdir=$srcdir
  708.  
  709. CONFIG_FILES=${CONFIG_FILES-"$1"}
  710. for file in .. ${CONFIG_FILES}; do if test "x$file" != x..; then
  711.   srcdir=$top_srcdir
  712.   # Remove last slash and all that follows it.  Not all systems have dirname.
  713. changequote(,)dnl
  714.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  715. changequote([,])dnl
  716.   if test "$dir" != "$file"; then
  717.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  718.     test ! -d $dir && mkdir $dir
  719.   fi
  720.   echo creating $file
  721.   rm -f $file
  722.   touch $file
  723.   if test `echo $file|sed 's|.*/||'` = makemake; then
  724.     echo "#! /bin/sh" >> $file
  725.   fi
  726.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." >> $file
  727.   sed -e "
  728. $prsub
  729. dnl Shell code in configure.in might set extrasub.
  730. $extrasub
  731. dnl Insert the sed substitutions.
  732. undivert(1)dnl
  733. " $top_srcdir/${file}.in >> $file
  734.   if test `echo $file|sed 's|.*/||'` = makemake; then
  735.     chmod a+x $file
  736.   fi
  737. fi; done
  738. AC_OUTPUT_HEADER
  739. $2
  740. exit 0
  741. EOF
  742. chmod +x config.status
  743. ${CONFIG_SHELL-/bin/sh} config.status
  744. ])dnl
  745. dnl This is a subroutine of AC_OUTPUT, broken out primarily to avoid bugs
  746. dnl with long definitions in GNU m4 1.0.  This is called inside a quoted
  747. dnl here document whose contents are going into config.status.
  748. define(AC_OUTPUT_HEADER,[dnl
  749. ifdef([AC_CONFIG_NAMES],[dnl
  750. changequote(<<,>>)dnl
  751.  
  752. CONFIG_HEADERS=${CONFIG_HEADERS-"AC_CONFIG_NAMES"}
  753. for file in .. ${CONFIG_HEADERS}; do if test "x$file" != x..; then
  754. echo creating $file
  755.  
  756. # These sed commands are put into SEDDEFS when defining a macro.
  757. # They are broken into pieces to make the sed script easier to manage.
  758. # They are passed to sed as "A NAME B NAME C VALUE D", where NAME
  759. # is the cpp macro being defined and VALUE is the value it is being given.
  760. # Each defining turns into a single global substitution command.
  761. #
  762. # SEDd sets the value in "#define NAME VALUE" lines.
  763. SEDdA='s@^\([     ]*\)#\([     ]*define[     ][     ]*\)'
  764. SEDdB='\([     ][     ]*\)[^     ]*@\1#\2'
  765. SEDdC='\3'
  766. SEDdD='@g'
  767. # SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
  768. SEDuA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  769. SEDuB='\([     ]\)@\1#\2define\3'
  770. SEDuC=' '
  771. SEDuD='\4@g'
  772. # SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
  773. SEDeA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  774. SEDeB='<<$>>@\1#\2define\3'
  775. SEDeC=' '
  776. SEDeD='@g'
  777. # SEDf turns "#define NAME" without trailing blanks into "#define NAME VALUE".
  778. SEDfA='s@^\([     ]*\)#\([     ]*\)define\([     ][     ]*\)'
  779. SEDfB='<<$>>@\1#\2define\3'
  780. SEDfC=' '
  781. SEDfD='@g'
  782. changequote([,])dnl
  783. rm -f conftest.sed
  784. EOF
  785. # Turn off quoting long enough to insert the sed commands.
  786. rm -f conftest.sh
  787. cat > conftest.sh <<EOF
  788. $SEDDEFS
  789. EOF
  790.  
  791. # Break up $SEDDEFS (now in conftest.sh) because some shells have a limit
  792. # on the size of here documents.
  793.  
  794. # Maximum number of lines to put in a single here document.
  795. maxshlines=9
  796.  
  797. while :
  798. do
  799.   # wc gives bogus results for an empty file on some systems.
  800.   lines=`grep -c . conftest.sh`
  801.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  802.   rm -f conftest.s1 conftest.s2
  803.   sed ${maxshlines}q conftest.sh > conftest.s1 # Like head -20.
  804.   sed 1,${maxshlines}d conftest.sh > conftest.s2 # Like tail +21.
  805.   # Write a limited-size here document to append to conftest.sed.
  806.   echo 'cat >> conftest.sed <<CONFEOF' >> config.status
  807.   cat conftest.s1 >> config.status
  808.   echo 'CONFEOF' >> config.status
  809.   rm -f conftest.s1 conftest.sh
  810.   mv conftest.s2 conftest.sh
  811. done
  812. rm -f conftest.sh
  813.  
  814. # Now back to your regularly scheduled config.status.
  815. cat >> config.status <<\EOF
  816. dnl # This sed command replaces #undef's with comments.  This is necessary, for
  817. dnl # example, in the case of _POSIX_SOURCE, which is predefined and required
  818. dnl # on some systems where configure will not decide to define it in
  819. dnl [#] AC_CONFIG_NAMES.
  820. dnl cat >> conftest.sed <<\CONFEOF
  821. dnl changequote(,)dnl
  822. dnl s,^[     ]*#[     ]*undef[     ][     ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
  823. dnl changequote([,])dnl
  824. dnl CONFEOF
  825. rm -f conftest.h
  826. # Break up the sed commands because old seds have small limits.
  827. maxsedlines=20
  828. cp $top_srcdir/$file.in conftest.h1
  829. while :
  830. do
  831.   lines=`grep -c . conftest.sed`
  832.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  833.   rm -f conftest.s1 conftest.s2 conftest.h2
  834.   sed ${maxsedlines}q conftest.sed > conftest.s1 # Like head -20.
  835.   sed 1,${maxsedlines}d conftest.sed > conftest.s2 # Like tail +21.
  836.   sed -f conftest.s1 < conftest.h1 > conftest.h2
  837.   rm -f conftest.s1 conftest.h1 conftest.sed
  838.   mv conftest.h2 conftest.h1
  839.   mv conftest.s2 conftest.sed
  840. done
  841. rm -f conftest.sed conftest.h
  842. echo "/* $file.  Generated automatically by configure.  */" > conftest.h
  843. cat conftest.h1 >> conftest.h
  844. rm -f conftest.h1
  845. if cmp -s $file conftest.h 2>/dev/null; then
  846.   # The file exists and we would not be changing it.
  847.   echo "$file is unchanged"
  848.   rm -f conftest.h
  849. else
  850.   rm -f $file
  851.   mv conftest.h $file
  852. fi
  853. fi; done
  854.  
  855. ])])dnl
  856.