1 | dnl Process this file with autoconf to produce a configure script.
|
---|
2 |
|
---|
3 | dnl autoconf configuration script for the JNI part of the
|
---|
4 | dnl au.com.pharos.gdbm Java package
|
---|
5 | dnl $Id: configure.in 37405 2023-03-03 03:57:52Z davidb $
|
---|
6 |
|
---|
7 | AC_REVISION($Revision: 37405 $)
|
---|
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 |
|
---|
25 | AC_INIT(jni/gdbmjava.c)
|
---|
26 |
|
---|
27 | dnl
|
---|
28 | dnl look for libgdbm if not in standard location
|
---|
29 | dnl
|
---|
30 | AC_ARG_WITH(gdbm, [ --with-gdbm=dir Use local gdbm library and headers], gdbmdir=$withval)
|
---|
31 |
|
---|
32 | dnl get $target_cpu, $target_vendor, and $target_os
|
---|
33 | dnl (as well as host_*)
|
---|
34 | AC_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
|
---|
40 | AC_PROG_CC
|
---|
41 | AC_PROG_INSTALL
|
---|
42 | AC_PROG_LN_S
|
---|
43 |
|
---|
44 | AC_MSG_CHECKING(to see if architecture is 64-bit)
|
---|
45 | arch_64bit=no
|
---|
46 | case "$host_cpu" in
|
---|
47 | x86_64) arch_64bit=yes ;;
|
---|
48 | esac
|
---|
49 |
|
---|
50 | if test "$arch_64bit" = yes; then
|
---|
51 | AC_MSG_RESULT(yes)
|
---|
52 | if test -z "$ARCH_DEP_FLAGS" ; then
|
---|
53 | ARCH_DEP_FLAGS="-fPIC"
|
---|
54 | gsdlarch='64'
|
---|
55 | fi
|
---|
56 | else
|
---|
57 | AC_MSG_RESULT(no)
|
---|
58 | if test -z "$ARCH_DEP_FLAGS" ; then
|
---|
59 | ARCH_DEP_FLAGS=
|
---|
60 | gsdlarch='32'
|
---|
61 | fi
|
---|
62 | fi
|
---|
63 |
|
---|
64 | export ARCH_DEP_FLAGS
|
---|
65 | AC_SUBST(ARCH_DEP_FLAGS)
|
---|
66 |
|
---|
67 | AC_CHECK_SIZEOF(void *)
|
---|
68 | AC_CHECK_SIZEOF(int)
|
---|
69 | AC_CHECK_SIZEOF(long)
|
---|
70 |
|
---|
71 | ######## check for the JDK and tools within the JDK
|
---|
72 | ######## look in the JAVA_HOME environment variable at configure-time
|
---|
73 | #AC_MSG_CHECKING([for the JDK])
|
---|
74 | #if test "z$JAVA_HOME" != z &&
|
---|
75 | # test -d $JAVA_HOME &&
|
---|
76 | # (test -d $JAVA_HOME/bin)
|
---|
77 | ## The following used to be the test, but failed on newer versions of MacOS
|
---|
78 | ## Cut back to something simpler, and rely on the later tests for JNIINC to confirm
|
---|
79 | ## files like 'jni.h' can be found
|
---|
80 | ## test -d $JAVA_HOME &&
|
---|
81 | ## (test -d $JAVA_HOME/include || test -d $JAVA_HOME/../Headers)
|
---|
82 | #then
|
---|
83 | # AC_SUBST(JAVA_HOME)
|
---|
84 | # AC_MSG_RESULT([found in $JAVA_HOME])
|
---|
85 | #else
|
---|
86 | # AC_MSG_ERROR([not found in \$JAVA_HOME])
|
---|
87 | #fi
|
---|
88 |
|
---|
89 | ## TODO: Check for specific header files in the JDK, or
|
---|
90 | ## functions/definitions within those headers?
|
---|
91 |
|
---|
92 | ## TODO: guess which include directory to use under the JDK
|
---|
93 |
|
---|
94 | #AC_PATH_PROG(javagdbm_cv_path_javah, javah, missing_javah)
|
---|
95 | #if test "$javagdbm_cv_path_javah" = missing_javah; then
|
---|
96 | # AC_MSG_ERROR([javah not found.])
|
---|
97 | #fi
|
---|
98 |
|
---|
99 | #AC_PATH_PROG(javagdbm_cv_path_java, java, missing)
|
---|
100 | #if test "$javagdbm_cv_path_java" = missing; then
|
---|
101 | # AC_MSG_ERROR([java not found.])
|
---|
102 | #fi
|
---|
103 |
|
---|
104 | # Replacing the above with a more streamlined test for 'javac'
|
---|
105 | # This should have the advantage of meaning its not mandated
|
---|
106 | # that JAVA_HOME must be set for it to locate a javac
|
---|
107 | AC_PROG_JAVAC
|
---|
108 |
|
---|
109 | # check for gdbm library
|
---|
110 | #AC_CHECK_LIB(gdbm, gdbm_open, [javagdbm_cv_lib_gdbm="-lgdbm"],
|
---|
111 | # [javagdbm_cv_lib_gdbm=no])
|
---|
112 | #if test "$javagdbm_cv_lib_gdbm" = "no"; then
|
---|
113 | # AC_MSG_ERROR([no native gdbm library found.])
|
---|
114 | #fi
|
---|
115 | #LIBS="$javagdbm_cv_lib_gdbm"
|
---|
116 |
|
---|
117 | # gdbm stuff copied from gsdl [kjdon]
|
---|
118 |
|
---|
119 | dnl
|
---|
120 | dnl Check that the GDBM library is available
|
---|
121 | dnl
|
---|
122 | dnl check libgdbm manually, in case it's not in the standard location.
|
---|
123 |
|
---|
124 | AC_MSG_CHECKING(that the GDBM library is available)
|
---|
125 | if test ! -z "$gdbmdir" ; then
|
---|
126 | # look in given directory for header file
|
---|
127 | if test -r $gdbmdir/include/gdbm.h ; then
|
---|
128 | GDBM_INCLUDE="-I$gdbmdir/include" ;
|
---|
129 | elif test -r $gdbmdir/gdbm.h ; then
|
---|
130 | GDBM_INCLUDE="-I$gdbmdir" ;
|
---|
131 | fi
|
---|
132 |
|
---|
133 | # look in given directory for library
|
---|
134 | if test -r $gdbmdir/libgdbm.a ; then
|
---|
135 | GDBM_LIBPATH="-L$gdbmdir" ;
|
---|
136 | elif test -r $gdbmdir/lib/libgdbm.a ; then
|
---|
137 | GDBM_LIBPATH="-L$gdbmdir/lib" ;
|
---|
138 | elif test -r $gdbmdir/.libs/libgdbm.a ; then
|
---|
139 | GDBM_LIBPATH="-L$gdbmdir/.libs" ;
|
---|
140 | fi
|
---|
141 |
|
---|
142 | if test ! -z "$GDBM_LIBPATH" -a ! -z "$GDBM_INCLUDE" ; then
|
---|
143 | AC_MSG_RESULT($gdbmdir) ;
|
---|
144 | else
|
---|
145 | AC_MSG_RESULT(can't find gdbm.h and libgdbm.a in $gdbmdir);
|
---|
146 | AC_MSG_CHECKING( looking for GDBM library in default locations)
|
---|
147 | fi
|
---|
148 | fi
|
---|
149 |
|
---|
150 | # look in default path and in /usr/local
|
---|
151 | if test -z "$GDBM_INCLUDE" ; then
|
---|
152 | # try in system directory
|
---|
153 | AC_TRY_COMPILE(
|
---|
154 | [#include <gdbm.h>
|
---|
155 | ],
|
---|
156 | [],
|
---|
157 | success=yes,
|
---|
158 | success=no
|
---|
159 | )
|
---|
160 |
|
---|
161 | if test $success = "no"; then
|
---|
162 | # last chance - look in /usr/local (eg FreeBSD)
|
---|
163 | GDBM_LIBPATH=-L/usr/local/lib
|
---|
164 | GDBM_INCLUDE=-I/usr/local/include
|
---|
165 | ac_save_CXXFLAGS="$CXXFLAGS"
|
---|
166 | ac_save_LIBS="$LIBS"
|
---|
167 | CXXFLAGS="$CXXFLAGS -I/usr/local/include"
|
---|
168 | LIBS="$LIBS -L/usr/local/lib -lgdbm"
|
---|
169 | AC_TRY_LINK(
|
---|
170 | [#include <gdbm.h>
|
---|
171 | #include <stdio.h>
|
---|
172 | ],
|
---|
173 | [printf("%s",gdbm_version);],
|
---|
174 | success=/usr/local,
|
---|
175 | success=no
|
---|
176 | )
|
---|
177 | CXXFLAGS=$ac_save_CXXFLAGS
|
---|
178 | LIBS=$ac_save_LIBS
|
---|
179 | fi
|
---|
180 |
|
---|
181 | AC_MSG_RESULT($success)
|
---|
182 | if test $success = "no"; then
|
---|
183 | AC_MSG_ERROR(GDBM Library not available - cannot install)
|
---|
184 | fi
|
---|
185 | fi
|
---|
186 | dnl I don't think anything actually checks this define, but...
|
---|
187 | AC_DEFINE(HAVE_LIBGDBM , 1)
|
---|
188 |
|
---|
189 | AC_SUBST(GDBM_LIBPATH)
|
---|
190 | AC_SUBST(GDBM_INCLUDE)
|
---|
191 |
|
---|
192 | ########## set compiler options
|
---|
193 | # TODO: is there a more appropriate way to guess which switches to use
|
---|
194 | # with which systems/compilers?
|
---|
195 | CFLAGS="-Wall -O2 -fpic"
|
---|
196 | PKG="au.com.pharos.gdbm"
|
---|
197 | AC_SUBST(CFLAGS)
|
---|
198 | AC_SUBST(PKG)
|
---|
199 | AC_SUBST(LIBS)
|
---|
200 |
|
---|
201 | # we need to set an extended JNI path for Mac OS/Darwin, as jni.h is on
|
---|
202 | # a non-standard Path
|
---|
203 | # is there a better way to do this??
|
---|
204 | AC_MSG_CHECKING(for OS to set JNI options)
|
---|
205 | # set defaults
|
---|
206 | JNIINC=""
|
---|
207 | JNIPREFIX="lib"
|
---|
208 | JNISUFFIX="so"
|
---|
209 | JNICFLAGS=""
|
---|
210 | JNILDFLAGS="-shared"
|
---|
211 |
|
---|
212 | if test "`(uname -s) 2> /dev/null`" = 'Darwin'; then
|
---|
213 | AC_MSG_RESULT(Darwin)
|
---|
214 | JNIINC="-I\$(JAVA_HOME)/include/darwin -I\$(JAVA_HOME)/include "
|
---|
215 | JNISUFFIX="jnilib"
|
---|
216 | JNILDFLAGS="-dynamiclib -fno-common -single_module -framework JavaNativeFoundation"
|
---|
217 | fi
|
---|
218 | if test "`(uname -s) 2> /dev/null`" = 'SunOS'; then
|
---|
219 | AC_MSG_RESULT(Solaris)
|
---|
220 | JNIINC="-I\$(JAVA_HOME)/include/solaris "
|
---|
221 | fi
|
---|
222 | if test "`(uname -s) 2> /dev/null`" = 'Linux'; then
|
---|
223 | AC_MSG_RESULT(Linux)
|
---|
224 | JNIINC="-I\$(JAVA_HOME)/include/linux -I\$(JAVA_HOME)/include "
|
---|
225 | fi
|
---|
226 |
|
---|
227 | if test "x$crossOS" != "x" ; then
|
---|
228 | if test "$crossOS" = "windows" ; then
|
---|
229 | JNIINC="-I../java-windows-include/win32 -I../java-windows-include "
|
---|
230 | JNICFLAGS="-Wall -D_JNI_IMPLEMENTATION_ -Wl,--kill-at"
|
---|
231 | JNIPREFIX=""
|
---|
232 | JNISUFFIX="dll"
|
---|
233 | fi
|
---|
234 | fi
|
---|
235 |
|
---|
236 | AC_SUBST(JNIINC)
|
---|
237 | AC_SUBST(JNIPREFIX)
|
---|
238 | AC_SUBST(JNISUFFIX)
|
---|
239 | AC_SUBST(JNICFLAGS)
|
---|
240 | AC_SUBST(JNILDFLAGS)
|
---|
241 |
|
---|
242 | # write the output
|
---|
243 | AC_OUTPUT([Makefile jni/Makefile java/Makefile])
|
---|