From 6b8cd68823e8d6cecb04e084c8b54e7daacb58bf Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Fri, 26 May 1995 02:11:28 +0000 Subject: [PATCH] Add support for shared libraries git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5883 dc483132-0cff-0310-8789-dd5450dbe970 --- src/ChangeLog | 7 +++++++ src/aclocal.m4 | 42 ++++++++++++++++++++++++++++++++++++++++++ src/configure.in | 27 +++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index a4937f903..57fb18a25 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +Thu May 25 22:01:39 1995 Theodore Y. Ts'o (tytso@dcl) + + * aclocal.m4(V5_MAKE_SHARED_LIB, V5_SHARED_LIB_OBJS): Added autoconf + rules for creating shared libraries. + + * configure.in: Add support for --enable-shared + Thu May 25 11:30:00 1995 Keith Vetter (keithv@fusion.com) * Makefile.in: don't copy profile.h here but do it in include/makefile. diff --git a/src/aclocal.m4 b/src/aclocal.m4 index bfc1d4858..993288f0f 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -647,3 +647,45 @@ if test $krb5_cv_has_ansi_volatile = no; then ADD_DEF(-Dvolatile=) fi ])dnl +dnl +dnl This rule supports the generation of the shared library object files +dnl +define(V5_SHARED_LIB_OBJS,[ +if test ${krb5_cv_shlibs_dir}x != x; then +SHARED_RULE=" \$(CC) ${krb5_cv_shlibs_cflags} \$(CFLAGS) -o ${krb5_cv_shlibs_dir}/\$""*.o -c \$(srcdir)/\$""*.c" +SHARED_RULE_LOCAL=" \$(CC) ${krb5_cv_shlibs_cflags} \$(CFLAGS) -o ${krb5_cv_shlibs_dir}/\$""*.o -c \$""*.c" +else +SHARED_RULE= +SHARED_RULE_LOCAL= +fi +AC_SUBST(SHARED_RULE) +AC_SUBST(SHARED_RULE_LOCAL) +])dnl +dnl +dnl This rule adds the additional Makefile fragment necessary to actually +dnl create the shared library +dnl +define(V5_MAKE_SHARED_LIB,[ +AC_ARG_ENABLE([shared], +[ --enable-shared build with shared libraries],[ +HOST_TYPE=$krb5_cv_host +AC_SUBST(HOST_TYPE) +SHEXT=$krb5_cv_shlibs_ext +AC_SUBST(SHEXT) +DO_MAKE_SHLIB="$1.\$""(SHEXT)" +AC_DIVERT_PUSH(AC_DIVERSION_MAKEFILE)dnl + +all:: $(DO_MAKE_SHLIB) + +clean:: + $(RM) $1.[$](SHEXT) + +$1.[$](SHEXT): [$](LIBDONE) + [$](SRCTOP)/util/makeshlib [$](HOST_TYPE) [$](CC) [$]@ [$](LIB_SUBDIRS) + +AC_DIVERT_POP()dnl +],[ +DO_MAKE_SHLIB= +])dnl +AC_SUBST(DO_MAKE_SHLIB) +])dnl diff --git a/src/configure.in b/src/configure.in index 4c9ddb861..1b6badd94 100644 --- a/src/configure.in +++ b/src/configure.in @@ -2,9 +2,36 @@ AC_INIT(configure.in) WITH_CCOPTS CONFIG_RULES AC_SET_BUILDTOP +AC_MSG_CHECKING([for build host]) +AC_CACHE_VAL(krb5_cv_host, [AC_CANONICAL_HOST +krb5_cv_host=$host]) +AC_MSG_RESULT($krb5_cv_host) WITH_KRB5ROOT WITH_KRB4 WITH_NETLIB +AC_ARG_ENABLE([shared], +[ --enable-shared build with shared libraries],[ +case $krb5_cv_host in +*-*-linux*) + echo "Enabling shared libraries for Linux...." + krb5_cv_shlibs_cflags=-fPIC + krb5_cv_shlibs_ext=so + krb5_cv_shlibs_dir=shared + ;; +*-*-solaris*) + echo "Enabling shared libraries for Solaris...." + krb5_cv_shlibs_cflags=-Kpic + krb5_cv_shlibs_ext=so + krb5_cv_shlibs_dir=shared + ;; +*) + echo " " + echo "Shared libraries not supported on $krb5_cv_host" + exit 1 + ;; +esac],[krb5_cv_shlibs_cflags= +krb5_cv_shlibs_ext= +krb5_cv_shlibs_dir=]) AC_ARG_ENABLE([athena], [ --enable-athena build with MIT Project Athena configuration],,) if test -z "$KRB4_LIB"; then -- 2.26.2