From d6d2f2845072e75cdf1e21bd5d28aba70610bce7 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Tue, 22 May 2012 08:37:08 +0100 Subject: [PATCH] comerr: Convert to using libtool Convert the libafs_comerr library so that it uses libtool. comerr uses a pthread lock to protect the error tables, so it needs to be built as both an LWP, and a pthread library (previously, we've just built it as LWP, which is probably broken on some platforms, as it won't define -D_REENTRANT) libafscom_err.a remains as the LWP variant, and all pthreaded code is modified to use the libtool liboafs_comerr.la library. Change-Id: Id421cc97ad8681b42af7a5eb3cb512e1e1ce9a90 Reviewed-on: http://gerrit.openafs.org/8054 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/comerr/Makefile.in | 24 +++++++++++++++++------- src/comerr/liboafs_comerr.la.sym | 10 ++++++++++ src/tubik/Makefile.in | 3 ++- tests/cmd/Makefile.in | 2 +- 4 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 src/comerr/liboafs_comerr.la.sym diff --git a/src/comerr/Makefile.in b/src/comerr/Makefile.in index 104ba8b12..794d7afcd 100644 --- a/src/comerr/Makefile.in +++ b/src/comerr/Makefile.in @@ -6,10 +6,16 @@ srcdir=@srcdir@ include @TOP_OBJDIR@/src/config/Makefile.config +include @TOP_OBJDIR@/src/config/Makefile.libtool include @TOP_OBJDIR@/src/config/Makefile.lwp +LT_objs = error_msg.lo et_name.lo com_err.lo AFS_component_version_number.lo +LT_deps = $(top_builddir)/src/opr/liboafs_opr.la +LT_libs = $(MT_LIBS) -all: compile_et ${TOP_INCDIR}/afs/com_err.h ${TOP_INCDIR}/afs/error_table.h ${TOP_INCDIR}/afs/mit-sipb-cr.h ${TOP_LIBDIR}/libafscom_err.a +all: compile_et ${TOP_INCDIR}/afs/com_err.h ${TOP_INCDIR}/afs/error_table.h \ + ${TOP_INCDIR}/afs/mit-sipb-cr.h ${TOP_LIBDIR}/libafscom_err.a \ + liboafs_comerr.la buildtools: compile_et @@ -37,12 +43,12 @@ compile_et: compile_et.o error_table.o $(AFS_LDRULE_NOQ) compile_et.o error_table.o -L${TOP_LIBDIR} -lopr -ll;; \ esac -libafscom_err.a: error_msg.o et_name.o com_err.o AFS_component_version_number.o - $(RM) -f $@ - $(AR) crv $@ error_msg.o et_name.o com_err.o AFS_component_version_number.o - $(RANLIB) $@ +libafscom_err.a: $(LT_objs) + $(LT_LDLIB_lwp) $(LT_objs) + +liboafs_comerr.la: $(LT_objs) $(LT_deps) + $(LT_LDLIB_shlib) $(LT_objs) $(LT_deps) $(LT_libs) -# # When we build this file, we're using a .c file that's in the object directory, # so we need to add the source directory to the includes to pick up local headers. # @@ -51,7 +57,8 @@ CFLAGS_error_table.o= -I${srcdir} @CFLAGS_NOUNUSED@ @CFLAGS_NOOLDSTYLE@ # # Installation targets # -install: compile_et com_err.h error_table.h mit-sipb-cr.h libafscom_err.a +install: compile_et com_err.h error_table.h mit-sipb-cr.h libafscom_err.a \ + liboafs_comerr.la ${INSTALL} -d ${DESTDIR}${bindir} ${INSTALL} -d ${DESTDIR}${includedir}/afs ${INSTALL} -d ${DESTDIR}${libdir}/afs @@ -60,6 +67,7 @@ install: compile_et com_err.h error_table.h mit-sipb-cr.h libafscom_err.a ${INSTALL_DATA} ${srcdir}/error_table.h ${DESTDIR}${includedir}/afs/error_table.h ${INSTALL_DATA} ${srcdir}/mit-sipb-cr.h ${DESTDIR}${includedir}/afs/mit-sipb-cr.h ${INSTALL_DATA} libafscom_err.a ${DESTDIR}${libdir}/afs/libafscom_err.a + $(LT_INSTALL_DATA) liboafs_comerr.la $(DESTDIR)$(libdir)liboafs_comerr.la dest: compile_et com_err.h error_table.h mit-sipb-cr.h libafscom_err.a ${INSTALL} -d ${DEST}/bin @@ -72,6 +80,7 @@ dest: compile_et com_err.h error_table.h mit-sipb-cr.h libafscom_err.a ${INSTALL_DATA} libafscom_err.a ${DEST}/lib/afs/libafscom_err.a clean: + $(LT_CLEAN) $(RM) -f *~ \#* *.bak *.otl *.aux *.toc *.PS *.dvi *.x9700 *.ps \ *.cp *.fn *.ky *.log *.pg *.tp *.vr *.o libafscom_err.a \ com_err.o compile_et et.ar TAGS y.tab.c lex.yy.c error_table.c \ @@ -84,5 +93,6 @@ test: compile_et.o: AFS_component_version_number.c # specify yacc build product as a dependency so our .c.o rule will apply error_table.o: et_lex.lex.c error_table.c +error_table.lo: et_lex.lex.c error_table.c include ../config/Makefile.version diff --git a/src/comerr/liboafs_comerr.la.sym b/src/comerr/liboafs_comerr.la.sym new file mode 100644 index 000000000..3b0598535 --- /dev/null +++ b/src/comerr/liboafs_comerr.la.sym @@ -0,0 +1,10 @@ +afs_com_err +afs_com_err_va +afs_error_table_name +afs_error_message +afs_error_message_localize +afs_set_com_err_hook +afs_reset_com_err_hook +afs_add_to_error_table +afs_com_right_r +afs_com_right diff --git a/src/tubik/Makefile.in b/src/tubik/Makefile.in index 3f4856497..f8dcbfc00 100644 --- a/src/tubik/Makefile.in +++ b/src/tubik/Makefile.in @@ -31,7 +31,8 @@ UTILOBJS=uuid.o serverLog.o fileutil.o dirpath.o \ pthread_threadname.o LIBS=${RXOBJS} ${UTILOBJS} ${TOP_LIBDIR}/libafsauthent.a ${TOP_LIBDIR}/libafsrpc.a \ - ${TOP_LIBDIR}/libafscom_err.a ${TOP_LIBDIR}/libcmd.a \ + $(top_builddir)/src/comerr/liboafs_comerr.la \ + $(TOP_LIBDIR)/libcmd.a \ ${TOP_LIBDIR}/libsys.a \ $(top_builddir)/src/opr/liboafs_opr.la \ ${XLIBS} ${MT_LIBS} diff --git a/tests/cmd/Makefile.in b/tests/cmd/Makefile.in index 43aceb024..e8e5b86b6 100644 --- a/tests/cmd/Makefile.in +++ b/tests/cmd/Makefile.in @@ -9,7 +9,7 @@ MODULE_CFLAGS = -I$(srcdir)/../.. LIBS = ../tap/libtap.a \ $(abs_top_builddir)/lib/libcmd.a \ - $(abs_top_builddir)/lib/libafscom_err.a \ + $(abs_top_builddir)/src/comerr/liboafs_comerr.la \ $(abs_top_builddir)/src/opr/liboafs_opr.la \ $(abs_top_builddir)/lib/util.a -- 2.39.5