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

Last change on this file since 18343 was 18343, checked in by davidb, 15 years ago

Modifications to support 64-bit architecture

  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 KB
Line 
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 18343 2009-01-11 06:39:56Z davidb $
6
7AC_REVISION($Revision: 18343 $)
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
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
32dnl get $target_cpu, $target_vendor, and $target_os
33dnl (as well as host_*)
34AC_CANONICAL_SYSTEM
35
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
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
61export COMPAT32BITFLAGS
62AC_SUBST(COMPAT32BITFLAGS)
63
64
65
66AC_CHECK_SIZEOF(void *)
67AC_CHECK_SIZEOF(int)
68AC_CHECK_SIZEOF(long)
69
70######## check for the JDK and tools within the JDK
71######## look in the JAVA_HOME environment variable at configure-time
72AC_MSG_CHECKING([for the JDK])
73if test "z$JAVA_HOME" != z &&
74 test -d $JAVA_HOME &&
75 test -d $JAVA_HOME/include
76then
77 AC_SUBST(JAVA_HOME)
78 AC_MSG_RESULT([found in $JAVA_HOME])
79else
80 AC_MSG_ERROR([not found in \$JAVA_HOME])
81fi
82
83# TODO: Check for specific header files in the JDK, or
84# functions/definitions within those headers?
85
86# TODO: guess which include directory to use under the JDK
87
88AC_PATH_PROG(javagdbm_cv_path_javah, javah, missing_javah)
89if test "$javagdbm_cv_path_javah" = missing_javah; then
90 AC_MSG_ERROR([javah not found.])
91fi
92
93AC_PATH_PROG(javagdbm_cv_path_java, java, missing)
94if test "$javagdbm_cv_path_java" = missing; then
95 AC_MSG_ERROR([java not found.])
96fi
97
98# check for gdbm library
99#AC_CHECK_LIB(gdbm, gdbm_open, [javagdbm_cv_lib_gdbm="-lgdbm"],
100# [javagdbm_cv_lib_gdbm=no])
101#if test "$javagdbm_cv_lib_gdbm" = "no"; then
102# AC_MSG_ERROR([no native gdbm library found.])
103#fi
104#LIBS="$javagdbm_cv_lib_gdbm"
105
106# gdbm stuff copied from gsdl [kjdon]
107
108dnl
109dnl Check that the GDBM library is available
110dnl
111dnl check libgdbm manually, in case it's not in the standard location.
112
113AC_MSG_CHECKING(that the GDBM library is available)
114if test ! -z "$gdbmdir" ; then
115 # look in given directory for header file
116 if test -r $gdbmdir/include/gdbm.h ; then
117 GDBM_INCLUDE="-I$gdbmdir/include" ;
118 elif test -r $gdbmdir/gdbm.h ; then
119 GDBM_INCLUDE="-I$gdbmdir" ;
120 fi
121
122 # look in given directory for library
123 if test -r $gdbmdir/libgdbm.a ; then
124 GDBM_LIBPATH="-L$gdbmdir" ;
125 elif test -r $gdbmdir/lib/libgdbm.a ; then
126 GDBM_LIBPATH="-L$gdbmdir/lib" ;
127 elif test -r $gdbmdir/.libs/libgdbm.a ; then
128 GDBM_LIBPATH="-L$gdbmdir/.libs" ;
129 fi
130
131 if test ! -z "$GDBM_LIBPATH" -a ! -z "$GDBM_INCLUDE" ; then
132 AC_MSG_RESULT($gdbmdir) ;
133 else
134 AC_MSG_RESULT(can't find gdbm.h and libgdbm.a in $gdbmdir);
135 AC_MSG_CHECKING( looking for GDBM library in default locations)
136 fi
137fi
138
139# look in default path and in /usr/local
140if test -z "$GDBM_INCLUDE" ; then
141 # try in system directory
142 AC_TRY_COMPILE(
143 [#include <gdbm.h>
144],
145 [],
146 success=yes,
147 success=no
148 )
149
150 if test $success = "no"; then
151# last chance - look in /usr/local (eg FreeBSD)
152 GDBM_LIBPATH=-L/usr/local/lib
153 GDBM_INCLUDE=-I/usr/local/include
154 ac_save_CXXFLAGS="$CXXFLAGS"
155 ac_save_LIBS="$LIBS"
156 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
157 LIBS="$LIBS -L/usr/local/lib -lgdbm"
158 AC_TRY_LINK(
159 [#include <gdbm.h>
160#include <stdio.h>
161 ],
162 [printf("%s",gdbm_version);],
163 success=/usr/local,
164 success=no
165 )
166 CXXFLAGS=$ac_save_CXXFLAGS
167 LIBS=$ac_save_LIBS
168 fi
169
170 AC_MSG_RESULT($success)
171 if test $success = "no"; then
172 AC_MSG_ERROR(GDBM Library not available - cannot install)
173 fi
174fi
175dnl I don't think anything actually checks this define, but...
176AC_DEFINE(HAVE_LIBGDBM , 1)
177
178AC_SUBST(GDBM_LIBPATH)
179AC_SUBST(GDBM_INCLUDE)
180
181########## set compiler options
182# TODO: is there a more appropriate way to guess which switches to use
183# with which systems/compilers?
184CFLAGS="-Wall -O2 -fpic"
185PKG="au.com.pharos.gdbm"
186AC_SUBST(CFLAGS)
187AC_SUBST(PKG)
188AC_SUBST(LIBS)
189
190# we need to set an extended JNI path for Mac OS/Darwin, as jni.h is on
191# a non-standard Path
192# is there a better way to do this??
193AC_MSG_CHECKING(for OS to set JNI options)
194# set defaults
195JNIINC=""
196JNISUFFIX="so"
197JNIFLAGS="-shared"
198
199if test "`(uname -s) 2> /dev/null`" = 'Darwin'; then
200 AC_MSG_RESULT(Darwin)
201 JNIINC="-I/System/Library/Frameworks/JavaVM.framework/Headers/ "
202 JNISUFFIX="jnilib"
203 JNIFLAGS="-dynamiclib -fno-common -single_module -framework JavaVM"
204fi
205if test "`(uname -s) 2> /dev/null`" = 'SunOS'; then
206 AC_MSG_RESULT(Solaris)
207 JNIINC="-I\$(JAVA_HOME)/include/solaris "
208fi
209if test "`(uname -s) 2> /dev/null`" = 'Linux'; then
210 AC_MSG_RESULT(Linux)
211 JNIINC="-I\$(JAVA_HOME)/include/linux "
212fi
213
214AC_SUBST(JNIINC)
215AC_SUBST(JNISUFFIX)
216AC_SUBST(JNIFLAGS)
217
218# write the output
219AC_OUTPUT([Makefile jni/Makefile java/Makefile])
Note: See TracBrowser for help on using the repository browser.