1qdnl Process this with autoconf to create configure
2AC_INIT([kawa],[3.1.1]) dnl Also update bin/configure.ac and build.xml.
3AC_CONFIG_SRCDIR([doc/kawa.texi])
4AC_CONFIG_AUX_DIR([build-aux])
5
6AM_MAINTAINER_MODE([enable])
7AC_CANONICAL_HOST
8
9AM_INIT_AUTOMAKE([info-in-builddir foreign])
10
11AC_ARG_WITH(docbook-stylesheets,
12  AS_HELP_STRING(--with-docbook-stylesheets=path,Building nicely-formatted documentation))
13
14dnl AC_ARG_WITH(classpath,[  --with-classpath          Path to Java classes], classpath=$withval, classpath=$$CLASSPATH)
15AC_ARG_ENABLE(kawa-frontend,
16  [  --enable-kawa-frontend  Build "kawa" front-end program using readline],
17  enable_kawa_frontend=$enableval, enable_kawa_frontend=no)
18
19AC_ARG_ENABLE(xml,
20  AS_HELP_STRING(--disable-xml,Don't build support for XML processing),
21  enable_xml=$enableval, enable_xml=yes)
22
23AC_ARG_WITH(servlet,
24  AS_HELP_STRING(--with-servlet@<:@=servlet-api.jar@:>@,Build support for generating servlets))
25WITH_SERVLET_ARG="${with_servlet}"
26
27AC_ARG_WITH(android,
28  AS_HELP_STRING(--with-android@<:@=android.jar@:>@,Build for the Android platform))
29
30AC_ARG_WITH(javafx,
31 AS_HELP_STRING(--with-javafx@<:@=javafx-sdk-home@:>@,Enable support for JavaFX))
32WITH_JAVAFX_ARG="${with_javafx}"
33
34AC_ARG_WITH(lsp4j,
35  AS_HELP_STRING(--with-lsp4j=<:@=lsp4j.jar@>))
36AC_ARG_WITH(lsp4j.jsonrpc,
37  AS_HELP_STRING(--with-lsp4j.jsonrpc=<:@=lsp4j.jsonrpc.jar@>))
38AC_ARG_WITH(gson,
39  AS_HELP_STRING(--with-gson=<:@=gson.jar@>))
40
41AC_ARG_WITH(domterm,
42 AS_HELP_STRING(--with-domterm=<:@=domterm_home:>@,Build support for DomTerm))
43 WITH_DOMTERM_ARG="${with_domterm}"
44
45AC_ARG_WITH(jline3,
46 AS_HELP_STRING(--with-jline3=<:@=jline3.jar@:>@,Build support JLine3 input editing))
47
48AC_ARG_WITH(XQTS,
49  AS_HELP_STRING(--with-XQTS@<:@=XQTS-path@:>@,Support XQuery Test Suite))
50
51AC_ARG_ENABLE(echo2,
52  AS_HELP_STRING(--enable-echo2,Enable support for the Echo2 web toolkit))
53
54AC_ARG_ENABLE(jemacs,
55  AS_HELP_STRING(--enable-jemacs,Build JEmacs))
56
57AC_ARG_ENABLE(xquery,
58  AS_HELP_STRING(--enable-xquery,Build XQuery language support (Qexo) (default on)))
59
60AC_ARG_ENABLE(brl,
61  AS_HELP_STRING(--enable-brl,Build BRL emulation and KRL))
62
63AC_ARG_WITH(httpserver,
64  AS_HELP_STRING(--with-httpserver,Make use of JDK6's builtin http server))
65
66AC_ARG_WITH(swing,
67  AS_HELP_STRING(--with-swing,Assume Swing is available (default on)))
68
69AC_ARG_WITH(swt,
70  AS_HELP_STRING(--with-swt,Assume SWT is available))
71
72AC_ARG_WITH(awt,
73  AS_HELP_STRING(--with-awt,Assume AWT is available (default on)))
74
75AC_ARG_WITH(sax2,
76  AS_HELP_STRING(--with-sax2, Assume SAX2 is available (default on)))
77
78AC_ARG_WITH(javax.script,
79  AS_HELP_STRING(--with-javax.script, Use javax.script interfaces))
80
81AC_ARG_WITH(java-source,
82  AS_HELP_STRING(--with-java-source=NUM,Assume functionality of given Java/JDK version))
83
84test -z "${with_java_source}" -a -n "${with_android}" \
85  && with_java_source=android
86test -z "${with_swing}" -a "$with_awt" == "no" \
87  && with_swing=no
88
89with_java_source=`echo ${with_java_source} | tr A-Z a-z`
90# Java 8 is the (current) default
91test "${with_java_source}" = "" && with_java_source=8
92case "/${with_java_source}/" in
93  /1/|/1.1*/) # JDK 1.1 - not supported
94    JAVA_SOURCE=1; JAVA_SOURCE_SELECTOR='%java1';;
95  /2/|/1.2*/|/1.3*/) # JDK 1.2+, GCJ-3.x - not supported
96    JAVA_SOURCE=2; JAVA_SOURCE_SELECTOR='%java2' ;;
97  /4/|/1.4*/) # JDK 1.4, GCJ-4.x, without JAXP - not supported
98    JAVA_SOURCE=4; JAVA_SOURCE_SELECTOR='%java4' ;;
99  /4x/|/1.4*+jaxp1.3/) # JDK 1.4, GCJ-4.x with JAXP 1.3 - not supported
100    JAVA_SOURCE=4x; JAVA_SOURCE_SELECTOR='%java4x' ;;
101  /5/|/1.5*/) # JDK 1.5
102    JAVA_SOURCE=5; JAVA_SOURCE_SELECTOR='%java5' ;;
103  /6/|/1.6*/) # JDK 1.6
104    JAVA_SOURCE=6; JAVA_SOURCE_SELECTOR='%java6' ;;
105  /6compat5/) # JDK 1.5 with some Java6 features.
106    # Requires building with Java6, but runs on Java5 (without those features)
107    # or on Java6 (with those features).
108    JAVA_SOURCE=6compat5; JAVA_SOURCE_SELECTOR='%java6compat5' ;;
109  /7/|/1.7*/) # JDK 1.7
110    JAVA_SOURCE=7; JAVA_SOURCE_SELECTOR='%java7' ;;
111  /8/|/1.8*/) # Java 8
112    JAVA_SOURCE=8; JAVA_SOURCE_SELECTOR='%java8' ;;
113  /9/|/1.9*/) # Java 9
114    JAVA_SOURCE=9; JAVA_SOURCE_SELECTOR='%java9' ;;
115  [/[1-9][0-9]/]) # Java 10-
116    JAVA_SOURCE=${with_java_source};
117    JAVA_SOURCE_SELECTOR="%java${with_java_source}"
118    ;;
119  /android*/)
120        JAVA_SOURCE=android; JAVA_SOURCE_SELECTOR='%android'
121        test -z "$with_swing" && with_swing="no"
122        test -z "$with_awt" && with_awt="no"
123        ;;
124  /*/) AC_MSG_ERROR([Invalid version for --with-java-version.
125  (Must be 5, 6, ..., or a JDK version such as 1.5.)]) ;;
126esac
127AC_SUBST(JAVA_SOURCE)
128AC_SUBST(JAVA_SOURCE_SELECTOR)
129
130if test -z "$with_sax2" ; then
131  case "$JAVA_SOURCE" in
132  1|2|3) with_sax2="no";;
133  esac
134fi
135
136if test -z "$with_javax_script"; then
137  case "$JAVA_SOURCE" in
138  6compat5|6|7|8|9) with_javax_script="yes";;
139  esac
140fi
141
142if test -z "$with_httpserver"; then
143  case "$JAVA_SOURCE" in
144  6compat5|6|7|8|9)
145    test "$with_android" != "" -a "$with_android" != "no" \
146      || with_httpserver="yes";;
147  esac
148fi
149
150AC_PROG_INSTALL
151AC_PROG_LN_S
152
153TOP_BUILDDIR=`pwd`
154
155JAVA=${JAVA-java}
156JAVAC=${JAVAC-javac}
157dnl needed to match _AM_DEPENDENCIES
158
159JAVACFLAGS=${JAVACFLAGS--g}
160case "$JAVA_SOURCE" in
161  6compat5) JAVACFLAGS="${JAVACFLAGS} -target 1.5 -source 1.5" ;;
162esac
163
164filesep='/'
165
166# Partly for compatibility (--enable/--disable-servlet was the old option);
167# partly to allow --with-servlet=path-to-jar --disable-servlet.
168# we essentially default enable-servlet to with-servlet. But we don't
169# want to clutter up configure --help with --enable-servlet.
170enable_servlet=${enable_servlet-${with_servlet}}
171
172# Windows has a non-suitable find command.
173AC_CACHE_CHECK([for Posix find command], [ac_cv_path_FIND],
174            [AC_PATH_PROGS_FEATURE_CHECK([FIND], [find],
175              [[findout=`$ac_path_FIND . -maxdepth 0 -type d -exec echo '{}' ';'`
176                test "x$findout" = x"." \
177                && ac_cv_path_FIND=$ac_path_FIND ac_path_FIND_found=:]],
178              [AC_MSG_WARN([could not find Posix find]); ac_cv_path_FIND=find])])
179          AC_SUBST([FIND], [$ac_cv_path_FIND])
180
181AM_CONDITIONAL(ENABLE_ECHO2, test "$enable_echo2" = "yes")
182AM_CONDITIONAL(WITH_ANDROID,
183  test "$with_android" != "" -a "$with_android" != "no")
184AM_CONDITIONAL(ENABLE_BRL, test "$enable_brl" = "yes")
185AM_CONDITIONAL(ENABLE_JEMACS, test "$enable_jemacs" = "yes")
186AM_CONDITIONAL(ENABLE_XQUERY, test "$enable_xquery" != "no")
187AM_CONDITIONAL(ENABLE_XML, test "$enable_xml" = "yes")
188AM_CONDITIONAL(ENABLE_SERVLET,
189  test "$enable_servlet" != "" -a "$enable_servlet" != "no")
190AM_CONDITIONAL(WITH_SWING, test "$with_swing" != "no")
191AM_CONDITIONAL(WITH_LSP4J,
192  test "$with_lsp4j" != "" -a "$with_lsp4j" != "no")
193AM_CONDITIONAL(WITH_JLINE3,
194  test "$with_jline3" != "" -a "$with_jline3" != "no")
195AM_CONDITIONAL(WITH_DOMTERM,
196  test "$with_domterm" != "" -a "$with_domterm" != "no")
197AM_CONDITIONAL(WITH_JAVAFX,
198  test "$with_javafx" != "" -a "$with_javafx" != "no")
199AM_CONDITIONAL(WITH_JAVAFX_MODULE,
200  test "$with_javafx" != "" -a "$with_javafx" != "no" -a "$with_javafx" != "yes")
201
202AM_CONDITIONAL(WITH_SWT, test "$with_swt" = "yes")
203AM_CONDITIONAL(WITH_AWT, test "$with_awt" != "no")
204AM_CONDITIONAL(WITH_SAX2, test "$with_sax2" != "no")
205AM_CONDITIONAL(WITH_JAVAX_SCRIPT, test "$with_javax_script" = "yes")
206AM_CONDITIONAL(WITH_HTTPSERVER, test "$with_httpserver" = "yes")
207AM_CONDITIONAL(WITH_DOCBOOK_STYLESHEETS, test "$with_docbook_stylesheets" != "" -a "$with_docbook_stylesheets" != "no")
208AM_CONDITIONAL(WITH_XQTS, test "$with_XQTS" != "" -a "$with_XQTS" != "no")
209AM_CONDITIONAL(ENABLE_KAWA_FRONTEND, test "$enable_kawa_frontend" = "yes")
210AM_CONDITIONAL(ON_WINDOWS, test "$CLASSPATH_SEPARATOR" = ";")
211
212if test -z "${ON_WINDOWS_FALSE}${ENABLE_KAWA_FRONTEND_FALSE}"
213then
214  KAWA_SCRIPT=kawa
215else
216  KAWA_SCRIPT=kawa.sh
217fi
218AC_SUBST(KAWA_SCRIPT)
219AS_IF([test "${KAWA_SCRIPT}" == "kawa"],
220  AC_CONFIG_FILES([bin/kawa:bin/kawa.sh.in],[chmod +x bin/kawa]),
221  AC_CONFIG_FILES([bin/kawa.sh:bin/kawa.sh.in],[chmod +x bin/kawa.sh]))
222
223if test "$with_docbook_stylesheets" == "" -o "$with_docbook_stylesheets" == "no" -o  "$with_docbook_stylesheets" == "yes"
224then
225DOCBOOK_STYLESHEETS_PATH='$(TOP_BUILDDIR)/docbook-xsl'
226else
227DOCBOOK_STYLESHEETS_PATH="${with_docbook_stylesheets}"
228fi
229
230if test "$with_jline3" != "" -a "$with_jline3" != "no"
231then WITH_JLINE_PATH="${with_jline3}"
232fi
233
234if test "$with_gson" != "" -a "$with_gson" != "no"
235then WITH_GSON_PATH="${with_gson}"
236fi
237
238if test "$with_lsp4j" != "" -a "$with_lsp4j" != "no"
239then WITH_LSP4J_PATH="${with_lsp4j}"
240fi
241
242if test "$with_lsp4j_jsonrpc" != "" -a "$with_lsp4j_jsonrpc" != "no"
243then WITH_LSP4J_JSONRPC_PATH="${with_lsp4j_jsonrpc}"
244elif test -n "${WITH_LSP4J_PATH}"
245then WITH_LSP4J_JSONRPC_PATH=`echo "${WITH_LSP4J_PATH}"|sed -e 's|\(org.eclipse.lsp4j\)\(.\)|\1.jsonrpc\2|g'`
246fi
247
248JEMACS_VERSION=`echo $VERSION | sed  -e 's/^1/0/'`
249BYTECODE_VERSION="$VERSION"
250
251m4_include(config.classpath)
252
253case ${with_sax2} in
254  yes) SAX2_PREPROCESS="+SAX2";;
255  no) SAX2_PREPROCESS="-SAX2";;
256  *) SAX2_PREPROCESS=""
257esac
258
259XQTS_PATH=${with_XQTS:-XQTS}
260AC_SUBST(XQTS_PATH)
261AC_SUBST(DOCBOOK_STYLESHEETS_PATH)
262AC_SUBST(SAX2_PREPROCESS)
263AC_SUBST(conf_classpath)
264AC_SUBST(run_classpath)
265AC_SUBST(CLASSPATH_SEPARATOR)
266AC_SUBST(pathsep)
267AC_SUBST(filesep)
268AC_SUBST(WITH_SERVLET_ARG)
269AC_SUBST(WITH_JAVAFX_ARG)
270AC_SUBST(WITH_JAVAFX_MODULE)
271AC_SUBST(WITH_JLINE3)
272AC_SUBST(WITH_GSON_PATH)
273AC_SUBST(WITH_JLINE_PATH)
274AC_SUBST(WITH_LSP4J_PATH)
275AC_SUBST(WITH_LSP4J_JSONRPC_PATH)
276AC_SUBST(WITH_DOMTERM_ARG)
277
278AC_SUBST(JAVA)
279AC_SUBST(JAVAC)
280AC_SUBST(JAVACFLAGS)
281#These don't do anything, because Make-rules can't contain autoconf
282#substitutions.  Perhaps fix when new automake is out.
283AC_SUBST(TOP_BUILDDIR)
284AC_SUBST(PACKAGE)
285AC_SUBST(VERSION)
286AC_SUBST(JEMACS_VERSION)
287AC_SUBST(BYTECODE_VERSION)
288
289if test -z "$KAWA_SHELL"; then
290  if test -f /bin/bash; then KAWA_SHELL=/bin/bash
291  elif test -f /bin/ksh; then KAWA_SHELL=/bin/ksh
292  else KAWA_SHELL=${CONFIG_SHELL-/bin/sh}
293  fi
294fi
295AC_SUBST(KAWA_SHELL)
296
297Make_rules="$srcdir/Make-rules"
298AC_SUBST_FILE(Make_rules)
299AC_CONFIG_LINKS(
300  testsuite/scribble.html:testsuite/scribble.html.in)
301
302AC_CONFIG_SUBDIRS([bin])
303
304AC_CONFIG_FILES([Makefile gnu/bytecode/Makefile
305  gnu/Makefile gnu/kawa/servlet/Makefile
306  gnu/brl/Makefile gnu/kawa/brl/Makefile
307  kawa/lib/Makefile gnu/kawa/slib/Makefile
308  gnu/commonlisp/lisp/Makefile gnu/commonlisp/testsuite/Makefile
309  gnu/jemacs/lisp/Makefile gnu/jemacs/testsuite/Makefile
310  gnu/q2/testsuite/Makefile
311  gnu/xquery/testsuite/Makefile
312  gnu/kawa/android/Makefile
313  gnu/kawa/javafx/Makefile
314  doc/Makefile testsuite/Makefile
315  bin/kawa.bat])
316AC_CONFIG_FILES([bin/qexo],[chmod +x bin/qexo])
317AC_OUTPUT
318