diff options
author | das <das> | 2006-01-10 05:37:49 (GMT) |
---|---|---|
committer | das <das> | 2006-01-10 05:37:49 (GMT) |
commit | cec6a748f79c7df4f389cbca2117790addefd411 (patch) | |
tree | 967c3ee56a6db04059d4b910e916fb987df45557 | |
parent | 7fd2cf260b6d61989d3f5e82a802bcd0a7f33e81 (diff) | |
download | tk-cec6a748f79c7df4f389cbca2117790addefd411.zip tk-cec6a748f79c7df4f389cbca2117790addefd411.tar.gz tk-cec6a748f79c7df4f389cbca2117790addefd411.tar.bz2 |
* macosx/tkMacOSXDebug.c: add TkMacOSXGetNamedDebugSymbol() function
* macosx/tkMacOSXDebug.h: that finds unexported symbols in loaded
libraries by manually walking their symbol table; only to be used for
debugging purposes, may break unexpectedly in the future. Needed to get
access to private_extern internal debugging functions in HIToolbox.
* macosx/tkMacOSXCarbonEvents.c: fix debug event tracing on Tiger.
* macosx/tkMacOSXMenu.c: add debug menu printing during reconfigure.
* macosx/tkMacOSXInit.c: conditionalize 64bit-unsafe dyld code.
* macosx/GNUmakefile: add 'wish8.x' symlink to SYMROOT.
* macosx/Wish.xcode/project.pbxproj: fix copy to tktest resource
* macosx/Wish.xcodeproj/project.pbxproj: fork when zerolinked.
* macosx/Wish.xcode/default.pbxuser: add widget demo as argument to
* macosx/Wish.xcodeproj/default.pbxuser: executables (on by default).
* unix/configure: add caching, use AC_CACHE_CHECK instead of
* unix/configure.in: AC_CACHE_VAL where possible, consistent message
* unix/tcl.m4: quoting, sync relevant tclconfig/tcl.m4 changes and
gratuitous formatting differences, fix SC_CONFIG_MANPAGES with default
argument, Darwin improvements to SC_LOAD_*CONFIG.
-rw-r--r-- | ChangeLog | 25 | ||||
-rw-r--r-- | macosx/GNUmakefile | 5 | ||||
-rw-r--r-- | macosx/Wish.xcode/default.pbxuser | 8 | ||||
-rw-r--r-- | macosx/Wish.xcode/project.pbxproj | 2 | ||||
-rw-r--r-- | macosx/Wish.xcodeproj/default.pbxuser | 8 | ||||
-rw-r--r-- | macosx/Wish.xcodeproj/project.pbxproj | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXCarbonEvents.c | 60 | ||||
-rw-r--r-- | macosx/tkMacOSXDebug.c | 134 | ||||
-rw-r--r-- | macosx/tkMacOSXDebug.h | 11 | ||||
-rw-r--r-- | macosx/tkMacOSXInit.c | 6 | ||||
-rw-r--r-- | macosx/tkMacOSXMenu.c | 20 | ||||
-rwxr-xr-x | unix/configure | 371 | ||||
-rw-r--r-- | unix/configure.in | 29 | ||||
-rw-r--r-- | unix/tcl.m4 | 494 |
14 files changed, 753 insertions, 422 deletions
@@ -1,3 +1,28 @@ +2006-01-10 Daniel Steffen <das@users.sourceforge.net> + + * macosx/tkMacOSXDebug.c: add TkMacOSXGetNamedDebugSymbol() function + * macosx/tkMacOSXDebug.h: that finds unexported symbols in loaded + libraries by manually walking their symbol table; only to be used for + debugging purposes, may break unexpectedly in the future. Needed to get + access to private_extern internal debugging functions in HIToolbox. + + * macosx/tkMacOSXCarbonEvents.c: fix debug event tracing on Tiger. + * macosx/tkMacOSXMenu.c: add debug menu printing during reconfigure. + * macosx/tkMacOSXInit.c: conditionalize 64bit-unsafe dyld code. + * macosx/GNUmakefile: add 'wish8.x' symlink to SYMROOT. + + * macosx/Wish.xcode/project.pbxproj: fix copy to tktest resource + * macosx/Wish.xcodeproj/project.pbxproj: fork when zerolinked. + + * macosx/Wish.xcode/default.pbxuser: add widget demo as argument to + * macosx/Wish.xcodeproj/default.pbxuser: executables (on by default). + + * unix/configure: add caching, use AC_CACHE_CHECK instead of + * unix/configure.in: AC_CACHE_VAL where possible, consistent message + * unix/tcl.m4: quoting, sync relevant tclconfig/tcl.m4 changes and + gratuitous formatting differences, fix SC_CONFIG_MANPAGES with default + argument, Darwin improvements to SC_LOAD_*CONFIG. + 2005-12-28 Donal K. Fellows <dkf@users.sf.net> * generic/tkUndo.c (TkUndoSetDepth): Apply [Patch 1391939] from diff --git a/macosx/GNUmakefile b/macosx/GNUmakefile index c4a458c..9740151 100644 --- a/macosx/GNUmakefile +++ b/macosx/GNUmakefile @@ -4,7 +4,7 @@ # uses the standard unix build system in tk/unix (which can be used directly instead of this # if you are not using the tk/macosx projects). # -# RCS: @(#) $Id: GNUmakefile,v 1.2 2005/11/27 02:36:14 das Exp $ +# RCS: @(#) $Id: GNUmakefile,v 1.3 2006/01/10 05:37:51 das Exp $ # ######################################################################################################## @@ -186,7 +186,8 @@ build-${PROJECT}: ${OBJ_DIR}/Makefile rm -rf ./${LIBDIR} ./${BINDIR} && ln -fs ${SYMROOT} ./${LIBDIR} && \ ln -fs ${SYMROOT} ./${BINDIR} && ln -fs ${OBJ_DIR}/tktest ${SYMROOT} ifeq (${TK_X11},) - @rm -f ${OBJ_DIR}/${BINDIR} + @rm -f ${OBJ_DIR}/${BINDIR} && \ + ln -fs Wish.app/Contents/MacOS/Wish ${SYMROOT}/${WISH} endif # Create symbolic link to Tcl.framework in ${SYMROOT}if necessary @cd ${SYMROOT} && if [ ! -e Tcl.framework -o -L Tcl.framework ]; then \ diff --git a/macosx/Wish.xcode/default.pbxuser b/macosx/Wish.xcode/default.pbxuser index c742c7f..164d686 100644 --- a/macosx/Wish.xcode/default.pbxuser +++ b/macosx/Wish.xcode/default.pbxuser @@ -24,13 +24,15 @@ ); }; F944EB8F08F798100049FDD4 = { - activeArgIndex = 2147483647; + activeArgIndex = 0; activeArgIndices = ( + YES, NO, NO, NO, ); argumentStrings = ( + "${SRCROOT}/../../tk/library/demos/widget", "${SRCROOT}/../../tcl/tests/all.tcl", "${SRCROOT}/../../tk/tests/all.tcl", "-verbose \"\"", @@ -118,10 +120,12 @@ activeExec = 0; }; F9E61D1C090A4282002B3151 = { - activeArgIndex = 2147483647; + activeArgIndex = 0; activeArgIndices = ( + YES, ); argumentStrings = ( + "${SRCROOT}/../../tk/library/demos/widget", ); configStateDict = { "PBXLSLaunchAction-0" = { diff --git a/macosx/Wish.xcode/project.pbxproj b/macosx/Wish.xcode/project.pbxproj index 79e5cb4..6049eb4 100644 --- a/macosx/Wish.xcode/project.pbxproj +++ b/macosx/Wish.xcode/project.pbxproj @@ -14306,7 +14306,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; - shellScript = "touch -t $(date -r $(expr $(date '+%s') + 5) '+%Y%m%d%H%M.%S') \"${TEMP_DIR}/stamp\"\n\n## Ensure other buildstyles are relinked next time they are built:\ncd \"${OBJROOT}/${PROJECT_NAME}.build\" &&\nfor d in $(find . -maxdepth 1 -type d -name '*.build' ! -name \"${PROJECT_TEMP_DIR##*/}\"); do\n for v in ${BUILD_VARIANTS}; do\n o=\"$d/${TARGET_NAME}.build/Objects-${v}\" &&\n for a in ${ARCHS}; do touch -c -r \"${TEMP_DIR}/stamp\" \"$o/$a/tkAppInit.o\"; done\n done\ndone\n\n## Xcode bug workaround: Rezzing does not take place for commandline tool targets\n## even when a ResourceManager Resources phase is present, but this script phase's\n## input dependency on the final merged resource file forces the Rezzing.\n\nif [ \"${ZERO_LINK}\" = \"YES\" ]; then\n ## ZeroLinking ignores OTHER_LDFLAGS, so our resource file doesn't get linked into the executable.\n ## workaround: copy resource data into resource fork of zerolink launcher (will only work on HFS+).\n cp -f \"${SCRIPT_INPUT_FILE_1}\" \"${SCRIPT_INPUT_FILE_0}/rsrc\"\nfi\n"; + shellScript = "touch -t $(date -r $(expr $(date '+%s') + 5) '+%Y%m%d%H%M.%S') \"${TEMP_DIR}/stamp\"\n\n## Ensure other buildstyles are relinked next time they are built:\ncd \"${OBJROOT}/${PROJECT_NAME}.build\" &&\nfor d in $(find . -maxdepth 1 -type d -name '*.build' ! -name \"${PROJECT_TEMP_DIR##*/}\"); do\n for v in ${BUILD_VARIANTS}; do\n o=\"$d/${TARGET_NAME}.build/Objects-${v}\" &&\n for a in ${ARCHS}; do touch -c -r \"${TEMP_DIR}/stamp\" \"$o/$a/tkAppInit.o\"; done\n done\ndone\n\n## Xcode bug workaround: Rezzing does not take place for commandline tool targets\n## even when a ResourceManager Resources phase is present, but this script phase's\n## input dependency on the final merged resource file forces the Rezzing.\n\nif [ \"${ZERO_LINK}\" = \"YES\" ]; then\n ## ZeroLinking ignores OTHER_LDFLAGS, so our resource file doesn't get linked into the executable.\n ## workaround: copy resource data into resource fork of zerolink launcher (will only work on HFS+).\n cp -f \"${SCRIPT_INPUT_FILE_1}\" \"${SCRIPT_INPUT_FILE_0}/..namedfork/rsrc\"\nfi\n"; }; F9903CAF094FAADA004613E9 = { explicitFileType = text.script; diff --git a/macosx/Wish.xcodeproj/default.pbxuser b/macosx/Wish.xcodeproj/default.pbxuser index 584b1f0..1695fa5 100644 --- a/macosx/Wish.xcodeproj/default.pbxuser +++ b/macosx/Wish.xcodeproj/default.pbxuser @@ -26,13 +26,15 @@ }; F944EB8F08F798100049FDD4 /* tktest */ = { isa = PBXExecutable; - activeArgIndex = 2147483647; + activeArgIndex = 0; activeArgIndices = ( + YES, NO, NO, NO, ); argumentStrings = ( + "${SRCROOT}/../../tk/library/demos/widget", "${SRCROOT}/../../tcl/tests/all.tcl", "${SRCROOT}/../../tk/tests/all.tcl", "-verbose \"\"", @@ -111,10 +113,12 @@ }; F9E61D1C090A4282002B3151 /* Wish */ = { isa = PBXExecutable; - activeArgIndex = 2147483647; + activeArgIndex = 0; activeArgIndices = ( + YES, ); argumentStrings = ( + "${SRCROOT}/../../tk/library/demos/widget", ); autoAttachOnCrash = 1; configStateDict = { diff --git a/macosx/Wish.xcodeproj/project.pbxproj b/macosx/Wish.xcodeproj/project.pbxproj index 242c1af..29331fc 100644 --- a/macosx/Wish.xcodeproj/project.pbxproj +++ b/macosx/Wish.xcodeproj/project.pbxproj @@ -3358,7 +3358,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; - shellScript = "touch -t $(date -r $(expr $(date '+%s') + 5) '+%Y%m%d%H%M.%S') \"${TEMP_DIR}/stamp\"\n\n## Xcode bug workaround: Rezzing does not take place for commandline tool targets\n## even when a ResourceManager Resources phase is present, but this script phase's\n## input dependency on the final merged resource file forces the Rezzing.\n\nif [ \"${ZERO_LINK}\" = \"YES\" ]; then\n ## ZeroLinking ignores OTHER_LDFLAGS, so our resource file doesn't get linked into the executable.\n ## workaround: copy resource data into resource fork of zerolink launcher (will only work on HFS+).\n cp -f \"${SCRIPT_INPUT_FILE_1}\" \"${SCRIPT_INPUT_FILE_0}/rsrc\"\nfi\n"; + shellScript = "touch -t $(date -r $(expr $(date '+%s') + 5) '+%Y%m%d%H%M.%S') \"${TEMP_DIR}/stamp\"\n\n## Xcode bug workaround: Rezzing does not take place for commandline tool targets\n## even when a ResourceManager Resources phase is present, but this script phase's\n## input dependency on the final merged resource file forces the Rezzing.\n\nif [ \"${ZERO_LINK}\" = \"YES\" ]; then\n ## ZeroLinking ignores OTHER_LDFLAGS, so our resource file doesn't get linked into the executable.\n ## workaround: copy resource data into resource fork of zerolink launcher (will only work on HFS+).\n cp -f \"${SCRIPT_INPUT_FILE_1}\" \"${SCRIPT_INPUT_FILE_0}/..namedfork/rsrc\"\nfi\n"; }; F9A5C5F508F651A2008AE941 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; diff --git a/macosx/tkMacOSXCarbonEvents.c b/macosx/tkMacOSXCarbonEvents.c index c4aca8d..def8bd8 100644 --- a/macosx/tkMacOSXCarbonEvents.c +++ b/macosx/tkMacOSXCarbonEvents.c @@ -60,7 +60,7 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.8 2005/12/13 03:44:34 das Exp $ + * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.9 2006/01/10 05:37:51 das Exp $ */ #include "tkInt.h" @@ -119,13 +119,13 @@ CarbonEventHandlerProc ( macEvent.interp = (Tcl_Interp *) userData; bzero(&eventStatus, sizeof(eventStatus)); -#ifdef TK_MAC_DEBUG_CARBON_EVENTS +#if defined(TK_MAC_DEBUG) && defined(TK_MAC_DEBUG_CARBON_EVENTS) char buf [256]; if (macEvent.eKind != kEventMouseMoved && macEvent.eKind != kEventMouseDragged) { CarbonEventToAscii(event, buf); fprintf(stderr, "CarbonEventHandlerProc started handling %s\n", buf); - TkMacOSXInitNamedSymbol(HIToolbox, void, _DebugPrintEvent, + TkMacOSXInitNamedDebugSymbol(HIToolbox, void, _DebugPrintEvent, EventRef inEvent); if (_DebugPrintEvent) { /* Carbon-internal event debugging (c.f. Technote 2124) */ @@ -139,7 +139,7 @@ CarbonEventHandlerProc ( result = noErr; } -#ifdef TK_MAC_DEBUG_CARBON_EVENTS +#if defined(TK_MAC_DEBUG) && defined(TK_MAC_DEBUG_CARBON_EVENTS) if (macEvent.eKind != kEventMouseMoved && macEvent.eKind != kEventMouseDragged) { fprintf(stderr, @@ -225,32 +225,32 @@ TkMacOSXInitCarbonEvents ( #endif } -#ifdef TK_MAC_DEBUG_CARBON_EVENTS - TkMacOSXInitNamedSymbol(HIToolbox, void, _TraceEventByName, CFStringRef); - if (_TraceEventByName) { +#if defined(TK_MAC_DEBUG) && defined(TK_MAC_DEBUG_CARBON_EVENTS) + TkMacOSXInitNamedDebugSymbol(HIToolbox, void, TraceEventByName, char*); + if (TraceEventByName) { /* Carbon-internal event debugging (c.f. Technote 2124) */ - _TraceEventByName(CFSTR("kEventMouseDown")); - _TraceEventByName(CFSTR("kEventMouseUp")); - _TraceEventByName(CFSTR("kEventMouseWheelMoved")); - _TraceEventByName(CFSTR("kEventMouseScroll")); - _TraceEventByName(CFSTR("kEventWindowUpdate")); - _TraceEventByName(CFSTR("kEventWindowActivated")); - _TraceEventByName(CFSTR("kEventWindowDeactivated")); - _TraceEventByName(CFSTR("kEventRawKeyDown")); - _TraceEventByName(CFSTR("kEventRawKeyRepeat")); - _TraceEventByName(CFSTR("kEventRawKeyUp")); - _TraceEventByName(CFSTR("kEventRawKeyModifiersChanged")); - _TraceEventByName(CFSTR("kEventRawKeyRepeat")); - _TraceEventByName(CFSTR("kEventAppActivated")); - _TraceEventByName(CFSTR("kEventAppDeactivated")); - _TraceEventByName(CFSTR("kEventAppQuit")); - _TraceEventByName(CFSTR("kEventMenuBeginTracking")); - _TraceEventByName(CFSTR("kEventMenuEndTracking")); - _TraceEventByName(CFSTR("kEventCommandProcess")); - _TraceEventByName(CFSTR("kEventWindowExpanded")); - _TraceEventByName(CFSTR("kEventAppHidden")); - _TraceEventByName(CFSTR("kEventAppShown")); - _TraceEventByName(CFSTR("kEventAppAvailableWindowBoundsChanged")); + TraceEventByName("kEventMouseDown"); + TraceEventByName("kEventMouseUp"); + TraceEventByName("kEventMouseWheelMoved"); + TraceEventByName("kEventMouseScroll"); + TraceEventByName("kEventWindowUpdate"); + TraceEventByName("kEventWindowActivated"); + TraceEventByName("kEventWindowDeactivated"); + TraceEventByName("kEventRawKeyDown"); + TraceEventByName("kEventRawKeyRepeat"); + TraceEventByName("kEventRawKeyUp"); + TraceEventByName("kEventRawKeyModifiersChanged"); + TraceEventByName("kEventRawKeyRepeat"); + TraceEventByName("kEventAppActivated"); + TraceEventByName("kEventAppDeactivated"); + TraceEventByName("kEventAppQuit"); + TraceEventByName("kEventMenuBeginTracking"); + TraceEventByName("kEventMenuEndTracking"); + TraceEventByName("kEventCommandProcess"); + TraceEventByName("kEventWindowExpanded"); + TraceEventByName("kEventAppHidden"); + TraceEventByName("kEventAppShown"); + TraceEventByName("kEventAppAvailableWindowBoundsChanged"); } #endif /* TK_MAC_DEBUG_CARBON_EVENTS */ } @@ -380,7 +380,7 @@ CarbonTimerProc ( { while(carbonTimerEnabled && Tcl_DoOneEvent( TCL_FILE_EVENTS|TCL_TIMER_EVENTS|TCL_DONT_WAIT)) { -#ifdef TK_MAC_DEBUG_CARBON_EVENTS +#if defined(TK_MAC_DEBUG) && defined(TK_MAC_DEBUG_CARBON_EVENTS) fprintf(stderr, "Processed tcl event from carbon timer\n"); #endif /* TK_MAC_DEBUG_CARBON_EVENTS */ } diff --git a/macosx/tkMacOSXDebug.c b/macosx/tkMacOSXDebug.c index 9997886..61f8418 100644 --- a/macosx/tkMacOSXDebug.c +++ b/macosx/tkMacOSXDebug.c @@ -50,13 +50,17 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.6 2005/11/27 02:36:14 das Exp $ + * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.7 2006/01/10 05:37:51 das Exp $ */ +#include "tkMacOSXInt.h" #include "tkMacOSXDebug.h" #ifdef TK_MAC_DEBUG +#include <mach-o/dyld.h> +#include <mach-o/nlist.h> + typedef struct { EventKind kind; char * name; @@ -447,5 +451,133 @@ MouseTrackingResultToAscii(MouseTrackingResult r, char * buf) sprintf(buf, "Unknown mouse tracking result : %d", r); return buf; } + +/* + *---------------------------------------------------------------------- + * + * TkMacOSXGetNamedDebugSymbol -- + * + * + * Dynamically acquire address of a named symbol from a loaded + * dynamic library, so that we can use API that may not be + * available on all OS versions. + * For debugging purposes, if we cannot find the symbol with the + * usual dynamic library APIs, we manually walk the symbol table + * of the loaded library. This allows access to unexported + * symbols such as private_extern internal debugging functions. + * If module is NULL or the empty string, search all loaded + * libraries (could be very expensive and should be avoided). + * + * THIS FUCTION IS ONLY TO BE USED FOR DEBUGGING PURPOSES, IT MAY + * BREAK UNEXPECTEDLY IN THE FUTURE ! + * + * Results: + * Address of given symbol or NULL if unavailable. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +MODULE_SCOPE void * +TkMacOSXGetNamedDebugSymbol(const char* module, const char* symbol) +{ + void* addr = TkMacOSXGetNamedSymbol(module, symbol); +#ifndef __LP64__ + if (!addr) { + const struct mach_header *mh = NULL; + uint32_t i, n = _dyld_image_count(); + + for (i = 0; i < n; i++) { + if (module && *module) { + /* Find image with given module name */ + char *name; + const char *path = _dyld_get_image_name(i); + + if (!path) { + continue; + } + name = strrchr(path, '/') + 1; + if (strncmp(name, module, strlen(name)) != 0) { + continue; + } + } + mh = _dyld_get_image_header(i); + if (mh) { + struct load_command *lc; + struct symtab_command *st = NULL; + struct segment_command *sg = NULL; + uint32_t j, m, nsect = 0, txtsectx = 0; + + lc = (struct load_command*)((char *) mh + + sizeof(struct mach_header)); + m = mh->ncmds; + for (j = 0; j < m; j++) { + /* Find symbol table and index of __text section */ + if (lc->cmd == LC_SEGMENT) { + /* Find last segment before symbol table */ + sg = (struct segment_command*) lc; + if (!txtsectx) { + /* Count total sections until (__TEXT, __text) */ + uint32_t k, ns = sg->nsects; + + if (strcmp(sg->segname, SEG_TEXT) == 0) { + struct section *s = (struct section *)( + (char *)sg + + sizeof(struct segment_command)); + + for(k = 0; k < ns; k++) { + if (strcmp(s->sectname, SECT_TEXT) == 0) { + txtsectx = nsect+k+1; + break; + } + s++; + } + } + nsect += ns; + } + } else if (!st && lc->cmd == LC_SYMTAB) { + st = (struct symtab_command*) lc; + break; + } + lc = (struct load_command *)((char *) lc + lc->cmdsize); + } + if (st && sg && txtsectx) { + intptr_t base, slide = _dyld_get_image_vmaddr_slide(i); + char *strings; + struct nlist *sym; + uint32_t strsize = st->strsize; + int32_t strx; + + /* Offset file positions by difference to actual position + in memory of last segment before symbol table: */ + base = (intptr_t) sg->vmaddr + slide - sg->fileoff; + strings = (char*)(base + st->stroff); + sym = (struct nlist*)(base + st->symoff); + m = st->nsyms; + for (j = 0; j < m; j++) { + /* Find symbol with given name in __text section */ + strx = sym->n_un.n_strx; + if ((sym->n_type & N_TYPE) == N_SECT && + sym->n_sect == txtsectx && + strx > 0 && strx < strsize && + strcmp(strings + strx, symbol) == 0) { + addr = (void*) sym->n_value + slide; + break; + } + sym++; + } + } + } + if (module && *module) { + /* If given a module name, only search corresponding image */ + break; + } + } + } +#endif /* __LP64__ */ + return addr; +} #endif /* TK_MAC_DEBUG */ diff --git a/macosx/tkMacOSXDebug.h b/macosx/tkMacOSXDebug.h index 5abe734..7039b36 100644 --- a/macosx/tkMacOSXDebug.h +++ b/macosx/tkMacOSXDebug.h @@ -50,7 +50,7 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXDebug.h,v 1.6 2005/11/27 02:36:14 das Exp $ + * RCS: @(#) $Id: tkMacOSXDebug.h,v 1.7 2006/01/10 05:37:51 das Exp $ */ #ifndef _TKMACDEBUG @@ -79,6 +79,15 @@ MODULE_SCOPE char * TkMacOSXMenuMessageToAscii(int msg, char * s); MODULE_SCOPE char * MouseTrackingResultToAscii(MouseTrackingResult r, char * buf ); +MODULE_SCOPE void* TkMacOSXGetNamedDebugSymbol(const char* module, const char* symbol); + +/* Macro to abstract common use of TkMacOSXGetNamedDebugSymbol to initialize named symbols */ +#define TkMacOSXInitNamedDebugSymbol(module, ret, symbol, ...) \ + static ret (* symbol)(__VA_ARGS__) = (void*)(-1L); \ + if (symbol == (void*)(-1L)) { \ + symbol = TkMacOSXGetNamedDebugSymbol(STRINGIFY(module), STRINGIFY(_##symbol));\ + } + #endif #endif diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 00f02ea..aefde49 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXInit.c,v 1.17 2005/12/08 07:50:14 das Exp $ + * RCS: @(#) $Id: tkMacOSXInit.c,v 1.18 2006/01/10 05:37:51 das Exp $ */ #include "tkInt.h" @@ -170,12 +170,13 @@ TkpInit(interp) if (rsrc) { ReleaseResource(rsrc); } else { +#ifndef __LP64__ const struct mach_header *image; char *data = NULL; uint32_t size; int fd = -1; char fileName[L_tmpnam + 15]; - int i, n; + uint32_t i, n; /* Get resource data from __tk_rsrc section of tk library file */ n = _dyld_image_count(); @@ -216,6 +217,7 @@ TkpInit(interp) unlink(fileName); close(fd); } +#endif /* __LP64__ */ } } diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 4f849bc..eaef5f1 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.24 2005/11/27 06:53:13 das Exp $ + * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.25 2006/01/10 05:37:51 das Exp $ */ #include "tkMacOSXInt.h" #include "tkMenubutton.h" @@ -25,6 +25,12 @@ #include "tkMacOSXDebug.h" #include <CoreFoundation/CFString.h> +/* +#ifdef TK_MAC_DEBUG +#define TK_MAC_DEBUG_MENUS +#endif +*/ + #if !defined(MAC_OS_X_VERSION_10_3) || \ (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3) /* Define constants only available on Mac OS X 10.3 or later */ @@ -1066,6 +1072,14 @@ ReconfigureIndividualMenu( TkMenuEntry *mePtr; int parentDisabled = 0; +#if defined(TK_MAC_DEBUG) && defined(TK_MAC_DEBUG_MENUS) + /* Carbon-internal menu debugging (c.f. Technote 2124) */ + TkMacOSXInitNamedDebugSymbol(HIToolbox, void, DebugPrintMenu, MenuRef menu); + if (DebugPrintMenu) { + DebugPrintMenu(macMenuHdl); + } +#endif + for (mePtr = menuPtr->menuRefPtr->parentEntryPtr; mePtr != NULL; mePtr = mePtr->nextCascadePtr) { char *name = (mePtr->namePtr == NULL) ? "" @@ -1150,10 +1164,6 @@ ReconfigureIndividualMenu( ((MacMenu *) mePtr->childMenuRefPtr ->menuPtr->platformData)->menuHdl; - if (childMenuHdl == NULL) { - childMenuHdl = ((MacMenu *) mePtr->childMenuRefPtr - ->menuPtr->platformData)->menuHdl; - } if (childMenuHdl != NULL) { { SetMenuItemHierarchicalID(macMenuHdl, base + index, diff --git a/unix/configure b/unix/configure index 860ae3d..21a48d6 100755 --- a/unix/configure +++ b/unix/configure @@ -1409,9 +1409,25 @@ echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" > done fi + # on Darwin, check in Framework installation locations + if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then + for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ + `ls -d /Library/Frameworks 2>/dev/null` \ + `ls -d /Network/Library/Frameworks 2>/dev/null` \ + `ls -d /System/Library/Frameworks 2>/dev/null` \ + ; do + if test -f "$i/Tcl.framework/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i/Tcl.framework; pwd)` + break + fi + done + fi + # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ + `ls -d ${exec_prefix}/lib 2>/dev/null` \ + `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ @@ -1448,49 +1464,64 @@ echo "$as_me: WARNING: Can't find Tcl configuration definitions" >&2;} else no_tcl= TCL_BIN_DIR=${ac_cv_c_tclconfig} - echo "$as_me:$LINENO: result: found $TCL_BIN_DIR/tclConfig.sh" >&5 -echo "${ECHO_T}found $TCL_BIN_DIR/tclConfig.sh" >&6 + echo "$as_me:$LINENO: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5 +echo "${ECHO_T}found ${TCL_BIN_DIR}/tclConfig.sh" >&6 fi fi - echo "$as_me:$LINENO: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 -echo $ECHO_N "checking for existence of $TCL_BIN_DIR/tclConfig.sh... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5 +echo $ECHO_N "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... $ECHO_C" >&6 - if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then + if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then echo "$as_me:$LINENO: result: loading" >&5 echo "${ECHO_T}loading" >&6 - . $TCL_BIN_DIR/tclConfig.sh + . ${TCL_BIN_DIR}/tclConfig.sh else - echo "$as_me:$LINENO: result: file not found" >&5 -echo "${ECHO_T}file not found" >&6 + echo "$as_me:$LINENO: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5 +echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6 fi - # + # eval is required to do the TCL_DBGX substitution + eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" + eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" + # If the TCL_BIN_DIR is the build directory (not the install directory), # then set the common variable name to the value of the build variables. # For example, the variable TCL_LIB_SPEC will be set to the value # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC # instead of TCL_BUILD_LIB_SPEC since it will work with both an # installed and uninstalled version of Tcl. - # - - if test -f $TCL_BIN_DIR/Makefile ; then + if test -f ${TCL_BIN_DIR}/Makefile ; then TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} + elif test "`uname -s`" = "Darwin"; then + # If Tcl was built as a framework, attempt to use the libraries + # from the framework at the given location so that linking works + # against Tcl.framework installed in an arbitary location. + case ${TCL_DEFS} in + *TCL_FRAMEWORK*) + if test -f ${TCL_BIN_DIR}/${TCL_LIB_FILE}; then + for i in "`cd ${TCL_BIN_DIR}; pwd`" \ + "`cd ${TCL_BIN_DIR}/../..; pwd`"; do + if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then + TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}" + break + fi + done + fi + if test -f ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}; then + TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}" + TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}" + fi + ;; + esac fi - # # eval is required to do the TCL_DBGX substitution - # (@@@ Is this still the case?) - # - - eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" - - eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" @@ -1510,7 +1541,6 @@ echo "${ECHO_T}file not found" >&6 echo "$as_me:$LINENO: checking for tclsh" >&5 echo $ECHO_N "checking for tclsh... $ECHO_C" >&6 - if test "${ac_cv_path_tclsh+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1580,6 +1610,7 @@ TK_SRC_DIR=`cd $srcdir/..; pwd` # Compress and/or soft link the manpages? #------------------------------------------------------------------------ + echo "$as_me:$LINENO: checking whether to use symlinks for manpages" >&5 echo $ECHO_N "checking whether to use symlinks for manpages... $ECHO_C" >&6 # Check whether --enable-man-symlinks or --disable-man-symlinks was given. @@ -1627,7 +1658,7 @@ echo $ECHO_N "checking whether to add a package name suffix for the manpages... if test "${enable_man_suffix+set}" = set; then enableval="$enable_man_suffix" case $enableval in - yes) enableval="tk";; + yes) enableval="tk" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";; no) ;; *) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";; esac @@ -3500,8 +3531,6 @@ fi #------------------------------------------------------------------------ - echo "$as_me:$LINENO: checking for building with threads" >&5 -echo $ECHO_N "checking for building with threads... $ECHO_C" >&6 # Check whether --enable-threads or --disable-threads was given. if test "${enable_threads+set}" = set; then enableval="$enable_threads" @@ -3510,20 +3539,12 @@ else tcl_ok=no fi; + if test "${TCL_THREADS}" = 1; then + tcl_threaded_core=1; + fi + if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then - if test "${TCL_THREADS}" = 1; then - echo "$as_me:$LINENO: result: yes (threaded core)" >&5 -echo "${ECHO_T}yes (threaded core)" >&6 - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - fi TCL_THREADS=1 - -cat >>confdefs.h <<\_ACEOF -#define TCL_THREADS 1 -_ACEOF - # USE_THREAD_ALLOC tells us to try the special thread-based # allocator that significantly reduces lock contention @@ -3844,7 +3865,7 @@ else tcl_ok=no fi - if test "$tcl_ok" = "no"; then + if test "$tcl_ok" = "no"; then echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc_r" >&5 echo $ECHO_N "checking for pthread_mutex_init in -lc_r... $ECHO_C" >&6 if test "${ac_cv_lib_c_r_pthread_mutex_init+set}" = set; then @@ -3920,10 +3941,10 @@ fi THREADS_LIBS=" -pthread" else TCL_THREADS=0 - { echo "$as_me:$LINENO: WARNING: \"Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...\"" >&5 -echo "$as_me: WARNING: \"Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...\"" >&2;} + { echo "$as_me:$LINENO: WARNING: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." >&5 +echo "$as_me: WARNING: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." >&2;} fi - fi + fi fi fi @@ -4138,7 +4159,7 @@ _ACEOF echo "$as_me:$LINENO: checking for pthread_attr_get_np declaration" >&5 echo $ECHO_N "checking for pthread_attr_get_np declaration... $ECHO_C" >&6 - if test "${tcl_cv_grep_pthread_attr_get_np+set}" = set; then +if test "${tcl_cv_grep_pthread_attr_get_np+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -4159,8 +4180,7 @@ fi rm -f conftest* fi - - echo "$as_me:$LINENO: result: $tcl_cv_grep_pthread_attr_get_np" >&5 +echo "$as_me:$LINENO: result: $tcl_cv_grep_pthread_attr_get_np" >&5 echo "${ECHO_T}$tcl_cv_grep_pthread_attr_get_np" >&6 if test $tcl_cv_grep_pthread_attr_get_np = missing ; then @@ -4274,7 +4294,7 @@ _ACEOF echo "$as_me:$LINENO: checking for pthread_getattr_np declaration" >&5 echo $ECHO_N "checking for pthread_getattr_np declaration... $ECHO_C" >&6 - if test "${tcl_cv_grep_pthread_getattr_np+set}" = set; then +if test "${tcl_cv_grep_pthread_getattr_np+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -4295,8 +4315,7 @@ fi rm -f conftest* fi - - echo "$as_me:$LINENO: result: $tcl_cv_grep_pthread_getattr_np" >&5 +echo "$as_me:$LINENO: result: $tcl_cv_grep_pthread_getattr_np" >&5 echo "${ECHO_T}$tcl_cv_grep_pthread_getattr_np" >&6 if test $tcl_cv_grep_pthread_getattr_np = missing ; then @@ -4310,12 +4329,31 @@ _ACEOF LIBS=$ac_saved_libs else TCL_THREADS=0 + fi + # Do checking message here to not mess up interleaved configure output + echo "$as_me:$LINENO: checking for building with threads" >&5 +echo $ECHO_N "checking for building with threads... $ECHO_C" >&6 + if test "${TCL_THREADS}" = 1; then + +cat >>confdefs.h <<\_ACEOF +#define TCL_THREADS 1 +_ACEOF + + if test "${tcl_threaded_core}" = 1; then + echo "$as_me:$LINENO: result: yes (threaded core)" >&5 +echo "${ECHO_T}yes (threaded core)" >&6 + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + fi + else echo "$as_me:$LINENO: result: no (default)" >&5 echo "${ECHO_T}no (default)" >&6 fi + # Add the threads support libraries LIBS="$LIBS$THREADS_LIBS" @@ -4448,16 +4486,10 @@ echo $ECHO_N "checking if 64bit support is requested... $ECHO_C" >&6 # Check whether --enable-64bit or --disable-64bit was given. if test "${enable_64bit+set}" = set; then enableval="$enable_64bit" - + do64bit=$enableval else - enableval="no" + do64bit=no fi; - - if test "$enableval" = "yes"; then - do64bit=yes - else - do64bit=no - fi echo "$as_me:$LINENO: result: $do64bit" >&5 echo "${ECHO_T}$do64bit" >&6 @@ -4468,49 +4500,54 @@ echo $ECHO_N "checking if 64bit Sparc VIS support is requested... $ECHO_C" >&6 # Check whether --enable-64bit-vis or --disable-64bit-vis was given. if test "${enable_64bit_vis+set}" = set; then enableval="$enable_64bit_vis" - + do64bitVIS=$enableval else - enableval="no" + do64bitVIS=no fi; + echo "$as_me:$LINENO: result: $do64bitVIS" >&5 +echo "${ECHO_T}$do64bitVIS" >&6 - if test "$enableval" = "yes"; then + if test "$do64bitVIS" = "yes"; then # Force 64bit on with VIS do64bit=yes - do64bitVIS=yes - else - do64bitVIS=no fi - echo "$as_me:$LINENO: result: $do64bitVIS" >&5 -echo "${ECHO_T}$do64bitVIS" >&6 # Step 1: set the variable "system" to hold the name and version number - # for the system. This can usually be done via the "uname" command, but - # there are a few systems, like Next, where this doesn't work. + # for the system. - echo "$as_me:$LINENO: checking system version (for dynamic loading)" >&5 -echo $ECHO_N "checking system version (for dynamic loading)... $ECHO_C" >&6 - if test -f /usr/lib/NextStep/software_version; then - system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` - else - system=`uname -s`-`uname -r` - if test "$?" -ne 0 ; then - echo "$as_me:$LINENO: result: unknown (can't find uname command)" >&5 -echo "${ECHO_T}unknown (can't find uname command)" >&6 - system=unknown + + echo "$as_me:$LINENO: checking system version" >&5 +echo $ECHO_N "checking system version... $ECHO_C" >&6 +if test "${tcl_cv_sys_version+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test -f /usr/lib/NextStep/software_version; then + tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` else - # Special check for weird MP-RAS system (uname returns weird - # results, and the version is kept in special file). + tcl_cv_sys_version=`uname -s`-`uname -r` + if test "$?" -ne 0 ; then + { echo "$as_me:$LINENO: WARNING: can't find uname command" >&5 +echo "$as_me: WARNING: can't find uname command" >&2;} + tcl_cv_sys_version=unknown + else + # Special check for weird MP-RAS system (uname returns weird + # results, and the version is kept in special file). - if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then - system=MP-RAS-`awk '{print }' /etc/.relid` - fi - if test "`uname -s`" = "AIX" ; then - system=AIX-`uname -v`.`uname -r` + if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then + tcl_cv_sys_version=MP-RAS-`awk '{print }' /etc/.relid` + fi + if test "`uname -s`" = "AIX" ; then + tcl_cv_sys_version=AIX-`uname -v`.`uname -r` + fi fi - echo "$as_me:$LINENO: result: $system" >&5 -echo "${ECHO_T}$system" >&6 fi - fi + +fi +echo "$as_me:$LINENO: result: $tcl_cv_sys_version" >&5 +echo "${ECHO_T}$tcl_cv_sys_version" >&6 + system=$tcl_cv_sys_version + # Step 2: check for existence of -ldl library. This is needed because # Linux can use either -ldl or -ldld for dynamic loading. @@ -4661,9 +4698,14 @@ echo "$as_me: error: Required archive tool 'ar' not found on PATH." >&2;} AIX-*) if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then # AIX requires the _r compiler when gcc isn't being used - if test "${CC}" != "cc_r" ; then - CC=${CC}_r - fi + case "${CC}" in + *_r) + # ok ... + ;; + *) + CC=${CC}_r + ;; + esac echo "$as_me:$LINENO: result: Using $CC for compiling with threads" >&5 echo "${ECHO_T}Using $CC for compiling with threads" >&6 fi @@ -5042,19 +5084,19 @@ fi # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes" ; then if test "$GCC" = "yes" ; then - hpux_arch=`gcc -dumpmachine` + hpux_arch=`${CC} -dumpmachine` case $hpux_arch in hppa64*) # 64-bit gcc in use. Fix flags for GNU ld. do64bit_ok=yes - SHLIB_LD="gcc -shared" + SHLIB_LD="${CC} -shared" SHLIB_LD_LIBS='${LIBS}' CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ;; *) - { echo "$as_me:$LINENO: WARNING: \"64bit mode not supported with GCC on $system\"" >&5 -echo "$as_me: WARNING: \"64bit mode not supported with GCC on $system\"" >&2;} + { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5 +echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} ;; esac else @@ -5264,16 +5306,16 @@ _ACEOF ;; Lynx*) SHLIB_CFLAGS="-fPIC" - SHLIB_LD_LIBS='${LIBS}' + SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" - CFLAGS_OPTIMIZE=-02 + CFLAGS_OPTIMIZE=-02 SHLIB_LD="${CC} -shared " DL_OBJS="tclLoadDl.o" DL_LIBS="-mshared -ldl" LD_FLAGS="-Wl,--export-dynamic" CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - ;; + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + ;; MP-RAS-02*) SHLIB_CFLAGS="-K PIC" SHLIB_LD="cc -G" @@ -5307,7 +5349,11 @@ _ACEOF LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' echo "$as_me:$LINENO: checking for ELF" >&5 echo $ECHO_N "checking for ELF... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF +if test "${tcl_cv_ld_elf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5321,17 +5367,20 @@ cat >>conftest.$ac_ext <<_ACEOF _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' + tcl_cv_ld_elf=yes else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' - + tcl_cv_ld_elf=no fi rm -f conftest* +fi +echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5 +echo "${ECHO_T}$tcl_cv_ld_elf" >&6 + if test $tcl_cv_ld_elf = yes; then + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' + else + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' + fi # Ancient FreeBSD doesn't handle version numbers with dots. @@ -5356,7 +5405,11 @@ rm -f conftest* SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' echo "$as_me:$LINENO: checking for ELF" >&5 echo $ECHO_N "checking for ELF... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF +if test "${tcl_cv_ld_elf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5370,17 +5423,20 @@ cat >>conftest.$ac_ext <<_ACEOF _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - LDFLAGS=-Wl,-export-dynamic + tcl_cv_ld_elf=yes else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - LDFLAGS="" - + tcl_cv_ld_elf=no fi rm -f conftest* +fi +echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5 +echo "${ECHO_T}$tcl_cv_ld_elf" >&6 + if test $tcl_cv_ld_elf = yes; then + LDFLAGS=-Wl,-export-dynamic + else + LDFLAGS="" + fi # OpenBSD doesn't do version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' @@ -6488,6 +6544,8 @@ echo "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;} CFLAGS="$CFLAGS -xarch=v9" LDFLAGS_ARCH="-xarch=v9" fi + # Solaris 64 uses this as well + #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64" fi elif test "$arch" = "amd64 i386" ; then if test "$GCC" = "yes" ; then @@ -6539,11 +6597,15 @@ echo "$as_me: WARNING: 64bit mode not supported for $arch" >&2;} DL_LIBS="-ldl" # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers # that don't grok the -Bexport option. Test that it does. - hold_ldflags=$LDFLAGS echo "$as_me:$LINENO: checking for ld accepts -Bexport flag" >&5 echo $ECHO_N "checking for ld accepts -Bexport flag... $ECHO_C" >&6 - LDFLAGS="$LDFLAGS -Wl,-Bexport" - cat >conftest.$ac_ext <<_ACEOF +if test "${tcl_cv_ld_Bexport+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + hold_ldflags=$LDFLAGS + LDFLAGS="$LDFLAGS -Wl,-Bexport" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -6580,17 +6642,22 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - found=yes + tcl_cv_ld_Bexport=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -LDFLAGS=$hold_ldflags found=no +tcl_cv_ld_Bexport=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - echo "$as_me:$LINENO: result: $found" >&5 -echo "${ECHO_T}$found" >&6 + LDFLAGS=$hold_ldflags +fi +echo "$as_me:$LINENO: result: $tcl_cv_ld_Bexport" >&5 +echo "${ECHO_T}$tcl_cv_ld_Bexport" >&6 + if test $tcl_cv_ld_Bexport = yes; then + LDFLAGS="$LDFLAGS -Wl,-Bexport" + fi CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; @@ -6656,12 +6723,8 @@ fi; ;; Darwin-*) ;; - RISCos-*) - ;; SCO_SV-3.2*) ;; - ULTRIX-4.*) - ;; *) SHLIB_CFLAGS="-fPIC" ;; @@ -6924,6 +6987,7 @@ _ACEOF tcl_flags="$tcl_flags _ISOC99_SOURCE" fi + if test "${tcl_cv_flag__largefile64_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -7028,6 +7092,7 @@ _ACEOF tcl_flags="$tcl_flags _LARGEFILE64_SOURCE" fi + if test "${tcl_cv_flag__largefile_source64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -7131,6 +7196,7 @@ _ACEOF tcl_flags="$tcl_flags _LARGEFILE_SOURCE64" fi + if test "x${tcl_flags}" = "x" ; then echo "$as_me:$LINENO: result: none" >&5 echo "${ECHO_T}none" >&6 @@ -7140,6 +7206,7 @@ echo "${ECHO_T}${tcl_flags}" >&6 fi + echo "$as_me:$LINENO: checking for 64-bit integer type" >&5 echo $ECHO_N "checking for 64-bit integer type... $ECHO_C" >&6 if test "${tcl_cv_type_64bit+set}" = set; then @@ -7264,7 +7331,7 @@ echo "${ECHO_T}${tcl_cv_type_64bit}" >&6 # Now check for auxiliary declarations echo "$as_me:$LINENO: checking for struct dirent64" >&5 echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6 - if test "${tcl_cv_struct_dirent64+set}" = set; then +if test "${tcl_cv_struct_dirent64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -7315,7 +7382,8 @@ tcl_cv_struct_dirent64=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - +echo "$as_me:$LINENO: result: $tcl_cv_struct_dirent64" >&5 +echo "${ECHO_T}$tcl_cv_struct_dirent64" >&6 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF @@ -7323,12 +7391,10 @@ cat >>confdefs.h <<\_ACEOF _ACEOF fi - echo "$as_me:$LINENO: result: ${tcl_cv_struct_dirent64}" >&5 -echo "${ECHO_T}${tcl_cv_struct_dirent64}" >&6 echo "$as_me:$LINENO: checking for struct stat64" >&5 echo $ECHO_N "checking for struct stat64... $ECHO_C" >&6 - if test "${tcl_cv_struct_stat64+set}" = set; then +if test "${tcl_cv_struct_stat64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -7379,7 +7445,8 @@ tcl_cv_struct_stat64=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - +echo "$as_me:$LINENO: result: $tcl_cv_struct_stat64" >&5 +echo "${ECHO_T}$tcl_cv_struct_stat64" >&6 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF @@ -7387,8 +7454,6 @@ cat >>confdefs.h <<\_ACEOF _ACEOF fi - echo "$as_me:$LINENO: result: ${tcl_cv_struct_stat64}" >&5 -echo "${ECHO_T}${tcl_cv_struct_stat64}" >&6 @@ -7563,6 +7628,7 @@ echo "${ECHO_T}no" >&6 fi fi + #-------------------------------------------------------------------- # Check endianness because we can optimize some operations #-------------------------------------------------------------------- @@ -7879,14 +7945,13 @@ tcl_cv_type_fd_set=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $tcl_cv_type_fd_set" >&5 echo "${ECHO_T}$tcl_cv_type_fd_set" >&6 tk_ok=$tcl_cv_type_fd_set -if test $tcl_cv_type_fd_set = no; then +if test $tk_ok = no; then echo "$as_me:$LINENO: checking for fd_mask in sys/select" >&5 echo $ECHO_N "checking for fd_mask in sys/select... $ECHO_C" >&6 - if test "${tcl_cv_grep_fd_mask+set}" = set; then +if test "${tcl_cv_grep_fd_mask+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -7907,8 +7972,7 @@ fi rm -f conftest* fi - - echo "$as_me:$LINENO: result: $tcl_cv_grep_fd_mask" >&5 +echo "$as_me:$LINENO: result: $tcl_cv_grep_fd_mask" >&5 echo "${ECHO_T}$tcl_cv_grep_fd_mask" >&6 if test $tcl_cv_grep_fd_mask = present; then @@ -8254,12 +8318,12 @@ fi if test "$tcl_strtod" = 1; then echo "$as_me:$LINENO: checking for Solaris2.4/Tru64 strtod bugs" >&5 echo $ECHO_N "checking for Solaris2.4/Tru64 strtod bugs... $ECHO_C" >&6 - if test "${tcl_cv_strtod_buggy+set}" = set; then +if test "${tcl_cv_strtod_buggy+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - tcl_cv_strtod_buggy=0 + tcl_cv_strtod_buggy=buggy else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -8299,25 +8363,21 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - tcl_cv_strtod_buggy=1 + tcl_cv_strtod_buggy=ok else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -tcl_cv_strtod_buggy=0 +tcl_cv_strtod_buggy=buggy fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi - - if test "$tcl_cv_strtod_buggy" = 1; then - echo "$as_me:$LINENO: result: ok" >&5 -echo "${ECHO_T}ok" >&6 - else - echo "$as_me:$LINENO: result: buggy" >&5 -echo "${ECHO_T}buggy" >&6 +echo "$as_me:$LINENO: result: $tcl_cv_strtod_buggy" >&5 +echo "${ECHO_T}$tcl_cv_strtod_buggy" >&6 + if test "$tcl_cv_strtod_buggy" = buggy; then case $LIBOBJS in "fixstrtod.$ac_objext" | \ *" fixstrtod.$ac_objext" | \ @@ -8633,7 +8693,6 @@ tcl_cv_pwd_pw_gecos=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $tcl_cv_pwd_pw_gecos" >&5 echo "${ECHO_T}$tcl_cv_pwd_pw_gecos" >&6 if test $tcl_cv_pwd_pw_gecos = yes; then @@ -8658,12 +8717,12 @@ else fi; if test $tk_aqua = yes; then if test $tcl_corefoundation = no; then - { echo "$as_me:$LINENO: WARNING: \"Aqua can only be used when CoreFoundation is available\"" >&5 -echo "$as_me: WARNING: \"Aqua can only be used when CoreFoundation is available\"" >&2;} + { echo "$as_me:$LINENO: WARNING: Aqua can only be used when CoreFoundation is available" >&5 +echo "$as_me: WARNING: Aqua can only be used when CoreFoundation is available" >&2;} tk_aqua=no elif test ! -d /System/Library/Frameworks/Carbon.framework; then - { echo "$as_me:$LINENO: WARNING: \"Aqua can only be used when Carbon is available\"" >&5 -echo "$as_me: WARNING: \"Aqua can only be used when Carbon is available\"" >&2;} + { echo "$as_me:$LINENO: WARNING: Aqua can only be used when Carbon is available" >&5 +echo "$as_me: WARNING: Aqua can only be used when Carbon is available" >&2;} tk_aqua=no fi fi @@ -9133,8 +9192,8 @@ fi fi if test "$XLIBSW" = nope ; then - echo "$as_me:$LINENO: result: couldn't find any! Using -lX11." >&5 -echo "${ECHO_T}couldn't find any! Using -lX11." >&6 + echo "$as_me:$LINENO: result: could not find any! Using -lX11." >&5 +echo "${ECHO_T}could not find any! Using -lX11." >&6 XLIBSW=-lX11 fi @@ -9825,13 +9884,13 @@ fi; echo "${ECHO_T}framework" >&6 FRAMEWORK_BUILD=1 if test "${SHARED_BUILD}" = "0" ; then - { echo "$as_me:$LINENO: WARNING: \"Frameworks can only be built if --enable-shared is yes\"" >&5 -echo "$as_me: WARNING: \"Frameworks can only be built if --enable-shared is yes\"" >&2;} + { echo "$as_me:$LINENO: WARNING: Frameworks can only be built if --enable-shared is yes" >&5 +echo "$as_me: WARNING: Frameworks can only be built if --enable-shared is yes" >&2;} FRAMEWORK_BUILD=0 fi if test $tcl_corefoundation = no; then - { echo "$as_me:$LINENO: WARNING: \"Frameworks can only be used when CoreFoundation is available\"" >&5 -echo "$as_me: WARNING: \"Frameworks can only be used when CoreFoundation is available\"" >&2;} + { echo "$as_me:$LINENO: WARNING: Frameworks can only be used when CoreFoundation is available" >&5 +echo "$as_me: WARNING: Frameworks can only be used when CoreFoundation is available" >&2;} FRAMEWORK_BUILD=0 fi else diff --git a/unix/configure.in b/unix/configure.in index 6a57f1d..a64b273 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tk installation dnl to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.113 2005/11/27 04:23:10 das Exp $ +# RCS: @(#) $Id: configure.in,v 1.114 2006/01/10 05:37:53 das Exp $ AC_INIT([tk],[8.5]) AC_PREREQ(2.59) @@ -64,6 +64,7 @@ TK_SRC_DIR=`cd $srcdir/..; pwd` #------------------------------------------------------------------------ # Compress and/or soft link the manpages? #------------------------------------------------------------------------ + SC_CONFIG_MANPAGES #------------------------------------------------------------------------ @@ -108,9 +109,9 @@ if test -n "$GCC"; then OLDCC="$CC" CC="$CC -pipe" AC_TRY_COMPILE(,, - AC_MSG_RESULT(yes), + AC_MSG_RESULT([yes]), CC="$OLDCC" - AC_MSG_RESULT(no)) + AC_MSG_RESULT([no])) fi fi @@ -176,18 +177,14 @@ fi # special flag. #-------------------------------------------------------------------- -AC_MSG_CHECKING([for fd_set in sys/types]) -AC_CACHE_VAL(tcl_cv_type_fd_set, +AC_CACHE_CHECK([for fd_set in sys/types], tcl_cv_type_fd_set, AC_TRY_COMPILE([#include <sys/types.h>],[fd_set readMask, writeMask;], tcl_cv_type_fd_set=yes, tcl_cv_type_fd_set=no)) -AC_MSG_RESULT($tcl_cv_type_fd_set) tk_ok=$tcl_cv_type_fd_set -if test $tcl_cv_type_fd_set = no; then - AC_MSG_CHECKING([for fd_mask in sys/select]) - AC_CACHE_VAL(tcl_cv_grep_fd_mask, +if test $tk_ok = no; then + AC_CACHE_CHECK([for fd_mask in sys/select], tcl_cv_grep_fd_mask, AC_EGREP_HEADER(fd_mask, sys/select.h, tcl_cv_grep_fd_mask=present, tcl_cv_grep_fd_mask=missing)) - AC_MSG_RESULT($tcl_cv_grep_fd_mask) if test $tcl_cv_grep_fd_mask = present; then AC_DEFINE(HAVE_SYS_SELECT_H, 1, [Should we include <sys/select.h>?]) tk_ok=yes @@ -227,12 +224,10 @@ AC_TYPE_UID_T # In OS/390 struct pwd has no pw_gecos field #------------------------------------------- -AC_MSG_CHECKING([pw_gecos in struct pwd]) -AC_CACHE_VAL(tcl_cv_pwd_pw_gecos, +AC_CACHE_CHECK([pw_gecos in struct pwd], tcl_cv_pwd_pw_gecos, AC_TRY_COMPILE([#include <pwd.h>], [struct passwd pwd; pwd.pw_gecos;], tcl_cv_pwd_pw_gecos=yes, tcl_cv_pwd_pw_gecos=no)) -AC_MSG_RESULT($tcl_cv_pwd_pw_gecos) if test $tcl_cv_pwd_pw_gecos = yes; then AC_DEFINE(HAVE_PW_GECOS, 1, [Does struct password have a pw_gecos field?]) fi @@ -248,10 +243,10 @@ if test "`uname -s`" = "Darwin" ; then [tk_aqua=$enableval], [tk_aqua=no]) if test $tk_aqua = yes; then if test $tcl_corefoundation = no; then - AC_MSG_WARN("Aqua can only be used when CoreFoundation is available") + AC_MSG_WARN([Aqua can only be used when CoreFoundation is available]) tk_aqua=no elif test ! -d /System/Library/Frameworks/Carbon.framework; then - AC_MSG_WARN("Aqua can only be used when Carbon is available") + AC_MSG_WARN([Aqua can only be used when Carbon is available]) tk_aqua=no fi fi @@ -358,10 +353,10 @@ if test -d /usr/include/mit -a $tk_aqua = no; then ], [ XOpenDisplay(0); ], [ - AC_MSG_RESULT(yes) + AC_MSG_RESULT([yes]) XLIBSW="-lX11-mit" XINCLUDES="-I/usr/include/mit" - ], AC_MSG_RESULT(no)) + ], AC_MSG_RESULT([no])) CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi diff --git a/unix/tcl.m4 b/unix/tcl.m4 index c313068..3d35a27 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -72,9 +72,25 @@ AC_DEFUN(SC_PATH_TCLCONFIG, [ done fi + # on Darwin, check in Framework installation locations + if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then + for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ + `ls -d /Library/Frameworks 2>/dev/null` \ + `ls -d /Network/Library/Frameworks 2>/dev/null` \ + `ls -d /System/Library/Frameworks 2>/dev/null` \ + ; do + if test -f "$i/Tcl.framework/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i/Tcl.framework; pwd)` + break + fi + done + fi + # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ + `ls -d ${exec_prefix}/lib 2>/dev/null` \ + `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ @@ -103,12 +119,12 @@ AC_DEFUN(SC_PATH_TCLCONFIG, [ if test x"${ac_cv_c_tclconfig}" = x ; then TCL_BIN_DIR="# no Tcl configs found" - AC_MSG_WARN(Can't find Tcl configuration definitions) + AC_MSG_WARN([Can't find Tcl configuration definitions]) exit 0 else no_tcl= TCL_BIN_DIR=${ac_cv_c_tclconfig} - AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh) + AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh]) fi fi ]) @@ -185,9 +201,26 @@ AC_DEFUN(SC_PATH_TKCONFIG, [ fi done fi + + # on Darwin, check in Framework installation locations + if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then + for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ + `ls -d /Library/Frameworks 2>/dev/null` \ + `ls -d /Network/Library/Frameworks 2>/dev/null` \ + `ls -d /System/Library/Frameworks 2>/dev/null` \ + ; do + if test -f "$i/Tk.framework/tkConfig.sh" ; then + ac_cv_c_tkconfig=`(cd $i/Tk.framework; pwd)` + break + fi + done + fi + # check in a few common install locations if test x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ + `ls -d ${exec_prefix}/lib 2>/dev/null` \ + `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ @@ -212,17 +245,17 @@ AC_DEFUN(SC_PATH_TKCONFIG, [ done fi ]) + if test x"${ac_cv_c_tkconfig}" = x ; then TK_BIN_DIR="# no Tk configs found" - AC_MSG_WARN(Can't find Tk configuration definitions) + AC_MSG_WARN([Can't find Tk configuration definitions]) exit 0 else no_tk= TK_BIN_DIR=${ac_cv_c_tkconfig} - AC_MSG_RESULT(found $TK_BIN_DIR/tkConfig.sh) + AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh]) fi fi - ]) #------------------------------------------------------------------------ @@ -245,40 +278,55 @@ AC_DEFUN(SC_PATH_TKCONFIG, [ #------------------------------------------------------------------------ AC_DEFUN(SC_LOAD_TCLCONFIG, [ - AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh]) + AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh]) - if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then + if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then AC_MSG_RESULT([loading]) - . $TCL_BIN_DIR/tclConfig.sh + . ${TCL_BIN_DIR}/tclConfig.sh else - AC_MSG_RESULT([file not found]) + AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh]) fi - # + # eval is required to do the TCL_DBGX substitution + eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" + eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" + # If the TCL_BIN_DIR is the build directory (not the install directory), # then set the common variable name to the value of the build variables. # For example, the variable TCL_LIB_SPEC will be set to the value # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC # instead of TCL_BUILD_LIB_SPEC since it will work with both an # installed and uninstalled version of Tcl. - # - - if test -f $TCL_BIN_DIR/Makefile ; then + if test -f ${TCL_BIN_DIR}/Makefile ; then TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} + elif test "`uname -s`" = "Darwin"; then + # If Tcl was built as a framework, attempt to use the libraries + # from the framework at the given location so that linking works + # against Tcl.framework installed in an arbitary location. + case ${TCL_DEFS} in + *TCL_FRAMEWORK*) + if test -f ${TCL_BIN_DIR}/${TCL_LIB_FILE}; then + for i in "`cd ${TCL_BIN_DIR}; pwd`" \ + "`cd ${TCL_BIN_DIR}/../..; pwd`"; do + if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then + TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}" + break + fi + done + fi + if test -f ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}; then + TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}" + TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}" + fi + ;; + esac fi - # # eval is required to do the TCL_DBGX substitution - # (@@@ Is this still the case?) - # - - eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" - - eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" @@ -312,19 +360,69 @@ AC_DEFUN(SC_LOAD_TCLCONFIG, [ #------------------------------------------------------------------------ AC_DEFUN(SC_LOAD_TKCONFIG, [ - AC_MSG_CHECKING([for existence of $TK_BIN_DIR/tkConfig.sh]) + AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh]) - if test -f "$TK_BIN_DIR/tkConfig.sh" ; then + if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then AC_MSG_RESULT([loading]) - . $TK_BIN_DIR/tkConfig.sh + . ${TK_BIN_DIR}/tkConfig.sh else - AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh]) + AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh]) + fi + + # eval is required to do the TK_DBGX substitution + eval "TK_LIB_FILE=\"${TK_LIB_FILE}\"" + eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\"" + + # If the TK_BIN_DIR is the build directory (not the install directory), + # then set the common variable name to the value of the build variables. + # For example, the variable TK_LIB_SPEC will be set to the value + # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC + # instead of TK_BUILD_LIB_SPEC since it will work with both an + # installed and uninstalled version of Tcl. + if test -f ${TK_BIN_DIR}/Makefile ; then + TK_LIB_SPEC=${TK_BUILD_LIB_SPEC} + TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC} + TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH} + elif test "`uname -s`" = "Darwin"; then + # If Tk was built as a framework, attempt to use the libraries + # from the framework at the given location so that linking works + # against Tk.framework installed in an arbitary location. + case ${TK_DEFS} in + *TK_FRAMEWORK*) + if test -f ${TK_BIN_DIR}/${TK_LIB_FILE}; then + for i in "`cd ${TK_BIN_DIR}; pwd`" \ + "`cd ${TK_BIN_DIR}/../..; pwd`"; do + if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then + TK_LIB_SPEC="-F`dirname "$i"` -framework ${TK_LIB_FILE}" + break + fi + done + fi + if test -f ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}; then + TK_STUB_LIB_SPEC="-L${TK_BIN_DIR} ${TK_STUB_LIB_FLAG}" + TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}" + fi + ;; + esac fi + # eval is required to do the TK_DBGX substitution + eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\"" + eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\"" + eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\"" + eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\"" + AC_SUBST(TK_VERSION) AC_SUBST(TK_BIN_DIR) AC_SUBST(TK_SRC_DIR) + AC_SUBST(TK_LIB_FILE) + AC_SUBST(TK_LIB_FLAG) + AC_SUBST(TK_LIB_SPEC) + + AC_SUBST(TK_STUB_LIB_FILE) + AC_SUBST(TK_STUB_LIB_FLAG) + AC_SUBST(TK_STUB_LIB_SPEC) ]) #------------------------------------------------------------------------ @@ -349,7 +447,6 @@ AC_DEFUN(SC_LOAD_TKCONFIG, [ AC_DEFUN(SC_PROG_TCLSH, [ AC_MSG_CHECKING([for tclsh]) - AC_CACHE_VAL(ac_cv_path_tclsh, [ search_path=`echo ${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do @@ -367,7 +464,7 @@ AC_DEFUN(SC_PROG_TCLSH, [ if test -f "$ac_cv_path_tclsh" ; then TCLSH_PROG="$ac_cv_path_tclsh" - AC_MSG_RESULT($TCLSH_PROG) + AC_MSG_RESULT([$TCLSH_PROG]) else # It is not an error if an installed version of Tcl can't be located. TCLSH_PROG="" @@ -396,7 +493,7 @@ AC_DEFUN(SC_PROG_TCLSH, [ AC_DEFUN(SC_BUILD_TCLSH, [ AC_MSG_CHECKING([for tclsh in Tcl build directory]) BUILD_TCLSH=${TCL_BIN_DIR}/tclsh - AC_MSG_RESULT($BUILD_TCLSH) + AC_MSG_RESULT([$BUILD_TCLSH]) AC_SUBST(BUILD_TCLSH) ]) @@ -480,11 +577,11 @@ AC_DEFUN(SC_ENABLE_FRAMEWORK, [ AC_MSG_RESULT([framework]) FRAMEWORK_BUILD=1 if test "${SHARED_BUILD}" = "0" ; then - AC_MSG_WARN("Frameworks can only be built if --enable-shared is yes") + AC_MSG_WARN([Frameworks can only be built if --enable-shared is yes]) FRAMEWORK_BUILD=0 fi if test $tcl_corefoundation = no; then - AC_MSG_WARN("Frameworks can only be used when CoreFoundation is available") + AC_MSG_WARN([Frameworks can only be used when CoreFoundation is available]) FRAMEWORK_BUILD=0 fi else @@ -517,20 +614,17 @@ AC_DEFUN(SC_ENABLE_FRAMEWORK, [ #------------------------------------------------------------------------ AC_DEFUN(SC_ENABLE_THREADS, [ - AC_MSG_CHECKING(for building with threads) AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads], [build with threads (default: off)]), [tcl_ok=$enableval], [tcl_ok=no]) + if test "${TCL_THREADS}" = 1; then + tcl_threaded_core=1; + fi + if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then - if test "${TCL_THREADS}" = 1; then - AC_MSG_RESULT([yes (threaded core)]) - else - AC_MSG_RESULT([yes]) - fi TCL_THREADS=1 - AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?]) # USE_THREAD_ALLOC tells us to try the special thread-based # allocator that significantly reduces lock contention AC_DEFINE(USE_THREAD_ALLOC, 1, @@ -548,29 +642,33 @@ AC_DEFUN(SC_ENABLE_THREADS, [ # defined. We could alternatively do an AC_TRY_COMPILE with # pthread.h, but that will work with libpthread really doesn't # exist, like AIX 4.2. [Bug: 4359] - AC_CHECK_LIB(pthread,__pthread_mutex_init,tcl_ok=yes,tcl_ok=no) + AC_CHECK_LIB(pthread, __pthread_mutex_init, + tcl_ok=yes, tcl_ok=no) fi if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -lpthread" else - AC_CHECK_LIB(pthreads,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) + AC_CHECK_LIB(pthreads, pthread_mutex_init, + tcl_ok=yes, tcl_ok=no) if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -lpthreads" else - AC_CHECK_LIB(c,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) - if test "$tcl_ok" = "no"; then - AC_CHECK_LIB(c_r,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) + AC_CHECK_LIB(c, pthread_mutex_init, + tcl_ok=yes, tcl_ok=no) + if test "$tcl_ok" = "no"; then + AC_CHECK_LIB(c_r, pthread_mutex_init, + tcl_ok=yes, tcl_ok=no) if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -pthread" else TCL_THREADS=0 - AC_MSG_WARN("Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...") + AC_MSG_WARN([Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...]) fi - fi + fi fi fi @@ -584,12 +682,11 @@ AC_DEFUN(SC_ENABLE_THREADS, [ if test $tcl_ok = yes ; then AC_DEFINE(HAVE_PTHREAD_ATTR_GET_NP, 1, [Do we want a BSD-like thread-attribute interface?]) - AC_MSG_CHECKING([for pthread_attr_get_np declaration]) - AC_CACHE_VAL(tcl_cv_grep_pthread_attr_get_np, + AC_CACHE_CHECK([for pthread_attr_get_np declaration], + tcl_cv_grep_pthread_attr_get_np, AC_EGREP_HEADER(pthread_attr_get_np, pthread.h, tcl_cv_grep_pthread_attr_get_np=present, tcl_cv_grep_pthread_attr_get_np=missing)) - AC_MSG_RESULT($tcl_cv_grep_pthread_attr_get_np) if test $tcl_cv_grep_pthread_attr_get_np = missing ; then AC_DEFINE(ATTRGETNP_NOT_DECLARED, 1, [Is pthread_attr_get_np() declared in <pthread.h>?]) @@ -599,12 +696,11 @@ AC_DEFUN(SC_ENABLE_THREADS, [ if test $tcl_ok = yes ; then AC_DEFINE(HAVE_PTHREAD_GETATTR_NP, 1, [Do we want a Linux-like thread-attribute interface?]) - AC_MSG_CHECKING([for pthread_getattr_np declaration]) - AC_CACHE_VAL(tcl_cv_grep_pthread_getattr_np, + AC_CACHE_CHECK([for pthread_getattr_np declaration], + tcl_cv_grep_pthread_getattr_np, AC_EGREP_HEADER(pthread_getattr_np, pthread.h, tcl_cv_grep_pthread_getattr_np=present, tcl_cv_grep_pthread_getattr_np=missing)) - AC_MSG_RESULT($tcl_cv_grep_pthread_getattr_np) if test $tcl_cv_grep_pthread_getattr_np = missing ; then AC_DEFINE(GETATTRNP_NOT_DECLARED, 1, [Is pthread_getattr_np declared in <pthread.h>?]) @@ -614,8 +710,20 @@ AC_DEFUN(SC_ENABLE_THREADS, [ LIBS=$ac_saved_libs else TCL_THREADS=0 + fi + # Do checking message here to not mess up interleaved configure output + AC_MSG_CHECKING([for building with threads]) + if test "${TCL_THREADS}" = 1; then + AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?]) + if test "${tcl_threaded_core}" = 1; then + AC_MSG_RESULT([yes (threaded core)]) + else + AC_MSG_RESULT([yes]) + fi + else AC_MSG_RESULT([no (default)]) fi + AC_SUBST(TCL_THREADS) ]) @@ -728,7 +836,7 @@ AC_DEFUN(SC_ENABLE_LANGINFO, [ AC_CACHE_VAL(tcl_cv_langinfo_h, AC_TRY_COMPILE([#include <langinfo.h>], [nl_langinfo(CODESET);], [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])) - AC_MSG_RESULT($tcl_cv_langinfo_h) + AC_MSG_RESULT([$tcl_cv_langinfo_h]) if test $tcl_cv_langinfo_h = yes; then AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?]) fi @@ -742,8 +850,8 @@ AC_DEFUN(SC_ENABLE_LANGINFO, [ # # Decide whether to use symlinks for linking the manpages, # whether to compress the manpages after installation, and -# whether to add a package name suffix to the installed -# manpages to avoidfile name clashes. +# whether to add a package name suffix to the installed +# manpages to avoidfile name clashes. # If compression is enabled also find out what file name suffix # the given compression program is using. # @@ -799,7 +907,7 @@ AC_DEFUN(SC_CONFIG_MANPAGES, [ AC_HELP_STRING([--enable-man-suffix=STRING], [use STRING as a suffix to manpage file names (default: no, AC_PACKAGE_NAME if enabled without specifying STRING)]), [case $enableval in - yes) enableval="AC_PACKAGE_NAME";; + yes) enableval="AC_PACKAGE_NAME" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";; no) ;; *) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";; esac], @@ -810,6 +918,49 @@ AC_DEFUN(SC_CONFIG_MANPAGES, [ ]) #-------------------------------------------------------------------- +# SC_CONFIG_SYSTEM +# +# Determine what the system is (some things cannot be easily checked +# on a feature-driven basis, alas). This can usually be done via the +# "uname" command, but there are a few systems, like Next, where +# this doesn't work. +# +# Arguments: +# none +# +# Results: +# Defines the following var: +# +# system - System/platform/version identification code. +# +#-------------------------------------------------------------------- + +AC_DEFUN(SC_CONFIG_SYSTEM, [ + AC_CACHE_CHECK([system version], tcl_cv_sys_version, [ + if test -f /usr/lib/NextStep/software_version; then + tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` + else + tcl_cv_sys_version=`uname -s`-`uname -r` + if test "$?" -ne 0 ; then + AC_MSG_WARN([can't find uname command]) + tcl_cv_sys_version=unknown + else + # Special check for weird MP-RAS system (uname returns weird + # results, and the version is kept in special file). + + if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then + tcl_cv_sys_version=MP-RAS-`awk '{print $3}' /etc/.relid` + fi + if test "`uname -s`" = "AIX" ; then + tcl_cv_sys_version=AIX-`uname -v`.`uname -r` + fi + fi + fi + ]) + system=$tcl_cv_sys_version +]) + +#-------------------------------------------------------------------- # SC_CONFIG_CFLAGS # # Try to determine the proper flags to pass to the compiler @@ -901,7 +1052,7 @@ AC_DEFUN(SC_CONFIG_MANPAGES, [ # Flags used when running the compiler in debug mode # CFLAGS_OPTIMIZE - # Flags used when running the compiler in optimize mode -# CFLAGS +# CFLAGS - Additional CFLAGS added as necessary (usually 64-bit) # #-------------------------------------------------------------------- @@ -913,14 +1064,8 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ AC_ARG_ENABLE(64bit, AC_HELP_STRING([--enable-64bit], [enable 64bit support (default: off)]), - ,enableval="no") - - if test "$enableval" = "yes"; then - do64bit=yes - else - do64bit=no - fi - AC_MSG_RESULT($do64bit) + [do64bit=$enableval], [do64bit=no]) + AC_MSG_RESULT([$do64bit]) # Step 0.b: Enable Solaris 64 bit VIS support? @@ -928,42 +1073,18 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ AC_ARG_ENABLE(64bit-vis, AC_HELP_STRING([--enable-64bit-vis], [enable 64bit Sparc VIS support (default: off)]), - ,enableval="no") + [do64bitVIS=$enableval], [do64bitVIS=no]) + AC_MSG_RESULT([$do64bitVIS]) - if test "$enableval" = "yes"; then + if test "$do64bitVIS" = "yes"; then # Force 64bit on with VIS do64bit=yes - do64bitVIS=yes - else - do64bitVIS=no fi - AC_MSG_RESULT($do64bitVIS) # Step 1: set the variable "system" to hold the name and version number - # for the system. This can usually be done via the "uname" command, but - # there are a few systems, like Next, where this doesn't work. + # for the system. - AC_MSG_CHECKING([system version (for dynamic loading)]) - if test -f /usr/lib/NextStep/software_version; then - system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` - else - system=`uname -s`-`uname -r` - if test "$?" -ne 0 ; then - AC_MSG_RESULT([unknown (can't find uname command)]) - system=unknown - else - # Special check for weird MP-RAS system (uname returns weird - # results, and the version is kept in special file). - - if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then - system=MP-RAS-`awk '{print $3}' /etc/.relid` - fi - if test "`uname -s`" = "AIX" ; then - system=AIX-`uname -v`.`uname -r` - fi - AC_MSG_RESULT($system) - fi - fi + SC_CONFIG_SYSTEM # Step 2: check for existence of -ldl library. This is needed because # Linux can use either -ldl or -ldld for dynamic loading. @@ -1011,9 +1132,14 @@ dnl AC_CHECK_TOOL(AR, ar) AIX-*) if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then # AIX requires the _r compiler when gcc isn't being used - if test "${CC}" != "cc_r" ; then - CC=${CC}_r - fi + case "${CC}" in + *_r) + # ok ... + ;; + *) + CC=${CC}_r + ;; + esac AC_MSG_RESULT([Using $CC for compiling with threads]) fi LIBS="$LIBS -lc" @@ -1166,18 +1292,18 @@ dnl AC_CHECK_TOOL(AR, ar) # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes" ; then if test "$GCC" = "yes" ; then - hpux_arch=`gcc -dumpmachine` + hpux_arch=`${CC} -dumpmachine` case $hpux_arch in hppa64*) # 64-bit gcc in use. Fix flags for GNU ld. do64bit_ok=yes - SHLIB_LD="gcc -shared" + SHLIB_LD="${CC} -shared" SHLIB_LD_LIBS='${LIBS}' CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ;; *) - AC_MSG_WARN("64bit mode not supported with GCC on $system") + AC_MSG_WARN([64bit mode not supported with GCC on $system]) ;; esac else @@ -1313,16 +1439,16 @@ dnl AC_CHECK_TOOL(AR, ar) ;; Lynx*) SHLIB_CFLAGS="-fPIC" - SHLIB_LD_LIBS='${LIBS}' + SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" - CFLAGS_OPTIMIZE=-02 + CFLAGS_OPTIMIZE=-02 SHLIB_LD="${CC} -shared " DL_OBJS="tclLoadDl.o" DL_LIBS="-mshared -ldl" LD_FLAGS="-Wl,--export-dynamic" CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - ;; + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + ;; MP-RAS-02*) SHLIB_CFLAGS="-K PIC" SHLIB_LD="cc -G" @@ -1354,17 +1480,17 @@ dnl AC_CHECK_TOOL(AR, ar) DL_LIBS="" CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' - AC_MSG_CHECKING(for ELF) - AC_EGREP_CPP(yes, [ + AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [ + AC_EGREP_CPP(yes, [ #ifdef __ELF__ yes #endif - ], - AC_MSG_RESULT(yes) - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so', - AC_MSG_RESULT(no) + ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)]) + if test $tcl_cv_ld_elf = yes; then + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' + else SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' - ) + fi # Ancient FreeBSD doesn't handle version numbers with dots. @@ -1387,17 +1513,17 @@ dnl AC_CHECK_TOOL(AR, ar) CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' - AC_MSG_CHECKING(for ELF) - AC_EGREP_CPP(yes, [ + AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [ + AC_EGREP_CPP(yes, [ #ifdef __ELF__ yes #endif - ], - AC_MSG_RESULT(yes) - [ LDFLAGS=-Wl,-export-dynamic ], - AC_MSG_RESULT(no) + ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)]) + if test $tcl_cv_ld_elf = yes; then + LDFLAGS=-Wl,-export-dynamic + else LDFLAGS="" - ) + fi # OpenBSD doesn't do version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' @@ -1710,6 +1836,8 @@ dnl AC_CHECK_TOOL(AR, ar) CFLAGS="$CFLAGS -xarch=v9" LDFLAGS_ARCH="-xarch=v9" fi + # Solaris 64 uses this as well + #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64" fi elif test "$arch" = "amd64 i386" ; then if test "$GCC" = "yes" ; then @@ -1759,12 +1887,14 @@ dnl AC_CHECK_TOOL(AR, ar) DL_LIBS="-ldl" # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers # that don't grok the -Bexport option. Test that it does. - hold_ldflags=$LDFLAGS - AC_MSG_CHECKING(for ld accepts -Bexport flag) - LDFLAGS="$LDFLAGS -Wl,-Bexport" - AC_TRY_LINK(, [int i;], [found=yes], - [LDFLAGS=$hold_ldflags found=no]) - AC_MSG_RESULT($found) + AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [ + hold_ldflags=$LDFLAGS + LDFLAGS="$LDFLAGS -Wl,-Bexport" + AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no) + LDFLAGS=$hold_ldflags]) + if test $tcl_cv_ld_Bexport = yes; then + LDFLAGS="$LDFLAGS -Wl,-Bexport" + fi CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; @@ -1822,12 +1952,8 @@ dnl AC_CHECK_TOOL(AR, ar) ;; Darwin-*) ;; - RISCos-*) - ;; SCO_SV-3.2*) ;; - ULTRIX-4.*) - ;; *) SHLIB_CFLAGS="-fPIC" ;; @@ -1951,8 +2077,7 @@ dnl esac AC_DEFUN(SC_SERIAL_PORT, [ AC_CHECK_HEADERS(sys/modem.h) - AC_MSG_CHECKING([termios vs. termio vs. sgtty]) - AC_CACHE_VAL(tcl_cv_api_serial, [ + AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [ AC_TRY_RUN([ #include <termios.h> @@ -2044,7 +2169,6 @@ int main() { termio) AC_DEFINE(USE_TERMIO, 1, [Use the termio API for serial lines]);; sgtty) AC_DEFINE(USE_SGTTY, 1, [Use the sgtty API for serial lines]);; esac - AC_MSG_RESULT($tcl_cv_api_serial) ]) #-------------------------------------------------------------------- @@ -2077,8 +2201,7 @@ int main() { #-------------------------------------------------------------------- AC_DEFUN(SC_MISSING_POSIX_HEADERS, [ - AC_MSG_CHECKING(dirent.h) - AC_CACHE_VAL(tcl_cv_dirent_h, + AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, AC_TRY_LINK([#include <sys/types.h> #include <dirent.h>], [ #ifndef _POSIX_SOURCE @@ -2104,7 +2227,6 @@ closedir(d); AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?]) fi - AC_MSG_RESULT($tcl_ok) AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have <float.h>?])]) AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have <values.h>?])]) AC_CHECK_HEADER(limits.h, @@ -2169,14 +2291,14 @@ AC_DEFUN(SC_PATH_X, [ fi fi if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then - AC_MSG_CHECKING(for X11 header files) + AC_MSG_CHECKING([for X11 header files]) found_xincludes="no" AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no") if test "$found_xincludes" = "no"; then dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include" for i in $dirs ; do if test -r $i/X11/Intrinsic.h; then - AC_MSG_RESULT($i) + AC_MSG_RESULT([$i]) XINCLUDES=" -I$i" found_xincludes="yes" break @@ -2190,16 +2312,16 @@ AC_DEFUN(SC_PATH_X, [ fi fi if test found_xincludes = "no"; then - AC_MSG_RESULT(couldn't find any!) + AC_MSG_RESULT([couldn't find any!]) fi if test "$no_x" = yes; then - AC_MSG_CHECKING(for X11 libraries) + AC_MSG_CHECKING([for X11 libraries]) XLIBSW=nope dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib" for i in $dirs ; do if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then - AC_MSG_RESULT($i) + AC_MSG_RESULT([$i]) XLIBSW="-L$i -lX11" x_libraries="$i" break @@ -2216,7 +2338,7 @@ AC_DEFUN(SC_PATH_X, [ AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow) fi if test "$XLIBSW" = nope ; then - AC_MSG_RESULT(couldn't find any! Using -lX11.) + AC_MSG_RESULT([could not find any! Using -lX11.]) XLIBSW=-lX11 fi ]) @@ -2245,25 +2367,8 @@ AC_DEFUN(SC_PATH_X, [ AC_DEFUN(SC_BLOCKING_STYLE, [ AC_CHECK_HEADERS(sys/ioctl.h) AC_CHECK_HEADERS(sys/filio.h) + SC_CONFIG_SYSTEM AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O]) - if test -f /usr/lib/NextStep/software_version; then - system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` - else - system=`uname -s`-`uname -r` - if test "$?" -ne 0 ; then - system=unknown - else - # Special check for weird MP-RAS system (uname returns weird - # results, and the version is kept in special file). - - if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then - system=MP-RAS-`awk '{print $3}' /etc/.relid` - fi - if test "`uname -s`" = "AIX" ; then - system=AIX-`uname -v`.`uname -r` - fi - fi - fi case $system in # There used to be code here to use FIONBIO under AIX. However, it # was reported that FIONBIO doesn't work under AIX 3.2.5. Since @@ -2272,18 +2377,14 @@ AC_DEFUN(SC_BLOCKING_STYLE, [ OSF*) AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?]) - AC_MSG_RESULT(FIONBIO) + AC_MSG_RESULT([FIONBIO]) ;; SunOS-4*) AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?]) - AC_MSG_RESULT(FIONBIO) - ;; - ULTRIX-4.*) - AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?]) - AC_MSG_RESULT(FIONBIO) + AC_MSG_RESULT([FIONBIO]) ;; *) - AC_MSG_RESULT(O_NONBLOCK) + AC_MSG_RESULT([O_NONBLOCK]) ;; esac ]) @@ -2314,20 +2415,16 @@ AC_DEFUN(SC_TIME_HANDLER, [ AC_CHECK_FUNCS(gmtime_r localtime_r mktime) - AC_MSG_CHECKING([tm_tzadj in struct tm]) - AC_CACHE_VAL(tcl_cv_member_tm_tzadj, + AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;], tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)) - AC_MSG_RESULT($tcl_cv_member_tm_tzadj) if test $tcl_cv_member_tm_tzadj = yes ; then AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?]) fi - AC_MSG_CHECKING([tm_gmtoff in struct tm]) - AC_CACHE_VAL(tcl_cv_member_tm_gmtoff, + AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;], tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)) - AC_MSG_RESULT($tcl_cv_member_tm_gmtoff) if test $tcl_cv_member_tm_gmtoff = yes ; then AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?]) fi @@ -2336,28 +2433,24 @@ AC_DEFUN(SC_TIME_HANDLER, [ # Its important to include time.h in this check, as some systems # (like convex) have timezone functions, etc. # - AC_MSG_CHECKING([long timezone variable]) - AC_CACHE_VAL(tcl_cv_timezone_long, + AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, AC_TRY_COMPILE([#include <time.h>], [extern long timezone; timezone += 1; exit (0);], tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)) - AC_MSG_RESULT($tcl_cv_timezone_long) if test $tcl_cv_timezone_long = yes ; then AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?]) else # # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. # - AC_MSG_CHECKING([time_t timezone variable]) - AC_CACHE_VAL(tcl_cv_timezone_time, + AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, AC_TRY_COMPILE([#include <time.h>], [extern time_t timezone; timezone += 1; exit (0);], tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)) - AC_MSG_RESULT($tcl_cv_timezone_time) if test $tcl_cv_timezone_time = yes ; then AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?]) fi @@ -2387,8 +2480,7 @@ AC_DEFUN(SC_TIME_HANDLER, [ AC_DEFUN(SC_BUGGY_STRTOD, [ AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0) if test "$tcl_strtod" = 1; then - AC_MSG_CHECKING([for Solaris2.4/Tru64 strtod bugs]) - AC_CACHE_VAL(tcl_cv_strtod_buggy,[ + AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[ AC_TRY_RUN([ extern double strtod(); int main() { @@ -2408,11 +2500,9 @@ AC_DEFUN(SC_BUGGY_STRTOD, [ exit(1); } exit(0); - }], tcl_cv_strtod_buggy=1, tcl_cv_strtod_buggy=0, tcl_cv_strtod_buggy=0)]) - if test "$tcl_cv_strtod_buggy" = 1; then - AC_MSG_RESULT(ok) - else - AC_MSG_RESULT(buggy) + }], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy, + tcl_cv_strtod_buggy=buggy)]) + if test "$tcl_cv_strtod_buggy" = buggy; then AC_LIBOBJ([fixstrtod]) USE_COMPAT=1 AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?]) @@ -2508,6 +2598,7 @@ AC_DEFUN(SC_TCL_LINK_LIBS, [ # Might define the following vars: # _ISOC99_SOURCE # _LARGEFILE64_SOURCE +# _LARGEFILE_SOURCE64 # #-------------------------------------------------------------------- @@ -2521,7 +2612,8 @@ AC_DEFUN(SC_TCL_EARLY_FLAG,[ if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then AC_DEFINE($1, 1, [Add the ]$1[ flag when building]) tcl_flags="$tcl_flags $1" - fi]) + fi +]) AC_DEFUN(SC_TCL_EARLY_FLAGS,[ AC_MSG_CHECKING([for required early compiler flags]) @@ -2533,10 +2625,11 @@ AC_DEFUN(SC_TCL_EARLY_FLAGS,[ SC_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>], [char *p = (char *)open64;]) if test "x${tcl_flags}" = "x" ; then - AC_MSG_RESULT(none) + AC_MSG_RESULT([none]) else - AC_MSG_RESULT(${tcl_flags}) - fi]) + AC_MSG_RESULT([${tcl_flags}]) + fi +]) #-------------------------------------------------------------------- # SC_TCL_64BIT_FLAGS @@ -2572,32 +2665,28 @@ AC_DEFUN(SC_TCL_64BIT_FLAGS, [ }],tcl_cv_type_64bit=${tcl_type_64bit})]) if test "${tcl_cv_type_64bit}" = none ; then AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?]) - AC_MSG_RESULT(using long) + AC_MSG_RESULT([using long]) else AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit}, [What type should be used to define wide integers?]) - AC_MSG_RESULT(${tcl_cv_type_64bit}) + AC_MSG_RESULT([${tcl_cv_type_64bit}]) # Now check for auxiliary declarations - AC_MSG_CHECKING([for struct dirent64]) - AC_CACHE_VAL(tcl_cv_struct_dirent64,[ + AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[ AC_TRY_COMPILE([#include <sys/types.h> #include <sys/dirent.h>],[struct dirent64 p;], tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)]) if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?]) fi - AC_MSG_RESULT(${tcl_cv_struct_dirent64}) - AC_MSG_CHECKING([for struct stat64]) - AC_CACHE_VAL(tcl_cv_struct_stat64,[ + AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[ AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p; ], tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)]) if test "x${tcl_cv_struct_stat64}" = "xyes" ; then AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?]) fi - AC_MSG_RESULT(${tcl_cv_struct_stat64}) AC_CHECK_FUNCS(open64 lseek64) AC_MSG_CHECKING([for off64_t]) @@ -2611,11 +2700,12 @@ AC_DEFUN(SC_TCL_64BIT_FLAGS, [ test "x${ac_cv_func_lseek64}" = "xyes" && \ test "x${ac_cv_func_open64}" = "xyes" ; then AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?]) - AC_MSG_RESULT(yes) + AC_MSG_RESULT([yes]) else - AC_MSG_RESULT(no) + AC_MSG_RESULT([no]) fi - fi]) + fi +]) #-------------------------------------------------------------------- # SC_TCL_CFG_ENCODING TIP #59 @@ -2646,12 +2736,13 @@ AC_DEFUN(SC_TCL_CFG_ENCODING, [ else AC_DEFINE(TCL_CFGVAL_ENCODING,"iso8859-1", [What encoding should be used for embedded configuration info?]) - fi]) + fi +]) #-------------------------------------------------------------------- # SC_TCL_CHECK_BROKEN_FUNC # -# Declare the encoding to use for embedded configuration information. +# Check for broken function. # # Arguments: # funcName - function to test for @@ -2667,11 +2758,9 @@ AC_DEFUN(SC_TCL_CFG_ENCODING, [ AC_DEFUN(SC_TCL_CHECK_BROKEN_FUNC,[ AC_CHECK_FUNC($1, tcl_ok=1, tcl_ok=0) if test ["$tcl_ok"] = 1; then - AC_MSG_CHECKING([proper ]$1[ implementation]) - AC_CACHE_VAL([tcl_cv_]$1[_unbroken], + AC_CACHE_CHECK([proper ]$1[ implementation], [tcl_cv_]$1[_unbroken], AC_TRY_RUN([[int main() {]$2[}]],[tcl_cv_]$1[_unbroken]=ok, [tcl_cv_]$1[_unbroken]=broken,[tcl_cv_]$1[_unbroken]=unknown)) - AC_MSG_RESULT([$tcl_cv_]$1[_unbroken]) if test ["$tcl_cv_]$1[_unbroken"] = "ok"; then tcl_ok=1 else @@ -2681,7 +2770,8 @@ AC_DEFUN(SC_TCL_CHECK_BROKEN_FUNC,[ if test ["$tcl_ok"] = 0; then AC_LIBOBJ($1) USE_COMPAT=1 - fi]) + fi +]) # Local Variables: |