]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Clean up and restructure the TCL configuration sections in autoconf.
authordrh <>
Thu, 1 Aug 2024 18:10:00 +0000 (18:10 +0000)
committerdrh <>
Thu, 1 Aug 2024 18:10:00 +0000 (18:10 +0000)
The new --with-tclsh=FILE option lets you select the specific tclsh
that you want to run.

FossilOrigin-Name: 8fafc679d91e857602fbbe203144ca98242246660ede5a49c5fec8aaff571151

configure
configure.ac
manifest
manifest.uuid
tool/find_tclconfig.tcl [new file with mode: 0644]

index efd0422ac185dfb42d902034410e92dac7157072..744410589bc634eead0260f0e9e7a22add504d4e 100755 (executable)
--- a/configure
+++ b/configure
@@ -781,18 +781,6 @@ TARGET_HAVE_EDITLINE
 TARGET_HAVE_READLINE
 TARGET_READLINE_INC
 TARGET_READLINE_LIBS
-HAVE_TCL
-TCL_SHLIB_SUFFIX
-TCL_STUB_LIB_SPEC
-TCL_STUB_LIB_FLAG
-TCL_STUB_LIB_FILE
-TCL_LIB_SPEC
-TCL_LIB_FLAG
-TCL_LIB_FILE
-TCL_INCLUDE_SPEC
-TCL_SRC_DIR
-TCL_BIN_DIR
-TCL_VERSION
 TARGET_EXEEXT
 SQLITE_OS_WIN
 SQLITE_OS_UNIX
@@ -806,6 +794,18 @@ RELEASE
 VERSION
 program_prefix
 TCLLIBDIR
+HAVE_TCL
+TCL_SHLIB_SUFFIX
+TCL_STUB_LIB_SPEC
+TCL_STUB_LIB_FLAG
+TCL_STUB_LIB_FILE
+TCL_LIB_SPEC
+TCL_LIB_FLAG
+TCL_LIB_FILE
+TCL_INCLUDE_SPEC
+TCL_SRC_DIR
+TCL_BIN_DIR
+TCL_VERSION
 TCLSH_CMD
 INSTALL_DATA
 INSTALL_SCRIPT
@@ -894,12 +894,12 @@ enable_fast_install
 with_gnu_ld
 enable_libtool_lock
 enable_largefile
+with_tclsh
+with_tcl
 with_wasi_sdk
 enable_threadsafe
 enable_releasemode
 enable_tempstore
-enable_tcl
-with_tcl
 enable_editline
 enable_readline
 with_readline_lib
@@ -1555,7 +1555,6 @@ Optional Features:
   --enable-releasemode    Support libtool link to release mode
   --enable-tempstore      Use an in-ram database for temporary tables
                           (never,no,yes,always)
-  --disable-tcl           do not build TCL extension
   --enable-editline       enable BSD editline support
   --disable-readline      disable readline support
   --enable-debug          enable debugging & verbose explain
@@ -1583,10 +1582,10 @@ Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-tclsh=PATHNAME   full pathname of a tclsh to use
+  --with-tcl=DIR          directory containing (tclConfig.sh)
   --with-wasi-sdk=DIR     directory containing the WASI SDK. Triggers
                           cross-compile to WASM.
-  --with-tcl=DIR          directory containing tcl configuration
-                          (tclConfig.sh)
   --with-readline-lib     specify readline library
   --with-readline-inc     specify readline include paths
   --with-linenoise=DIR    source directory for linenoise library
@@ -3945,13 +3944,13 @@ if ${lt_cv_nm_interface+:} false; then :
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:3948: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:3947: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:3951: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:3950: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:3954: output\"" >&5)
+  (eval echo "\"\$as_me:3953: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -5157,7 +5156,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5160 "configure"' > conftest.$ac_ext
+  echo '#line 5159 "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -6682,11 +6681,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6685: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6684: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6689: \$? = $ac_status" >&5
+   echo "$as_me:6688: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7021,11 +7020,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7024: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7023: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7028: \$? = $ac_status" >&5
+   echo "$as_me:7027: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7126,11 +7125,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7129: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7128: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7133: \$? = $ac_status" >&5
+   echo "$as_me:7132: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -7181,11 +7180,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7184: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7183: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7188: \$? = $ac_status" >&5
+   echo "$as_me:7187: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -9561,7 +9560,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 9564 "configure"
+#line 9563 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -9657,7 +9656,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 9660 "configure"
+#line 9659 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10314,24 +10313,23 @@ done
 USE_AMALGAMATION=1
 
 #########
-# See whether we can run specific tclsh versions known to work well;
-# if not, then we fall back to plain tclsh.
-# TODO: try other versions before falling back?
+# Figure out all the name of a working tclsh and parameters needed to compile against Tcl.
+# The --with-tcl= configuration parameter might be useful for this.
 #
-if test x"${with_tcl}" != x; then
-  if test ! -r ${with_tcl}/tclConfig.sh; then
-    as_fn_error $? "no tclConfig.sh file found in --with-tcl: ${with_tcl}" "$LINENO" 5
-  else
-    . ${with_tcl}/tclConfig.sh
-    TCLSH_CMD=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION}
-    if test ! -x ${TCLSH_CMD}; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot use tclsh at: ${TCLSH_CMD}" >&5
-$as_echo "$as_me: WARNING: cannot use tclsh at: ${TCLSH_CMD}" >&2;}
-      TCLSH_CMD=none
-    fi
-  fi
-else
-  for ac_prog in tclsh8.6 tclsh8.5 tclsh
+
+# Check whether --with-tclsh was given.
+if test "${with_tclsh+set}" = set; then :
+  withval=$with_tclsh;
+fi
+
+
+# Check whether --with-tcl was given.
+if test "${with_tcl+set}" = set; then :
+  withval=$with_tcl;
+fi
+
+if test x"${with_tclsh}" == x -a x"${with_tcl}" == x; then
+  for ac_prog in tclsh8.6 tclsh tclsh9.0
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 done
 test -n "$TCLSH_CMD" || TCLSH_CMD="none"
 
+  with_tclsh=${TCLSH_CMD}
+fi
+if test x"${with_tclsh}" != x -a x"${with_tclsh}" != xnone; then
+  TCLSH_CMD=${with_tclsh}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: using tclsh at \"$TCLSH_CMD\"" >&5
+$as_echo "using tclsh at \"$TCLSH_CMD\"" >&6; }
+  with_tcl=`${with_tclsh} <${srcdir}/tool/find_tclconfig.tcl`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH_CMD recommends the tclConfig.sh at ${with_tcl}" >&5
+$as_echo "$TCLSH_CMD recommends the tclConfig.sh at ${with_tcl}" >&6; }
+fi
+if test x"${with_tcl}" != x; then
+  if test -r ${with_tcl}/tclConfig.sh; then
+    tclconfig="${with_tcl}/tclConfig.sh"
+  else
+    if test -r ${with_tcl}/tcl8.6/tclConfig.sh; then
+      tclconfig="${with_tcl}/tcl8.6/tclConfig.sh"
+    else
+      as_fn_error $? "no tclConfig.sh file found in ${with_tcl} or ${with_tcl}/tcl8.6" "$LINENO" 5
+    fi
+  fi
+  if test x"${tclconfig}" != x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: loading TCL configuration from ${tclconfig}" >&5
+$as_echo "loading TCL configuration from ${tclconfig}" >&6; }
+    . ${tclconfig}
+
+
+
+
+
+
+
+
+
+
+
+  fi
+  if test x"$TCLSH_CMD" == x; then
+    TCLSH_CMD=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION}
+    if test ! -x ${TCLSH_CMD}; then
+      TCLSH_CMD_2=${TCL_EXEC_PREFIX}/bin/tclsh
+      if test ! -x ${TCLSH_CMD_2}; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find a usable tclsh at either ${TCLSH_CMD} or ${TCLSH_CMD_2}" >&5
+$as_echo "$as_me: WARNING: cannot find a usable tclsh at either ${TCLSH_CMD} or ${TCLSH_CMD_2}" >&2;}
+        TCLSH_CMD=none
+      else
+        TCLSH_CMD=${TCLSH_CMD_2}
+      fi
+    fi
+  fi
 fi
 if test "$TCLSH_CMD" = "none"; then
   # If we can't find a local tclsh, then building the amalgamation will fail.
   # We act as though --disable-amalgamation has been used.
-  echo "Warning: can't find tclsh - defaulting to non-amalgamation build."
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Warning: can't find tclsh - defaulting to non-amalgamation build." >&5
+$as_echo "$as_me: WARNING: Warning: can't find tclsh - defaulting to non-amalgamation build." >&2;}
   USE_AMALGAMATION=0
   TCLSH_CMD="tclsh"
-fi
-if test x"$TCLSH_CMD" = x; then
-  as_fn_error $? "cannot find a usable tclsh" "$LINENO" 5
+  HAVE_TCL=0
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: using $TCLSH_CMD" >&5
-$as_echo "using $TCLSH_CMD" >&6; }
+  HAVE_TCL=1
 fi
 
 
 
+
 if test "x${TCLLIBDIR+set}" != "xset" ; then
   TCLLIBDIR='$(libdir)'
   for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}` ; do
 
 
 
-##########
-# Figure out all the parameters needed to compile against Tcl.
-#
-# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
-# macros in the in the tcl.m4 file of the standard TCL distribution.
-# Those macros could not be used directly since we have to make some
-# minor changes to accomodate systems that do not have TCL installed.
-#
-# Check whether --enable-tcl was given.
-if test "${enable_tcl+set}" = set; then :
-  enableval=$enable_tcl; use_tcl=$enableval
-else
-  use_tcl=yes
-fi
-
-if test "${use_tcl}" = "yes" ; then
-
-# Check whether --with-tcl was given.
-if test "${with_tcl+set}" = set; then :
-  withval=$with_tcl; with_tclconfig=${withval}
-fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5
-$as_echo_n "checking for Tcl configuration... " >&6; }
-  if ${ac_cv_c_tclconfig+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-    # First check to see if --with-tcl was specified.
-    if test x"${with_tclconfig}" != x ; then
-      if test -f "${with_tclconfig}/tclConfig.sh" ; then
-        ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
-      else
-        as_fn_error $? "${with_tclconfig} directory doesn't contain tclConfig.sh" "$LINENO" 5
-      fi
-    fi
-
-    # Start autosearch by asking tclsh
-    if test x"${ac_cv_c_tclconfig}" = x ; then
-      if test x"$cross_compiling" = xno; then
-        for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}`
-        do
-          if test -f "$i/tclConfig.sh" ; then
-            ac_cv_c_tclconfig="$i"
-            break
-          fi
-        done
-      fi
-    fi
-
-    # On ubuntu 14.10, $auto_path on tclsh is not quite correct.
-    # So try again after applying corrections.
-    if test x"${ac_cv_c_tclconfig}" = x ; then
-      if test x"$cross_compiling" = xno; then
-        for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD} | sed 's,/tcltk/tcl,/tcl,g'`
-        do
-          if test -f "$i/tclConfig.sh" ; then
-            ac_cv_c_tclconfig="$i"
-            break
-          fi
-        done
-      fi
-    fi
-
-    # Recent versions of Xcode on Macs hid the tclConfig.sh file
-    # in a strange place.
-    if test x"${ac_cv_c_tclconfig}" = x ; then
-      if test x"$cross_compiling" = xno; then
-        for i in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX*.sdk/usr/lib
-        do
-          if test -f "$i/tclConfig.sh" ; then
-            ac_cv_c_tclconfig="$i"
-            break
-          fi
-        done
-      fi
-    fi
-
-    # then check for a private Tcl installation
-    if test x"${ac_cv_c_tclconfig}" = x ; then
-      for i in \
-            ../tcl \
-            `ls -dr ../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \
-            `ls -dr ../tcl[8-9].[0-9] 2>/dev/null` \
-            `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \
-            ../../tcl \
-            `ls -dr ../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \
-            `ls -dr ../../tcl[8-9].[0-9] 2>/dev/null` \
-            `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \
-            ../../../tcl \
-            `ls -dr ../../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \
-            `ls -dr ../../../tcl[8-9].[0-9] 2>/dev/null` \
-            `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null`
-      do
-        if test -f "$i/unix/tclConfig.sh" ; then
-          ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
-          break
-        fi
-      done
-    fi
-
-    # check in a few common install locations
-    if test x"${ac_cv_c_tclconfig}" = x ; then
-      for i in \
-            `ls -d ${libdir} 2>/dev/null` \
-            `ls -d /usr/local/lib 2>/dev/null` \
-            `ls -d /usr/contrib/lib 2>/dev/null` \
-            `ls -d /usr/lib 2>/dev/null`
-      do
-        if test -f "$i/tclConfig.sh" ; then
-           ac_cv_c_tclconfig=`(cd $i; pwd)`
-           break
-        fi
-      done
-    fi
-
-    # check in a few other private locations
-    if test x"${ac_cv_c_tclconfig}" = x ; then
-      for i in \
-         ${srcdir}/../tcl \
-         `ls -dr ${srcdir}/../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \
-         `ls -dr ${srcdir}/../tcl[8-9].[0-9] 2>/dev/null` \
-         `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null`
-      do
-        if test -f "$i/unix/tclConfig.sh" ; then
-          ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
-          break
-        fi
-      done
-    fi
-
-fi
-
-
-  if test x"${ac_cv_c_tclconfig}" = x ; then
-    use_tcl=no
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find Tcl configuration definitions" >&5
-$as_echo "$as_me: WARNING: Can't find Tcl configuration definitions" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Without Tcl the regression tests cannot be executed ***" >&5
-$as_echo "$as_me: WARNING: *** Without Tcl the regression tests cannot be executed ***" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Consider using --with-tcl=... to define location of Tcl ***" >&5
-$as_echo "$as_me: WARNING: *** Consider using --with-tcl=... to define location of Tcl ***" >&2;}
-  else
-    TCL_BIN_DIR=${ac_cv_c_tclconfig}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: found $TCL_BIN_DIR/tclConfig.sh" >&5
-$as_echo "found $TCL_BIN_DIR/tclConfig.sh" >&6; }
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5
-$as_echo_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh... " >&6; }
-    if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: loading" >&5
-$as_echo "loading" >&6; }
-      . $TCL_BIN_DIR/tclConfig.sh
-    else
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: file not found" >&5
-$as_echo "file not found" >&6; }
-    fi
-
-    #
-    # If the TCL_BIN_DIR is the build directory (not the install directory),
-    # then set the common variable name to the value of the build variables.
-    # For example, the variable TCL_LIB_SPEC will be set to the value
-    # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
-    # instead of TCL_BUILD_LIB_SPEC since it will work with both an
-    # installed and uninstalled version of Tcl.
-    #
-
-    if test -f $TCL_BIN_DIR/Makefile ; then
-      TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
-      TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
-      TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
-    fi
-
-    #
-    # eval is required to do the TCL_DBGX substitution
-    #
-
-    eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
-    eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
-    eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
-
-    eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
-    eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
-    eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-  fi
-fi
-if test "${use_tcl}" = "no" ; then
-  HAVE_TCL=""
-else
-  HAVE_TCL=1
-fi
-
-
 ##########
 # Figure out what C libraries are required to compile programs
 # that use "readline()" library.
index 9d8c594bae6dda9e38707468349d189814468f8d..404a80bffd329054fcba9bf7c740be56a90a6a81 100644 (file)
@@ -116,37 +116,71 @@ AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_s
 USE_AMALGAMATION=1
 
 #########
-# See whether we can run specific tclsh versions known to work well;
-# if not, then we fall back to plain tclsh.
-# TODO: try other versions before falling back?
+# Figure out all the name of a working tclsh and parameters needed to compile against Tcl.
+# The --with-tcl= configuration parameter might be useful for this.
 #
+AC_ARG_WITH(tclsh, AS_HELP_STRING([--with-tclsh=PATHNAME],[full pathname of a tclsh to use]))
+AC_ARG_WITH(tcl, AS_HELP_STRING([--with-tcl=DIR],[directory containing (tclConfig.sh)]))
+if test x"${with_tclsh}" == x -a x"${with_tcl}" == x; then
+  AC_CHECK_PROGS(TCLSH_CMD, [tclsh8.6 tclsh tclsh9.0],none)
+  with_tclsh=${TCLSH_CMD}
+fi
+if test x"${with_tclsh}" != x -a x"${with_tclsh}" != xnone; then
+  TCLSH_CMD=${with_tclsh}
+  AC_MSG_RESULT([using tclsh at "$TCLSH_CMD"])
+  with_tcl=`${with_tclsh} <${srcdir}/tool/find_tclconfig.tcl`
+  AC_MSG_RESULT([$TCLSH_CMD recommends the tclConfig.sh at ${with_tcl}])
+fi
 if test x"${with_tcl}" != x; then
-  if test -r ${with_tcl}/tclConfig.sh; then
-    AC_MSG_ERROR([no tclConfig.sh file found in --with-tcl: ${with_tcl}])
+  if test -r ${with_tcl}/tclConfig.sh; then
+    tclconfig="${with_tcl}/tclConfig.sh"
   else
-    . ${with_tcl}/tclConfig.sh
+    if test -r ${with_tcl}/tcl8.6/tclConfig.sh; then
+      tclconfig="${with_tcl}/tcl8.6/tclConfig.sh"
+    else
+      AC_MSG_ERROR([no tclConfig.sh file found in ${with_tcl} or ${with_tcl}/tcl8.6])
+    fi
+  fi
+  if test x"${tclconfig}" != x; then
+    AC_MSG_RESULT([loading TCL configuration from ${tclconfig}])
+    . ${tclconfig}
+    AC_SUBST(TCL_VERSION)
+    AC_SUBST(TCL_BIN_DIR)
+    AC_SUBST(TCL_SRC_DIR)
+    AC_SUBST(TCL_INCLUDE_SPEC)
+    AC_SUBST(TCL_LIB_FILE)
+    AC_SUBST(TCL_LIB_FLAG)
+    AC_SUBST(TCL_LIB_SPEC)
+    AC_SUBST(TCL_STUB_LIB_FILE)
+    AC_SUBST(TCL_STUB_LIB_FLAG)
+    AC_SUBST(TCL_STUB_LIB_SPEC)
+    AC_SUBST(TCL_SHLIB_SUFFIX)
+  fi
+  if test x"$TCLSH_CMD" == x; then
     TCLSH_CMD=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION}
     if test ! -x ${TCLSH_CMD}; then
-      AC_MSG_WARN([cannot use tclsh at: ${TCLSH_CMD}])
-      TCLSH_CMD=none
+      TCLSH_CMD_2=${TCL_EXEC_PREFIX}/bin/tclsh
+      if test ! -x ${TCLSH_CMD_2}; then
+        AC_MSG_WARN([cannot find a usable tclsh at either ${TCLSH_CMD} or ${TCLSH_CMD_2}])
+        TCLSH_CMD=none
+      else
+        TCLSH_CMD=${TCLSH_CMD_2}
+      fi
     fi
   fi
-else
-  AC_CHECK_PROGS(TCLSH_CMD, [tclsh8.6 tclsh8.5 tclsh], none)
 fi
 if test "$TCLSH_CMD" = "none"; then
   # If we can't find a local tclsh, then building the amalgamation will fail.
   # We act as though --disable-amalgamation has been used.
-  echo "Warning: can't find tclsh - defaulting to non-amalgamation build."
+  AC_MSG_WARN([Warning: can't find tclsh - defaulting to non-amalgamation build.])
   USE_AMALGAMATION=0
   TCLSH_CMD="tclsh"
-fi
-if test x"$TCLSH_CMD" = x; then
-  AC_MSG_ERROR([cannot find a usable tclsh])
+  HAVE_TCL=0
 else
-  AC_MSG_RESULT([using $TCLSH_CMD])
+  HAVE_TCL=1
 fi
 AC_SUBST(TCLSH_CMD)
+AC_SUBST(HAVE_TCL)
 
 AC_ARG_VAR([TCLLIBDIR], [Where to install tcl plugin])
 if test "x${TCLLIBDIR+set}" != "xset" ; then
@@ -357,190 +391,6 @@ AC_SUBST(SQLITE_OS_UNIX)
 AC_SUBST(SQLITE_OS_WIN)
 AC_SUBST(TARGET_EXEEXT)
 
-##########
-# Figure out all the parameters needed to compile against Tcl.
-#
-# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
-# macros in the in the tcl.m4 file of the standard TCL distribution.
-# Those macros could not be used directly since we have to make some
-# minor changes to accomodate systems that do not have TCL installed.
-#
-AC_ARG_ENABLE(tcl, AS_HELP_STRING([--disable-tcl],[do not build TCL extension]),
-      [use_tcl=$enableval],[use_tcl=yes])
-if test "${use_tcl}" = "yes" ; then
-  AC_ARG_WITH(tcl, AS_HELP_STRING([--with-tcl=DIR],[directory containing tcl configuration (tclConfig.sh)]), with_tclconfig=${withval})
-  AC_MSG_CHECKING([for Tcl configuration])
-  AC_CACHE_VAL(ac_cv_c_tclconfig,[
-    # First check to see if --with-tcl was specified.
-    if test x"${with_tclconfig}" != x ; then
-      if test -f "${with_tclconfig}/tclConfig.sh" ; then
-        ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
-      else
-        AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
-      fi
-    fi
-
-    # Start autosearch by asking tclsh
-    if test x"${ac_cv_c_tclconfig}" = x ; then
-      if test x"$cross_compiling" = xno; then
-        for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}`
-        do
-          if test -f "$i/tclConfig.sh" ; then
-            ac_cv_c_tclconfig="$i"
-            break
-          fi
-        done
-      fi
-    fi
-
-    # On ubuntu 14.10, $auto_path on tclsh is not quite correct.
-    # So try again after applying corrections.
-    if test x"${ac_cv_c_tclconfig}" = x ; then
-      if test x"$cross_compiling" = xno; then
-        for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD} | sed 's,/tcltk/tcl,/tcl,g'`
-        do
-          if test -f "$i/tclConfig.sh" ; then
-            ac_cv_c_tclconfig="$i"
-            break
-          fi
-        done
-      fi
-    fi
-
-    # Recent versions of Xcode on Macs hid the tclConfig.sh file
-    # in a strange place.
-    if test x"${ac_cv_c_tclconfig}" = x ; then
-      if test x"$cross_compiling" = xno; then
-        for i in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX*.sdk/usr/lib
-        do
-          if test -f "$i/tclConfig.sh" ; then
-            ac_cv_c_tclconfig="$i"
-            break
-          fi
-        done
-      fi
-    fi
-
-    # then check for a private Tcl installation
-    if test x"${ac_cv_c_tclconfig}" = x ; then
-      for i in \
-            ../tcl \
-            `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
-            `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
-            `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
-            ../../tcl \
-            `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
-            `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
-            `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
-            ../../../tcl \
-            `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
-            `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
-            `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
-      do
-        if test -f "$i/unix/tclConfig.sh" ; then
-          ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
-          break
-        fi
-      done
-    fi
-
-    # check in a few common install locations
-    if test x"${ac_cv_c_tclconfig}" = x ; then
-      for i in \
-            `ls -d ${libdir} 2>/dev/null` \
-            `ls -d /usr/local/lib 2>/dev/null` \
-            `ls -d /usr/contrib/lib 2>/dev/null` \
-            `ls -d /usr/lib 2>/dev/null`
-      do
-        if test -f "$i/tclConfig.sh" ; then
-           ac_cv_c_tclconfig=`(cd $i; pwd)`
-           break
-        fi
-      done
-    fi
-
-    # check in a few other private locations
-    if test x"${ac_cv_c_tclconfig}" = x ; then
-      for i in \
-         ${srcdir}/../tcl \
-         `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
-         `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
-         `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
-      do
-        if test -f "$i/unix/tclConfig.sh" ; then
-          ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
-          break
-        fi
-      done
-    fi
-  ])
-
-  if test x"${ac_cv_c_tclconfig}" = x ; then
-    use_tcl=no
-    AC_MSG_WARN(Can't find Tcl configuration definitions)
-    AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
-    AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
-  else
-    TCL_BIN_DIR=${ac_cv_c_tclconfig}
-    AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
-
-    AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
-    if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
-      AC_MSG_RESULT([loading])
-      . $TCL_BIN_DIR/tclConfig.sh
-    else
-      AC_MSG_RESULT([file not found])
-    fi
-    
-    #
-    # If the TCL_BIN_DIR is the build directory (not the install directory),
-    # then set the common variable name to the value of the build variables.
-    # For example, the variable TCL_LIB_SPEC will be set to the value
-    # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
-    # instead of TCL_BUILD_LIB_SPEC since it will work with both an
-    # installed and uninstalled version of Tcl.
-    #
-    
-    if test -f $TCL_BIN_DIR/Makefile ; then
-      TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
-      TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
-      TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
-    fi
-    
-    #
-    # eval is required to do the TCL_DBGX substitution
-    #
-    
-    eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
-    eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
-    eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
-    
-    eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
-    eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
-    eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
-    
-    AC_SUBST(TCL_VERSION)
-    AC_SUBST(TCL_BIN_DIR)
-    AC_SUBST(TCL_SRC_DIR)
-    AC_SUBST(TCL_INCLUDE_SPEC)
-    
-    AC_SUBST(TCL_LIB_FILE)
-    AC_SUBST(TCL_LIB_FLAG)
-    AC_SUBST(TCL_LIB_SPEC)
-    
-    AC_SUBST(TCL_STUB_LIB_FILE)
-    AC_SUBST(TCL_STUB_LIB_FLAG)
-    AC_SUBST(TCL_STUB_LIB_SPEC)
-    AC_SUBST(TCL_SHLIB_SUFFIX)
-  fi
-fi
-if test "${use_tcl}" = "no" ; then
-  HAVE_TCL=""
-else
-  HAVE_TCL=1
-fi
-AC_SUBST(HAVE_TCL)
-
 ##########
 # Figure out what C libraries are required to compile programs
 # that use "readline()" library.
index 488738897e87c0f1f95f469eb4298bef228fb0e6..19bf09ec46428ff92151f13efd5eb1b6652c2223 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Include\sa\stest\scase\ssummary\sin\sthe\soutput\sof\s"errors"\sin\stestrunner.tcl.
-D 2024-08-01T14:43:27.026
+C Clean\sup\sand\srestructure\sthe\sTCL\sconfiguration\ssections\sin\sautoconf.\nThe\snew\s--with-tclsh=FILE\soption\slets\syou\sselect\sthe\sspecific\stclsh\nthat\syou\swant\sto\srun.
+D 2024-08-01T18:10:00.524
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -35,8 +35,8 @@ F autoconf/tea/win/nmakehlp.c b01f822eabbe1ed2b64e70882d97d48402b42d2689a1ea0034
 F autoconf/tea/win/rules.vc 7b3bb2ef32ade0f3f14d951231811678722725e3bca240dd9727ae0dfe10f6a5
 F config.guess 883205ddf25b46f10c181818bf42c09da9888884af96f79e1719264345053bd6
 F config.sub c2d0260f17f3e4bc0b6808fccf1b291cb5e9126c14fc5890efc77b9fd0175559
-F configure e0efd210b151971f4158e3fdf93b34322882a668a96f88b6167a6f7a51edebec x
-F configure.ac 7361a1dd862c0ba0d2daa3d978bc3b93fcccc1ef3efe204d0238722c19bbdcf5
+F configure 7657b4eaced7589ee0259f7c99ca0b71fe3d47b7fdcc13844b64f77d3084c082 x
+F configure.ac 6c41bb7a160c3c057af689f5fbf44bd290ccf2fb68be63b3f8d6a9062b224832
 F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
 F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd
 F doc/compile-for-windows.md e8635eea9153dcd6a51fd2740666ebc4492b3813cb1ac31cd8e99150df91762d
@@ -2104,6 +2104,7 @@ F tool/enlargedb.c 3e8b2612b985cfa7e3e8800031ee191b43ae80de96abb5abbd5eada62651e
 F tool/extract-sqlite3h.tcl 069ceab0cee26cba99952bfa08c0b23e35941c837acabe143f0c355d96c9e2eb x
 F tool/extract.c 054069d81b095fbdc189a6f5d4466e40380505e2
 F tool/fast_vacuum.c c129ae2924a48310c7b766810391da9e8fda532b9f6bd3f9a9e3a799a1b42af9
+F tool/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e
 F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439
 F tool/fuzzershell.c 41480c8a1e4749351f381431ecfdfceba645396c5d836f8d26b51a33c4a21b33
 F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4
@@ -2200,8 +2201,11 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 03b7f99229cfcffde024915e6812d75ae11318db9dc93a00838e4588a79b1243
-R 08e6905a776f74e196253ed63d164e48
+P 173df1478e89996126e172656e35da8026d4ef145b2341ef56213f00ade14f48
+R 9276dc9ad744c7eb260be766cc2b74e8
+T *branch * autoconf-revamp
+T *sym-autoconf-revamp *
+T -sym-trunk *
 U drh
-Z 096dcbc7b2b21544af81d2d7e8439d72
+Z c7858b737379341436d4877837104339
 # Remove this line to create a well-formed Fossil manifest.
index 7d0cd49d410a54c2d0eed92a7bba5fd66eba3311..0be9acc96b8b7fd4c6ddb625c9da0c967a309c28 100644 (file)
@@ -1 +1 @@
-173df1478e89996126e172656e35da8026d4ef145b2341ef56213f00ade14f48
+8fafc679d91e857602fbbe203144ca98242246660ede5a49c5fec8aaff571151
diff --git a/tool/find_tclconfig.tcl b/tool/find_tclconfig.tcl
new file mode 100644 (file)
index 0000000..c3d3df8
--- /dev/null
@@ -0,0 +1,24 @@
+#
+# Run this TCL script to find and print the pathname for the tclConfig.sh
+# file.  Used by ../configure
+#
+if {[catch {
+  set libdir [tcl::pkgconfig get libdir,install]
+}]} {
+  puts stderr "tclsh too old:  does not support tcl::pkgconfig"
+  exit 1
+}
+if {![file exists $libdir]} {
+  puts stderr "tclsh reported library directory \"$libdir\" does not exist"
+  exit 1
+}
+if {![file exists $libdir/tclConfig.sh]} {
+  set n1 $libdir/tcl$::tcl_version
+  if {[file exists $n1/tclConfig.sh]} {
+    set libdir $n1
+  } else {
+    puts stderr "cannot find tclConfig.sh in either $libdir or $n1"
+    exit 1
+  }
+}
+puts $libdir