home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / octave-1.1.1p1-base.tgz / octave-1.1.1p1-base.tar / fsf / octave / kpathsea / configure < prev    next >
Text File  |  1994-03-16  |  23KB  |  847 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp]
  21. #        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE[=VALUE]]
  22. # Ignores all args except --srcdir, --prefix, --exec-prefix, and
  23. # --with-PACKAGE[=VALUE] unless this script has special code to handle it.
  24.  
  25. for arg
  26. do
  27.   # Handle --exec-prefix with a space before the argument.
  28.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  29.   # Handle --host with a space before the argument.
  30.   elif test x$next_host = xyes; then next_host=
  31.   # Handle --prefix with a space before the argument.
  32.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  33.   # Handle --srcdir with a space before the argument.
  34.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  35.   else
  36.     case $arg in
  37.      # For backward compatibility, recognize -exec-prefix and --exec_prefix.
  38.      -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
  39.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  40.      -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  41.     next_exec_prefix=yes ;;
  42.  
  43.      -gas | --gas | --ga | --g) ;;
  44.  
  45.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  46.      -host | --host | --hos | --ho | --h)
  47.     next_host=yes ;;
  48.  
  49.      -nfp | --nfp | --nf) ;;
  50.  
  51.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  52.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  53.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  54.     next_prefix=yes ;;
  55.  
  56.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  57.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  58.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  59.     next_srcdir=yes ;;
  60.  
  61.      -with-* | --with-*)
  62.        package=`echo $arg|sed -e 's/-*with-//' -e 's/=.*//'`
  63.        # Reject names that aren't valid shell variable names.
  64.        if test -n "`echo $package| sed 's/[-a-zA-Z0-9_]//g'`"; then
  65.          echo "configure: $package: invalid package name" >&2; exit 1
  66.        fi
  67.        package=`echo $package| sed 's/-/_/g'`
  68.        case "$arg" in
  69.          *=*) val="`echo $arg|sed 's/[^=]*=//'`" ;;
  70.          *) val=1 ;;
  71.        esac
  72.        eval "with_$package='$val'" ;;
  73.  
  74.      -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
  75.        verbose=yes ;;
  76.  
  77.      *) ;;
  78.     esac
  79.   fi
  80. done
  81.  
  82. trap 'rm -fr conftest* confdefs* core; exit 1' 1 3 15
  83. trap 'rm -f confdefs*' 0
  84.  
  85. # NLS nuisances.
  86. # These must not be set unconditionally because not all systems understand
  87. # e.g. LANG=C (notably SCO).
  88. if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi
  89. if test "${LANG+set}"   = 'set' ; then LANG=C;   export LANG;   fi
  90.  
  91. rm -f conftest* confdefs.h
  92. # AIX cpp loses on an empty file, so make sure it contains at least a newline.
  93. echo > confdefs.h
  94. compile='${CC-cc} $CFLAGS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  95.  
  96. # A filename unique to this package, relative to the directory that
  97. # configure is in, which we can look for to find out if srcdir is correct.
  98. unique_file=kpathsea.texi
  99.  
  100. # Find the source files, if location was not specified.
  101. if test -z "$srcdir"; then
  102.   srcdirdefaulted=yes
  103.   # Try the directory containing this script, then `..'.
  104.   prog=$0
  105.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  106.   test "X$confdir" = "X$prog" && confdir=.
  107.   srcdir=$confdir
  108.   if test ! -r $srcdir/$unique_file; then
  109.     srcdir=..
  110.   fi
  111. fi
  112. if test ! -r $srcdir/$unique_file; then
  113.   if test x$srcdirdefaulted = xyes; then
  114.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  115.   else
  116.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  117.   fi
  118.   exit 1
  119. fi
  120. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  121. # But we can't avoid them for `..', to make subdirectories work.
  122. case $srcdir in
  123.   .|/*|~*) ;;
  124.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  125. esac
  126.  
  127.  
  128. # Save the original args to write them into config.status later.
  129. configure_args="$*"
  130.  
  131.  
  132.  
  133.  
  134.  
  135. if test -z "$CC"; then
  136.   # Extract the first word of `gcc', so it can be a program name with args.
  137.   set dummy gcc; word=$2
  138.   echo checking for $word
  139.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  140.   for dir in $PATH; do
  141.     test -z "$dir" && dir=.
  142.     if test -f $dir/$word; then
  143.       CC="gcc"
  144.       break
  145.     fi
  146.   done
  147.   IFS="$saveifs"
  148. fi
  149. test -z "$CC" && CC="cc"
  150. test -n "$CC" && test -n "$verbose" && echo "    setting CC to $CC"
  151.  
  152. # Find out if we are using GNU C, under whatever name.
  153. cat > conftest.c <<EOF
  154. #ifdef __GNUC__
  155.   yes
  156. #endif
  157. EOF
  158. ${CC-cc} -E conftest.c > conftest.out 2>&1
  159. if egrep yes conftest.out >/dev/null 2>&1; then
  160.   GCC=1 # For later tests.
  161. fi
  162. rm -f conftest*
  163.  
  164. echo checking how to run the C preprocessor
  165. if test -z "$CPP"; then
  166.   # This must be in double quotes, not single quotes, because CPP may get
  167.   # substituted into the Makefile and ``${CC-cc}'' will simply confuse
  168.   # make.  It must be expanded now.
  169.   CPP="${CC-cc} -E"
  170.   cat > conftest.c <<EOF
  171. #include "confdefs.h"
  172. #include <stdio.h>
  173. Syntax Error
  174. EOF
  175. err=`eval "($CPP conftest.c >/dev/null) 2>&1"`
  176. if test -z "$err"; then
  177.   :
  178. else
  179.   rm -rf conftest*
  180.   CPP=/lib/cpp
  181. fi
  182. rm -f conftest*
  183. fi
  184. test ".${verbose}" != "." && echo "    setting CPP to $CPP"
  185.  
  186. # Make sure to not get the incompatible SysV /etc/install and
  187. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  188. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  189. # or the AFS install, which mishandles nonexistent args, or
  190. # /usr/ucb/install on SVR4, which tries to use the nonexistent group
  191. # `staff'.  On most BSDish systems install is in /usr/bin, not /usr/ucb
  192. # anyway.  Sigh.
  193. if test "z${INSTALL}" = "z" ; then
  194.   echo checking for install
  195.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  196.   for dir in $PATH; do
  197.     test -z "$dir" && dir=.
  198.     case $dir in
  199.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
  200.     *)
  201.       if test -f $dir/installbsd; then
  202.     INSTALL="$dir/installbsd -c" # OSF1
  203.     INSTALL_PROGRAM='$(INSTALL)'
  204.     INSTALL_DATA='$(INSTALL) -m 644'
  205.     break
  206.       fi
  207.       if test -f $dir/install; then
  208.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  209.       : # AIX
  210.     else
  211.       INSTALL="$dir/install -c"
  212.       INSTALL_PROGRAM='$(INSTALL)'
  213.       INSTALL_DATA='$(INSTALL) -m 644'
  214.       break
  215.     fi
  216.       fi
  217.       ;;
  218.     esac
  219.   done
  220.   IFS="$saveifs"
  221. fi
  222. INSTALL=${INSTALL-cp}
  223. test -n "$verbose" && echo "    setting INSTALL to $INSTALL"
  224. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  225. test -n "$verbose" && echo "    setting INSTALL_PROGRAM to $INSTALL_PROGRAM"
  226. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  227. test -n "$verbose" && echo "    setting INSTALL_DATA to $INSTALL_DATA"
  228.  
  229. if test -z "$RANLIB"; then
  230.   # Extract the first word of `ranlib', so it can be a program name with args.
  231.   set dummy ranlib; word=$2
  232.   echo checking for $word
  233.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  234.   for dir in $PATH; do
  235.     test -z "$dir" && dir=.
  236.     if test -f $dir/$word; then
  237.       RANLIB="ranlib"
  238.       break
  239.     fi
  240.   done
  241.   IFS="$saveifs"
  242. fi
  243. test -z "$RANLIB" && RANLIB=":"
  244. test -n "$RANLIB" && test -n "$verbose" && echo "    setting RANLIB to $RANLIB"
  245.  
  246.  
  247.  
  248. echo checking for POSIXized ISC
  249. if test -d /etc/conf/kconfig.d &&
  250.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  251. then
  252.   ISC=1 # If later tests want to check for ISC.
  253.   
  254. {
  255. test -n "$verbose" && \
  256. echo "    defining _POSIX_SOURCE"
  257. echo "#define" _POSIX_SOURCE 1 >> confdefs.h
  258. DEFS="$DEFS -D_POSIX_SOURCE=1"
  259. SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_SOURCE\${SEDdB}_POSIX_SOURCE\${SEDdC}1\${SEDdD}
  260. \${SEDuA}_POSIX_SOURCE\${SEDuB}_POSIX_SOURCE\${SEDuC}1\${SEDuD}
  261. \${SEDeA}_POSIX_SOURCE\${SEDeB}_POSIX_SOURCE\${SEDeC}1\${SEDeD}
  262. "
  263. }
  264.  
  265.   if test -n "$GCC"; then
  266.     CC="$CC -posix"
  267.   else
  268.     CC="$CC -Xp"
  269.   fi
  270. fi
  271.  
  272.  
  273. echo checking for directory library header
  274. dirheader=
  275. if test -z "$dirheader"; then
  276.   echo checking for dirent.h
  277. cat > conftest.c <<EOF
  278. #include "confdefs.h"
  279. #include <sys/types.h>
  280. #include <dirent.h>
  281. int main() { exit(0); }
  282. int t() { DIR *dirp = 0; }
  283. EOF
  284. if eval $compile; then
  285.   rm -rf conftest*
  286.   
  287. {
  288. test -n "$verbose" && \
  289. echo "    defining DIRENT"
  290. echo "#define" DIRENT 1 >> confdefs.h
  291. DEFS="$DEFS -DDIRENT=1"
  292. SEDDEFS="${SEDDEFS}\${SEDdA}DIRENT\${SEDdB}DIRENT\${SEDdC}1\${SEDdD}
  293. \${SEDuA}DIRENT\${SEDuB}DIRENT\${SEDuC}1\${SEDuD}
  294. \${SEDeA}DIRENT\${SEDeB}DIRENT\${SEDeC}1\${SEDeD}
  295. "
  296. }
  297.  dirheader=dirent.h
  298.  
  299. fi
  300. rm -f conftest*
  301. fi
  302. if test -z "$dirheader"; then
  303.   echo checking for sys/ndir.h
  304. cat > conftest.c <<EOF
  305. #include "confdefs.h"
  306. #include <sys/types.h>
  307. #include <sys/ndir.h>
  308. int main() { exit(0); }
  309. int t() { DIR *dirp = 0; }
  310. EOF
  311. if eval $compile; then
  312.   rm -rf conftest*
  313.   
  314. {
  315. test -n "$verbose" && \
  316. echo "    defining SYSNDIR"
  317. echo "#define" SYSNDIR 1 >> confdefs.h
  318. DEFS="$DEFS -DSYSNDIR=1"
  319. SEDDEFS="${SEDDEFS}\${SEDdA}SYSNDIR\${SEDdB}SYSNDIR\${SEDdC}1\${SEDdD}
  320. \${SEDuA}SYSNDIR\${SEDuB}SYSNDIR\${SEDuC}1\${SEDuD}
  321. \${SEDeA}SYSNDIR\${SEDeB}SYSNDIR\${SEDeC}1\${SEDeD}
  322. "
  323. }
  324.  dirheader=sys/ndir.h
  325.  
  326. fi
  327. rm -f conftest*
  328. fi
  329. if test -z "$dirheader"; then
  330.   echo checking for sys/dir.h
  331. cat > conftest.c <<EOF
  332. #include "confdefs.h"
  333. #include <sys/types.h>
  334. #include <sys/dir.h>
  335. int main() { exit(0); }
  336. int t() { DIR *dirp = 0; }
  337. EOF
  338. if eval $compile; then
  339.   rm -rf conftest*
  340.   
  341. {
  342. test -n "$verbose" && \
  343. echo "    defining SYSDIR"
  344. echo "#define" SYSDIR 1 >> confdefs.h
  345. DEFS="$DEFS -DSYSDIR=1"
  346. SEDDEFS="${SEDDEFS}\${SEDdA}SYSDIR\${SEDdB}SYSDIR\${SEDdC}1\${SEDdD}
  347. \${SEDuA}SYSDIR\${SEDuB}SYSDIR\${SEDuC}1\${SEDuD}
  348. \${SEDeA}SYSDIR\${SEDeB}SYSDIR\${SEDeC}1\${SEDeD}
  349. "
  350. }
  351.  dirheader=sys/dir.h
  352.  
  353. fi
  354. rm -f conftest*
  355. fi
  356. if test -z "$dirheader"; then
  357.   echo checking for ndir.h
  358. cat > conftest.c <<EOF
  359. #include "confdefs.h"
  360. #include <sys/types.h>
  361. #include <ndir.h>
  362. int main() { exit(0); }
  363. int t() { DIR *dirp = 0; }
  364. EOF
  365. if eval $compile; then
  366.   rm -rf conftest*
  367.   
  368. {
  369. test -n "$verbose" && \
  370. echo "    defining NDIR"
  371. echo "#define" NDIR 1 >> confdefs.h
  372. DEFS="$DEFS -DNDIR=1"
  373. SEDDEFS="${SEDDEFS}\${SEDdA}NDIR\${SEDdB}NDIR\${SEDdC}1\${SEDdD}
  374. \${SEDuA}NDIR\${SEDuB}NDIR\${SEDuC}1\${SEDuD}
  375. \${SEDeA}NDIR\${SEDeB}NDIR\${SEDeC}1\${SEDeD}
  376. "
  377. }
  378.  dirheader=ndir.h
  379.  
  380. fi
  381. rm -f conftest*
  382. fi
  383.  
  384. echo checking for closedir return value
  385. cat > conftest.c <<EOF
  386. #include "confdefs.h"
  387. #include <sys/types.h>
  388. #include <$dirheader>
  389. int closedir(); main() { exit(closedir(opendir(".")) != 0); }
  390. EOF
  391. eval $compile
  392. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  393.   :
  394. else
  395.   
  396. {
  397. test -n "$verbose" && \
  398. echo "    defining VOID_CLOSEDIR"
  399. echo "#define" VOID_CLOSEDIR 1 >> confdefs.h
  400. DEFS="$DEFS -DVOID_CLOSEDIR=1"
  401. SEDDEFS="${SEDDEFS}\${SEDdA}VOID_CLOSEDIR\${SEDdB}VOID_CLOSEDIR\${SEDdC}1\${SEDdD}
  402. \${SEDuA}VOID_CLOSEDIR\${SEDuB}VOID_CLOSEDIR\${SEDuC}1\${SEDuD}
  403. \${SEDeA}VOID_CLOSEDIR\${SEDeB}VOID_CLOSEDIR\${SEDeC}1\${SEDeD}
  404. "
  405. }
  406.  
  407. fi
  408. rm -fr conftest*
  409.  
  410. echo checking for Xenix
  411. cat > conftest.c <<EOF
  412. #include "confdefs.h"
  413. #if defined(M_XENIX) && !defined(M_UNIX)
  414.   yes
  415. #endif
  416.  
  417. EOF
  418. eval "$CPP conftest.c > conftest.out 2>&1"
  419. if egrep "yes" conftest.out >/dev/null 2>&1; then
  420.   rm -rf conftest*
  421.   XENIX=1
  422.  
  423. fi
  424. rm -f conftest*
  425.  
  426. if test -n "$XENIX"; then
  427.   LIBS="$LIBS -lx"
  428.   case "$DEFS" in
  429.   *SYSNDIR*) ;;
  430.   *) LIBS="-ldir $LIBS" ;; # Make sure -ldir precedes any -lx.
  431.   esac
  432. fi
  433.  
  434. echo checking for ANSI C header files
  435. cat > conftest.c <<EOF
  436. #include "confdefs.h"
  437. #include <stdlib.h>
  438. #include <stdarg.h>
  439. #include <string.h>
  440. #include <float.h>
  441. EOF
  442. err=`eval "($CPP conftest.c >/dev/null) 2>&1"`
  443. if test -z "$err"; then
  444.   rm -rf conftest*
  445.   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
  446. echo '#include "confdefs.h"
  447. #include <string.h>' > conftest.c
  448. eval "$CPP conftest.c > conftest.out 2>&1"
  449. if egrep "memchr" conftest.out >/dev/null 2>&1; then
  450.   rm -rf conftest*
  451.   # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
  452. cat > conftest.c <<EOF
  453. #include "confdefs.h"
  454. #include <ctype.h>
  455. #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
  456. #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
  457. #define XOR(e,f) (((e) && !(f)) || (!(e) && (f)))
  458. int main () { int i; for (i = 0; i < 256; i++)
  459. if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
  460. exit (0); }
  461.  
  462. EOF
  463. eval $compile
  464. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  465.   
  466. {
  467. test -n "$verbose" && \
  468. echo "    defining STDC_HEADERS"
  469. echo "#define" STDC_HEADERS 1 >> confdefs.h
  470. DEFS="$DEFS -DSTDC_HEADERS=1"
  471. SEDDEFS="${SEDDEFS}\${SEDdA}STDC_HEADERS\${SEDdB}STDC_HEADERS\${SEDdC}1\${SEDdD}
  472. \${SEDuA}STDC_HEADERS\${SEDuB}STDC_HEADERS\${SEDuC}1\${SEDuD}
  473. \${SEDeA}STDC_HEADERS\${SEDeB}STDC_HEADERS\${SEDeC}1\${SEDeD}
  474. "
  475. }
  476.  
  477.  
  478. fi
  479. rm -fr conftest*
  480.  
  481. fi
  482. rm -f conftest*
  483.  
  484.  
  485. fi
  486. rm -f conftest*
  487.  
  488. for hdr in assert.h float.h limits.h memory.h pwd.h stdlib.h \
  489.                 string.h unistd.h
  490. do
  491. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  492. echo checking for ${hdr}
  493. cat > conftest.c <<EOF
  494. #include "confdefs.h"
  495. #include <${hdr}>
  496. EOF
  497. err=`eval "($CPP conftest.c >/dev/null) 2>&1"`
  498. if test -z "$err"; then
  499.   rm -rf conftest*
  500.   
  501. {
  502. test -n "$verbose" && \
  503. echo "    defining ${trhdr}"
  504. echo "#define" ${trhdr} 1 >> confdefs.h
  505. DEFS="$DEFS -D${trhdr}=1"
  506. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  507. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  508. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  509. "
  510. }
  511.  
  512.  
  513. fi
  514. rm -f conftest*
  515. done
  516.  
  517.  
  518. for func in memmove putenv
  519. do
  520. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  521. echo checking for ${func}
  522. cat > conftest.c <<EOF
  523. #include "confdefs.h"
  524. #include <ctype.h>
  525. int main() { exit(0); }
  526. int t() { 
  527. /* The GNU C library defines this for functions which it implements
  528.     to always fail with ENOSYS.  Some functions are actually named
  529.     something starting with __ and the normal name is an alias.  */
  530. #if defined (__stub_${func}) || defined (__stub___${func})
  531. choke me
  532. #else
  533. /* Override any gcc2 internal prototype to avoid an error.  */
  534. extern char ${func}(); ${func}();
  535. #endif
  536.  }
  537. EOF
  538. if eval $compile; then
  539.   rm -rf conftest*
  540.   {
  541. test -n "$verbose" && \
  542. echo "    defining ${trfunc}"
  543. echo "#define" ${trfunc} 1 >> confdefs.h
  544. DEFS="$DEFS -D${trfunc}=1"
  545. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  546. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  547. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  548. "
  549. }
  550.  
  551.  
  552. fi
  553. rm -f conftest*
  554. done
  555.  
  556.  
  557. # It would be nicer to test for the requisite putenv features directly,
  558. # but can't figure out how to do that.
  559. if test "`(uname) 2>/dev/null`" = NetBSD \
  560.    || test "`(uname) 2>/dev/null`" = FreeBSD; then
  561.   
  562. {
  563. test -n "$verbose" && \
  564. echo "    defining SMART_PUTENV"
  565. echo "#define" SMART_PUTENV 1 >> confdefs.h
  566. DEFS="$DEFS -DSMART_PUTENV=1"
  567. SEDDEFS="${SEDDEFS}\${SEDdA}SMART_PUTENV\${SEDdB}SMART_PUTENV\${SEDdC}1\${SEDdD}
  568. \${SEDuA}SMART_PUTENV\${SEDuB}SMART_PUTENV\${SEDuC}1\${SEDuD}
  569. \${SEDeA}SMART_PUTENV\${SEDeB}SMART_PUTENV\${SEDeC}1\${SEDeD}
  570. "
  571. }
  572.  
  573. fi
  574.  
  575. prog='/* Ultrix mips cc rejects this.  */
  576. typedef int charset[2]; const charset x;
  577. /* SunOS 4.1.1 cc rejects this.  */
  578. char const *const *ccp;
  579. char **p;
  580. /* AIX XL C 1.02.0.0 rejects this.
  581.    It does not let you subtract one const X* pointer from another in an arm
  582.    of an if-expression whose if-part is not a constant expression */
  583. const char *g = "string";
  584. ccp = &g + (g ? g-g : 0);
  585. /* HPUX 7.0 cc rejects these. */
  586. ++ccp;
  587. p = (char**) ccp;
  588. ccp = (char const *const *) p;
  589. { /* SCO 3.2v4 cc rejects this.  */
  590.   char *t;
  591.   char const *s = 0 ? (char *) 0 : (char const *) 0;
  592.  
  593.   *t++ = 0;
  594. }
  595. { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
  596.   int x[] = {25,17};
  597.   const int *foo = &x[0];
  598.   ++foo;
  599. }
  600. { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
  601.   typedef const int *iptr;
  602.   iptr p = 0;
  603.   ++p;
  604. }
  605. { /* AIX XL C 1.02.0.0 rejects this saying
  606.      "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
  607.   struct s { int j; const int *ap[3]; };
  608.   struct s *b; b->j = 5;
  609. }
  610. { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
  611.   const int foo = 10;
  612. }'
  613. echo checking for lack of working const
  614. cat > conftest.c <<EOF
  615. #include "confdefs.h"
  616.  
  617. int main() { exit(0); }
  618. int t() { $prog }
  619. EOF
  620. if eval $compile; then
  621.   :
  622. else
  623.   rm -rf conftest*
  624.   
  625. {
  626. test -n "$verbose" && \
  627. echo "    defining" const to be empty
  628. echo "#define" const  >> confdefs.h
  629. DEFS="$DEFS -Dconst="
  630. SEDDEFS="${SEDDEFS}\${SEDdA}const\${SEDdB}const\${SEDdC}\${SEDdD}
  631. \${SEDuA}const\${SEDuB}const\${SEDuC}\${SEDuD}
  632. \${SEDeA}const\${SEDeB}const\${SEDeC}\${SEDeD}
  633. "
  634. }
  635.  
  636. fi
  637. rm -f conftest*
  638.  
  639.  
  640. # Any assignment to VPATH causes various Sun make's (both SunOS and
  641. # Solaris) to only execute the first set of double-colon rules, as in
  642. # the following 5-line Makefile. Since we use :: rules for distclean and
  643. # other important targets, we just remove the VPATH lines if they
  644. # defined it to be simply `.'.
  645. # VPATH = foo
  646. # target::
  647. #    echo first
  648. # target::
  649. #    echo second
  650.  
  651. # The line we're matching here is
  652. # VPATH = <whatever>
  653. # with arbitrary spaces and tabs around each of the elements.
  654. if test x$srcdir = x.; then
  655.   
  656.   extrasub='/^[     ]*VPATH[     ]*=[     ]*/d'
  657.   
  658. fi
  659.  
  660.  
  661. # Set default prefixes.
  662. if test -n "$prefix"; then
  663.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  664.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  665. fi
  666. if test -n "$exec_prefix"; then
  667.   prsub="$prsub
  668. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%"
  669. fi
  670. # Quote sed substitution magic chars in DEFS.
  671. cat >conftest.def <<EOF
  672. $DEFS
  673. EOF
  674. escape_ampersand_and_backslash='s%[&\\]%\\&%g'
  675. DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
  676. rm -f conftest.def
  677. # Substitute for predefined variables.
  678.  
  679. trap 'rm -f config.status; exit 1' 1 3 15
  680. echo creating config.status
  681. rm -f config.status
  682. cat > config.status <<EOF
  683. #!/bin/sh
  684. # Generated automatically by configure.
  685. # Run this file to recreate the current configuration.
  686. # This directory was configured as follows,
  687. # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  688. #
  689. # $0 $configure_args
  690.  
  691. for arg
  692. do
  693.   case "\$arg" in
  694.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  695.     echo running \${CONFIG_SHELL-/bin/sh} $0 $configure_args
  696.     exec \${CONFIG_SHELL-/bin/sh} $0 $configure_args ;;
  697.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  698.   esac
  699. done
  700.  
  701. trap 'rm -fr ./Makefile c-auto.h conftest*; exit 1' 1 3 15
  702. CC='$CC'
  703. CPP='$CPP'
  704. INSTALL='$INSTALL'
  705. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  706. INSTALL_DATA='$INSTALL_DATA'
  707. RANLIB='$RANLIB'
  708. LIBS='$LIBS'
  709. srcdir='$srcdir'
  710. prefix='$prefix'
  711. exec_prefix='$exec_prefix'
  712. prsub='$prsub'
  713. extrasub='$extrasub'
  714. EOF
  715. cat >> config.status <<\EOF
  716.  
  717. top_srcdir=$srcdir
  718.  
  719. CONFIG_FILES=${CONFIG_FILES-"./Makefile"}
  720. for file in .. ${CONFIG_FILES}; do if test "x$file" != x..; then
  721.   srcdir=$top_srcdir
  722.   # Remove last slash and all that follows it.  Not all systems have dirname.
  723.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  724.   if test "$dir" != "$file"; then
  725.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  726.     test ! -d $dir && mkdir $dir
  727.   fi
  728.   echo creating $file
  729.   rm -f $file
  730.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  731.   sed -e "
  732. $prsub
  733. $extrasub
  734. s%@CC@%$CC%g
  735. s%@CPP@%$CPP%g
  736. s%@INSTALL@%$INSTALL%g
  737. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  738. s%@INSTALL_DATA@%$INSTALL_DATA%g
  739. s%@RANLIB@%$RANLIB%g
  740. s%@LIBS@%$LIBS%g
  741. s%@srcdir@%$srcdir%g
  742. s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
  743. fi; done
  744.  
  745. CONFIG_HEADERS=${CONFIG_HEADERS-"c-auto.h"}
  746. for file in .. ${CONFIG_HEADERS}; do if test "x$file" != x..; then
  747. echo creating $file
  748.  
  749. # These sed commands are put into SEDDEFS when defining a macro.
  750. # They are broken into pieces to make the sed script easier to manage.
  751. # They are passed to sed as "A NAME B NAME C VALUE D", where NAME
  752. # is the cpp macro being defined and VALUE is the value it is being given.
  753. # Each defining turns into a single global substitution command.
  754. #
  755. # SEDd sets the value in "#define NAME VALUE" lines.
  756. SEDdA='s@^\([     ]*\)#\([     ]*define[     ][     ]*\)'
  757. SEDdB='\([     ][     ]*\)[^     ]*@\1#\2'
  758. SEDdC='\3'
  759. SEDdD='@g'
  760. # SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
  761. SEDuA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  762. SEDuB='\([     ]\)@\1#\2define\3'
  763. SEDuC=' '
  764. SEDuD='\4@g'
  765. # SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
  766. SEDeA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  767. SEDeB='$@\1#\2define\3'
  768. SEDeC=' '
  769. SEDeD='@g'
  770. rm -f conftest.sed
  771. EOF
  772. # Turn off quoting long enough to insert the sed commands.
  773. rm -f conftest.sh
  774. cat > conftest.sh <<EOF
  775. $SEDDEFS
  776. EOF
  777.  
  778. # Break up $SEDDEFS (now in conftest.sh) because some shells have a limit
  779. # on the size of here documents.
  780.  
  781. # Maximum number of lines to put in a single here document.
  782. maxshlines=9
  783.  
  784. while :
  785. do
  786.   # wc gives bogus results for an empty file on some systems.
  787.   lines=`grep -c . conftest.sh`
  788.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  789.   rm -f conftest.s1 conftest.s2
  790.   sed ${maxshlines}q conftest.sh > conftest.s1 # Like head -20.
  791.   sed 1,${maxshlines}d conftest.sh > conftest.s2 # Like tail +21.
  792.   # Write a limited-size here document to append to conftest.sed.
  793.   echo 'cat >> conftest.sed <<CONFEOF' >> config.status
  794.   cat conftest.s1 >> config.status
  795.   echo 'CONFEOF' >> config.status
  796.   rm -f conftest.s1 conftest.sh
  797.   mv conftest.s2 conftest.sh
  798. done
  799. rm -f conftest.sh
  800.  
  801. # Now back to your regularly scheduled config.status.
  802. cat >> config.status <<\EOF
  803. # This sed command replaces #undef's with comments.  This is necessary, for
  804. # example, in the case of _POSIX_SOURCE, which is predefined and required
  805. # on some systems where configure will not decide to define it in
  806. # c-auto.h.
  807. cat >> conftest.sed <<\CONFEOF
  808. s,^[     ]*#[     ]*undef[     ][     ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
  809. CONFEOF
  810. rm -f conftest.h
  811. # Break up the sed commands because old seds have small limits.
  812. maxsedlines=20
  813. cp $top_srcdir/$file.in conftest.h1
  814. while :
  815. do
  816.   lines=`grep -c . conftest.sed`
  817.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  818.   rm -f conftest.s1 conftest.s2 conftest.h2
  819.   sed ${maxsedlines}q conftest.sed > conftest.s1 # Like head -20.
  820.   sed 1,${maxsedlines}d conftest.sed > conftest.s2 # Like tail +21.
  821.   sed -f conftest.s1 < conftest.h1 > conftest.h2
  822.   rm -f conftest.s1 conftest.h1 conftest.sed
  823.   mv conftest.h2 conftest.h1
  824.   mv conftest.s2 conftest.sed
  825. done
  826. rm -f conftest.sed conftest.h
  827. echo "/* $file.  Generated automatically by configure.  */" > conftest.h
  828. cat conftest.h1 >> conftest.h
  829. rm -f conftest.h1
  830. if cmp -s $file conftest.h 2>/dev/null; then
  831.   # The file exists and we would not be changing it.
  832.   echo "$file is unchanged"
  833.   rm -f conftest.h
  834. else
  835.   rm -f $file
  836.   mv conftest.h $file
  837. fi
  838. fi; done
  839.  
  840.  
  841.  
  842. exit 0
  843. EOF
  844. chmod +x config.status
  845. ${CONFIG_SHELL-/bin/sh} config.status
  846.  
  847.