* aclocal.m4 (CONFIG_RULES): Invoke KRB5_LIB_PARAMS and KRB5_AC_INITFINI.
authorKen Raeburn <raeburn@mit.edu>
Thu, 29 Apr 2004 06:46:00 +0000 (06:46 +0000)
committerKen Raeburn <raeburn@mit.edu>
Thu, 29 Apr 2004 06:46:00 +0000 (06:46 +0000)
(KRB5_AC_INITFINI): New macro.  Define delayed-initialization config option,
test for gcc constructor/destructor attribute support, and test whether
shlib.conf indicates support for link-time options.
(KRB5_AC_GCC_ATTRS): Implement.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16280 dc483132-0cff-0310-8789-dd5450dbe970

src/ChangeLog
src/aclocal.m4

index e191b90ba8473e88e7d2cca5604ee60d1f753401..315f03cd51ee4780d052a6567cc1462f27c4d0cf 100644 (file)
@@ -1,3 +1,13 @@
+2004-04-29  Ken Raeburn  <raeburn@mit.edu>
+
+       * aclocal.m4 (CONFIG_RULES): Invoke KRB5_LIB_PARAMS and
+       KRB5_AC_INITFINI.
+       (KRB5_AC_INITFINI): New macro.  Define delayed-initialization
+       config option, test for gcc constructor/destructor attribute
+       support, and test whether shlib.conf indicates support for
+       link-time options.
+       (KRB5_AC_GCC_ATTRS): Implement.
+
 2004-04-26  Ken Raeburn  <raeburn@mit.edu>
 
        * aclocal.m4 (KRB5_BUILD_LIBRARY_WITH_DEPS): Report an error if
index 5f1b732a07631728beee66ba66122ab0c845c585..62c8ce0c289c8f6f74c7fd0c99fb46ea3e1092d0 100644 (file)
@@ -101,6 +101,8 @@ libobj_frag=$srcdir/$ac_config_fragdir/libobj.in
 AC_SUBST_FILE(libobj_frag)
 dnl
 KRB5_AC_PRAGMA_WEAK_REF
+KRB5_LIB_PARAMS
+KRB5_AC_INITFINI
 KRB5_AC_ENABLE_THREADS
 ])dnl
 
@@ -125,6 +127,33 @@ AC_SUBST(MAINTAINER_MODE_FALSE)
 AC_SUBST(MAINT)
 ])
 
+dnl
+AC_DEFUN([KRB5_AC_INITFINI],[
+dnl Do we want initialization at load time?
+AC_ARG_ENABLE([delayed-initialization],
+AC_HELP_STRING([--disable-delayed-initialization],initialize library code when loaded @<:@delay until first use@:>@), , enable_delayed_initialization=yes)
+case "$enable_delayed_initialization" in
+  yes)
+    AC_DEFINE(DELAY_INITIALIZER,1,[Define if library initialization should be delayed until first use]) ;;
+  no) ;;
+  *)  AC_MSG_ERROR(invalid option $enable_delayed_initialization for delayed-initialization) ;;
+esac
+dnl We always want finalization at unload time.
+dnl
+dnl Can we do things through gcc?
+KRB5_AC_GCC_ATTRS
+dnl How about with the linker?
+if test -z "$use_linker_init_option" ; then
+  AC_MSG_ERROR(ran INITFINI before checking shlib.conf?)
+fi
+if test "$use_linker_init_option" = yes; then
+  AC_DEFINE(USE_LINKER_INIT_OPTION,1,[Define if link-time options for library initialization will be used])
+fi
+if test "$use_linker_fini_option" = yes; then
+  AC_DEFINE(USE_LINKER_FINI_OPTION,1,[Define if link-time options for library finalization will be used])
+fi
+])
+
 dnl Hack for now.
 AC_DEFUN([KRB5_AC_ENABLE_THREADS],[
 AC_ARG_ENABLE([thread-support],
@@ -1551,7 +1580,38 @@ dnl
 dnl
 dnl KRB5_AC_GCC_ATTRS
 AC_DEFUN([KRB5_AC_GCC_ATTRS],
-[
+[AC_CACHE_CHECK([for constructor/destructor attribute support],krb5_cv_attr_constructor_destructor,
+[rm -f conftest.1 conftest.2
+if test -r conftest.1 || test -r conftest.2 ; then
+  AC_MSG_ERROR(write error in local file system?)
+fi
+true > conftest.1
+true > conftest.2
+if test -r conftest.1 && test -r conftest.2 ; then true ; else
+  AC_MSG_ERROR(write error in local file system?)
+fi
+a=no
+b=no
+# blindly assume we have 'unlink'...
+AC_TRY_RUN([void foo1() __attribute__((constructor));
+void foo1() { unlink("conftest.1"); }
+void foo2() __attribute__((destructor));
+void foo2() { unlink("conftest.2"); }
+int main () { return 0; }],
+[test -r conftest.1 || a=yes
+test -r conftest.2 || b=yes], , AC_MSG_ERROR(Cannot test for constructor/destructor support when cross compiling))
+krb5_cv_attr_constructor_destructor="$a,$b"
+])
+# Okay, krb5_cv_... should be set now.
+case $krb5_cv_attr_constructor_destructor in
+  yes,*)
+    AC_DEFINE(CONSTRUCTOR_ATTR_WORKS,1,[Define if __attribute__((constructor)) works]) ;;
+esac
+case $krb5_cv_attr_constructor_destructor in
+  *,yes)
+    AC_DEFINE(DESTRUCTOR_ATTR_WORKS,1,[Define if __attribute__((destructor)) works]) ;;
+esac
+dnl End of attributes we care about right now.
 ])
 dnl
 dnl