source: main/trunk/greenstone3/src/packages/javagdbm/configure.in@ 21433

Last change on this file since 21433 was 21433, checked in by davidb, 14 years ago

Extra logic to COMPAT32BIT flag added for when mg and mgpp not enabled

  • Property svn:keywords set to Author Date Id Revision
File size: 5.9 KB
RevLine 
[10737]1dnl Process this file with autoconf to produce a configure script.
2
3dnl autoconf configuration script for the JNI part of the
4dnl au.com.pharos.gdbm Java package
5dnl $Id: configure.in 21433 2010-01-06 10:35:50Z davidb $
6
7AC_REVISION($Revision: 21433 $)
8
9# Copyright (C) 1997 by Pharos IP Pty Ltd
10#
11# This program is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software
23# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24
25AC_INIT(jni/gdbmjava.c)
26
[10771]27dnl
28dnl look for libgdbm if not in standard location
29dnl
30AC_ARG_WITH(gdbm, [ --with-gdbm=dir Use local gdbm library and headers], gdbmdir=$withval)
31
[18343]32dnl get $target_cpu, $target_vendor, and $target_os
33dnl (as well as host_*)
34AC_CANONICAL_SYSTEM
35
[10737]36# TODO: allow the user to specify whether they want a debugging
37# library or not?
38
39# check for compilers and other tools
40AC_PROG_CC
41AC_PROG_INSTALL
42AC_PROG_LN_S
43
[18343]44AC_MSG_CHECKING(to see if architecture is 64-bit)
45arch_64bit=no
46case "$host_cpu" in
47x86_64) arch_64bit=yes ;;
48esac
49
50if test "$arch_64bit" = yes; then
51 AC_MSG_RESULT(yes)
52 if test -z "$COMPAT32BITFLAGS" ; then
53 COMPAT32BITFLAGS="-m32"
54 fi
55else
56 AC_MSG_RESULT(no)
57 if test -z "$COMPAT32BITFLAGS" ; then
58 COMPAT32BITFLAGS=
59 fi
60fi
[21433]61
62# Only need compat32bitflag if using MG or MGPP
63if test "$ENABLE_MG" = "0" ; then
64 COMPAT32BITFLAGS=
65else
66 if test "$ENABLE_MGPP" = "0" ; then
67 COMPAT32BITFLAGS=
68 fi
69fi
70
[18343]71export COMPAT32BITFLAGS
72AC_SUBST(COMPAT32BITFLAGS)
73
74
75
[10737]76AC_CHECK_SIZEOF(void *)
77AC_CHECK_SIZEOF(int)
78AC_CHECK_SIZEOF(long)
79
80######## check for the JDK and tools within the JDK
81######## look in the JAVA_HOME environment variable at configure-time
82AC_MSG_CHECKING([for the JDK])
83if test "z$JAVA_HOME" != z &&
84 test -d $JAVA_HOME &&
85 test -d $JAVA_HOME/include
86then
87 AC_SUBST(JAVA_HOME)
88 AC_MSG_RESULT([found in $JAVA_HOME])
89else
90 AC_MSG_ERROR([not found in \$JAVA_HOME])
91fi
92
93# TODO: Check for specific header files in the JDK, or
94# functions/definitions within those headers?
95
96# TODO: guess which include directory to use under the JDK
97
98AC_PATH_PROG(javagdbm_cv_path_javah, javah, missing_javah)
99if test "$javagdbm_cv_path_javah" = missing_javah; then
100 AC_MSG_ERROR([javah not found.])
101fi
102
103AC_PATH_PROG(javagdbm_cv_path_java, java, missing)
104if test "$javagdbm_cv_path_java" = missing; then
105 AC_MSG_ERROR([java not found.])
106fi
107
108# check for gdbm library
[10771]109#AC_CHECK_LIB(gdbm, gdbm_open, [javagdbm_cv_lib_gdbm="-lgdbm"],
110# [javagdbm_cv_lib_gdbm=no])
111#if test "$javagdbm_cv_lib_gdbm" = "no"; then
112# AC_MSG_ERROR([no native gdbm library found.])
113#fi
114#LIBS="$javagdbm_cv_lib_gdbm"
115
116# gdbm stuff copied from gsdl [kjdon]
117
118dnl
119dnl Check that the GDBM library is available
120dnl
121dnl check libgdbm manually, in case it's not in the standard location.
122
123AC_MSG_CHECKING(that the GDBM library is available)
124if test ! -z "$gdbmdir" ; then
125 # look in given directory for header file
126 if test -r $gdbmdir/include/gdbm.h ; then
127 GDBM_INCLUDE="-I$gdbmdir/include" ;
128 elif test -r $gdbmdir/gdbm.h ; then
129 GDBM_INCLUDE="-I$gdbmdir" ;
130 fi
131
132 # look in given directory for library
133 if test -r $gdbmdir/libgdbm.a ; then
134 GDBM_LIBPATH="-L$gdbmdir" ;
135 elif test -r $gdbmdir/lib/libgdbm.a ; then
136 GDBM_LIBPATH="-L$gdbmdir/lib" ;
137 elif test -r $gdbmdir/.libs/libgdbm.a ; then
138 GDBM_LIBPATH="-L$gdbmdir/.libs" ;
139 fi
140
141 if test ! -z "$GDBM_LIBPATH" -a ! -z "$GDBM_INCLUDE" ; then
142 AC_MSG_RESULT($gdbmdir) ;
143 else
144 AC_MSG_RESULT(can't find gdbm.h and libgdbm.a in $gdbmdir);
145 AC_MSG_CHECKING( looking for GDBM library in default locations)
146 fi
[10737]147fi
148
[10771]149# look in default path and in /usr/local
150if test -z "$GDBM_INCLUDE" ; then
151 # try in system directory
152 AC_TRY_COMPILE(
153 [#include <gdbm.h>
154],
155 [],
156 success=yes,
157 success=no
158 )
159
160 if test $success = "no"; then
161# last chance - look in /usr/local (eg FreeBSD)
162 GDBM_LIBPATH=-L/usr/local/lib
163 GDBM_INCLUDE=-I/usr/local/include
164 ac_save_CXXFLAGS="$CXXFLAGS"
165 ac_save_LIBS="$LIBS"
166 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
167 LIBS="$LIBS -L/usr/local/lib -lgdbm"
168 AC_TRY_LINK(
169 [#include <gdbm.h>
170#include <stdio.h>
171 ],
172 [printf("%s",gdbm_version);],
173 success=/usr/local,
174 success=no
175 )
176 CXXFLAGS=$ac_save_CXXFLAGS
177 LIBS=$ac_save_LIBS
178 fi
179
180 AC_MSG_RESULT($success)
181 if test $success = "no"; then
182 AC_MSG_ERROR(GDBM Library not available - cannot install)
183 fi
184fi
185dnl I don't think anything actually checks this define, but...
186AC_DEFINE(HAVE_LIBGDBM , 1)
187
188AC_SUBST(GDBM_LIBPATH)
189AC_SUBST(GDBM_INCLUDE)
190
[10737]191########## set compiler options
192# TODO: is there a more appropriate way to guess which switches to use
193# with which systems/compilers?
194CFLAGS="-Wall -O2 -fpic"
195PKG="au.com.pharos.gdbm"
196AC_SUBST(CFLAGS)
197AC_SUBST(PKG)
198AC_SUBST(LIBS)
199
200# we need to set an extended JNI path for Mac OS/Darwin, as jni.h is on
201# a non-standard Path
[10917]202# is there a better way to do this??
203AC_MSG_CHECKING(for OS to set JNI options)
204# set defaults
205JNIINC=""
206JNISUFFIX="so"
207JNIFLAGS="-shared"
208
[10737]209if test "`(uname -s) 2> /dev/null`" = 'Darwin'; then
[10917]210 AC_MSG_RESULT(Darwin)
[10737]211 JNIINC="-I/System/Library/Frameworks/JavaVM.framework/Headers/ "
212 JNISUFFIX="jnilib"
[10917]213 JNIFLAGS="-dynamiclib -fno-common -single_module -framework JavaVM"
[10737]214fi
[10917]215if test "`(uname -s) 2> /dev/null`" = 'SunOS'; then
216 AC_MSG_RESULT(Solaris)
217 JNIINC="-I\$(JAVA_HOME)/include/solaris "
218fi
219if test "`(uname -s) 2> /dev/null`" = 'Linux'; then
220 AC_MSG_RESULT(Linux)
221 JNIINC="-I\$(JAVA_HOME)/include/linux "
222fi
223
[10737]224AC_SUBST(JNIINC)
225AC_SUBST(JNISUFFIX)
226AC_SUBST(JNIFLAGS)
227
228# write the output
229AC_OUTPUT([Makefile jni/Makefile java/Makefile])
Note: See TracBrowser for help on using the repository browser.