+2004-06-18 Ken Raeburn <raeburn@mit.edu>
+
+ * Makefile.in (SLIBS, SDEF, S_GLUE, COMERR_GLUE, PROF_GLUE,
+ SGLUE): New variables.
+ (NO_GLUE): Deleted.
+ (CGLUE, PGLUE): Use new separate glue files instead of no_glue.
+ (SRES) [WIN32]: New variable.
+ ($(SRES), $(SLIB)) [WIN32]: New targets.
+ ($(CLIB), $(PLIB), $(KLIB), $(GLIB)) [WIN32]: Depend on and link
+ against $(SLIB) too.
+ ($(SDEF)): New target. Generate Windows export list from common
+ symbol list.
+ ($(COMERR_GLUE), $(PROF_GLUE), $(S_GLUE)): New targets.
+
+ * win_glue.c (control): Reference add/remove_error_table only if
+ building for krb4 library. Add calls to library init/fini
+ functions for other libraries. For support library, also call a
+ hook function on DLL_THREAD_DETACH. If no recognized
+ library-specific macro is defined, don't compile.
+ (DllMain): Do call control() on DLL_THREAD_DETACH.
+
2004-06-16 Ken Raeburn <raeburn@mit.edu>
* Makefile.in (MAC_SUBDIRS): Don't set.
##MIT##MITLIBS=$(VS_LIB)
##MIT##MITFLAGS=-I$(VS_INC) /DVERSERV=1
+SLIBS = $(BUILDTOP)\util\support\$(OUTPRE)krb5support_32.lib
CLIBS = $(BUILDTOP)\util\et\$(OUTPRE)comerr.lib
PLIBS = $(BUILDTOP)\util\profile\$(OUTPRE)profile.lib
KLIBS = krb5\$(OUTPRE)krb5.lib crypto\$(OUTPRE)crypto.lib \
GLIBS = gssapi\$(OUTPRE)gssapi.lib
K4LIBS = krb4\$(OUTPRE)krb4.lib
+SDEF = krb5support32.def
CDEF = comerr32.def
PDEF = xpprof32.def
KDEF = krb5_32.def
WINDLLFLAGS = $(DLL_LINKOPTS) -base:0x1c000000 /DELAYLOAD:secur32.dll \
/DELAYLOAD:advapi32.dll /DELAY:UNLOAD /DELAY:NOBIND
-NO_GLUE=$(OUTPRE)no_glue.obj
+S_GLUE=$(OUTPRE)support_glue.obj
K5_GLUE=$(OUTPRE)k5_glue.obj
K4_GLUE=$(OUTPRE)k4_glue.obj
GSS_GLUE=$(OUTPRE)gss_glue.obj
+COMERR_GLUE=$(OUTPRE)comerr_glue.obj
+PROF_GLUE=$(OUTPRE)prof_glue.obj
-CGLUE=$(NO_GLUE)
-PGLUE=$(NO_GLUE)
+SGLUE=$(S_GLUE)
+CGLUE=$(COMERR_GLUE)
+PGLUE=$(PROF_GLUE)
KGLUE=$(K5_GLUE)
GGLUE=$(GSS_GLUE)
K4GLUE=$(K4_GLUE)
RCFLAGS=$(CPPFLAGS) -D_WIN32 -DRES_ONLY
+##WIN32##SRES=$(SLIB:.lib=.res)
##WIN32##CRES=$(CLIB:.lib=.res)
##WIN32##PRES=$(PLIB:.lib=.res)
##WIN32##KRES=$(KLIB:.lib=.res)
##WIN32##GRES=$(GLIB:.lib=.res)
##WIN32##K4RES=$(K4LIB:.lib=.res)
+##WIN32##$(SRES): $(VERSIONRC)
+##WIN32## $(RC) $(RCFLAGS) -DSUPPORT_LIB -fo $@ -r $**
##WIN32##$(CRES): $(VERSIONRC)
##WIN32## $(RC) $(RCFLAGS) -DCE_LIB -fo $@ -r $**
##WIN32##$(PRES): $(VERSIONRC)
##WIN32## $(RC) $(RCFLAGS) -DGSSAPI_LIB -fo $@ -r $**
##WIN32##$(KRB5RC): $(VERSIONRC)
-##WIN32##$(CLIB): $(CDEF) $(CLIBS) $(CGLUE) $(CRES)
+##WIN32##$(SLIB): $(SDEF) $(SLIBS) $(SGLUE) $(SRES)
+##WIN32## link $(WINDLLFLAGS) -def:$(SDEF) -out:$*.dll \
+##WIN32## $(SLIBS) $(SGLUE) $(SRES) $(WINLIBS)
+$(SDEF): ..\util\support\libkrb5support.exports
+ echo EXPORTS > $(SDEF).new
+ type ..\util\support\libkrb5support.exports >> $(SDEF).new
+ -$(RM) $(SDEF)
+ ren $(SDEF).new $(SDEF)
+
+##WIN32##$(CLIB): $(CDEF) $(CLIBS) $(CGLUE) $(CRES) $(SLIB)
##WIN32## link $(WINDLLFLAGS) -def:$(CDEF) -out:$*.dll \
-##WIN32## $(CLIBS) $(CGLUE) $(CRES) $(WINLIBS)
+##WIN32## $(CLIBS) $(CGLUE) $(CRES) $(SLIB) $(WINLIBS)
-##WIN32##$(PLIB): $(PDEF) $(PLIBS) $(PGLUE) $(PRES) $(CLIB)
+##WIN32##$(PLIB): $(PDEF) $(PLIBS) $(PGLUE) $(PRES) $(CLIB) $(SLIB)
##WIN32## link $(WINDLLFLAGS) -def:$(PDEF) -out:$*.dll \
-##WIN32## $(PLIBS) $(PGLUE) $(PRES) $(CLIB) $(WINLIBS)
+##WIN32## $(PLIBS) $(PGLUE) $(PRES) $(CLIB) $(SLIB) $(WINLIBS)
-##WIN32##$(KLIB): $(KDEF) $(KLIBS) $(KGLUE) $(KRES) $(CLIB) $(MITLIBS) $(DNSLIBS)
+##WIN32##$(KLIB): $(KDEF) $(KLIBS) $(KGLUE) $(KRES) $(CLIB) $(SLIB) $(MITLIBS) $(DNSLIBS)
##WIN32## link $(WINDLLFLAGS) -def:$(KDEF) -out:$*.dll \
-##WIN32## $(KLIBS) $(KGLUE) $(KRES) $(CLIB) $(MITLIBS) $(DNSLIBS) $(WINLIBS)
+##WIN32## $(KLIBS) $(KGLUE) $(KRES) $(CLIB) $(SLIB) $(MITLIBS) $(DNSLIBS) $(WINLIBS)
-##WIN32##$(GLIB): $(GDEF) $(GLIBS) $(GGLUE) $(GRES) $(KLIB) $(CLIB)
+##WIN32##$(GLIB): $(GDEF) $(GLIBS) $(GGLUE) $(GRES) $(KLIB) $(CLIB) $(SLIB)
##WIN32## link $(WINDLLFLAGS) -def:$(GDEF) -out:$*.dll \
-##WIN32## $(GLIBS) $(GGLUE) $(GRES) $(KLIB) $(CLIB) $(WINLIBS)
+##WIN32## $(GLIBS) $(GGLUE) $(GRES) $(KLIB) $(CLIB) $(SLIB) $(WINLIBS)
##WIN32##$(K4LIB): $(K4DEF) $(K4LIBS) $(K4GLUE) $(K4RES) $(KLIB) $(CLIB) $(PLIB)
##WIN32## link $(WINDLLFLAGS) -def:$(K4DEF) -out:$*.dll \
$(CC) $(ALL_CFLAGS) /c /DKRB4=1 /Fo$@ $**
$(GSS_GLUE): win_glue.c
$(CC) $(ALL_CFLAGS) /c /DGSSAPI=1 /Fo$@ $**
-$(NO_GLUE): win_glue.c
- $(CC) $(ALL_CFLAGS) /c /Fo$@ $**
+$(COMERR_GLUE): win_glue.c
+ $(CC) $(ALL_CFLAGS) /c /DCOMERR=1 /Fo$@ $**
+$(PROF_GLUE): win_glue.c
+ $(CC) $(ALL_CFLAGS) /c /DPROFILELIB=1 /Fo$@ $**
+$(S_GLUE): win_glue.c
+ $(CC) $(ALL_CFLAGS) /c /DSUPPORTLIB=1 /Fo$@ $**
# Build Convenience
comerr.lib: $(CLIB)
static int
control(int mode)
{
- void ((KRB5_CALLCONV *et_func)(struct error_table *));
#ifdef NEED_WINSOCK
WORD wVersionRequested;
WSADATA wsaData;
switch(mode) {
case DLL_STARTUP:
- et_func = add_error_table;
-
#ifdef NEED_WINSOCK
wVersionRequested = 0x0101; /* We need version 1.1 */
if ((err = WSAStartup (wVersionRequested, &wsaData)))
#ifdef KRB5
krb5_stdcc_shutdown();
#endif
- et_func = remove_error_table;
#ifdef NEED_WINSOCK
WSACleanup ();
#endif
break;
+#if defined(ENABLE_THREADS) && defined(SUPPORTLIB)
+ case DLL_THREAD_DETACH:
+ krb5int_thread_detach_hook();
+ return 0;
+#endif
+
default:
return -1;
}
-#ifdef KRB4
- (*et_func)(&et_krb_error_table);
- (*et_func)(&et_kadm_error_table);
-#endif
-#ifdef KRB5
- (*et_func)(&et_krb5_error_table);
- (*et_func)(&et_kv5m_error_table);
- (*et_func)(&et_kdb5_error_table);
- (*et_func)(&et_asn1_error_table);
- (*et_func)(&et_prof_error_table);
-#endif
-#ifdef GSSAPI
- (*et_func)(&et_k5g_error_table);
- (*et_func)(&et_ggss_error_table);
+#if defined KRB5
+ switch (mode) {
+ case DLL_STARTUP:
+ profile_library_initializer__auxinit();
+ cryptoint_initialize_library__auxinit();
+ krb5int_lib_init__auxinit();
+ break;
+ case DLL_SHUTDOWN:
+ krb5int_lib_fini();
+ cryptoint_cleanup_library();
+ profile_library_finalizer();
+ break;
+ }
+#elif defined KRB4
+ switch (mode){
+ case DLL_STARTUP:
+ add_error_table(&et_krb_error_table);
+ add_error_table(&et_kadm_error_table);
+ break;
+ case DLL_SHUTDOWN:
+ remove_error_table(&et_krb_error_table);
+ remove_error_table(&et_kadm_error_table);
+ break;
+ }
+#elif defined GSSAPI
+ switch (mode) {
+ case DLL_STARTUP:
+ gssint_lib_init__auxinit();
+ break;
+ case DLL_SHUTDOWN:
+ gssint_lib_fini();
+ break;
+ }
+#elif defined COMERR
+ switch (mode) {
+ case DLL_STARTUP:
+ com_err_initialize__auxinit();
+ break;
+ case DLL_SHUTDOWN:
+ com_err_terminate();
+ break;
+ }
+#elif defined PROFILELIB
+ switch (mode) {
+ case DLL_STARTUP:
+ profile_library_initializer__auxinit();
+ break;
+ case DLL_SHUTDOWN:
+ profile_library_finalizer();
+ break;
+ }
+#elif defined SUPPORTLIB
+ switch (mode) {
+ case DLL_STARTUP:
+ krb5int_thread_support_init__auxinit();
+ break;
+ case DLL_SHUTDOWN:
+ krb5int_thread_support_fini();
+ break;
+ }
+#else
+# error "Don't know the init/fini functions for this library."
#endif
return 0;
break;
case DLL_THREAD_DETACH:
+ if (control(DLL_THREAD_DETACH))
+ return FALSE;
break;
case DLL_PROCESS_DETACH: