summaryrefslogtreecommitdiffstats
path: root/src/aclocal.m4
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2004-04-29 06:46:00 +0000
committerKen Raeburn <raeburn@mit.edu>2004-04-29 06:46:00 +0000
commit61cb1ca9519ffe48ed8d0682acf1aa6837aead3c (patch)
tree79bd015d0f98a3feb8e3ec2fa967a9be80f491e5 /src/aclocal.m4
parenta7158b8a13aaa405199bbc3671c9e9d3537b9da8 (diff)
downloadkrb5-61cb1ca9519ffe48ed8d0682acf1aa6837aead3c.tar.gz
krb5-61cb1ca9519ffe48ed8d0682acf1aa6837aead3c.tar.xz
krb5-61cb1ca9519ffe48ed8d0682acf1aa6837aead3c.zip
* 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. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16280 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/aclocal.m4')
-rw-r--r--src/aclocal.m462
1 files changed, 61 insertions, 1 deletions
diff --git a/src/aclocal.m4 b/src/aclocal.m4
index 5f1b732a07..62c8ce0c28 100644
--- a/src/aclocal.m4
+++ b/src/aclocal.m4
@@ -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