Patch for shared libgm

Douglas Johnson <[email protected]>
Newsgroups gmane.network.myrinet.general
Message-ID <[email protected]>
Hi, 

Attached is a patch to build a shared version of libgm on linux. The
motivation for this is to minimize the need to recompile user mpi
codes when upgrading gm and mpich. When used in conjunction with
shared mpich libraries it will increase the ability to change versions
of gm and mpich transparently to users without forcing them to
recompile their mpi programs. To use this patch perform the following,

cd [gm src directory]
patch -p0 < [location of patch]
autoconf configure.in > configure
chmod +x configure

Run the configure script with your normal options and include
--enable-sharedlib. Type 'make shared' instead of 'make'. This has
been tested on linux x86 platforms, and should work on other linux
platforms.


**Cut here**

--- ../clean/gm-1.2.3/configure.in	Thu May  4 19:35:23 2000
+++ configure.in	Wed Aug 23 12:07:09 2000
@@ -110,6 +110,9 @@
 
 AC_ARG_ENABLE(directcopy, --enable-directcopy: enable the direct memory copy for MPI-GM/SMP, enable_directcopy=$enableval, enable_directcopy=no)
 
+AC_ARG_ENABLE(sharedlib, --enable-sharedlib: Builds a shared version of libgm, enable_sharedlib=$enableval, enable_sharedlib=no)
+
+
 if (test ${MAX_SRAM} = 256) || (test ${MAX_SRAM} = 512) || (test ${MAX_SRAM} = 1024) ; then
 	echo "max_sram is ${MAX_SRAM}"
 else
@@ -169,10 +172,23 @@
 	CPP_EXTRA_FLAGS=""
 fi
 
+if test "$enable_sharedlib" = yes; then
+    case ${target} in
+	*-*-linux*)
+	    CC_EXTRA_FLAGS="-fPIC"
+	    SHAREDLIB_FLAGS="-g -shared -Wl,-soname,libgm.so.1.2"
+	    LIBGM_TYPE="shared"
+	    ;;
+    esac
+fi
+
 AC_SUBST(LINUX_SMP)
 AC_SUBST(LINUX_MODVER)
 AC_SUBST(LANAI3_EXTRA_FLAGS)
 AC_SUBST(CPP_EXTRA_FLAGS)
+AC_SUBST(CC_EXTRA_FLAGS)
+AC_SUBST(SHAREDLIB_FLAGS)
+AC_SUBST(LIBGM_TYPE)
 
 dnl echo enable_l4 = $enable_l4
 dnl echo enable_l5 = $enable_l5
--- ../clean/gm-1.2.3/Makefile.in	Fri Jun 16 14:48:51 2000
+++ Makefile.in	Sat Aug 26 11:45:00 2000
@@ -64,6 +64,7 @@
 
 DUSER		= @DUSER@
 
+CC_EXTRA_FLAGS	= @CC_EXTRA_FLAGS@
 CPPFLAGS	= @CPPFLAGS@ @DEFS@ -Iinclude -I$(srcdir)/include \
 			-I$(srcdir)/$(driverdir)/gm -DGM_DEBUG=@GM_HOST_DEBUG@ \
 			$(DUSER) -DINSIST @CPP_EXTRA_FLAGS@
@@ -114,6 +115,7 @@
 GM_REL = $(shell uname -r)
 GM_MACH = $(shell uname -m | sed -e 's/i[0-9]86/x86/')
 GM_TARGET = $(GM_MACH)-$(GM_SYS)-$(GM_REL)
+SHAREDLIB_FLAGS = @SHAREDLIB_FLAGS@
 
 # If it exists, include the Makefile.overrides file to allow manual
 # overrides of automatically configured variables.  This allows
@@ -774,7 +776,10 @@
 	$(RANLIB) $@
 
 libgm/%.o: libgm/%.c
-	$(CC) -c $(LIBGM_CFLAGS) $< -o $@
+	$(CC) -c $(LIBGM_CFLAGS) $(CC_EXTRA_FLAGS) $< -o $@
+
+shared: $(ALL)
+	$(CC) $(SHAREDLIB_FLAGS) $(LIB_OBJS) -o binary/lib/libgm.so.1.2.3
 
 ############
 # Cleanliness


Doug Johnson
Systems Developer/Engineer
The Ohio Supercomputer Center
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.