home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / tput-1.0 / configure < prev    next >
Encoding:
Text File  |  1991-07-10  |  3.2 KB  |  130 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. trap 'rm -f defstest defstest.c Makefile; exit 1' 1 3 15
  20.  
  21. set +u # Make sure unset variables are ok.
  22.  
  23. # Make sure we don't find the System V /etc/install.
  24. PATH=`echo $PATH|sed 's,^:,|,
  25. s,:$,|,
  26. s,:/usr/etc,,g
  27. s,/usr/etc:,,g
  28. s,:/etc,,g
  29. s,/etc:,,g
  30. s,|,:,g'`
  31.  
  32. if test "$RANDOM" = "$RANDOM"; then
  33.   # Plain old Bourne shell.
  34.   echo checking for gcc
  35.   test -z "$CC" -a -n "`gcc 2>&1`" && CC="gcc -O"
  36.  
  37.   echo checking for install
  38.   if test -z "$INSTALL" -a -n "`install 2>&1`"; then
  39.     INSTALL="install -c"
  40.   fi
  41. else
  42.   # ksh, bash or zsh.
  43.   echo checking for gcc
  44.   test -z "$CC" && type gcc && CC="gcc -O"
  45.  
  46.   echo checking for install
  47.   if test -z "$INSTALL" && type install; then
  48.     INSTALL="install -c"
  49.   fi
  50. fi
  51.  
  52. CC=${CC-cc}
  53. INSTALL=${INSTALL-cp}
  54. INCLUDEDIR=${INCLUDEDIR-/usr/include}
  55.  
  56. rm -f defstest defstest.c
  57. compile="$CC $DEFS defstest.c -o defstest $LIBS >/dev/null 2>&1"
  58.  
  59. # Check for various header files.
  60.  
  61. echo checking signal handler return type
  62. grep 'int[     ]*(\*signal[     ]*(' $INCLUDEDIR/signal.h >/dev/null 2>&1 &&
  63.   DEFS="$DEFS -DSIGTYPE=int"
  64.  
  65. echo checking for ANSI C header files
  66. echo "#include <stdlib.h>
  67. #include <string.h>
  68. main () { exit(0); strerror(0); }" > defstest.c
  69. eval $compile
  70. if test -s defstest && ./defstest 2>/dev/null; then
  71.   DEFS="$DEFS -DSTDC_HEADERS"
  72. fi
  73. rm -f defstest defstest.c
  74.  
  75. echo checking for BSD string and memory functions
  76. echo "#include <strings.h>
  77. main () { exit(0); rindex(0, 0); bzero(0, 0); }" > defstest.c
  78. eval $compile
  79. if test -s defstest && ./defstest 2>/dev/null; then :
  80.   else DEFS="$DEFS -DUSG"
  81. fi
  82. rm -f defstest defstest.c
  83.  
  84. # Check whether various functions exist.
  85.  
  86. # Functions we provide replacements for.
  87. for func in bsearch
  88. do
  89.   echo checking for $func
  90.   echo "main() { exit(0); ${func}(); }" > defstest.c
  91.   eval $compile
  92.   if test -s defstest && ./defstest 2>/dev/null; then :
  93.   else LIBOBJS="$LIBOBJS ${func}.o"
  94.   fi
  95.   rm -f defstest defstest.c
  96. done
  97.  
  98. # Check other misc. things.
  99.  
  100. echo checking how to get alloca
  101. echo '
  102. #ifdef __GNUC__
  103. #define alloca __builtin_alloca
  104. #else
  105. #ifdef sparc
  106. #include <alloca.h>
  107. #else
  108. #ifdef _AIX
  109. #pragma alloca
  110. #else
  111. char *alloca ();
  112. #endif
  113. #endif
  114. #endif
  115. main() { char *p = (char *) alloca(1); exit(0); }' > defstest.c
  116. eval $compile
  117. if test -s defstest && ./defstest 2>/dev/null; then :
  118. else LIBS="$LIBS -lPW"
  119. fi
  120. rm -f defstest defstest.c
  121.  
  122. echo '# Generated automatically from Makefile.in by configure.' > Makefile
  123. sed -e "
  124. s,@CC@,$CC,
  125. s,@INSTALL@,$INSTALL,
  126. s,@DEFS@,$DEFS,
  127. s,@LIBS@,$LIBS,
  128. s,@LIBOBJS@,$LIBOBJS,
  129. " Makefile.in >> Makefile
  130.