diff options
Diffstat (limited to 'flow/gsl/CMakeLists.txt')
-rw-r--r-- | flow/gsl/CMakeLists.txt | 44 |
1 files 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 <vorbis/vorbisfile.h> + 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 <pthread.h> + 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 ################################### |