ADDED .fossil-settings/ignore-glob Index: .fossil-settings/ignore-glob ================================================================== --- /dev/null +++ .fossil-settings/ignore-glob @@ -0,0 +1,14 @@ +nano.so +Makefile +pkgIndex.tcl +aclocal.m4 +config.guess +config.sub +configure +install-sh +config.log +config.status +blake2b/blake2b.o +tweetnacl/tweetnacl.c +tweetnacl/tweetnacl.h +tweetnacl/tweetnacl.o DELETED Makefile Index: Makefile ================================================================== --- Makefile +++ /dev/null @@ -1,26 +0,0 @@ -CFLAGS = -Wall -LIBS = -ltcl8.6 -export CFLAGS - -all: nano.so - -nano.so: tweetnacl/tweetnacl.o blake2b/blake2b.o nano.c Makefile - $(CC) $(CPPFLAGS) $(CFLAGS) -shared -o nano.so nano.c tweetnacl/tweetnacl.o blake2b/blake2b.o $(LDFLAGS) $(LIBS) - -tweetnacl/tweetnacl.o: - $(MAKE) -C tweetnacl tweetnacl.o - -blake2b/blake2b.o: - $(MAKE) -C blake2b blake2b.o - -clean: - rm -f nano.so - $(MAKE) -C tweetnacl clean - $(MAKE) -C blake2b clean - -distclean: - rm -f nano.so - $(MAKE) -C tweetnacl distclean - $(MAKE) -C blake2b distclean - -.PHONY: all clean distclean ADDED Makefile.in Index: Makefile.in ================================================================== --- /dev/null +++ Makefile.in @@ -0,0 +1,26 @@ +CFLAGS = -Wall +LIBS = -ltcl8.6 +export CFLAGS + +all: nano.so + +nano.so: tweetnacl/tweetnacl.o blake2b/blake2b.o nano.c Makefile + $(CC) $(CPPFLAGS) $(CFLAGS) -shared -o nano.so nano.c tweetnacl/tweetnacl.o blake2b/blake2b.o $(LDFLAGS) $(LIBS) + +tweetnacl/tweetnacl.o: + $(MAKE) -C tweetnacl tweetnacl.o + +blake2b/blake2b.o: + $(MAKE) -C blake2b blake2b.o + +clean: + rm -f nano.so + $(MAKE) -C tweetnacl clean + $(MAKE) -C blake2b clean + +distclean: + rm -f nano.so + $(MAKE) -C tweetnacl distclean + $(MAKE) -C blake2b distclean + +.PHONY: all clean distclean ADDED aclocal/ax_check_compile_flag.m4 Index: aclocal/ax_check_compile_flag.m4 ================================================================== --- /dev/null +++ aclocal/ax_check_compile_flag.m4 @@ -0,0 +1,74 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 5 + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS ADDED aclocal/shobj.m4 Index: aclocal/shobj.m4 ================================================================== --- /dev/null +++ aclocal/shobj.m4 @@ -0,0 +1,296 @@ +dnl Usage: +dnl DC_TEST_SHOBJFLAGS(shobjflags, shobjldflags, action-if-not-found) +dnl +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="" + + 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"; 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_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" -a -z "$SHOBJCPPFLAGS"; then + DC_TEST_SHOBJFLAGS([-fPIC], [-DPIC], [-shared], [ + 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($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], [ + AC_ARG_ENABLE([rpath], AS_HELP_STRING([--disable-rpath], [disable setting of rpath]), [ + if test "$enableval" = 'no'; then + set_rpath='no' + else + set_rpath='yes' + fi + ], [ + if test "$cross_compiling" = 'yes'; then + set_rpath='no' + else + ifelse($1, [], [ + set_rpath='yes' + ], [ + set_rpath='$1' + ]) + fi + ]) + + if test "$set_rpath" = 'yes'; then + OLD_LDFLAGS="$LDFLAGS" + + AC_CACHE_CHECK([how to set rpath], [rsk_cv_link_set_rpath], [ + AC_LANG_PUSH(C) + for tryrpath in "-Wl,-rpath" "-Wl,--rpath" "-Wl,-R"; do + LDFLAGS="$OLD_LDFLAGS $tryrpath -Wl,/tmp" + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [ return(0); ])], [ + rsk_cv_link_set_rpath="$tryrpath" + break + ]) + done + AC_LANG_POP(C) + unset tryrpath + ]) + + LDFLAGS="$OLD_LDFLAGS" + unset OLD_LDFLAGS + + ADDLDFLAGS="" + for opt in $LDFLAGS $LIBS; do + if echo "$opt" | grep '^-L' >/dev/null; then + rpathdir="`echo "$opt" | sed 's@^-L *@@'`" + ADDLDFLAGS="$ADDLDFLAGS $rsk_cv_link_set_rpath -Wl,$rpathdir" + fi + done + unset opt + + LDFLAGS="$LDFLAGS $ADDLDFLAGS" + + unset ADDLDFLAGS + fi +]) + +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) + + 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 + ;; + mingw32|mingw32msvc*) + SHOBJEXT="dll" + AREXT='lib' + 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" + AREXT='lib' + 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) +]) + +dnl $1 = Description to show user +dnl $2 = Libraries to link to +dnl $3 = Variable to update (optional; default LIBS) +dnl $4 = Action to run if found +dnl $5 = Action to run if not found +AC_DEFUN([SHOBJ_DO_STATIC_LINK_LIB], [ + ifelse($3, [], [ + define([VAR_TO_UPDATE], [LIBS]) + ], [ + define([VAR_TO_UPDATE], [$3]) + ]) + + + AC_MSG_CHECKING([for how to statically link to $1]) + + trylink_ADD_LDFLAGS='' + for arg in $VAR_TO_UPDATE; do + case "${arg}" in + -L*) + trylink_ADD_LDFLAGS="${arg}" + ;; + esac + done + + SAVELIBS="$LIBS" + staticlib="" + found="0" + dnl HP/UX uses -Wl,-a,archive ... -Wl,-a,shared_archive + dnl Linux and Solaris us -Wl,-Bstatic ... -Wl,-Bdynamic + AC_LANG_PUSH([C]) + for trylink in "-Wl,-a,archive $2 -Wl,-a,shared_archive" "-Wl,-Bstatic $2 -Wl,-Bdynamic" "$2"; do + if echo " ${LDFLAGS} " | grep ' -static ' >/dev/null; then + if test "${trylink}" != "$2"; then + continue + fi + fi + + LIBS="${SAVELIBS} ${trylink_ADD_LDFLAGS} ${trylink}" + + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [ + staticlib="${trylink}" + found="1" + + break + ]) + done + AC_LANG_POP([C]) + LIBS="${SAVELIBS}" + + if test "${found}" = "1"; then + new_RESULT='' + SAVERESULT="$VAR_TO_UPDATE" + for lib in ${SAVERESULT}; do + addlib='1' + for removelib in $2; do + if test "${lib}" = "${removelib}"; then + addlib='0' + break + fi + done + + if test "$addlib" = '1'; then + new_RESULT="${new_RESULT} ${lib}" + fi + done + VAR_TO_UPDATE="${new_RESULT} ${staticlib}" + + AC_MSG_RESULT([${staticlib}]) + + $4 + else + AC_MSG_RESULT([cant]) + + $5 + fi +]) + ADDED aclocal/tcl.m4 Index: aclocal/tcl.m4 ================================================================== --- /dev/null +++ aclocal/tcl.m4 @@ -0,0 +1,174 @@ +dnl Tcl M4 Routines + +dnl Find a runnable Tcl +AC_DEFUN([TCLEXT_FIND_TCLSH_PROG], [ + AC_CACHE_CHECK([for runnable tclsh], [tcl_cv_tclsh_native_path], [ + dnl Try to find a runnable tclsh + if test -z "$TCLCONFIGPATH"; then + TCLCONFIGPATH=/dev/null/null + fi + + for try_tclsh in "$TCLSH_NATIVE" "$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 -z "$try_tclsh"; then + continue + fi + if test -x "$try_tclsh"; then + if echo 'exit 0' | "$try_tclsh" 2>/dev/null >/dev/null; then + tcl_cv_tclsh_native_path="$try_tclsh" + + break + fi + fi + done + + if test "$TCLCONFIGPATH" = '/dev/null/null'; then + unset TCLCONFIGPATH + fi + ]) + + TCLSH_PROG="${tcl_cv_tclsh_native_path}" + AC_SUBST(TCLSH_PROG) +]) + + +dnl Must call AC_CANONICAL_HOST before calling us +AC_DEFUN([TCLEXT_FIND_TCLCONFIG], [ + + TCLCONFIGPATH="" + AC_ARG_WITH([tcl], AS_HELP_STRING([--with-tcl], [directory containing tcl configuration (tclConfig.sh)]), [ + if test "x$withval" = "xno"; then + AC_MSG_ERROR([cant build without tcl]) + fi + + TCLCONFIGPATH="$withval" + ], [ + if test "$cross_compiling" = 'no'; then + TCLEXT_FIND_TCLSH_PROG + tclConfigCheckDir0="`echo 'puts [[tcl::pkgconfig get libdir,runtime]]' | "$TCLSH_PROG" 2>/dev/null`" + tclConfigCheckDir1="`echo 'puts [[tcl::pkgconfig get scriptdir,runtime]]' | "$TCLSH_PROG" 2>/dev/null`" + else + tclConfigCheckDir0=/dev/null/null + tclConfigCheckDir1=/dev/null/null + fi + + if test "$cross_compiling" = 'no'; then + dirs="/usr/$host_alias/lib /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64" + else + dirs='' + fi + + for dir in "$tclConfigCheckDir0" "$tclConfigCheckDir1" $dirs; do + if test -f "$dir/tclConfig.sh"; then + TCLCONFIGPATH="$dir" + + break + fi + done + ]) + + AC_MSG_CHECKING([for path to tclConfig.sh]) + + if test -z "$TCLCONFIGPATH"; then + AC_MSG_ERROR([unable to locate tclConfig.sh. Try --with-tcl.]) + fi + + AC_SUBST(TCLCONFIGPATH) + + AC_MSG_RESULT([$TCLCONFIGPATH]) + + dnl Find Tcl if we haven't already + if test -z "$TCLSH_PROG"; then + TCLEXT_FIND_TCLSH_PROG + fi +]) + +dnl Must define TCLCONFIGPATH before calling us (i.e., by TCLEXT_FIND_TCLCONFIG) +AC_DEFUN([TCLEXT_LOAD_TCLCONFIG], [ + AC_MSG_CHECKING([for working tclConfig.sh]) + + if test -f "$TCLCONFIGPATH/tclConfig.sh"; then + . "$TCLCONFIGPATH/tclConfig.sh" + else + AC_MSG_ERROR([unable to load tclConfig.sh]) + fi + + + AC_MSG_RESULT([found]) +]) + +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]) + + TCLEXT_BUILD='shared' + AC_ARG_ENABLE([shared], AS_HELP_STRING([--disable-shared], [disable the shared build (same as --enable-static)]), [ + if test "$enableval" = "no"; then + TCLEXT_BUILD='static' + TCL_SUPPORTS_STUBS=0 + fi + ]) + + AC_ARG_ENABLE([static], AS_HELP_STRING([--enable-static], [enable a static build]), [ + if test "$enableval" = "yes"; then + TCLEXT_BUILD='static' + TCL_SUPPORTS_STUBS=0 + fi + ]) + + 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}"`" + LIBS="${LIBS} ${TCL_STUB_LIB_SPEC}" + else + TCL_LIB_SPEC="`eval echo "${TCL_LIB_SPEC}"`" + LIBS="${LIBS} ${TCL_LIB_SPEC}" + fi + + TCL_INCLUDE_SPEC="`eval echo "${TCL_INCLUDE_SPEC}"`" + + CFLAGS="${CFLAGS} ${TCL_INCLUDE_SPEC}" + CPPFLAGS="${CPPFLAGS} ${TCL_INCLUDE_SPEC}" + TCL_DEFS_TCL_ONLY=`( + eval "set -- ${TCL_DEFS}" + for flag in "[$]@"; do + case "${flag}" in + -DTCL_*) + echo "${flag}" | sed "s/'/'\\''/g" | sed "s@^@'@;s@"'[$]'"@'@" | tr $'\n' ' ' + ;; + esac + done + )` + TCL_DEFS="${TCL_DEFS_TCL_ONLY}" + AC_SUBST(TCL_DEFS) + + dnl Needed for package installation + if test "$prefix" = 'NONE' -a "$exec_prefix" = 'NONE' -a "${libdir}" = '${exec_prefix}/lib'; then + TCL_PACKAGE_PATH="`echo "${TCL_PACKAGE_PATH}" | sed 's@ *$''@@' | awk '{ print [$]1 }'`" + else + TCL_PACKAGE_PATH='${libdir}' + fi + AC_SUBST(TCL_PACKAGE_PATH) + + AC_SUBST(LIBS) +]) ADDED aclocal/versionscript.m4 Index: aclocal/versionscript.m4 ================================================================== --- /dev/null +++ aclocal/versionscript.m4 @@ -0,0 +1,85 @@ +AC_DEFUN([DC_SETUP_STABLE_API], [ + VERSIONSCRIPT="$1" + SYMFILE="$2" + + DC_FIND_STRIP_AND_REMOVESYMS([$SYMFILE]) + DC_SETVERSIONSCRIPT([$VERSIONSCRIPT], [$SYMFILE]) +]) + + +AC_DEFUN([DC_SETVERSIONSCRIPT], [ + VERSIONSCRIPT="$1" + SYMFILE="$2" + TMPSYMFILE="${SYMFILE}.tmp" + TMPVERSIONSCRIPT="${VERSIONSCRIPT}.tmp" + + echo "${SYMPREFIX}Test_Symbol" > "${TMPSYMFILE}" + + echo '{' > "${TMPVERSIONSCRIPT}" + echo ' local:' >> "${TMPVERSIONSCRIPT}" + echo " ${SYMPREFIX}Test_Symbol;" >> "${TMPVERSIONSCRIPT}" + echo '};' >> "${TMPVERSIONSCRIPT}" + + SAVE_LDFLAGS="${LDFLAGS}" + + AC_MSG_CHECKING([for how to set version script]) + + for tryaddldflags in "-Wl,--version-script,${TMPVERSIONSCRIPT}" "-Wl,-exported_symbols_list,${TMPSYMFILE}"; do + LDFLAGS="${SAVE_LDFLAGS} ${tryaddldflags}" + AC_TRY_LINK([void Test_Symbol(void) { return; }], [], [ + addldflags="`echo "${tryaddldflags}" | sed 's/\.tmp$//'`" + + break + ]) + done + + rm -f "${TMPSYMFILE}" + rm -f "${TMPVERSIONSCRIPT}" + + LDFLAGS="${SAVE_LDFLAGS}" + + if test -n "${addldflags}"; then + SHOBJLDFLAGS="${SHOBJLDFLAGS} ${addldflags}" + + AC_MSG_RESULT($addldflags) + else + AC_MSG_RESULT([don't know]) + fi + + AC_SUBST(SHOBJLDFLAGS) +]) + +AC_DEFUN([DC_FIND_STRIP_AND_REMOVESYMS], [ + SYMFILE="$1" + + dnl Determine how to strip executables + AC_CHECK_TOOLS(OBJCOPY, objcopy gobjcopy, [false]) + AC_CHECK_TOOLS(STRIP, strip gstrip, [false]) + + if test "x${STRIP}" = "xfalse"; then + STRIP="${OBJCOPY}" + fi + + WEAKENSYMS='true' + REMOVESYMS='true' + SYMPREFIX='' + + case $host_os in + darwin*) + SYMPREFIX="_" + REMOVESYMS="${STRIP} -u -x" + ;; + *) + if test "x${OBJCOPY}" != "xfalse"; then + WEAKENSYMS="${OBJCOPY} --keep-global-symbols=${SYMFILE}" + REMOVESYMS="${OBJCOPY} --discard-all" + elif test "x${STRIP}" != "xfalse"; then + REMOVESYMS="${STRIP} -x" + fi + ;; + esac + + AC_SUBST(WEAKENSYMS) + AC_SUBST(REMOVESYMS) + AC_SUBST(SYMPREFIX) +]) ADDED autogen.sh Index: autogen.sh ================================================================== --- /dev/null +++ autogen.sh @@ -0,0 +1,78 @@ +#! /usr/bin/env bash + +update='0' +if [ "$1" = '-update' ]; then + update='1' +fi + +commands=( + curl diff cat mkdir rm mv automake autoconf +) + +urls=( + http://chiselapp.com/user/rkeene/repository/autoconf/doc/trunk/tcl.m4 + http://chiselapp.com/user/rkeene/repository/autoconf/doc/trunk/shobj.m4 + http://chiselapp.com/user/rkeene/repository/autoconf/doc/trunk/versionscript.m4 + 'http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_check_compile_flag.m4' +) + +localFiles=( +) + +failed='0' +for command in "${commands[@]}"; do + if [ ! -f "$(which "${command}" 2>/dev/null)" ]; then + echo "error: Unable to locate ${command}" >&2 + failed='1' + fi +done +if [ "${failed}" = '1' ]; then + exit 1 +fi + +cd "$(dirname "$(which "$0")")" || exit 1 + +mkdir aclocal >/dev/null 2>/dev/null + +files=() + +for url in "${urls[@]}"; do + file="aclocal/$(echo "${url}" | sed 's@^.*/@@')" + + if [ -f "${file}" ]; then + if [ "${update}" = '0' ]; then + files=("${files[@]}" "${file}") + + continue + fi + fi + + curl -lsS "${url}" > "${file}.new" || exit 1 + if diff "${file}.new" "${file}" >/dev/null 2>/dev/null; then + rm -f "${file}.new" + else + mv "${file}.new" "${file}" + fi + + files=("${files[@]}" "${file}") +done + +for file in "${files[@]}" "${localFiles[@]}"; do + cat "${file}" +done > aclocal.m4.new + +if diff aclocal.m4.new aclocal.m4 >/dev/null 2>/dev/null; then + rm -f aclocal.m4.new +else + mv aclocal.m4.new aclocal.m4 +fi + +automake --add-missing --copy --force-missing >/dev/null 2>/dev/null +if ! [ -f install-sh -o -f install.sh -o -f shtool ]; then + echo "automake failed" >&2 + exit 1 +fi + +autoconf + +rm -rf autom4te.cache ADDED configure.ac Index: configure.ac ================================================================== --- /dev/null +++ configure.ac @@ -0,0 +1,72 @@ +dnl Define ourselves +AC_INIT(tcl-nano, 0) + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_MAKE_SET +AC_PROG_INSTALL +AC_GNU_SOURCE + +dnl Determine system information +DC_CHK_OS_INFO + +dnl Look for appropriate headers +AC_CHECK_HEADERS(unistd.h stdlib.h string.h strings.h) + +dnl Perform Tcl Extension required stuff +TCLEXT_INIT + +if test "$TCLEXT_BUILD" != 'static'; then + dnl Determine how to make shared objects + DC_GET_SHOBJFLAGS + + EXTENSION_TARGET="nano.${SHOBJEXT}" +else + AC_CHECK_TOOL([AR], [ar], [false]) + AC_CHECK_TOOL([RANLIB], [ranlib], [:]) + + EXTENSION_TARGET="nano.${AREXT}" +fi +AC_SUBST(EXTENSION_TARGET) +AC_SUBST(TCLEXT_BUILD) + +dnl Enable support for a debugging build +tcl_nano_debug='false' +AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [enable debugging parameters]), [ + if test "$enableval" = "yes"; then + tcl_nano_debug='true' + fi +]) +if test "$tcl_nano_debug" = 'true'; then + AC_DEFINE(TCLEXT_TCLTLS_DEBUG, [1], [Enable debugging build]) + AX_CHECK_COMPILE_FLAG([-fcheck-pointer-bounds], [CFLAGS="$CFLAGS -fcheck-pointer-bounds"]) +else + dnl If we are not doing debugging disable some of the more annoying warnings + AX_CHECK_COMPILE_FLAG([-Wno-unused-value], [CFLAGS="$CFLAGS -Wno-unused-value"]) + AX_CHECK_COMPILE_FLAG([-Wno-unused-parameter], [CFLAGS="$CFLAGS -Wno-unused-parameter"]) + AX_CHECK_COMPILE_FLAG([-Wno-deprecated-declarations], [CFLAGS="$CFLAGS -Wno-deprecated-declarations"]) +fi + +dnl Enable compiler warnings +AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"]) +AX_CHECK_COMPILE_FLAG([-W], [ + CFLAGS="$CFLAGS -W" + AX_CHECK_COMPILE_FLAG([-Wno-self-assign], [CFLAGS="$CFLAGS -Wno-self-assign"]) +]) + +dnl Enable hardening +AX_CHECK_COMPILE_FLAG([-fstack-protector-all], [CFLAGS="$CFLAGS -fstack-protector-all"]) +AX_CHECK_COMPILE_FLAG([-fno-strict-overflow], [CFLAGS="$CFLAGS -fno-strict-overflow"]) +AC_DEFINE([_FORTIFY_SOURCE], [2], [Enable fortification]) + +dnl Sync the RPATH if requested +if test "$TCLEXT_BUILD" != 'static'; then + if test "$TCLEXT_TLS_STATIC_SSL" = 'yes'; then + DC_SYNC_RPATH([no]) + else + DC_SYNC_RPATH([yes]) + fi +fi + +dnl Produce output +AC_OUTPUT(Makefile pkgIndex.tcl) DELETED pkgIndex.tcl Index: pkgIndex.tcl ================================================================== --- pkgIndex.tcl +++ /dev/null @@ -1,4 +0,0 @@ -package ifneeded nano 0 [list apply {{dir} { - load [file join $dir nano.so] - source [file join $dir nano.tcl] -}} $dir] ADDED pkgIndex.tcl.in Index: pkgIndex.tcl.in ================================================================== --- /dev/null +++ pkgIndex.tcl.in @@ -0,0 +1,4 @@ +package ifneeded nano @PACKAGE_VERSION@ [list apply {{dir} { + load [file join $dir nano.so] + source [file join $dir nano.tcl] +}} $dir]