llvm.org GIT mirror llvm / 8525fad
Port the detection of zlib from the main autoconf system to the sample project's autoconf. This is the last of the missing optional checks used by libSupport that seemed to be missing from the sample project, but I could easily have missed some as this was done by inspection when Craig asked me to add the terminfo support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188618 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 6 years ago
2 changed file(s) with 327 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
534534 *) AC_MSG_ERROR([Invalid setting for --enable-pthreads. Use "yes" or "no"]) ;;
535535 esac
536536
537 dnl Allow disablement of zlib
538 AC_ARG_ENABLE(zlib,
539 AS_HELP_STRING([--enable-zlib],
540 [Use zlib for compression/decompression if
541 available (default is YES)]),,
542 enableval=default)
543 case "$enableval" in
544 yes) AC_SUBST(LLVM_ENABLE_ZLIB,[1]) ;;
545 no) AC_SUBST(LLVM_ENABLE_ZLIB,[0]) ;;
546 default) AC_SUBST(LLVM_ENABLE_ZLIB,[1]) ;;
547 *) AC_MSG_ERROR([Invalid setting for --enable-zlib. Use "yes" or "no"]) ;;
548 esac
549 AC_DEFINE_UNQUOTED([LLVM_ENABLE_ZLIB],$LLVM_ENABLE_ZLIB,
550 [Define if zlib is enabled])
551
537552 dnl Allow building without position independent code
538553 AC_ARG_ENABLE(pic,
539554 AS_HELP_STRING([--enable-pic],
11171132 [Have pthread_getspecific]))
11181133 fi
11191134
1135 dnl zlib is optional; used for compression/uncompression
1136 if test "$LLVM_ENABLE_ZLIB" -eq 1 ; then
1137 AC_CHECK_LIB(z, compress2)
1138 fi
1139
11201140 dnl Allow extra x86-disassembler library
11211141 AC_ARG_WITH(udis86,
11221142 AS_HELP_STRING([--with-udis86=],
12021222 else
12031223 AC_SUBST(HAVE_PTHREAD, 0)
12041224 fi
1225 if test "$LLVM_ENABLE_ZLIB" -eq 1 ; then
1226 AC_CHECK_HEADERS(zlib.h,
1227 AC_SUBST(HAVE_LIBZ, 1),
1228 AC_SUBST(HAVE_LIBZ, 0))
1229 else
1230 AC_SUBST(HAVE_LIBZ, 0)
1231 fi
12051232
12061233 dnl Try to find ffi.h.
12071234 if test "$llvm_cv_enable_libffi" = "yes" ; then
697697 ENABLE_DOXYGEN
698698 ENABLE_THREADS
699699 ENABLE_PTHREADS
700 LLVM_ENABLE_ZLIB
700701 ENABLE_PIC
701702 ENABLE_SHARED
702703 ENABLE_EMBED_STDCXX
765766 USE_UDIS86
766767 USE_OPROFILE
767768 HAVE_PTHREAD
769 HAVE_LIBZ
768770 HUGE_VAL_SANITY
769771 MMAP_FILE
770772 SHLIBEXT
13931395 --enable-doxygen Build doxygen documentation (default is NO)
13941396 --enable-threads Use threads if available (default is YES)
13951397 --enable-pthreads Use pthreads if available (default is YES)
1398 --enable-zlib Use zlib for compression/decompression if available
1399 (default is YES)
13961400 --enable-pic Build LLVM with Position Independent Code (default
13971401 is YES)
13981402 --enable-shared Build a shared library and link tools against it
52035207 { (exit 1); exit 1; }; } ;;
52045208 esac
52055209
5210 # Check whether --enable-zlib was given.
5211 if test "${enable_zlib+set}" = set; then
5212 enableval=$enable_zlib;
5213 else
5214 enableval=default
5215 fi
5216
5217 case "$enableval" in
5218 yes) LLVM_ENABLE_ZLIB=1
5219 ;;
5220 no) LLVM_ENABLE_ZLIB=0
5221 ;;
5222 default) LLVM_ENABLE_ZLIB=1
5223 ;;
5224 *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-zlib. Use \"yes\" or \"no\"" >&5
5225 echo "$as_me: error: Invalid setting for --enable-zlib. Use \"yes\" or \"no\"" >&2;}
5226 { (exit 1); exit 1; }; } ;;
5227 esac
5228
5229 cat >>confdefs.h <<_ACEOF
5230 #define LLVM_ENABLE_ZLIB $LLVM_ENABLE_ZLIB
5231 _ACEOF
5232
5233
52065234 # Check whether --enable-pic was given.
52075235 if test "${enable_pic+set}" = set; then
52085236 enableval=$enable_pic;
1035410382 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1035510383 lt_status=$lt_dlunknown
1035610384 cat > conftest.$ac_ext <
10357 #line 10358 "configure"
10385 #line 10386 "configure"
1035810386 #include "confdefs.h"
1035910387
1036010388 #if HAVE_DLFCN_H
1329613324
1329713325 fi
1329813326
13327 if test "$LLVM_ENABLE_ZLIB" -eq 1 ; then
13328
13329 { echo "$as_me:$LINENO: checking for compress2 in -lz" >&5
13330 echo $ECHO_N "checking for compress2 in -lz... $ECHO_C" >&6; }
13331 if test "${ac_cv_lib_z_compress2+set}" = set; then
13332 echo $ECHO_N "(cached) $ECHO_C" >&6
13333 else
13334 ac_check_lib_save_LIBS=$LIBS
13335 LIBS="-lz $LIBS"
13336 cat >conftest.$ac_ext <<_ACEOF
13337 /* confdefs.h. */
13338 _ACEOF
13339 cat confdefs.h >>conftest.$ac_ext
13340 cat >>conftest.$ac_ext <<_ACEOF
13341 /* end confdefs.h. */
13342
13343 /* Override any GCC internal prototype to avoid an error.
13344 Use char because int might match the return type of a GCC
13345 builtin and then its argument prototype would still apply. */
13346 #ifdef __cplusplus
13347 extern "C"
13348 #endif
13349 char compress2 ();
13350 int
13351 main ()
13352 {
13353 return compress2 ();
13354 ;
13355 return 0;
13356 }
13357 _ACEOF
13358 rm -f conftest.$ac_objext conftest$ac_exeext
13359 if { (ac_try="$ac_link"
13360 case "(($ac_try" in
13361 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13362 *) ac_try_echo=$ac_try;;
13363 esac
13364 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13365 (eval "$ac_link") 2>conftest.er1
13366 ac_status=$?
13367 grep -v '^ *+' conftest.er1 >conftest.err
13368 rm -f conftest.er1
13369 cat conftest.err >&5
13370 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13371 (exit $ac_status); } &&
13372 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
13373 { (case "(($ac_try" in
13374 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13375 *) ac_try_echo=$ac_try;;
13376 esac
13377 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13378 (eval "$ac_try") 2>&5
13379 ac_status=$?
13380 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13381 (exit $ac_status); }; } &&
13382 { ac_try='test -s conftest$ac_exeext'
13383 { (case "(($ac_try" in
13384 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13385 *) ac_try_echo=$ac_try;;
13386 esac
13387 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13388 (eval "$ac_try") 2>&5
13389 ac_status=$?
13390 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13391 (exit $ac_status); }; }; then
13392 ac_cv_lib_z_compress2=yes
13393 else
13394 echo "$as_me: failed program was:" >&5
13395 sed 's/^/| /' conftest.$ac_ext >&5
13396
13397 ac_cv_lib_z_compress2=no
13398 fi
13399
13400 rm -f core conftest.err conftest.$ac_objext \
13401 conftest$ac_exeext conftest.$ac_ext
13402 LIBS=$ac_check_lib_save_LIBS
13403 fi
13404 { echo "$as_me:$LINENO: result: $ac_cv_lib_z_compress2" >&5
13405 echo "${ECHO_T}$ac_cv_lib_z_compress2" >&6; }
13406 if test $ac_cv_lib_z_compress2 = yes; then
13407 cat >>confdefs.h <<_ACEOF
13408 #define HAVE_LIBZ 1
13409 _ACEOF
13410
13411 LIBS="-lz $LIBS"
13412
13413 fi
13414
13415 fi
13416
1329913417
1330013418 # Check whether --with-udis86 was given.
1330113419 if test "${with_udis86+set}" = set; then
1578615904
1578715905 else
1578815906 HAVE_PTHREAD=0
15907
15908 fi
15909 if test "$LLVM_ENABLE_ZLIB" -eq 1 ; then
15910
15911 for ac_header in zlib.h
15912 do
15913 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
15914 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
15915 { echo "$as_me:$LINENO: checking for $ac_header" >&5
15916 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
15917 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
15918 echo $ECHO_N "(cached) $ECHO_C" >&6
15919 fi
15920 ac_res=`eval echo '${'$as_ac_Header'}'`
15921 { echo "$as_me:$LINENO: result: $ac_res" >&5
15922 echo "${ECHO_T}$ac_res" >&6; }
15923 else
15924 # Is the header compilable?
15925 { echo "$as_me:$LINENO: checking $ac_header usability" >&5
15926 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
15927 cat >conftest.$ac_ext <<_ACEOF
15928 /* confdefs.h. */
15929 _ACEOF
15930 cat confdefs.h >>conftest.$ac_ext
15931 cat >>conftest.$ac_ext <<_ACEOF
15932 /* end confdefs.h. */
15933 $ac_includes_default
15934 #include <$ac_header>
15935 _ACEOF
15936 rm -f conftest.$ac_objext
15937 if { (ac_try="$ac_compile"
15938 case "(($ac_try" in
15939 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
15940 *) ac_try_echo=$ac_try;;
15941 esac
15942 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
15943 (eval "$ac_compile") 2>conftest.er1
15944 ac_status=$?
15945 grep -v '^ *+' conftest.er1 >conftest.err
15946 rm -f conftest.er1
15947 cat conftest.err >&5
15948 echo "$as_me:$LINENO: \$? = $ac_status" >&5
15949 (exit $ac_status); } &&
15950 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
15951 { (case "(($ac_try" in
15952 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
15953 *) ac_try_echo=$ac_try;;
15954 esac
15955 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
15956 (eval "$ac_try") 2>&5
15957 ac_status=$?
15958 echo "$as_me:$LINENO: \$? = $ac_status" >&5
15959 (exit $ac_status); }; } &&
15960 { ac_try='test -s conftest.$ac_objext'
15961 { (case "(($ac_try" in
15962 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
15963 *) ac_try_echo=$ac_try;;
15964 esac
15965 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
15966 (eval "$ac_try") 2>&5
15967 ac_status=$?
15968 echo "$as_me:$LINENO: \$? = $ac_status" >&5
15969 (exit $ac_status); }; }; then
15970 ac_header_compiler=yes
15971 else
15972 echo "$as_me: failed program was:" >&5
15973 sed 's/^/| /' conftest.$ac_ext >&5
15974
15975 ac_header_compiler=no
15976 fi
15977
15978 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15979 { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
15980 echo "${ECHO_T}$ac_header_compiler" >&6; }
15981
15982 # Is the header present?
15983 { echo "$as_me:$LINENO: checking $ac_header presence" >&5
15984 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
15985 cat >conftest.$ac_ext <<_ACEOF
15986 /* confdefs.h. */
15987 _ACEOF
15988 cat confdefs.h >>conftest.$ac_ext
15989 cat >>conftest.$ac_ext <<_ACEOF
15990 /* end confdefs.h. */
15991 #include <$ac_header>
15992 _ACEOF
15993 if { (ac_try="$ac_cpp conftest.$ac_ext"
15994 case "(($ac_try" in
15995 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
15996 *) ac_try_echo=$ac_try;;
15997 esac
15998 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
15999 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
16000 ac_status=$?
16001 grep -v '^ *+' conftest.er1 >conftest.err
16002 rm -f conftest.er1
16003 cat conftest.err >&5
16004 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16005 (exit $ac_status); } >/dev/null; then
16006 if test -s conftest.err; then
16007 ac_cpp_err=$ac_c_preproc_warn_flag
16008 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
16009 else
16010 ac_cpp_err=
16011 fi
16012 else
16013 ac_cpp_err=yes
16014 fi
16015 if test -z "$ac_cpp_err"; then
16016 ac_header_preproc=yes
16017 else
16018 echo "$as_me: failed program was:" >&5
16019 sed 's/^/| /' conftest.$ac_ext >&5
16020
16021 ac_header_preproc=no
16022 fi
16023
16024 rm -f conftest.err conftest.$ac_ext
16025 { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
16026 echo "${ECHO_T}$ac_header_preproc" >&6; }
16027
16028 # So? What about this header?
16029 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
16030 yes:no: )
16031 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
16032 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
16033 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
16034 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
16035 ac_header_preproc=yes
16036 ;;
16037 no:yes:* )
16038 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
16039 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
16040 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
16041 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
16042 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
16043 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
16044 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
16045 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
16046 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
16047 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
16048 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
16049 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
16050 ( cat <<\_ASBOX
16051 ## ------------------------------ ##
16052 ## Report this to bugs@yourdomain ##
16053 ## ------------------------------ ##
16054 _ASBOX
16055 ) | sed "s/^/$as_me: WARNING: /" >&2
16056 ;;
16057 esac
16058 { echo "$as_me:$LINENO: checking for $ac_header" >&5
16059 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
16060 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
16061 echo $ECHO_N "(cached) $ECHO_C" >&6
16062 else
16063 eval "$as_ac_Header=\$ac_header_preproc"
16064 fi
16065 ac_res=`eval echo '${'$as_ac_Header'}'`
16066 { echo "$as_me:$LINENO: result: $ac_res" >&5
16067 echo "${ECHO_T}$ac_res" >&6; }
16068
16069 fi
16070 if test `eval echo '${'$as_ac_Header'}'` = yes; then
16071 cat >>confdefs.h <<_ACEOF
16072 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
16073 _ACEOF
16074 HAVE_LIBZ=1
16075
16076 else
16077 HAVE_LIBZ=0
16078
16079 fi
16080
16081 done
16082
16083 else
16084 HAVE_LIBZ=0
1578916085
1579016086 fi
1579116087
2194122237 for ac_last_try in false false false false false :; do
2194222238 cat >conf$$subs.sed <<_ACEOF
2194322239 ENABLE_PTHREADS!$ENABLE_PTHREADS$ac_delim
22240 LLVM_ENABLE_ZLIB!$LLVM_ENABLE_ZLIB$ac_delim
2194422241 ENABLE_PIC!$ENABLE_PIC$ac_delim
2194522242 ENABLE_SHARED!$ENABLE_SHARED$ac_delim
2194622243 ENABLE_EMBED_STDCXX!$ENABLE_EMBED_STDCXX$ac_delim
2200922306 USE_UDIS86!$USE_UDIS86$ac_delim
2201022307 USE_OPROFILE!$USE_OPROFILE$ac_delim
2201122308 HAVE_PTHREAD!$HAVE_PTHREAD$ac_delim
22309 HAVE_LIBZ!$HAVE_LIBZ$ac_delim
2201222310 HUGE_VAL_SANITY!$HUGE_VAL_SANITY$ac_delim
2201322311 MMAP_FILE!$MMAP_FILE$ac_delim
2201422312 SHLIBEXT!$SHLIBEXT$ac_delim
2203222330 LTLIBOBJS!$LTLIBOBJS$ac_delim
2203322331 _ACEOF
2203422332
22035 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 90; then
22333 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 92; then
2203622334 break
2203722335 elif $ac_last_try; then
2203822336 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5