Check-in [66c3398628]
Overview
Comment:Updated test for dladdr() to be more comprehensive
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:66c339862843db14bad4afb25b12adad9e1267f2
User & Date: rkeene on 2010-09-26 04:50:15
Other Links: manifest | tags
Context
2010-09-26
04:50
Corrected typo in previous commit check-in: 62d83850be user: rkeene tags: trunk
04:50
Updated test for dladdr() to be more comprehensive check-in: 66c3398628 user: rkeene tags: trunk
04:50
Updated to not remove EXTRA_OBJS when `clean' target called check-in: a4e97ccf7b user: rkeene tags: trunk
Changes

Modified kitsh/buildsrc/kitsh-0.0/aclocal.m4 from [d6fff4a63c] to [9a1977c3cc].

   229    229   	else
   230    230   		LDFLAGS="${SAVELDFLAGS}"
   231    231   		AC_MSG_RESULT([not needed])
   232    232   	fi
   233    233   
   234    234   	AC_SUBST(LDFLAGS)
   235    235   ])
          236  +
          237  +AC_DEFUN(DC_CHECK_FOR_ACCEPTABLE_DLADDR, [
          238  +	AC_CHECK_HEADERS(dlfcn.h)
          239  +	AC_CHECK_FUNCS(dladdr)
          240  +
          241  +	AC_MSG_CHECKING([for acceptable dladdr])
          242  +
          243  +	AC_LINK_IFELSE(
          244  +		AC_LANG_PROGRAM([[
          245  +#ifdef HAVE_DLFCN_H
          246  +#include <dlfcn.h>
          247  +#endif
          248  +			]], [[
          249  +char *x;
          250  +Dl_info syminfo;
          251  +dladdr((void *) 0, &syminfo);
          252  +x = syminfo.dli_fname;
          253  +			]]
          254  +		),
          255  +		[
          256  +			AC_MSG_RESULT([found])
          257  +			AC_DEFINE(HAVE_ACCEPTABLE_DLADDR, [1], [Define to 1 if you have an acceptable dladdr implementation with dli_fname])
          258  +		], [
          259  +			AC_MSG_RESULT([not found])
          260  +		]
          261  +	)
          262  +])

Modified kitsh/buildsrc/kitsh-0.0/configure.ac from [a3f511626a] to [e12a8b84bb].

    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     44   dnl Check for optional headers
    45     45   AC_HEADER_STDC
    46         -AC_CHECK_HEADERS(unistd.h dlfcn.h)
           46  +AC_CHECK_HEADERS(unistd.h)
    47     47   
    48     48   dnl Check for optional system calls
    49         -AC_CHECK_FUNCS(readlink dladdr)
           49  +AC_CHECK_FUNCS(readlink)
           50  +
           51  +dnl Check for acceptable dladdr so we can find ourselves on Solaris
           52  +DC_CHECK_FOR_ACCEPTABLE_DLADDR
    50     53   
    51     54   dnl Find zlib
    52     55   AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib], [directory containing zlib]), [
    53     56   	CPPFLAGS="${CPPFLAGS} -I${with_zlib}/include -I${with_zlib}"
    54     57   	CFLAGS="${CFLAGS} -I${with_zlib}/include -I${with_zlib}"
    55     58   	LDFLAGS="${LDFLAGS} -L${with_zlib}/lib -L${with_zlib}"
    56     59   ])

Modified kitsh/buildsrc/kitsh-0.0/kitInit.c from [bab566bd8a] to [3729076ea4].

    32     32   #endif /* MB_TASKMODAL */
    33     33   
    34     34   #include "tclInt.h"
    35     35   
    36     36   #ifdef HAVE_UNISTD_H
    37     37   #  include <unistd.h>
    38     38   #endif
    39         -#ifdef HAVE_DLADDR
    40         -#  ifdef HAVE_DLFCN_H
    41         -#    include <dlfcn.h>
    42         -#  else
    43         -#    undef HAVE_DLADDR
    44         -#  endif
           39  +
           40  +/* For dladdr() and Dl_info */
           41  +#ifdef HAVE_DLFCN_H
           42  +#  include <dlfcn.h>
    45     43   #endif
    46     44   
    47     45   #if defined(HAVE_TCL_GETENCODINGNAMEFROMENVIRONMENT) && defined(HAVE_TCL_SETSYSTEMENCODING)
    48     46   #  define TCLKIT_CAN_SET_ENCODING 1
    49     47   #endif
    50     48   #if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85
    51     49   #  define TCLKIT_REQUIRE_TCLEXECUTABLENAME 1
................................................................................
   208    206   	Tcl_Obj *lobjv[1];
   209    207   #ifdef HAVE_READLINK
   210    208   	ssize_t readlink_ret;
   211    209   	char procpath[4096];
   212    210   	char exe_buf[4096];
   213    211   	int snprintf_ret;
   214    212   #endif /* HAVE_READLINK */
   215         -#ifdef HAVE_DLADDR
          213  +#ifdef HAVE_ACCEPTABLE_DLADDR
   216    214   	Dl_info syminfo;
   217    215   	int dladdr_ret;
   218         -#endif /* HAVE_DLADDR */
          216  +#endif /*aHAVE_ACCEPTABLE_DLADDR */ 
   219    217   
   220    218   #ifdef HAVE_READLINK
   221    219   	if (Tcl_GetNameOfExecutable() == NULL) {
   222    220   		snprintf_ret = snprintf(procpath, sizeof(procpath), "/proc/%lu/exe", (unsigned long) getpid());
   223    221   		if (snprintf_ret < sizeof(procpath)) {
   224    222   			readlink_ret = readlink(procpath, exe_buf, sizeof(exe_buf) - 1);
   225    223   
................................................................................
   230    228   
   231    229   				return;
   232    230   			}
   233    231   		}
   234    232   	}
   235    233   #endif /* HAVE_READLINK */
   236    234   
   237         -#ifdef HAVE_DLADDR
          235  +#ifdef HAVE_ACCEPTABLE_DLADDR
   238    236   	if (Tcl_GetNameOfExecutable() == NULL) {
   239    237   		dladdr_ret = dladdr(&SetExecName, &syminfo);
   240    238   		if (dladdr_ret != 0) {
   241    239   			SetExecName(interp, syminfo.dli_fname);
   242    240   		}
   243    241   	}
   244         -#endif /* HAVE_DLADDR */
          242  +#endif /* HAVE_ACCEPTABLE_DLADDR */
   245    243   
   246    244   	if (Tcl_GetNameOfExecutable() == NULL) {
   247    245   		lobjv[0] = Tcl_GetVar2Ex(interp, "argv0", NULL, TCL_GLOBAL_ONLY);
   248    246   		execNameObj = Tcl_FSJoinToPath(Tcl_FSGetCwd(interp), 1, lobjv);
   249    247   
   250    248   		SetExecName(interp, Tcl_GetStringFromObj(execNameObj, &len));
   251    249