diff options
Diffstat (limited to 'pki/ConfigureChecks.cmake')
-rw-r--r-- | pki/ConfigureChecks.cmake | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/pki/ConfigureChecks.cmake b/pki/ConfigureChecks.cmake new file mode 100644 index 000000000..d7ffb5569 --- /dev/null +++ b/pki/ConfigureChecks.cmake @@ -0,0 +1,77 @@ +include(CheckIncludeFile) +include(CheckSymbolExists) +include(CheckFunctionExists) +include(CheckLibraryExists) +include(CheckTypeSize) +include(CheckCXXSourceCompiles) +include(TestBigEndian) + +set(PACKAGE ${APPLICATION_NAME}) +set(VERSION ${APPLICATION_VERSION}) +set(DATADIR ${DATA_INSTALL_DIR}) +set(LIBDIR ${LIB_INSTALL_DIR}) +set(PLUGINDIR "${PLUGIN_INSTALL_DIR}-${LIBRARY_SOVERSION}") +set(SYSCONFDIR ${SYSCONF_INSTALL_DIR}) + +set(BINARYDIR ${CMAKE_BINARY_DIR}) +set(SOURCEDIR ${CMAKE_SOURCE_DIR}) + +function(COMPILER_DUMPVERSION _OUTPUT_VERSION) + # Remove whitespaces from the argument. + # This is needed for CC="ccache gcc" cmake .. + string(REPLACE " " "" _C_COMPILER_ARG "${CMAKE_C_COMPILER_ARG1}") + + execute_process( + COMMAND + ${CMAKE_C_COMPILER} ${_C_COMPILER_ARG} -dumpversion + OUTPUT_VARIABLE _COMPILER_VERSION + ) + + string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" + _COMPILER_VERSION ${_COMPILER_VERSION}) + + set(${_OUTPUT_VERSION} ${_COMPILER_VERSION} PARENT_SCOPE) +endfunction() + +if(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW) + compiler_dumpversion(GNUCC_VERSION) + if (NOT GNUCC_VERSION EQUAL 34) + check_c_compiler_flag("-fvisibility=hidden" WITH_VISIBILITY_HIDDEN) + endif (NOT GNUCC_VERSION EQUAL 34) +endif(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW) + +# HEADER FILES +check_include_file(argp.h HAVE_ARGP_H) +check_include_file(pty.h HAVE_PTY_H) +check_include_file(terminos.h HAVE_TERMIOS_H) + +set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS}) +check_include_file(openssl/aes.h HAVE_OPENSSL_AES_H) + +set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS}) +check_include_file(openssl/blowfish.h HAVE_OPENSSL_BLOWFISH_H) + +set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS}) +check_include_file(openssl/des.h HAVE_OPENSSL_DES_H) + +if (CMAKE_HAVE_PTHREAD_H) + set(HAVE_PTHREAD_H 1) +endif (CMAKE_HAVE_PTHREAD_H) + +# FUNCTIONS + +check_function_exists(strncpy HAVE_STRNCPY) +check_function_exists(vsnprintf HAVE_VSNPRINTF) +check_function_exists(snprintf HAVE_SNPRINTF) + +# LIBRARIES +if (CMAKE_HAVE_THREADS_LIBRARY) + if (CMAKE_USE_PTHREADS_INIT) + set(HAVE_PTHREAD 1) + endif (CMAKE_USE_PTHREADS_INIT) +endif (CMAKE_HAVE_THREADS_LIBRARY) + +# ENDIAN +if (NOT WIN32) + test_big_endian(WORDS_BIGENDIAN) +endif (NOT WIN32) |