diff options
author | Ken Raeburn <raeburn@mit.edu> | 2004-04-24 21:09:44 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2004-04-24 21:09:44 +0000 |
commit | fcf02bef88a17724aa230547459a9eaf1159d6c1 (patch) | |
tree | 7f9dd998b8e7baf61111f6bf0428da47de1291eb /src/aclocal.m4 | |
parent | 3b4d753fc5169469da270c831654a8fae407cfdf (diff) | |
download | krb5-fcf02bef88a17724aa230547459a9eaf1159d6c1.tar.gz krb5-fcf02bef88a17724aa230547459a9eaf1159d6c1.tar.xz krb5-fcf02bef88a17724aa230547459a9eaf1159d6c1.zip |
Added support for library initialization and finalization, and verification
that the initializer completed successfully. Delay initialization on POSIX
until the first "verification" call. Currently specific to a few platforms,
but should still build on others without thread support enabled.
Use it to finish creating (if necessary) and destroy mutexes, and free some
other storage "permanently" allocated by libraries (currently, libkrb5
cache/keytab type registries only). Change initialization of static mutexes to
a two-step operation, a static "partial" initializer and a "finish_init"
routine called from a thread-safe environment like library initialization is
assumed to be. POSIX will use the former, Windows will use the latter, and the
debug support will check that *both* have been used.
Added init/fini functions to com_err, profile, krb5, and gssapi libraries.
(The profile library one may need to be removed later.) The existing ones, not
thread-safe, are still around.
Use weak symbol support if available to figure out if the pthread library has
been linked in, and avoid calling certain routines if the C library stubs are
known not to exist or work.
Stub declarations for thread-specific data.
Minor bugfixes, whitespace changes.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16268 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/aclocal.m4')
-rw-r--r-- | src/aclocal.m4 | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/src/aclocal.m4 b/src/aclocal.m4 index cf1fd80026..6dd69452ed 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -100,7 +100,8 @@ AC_SUBST_FILE(lib_frag) libobj_frag=$srcdir/$ac_config_fragdir/libobj.in AC_SUBST_FILE(libobj_frag) dnl -KRB5_AC_ENABLE_THREADS dnl +KRB5_AC_PRAGMA_WEAK_REF +KRB5_AC_ENABLE_THREADS ])dnl dnl Maintainer mode, akin to what automake provides, 'cept we don't @@ -128,16 +129,38 @@ dnl Hack for now. AC_DEFUN([KRB5_AC_ENABLE_THREADS],[ AC_ARG_ENABLE([thread-support], AC_HELP_STRING([--enable-thread-support],use PRELIMINARY EXPERIMENTAL UNFINISHED POSIX-only thread support @<:@disabled@:>@), -[ if test "$withval" = yes ; then +[ if test "$enableval" = yes ; then AC_MSG_NOTICE(enabling PRELIMINARY EXPERIMENTAL UNFINISHED POSIX-only thread support) AC_DEFINE(ENABLE_THREADS,1,[Define if thread support enabled]) fi ]) dnl Maybe this should be inside the conditional above? Doesn't cache.... -ACX_PTHREAD +if test "$enable_thread_support" = yes; then +ACX_PTHREAD(,[AC_MSG_ERROR([cannot determine options for enabling thread support])]) +AC_MSG_NOTICE(PTHREAD_CC = $PTHREAD_CC) +AC_MSG_NOTICE(PTHREAD_CFLAGS = $PTHREAD_CFLAGS) +AC_MSG_NOTICE(PTHREAD_LIBS = $PTHREAD_LIBS) dnl Not really needed -- if pthread.h isn't found, ACX_PTHREAD will fail. AC_CHECK_HEADERS(pthread.h) +fi +dnl We want to know where these routines live, so on systems with weak +dnl reference support we can figure out whether or not the pthread library +dnl has been linked in. +dnl If we don't add any libraries for thread support, don't bother. +AC_CHECK_FUNCS(pthread_once pthread_mutexattr_setrobust_np) +old_CC="$CC" +test "$PTHREAD_CC" != "" && CC=$PTHREAD_CC +old_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +old_LIBS="$LIBS" +LIBS="$PTHREAD_LIBS $LIBS" +AC_MSG_NOTICE(rechecking with PTHREAD_... options) +AC_CHECK_LIB(c, pthread_mutexattr_setrobust_np, + [AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP_IN_THREAD_LIB,1,[Define if pthread_mutexattr_setrobust_np is provided in the thread library.])]) ]) +LIBS="$old_LIBS" +CC="$old_CC" +fi dnl This is somewhat gross and should go away when the build system dnl is revamped. -- tlyu @@ -1042,7 +1065,7 @@ AC_REQUIRE([AC_PROG_ARCHIVE])dnl AC_REQUIRE([AC_PROG_ARCHIVE_ADD])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl AC_CHECK_PROG(AR, ar, ar, false) -AC_CHECK_PROG(PERL, perl, false) +AC_CHECK_PROG(PERL, perl, perl, false) AC_SUBST(LIBLIST) AC_SUBST(LIBLINKS) AC_SUBST(MAKE_SHLIB_COMMAND) @@ -1523,4 +1546,22 @@ esac AC_SUBST(PRIOCNTL_HACK)]) dnl dnl +dnl KRB5_AC_GCC_ATTRS +AC_DEFUN([KRB5_AC_GCC_ATTRS], +[ +]) +dnl +dnl +dnl KRB5_AC_PRAGMA_WEAK_REF +AC_DEFUN([KRB5_AC_PRAGMA_WEAK_REF], +[AC_CACHE_CHECK([whether pragma weak references are supported], +krb5_cv_pragma_weak_ref, +[AC_TRY_LINK([#pragma weak flurbl +extern int flurbl(void);],[if (&flurbl != 0) return 1;], +krb5_cv_pragma_weak_ref=yes,krb5_cv_pragma_weak_ref=no)]) +if test $krb5_cv_pragma_weak_ref = yes ; then + AC_DEFINE(HAVE_PRAGMA_WEAK_REF,1,[Define if #pragma weak references work]) +fi]) +dnl +dnl m4_include(config/ac-archive/acx_pthread.m4) |