Parent: [640bdb] (diff)

Download this file

configure.in    299 lines (254 with data), 8.4 kB

AC_INIT(mysqltcl.c)

VERSION=`cat VERSION`
AC_SUBST(VERSION)

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
# standard install (then there under /usr, not /usr/local). 
# We look for executable tclsh and wish in the PATH and use this to get the
# name for the library directories, then use tclConfig.sh/tkConfig.sh from
# there to get to the variables

AC_CHECKING(Tcl/Tk installation)

tclversion=none
AC_ARG_WITH(tclversion,[  --with-tclversion=<x.y>     tclsh version number],
        tclversion="$withval")
if test x$tclversion = xnone ; then
   tk_versions="8.7 8.6 8.5 8.4 8.3 8.2"
   tcl_versions="8.7 8.6 8.5 8.4 8.3 8.2"
else
   tk_versions=$tclversion
   tcl_versions=$tclversion
fi

#### Find tclsh
AC_ARG_WITH(tclsh,[  --with-tclsh=<path>     full path name of tclsh],
        tclsh="$withval")
if test -n "$tclsh"; then
    AC_MSG_CHECKING(for tclsh)
    AC_MSG_RESULT($tclsh)
else
    tclsh_list="tclsh"
    for v in $tcl_versions "" ; do
        tclsh_list="$tclsh_list tclsh$v"
    done
    #echo "tclsh_list=$tclsh_list"
    # Look for tclsh variants in $prefix/bin, and then in $PATH.
    AC_PATH_PROGS(tclsh, $tclsh_list)
fi
if test -z "$tclsh"; then
    AC_MSG_ERROR([I could not find tclsh in your search PATH.
Please supply the location of a tclsh executable by
running configure with the following option
        --with-tclsh=<full path name of tclsh>])
fi

changequote(,)
tclversion=`echo 'puts stdout [info tclversion]' | $tclsh`
changequote([,])

#### Find wish
AC_ARG_WITH(wish,[  --with-wish=<path>     full path name of wish],
        wish="$withval")
if test -n "$wish"; then
    AC_MSG_CHECKING(for wish)
    AC_MSG_RESULT($wish)
else
    wish_list="wish"
    for v in $tk_versions "" ; do
        wish_list="$wish_list wish$v"
    done
    # Look for wish variants in $prefix/bin, and then in $PATH.
    AC_PATH_PROGS(wish,$wish_list)
fi
if test -z "$wish"; then
  AC_MSG_ERROR([I could not find wish in your search PATH.
Please supply the location of a wish executable by
running configure with the following option
        --with-wish=<full path name of wish>])
fi

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")
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
# tcl and tk distribs.

#### Find tclConfig.sh
AC_MSG_CHECKING(for tclConfig.sh)
AC_ARG_WITH(tclconfig,
[  --with-tclconfig=<path> directory that contains tclConfig.sh],
tclconfig="$withval")

if test -n "$tclconfig"; then
    tclConfigSH="$tclconfig/tclConfig.sh"
else
    changequote(,)
    tclpkgpath=`echo 'puts stdout [set tcl_pkgPath]' | $tclsh`
    changequote([,])

    # 64 bits distrib ?
    is64=no
    echo $tclpkgpath | grep -s -q 64 && is64=yes

    # root of distribution (2 levels above exec path)
    rootdist=`dirname $tclsh`
    rootdist=`dirname $rootdist`
    echo;echo rootdist $rootdist is64 $is64
    if test $is64 = "yes" ; then
       candidates="$rootdist/lib64/tcl$tclversion $rootdist/lib64 $rootdist/lib/tcl$tclversion $rootdist/lib"
    else
       candidates="$rootdist/lib/tcl$tclversion $rootdist/lib "
    fi
    tclConfigSH=""
    for dir in $candidates; do
    	maybe=$dir/tclConfig.sh
    	echo testing $maybe
        test -f  $maybe && tclConfigSH=$dir/tclConfig.sh && break
    done
fi

if test -z "$tclConfigSH"; then
    AC_MSG_ERROR([I could not find tclConfig.sh.
Please specify the directory that contains tclConfig.sh
by running configure with the following option
  --with-tclconfig=<path name of directory containing tclConfig.sh>
])
fi

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")

if test -n "$tkconfig"; then
    tkConfigSH="$tkconfig/tkConfig.sh"
else
    changequote(,)
    tclpkgpath=`echo 'puts stdout [set tcl_pkgPath];flush stdout;exit' | $wish`
    changequote([,])

    # 64 bits distrib ?
    is64=no
    echo $tclpkgpath | grep -s 64 && is64=yes

    # root of distribution (2 levels above exec path)
    rootdist=`dirname $wish`
    rootdist=`dirname $rootdist`

    if test $is64 = "yes" ; then
       candidates="$rootdist/lib64/tk$tkversion $rootdist/lib64 $rootdist/lib/tk$tkversion $rootdist/lib"
    else
       candidates="$rootdist/lib/tk$tkversion $rootdist/lib "
    fi
    tkConfigSH=""
    for dir in $candidates; do
        test -f $dir/tkConfig.sh && tkConfigSH=$dir/tkConfig.sh && break
    done
fi

if test -z "$tkConfigSH"; then
    AC_MSG_ERROR([I could not find tkConfig.sh.
Please specify the directory that contains tclConfig.sh
by running configure with the following option
  --with-tkconfig=<path name of directory containing tkConfig.sh>
])
fi

AC_MSG_RESULT($tkConfigSH)

###########
# 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([$PACKAGEDIR])

#### Load the Tcl/Tk configuration files 
. $tclConfigSH
. $tkConfigSH

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}

# 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
fi

# If the link prog is ld, check the rpath opt, it's sometimes wrong in 
# tclconfig (in a form that would be suitable for cc)
case "$TCL_SHLIB_LD" in
  ld*)
    case "$TCL_LD_SEARCH_FLAGS" in
      -Wl*)
        TCL_LD_SEARCH_FLAGS=`echo $TCL_LD_SEARCH_FLAGS | \
                               sed -e 's/-Wl,//' -e 's/,/ /'`
      ;;			       
    esac
  ;;
esac

WISH=$wish

AC_SUBST(CC)
AC_SUBST(GCCLIB)
AC_SUBST(GCCLIBDIR)
AC_SUBST(INSTALL)
AC_SUBST(INSTALL_PROGRAM)
AC_SUBST(INSTALL_DATA)
AC_SUBST(TCL_SHLIB_CFLAGS)
AC_SUBST(TCL_SHLIB_SUFFIX)
AC_SUBST(TCL_SHLIB_LD)
AC_SUBST(TCL_VERSION)
AC_SUBST(TCL_PREFIX)
AC_SUBST(TCL_EXEC_PREFIX)
AC_SUBST(TCL_CFLAGS)
AC_SUBST(TCL_DEFS)
AC_SUBST(TCL_LIB_SPEC)
AC_SUBST(TCL_LIBS)
AC_SUBST(TCL_LD_FLAGS)
AC_SUBST(TCL_COMPAT_OBJS)
AC_SUBST(TCL_LD_SEARCH_FLAGS)
AC_SUBST(exec_prefix)
AC_SUBST(TK_VERSION)
AC_SUBST(TK_XINCLUDES)
AC_SUBST(TK_PREFIX)
AC_SUBST(TK_EXEC_PREFIX)
AC_SUBST(TK_DEFS)
AC_SUBST(TK_LIBS)
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

MYSQLLIBSW=`$mysqlconf --libs`
MYSQLINCSW=`$mysqlconf --cflags`

AC_SUBST(MYSQLINCSW)
AC_SUBST(MYSQLLIBSW)

fi
# end mysql optional section

AC_EGREP_HEADER(gethostname, unistd.h,,AC_DEFINE(HASNO_GETHOSTNAME_PROTO))

AC_OUTPUT(Makefile)