$NetBSD: patch-aa,v 1.2 2005/04/10 07:15:25 jlam Exp $

--- aclocal.m4.orig	2005-01-14 19:10:44.000000000 -0500
+++ aclocal.m4
@@ -1113,8 +1113,10 @@ dnl Pull in the necessary stuff to creat
 
 AC_DEFUN(KRB5_BUILD_LIBRARY,
 [KRB5_BUILD_LIBRARY_WITH_DEPS
-# null out SHLIB_EXPFLAGS because we lack any dependencies
-SHLIB_EXPFLAGS=])
+# null out SHLIB_EXPFLAGS and LALIB_EXPFLAGS because we lack any dependencies
+SHLIB_EXPFLAGS=
+LALIB_EXPFLAGS=
+])
 
 dnl
 dnl KRB5_BUILD_LIBRARY_STATIC
@@ -1162,6 +1164,9 @@ AC_SUBST(SHLIBVEXT)
 AC_SUBST(SHLIBSEXT)
 AC_SUBST(DEPLIBEXT)
 AC_SUBST(PFLIBEXT)
+AC_SUBST(LALIBEXT)
+AC_SUBST(LALIB_EXPFLAGS)
+AC_SUBST(LIBTOOL_TAIL)
 AC_SUBST(LIBINSTLIST)])
 
 dnl
@@ -1175,6 +1180,7 @@ AC_SUBST(OBJLISTS)
 AC_SUBST(STOBJEXT)
 AC_SUBST(SHOBJEXT)
 AC_SUBST(PFOBJEXT)
+AC_SUBST(LAOBJEXT)
 AC_SUBST(PICFLAGS)
 AC_SUBST(PROFFLAGS)])
 
@@ -1226,6 +1232,8 @@ else
 	LIBINSTLIST=install-static
 	DEPLIBEXT=$STLIBEXT
 fi
+DEPSTLIBEXT=$STLIBEXT
+AC_SUBST(DEPSTLIBEXT)
 
 # Check whether to build shared libraries.
 AC_ARG_ENABLE([shared],
@@ -1284,8 +1292,35 @@ else
 	SHLIBSEXT=.so.s-nobuild
 fi
 
+# Check whether to build libtool archives.
+AC_ARG_ENABLE([pkgsrc-libtool],
+[  --enable-pkgsrc-libtool build libtool archives],
+[
+	case $enableval in
+	/*)	LIBTOOL=$enableval ;;
+	*)	LIBTOOL=libtool ;;
+	esac
+	AC_MSG_RESULT([Enabling libtool archives.])
+	LIBLIST='lib$(LIBBASE)$(LALIBEXT)'
+	LIBLINKS='$(TOPLIBD)/lib$(LIBBASE)$(LALIBEXT)'
+	OBJLISTS=OBJS.LA
+	LIBINSTLIST=install-libtool
+	DEPLIBEXT=$LALIBEXT
+	DEPSTLIBEXT=$LALIBEXT
+	CC_LINK="$CC_LINK_LIBTOOL"
+	INSTALL_LIBTOOL='$(LIBTOOL) --mode=install'
+	if test "$krb5_force_static" = yes; then
+		LIBTOOL_TAIL=
+	fi
+], [
+	LIBTOOL=:
+	INSTALL_LIBTOOL=
+])
+AC_SUBST(LIBTOOL)
+AC_SUBST(INSTALL_LIBTOOL)
+
 if test -z "$LIBLIST"; then
-	AC_MSG_ERROR([must enable one of shared or static libraries])
+	AC_MSG_ERROR([must enable one of shared, libtool or static libraries])
 fi
 
 # Check whether to build profiled libraries.
