forked from SWI-Prolog/packages-jpl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
169 lines (141 loc) · 3.62 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
dnl Process this file with autoconf to produce a configure script.
AC_INIT(install-sh)
AC_PREREQ([2.50])
AC_CONFIG_HEADER(config.h)
AC_SUBST(JAVA_HOME)
AC_SUBST(JAVACFLAGS)
AC_SUBST(JAVALIBS)
AC_SUBST(JAVADOCFLAGS)
AC_SUBST(JUNIT)
AC_SUBST(JPLCFLAGS)
AC_SUBST(JPLLDFLAGS)
AC_SUBST(LIBJPL)
AC_SUBST(OSLIBPL)
AC_SUBST(JAVA_PRELOAD)
AC_SUBST(JAVA_LIBRARY_PATH)
AC_SUBST(CMDEXT)
m4_include([../ac_swi_c.m4])
CMDEXT=sh
OSLIBPL=
if test "x$JAVALIBS" = "x"; then
case "$PLARCH" in
*darwin*)
JAVALIBS="-ljvm"
AC_CHECKING("JAVA_HOME")
if test -z "$JAVA_HOME" -o ! -d "$JAVA_HOME"; then
JAVA_HOME=$(/usr/libexec/java_home)
fi
AC_MSG_RESULT($JAVA_HOME)
JAVA_BINDIR="${JAVA_BINDIR:-$JAVA_HOME/bin}"
PATH="$JAVA_BINDIR:$PATH"
java_abs_paths=yes
OSLIBPL=jpl_config.pl
;;
*powerpc-linux*)
JAVALIBS="-ljava -ljvm"
;;
*win32*|*win64*)
JAVALIBS="-ljvm"
CMDEXT=bat
;;
*)
JAVALIBS="-ljava -lverify -ljvm"
;;
esac
fi
case "$PLARCH" in
*win32*)
JPLLDFLAGS="$JPLLDFLAGS -Wl,--kill-at"
LIBJPL=jpl
;;
*win64*)
LIBJPL=jpl
;;
*)
LIBJPL=libjpl
;;
esac
dnl ================================================================
dnl Java stuff
dnl ================================================================
AC_CANONICAL_HOST dnl needed to get $host_os
if test "x$JAVACFLAGS" = x; then
JAVACFLAGS="-target 7 -source 7"
fi
m4_include([ac/ac_prog_java.m4])
m4_include([ac/ac_prog_java_works.m4])
m4_include([ac/ac_prog_javac.m4])
m4_include([ac/ac_prog_javac_works.m4])
m4_include([ac/ac_prog_javadoc.m4])
m4_include([ac/ac_jni_include_dirs.m4])
m4_include([ac/ac_prog_jar.m4])
java_abs_paths=${java_abs_paths:-no}
AC_CHECKING(Java configuration)
if test -r /etc/java/java2.conf; then
AC_MSG_RESULT(Using /etc/java/java2.conf)
eval `grep '\(JAVA\|JRE\|JDK\|SDK\).*=' /etc/java/java2.conf | sed 's/ *= */=/'`
if test ! -z "$JAVA_BINDIR"; then
PATH="$PATH:$JAVA_BINDIR"
java_abs_paths=yes
fi
fi
AC_PROG_JAVAC(javac)
AC_PROG_JAVA(java)
AC_PROG_JAR(jar)
AC_PROG_JAVADOC(javadoc)
dnl Our javadoc is not strict, while javadoc v8 enforces this
AC_CHECKING(javadoc -Xdoclint)
if "$JAVADOC" -Xdoclint:none -help >/dev/null 2>/dev/null; then
AC_MSG_RESULT(yes)
JAVADOCFLAGS="-Xdoclint:none"
else
AC_MSG_RESULT(no)
fi
escape_space()
{ sed -e "s/Program Files/Program-SPACE-Files/g" -e "s/ (x86)/SPACEX86/g"
}
unescape_space()
{ sed -e "s/-SPACE-/ /g" -e "s/SPACEX86/ (x86)/g"
}
AC_JNI_INCLUDE_DIR
for d in $(echo $JNI_INCLUDE_DIRS | escape_space); do
JPLCFLAGS="$JPLCFLAGS -I'$d'"
done
JPLCFLAGS="$(echo $JPLCFLAGS | unescape_space)"
for d in $(echo $JNI_CLIENT_DIRS | escape_space); do
JPLLDFLAGS="$JPLLDFLAGS -L'$d'"
done
JPLLDFLAGS="$(echo $JPLLDFLAGS | unescape_space)"
JAVA_LIBRARY_PATH=$(echo $JNI_CLIENT_DIRS | escape_space | sed 's/ /:/' | unescape_space)
for d in $(echo $JNI_CLIENT_DIRS | escape_space); do
if test -f "$d/libjsig.$SO"; then
JAVALIBS="-ljsig $JAVALIBS"
JAVA_PRELOAD=$d/libjsig.$SO
break
fi
done
JAVA_PRELOAD="$(echo $JAVA_PRELOAD | unescape_space)"
if test "$java_abs_paths" = yes; then
JAVA_CC="$JAVA_BINDIR/$JAVA_CC"
fi
AC_ARG_WITH(junit, [ --with-junit=PATH Specify location of the junit JAR file],
[case "$withval" in
yes) JUNIT=/usr/share/java/junit.jar
;;
no) JUNIT=""
;;
*) JUNIT="$withval"
;;
esac
],
[ if test "x$JUNIT" = "x" -a -r /usr/share/java/junit.jar; then
JUNIT=/usr/share/java/junit.jar
fi
]
)
AC_CHECK_HEADERS(wchar.h)
AC_CHECK_SIZEOF(wchar_t, 4)
AC_CHECK_SIZEOF(void*, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(long long, 8)
AC_OUTPUT(Makefile src/java/Makefile)