1:
2#!/bin/sh -x
3# The above : is necessary on some buggy systems.
4
5# configure: Guess values for system-dependent variables
6# Output the flag definitions to the file "flags".
7#
8# Parameters: $1 = $CC, $2 = $CFLAGS, $3 = $IZ_BZIP2
9#
10# This file is typically called from Makefile rather than executed
11# from the command line.
12#
13# To construct zip automatically using this file, type
14# "make -f unix/Makefile generic".
15# If this fails, then type "make list" to get a list of special targets.
16
17trap "rm -f conftest* core a.out; exit 1" 1 2 3 15
18
19CC=${1-cc}
20CFLAGS=${2-"-I. -DUNIX"}
21LFLAGS1=''
22LFLAGS2=''
23LN="ln -s"
24
25CFLAGS_OPT=''
26
27# bzip2
28IZ_BZIP2=${3-}
29CFLAGS_BZ=''
30
31
32echo 'Check C compiler type (optimization options)'
33# Sun C?
34cat > conftest.c << _EOF_
35int main()
36{
37#ifndef __SUNPRO_C
38   bad code
39#endif
40   return 0;
41}
42_EOF_
43$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
44if test $? -eq 0; then
45  CFLAGS_OPT='-xO3'
46  echo "  Sun C ($CFLAGS_OPT)"
47else
48  # Tru64 DEC/Compaq/HP C?
49  cat > conftest.c << _EOF_
50int main()
51{
52#ifndef __DECC
53   bad code
54#endif
55   return 0;
56}
57_EOF_
58  $CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
59  if test $? -eq 0; then
60    CFLAGS_OPT='-O3'
61    echo "  DEC C ($CFLAGS_OPT)"
62  else
63    # HP-UX HP C?
64    cat > conftest.c << _EOF_
65int main()
66{
67#ifdef __GNUC__
68   bad code
69#endif
70#ifndef __hpux
71   bad code
72#endif
73   return 0;
74}
75_EOF_
76    $CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
77    if test $? -eq 0; then
78      # HP-UX, not GCC.  Lame bundled or real ANSI compiler?
79      CFLAGS_OPT_TRY="+O3 +Onolimit"
80      $CC $CFLAGS $CFLAGS_OPT_TRY -c conftest.c 2>&1 | \
81       grep '(Bundled)' > /dev/null
82      if test $? -ne 0; then
83        CFLAGS_OPT="$CFLAGS_OPT_TRY"
84        echo "  HP-UX ANSI C ($CFLAGS_OPT)"
85      else
86        echo '  HP-UX Bundled C (no opt)'
87      fi
88    else
89      # GNU C?
90      cat > conftest.c << _EOF_
91int main()
92{
93#ifndef __GNUC__
94   bad code
95#endif
96   return 0;
97}
98_EOF_
99      $CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
100      if test $? -eq 0; then
101        CFLAGS_OPT='-O3'
102        echo "  GNU C ($CFLAGS_OPT)"
103        # Special Mac OS X shared library "ld" option?
104        if test ` uname -s 2> /dev/null ` = 'Darwin'; then
105          lf='-Wl,-search_paths_first'
106          $CC $CFLAGS $lf conftest.c > /dev/null 2>/dev/null
107          if test $? -eq 0; then
108            LFLAGS2="${LFLAGS2} ${lf}"
109          fi
110          rm -f conftest
111        fi
112      else
113        CFLAGS_OPT='-O'
114        echo "  Other-unknown C ($CFLAGS_OPT)"
115      fi
116    fi
117  fi
118fi
119
120# optimization flags
121if test -n "${CFLAGS_OPT}"; then
122  CFLAGS="${CFLAGS} ${CFLAGS_OPT}"
123  CFLAGS_BZ="${CFLAGS_BZ} ${CFLAGS_OPT}"
124fi
125
126
127# bzip2
128
129echo "Check bzip2 support"
130CC_BZ="${CC}"
131LIB_BZ=''
132if test -n "${IZ_BZIP2}"; then
133  echo "  Check for bzip2 compiled library in IZ_BZIP2 (${IZ_BZIP2})"
134  if test -f "${IZ_BZIP2}/libbz2.a"; then
135#
136#   A bzip2 library built with BZ_NO_STDIO should have an
137#   unresolved external, "bz_internal_error".  The default,
138#   full-function library will not mention it.
139#
140    nm ${IZ_BZIP2}/libbz2.a | grep bz_internal_error > /dev/null
141    if test $? -eq 0; then
142      echo "    Found bzip2 BZ_NO_STDIO library, ${IZ_BZIP2}/libbz2.a"
143    else
144      echo "    Found bzip2 library, ${IZ_BZIP2}/libbz2.a,"
145      echo "      but library not compiled with BZ_NO_STDIO"
146      echo "    WARNING:  We recommend using a bzip2 library compiled"
147      echo "      with BZ_NO_STDIO defined for proper error handling"
148      echo "    Please see the Zip installation instructions in bzip2/install.txt"
149      echo "    Continuing anyway with standard bzip2 library..."
150    fi
151    if test -f "${IZ_BZIP2}/bzlib.h"; then
152      CFLAGS="${CFLAGS} -I${IZ_BZIP2} -DBZIP2_SUPPORT"
153      LFLAGS2="${LFLAGS2} -L${IZ_BZIP2} -lbz2"
154      echo "-- Found bzip2 library - linking in bzip2"
155    else
156      echo "    ${IZ_BZIP2}/bzlib.h not found"
157      echo "-- Since IZ_BZIP2 defined, skipping OS and bzip2 dir checks - no bzip2"
158    fi
159  else
160    echo "    ${IZ_BZIP2}/libbz2.a not found"
161    echo "-- Since IZ_BZIP2 defined, skipping OS and bzip2 checks - no bzip2"
162  fi
163else
164  echo "  Check for bzip2 in bzip2 directory"
165  IZ_BZIP2=bzip2
166  if test -f "${IZ_BZIP2}/libbz2.a"; then
167    nm ${IZ_BZIP2}/libbz2.a | grep bz_internal_error > /dev/null
168    if test $? -eq 0; then
169      echo "    Found bzip2 BZ_NO_STDIO library in bzip2 directory"
170    else
171      echo "    Found bzip2 library in bzip2 directory,"
172      echo "      but not built with the BZ_NO_STDIO option"
173      echo "    WARNING:  We recommend using a bzip2 library compiled"
174      echo "      with BZ_NO_STDIO defined for proper error handling"
175      echo "    Please see the Zip installation instructions"
176      echo "    Continuing anyway with standard bzip2 library..."
177    fi
178  fi
179  if test -f "bzip2/bzlib.h" -a -f "bzip2/libbz2.a"; then
180    CFLAGS="${CFLAGS} -I${IZ_BZIP2} -DBZIP2_SUPPORT"
181    LFLAGS2="${LFLAGS2} -Lbzip2 -lbz2"
182    echo "-- Found bzip2 library - linking in bzip2"
183  else
184    if test -f "bzip2/bzlib.c" -a -f "bzip2/bzlib.h"; then
185      echo "-- No library, but found bzip2 source in bzip2 directory"
186      echo "-- Will try to build bzip2 library from source and link in"
187#
188# Arrange to build a BZ_NO_STDIO bzip2 object library using the
189# same compiler and optimization options as used for Zip, and
190# to compile and link Zip with bzip2.
191#
192      CFLAGS_BZ="${CFLAGS_BZ} -DBZ_NO_STDIO"
193      LIB_BZ="bzip2/libbz2.a"
194      CFLAGS="${CFLAGS} -Ibzip2 -DBZIP2_SUPPORT"
195      LFLAGS2="${LFLAGS2} -Lbzip2 -lbz2"
196    else
197      echo "  Check if OS already has bzip2 library installed"
198      cat > conftest.c << _EOF_
199#include "bzlib.h"
200int main()
201{
202  bz_stream strm;
203  BZ2_bzCompressEnd(&strm);
204  return 0;
205}
206_EOF_
207      $CC $CFLAGS -o conftest conftest.c -lbz2 > /dev/null 2>/dev/null
208      if test $? -eq 0; then
209        echo "-- OS supports bzip2 - linking in bzip2"
210        CFLAGS="${CFLAGS} -DBZIP2_SUPPORT"
211        LFLAGS2="${LFLAGS2} -lbz2"
212      else
213        echo "-- Either bzlib.h or libbz2.a not found - no bzip2"
214      fi
215    fi
216  fi
217fi
218
219
220echo Check for the C preprocessor
221# on SVR4, cc -E does not produce correct assembler files. Need /lib/cpp.
222CPP="${CC} -E"
223# solaris as(1) needs -P, maybe others as well ?
224[ -f /usr/ccs/lib/cpp ] && CPP="/usr/ccs/lib/cpp -P"
225[ -f /usr/lib/cpp ] && CPP=/usr/lib/cpp
226[ -f /lib/cpp ] && CPP=/lib/cpp
227[ -f /usr/bin/cpp ] && CPP=/usr/bin/cpp
228[ -f /xenix ] && CPP="${CC} -E"
229[ -f /lynx.os ] && CPP="${CC} -E"
230
231echo "#include <stdio.h>" > conftest.c
232$CPP conftest.c >/dev/null 2>/dev/null || CPP="${CC} -E"
233
234
235echo Check if we can use asm code
236OBJA=""
237OCRCU8=""
238if eval "$CPP match.S > _match.s 2>/dev/null"; then
239  if test ! -s _match.s || grep error < _match.s > /dev/null; then
240    :
241  elif eval "$CC -c _match.s >/dev/null 2>/dev/null" && [ -f _match.o ]; then
242    CFLAGS="${CFLAGS} -DASMV"
243    OBJA="match.o"
244    echo "int foo() { return 0;}" > conftest.c
245    $CC -c conftest.c >/dev/null 2>/dev/null
246    echo Check if compiler generates underlines
247    nm conftest.o | grep "(^|[^_])foo" >/dev/null 2>/dev/null
248    [ $? -eq 0 ] && CPP="${CPP} -DNO_UNDERLINE"
249    if eval "$CPP crc_i386.S > _crc_i386.s 2>/dev/null"; then
250      if eval "$CC -c _crc_i386.s >/dev/null 2>/dev/null" && [ -f _crc_i386.o ]
251      then
252        OBJA="$OBJA crc_i386.o"
253        OCRCU8="crc_i386.o"
254        CFLAGS="${CFLAGS} -DASM_CRC"
255      fi
256    fi
257  fi
258fi
259rm -f _match.s _match.o _crc_i386.s _crc_i386.o
260
261
262# ANSI options for compilers that don't have __STDC__ defined by default
263# Currently HPUX, pyramid, Dynix, AIX, OSF/1 and ultrix
264
265echo Check for ANSI options
266cat > conftest.c << _EOF_
267int main()
268{
269#ifndef __STDC__
270   forget it
271#endif
272   return 0;
273}
274_EOF_
275$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
276if [ $? -ne 0 ]; then
277  for OPT in -Ae -Xa -qlanglvl=ansi -std1 -std
278  do
279    $CC $CFLAGS $OPT -c conftest.c > /dev/null 2>/dev/null
280    [ $? -eq 0 ] && CFLAGS="${CFLAGS} ${OPT}" && break
281  done
282fi
283
284
285echo Check for prototypes
286echo "int main(int argc, char *argv[]) { return 0; }" > conftest.c
287$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
288[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_PROTO"
289
290# const check currently handles mips cc and non ANSI compilers.
291# does it need more ?
292echo Check the handling of const
293cat > conftest.c << _EOF_
294typedef int charset[2];
295int main()
296{
297  const charset x;
298  const char *foo;
299  return 0;
300}
301_EOF_
302$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
303[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_CONST"
304
305
306echo Check for time_t
307cat > conftest.c << _EOF_
308#include <sys/types.h>
309#include <time.h>
310int main()
311{
312  time_t t;
313  return 0;
314}
315_EOF_
316$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
317[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_TIME_T"
318
319
320echo Check for size_t
321cat > conftest.c << _EOF_
322#include <sys/types.h>
323int main()
324{
325  size_t s;
326  return 0;
327}
328_EOF_
329$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
330[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_SIZE_T"
331
332
333echo Check for off_t
334cat > conftest.c << _EOF_
335#include <sys/types.h>
336int main()
337{
338  off_t s;
339  return 0;
340}
341_EOF_
342$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
343[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_OFF_T"
344
345
346echo Check size of UIDs and GIDs
347echo "(Now zip stores variable size UIDs/GIDs using a new extra field.  This"
348echo " tests if this OS uses 16-bit UIDs/GIDs and so if the old 16-bit storage"
349echo " should also be used for backward compatibility.)"
350# Added 2008-04-15 CS
351cat > conftest.c << _EOF_
352# define _LARGEFILE_SOURCE          /* some OSes need this for fseeko */
353# define _LARGEFILE64_SOURCE
354# define _FILE_OFFSET_BITS 64       /* select default interface as 64 bit */
355# define _LARGE_FILES               /* some OSes need this for 64-bit off_t */
356#include <sys/types.h>
357#include <sys/stat.h>
358#include <unistd.h>
359#include <stdio.h>
360int main()
361{
362  struct stat s;
363
364  printf("  s.st_uid is %u bytes\n", sizeof(s.st_uid));
365  printf("  s.st_gid is %u bytes\n", sizeof(s.st_gid));
366
367  /* see if have 16-bit UID */
368  if (sizeof(s.st_uid) != 2) {
369    return 1;
370  }
371  /* see if have 16-bit GID */
372  if (sizeof(s.st_gid) != 2) {
373    return 2;
374  }
375  return 3;
376}
377_EOF_
378# compile it
379$CC -o conftest conftest.c >/dev/null 2>/dev/null
380if [ $? -ne 0 ]; then
381  echo -- UID/GID test failed on compile - disabling old 16-bit UID/GID support
382  CFLAGS="${CFLAGS} -DUIDGID_NOT_16BIT"
383else
384# run it
385  ./conftest
386  r=$?
387  if [ $r -eq 1 ]; then
388    echo -- UID not 2 bytes - disabling old 16-bit UID/GID support
389    CFLAGS="${CFLAGS} -DUIDGID_NOT_16BIT"
390  elif [ $r -eq 2 ]; then
391    echo -- GID not 2 bytes - disabling old 16-bit UID/GID support
392    CFLAGS="${CFLAGS} -DUIDGID_NOT_16BIT"
393  elif [ $r -eq 3 ]; then
394    echo -- 16-bit UIDs and GIDs - keeping old 16-bit UID/GID support
395  else
396    echo -- test failed - conftest returned $r - disabling old 16-bit UID/GID support
397    CFLAGS="${CFLAGS} -DUIDGID_NOT_16BIT"
398  fi
399fi
400
401
402# Now we set the 64-bit file environment and check the size of off_t
403# Added 11/4/2003 EG
404# Revised 8/12/2004 EG
405
406echo Check for Large File Support
407cat > conftest.c << _EOF_
408# define _LARGEFILE_SOURCE       /* some OSes need this for fseeko */
409# define _LARGEFILE64_SOURCE
410# define _FILE_OFFSET_BITS 64       /* select default interface as 64 bit */
411# define _LARGE_FILES        /* some OSes need this for 64-bit off_t */
412#include <sys/types.h>
413#include <sys/stat.h>
414#include <unistd.h>
415#include <stdio.h>
416int main()
417{
418  off_t offset;
419  struct stat s;
420  /* see if have 64-bit off_t */
421  if (sizeof(offset) < 8)
422    return 1;
423  printf("  off_t is %d bytes\n", sizeof(off_t));
424  /* see if have 64-bit stat */
425  if (sizeof(s.st_size) < 8) {
426    printf("  s.st_size is %d bytes\n", sizeof(s.st_size));
427    return 2;
428  }
429  return 3;
430}
431_EOF_
432# compile it
433$CC -o conftest conftest.c >/dev/null 2>/dev/null
434if [ $? -ne 0 ]; then
435  echo -- no Large File Support
436else
437# run it
438  ./conftest
439  r=$?
440  if [ $r -eq 1 ]; then
441    echo -- no Large File Support - no 64-bit off_t
442  elif [ $r -eq 2 ]; then
443    echo -- no Large File Support - no 64-bit stat
444  elif [ $r -eq 3 ]; then
445    echo -- yes we have Large File Support!
446    CFLAGS="${CFLAGS} -DLARGE_FILE_SUPPORT"
447  else
448    echo -- no Large File Support - conftest returned $r
449  fi
450fi
451
452
453# Check for wide char for Unicode support
454# Added 11/24/2005 EG
455
456echo Check for wide char support
457cat > conftest.c << _EOF_
458#include <stdlib.h>
459#include <stdio.h>
460int main()
461{
462  int wsize;
463  wchar_t *wide_string;
464
465  if ((wide_string = (wchar_t *)malloc(4 * sizeof(wchar_t))) == NULL) {
466    return 0;
467  }
468  /* get wide string */
469  wsize = mbstowcs(wide_string, "foo", 3);
470  wide_string[wsize] = (wchar_t) NULL;
471  return 1;
472}
473_EOF_
474# compile it
475$CC -o conftest conftest.c >/dev/null 2>/dev/null
476# OCRCU8 is used by all utilities if Unicode is enabled
477# OCRCTB is only used by zipcloak
478if [ $? -ne 0 ]; then
479  echo -- no Unicode support
480  OCRCU8=""
481  OCRCTB="crc32_.o"
482else
483# have wide char support
484  echo -- have wchar_t - enabling Unicode support
485  CFLAGS="${CFLAGS} -DUNICODE_SUPPORT"
486  OCRCU8="crc32_.o ${OCRCU8}"
487  OCRCTB=""
488fi
489
490
491# from configure 2.4i (Onno) 12/5/04
492
493echo Check for gcc no-builtin flag
494# -fno-builtin since version 2
495cat > conftest.c << _EOF_
496int main()
497{
498#if __GNUC__ >= 2
499   return 0;
500#else
501   forget it
502#endif
503}
504_EOF_
505$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
506[ $? -eq 0 ] && BFLAG="-fno-builtin"
507
508
509# Check for missing functions
510# add NO_'function_name' to flags if missing
511
512for func in rmdir strchr strrchr rename mktemp mktime mkstemp
513do
514  echo Check for $func
515  echo "int main(){ $func(); return 0; }" > conftest.c
516  $CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
517  [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
518done
519
520
521echo Check for memset
522echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c
523$CC -o conftest conftest.c >/dev/null 2>/dev/null
524[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DZMEM"
525
526
527echo Check for memmove
528cat > conftest.c << _EOF_
529#include <string.h>
530int main() { int a; int b = 0; memmove( &a, &b, sizeof( a)); return a; }
531_EOF_
532$CC -o conftest conftest.c >/dev/null 2>/dev/null
533[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNEED_MEMMOVE"
534
535
536echo Check for strerror
537cat > conftest.c << _EOF_
538#include <string.h>
539int main() { strerror( 0); return 0; }
540_EOF_
541$CC -o conftest conftest.c >/dev/null 2>/dev/null
542[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNEED_STRERROR"
543
544echo Check for errno declaration
545cat > conftest.c << _EOF_
546#include <errno.h>
547main()
548{
549  errno = 0;
550  return 0;
551}
552_EOF_
553$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
554[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_ERRNO"
555
556
557echo Check for directory libraries
558cat > conftest.c << _EOF_
559int main() { return closedir(opendir(".")); }
560_EOF_
561
562$CC -o conftest conftest.c >/dev/null 2>/dev/null
563if [ $? -ne 0 ]; then
564  OPT=""
565  for lib in ndir dir ucb bsd BSD PW x dirent
566  do
567    $CC -o conftest conftest.c -l$lib >/dev/null 2>/dev/null
568    [ $? -eq 0 ] && OPT=-l$lib && break
569  done
570  if [ ${OPT} ]; then
571    LFLAGS2="${LFLAGS2} ${OPT}"
572  else
573    CFLAGS="${CFLAGS} -DNO_DIR"
574  fi
575fi
576
577
578# Dynix/ptx 1.3 needed this
579
580echo Check for readlink
581echo "int main(){ return readlink(); }" > conftest.c
582$CC -o conftest conftest.c >/dev/null 2>/dev/null
583if [ $? -ne 0 ]; then
584  $CC -o conftest conftest.c -lseq >/dev/null 2>/dev/null
585  [ $? -eq 0 ] && LFLAGS2="${LFLAGS2} -lseq"
586fi
587
588
589echo Check for directory include file
590OPT=""
591for inc in dirent.h sys/ndir.h ndir.h sys/dir.h
592do
593   echo "#include <$inc>" > conftest.c
594   $CPP conftest.c > /dev/null 2>/dev/null
595   [ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && break
596done
597CFLAGS="${CFLAGS} ${OPT}"
598
599
600echo Check for nonexistent include files
601for inc in stdlib.h stddef.h unistd.h fcntl.h string.h
602do
603   echo "#include <$inc>" > conftest.c
604   $CPP conftest.c >/dev/null 2>/dev/null
605   [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $inc | tr '[a-z]./' '[A-Z]__'`"
606done
607
608
609echo Check for term I/O include file
610OPT=""
611for inc in termios.h termio.h sgtty.h
612do
613   echo "#include <$inc>" > conftest.c
614   $CPP conftest.c > /dev/null 2>/dev/null
615   [ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && break
616done
617CFLAGS="${CFLAGS} ${OPT}"
618
619
620# needed for AIX (and others ?) when mmap is used
621
622echo Check for valloc
623cat > conftest.c << _EOF_
624main()
625{
626#ifdef MMAP
627    valloc();
628#endif
629}
630_EOF_
631$CC ${CFLAGS} -c conftest.c > /dev/null 2>/dev/null
632[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_VALLOC"
633
634
635echo Check for /usr/local/bin and /usr/local/man
636BINDIR=$HOME/bin
637[ -d /usr/local/bin ] && BINDIR=/usr/local/bin
638
639MANDIR=manl
640[ -d /usr/man/manl ]       && MANDIR=/usr/man/manl
641[ -d /usr/local/man/manl ] && MANDIR=/usr/local/man/manl
642[ -d /usr/local/man/man1 ] && MANDIR=/usr/local/man/man1
643
644
645echo Check for OS-specific flags
646if [ -f /usr/bin/hostinfo ]; then
647  if /usr/bin/hostinfo | grep NeXT > /dev/null; then
648    CFLAGS="${CFLAGS} -posix"
649    LFLAGS1="${LFLAGS1} -posix -object"
650  fi
651# XXX ATT6300, Cray
652elif [ -f /xenix ]; then
653  if uname -p | grep 286 > /dev/null; then
654    CFLAGS="${CFLAGS} -LARGE -Mel2 -DMEDIUM_MEM -DWSIZE=16384 -DNO_VOID"
655    LFLAGS1="${LFLAGS1} -LARGE -Mel2"
656  fi
657elif uname -X >/dev/null 2>/dev/null; then
658# SCO shared library check
659  echo "int main() { return 0;}" > conftest.c
660  $CC -o conftest conftest.c -lc_s -nointl >/dev/null 2> /dev/null
661  [ $? -eq 0 ] && LFLAGS2="-lc_s -nointl"
662else
663  SYSTEM=`uname -s 2>/dev/null` || SYSTEM="unknown"
664  echo "int main() { return 0;}" > conftest.c
665  case $SYSTEM in
666     OSF1|ULTRIX)
667        echo Check for -Olimit option
668        $CC ${CFLAGS} -Olimit 1000 -o conftest conftest.c >/dev/null 2>/dev/null
669        [ $? -eq 0 ] && CFLAGS="${CFLAGS} -Olimit 1000"
670        ;;
671###     HP-UX)
672###        echo Check for +Onolimit option
673###        $CC ${CFLAGS} +Onolimit -o conftest conftest.c >/dev/null 2>/dev/null
674###        [ $? -eq 0 ] && CFLAGS="${CFLAGS} +Onolimit"
675###        ;;
676###     SunOS)
677###        CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
678###        ;;
679  esac
680fi
681
682
683echo Check for symbolic links
684ln -s /dev/null null > /dev/null 2>/dev/null || LN=ln
685
686
687rm -f a.out conftest.c conftest.o conftest null
688
689echo CC=\"${CC}\" CFLAGS=\"${CFLAGS}\"  CPP=\"${CPP}\" OBJA=\"${OBJA}\" \
690       OCRCU8=\"${OCRCU8}\" OCRCTB=\"${OCRCTB}\" \
691       BINDIR=${BINDIR} MANDIR=${MANDIR} LFLAGS1=\"${LFLAGS1}\" \
692       LFLAGS2=\"${LFLAGS2}\" LN=\"${LN}\" \
693       CC_BZ=\"${CC_BZ}\" CFLAGS_BZ=\"${CFLAGS_BZ}\" \
694       IZ_BZIP2=\"${IZ_BZIP2}\" LIB_BZ=\"${LIB_BZ}\" > flags
695
696