$NetBSD: patch-configure.ac,v 1.1 2022/07/08 19:47:59 thor Exp $ Short out the rpath test that fails with pkgsrc wrappers. Enable rpath flags also for linking the main binary. Fix portability to non-bash with test = instead of test ==. Including the .ac patch here to motivate upstreaming at least of the == stuff. --- configure.ac.orig 2022-02-22 22:28:39.000000000 +0000 +++ configure.ac @@ -89,7 +89,7 @@ AC_DEFUN([PLUMED_CHECK_LDFLAGS], [ # same as AC_SEARCH_LIBS, but does not try any library unless $libsearch==true # Should be used instead of AC_SEARCH_LIBS in order to make --disable-libsearch work correctly AC_DEFUN([PLUMED_SEARCH_LIBS], [ - if test "${libsearch}" == true ; then + if test "${libsearch}" = true ; then AC_SEARCH_LIBS([$1],[$2],[$3],[$4],[$5]) else AC_SEARCH_LIBS([$1],[],[$3],[$4],[]) @@ -106,7 +106,7 @@ AC_DEFUN([PLUMED_CHECK_PACKAGE], [ AC_CHECK_HEADER( [$1],[ PLUMED_SEARCH_LIBS([$2],[$4],[found=ok]) ]) - if test $found == ok ; then + if test $found = ok ; then AC_DEFINE([$3]) $3=yes else @@ -122,7 +122,7 @@ AC_DEFUN([PLUMED_CHECK_PACKAGE], [ AC_DEFUN([PLUMED_CHECK_CXX_PACKAGE], [ found=ko $3=no - if test "${libsearch}" == true ; then + if test "${libsearch}" = true ; then testlibs="$4" else testlibs="" @@ -141,12 +141,12 @@ AC_DEFUN([PLUMED_CHECK_CXX_PACKAGE], [ [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])] ) - if test $found == ok ; then + if test $found = ok ; then break fi LIBS="$save_LIBS" done - if test $found == ok ; then + if test $found = ok ; then AC_DEFINE([$3]) $3=yes else @@ -164,10 +164,10 @@ AC_ARG_ENABLE([modules], AS_HELP_STRING([--enable-modules], [all/none/reset or : separated list such as +crystallization:-bias default: reset]), [ rm -f src/*.on src/*.off - if test "${enableval}" == yes ; then + if test "${enableval}" = yes ; then enableval=reset fi - if test "${enableval}" == no ; then + if test "${enableval}" = no ; then enableval=none fi for modules_mod in `echo "${enableval}" | sed 's/:/ /g' | sed 's/+/ +/g' | sed 's/-/ -/g'` @@ -313,7 +313,7 @@ case `(uname)` in esac # if searching for MPI, try first mpi-like compilers -if test $mpi == true ; then +if test $mpi = true ; then compilers="mpic++ mpicxx mpiicpc openmpic++ openmpicxx $compilers" fi @@ -346,13 +346,13 @@ AC_MSG_NOTICE([Initial LDSHARED: $LDS AC_MSG_NOTICE([Initial SOEXT: $SOEXT]) # check C++ flags -if test $shared == true +if test $shared = true then PLUMED_CHECK_CXXFLAG([-fPIC]) PLUMED_CHECK_CFLAG([-fPIC]) fi -if test $basic_warnings == true +if test $basic_warnings = true then PLUMED_CHECK_CXXFLAG([-Wall]) PLUMED_CHECK_CXXFLAG([-pedantic]) @@ -363,12 +363,12 @@ then PLUMED_CHECK_CXXFLAG([-std=c++$cxx_level]) fi -if test $debug == true +if test $debug = true then PLUMED_CHECK_CXXFLAG([-g]) fi -if test $gcov == true +if test $gcov = true then CXX="$CXX --coverage" LDSHARED="$LDSHARED --coverage" @@ -377,7 +377,7 @@ then STATIC_LIBS="$STATIC_LIBS --coverage" fi -if test $fussy == true +if test $fussy = true then PLUMED_CHECK_CXXFLAG([-Wextra]) PLUMED_CHECK_CXXFLAG([-Wfloat-equal]) @@ -499,14 +499,14 @@ lapack_found= # external lapack can only work with external blas # thus, if external blas are disabled also external lapack should be disabled -if test "$external_blas" == false && test "$external_lapack" == true ; then +if test "$external_blas" = false && test "$external_lapack" = true ; then AC_MSG_NOTICE([Internal blas can only be used with internal lapack]) AC_MSG_NOTICE([Will not search for external lapack]) external_lapack=false fi # first look for blas -if test "$external_blas" == true ; then +if test "$external_blas" = true ; then AC_MSG_CHECKING([whether dgemv can be linked with no library]) AC_LINK_IFELSE([AC_LANG_CALL([], [dgemv])],[ AC_MSG_RESULT([yes]) @@ -536,7 +536,7 @@ if test -n "$blas_found" ; then AC_DEFINE([__PLUMED_HAS_EXTERNAL_BLAS]) -if test "$external_lapack" == true ; then +if test "$external_lapack" = true ; then # Then we look for lapack using same underscoring case "$blas_found" in (underscore) search_for=dsyevr_ ;; @@ -557,7 +557,7 @@ fi # in case external blas have been found, take note of their underscoring # notice that this applies also when external blas are used with internal lapack # in the latter case, also (internal) lapack names will be underscored consistently -if test "$blas_found" == nounderscore +if test "$blas_found" = nounderscore then AC_DEFINE([F77_NO_UNDERSCORE]) fi @@ -596,7 +596,7 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([PLUMED_TE [ AC_MSG_RESULT([not checked (cross compiling)]) ] ) -if test "$sdot_returns_float" == no ; +if test "$sdot_returns_float" = no ; then AC_MSG_CHECKING([whether sdot returns double]) @@ -638,14 +638,14 @@ AC_MSG_NOTICE([Now we will check for opt # GB ############################################################# -if test $molfile_plugins == true ; then +if test $molfile_plugins = true ; then # Check for molfile_plugins and use internal fallback if not found. TG # We always have molfile, now AC_DEFINE([__PLUMED_HAS_MOLFILE_PLUGINS]) - if test "$external_molfile_plugins" == true ; then + if test "$external_molfile_plugins" = true ; then PLUMED_CHECK_PACKAGE([libmolfile_plugin.h],[molfile_dcdplugin_init],[__PLUMED_HAS_EXTERNAL_MOLFILE_PLUGINS],molfile_plugin) if test "$__PLUMED_HAS_EXTERNAL_MOLFILE_PLUGINS" != yes ; then AC_MSG_WARN([using internal molfile_plugins, which only support dcd/xtc/trr/trj/crd files]) @@ -662,7 +662,7 @@ AC_CHECK_LIB([dl],dlopen, [STATIC_LIBS=" mpi_found=ko # optional libraries follow -if test $mpi == true ; then +if test $mpi = true ; then PLUMED_CHECK_PACKAGE([mpi.h],[MPI_Init],[__PLUMED_HAS_MPI]) if test "$__PLUMED_HAS_MPI" = yes; then mpi_found=ok @@ -675,7 +675,7 @@ fi # when configuring with --disable-openmp AC_OPENMP -if test $asmjit == true ; then +if test $asmjit = true ; then AC_MSG_CHECKING([whether architecture is X86/X64]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #if !(defined(_M_IX86 ) || defined(__X86__ ) || defined(__i386 ) || \ @@ -692,12 +692,12 @@ this_is_not_x86_x64 x86_x64=false]) fi -if test $asmjit == true && test $x86_x64 == false ; then +if test $asmjit = true && test $x86_x64 = false ; then AC_MSG_WARN([asmjit does not support this architecture, it will be disabled]) asmjit=false fi -if test $asmjit == true ; then +if test $asmjit = true ; then found=ko # asmjit calls clock_gettime and thus should be linked to rt on Linux if test `(uname)` = Linux ; then @@ -714,17 +714,17 @@ if test $asmjit == true ; then fi -if test $readdir_r == true ; then +if test $readdir_r = true ; then PLUMED_CHECK_PACKAGE([dirent.h],[readdir_r],[__PLUMED_HAS_READDIR_R]) fi -if test $cregex == true ; then +if test $cregex = true ; then PLUMED_CHECK_PACKAGE([regex.h],[regcomp],[__PLUMED_HAS_CREGEX]) fi -if test $dlopen == true ; then +if test $dlopen = true ; then PLUMED_CHECK_PACKAGE([dlfcn.h],[dlopen],[__PLUMED_HAS_DLOPEN]) fi -if test $rtld_default == true ; then +if test $rtld_default = true ; then PLUMED_CHECK_CXX_PACKAGE([RTLD_DEFAULT],[ #include int @@ -736,11 +736,11 @@ main () ], [__PLUMED_HAS_RTLD_DEFAULT]) fi -if test $chdir == true ; then +if test $chdir = true ; then PLUMED_CHECK_PACKAGE([unistd.h],[chdir],[__PLUMED_HAS_CHDIR]) fi -if test $subprocess == true ; then +if test $subprocess = true ; then PLUMED_CHECK_CXX_PACKAGE([subprocess],[ /* random program calling all the functions needed to manage a subprocess */ #include @@ -775,36 +775,36 @@ main () ], [__PLUMED_HAS_SUBPROCESS]) fi -if test $getcwd == true ; then +if test $getcwd = true ; then PLUMED_CHECK_PACKAGE([unistd.h],[getcwd],[__PLUMED_HAS_GETCWD]) fi -if test $popen == true ; then +if test $popen = true ; then PLUMED_CHECK_PACKAGE([cstdio],[popen],[__PLUMED_HAS_POPEN]) fi -if test $execinfo == true ; then +if test $execinfo = true ; then PLUMED_CHECK_PACKAGE([execinfo.h],[backtrace],[__PLUMED_HAS_EXECINFO]) fi -if test $zlib == true ; then +if test $zlib = true ; then PLUMED_CHECK_PACKAGE([zlib.h],[gzopen],[__PLUMED_HAS_ZLIB],[z]) fi -if test $gsl == true ; then +if test $gsl = true ; then found=ko PLUMED_SEARCH_LIBS([cblas_dgemv],[gslcblas], [ AC_CHECK_HEADER( [gsl/gsl_vector.h], [ PLUMED_SEARCH_LIBS([gsl_vector_alloc],[gsl],[found=ok]) ]) ]) - if test $found == ok ; then + if test $found = ok ; then AC_DEFINE([__PLUMED_HAS_GSL]) else AC_MSG_WARN([cannot enable __PLUMED_HAS_GSL]) fi fi -if test $boost_graph == true ; then +if test $boost_graph = true ; then PLUMED_CHECK_CXX_PACKAGE([boost graph],[ #include #include @@ -818,7 +818,7 @@ main () ], [__PLUMED_HAS_BOOST_GRAPH]) fi -if test $boost_serialization == true ; then +if test $boost_serialization = true ; then PLUMED_CHECK_CXX_PACKAGE([boost serialization],[ #include #include @@ -831,11 +831,11 @@ int main() { # notice: macports install libraries with -mt suffix fi -if test $fftw == true ; then +if test $fftw = true ; then PLUMED_CHECK_PACKAGE([fftw3.h],[fftw_execute],[__PLUMED_HAS_FFTW],[fftw3]) fi -if test $python == true ; then +if test $python = true ; then # if PYTHON_BIN is defined, it is expected to be the full path to python # Otherwise, search from a list of names: if test -z "$PYTHON_BIN" ; then @@ -870,18 +870,18 @@ if sys.version_info < (3,): fi fi -if test "$af_ocl" == true ; then +if test "$af_ocl" = true ; then PLUMED_CHECK_PACKAGE([arrayfire.h],[af_is_double],[__PLUMED_HAS_ARRAYFIRE],[afopencl]) fi -if test "$af_cuda" == true ; then +if test "$af_cuda" = true ; then PLUMED_CHECK_PACKAGE([arrayfire.h],[af_is_double],[__PLUMED_HAS_ARRAYFIRE],[afcuda]) fi -if test "$af_cpu" == true ; then +if test "$af_cpu" = true ; then PLUMED_CHECK_PACKAGE([arrayfire.h],[af_is_double],[__PLUMED_HAS_ARRAYFIRE],[afcpu]) fi # in non-debug mode, add -DNDEBUG -if test "$debug" == false ; then +if test "$debug" = false ; then AC_MSG_NOTICE([Release mode, adding -DNDEBUG]) AC_DEFINE([NDEBUG]) fi @@ -890,7 +890,7 @@ AC_SUBST(use_debug_glibcxx) # in debug-glibcxx mode, add -D_GLIBCXX_DEBUG # also take note that we are using this to relax `make nmcheck` use_debug_glibcxx=no -if test "$debug_glibcxx" == true ; then +if test "$debug_glibcxx" = true ; then AC_MSG_NOTICE([Check boundaries, adding -D_GLIBCXX_DEBUG]) AC_DEFINE([_GLIBCXX_DEBUG]) use_debug_glibcxx=yes @@ -903,6 +903,7 @@ AC_DEFINE([_REENTRANT]) #### Options for dynamic library to work properly #### AC_SUBST(SOEXT) AC_SUBST(LDSHARED) +AC_SUBST(RPATH) # these are libraries that should be linked also to MD engines AC_SUBST(STATIC_LIBS) # python executable @@ -910,7 +911,7 @@ AC_SUBST(PYTHON_BIN) AC_SUBST(MPIEXEC) -if test "$shared" == true ; then +if test "$shared" = true ; then case `(uname)` in (Darwin) AC_MSG_NOTICE([*** Special settings for dynamic libraries on OSX ***]) @@ -930,7 +931,7 @@ if test "$shared" == true ; then SOEXT=so LDSHARED="$LDSHARED -shared" PLUMED_CHECK_LDFLAGS([-rdynamic]) - if test "$bsymbolic" == true ; then + if test "$bsymbolic" = true ; then PLUMED_CHECK_LDFLAGS([-Wl,-Bsymbolic]) fi ;; @@ -961,17 +962,20 @@ then rm -f conftest.$SOEXT readelf="" AC_CHECK_PROG([readelf],[readelf],[found]) - if test "$readelf" == found ; then - test_LDSHARED="$LDSHARED -Wl,-R -Wl,/some/random/dir/" - $test_LDSHARED $LDFLAGS conftest.o -o conftest.$SOEXT 1>/dev/null 2>/dev/null - if readelf -d conftest.$SOEXT | grep RPATH | grep -q /some/random/dir ; then - LDSHARED="$LDSHARED -Wl,-R -Wl,\"$libdir:$LIBRARY_PATH\"" - else - AC_MSG_WARN([-R option seems not working, disabling rpath]) - fi - else - AC_MSG_WARN([readelf not available, no way to set rpath]) - fi +# Believe us that we provide a toolchain that does rpath, just not accepting +# any random directories in pkgsrc! +# Also need rpath in LDFLAGS for plumed binary! +# if test "$readelf" = found ; then +# test_LDSHARED="$LDSHARED -Wl,-R -Wl,/some/random/dir/" +# $test_LDSHARED $LDFLAGS conftest.o -o conftest.$SOEXT 1>/dev/null 2>/dev/null +# if readelf -d conftest.$SOEXT | grep RPATH | grep -q /some/random/dir ; then + RPATH="-Wl,-R -Wl,\"$libdir:$LIBRARY_PATH\"" +# else +# AC_MSG_WARN([-R option seems not working, disabling rpath]) +# fi +# else +# AC_MSG_WARN([readelf not available, no way to set rpath]) +# fi fi rm -f conftest.* fi @@ -979,17 +983,17 @@ fi AC_SUBST(make_doc) make_doc=no -if test "$doc" == true +if test "$doc" = true then make_doc=yes ### Look for doxygen AC_CHECK_PROG([doxygen],[doxygen],[found]) -if test "$doxygen" == found +if test "$doxygen" = found then doxygen_version=`doxygen --version | awk 'BEGIN{FS="."}{if($1>1 || ($1==1 && $2>=8)) print "ok"}'` - if test "$doxygen_version" == ok + if test "$doxygen_version" = ok then AC_MSG_NOTICE([Doxygen version is fine]) else @@ -1015,7 +1019,7 @@ fi AC_SUBST(make_pdfdoc) make_pdfdoc="" -if test "$pdfdoc" == true && test "$make_doc" == yes +if test "$pdfdoc" = true && test "$make_doc" = yes then AC_MSG_NOTICE([A PDF version of the manual will be generated]) make_pdfdoc=yes @@ -1049,7 +1053,7 @@ int main(int argc,char*argv[[]]){ [ program_can_run=no ; AC_MSG_RESULT([no (cross compiling)]) ] ) -if test $mpi_found == ok ; then +if test $mpi_found = ok ; then AC_SUBST(program_can_run_mpi) program_can_run_mpi="" AC_MSG_CHECKING([whether a program compiled with mpi can be run on this machine]) @@ -1072,7 +1076,7 @@ int main(int argc,char*argv[[]]){ ) fi -if test $mpi_found == ok ; then +if test $mpi_found = ok ; then if test -n "$MPIEXEC" ; then AC_MSG_NOTICE([Regtest suite will use $MPIEXEC command to run MPI tests]) else @@ -1080,15 +1084,15 @@ if test $mpi_found == ok ; then fi fi -if test "$SOEXT" == "dylib" ; then +if test "$SOEXT" = "dylib" ; then use_absolute_soname=yes else use_absolute_soname=no fi AC_SUBST(use_absolute_soname) -if test "$absolute_soname" == true ; then - if test "$SOEXT" == "dylib" ; then +if test "$absolute_soname" = true ; then + if test "$SOEXT" = "dylib" ; then AC_MSG_WARN([--enable-absolute-soname has no effect on OSX]) else AC_MSG_NOTICE([enabling absolute soname. Full path will be hardcoded in plumed library soname]) @@ -1096,8 +1100,8 @@ if test "$absolute_soname" == true ; the fi fi -if test "$absolute_install_name" == false ; then - if test "$SOEXT" == "so" ; then +if test "$absolute_install_name" = false ; then + if test "$SOEXT" = "so" ; then AC_MSG_WARN([--disable-absolute-install-name has no effect on Linux]) else AC_MSG_NOTICE([enabling relative install_name. You will have to set DYLD_LIBRARY_PATH yor plumed libraries to be found at runtime]) @@ -1106,8 +1110,8 @@ if test "$absolute_install_name" == fals fi AC_SUBST(use_loader_path) -if test "$SOEXT" == "dylib" ; then - if test "$loader_path" == true ; then +if test "$SOEXT" = "dylib" ; then + if test "$loader_path" = true ; then use_loader_path=yes else use_loader_path=no @@ -1121,7 +1125,7 @@ AC_MSG_NOTICE([PLUMED seems to be config AC_MSG_NOTICE([**************************]) AC_SUBST(LD_RO) LD_RO= -if test "$ld_r" == true ; then +if test "$ld_r" = true ; then for test_LD_RO in "$($CXX --print-prog-name=ld) -r -o" "$CXX -Wl,-r -o" "ld -r -o" do AC_MSG_CHECKING([whether C++ objects can be grouped with $test_LD_RO]) @@ -1162,7 +1166,7 @@ fi AC_SUBST(AR_CR) AR_CR= -if test "$ar_cr" == true ; then +if test "$ar_cr" = true ; then for test_AR_CR in "$($CXX --print-prog-name=ar) cr" "ar cr" do AC_MSG_CHECKING([whether static libraries can be created with $test_AR_CR]) @@ -1204,14 +1208,14 @@ fi make_static_archive=no AC_SUBST(make_static_archive) -if test "${static_archive}" == true ; then +if test "${static_archive}" = true ; then if test -z "$LD_RO" || test -z "$AR_CR" ; then AC_MSG_WARN([no way to create a static archive if ld -ro or ar cr do not work]) static_archive=false fi fi -if test "${static_archive}" == true ; then +if test "${static_archive}" = true ; then AC_MSG_CHECKING([whether static-object constructors can be linked from a static archive]) magic_token=c1bc476d093a3a5c67b4530e6c54c633593fe9aa @@ -1251,7 +1255,7 @@ EOF fi fi -if test "${static_patch}" == true ; then +if test "${static_patch}" = true ; then AC_MSG_NOTICE([I will now check if C++ objects can be linked by C/Fortran compilers]) AC_MSG_NOTICE([This is relevant if you want to use plumed patch --static on a non-C++ code]) @@ -1290,7 +1294,7 @@ EOF $CXX $CXXFLAGS -c conftest.cpp # start search: found= - if test "${libsearch}" == true ; then + if test "${libsearch}" = true ; then testlibs="-lstdc++ -lc++ -lmpi_cxx" else testlibs="" @@ -1324,7 +1328,7 @@ else AC_MSG_NOTICE([Static patching is disabled, thus tests required for static patching will be skipped]) fi -if test "$prefix" == NONE +if test "$prefix" = NONE then prefix=/usr/local fi @@ -1334,7 +1338,7 @@ pkgconfig_bin="" AC_PATH_PROGS(pkgconfig_bin,pkg-config) if test -z "$BASH_COMPLETION_DIR" && test -n "$pkgconfig_bin"; then - if test "$prefix" == "$(pkg-config --variable=prefix bash-completion 2>/dev/null)" + if test "$prefix" = "$(pkg-config --variable=prefix bash-completion 2>/dev/null)" then AC_MSG_NOTICE([bash-completion is installed on the same prefix where plumed will be installed]) if pkg-config --variable=completionsdir bash-completion 2>/dev/null >/dev/null ; then @@ -1401,8 +1405,8 @@ if test -z "$BASH_COMPLETION_DIR" ; then AC_MSG_WARN([**** complete -F _$program_name -o default $program_name]) fi -if test $mpi == true; then - if test $mpi_found == ok; then +if test $mpi = true; then + if test $mpi_found = ok; then AC_MSG_NOTICE([**** PLUMED will be compiled using MPI]) else AC_MSG_WARN([**** PLUMED will NOT be compiled using MPI because MPI have not been found!]) @@ -1411,11 +1415,11 @@ else AC_MSG_NOTICE([**** PLUMED will be compiled without MPI]) fi -if test $program_can_run == no ; then +if test $program_can_run = no ; then AC_MSG_WARN([plumed executable will not run on this machine]) AC_MSG_WARN([to patch an MD code use 'plumed-patch']) -elif test $mpi_found == ok ; then - if test $program_can_run_mpi == no ; then +elif test $mpi_found = ok ; then + if test $program_can_run_mpi = no ; then AC_MSG_WARN([plumed executable will not run on this machine]) AC_MSG_WARN([unless you invoke it as 'plumed --no-mpi']) AC_MSG_WARN([all command line tools are thus available as 'plumed --no-mpi name-of-the-tool'])