Add support for shared libraries
authorTheodore Tso <tytso@mit.edu>
Fri, 26 May 1995 02:11:28 +0000 (02:11 +0000)
committerTheodore Tso <tytso@mit.edu>
Fri, 26 May 1995 02:11:28 +0000 (02:11 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5883 dc483132-0cff-0310-8789-dd5450dbe970

src/ChangeLog
src/aclocal.m4
src/configure.in

index a4937f903f5b94334532f86ba035e304a5335e12..57fb18a25d63c719d2c4fc8c7b4b0759f0a3673e 100644 (file)
@@ -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.
index bfc1d4858a4fd8a6f720c3248240de33452913ad..993288f0f0ef7241dfe927db5c2d2a125b56a472 100644 (file)
@@ -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
index 4c9ddb861466541710599eceabb8c0134fc9fe60..1b6badd9432d8201b6cbd72a257cfe15308e6dcc 100644 (file)
@@ -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