From 38a9ae9da63b668104cb1f486d8a1c01243cfcc1 Mon Sep 17 00:00:00 2001 From: samelian Date: Tue, 5 Oct 2010 21:53:35 +0000 Subject: [PATCH] [dependencies/arts] GSL_HAVE_OGGVORBIS_RC3 and GSL_HAVE_MUTEXATTR_SETTYPE tests have been embedded into CMakeLists.txt git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/dependencies/arts@1182888 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- flow/gsl/CMakeLists.txt | 44 +++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/flow/gsl/CMakeLists.txt b/flow/gsl/CMakeLists.txt index 36ee59c..7c880ee 100644 --- a/flow/gsl/CMakeLists.txt +++ b/flow/gsl/CMakeLists.txt @@ -9,6 +9,9 @@ # ################################################# +include( CheckCSourceCompiles ) + + ##### check for ogg/vorbis ###################### set( GSL_HAVE_OGGVORBIS 0 ) @@ -24,12 +27,17 @@ if( WITH_VORBIS ) set( GSL_HAVE_OGGVORBIS 1 ) - try_compile( - GSL_HAVE_OGGVORBIS_RC3 - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/check_for_ov_read_float.c - CMAKE_FLAGS "-DLINK_LIBRARIES=${VORBISFILE_LIBRARIES}" - ) + set( bak_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ) + set( CMAKE_REQUIRED_LIBRARIES ${VORBISFILE_LIBRARIES} ) + check_c_source_compiles( + "#include + int main() { ov_read_float(0,0,0); return 0; } " + GSL_HAVE_OGGVORBIS_RC3 ) + if( NOT GSL_HAVE_OGGVORBIS_RC3 ) + set( GSL_HAVE_OGGVORBIS_RC3 0 ) + endif( NOT GSL_HAVE_OGGVORBIS_RC3 ) + set( CMAKE_REQUIRED_LIBRARIES ${bak_CMAKE_REQUIRED_LIBRARIES} ) + else( VORBISFILE_FOUND ) message(FATAL_ERROR "\nOgg/Vorbis support are requested, but `libvorbisfile` not found" ) @@ -69,12 +77,22 @@ check_type_size( pthread_mutex_t GSL_SIZEOF_PTH_MUTEX_T ) check_type_size( pthread_cond_t GSL_SIZEOF_PTH_COND_T ) check_type_size( intmax_t GSL_SIZEOF_STD_INTMAX_T ) -try_compile( - GSL_HAVE_MUTEXATTR_SETTYPE - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/check_for_pthread_mutexattr_settype.c - CMAKE_FLAGS "-DLINK_LIBRARIES=${CMAKE_THREAD_LIBS_INIT}" -) +set( bak_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ) +set( CMAKE_REQUIRED_LIBRARIES ${CMAKE_THREAD_LIBS_INIT} ) +check_c_source_compiles( + "#define _XOPEN_SOURCE 500 + #include + int main() + { + int (*attr_settype) (pthread_mutexattr_t *__attr, int __kind) = pthread_mutexattr_settype; + int val = PTHREAD_MUTEX_RECURSIVE; attr_settype = 0; val = 0; + return 0; + }" + GSL_HAVE_MUTEXATTR_SETTYPE ) + if( NOT GSL_HAVE_MUTEXATTR_SETTYPE ) + set( GSL_HAVE_MUTEXATTR_SETTYPE 0 ) + endif( NOT GSL_HAVE_MUTEXATTR_SETTYPE ) +set( CMAKE_REQUIRED_LIBRARIES ${bak_CMAKE_REQUIRED_LIBRARIES} ) set( GSL_USE_GSL_GLIB 1 ) set( GSL_USE_ARTS_THREADS 1 ) @@ -82,7 +100,7 @@ set( GSL_USE_ARTS_THREADS 1 ) ##### write configuration ####################### -configure_file( gslconfig.h.in gslconfig.h ) +configure_file( gslconfig.h.in gslconfig.h @ONLY ) ##### compile ###################################