From 052b68fff4c963dbdc5a927ae3d579fd9e7ee7ad Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Thu, 30 Jul 2015 11:10:00 +0200
Subject: [PATCH] Fixes

* added comments on install paths at the end of ./configure
* fixed include path in modulefile
* make obj/kernel.o only when necessary
---
 configure             | 29 +++++++++++++++++++++++++----
 configure.ac          | 14 ++++++++++++--
 src/lib/Makefile      |  9 +++++++--
 src/lib/modulefile.in |  2 +-
 4 files changed, 45 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index f2544f377..84c06ac0d 100755
--- a/configure
+++ b/configure
@@ -6880,6 +6880,7 @@ program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
 program_transform_name_sh=$(echo "${program_transform_name}" | sed 's:\$\$:$:g')
 program_name=$(echo plumed | sed "$program_transform_name_sh")
 
+
 if test "$(echo "$program_name" | tr 'A-Z' 'a-z')" != "$(echo "$program_name" | tr 'A-Z' 'a-z' | sed 's/kernel$//')" ; then
   as_fn_error $? "$program_name is not a valid program name (should not terminate with Kernel)" "$LINENO" 5
 fi
@@ -6887,12 +6888,32 @@ if test "$(echo "$program_name" | tr 'A-Z' 'a-z')" != "$(echo "$program_name" |
   as_fn_error $? "$program_name is not a valid program name (should not terminate with -patch)" "$LINENO" 5
 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 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}: **** PLUMED will be installed using the following paths:" >&5
+$as_echo "$as_me: **** PLUMED will be installed using the following paths:" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: **** prefix: $prefix" >&5
+$as_echo "$as_me: **** prefix: $prefix" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: **** exec_prefix: $exec_prefix" >&5
+$as_echo "$as_me: **** exec_prefix: $exec_prefix" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: **** bindir: $bindir" >&5
+$as_echo "$as_me: **** bindir: $bindir" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: **** libdir: $libdir" >&5
+$as_echo "$as_me: **** libdir: $libdir" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: **** includedir: $includedir" >&5
+$as_echo "$as_me: **** includedir: $includedir" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: **** datarootdir: $datarootdir" >&5
+$as_echo "$as_me: **** datarootdir: $datarootdir" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: **** datadir: $datadir" >&5
+$as_echo "$as_me: **** datadir: $datadir" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: **** docdir: ${datarootdir}/doc/$program_name" >&5
+$as_echo "$as_me: **** docdir: ${datarootdir}/doc/$program_name" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: **** htmldir: $htmldir" >&5
+$as_echo "$as_me: **** htmldir: $htmldir" >&6;}
 { $as_echo "$as_me:${as_lineno-$LINENO}: **** Executable will be named $program_name" >&5
 $as_echo "$as_me: **** Executable will be named $program_name" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: **** You can change paths later using options to \"make install\"" >&5
+$as_echo "$as_me: **** You can change paths later using options to \"make install\"" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: **** e.g. with \"make install prefix=/path\"" >&5
+$as_echo "$as_me: **** e.g. with \"make install prefix=/path\"" >&6;}
 
 if test $mpi == true; then
   if test $mpi_found == ok; then
diff --git a/configure.ac b/configure.ac
index a91dadcec..ee4639944 100644
--- a/configure.ac
+++ b/configure.ac
@@ -724,9 +724,19 @@ if test "$(echo "$program_name" | tr '[A-Z]' '[a-z]')" != "$(echo "$program_name
   AC_MSG_ERROR([$program_name is not a valid program name (should not terminate with -patch)])
 fi
 
-AC_MSG_NOTICE([**** PLUMED will be installed using prefix $prefix])
-AC_MSG_NOTICE([**** You can change this later using "make install prefix=/path"])
+AC_MSG_NOTICE([**** PLUMED will be installed using the following paths:])
+AC_MSG_NOTICE([**** prefix: $prefix])
+AC_MSG_NOTICE([**** exec_prefix: $exec_prefix])
+AC_MSG_NOTICE([**** bindir: $bindir])
+AC_MSG_NOTICE([**** libdir: $libdir])
+AC_MSG_NOTICE([**** includedir: $includedir])
+AC_MSG_NOTICE([**** datarootdir: $datarootdir])
+AC_MSG_NOTICE([**** datadir: $datadir])
+AC_MSG_NOTICE([**** docdir: ${datarootdir}/doc/$program_name])
+AC_MSG_NOTICE([**** htmldir: $htmldir])
 AC_MSG_NOTICE([**** Executable will be named $program_name])
+AC_MSG_NOTICE([**** You can change paths later using options to "make install"])
+AC_MSG_NOTICE([**** e.g. with "make install prefix=/path"])
 
 if test $mpi == true; then
   if test $mpi_found == ok; then
diff --git a/src/lib/Makefile b/src/lib/Makefile
index 514c8d197..ba64da193 100644
--- a/src/lib/Makefile
+++ b/src/lib/Makefile
@@ -80,7 +80,7 @@ install-build:
 	mkdir -p install/
 	$(MAKE) PLUMED_INSTALL=Install all
 ifdef LD_RO
-	$(LD_RO) install/kernel.o $(OBJ_KERNEL)
+	$(MAKE) install/kernel.o
 endif
 # modulefile
 	@cat modulefile.in | \
@@ -91,6 +91,11 @@ endif
            sed "s|@_includedir_@|$(includedir)|" \
 	   > install/modulefile
 
+ifdef LD_RO
+install/kernel.o: $(OBJ_KERNEL)
+	$(LD_RO) install/kernel.o $(OBJ_KERNEL)
+endif
+
 install:
 ifdef PLUMED_PREFIX
 	@echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
@@ -155,7 +160,7 @@ ifdef SOEXT
 	cp install/libplumedKernel.$(SOEXT) $(DESTDIR)$(libdir)/lib$(program_name)Kernel.$(SOEXT)
 endif
 # modulefile
-	cp install/modulefile $(DESTDIR)$(libdir)/$(program_name)/src/lib/modulefile
+	cp install/modulefile $(DESTDIR)$(libdir)/$(program_name)/modulefile
 # making everything visible:
 	chmod -R go+rX,go-w $(DESTDIR)$(libdir)/$(program_name)
 	chmod -R go+rX,go-w $(DESTDIR)$(includedir)/$(program_name)
diff --git a/src/lib/modulefile.in b/src/lib/modulefile.in
index fc264258a..e3262a580 100644
--- a/src/lib/modulefile.in
+++ b/src/lib/modulefile.in
@@ -7,7 +7,7 @@ set libdir "@_libdir_@"
 # this is the path for binaries
 set bindir "@_bindir_@"
 # this is the path for include files
-set bindir "@_includedir_@"
+set includedir "@_includedir_@"
 # this is the extension for dynamic libraries
 # if set to empty, switches off plumed library
 set soext  "@_SOEXT_@"
-- 
GitLab