klibtool works for the most part. However, on HP-UX, it does not
*relink* executables at install time resulting in relative paths in
the executables (HP embeds the path specified with -L in the
executable). Rather than fixing klibtool, I made the switch to
libtool.

libtool.m4 and ltmain.sh need to be copied to texk/. I have not
included a version in this patch due to their size.

I would *really* like to see this integrated. If additional work needs
to be done to integrate it better, please let me know. A big question
is the version number for the shared libkpathsea library. I've used
4:0:0 only to move away from the 3.x.y version currently used. Maybe
something else is more suitable.

-- 
albert chin ([EMAIL PROTECTED])

-- snip snip
--- texk/make/programs.mk.orig  Mon Feb  3 20:03:10 2003
+++ texk/make/programs.mk       Mon Feb  3 20:24:46 2003
@@ -15,5 +15,6 @@
 
 # When we link with Kpathsea, have to take account that it might be a
 # shared library, etc.
-kpathsea_link = $(LIBTOOL) link $(link_command)
+kpathsea_link = $(LIBTOOL) --mode=link $(link_command) \
+       -rpath $(libdir)
 # End of programs.mk.
--- texk/makeindexk/Makefile.in.orig    Mon Feb  3 21:58:45 2003
+++ texk/makeindexk/Makefile.in Mon Feb  3 21:58:59 2003
@@ -20,7 +20,7 @@
 
 install-exec: $(programs)
        $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir)
-       $(INSTALL_LIBTOOL_PROG) $(bindir) $(program)
+       $(INSTALL_LIBTOOL_PROG) $(program) $(bindir)
        $(INSTALL_SCRIPT) $(srcdir)/mkindex $(scriptdir)/mkindex
 uninstall-exec:
        cd $(bindir) && rm -f $(program)
--- texk/web2c/otps/Makefile.in.orig    Mon Feb  3 21:50:58 2003
+++ texk/web2c/otps/Makefile.in Mon Feb  3 21:51:08 2003
@@ -36,7 +36,7 @@
 
 install-programs: $(programs)
        $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) 
-       for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $(bindir) $$p; done
+       for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $$p $(bindir); done
        for p in $(scripts); do $(INSTALL_SCRIPT) $(srcdir)/$$p $(scriptdir); done
 
 Makefile: Makefile.in ../config.status
--- texk/web2c/pdftexdir/pdftex.mk.orig Mon Feb  3 20:49:53 2003
+++ texk/web2c/pdftexdir/pdftex.mk      Mon Feb  3 20:50:06 2003
@@ -33,7 +33,7 @@
 ttf2afm: ttf2afm.o
        $(kpathsea_link) ttf2afm.o $(kpathsea)
 ttf2afm.o: ttf2afm.c macnames.c
-       $(compile) $<
+       $(compile) -c $< -o $@
 ttf2afm.c:
        $(LN) $(srcdir)/pdftexdir/ttf2afm.c .
 macnames.c:
--- texk/web2c/omegadir/omega.mk.orig   Mon Feb  3 21:48:22 2003
+++ texk/web2c/omegadir/omega.mk        Mon Feb  3 21:48:33 2003
@@ -117,7 +117,7 @@
 # The actual binary executables and pool files.
 install-omega-programs: $(omega_programs)
        $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir)
-       for p in omega; do $(INSTALL_LIBTOOL_PROG) $(bindir) $$p; done
+       for p in omega; do $(INSTALL_LIBTOOL_PROG) $$p $(bindir); done
        cd otps && $(MAKE) $(install_makeargs) install-programs
        cd omegafonts && $(MAKE) $(install_makeargs) install-programs
 
--- texk/web2c/mpware/Makefile.in.orig  Mon Feb  3 21:45:08 2003
+++ texk/web2c/mpware/Makefile.in       Mon Feb  3 21:45:25 2003
@@ -47,8 +47,8 @@
 install-exec: $(programs)
        $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) $(scriptdir)
        $(INSTALL_PROGRAM) newer $(bindir)/newer
-       $(INSTALL_LIBTOOL_PROG) $(bindir) dmp
-       $(INSTALL_LIBTOOL_PROG) $(bindir) mpto
+       $(INSTALL_LIBTOOL_PROG) dmp $(bindir)
+       $(INSTALL_LIBTOOL_PROG) mpto $(bindir)
        $(INSTALL_SCRIPT) makempx $(scriptdir)/makempx
 install-data:
 
--- texk/web2c/omegafonts/Makefile.in.orig      Mon Feb  3 21:49:28 2003
+++ texk/web2c/omegafonts/Makefile.in   Mon Feb  3 21:49:39 2003
@@ -53,7 +53,7 @@
 
 install-programs: $(programs)
        $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) 
-       for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $(bindir) $$p; done
+       for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $$p $(bindir); done
 
 install-links: install-programs
        for f in ""$(linked_programs); do \
--- texk/web2c/Makefile.in.orig Mon Feb  3 20:45:43 2003
+++ texk/web2c/Makefile.in      Mon Feb  3 21:47:18 2003
@@ -38,7 +38,7 @@
 CXX = @CXX@
 CXXLD = $(CXX)
 cxx_link_command = $(CXXLD) -o $@ $(LDFLAGS)
-kpathsea_cxx_link = $(LIBTOOL) link $(cxx_link_command)
+kpathsea_cxx_link = $(LIBTOOL) --mode=link $(cxx_link_command)
 
 @MAINT@ifeq ($(CC), gcc)
 @MAINT@XDEFS = -Wimplicit -Wreturn-type -Wcomment -Wformat
@@ -180,7 +180,7 @@
 @MFW@$(mfw): $(mf_o) $(windowlib)
 @MFW@  $(kpathsea_link) $(mf_o) $(windowlink) $(LOADLIBES)
 @[EMAIL PROTECTED]: mfnowin.c
-@MFN@  $(compile) -DMFNOWIN $<
+@MFN@  $(compile) -DMFNOWIN -c $< -o $@
 @MFN@$(mfn): $(mf_nowin_o) window/trap.o
 @MFN@  $(kpathsea_link) $(mf_nowin_o) window/trap.o $(LOADLIBES)
 @MFW@@MFN@mf: $(mfw)
@@ -581,7 +581,7 @@
        $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) $(texpooldir) \
          $(mfpooldir) $(mppooldir)
        cd mpware && $(MAKE) $(install_makeargs) install-exec
-       for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $(bindir) $$p; done
+       for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $$p $(bindir); done
 @OMEGA@        cd omegafonts && $(MAKE) $(install_makeargs) install-programs 
install-links
 @OMEGA@        cd otps && $(MAKE) $(install_makeargs) install-programs
 
--- texk/xdvik/Makefile.in.orig Mon Feb  3 22:06:36 2003
+++ texk/xdvik/Makefile.in      Mon Feb  3 22:06:47 2003
@@ -103,7 +103,7 @@
 
 install-exec: $(program)
        $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir)
-       for p in $(program); do $(INSTALL_LIBTOOL_PROG) $(bindir) $$p; done
+       for p in $(program); do $(INSTALL_LIBTOOL_PROG) $$p $(bindir); done
        $(INSTALL_SCRIPT) $(srcdir)/$(perlprog) $(scriptdir)/$(perlprog)
        $(INSTALL_SCRIPT) $(srcdir)/xdvi-sh $(scriptdir)/xdvi
        $(INSTALL_SCRIPT) $(srcdir)/xdvizilla $(scriptdir)/xdvizilla
--- texk/kpathsea/common.ac.orig        Mon Feb  3 18:15:42 2003
+++ texk/kpathsea/common.ac     Mon Feb  3 18:26:09 2003
@@ -20,17 +20,12 @@
                  string.h sys/param.h unistd.h)
 
 
-dnl We would to do the klibtool stuff only in kpathsea (i.e., in
-dnl kpathsea/configure.in instead of here in common.ac), but then
-dnl HAVE_PUTENV etc. are not defined when compiling the programs,
-dnl because <kpathsea/config.h> includes <c-auto.h> (the programs'),
-dnl not <kpathsea/c-auto.h>.  Should it include both?  But then we will
-dnl have many benign redefinitions that some compilers may not consider
-dnl benign.  And it's a big change.
-sinclude(../../texk/acklibtool.m4)
-kb_AC_PROG_LIBTOOL
 dnl If the list of functions here changes, also change acconfig.h.  */
-kb_AC_KLIBTOOL_REPLACE_FUNCS(putenv strcasecmp strtol strstr)
+AC_CHECK_FUNCS(putenv,, LTLIBOBJS="$LTLIBOBJS putenv.lo")
+AC_CHECK_FUNCS(strcasecmp,, LTLIBOBJS="$LTLIBOBJS strcasecmp.lo")
+AC_CHECK_FUNCS(strtol,, LTLIBOBJS="$LTLIBOBJS strtol.lo")
+AC_CHECK_FUNCS(strstr,, LTLIBOBJS="$LTLIBOBJS strstr.lo")
+AC_SUBST(LTLIBOBJS)
 
 AC_CHECK_FUNCS(bcmp bcopy bzero getcwd getwd index memcmp memcpy rindex strchr 
strrchr)
 
--- texk/dvipdfm/Makefile.in.orig       Mon Feb  3 21:54:04 2003
+++ texk/dvipdfm/Makefile.in    Mon Feb  3 21:54:18 2003
@@ -50,8 +50,8 @@
 
 install-exec:
        $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir)
-       $(INSTALL_LIBTOOL_PROG) $(bindir) $(program)
-       $(INSTALL_LIBTOOL_PROG) $(bindir) ebb
+       $(INSTALL_LIBTOOL_PROG) $(program) $(bindir)
+       $(INSTALL_LIBTOOL_PROG) ebb $(bindir)
 
 uninstall-exec:
        cd $(bindir); rm -f $(programs)
--- texk/dviljk/Makefile.in.orig        Mon Feb  3 21:01:09 2003
+++ texk/dviljk/Makefile.in     Mon Feb  3 21:53:13 2003
@@ -36,17 +36,13 @@
        $(kpathsea_link) $(objects4l) $(LOADLIBES)
 
 dvilj.o:
-       $(compile) -DLJ $(srcdir)/dvi2xx.c
-       mv dvi2xx.o $@
+       $(compile) -DLJ -c $(srcdir)/dvi2xx.c -o $@
 dvilj2p.o:
-       $(compile) -DLJ2P $(srcdir)/dvi2xx.c
-       mv dvi2xx.o $@
+       $(compile) -DLJ2P -c $(srcdir)/dvi2xx.c -o $@
 dvilj4.o:
-       $(compile) -DLJ4 $(srcdir)/dvi2xx.c
-       mv dvi2xx.o $@
+       $(compile) -DLJ4 -c $(srcdir)/dvi2xx.c -o $@
 dvilj4l.o:
-       $(compile) -DLJ4 -DLJ4L $(srcdir)/dvi2xx.c
-       mv dvi2xx.o $@
+       $(compile) -DLJ4 -DLJ4L -c $(srcdir)/dvi2xx.c -o $@
 
 dvilj.o dvilj2p.o dvilj4.o dvilj4l.o: dvi2xx.c
 
@@ -58,13 +54,13 @@
 install-exec:
        $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) $(scriptdir)
        test ! -f $(program) \
-         || $(INSTALL_LIBTOOL_PROG) $(bindir) $(program)
+         || $(INSTALL_LIBTOOL_PROG) $(program) $(bindir)
        test ! -f $(program2p) \
-         || $(INSTALL_LIBTOOL_PROG) $(bindir) $(program2p)
+         || $(INSTALL_LIBTOOL_PROG) $(program2p) $(bindir)
        test ! -f $(program4) \
-         || $(INSTALL_LIBTOOL_PROG) $(bindir) $(program4)
+         || $(INSTALL_LIBTOOL_PROG) $(program4) $(bindir)
        test ! -f $(program4l) \
-         || $(INSTALL_LIBTOOL_PROG) $(bindir) $(program4l)
+         || $(INSTALL_LIBTOOL_PROG) $(program4l) $(bindir)
        $(INSTALL_SCRIPT) $(srcdir)/dvihp $(scriptdir)/dvihp
        rm -f $(bindir)/$(program6); $(LN) $(program4) $(bindir)/$(program6)
 uninstall-exec:
--- texk/dvipsk/Makefile.in.orig        Mon Feb  3 21:54:37 2003
+++ texk/dvipsk/Makefile.in     Mon Feb  3 21:54:49 2003
@@ -73,7 +73,7 @@
 
 install-exec: all
        $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) $(scriptdir) $(fontdir)
-       for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $(bindir) $$p; done
+       for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $$p $(bindir); done
 uninstall-exec:
        for p in $(programs); do rm -f $(bindir)/$$p; done
 
--- texk/oxdvik/Makefile.in.orig        Mon Feb  3 22:01:42 2003
+++ texk/oxdvik/Makefile.in     Mon Feb  3 22:01:55 2003
@@ -102,7 +102,7 @@
 
 install-exec: $(program)
        $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir)
-       for p in $(program); do $(INSTALL_LIBTOOL_PROG) $(bindir) $$p; done
+       for p in $(program); do $(INSTALL_LIBTOOL_PROG) $$p $(bindir); done
        $(INSTALL_SCRIPT) $(srcdir)/oxdvi-sh $(scriptdir)/oxdvi
 uninstall-exec:
 
--- texk/ps2pkm/Makefile.in.orig        Mon Feb  3 22:04:19 2003
+++ texk/ps2pkm/Makefile.in     Mon Feb  3 22:04:29 2003
@@ -36,7 +36,7 @@
 
 install-exec: $(programs)
        $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir)
-       for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $(bindir) $$p; done
+       for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $$p $(bindir); done
 uninstall-exec:
        for p in $(programs); do rm -f $(bindir)/$$p; done
 
--- texk/odvipsk/Makefile.in.orig       Mon Feb  3 22:00:45 2003
+++ texk/odvipsk/Makefile.in    Mon Feb  3 22:00:54 2003
@@ -61,7 +61,7 @@
 
 install-exec: all
        $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) $(scriptdir)
-       for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $(bindir) $$p; done
+       for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $$p $(bindir); done
 uninstall-exec:
        for p in $(programs); do rm -f $(bindir)/$$p; done
 
--- texk/gsftopk/Makefile.in.orig       Mon Feb  3 21:56:13 2003
+++ texk/gsftopk/Makefile.in    Mon Feb  3 21:57:06 2003
@@ -35,7 +35,7 @@
 
 install-exec: $(program)
        $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir)
-       $(INSTALL_LIBTOOL_PROG)  $(bindir) $(program)
+       $(INSTALL_LIBTOOL_PROG) $(program) $(bindir)
 uninstall-exec:
        rm -f $(bindir)/$(program)
 
--- texk/configure.in.orig      Mon Feb  3 18:12:42 2003
+++ texk/configure.in   Mon Feb  3 18:26:15 2003
@@ -32,11 +32,13 @@
 dnl If the other programs ever acquire their own --with or --enable
 dnl options, they must be added, so configure --help at the top level
 dnl will show all the options.
-sinclude(acklibtool.m4)
+sinclude(libtool.m4)
 sinclude(withenable.ac)
 sinclude(kpathsea/withenable.ac)
 sinclude(web2c/withenable.ac)
 sinclude(xdvik/withenable.ac)
+
+AC_PROG_LIBTOOL
 
 if test "x$with_omega" = xno; then
   with_odvipsk=no
--- texk/Makefile.in.orig       Mon Feb  3 19:00:22 2003
+++ texk/Makefile.in    Mon Feb  3 19:00:33 2003
@@ -51,7 +51,7 @@
          (cd $$d && $(MAKE) $(makeargs) $@) || exit 1; else true; fi; done
 
 distclean realclean::
-       rm -f Makefile config.status config.cache config.log klibtool.config
+       rm -f Makefile config.status config.cache config.log
 
 # Unconditionally remake the library, since we don't want to write out
 # the dependencies here.
--- texk/make/common.mk.orig    Mon Feb  3 19:46:16 2003
+++ texk/make/common.mk Mon Feb  3 23:31:38 2003
@@ -12,28 +12,28 @@
 LDFLAGS = @LDFLAGS@ $(XLDFLAGS)
 
 # Kpathsea needs this for compiling, programs need it for linking.
-LIBTOOL = $(kpathsea_srcdir_parent)/klibtool
+LIBTOOL = $(SHELL) $(kpathsea_parent)/libtool
 
 # You can change [X]CPPFLAGS, [X]CFLAGS, or [X]DEFS, but
 # please don't change ALL_CPPFLAGS or ALL_CFLAGS.
 # prog_cflags is set by subdirectories of web2c.
 ALL_CPPFLAGS = $(DEFS) -I. -I$(srcdir) -I$(kpathsea_parent) \
   -I$(kpathsea_srcdir_parent) $(prog_cflags) $(CPPFLAGS)
-ALL_CFLAGS = $(ALL_CPPFLAGS) $(CFLAGS) -c
+ALL_CFLAGS = $(ALL_CPPFLAGS) $(CFLAGS)
 compile = $(CC) $(ALL_CFLAGS)
 
 .SUFFIXES:
-.SUFFIXES: .c .o # in case the suffix list has been cleared, e.g., by web2c
+.SUFFIXES: .c .o .lo # in case the suffix list has been cleared, e.g., by web2c
 .c.o:
-       $(compile) $<
+       $(compile) -c $< -o $@
 
 # Installation.
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_DATA = @INSTALL_DATA@
-INSTALL_LIBTOOL_LIBS = INSTALL_DATA='$(INSTALL_DATA)' $(LIBTOOL) install-lib
-INSTALL_LIBTOOL_PROG = INSTALL_PROGRAM='$(INSTALL_PROGRAM)' $(LIBTOOL) install-prog
+INSTALL_LIBTOOL_LIBS = $(LIBTOOL) --mode=install $(INSTALL_DATA)
+INSTALL_LIBTOOL_PROG = $(LIBTOOL) --mode=install $(INSTALL_PROGRAM)
 
 # Creating (symbolic) links.
 LN = @LN_S@
--- texk/kpathsea/Makefile.in.orig      Mon Feb  3 08:24:08 2003
+++ texk/kpathsea/Makefile.in   Tue Feb  4 00:32:26 2003
@@ -33,10 +33,10 @@
 library = kpathsea
 
 # We want to compile almost everything with libtool ...
-KPATHSEA_CC = $(LIBTOOL) compile "$(CC)"
+KPATHSEA_CC = $(LIBTOOL) --mode=compile "$(CC)"
 .SUFFIXES: .lo
 .c.lo:
-       $(KPATHSEA_CC) $< $(ALL_CFLAGS)
+       $(KPATHSEA_CC) $(ALL_CFLAGS) -c $< -o $@
 
 default all: kpsewhich kpsestat access readlink $(library).info manfiles
 
@@ -52,15 +52,8 @@
 readlink: readlink.o
        $(link_command) readlink.o
 
-$(kpathsea): $(objects) klibtool.version
-       $(LIBTOOL) archive $(AR) $(ARFLAGS) $@ $(objects)
-
-# All the objects depend on the klibtool configuration file.
-$(objects): ../klibtool.config
-
-# Create klibtool.version in the build tree
-klibtool.version:
-       $(LN) $(srcdir)/kpathsea.version $@
+$(kpathsea): $(objects)
+       $(kpathsea_link) -version-info 4:0:0 $(objects)
 
 # Make variable substitutions for paths.h.
 texmf.cnf: texmf.in texmf.sed
@@ -123,8 +116,8 @@
        sed -e 's/%.*//' -e 's/^[       ]*//' -e 's/[   ]*$$//' texmf.cnf \
        | grep '^[      ]*[A-Z0-9_]*[   =]' \
        | sed '/^$$/d' \
-       | sed 's/^\([^  =]*\)[  ]*=*[   ]*\(.*\)/#ifndef DEFAULT_\1@#define DEFAULT_\1 
"\2"@#endif/' \
-       | tr '@' '\012' \
+       | sed 's/^\([^  =]*\)[  ]*=*[   ]*\(.*\)/#ifndef DEFAULT_\1~#define DEFAULT_\1 
+"\2"~#endif/' \
+       | tr '~' '\012' \
        | sed -e 's%\$$TEXMFMAIN%$(texmf)%g' \
              -e 's%\$$TEXMF%$(texmf)%g' \
              -e 's%\$$VARTEXFONTS%$(vartexfonts)%g' \
@@ -180,8 +173,8 @@
        $(INSTALL_SCRIPT) $(srcdir)/mktexnam $(web2cdir)/mktexnam
        $(INSTALL_DATA) $(srcdir)/mktexnam.opt $(web2cdir)/mktexnam.opt
        $(INSTALL_SCRIPT) $(srcdir)/mktexupd $(web2cdir)/mktexupd
-       $(INSTALL_LIBTOOL_LIBS) $(libdir) lib$(library).la
-       $(INSTALL_LIBTOOL_PROG) $(bindir) kpsewhich
+       $(INSTALL_LIBTOOL_LIBS) lib$(library).la $(libdir)
+       $(INSTALL_LIBTOOL_PROG) kpsewhich $(bindir)
        $(INSTALL_PROGRAM) kpsestat $(bindir)
        $(INSTALL_PROGRAM) access $(bindir)
        $(INSTALL_PROGRAM) readlink $(bindir)
@@ -259,7 +252,7 @@
 ac_include ../make/clean.mk
 
 mostlyclean::
-       rm -f kpsewhich kpsestat access readlink *.lo klibtool.version
+       rm -f kpsewhich kpsestat access readlink *.lo
        rm -rf PROF PROF_SHARED SHARED STATIC
 distclean::
        rm -f paths.h texmf.cnf texmf.sed stamp-paths

Reply via email to