Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

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