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 10737 2005-10-19 03:06:40Z kjdon $
|
---|
6 |
|
---|
7 | AC_REVISION($Revision: 10737 $)
|
---|
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 | # TODO: allow the user to specify whether they want a debugging
|
---|
28 | # library or not?
|
---|
29 |
|
---|
30 | # check for compilers and other tools
|
---|
31 | AC_PROG_CC
|
---|
32 | AC_PROG_INSTALL
|
---|
33 | AC_PROG_LN_S
|
---|
34 |
|
---|
35 | AC_CHECK_SIZEOF(void *)
|
---|
36 | AC_CHECK_SIZEOF(int)
|
---|
37 | AC_CHECK_SIZEOF(long)
|
---|
38 |
|
---|
39 | ######## check for the JDK and tools within the JDK
|
---|
40 | ######## look in the JAVA_HOME environment variable at configure-time
|
---|
41 | AC_MSG_CHECKING([for the JDK])
|
---|
42 | if test "z$JAVA_HOME" != z &&
|
---|
43 | test -d $JAVA_HOME &&
|
---|
44 | test -d $JAVA_HOME/include
|
---|
45 | then
|
---|
46 | AC_SUBST(JAVA_HOME)
|
---|
47 | AC_MSG_RESULT([found in $JAVA_HOME])
|
---|
48 | else
|
---|
49 | AC_MSG_ERROR([not found in \$JAVA_HOME])
|
---|
50 | fi
|
---|
51 |
|
---|
52 | # TODO: Check for specific header files in the JDK, or
|
---|
53 | # functions/definitions within those headers?
|
---|
54 |
|
---|
55 | # TODO: guess which include directory to use under the JDK
|
---|
56 |
|
---|
57 | AC_PATH_PROG(javagdbm_cv_path_javah, javah, missing_javah)
|
---|
58 | if test "$javagdbm_cv_path_javah" = missing_javah; then
|
---|
59 | AC_MSG_ERROR([javah not found.])
|
---|
60 | fi
|
---|
61 |
|
---|
62 | AC_PATH_PROG(javagdbm_cv_path_java, java, missing)
|
---|
63 | if test "$javagdbm_cv_path_java" = missing; then
|
---|
64 | AC_MSG_ERROR([java not found.])
|
---|
65 | fi
|
---|
66 |
|
---|
67 | # check for gdbm library
|
---|
68 | AC_CHECK_LIB(gdbm, gdbm_open, [javagdbm_cv_lib_gdbm="-lgdbm"],
|
---|
69 | [javagdbm_cv_lib_gdbm=no])
|
---|
70 | if test "$javagdbm_cv_lib_gdbm" = "no"; then
|
---|
71 | AC_MSG_ERROR([no native gdbm library found.])
|
---|
72 | fi
|
---|
73 | LIBS="$javagdbm_cv_lib_gdbm"
|
---|
74 |
|
---|
75 | ########## set compiler options
|
---|
76 | # TODO: is there a more appropriate way to guess which switches to use
|
---|
77 | # with which systems/compilers?
|
---|
78 | CFLAGS="-Wall -O2 -fpic"
|
---|
79 | PKG="au.com.pharos.gdbm"
|
---|
80 | AC_SUBST(CFLAGS)
|
---|
81 | AC_SUBST(PKG)
|
---|
82 | AC_SUBST(LIBS)
|
---|
83 |
|
---|
84 | # we need to set an extended JNI path for Mac OS/Darwin, as jni.h is on
|
---|
85 | # a non-standard Path
|
---|
86 | AC_MSG_CHECKING(for Apple MacOS X/Darwin)
|
---|
87 | if test "`(uname -s) 2> /dev/null`" = 'Darwin'; then
|
---|
88 | AC_MSG_RESULT(yes)
|
---|
89 | JNIINC="-I/System/Library/Frameworks/JavaVM.framework/Headers/ "
|
---|
90 | JNISUFFIX="jnilib"
|
---|
91 | JNIFLAGS="-dynamiclib -fno-common"
|
---|
92 | LDFLAGS="-framework JavaVM"
|
---|
93 | else
|
---|
94 | AC_MSG_RESULT(no)
|
---|
95 | JNIINC=""
|
---|
96 | JNISUFFIX="so"
|
---|
97 | JNIFLAGS="-shared"
|
---|
98 | fi
|
---|
99 | AC_SUBST(JNIINC)
|
---|
100 | AC_SUBST(JNISUFFIX)
|
---|
101 | AC_SUBST(JNIFLAGS)
|
---|
102 |
|
---|
103 | # write the output
|
---|
104 | AC_OUTPUT([Makefile jni/Makefile java/Makefile])
|
---|