home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / indent-1.9.1-base.tgz / indent-1.9.1-base.tar / fsf / indent / configure < prev    next >
Text File  |  1993-07-08  |  14KB  |  555 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 -fr conftest* core; exit 1' 1 3 15
  82.  
  83. # NLS nuisances.
  84. # These must not be set unconditionally because not all systems understand
  85. # e.g. LANG=C (notably SCO).
  86. if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi
  87. if test "${LANG+set}"   = 'set' ; then LANG=C;   export LANG;   fi
  88.  
  89. rm -f conftest*
  90. compile='${CC-cc} $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  91.  
  92. # A filename unique to this package, relative to the directory that
  93. # configure is in, which we can look for to find out if srcdir is correct.
  94. unique_file=indent.c
  95.  
  96. # Find the source files, if location was not specified.
  97. if test -z "$srcdir"; then
  98.   srcdirdefaulted=yes
  99.   # Try the directory containing this script, then `..'.
  100.   prog=$0
  101.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  102.   test "X$confdir" = "X$prog" && confdir=.
  103.   srcdir=$confdir
  104.   if test ! -r $srcdir/$unique_file; then
  105.     srcdir=..
  106.   fi
  107. fi
  108. if test ! -r $srcdir/$unique_file; then
  109.   if test x$srcdirdefaulted = xyes; then
  110.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  111.   else
  112.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  113.   fi
  114.   exit 1
  115. fi
  116. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  117. # But we can't avoid them for `..', to make subdirectories work.
  118. case $srcdir in
  119.   .|/*|~*) ;;
  120.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  121. esac
  122.  
  123. # Save the original args to write them into config.status later.
  124. configure_args="$*"
  125.  
  126. if test -z "$CC"; then
  127.   # Extract the first word of `gcc', so it can be a program name with args.
  128.   set dummy gcc; word=$2
  129.   echo checking for $word
  130.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  131.   for dir in $PATH; do
  132.     test -z "$dir" && dir=.
  133.     if test -f $dir/$word; then
  134.       CC="gcc"
  135.       break
  136.     fi
  137.   done
  138.   IFS="$saveifs"
  139. fi
  140. test -z "$CC" && CC="cc"
  141. test -n "$CC" -a -n "$verbose" && echo "    setting CC to $CC"
  142.  
  143. # Find out if we are using GNU C, under whatever name.
  144. cat > conftest.c <<EOF
  145. #ifdef __GNUC__
  146.   yes
  147. #endif
  148. EOF
  149. ${CC-cc} -E conftest.c > conftest.out 2>&1
  150. if egrep yes conftest.out >/dev/null 2>&1; then
  151.   GCC=1 # For later tests.
  152. fi
  153. rm -f conftest*
  154.  
  155. echo checking how to run the C preprocessor
  156. if test -z "$CPP"; then
  157.   # This must be in double quotes, not single quotes, because CPP may get
  158.   # substituted into the Makefile and ``${CC-cc}'' will simply confuse
  159.   # make.  It must be expanded now.
  160.   CPP="${CC-cc} -E"
  161.   cat > conftest.c <<EOF
  162. #include <stdio.h>
  163. Syntax Error
  164. EOF
  165. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  166. if test -z "$err"; then
  167.   :
  168. else
  169.   CPP=/lib/cpp
  170. fi
  171. rm -f conftest*
  172. fi
  173. test ".${verbose}" != "." && echo "    setting CPP to $CPP"
  174.  
  175. # Make sure to not get the incompatible SysV /etc/install and
  176. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  177. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  178. # or the AFS install, which mishandles nonexistent args, or
  179. # /usr/ucb/install on SVR4, which tries to use the nonexistent group
  180. # `staff'.  On most BSDish systems install is in /usr/bin, not /usr/ucb
  181. # anyway.  Sigh.
  182. if test "z${INSTALL}" = "z" ; then
  183.   echo checking for install
  184.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  185.   for dir in $PATH; do
  186.     test -z "$dir" && dir=.
  187.     case $dir in
  188.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
  189.     *)
  190.       if test -f $dir/installbsd; then
  191.     INSTALL="$dir/installbsd -c" # OSF1
  192.     INSTALL_PROGRAM='$(INSTALL)'
  193.     INSTALL_DATA='$(INSTALL) -m 644'
  194.     break
  195.       fi
  196.       if test -f $dir/install; then
  197.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  198.       : # AIX
  199.     else
  200.       INSTALL="$dir/install -c"
  201.       INSTALL_PROGRAM='$(INSTALL)'
  202.       INSTALL_DATA='$(INSTALL) -m 644'
  203.       break
  204.     fi
  205.       fi
  206.       ;;
  207.     esac
  208.   done
  209.   IFS="$saveifs"
  210. fi
  211. INSTALL=${INSTALL-cp}
  212. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  213. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  214.  
  215. echo checking for AIX
  216. cat > conftest.c <<EOF
  217. #ifdef _AIX
  218.   yes
  219. #endif
  220.  
  221. EOF
  222. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  223. if egrep "yes" conftest.out >/dev/null 2>&1; then
  224.   {
  225. test -n "$verbose" && \
  226. echo '    defining' _ALL_SOURCE
  227. DEFS="$DEFS -D_ALL_SOURCE=1"
  228. }
  229.  
  230. fi
  231. rm -f conftest*
  232.  
  233.  
  234. echo checking for minix/config.h
  235. cat > conftest.c <<EOF
  236. #include <minix/config.h>
  237. EOF
  238. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  239. if test -z "$err"; then
  240.   MINIX=1
  241. fi
  242. rm -f conftest*
  243.  
  244. # The Minix shell can't assign to the same variable on the same line!
  245. if test -n "$MINIX"; then
  246.   {
  247. test -n "$verbose" && \
  248. echo '    defining' _POSIX_SOURCE
  249. DEFS="$DEFS -D_POSIX_SOURCE=1"
  250. }
  251.  
  252.   {
  253. test -n "$verbose" && \
  254. echo '    defining' _POSIX_1_SOURCE to be '2'
  255. DEFS="$DEFS -D_POSIX_1_SOURCE=2"
  256. }
  257.  
  258.   {
  259. test -n "$verbose" && \
  260. echo '    defining' _MINIX
  261. DEFS="$DEFS -D_MINIX=1"
  262. }
  263.  
  264. fi
  265.  
  266. echo checking for POSIXized ISC
  267. if test -d /etc/conf/kconfig.d &&
  268.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  269. then
  270.   ISC=1 # If later tests want to check for ISC.
  271.   {
  272. test -n "$verbose" && \
  273. echo '    defining' _POSIX_SOURCE
  274. DEFS="$DEFS -D_POSIX_SOURCE=1"
  275. }
  276.  
  277.   if test -n "$GCC"; then
  278.     CC="$CC -posix"
  279.   else
  280.     CC="$CC -Xp"
  281.   fi
  282. fi
  283.  
  284. echo checking for BSD string and memory functions
  285. cat > conftest.c <<EOF
  286. #include <strings.h>
  287. int main() { exit(0); }
  288. int t() { rindex(0, 0); bzero(0, 0); }
  289. EOF
  290. if eval $compile; then
  291.   :
  292. else
  293.   {
  294. test -n "$verbose" && \
  295. echo '    defining' USG
  296. DEFS="$DEFS -DUSG=1"
  297. }
  298.  
  299. fi
  300. rm -f conftest*
  301.  
  302. for func in memcpy
  303. do
  304. echo checking for ${func}
  305. cat > conftest.c <<EOF
  306. #include <ctype.h>
  307. int main() { exit(0); }
  308. int t() { 
  309. /* The GNU C library defines this for functions which it implements
  310.     to always fail with ENOSYS.  Some functions are actually named
  311.     something starting with __ and the normal name is an alias.  */
  312. #if defined (__stub_${func}) || defined (__stub___${func})
  313. choke me
  314. #else
  315. /* Override any gcc2 internal prototype to avoid an error.  */
  316. extern char ${func}(); ${func}();
  317. #endif
  318.  }
  319. EOF
  320. if eval $compile; then
  321.   :
  322. else
  323.   LIBOBJS="$LIBOBJS ${func}.o"
  324. test -n "$verbose" && echo "    using ${func}.o instead"
  325. fi
  326. rm -f conftest*
  327.  
  328. done
  329.  
  330. echo checking for unistd.h
  331. cat > conftest.c <<EOF
  332. #include <unistd.h>
  333. EOF
  334. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  335. if test -z "$err"; then
  336.   {
  337. test -n "$verbose" && \
  338. echo '    defining' HAVE_UNISTD_H
  339. DEFS="$DEFS -DHAVE_UNISTD_H=1"
  340. }
  341.  
  342. fi
  343. rm -f conftest*
  344.  
  345. echo checking for directory library header
  346. dirheader=
  347. if test -z "$dirheader"; then
  348.   echo checking for dirent.h
  349. cat > conftest.c <<EOF
  350. #include <sys/types.h>
  351. #include <dirent.h>
  352. int main() { exit(0); }
  353. int t() { DIR *dirp = opendir ("/"); }
  354. EOF
  355. if eval $compile; then
  356.   {
  357. test -n "$verbose" && \
  358. echo '    defining' DIRENT
  359. DEFS="$DEFS -DDIRENT=1"
  360. }
  361.  dirheader=dirent.h
  362. fi
  363. rm -f conftest*
  364. fi
  365. if test -z "$dirheader"; then
  366.   echo checking for sys/ndir.h
  367. cat > conftest.c <<EOF
  368. #include <sys/types.h>
  369. #include <sys/ndir.h>
  370. int main() { exit(0); }
  371. int t() { DIR *dirp = opendir ("/"); }
  372. EOF
  373. if eval $compile; then
  374.   {
  375. test -n "$verbose" && \
  376. echo '    defining' SYSNDIR
  377. DEFS="$DEFS -DSYSNDIR=1"
  378. }
  379.  dirheader=sys/ndir.h
  380. fi
  381. rm -f conftest*
  382. fi
  383. if test -z "$dirheader"; then
  384.   echo checking for sys/dir.h
  385. cat > conftest.c <<EOF
  386. #include <sys/types.h>
  387. #include <sys/dir.h>
  388. int main() { exit(0); }
  389. int t() { DIR *dirp = opendir ("/"); }
  390. EOF
  391. if eval $compile; then
  392.   {
  393. test -n "$verbose" && \
  394. echo '    defining' SYSDIR
  395. DEFS="$DEFS -DSYSDIR=1"
  396. }
  397.  dirheader=sys/dir.h
  398. fi
  399. rm -f conftest*
  400. fi
  401. if test -z "$dirheader"; then
  402.   echo checking for ndir.h
  403. cat > conftest.c <<EOF
  404. #include <sys/types.h>
  405. #include <ndir.h>
  406. int main() { exit(0); }
  407. int t() { DIR *dirp = opendir ("/"); }
  408. EOF
  409. if eval $compile; then
  410.   {
  411. test -n "$verbose" && \
  412. echo '    defining' NDIR
  413. DEFS="$DEFS -DNDIR=1"
  414. }
  415.  dirheader=ndir.h
  416. fi
  417. rm -f conftest*
  418. fi
  419.  
  420. echo checking for closedir return value
  421. cat > conftest.c <<EOF
  422. #include <sys/types.h>
  423. #include <$dirheader>
  424. int closedir(); main() { exit(closedir(opendir(".")) != 0); }
  425. EOF
  426. eval $compile
  427. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  428.   :
  429. else
  430.   {
  431. test -n "$verbose" && \
  432. echo '    defining' VOID_CLOSEDIR
  433. DEFS="$DEFS -DVOID_CLOSEDIR=1"
  434. }
  435.  
  436. fi
  437. rm -f conftest*
  438.  
  439. if test -z "$dirheader"; then
  440.   {
  441. test -n "$verbose" && \
  442. echo '    defining' NODIR
  443. DEFS="$DEFS -DNODIR=1"
  444. }
  445.  
  446. fi
  447. echo checking for Xenix
  448. cat > conftest.c <<EOF
  449. #if defined(M_XENIX) && !defined(M_UNIX)
  450.   yes
  451. #endif
  452.  
  453. EOF
  454. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  455. if egrep "yes" conftest.out >/dev/null 2>&1; then
  456.   XENIX=1
  457. fi
  458. rm -f conftest*
  459.  
  460. if test -n "$XENIX"; then
  461.   LIBS="$LIBS -lx"
  462.   case "$DEFS" in
  463.   *SYSNDIR*) ;;
  464.   *) LIBS="-ldir $LIBS" ;; # Make sure -ldir precedes any -lx.
  465.   esac
  466. fi
  467.  
  468. if test -n "$prefix"; then
  469.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  470.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  471. fi
  472. if test -n "$exec_prefix"; then
  473.   prsub="$prsub
  474. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%"
  475. fi
  476. cat >conftest.def <<EOF
  477. $DEFS
  478. EOF
  479. escape_ampersand_and_backslash='s%[&\\]%\\&%g'
  480. DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
  481. rm -f conftest.def
  482.  
  483. trap 'rm -f config.status; exit 1' 1 3 15
  484. echo creating config.status
  485. rm -f config.status
  486. cat > config.status <<EOF
  487. #!/bin/sh
  488. # Generated automatically by configure.
  489. # Run this file to recreate the current configuration.
  490. # This directory was configured as follows,
  491. # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  492. #
  493. # $0 $configure_args
  494.  
  495. for arg
  496. do
  497.   case "\$arg" in
  498.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  499.     exec /bin/sh $0 $configure_args ;;
  500.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  501.   esac
  502. done
  503.  
  504. trap 'rm -f makefile; exit 1' 1 3 15
  505. CC='$CC'
  506. CPP='$CPP'
  507. INSTALL='$INSTALL'
  508. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  509. INSTALL_DATA='$INSTALL_DATA'
  510. LIBOBJS='$LIBOBJS'
  511. LIBS='$LIBS'
  512. srcdir='$srcdir'
  513. DEFS='$DEFS'
  514. prefix='$prefix'
  515. exec_prefix='$exec_prefix'
  516. prsub='$prsub'
  517. EOF
  518. cat >> config.status <<\EOF
  519.  
  520. top_srcdir=$srcdir
  521.  
  522. # Allow make-time overrides of the generated file list.
  523. test -n "$gen_files" || gen_files="makefile"
  524.  
  525. for file in .. $gen_files; do if [ "x$file" != "x.." ]; then
  526.   srcdir=$top_srcdir
  527.   # Remove last slash and all that follows it.  Not all systems have dirname.
  528.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  529.   if test "$dir" != "$file"; then
  530.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  531.     test ! -d $dir && mkdir $dir
  532.   fi
  533.   echo creating $file
  534.   rm -f $file
  535.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  536.   sed -e "
  537. $prsub
  538. s%@CC@%$CC%g
  539. s%@CPP@%$CPP%g
  540. s%@INSTALL@%$INSTALL%g
  541. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  542. s%@INSTALL_DATA@%$INSTALL_DATA%g
  543. s%@LIBOBJS@%$LIBOBJS%g
  544. s%@LIBS@%$LIBS%g
  545. s%@srcdir@%$srcdir%g
  546. s%@DEFS@%$DEFS%
  547. " $top_srcdir/${file}.in >> $file
  548. fi; done
  549.  
  550. exit 0
  551. EOF
  552. chmod +x config.status
  553. test -n "$no_create" || ./config.status
  554.  
  555.