home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / indent / configure < prev    next >
Text File  |  1999-05-29  |  11KB  |  437 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=indent.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. if test -z "$CC"; then
  115.   echo checking for gcc
  116.   saveifs="$IFS"; IFS="${IFS}:"
  117.   for dir in $PATH; do
  118.     test -z "$dir" && dir=.
  119.     if test -f $dir/gcc; then
  120.       CC="gcc"
  121.       break
  122.     fi
  123.   done
  124.   IFS="$saveifs"
  125. fi
  126. test -z "$CC" && CC="cc"
  127.  
  128. # Find out if we are using GNU C, under whatever name.
  129. cat > conftest.c <<EOF
  130. #ifdef __GNUC__
  131.   yes
  132. #endif
  133. EOF
  134. ${CC-cc} -E conftest.c > conftest.out 2>&1
  135. if egrep yes conftest.out >/dev/null 2>&1; then
  136.   GCC=1 # For later tests.
  137. fi
  138. rm -f conftest*
  139.  
  140. echo checking how to run the C preprocessor
  141. if test -z "$CPP"; then
  142.   CPP='${CC-cc} -E'
  143.   cat > conftest.c <<EOF
  144. #include <stdio.h>
  145. EOF
  146. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  147. if test -z "$err"; then
  148.   :
  149. else
  150.   CPP=/lib/cpp
  151. fi
  152. rm -f conftest*
  153. fi
  154.  
  155. # Make sure to not get the incompatible SysV /etc/install and
  156. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  157. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  158. # or the AFS install, which mishandles nonexistent args.  (Sigh.)
  159. if test -z "$INSTALL"; then
  160.   echo checking for install
  161.   saveifs="$IFS"; IFS="${IFS}:"
  162.   for dir in $PATH; do
  163.     test -z "$dir" && dir=.
  164.     case $dir in
  165.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;;
  166.     *)
  167.       if test -f $dir/install; then
  168.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  169.       : # AIX
  170.     else
  171.       INSTALL="$dir/install -c"
  172.       INSTALL_PROGRAM='$(INSTALL)'
  173.       INSTALL_DATA='$(INSTALL) -m 644'
  174.       break
  175.     fi
  176.       fi
  177.       ;;
  178.     esac
  179.   done
  180.   IFS="$saveifs"
  181. fi
  182. INSTALL=${INSTALL-cp}
  183. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  184. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  185.  
  186. echo checking for AIX
  187. cat > conftest.c <<EOF
  188. #ifdef _AIX
  189.   yes
  190. #endif
  191.  
  192. EOF
  193. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  194. if egrep "yes" conftest.out >/dev/null 2>&1; then
  195.   DEFS="$DEFS -D_ALL_SOURCE=1"
  196. fi
  197. rm -f conftest*
  198.  
  199.  
  200. echo checking for minix/config.h
  201. cat > conftest.c <<EOF
  202. #include <minix/config.h>
  203. EOF
  204. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  205. if test -z "$err"; then
  206.   MINIX=1
  207. fi
  208. rm -f conftest*
  209.  
  210. # The Minix shell can't assign to the same variable on the same line!
  211. if test -n "$MINIX"; then
  212.   DEFS="$DEFS -D_POSIX_SOURCE=1"
  213.   DEFS="$DEFS -D_POSIX_1_SOURCE=2"
  214.   DEFS="$DEFS -D_MINIX=1"
  215. fi
  216.  
  217. echo checking for POSIXized ISC
  218. if test -d /etc/conf/kconfig.d &&
  219.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  220. then
  221.   ISC=1 # If later tests want to check for ISC.
  222.   DEFS="$DEFS -D_POSIX_SOURCE=1"
  223.   if test -n "$GCC"; then
  224.     CC="$CC -posix"
  225.   else
  226.     CC="$CC -Xp"
  227.   fi
  228. fi
  229.  
  230. echo checking for BSD string and memory functions
  231. cat > conftest.c <<EOF
  232. #include <strings.h>
  233. main() { exit(0); } 
  234. t() { rindex(0, 0); bzero(0, 0); }
  235. EOF
  236. if eval $compile; then
  237.   :
  238. else
  239.   DEFS="$DEFS -DUSG=1"
  240. fi
  241. rm -f conftest*
  242.  
  243. for func in memcpy
  244. do
  245. echo checking for ${func}
  246. cat > conftest.c <<EOF
  247.  
  248. main() { exit(0); } 
  249. t() { 
  250. /* Override any gcc2 internal prototype to avoid an error.  */
  251. extern char ${func}(); ${func}(); }
  252. EOF
  253. if eval $compile; then
  254.   :
  255. else
  256.   LIBOBJS="$LIBOBJS ${func}.o"
  257. fi
  258. rm -f conftest*
  259.  
  260. done
  261.  
  262. echo checking for unistd.h
  263. cat > conftest.c <<EOF
  264. #include <unistd.h>
  265. EOF
  266. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  267. if test -z "$err"; then
  268.   DEFS="$DEFS -DHAVE_UNISTD_H=1"
  269. fi
  270. rm -f conftest*
  271.  
  272. echo checking for directory library header
  273. echo checking for dirent.h
  274. cat > conftest.c <<EOF
  275. #include <dirent.h>
  276. EOF
  277. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  278. if test -z "$err"; then
  279.   DEFS="$DEFS -DDIRENT=1" dirheader=dirent.h
  280. fi
  281. rm -f conftest*
  282.  
  283. if test -z "$dirheader"; then
  284. echo checking for sys/ndir.h
  285. cat > conftest.c <<EOF
  286. #include <sys/ndir.h>
  287. EOF
  288. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  289. if test -z "$err"; then
  290.   DEFS="$DEFS -DSYSNDIR=1" dirheader=sys/ndir.h
  291. fi
  292. rm -f conftest*
  293.  
  294. fi
  295. if test -z "$dirheader"; then
  296. echo checking for sys/dir.h
  297. cat > conftest.c <<EOF
  298. #include <sys/dir.h>
  299. EOF
  300. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  301. if test -z "$err"; then
  302.   DEFS="$DEFS -DSYSDIR=1" dirheader=sys/dir.h
  303. fi
  304. rm -f conftest*
  305.  
  306. fi
  307. if test -z "$dirheader"; then
  308. echo checking for ndir.h
  309. cat > conftest.c <<EOF
  310. #include <ndir.h>
  311. EOF
  312. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  313. if test -z "$err"; then
  314.   DEFS="$DEFS -DNDIR=1" dirheader=ndir.h
  315. fi
  316. rm -f conftest*
  317.  
  318. fi
  319.  
  320. echo checking for closedir return value
  321. cat > conftest.c <<EOF
  322. #include <sys/types.h>
  323. #include <$dirheader>
  324. int closedir(); main() { exit(0); }
  325. EOF
  326. eval $compile
  327. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  328.   :
  329. else
  330.   DEFS="$DEFS -DVOID_CLOSEDIR=1"
  331. fi
  332. rm -f conftest*
  333.  
  334. if test -z "$dirheader"; then
  335.   DEFS="$DEFS -DNODIR=1"
  336. fi
  337. echo checking for Xenix
  338. cat > conftest.c <<EOF
  339. #if defined(M_XENIX) && !defined(M_UNIX)
  340.   yes
  341. #endif
  342.  
  343. EOF
  344. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  345. if egrep "yes" conftest.out >/dev/null 2>&1; then
  346.   XENIX=1
  347. fi
  348. rm -f conftest*
  349.  
  350. if test -n "$XENIX"; then
  351.   DEFS="$DEFS -DVOID_CLOSEDIR=1"
  352.   LIBS="$LIBS -lx"
  353.   case "$DEFS" in
  354.   *SYSNDIR*) ;;
  355.   *) LIBS="-ldir $LIBS" ;; # Make sure -ldir precedes any -lx.
  356.   esac
  357. fi
  358.  
  359. if test -n "$prefix"; then
  360.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  361.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  362. fi
  363. if test -n "$exec_prefix"; then
  364.   prsub="$prsub
  365. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%\
  366. exec_prefix\\1=\\2$exec_prefix%"
  367. fi
  368.  
  369. trap 'rm -f config.status; exit 1' 1 3 15
  370. echo creating config.status
  371. rm -f config.status
  372. cat > config.status <<EOF
  373. #!/bin/sh
  374. # Generated automatically by configure.
  375. # Run this file to recreate the current configuration.
  376. # This directory was configured as follows,
  377. # on host `(hostname || uname -n) 2>/dev/null`:
  378. #
  379. # $0 $*
  380.  
  381. for arg
  382. do
  383.   case "\$arg" in
  384.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  385.     exec /bin/sh $0 $* ;;
  386.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  387.   esac
  388. done
  389.  
  390. trap 'rm -f makefile; exit 1' 1 3 15
  391. CC='$CC'
  392. CPP='$CPP'
  393. INSTALL='$INSTALL'
  394. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  395. INSTALL_DATA='$INSTALL_DATA'
  396. LIBOBJS='$LIBOBJS'
  397. LIBS='$LIBS'
  398. srcdir='$srcdir'
  399. DEFS='$DEFS'
  400. prefix='$prefix'
  401. exec_prefix='$exec_prefix'
  402. prsub='$prsub'
  403. EOF
  404. cat >> config.status <<\EOF
  405.  
  406. top_srcdir=$srcdir
  407. for file in .. makefile; do if [ "x$file" != "x.." ]; then
  408.   srcdir=$top_srcdir
  409.   # Remove last slash and all that follows it.  Not all systems have dirname.
  410.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  411.   if test "$dir" != "$file"; then
  412.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  413.     test ! -d $dir && mkdir $dir
  414.   fi
  415.   echo creating $file
  416.   rm -f $file
  417.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  418.   sed -e "
  419. $prsub
  420. s%@CC@%$CC%g
  421. s%@CPP@%$CPP%g
  422. s%@INSTALL@%$INSTALL%g
  423. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  424. s%@INSTALL_DATA@%$INSTALL_DATA%g
  425. s%@LIBOBJS@%$LIBOBJS%g
  426. s%@LIBS@%$LIBS%g
  427. s%@srcdir@%$srcdir%g
  428. s%@DEFS@%$DEFS%
  429. " $top_srcdir/${file}.in >> $file
  430. fi; done
  431.  
  432. exit 0
  433. EOF
  434. chmod +x config.status
  435. test -n "$no_create" || ./config.status
  436.  
  437.