source: main/branches/64_bit_Greenstone/greenstone3/src/packages/javagdbm/configure.in

Last change on this file was 23632, checked in by sjm84, 13 years ago

Adding the latest trunk changes as well as tidying up several files and removing more -m32 stuff

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