Bug 444688 - Autotools shared lib example not building

- make changes to default shared library template to handle
  changes made to external autotools
- add the rpath specification to the exampleProgram build so it
  will just run without having to set LD_LIBRARY_PATH

Change-Id: I299c274bc07e91bbe6cf955c5391faf4f87b3edc
Reviewed-on: https://git.eclipse.org/r/34531
Tested-by: Hudson CI
Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
Tested-by: Jeff Johnston <jjohnstn@redhat.com>
diff --git a/build/org.eclipse.cdt.autotools.ui/templates/projecttemplates/AutotoolsSharedLibraryProject/Makefile.am b/build/org.eclipse.cdt.autotools.ui/templates/projecttemplates/AutotoolsSharedLibraryProject/Makefile.am
index dd87335..efd2431 100644
--- a/build/org.eclipse.cdt.autotools.ui/templates/projecttemplates/AutotoolsSharedLibraryProject/Makefile.am
+++ b/build/org.eclipse.cdt.autotools.ui/templates/projecttemplates/AutotoolsSharedLibraryProject/Makefile.am
@@ -1 +1,2 @@
 SUBDIRS=$(libName) include exampleProgram
+ACLOCAL_AMFLAGS=-I m4
diff --git a/build/org.eclipse.cdt.autotools.ui/templates/projecttemplates/AutotoolsSharedLibraryProject/configure.ac b/build/org.eclipse.cdt.autotools.ui/templates/projecttemplates/AutotoolsSharedLibraryProject/configure.ac
index 85c2c36..db600be 100644
--- a/build/org.eclipse.cdt.autotools.ui/templates/projecttemplates/AutotoolsSharedLibraryProject/configure.ac
+++ b/build/org.eclipse.cdt.autotools.ui/templates/projecttemplates/AutotoolsSharedLibraryProject/configure.ac
@@ -6,6 +6,8 @@
 
 AC_CANONICAL_SYSTEM
 
+AC_CONFIG_MACRO_DIR([m4])
+
 dnl Initialize automake
 AM_INIT_AUTOMAKE
 
@@ -15,10 +17,6 @@
 dnl Initialize Libtool
 LT_INIT
 
-dnl Check if Libtool is present
-dnl Libtool is used for building share libraries 
-AC_PROG_LIBTOOL
-
 AC_CONFIG_FILES(Makefile
                 exampleProgram/Makefile
                 $(libName)/Makefile
diff --git a/build/org.eclipse.cdt.autotools.ui/templates/projecttemplates/AutotoolsSharedLibraryProject/exampleProgram/Makefile.am b/build/org.eclipse.cdt.autotools.ui/templates/projecttemplates/AutotoolsSharedLibraryProject/exampleProgram/Makefile.am
index 9c61633..2b6dd21 100644
--- a/build/org.eclipse.cdt.autotools.ui/templates/projecttemplates/AutotoolsSharedLibraryProject/exampleProgram/Makefile.am
+++ b/build/org.eclipse.cdt.autotools.ui/templates/projecttemplates/AutotoolsSharedLibraryProject/exampleProgram/Makefile.am
@@ -15,11 +15,16 @@
 # replaced by '_'. So a.out becomes a_out and the appropriate suffex added.
 # '_SOURCES' for example.
 
+ACLOCAL_AMFLAGS=-I ../m4
+
 # Sources for the a.out 
 exampleProgram_SOURCES= exampleProgram.c
 
+# Libraries for a.out
+exampleProgram_LDADD = $(top_srcdir)/$(libName)/$(libName).la
+
 # Linker options for a.out
-exampleProgram_LDFLAGS = $(top_srcdir)/$(libName)/$(libName).la
+exampleProgram_LDFLAGS = -rpath `cd $(top_srcdir);pwd`/$(libName)/.libs
 
 # Compiler options for a.out
 exampleProgram_CPPFLAGS = -I$(top_srcdir)/include
diff --git a/build/org.eclipse.cdt.autotools.ui/templates/projecttemplates/AutotoolsSharedLibraryProject/template.xml b/build/org.eclipse.cdt.autotools.ui/templates/projecttemplates/AutotoolsSharedLibraryProject/template.xml
index b55e4d8..e9978ef 100644
--- a/build/org.eclipse.cdt.autotools.ui/templates/projecttemplates/AutotoolsSharedLibraryProject/template.xml
+++ b/build/org.eclipse.cdt.autotools.ui/templates/projecttemplates/AutotoolsSharedLibraryProject/template.xml
@@ -52,6 +52,11 @@
 		<simple name="path" value="include"/>
 	</process>
 
+	<process type="org.eclipse.cdt.core.CreateSourceFolder">
+		<simple name="projectName" value="$(projectName)"/>
+		<simple name="path" value="m4"/>
+	</process>
+
 	<process type="org.eclipse.cdt.core.AddFiles">
 		<simple name="projectName" value="$(projectName)"/>
 		<complex-array name="files">