source: main/trunk/greenstone2/common-src/indexers/mg/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: 5.3 KB
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
132# Boolean operators with if test: https://www.shell-tips.com/bash/if-statement/#gsc.tab=0
133# Shell regex to get number from sentence: https://linuxconfig.org/how-to-extract-number-from-a-string-using-bash-example
134if test "`(uname -s) 2> /dev/null`" = 'Darwin'; then
135 AC_MSG_RESULT(Darwin)
136 JNIINC="-I\$(JAVA_HOME)/include/darwin -I\$(JAVA_HOME)/include "
137 JNISUFFIX="jnilib"
138 knownMinXcodeVersionForNewJavaFramework=2395
139 xcodeVersion=`(xcode-select --version) 2> /dev/null`
140 if test "$?" -eq 127 || test "${xcodeVersion//[!0-9]/}" -lt $knownMinXcodeVersionForNewJavaFramework; then
141 JNILDFLAGS="-dynamiclib -fno-common -single_module -framework JavaVM"
142 else
143 JNILDFLAGS="-dynamiclib -fno-common -single_module -framework JavaNativeFoundation"
144 fi
145fi
146if test "`(uname -s) 2> /dev/null`" = 'SunOS'; then
147 AC_MSG_RESULT(Solaris)
148 JNIINC="-I\$(JAVA_HOME)/include/solaris "
149fi
150if test "`(uname -s) 2> /dev/null`" = 'Linux'; then
151 AC_MSG_RESULT(Linux)
152 JNIINC="-I\$(JAVA_HOME)/include/linux -I\$(JAVA_HOME)/include "
153fi
154
155if test "x$crossOS" != "x" ; then
156 if test "$crossOS" = "windows" ; then
157 JNIINC="-I../../java-windows-include/win32 -I../../java-windows-include "
158 JNICFLAGS="-Wall -D_JNI_IMPLEMENTATION_ -Wl,--kill-at"
159 JNIPREFIX=""
160 JNISUFFIX="dll"
161 fi
162fi
163
164AC_SUBST(JNIINC)
165AC_SUBST(JNIPREFIX)
166AC_SUBST(JNISUFFIX)
167AC_SUBST(JNICFLAGS)
168AC_SUBST(JNILDFLAGS)
169
170fp_WITH_DMALLOC
171fp_WITH_REGEX
172
173# text for endianness
174AC_C_BIGENDIAN
175
176# ---------------------------------------------------------------------------
177if test "$ac_cv_func_alloca" = 'no'; then
178dnl support functions for alloca.c
179 AC_LIBOBJ(xmalloc)
180 AC_LIBOBJ(error)
181fi
182
183
184# ---------------------------------------------------------------------------
185
186AC_OUTPUT([Makefile src/text/Makefile lib/Makefile
187 jni/Makefile java/org/greenstone/mg/Makefile ],
188[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h])
189
190# To prevent timestamp problems causing bool_parser.c to be generated from bool_parser.y
191touch src/text/bool_parser.c
Note: See TracBrowser for help on using the repository browser.