This repository has been archived by the owner on Jul 18, 2024. It is now read-only.
forked from openslide/openslide-java
-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.ac
146 lines (130 loc) · 4.69 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT([OpenSlide Java], [0.12.0], [openslide-users@lists.andrew.cmu.edu])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([openslide-jni.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.11 foreign dist-xz])
AM_SILENT_RULES([yes])
LT_INIT([win32-dll disable-static])
# Checks for programs.
PKG_PROG_PKG_CONFIG()
AC_PROG_CC
# For distribution-packaged Ant, $ANT may not be $ANT_HOME/bin/ant.
# Use and pass through ANT_HOME if we receive it; otherwise, focus on ANT.
AC_ARG_VAR([ANT], [path to ant program])
AC_ARG_VAR([ANT_HOME], [path to ant installation directory])
if test "z$ANT" = z && test "z$ANT_HOME" != z ; then
ANT="$ANT_HOME/bin/ant"
fi
AC_PATH_PROG([ANT], [ant])
if test "z$ANT" = z ; then
AC_MSG_ERROR([ant not found])
fi
# On Cygwin the JVM uses Windows paths. The ant wrapper script converts
# almost everything for us, but not the argument to -Dbuilddir.
AC_MSG_CHECKING([Ant build path])
AS_CASE([$build],
[*-*-cygwin], [ANT_BUILDDIR="$(cygpath -w "$(pwd)")"],
[ANT_BUILDDIR="$(pwd)"]
)
AC_SUBST([ANT_BUILDDIR])
AC_MSG_RESULT([$ANT_BUILDDIR])
# Checks for libraries.
PKG_CHECK_MODULES([OPENSLIDE], [openslide >= 3.4.0])
# Checks for header files.
AC_ARG_VAR([JAVA_HOME], [path to JDK])
# Dynamic default for Mac OS X
if test -x /usr/libexec/java_home ; then
DEFAULT_JAVA_HOME=$(/usr/libexec/java_home)
fi
AC_ARG_WITH([java], [AS_HELP_STRING([--with-java], [path to JDK])], [],
[with_java="$JAVA_HOME:$DEFAULT_JAVA_HOME:/usr/lib/jvm/java"])
AC_ARG_WITH([jni-headers], [AS_HELP_STRING([--with-jni-headers=PLATFORM],
[use JNI headers for PLATFORM. Specify "cross" to use Classpath
headers from the build platform.])], [], [with_jni_headers=guess])
if test z$with_jni_headers = zguess ; then
if test $host = $build ; then
AS_CASE([$host],
[*-*-linux-gnu], [with_jni_headers=linux],
[*-*-mingw32], [with_jni_headers=win32],
[with_jni_headers=]
)
else
with_jni_headers=cross
# If building with MinGW inside Cygwin, the native headers are
# available, so use them.
AS_CASE([$build], [*-*-cygwin],
AS_CASE([$host], [*-*-mingw32], [with_jni_headers=win32]))
fi
fi
if test z$with_jni_headers != zcross ; then
# Find jni.h
JOIN_EACH([include_paths], [$with_java], [include])
FIND_FILE([jni_h_dir], [jni.h], [$include_paths])
JAVA_HOME=$(dirname "$jni_h_dir")
# Find jni_md.h
JOIN_EACH([platform_include_paths], [$include_paths], [$with_jni_headers])
FIND_FILE([jni_md_h_dir], [jni_md.h],
[$platform_include_paths $include_paths])
JNI_CFLAGS="\"-I$jni_h_dir\" \"-I$jni_md_h_dir\""
else
# For cross builds, we don't have the OpenJDK jni_md.h for the target
# platform, so use the GNU Classpath JNI headers in the build system's
# gcj include directory instead. Autoconf doesn't give us a variable
# for the build compiler, which is okay because anything other than
# GCC probably won't support this syntax.
#
# Don't set JAVA_HOME unless it was specified on the command line.
#
# This is terrible.
JNI_CFLAGS=
AC_MSG_CHECKING([for cross jni.h and jni_md.h])
for word in $(gcc - -v -E < /dev/null 2>&1)
do
if test -r "$word/jni.h" && test -r "$word/jni_md.h" ; then
AC_MSG_RESULT([$word])
JNI_CFLAGS="-I$word"
break
fi
done
if test "x$JNI_CFLAGS" = x ; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([cannot find JNI headers])
fi
fi
AC_SUBST([JNI_CFLAGS])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_INT64_T
AC_TYPE_UINT32_T
# Get the filename extension for dynamic libraries.
# $module matters on Mac OS X.
module=no
eval dynlib_ext=$shrext_cmds
if test x$dynlib_ext = x.dylib ; then
# Mac OS X has a special file extension for JNI libraries
dynlib_ext=.jnilib
fi
AM_CONDITIONAL([RENAME_JNI], [test x$dynlib_ext = x.jnilib])
AC_MSG_CHECKING([JNI library name])
if test x$dynlib_ext = x.dll ; then
AC_SUBST([JNI_SO], [openslide-jni.dll])
# JNI uses stdcall without @
AC_SUBST([JNI_LDFLAGS], [-Wl,--kill-at])
else
AC_SUBST([JNI_SO], [libopenslide-jni$dynlib_ext])
fi
AC_MSG_RESULT([$JNI_SO])
AM_CONDITIONAL([DLL], [test x$dynlib_ext = x.dll])
AC_MSG_CHECKING([whether to embed library path in JAR])
if test x$dynlib_ext != x.dll ; then
AC_SUBST([JNI_EMBED_PATH], [$libdir/$PACKAGE/$JNI_SO])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
# Checks for library functions.
AC_CONFIG_FILES([Makefile])
AC_OUTPUT