Index: kitsh/buildsrc/kitsh-0.0/aclocal.m4 ================================================================== --- kitsh/buildsrc/kitsh-0.0/aclocal.m4 +++ kitsh/buildsrc/kitsh-0.0/aclocal.m4 @@ -255,14 +255,10 @@ fi initialize="0" fi - if test "${proj}" = "thread"; then - initialize="0" - fi - if test "${proj}" = "tclvfs"; then initialize="0" fi if test "${hide_symbols}" = "1"; then Index: thread/build.sh ================================================================== --- thread/build.sh +++ thread/build.sh @@ -72,21 +72,79 @@ else cp -rp ../buildsrc/* './' fi cd "${BUILDDIR}" || exit 1 - echo "Running: ./configure --enable-shared --disable-symbols --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --with-tcl=\"${TCLCONFIGDIR}\" ${CONFIGUREEXTRA}" - ./configure --enable-shared --disable-symbols --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" ${CONFIGUREEXTRA} - - echo "Running: ${MAKE:-make}" - ${MAKE:-make} || exit 1 - - echo "Running: ${MAKE:-make} install" - ${MAKE:-make} install + + + # Try to build as a shared object if requested + if [ "${STATICTHREAD}" = "0" ]; then + tryopts="--enable-shared --disable-shared" + elif [ "${STATICTHREAD}" = "1" ]; then + tryopts="--disable-shared" + else + tryopts="--enable-shared" + fi + + SAVE_CFLAGS="${CFLAGS}" + for tryopt in $tryopts __fail__; do + # Clean up, if needed + make distclean >/dev/null 2>/dev/null + rm -rf "${INSTDIR}" + mkdir "${INSTDIR}" + + if [ "${tryopt}" = "__fail__" ]; then + exit 1 + fi + + if [ "${tryopt}" == "--enable-shared" ]; then + isshared="1" + else + isshared="0" + fi + + # If build a static TLS for KitDLL, ensure that we use PIC + # so that it can be linked into the shared object + if [ "${isshared}" = "0" -a "${KITTARGET}" = "kitdll" ]; then + CFLAGS="${SAVE_CFLAGS} -fPIC" + else + CFLAGS="${SAVE_CFLAGS}" + fi + export CFLAGS + + if [ "${isshared}" = '0' ]; then + sed 's@USE_TCL_STUBS@XXX_TCL_STUBS@g' configure > configure.new + else + sed 's@XXX_TCL_STUBS@USE_TCL_STUBS@g' configure > configure.new + fi + cat configure.new > configure + rm -f configure.new + + ( + echo "Running: ./configure $tryopt --disable-symbols --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --with-tcl=\"${TCLCONFIGDIR}\" ${CONFIGUREEXTRA}" + ./configure $tryopt --disable-symbols --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" ${CONFIGUREEXTRA} + + echo "Running: ${MAKE:-make}" + ${MAKE:-make} || exit 1 + + echo "Running: ${MAKE:-make} install" + ${MAKE:-make} install + ) || continue + + break + done mkdir "${OUTDIR}/lib" || exit 1 cp -r "${INSTDIR}/lib"/thread*/ "${OUTDIR}/lib/" + rm -f "${OUTDIR}"/lib/thread*/*.a + + if [ "${isshared}" = '0' ]; then + cat << _EOF_ > "${OUTDIR}/lib/thread${THREADVERS}/pkgIndex.tcl" +package ifneeded Thread ${THREADVERS} [list load "" Thread] +package ifneeded Ttrace ${THREADVERS} [list source [file join $dir ttrace.tcl]] +_EOF_ + fi "${STRIP:-strip}" -g "${OUTDIR}"/lib/thread*/*.so >/dev/null 2>/dev/null exit 0 ) || exit 1