forked from zeromq/jzmq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
163 lines (146 loc) · 4.47 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# AC_PREREQ(2.61)
#
# Change the version number below after doing a public release.
# The version in git should reflect the *next* version planned.
# Version must be MAJOR.MINOR.PATCH otherwise things will break.
#
AC_INIT([jzmq],[2.1.0],[[email protected]])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
AC_CONFIG_HEADER(src/config.hpp)
AM_INIT_AUTOMAKE(tar-ustar)
#
# Libtool -version-info (ABI version)
#
# Currently 0.0.0 ("unstable"). Don't change this unless you
# know exactly what you're doing and have read and understand
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
#
# libjzmq -version-info
JLTVER="0:0:0"
AC_SUBST(JLTVER)
SPEC_VERSION="0.0.0"
AC_SUBST(SPEC_VERSION)
# Checks for programs.
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
# AC_PROG_SED
AC_PROG_AWK
AM_PROG_CC_C_O
AC_PROG_CXX
AC_LANG(C++)
# Set default CPPFLAGS for reentrant code
CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS"
# Check for zeromq library
zeromq_prefix=detect
AC_ARG_WITH([zeromq],
[AS_HELP_STRING([--with-zeromq=PREFIX],
[build with ZeroMQ library installed in PREFIX [default=autodetect]])],
[case "x$withval" in
xno)
AC_MSG_ERROR([jzmq requires the ZeroMQ library])
;;
xyes|x)
;;
*)
CPPFLAGS="$CPPFLAGS -I${withval}/include"
LDFLAGS="$LDFLAGS -L${withval}/lib"
zeromq_prefix=${withval}
;;
esac ]
)
AC_ARG_VAR([JAVA_TARGET_VERSION], [Compile byte codes for a specific JVM version.])
AC_ARG_VAR([JAVAC_EXTRA_FLAGS], [Any other flags worth passing directly to the compiler.])
if test "x$zeromq_prefix" = "xdetect"; then
PKG_CHECK_MODULES(
[ZeroMQ], [libzmq], [zeromq_prefix=pkgconfig], [zeromq_prefix=])
if test "x$zeromq_prefix" = "xpkgconfig"; then
CPPFLAGS="$CPPFLAGS ${ZeroMQ_CFLAGS}"
LDFLAGS="$LDFLAGS ${ZeroMQ_LIBS}"
fi
fi
AC_CHECK_HEADER([zmq.h], [],
[AC_MSG_ERROR([cannot find zmq.h])])
AC_CHECK_LIB([zmq], [zmq_init], [],
[AC_MSG_ERROR([cannot link with -lzmq])])
# Check for JDK
AX_CHECK_JAVA_HOME
AC_PATH_PROG(JAVAC, javac, [no], [$PATH:$JAVA_HOME/bin])
if test "x$JAVAC" = "xno"; then
AC_MSG_ERROR([cannot find javac.]);
fi
AC_PATH_PROG(JAVAH, javah, [no], [$PATH:$JAVA_HOME/bin])
if test "x$JAVAH" = "xno"; then
AC_MSG_ERROR([cannot find javah.]);
fi
AC_PATH_PROG(JAR, jar, [no], [$PATH:$JAVA_HOME/bin])
if test "x$JAR" = "xno"; then
AC_MSG_ERROR([cannot find jar.]);
fi
AC_PATH_PROG(JAVA, java, [no], [$PATH:$JAVA_HOME/bin])
if test "x$JAVA" = "xno"; then
AC_MSG_ERROR([cannot find java.]);
fi
if test "x$JAVA_TARGET_VERSION" != "x"; then
JAVAC_EXTRA_FLAGS="-source $JAVA_TARGET_VERSION -target $JAVA_TARGET_VERSION $JAVAC_EXTRA_FLAGS"
AC_MSG_NOTICE([Setting JAVAC_EXTRA_FLAGS to $JAVAC_EXTRA_FLAGS])
AC_SUBST(JAVAC_EXTRA_FLAGS)
else
AC_MSG_NOTICE([Going with default bytecode version.])
fi
# Check for JNI headers
AX_JNI_INCLUDE_DIR
for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
do
CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR"
done
# Need host-specific path for jni_md.h on some systems, this is braindead
AC_CANONICAL_HOST
case "${host_os}" in
*solaris*)
CPPFLAGS="$CPPFLAGS -I${JAVA_HOME}/include/solaris"
;;
*openbsd*)
CPPFLAGS="$CPPFLAGS -I${JAVA_HOME}/include/openbsd"
;;
*linux*)
CPPFLAGS="$CPPFLAGS -I${JAVA_HOME}/include/linux"
;;
*darwin*)
# Darwin does not need an extra -I path
;;
*)
AC_MSG_ERROR([don't know how to find jni_md.h on this platform])
;;
esac
case "${host_os}" in
*darwin*) AC_SUBST(LIB_EXTENSION,[dylib])
;;
*mingw*) AC_SUBST(LIB_EXTENSION,[dll])
;;
*cygwin*) AC_SUBST(LIB_EXTENSION,[dll])
;;
*) AC_SUBST(LIB_EXTENSION,[so])
;;
esac
JAVAROOT=.
AC_SUBST(JAVAROOT)
dnl Want to use this to generate the Manifest from M4
JZMQ_APP_CLASS=org.zeromq.App
AC_SUBST(JZMQ_APP_CLASS)
BUILD_VERSION=`git rev-parse HEAD`
BUILD_TIME=`date "+%Y-%m-%d[%H:%M:%S]%Z"`
AC_SUBST(BUILD_VERSION)
AC_SUBST(BUILD_TIME)
AC_OUTPUT(Makefile src/Makefile perf/Makefile)
# On Linux patch libtool to delete hardcoded paths (rpath).
case "${host_os}" in
*linux*)
sed < libtool > libtool-2 \
's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" "/'
mv libtool-2 libtool
chmod 755 libtool
;;
esac