@@ -313,7 +313,15 @@ AM_CONDITIONAL([INCLUDE_SLEPC], [test "x${have_slepc}" = "xyes"])
313313
314314
315315# #####################
316- # see if we have --enable-download-gsl
316+ # check for GSL (optional)
317+ AC_ARG_WITH ( [ gsl] ,
318+ [ AS_HELP_STRING ( [ --with-gsl] ,
319+ [ use GSL for advanced math features @<:@ default=check@:>@ ] ) ] ,
320+ [ ] ,
321+ [ with_gsl=check]
322+ )
323+
324+ have_gsl="no"
317325gslver=2.8
318326gsldist=gsl-${gslver}
319327gslmirror=http://ftpmirror.gnu.org/gsl/${gsldist}.tar.gz
@@ -323,59 +331,92 @@ AC_ARG_ENABLE([download-gsl],
323331 [ download_gsl=yes] ,
324332 [ download_gsl=no] )
325333
326- # if gsl directory does not exist, see if we have to uncompress and/or download
327- AS_IF ( [ test ! -e ${gsldist}] ,[
328- AS_IF ( [ test ! -e ${gsldist}.tar.gz] ,[
329- AS_IF ( [ test "x$download_gsl" = "xyes"] ,[
330- AS_IF ( [ test "x$(which wget)" != "x"] ,[
331- AC_MSG_NOTICE ( [ downloading ${gslmirror}] )
332- wget -c ${gslmirror}
334+ AS_IF ( [ test "x${with_gsl}" != "xno"] , [
335+ # if gsl directory does not exist, see if we have to uncompress and/or download
336+ AS_IF ( [ test ! -e ${gsldist}] ,[
337+ AS_IF ( [ test ! -e ${gsldist}.tar.gz] ,[
338+ AS_IF ( [ test "x$download_gsl" = "xyes"] ,[
339+ AS_IF ( [ test "x$(which wget)" != "x"] ,[
340+ AC_MSG_NOTICE ( [ downloading ${gslmirror}] )
341+ wget -c ${gslmirror}
342+ ] ,[
343+ AS_IF ( [ test "x${with_gsl}" != "xcheck"] , [
344+ AC_MSG_ERROR ( [ file ${gsldist}.tar.gz not found and wget not installed] )
345+ ] )
346+ ] )
347+ AS_IF ( [ test ! -e ${gsldist}.tar.gz] ,[
348+ AS_IF ( [ test "x${with_gsl}" != "xcheck"] , [
349+ AC_MSG_ERROR ( [ file ${gsldist}.tar.gz could not be downloaded] )
350+ ] )
351+ ] )
352+ ] )
353+ ] )
354+
355+ AS_IF ( [ test -e ${gsldist}.tar.gz] ,[
356+ AC_MSG_NOTICE ( [ uncompressing ${gsldist}.tar.gz] )
357+ tar xzf ${gsldist}.tar.gz
358+ ] )
359+ ] )
360+
361+ # if gsl directory exists, see if we have to compile it
362+ AS_IF ( [ test -e ${gsldist}] ,[
363+ AS_IF ( [ test -e ${gsldist}/.libs/libgsl.a] ,[
364+ AC_MSG_NOTICE ( [ using already-compiled GSL library ${gsldist}/.libs/libgsl.a] )
333365 ] ,[
334- AC_MSG_ERROR ( [ file ${gsldist}.tar.gz not found and wget not installed] )
366+ AC_MSG_NOTICE ( [ configuring ${gsldist}] )
367+ cd ${gsldist}
368+ ./configure --prefix=${prefix} --host=${host}
369+ AC_MSG_NOTICE ( [ compiling ${gsldist}] )
370+ make
371+ cd ..
335372 ] )
336- AS_IF ( [ test ! -e ${gsldist}.tar.gz] ,[
337- AC_MSG_ERROR ( [ file ${gsldist}.tar.gz could not be downloaded, copy it manually and re-try.] )
373+
374+ AC_SUBST ( [ DOWNLOADED_GSL_LIBS] , [ "../${gsldist}/.libs/libgsl.a ../${gsldist}/cblas/.libs/libgslcblas.a"] )
375+ AC_SUBST ( [ DOWNLOADED_GSL_INCLUDES] , [ "-I ../${gsldist} -I ../../${gsldist}"] )
376+ gsl_version="${gslver} (downloaded and statically linked)"
377+ have_gsl="yes"
378+ ] ,[
379+ # traditional test for GSL
380+ # check for GSL & CBLAS
381+ AC_CHECK_HEADER ( [ gsl/gsl_vector.h] , [ ] , [
382+ AS_IF ( [ test "x${with_gsl}" != "xcheck"] , [
383+ AC_MSG_FAILURE ( [ --with-gsl was given but GSL headers libgsl-dev not found] )
384+ ] )
385+ ] )
386+
387+ # TODO: the original idea is that
388+ # if we found PETSc, we use whatever BLAS it has, otherwise we use GSL's CBLAS
389+ # but this does not work in Fedora since even though the library flexiblas
390+ # that is used by PETSc does contain cblas_dgemm, it is not found by the linker
391+ #AS_IF ( [ test "x${have_petsc}" != "xyes"] ,
392+ AC_CHECK_LIB ( [ gslcblas] ,[ cblas_dgemm] , [ ] , [
393+ AS_IF ( [ test "x${with_gsl}" != "xcheck"] , [
394+ AC_MSG_FAILURE ( [ --with-gsl was given but GSL CBLAS libgsl-dev not found] )
395+ ] )
396+ ] )
397+ # )
398+ AC_CHECK_LIB ( [ gsl] ,[ gsl_blas_dgemm] , [ ] , [
399+ AS_IF ( [ test "x${with_gsl}" != "xcheck"] , [
400+ AC_MSG_FAILURE ( [ --with-gsl was given but GSL library libgsl-dev not found] )
401+ ] )
338402 ] )
403+
404+ # check if we have everything
405+ AS_IF ( [ test "x${ac_cv_lib_gsl_gsl_blas_dgemm}" = "xyes" -a \
406+ "x${ac_cv_header_gsl_gsl_vector_h}" = "xyes"] ,
407+ [
408+ gsl_version="from system"
409+ have_gsl="yes"
410+ ]
411+ )
339412 ])
340- ] )
341-
342- AS_IF ( [ test -e ${gsldist}.tar.gz] ,[
343- AC_MSG_NOTICE ( [ uncompressing ${gsldist}.tar.gz] )
344- tar xzf ${gsldist}.tar.gz
345- ] )
346- ] )
347413
348- # if gsl directory exists, see if we have to compile it
349- AS_IF ( [ test -e ${gsldist}] ,[
350- AS_IF ( [ test -e ${gsldist}/.libs/libgsl.a] ,[
351- AC_MSG_NOTICE ( [ using already-compiled GSL library ${gsldist}/.libs/libgsl.a] )
352- ] ,[
353- AC_MSG_NOTICE ( [ configuring ${gsldist}] )
354- cd ${gsldist}
355- ./configure --prefix=${prefix} --host=${host}
356- AC_MSG_NOTICE ( [ compiling ${gsldist}] )
357- make
358- cd ..
359- ] )
360-
361- AC_SUBST ( [ DOWNLOADED_GSL_LIBS] , [ "../${gsldist}/.libs/libgsl.a ../${gsldist}/cblas/.libs/libgslcblas.a"] )
362- AC_SUBST ( [ DOWNLOADED_GSL_INCLUDES] , [ "-I ../${gsldist} -I ../../${gsldist}"] )
363- gsl_version="${gslver} (downloaded and statically linked)"
364- ] ,[
365- # traditional test for GSL
366- # check for GSL & CBLAS (required)
367- AC_CHECK_HEADER ( [ gsl/gsl_vector.h] , [ ] , AC_MSG_ERROR ( [ GNU Scientific library headers libgsl-dev not found.
368- Either install them with your package manager or configure with --enable-download-gsl] ) )
369-
370- # TODO: the original idea is that
371- # if we found PETSc, we use whatever BLAS it has, otherwise we use GSL's CBLAS
372- # but this does not work in Fedora since even though the library flexiblas
373- # that is used by PETSc does contain cblas_dgemm, it is not found by the linker
374- #AS_IF ( [ test "x${have_petsc}" != "xyes"] ,
375- AC_CHECK_LIB ( [ gslcblas] ,[ cblas_dgemm] , [ ] , AC_MSG_ERROR ( [ GNU Scientific library CBLAS libgsl-dev not found] ) )
376- # )
377- AC_CHECK_LIB ( [ gsl] ,[ gsl_blas_dgemm] , [ ] , AC_MSG_ERROR ( [ GNU Scientific library libgsl-dev not found] ) )
378- gsl_version="from system"
414+ # Define HAVE_GSL if we found it
415+ AS_IF ( [ test "x${have_gsl}" = "xyes"] ,
416+ [
417+ AC_DEFINE ( [ HAVE_GSL] , [ 1] , [ GSL is available] )
418+ ]
419+ )
379420] )
380421
381422
@@ -424,22 +465,32 @@ AS_IF([test "x${enable_fee2ccx}" = "xyes"] , [
424465
425466
426467AS_BOX ( [ Summary of dependencies] )
427- AS_ECHO ( [ " GNU Scientific Library ${gsl_version}"] )
468+ AS_ECHO_N ( [ " GNU Scientific Library ${have_gsl}"] )
469+ AS_IF ( [ test "x${have_gsl}" = "xyes"] ,
470+ AS_ECHO ( [ " ${gsl_version}"] ) ,
471+ AS_ECHO
472+ )
473+
428474# AS_ECHO( [" Readline ${have_readline}"])
475+
429476AS_ECHO ( [ " SUNDIALS ${have_sundials}"] )
477+
430478AS_ECHO_N ( [ " PETSc ${have_petsc}"] )
431479AS_IF ( [ test "x${have_petsc}" = "xyes"] ,
432480 AS_ECHO ( [ " ${PETSC_DIR} ${PETSC_ARCH}"] ) ,
433481 AS_ECHO
434482)
483+
435484AS_ECHO_N ( [ " SLEPc ${have_slepc}"] )
436485AS_IF ( [ test "x${have_slepc}" = "xyes"] ,
437486 AS_ECHO ( [ " ${SLEPC_DIR}"] ) ,
438487 AS_ECHO
439488)
489+
440490AS_ECHO ( [ " Compile fee2ccx ${enable_fee2ccx}"] )
441491AS_ECHO ( [ " Compiler ${compiler_show}"] )
442492AS_ECHO ( [ " Compiler flags ${CFLAGS}"] )
493+ AS_ECHO ( [ " Compiler version ${compiler_version}"] )
443494# AS_ECHO( [" Linker flags ${LDFLAGS}"])
444495
445496AC_OUTPUT
0 commit comments