summaryrefslogtreecommitdiffhomepage
path: root/configure.in
blob: 7c11f48fbf4c390010ee480ea6f27265eb19bd5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
#
# $Id: configure.in,v 1.23 2002/12/08 01:37:41 jao Exp $
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

AC_INIT(mixlib/mix.h)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(mdk,1.0)

AM_MAINTAINER_MODE

AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC

AM_PROG_LEX
AC_PROG_RANLIB

dnl i18n stuff
AM_GNU_GETTEXT_VERSION(0.11.5)
AM_GNU_GETTEXT

test "x$prefix" = xNONE && prefix=$ac_default_prefix

AC_DEFINE_UNQUOTED(LOCALEDIR, "${prefix}/share/locale")

dnl Check for readline and history
AC_ARG_WITH(readline,
[  --with-readline         build mixvm with readline support],
[case "${withval}" in
  yes) readl=true ;;
  no)  readl=false ;;
  *) AC_MSG_ERROR(bad value ${withval} for --with-readline) ;;
esac], [readl=true])

if test x$readl = xtrue; then
  AC_CHECK_LIB(ncurses, initscr, ,
               [AC_MSG_WARN(Cannot find ncurses lib); readl=false])
fi

if test x$readl = xtrue; then
  AC_CHECK_LIB(readline, readline, ,
               [AC_MSG_WARN(Cannot find GNU readline lib); readl=false])
fi

if test x$readl = xtrue; then
AC_CHECK_LIB(history, add_history, ,
             [AC_MSG_WARN(Cannot find GNU history lib); readl=false])
dnl old versions of readline use completion_matches instead
dnl of rl_completion_matches
AC_CHECK_FUNCS(rl_completion_matches,,)
fi

dnl Check for guile
AC_ARG_WITH(guile,
[  --with-guile         build MDK with Guile support],
[case "${withval}" in
  yes) wguile=true ;;
  no)  wguile=false ;;
  *) AC_MSG_ERROR(bad value ${withval} for --with-guile) ;;
esac], [wguile=true])

if test x$wguile = xtrue; then
  AC_MSG_CHECKING(for Guile)
  guile-config link > /dev/null || {
    AC_MSG_RESULT(no)
    wguile=false
  }
fi

if test x$wguile = xtrue; then
  GUILE_CFLAGS="`guile-config compile`"
  GUILE_LDFLAGS="`guile-config link`"
  LIBS="$LIBS $GUILE_LDFLAGS"
  CFLAGS="$CFLAGS $GUILE_CFLAGS"
  AC_SUBST(MAKE_GUILE)
  AC_MSG_RESULT(yes)
fi

AM_CONDITIONAL(MAKE_GUILE, test x$wguile = xtrue)

dnl Check for glib
AM_PATH_GLIB(1.2.0,
             [LIBS="$LIBS $GLIB_LIBS" CFLAGS="$CFLAGS $GLIB_CFLAGS"],
	     AC_MSG_ERROR(Cannot find GLIB), "gmodule" )

dnl Check if the gtk gui is required
AC_ARG_ENABLE(gui,
[  --enable-gui          build the GTK+ GUI for mixvm (gmixvm)],
[case "${enableval}" in
  yes) gui=true ;;
  no)  gui=false ;;
  *) AC_MSG_ERROR(bad value ${enableval} for --enable-gui) ;;
esac],[gui=true])

dnl Check for gtk+
if test x$gui = xtrue; then
AM_PATH_GTK(1.2.0,
[LIBS="$LIBS $GTK_LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS"],
[AC_MSG_WARN(Cannot find GTK+: the GUI shall not be built)
 gui=false],
"gmodule" )
fi

dnl Check for libglade
if test x$gui = xtrue; then
  AM_PATH_LIBGLADE([LIBS="$LIBS $LIBGLADE_LIBS"
          CFLAGS="$CFLAGS $LIBGLADE_CFLAGS"],
     	  gui=false)
fi

dnl use the provided getopt if gnu getopt is not available
AC_REPLACE_FUNCS(getopt_long)

AM_CONDITIONAL(MAKE_GUI, test x$gui = xtrue)

AC_CANONICAL_HOST
case "${host_os}" in
darwin*) CFLAGS="$CFLAGS -Wall -traditional-cpp";;
*)  CFLAGS="$CFLAGS -Wall";;
esac

AC_SUBST(CFLAGS)

AC_OUTPUT(
Makefile
doc/Makefile
doc/img/Makefile
mixlib/Makefile
mixlib/testsuite/Makefile
mixguile/Makefile
mixutils/Makefile
mixgtk/Makefile
lib/Makefile
misc/Makefile
samples/Makefile
po/Makefile.in
intl/Makefile
m4/Makefile
)

if test x$readl = xtrue; then
  rlinfo=", with readline support"
fi

if test x$wguile = xtrue; then
  guileinfo=", with guile support"
fi

echo
echo "*** GNU MDK $VERSION has been successfully configured. ***"
echo
echo "Type 'make' to build the following utilities:"
echo "    - mixasm (MIX assembler)"
echo "    - mixvm (MIX virtual machine${rlinfo}${guileinfo})"
if test x$gui = xtrue; then
echo "    - gmixvm (mixvm GTK+ GUI${guileinfo})"
fi
if test x$wguile = xtrue; then
echo "    - mixguile (the mixvm guile shell)"
fi
echo