home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / bison-1.21 / configure < prev    next >
Encoding:
Text File  |  1993-04-16  |  14.0 KB  |  576 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] [--no-create]
  21. #        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
  22. # Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
  23. # --with-PACKAGE unless this script has special code to handle it.
  24.  
  25.  
  26. for arg
  27. do
  28.   # Handle --exec-prefix with a space before the argument.
  29.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  30.   # Handle --host with a space before the argument.
  31.   elif test x$next_host = xyes; then next_host=
  32.   # Handle --prefix with a space before the argument.
  33.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  34.   # Handle --srcdir with a space before the argument.
  35.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  36.   else
  37.     case $arg in
  38.      # For backward compatibility, also recognize exact --exec_prefix.
  39.      -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
  40.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  41.      -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  42.     next_exec_prefix=yes ;;
  43.  
  44.      -gas | --gas | --ga | --g) ;;
  45.  
  46.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  47.      -host | --host | --hos | --ho | --h)
  48.     next_host=yes ;;
  49.  
  50.      -nfp | --nfp | --nf) ;;
  51.  
  52.      -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  53.         no_create=1 ;;
  54.  
  55.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  56.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  57.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  58.     next_prefix=yes ;;
  59.  
  60.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  61.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  62.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  63.     next_srcdir=yes ;;
  64.  
  65.      -with-* | --with-*)
  66.        package=`echo $arg|sed 's/-*with-//'`
  67.        # Delete all the valid chars; see if any are left.
  68.        if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
  69.          echo "configure: $package: invalid package name" >&2; exit 1
  70.        fi
  71.        eval "with_`echo $package|sed s/-/_/g`=1" ;;
  72.  
  73.      -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
  74.        verbose=yes ;;
  75.  
  76.      *) ;;
  77.     esac
  78.   fi
  79. done
  80.  
  81. trap 'rm -f conftest* core; exit 1' 1 3 15
  82.  
  83. rm -f conftest*
  84. compile='${CC-cc} $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  85.  
  86. # A filename unique to this package, relative to the directory that
  87. # configure is in, which we can look for to find out if srcdir is correct.
  88. unique_file=reduce.c
  89.  
  90. # Find the source files, if location was not specified.
  91. if test -z "$srcdir"; then
  92.   srcdirdefaulted=yes
  93.   # Try the directory containing this script, then `..'.
  94.   prog=$0
  95.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  96.   test "X$confdir" = "X$prog" && confdir=.
  97.   srcdir=$confdir
  98.   if test ! -r $srcdir/$unique_file; then
  99.     srcdir=..
  100.   fi
  101. fi
  102. if test ! -r $srcdir/$unique_file; then
  103.   if test x$srcdirdefaulted = xyes; then
  104.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  105.   else
  106.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  107.   fi
  108.   exit 1
  109. fi
  110. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  111. # But we can't avoid them for `..', to make subdirectories work.
  112. case $srcdir in
  113.   .|/*|~*) ;;
  114.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  115. esac
  116.  
  117. if test -z "$CC"; then
  118.   echo checking for gcc
  119.   saveifs="$IFS"; IFS="${IFS}:"
  120.   for dir in $PATH; do
  121.     test -z "$dir" && dir=.
  122.     if test -f $dir/gcc; then
  123.       CC="gcc"
  124.       break
  125.     fi
  126.   done
  127.   IFS="$saveifs"
  128. fi
  129. test -z "$CC" && CC="cc"
  130.  
  131. # Find out if we are using GNU C, under whatever name.
  132. cat > conftest.c <<EOF
  133. #ifdef __GNUC__
  134.   yes
  135. #endif
  136. EOF
  137. ${CC-cc} -E conftest.c > conftest.out 2>&1
  138. if egrep yes conftest.out >/dev/null 2>&1; then
  139.   GCC=1 # For later tests.
  140. fi
  141. rm -f conftest*
  142.  
  143. echo checking how to run the C preprocessor
  144. if test -z "$CPP"; then
  145.   CPP='${CC-cc} -E'
  146.   cat > conftest.c <<EOF
  147. #include <stdio.h>
  148. EOF
  149. err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"`
  150. if test -z "$err"; then
  151.   :
  152. else
  153.   CPP=/lib/cpp
  154. fi
  155. rm -f conftest*
  156. fi
  157.  
  158. # Make sure to not get the incompatible SysV /etc/install and
  159. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  160. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  161. # or the AFS install, which mishandles nonexistent args.  (Sigh.)
  162. if test -z "$INSTALL"; then
  163.   echo checking for install
  164.   saveifs="$IFS"; IFS="${IFS}:"
  165.   for dir in $PATH; do
  166.     test -z "$dir" && dir=.
  167.     case $dir in
  168.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;;
  169.     *)
  170.       if test -f $dir/installbsd; then
  171.     INSTALL="$dir/installbsd -c" # OSF1
  172.     INSTALL_PROGRAM='$(INSTALL)'
  173.     INSTALL_DATA='$(INSTALL) -m 644'
  174.     break
  175.       fi
  176.       if test -f $dir/install; then
  177.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  178.       : # AIX
  179.     else
  180.       INSTALL="$dir/install -c"
  181.       INSTALL_PROGRAM='$(INSTALL)'
  182.       INSTALL_DATA='$(INSTALL) -m 644'
  183.       break
  184.     fi
  185.       fi
  186.       ;;
  187.     esac
  188.   done
  189.   IFS="$saveifs"
  190. fi
  191. INSTALL=${INSTALL-cp}
  192. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  193. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  194.  
  195. echo checking for minix/config.h
  196. cat > conftest.c <<EOF
  197. #include <minix/config.h>
  198. EOF
  199. err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"`
  200. if test -z "$err"; then
  201.   MINIX=1
  202. fi
  203. rm -f conftest*
  204.  
  205. # The Minix shell can't assign to the same variable on the same line!
  206. if test -n "$MINIX"; then
  207.   {
  208. test -n "$verbose" && \
  209. echo '    defining' _POSIX_SOURCE
  210. DEFS="$DEFS -D_POSIX_SOURCE=1"
  211. }
  212.  
  213.   {
  214. test -n "$verbose" && \
  215. echo '    defining' _POSIX_1_SOURCE to be '2'
  216. DEFS="$DEFS -D_POSIX_1_SOURCE=2"
  217. }
  218.  
  219.   {
  220. test -n "$verbose" && \
  221. echo '    defining' _MINIX
  222. DEFS="$DEFS -D_MINIX=1"
  223. }
  224.  
  225. fi
  226.  
  227. echo checking for POSIXized ISC
  228. if test -d /etc/conf/kconfig.d &&
  229.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  230. then
  231.   ISC=1 # If later tests want to check for ISC.
  232.   {
  233. test -n "$verbose" && \
  234. echo '    defining' _POSIX_SOURCE
  235. DEFS="$DEFS -D_POSIX_SOURCE=1"
  236. }
  237.  
  238.   if test -n "$GCC"; then
  239.     CC="$CC -posix"
  240.   else
  241.     CC="$CC -Xp"
  242.   fi
  243. fi
  244.  
  245. prog='/* Ultrix mips cc rejects this.  */
  246. typedef int charset[2]; const charset x;
  247. /* SunOS 4.1.1 cc rejects this.  */
  248. char const *const *ccp;
  249. char **p;
  250. /* AIX XL C 1.02.0.0 rejects this.
  251.    It does not let you subtract one const X* pointer from another in an arm
  252.    of an if-expression whose if-part is not a constant expression */
  253. const char *g = "string";
  254. p = &g + (g ? g-g : 0);
  255. /* HPUX 7.0 cc rejects these. */
  256. ++ccp;
  257. p = (char**) ccp;
  258. ccp = (char const *const *) p;
  259. { /* SCO 3.2v4 cc rejects this.  */
  260.   char *t;
  261.   char const *s = 0 ? (char *) 0 : (char const *) 0;
  262.  
  263.   *t++ = 0;
  264. }
  265. { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
  266.   int x[] = {25,17};
  267.   const int *foo = &x[0];
  268.   ++foo;
  269. }
  270. { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
  271.   typedef const int *iptr;
  272.   iptr p = 0;
  273.   ++p;
  274. }
  275. { /* AIX XL C 1.02.0.0 rejects this saying
  276.      "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
  277.   struct s { int j; const int *ap[3]; };
  278.   struct s *b; b->j = 5;
  279. }'
  280. echo checking for working const
  281. cat > conftest.c <<EOF
  282.  
  283. int main() { exit(0); } 
  284. int t() { $prog }
  285. EOF
  286. if eval $compile; then
  287.   :
  288. else
  289.   {
  290. test -n "$verbose" && \
  291. echo '    defining' const to be 'empty'
  292. DEFS="$DEFS -Dconst="
  293. }
  294.  
  295. fi
  296. rm -f conftest*
  297.  
  298. echo checking for ANSI C header files
  299. cat > conftest.c <<EOF
  300. #include <stdlib.h>
  301. #include <stdarg.h>
  302. #include <string.h>
  303. #include <float.h>
  304. EOF
  305. err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"`
  306. if test -z "$err"; then
  307.   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
  308. echo '#include <string.h>' > conftest.c
  309. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  310. if egrep "memchr" conftest.out >/dev/null 2>&1; then
  311.   # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
  312. cat > conftest.c <<EOF
  313. #include <ctype.h>
  314. #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
  315. #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
  316. #define XOR(e,f) (((e) && !(f)) || (!(e) && (f)))
  317. int main () { int i; for (i = 0; i < 256; i++)
  318. if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
  319. exit (0); }
  320.  
  321. EOF
  322. eval $compile
  323. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  324.   {
  325. test -n "$verbose" && \
  326. echo '    defining' STDC_HEADERS
  327. DEFS="$DEFS -DSTDC_HEADERS=1"
  328. }
  329.  
  330. fi
  331. rm -f conftest*
  332. fi
  333. rm -f conftest*
  334.  
  335. fi
  336. rm -f conftest*
  337.  
  338. for hdr in string.h stdlib.h memory.h
  339. do
  340. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  341. echo checking for ${hdr}
  342. cat > conftest.c <<EOF
  343. #include <${hdr}>
  344. EOF
  345. err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"`
  346. if test -z "$err"; then
  347.   {
  348. test -n "$verbose" && \
  349. echo '    defining' ${trhdr}
  350. DEFS="$DEFS -D${trhdr}=1"
  351. }
  352.  
  353. fi
  354. rm -f conftest*
  355. done
  356.  
  357. for func in strerror
  358. do
  359. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  360. echo checking for ${func}
  361. cat > conftest.c <<EOF
  362. #include <stdio.h>
  363. int main() { exit(0); } 
  364. int t() { 
  365. #ifdef __stub_${func}
  366. choke me
  367. #else
  368. /* Override any gcc2 internal prototype to avoid an error.  */
  369. extern char ${func}(); ${func}();
  370. #endif
  371.  }
  372. EOF
  373. if eval $compile; then
  374.   {
  375. test -n "$verbose" && \
  376. echo '    defining' ${trfunc}
  377. DEFS="$DEFS -D${trfunc}=1"
  378. }
  379.  
  380. fi
  381. rm -f conftest*
  382. #endif
  383. done
  384.  
  385. # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  386. # for constant arguments.  Useless!
  387. echo checking for working alloca.h
  388. cat > conftest.c <<EOF
  389. #include <alloca.h>
  390. int main() { exit(0); } 
  391. int t() { char *p = alloca(2 * sizeof(int)); }
  392. EOF
  393. if eval $compile; then
  394.   {
  395. test -n "$verbose" && \
  396. echo '    defining' HAVE_ALLOCA_H
  397. DEFS="$DEFS -DHAVE_ALLOCA_H=1"
  398. }
  399.  
  400. fi
  401. rm -f conftest*
  402.  
  403. decl="#ifdef __GNUC__
  404. #define alloca __builtin_alloca
  405. #else
  406. #if HAVE_ALLOCA_H
  407. #include <alloca.h>
  408. #else
  409. #ifdef _AIX
  410.  #pragma alloca
  411. #else
  412. char *alloca ();
  413. #endif
  414. #endif
  415. #endif
  416. "
  417. echo checking for alloca
  418. cat > conftest.c <<EOF
  419. $decl
  420. int main() { exit(0); } 
  421. int t() { char *p = (char *) alloca(1); }
  422. EOF
  423. if eval $compile; then
  424.   :
  425. else
  426.   alloca_missing=1
  427. fi
  428. rm -f conftest*
  429.  
  430. if test -n "$alloca_missing"; then
  431.   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
  432.   # that cause trouble.  Some versions do not even contain alloca or
  433.   # contain a buggy version.  If you still want to use their alloca,
  434.   # use ar to extract alloca.o from them instead of compiling alloca.c.
  435.   ALLOCA=alloca.o
  436.  
  437.   echo 'checking stack direction for C alloca'
  438.   echo checking whether cross-compiling
  439. # If we cannot run a trivial program, we must be cross compiling.
  440. cat > conftest.c <<EOF
  441. main(){exit(0);}
  442. EOF
  443. eval $compile
  444. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  445.   :
  446. else
  447.   cross_compiling=1
  448. fi
  449. rm -f conftest*
  450.  
  451. if test -n "$cross_compiling"
  452. then
  453.   {
  454. test -n "$verbose" && \
  455. echo '    defining' STACK_DIRECTION to be '0'
  456. DEFS="$DEFS -DSTACK_DIRECTION=0"
  457. }
  458.  
  459. else
  460. cat > conftest.c <<EOF
  461. find_stack_direction ()
  462. {
  463.   static char *addr = 0;
  464.   auto char dummy;
  465.   if (addr == 0)
  466.     {
  467.       addr = &dummy;
  468.       find_stack_direction ();
  469.     }
  470.   else
  471.     return (&dummy > addr) ? 1 : -1;
  472. }
  473. main ()
  474. {
  475.   exit (find_stack_direction() < 0);
  476. }
  477. EOF
  478. eval $compile
  479. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  480.   {
  481. test -n "$verbose" && \
  482. echo '    defining' STACK_DIRECTION to be '1'
  483. DEFS="$DEFS -DSTACK_DIRECTION=1"
  484. }
  485.  
  486. else
  487.   {
  488. test -n "$verbose" && \
  489. echo '    defining' STACK_DIRECTION to be '-1'
  490. DEFS="$DEFS -DSTACK_DIRECTION=-1"
  491. }
  492.  
  493. fi
  494. fi
  495. rm -f conftest*
  496. fi
  497.  
  498. if test -n "$prefix"; then
  499.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  500.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  501. fi
  502. if test -n "$exec_prefix"; then
  503.   prsub="$prsub
  504. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%\
  505. exec_prefix\\1=\\2$exec_prefix%"
  506. fi
  507.  
  508. trap 'rm -f config.status; exit 1' 1 3 15
  509. echo creating config.status
  510. rm -f config.status
  511. cat > config.status <<EOF
  512. #!/bin/sh
  513. # Generated automatically by configure.
  514. # Run this file to recreate the current configuration.
  515. # This directory was configured as follows,
  516. # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  517. #
  518. # $0 $*
  519.  
  520. for arg
  521. do
  522.   case "\$arg" in
  523.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  524.     exec /bin/sh $0 $* ;;
  525.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  526.   esac
  527. done
  528.  
  529. trap 'rm -f Makefile; exit 1' 1 3 15
  530. CC='$CC'
  531. CPP='$CPP'
  532. INSTALL='$INSTALL'
  533. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  534. INSTALL_DATA='$INSTALL_DATA'
  535. ALLOCA='$ALLOCA'
  536. LIBS='$LIBS'
  537. srcdir='$srcdir'
  538. DEFS='$DEFS'
  539. prefix='$prefix'
  540. exec_prefix='$exec_prefix'
  541. prsub='$prsub'
  542. EOF
  543. cat >> config.status <<\EOF
  544.  
  545. top_srcdir=$srcdir
  546. for file in .. Makefile; do if [ "x$file" != "x.." ]; then
  547.   srcdir=$top_srcdir
  548.   # Remove last slash and all that follows it.  Not all systems have dirname.
  549.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  550.   if test "$dir" != "$file"; then
  551.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  552.     test ! -d $dir && mkdir $dir
  553.   fi
  554.   echo creating $file
  555.   rm -f $file
  556.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  557.   sed -e "
  558. $prsub
  559. s%@CC@%$CC%g
  560. s%@CPP@%$CPP%g
  561. s%@INSTALL@%$INSTALL%g
  562. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  563. s%@INSTALL_DATA@%$INSTALL_DATA%g
  564. s%@ALLOCA@%$ALLOCA%g
  565. s%@LIBS@%$LIBS%g
  566. s%@srcdir@%$srcdir%g
  567. s%@DEFS@%$DEFS%
  568. " $top_srcdir/${file}.in >> $file
  569. fi; done
  570.  
  571. exit 0
  572. EOF
  573. chmod +x config.status
  574. test -n "$no_create" || ./config.status
  575.  
  576.