diff --git a/configure b/configure index cf6f86d5566d7e6dc9b76acfc9f9065770cd15d1..d374e8dadb1736926d579b93072134e20f35ef7d 100755 --- a/configure +++ b/configure @@ -1560,6 +1560,52 @@ fi } # ac_fn_fc_try_compile +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_link + # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. @@ -1757,52 +1803,6 @@ $as_echo "$ac_res" >&6; } } # ac_fn_cxx_check_header_compile -# ac_fn_cxx_try_link LINENO -# ------------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_link - # ac_fn_cxx_check_func LINENO FUNC VAR # ------------------------------------ # Tests whether FUNC exists, setting the cache variable VAR accordingly @@ -2235,6 +2235,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # use it to check if a flag is available on this compiler +# PLUMED_CHECK_LDFLAGS(flag) +# use it to check if a flag is available on this compiler + + # PLUMED_CHECK_PACKAGE(header,function,define[,library]) # first we check if the header is present. if so, we check if the given function can be found. # if it cannot be found and the fourth argument (library) has been supplied, we look for it @@ -3922,8 +3926,28 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not linking" >&5 +$as_echo "not linking" >&6; }; CXXFLAGS="$save_CXXFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; CXXFLAGS="$save_CXXFLAGS" @@ -3952,8 +3976,28 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not linking" >&5 +$as_echo "not linking" >&6; }; CXXFLAGS="$save_CXXFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; CXXFLAGS="$save_CXXFLAGS" @@ -3978,8 +4022,28 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not linking" >&5 +$as_echo "not linking" >&6; }; CXXFLAGS="$save_CXXFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; CXXFLAGS="$save_CXXFLAGS" @@ -4004,8 +4068,28 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not linking" >&5 +$as_echo "not linking" >&6; }; CXXFLAGS="$save_CXXFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; CXXFLAGS="$save_CXXFLAGS" @@ -4034,8 +4118,28 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not linking" >&5 +$as_echo "not linking" >&6; }; CXXFLAGS="$save_CXXFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; CXXFLAGS="$save_CXXFLAGS" @@ -4064,8 +4168,28 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not linking" >&5 +$as_echo "not linking" >&6; }; CXXFLAGS="$save_CXXFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; CXXFLAGS="$save_CXXFLAGS" @@ -4090,8 +4214,28 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not linking" >&5 +$as_echo "not linking" >&6; }; CXXFLAGS="$save_CXXFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; CXXFLAGS="$save_CXXFLAGS" @@ -4116,8 +4260,28 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not linking" >&5 +$as_echo "not linking" >&6; }; CXXFLAGS="$save_CXXFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; CXXFLAGS="$save_CXXFLAGS" @@ -4142,8 +4306,28 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not linking" >&5 +$as_echo "not linking" >&6; }; CXXFLAGS="$save_CXXFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; CXXFLAGS="$save_CXXFLAGS" @@ -4168,8 +4352,28 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not linking" >&5 +$as_echo "not linking" >&6; }; CXXFLAGS="$save_CXXFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; CXXFLAGS="$save_CXXFLAGS" @@ -4194,8 +4398,28 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not linking" >&5 +$as_echo "not linking" >&6; }; CXXFLAGS="$save_CXXFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; CXXFLAGS="$save_CXXFLAGS" @@ -4220,8 +4444,28 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not linking" >&5 +$as_echo "not linking" >&6; }; CXXFLAGS="$save_CXXFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; CXXFLAGS="$save_CXXFLAGS" @@ -4246,8 +4490,28 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not linking" >&5 +$as_echo "not linking" >&6; }; CXXFLAGS="$save_CXXFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; CXXFLAGS="$save_CXXFLAGS" @@ -4272,8 +4536,28 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not linking" >&5 +$as_echo "not linking" >&6; }; CXXFLAGS="$save_CXXFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; CXXFLAGS="$save_CXXFLAGS" @@ -4298,8 +4582,28 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not linking" >&5 +$as_echo "not linking" >&6; }; CXXFLAGS="$save_CXXFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; CXXFLAGS="$save_CXXFLAGS" @@ -5671,7 +5975,32 @@ $as_echo "$as_me: Dynamic library extension is 'so'" >&6;} $as_echo "$as_me: LDSO and LDFLAGS need special flags" >&6;} SOEXT=so LDSO="$LDSO -shared" - LDFLAGS="$LDFLAGS -rdynamic" + + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -rdynamic" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether LDFLAGS can contain -rdynamic" >&5 +$as_echo_n "checking whether LDFLAGS can contain -rdynamic... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; LDFLAGS="$save_LDFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ;; (*) { $as_echo "$as_me:${as_lineno-$LINENO}: *** Dynamic library only enabled on OSX and Linux ***" >&5 diff --git a/configure.ac b/configure.ac index 65eb808973f4e591bf100e25247d8e7931f33354..2a6a5dbb5d4687174970563032e65ae6d88afb1f 100644 --- a/configure.ac +++ b/configure.ac @@ -42,11 +42,26 @@ AC_DEFUN([PLUMED_CHECK_CXXFLAG], [ CXXFLAGS="$CXXFLAGS $1" AC_MSG_CHECKING([whether $CXX accepts $1]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], - [AC_MSG_RESULT([yes])], + [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([not linking]); CXXFLAGS="$save_CXXFLAGS"]) + ], [AC_MSG_RESULT([no]); CXXFLAGS="$save_CXXFLAGS"] ) ]) +# PLUMED_CHECK_LDFLAGS(flag) +# use it to check if a flag is available on this compiler +AC_DEFUN([PLUMED_CHECK_LDFLAGS], [ + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $1" + AC_MSG_CHECKING([whether LDFLAGS can contain $1]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]); LDFLAGS="$save_LDFLAGS"]) +]) + # PLUMED_CHECK_PACKAGE(header,function,define[,library]) # first we check if the header is present. if so, we check if the given function can be found. # if it cannot be found and the fourth argument (library) has been supplied, we look for it @@ -362,7 +377,7 @@ if test "$shared" == true ; then AC_MSG_NOTICE([LDSO and LDFLAGS need special flags]) SOEXT=so LDSO="$LDSO -shared" - LDFLAGS="$LDFLAGS -rdynamic" + PLUMED_CHECK_LDFLAGS([-rdynamic]) ;; (*) AC_MSG_NOTICE([*** Dynamic library only enabled on OSX and Linux ***])