Index: aclocal/shobj.m4 ================================================================== --- aclocal/shobj.m4 +++ aclocal/shobj.m4 @@ -1,84 +1,199 @@ dnl Usage: dnl DC_TEST_SHOBJFLAGS(shobjflags, shobjldflags, action-if-not-found) dnl -AC_DEFUN(DC_TEST_SHOBJFLAGS, [ +AC_DEFUN([DC_TEST_SHOBJFLAGS], [ AC_SUBST(SHOBJFLAGS) + AC_SUBST(SHOBJCPPFLAGS) AC_SUBST(SHOBJLDFLAGS) OLD_LDFLAGS="$LDFLAGS" + OLD_CFLAGS="$CFLAGS" + OLD_CPPFLAGS="$CPPFLAGS" + SHOBJFLAGS="" + SHOBJCPPFLAGS="" + SHOBJLDFLAGS="" - LDFLAGS="$OLD_LDFLAGS $1 $2" + CFLAGS="$OLD_CFLAGS $1" + CPPFLAGS="$OLD_CPPFLAGS $2" + LDFLAGS="$OLD_LDFLAGS $3" AC_TRY_LINK([#include -int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="$1"; SHOBJLDFLAGS="$2" ], [ - LDFLAGS="$OLD_LDFLAGS" - $3 -]) +int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="$1"; SHOBJCPPFLAGS="$2"; SHOBJLDFLAGS="$3" ], [ + LDFLAGS="$OLD_LDFLAGS" + CFLAGS="$OLD_CFLAGS" + CPPFLAGS="$OLD_CPPFLAGS" + $4 + ]) LDFLAGS="$OLD_LDFLAGS" + CFLAGS="$OLD_CFLAGS" + CPPFLAGS="$OLD_CPPFLAGS" ]) -AC_DEFUN(DC_GET_SHOBJFLAGS, [ +AC_DEFUN([DC_GET_SHOBJFLAGS], [ AC_SUBST(SHOBJFLAGS) + AC_SUBST(SHOBJCPPFLAGS) AC_SUBST(SHOBJLDFLAGS) + + DC_CHK_OS_INFO AC_MSG_CHECKING(how to create shared objects) - if test -z "$SHOBJFLAGS" -a -z "$SHOBJLDFLAGS"; then - DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic], [ - DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared], [ - DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic -mimpure-text], [ - DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -mimpure-text], [ - DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic -Wl,-G,-z,textoff], [ - DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -Wl,-G,-z,textoff], [ - DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -dynamiclib -flat_namespace -undefined suppress -bind_at_load], [ - DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib -flat_namespace -undefined suppress -bind_at_load], [ - DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-Wl,-dynamiclib -Wl,-flat_namespace -Wl,-undefined,suppress -Wl,-bind_at_load], [ - DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib -flat_namespace -undefined suppress], [ - DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib], [ - AC_MSG_RESULT(cant) - AC_MSG_ERROR([We are unable to make shared objects.]) - ]) - ]) - ]) - ]) - ]) - ]) - ]) - ]) - ]) + if test -z "$SHOBJFLAGS" -a -z "$SHOBJLDFLAGS" -a -z "$SHOBJCPPFLAGS"; then + DC_TEST_SHOBJFLAGS([-fPIC], [-DPIC], [-shared -rdynamic], [ + DC_TEST_SHOBJFLAGS([-fPIC], [-DPIC], [-shared], [ + DC_TEST_SHOBJFLAGS([-fPIC], [-DPIC], [-shared -rdynamic -mimpure-text], [ + DC_TEST_SHOBJFLAGS([-fPIC], [-DPIC], [-shared -mimpure-text], [ + DC_TEST_SHOBJFLAGS([-fPIC], [-DPIC], [-shared -rdynamic -Wl,-G,-z,textoff], [ + DC_TEST_SHOBJFLAGS([-fPIC], [-DPIC], [-shared -Wl,-G], [ + DC_TEST_SHOBJFLAGS([-fPIC], [-DPIC], [-shared -dynamiclib -flat_namespace -undefined suppress -bind_at_load], [ + DC_TEST_SHOBJFLAGS([-fPIC], [-DPIC], [-dynamiclib -flat_namespace -undefined suppress -bind_at_load], [ + DC_TEST_SHOBJFLAGS([-fPIC], [-DPIC], [-Wl,-dynamiclib -Wl,-flat_namespace -Wl,-undefined,suppress -Wl,-bind_at_load], [ + DC_TEST_SHOBJFLAGS([-fPIC], [-DPIC], [-dynamiclib -flat_namespace -undefined suppress], [ + DC_TEST_SHOBJFLAGS([-fPIC], [-DPIC], [-dynamiclib], [ + AC_MSG_RESULT(cant) + AC_MSG_ERROR([We are unable to make shared objects.]) + ]) + ]) + ]) + ]) + ]) + ]) + ]) + ]) + ]) ]) ]) fi - AC_MSG_RESULT($SHOBJLDFLAGS $SHOBJFLAGS) + AC_MSG_RESULT($SHOBJCPPFLAGS $SHOBJFLAGS $SHOBJLDFLAGS) + + DC_SYNC_SHLIBOBJS +]) + +AC_DEFUN([DC_SYNC_SHLIBOBJS], [ + AC_SUBST(SHLIBOBJS) + SHLIBOBJS="" + for obj in $LIB@&t@OBJS; do + SHLIBOBJS="$SHLIBOBJS `echo $obj | sed 's/\.o$/_shr.o/g'`" + done +]) + +AC_DEFUN([DC_SYNC_RPATH], [ + OLD_LDFLAGS="$LDFLAGS" + + for tryrpath in "-Wl,-rpath" "-Wl,--rpath" "-Wl,-R"; do + LDFLAGS="$OLD_LDFLAGS $tryrpath -Wl,/tmp" + AC_LINK_IFELSE(AC_LANG_PROGRAM([], [ return(0); ]), [ + rpathldflags="$tryrpath" + break + ]) + done + unset tryrpath + + LDFLAGS="$OLD_LDFLAGS" + unset OLD_LDFLAGS + + ADDLDFLAGS="" + for opt in $LDFLAGS; do + if echo "$opt" | grep '^-L' >/dev/null; then + rpathdir=`echo "$opt" | sed 's@^-L *@@'` + ADDLDFLAGS="$ADDLDFLAGS $rpathldflags -Wl,$rpathdir" + fi + done + unset opt rpathldflags + + LDFLAGS="$LDFLAGS $ADDLDFLAGS" + + unset ADDLDFLAGS ]) -AC_DEFUN(DC_CHK_OS_INFO, [ +AC_DEFUN([DC_CHK_OS_INFO], [ AC_CANONICAL_HOST AC_SUBST(SHOBJEXT) + AC_SUBST(SHOBJFLAGS) + AC_SUBST(SHOBJCPPFLAGS) + AC_SUBST(SHOBJLDFLAGS) + AC_SUBST(CFLAGS) + AC_SUBST(CPPFLAGS) AC_SUBST(AREXT) - AC_SUBST(SHOBJFLAGS) - AC_SUBST(SHOBJLDFLAGS) - - AC_MSG_CHECKING(host operating system) - AC_MSG_RESULT($host_os) - - SHOBJEXT="so" - AREXT="a" - - case $host_os in - darwin*) - SHOBJEXT="dylib" - ;; - hpux*) - SHOBJEXT="sl" - ;; - mingw*) - SHOBJEXT="dll" - SHOBJFLAGS="-mms-bitfields -DPIC" - SHOBJLDFLAGS='-shared -Wl,--dll -Wl,--enable-auto-image-base -Wl,--output-def,$[@].def,--out-implib,$[@].a' - ;; - esac + + if test "$dc_cv_dc_chk_os_info_called" != '1'; then + dc_cv_dc_chk_os_info_called='1' + + AC_MSG_CHECKING(host operating system) + AC_MSG_RESULT($host_os) + + SHOBJEXT="so" + AREXT="a" + + case $host_os in + darwin*) + SHOBJEXT="dylib" + ;; + hpux*) + case "$host_cpu" in + ia64) + SHOBJEXT="so" + ;; + *) + SHOBJEXT="sl" + ;; + esac + ;; + aix[0-9].*) + SHOBJEXT="a" + ;; + mingw32|mingw32msvc*) + SHOBJEXT="dll" + CFLAGS="$CFLAGS -mms-bitfields" + CPPFLAGS="$CPPFLAGS -mms-bitfields" + SHOBJCPPFLAGS="-DPIC" + SHOBJLDFLAGS='-shared -Wl,--dll -Wl,--enable-auto-image-base -Wl,--output-def,$[@].def,--out-implib,$[@].a' + ;; + msvc) + SHOBJEXT="dll" + CFLAGS="$CFLAGS -nologo" + SHOBJCPPFLAGS='-DPIC' + SHOBJLDFLAGS='/LD /LINK /NODEFAULTLIB:MSVCRT' + ;; + cygwin*) + SHOBJEXT="dll" + SHOBJFLAGS="-fPIC" + SHOBJCPPFLAGS="-DPIC" + CFLAGS="$CFLAGS -mms-bitfields" + CPPFLAGS="$CPPFLAGS -mms-bitfields" + SHOBJLDFLAGS='-shared -Wl,--enable-auto-image-base -Wl,--output-def,$[@].def,--out-implib,$[@].a' + ;; + esac + fi +]) + +AC_DEFUN(SHOBJ_SET_SONAME, [ + SAVE_LDFLAGS="$LDFLAGS" + + AC_MSG_CHECKING([how to specify soname]) + + for try in "-Wl,--soname,$1" "Wl,-install_name,$1" '__fail__'; do + LDFLAGS="$SAVE_LDFLAGS" + + if test "${try}" = '__fail__'; then + AC_MSG_RESULT([can't]) + + break + fi + + LDFLAGS="${LDFLAGS} ${try}" + AC_TRY_LINK([void TestTest(void) { return; }], [], [ + LDFLAGS="${SAVE_LDFLAGS}" + SHOBJLDFLAGS="${SHOBJLDFLAGS} ${try}" + + AC_MSG_RESULT([$try]) + + break + ]) + done + + AC_SUBST(SHOBJLDFLAGS) ]) Index: aclocal/tcl.m4 ================================================================== --- aclocal/tcl.m4 +++ aclocal/tcl.m4 @@ -1,9 +1,9 @@ dnl Tcl M4 Routines dnl Must call AC_CANONICAL_HOST before calling us -AC_DEFUN(TCLEXT_FIND_TCLCONFIG, [ +AC_DEFUN([TCLEXT_FIND_TCLCONFIG], [ AC_MSG_CHECKING([for path to tclConfig.sh]) TCLCONFIGPATH="" AC_ARG_WITH([tcl], AS_HELP_STRING([--with-tcl], [directory containing tcl configuration (tclConfig.sh)]), [ if test "x$withval" = "xno"; then @@ -23,17 +23,33 @@ if test -z "$TCLCONFIGPATH"; then AC_MSG_ERROR([unable to locate tclConfig.sh. Try --with-tcl.]) fi + for try_tclsh in "$TCLCONFIGPATH/../bin/tclsh" \ + "$TCLCONFIGPATH/../bin/tclsh8.6" \ + "$TCLCONFIGPATH/../bin/tclsh8.5" \ + "$TCLCONFIGPATH/../bin/tclsh8.4" \ + `which tclsh 2>/dev/null` \ + `which tclsh8.6 2>/dev/null` \ + `which tclsh8.5 2>/dev/null` \ + `which tclsh8.4 2>/dev/null` \ + tclsh; do + if test -x "$try_tclsh"; then + break + fi + done + TCLSH_PROG="${try_tclsh}" + AC_SUBST(TCLCONFIGPATH) + AC_SUBST(TCLSH_PROG) AC_MSG_RESULT([$TCLCONFIGPATH]) ]) dnl Must define TCLCONFIGPATH before calling us (i.e., by TCLEXT_FIND_TCLCONFIG) -AC_DEFUN(TCLEXT_LOAD_TCLCONFIG, [ +AC_DEFUN([TCLEXT_LOAD_TCLCONFIG], [ AC_MSG_CHECKING([for working tclConfig.sh]) if test -f "$TCLCONFIGPATH/tclConfig.sh"; then . "$TCLCONFIGPATH/tclConfig.sh" else @@ -42,18 +58,25 @@ AC_MSG_RESULT([found]) ]) -AC_DEFUN(TCLEXT_INIT, [ +AC_DEFUN([TCLEXT_INIT], [ AC_CANONICAL_HOST TCLEXT_FIND_TCLCONFIG TCLEXT_LOAD_TCLCONFIG - AC_DEFINE_UNQUOTED([MODULE_SCOPE], [static], [Define how to declare a function should only be visible to the current module]) + + AC_ARG_ENABLE([stubs], AS_HELP_STRING([--disable-stubs], [disable use of Tcl stubs]), [ + if test "$enableval" = "no"; then + TCL_SUPPORTS_STUBS=0 + else + TCL_SUPPORTS_STUBS=1 + fi + ]) if test "$TCL_SUPPORTS_STUBS" = "1"; then AC_DEFINE([USE_TCL_STUBS], [1], [Define if you are using the Tcl Stubs Mechanism]) TCL_STUB_LIB_SPEC="`eval echo "${TCL_STUB_LIB_SPEC}"`" @@ -68,10 +91,10 @@ CFLAGS="${CFLAGS} ${TCL_INCLUDE_SPEC}" CPPFLAGS="${CPPFLAGS} ${TCL_INCLUDE_SPEC}" DEFS="${DEFS} ${TCL_DEFS}" dnl Needed for package installation - TCL_PACKAGE_PATH="`echo "${TCL_PACKAGE_PATH}" | sed 's@ *$''@@'`" + TCL_PACKAGE_PATH="`echo "${TCL_PACKAGE_PATH}" | sed 's@ *$''@@' | awk '{ print [$]1 }'`" AC_SUBST(TCL_PACKAGE_PATH) AC_SUBST(LIBS) ]) Index: build/autogen.sh ================================================================== --- build/autogen.sh +++ build/autogen.sh @@ -1,6 +1,19 @@ #! /bin/bash + +( + mkdir aclocal >/dev/null 2>/dev/null + cd aclocal || exit 1 + + for file in shobj.m4 tcl.m4; do + rm -f "${file}" + + wget -O "${file}.new" "http://rkeene.org/devel/autoconf/${file}" || continue + + mv "${file}.new" "${file}" + done +) cat aclocal/*.m4 > aclocal.m4 || exit 1 autoconf || exit 1 rm -rf autom4te.cache/