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, :)
17 AC_CHECK_PROG(ITCL_SH, itcl_sh, itcl_sh,
18 [\$\$here/\$(top_builddir)/../itcl/itcl/unix/itcl_sh\$(EXEEXT)])
21 AC_HAVE_HEADERS(stddef.h stdlib.h getopt.h unistd.h fcntl.h sys/file.h sys/wait.h string.h strings.h)
24 AC_ARG_ENABLE(ide, [ --enable-ide Enable IDE support],
25 [case "${enableval}" in
28 *) AC_MSG_ERROR(bad value ${enableval} for enable-ide option) ;;
31 AM_CONDITIONAL(IDE_ENABLED, test x$ide = xyes)
32 if test x$ide = xyes; then
33 AC_DEFINE(IDE_ENABLED)
36 # If we have random, assume we have srandom. If we have drand48,
37 # assume we have srand48. If we have rand, assume we have srand.
38 AC_CHECK_FUNCS(random drand48 rand, break)
40 dnl Tcl ensures that strncasecmp is provided everywhere. But in some
41 dnl situations we might need to declare it. We check for that case
43 AC_EGREP_CPP(strncasecmp, [#include <string.h>],
44 AC_DEFINE(HAVE_STRNCASECMP_DECL))
46 # Tcl8.1 requires writable strings for gcc
48 if test "$GCC" = "yes"; then
49 LIBGUI_CFLAGS=-fwritable-strings
54 AC_CACHE_CHECK([for cygwin32], ide_cv_os_cygwin32,
58 #endif],[ide_cv_os_cygwin32=yes],[ide_cv_os_cygwin32=no])])
60 if test x$ide_cv_os_cygwin32 = xyes; then
67 if ${CC} -c -mwin32 ac$$.c >/dev/null 2>&1; then
68 case "$LIBGUI_CFLAGS" in
70 *) LIBGUI_CFLAGS="-mwin32 $LIBGUI_CFLAGS" ;;
78 LIBGUI_CFLAGS="-DWIN32 $LIBGUI_CFLAGS" ;;
80 AC_SUBST(LIBGUI_CFLAGS)
82 tmp="`cd $srcdir/library; pwd`"
83 if test x"$ac_cv_prog_CC" = xcl ; then
84 tmp2="`cygpath --windows $tmp`"
85 LIBGUI_LIBRARY_DIR="`echo $tmp2 | sed -e s#\\\\\\\\#/#g`"
87 LIBGUI_LIBRARY_DIR=$tmp
89 AC_SUBST(LIBGUI_LIBRARY_DIR)
91 # Find the init.tcl file.
93 AC_MSG_CHECKING(for init.tcl)
94 AC_CACHE_VAL(ac_cv_c_tcl_libdir,[
95 dnl currently, only check the source tree
96 if test -f $srcdir/../tcl/library/init.tcl ; then
97 ac_cv_c_tcl_libdir=`cd $srcdir/../tcl/library; pwd`
98 elif test -f $srcdir/../tcl8.1/library/init.tcl; then
99 ac_cv_c_tcl_libdir=`cd $srcdir/../tcl8.1/library; pwd`
102 AC_MSG_RESULT(${ac_cv_c_tcl_libdir})
104 if test x"$ac_cv_prog_CC" = xcl; then
105 tmp2="`cygpath --windows $ac_cv_c_tcl_libdir`"
106 TCL_LIBRARY="`echo $tmp2 | sed -e s#\\\\\\\\#/#g`"
108 TCL_LIBRARY=$ac_cv_c_tcl_libdir
110 AC_SUBST(TCL_LIBRARY)
112 # Check for Tcl and Tk.
113 CYG_AC_PATH_TCLCONFIG
114 CYG_AC_LOAD_TCLCONFIG
118 # FIXME: consider only doing this if --with-x given.
125 AC_SUBST(TK_XINCLUDES)
127 AC_SUBST(TK_BUILD_LIB_SPEC)
128 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])