home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / zip / gnu / tinfo210.lzh / TINFO210 / C / CONFIGUR next >
Text File  |  1991-09-13  |  5KB  |  181 lines

  1. :
  2. # Guess values for system-dependant variables and create `Makefile'.
  3. # Copyright (C) 1991 Free Software Foundation, Inc.
  4.  
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2, or (at your option)
  8. # any later version.
  9.  
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14.  
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19. # Usage: configure [+srcdir=DIR] [+host=HOST] [+gas] [+nfp] [TARGET]
  20. # All args except +srcdir=DIR are ignored.
  21.  
  22. trap 'rm -f conftest conftest.c; exit 1' 1 3 15
  23.  
  24. set +u # Make sure unset variables are ok.
  25.  
  26. # Make sure we don't find the System V /etc/install.
  27. PATH=`echo $PATH|sed '
  28. s,^/etc:,,
  29. s,:/etc$,,
  30. s,:/etc:,:,g'`
  31.  
  32. # A filename unique to this package, relative to the directory that
  33. # configure is in, which we can look for to find out if srcdir is correct.
  34. unique_file=makeinfo.c
  35.  
  36. for arg in $*; do
  37.   # Handle +srcdir with a space before the argument.
  38.   if [ x$next_srcdir = xyes ]; then srcdir=$arg; next_srcdir=
  39.   # Handle +host with a space before the argument.
  40.   elif [ x$next_host = xyes ]; then next_host=
  41.   else 
  42.     case $arg in
  43.      -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
  44.     srcdir=`echo $arg | sed 's/[+-]s[a-z]*=//'` ;;
  45.      -srcdir | +srcdir | +srcdi | +srcd | +src | +sr | +s)
  46.     next_srcdir=yes ;;
  47.      -host=* | +host=* | +hos=* | +ho=* | +h=*) ;;
  48.      -host | +host | +hos | +ho | +h)
  49.     next_host=yes ;;
  50.      -gas | +gas | +ga | +g) ;;
  51.      -nfp | +nfp | +nf | +n) ;;
  52.      *) ;;
  53.     esac
  54.   fi
  55. done
  56.  
  57. vpsub='s@\$\([-./a-zA-Z0-9]*\)<@\1@g'
  58. # Find the source files, if location was not specified.
  59. if [ x$srcdir = x ]; then
  60.   srcdirdefaulted=yes; srcdir=.
  61.   if [ ! -r $unique_file ]; then srcdir=..; fi
  62. fi
  63. if [ $srcdir != . ]; then
  64.   VPATH='VPATH = $(srcdir)'
  65.   vpsub='s@\$\([-./a-zA-Z0-9]*\)<@\$<@g'
  66. fi
  67.  
  68. if [ ! -r $srcdir/$unique_file ]; then
  69.   if [ x$srcdirdefaulted = xyes ]; then
  70.     echo "$0: Can not find sources in \`.' or \`..'." 1>&2
  71.   else
  72.     echo "$0: Can not find sources in \`${srcdir}'." 1>&2
  73.   fi
  74.   exit 1
  75. fi
  76.  
  77. if test "$RANDOM" = "$RANDOM"; then
  78.   # Plain old Bourne shell.
  79.   echo checking for gcc
  80.   test -z "$CC" -a -n "`gcc 2>&1`" && CC="gcc -O"
  81.  
  82.   echo checking for install
  83.   if test -z "$INSTALL" -a -n "`install 2>&1`"; then
  84.     INSTALL="install -c"
  85.     INSTALLDATA="install -c -m 644"
  86.   fi
  87. else
  88.   # ksh, bash or zsh.  ksh and zsh write "command not found" to stderr.
  89.   echo checking for gcc
  90.   test -z "$CC" && type gcc && CC="gcc -O"
  91.  
  92.   echo checking for install
  93.   if test -z "$INSTALL" && type install; then
  94.     INSTALL="install -c"
  95.     INSTALLDATA="install -c -m 644"
  96.   fi
  97. fi
  98.  
  99. CC=${CC-cc}
  100. INSTALL=${INSTALL-cp}
  101. INSTALLDATA=${INSTALLDATA-cp}
  102. INCLUDEDIR=${INCLUDEDIR-/usr/include}
  103.  
  104. rm -f conftest conftest.c
  105. compile="$CC $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1"
  106.  
  107. # Check for various header files.
  108.  
  109. echo checking for ANSI C header files
  110. echo "#include <stdlib.h>
  111. #include <string.h>
  112. main () { exit(0); strerror(0); }" > conftest.c
  113. eval $compile
  114. if test -s conftest && ./conftest 2>/dev/null; then
  115.   DEFS="$DEFS -DSTDC_HEADERS"
  116. fi
  117. rm -f conftest conftest.c
  118.  
  119. echo checking for BSD string and memory functions
  120. echo "#include <strings.h>
  121. main () { exit(0); rindex(0, 0); bzero(0, 0); }" > conftest.c
  122. eval $compile
  123. if test -s conftest && ./conftest 2>/dev/null; then :
  124.   else DEFS="$DEFS -DUSG"
  125. fi
  126. rm -f conftest conftest.c
  127.  
  128. # Check other misc. things.
  129.  
  130. echo checking how to get alloca
  131. echo '
  132. #ifdef __GNUC__
  133. #define alloca __builtin_alloca
  134. #else
  135. #ifdef sparc
  136. #include <alloca.h>
  137. #else
  138. #ifdef _AIX
  139.  #pragma alloca
  140. #else
  141. char *alloca ();
  142. #endif
  143. #endif
  144. #endif
  145. main() { char *p = (char *) alloca(1); exit(0); }' > conftest.c
  146. eval $compile
  147. if test -s conftest && ./conftest 2>/dev/null; then :
  148. else
  149.   rm -f conftest conftest.c
  150.   echo 'char *alloca();
  151. main() { char *p = alloca(1); exit(0); }' > conftest.c
  152.   eval $compile -lPW
  153.   if test -s conftest && ./conftest 2>/dev/null; then LIBS="$LIBS -lPW"
  154.   elif test -d /usr/ucblib; then LIBS="$LIBS -L/usr/ucblib -lucb"
  155.   else ALLOCA=alloca.o
  156.   fi
  157. fi
  158. rm -f conftest conftest.c
  159.  
  160. trap 'rm -f Makefile config.status; exit 1' 1 3 15
  161.  
  162. echo '# Generated automatically from Makefile.in by configure.' > Makefile
  163. sed -e "
  164. $vpsub
  165. s,@srcdir@,$srcdir,
  166. s,@VPATH@,$VPATH,
  167. s,@CC@,$CC,
  168. s,@INSTALL@,$INSTALL,
  169. s,@INSTALLDATA@,$INSTALLDATA,
  170. s,@DEFS@,$DEFS,
  171. s,@LIBS@,$LIBS,
  172. s,@ALLOCA@,$ALLOCA,
  173. " $srcdir/Makefile.in >> Makefile
  174.  
  175. echo "CC = $CC
  176. INSTALL = $INSTALL
  177. INSTALLDATA = $INSTALLDATA
  178. DEFS = $DEFS
  179. LIBS = $LIBS
  180. ALLOCA = $ALLOCA" > config.status
  181.