root/main/trunk/greenstone2/common-src/indexers/mgpp/configure.in @ 26656

Revision 26656, 6.3 KB (checked in by davidb, 7 years ago)

Support for cross-compilation added. In addition to the CrossOS check, this particular set of changes focus on flags that assist cross-compilation with JNI

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