home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / zip201.zip / configure < prev    next >
Text File  |  1993-09-02  |  3KB  |  98 lines

  1. :
  2. #!/bin/sh
  3. # The above : is necessary on some buggy systems.
  4.  
  5. # configure: Guess values for system-dependent variables
  6. # Output the flag definitions to stdout.
  7. # You can invoke 'configure' interactively to see the results.
  8. # When invoked with a file argument, the flags are written to this file.
  9. # To construct zip automatically using this file, type "make generic".
  10. # If this fails, then type "make list" to get a list of special targets.
  11.  
  12. trap "rm -f conftest* core; exit 1" 1 2 3 15
  13.  
  14. CFLAGS=""
  15.  
  16. echo Check for the C compiler
  17. # Check which compiler we have and if it supports -O or -O2
  18. CC=cc
  19. OPT=""
  20. echo 'int foo() {return 0;}' > conftest.c
  21.  
  22. if test -z "`(gcc -c -O2 conftest.c) 2>&1`" ; then
  23.   CC=gcc OPT="-O2"
  24. elif test -z "`(gcc -c -O conftest.c) 2>&1`" ; then
  25.   CC=gcc  OPT="-O"
  26. elif test -z "`cc -c -O  conftest.c 2>&1`" ; then
  27.   OPT="-O"
  28. fi
  29. CFLAGS="${CFLAGS} ${OPT}"
  30.  
  31. echo Check for the C preprocessor
  32. # on SVR4, cc -E does not produce correct assembler files. Need /lib/cpp.
  33. CPP="${CC} -E"
  34. [ -f /usr/lib/cpp ] && CPP=/usr/lib/cpp
  35. [ -f /lib/cpp ] && CPP=/lib/cpp
  36.  
  37. echo Check if we can use asm code
  38. OBJA=""
  39. if eval "$CPP match.s > _match.s 2>/dev/null"; then
  40.   if test ! -s _match.s || grep error < _match.s > /dev/null; then
  41.     :
  42.   elif eval "$CC -c _match.s >/dev/null 2>&1" && test -f _match.o; then
  43.     CFLAGS="${CFLAGS} -DASMV"
  44.     OBJA=match.o
  45.   fi
  46. fi
  47. rm -f _match.s _match.o
  48.  
  49. echo Check if compiler generates underlines
  50. if nm conftest.o | grep _foo > /dev/null 2>&1 ; then
  51.   :
  52. else
  53.   CPP="${CPP} -DNO_UNDERLINE"
  54. fi
  55.  
  56. rm -f conftest.c conftest.o
  57.  
  58. echo Check for BSD/SYSV
  59. OPT=""
  60. [ -f /usr/include/sys/dir.h ]    && OPT="-DSYSDIR"
  61. [ -f /usr/include/sys/ndir.h ]   && OPT="-DSYSNDIR"
  62. [ -f /usr/include/sys/dirent.h ] && OPT="-DDIRENT"
  63. [ -f /usr/include/sys/termio.h ] && OPT="-DSYSV"
  64. CFLAGS="${CFLAGS} ${OPT}"
  65.  
  66. echo Check for /usr/local/bin and /usr/local/man
  67. BINDIR=$HOME/bin
  68. [ -d /usr/local/bin ] && BINDIR=/usr/local/bin
  69.  
  70. MANDIR=manl
  71. [ -d /usr/man/manl ]       && MANDIR=/usr/man/manl
  72. [ -d /usr/local/man/manl ] && MANDIR=/usr/local/man/manl
  73. [ -d /usr/local/man/man1 ] && MANDIR=/usr/local/man/man1
  74.  
  75. LFLAGS2="-s"
  76.  
  77. echo Check for NeXT
  78. if test -f /usr/bin/hostinfo; then
  79.   if /usr/bin/hostinfo | grep NeXT > /dev/null; then
  80.     if /usr/bin/hostinfo | grep -s "Mach 1"; then
  81.        CFLAGS="-O" LFLAGS2="-s -lsys_s"
  82.  
  83.     elif /usr/bin/hostinfo | grep -s "Mach 2"; then
  84.        CFLAGS="-O" LFLAGS2="-s -object"
  85.     else
  86.        CFLAGS="-O2" LFLAGS2="-s -object"
  87.     fi
  88.   fi
  89. fi
  90.  
  91. if test $# = 0; then
  92.   echo CC=${CC} CFLAGS=\"${CFLAGS}\"  CPP=\"${CPP}\" OBJA=${OBJA}
  93.   echo BINDIR=${BINDIR} MANDIR=${MANDIR} LFLAGS2=\"${LFLAGS2}\"
  94. else
  95.   echo CC=${CC} CFLAGS=\"${CFLAGS}\"  CPP=\"${CPP}\" OBJA=${OBJA} \
  96.        BINDIR=${BINDIR} MANDIR=${MANDIR} LFLAGS2=\"${LFLAGS2}\" > $1
  97. fi
  98.