Switch to side-by-side view

--- a/configure.in
+++ b/configure.in
@@ -5,6 +5,7 @@
 
 AC_PROG_INSTALL
 
+############################################## TCL/TK config
 # Looking for tclConfig and tkConfig to set all defaults
 # this is an awful mess because this not always found in the same
 # place, especially on systems where tcl and/or tk are part of the
@@ -33,7 +34,7 @@
     AC_MSG_CHECKING(for tclsh)
     AC_MSG_RESULT($tclsh)
 else
-    tclsh_list=""
+    tclsh_list="tclsh"
     for v in $tcl_versions "" ; do
         tclsh_list="$tclsh_list tclsh$v"
     done
@@ -59,7 +60,7 @@
     AC_MSG_CHECKING(for wish)
     AC_MSG_RESULT($wish)
 else
-    wish_list=""
+    wish_list="wish"
     for v in $tk_versions "" ; do
         wish_list="$wish_list wish$v"
     done
@@ -76,13 +77,12 @@
 changequote(,)
 tkversion=`echo 'puts stdout [info tclversion];flush stdout;exit' | $wish`
 changequote([,])
-
 if test "$tclversion" != "$tkversion" ; then
    AC_MSG_ERROR("Different versions for tclsh and wish: $tclversion and $tkvesion")
-   exit 1
-fi
-
-###########
+fi
+AC_MSG_NOTICE([Tcl version: $tclversion])
+
+######
 # Finding tclConfig.sh and tkConfig.sh. This is a mess, there is no
 # standard way to do it, these files may not even be installed on the
 # system (happens). In this case you have to recompile and install standard
@@ -130,13 +130,11 @@
 
 AC_MSG_RESULT($tclConfigSH)
 
-
-
 #### Look for tkConfig.sh
 AC_MSG_CHECKING(for tkConfig.sh)
 AC_ARG_WITH(tkconfig,
-[  --with-tkconfig=<path>  directory that contains tkConfig.sh],
-tkconfig="$withval")
+    [  --with-tkconfig=<path>  directory that contains tkConfig.sh],
+    tkconfig="$withval")
 
 if test -n "$kconfig"; then
     tkConfigSH="$tkconfig/tkConfig.sh"
@@ -174,41 +172,27 @@
 
 AC_MSG_RESULT($tkConfigSH)
 
-# Find a place to install. Need to execute a script for this, things have
-# become complicated
+###########
+# Find a place to install to. Need to execute a script for this, things
+# have become complicated
+AC_MSG_CHECKING([for an appropriate Sqlscreens installation directory])
 PACKAGEDIR=`$tclsh findpkgdir.tcl`/sqlsc/
 AC_SUBST(PACKAGEDIR)
-AC_MSG_RESULT(Will install to $PACKAGEDIR)
+AC_MSG_RESULT([$PACKAGEDIR])
 
 #### Load the Tcl/Tk configuration files 
 . $tclConfigSH
 . $tkConfigSH
 
-
-# Directories for include files
-TCL_INCLUDE_DIR=none
-dirs="$TCL_PREFIX/include/tcl$TCL_VERSION $TCL_PREFIX/include"
-for d in $dirs ;do
-  if test -f $d/tcl.h ; then 
-    TCL_INCLUDE_DIR=$d;break
-  fi
-done
-if test x$TCL_INCLUDE_DIR = x ; then
-  AC_MSG_ERROR([I could not find tcl.h (looked in $dirs)])
-fi
-AC_SUBST(TCL_INCLUDE_DIR)
-
-TK_INCLUDE_DIR=none
-dirs="$TK_PREFIX/include/tk$TK_VERSION $TK_PREFIX/include"
-for d in $dirs ;do
-  if test -f $d/tk.h ; then 
-    TK_INCLUDE_DIR=$d;break
-  fi
-done
-if test x$TK_INCLUDE_DIR = x ; then
-  AC_MSG_ERROR([I could not find tk.h (looked in $dirs)])
-fi
-AC_SUBST(TK_INCLUDE_DIR)
+if test X$TCL_INCLUDE_SPEC = X; then
+   AC_MSG_ERROR([tclConfig.sh does not define TCL_INCLUDE_SPEC])
+fi
+AC_SUBST(TCL_INCLUDE_SPEC)
+
+if test x$TK_INCLUDE_SPEC = x ; then
+  AC_MSG_ERROR([tcl/tkConfig.sh do not define TK_INCLUDE_SPEC])
+fi
+AC_SUBST(TK_INCLUDE_SPEC)
 
 
 CC=${CC:-$TCL_CC}
@@ -216,14 +200,14 @@
 # Under solaris, if compiling with gcc, have to add the right gcc to
 # the link command line for the dynamic obj
 if test -x /usr/bin/uname ; then
-if test `/usr/bin/uname` = SunOS ; then
-AC_PROG_CC
-if test "A$GCC" = "Ayes" ; then 
-    set `$CC -v 2>&1 | grep 'Reading specs'`
-    GCCLIBDIR=-L`/usr/bin/dirname $4`
-    GCCLIB=-lgcc
-fi
-fi
+  if test `/usr/bin/uname` = SunOS ; then
+    AC_PROG_CC
+    if test "A$GCC" = "Ayes" ; then 
+      set `$CC -v 2>&1 | grep 'Reading specs'`
+      GCCLIBDIR=-L`/usr/bin/dirname $4`
+      GCCLIB=-lgcc
+    fi
+  fi
 fi
 
 # If the link prog is ld, check the rpath opt, it's sometimes wrong in 
@@ -239,8 +223,6 @@
   ;;
 esac
 
-echo "TCL_LD_SEARCH_FLAGS: $TCL_LD_SEARCH_FLAGS"
-
 WISH=$wish
 
 AC_SUBST(CC)
@@ -253,7 +235,6 @@
 AC_SUBST(TCL_SHLIB_SUFFIX)
 AC_SUBST(TCL_SHLIB_LD)
 AC_SUBST(TCL_VERSION)
-AC_SUBST(TCL_XINCLUDES)
 AC_SUBST(TCL_PREFIX)
 AC_SUBST(TCL_EXEC_PREFIX)
 AC_SUBST(TCL_CFLAGS)
@@ -273,74 +254,41 @@
 AC_SUBST(TK_LIB_SPEC)
 AC_SUBST(WISH) 
 
+###################################################### MySQL
 # Mysql includes and libs. The user can specify where they are, 
 # else we try to find them
 
+# Enable use of mysql. This needs libmysqlclient, so it can be disabled for
+# people which don't need/want to install mysql. Other dbs depend on
+# run-time detection of the appropriate tcl module.
+AC_ARG_ENABLE(mysql,
+    AC_HELP_STRING([--disable-mysql],
+    [Disable mysql interface. Avoids having to install libmysqlclient-dev.]),
+    mysqlEnabled=$enableval, mysqlEnabled=yes)
+
+if test X$mysqlEnabled = Xyes ; then
+  NOMYSQL=""
+else
+  NOMYSQL="#"
+fi
+AC_SUBST(NOMYSQL)
+
+if test X$mysqlEnabled = Xyes ; then
+ 
 # Use mysql_config if available
 AC_PATH_PROGS(mysqlconf, mysql_config)
 if test -z "$mysqlconf" ; then
    AC_MSG_ERROR([mysql_config not found])
 fi
 
-AC_ARG_WITH(mysql-libs,
-    [ --with-mysql-libs    Specify directory to search for mysql client libs.],
-    [ mysql_libs=$withval ],
-    [ mysql_libs=no ]
-    )
-
-# The MySQL library directory is needed for the dynlink search path? It's
-# not given by mysql_config.
-if test "$mysql_libs" != "no" ; then 
-    MYSQLLIBDIR=$mysql_libs
-else
-    MYSQLLIBDIR=`$mysqlconf --libs | awk '{print $1}'`
-    case A"$MYSQLLIBDIR" in
-    A-L*) MYSQLLIBDIR=`echo $MYSQLLIBDIR | sed -e 's/-L//'`;;
-    *) MYSQLLIBDIR="";;
-    esac
-    if test -z "$MYSQLLIBDIR" ; then
-       AC_MSG_ERROR([Sorry, can't find mysql libmysqlclient.a. 
-       Check that the mysql development libraries are installed or
-       try using --with-mysql-libs])
-    fi
-fi
-
 MYSQLLIBSW=`$mysqlconf --libs`
-
-AC_ARG_WITH(mysql-includes,
-    [ --with-mysql-includes  Specify directory to search for mysql .h files.],
-    [ mysql_includes=$withval ],
-    [ mysql_includes=no ]
-    )
-
-if test "$mysql_includes" != "no" ; then
-    MYSQLINCSW=-I$mysql_includes
-else
-    # If the new mysql_config utility is available, use it
-    if test ! -z "$mysqlconf"; then
-        MYSQLINCSW=`$mysqlconf --cflags`
-    else 
-      # libs can be like local/lib/mysql or local/mysql/lib, not the same
-      # way to compute the include file directory...  
-      if test `expr $MYSQLLIBDIR : '.*mysql/lib'` -eq 0; then
-        MYSQLINCDIR=$MYSQLLIBDIR/../../include/mysql
-      else
-        MYSQLINCDIR=$MYSQLLIBDIR/../include
-      fi  
-      if test ! -f "$MYSQLINCDIR/mysql.h" ; then
-        echo "Sorry, can't find mysql.h"
-        echo "I searched in: $MYSQLINCDIR"
-        echo "Check that the mysql development files are installed and"
-        echo "try using --with-mysql-includes"
-        exit 1
-      fi
-      MYSQLINCSW=-I${MYSQLINCDIR}
-   fi
-fi
+MYSQLINCSW=`$mysqlconf --cflags`
 
 AC_SUBST(MYSQLINCSW)
 AC_SUBST(MYSQLLIBSW)
-AC_SUBST(MYSQLLIBDIR)
+
+fi
+# end mysql optional section
 
 AC_EGREP_HEADER(gethostname, unistd.h,,AC_DEFINE(HASNO_GETHOSTNAME_PROTO))