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
230
231
232
233
234
235



























	else
		LDFLAGS="${SAVELDFLAGS}"
		AC_MSG_RESULT([not needed])
	fi

	AC_SUBST(LDFLAGS)
])


































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
	else
		LDFLAGS="${SAVELDFLAGS}"
		AC_MSG_RESULT([not needed])
	fi

	AC_SUBST(LDFLAGS)
])

AC_DEFUN(DC_CHECK_FOR_ACCEPTABLE_DLADDR, [
	AC_CHECK_HEADERS(dlfcn.h)
	AC_CHECK_FUNCS(dladdr)

	AC_MSG_CHECKING([for acceptable dladdr])

	AC_LINK_IFELSE(
		AC_LANG_PROGRAM([[
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif
			]], [[
char *x;
Dl_info syminfo;
dladdr((void *) 0, &syminfo);
x = syminfo.dli_fname;
			]]
		),
		[
			AC_MSG_RESULT([found])
			AC_DEFINE(HAVE_ACCEPTABLE_DLADDR, [1], [Define to 1 if you have an acceptable dladdr implementation with dli_fname])
		], [
			AC_MSG_RESULT([not found])
		]
	)
])

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

39
40
41
42
43
44
45
46
47
48
49



50
51
52
53
54
55
56
AC_CHECK_FUNCS(Tcl_SetStartupScript TclSetStartupScriptPath)
dnl Check for the ability to get the current system encoding
AC_CHECK_FUNCS(Tcl_GetEncodingNameFromEnvironment Tcl_SetSystemEncoding)
LIBS="${SAVE_LIBS}"

dnl Check for optional headers
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h dlfcn.h)

dnl Check for optional system calls
AC_CHECK_FUNCS(readlink dladdr)




dnl Find zlib
AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib], [directory containing zlib]), [
	CPPFLAGS="${CPPFLAGS} -I${with_zlib}/include -I${with_zlib}"
	CFLAGS="${CFLAGS} -I${with_zlib}/include -I${with_zlib}"
	LDFLAGS="${LDFLAGS} -L${with_zlib}/lib -L${with_zlib}"
])







|


|
>
>
>







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
AC_CHECK_FUNCS(Tcl_SetStartupScript TclSetStartupScriptPath)
dnl Check for the ability to get the current system encoding
AC_CHECK_FUNCS(Tcl_GetEncodingNameFromEnvironment Tcl_SetSystemEncoding)
LIBS="${SAVE_LIBS}"

dnl Check for optional headers
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)

dnl Check for optional system calls
AC_CHECK_FUNCS(readlink)

dnl Check for acceptable dladdr so we can find ourselves on Solaris
DC_CHECK_FOR_ACCEPTABLE_DLADDR

dnl Find zlib
AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib], [directory containing zlib]), [
	CPPFLAGS="${CPPFLAGS} -I${with_zlib}/include -I${with_zlib}"
	CFLAGS="${CFLAGS} -I${with_zlib}/include -I${with_zlib}"
	LDFLAGS="${LDFLAGS} -L${with_zlib}/lib -L${with_zlib}"
])

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

32
33
34
35
36
37
38
39

40
41
42
43
44
45
46
47
48
49
50
51
#endif /* MB_TASKMODAL */

#include "tclInt.h"

#ifdef HAVE_UNISTD_H
#  include <unistd.h>
#endif
#ifdef HAVE_DLADDR

#  ifdef HAVE_DLFCN_H
#    include <dlfcn.h>
#  else
#    undef HAVE_DLADDR
#  endif
#endif

#if defined(HAVE_TCL_GETENCODINGNAMEFROMENVIRONMENT) && defined(HAVE_TCL_SETSYSTEMENCODING)
#  define TCLKIT_CAN_SET_ENCODING 1
#endif
#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85
#  define TCLKIT_REQUIRE_TCLEXECUTABLENAME 1







|
>
|
|
<
<
<







32
33
34
35
36
37
38
39
40
41
42



43
44
45
46
47
48
49
#endif /* MB_TASKMODAL */

#include "tclInt.h"

#ifdef HAVE_UNISTD_H
#  include <unistd.h>
#endif

/* For dladdr() and Dl_info */
#ifdef HAVE_DLFCN_H
#  include <dlfcn.h>



#endif

#if defined(HAVE_TCL_GETENCODINGNAMEFROMENVIRONMENT) && defined(HAVE_TCL_SETSYSTEMENCODING)
#  define TCLKIT_CAN_SET_ENCODING 1
#endif
#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85
#  define TCLKIT_REQUIRE_TCLEXECUTABLENAME 1
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
	Tcl_Obj *lobjv[1];
#ifdef HAVE_READLINK
	ssize_t readlink_ret;
	char procpath[4096];
	char exe_buf[4096];
	int snprintf_ret;
#endif /* HAVE_READLINK */
#ifdef HAVE_DLADDR
	Dl_info syminfo;
	int dladdr_ret;
#endif /* HAVE_DLADDR */

#ifdef HAVE_READLINK
	if (Tcl_GetNameOfExecutable() == NULL) {
		snprintf_ret = snprintf(procpath, sizeof(procpath), "/proc/%lu/exe", (unsigned long) getpid());
		if (snprintf_ret < sizeof(procpath)) {
			readlink_ret = readlink(procpath, exe_buf, sizeof(exe_buf) - 1);

			if (readlink_ret > 0 && readlink_ret < (sizeof(exe_buf) - 1)) {
				exe_buf[readlink_ret] = '\0';

				SetExecName(interp, exe_buf);

				return;
			}
		}
	}
#endif /* HAVE_READLINK */

#ifdef HAVE_DLADDR
	if (Tcl_GetNameOfExecutable() == NULL) {
		dladdr_ret = dladdr(&SetExecName, &syminfo);
		if (dladdr_ret != 0) {
			SetExecName(interp, syminfo.dli_fname);
		}
	}
#endif /* HAVE_DLADDR */

	if (Tcl_GetNameOfExecutable() == NULL) {
		lobjv[0] = Tcl_GetVar2Ex(interp, "argv0", NULL, TCL_GLOBAL_ONLY);
		execNameObj = Tcl_FSJoinToPath(Tcl_FSGetCwd(interp), 1, lobjv);

		SetExecName(interp, Tcl_GetStringFromObj(execNameObj, &len));








|


|


















|






|







206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
	Tcl_Obj *lobjv[1];
#ifdef HAVE_READLINK
	ssize_t readlink_ret;
	char procpath[4096];
	char exe_buf[4096];
	int snprintf_ret;
#endif /* HAVE_READLINK */
#ifdef HAVE_ACCEPTABLE_DLADDR
	Dl_info syminfo;
	int dladdr_ret;
#endif /*aHAVE_ACCEPTABLE_DLADDR */ 

#ifdef HAVE_READLINK
	if (Tcl_GetNameOfExecutable() == NULL) {
		snprintf_ret = snprintf(procpath, sizeof(procpath), "/proc/%lu/exe", (unsigned long) getpid());
		if (snprintf_ret < sizeof(procpath)) {
			readlink_ret = readlink(procpath, exe_buf, sizeof(exe_buf) - 1);

			if (readlink_ret > 0 && readlink_ret < (sizeof(exe_buf) - 1)) {
				exe_buf[readlink_ret] = '\0';

				SetExecName(interp, exe_buf);

				return;
			}
		}
	}
#endif /* HAVE_READLINK */

#ifdef HAVE_ACCEPTABLE_DLADDR
	if (Tcl_GetNameOfExecutable() == NULL) {
		dladdr_ret = dladdr(&SetExecName, &syminfo);
		if (dladdr_ret != 0) {
			SetExecName(interp, syminfo.dli_fname);
		}
	}
#endif /* HAVE_ACCEPTABLE_DLADDR */

	if (Tcl_GetNameOfExecutable() == NULL) {
		lobjv[0] = Tcl_GetVar2Ex(interp, "argv0", NULL, TCL_GLOBAL_ONLY);
		execNameObj = Tcl_FSJoinToPath(Tcl_FSGetCwd(interp), 1, lobjv);

		SetExecName(interp, Tcl_GetStringFromObj(execNameObj, &len));