1 dnl Process this file with autoconf to produce configure.
3 AC_INIT(src/subcommand.h)
4 AM_INIT_AUTOMAKE(libgui, 0.0)
5 AM_CONFIG_HEADER(config.h)
11 AC_ARG_ENABLE(install-libgui, \
12 [ --enable-install-libgui Install libgui.a and library header files])
13 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
14 AM_CONDITIONAL(INSTALL_LIBGUI, test x$enable_install_libgui = xyes)
15 AC_CHECK_TOOL(RANLIB, ranlib, :)
16 AC_CHECK_TOOL(AR, ar, :)
19 AC_HAVE_HEADERS(stddef.h stdlib.h getopt.h unistd.h fcntl.h sys/file.h sys/wait.h string.h strings.h)
22 AC_ARG_ENABLE(ide, [ --enable-ide Enable IDE support],
23 [case "${enableval}" in
26 *) AC_MSG_ERROR(bad value ${enableval} for enable-ide option) ;;
29 AM_CONDITIONAL(IDE_ENABLED, test x$ide = xyes)
30 if test x$ide = xyes; then
31 AC_DEFINE(IDE_ENABLED)
34 # If we have random, assume we have srandom. If we have drand48,
35 # assume we have srand48. If we have rand, assume we have srand.
36 AC_CHECK_FUNCS(random drand48 rand, break)
38 dnl Tcl ensures that strncasecmp is provided everywhere. But in some
39 dnl situations we might need to declare it. We check for that case
41 AC_EGREP_CPP(strncasecmp, [#include <string.h>],
42 AC_DEFINE(HAVE_STRNCASECMP_DECL))
44 # Tcl8.1 requires writable strings for gcc
46 if test "$GCC" = "yes"; then
47 LIBGUI_CFLAGS=-fwritable-strings
52 AC_CACHE_CHECK([for cygwin32], ide_cv_os_cygwin32,
56 #endif],[ide_cv_os_cygwin32=yes],[ide_cv_os_cygwin32=no])])
58 if test x$ide_cv_os_cygwin32 = xyes; then
62 tmp="`cd $srcdir/library; pwd`"
63 if test x"$ac_cv_prog_CC" = xcl ; then
64 tmp2="`cygpath --windows $tmp`"
65 LIBGUI_LIBRARY_DIR="`echo $tmp2 | sed -e s#\\\\\\\\#/#g`"
67 LIBGUI_LIBRARY_DIR=$tmp
69 AC_SUBST(LIBGUI_LIBRARY_DIR)
71 # Find the init.tcl file.
73 AC_MSG_CHECKING(for init.tcl)
74 AC_CACHE_VAL(ac_cv_c_tcl_libdir,[
75 dnl currently, only check the source tree
76 if test -f $srcdir/../tcl/library/init.tcl ; then
77 ac_cv_c_tcl_libdir=`cd $srcdir/../tcl/library; pwd`
78 elif test -f $srcdir/../tcl8.1/library/init.tcl; then
79 ac_cv_c_tcl_libdir=`cd $srcdir/../tcl8.1/library; pwd`
82 AC_MSG_RESULT(${ac_cv_c_tcl_libdir})
84 if test x"$ac_cv_prog_CC" = xcl; then
85 tmp2="`cygpath --windows $ac_cv_c_tcl_libdir`"
86 TCL_LIBRARY="`echo $tmp2 | sed -e s#\\\\\\\\#/#g`"
88 TCL_LIBRARY=$ac_cv_c_tcl_libdir
92 # Check for Tcl and Tk.
98 # FIXME: consider only doing this if --with-x given.
100 CYG_AC_PATH_ITCLCONFIG
101 CYG_AC_LOAD_ITCLCONFIG
103 dnl what is the path to itclsh?
106 ITCL_DIR=itcl/itcl/win
108 if ${CC} -c -mwin32 ac$$.c >/dev/null 2>&1; then
109 case "$LIBGUI_CFLAGS" in
111 *) LIBGUI_CFLAGS="-mwin32 $LIBGUI_CFLAGS" ;;
116 *) ITCL_DIR=itcl/itcl/unix ;;
119 AC_SUBST(LIBGUI_CFLAGS)
124 AC_SUBST(TK_XINCLUDES)
126 AC_SUBST(TK_BUILD_LIB_SPEC)
127 AC_SUBST(TCL_BUILD_LIB_SPEC)
131 AM_CONDITIONAL(TCL_SHARED, test x$TCL_SHARED_BUILD = x1)
133 AC_SUBST(RPATH_ENVVAR)
135 AC_OUTPUT([Makefile library/Makefile src/Makefile])