home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / regex-0.12 / configure < prev    next >
Encoding:
Text File  |  1993-02-08  |  11.9 KB  |  463 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.      *) ;;
  74.     esac
  75.   fi
  76. done
  77.  
  78. trap 'rm -f conftest* core; exit 1' 1 3 15
  79.  
  80. rm -f conftest*
  81. compile='${CC-cc} $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  82.  
  83. # A filename unique to this package, relative to the directory that
  84. # configure is in, which we can look for to find out if srcdir is correct.
  85. unique_file=regex.c
  86.  
  87. # Find the source files, if location was not specified.
  88. if test -z "$srcdir"; then
  89.   srcdirdefaulted=yes
  90.   # Try the directory containing this script, then `..'.
  91.   prog=$0
  92.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  93.   test "X$confdir" = "X$prog" && confdir=.
  94.   srcdir=$confdir
  95.   if test ! -r $srcdir/$unique_file; then
  96.     srcdir=..
  97.   fi
  98. fi
  99. if test ! -r $srcdir/$unique_file; then
  100.   if test x$srcdirdefaulted = xyes; then
  101.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  102.   else
  103.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  104.   fi
  105.   exit 1
  106. fi
  107. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  108. # But we can't avoid them for `..', to make subdirectories work.
  109. case $srcdir in
  110.   .|/*|~*) ;;
  111.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  112. esac
  113.  
  114.  
  115. if test -z "$CC"; then
  116.   echo checking for gcc
  117.   saveifs="$IFS"; IFS="${IFS}:"
  118.   for dir in $PATH; do
  119.     test -z "$dir" && dir=.
  120.     if test -f $dir/gcc; then
  121.       CC="gcc"
  122.       break
  123.     fi
  124.   done
  125.   IFS="$saveifs"
  126. fi
  127. test -z "$CC" && CC="cc"
  128.  
  129. # Find out if we are using GNU C, under whatever name.
  130. cat > conftest.c <<EOF
  131. #ifdef __GNUC__
  132.   yes
  133. #endif
  134. EOF
  135. ${CC-cc} -E conftest.c > conftest.out 2>&1
  136. if egrep yes conftest.out >/dev/null 2>&1; then
  137.   GCC=1 # For later tests.
  138. fi
  139. rm -f conftest*
  140.  
  141. # Make sure to not get the incompatible SysV /etc/install and
  142. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  143. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  144. # or the AFS install, which mishandles nonexistent args.  (Sigh.)
  145. if test -z "$INSTALL"; then
  146.   echo checking for install
  147.   saveifs="$IFS"; IFS="${IFS}:"
  148.   for dir in $PATH; do
  149.     test -z "$dir" && dir=.
  150.     case $dir in
  151.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;;
  152.     *)
  153.       if test -f $dir/install; then
  154.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  155.       : # AIX
  156.     else
  157.       INSTALL="$dir/install -c"
  158.       INSTALL_PROGRAM='$(INSTALL)'
  159.       INSTALL_DATA='$(INSTALL) -m 644'
  160.       break
  161.     fi
  162.       fi
  163.       ;;
  164.     esac
  165.   done
  166.   IFS="$saveifs"
  167. fi
  168. INSTALL=${INSTALL-cp}
  169. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  170. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  171.  
  172.  
  173. echo checking for AIX
  174. echo checking how to run the C preprocessor
  175. if test -z "$CPP"; then
  176.   CPP='${CC-cc} -E'
  177.   cat > conftest.c <<EOF
  178. #include <stdio.h>
  179. EOF
  180. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  181. if test -z "$err"; then
  182.   :
  183. else
  184.   CPP=/lib/cpp
  185. fi
  186. rm -f conftest*
  187. fi
  188.  
  189. cat > conftest.c <<EOF
  190. #ifdef _AIX
  191.   yes
  192. #endif
  193.  
  194. EOF
  195. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  196. if egrep "yes" conftest.out >/dev/null 2>&1; then
  197.   DEFS="$DEFS -D_ALL_SOURCE=1"
  198. fi
  199. rm -f conftest*
  200.  
  201.  
  202. echo checking for DYNIX/ptx libseq
  203. cat > conftest.c <<EOF
  204. #if defined(_SEQUENT_)
  205.   yes
  206. #endif
  207.  
  208. EOF
  209. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  210. if egrep "yes" conftest.out >/dev/null 2>&1; then
  211.   SEQUENT=1
  212. fi
  213. rm -f conftest*
  214.  
  215. test -n "$SEQUENT" && test -f /usr/lib/libseq.a &&
  216.   LIBS="$LIBS -lseq"
  217.  
  218. echo checking for POSIXized ISC
  219. if test -d /etc/conf/kconfig.d &&
  220.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  221. then
  222.   ISC=1 # If later tests want to check for ISC.
  223.   DEFS="$DEFS -D_POSIX_SOURCE=1"
  224.   if test -n "$GCC"; then
  225.     CC="$CC -posix"
  226.   else
  227.     CC="$CC -Xp"
  228.   fi
  229. fi
  230.  
  231. echo checking for minix/config.h
  232. cat > conftest.c <<EOF
  233. #include <minix/config.h>
  234. EOF
  235. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  236. if test -z "$err"; then
  237.   MINIX=1
  238. fi
  239. rm -f conftest*
  240.  
  241. # The Minix shell can't assign to the same variable on the same line!
  242. if test -n "$MINIX"; then
  243.   DEFS="$DEFS -D_POSIX_SOURCE=1"
  244.   DEFS="$DEFS -D_POSIX_1_SOURCE=2"
  245.   DEFS="$DEFS -D_MINIX=1"
  246. fi
  247.  
  248.  
  249. echo checking for ANSI C header files
  250. cat > conftest.c <<EOF
  251. #include <stdlib.h>
  252. #include <stdarg.h>
  253. #include <string.h>
  254. #include <float.h>
  255. EOF
  256. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  257. if test -z "$err"; then
  258.   # SunOS string.h does not declare mem*, contrary to ANSI.
  259. echo '#include <string.h>' > conftest.c
  260. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  261. if egrep "memchr" conftest.out >/dev/null 2>&1; then
  262.   # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
  263. cat > conftest.c <<EOF
  264. #include <ctype.h>
  265. #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
  266. #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
  267. #define XOR(e,f) (((e) && !(f)) || (!(e) && (f)))
  268. int main () { int i; for (i = 0; i < 256; i++)
  269. if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
  270. exit (0); }
  271.  
  272. EOF
  273. eval $compile
  274. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  275.   DEFS="$DEFS -DSTDC_HEADERS=1"
  276. fi
  277. rm -f conftest*
  278. fi
  279. rm -f conftest*
  280.  
  281. fi
  282. rm -f conftest*
  283.  
  284. for hdr in string.h
  285. do
  286. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  287. echo checking for ${hdr}
  288. cat > conftest.c <<EOF
  289. #include <${hdr}>
  290. EOF
  291. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  292. if test -z "$err"; then
  293.   DEFS="$DEFS -D${trhdr}=1"
  294. fi
  295. rm -f conftest*
  296. done
  297.  
  298.  
  299. # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  300. # for constant arguments.  Useless!
  301. echo checking for working alloca.h
  302. cat > conftest.c <<EOF
  303. #include <alloca.h>
  304. main() { exit(0); } 
  305. t() { char *p = alloca(2 * sizeof(int)); }
  306. EOF
  307. if eval $compile; then
  308.   DEFS="$DEFS -DHAVE_ALLOCA_H=1"
  309. fi
  310. rm -f conftest*
  311.  
  312. decl="#ifdef __GNUC__
  313. #define alloca __builtin_alloca
  314. #else
  315. #if HAVE_ALLOCA_H
  316. #include <alloca.h>
  317. #else
  318. #ifdef _AIX
  319.  #pragma alloca
  320. #else
  321. char *alloca ();
  322. #endif
  323. #endif
  324. #endif
  325. "
  326. echo checking for alloca
  327. cat > conftest.c <<EOF
  328. $decl
  329. main() { exit(0); } 
  330. t() { char *p = (char *) alloca(1); }
  331. EOF
  332. if eval $compile; then
  333.   :
  334. else
  335.   alloca_missing=1
  336. fi
  337. rm -f conftest*
  338.  
  339. if test -n "$alloca_missing"; then
  340.   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
  341.   # that cause trouble.  Some versions do not even contain alloca or
  342.   # contain a buggy version.  If you still want to use their alloca,
  343.   # use ar to extract alloca.o from them instead of compiling alloca.c.
  344.   ALLOCA=alloca.o
  345. fi
  346.  
  347. prog='/* Ultrix mips cc rejects this.  */
  348. typedef int charset[2]; const charset x;
  349. /* SunOS 4.1.1 cc rejects this. */
  350. char const *const *p;
  351. char **p2;
  352. /* HPUX 7.0 cc rejects these. */
  353. ++p;
  354. p2 = (char const* const*) p;'
  355. echo checking for working const
  356. cat > conftest.c <<EOF
  357.  
  358. main() { exit(0); } 
  359. t() { $prog }
  360. EOF
  361. if eval $compile; then
  362.   :
  363. else
  364.   DEFS="$DEFS -Dconst="
  365. fi
  366. rm -f conftest*
  367.  
  368.  
  369. if test -z "$prefix"
  370. then
  371.   echo checking for gcc to derive installation directory prefix
  372.   saveifs="$IFS"; IFS="$IFS:"
  373.   for dir in $PATH; do
  374.     test -z "$dir" && dir=.
  375.     if test $dir != . && test -f $dir/gcc; then
  376.       # Not all systems have dirname.
  377.       prefix=`echo $dir|sed 's%/[^/][^/]*$%%'`
  378.       break
  379.     fi
  380.   done
  381.   IFS="$saveifs"
  382. fi
  383.  
  384.  
  385. if test -n "$prefix"; then
  386.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  387.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  388. fi
  389. if test -n "$exec_prefix"; then
  390.   prsub="$prsub
  391. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%\
  392. exec_prefix\\1=\\2$exec_prefix%"
  393. fi
  394.  
  395. trap 'rm -f config.status; exit 1' 1 3 15
  396. echo creating config.status
  397. rm -f config.status
  398. cat > config.status <<EOF
  399. #!/bin/sh
  400. # Generated automatically by configure.
  401. # Run this file to recreate the current configuration.
  402. # This directory was configured as follows,
  403. # on host `(hostname || uname -n) 2>/dev/null`:
  404. #
  405. # $0 $*
  406.  
  407. for arg
  408. do
  409.   case "\$arg" in
  410.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  411.     exec /bin/sh $0 $* ;;
  412.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  413.   esac
  414. done
  415.  
  416. trap 'rm -f Makefile doc/Makefile test/Makefile; exit 1' 1 3 15
  417. CC='$CC'
  418. INSTALL='$INSTALL'
  419. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  420. INSTALL_DATA='$INSTALL_DATA'
  421. CPP='$CPP'
  422. ALLOCA='$ALLOCA'
  423. LIBS='$LIBS'
  424. srcdir='$srcdir'
  425. DEFS='$DEFS'
  426. prefix='$prefix'
  427. exec_prefix='$exec_prefix'
  428. prsub='$prsub'
  429. EOF
  430. cat >> config.status <<\EOF
  431.  
  432. top_srcdir=$srcdir
  433. for file in .. Makefile doc/Makefile test/Makefile; do if [ "x$file" != "x.." ]; then
  434.   srcdir=$top_srcdir
  435.   # Remove last slash and all that follows it.  Not all systems have dirname.
  436.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  437.   if test "$dir" != "$file"; then
  438.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  439.     test ! -d $dir && mkdir $dir
  440.   fi
  441.   echo creating $file
  442.   rm -f $file
  443.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  444.   sed -e "
  445. $prsub
  446. s%@CC@%$CC%g
  447. s%@INSTALL@%$INSTALL%g
  448. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  449. s%@INSTALL_DATA@%$INSTALL_DATA%g
  450. s%@CPP@%$CPP%g
  451. s%@ALLOCA@%$ALLOCA%g
  452. s%@LIBS@%$LIBS%g
  453. s%@srcdir@%$srcdir%g
  454. s%@DEFS@%$DEFS%
  455. " $top_srcdir/${file}.in >> $file
  456. fi; done
  457.  
  458. exit 0
  459. EOF
  460. chmod +x config.status
  461. test -n "$no_create" || ./config.status
  462.  
  463.