From d5f6d201c6d3a6853b470cfb65786a3589be5ad3 Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Thu, 10 Mar 2016 14:04:04 -0600 Subject: [PATCH] Add default configure option for GSL and HDF5 If no argument is given with --with-gsl or --with-hdf5 we search /usr/include for the proper header files. If found we set the configure variables for these packages to /usr. If not found we emit an error message. refs #199 --- autoconf/configure.ac | 18 ++++++++++++------ configure | 39 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 3abd9710..24c0886b 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -20,11 +20,13 @@ AC_DEFUN([AX_HDF5_HOME],[ AC_ARG_WITH([hdf5], AS_HELP_STRING([--with-hdf5@<:@=DIR@:>@], [HDF5 root directory]), [HDF5_HOME="$withval" - AC_CHECK_FILE([$HDF5_HOME/include/hdf5.h], + AS_IF([test "$HDF5_HOME" = "yes"], + AC_CHECK_HEADER(hdf5.h,[HDF5_HOME="/usr"],AC_MSG_ERROR([could not find hdf5.h])), + AC_CHECK_FILE([$HDF5_HOME/include/hdf5.h], [], AC_MSG_ERROR([could not find $HDF5_HOME/include/hdf5.h]) ) - ], + )], [HDF5_HOME=""] ) AC_SUBST([HDF5_HOME]) @@ -34,11 +36,13 @@ AC_DEFUN([AX_DMTCP_HOME],[ AC_ARG_WITH([dmtcp], AS_HELP_STRING([--with-dmtcp@<:@=DIR@:>@], [DMTCP root directory]), [DMTCP_HOME="$withval" - AC_CHECK_FILE([$DMTCP_HOME/include/dmtcpaware.h], + AS_IF([test "$DMTCP_HOME" = "yes"], + AC_CHECK_HEADER(dmtcpaware.h,[DMTCP_HOME="/usr"],AC_MSG_ERROR([could not find dmtcpaware.h])), + AC_CHECK_FILE([$DMTCP_HOME/include/dmtcpaware.h], [], AC_MSG_ERROR([could not find $DMTCP_HOME/include/dmtcpaware.h]) ) - ], + )], [DMTCP_HOME=""] ) AC_SUBST([DMTCP_HOME]) @@ -76,11 +80,13 @@ AC_DEFUN([AX_GSL_HOME],[ AC_ARG_WITH([gsl], AS_HELP_STRING([--with-gsl@<:@=DIR@:>@], [GSL root directory]), [GSL_HOME="$withval" - AC_CHECK_FILE([$GSL_HOME/include/gsl], + AS_IF([test "$GSL_HOME" = "yes"], + AC_CHECK_HEADER(gsl/gsl_rng.h,[GSL_HOME="/usr"],AC_MSG_ERROR([could not find gsl/gsl_rng.h])), + AC_CHECK_FILE([$GSL_HOME/include/gsl], [], AC_MSG_ERROR([could not find $GSL_HOME/include/gsl]) ) - ], + )], [GSL_HOME=""] ) AC_SUBST([GSL_HOME]) diff --git a/configure b/configure index c45acb86..3ef68c0c 100755 --- a/configure +++ b/configure @@ -5504,7 +5504,17 @@ fi # Check whether --with-hdf5 was given. if test "${with_hdf5+set}" = set; then : withval=$with_hdf5; HDF5_HOME="$withval" - as_ac_File=`$as_echo "ac_cv_file_$HDF5_HOME/include/hdf5.h" | $as_tr_sh` + if test "$HDF5_HOME" = "yes"; then : + ac_fn_cxx_check_header_mongrel "$LINENO" "hdf5.h" "ac_cv_header_hdf5_h" "$ac_includes_default" +if test "x$ac_cv_header_hdf5_h" = xyes; then : + HDF5_HOME="/usr" +else + as_fn_error $? "could not find hdf5.h" "$LINENO" 5 +fi + + +else + as_ac_File=`$as_echo "ac_cv_file_$HDF5_HOME/include/hdf5.h" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $HDF5_HOME/include/hdf5.h" >&5 $as_echo_n "checking for $HDF5_HOME/include/hdf5.h... " >&6; } if eval \${$as_ac_File+:} false; then : @@ -5529,6 +5539,7 @@ else fi +fi else HDF5_HOME="" @@ -5541,7 +5552,17 @@ fi # Check whether --with-dmtcp was given. if test "${with_dmtcp+set}" = set; then : withval=$with_dmtcp; DMTCP_HOME="$withval" - as_ac_File=`$as_echo "ac_cv_file_$DMTCP_HOME/include/dmtcpaware.h" | $as_tr_sh` + if test "$DMTCP_HOME" = "yes"; then : + ac_fn_cxx_check_header_mongrel "$LINENO" "dmtcpaware.h" "ac_cv_header_dmtcpaware_h" "$ac_includes_default" +if test "x$ac_cv_header_dmtcpaware_h" = xyes; then : + DMTCP_HOME="/usr" +else + as_fn_error $? "could not find dmtcpaware.h" "$LINENO" 5 +fi + + +else + as_ac_File=`$as_echo "ac_cv_file_$DMTCP_HOME/include/dmtcpaware.h" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DMTCP_HOME/include/dmtcpaware.h" >&5 $as_echo_n "checking for $DMTCP_HOME/include/dmtcpaware.h... " >&6; } if eval \${$as_ac_File+:} false; then : @@ -5566,6 +5587,7 @@ else fi +fi else DMTCP_HOME="" @@ -5652,7 +5674,17 @@ fi # Check whether --with-gsl was given. if test "${with_gsl+set}" = set; then : withval=$with_gsl; GSL_HOME="$withval" - as_ac_File=`$as_echo "ac_cv_file_$GSL_HOME/include/gsl" | $as_tr_sh` + if test "$GSL_HOME" = "yes"; then : + ac_fn_cxx_check_header_mongrel "$LINENO" "gsl/gsl_rng.h" "ac_cv_header_gsl_gsl_rng_h" "$ac_includes_default" +if test "x$ac_cv_header_gsl_gsl_rng_h" = xyes; then : + GSL_HOME="/usr" +else + as_fn_error $? "could not find gsl/gsl_rng.h" "$LINENO" 5 +fi + + +else + as_ac_File=`$as_echo "ac_cv_file_$GSL_HOME/include/gsl" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $GSL_HOME/include/gsl" >&5 $as_echo_n "checking for $GSL_HOME/include/gsl... " >&6; } if eval \${$as_ac_File+:} false; then : @@ -5677,6 +5709,7 @@ else fi +fi else GSL_HOME=""