root/trunk/gsdl3/src/packages/javagdbm/configure.in @ 10917

Revision 10917, 5.3 KB (checked in by kjdon, 14 years ago)

removed java_home/include/linux from include path in makefile, made the configure script include this in JNIINC for linux, and use JAVA_HOME/include/solaris for solaris machines

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