From 78e2074eeeee266f4b6b212800f00e9acddecb15 Mon Sep 17 00:00:00 2001 From: Oscar Fuentes Date: Mon, 31 Jan 2011 18:25:25 +0000 Subject: Adds some platform checks to cmake/config-ix.cmake and fixes checking for dlopen/dlerror. Patch by arrowdodger! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124590 91177308-0d34-0410-b5e6-96231b3b80d8 --- cmake/config-ix.cmake | 30 +++++++++++++++++++++++++++--- include/llvm/Config/config.h.cmake | 18 +++++++++--------- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 4a87a23aed..4cb68dfb1a 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -89,6 +89,7 @@ check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE) check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE) check_symbol_exists(setrlimit sys/resource.h HAVE_SETRLIMIT) check_function_exists(isatty HAVE_ISATTY) +check_symbol_exists(index strings.h HAVE_INDEX) check_symbol_exists(isinf cmath HAVE_ISINF_IN_CMATH) check_symbol_exists(isinf math.h HAVE_ISINF_IN_MATH_H) check_symbol_exists(finite ieeefp.h HAVE_FINITE_IN_IEEEFP_H) @@ -97,6 +98,12 @@ check_symbol_exists(isnan math.h HAVE_ISNAN_IN_MATH_H) check_symbol_exists(ceilf math.h HAVE_CEILF) check_symbol_exists(floorf math.h HAVE_FLOORF) check_symbol_exists(fmodf math.h HAVE_FMODF) +if( HAVE_SETJMP_H ) + check_symbol_exists(longjmp setjmp.h HAVE_LONGJMP) + check_symbol_exists(setjmp setjmp.h HAVE_SETJMP) + check_symbol_exists(siglongjmp setjmp.h HAVE_SIGLONGJMP) + check_symbol_exists(sigsetjmp setjmp.h HAVE_SIGSETJMP) +endif() check_symbol_exists(nearbyintf math.h HAVE_NEARBYINTF) check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO) check_symbol_exists(malloc_zone_statistics malloc/malloc.h @@ -106,9 +113,11 @@ check_symbol_exists(mkstemp "stdlib.h;unistd.h" HAVE_MKSTEMP) check_symbol_exists(mktemp "stdlib.h;unistd.h" HAVE_MKTEMP) check_symbol_exists(closedir "sys/types.h;dirent.h" HAVE_CLOSEDIR) check_symbol_exists(opendir "sys/types.h;dirent.h" HAVE_OPENDIR) +check_symbol_exists(readdir "sys/types.h;dirent.h" HAVE_READDIR) check_symbol_exists(getcwd unistd.h HAVE_GETCWD) check_symbol_exists(gettimeofday sys/time.h HAVE_GETTIMEOFDAY) check_symbol_exists(getrlimit "sys/types.h;sys/time.h;sys/resource.h" HAVE_GETRLIMIT) +check_symbol_exists(rindex strings.h HAVE_RINDEX) check_symbol_exists(strchr string.h HAVE_STRCHR) check_symbol_exists(strcmp string.h HAVE_STRCMP) check_symbol_exists(strdup string.h HAVE_STRDUP) @@ -117,7 +126,18 @@ if( NOT LLVM_ON_WIN32 ) check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK) endif() check_symbol_exists(sbrk unistd.h HAVE_SBRK) +check_symbol_exists(srand48 stdlib.h HAVE_RAND48_SRAND48) +if( HAVE_RAND48_SRAND48 ) + check_symbol_exists(lrand48 stdlib.h HAVE_RAND48_LRAND48) + if( HAVE_RAND48_LRAND48 ) + check_symbol_exists(drand48 stdlib.h HAVE_RAND48_DRAND48) + if( HAVE_RAND48_DRAND48 ) + set(HAVE_RAND48 1 CACHE INTERNAL "are srand48/lrand48/drand48 available?") + endif() + endif() +endif() check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL) +check_symbol_exists(strtoq stdlib.h HAVE_STRTOQ) check_symbol_exists(strerror string.h HAVE_STRERROR) check_symbol_exists(strerror_r string.h HAVE_STRERROR_R) check_symbol_exists(strerror_s string.h HAVE_STRERROR_S) @@ -134,11 +154,15 @@ if( HAVE_ARGZ_H ) check_symbol_exists(argz_next argz.h HAVE_ARGZ_NEXT) check_symbol_exists(argz_stringify argz.h HAVE_ARGZ_STRINGIFY) endif() -if( HAVE_DLFCN_H AND HAVE_LIBDL ) - list(APPEND CMAKE_REQUIRED_LIBRARIES dl) +if( HAVE_DLFCN_H ) + if( HAVE_LIBDL ) + list(APPEND CMAKE_REQUIRED_LIBRARIES dl) + endif() check_symbol_exists(dlerror dlfcn.h HAVE_DLERROR) check_symbol_exists(dlopen dlfcn.h HAVE_DLOPEN) - list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES dl) + if( HAVE_LIBDL ) + list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES dl) + endif() endif() check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC) diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index e017dd97f1..c94abb681f 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -169,7 +169,7 @@ #cmakedefine HAVE_GV ${HAVE_GV} /* Define to 1 if you have the `index' function. */ -#undef HAVE_INDEX +#cmakedefine HAVE_INDEX ${HAVE_INDEX} /* Define to 1 if the system has the type `int64_t'. */ #cmakedefine HAVE_INT64_T ${HAVE_INT64_T} @@ -224,7 +224,7 @@ #undef HAVE_LINK_R /* Define to 1 if you have the `longjmp' function. */ -#undef HAVE_LONGJMP +#cmakedefine HAVE_LONGJMP ${HAVE_LONGJMP} /* Define to 1 if you have the header file. */ #cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H} @@ -309,16 +309,16 @@ #cmakedefine HAVE_PTHREAD_RWLOCK_INIT ${HAVE_PTHREAD_RWLOCK_INIT} /* Define to 1 if srand48/lrand48/drand48 exist in */ -#undef HAVE_RAND48 +#cmakedefine HAVE_RAND48 ${HAVE_RAND48} /* Define to 1 if you have the `readdir' function. */ -#undef HAVE_READDIR +#cmakedefine HAVE_READDIR ${HAVE_READDIR} /* Define to 1 if you have the `realpath' function. */ #undef HAVE_REALPATH /* Define to 1 if you have the `rindex' function. */ -#undef HAVE_RINDEX +#cmakedefine HAVE_RINDEX ${HAVE_RINDEX} /* Define to 1 if you have the `rintf' function. */ #undef HAVE_RINTF @@ -336,7 +336,7 @@ #cmakedefine HAVE_SETENV ${HAVE_SETENV} /* Define to 1 if you have the `setjmp' function. */ -#undef HAVE_SETJMP +#cmakedefine HAVE_SETJMP ${HAVE_SETJMP} /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SETJMP_H ${HAVE_SETJMP_H} @@ -348,13 +348,13 @@ #undef HAVE_SHL_LOAD /* Define to 1 if you have the `siglongjmp' function. */ -#undef HAVE_SIGLONGJMP +#cmakedefine HAVE_SIGLONGJMP ${HAVE_SIGLONGJMP} /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SIGNAL_H ${HAVE_SIGNAL_H} /* Define to 1 if you have the `sigsetjmp' function. */ -#undef HAVE_SIGSETJMP +#cmakedefine HAVE_SIGSETJMP ${HAVE_SIGSETJMP} /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H} @@ -405,7 +405,7 @@ #cmakedefine HAVE_STRTOLL ${HAVE_STRTOLL} /* Define to 1 if you have the `strtoq' function. */ -#undef HAVE_STRTOQ +#cmakedefine HAVE_STRTOQ ${HAVE_STRTOQ} /* Define to 1 if you have the `sysconf' function. */ #undef HAVE_SYSCONF -- cgit v1.2.3