llvm.org GIT mirror llvm / 7931a78
For PR351: * Add checks for sterror and strerror_r functions * Add check to determine if /dev/zero is needed for allocating RWX memory. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19148 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Spencer 15 years ago
3 changed file(s) with 142 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
442442
443443 AC_CHECK_FUNCS([backtrace getcwd getpagesize getrusage gettimeofday isatty ])
444444 AC_CHECK_FUNCS([mkdtemp mkstemp mktemp ])
445 AC_CHECK_FUNCS([realpath setrlimit strdup strtoq strtoll sysconf ])
445 AC_CHECK_FUNCS([realpath setrlimit strdup strerror strerror_r strtoll strtoq ])
446 AC_CHECK_FUNCS([sysconf])
446447 AC_C_PRINTF_A
447448 AC_FUNC_ALLOCA
448449 AC_FUNC_RAND48
458459 AC_FUNC_ISINF
459460
460461 dnl Check for mmap and mprotect support. We need both to do the JIT and for
461 dnl bytecode loading, etc.
462 dnl bytecode loading, etc. We also need to know if /dev/zero is required to
463 dnl be opened for allocating RWX memory.
462464 AC_FUNC_MMAP
463465 AC_FUNC_MMAP_FILE
466 AC_NEED_DEV_ZERO_FOR_MMAP
464467 AC_CHECK_FUNC(mprotect,,
465468 AC_MSG_ERROR([Function mprotect() required but not found]))
466469
2460024600 ETAGSFLAGS=$ETAGSFLAGS
2460124601
2460224602
24603 if test "$WITH_LLVMGCCDIR" != "default" ; then
24603 if test "$WITH_LLVMGCCDIR" = "default" ; then
2460424604 # Extract the first word of "llvm-gcc", so it can be a program name with args.
2460524605 set dummy llvm-gcc; ac_word=$2
2460624606 echo "$as_me:$LINENO: checking for $ac_word" >&5
2574925749 if test "$ac_cv_header_mmap_anon" = yes; then
2575025750
2575125751 cat >>confdefs.h <<\_ACEOF
25752 #define HAVE_MMAP_ANONYMOUS
25752 #define HAVE_MMAP_ANONYMOUS 1
2575325753 _ACEOF
2575425754
2575525755 fi
2726827268
2726927269
2727027270
27271 for ac_func in realpath setrlimit strdup strtoq strtoll sysconf
27271
27272 for ac_func in realpath setrlimit strdup strerror strerror_r strtoll strtoq
27273 do
27274 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
27275 echo "$as_me:$LINENO: checking for $ac_func" >&5
27276 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
27277 if eval "test \"\${$as_ac_var+set}\" = set"; then
27278 echo $ECHO_N "(cached) $ECHO_C" >&6
27279 else
27280 cat >conftest.$ac_ext <<_ACEOF
27281 /* confdefs.h. */
27282 _ACEOF
27283 cat confdefs.h >>conftest.$ac_ext
27284 cat >>conftest.$ac_ext <<_ACEOF
27285 /* end confdefs.h. */
27286 /* Define $ac_func to an innocuous variant, in case declares $ac_func.
27287 For example, HP-UX 11i declares gettimeofday. */
27288 #define $ac_func innocuous_$ac_func
27289
27290 /* System header to define __stub macros and hopefully few prototypes,
27291 which can conflict with char $ac_func (); below.
27292 Prefer to if __STDC__ is defined, since
27293 exists even on freestanding compilers. */
27294
27295 #ifdef __STDC__
27296 # include
27297 #else
27298 # include
27299 #endif
27300
27301 #undef $ac_func
27302
27303 /* Override any gcc2 internal prototype to avoid an error. */
27304 #ifdef __cplusplus
27305 extern "C"
27306 {
27307 #endif
27308 /* We use char because int might match the return type of a gcc2
27309 builtin and then its argument prototype would still apply. */
27310 char $ac_func ();
27311 /* The GNU C library defines this for functions which it implements
27312 to always fail with ENOSYS. Some functions are actually named
27313 something starting with __ and the normal name is an alias. */
27314 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
27315 choke me
27316 #else
27317 char (*f) () = $ac_func;
27318 #endif
27319 #ifdef __cplusplus
27320 }
27321 #endif
27322
27323 int
27324 main ()
27325 {
27326 return f != $ac_func;
27327 ;
27328 return 0;
27329 }
27330 _ACEOF
27331 rm -f conftest.$ac_objext conftest$ac_exeext
27332 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
27333 (eval $ac_link) 2>conftest.er1
27334 ac_status=$?
27335 grep -v '^ *+' conftest.er1 >conftest.err
27336 rm -f conftest.er1
27337 cat conftest.err >&5
27338 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27339 (exit $ac_status); } &&
27340 { ac_try='test -z "$ac_c_werror_flag"
27341 || test ! -s conftest.err'
27342 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
27343 (eval $ac_try) 2>&5
27344 ac_status=$?
27345 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27346 (exit $ac_status); }; } &&
27347 { ac_try='test -s conftest$ac_exeext'
27348 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
27349 (eval $ac_try) 2>&5
27350 ac_status=$?
27351 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27352 (exit $ac_status); }; }; then
27353 eval "$as_ac_var=yes"
27354 else
27355 echo "$as_me: failed program was:" >&5
27356 sed 's/^/| /' conftest.$ac_ext >&5
27357
27358 eval "$as_ac_var=no"
27359 fi
27360 rm -f conftest.err conftest.$ac_objext \
27361 conftest$ac_exeext conftest.$ac_ext
27362 fi
27363 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
27364 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
27365 if test `eval echo '${'$as_ac_var'}'` = yes; then
27366 cat >>confdefs.h <<_ACEOF
27367 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
27368 _ACEOF
27369
27370 fi
27371 done
27372
27373
27374 for ac_func in sysconf
2727227375 do
2727327376 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
2727427377 echo "$as_me:$LINENO: checking for $ac_func" >&5
2974629849
2974729850 fi
2974829851
29852 echo "$as_me:$LINENO: checking if /dev/zero is needed for mmap" >&5
29853 echo $ECHO_N "checking if /dev/zero is needed for mmap... $ECHO_C" >&6
29854 if test "${ac_cv_need_dev_zero_for_mmap+set}" = set; then
29855 echo $ECHO_N "(cached) $ECHO_C" >&6
29856 else
29857 if test "$llvm_cv_os_type" == "Interix" ; then
29858 ac_cv_need_dev_zero_for_mmap=yes
29859 else
29860 ac_cv_need_dev_zero_for_mmap=no
29861 fi
29862
29863 fi
29864 echo "$as_me:$LINENO: result: $ac_cv_need_dev_zero_for_mmap" >&5
29865 echo "${ECHO_T}$ac_cv_need_dev_zero_for_mmap" >&6
29866 if test "$ac_cv_need_dev_zero_for_mmap" = yes; then
29867
29868 cat >>confdefs.h <<\_ACEOF
29869 #define NEED_DEV_ZERO_FOR_MMAP 1
29870 _ACEOF
29871
29872 fi
2974929873 echo "$as_me:$LINENO: checking for mprotect" >&5
2975029874 echo $ECHO_N "checking for mprotect... $ECHO_C" >&6
2975129875 if test "${ac_cv_func_mprotect+set}" = set; then
269269 /* Define to 1 if you have the `strdup' function. */
270270 #undef HAVE_STRDUP
271271
272 /* Define to 1 if you have the `strerror' function. */
273 #undef HAVE_STRERROR
274
275 /* Define to 1 if you have the `strerror_r' function. */
276 #undef HAVE_STRERROR_R
277
272278 /* Define to 1 if you have the header file. */
273279 #undef HAVE_STRINGS_H
274280
383389
384390 /* Define to the system default library search path. */
385391 #undef LTDL_SYSSEARCHPATH
392
393 /* Define if /dev/zero should be used when mapping RWX memory, or undefine if
394 its not necessary */
395 #undef NEED_DEV_ZERO_FOR_MMAP
386396
387397 /* Define if dlsym() requires a leading underscore in symbol names. */
388398 #undef NEED_USCORE