configure 17 KB

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