source: main/trunk/greenstone2/common-src/indexers/mgpp/configure.in

Last change on this file was 37389, checked in by anupama, 14 months ago

Make configure script for mg/mgpp choose between which Java framework to set as part of the JNILDFlAGS variable on a Mac, depending on version of xcode compile tools installed. Tested in separate bash script. Committing now in order to test with release-kit.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 6.9 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(text/MGQuery.cpp)
3AC_CONFIG_HEADER(config.h)
4
5dnl get $target_cpu, $target_vendor, and $target_os
6dnl (as well as host_*)
7AC_CANONICAL_SYSTEM
8AC_ARG_PROGRAM
9
10dnl
11PACKAGE=mgpp
12VERSION=1.3
13
14AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
15AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
16AC_SUBST(PACKAGE)
17AC_SUBST(VERSION)
18
19gsdlos=`uname | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
20# check for running bash under cygwin
21 if test "`echo $gsdlos | sed 's/cygwin//'`" != "$gsdlos" ;
22 then
23 gsdlos=windows
24 fi
25if test "x$crossOS" != "x" ; then
26 gsdlos=$crossOS
27 gsdlarch=""
28fi
29AC_SUBST(gsdlos)
30
31dnl
32dnl Disable all Java compilation
33dnl
34AC_ARG_ENABLE(java, [ --disable-java Disable Java compilation], ENABLE_JAVA=$enableval, ENABLE_JAVA=yes)
35if test $ENABLE_JAVA = "yes" -o $ENABLE_JAVA = "1" ; then
36 ENABLE_JAVA=1
37 if test "x$JAVA_HOME" != "x" ; then
38 echo "Detected JAVA_HOME is set, however this will not be used during compilation"
39 echo "To control the version of 'javac' and 'java' set environment variables JAVAC"
40 echo "and JAVA respectively"
41 export JAVA_HOME=
42 fi
43else
44 ENABLE_JAVA=0
45fi
46AC_SUBST(ENABLE_JAVA)
47
48dnl AC_MSG_CHECKING(to see if architecture is 64-bit)
49dnl arch_64bit=no
50dnl case "$host_cpu" in
51dnl x86_64) arch_64bit=yes ;;
52dnl esac
53if test -z "$ARCH_DEP_FLAGS" ; then
54 ARCH_DEP_FLAGS=
55fi
56AC_SUBST(ARCH_DEP_FLAGS)
57
58dnl
59dnl disable compilation of accent folding stuff for mgpp (and one day mg)
60dnl
61AC_ARG_ENABLE(accentfold, [ --disable-accentfold Disable Accent Folding for MGPP], ENABLE_ACCENTFOLD=$enableval, ENABLE_ACCENTFOLD=yes)
62if test $ENABLE_ACCENTFOLD = "yes" -o $ENABLE_ACCENTFOLD = "1" ; then
63 ENABLE_ACCENTFOLD=1
64 AC_DEFINE(ENABLE_ACCENTFOLD,[])
65else
66 ENABLE_ACCENTFOLD=0
67fi
68AC_SUBST(ENABLE_ACCENTFOLD)
69
70
71dnl Checks for programs.
72AC_PROG_CXX
73AC_PROG_AWK
74AC_PROG_YACC
75AC_PROG_CC
76AC_PROG_INSTALL
77AC_PROG_LN_S
78AC_PROG_MAKE_SET
79AC_PROG_RANLIB
80if test $ENABLE_JAVA = "1" ; then
81 AC_PROG_JAVA
82 AC_PROG_JAVAC
83fi
84
85dnl Checks for typedefs, structures, and compiler characteristics.
86AC_AIX
87AC_ISC_POSIX
88AC_MINIX
89fp_C_PROTOTYPES
90AC_C_CONST
91AC_TYPE_OFF_T
92AC_TYPE_SIZE_T
93AC_HEADER_TIME
94AC_STRUCT_TM
95
96dnl
97dnl look for unac package if not in standard location
98dnl
99dnl is it ok to use `pwd` like this??
100AC_ARG_WITH(unac, [ --with-unac=dir Use local unac library and headers], UNAC_DIR=$withval, UNAC_DIR="`pwd`/../packages/unac")
101AC_DEFINE_UNQUOTED(UNAC_DIR, "$UNAC_DIR")
102AC_SUBST(UNAC_DIR)
103
104dnl
105dnl look for libiconv package if not in standard location
106dnl
107#AC_ARG_WITH(unac, [ --with-libiconv-prefix=dir Use local libiconv library], LIBICONV_DIR=$withval)
108#AC_DEFINE_UNQUOTED(LIBICONV_DIR, "$LIBICONV_DIR")
109#AC_SUBST(LIBICONV_DIR)
110
111
112dnl --- This should be in the stdc checking -----------------
113if test "$ac_cv_prog_cc_stdc" = '-Xc'; then
114dnl The Pyramids running SMP_DC.OSx on MIPS r3000 chips with
115dnl /usr/opt/cc3.11/bin/cc treat -Xc as full ANSI mode - no POSIX or
116dnl XOPEN extensions (like popen).
117dnl Unfortunately -D_{XOPEN,POSIX}_SOURCE can't provide all that mg
118dnl needs. So drop back to -Xa
119AC_TRY_COMPILE(
120[#include <stdio.h>
121], [ FILE *rubbish = popen("yes", "r"); ],,
122[CC="`echo $CC | sed 's/-Xc/-Xa/'`" ac_cv_prog_cc_stdc='-Xa'])
123fi
124dnl ----------------------
125
126
127dnl Checks for libraries.
128dnl Replace `main' with a function in -lg:
129AC_CHECK_LIB(g, main)
130dnl Replace `main' with a function in -lm:
131AC_CHECK_LIB(m, main)
132dnl Replace `main' with a function in -lstdc++:
133dnl AC_CHECK_LIB(stdc++, main)
134dnl Replace `main' with a function in -lcrypt:
135AC_CHECK_LIB(crypt, main)
136#if test $ENABLE_ACCENTFOLD = 1; then
137#AC_HAVE_LIBRARY(iconv)
138#fi
139
140
141dnl Checks for header files.
142AC_HEADER_DIRENT
143AC_HEADER_STDC
144AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h crypt.h string.h memory.h sys/procfs.h)
145AC_EGREP_HEADER(fread, stdio.h, AC_DEFINE(HAVE_FREAD_DECL))
146AC_EGREP_HEADER(fgetc, stdio.h, AC_DEFINE(HAVE_FGETC_DECL))
147AC_EGREP_HEADER(pr_brksize, sys/procfs.h, AC_DEFINE(HAVE_PR_BRKSIZE))
148
149dnl Checks for library functions.
150AC_FUNC_ALLOCA
151AC_PROG_GCC_TRADITIONAL
152AC_TYPE_SIGNAL
153AC_FUNC_VPRINTF
154AC_CHECK_FUNCS(ftime select strftime strtol getrusage times mallinfo setbuffer getpagesize strerror)
155AC_REPLACE_FUNCS(ftruncate strstr strcasecmp)
156
157
158dnl see if gettext is in libc. (try the textdomain() function).
159AC_CHECK_FUNC(textdomain, AC_DEFINE(ENABLE_NLS ,1) )
160
161# we need to set an extended JNI path for Mac OS/Darwin, as jni.h is on
162# a non-standard Path
163# is there a better way to do this??
164AC_MSG_CHECKING(for OS to set JNI options)
165# set defaults
166JNIINC=""
167JNIPREFIX="lib"
168JNISUFFIX="so"
169JNICFLAGS=""
170JNILDFLAGS="-shared"
171
172if test "`(uname -s) 2> /dev/null`" = 'Darwin'; then
173 AC_MSG_RESULT(Darwin)
174 JNIINC="-I\$(JAVA_HOME)/include/darwin -I\$(JAVA_HOME)/include "
175 JNISUFFIX="jnilib"
176 knownMinXcodeVersionForNewJavaFramework=2395
177 xcodeVersion=`(xcode-select --version) 2> /dev/null`
178 if test "$?" -eq 127 || test "${xcodeVersion//[!0-9]/}" -lt $knownMinXcodeVersionForNewJavaFramework; then
179 JNILDFLAGS="-dynamiclib -fno-common -single_module -framework JavaVM"
180 else
181 JNILDFLAGS="-dynamiclib -fno-common -single_module -framework JavaNativeFoundation"
182 fi
183fi
184if test "`(uname -s) 2> /dev/null`" = 'SunOS'; then
185 AC_MSG_RESULT(Solaris)
186 JNIINC="-I\$(JAVA_HOME)/include/solaris "
187fi
188if test "`(uname -s) 2> /dev/null`" = 'Linux'; then
189 AC_MSG_RESULT(Linux)
190 JNIINC="-I\$(JAVA_HOME)/include/linux -I\$(JAVA_HOME)/include "
191fi
192
193if test "x$crossOS" != "x" ; then
194 if test "$crossOS" = "windows" ; then
195 JNIINC="-I../../java-windows-include/win32 -I../../java-windows-include "
196 JNICFLAGS="-shared -Wall -D_JNI_IMPLEMENTATION_ -Wl,--kill-at"
197 JNIPREFIX=""
198 JNISUFFIX="dll"
199 fi
200fi
201
202AC_SUBST(JNIINC)
203AC_SUBST(JNIPREFIX)
204AC_SUBST(JNISUFFIX)
205AC_SUBST(JNICFLAGS)
206AC_SUBST(JNILDFLAGS)
207
208# *** Custom checking (based on GNU tar configure.in) ***
209# ---------------------------------------------------------------------------
210AC_MSG_CHECKING(for HP-UX needing gmalloc)
211if test "`(uname -s) 2> /dev/null`" = 'HP-UX'; then
212 AC_MSG_RESULT(yes)
213 AC_LIBOBJ(gmalloc)
214 AC_DEFINE(HAVE_VALLOC)
215else
216 AC_MSG_RESULT(no)
217 AC_CHECK_FUNCS(valloc)
218fi
219
220fp_WITH_DMALLOC
221fp_WITH_REGEX
222fp_WITH_GNU_READLINE
223
224# text for endianness
225AC_C_BIGENDIAN
226
227# ---------------------------------------------------------------------------
228if test "$ac_cv_func_alloca" = 'no'; then
229dnl support functions for alloca.c
230 AC_LIBOBJ(xmalloc)
231 AC_LIBOBJ(error)
232fi
233
234
235# ---------------------------------------------------------------------------
236# see if the user wants to override use of long long
237AC_ARG_ENABLE(override-longlong,
238[ --enable-override-longlong
239 overide use of long long with GCC],
240 AC_DEFINE(DISABLE_LONG_LONG))
241
242
243# ---------------------------------------------------------------------------
244
245AC_OUTPUT([Makefile text/Makefile lib/Makefile
246 jni/Makefile java/org/greenstone/mgpp/Makefile],
247[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h])
Note: See TracBrowser for help on using the repository browser.