[10737] | 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 26672 2013-01-10 03:27:16Z davidb $
|
---|
| 6 |
|
---|
| 7 | AC_REVISION($Revision: 26672 $)
|
---|
| 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 |
|
---|
[10771] | 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 |
|
---|
[18343] | 32 | dnl get $target_cpu, $target_vendor, and $target_os
|
---|
| 33 | dnl (as well as host_*)
|
---|
| 34 | AC_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
|
---|
| 40 | AC_PROG_CC
|
---|
| 41 | AC_PROG_INSTALL
|
---|
| 42 | AC_PROG_LN_S
|
---|
| 43 |
|
---|
[18343] | 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)
|
---|
[25173] | 52 | if test -z "$ARCH_DEP_FLAGS" ; then
|
---|
| 53 | ARCH_DEP_FLAGS="-fPIC"
|
---|
| 54 | gsdlarch='64'
|
---|
[18343] | 55 | fi
|
---|
| 56 | else
|
---|
| 57 | AC_MSG_RESULT(no)
|
---|
[25173] | 58 | if test -z "$ARCH_DEP_FLAGS" ; then
|
---|
| 59 | ARCH_DEP_FLAGS=
|
---|
| 60 | gsdlarch='32'
|
---|
[18343] | 61 | fi
|
---|
| 62 | fi
|
---|
[21433] | 63 |
|
---|
[25173] | 64 | export ARCH_DEP_FLAGS
|
---|
| 65 | AC_SUBST(ARCH_DEP_FLAGS)
|
---|
[21433] | 66 |
|
---|
[10737] | 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 &&
|
---|
[25493] | 76 | (test -d $JAVA_HOME/include || test -d $JAVA_HOME/../Headers)
|
---|
[10737] | 77 | then
|
---|
| 78 | AC_SUBST(JAVA_HOME)
|
---|
| 79 | AC_MSG_RESULT([found in $JAVA_HOME])
|
---|
| 80 | else
|
---|
| 81 | AC_MSG_ERROR([not found in \$JAVA_HOME])
|
---|
| 82 | fi
|
---|
| 83 |
|
---|
| 84 | # TODO: Check for specific header files in the JDK, or
|
---|
| 85 | # functions/definitions within those headers?
|
---|
| 86 |
|
---|
| 87 | # TODO: guess which include directory to use under the JDK
|
---|
| 88 |
|
---|
| 89 | AC_PATH_PROG(javagdbm_cv_path_javah, javah, missing_javah)
|
---|
| 90 | if test "$javagdbm_cv_path_javah" = missing_javah; then
|
---|
| 91 | AC_MSG_ERROR([javah not found.])
|
---|
| 92 | fi
|
---|
| 93 |
|
---|
| 94 | AC_PATH_PROG(javagdbm_cv_path_java, java, missing)
|
---|
| 95 | if test "$javagdbm_cv_path_java" = missing; then
|
---|
| 96 | AC_MSG_ERROR([java not found.])
|
---|
| 97 | fi
|
---|
| 98 |
|
---|
| 99 | # check for gdbm library
|
---|
[10771] | 100 | #AC_CHECK_LIB(gdbm, gdbm_open, [javagdbm_cv_lib_gdbm="-lgdbm"],
|
---|
| 101 | # [javagdbm_cv_lib_gdbm=no])
|
---|
| 102 | #if test "$javagdbm_cv_lib_gdbm" = "no"; then
|
---|
| 103 | # AC_MSG_ERROR([no native gdbm library found.])
|
---|
| 104 | #fi
|
---|
| 105 | #LIBS="$javagdbm_cv_lib_gdbm"
|
---|
| 106 |
|
---|
| 107 | # gdbm stuff copied from gsdl [kjdon]
|
---|
| 108 |
|
---|
| 109 | dnl
|
---|
| 110 | dnl Check that the GDBM library is available
|
---|
| 111 | dnl
|
---|
| 112 | dnl check libgdbm manually, in case it's not in the standard location.
|
---|
| 113 |
|
---|
| 114 | AC_MSG_CHECKING(that the GDBM library is available)
|
---|
| 115 | if test ! -z "$gdbmdir" ; then
|
---|
| 116 | # look in given directory for header file
|
---|
| 117 | if test -r $gdbmdir/include/gdbm.h ; then
|
---|
| 118 | GDBM_INCLUDE="-I$gdbmdir/include" ;
|
---|
| 119 | elif test -r $gdbmdir/gdbm.h ; then
|
---|
| 120 | GDBM_INCLUDE="-I$gdbmdir" ;
|
---|
| 121 | fi
|
---|
| 122 |
|
---|
| 123 | # look in given directory for library
|
---|
| 124 | if test -r $gdbmdir/libgdbm.a ; then
|
---|
| 125 | GDBM_LIBPATH="-L$gdbmdir" ;
|
---|
| 126 | elif test -r $gdbmdir/lib/libgdbm.a ; then
|
---|
| 127 | GDBM_LIBPATH="-L$gdbmdir/lib" ;
|
---|
| 128 | elif test -r $gdbmdir/.libs/libgdbm.a ; then
|
---|
| 129 | GDBM_LIBPATH="-L$gdbmdir/.libs" ;
|
---|
| 130 | fi
|
---|
| 131 |
|
---|
| 132 | if test ! -z "$GDBM_LIBPATH" -a ! -z "$GDBM_INCLUDE" ; then
|
---|
| 133 | AC_MSG_RESULT($gdbmdir) ;
|
---|
| 134 | else
|
---|
| 135 | AC_MSG_RESULT(can't find gdbm.h and libgdbm.a in $gdbmdir);
|
---|
| 136 | AC_MSG_CHECKING( looking for GDBM library in default locations)
|
---|
| 137 | fi
|
---|
[10737] | 138 | fi
|
---|
| 139 |
|
---|
[10771] | 140 | # look in default path and in /usr/local
|
---|
| 141 | if test -z "$GDBM_INCLUDE" ; then
|
---|
| 142 | # try in system directory
|
---|
| 143 | AC_TRY_COMPILE(
|
---|
| 144 | [#include <gdbm.h>
|
---|
| 145 | ],
|
---|
| 146 | [],
|
---|
| 147 | success=yes,
|
---|
| 148 | success=no
|
---|
| 149 | )
|
---|
| 150 |
|
---|
| 151 | if test $success = "no"; then
|
---|
| 152 | # last chance - look in /usr/local (eg FreeBSD)
|
---|
| 153 | GDBM_LIBPATH=-L/usr/local/lib
|
---|
| 154 | GDBM_INCLUDE=-I/usr/local/include
|
---|
| 155 | ac_save_CXXFLAGS="$CXXFLAGS"
|
---|
| 156 | ac_save_LIBS="$LIBS"
|
---|
| 157 | CXXFLAGS="$CXXFLAGS -I/usr/local/include"
|
---|
| 158 | LIBS="$LIBS -L/usr/local/lib -lgdbm"
|
---|
| 159 | AC_TRY_LINK(
|
---|
| 160 | [#include <gdbm.h>
|
---|
| 161 | #include <stdio.h>
|
---|
| 162 | ],
|
---|
| 163 | [printf("%s",gdbm_version);],
|
---|
| 164 | success=/usr/local,
|
---|
| 165 | success=no
|
---|
| 166 | )
|
---|
| 167 | CXXFLAGS=$ac_save_CXXFLAGS
|
---|
| 168 | LIBS=$ac_save_LIBS
|
---|
| 169 | fi
|
---|
| 170 |
|
---|
| 171 | AC_MSG_RESULT($success)
|
---|
| 172 | if test $success = "no"; then
|
---|
| 173 | AC_MSG_ERROR(GDBM Library not available - cannot install)
|
---|
| 174 | fi
|
---|
| 175 | fi
|
---|
| 176 | dnl I don't think anything actually checks this define, but...
|
---|
| 177 | AC_DEFINE(HAVE_LIBGDBM , 1)
|
---|
| 178 |
|
---|
| 179 | AC_SUBST(GDBM_LIBPATH)
|
---|
| 180 | AC_SUBST(GDBM_INCLUDE)
|
---|
| 181 |
|
---|
[10737] | 182 | ########## set compiler options
|
---|
| 183 | # TODO: is there a more appropriate way to guess which switches to use
|
---|
| 184 | # with which systems/compilers?
|
---|
| 185 | CFLAGS="-Wall -O2 -fpic"
|
---|
| 186 | PKG="au.com.pharos.gdbm"
|
---|
| 187 | AC_SUBST(CFLAGS)
|
---|
| 188 | AC_SUBST(PKG)
|
---|
| 189 | AC_SUBST(LIBS)
|
---|
| 190 |
|
---|
| 191 | # we need to set an extended JNI path for Mac OS/Darwin, as jni.h is on
|
---|
| 192 | # a non-standard Path
|
---|
[10917] | 193 | # is there a better way to do this??
|
---|
| 194 | AC_MSG_CHECKING(for OS to set JNI options)
|
---|
| 195 | # set defaults
|
---|
| 196 | JNIINC=""
|
---|
[26672] | 197 | JNIPREFIX="lib"
|
---|
[10917] | 198 | JNISUFFIX="so"
|
---|
[26672] | 199 | JNICFLAGS=""
|
---|
| 200 | JNILDFLAGS="-shared"
|
---|
[10917] | 201 |
|
---|
[10737] | 202 | if test "`(uname -s) 2> /dev/null`" = 'Darwin'; then
|
---|
[10917] | 203 | AC_MSG_RESULT(Darwin)
|
---|
[10737] | 204 | JNIINC="-I/System/Library/Frameworks/JavaVM.framework/Headers/ "
|
---|
| 205 | JNISUFFIX="jnilib"
|
---|
[26672] | 206 | JNILDFLAGS="-dynamiclib -fno-common -single_module -framework JavaVM"
|
---|
[10737] | 207 | fi
|
---|
[10917] | 208 | if test "`(uname -s) 2> /dev/null`" = 'SunOS'; then
|
---|
| 209 | AC_MSG_RESULT(Solaris)
|
---|
| 210 | JNIINC="-I\$(JAVA_HOME)/include/solaris "
|
---|
| 211 | fi
|
---|
| 212 | if test "`(uname -s) 2> /dev/null`" = 'Linux'; then
|
---|
| 213 | AC_MSG_RESULT(Linux)
|
---|
[26672] | 214 | JNIINC="-I\$(JAVA_HOME)/include/linux -I\$(JAVA_HOME)/in5Aclude "
|
---|
[10917] | 215 | fi
|
---|
| 216 |
|
---|
[26672] | 217 | if test "x$crossOS" != "x" ; then
|
---|
| 218 | if test "$crossOS" = "windows" ; then
|
---|
| 219 | JNIINC="-I../java-windows-include/win32 -I../java-windows-include "
|
---|
| 220 | JNICFLAGS="-Wall -D_JNI_IMPLEMENTATION_ -Wl,--kill-at"
|
---|
| 221 | JNIPREFIX=""
|
---|
| 222 | JNISUFFIX="dll"
|
---|
| 223 | fi
|
---|
| 224 | fi
|
---|
| 225 |
|
---|
[10737] | 226 | AC_SUBST(JNIINC)
|
---|
[26672] | 227 | AC_SUBST(JNIPREFIX)
|
---|
[10737] | 228 | AC_SUBST(JNISUFFIX)
|
---|
[26672] | 229 | AC_SUBST(JNICFLAGS)
|
---|
| 230 | AC_SUBST(JNILDFLAGS)
|
---|
[10737] | 231 |
|
---|
| 232 | # write the output
|
---|
| 233 | AC_OUTPUT([Makefile jni/Makefile java/Makefile])
|
---|