source: main/trunk/greenstone2/runtime-src/aclocal.m4@ 36232

Last change on this file since 36232 was 36232, checked in by kjdon, 3 months ago

removed the -source -target JAVACFLAGS to match what was done in build-src and common-src. we only set these now in the release kits

  • Property svn:executable set to *
File size: 13.2 KB
Line 
1# Local additions to Autoconf macros.
2# Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
3# François Pinard <pinard@iro.umontreal.ca>, 1992.
4
5# [TS:Aug/95] - chopped out the NLS stuff which I don't support
6
7## ------------------------------- ##
8## Check for function prototypes. ##
9## ------------------------------- ##
10
11AC_DEFUN(fp_C_PROTOTYPES,
12[AC_REQUIRE([fp_PROG_CC_STDC])
13AC_MSG_CHECKING([for function prototypes])
14if test "$ac_cv_prog_cc_stdc" != no; then
15 AC_MSG_RESULT(yes)
16 AC_DEFINE(PROTOTYPES)
17 U= ANSI2KNR=
18else
19 AC_MSG_RESULT(no)
20 U=_ ANSI2KNR=ansi2knr
21fi
22AC_SUBST(U)dnl
23AC_SUBST(ANSI2KNR)dnl
24])
25
26## ----------------------------------------- ##
27## ANSIfy the C compiler whenever possible. ##
28## ----------------------------------------- ##
29
30# @defmac AC_PROG_CC_STDC
31# @maindex PROG_CC_STDC
32# @ovindex CC
33# If the C compiler in not in ANSI C mode by default, try to add an option
34# to output variable @code{CC} to make it so. This macro tries various
35# options that select ANSI C on some system or another. It considers the
36# compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
37# handles function prototypes correctly.
38#
39# If you use this macro, you should check after calling it whether the C
40# compiler has been set to accept ANSI C; if not, the shell variable
41# @code{ac_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
42# code in ANSI C, you can make an un-ANSIfied copy of it by using the
43# program @code{ansi2knr}, which comes with Ghostscript.
44# @end defmac
45
46AC_DEFUN(fp_PROG_CC_STDC,
47[AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
48AC_CACHE_VAL(ac_cv_prog_cc_stdc,
49[ac_cv_prog_cc_stdc=no
50ac_save_CFLAGS="$CFLAGS"
51# Don't try gcc -ansi; that turns off useful extensions and
52# breaks some systems' header files.
53# AIX -qlanglvl=ansi
54# Ultrix and OSF/1 -std1
55# HP-UX -Aa -D_HPUX_SOURCE
56# SVR4 -Xc
57for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc
58do
59 CFLAGS="$ac_save_CFLAGS $ac_arg"
60 AC_TRY_COMPILE(
61[#if !defined(__STDC__) || __STDC__ != 1
62choke me
63#endif
64], [int test (int i, double x);
65struct s1 {int (*f) (int a);};
66struct s2 {int (*f) (double a);};],
67[ac_cv_prog_cc_stdc="$ac_arg"; break])
68done
69CFLAGS="$ac_save_CFLAGS"
70])
71AC_MSG_RESULT($ac_cv_prog_cc_stdc)
72case "x$ac_cv_prog_cc_stdc" in
73 x|xno) ;;
74 *) CC="$CC $ac_cv_prog_cc_stdc" ;;
75esac
76])
77
78## --------------------------------------------------------- ##
79## Use AC_PROG_INSTALL, supplementing it with INSTALL_SCRIPT ##
80## substitution. ##
81## --------------------------------------------------------- ##
82
83AC_DEFUN(fp_PROG_INSTALL,
84[AC_PROG_INSTALL
85test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL} -m 755'
86AC_SUBST(INSTALL_SCRIPT)dnl
87])
88
89## ----------------------------------- ##
90## Check if --with-dmalloc was given. ##
91## ----------------------------------- ##
92
93# I just checked, and GNU rx seems to work fine with a slightly
94# modified GNU m4. So, I put out the test below in my aclocal.m4,
95# and will try to use it in my things. The idea is to distribute
96# rx.[hc] and regex.[hc] together, for a while. The WITH_REGEX symbol
97# (which should also be documented in acconfig.h) is used to decide
98# which of regex.h or rx.h should be included in the application.
99#
100# If `./configure --with-regex' is given, the package will use
101# the older regex. Else, a check is made to see if rx is already
102# installed, as with newer Linux'es. If not found, the package will
103# use the rx from the distribution. If found, the package will use
104# the system's rx which, on Linux at least, will result in a smaller
105# executable file.
106
107AC_DEFUN(fp_WITH_DMALLOC,
108[AC_MSG_CHECKING(if malloc debugging is wanted)
109AC_ARG_WITH(dmalloc,
110[ --with-dmalloc use dmalloc, as in
111 ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz],
112[if test "$withval" = yes; then
113 AC_MSG_RESULT(yes)
114 AC_DEFINE(WITH_DMALLOC)
115 LIBS="$LIBS -ldmalloc"
116 LDFLAGS="$LDFLAGS -g"
117else
118 AC_MSG_RESULT(no)
119fi], [AC_MSG_RESULT(no)])
120])
121
122## --------------------------------- ##
123## Check if --with-regex was given. ##
124## --------------------------------- ##
125
126AC_DEFUN(fp_WITH_REGEX,
127[AC_MSG_CHECKING(which of rx or regex is wanted)
128AC_ARG_WITH(regex,
129[ --with-regex use older regex in lieu of GNU rx for matching],
130[if test "$withval" = yes; then
131 ac_with_regex=1
132 AC_MSG_RESULT(regex)
133 AC_DEFINE(WITH_REGEX)
134 AC_LIBOBJ([regex])
135fi])
136if test -z "$ac_with_regex"; then
137 AC_MSG_RESULT(rx)
138 AC_CHECK_FUNC(re_rx_search, , [AC_LIBOBJ([rx])])
139fi
140])
141dnl @synopsis AC_PROG_JAVAC
142dnl
143dnl AC_PROG_JAVAC tests an existing Java compiler. It uses the
144dnl environment variable JAVAC then tests in sequence various common
145dnl Java compilers. For political reasons, it starts with the free
146dnl ones.
147dnl
148dnl If you want to force a specific compiler:
149dnl
150dnl - at the configure.in level, set JAVAC=yourcompiler before calling
151dnl AC_PROG_JAVAC
152dnl
153dnl - at the configure level, setenv JAVAC
154dnl
155dnl You can use the JAVAC variable in your Makefile.in, with @JAVAC@.
156dnl
157dnl *Warning*: its success or failure can depend on a proper setting of
158dnl the CLASSPATH env. variable.
159dnl
160dnl TODO: allow to exclude compilers (rationale: most Java programs
161dnl cannot compile with some compilers like guavac).
162dnl
163dnl Note: This is part of the set of autoconf M4 macros for Java
164dnl programs. It is VERY IMPORTANT that you download the whole set,
165dnl some macros depend on other. Unfortunately, the autoconf archive
166dnl does not support the concept of set of macros, so I had to break it
167dnl for submission. The general documentation, as well as the sample
168dnl configure.in, is included in the AC_PROG_JAVA macro.
169dnl
170dnl @category Java
171dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
172dnl @version 2000-07-19
173dnl @license GPLWithACException
174
175AC_DEFUN([AC_PROG_JAVAC],[
176if test "x$JAVAC" = x ; then
177 AC_REQUIRE([AC_EXEEXT])dnl
178 if test "x$JAVAPREFIX" = x; then
179 test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, javac$EXEEXT)
180 else
181 test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, javac$EXEEXT, $JAVAPREFIX)
182 fi
183 test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH])
184else
185 echo "Checking for javac... $JAVAC"
186fi
187
188AC_SUBST(JAVAC)
189AC_PROG_JAVAC_WORKS
190AC_PROVIDE([$0])dnl
191])
192
193dnl @synopsis AC_PROG_JAVAC_WORKS
194dnl
195dnl Internal use ONLY.
196dnl
197dnl Note: This is part of the set of autoconf M4 macros for Java
198dnl programs. It is VERY IMPORTANT that you download the whole set,
199dnl some macros depend on other. Unfortunately, the autoconf archive
200dnl does not support the concept of set of macros, so I had to break it
201dnl for submission. The general documentation, as well as the sample
202dnl configure.in, is included in the AC_PROG_JAVA macro.
203dnl
204dnl @category Java
205dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
206dnl @version 2000-07-19
207dnl @license GPLWithACException
208
209AC_DEFUN([AC_PROG_JAVAC_WORKS],[
210AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [
211JAVA_TEST=Test.java
212CLASS_TEST=Test.class
213cat << \EOF > $JAVA_TEST
214/* [#]line __oline__ "configure" */
215public class Test {
216}
217EOF
218if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then
219 ac_cv_prog_javac_works=yes
220else
221 AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)])
222 echo "configure: failed program was:" >&AC_FD_CC
223 cat $JAVA_TEST >&AC_FD_CC
224fi
225rm -f $JAVA_TEST $CLASS_TEST
226])
227AC_PROVIDE([$0])dnl
228dnl The following is now explicitly set in the Release Kit. and not used for local compilation
229dnl if test "x$JAVACFLAGS" = x ; then
230dnl JAVACFLAGS="-source 1.4 -target 1.4"
231dnl fi
232AC_SUBST(JAVACFLAGS)
233])
234
235dnl @synopsis AC_PROG_JAVA
236dnl
237dnl Here is a summary of the main macros:
238dnl
239dnl AC_PROG_JAVAC: finds a Java compiler.
240dnl
241dnl AC_PROG_JAVA: finds a Java virtual machine.
242dnl
243dnl AC_CHECK_CLASS: finds if we have the given class (beware of
244dnl CLASSPATH!).
245dnl
246dnl AC_CHECK_RQRD_CLASS: finds if we have the given class and stops
247dnl otherwise.
248dnl
249dnl AC_TRY_COMPILE_JAVA: attempt to compile user given source.
250dnl
251dnl AC_TRY_RUN_JAVA: attempt to compile and run user given source.
252dnl
253dnl AC_JAVA_OPTIONS: adds Java configure options.
254dnl
255dnl AC_PROG_JAVA tests an existing Java virtual machine. It uses the
256dnl environment variable JAVA then tests in sequence various common
257dnl Java virtual machines. For political reasons, it starts with the
258dnl free ones. You *must* call [AC_PROG_JAVAC] before.
259dnl
260dnl If you want to force a specific VM:
261dnl
262dnl - at the configure.in level, set JAVA=yourvm before calling
263dnl AC_PROG_JAVA
264dnl
265dnl (but after AC_INIT)
266dnl
267dnl - at the configure level, setenv JAVA
268dnl
269dnl You can use the JAVA variable in your Makefile.in, with @JAVA@.
270dnl
271dnl *Warning*: its success or failure can depend on a proper setting of
272dnl the CLASSPATH env. variable.
273dnl
274dnl TODO: allow to exclude virtual machines (rationale: most Java
275dnl programs cannot run with some VM like kaffe).
276dnl
277dnl Note: This is part of the set of autoconf M4 macros for Java
278dnl programs. It is VERY IMPORTANT that you download the whole set,
279dnl some macros depend on other. Unfortunately, the autoconf archive
280dnl does not support the concept of set of macros, so I had to break it
281dnl for submission.
282dnl
283dnl A Web page, with a link to the latest CVS snapshot is at
284dnl <http://www.internatif.org/bortzmeyer/autoconf-Java/>.
285dnl
286dnl This is a sample configure.in Process this file with autoconf to
287dnl produce a configure script.
288dnl
289dnl AC_INIT(UnTag.java)
290dnl
291dnl dnl Checks for programs.
292dnl AC_CHECK_CLASSPATH
293dnl AC_PROG_JAVAC
294dnl AC_PROG_JAVA
295dnl
296dnl dnl Checks for classes
297dnl AC_CHECK_RQRD_CLASS(org.xml.sax.Parser)
298dnl AC_CHECK_RQRD_CLASS(com.jclark.xml.sax.Driver)
299dnl
300dnl AC_OUTPUT(Makefile)
301dnl
302dnl @category Java
303dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
304dnl @version 2000-07-19
305dnl @license GPLWithACException
306
307AC_DEFUN([AC_PROG_JAVA],[
308if test "x$JAVA" = x ; then
309 AC_REQUIRE([AC_EXEEXT])dnl
310 if test x$JAVAPREFIX = x; then
311 test x$JAVA = x && AC_CHECK_PROGS(JAVA, java$EXEEXT)
312 else
313 test x$JAVA = x && AC_CHECK_PROGS(JAVA, java$EXEEXT, $JAVAPREFIX)
314 fi
315 test x$JAVA = x && AC_MSG_ERROR([no acceptable Java virtual machine found in \$PATH])
316fi
317AC_SUBST(JAVA)
318AC_PROG_JAVA_WORKS
319AC_PROVIDE([$0])dnl
320])
321
322dnl @synopsis AC_PROG_JAVA_WORKS
323dnl
324dnl Internal use ONLY.
325dnl
326dnl Note: This is part of the set of autoconf M4 macros for Java
327dnl programs. It is VERY IMPORTANT that you download the whole set,
328dnl some macros depend on other. Unfortunately, the autoconf archive
329dnl does not support the concept of set of macros, so I had to break it
330dnl for submission. The general documentation, as well as the sample
331dnl configure.in, is included in the AC_PROG_JAVA macro.
332dnl
333dnl @category Java
334dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
335dnl @version 2000-07-19
336dnl @license GPLWithACException
337
338AC_DEFUN([AC_PROG_JAVA_WORKS], [
339AC_CHECK_PROG(uudecode, uudecode$EXEEXT, yes)
340if test x$uudecode = xyes; then
341AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [
342dnl /**
343dnl * Test.java: used to test if java compiler works.
344dnl */
345dnl public class Test
346dnl {
347dnl
348dnl public static void
349dnl main( String[] argv )
350dnl {
351dnl System.exit (0);
352dnl }
353dnl
354dnl }
355cat << \EOF > Test.uue
356begin-base64 644 Test.class
357yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE
358bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51
359bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s
360YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG
361aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB
362AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB
363AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ=
364====
365EOF
366if uudecode$EXEEXT Test.uue; then
367 ac_cv_prog_uudecode_base64=yes
368else
369 echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC
370 echo "configure: failed file was:" >&AC_FD_CC
371 cat Test.uue >&AC_FD_CC
372 ac_cv_prog_uudecode_base64=no
373fi
374rm -f Test.uue])
375fi
376if test x$ac_cv_prog_uudecode_base64 != xyes; then
377 rm -f Test.class
378 AC_MSG_WARN([I have to compile Test.class from scratch])
379 if test x$ac_cv_prog_javac_works = xno; then
380 AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly])
381 fi
382 if test x$ac_cv_prog_javac_works = x; then
383 AC_PROG_JAVAC
384 fi
385fi
386AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [
387JAVA_TEST=Test.java
388CLASS_TEST=Test.class
389TEST=Test
390changequote(, )dnl
391cat << \EOF > $JAVA_TEST
392/* [#]line __oline__ "configure" */
393public class Test {
394public static void main (String args[]) {
395 System.exit (0);
396} }
397EOF
398changequote([, ])dnl
399if test x$ac_cv_prog_uudecode_base64 != xyes; then
400 if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then
401 :
402 else
403 echo "configure: failed program was:" >&AC_FD_CC
404 cat $JAVA_TEST >&AC_FD_CC
405 AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?))
406 fi
407fi
408if AC_TRY_COMMAND($JAVA $JAVAFLAGS $TEST) >/dev/null 2>&1; then
409 ac_cv_prog_java_works=yes
410else
411 echo "configure: failed program was:" >&AC_FD_CC
412 cat $JAVA_TEST >&AC_FD_CC
413 AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?))
414fi
415rm -fr $JAVA_TEST $CLASS_TEST Test.uue
416])
417AC_PROVIDE([$0])dnl
418]
419)
Note: See TracBrowser for help on using the repository browser.