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 0cf7b0087ee30732a4fba2bdbf4ada8ad150af74..f023d1a6d73058e11f384d3e0a6b89b33bfe073a 100755 --- a/configure +++ b/configure @@ -8964,6 +8964,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 + pkgconfig_bin="" for ac_prog in pkg-config diff --git a/configure.ac b/configure.ac index e74a67ff2b8eca76cdbc78f8423e0122a7b7bf98..dd98ab5c13ba3d6f31ac166349a1fbcba220ffd0 100644 --- a/configure.ac +++ b/configure.ac @@ -1097,6 +1097,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 + pkgconfig_bin="" AC_PATH_PROGS(pkgconfig_bin,pkg-config) diff --git a/user-doc/Installation.md b/user-doc/Installation.md index 3795fbd4ef9c4daa6dfc192de941cff9f07ffdd2..f5332309bf4f5c4c69d65edc4afebe5aa53340c5 100644 --- a/user-doc/Installation.md +++ b/user-doc/Installation.md @@ -425,6 +425,9 @@ If you didn't specify the `--prefix` option during configure PLUMED will be inst 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`.