Parent: [bd2fef] (diff)

Child: [e4c2b6] (diff)

Download this file

configure.in    349 lines (298 with data), 9.6 kB

AC_INIT(mysqltcl.c)

VERSION=`cat VERSION`
AC_SUBST(VERSION)

AC_PROG_INSTALL

# 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=""
    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=""
    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")
   exit 1
fi

###########
# 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 64 && is64=yes

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

    if test $is64 = "yes" ; then
       candidates="$rootdist/lib64/tcl$tclversion $rootdist/lib64"
    else
       candidates="$rootdist/lib/tcl$tclversion $rootdist/lib "
    fi
    tclConfigSH=""
    for dir in $candidates; do
        test -f $dir/tclConfig.sh && 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 "$kconfig"; 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"
    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. Need to execute a script for this, things have
# become complicated
PACKAGEDIR=`$tclsh findpkgdir.tcl`/sqlsc/
AC_SUBST(PACKAGEDIR)
AC_MSG_RESULT(Will install to $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)


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

echo "TCL_LD_SEARCH_FLAGS: $TCL_LD_SEARCH_FLAGS"

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_XINCLUDES)
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 includes and libs. The user can specify where they are, 
# else we try to find them

# 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

AC_SUBST(MYSQLINCSW)
AC_SUBST(MYSQLLIBSW)
AC_SUBST(MYSQLLIBDIR)

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

AC_OUTPUT(Makefile)