1dnl Process this file with autoconf to produce a configure script.
2
3dnl If git is available, the version number here is not used.
4dnl Instead, git is used to derive the version based on the closest
5dnl annotated branch tag.
6dnl
7dnl Note: during Lisp-based builds (see INSTALL.lisp) the version
8dnl number is read from the following AC_INIT line.  It's sensitive to
9dnl whitespace so when updating the version number only make changes
10dnl within the second pair of square brackets.
11AC_INIT([maxima], [5.43.2])
12AC_CONFIG_SRCDIR([src/macsys.lisp])
13AM_INIT_AUTOMAKE([-Wno-portability tar-ustar])
14
15# On debian-based systems this makes us use the right gcl version out-of-the box.
16# On other systems it doesn't hurt.
17export GCL_ANSI=t
18
19# This enables running the testbench for "make check" on gcl versions with the old
20# memory management (Which in January 2018 includes all Versions shipped with debian
21# and Ubuntu)
22export GCL_MEM_MULTIPLE=0.1
23
24AM_PATH_LISPDIR
25
26AC_CANONICAL_HOST
27
28dnl If we were using a C compiler, EXEEXT would get defined
29dnl automatically. But we aren't, so we have to define it ourselves.
30dnl Still to do: Add Win64 support here, if this is needed.
31case "$host" in
32        *mingw*)
33                win32=true
34                win64=false
35                mingw=true
36                EXEEXT=.exe
37		CLISPEXT=${EXEEXT}
38                ;;
39        *cygwin*)
40                win32=false
41                win64=false
42                mingw=false
43                EXEEXT=.exe
44		CLISPEXT=${EXEEXT}
45                ;;
46        *)
47                win32=false
48                win64=false
49                mingw=false
50                EXEEXT=
51		CLISPEXT=.run
52esac
53AC_SUBST(EXEEXT)
54AC_SUBST(win32)
55AC_SUBST(win64)
56AM_CONDITIONAL(WIN32, test x$win32 = xtrue)
57AM_CONDITIONAL(WIN64, test x$win64 = xtrue)
58
59dnl To make life more confusing, the automake test machinery (which we
60dnl use in ./tests) needs the am__EXEEXT conditional. This would have
61dnl normally been expanded (via something we've copied from Automake's
62dnl init.m4 into our aclocal.m4) as Automake computed EXEEXT, but it
63dnl didn't so we have to drop this in ourselves.
64AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])
65
66explicit_lisp=false
67lisps_enabled=""
68
69dnl Compiling with abcl requires a jre and the path to abcl.jar
70AC_ARG_ENABLE(abcl,
71	[  --enable-abcl                Use abcl, requires --with-abcl-jar],
72     	[case "${enableval}" in
73       		yes) abcl=true
74		     lisps_enabled="${lisps_enabled} abcl"
75                     explicit_lisp=true ;;
76       		no)  abcl=false ;;
77		*) AC_MSG_ERROR(bad value ${enableval} for --enable-abcl) ;;
78     	esac
79	explicit_lisp=true],
80	[abcl=false])
81ABCL_JAR=`pwd`/"abcl.jar"
82AC_ARG_WITH(abcl-jar,
83	[  --with-abcl-jar=<jarfile>    Use <jarfile> as abcl install (default ./abcl.jar)],
84	[abcl=true
85	lisps_enabled="${lisps_enabled} abcl"
86	explicit_lisp=true
87	ABCL_JAR="${withval}"])
88
89AC_ARG_WITH(jre,
90 	[  --with-jre=<jre>             When compiling with abcl: use <jre> as Java interpreter],
91 	[JRE="${withval}"],
92 	[JRE="java"])
93
94if test x"${abcl}" = xtrue ; then
95     if test -e "${ABCL_JAR}" ; then
96          echo Using abcl found in ${ABCL_JAR}
97     else
98        AC_MSG_ERROR(${ABCL_JAR} not found.)
99     fi
100fi
101
102dnl n.b. clisp_default_name is hardcoded in "with" message
103clisp_default_name=clisp
104AC_ARG_ENABLE(clisp,
105	[  --enable-clisp               Use clisp],
106     	[case "${enableval}" in
107       		yes) clisp=true
108		     lisps_enabled="${lisps_enabled} clisp"
109                     explicit_lisp=true ;;
110       		no)  clisp=false ;;
111		*) AC_MSG_ERROR(bad value ${enableval} for --enable-clisp) ;;
112     	esac
113	explicit_lisp=true],
114	[clisp=false])
115AC_ARG_WITH(clisp,
116	[  --with-clisp=<prog>          Use clisp executable <prog> (default clisp)],
117	[clisp=true
118	lisps_enabled="${lisps_enabled} clisp"
119	explicit_lisp=true
120	if test "$withval" = "yes"; then
121		CLISP_NAME="${clisp_default_name}"
122	else
123		CLISP_NAME="$withval"
124	fi],
125	[CLISP_NAME=${clisp_default_name}])
126	CLISP_RUNTIME="lisp${CLISPEXT}"
127AC_ARG_WITH(clisp-runtime,
128	[  --with-clisp-runtime=<path>  Use clisp runtime <path> (default
129	                          *lib-directory*/base/lisp.run on unix,
130	   		          *lib-directory*\\lisp.exe on windows) ],
131	[clisp=true
132	lisps_enabled="${lisps_enabled} clisp"
133	CLISP_RUNTIME_PATH="$withval"
134	CLISP_RUNTIME=`basename ${CLISP_RUNTIME_PATH}`],
135	[])
136AC_ARG_ENABLE(clisp-exec,
137	[  --enable-clisp-exec          Create a maxima executable image using CLISP.
138                                No check is made if the version of
139                                CLISP supports executable images],
140	[case "${enableval}" in
141	    yes) clisp_exec=true
142                 clisp=true
143		 lisps_enabled="${lisps_enabled} clisp"
144                 explicit_lisp=true ;;
145	    no) clisp_exec=false ;;
146	    *) AC_MSG_ERROR(bad value ${enableval} for --enable-clisp-exec) ;;
147         esac
148	 CLISP_EXEC=${clisp_exec}],
149	[clisp_exec=false
150	 CLISP_EXEC=false])
151if test x"${clisp}" = xtrue ; then
152	if test `echo "$CLISP_NAME" | sed 's/\(.\).*/\1/'` = "/" ; then
153		if test -x "$CLISP_NAME" ; then
154			clisp_found=true
155		else
156			clisp_found=false
157		fi
158	else
159		AC_CHECK_PROG(clisp_found,$CLISP_NAME,true,false)
160	fi
161	if test x"${clisp_found}" = xfalse ; then
162		AC_MSG_WARN(clisp executable ${CLISP_NAME} not found in PATH)
163	fi
164fi
165
166
167dnl See if git exists.  If it does, update VERSION to include a git tag
168AC_CHECK_PROG(git_found, git, true, false)
169if test x"${git_found}" = xtrue; then
170    # Test to see if git describe works (discarding any output).  If
171    # it works, use it.  Otherwise, keep existing value of VERSION.
172    # (git describe fails if git is executed in a non-Git directory, e.g.,
173    # an unpacked tarball. Since the exit codes of git describe are undocumented,
174    # we cannot distinguish that from a missing annotated tag.
175    # Play it safe by refusing to change VERSION.)
176    if git describe > /dev/null 2>&1; then
177        VERSION="`git describe --dirty`"
178        # When building RPMs, hyphens in the version are not allowed, so
179        # replace them with underscores.
180        VERSION=`echo $VERSION | sed 's;-;_;g'`
181    fi
182fi
183
184dnl Parses the version number for the manual
185manual_version=`echo $VERSION | sed 's+branch_++; s+_base++; s+_dirty++; s+_+.+g'`
186AC_SUBST(manual_version)
187
188dnl n.b. cmucl_default_name is hardcoded in "with" message
189cmucl_default_name=lisp
190CMUCL_RUNTIME=lisp
191AC_ARG_ENABLE(cmucl,
192	[  --enable-cmucl               Use CMUCL],
193     	[case "${enableval}" in
194       		yes) cmucl=true
195		     lisps_enabled="${lisps_enabled} cmucl"
196                     explicit_lisp=true ;;
197       		no)  cmucl=false ;;
198		*) AC_MSG_ERROR(bad value ${enableval} for --enable-cmucl) ;;
199     	esac
200	explicit_lisp=true],
201	[cmucl=false])
202AC_ARG_WITH(cmucl,
203	[  --with-cmucl=<prog>          Use CMUCL executable <prog> (default lisp)],
204	[cmucl=true
205	lisps_enabled="${lisps_enabled} cmucl"
206	explicit_lisp=true
207	if test "$withval" = "yes"; then
208		CMUCL_NAME="${cmucl_default_name}"
209	else
210		CMUCL_NAME="$withval"
211	fi],
212	[CMUCL_NAME=${cmucl_default_name}])
213AC_ARG_WITH(cmucl-runtime,
214	[  --with-cmucl-runtime=<path>  Use CMUCL runtime <path> (default
215	                          *cmucl-lib*/../bin/lisp)],
216	[cmucl=true
217	lisps_enabled="${lisps_enabled} cmucl"
218	CMUCL_RUNTIME_PATH="$withval"
219	CMUCL_RUNTIME=`basename ${CMUCL_RUNTIME_PATH}`],
220	[])
221AC_ARG_ENABLE(cmucl-exec,
222	[  --enable-cmucl-exec          Create a maxima executable image using CMUCL.
223                                No check is made if the version of
224                                CMUCL supports executable images],
225	[case "${enableval}" in
226	    yes) cmucl_exec=true
227                 cmucl=true
228		 lisps_enabled="${lisps_enabled} cmucl"
229                 explicit_lisp=true ;;
230	    no) cmucl_exec=false ;;
231	    *) AC_MSG_ERROR(bad value ${enableval} for --enable-cmucl-exec) ;;
232         esac
233	 CMUCL_EXEC=${cmucl_exec}],
234	[cmucl_exec=false
235	 CMUCL_EXEC=false])
236if test x"${cmucl}" = xtrue ; then
237	if test `echo "$CMUCL_NAME" | sed 's/\(.\).*/\1/'` = "/" ; then
238		if test -x "$CMUCL_NAME" ; then
239			cmucl_found=true
240		else
241			cmucl_found=false
242		fi
243	else
244		AC_CHECK_PROG(cmucl_found,$CMUCL_NAME,true,false)
245	fi
246	AC_CHECK_PROG(cmucl_found,$CMUCL_NAME,true,false)
247	if test x"${cmucl_found}" = xfalse ; then
248		AC_MSG_WARN(cmucl executable ${CMUCL_NAME} not found in PATH)
249	fi
250fi
251
252dnl n.b. scl_default_name is hardcoded in "with" message
253scl_default_name=scl
254SCL_RUNTIME=lisp
255AC_ARG_ENABLE(scl,
256	[  --enable-scl                 Use SCL],
257     	[case "${enableval}" in
258       		yes) scl=true
259		     lisps_enabled="${lisps_enabled} scl"
260                     explicit_lisp=true ;;
261       		no)  scl=false ;;
262		*) AC_MSG_ERROR(bad value ${enableval} for --enable-scl) ;;
263     	esac
264	explicit_lisp=true],
265	[scl=false])
266AC_ARG_WITH(scl,
267	[  --with-scl=<prog>            Use SCL executable <prog> (default scl)],
268	[scl=true
269	lisps_enabled="${lisps_enabled} scl"
270	explicit_lisp=true
271	if test "$withval" = "yes"; then
272		SCL_NAME="${scl_default_name}"
273	else
274		SCL_NAME="$withval"
275	fi],
276	[SCL_NAME=${scl_default_name}])
277AC_ARG_WITH(scl-runtime,
278	[  --with-scl-runtime=<path>    Use SCL runtime <path> (default
279	                          file://library/../bin/lisp)],
280	[scl=true
281	lisps_enabled="${lisps_enabled} scl"
282	SCL_RUNTIME_PATH="$withval"
283	SCL_RUNTIME=`basename ${SCL_RUNTIME_PATH}`],
284	[])
285if test x"${scl}" = xtrue ; then
286	if test `echo "$SCL_NAME" | sed 's/\(.\).*/\1/'` = "/" ; then
287		if test -x "$SCL_NAME" ; then
288			scl_found=true
289		else
290			scl_found=false
291		fi
292	else
293		AC_CHECK_PROG(scl_found,$SCL_NAME,true,false)
294	fi
295	AC_CHECK_PROG(scl_found,$SCL_NAME,true,false)
296	if test x"${scl_found}" = xfalse ; then
297		AC_MSG_WARN(scl executable ${SCL_NAME} not found in PATH)
298	fi
299fi
300
301dnl n.b. sbcl_default_name is hardcoded in "with" message
302sbcl_default_name=sbcl
303AC_ARG_ENABLE(sbcl,
304	[  --enable-sbcl                Use SBCL],
305     	[case "${enableval}" in
306       		yes) sbcl=true
307		     lisps_enabled="${lisps_enabled} sbcl"
308                     explicit_lisp=true ;;
309       		no)  sbcl=false ;;
310		*) AC_MSG_ERROR(bad value ${enableval} for --enable-sbcl) ;;
311     	esac
312	explicit_lisp=true],
313	[sbcl=false])
314AC_ARG_WITH(sbcl,
315	[  --with-sbcl=<prog>           Use SBCL executable <prog> (default sbcl)],
316	[sbcl=true
317	lisps_enabled="${lisps_enabled} sbcl"
318	explicit_lisp=true
319	if test "$withval" = "yes"; then
320		SBCL_NAME="${sbcl_default_name}"
321	else
322		SBCL_NAME="$withval"
323	fi],
324	[SBCL_NAME="${sbcl_default_name}"])
325AC_ARG_ENABLE(sbcl-exec,
326	[  --enable-sbcl-exec           Create a maxima executable image using SBCL.
327                                No check is made if the version of
328                                SBCL supports executable images],
329	[case "${enableval}" in
330	    yes) sbcl_exec=true
331                 sbcl=true
332		 lisps_enabled="${lisps_enabled} sbcl"
333                 explicit_lisp=true ;;
334	    no) sbcl_exec=false ;;
335	    *) AC_MSG_ERROR(bad value ${enableval} for --enable-sbcl-exec) ;;
336         esac
337	 SBCL_EXEC=${sbcl_exec}],
338	[sbcl_exec=false
339	 SBCL_EXEC=false])
340if test x"${sbcl}" = xtrue ; then
341	if test `echo "$SBCL_NAME" | sed 's/\(.\).*/\1/'` = "/" ; then
342		if test -x "$SBCL_NAME" ; then
343			sbcl_found=true
344		else
345			sbcl_found=false
346		fi
347	else
348		AC_CHECK_PROG(sbcl_found,"$SBCL_NAME",true,false)
349	fi
350	AC_CHECK_PROG(sbcl_found,"$SBCL_NAME",true,false)
351	if test x"${sbcl_found}" = xfalse ; then
352		AC_MSG_WARN(sbcl executable "${SBCL_NAME}" not found in PATH)
353	fi
354fi
355
356dnl n.b. acl_default_name is hardcoded in "with" message
357acl_default_name=lisp
358AC_ARG_ENABLE(acl,
359	[  --enable-acl                 Use ACL],
360     	[case "${enableval}" in
361       		yes) acl=true
362		     lisps_enabled="${lisps_enabled} acl"
363                     explicit_lisp=true ;;
364       		no)  acl=false ;;
365		*) AC_MSG_ERROR(bad value ${enableval} for --enable-acl) ;;
366     	esac
367	explicit_lisp=true],
368	[acl=false])
369AC_ARG_WITH(acl,
370	[  --with-acl=<prog>            Use ACL executable <prog> (default lisp)],
371	[acl=true
372	lisps_enabled="${lisps_enabled} acl"
373	explicit_lisp=true
374	if test "$withval" = "yes"; then
375		ACL_NAME="${acl_default_name}"
376	else
377		ACL_NAME="$withval"
378	fi],
379	[ACL_NAME=${acl_default_name}])
380if test x"${acl}" = xtrue ; then
381	if test `echo "$ACL_NAME" | sed 's/\(.\).*/\1/'` = "/" ; then
382		if test -x "$ACL_NAME" ; then
383			acl_found=true
384		else
385			acl_found=false
386		fi
387	else
388		AC_CHECK_PROG(acl_found,$ACL_NAME,true,false)
389	fi
390	AC_CHECK_PROG(acl_found,$ACL_NAME,true,false)
391	if test x"${acl_found}" = xfalse ; then
392		AC_MSG_WARN(acl executable ${ACL_NAME} not found in PATH)
393	fi
394fi
395
396dnl n.b. gcl_default_name is hardcoded in "with" message
397gcl_default_name=gcl
398AC_ARG_ENABLE(gcl,
399	[  --enable-gcl                 Use GCL],
400     	[case "${enableval}" in
401       		yes) gcl=true
402		     lisps_enabled="${lisps_enabled} gcl"
403		     explicit_lisp=true;;
404       		no)  gcl=false ;;
405		*) AC_MSG_ERROR(bad value ${enableval} for --enable-gcl) ;;
406     	esac],
407	[gcl=false])
408AC_ARG_WITH(gcl,
409	[  --with-gcl=<prog>            Use GCL executable <prog> (default gcl)],
410	[gcl=true
411	lisps_enabled="${lisps_enabled} gcl"
412	explicit_lisp=true
413	if test "$withval" = "yes"; then
414		GCL_NAME="${gcl_default_name}"
415	else
416		GCL_NAME="$withval"
417	fi],
418	[GCL_NAME=${gcl_default_name}])
419if test x"${gcl}" = xtrue ; then
420	if test `echo "$GCL_NAME" | sed 's/\(.\).*/\1/'` = "/" ; then
421		if test -x "$GCL_NAME" ; then
422			gcl_found=true
423		else
424			gcl_found=false
425		fi
426	else
427		AC_CHECK_PROG(gcl_found,$GCL_NAME,true,false)
428	fi
429	if test x"${gcl_found}" = xfalse ; then
430		AC_MSG_WARN(gcl executable ${GCL_NAME} not found in PATH)
431	fi
432fi
433
434dnl n.b. openmcl_default_name is hardcoded in "with" message
435openmcl_default_name=openmcl
436AC_ARG_ENABLE(openmcl,
437	[  --enable-openmcl             Use OpenMCL],
438     	[case "${enableval}" in
439       		yes) openmcl=true
440		     lisps_enabled="${lisps_enabled} openmcl"
441		     explicit_lisp=true;;
442       		no)  openmcl=false ;;
443		*) AC_MSG_ERROR(bad value ${enableval} for --enable-openmcl) ;;
444     	esac],
445	[openmcl=false])
446AC_ARG_WITH(openmcl,
447	[  --with-openmcl=<prog>        Use OpenMCL executable <prog> (default openmcl)],
448	[openmcl=true
449	lisps_enabled="${lisps_enabled} openmcl"
450	explicit_lisp=true
451	if test "$withval" = "yes"; then
452		OPENMCL_NAME="${openmcl_default_name}"
453	else
454		OPENMCL_NAME="$withval"
455	fi],
456	[OPENMCL_NAME=${openmcl_default_name}])
457AC_ARG_ENABLE(openmcl-exec,
458	[  --enable-openmcl-exec        Create a maxima executable image using OPENMCL.
459                                No check is made if the version of
460                                OPENMCL supports executable images],
461	[case "${enableval}" in
462	    yes) openmcl_exec=true
463                 openmcl=true
464		 lisps_enabled="${lisps_enabled} openmcl"
465		 explicit_lisp=true;;
466	    no) openmcl_exec=false ;;
467	    *) AC_MSG_ERROR(bad value ${enableval} for --enable-openmcl-exec) ;;
468         esac
469	 OPENMCL_EXEC=${openmcl_exec}],
470	[openmcl_exec=false
471	 OPENMCL_EXEC=false])
472
473dnl Define ccl as an alias (essentially) for openmcl
474AC_ARG_ENABLE(ccl,
475	[  --enable-ccl                 Use CCL (Clozure Common Lisp)],
476     	[case "${enableval}" in
477       		yes) openmcl=true
478		     lisps_enabled="${lisps_enabled} openmcl"
479		     explicit_lisp=true;;
480       		no)  openmcl=false ;;
481		*) AC_MSG_ERROR(bad value ${enableval} for --enable-ccl) ;;
482     	esac],
483	[openmcl=false])
484AC_ARG_WITH(ccl,
485	[  --with-ccl=<prog>            Use OpenMCL executable <prog> (default ccl)],
486	[openmcl=true
487	lisps_enabled="${lisps_enabled} openmcl"
488	explicit_lisp=true
489	if test "$withval" = "yes"; then
490		OPENMCL_NAME="${openmcl_default_name}"
491	else
492		OPENMCL_NAME="$withval"
493	fi],
494	[OPENMCL_NAME=${openmcl_default_name}])
495AC_ARG_ENABLE(ccl-exec,
496	[  --enable-ccl-exec            Create a maxima executable image using CCL.
497                                No check is made if the version of
498                                CCL supports executable images],
499	[case "${enableval}" in
500	    yes) openmcl_exec=true
501                 openmcl=true
502		 lisps_enabled="${lisps_enabled} openmcl"
503                 explicit_lisp=true;;
504	    no) openmcl_exec=false ;;
505	    *) AC_MSG_ERROR(bad value ${enableval} for --enable-ccl-exec) ;;
506         esac
507	 OPENMCL_EXEC=${openmcl_exec}],
508	[openmcl_exec=false
509	 OPENMCL_EXEC=false])
510
511if test x"${openmcl}" = xtrue ; then
512	if test `echo "$OPENMCL_NAME" | sed 's/\(.\).*/\1/'` = "/" ; then
513		if test -x "$OPENMCL_NAME" ; then
514			openmcl_found=true
515		else
516			openmcl_found=false
517		fi
518	else
519		AC_CHECK_PROG(openmcl_found,$OPENMCL_NAME,true,false)
520	fi
521	if test x"${openmcl_found}" = xfalse ; then
522		AC_MSG_WARN(openmcl executable ${OPENMCL_NAME} not found in PATH)
523	fi
524fi
525
526dnl n.b. ccl64_default_name is hardcoded in "with" message
527dnl We assume we're running on an x86 processor.  The user has to
528dnl select a different executable name to match his system, if neceessary.
529
530ccl64_default_name=dx86cl64
531AC_ARG_ENABLE(ccl64,
532	[  --enable-ccl64               Use CCL (Clozure Common Lisp), 64-bit],
533     	[case "${enableval}" in
534       		yes) ccl64=true
535		     lisps_enabled="${lisps_enabled} ccl64"
536		     explicit_lisp=true;;
537       		no)  ccl64=false ;;
538		*) AC_MSG_ERROR(bad value ${enableval} for --enable-ccl64) ;;
539     	esac],
540	[ccl64=false])
541AC_ARG_WITH(ccl64,
542	[  --with-ccl64=<prog>          Use ccl64 executable <prog> (default dx86cl64)],
543	[ccl64=true
544	lisps_enabled="${lisps_enabled} ccl64"
545	explicit_lisp=true
546	if test "$withval" = "yes"; then
547		CCL64_NAME="${ccl64_default_name}"
548	else
549		CCL64_NAME="$withval"
550	fi],
551	[CCL64_NAME=${ccl64_default_name}])
552AC_ARG_ENABLE(ccl64-exec,
553	[  --enable-ccl64-exec          Create a maxima executable image using CCL.
554                                No check is made if the version of
555                                CCL supports executable images],
556	[case "${enableval}" in
557	    yes) ccl64_exec=true
558                 ccl64=true
559		 lisps_enabled="${lisps_enabled} ccl64"
560                 explicit_lisp=true;;
561	    no) ccl64_exec=false ;;
562	    *) AC_MSG_ERROR(bad value ${enableval} for --enable-ccl64-exec) ;;
563         esac
564	 CCL64_EXEC=${ccl64_exec}],
565	[ccl64_exec=false
566	 CCL64_EXEC=false])
567
568dnl n.b. ecl_default_name is hardcoded in "with" message
569ecl_default_name=ecl
570AC_ARG_ENABLE(ecl,
571	[  --enable-ecl                 Use ECL],
572     	[case "${enableval}" in
573       		yes) ecl=true
574		     lisps_enabled="${lisps_enabled} ecl"
575		     explicit_lisp=true;;
576       		no)  ecl=false ;;
577		*) AC_MSG_ERROR(bad value ${enableval} for --enable-ecl) ;;
578     	esac],
579	[ecl=false])
580AC_ARG_WITH(ecl,
581	[  --with-ecl=<prog>            Use ECL executable <prog> (default ecl)],
582	[ecl=true
583	lisps_enabled="${lisps_enabled} ecl"
584	explicit_lisp=true
585	if test "$withval" = "yes"; then
586		ECL_NAME="${ecl_default_name}"
587	else
588		ECL_NAME="$withval"
589	fi],
590	[ECL_NAME=${ecl_default_name}])
591if test x"${ecl}" = xtrue ; then
592	if test `echo "$ECL_NAME" | sed 's/\(.\).*/\1/'` = "/" ; then
593		if test -x "$ECL_NAME" ; then
594			ecl_found=true
595		else
596			ecl_found=false
597		fi
598	else
599		AC_CHECK_PROG(ecl_found,$ECL_NAME,true,false)
600	fi
601	if test x"${ecl_found}" = xfalse ; then
602		AC_MSG_WARN(ecl executable ${ECL_NAME} not found in PATH)
603	fi
604fi
605
606dnl xgettext
607AC_ARG_ENABLE(gettext,
608	[  --enable-gettext             Locale support],
609	[case "${enableval}" in
610	       yes) enable_gettext=true  ;;
611 	       no)  enable_gettext=false ;;
612	       *) AC_MSG_ERROR(bad value ${enableval} for --enable-gettext) ;;
613	 esac],
614	 [enable_gettext=false])
615
616
617AM_CONDITIONAL(ENABLE_GETTEXT, test x$enable_gettext = xtrue)
618
619dnl languages
620AC_ARG_ENABLE(lang-de,
621	[  --enable-lang-de             German language support],
622     	[case "${enableval}" in
623       		yes) lang_de=true  ;;
624       		no)  lang_de=false ;;
625		*) AC_MSG_ERROR(bad value ${enableval} for --enable-lang-de) ;;
626     	esac],
627	[lang_de=false])
628
629AM_CONDITIONAL(LANG_DE, test x$lang_de = xtrue)
630
631AC_ARG_ENABLE(lang-de-utf8,
632	[  --enable-lang-de-utf8        German language support (UTF-8)],
633     	[case "${enableval}" in
634       		yes) lang_de_utf8=true  ;;
635       		no)  lang_de_utf8=false ;;
636		*) AC_MSG_ERROR(bad value ${enableval} for --enable-lang-de-utf8) ;;
637     	esac],
638	[lang_de_utf8=false])
639
640AM_CONDITIONAL(LANG_DE_UTF8, test x$lang_de_utf8 = xtrue)
641
642AC_ARG_ENABLE(lang-es,
643	[  --enable-lang-es             Spanish language support],
644     	[case "${enableval}" in
645       		yes) lang_es=true  ;;
646       		no)  lang_es=false ;;
647		*) AC_MSG_ERROR(bad value ${enableval} for --enable-lang-es) ;;
648     	esac],
649	[lang_es=false])
650
651AC_SUBST(lang_es)
652AM_CONDITIONAL(LANG_ES, test x$lang_es = xtrue)
653
654AC_ARG_ENABLE(lang-es-utf8,
655	[  --enable-lang-es-utf8        Spanish language support (UTF-8)],
656     	[case "${enableval}" in
657       		yes) lang_es_utf8=true  ;;
658       		no)  lang_es_utf8=false ;;
659		*) AC_MSG_ERROR(bad value ${enableval} for --enable-lang-es-utf8) ;;
660     	esac],
661	[lang_es_utf8=false])
662
663AM_CONDITIONAL(LANG_ES_UTF8, test x$lang_es_utf8 = xtrue)
664
665AC_ARG_ENABLE(lang-pt,
666	[  --enable-lang-pt             Portuguese language support],
667     	[case "${enableval}" in
668       		yes) lang_pt=true  ;;
669       		no)  lang_pt=false ;;
670		*) AC_MSG_ERROR(bad value ${enableval} for --enable-lang-pt) ;;
671     	esac],
672	[lang_pt=false])
673
674AC_SUBST(lang_pt)
675AM_CONDITIONAL(LANG_PT, test x$lang_pt = xtrue)
676
677AC_ARG_ENABLE(lang-pt-utf8,
678	[  --enable-lang-pt-utf8        Portuguese language support (UTF-8)],
679     	[case "${enableval}" in
680       		yes) lang_pt_utf8=true  ;;
681       		no)  lang_pt_utf8=false ;;
682		*) AC_MSG_ERROR(bad value ${enableval} for --enable-lang-pt-utf8) ;;
683     	esac],
684	[lang_pt_utf8=false])
685
686AM_CONDITIONAL(LANG_PT_UTF8, test x$lang_pt_utf8 = xtrue)
687
688AC_ARG_ENABLE(lang-pt_BR,
689	[  --enable-lang-pt_BR          Brazilian Portuguese language support],
690     	[case "${enableval}" in
691       		yes) lang_pt_br=true  ;;
692       		no)  lang_pt_br=false ;;
693		*) AC_MSG_ERROR(bad value ${enableval} for --enable-lang-pt_BR) ;;
694     	esac],
695	[lang_pt_br=false])
696
697AC_SUBST(lang_pt_br)
698AM_CONDITIONAL(LANG_PT_BR, test x$lang_pt_br = xtrue)
699
700AC_ARG_ENABLE(lang-pt_BR-utf8,
701	[  --enable-lang-pt_BR-utf8     Brazilian Portuguese language support (UTF-8)],
702     	[case "${enableval}" in
703       		yes) lang_pt_br_utf8=true  ;;
704       		no)  lang_pt_br_utf8=false ;;
705		*) AC_MSG_ERROR(bad value ${enableval} for --enable-lang-pt_BR-utf8) ;;
706     	esac],
707	[lang_pt_br_utf8=false])
708
709AM_CONDITIONAL(LANG_PT_BR_UTF8, test x$lang_pt_br_utf8 = xtrue)
710
711AC_ARG_ENABLE(recode,
712	[  --enable-recode              Use recode for charset conversion],
713     	[case "${enableval}" in
714       		yes) use_recode=true  ;;
715       		no)  use_recode=false ;;
716		*) AC_MSG_ERROR(bad value ${enableval} for --enable-recode) ;;
717     	esac],
718	[use_recode=false])
719
720dnl iconv and/or recode
721AC_CHECK_PROG(iconv_found,iconv,true,false)
722AC_CHECK_PROG(recode_found,recode,true,false)
723
724if test x"${use_recode}" = xtrue ; then
725    if test x"${recode_found}" = xfalse ; then
726	AC_MSG_ERROR(No recode found)
727    fi
728elif test x"${iconv_found}" = xfalse ; then
729    use_recode=true
730else
731    use_recode=false
732fi
733
734AM_CONDITIONAL(USE_RECODE, test x$use_recode = xtrue)
735
736dnl Optionally build the windows CHM help files
737dnl default to false as requires win32 and Microsoft HTML Help Workshop
738AC_ARG_ENABLE(chm,
739  [  --enable-chm                 Build Windows CHM help files],
740  [case "${enableval}" in
741       		yes) chm=true ;;
742       		no)  chm=false ;;
743		*) AC_MSG_ERROR(bad value ${enableval} for --enable-chm) ;;
744   esac],
745   [chm=false])
746AM_CONDITIONAL(CHM, test x$chm = xtrue)
747dnl hhc is the HTML Help Compiler for CHM documentation
748hhc_default_name=hhc$EXEEXT
749AC_ARG_WITH(hhc,
750	[  --with-hhc=<prog>            Use HTML Help Compiler executable <prog> (default hhc)],
751	[hhc=true
752	if test "$withval" = "yes"; then
753		HHC="${hhc_default_name}"
754	else
755		HHC="$withval"
756	fi],
757	[HHC="${hhc_default_name}"])
758
759# Check that hhc exists, using AC_CHECK_PROG
760if test x$chm = xtrue; then
761  if test -x "${HHC}"; then
762    # HHC was a path to the executable, and it existed, which is
763    # great! We still say something to the caller, since this is
764    # probably less confusing.
765    AC_MSG_CHECKING([for hhc])
766    AC_MSG_RESULT([yes])
767  else
768    AC_CHECK_PROG(hhc_found, ${HHC}, yes)
769    if test x"${hhc_found}" != x"yes"; then
770      AC_MSG_ERROR([HTML Help Compiler executable ${HHC} not found])
771    fi
772  fi
773fi
774
775dnl Make the build quiet
776AC_ARG_ENABLE(quiet_build,
777  [  --enable-quiet-build         Make the build quieter],
778  [case "${enableval}" in
779     yes) quiet_build=true ;;
780     no)  quiet_build=false ;;
781     *) AC_MSG_ERROR(bad value ${enableval} for --enable-quiet-build) ;;
782   esac],
783  [quiet_build=false])
784AM_CONDITIONAL(QUIET_BUILD, test x${quiet_build} = xtrue)
785
786dnl Optionally build xmaxima.exe under windows
787dnl default to false as additional software
788AC_ARG_ENABLE(xmaxima_exe,
789  [  --enable-xmaxima-exe         Build Windows xmaxima.exe for installer],
790  [case "${enableval}" in
791       		yes) xmaxima_exe=true ;;
792       		no)  xmaxima_exe=false ;;
793		*) AC_MSG_ERROR(bad value ${enableval} for --enable-xmaxima-exe) ;;
794   esac],
795   [xmaxima_exe=false])
796AM_CONDITIONAL(XMAXIMA_EXE, test x$xmaxima_exe = xtrue)
797
798dnl Optionally build xmaxima.exe under windows
799dnl default to false as additional software
800AC_ARG_ENABLE(winkill_exe,
801  [  --enable-winkill             Build Windows winkill.exe and winkill_lib.dll for installer],
802  [case "${enableval}" in
803       		yes) winkill_exe=true ;;
804       		no)  winkill_exe=false ;;
805		*) AC_MSG_ERROR(bad value ${enableval} for --enable-winkill-exe) ;;
806   esac],
807   [winkill_exe=false])
808AM_CONDITIONAL(WINKILL_EXE, test x$winkill_exe = xtrue)
809
810dnl Should we build a win64 installer?
811AC_ARG_ENABLE(win64-installer,
812  [  --enable-win64-installer     Build a 64bit installer on Windows],
813  [case "${enableval}" in
814                yes) win64_installer=true ;;
815                no) win64_installer=false ;;
816                *) AC_MSG_ERROR(bad valu ${enableval} for --enable-win64-installer) ;;
817  esac],
818  [win64_installer=false])
819AM_CONDITIONAL(WIN64_INSTALLER, test x$win64_installer = xtrue)
820AC_SUBST(win64_installer)
821
822dnl Enable use of MathJax in the html documentation.  This just loads
823dnl MathJax in each html file.  The texi files need to put the
824dnl appropriate @html/@end html text to generate the equations for MathJax.
825AC_ARG_ENABLE(mathjax,
826  [  --enable-mathjax             Enable MathJax support for html manual],
827  [case "${enableval}" in
828      yes) mathjax=true
829           mathjax_enable='@set mathjax true'
830           mathjax_script='<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>'
831;;
832      no)  mathjax=false
833           mathjax_enable='@clear mathjax'
834           mathjax_script="";;
835      *) AC_MSG_ERROR(bad value ${enableval} for --enable-mathjax) ;;
836   esac],
837  [mathjax=false])
838AM_CONDITIONAL(MATHJAX, test x$mathjax = xtrue)
839AC_SUBST(mathjax_script)
840AC_SUBST(mathjax_enable)
841
842dnl Tools for building xmaxima.exe on windows
843dnl Hard code the filenames for now.  Can over-ride on make command line
844GCCVER=undefined
845if test x${xmaxima_exe} = xtrue ; then
846  GCCVER=`gcc -dumpversion`
847  dnl http://tclkits.rkeene.org/fossil/wiki?name=Downloads
848  dnl and http://www.tcl.tk/starkits/
849  TCLKITSH=/c/programs/star/tclkitsh-8.6.3-win32-ix86.exe
850  TCLKIT_RUNTIME=/c/programs/star/tclkit-8.6.3-win32-ix86.exe
851  SDXKIT=/c/programs/star/sdx.kit
852  IMGKIT=/c/programs/star/img.kit
853fi
854
855AC_SUBST(GCCVER)
856AC_SUBST(TCLKITSH)
857AC_SUBST(TCLKIT_RUNTIME)
858AC_SUBST(SDXKIT)
859AC_SUBST(IMGKIT)
860AM_CONDITIONAL(GCC331, test x${GCCVER} = x3.3.1)
861
862if test x"${explicit_lisp}" = xfalse ; then
863	dnl See if any of the lisps can be found
864  	AC_CHECK_PROG(clisp_found,${clisp_default_name},true,false)
865	AC_CHECK_PROG(gcl_found,${gcl_default_name},true,false)
866	AC_CHECK_PROG(cmucl_found,$CMUCL_NAME,true,false)
867	AC_CHECK_PROG(scl_found,$SCL_NAME,true,false)
868	AC_CHECK_PROG(sbcl_found,$SBCL_NAME,true,false)
869	AC_CHECK_PROG(acl_found,$ACL_NAME,true,false)
870	AC_CHECK_PROG(openmcl_found,$OPENMCL_NAME,true,false)
871	AC_CHECK_PROG(ccl64_found,$CCL64_NAME,true,false)
872	AC_CHECK_PROG(ecl_found,$ECL_NAME,true,false)
873
874  	if test x"${clisp_found}" = xtrue ; then
875  		clisp=true
876		lisps_enabled="${lisps_enabled} clisp"
877  	elif test x"${gcl_found}" = xtrue ; then
878		gcl=true
879		lisps_enabled="${lisps_enabled} gcl"
880	elif test x"${cmucl_found}" = xtrue ; then
881		cmucl=true
882		lisps_enabled="${lisps_enabled} cmucl"
883	elif test x"${scl_found}" = xtrue ; then
884		scl=true
885		lisps_enabled="${lisps_enabled} scl"
886	elif test x"${sbcl_found}" = xtrue ; then
887	   	sbcl=true
888		lisps_enabled="${lisps_enabled} sbcl"
889	elif test x"${acl_found}" = xtrue ; then
890		acl=true
891		lisps_enabled="${lisps_enabled} acl"
892	elif test x"${ecl_found}" = xtrue ; then
893		ecl=true
894		lisps_enabled="${lisps_enabled} ecl"
895	else
896		AC_MSG_ERROR(No lisp implementation specified and none of the default executables [${clisp_default_name}(clisp),${gcl_default_name}(GCL),${cmucl_default_name}(CMUCL),${scl_default_name}(SCL),${sbcl_default_name}(SBCL),${acl_default_name}(ACL),${openmcl_default_name}(OpenMCL),${ecl_default_name}(ECL)] were found in PATH)
897	fi
898fi
899
900AM_CONDITIONAL(ABCL, test x$abcl = xtrue)
901AM_CONDITIONAL(CLISP, test x$clisp = xtrue)
902AM_CONDITIONAL(CLISP_EXEC, test x$clisp_exec = xtrue)
903AM_CONDITIONAL(GCL, test x$gcl = xtrue)
904AM_CONDITIONAL(CMUCL, test x$cmucl = xtrue)
905AM_CONDITIONAL(CMUCL_EXEC, test x${cmucl_exec} = xtrue)
906AM_CONDITIONAL(SCL, test x$scl = xtrue)
907AM_CONDITIONAL(SBCL, test x$sbcl = xtrue)
908AM_CONDITIONAL(SBCL_EXEC, test x$sbcl_exec = xtrue)
909AM_CONDITIONAL(ACL, test x$acl = xtrue)
910AM_CONDITIONAL(OPENMCL, test x$openmcl = xtrue)
911AM_CONDITIONAL(OPENMCL_EXEC, test x${openmcl_exec} = xtrue)
912AM_CONDITIONAL(ECL, test x$ecl = xtrue)
913AM_CONDITIONAL(CCL64, test x$ccl64 = xtrue)
914AM_CONDITIONAL(CCL64_EXEC, test x${ccl64_exec} = xtrue)
915
916if test x"${clisp}" = xtrue; then
917    if test x"${CLISP_RUNTIME_PATH}" = x"" ; then
918        if test x"${mingw}" = xtrue ; then
919            CLISP_RUNTIME_PATH=`${CLISP_NAME} -norc -q -x "(format nil \"~a${CLISP_RUNTIME}\" (namestring *lib-directory*))"|sed 's/\"\\(.*\\)\"/\\1/'`
920        else
921            CLISP_RUNTIME_PATH=`${CLISP_NAME} -norc -q -x "(format nil \"~abase/${CLISP_RUNTIME}\" (namestring *lib-directory*))"|sed 's/\"\\(.*\\)\"/\\1/'`
922        fi
923    fi
924    if test -x ${CLISP_RUNTIME_PATH} ; then
925        echo "clisp runtime is \"${CLISP_RUNTIME_PATH}\""
926    else
927        AC_MSG_ERROR(clisp runtime \"${CLISP_RUNTIME_PATH}\" is not an executable)
928    fi
929    CLISP_RUNTIME=`basename ${CLISP_RUNTIME_PATH}`
930fi
931
932if test x"${cmucl}" = xtrue; then
933    if test x"${CMUCL_RUNTIME_PATH}" = x"" ; then
934        CMUCL_RUNTIME_PATH=`${CMUCL_NAME} -noinit -nositeinit -quiet -batch -eval '#-cmu18 (progn (setf (search-list "cmuclbin:") (append (lisp::parse-unix-search-path lisp::*cmucl-lib*) (mapcar (function (lambda (p) (concatenate (quote string) p "../bin/"))) (lisp::parse-unix-search-path lisp::*cmucl-lib*))))(enumerate-search-list (s "cmuclbin:lisp") (when (probe-file s) (format t "~A~%" s) (quit)))) #+cmu18 (format t "~a/../bin/lisp~%" common-lisp::*cmucl-lib*)(quit)'`
935    fi
936    if test -x "${CMUCL_RUNTIME_PATH}" ; then
937        echo "cmucl runtime is \"${CMUCL_RUNTIME_PATH}\""
938    else
939dnl last chance: find CMUCL_NAME in path. Use it if it doesn't appear to
940dnl be a shell script.
941	cmucl_path=`type -p "${CMUCL_NAME}"`
942	if test x"`grep -c '#!.*bin.*sh.*' ${cmucl_path}`" = x"0" ; then
943	   	CMUCL_RUNTIME_PATH="${cmucl_path}"
944	else
945		AC_MSG_ERROR([Unable to determine CMUCL runtime path.
946The best guess for CMUCL runtime, \"${CMUCL_RUNTIME_PATH}\", is not
947an executable. Use the argument
948   --with-cmucl-runtime=<path>
949to set the actual CMUCL executable. If the CMUCL lisp command is a shell
950script the CMUCL executable is the program exec'd by that shell script.])
951	fi
952    fi
953    CMUCL_RUNTIME=`basename ${CMUCL_RUNTIME_PATH}`
954
955dnl cmucl final check
956   result=`"${CMUCL_RUNTIME_PATH}" -quiet -eval '(format t "MAXIMA_CMUCL_TEST_SUCCESS%")(quit)'`
957   retval=$?
958   if test ! x"${retval}" = x"0" ; then
959      AC_MSG_ERROR(unable to run cmucl runtime = "${CMUCL_RUNTIME_PATH}".
960Please specify the full path of the cmucl runtime using the
961    --with-cmucl-runtime=<path>
962flag.)
963   fi
964   count=`echo "${result}" | grep -c "MAXIMA_CMUCL_TEST_SUCCESS"`
965   if test ! "${count}" = "1" ; then
966      AC_MSG_ERROR(an error occured while checking cmucl runtime)
967   fi
968fi
969
970if test x"${scl}" = xtrue; then
971    if test x"${SCL_RUNTIME_PATH}" = x"" ; then
972        SCL_RUNTIME_PATH=`${SCL_NAME} -noinit -nositeinit -quiet -batch -eval '(progn (enumerate-pathname-translations (pathname "file://library/../bin/lisp") (when (probe-file pathname) (format t "~A~%" (unix-namestring pathname)))) (quit))'`
973    fi
974    if test -x "${SCL_RUNTIME_PATH}" ; then
975        echo "scl runtime is \"${SCL_RUNTIME_PATH}\""
976    else
977dnl last chance: find SCL_NAME in path. Use it if it doesn't appear to
978dnl be a shell script.
979	scl_path=`type -p "${SCL_NAME}"`
980	if test x"`grep -c '#!.*bin.*sh.*' ${scl_path}`" = x"0" ; then
981	   	SCL_RUNTIME_PATH="${scl_path}"
982	else
983		AC_MSG_ERROR([Unable to determine SCL runtime path.
984The best guess for SCL runtime, \"${SCL_RUNTIME_PATH}\", is not
985an executable. Use the argument
986   --with-scl-runtime=<path>
987to set the actual SCL executable. If the SCL lisp command is a shell
988script the SCL executable is the program exec'd by that shell script.])
989	fi
990    fi
991    SCL_RUNTIME=`basename ${SCL_RUNTIME_PATH}`
992fi
993
994if test x"${gcl}" = xtrue; then
995   result=`"${GCL_NAME}" -batch -eval '#+ansi-cl (format t "MAXIMA_GCL_ANSI_TEST_SUCCESS~%") #-ansi-cl (format t "MAXIMA_GCL_ANSI_TEST_FAILURE~%")' -eval '(si::bye)'`
996   retval=$?
997   if test ! x"${retval}" = x"0" ; then
998      AC_MSG_ERROR(unable to run gcl executable \"${GCL_NAME}\".)
999   fi
1000   count=`echo "${result}" | grep -c "MAXIMA_GCL_ANSI_TEST_SUCCESS"`
1001   if test ! "${count}" = "1" ; then
1002      AC_MSG_ERROR([The gcl executable \"${GCL_NAME}\" was not compiled with
1003the --enable-ansi flag, which is required for Maxima.
1004The gcl ANSI-CL check returned
1005\"${result}\".])
1006   fi
1007fi
1008
1009AC_ARG_ENABLE(gcl-alt-link,
1010	[  --enable-gcl-alt-link        Use GCL's alternate linking mechanism],
1011     	[case "${enableval}" in
1012       		yes) gcl_alt_link=true ;;
1013       		no)  gcl_alt_link=false ;;
1014		*) AC_MSG_ERROR(bad value ${enableval} for --enable-gcl-alt-link) ;;
1015     	esac],
1016	[gcl_alt_link=false])
1017
1018AM_CONDITIONAL(GCL_ALT_LINK, test x$gcl_alt_link = xtrue)
1019
1020AC_ARG_WITH(default-lisp,
1021	[  --with-default-lisp=<lisp>   Set default lisp implementation to <lisp>],
1022     	[case "${withval}" in
1023       		clisp)
1024			if test x"${clisp}" = xtrue ; then
1025				DEFAULTLISP=clisp
1026			else
1027				AC_MSG_ERROR(clisp not enabled)
1028			fi
1029			;;
1030		cmucl)
1031			if test x"${cmucl}" = xtrue ; then
1032				DEFAULTLISP=cmucl
1033			else
1034				AC_MSG_ERROR(cmucl not enabled)
1035			fi
1036			;;
1037		scl)
1038			if test x"${scl}" = xtrue ; then
1039				DEFAULTLISP=scl
1040			else
1041				AC_MSG_ERROR(scl not enabled)
1042			fi
1043			;;
1044		sbcl)
1045			if test x"${sbcl}" = xtrue ; then
1046				DEFAULTLISP=sbcl
1047			else
1048				AC_MSG_ERROR(sbcl not enabled)
1049			fi
1050			;;
1051		gcl)
1052			if test x"${gcl}" = xtrue ; then
1053				DEFAULTLISP=gcl
1054			else
1055				AC_MSG_ERROR(gcl not enabled)
1056			fi
1057			;;
1058		acl)
1059			if test x"${acl}" = xtrue ; then
1060				DEFAULTLISP=acl
1061			else
1062				AC_MSG_ERROR(acl not enabled)
1063			fi
1064			;;
1065		openmcl)
1066			if test x"${openmcl}" = xtrue ; then
1067				DEFAULTLISP=openmcl
1068			else
1069				AC_MSG_ERROR(openmcl not enabled)
1070			fi
1071			;;
1072		ecl)
1073			if test x"${ecl}" = xtrue ; then
1074				DEFAULTLISP=ecl
1075			else
1076				AC_MSG_ERROR(ecl not enabled)
1077			fi
1078			;;
1079		ccl64)
1080			if test x"${ccl64}" = xtrue ; then
1081				DEFAULTLISP=ccl64
1082			else
1083				AC_MSG_ERROR(ccl64 not enabled)
1084			fi
1085			;;
1086		abcl)
1087			if test x"${abcl}" = xtrue ; then
1088				DEFAULTLISP=abcl
1089			else
1090				AC_MSG_ERROR(abcl not enabled)
1091			fi
1092			;;
1093		*)
1094			AC_MSG_ERROR(Unknown argument ${DEFAULTLISP} to --with-default-lisp)
1095			;;
1096     	esac],
1097	[if test x"${sbcl}" = xtrue ; then
1098		DEFAULTLISP=sbcl
1099	elif test x"${cmucl}" = xtrue ; then
1100		DEFAULTLISP=cmucl
1101	elif test x"${scl}" = xtrue ; then
1102		DEFAULTLISP=scl
1103	elif test x"${clisp}" = xtrue ; then
1104	   	DEFAULTLISP=clisp
1105	elif test x"${gcl}" = xtrue ; then
1106	   	DEFAULTLISP=gcl
1107	elif test x"${acl}" = xtrue ; then
1108		DEFAULTLISP=acl
1109	elif test x"${openmcl}" = xtrue ; then
1110		DEFAULTLISP=openmcl
1111	elif test x"${ecl}" = xtrue ; then
1112		DEFAULTLISP=ecl
1113	elif test x"${ccl64}" = xtrue ; then
1114		DEFAULTLISP=ccl64
1115	elif test x"${abcl}" = xtrue ; then
1116		DEFAULTLISP=abcl
1117	else
1118		AC_MSG_ERROR(Internal error. No lisp enabled. Please contact maintainer.)
1119	fi])
1120
1121AC_SUBST(CLISP_NAME)
1122AC_SUBST(CLISP_RUNTIME)
1123AC_SUBST(CLISP_RUNTIME_PATH)
1124AC_SUBST(CMUCL_NAME)
1125AC_SUBST(CMUCL_RUNTIME)
1126AC_SUBST(CMUCL_RUNTIME_PATH)
1127AC_SUBST(CMUCL_EXEC)
1128AC_SUBST(SCL_NAME)
1129AC_SUBST(SCL_RUNTIME)
1130AC_SUBST(SCL_RUNTIME_PATH)
1131AC_SUBST(SBCL_NAME)
1132AC_SUBST(GCL_NAME)
1133AC_SUBST(ACL_NAME)
1134AC_SUBST(OPENMCL_NAME)
1135AC_SUBST(ECL_NAME)
1136AC_SUBST(CCL64_NAME)
1137AC_SUBST(DEFAULTLISP)
1138AC_SUBST(HHC)
1139AC_SUBST(lisps_enabled)
1140AC_SUBST(ABCL_JAR)
1141AC_SUBST(JRE)
1142
1143AC_ARG_WITH(posix-shell,
1144	[  --with-posix-shell=<path>    Use <shell> for maxima script (default /bin/sh)],
1145	[posix_shell_list="${withval}"],
1146	[posix_shell_list="/bin/sh /bin/bash /usr/bin/bash /usr/local/bin/bash"])
1147
1148AC_ARG_WITH(wish,
1149	[  --with-wish=<prog>           Use <prog> for Tk wish shell (default wish)],
1150	[WISH="${withval}"],
1151	[WISH="wish"])
1152AC_SUBST(WISH)
1153
1154
1155AC_MSG_CHECKING(POSIX shell to see that it contains getopts)
1156cat <<EOF > conftest-posix-shell.sh
1157getopts "ab:" opt
1158result="\$?"
1159echo "result is \$result"
1160exit "\$result"
1161EOF
1162POSIX_SHELL=""
1163for shell in $posix_shell_list
1164do
1165	if test -z "$POSIX_SHELL" ; then
1166		echo "trying $shell"
1167		$shell conftest-posix-shell.sh -a > /dev/null 2>&1
1168		if test "$?" = "0" ; then
1169			POSIX_SHELL="$shell"
1170		fi
1171	fi
1172done
1173rm -f conftest-posix-shell.sh
1174if test -n "$POSIX_SHELL" ; then
1175	AC_MSG_RESULT(POSIX shell is $POSIX_SHELL)
1176else
1177	AC_MSG_WARN(Could not find a shell that supports getopts.
1178The maxima wrapper script will be unusable. The shell may be specified
1179with --with-posix-shell=</path/to/shell>)
1180fi
1181AC_SUBST(POSIX_SHELL)
1182
1183if test x"${prefix}" = xNONE ; then
1184	tmp_prefix="/usr/local"
1185else
1186	tmp_prefix="${prefix}"
1187fi
1188if test x"${exec_prefix}" = xNONE ; then
1189	tmp_exec_prefix="${tmp_prefix}"
1190else
1191	tmp_exec_prefix="${exec_prefix}"
1192fi
1193expanded_top_srcdir="$(cd "$top_srcdir" 1>/dev/null 2>/dev/null; pwd)"
1194expanded_exec_prefix="${tmp_exec_prefix}"
1195expanded_libdir="$(eval "exec_prefix=\"${tmp_exec_prefix}\";echo ${libdir}")"
1196expanded_libexecdir="$(eval "exec_prefix=\"${tmp_exec_prefix}\";echo ${libexecdir}")"
1197expanded_datadir="$(eval "prefix=\"${tmp_prefix}\";datarootdir=\"${datarootdir}\";echo ${datadir}")"
1198expanded_infodir="$(eval "prefix=\"${tmp_prefix}\";datarootdir=\"${datarootdir}\";echo ${infodir}")"
1199
1200
1201dnl Find all the directories in share, but remove the share directory
1202dnl itself and all CVS directories (if any) and fortran directories
1203dnl and *.t2p directories (created when generating pdf documentation).
1204dnl Remove the leading "share" part of the path, and add double-quotes
1205dnl around it.
1206
1207#default_sharedirs=`find share -type d | sort | egrep -v 'share$|CVS|/fortran' | sed 's;share/\(.*\);        "\1" \\\\;' | sed '$s;\\\\;;'`
1208default_sharedirs=`cd $srcdir;find share -type d | sort | egrep -v 'share$|CVS|/fortran' | sed 's;share/\(.*\);"\1";' | tr '\n' ' '`
1209
1210AC_SUBST(top_srcdir)
1211AC_SUBST(abs_top_builddir)
1212AC_SUBST(abs_top_srcdir)
1213AC_SUBST(top_builddir)
1214AC_SUBST(expanded_top_srcdir)
1215AC_SUBST(expanded_exec_prefix)
1216AC_SUBST(expanded_libdir)
1217AC_SUBST(expanded_libexecdir)
1218AC_SUBST(expanded_datadir)
1219AC_SUBST(expanded_infodir)
1220default_layout_autotools="true"
1221AC_SUBST(default_layout_autotools)
1222AC_SUBST(LDFLAGS)
1223AC_SUBST(default_sharedirs)
1224
1225AC_ARG_WITH(emacs-prefix,
1226	[  --emacs-prefix=<path>        Where to install the emacs modes to],
1227	[EMACSDIR="$withval"],
1228	[EMACSDIR="${datarootdir}/emacs/site-lisp"])
1229AC_SUBST(EMACSDIR)
1230
1231dnl Tell defsystem that this isn't a lisp-only build
1232lisp_only_build="nil"
1233AC_SUBST(lisp_only_build)
1234dnl Extra files we want to clean from the src dir
1235if test x"$srcdir" = x"." ; then
1236   DISTCLEAN_EXTRA_SRC_FILES=""
1237else
1238   DISTCLEAN_EXTRA_SRC_FILES=share_subdirs.lisp
1239fi
1240AC_SUBST(DISTCLEAN_EXTRA_SRC_FILES)
1241
1242
1243dnl Look for grep that can handle long lines and -e.
1244AC_PROG_EGREP
1245AC_SUBST(EGREP)
1246AC_PATH_PROG([CAT],[cat])
1247AC_PROG_SED
1248AC_PROG_AWK
1249AM_PATH_PYTHON
1250AC_SUBST(SED)
1251
1252# Configure these files and make them executable
1253AC_CONFIG_FILES([maxima-local], chmod +x maxima-local)
1254AC_CONFIG_FILES([src/startmaxima_abcl.sh], chmod +x src/startmaxima_abcl.sh)
1255AC_CONFIG_FILES([xmaxima-local], chmod +x xmaxima-local)
1256AC_CONFIG_FILES([tests/test.sh], chmod +x tests/test.sh)
1257AC_CONFIG_FILES([doc/info/build_html.sh], chmod +x doc/info/build_html.sh)
1258
1259# Convert maxima.bat to DOS line ending
1260# sed-3.02 in old mingw distribution doesn't support -i or \r
1261# dos2unix may not be present, but perl is required elsewhere
1262# perl -i interferes with binmode so need to use a temporary file
1263AC_CONFIG_FILES([src/maxima.bat], (perl -ne 'BEGIN{binmode(STDOUT,":crlf")};' -e 'print' < src/maxima.bat > src/maxima.bat.tmp; mv src/maxima.bat.tmp src/maxima.bat))
1264AC_CONFIG_FILES([src/maxima], chmod +x src/maxima)
1265
1266AC_OUTPUT(Makefile maxima.spec maxima.iss \
1267admin/Makefile src/Makefile src/rmaxima src/autoconf-variables.lisp \
1268src/share-subdirs_autogenerated.lisp \
1269lisp-utils/Makefile tests/Makefile doc/Makefile \
1270crosscompile-windows/Makefile \
1271doc/emaxima/Makefile doc/info/Makefile doc/info/include-maxima.texi \
1272desktopintegration/Makefile \
1273doc/info/texi2html.init \
1274doc/info/figures/Makefile \
1275doc/info/de/Makefile \
1276doc/info/de.utf8/Makefile doc/info/es/Makefile doc/info/es.utf8/Makefile \
1277doc/info/pt/Makefile doc/info/pt.utf8/Makefile \
1278doc/info/pt/include-maxima.texi \
1279doc/info/pt_BR/Makefile doc/info/pt_BR.utf8/Makefile \
1280doc/intromax/Makefile doc/man/Makefile doc/man/maxima.1 doc/man/ru/maxima.1 \
1281doc/share/Makefile interfaces/Makefile interfaces/emacs/Makefile \
1282interfaces/emacs/emaxima/Makefile interfaces/emacs/imaxima/Makefile \
1283interfaces/emacs/misc/Makefile interfaces/xmaxima/Makefile \
1284interfaces/xmaxima/autoconf-variables.tcl interfaces/xmaxima/Tkmaxima/Header.tcl \
1285interfaces/xmaxima/doc/Makefile interfaces/xmaxima/doc/figures/Makefile \
1286interfaces/xmaxima/msgs/Makefile interfaces/xmaxima/win32/Makefile \
1287plotting/mgnuplot share/Makefile demo/Makefile plotting/Makefile locale/Makefile \
1288share/contrib/Makefile share/contrib/integration/Makefile \
1289share/contrib/maxima-odesolve/Makefile \
1290share/draw/Makefile share/logic/Makefile  doc/info/es/include-maxima.texi \
1291src/lisp)
1292
1293# The default of 4096 is sometimes too little for the test suite.
1294if test x"${sbcl}" = xtrue ; then
1295   AC_MSG_CHECKING(Testing if sbcl complains if we try to enlarge the thread-local storage)
1296   echo "(quit)" | ${SBCL_NAME} --tls-limit 8192 > /dev/null 2>&1
1297   if test "$?" = "0" ; then
1298	SBCL_EXTRA_ARGS="--tls-limit 8192"
1299	AC_MSG_RESULT(Yes)
1300   else
1301	SBCL_EXTRA_ARGS=""
1302	AC_MSG_RESULT(No)
1303   fi
1304fi
1305AC_SUBST(SBCL_EXTRA_ARGS)
1306
1307if test x"${clisp}" = xtrue ; then
1308   	echo
1309	AC_MSG_WARN("CLISP 2.49 is known to sporadically produce garbled data if the front-end is fast enough to acknowledge a data packet while a next data packet is still being prepared.")
1310fi
1311echo
1312echo "Summary:"
1313if test x"${clisp}" = xtrue ; then
1314	echo "Compiling an maxima image that uses \"${CLISP_NAME}\"",
1315	echo "clisp runtime is \"${CLISP_RUNTIME_PATH}\""
1316	if test x"${clisp_exec}" = xtrue ; then
1317		echo "clisp executable image enabled for maxima."
1318	else
1319		echo Use "--enable-clisp-exec to build a standalone executable instead."
1320	fi
1321fi
1322if test x"${cmucl}" = xtrue ; then
1323	echo "Compiling an maxima image that uses \"${CMUCL_NAME}\""
1324	echo "cmucl runtime is \"${CMUCL_RUNTIME_PATH}\""
1325	if test x"${cmucl_exec}" = xtrue; then
1326		echo "CMUCL executable image enabled for maxima."
1327	else
1328		echo Use "--enable-cmucl-exec to build a standalone executable instead."
1329	fi
1330fi
1331if test x"${scl}" = xtrue ; then
1332	echo "SCL enabled, that uses \"${SCL_NAME}\""
1333	echo "SCL runtime is \"${SCL_RUNTIME_PATH}\""
1334fi
1335if test x"${sbcl}" = xtrue ; then
1336   	echo "Compiling an maxima image that uses \"${SBCL_NAME}\""
1337	if test x"${sbcl_exec}" = xtrue ; then
1338	   	echo "sbcl executable image enabled for maxima."
1339	else
1340		echo Use "--enable-sbcl-exec to build a standalone executable instead."
1341	fi
1342fi
1343if test x"${gcl}" = xtrue ; then
1344	echo "Compiling an maxima image that uses \"${GCL_NAME}\""
1345	if test x"${gcl_alt_link}" = xtrue ; then
1346		echo "    GCL alternative linking method enabled."
1347	fi
1348fi
1349if test x"${acl}" = xtrue ; then
1350	echo "ACL enabled. Executable name: \"${ACL_NAME}\""
1351fi
1352if test x"${openmcl}" = xtrue ; then
1353	echo "Compiling an maxima image that uses \"${OPENMCL_NAME}\""
1354	if test x"${openmcl_exec}" = xtrue ; then
1355		echo "OpenMCL executable image enabled for maxima."
1356	else
1357		echo Use "--enable-openmcl-exec to build a standalone executable instead."
1358	fi
1359fi
1360if test x"${ccl64}" = xtrue ; then
1361	echo "Compiling an maxima image that uses \"${CCL64_NAME}\""
1362	if test x"${ccl64_exec}" = xtrue ; then
1363	   	echo "CCL64 executable image enabled for maxima."
1364	else
1365	   	echo Use "--enable-ccl64-exec to build a standalone executable instead."
1366	fi
1367fi
1368
1369if test x"${ecl}" = xtrue ; then
1370	if test x"$srcdir" = x"." ; then
1371		echo "Compiling maxima using \"${ECL_NAME}\""
1372	else
1373		echo "ECL enabled. Executable name: \"${ECL_NAME}\""
1374		AC_MSG_ERROR(For ECL out-of-tree builds aren't supported. See src/maxima.system for details.)
1375	fi
1376fi
1377
1378if test x"${abcl}" = xtrue ; then
1379	if test x"$srcdir" = x"." ; then
1380		echo "Compiling maxima using \"${ABCL_JAR}\""
1381	else
1382		echo "ABCL enabled. ABCL jarfile: \"${ABCL_JAR}\""
1383		AC_MSG_ERROR(For ABCL out-of-tree builds aren't supported. See src/maxima.system for details.)
1384	fi
1385fi
1386
1387echo "default lisp: $DEFAULTLISP"
1388echo "wish executable name: \"${WISH}\""
1389
1390if test x"${chm}" = xtrue ; then
1391  echo "CHM help files enabled"
1392  echo "  HHC: \"${HHC}\""
1393fi
1394if test x"${xmaxima_exe}" = xtrue ; then
1395   echo "Windows xmaxima.exe enabled"
1396   echo "  GCC version GCCVER: ${GCCVER}"
1397   echo "  TCLKITSH: ${TCLKITSH}"
1398   if ! test -f "${TCLKITSH}" ; then
1399     AC_MSG_WARN(*** TCLKITSH ${TCLKITSH} not found)
1400     xmaxima_exe_prerequisite=notfound
1401   fi
1402   echo "  TCLKIT_RUNTIME: ${TCLKIT_RUNTIME}"
1403   if ! test -f "${TCLKIT_RUNTIME}" ; then
1404     AC_MSG_WARN(*** TCLKIT_RUNTIME ${TCLKIT_RUNTIME} not found)
1405     xmaxima_exe_prerequisite=notfound
1406   fi
1407   echo "  SDXKIT: ${SDXKIT}"
1408   if ! test -f "${SDXKIT}" ; then
1409     AC_MSG_WARN(*** SDXKIT ${SDXKIT} not found)
1410     xmaxima_exe_prerequisite=notfound
1411   fi
1412   echo "  IMGKIT: ${IMGKIT}"
1413   if ! test -f "${IMGKIT}" ; then
1414     AC_MSG_WARN(*** IMGKIT ${IMGKIT} not found)
1415     xmaxima_exe_prerequisite=notfound
1416   fi
1417   if test x${xmaxima_exe_prerequisite} = xnotfound ; then
1418     AC_MSG_WARN([A prerequisite for xmaxima.exe not found.  The missing components can be defined on the make command line.])
1419   fi
1420fi
1421