libextractor-java

GNU libextractor
Log | Files | Refs | README | LICENSE

commit 500dd24e086464384463aff751c5dc37ca3c28ae
parent 5a09459feb119c988aa3b4c046dd555ca85cb1ed
Author: Christian Grothoff <christian@grothoff.org>
Date:   Mon,  4 Jul 2005 16:05:22 +0000

java

Diffstat:
MMakefile.am | 2--
Abootstrap | 2++
Aconfigure.ac | 146+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mnative/extractor.c | 4+++-
Morg/gnunet/libextractor/Extractor.java | 4++--
Morg/gnunet/libextractor/Makefile.am | 7++++++-
6 files changed, 159 insertions(+), 6 deletions(-)

diff --git a/Makefile.am b/Makefile.am @@ -1,4 +1,2 @@ SUBDIRS = native org . -EXTRA_DIST = \ - config.rpath \ ACLOCAL_AMFLAGS = -I m4 diff --git a/bootstrap b/bootstrap @@ -0,0 +1,2 @@ +#!/bin/sh +autoreconf -f -i diff --git a/configure.ac b/configure.ac @@ -0,0 +1,146 @@ +# Process this file with autoconf to produce a configure script. +AC_PREREQ(2.57) +AC_INIT([libextractor-java], [0.5.1], [bug-libextractor@gnu.org]) +AC_REVISION($Revision: 1.67 $) +AM_INIT_AUTOMAKE([libextractor-java], [0.5.1]) +AM_CONFIG_HEADER(native/config.h) + +AH_TOP([#define _GNU_SOURCE 1]) + +# Checks for programs. +AC_CANONICAL_HOST + +# The problem that I'm trying to solve here by specifying gcc-3.3 and gcc2 +# in the search list ahead of the other stuff is that gcc-3.1 on Mac OS X +# does not work for some of the pdf extractor code. Now, it would seem +# that we could have a conditional on $host_os that puts just the right +# amount of crazyness into the checks only on the Mac. Unfortunately, this +# will not work, because (according to some mailing lists and painful +# personal experiences) AC_PROG_CXX does not work inside of conditionals. +# So, instead, we do this crazyness globally. The list of compilers that +# you see below is taken right out of the autoconf (version 2.57) sources, +# so it should not impede our portability. +AC_PROG_CC(gcc-3.3 gcc2 gcc cc /usr/ucb/cc cl) +AC_PROG_CPP +AC_PROG_CXX(g++-3.3 g++2 g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC) + +AC_CHECK_CLASSPATH +AC_PROG_JAVAC +AC_PROG_JAVA +AC_PROG_JAR +AC_DISABLE_STATIC +AC_PROG_LIBTOOL + +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET + +case "$host_os" in +linux*) + AC_DEFINE(LINUX,1,[This is a Linux system]) + ;; +freebsd*) + AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) + ;; +openbsd*) + AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) + ;; +netbsd*) + AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) + ;; +*solaris*) + AC_DEFINE_UNQUOTED(SOLARIS,1,[This is a Solaris system]) + XTRA_CPPLIBS=-lstdc++ + ;; +darwin*) + AC_DEFINE_UNQUOTED(DARWIN,1,[This is a Darwin system]) + ;; +cygwin*) + AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a CYGWIN system]) + LDFLAGS="$LDFLAGS -no-undefined" + ;; +mingw*) + AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) + AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) + LDFLAGS="$LDFLAGS -no-undefined -Wl,--export-all-symbols -lws2_32 -lplibc" + ;; +*) + AC_MSG_RESULT(Unrecognised OS $host_os) + AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS]) + AC_MSG_RESULT(otheros) + ;; +esac + +# use '-fno-strict-aliasing', but only if the compiler can take it +if gcc -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1; +then + CFLAGS="-fno-strict-aliasing $CFLAGS" +fi + +# Special check for broken Operating Systems (OS X) +AC_CACHE_CHECK(whether ${CC-cc} accepts -no-cpp-precomp, +cv_prog_cc_darwin_cpp_precomp, +[echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -no-cpp-precomp -c conftest.c 2>&1`"; then + cv_prog_cc_darwin_cpp_precomp=yes +else + cv_prog_cc_darwin_cpp_precomp=no +fi +rm -f conftest* +]) +if test $cv_prog_cc_darwin_cpp_precomp = yes; then + CFLAGS="$CFLAGS -no-cpp-precomp" +fi + +AC_HEADER_STDC +AC_CHECK_HEADERS([jni.h],,AC_MSG_ERROR([need jni.h])) + +# check for GNU LD +AC_LIB_PROG_LD_GNU + +AC_SUBST(CPPFLAGS) +AC_SUBST(LDFLAGS) + +# test for libextractor +extractor=0 +AC_MSG_CHECKING(for libextractor) +AC_ARG_WITH(extractor, + [ --with-extractor=PFX Base of libextractor installation], + [AC_MSG_RESULT([$with_extractor]) + case $with_extractor in + no) + ;; + yes) + AC_CHECK_HEADERS(extractor.h, + AC_CHECK_LIB([extractor], [EXTRACTOR_loadDefaultLibraries], + extractor=1)) + ;; + *) + LDFLAGS="-L$with_extractor/lib $LDFLAGS" + CPPFLAGS="-I$with_extractor/include $CPPFLAGS" + AC_CHECK_HEADERS(extractor.h, + AC_CHECK_LIB([extractor], [EXTRACTOR_loadDefaultLibraries], + EXT_LIB_PATH="-L$with_extractor/lib $EXT_LIB_PATH" + extractor=1)) + ;; + esac + ], + [AC_MSG_RESULT([--with-extractor not specified]) + AC_CHECK_HEADERS(extractor.h, + AC_CHECK_LIB([extractor], [EXTRACTOR_loadDefaultLibraries], + extractor=1))]) +if test "$extractor" != 1 +then + AC_MSG_ERROR([libextractor-java requires libextractor]) +fi + + +AC_CONFIG_FILES([ +Makefile +native/Makefile +org/Makefile +org/gnunet/Makefile +org/gnunet/libextractor/Makefile +]) + +AC_OUTPUT diff --git a/native/extractor.c b/native/extractor.c @@ -34,6 +34,8 @@ #include "org_gnunet_libextractor_Extractor.h" +#define HIGHEST_TYPE_NUMBER EXTRACTOR_getHighestKeywordTypeNumber() + /* * Class: org_gnunet_libextractor_Extractor * Method: loadDefaultInternal @@ -147,7 +149,7 @@ Java_org_gnunet_libextractor_Extractor_getTypeAsStringInternal(JNIEnv * env, const char * str; if ( (type < 0) || (type > HIGHEST_TYPE_NUMBER) ) return NULL; /* error! */ - str = gettext(keywordTypes[type]); + str = EXTRACTOR_getKeywordTypeAsString((EXTRACTOR_KeywordType)type); if (str == NULL) return NULL; return (*env)->NewStringUTF(env, diff --git a/org/gnunet/libextractor/Extractor.java b/org/gnunet/libextractor/Extractor.java @@ -58,10 +58,10 @@ public final class Extractor { // next, load library and determine version_ int ver = 0; try { - System.loadLibrary("extractor"); + System.loadLibrary("extractor_java"); } catch (UnsatisfiedLinkError ule) { ver = -1; - warn("Did not find libextractor library: " + ule); + warn("Did not find libextractor_java library: " + ule); } if (ver == 0) { try { diff --git a/org/gnunet/libextractor/Makefile.am b/org/gnunet/libextractor/Makefile.am @@ -3,5 +3,10 @@ noinst_JAVA = \ Extractor.java \ Xtract.java +EXTRA_DIST = \ + Extractor.java \ + Xtract.java + install-exec-local: - @jar@ -cvf libextractor.jar *.class + mkdir -p $(prefix)/share/java + @JAR@ -cvf $(prefix)/share/java/libextractor.jar *.class