forked from micro-manager/micro-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
379 lines (320 loc) · 10.6 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
AC_PREREQ([2.69])
AC_INIT([Micro-Manager], [2])
AC_CONFIG_MACRO_DIR([mmCoreAndDevices/m4])
AC_CONFIG_SRCDIR([mmCoreAndDevices/MMCore/MMCore.cpp])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([foreign 1.11])
LT_PREREQ([2.2.6])
LT_INIT([disable-static])
AC_PROG_MKDIR_P
AC_PROG_CC([cc gcc clang])
AC_PROG_CXX([c++ g++ clang++])
AX_CXX_COMPILE_STDCXX([14], [noext])
# Testing (googletest, googlemock)
# See testing/setuptesting.sh
MM_GMOCK([$srcdir/testing/googletest], [\$(top_srcdir)/testing/googletest])
AM_CONDITIONAL([BUILD_CPP_TESTS], [test "x$have_gmock" = xyes])
# TODO Make conditional
can_build_mmcore=yes
##
## MMCoreJ
##
# SWIG
AC_ARG_VAR([SWIG], [Simple Wrapper and Interface Generator])
AC_CHECK_PROGS([SWIG], [swig])
# TODO Provide SWIGFLAGS as precious variable
# Java
# Help for users trying to use old options
if test -n "$with_javaincl"; then
AC_MSG_ERROR([--with-javaincl has been removed. You can use one of the following:
./configure --with-java=/path/to/jdk
./configure JNI_CPPFLAGS="-I/path/to/jni/include"
If you set the Java home, the JDK installation in that directory will be used.
If you set JNI_CPPFLAGS, it will override any automatic detection.
See ./configure --help for more options.])
fi
MM_ARG_WITH_JAVA
AS_IF([test "x$want_java" != xno],
[
AS_IF([test -n "$JAVA_PREFIX"],
[
AS_IF([test -n "$JAVA_HOME"],
[
AS_IF([test "$JAVA_HOME" != "$JAVA_PREFIX"],
[
AC_MSG_ERROR([Path argument to --with-java and JAVA_HOME were both given and differ. Try removing one or the other])
])
])
])
MM_JAVA_HOME(["$JAVA_PREFIX"])
have_java=no
MM_PROG_JAVA(
[
MM_HEADERS_JNI(
[
have_java=yes
])
])
AS_IF([test "x$want_java" = xyes],
[
AS_IF([test "x$have_java" = xno],
[
AC_MSG_FAILURE([--with-java was given, but test for Java and JNI failed])
])
])
use_java=$have_java
],
[
use_java=no
])
AC_ARG_VAR([JAVACFLAGS], [Java compiler flags])
test "${JAVACFLAGS+set}" = set || JAVACFLAGS="-Xlint:all,-path,-serial"
MM_JNI_LIBRARY_PREFIX_SUFFIX
AM_CONDITIONAL([NONSTD_JNI_PREFIX], [test "x$JNI_PREFIX" != xlib])
AC_ARG_VAR([ANT], [Ant command])
AC_ARG_VAR([ANTFLAGS], [Ant flags])
test "${ANTFLAGS+set}" = set || ANTFLAGS="-logger org.apache.tools.ant.listener.SimpleBigProjectLogger"
MM_ARG_WITH_ANT
AS_IF([test "x$want_ant" != xno],
[
AS_IF([test -z "$ANT"],
[
AS_IF([test -z "$ANTCMD"],
[
AC_PATH_PROG([ANTCMD], [ant])
])
AS_IF([test -z "$ANTCMD"],
[
have_ant=no
],
[
have_ant=yes
AS_IF([test -n "$JAVA_HOME"],
[
ANT="JAVA_HOME=$JAVA_HOME $ANTCMD"
],
[
ANT="$ANTCMD"
])
])
AS_IF([test "x$want_ant" = xyes],
[
AS_IF([test "x$have_ant" = xno],
[
AC_MSG_FAILURE([--with-ant was given, but test for Ant failed])
])
])
],
[
have_ant=yes
])
use_ant=$have_ant
],
[
use_ant=no
])
build_mmcorej=yes
test "x$use_ant" = xno && { build_mmcorej=no; nobuild_mmcorej_reason="(Apache Ant not available)"; }
test "x$use_java" = xno && { build_mmcorej=no; nobuild_mmcorej_reason="(Java not available)"; }
test -z "$SWIG" && { build_mmcorej=no; nobuild_mmcorej_reason="(SWIG not available)"; }
test "x$can_build_mmcore" = xno && { build_mmcorej=no; nobuild_mmcorej_reason="(cannot build MMCore)"; }
AM_CONDITIONAL([BUILD_MMCOREJ], [test "x$build_mmcorej" = xyes])
enable_hardcoded_mmcorej_library_path_default=yes
test "x$enable_imagej_plugin" != xno && enable_hardcoded_mmcorej_library_path_default=no
AC_ARG_ENABLE([hardcoded-mmcorej-library-path],
[AS_HELP_STRING([--disable-hardcoded-mmcorej-library-path],
[Do not use a fallback absolute path to locate the
MMCoreJ_wrap native library (default: disable if building
as ImageJ plugin; otherwise enable)])],
[],
[enable_hardcoded_mmcorej_library_path=yes])
if test "x$enable_hardcoded_mmcorej_library_path" = xyes; then
# The path to be hard-coded into MMCoreJ's Java class loading code. This
# should be the value of pkglibdir at build time (not configuration time),
# so we use an escaped make variable substitution (recall that normal make
# variables are recursively expanded).
MMCOREJ_LIBRARY_PATH="\$(pkglibdir)"
else
MMCOREJ_LIBRARY_PATH=
fi
AC_SUBST([MMCOREJ_LIBRARY_PATH])
build_mmcore=no
test "x$build_mmcorej" = xyes && build_mmcore=yes
AM_CONDITIONAL([BUILD_MMCORE], [test "x$build_mmcore" = xyes])
##
## Java application (MMStudio and plugins)
##
AC_ARG_ENABLE([java-app],
[AS_HELP_STRING([--disable-java-app], [do not build the Java app])],
[], [enable_java_app=auto])
build_java_app=yes
test "x$build_mmcorej" = xno && { build_java_app=no; nobuild_java_app_reason="(cannot build MMCoreJ)"; }
test "x$enable_java_app" = xno && { build_java_app=no; nobuild_java_app_reason="(disabled)"; }
# TODO Require dependency JARs
AS_IF([test "x$enable_java_app" = xyes],
[
AS_IF([test "x$build_java_app" = xno],
[
AC_MSG_ERROR([--enable-java-app was given, but prerequisites were not satisfied])
])
])
AM_CONDITIONAL([BUILD_JAVA_APP], [test "x$build_java_app" = xyes])
if test -n "$with_imagej"; then
AC_MSG_ERROR([--with-imagej has been removed. Please use --enable-imagej-plugin and (optionally) --with-ij-jar.])
fi
# Set the default install directories used in Makefile.am's.
MM_INSTALL_DIRS
# Allow user to override location of ij.jar (whether or not we are building as
# ImageJ plugin). If we are building as ImageJ plugin, default to the ij.jar in
# the target ImageJ directory. Otherwise do not set imagejjar, and use the copy
# fetched by Ivy.
AC_ARG_WITH([ij-jar],
[AS_HELP_STRING([--with-ij-jar=FILE],
[Use specified ImageJ ij.jar for building and running])],
[], [with_ij_jar=auto])
case $with_ij_jar in
yes) AC_MSG_ERROR([--with-ij-jar requires argument (ij.jar path)]) ;;
no) imagejjar="";;
*) imagejjar="$with_ij_jar";;
esac
if test "x$imagejjar" = xauto; then
if test -n "$imagejdir"; then
AC_MSG_CHECKING([for ij.jar under $imagejdir])
# Select the first ij.jar found
imagejjar=`find "$imagejdir" -name ij.jar | head -n 1`
if test -z "$imagejjar"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([use --with-ij-jar=FILE to specify where to find ij.jar])
fi
# But make sure all copies are equal (this is for cases like the OS X
# version, where there is one copy each within ImageJ.app and
# ImageJ64.app)
for ij_jar in `find "$imagejdir" -name ij.jar`
do
if cmp -s "$imagejjar" "$ij_jar"; then :; else
AC_MSG_RESULT([multiple non-identical copies])
AC_MSG_ERROR([use --with-ij-jar=FILE to specify which ij.jar to use])
fi
done
AC_MSG_RESULT([$imagejjar])
else
imagejjar=
fi
fi
AC_SUBST([imagejjar])
# Make the building of Magellan conditional on availability of non-free JARs.
# (This is a bit of a hack, in part since it needs to run before fetchdeps, but
# it will have to suffice for now.)
build_magellan=yes
AC_CHECK_FILE([$srcdir/../3rdparty/classext/DT1.2.jar],
[],
[build_magellan=no])
AM_CONDITIONAL([BUILD_MAGELLAN],
[test "x$build_magellan" = xyes])
# Java dependencies.
AC_ARG_ENABLE([install-dependency-jars],
[AS_HELP_STRING([--disable-install-dependency-jars],
[Do not install third-party library JARs])],
[], [enable_install_dependency_jars=yes])
test "x$build_java_app" = xno && enable_install_dependency_jars=no
AM_CONDITIONAL([INSTALL_DEPENDENCY_JARS],
[test "x$enable_install_dependency_jars" != xno])
##
## Leftover stuff (needs cleanup)
##
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_CHECK_FUNCS([memset])
AC_CHECK_LIB(dl, dlopen)
# Install Device Adapter API library and headers
install_mmdevapi=false
# TODO reinstate this flag in some better form
#AC_ARG_ENABLE(inst-devapi,
# [ --enable-inst-devapi Install the Device Adapter API library and headers ],
# [ install_mmdevapi=true ])
AM_CONDITIONAL([INSTALL_MMDEVAPI], [test x$install_mmdevapi = xtrue])
##
## Subdirectory configuration
##
AC_MSG_CHECKING([for proprietary device adapter source])
AS_IF([test -f "$srcdir/mmCoreAndDevices/SecretDeviceAdapters/configure"],
[build_secretdeviceadapters=yes], [build_secretdeviceadapters=no])
AM_CONDITIONAL([BUILD_SECRETDEVICEADAPTERS],
[test "x$build_secretdeviceadapters" = xyes])
AC_CONFIG_SUBDIRS([mmCoreAndDevices/DeviceAdapters])
AS_IF([test "x$build_secretdeviceadapters" = xyes], [
AC_CONFIG_SUBDIRS([mmCoreAndDevices/SecretDeviceAdapters])
])
##
## Output generation
##
AC_CONFIG_FILES(m4_strip([
Makefile
buildscripts/AntExtensions/Makefile
testing/Makefile
mmCoreAndDevices/MMDevice/Makefile
mmCoreAndDevices/MMCore/Makefile
mmCoreAndDevices/MMCoreJ_wrap/Makefile
mmstudio/Makefile
acqEngine/Makefile
libraries/Makefile
autofocus/Makefile
plugins/Makefile
mmAsImageJMacros/Makefile
scripts/Makefile
systemtest/Makefile
systemtest/SequenceTests/Makefile
bindist/Makefile
]))
AC_OUTPUT
echo ""
echo "m4_text_box([Micro-Manager configuration])"
echo ""
if test "x$use_java" = xyes; then
echo " JAVA_HOME = $JAVA_HOME"
echo " JNI_CPPFLAGS = $JNI_CPPFLAGS"
echo " JAVA = $JAVA"
echo " JAVACFLAGS = $JAVACFLAGS"
if test "x$use_ant" = xyes; then
echo " ANT = $ANT"
fi
echo ""
fi
echo " Build MMCoreJ (MMCore Java wrapper): $build_mmcorej $nobuild_mmcorej_reason"
echo " Build Java application (MMStudio): $build_java_app $nobuild_java_app_reason"
echo " Build device adapters: yes"
echo " Build closed-source device adapters: $build_secretdeviceadapters"
echo ""
if test "x$build_java_app" = xyes; then
AM_COND_IF([INSTALL_AS_IMAGEJ_PLUGIN],
[
echo " Install MMStudio as ImageJ plugin: yes"
echo " Target ImageJ directory: $imagejdir"
],
[
echo " Install MMStudio as ImageJ plugin: no"
echo " Installation prefix: $prefix"
])
if test -n "$imagejjar"; then
echo " ij.jar: $imagejjar"
else
echo " ij.jar: from build classpath"
fi
AM_COND_IF([INSTALL_DEPENDENCY_JARS],
[
echo " Install dependency JARs: yes"
],
[
echo " Install dependency JARs: no"
])
echo ""
fi # build_java_app
echo "Now you can build and install by typing:"
if test "x$use_java" = xyes; then
echo " make fetchdeps # To download Java dependencies"
fi
echo " make"
echo " make install"
echo ""