OSDN Git Service

2010-01-06 Tristan Gingold <gingold@adacore.com>
[pf3gnuchains/pf3gnuchains3x.git] / libgui / configure.ac
1 dnl Process this file with autoconf to produce configure.
2
3 AC_INIT(src/subcommand.h)
4 AM_INIT_AUTOMAKE(libgui, 0.0)
5 AM_CONFIG_HEADER(config.h)
6 AM_MAINTAINER_MODE
7 AC_CANONICAL_HOST
8 AC_PROG_CC
9 AC_EXEEXT
10 AC_OBJEXT
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
18 AC_FUNC_ALLOCA
19 AC_HAVE_HEADERS(stddef.h stdlib.h getopt.h unistd.h fcntl.h sys/file.h sys/wait.h string.h strings.h)
20 AC_CHECK_FUNCS(raise)
21
22 AC_ARG_ENABLE(ide, [  --enable-ide            Enable IDE support],
23 [case "${enableval}" in
24   yes) ide=yes ;;
25   no)  ide=no ;;
26   *)   AC_MSG_ERROR(bad value ${enableval} for enable-ide option) ;;
27 esac],
28 [ide=no])
29 AM_CONDITIONAL(IDE_ENABLED, test x$ide = xyes)
30 if test x$ide = xyes; then
31   AC_DEFINE(IDE_ENABLED)
32 fi
33
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)
37
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
40 dnl here.
41 AC_EGREP_CPP(strncasecmp, [#include <string.h>],
42   AC_DEFINE(HAVE_STRNCASECMP_DECL))
43
44
45 AC_CACHE_CHECK([for cygwin32], ide_cv_os_cygwin32,
46 [AC_EGREP_CPP(lose, [
47 #ifdef __CYGWIN32__
48 lose
49 #endif],[ide_cv_os_cygwin32=yes],[ide_cv_os_cygwin32=no])])
50 ac_win_build="no"
51 if test x$ide_cv_os_cygwin32 = xyes; then
52   ac_win_build="yes"
53 fi
54
55 case "${host}" in
56 *-*-cygwin*)
57         touch ac$$.c
58         if ${CC} -c -mwin32 ac$$.c >/dev/null 2>&1; then
59             case "$LIBGUI_CFLAGS" in
60                 *-mwin32*) ;;
61                 *) LIBGUI_CFLAGS="-mwin32 $LIBGUI_CFLAGS" ;;
62             esac
63         fi
64         rm -f ac$$.o ac$$.c
65         ;;
66 esac
67 case "${host}" in
68 *-*-cygwin*)
69         LIBGUI_CFLAGS="-DWIN32 $LIBGUI_CFLAGS" ;;
70 esac
71 AC_SUBST(LIBGUI_CFLAGS) 
72
73 tmp="`cd $srcdir/library; pwd`"
74 if test x"$ac_cv_prog_CC" = xcl ; then
75   tmp2="`cygpath --windows $tmp`"
76   LIBGUI_LIBRARY_DIR="`echo $tmp2 | sed -e s#\\\\\\\\#/#g`"
77 else
78   LIBGUI_LIBRARY_DIR=$tmp
79 fi
80 AC_SUBST(LIBGUI_LIBRARY_DIR)
81
82 # Check for Tcl and Tk.
83 SC_PATH_TCLCONFIG
84 SC_LOAD_TCLCONFIG
85 SC_PATH_TKCONFIG
86 SC_LOAD_TKCONFIG
87
88 here=`pwd`
89 cd ${srcdir}/..
90 topdir=`pwd`
91 cd ${here}
92
93 if test "${TCL_SRC_DIR}" = "${topdir}/tcl"; then
94   # Using in-tree Tcl/Tk
95   case "${host}" in
96     *-*-cygwin*) platDir="win" ;;
97     *) platDir="unix" ;;
98   esac
99
100   TCL_INCLUDES="-I${TCL_SRC_DIR}/generic -I${TCL_SRC_DIR}/${platDir}"
101   TCL_LIBRARY=${TCL_BUILD_LIB_SPEC}
102   TK_INCLUDES="-I${TK_SRC_DIR}/generic -I${TK_SRC_DIR}/${platDir}"
103   TK_LIBRARY=${TK_BUILD_LIB_SPEC}
104 else
105   # Using installed Tcl/Tk
106   CY_AC_TCL_PRIVATE_HEADERS
107   CY_AC_TK_PRIVATE_HEADERS
108   TCL_INCLUDES="${TCL_INCLUDE_SPEC} ${TCL_PRIVATE_INCLUDE}"
109   TCL_LIBRARY=${TCL_LIB_SPEC}
110   TK_INCLUDES="${TK_INCLUDE_SPEC} ${TK_PRIVATE_INCLUDE}"
111   TK_LIBRARY=${TK_LIB_SPEC}
112 fi
113
114 AC_SUBST(TCL_DEFS)
115 AC_SUBST(TCL_INCLUDES)
116 AC_SUBST(TK_DEFS)
117 AC_SUBST(TK_INCLUDES)
118 AC_SUBST(TK_XINCLUDES)
119 AC_SUBST(TCL_LIBS)
120 AC_SUBST(TK_LIBRARY)
121 AC_SUBST(TCL_LIBRARY)
122 AC_SUBST(TK_LIBS)
123
124 AM_CONDITIONAL(TCL_SHARED, test x$TCL_SHARED_BUILD = x1)
125
126 AC_SUBST(RPATH_ENVVAR)
127
128 AC_OUTPUT([Makefile library/Makefile src/Makefile])
129
130
131