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

Revision 26656, 4.8 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(src/text/mgquery.c)
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=mg
12VERSION=1.2
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
46
47
48dnl Checks for programs.
49AC_PROG_CXX
50AC_PROG_AWK
51AC_PROG_YACC
52AC_PROG_CC
53AC_PROG_INSTALL
54AC_PROG_LN_S
55AC_PROG_MAKE_SET
56AC_PROG_RANLIB
57if test $ENABLE_JAVA = "1" ; then
58  AC_PROG_JAVA
59  AC_PROG_JAVAC
60fi
61
62dnl Checks for typedefs, structures, and compiler characteristics.
63AC_AIX
64AC_ISC_POSIX
65AC_MINIX
66fp_C_PROTOTYPES
67AC_C_CONST
68AC_TYPE_OFF_T
69AC_TYPE_SIZE_T
70AC_HEADER_TIME
71AC_STRUCT_TM
72
73dnl --- This should be in the stdc checking -----------------
74if test "$ac_cv_prog_cc_stdc" = '-Xc'; then
75dnl The Pyramids running SMP_DC.OSx on MIPS r3000 chips with
76dnl /usr/opt/cc3.11/bin/cc treat -Xc as full ANSI mode - no POSIX or
77dnl XOPEN extensions (like popen).
78dnl Unfortunately -D_{XOPEN,POSIX}_SOURCE can't provide all that mg
79dnl needs. So drop back to -Xa
80AC_TRY_COMPILE(
81[#include <stdio.h>
82], [ FILE *rubbish = popen("yes", "r"); ],,
83[CC="`echo $CC | sed 's/-Xc/-Xa/'`"    ac_cv_prog_cc_stdc='-Xa'])
84fi
85dnl ----------------------
86
87
88dnl Checks for libraries.
89dnl Replace `main' with a function in -lm:
90AC_CHECK_LIB(m, main)
91
92dnl Checks for header files.
93AC_HEADER_DIRENT
94AC_HEADER_STDC
95AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h string.h memory.h sys/procfs.h)
96AC_EGREP_HEADER(fread, stdio.h, AC_DEFINE(HAVE_FREAD_DECL))
97AC_EGREP_HEADER(fgetc, stdio.h, AC_DEFINE(HAVE_FGETC_DECL))
98AC_EGREP_HEADER(pr_brksize, sys/procfs.h, AC_DEFINE(HAVE_PR_BRKSIZE))
99
100dnl Checks for library functions.
101AC_FUNC_ALLOCA
102AC_PROG_GCC_TRADITIONAL
103AC_TYPE_SIGNAL
104AC_FUNC_VPRINTF
105AC_CHECK_FUNCS(ftime select strftime strtol getrusage times mallinfo setbuffer getpagesize)
106AC_REPLACE_FUNCS(ftruncate strstr strcasecmp)
107
108
109# *** Custom checking (based on GNU tar configure.in) ***
110# ---------------------------------------------------------------------------
111AC_MSG_CHECKING(for HP-UX needing gmalloc)
112if test "`(uname -s) 2> /dev/null`" = 'HP-UX'; then
113  AC_MSG_RESULT(yes)
114  AC_LIBOBJ(gmalloc)
115  AC_DEFINE(HAVE_VALLOC)
116else
117  AC_MSG_RESULT(no)
118  AC_CHECK_FUNCS(valloc)
119fi
120
121# we need to set an extended JNI path for Mac OS/Darwin, as jni.h is on
122# a non-standard Path
123# is there a better way to do this??
124AC_MSG_CHECKING(for OS to set JNI options)
125# set defaults
126JNIINC=""
127JNIPREFIX="lib"
128JNISUFFIX="so"
129JNICFLAGS=""
130JNILDFLAGS="-shared"
131
132if test "`(uname -s) 2> /dev/null`" = 'Darwin'; then
133  AC_MSG_RESULT(Darwin)
134  JNIINC="-I/System/Library/Frameworks/JavaVM.framework/Headers/ "
135  JNISUFFIX="jnilib"
136  JNILDFLAGS="-dynamiclib -fno-common -single_module -framework JavaVM"
137fi
138if test "`(uname -s) 2> /dev/null`" = 'SunOS'; then
139  AC_MSG_RESULT(Solaris)
140  JNIINC="-I\$(JAVA_HOME)/include/solaris "
141fi
142if test "`(uname -s) 2> /dev/null`" = 'Linux'; then
143  AC_MSG_RESULT(Linux)
144  JNIINC="-I\$(JAVA_HOME)/include/linux -I\$(JAVA_HOME)/in5Aclude "
145fi
146
147if test "x$crossOS" != "x" ; then
148  if test "$crossOS" = "windows" ; then
149    JNIINC="-I../../java-windows-include/win32 -I../../java-windows-include "
150    JNICFLAGS="-Wall -D_JNI_IMPLEMENTATION_ -Wl,--kill-at"
151    JNIPREFIX=""
152    JNISUFFIX="dll"
153  fi
154fi
155
156AC_SUBST(JNIINC)
157AC_SUBST(JNIPREFIX)
158AC_SUBST(JNISUFFIX)
159AC_SUBST(JNICFLAGS)
160AC_SUBST(JNILDFLAGS)
161
162fp_WITH_DMALLOC
163fp_WITH_REGEX
164
165# text for endianness
166AC_C_BIGENDIAN
167
168# ---------------------------------------------------------------------------
169if test "$ac_cv_func_alloca" = 'no'; then
170dnl    support functions for alloca.c
171  AC_LIBOBJ(xmalloc)
172  AC_LIBOBJ(error)
173fi
174
175
176# ---------------------------------------------------------------------------
177
178AC_OUTPUT([Makefile src/text/Makefile lib/Makefile
179      jni/Makefile java/org/greenstone/mg/Makefile ],
180[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h])
181
182# To prevent timestamp problems causing bool_parser.c to be generated from bool_parser.y
183touch src/text/bool_parser.c
Note: See TracBrowser for help on using the browser.