From 206087c26e16578a5c596f1d64b14fc7a56fcc75 Mon Sep 17 00:00:00 2001 From: Giovanni Bussi <giovanni.bussi@gmail.com> Date: Thu, 4 Jun 2015 08:18:54 +0200 Subject: [PATCH] Replaced PLUMED_PREFIX with prefix This makes it compatible with the standard behavior of GNU tools. PLUMED_PREFIX still works but is now deprecated and dumps a warning. I will convert it to an error in a later version (2.3). --- configure | 4 ++-- configure.ac | 2 +- src/maketools/update-plumedroot.sh | 18 +++++++++++++++--- user-doc/Installation.txt | 25 +++++++++++-------------- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/configure b/configure index ea9d71c5b..2152e62a9 100755 --- a/configure +++ b/configure @@ -6483,8 +6483,8 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: **** PLUMED will be installed using prefix $prefix" >&5 $as_echo "$as_me: **** PLUMED will be installed using prefix $prefix" >&6;} -{ $as_echo "$as_me:${as_lineno-$LINENO}: **** You can change this later setting PLUMED_PREFIX environment variable before installing" >&5 -$as_echo "$as_me: **** You can change this later setting PLUMED_PREFIX environment variable before installing" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: **** You can change this later using \"make install prefix=/path\"" >&5 +$as_echo "$as_me: **** You can change this later using \"make install prefix=/path\"" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: **** Executable will be named 'plumed'" >&5 $as_echo "$as_me: **** Executable will be named 'plumed'" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: **** To add a suffix to this name, set PLUMED_LIBSUFFIX environment variable before installing" >&5 diff --git a/configure.ac b/configure.ac index 46363169e..f63e94ab1 100644 --- a/configure.ac +++ b/configure.ac @@ -513,7 +513,7 @@ then fi AC_MSG_NOTICE([**** PLUMED will be installed using prefix $prefix]) -AC_MSG_NOTICE([**** You can change this later setting PLUMED_PREFIX environment variable before installing]) +AC_MSG_NOTICE([**** You can change this later using "make install prefix=/path"]) AC_MSG_NOTICE([**** Executable will be named 'plumed']) AC_MSG_NOTICE([**** To add a suffix to this name, set PLUMED_LIBSUFFIX environment variable before installing]) diff --git a/src/maketools/update-plumedroot.sh b/src/maketools/update-plumedroot.sh index af7a2d2db..36d15a97c 100755 --- a/src/maketools/update-plumedroot.sh +++ b/src/maketools/update-plumedroot.sh @@ -11,15 +11,27 @@ prefix="${prefix:=/usr/local}" # if environment variable PLUMED_PREFIX is set, # override the present prefix -PLUMED_PREFIX="${PLUMED_PREFIX:=$prefix}" +if test -n "$PLUMED_PREFIX" ; then + echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" + echo "WARNING: using PLUMED_PREFIX variable is deprecated" + echo " please use one of the following choices:" + echo " (1) at configure time:" + echo " ./configure --prefix=$PLUMED_PREFIX" + echo " (2) or later, at install time:" + echo " make install prefix=$PLUMED_PREFIX" + echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +# this will result in an error in a later version +# now we fall back to the previous behavior + prefix="${PLUMED_PREFIX}" +fi PLUMED_LIBSUFFIX="${PLUMED_LIBSUFFIX:=}" test -n "$PLUMED_LIBSUFFIX" && PLUMED_LIBSUFFIX="-${PLUMED_LIBSUFFIX}" -PLUMED_ROOT="${PLUMED_PREFIX}/lib/plumed${PLUMED_LIBSUFFIX}/" +PLUMED_ROOT="$prefix/lib/plumed${PLUMED_LIBSUFFIX}/" { echo "PLUMED_INSTALL_ROOT=${PLUMED_ROOT}" -echo "PLUMED_INSTALL_PREFIX=${PLUMED_PREFIX}" +echo "PLUMED_INSTALL_PREFIX=$prefix" echo "PLUMED_INSTALL_LIBSUFFIX=${PLUMED_LIBSUFFIX}" } > install.conf diff --git a/user-doc/Installation.txt b/user-doc/Installation.txt index d2f9a86e8..8f67ed6ad 100644 --- a/user-doc/Installation.txt +++ b/user-doc/Installation.txt @@ -296,29 +296,28 @@ The standard way to do it is during the configure step: > make install \endverbatim However, you can also change it after compilation setting -the environment variable PLUMED_PREFIX. +the variable `prefix`. \verbatim > ./configure > make -> export PLUMED_PREFIX=$HOME/opt -> make install +> make install prefix=$HOME/opt \endverbatim -If you didn't specify the --prefix option during configure, and you did not set the PLUMED_PREFIX -environment variable, PLUMED will be installed in /usr/local. +If you didn't specify the `--prefix` option during configure, and you did not set the `prefix` +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. Notice that upon installation PLUMED currently needs to relink a library. If root user does not have access to compilers, "sudo -E make install" might solve the issue. An almost full copy of the compilation directory will -be installed into $PLUMED_PREFIX/lib/plumed/ directory. A link to the proper -PLUMED executable will be set up in $PLUMED_PREFIX/bin, -PLUMED include files will be copied to $PLUMED_PREFIX/include/plumed -and PLUMED libraries will be linked to $PLUMED_PREFIX/lib. +be installed into $prefix/lib/plumed/ directory. A link to the proper +PLUMED executable will be set up in $prefix/bin, +PLUMED include files will be copied to $prefix/include/plumed +and PLUMED libraries will be linked to $prefix/lib. One should then set the environment properly. We suggest to do it using the module framework (http://modules.sourceforge.net). An ad hoc generated -module file for PLUMED can be found in $PLUMED_PREFIX/lib/plumed/src/lib/modulefile +module file for PLUMED can be found in $prefix/lib/plumed/src/lib/modulefile Just edit it as you wish and put it in your modulefile directory. This will also allow you to install multiple PLUMED versions on your machine and to switch amongst them. If you do not want to use modules, you can @@ -335,11 +334,9 @@ the following things: exploit the PLUMED library in general purpose programs As a final note, if you want to install several PLUMED versions without using modules then you can -define the environment variable PLUMED_LIBSUFFIX using: +define the variable PLUMED_LIBSUFFIX using: \verbatim -> export PLUMED_PREFIX=$HOME/opt -> export PLUMED_LIBSUFFIX=v2.0 -> make install +> make install prefix=$HOME/opt PLUMED_LIBSUFFIX=v2.0 \endverbatim This will install a plumed executable named "plumed-v2.0". All the other files will be renamed similarly, e.g. the PLUMED library will be loaded with "-lplumed-v2.0" and the PLUMED header files -- GitLab