-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathconfigure.ac
501 lines (454 loc) · 11.3 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
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
##
# \file configure.in
# \author Bill Hill
# \date September 2007
# \version $Id$
# \par
# Address:
# MRC Human Genetics Unit,
# MRC Institute of Genetics and Molecular Medicine,
# University of Edinburgh,
# Western General Hospital,
# Edinburgh, EH4 2XU, UK.
# \par
# Copyright (C), [2012],
# The University Court of the University of Edinburgh,
# Old College, Edinburgh, UK.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
# \brief Process this file with autoconf to produce a configure script.
##
m4_define([WOOLZ_VERSION], [1.8.4])
AC_INIT(Woolz, WOOLZ_VERSION, ma-tech@igmm.ed.ac.uk)
AC_CANONICAL_TARGET
AC_GNU_SOURCE
AM_INIT_AUTOMAKE
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([libWlz/Wlz.h])
# Set defaults
AC_PREFIX_DEFAULT(/opt/MouseAtlas)
AC_DISABLE_SHARED
CP="cp"
RM="rm -f"
RMRF="rm -rf"
SIMD=''
CDEF_ARCH=""
USE_CTAGS=1
USE_ETAGS=0
HAVE_CJSON="no"
CJSON_DIR="no"
HAVE_JPEG="no"
JPEG_DIR="no"
HAVE_NIFTI="no"
NIFTI_DIR="no"
HAVE_TIFF="no"
TIFF_DIR="no"
HAVE_BZLIB="no"
HAVE_LZMALIB="no"
HAVE_ZLIB="no"
AC_SUBST(CP)
AC_SUBST(RM)
AC_SUBST(RMRF)
# Check CPU type
echo "Checking target cpu/system type"
case ${target_cpu} in
i386|i486|i586|i686)
CDEF_ARCH="-D__x86"
;;
x86_64|amd64)
CDEF_ARCH="-D__x86"
;;
ia64)
CDEF_ARCH="-D__x86"
;;
alpha)
CDEF_ARCH="-D__alpha"
;;
sparc|sparc64)
CDEF_ARCH="-D__sparc"
;;
ppc|powerpc)
CDEF_ARCH="-D__ppc"
;;
mips)
CDEF_ARCH="-D__mpis"
;;
*)
echo "Warning: CPU type ${target_cpu} unknown."
;;
esac
# Check for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
LT_INIT
AC_PROG_MKDIR_P
# Check for system functions
AC_FUNC_MMAP
# Check for libraries.
AC_CHECK_LIB(m, pow)
# Check for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([ assert.h \
ctype.h \
errno.h \
float.h \
limits.h \
stddef.h \
stdlib.h \
string.h \
strings.h \
sys/time.h \
sys/types.h \
time.h \
unistd.h])
# Check for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_C_RESTRICT
# Check for library functions.
AC_FUNC_MKTIME
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([ floor \
getcwd \
gethostname \
gettimeofday \
malloc \
memset \
mkdir \
modf \
pow \
rand_r \
realloc \
regcmp \
regcomp \
sqrt \
strcasecmp \
strchr \
strerror \
strrchr \
strsep \
strstr \
strtok \
strtok_r \
timersub])
# Check for doxygen
AC_PATH_PROG(DOXYGEN, doxygen)
AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, "yes", "no")
AM_CONDITIONAL(HAVE_DOXYGEN, test x$HAVE_DOXYGEN = xyes)
# Compilation and linking flags
CFLAGS=""
INCL_EXTFF=""
AC_SUBST(LIBS_EXTFF)
AC_SUBST(INCL_EXTFF)
AC_PROG_CC
AC_ARG_ENABLE(icc,
[ --enable-icc build using the Intel C compiler])
AS_IF([test x"$enable_icc" = "xyes"], [
CFLAGS="${CFLAGS} -w2"
CC="icc"
CXX="icpc"
LD="xild"
AR="xiar"
], [
CFLAGS="${CFLAGS} -pipe -Wall -Wno-deprecated"
AS_IF([test -z "$CC" ], [CC="gcc"], [CC="$CC"])
AS_IF([test -z "$CXX" ], [CXX="g++"], [CXX="$CXX"])
AS_IF([test -z "$LD" ], [LD="ld"], [LD="$LD"])
])
CFLAGS="${CFLAGS} ${CDEF_ARCH}"
# Set target architecture flags
if test "$CC" = "gcc"
then
case ${target_cpu} in
i386|i486|i586)
CFLAGS="${CFLAGS} -m32 -march=i586"
;;
i686)
CFLAGS="${CFLAGS} -m32 -march=i686"
;;
x86_64|amd64)
CFLAGS="${CFLAGS} -m64"
;;
*)
;;
esac
else
#Intel CC
if test "$CC" = "icc"
then
case ${target_cpu} in
i386|i486|i586)
CFLAGS="${CFLAGS} -m32 -xK"
;;
i686)
CFLAGS="${CFLAGS} -xN"
;;
x86_64|amd64)
CFLAGS="${CFLAGS} -m64"
;;
*)
;;
esac
fi
fi
CPP="cpp"
AC_ARG_ENABLE(debug,
[ --enable-debug build with debugging flags set])
AS_IF([test "x$enable_debug" = "xyes"], [
CFLAGS="${CFLAGS} -g -fPIC -DDEBUG"
LDFLAGS="${LDFLAGS} -g -DDEBUG"
])
AC_ARG_ENABLE(optimise,
[ --enable-optimise build with optimisation flags set])
AS_IF([test "x$enable_optimise" = "xyes"], [
# GNU CC
if test "$CC" = "gcc"
then
case ${target_cpu} in
i386|i486|i586|i686)
CFLAGS="${CFLAGS} -fPIC -O2 -fomit-frame-pointer"
;;
x86_64|amd64)
if test "x$SIMD" = "x"
then
SIMD="-msse3"
fi
CFLAGS="${CFLAGS} -fPIC -O3"
;;
*)
CFLAGS="${CFLAGS} -fPIC -O2"
;;
esac
else
#Intel CC
if test "$CC" = "icc"
then
CFLAGS="${CFLAGS} -fPIC -O3 -ip"
fi
fi
])
AC_ARG_ENABLE(avx2,
[AC_HELP_STRING([--enable-avx2],[enable AVX2 SIMD optimizations])],
SIMD='-mavx2')
AC_ARG_ENABLE(openmp,
[ --enable-openmp build with openmp flags set])
AS_IF([test "x$enable_openmp" = "xyes"], [
# GNU CC
if test "$CC" = "gcc"
then
CFLAGS="${CFLAGS} -fopenmp"
fi
# Intel CC
if test "$CC" = "icc"
then
CFLAGS="${CFLAGS} -openmp"
fi
])
AC_ARG_ENABLE(lto,
[ --enable-lto build with link time optimisation flags set])
AS_IF([test "x$enable_lto" = "xyes"], [
# GNU CC
if test "$CC" = "gcc"
then
CFLAGS="${CFLAGS} -flto"
fi
# Intel CC
if test "$CC" = "icc"
then
CFLAGS="${CFLAGS} -ipo"
fi
])
AC_ARG_ENABLE(profile,
[ --enable-profile build with profiling set])
AS_IF([test "x$enable_profile" = "xyes"], [
CFLAGS="${CFLAGS} -pg"
LDFLAGS="${LDFLAGS} -pg"
])
AC_ARG_ENABLE(extff,
[ --enable-extff build with external file format support])
AM_CONDITIONAL([BUILD_EXTFF], [test x"$enable_extff" = x"yes"])
AC_SUBST(ENABLE_EXTFF, ${enable_extff})
AC_ARG_ENABLE(test,
[ --enable-test build test programs])
AM_CONDITIONAL([BUILD_TEST], [test x"$enable_test" = x"yes"])
if test ${USE_CTAGS} = 1
then
AC_CHECK_PROG(GNC_CTAGS_FILE, ctags, tags)
fi
AC_ARG_ENABLE(bzip2,
AS_HELP_STRING([--disable-bzip2], [build without bzip2 support]))
AC_ARG_ENABLE(lzma,
AS_HELP_STRING([--disable-lzma], [build without lzma support]))
AC_ARG_ENABLE(zlib,
AS_HELP_STRING([--disable-zlib], [build without zlib support]))
AC_CONFIG_FILES([ Makefile \
libAlc/Makefile \
libAlg/Makefile \
libWlz/Makefile \
binWlz/Makefile \
binAlgTst/Makefile \
binWlzTst/Makefile ])
if test x${enable_extff} = "xyes"
then
AC_ARG_WITH(jpeg, [ --with-jpeg=DIR Directory containing the jpeg
lib and include directories.],
JPEG_DIR=$withval, JPEG_DIR=no)
if test ${JPEG_DIR} = "no"
then
AC_CHECK_HEADER(jpeglib.h,
AC_CHECK_LIB(jpeg, jpeg_CreateCompress,
[
HAVE_JPEG=yes
LIBS_EXTFF="-ljpeg ${LIBS_EXTFF}"
]))
else
HAVE_JPEG=yes
INCL_EXTFF="${INCL_EXTFF} -I${JPEG_DIR}/include"
LIBS_EXTFF="-L${JPEG_DIR}/lib -ljpeg ${LIBS_EXTFF}"
fi
AC_ARG_WITH(tiff, [ --with-tiff=DIR Directory containing the tiff
lib and include directories.],
TIFF_DIR=$withval, TIFF_DIR=no)
if test ${TIFF_DIR} = "no"
then
AC_CHECK_HEADER(tiff.h,
AC_CHECK_LIB(tiff, TIFFOpen,
[
HAVE_TIFF=yes
LIBS_EXTFF="-ltiff ${LIBS_EXTFF}"
]))
else
HAVE_TIFF=yes
INCL_EXTFF="${INCL_EXTFF} -I${TIFF_DIR}/include"
LIBS_EXTFF="-L${TIFF_DIR}/lib -ltiff ${LIBS_EXTFF}"
fi
AC_ARG_WITH(nifti, [ --with-nifti=DIR Directory containing NIfTI
lib and include directories.],
NIFTI_DIR=$withval, NIFTI_DIR=no)
if test ${NIFTI_DIR} = "no"
then
AC_CHECK_HEADER(nifti1_io.h,
AC_CHECK_LIB(nifti, nifti_simple_init_nim,
[
HAVE_NIFTI=yes
LIBS_EXTFF=" -lniftiio -lznz ${LIBS_EXTFF}"
]))
else
HAVE_NIFTI=yes
INCL_EXTFF="${INCL_EXTFF} -I${NIFTI_DIR}/include -I${NIFTI_DIR}/include/nifti"
LIBS_EXTFF=" -L${NIFTI_DIR}/lib -lniftiio -lznz ${LIBS_EXTFF}"
fi
AC_ARG_WITH(cjson, [ --with-cjson=DIR Directory containing the cJSON
lib and include directories.],
CJSON_DIR=$withval, CJSON_DIR=no)
if test ${CJSON_DIR} = "no"
then
AC_CHECK_HEADER(cJSON.h,
AC_CHECK_LIB(cjson, cJSON_Version,
[
HAVE_CJSON=yes
LIBS_EXTFF=" -lcjson ${LIBS_EXTFF}"
]))
else
HAVE_CJSON=yes
INCL_EXTFF="${INCL_EXTFF} -I${CJSON_DIR}/include"
LIBS_EXTFF=" -L${CJSON_DIR}/lib -lcjson ${LIBS_EXTFF}"
fi
if test ${ENABLE_EXTFF} = "yes"
then
AS_IF([test x"$enable_bzip2" != x"no"], [
AC_SEARCH_LIBS([BZ2_bzCompress], [bz2], [HAVE_BZLIB=yes])
])
AS_IF([test x"$enable_zlib" != x"no"], [
AC_SEARCH_LIBS([zlibVersion], [z], [HAVE_ZLIB=yes])
])
if test ${HAVE_BZLIB} = "no"
then
CFLAGS="${CFLAGS} -DHAVE_BZLIB=0"
else
CFLAGS="${CFLAGS} -DHAVE_BZLIB=1"
fi
AS_IF([test x"$enable_lzma" != x"no"], [
AC_SEARCH_LIBS([lzma_version_string], [lzma], [HAVE_LZMALIB=yes])
])
if test ${HAVE_BZLIB} = "no"
then
CFLAGS="${CFLAGS} -DHAVE_BZLIB=0"
else
CFLAGS="${CFLAGS} -DHAVE_BZLIB=1"
fi
if test ${HAVE_LZMALIB} = "no"
then
CFLAGS="${CFLAGS} -DHAVE_LZMALIB=0"
else
CFLAGS="${CFLAGS} -DHAVE_LZMALIB=1"
fi
if test ${HAVE_ZLIB} = "no"
then
CFLAGS="${CFLAGS} -DHAVE_ZLIB=0"
else
CFLAGS="${CFLAGS} -DHAVE_ZLIB=1"
fi
if test ${NIFTI_DIR} = "no"
then
CFLAGS="${CFLAGS} -DHAVE_NIFTI=0"
else
CFLAGS="${CFLAGS} -DHAVE_NIFTI=1"
fi
fi
AC_CONFIG_FILES([ libbibfile/Makefile \
libhguDlpList/Makefile \
libReconstruct/Makefile \
libWlzExtFF/Makefile \
libWlzBnd/Makefile \
binWlzApp/Makefile \
binWlzExtFF/Makefile])
fi
case $host in
*mingw*)
LIBS="-lregex $LIBS"
;;
*cygwin*)
LIBS="-lregex $LIBS"
;;
esac
AS_IF([ test "$CC" = "gcc" -a "x$enable_optimise" = "xyes" ],
CFLAGS="$CFLAGS $SIMD")
AC_OUTPUT
AC_MSG_RESULT([
Woolz core has been configured on ${host} with
Source directory: ${srcdir}
Installation directory: ${prefix}
Target CPU: ${target_cpu}
C compiler: ${CC}
C++ compiler: ${CXX}
Linker: ${LD}
Archiver: ${AR}
CFLAGS: ${CFLAGS}
LDFLAGS: ${LDFLAGS}
LIBS needed for configure: ${LIBS_EXTFF} ${LIBS}
Woolz external file format code: ${enable_extff}
Test programs: ${enable_test}
To build Woolz: make
To install Woolz: make install
To build Woolz documentation: make doc
To install Woolz documentation: make install-doc
])