Overview
Comment: | Updated to use dladdr() to find ourselves if possible |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | eb6f15ad72953de5a8610de49dde60f2515344a9 |
User & Date: | rkeene on 2010-09-26 04:50:05 |
Other Links: | manifest | tags |
Context
2010-09-26
| ||
04:50 | Updated to not remove EXTRA_OBJS when `clean' target called check-in: a4e97ccf7b user: rkeene tags: trunk | |
04:50 | Updated to use dladdr() to find ourselves if possible check-in: eb6f15ad72 user: rkeene tags: trunk | |
04:50 | Updated to load boot.tcl in new interpreters, issue with previous workaround and fixing creating new interpreters check-in: d5bcf0ec06 user: rkeene tags: trunk | |
Changes
Modified kitsh/buildsrc/kitsh-0.0/Makefile.in from [c486d97051] to [60aec6b7f1].
1 1 CC = @CC@ 2 2 RC = @RC@ 3 -CFLAGS = @CFLAGS@ @DEFS@ -DSTDC_HEADERS=1 -DTK_LOCAL_APPINIT=TclKit_AppInit 4 -CPPFLAGS = @CPPFLAGS@ @DEFS@ -DSTDC_HEADERS=1 -DTK_LOCAL_APPINIT=TclKit_AppInit 3 +CFLAGS = @CFLAGS@ @DEFS@ -DTK_LOCAL_APPINIT=TclKit_AppInit 4 +CPPFLAGS = @CPPFLAGS@ @DEFS@ -DTK_LOCAL_APPINIT=TclKit_AppInit 5 5 LDFLAGS = @LDFLAGS@ 6 6 LIBS = @LIBS@ 7 7 ARCHS = @ARCHS@ 8 8 OBJS = kitInit.o main.o pwb.o rechan.o zlib.o winMain.o @EXTRA_OBJS@ 9 9 10 10 all: kit 11 11
Modified kitsh/buildsrc/kitsh-0.0/configure.ac from [442f0e7737] to [a3f511626a].
37 37 LIBS="${ARCHS} ${LIBS}" 38 38 dnl Determine if we have "Tcl_SetStartupScript" (8.6.x) or "TclSetStartupScriptPath" (8.4.x) 39 39 AC_CHECK_FUNCS(Tcl_SetStartupScript TclSetStartupScriptPath) 40 40 dnl Check for the ability to get the current system encoding 41 41 AC_CHECK_FUNCS(Tcl_GetEncodingNameFromEnvironment Tcl_SetSystemEncoding) 42 42 LIBS="${SAVE_LIBS}" 43 43 44 +dnl Check for optional headers 45 +AC_HEADER_STDC 46 +AC_CHECK_HEADERS(unistd.h dlfcn.h) 47 + 44 48 dnl Check for optional system calls 45 -AC_CHECK_FUNCS(readlink) 49 +AC_CHECK_FUNCS(readlink dladdr) 46 50 47 51 dnl Find zlib 48 52 AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib], [directory containing zlib]), [ 49 53 CPPFLAGS="${CPPFLAGS} -I${with_zlib}/include -I${with_zlib}" 50 54 CFLAGS="${CFLAGS} -I${with_zlib}/include -I${with_zlib}" 51 55 LDFLAGS="${LDFLAGS} -L${with_zlib}/lib -L${with_zlib}" 52 56 ])
Modified kitsh/buildsrc/kitsh-0.0/kitInit.c from [0506bc15b0] to [bab566bd8a].
28 28 #endif /* _WIN32 */ 29 29 30 30 #ifndef MB_TASKMODAL 31 31 # define MB_TASKMODAL 0 32 32 #endif /* MB_TASKMODAL */ 33 33 34 34 #include "tclInt.h" 35 + 36 +#ifdef HAVE_UNISTD_H 37 +# include <unistd.h> 38 +#endif 39 +#ifdef HAVE_DLADDR 40 +# ifdef HAVE_DLFCN_H 41 +# include <dlfcn.h> 42 +# else 43 +# undef HAVE_DLADDR 44 +# endif 45 +#endif 35 46 36 47 #if defined(HAVE_TCL_GETENCODINGNAMEFROMENVIRONMENT) && defined(HAVE_TCL_SETSYSTEMENCODING) 37 48 # define TCLKIT_CAN_SET_ENCODING 1 38 49 #endif 39 50 #if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85 40 51 # define TCLKIT_REQUIRE_TCLEXECUTABLENAME 1 41 52 #endif ................................................................................ 191 202 return; 192 203 } 193 204 194 205 static void FindAndSetExecName(Tcl_Interp *interp) { 195 206 int len = 0; 196 207 Tcl_Obj *execNameObj; 197 208 Tcl_Obj *lobjv[1]; 198 -#if defined(HAVE_READLINK) 209 +#ifdef HAVE_READLINK 199 210 ssize_t readlink_ret; 200 211 char procpath[4096]; 201 212 char exe_buf[4096]; 202 213 int snprintf_ret; 214 +#endif /* HAVE_READLINK */ 215 +#ifdef HAVE_DLADDR 216 + Dl_info syminfo; 217 + int dladdr_ret; 218 +#endif /* HAVE_DLADDR */ 203 219 220 +#ifdef HAVE_READLINK 204 221 if (Tcl_GetNameOfExecutable() == NULL) { 205 222 snprintf_ret = snprintf(procpath, sizeof(procpath), "/proc/%lu/exe", (unsigned long) getpid()); 206 223 if (snprintf_ret < sizeof(procpath)) { 207 224 readlink_ret = readlink(procpath, exe_buf, sizeof(exe_buf) - 1); 208 225 209 226 if (readlink_ret > 0 && readlink_ret < (sizeof(exe_buf) - 1)) { 210 227 exe_buf[readlink_ret] = '\0'; ................................................................................ 211 228 212 229 SetExecName(interp, exe_buf); 213 230 214 231 return; 215 232 } 216 233 } 217 234 } 218 -#endif 235 +#endif /* HAVE_READLINK */ 236 + 237 +#ifdef HAVE_DLADDR 238 + if (Tcl_GetNameOfExecutable() == NULL) { 239 + dladdr_ret = dladdr(&SetExecName, &syminfo); 240 + if (dladdr_ret != 0) { 241 + SetExecName(interp, syminfo.dli_fname); 242 + } 243 + } 244 +#endif /* HAVE_DLADDR */ 219 245 220 246 if (Tcl_GetNameOfExecutable() == NULL) { 221 247 lobjv[0] = Tcl_GetVar2Ex(interp, "argv0", NULL, TCL_GLOBAL_ONLY); 222 248 execNameObj = Tcl_FSJoinToPath(Tcl_FSGetCwd(interp), 1, lobjv); 223 249 224 250 SetExecName(interp, Tcl_GetStringFromObj(execNameObj, &len)); 225 251