diff --git a/CHANGES/v2.3.md b/CHANGES/v2.3.md index a2a7c92ea02b7e1db7ab6d181a48ff23efedb49b..a5302cf35b7367cfdbfb321ce378464c0aceb851 100644 --- a/CHANGES/v2.3.md +++ b/CHANGES/v2.3.md @@ -233,6 +233,7 @@ For developers: For users: - Fixed a problem leading to NaN derivatives of \ref switchingfunction `Q` when distance between two atoms is large. - GROMACS patch updated to gromacs-2016.5. +- `./configure` crashes if prefix is set to present working directory (notice that this choice was already leading to issues). For developers: - Fixed small issue in debug options of \ref driver (see \issue{245}). diff --git a/configure b/configure index 0bfb79df8e1687327327be57b3009c2f2d4cc3b9..dd88edd25981f871dd6ad93265ff6baa9975b301 100755 --- a/configure +++ b/configure @@ -8953,6 +8953,21 @@ then prefix=/usr/local fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking If prefix is equal to present working directory" >&5 +$as_echo_n "checking If prefix is equal to present working directory... " >&6; } + +# ignore cases where the directory does not exist: +normalized_prefix="`cd "${prefix}" 2>/dev/null && pwd || true`" + +if test "`pwd`" = "$normalized_prefix" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + as_fn_error $? "prefix should not be equal to the present working directory" "$LINENO" 5 +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. diff --git a/configure.ac b/configure.ac index 08eddd60a8ca61ffde852e8c9a4064ef08ba818d..819ea122b2e9af639378edfdaa9613403e9d240b 100644 --- a/configure.ac +++ b/configure.ac @@ -1013,6 +1013,18 @@ then prefix=/usr/local fi +AC_MSG_CHECKING([If prefix is equal to present working directory]) + +# ignore cases where the directory does not exist: +normalized_prefix="`cd "${prefix}" 2>/dev/null && pwd || true`" + +if test "`pwd`" = "$normalized_prefix" ; then + AC_MSG_RESULT([yes]) + AC_MSG_ERROR([prefix should not be equal to the present working directory]) +else + AC_MSG_RESULT([no]) +fi + AC_ARG_PROGRAM diff --git a/user-doc/Installation.md b/user-doc/Installation.md index bf2807a06ef7392dcfd5bd98404feba0cf18c66a..ead4ae58ac243916f67724abfd3d6e8af8754b85 100644 --- a/user-doc/Installation.md +++ b/user-doc/Installation.md @@ -433,6 +433,9 @@ variable when installing, PLUMED will be installed in /usr/local. The install command should be executed with root permissions (e.g. "sudo make install") if you want to install PLUMED on a system directory. +\warning Please **do not** set prefix to the current directory (`./configure --prefix=$PWD`). PLUMED +expects the installation directory to be a different one! You might want to use something like `./configure --prefix=$PWD/install` instead. + Notice that upon installation PLUMED might need to relink a library. This was always true until version 2.1, but in version 2.2 libraries should only be relinked if one changes the install prefix during when typing `make install`.