configure.ac 16.6 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Copyright (C) 2006, 2007, 2008, 2009, 2010 EPITA Research and
# Development Laboratory (LRDE).
#
# This file is part of Olena.
#
# Olena 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, version 2 of the License.
#
# Olena 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 Olena.  If not, see <http://www.gnu.org/licenses/>.
17

18
m4_pattern_forbid([^OLN_])
19

Roland Levillain's avatar
Roland Levillain committed
20
AC_PREREQ([2.61])
21
22
23
24
25
26


## ---------------- ##
## Package set up.  ##
## ---------------- ##

27
AC_INIT([Olena], [1.0a], [olena@lrde.epita.fr], [olena])
28

Roland Levillain's avatar
Roland Levillain committed
29
30
31
# M4 macros.
AC_CONFIG_MACRO_DIR([m4])

32
33
34
35
36
# Auxiliary files.
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_FILES([build-aux/Makefile])

# Automake.
Roland Levillain's avatar
Roland Levillain committed
37
AM_INIT_AUTOMAKE([1.10 subdir-objects check-news dist-bzip2 nostdinc -Wall])
38

39
40
41
# Package metadata.
AC_CONFIG_FILES([milena/mln/version.hh])
AC_DEFINE_UNQUOTED([OLN_PACKAGE_NAME], ["$PACKAGE_NAME"],
42
		   [Package Full name.])
43
44
45
46
47
48
AC_DEFINE_UNQUOTED([OLN_PACKAGE_BUGREPORT], ["$PACKAGE_BUGREPORT"],
		   [Bug report address.])
AC_DEFINE_UNQUOTED([OLN_PACKAGE_STRING], ["$PACKAGE_STRING"],
		   [Full name and version.])
AC_DEFINE_UNQUOTED([OLN_PACKAGE_VERSION], ["$PACKAGE_VERSION"],
		   [Package Version.])
49

50
## --------------------- ##
51
## C++ compiler set up.  ##
52
53
## --------------------- ##

Roland Levillain's avatar
Roland Levillain committed
54
55
56
57
58
59
# If the user doesn't provide any CXXFLAGS, prevent Autoconf from
# settings its own default ones (e.g., `-g -O2' for g++).
if test ! ${CXXFLAGS+set}; then
   CXXFLAGS=""
fi

60
61
62
63
# Look for a C++ compiler.
AC_LANG([C++])
AC_PROG_CXX

64
65
66
# Set `ICPC' to `yes' if the Intel C++ compiler is used.
test $CXX --version 2>/dev/null | grep '\bICC\b' >/dev/null 2>&1 && ICPC=yes

67
# GNU C++ compiler setup.
68
if test "$GXX" = yes; then
69
  # Speed up compiling times.
70
  CXXFLAGS="$CXXFLAGS -pipe"
71
72
73
74
75
76
77
78
79
80
81
82
83

  # The code generated for mln::data::impl::memcpy__() by g++ 4.2 with
  # a high optimization level (`-O3') and without
  # `-fno-strict-aliasing' might be wrong, at least with Debian's g++
  # 4.2 on IA-32 (see also milena/mln/memcpy_.hh).  We observed this
  # behavior with e.g. milena/apps/graph-morpho/samples-image2d.cc.
  # Note that Debian's g++ 4.0, 4.1, 4.3 and 4.4 are fine.
  #
  # So, when the C++ compiler is g++ 4.2, set STRICT_ALIASING_CXXFLAGS
  # to `-fno-strict-aliasing'.
  if $CXX --version | head -n 1 | grep '\b4\.2' >/dev/null 2>&1; then
    STRICT_ALIASING_CXXFLAGS=-fno-strict-aliasing
  fi
84
fi
85
AC_SUBST([STRICT_ALIASING_CXXFLAGS])
86

87
88

# Adjusting warning options according to compilers.
89
AC_ARG_VAR([WARNINGS_CXXFLAGS], [C++ compiler warning flags])
90
91
92
93
94
95
96
97
98
99
100
case "$CXX" in
     # Intel compiler
     *icpc*)
	WARNINGS_CXXFLAGS="-Wall -wd111,193,279,383,444,522,654,810,981,1418"
	;;
     *)
	WARNINGS_CXXFLAGS="-Wall -W"
	;;
esac


101
102
103
104
105
106
# ------------------------------ #
# C++ compiler flags for tests.  #
# ------------------------------ #

# FIXME: We might want to write an Autoconf macro to factor this.

107
# Standard flags for tests.
108
AC_ARG_VAR([TESTS_CXXFLAGS], [C++ compiler flags for tests])
109
# We want no optimization for the tests (it slows down compiling
110
# times), and debugging information.
111
if test "$GXX" = yes && test -z "$TESTS_CXXFLAGS"; then
112
  TESTS_CXXFLAGS="-O0 -ggdb $WARNINGS_CXXFLAGS"
113
114
fi

115
# Flags for complex tests.
116
117
AC_ARG_VAR([TESTS_CXXFLAGS_SPEED],
           [C++ compiler optimization flags for (complex) tests])
118
119
120
121
122
123
# We want optimization for complex tests, and keep debugging flags
# (still useful).
if test "$GXX" = yes && test -z "$TESTS_CXXFLAGS_SPEED"; then
  TESTS_CXXFLAGS_SPEED="-O3 -DNDEBUG -ggdb -Wall -W"
fi

124
# Flags for tests with with all debugging features turned on.
125
AC_ARG_VAR([TESTS_CXXFLAGS_DEBUG], [C++ compiler debug flags])
126
127
128
129
130
131
132
# We want no optimization for the tests (it slows down compiling
# times), and a lot of debugging features.
# * GNU C++ Library Debug Mode:
#   http://gcc.gnu.org/onlinedocs/libstdc++/manual/debug_mode.html
# * GNU C++ Library Compile Time Checks (a.k.a. concept checking):
#   http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt12ch29.html
if test "$GXX" = yes && test -z "$TESTS_CXXFLAGS_DEBUG"; then
133
  TESTS_CXXFLAGS_DEBUG="-O0 -ggdb $WARNINGS_CXXFLAGS -D_GLIBCXX_DEBUG -D_GLIBCXX_CONCEPT_CHECKS"
134
135
136
fi


137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
## ------------------------------ ##
## ``Enable Everything'' Switch.  ##
## ------------------------------ ##

# Enable all bundled features (trimesh2, Swilena, apps, tools).  This
# option is useful to maintainers to ensure they do not break optional
# parts while modifying the core of the project. If both
# ``--enable-all'' is set and a given feature is disabled (say,
# ``--disable-apps''), then the disable flag has priority.

AC_ARG_ENABLE([all],
              [AS_HELP_STRING([--enable-all],
                              [enable maintainer mode])],
              [
               enable_trimesh=yes
               enable_swilena=yes
153
dnl<<lrde
154
               enable_scribo=yes
155
dnl>>
156
157
158
               enable_apps=yes
               enable_tools=yes
              ])
159

160

161
162
163
164
165
## ------------------ ##
## Libraries set up.  ##
## ------------------ ##

# Use Libtool.
166
167
# To be replaced by a call to LT_INIT as soon as Libtool 2.2 is used.
AC_PROG_LIBTOOL
168
169
170
171
172

# Check for Darwin.
AC_CANONICAL_HOST
AM_CONDITIONAL([DARWIN], [echo "$host_os" | grep '^darwin'])

Roland Levillain's avatar
Roland Levillain committed
173

174
175
176
## -------------------- ##
## External libraries.  ##
## -------------------- ##
177

178
### Support for FreeImagePlus has been disabled for Olena 1.0.
179
## OLN_WITH_LIB([FreeImagePlus], [FreeImagePlus.h], [freeimageplus])
180

181
# CFITSIO library.
182
OLN_WITH_LIB([CFITSIO], [fitsio.h], [cfitsio])
183

184
185
186
187
188
189
# Magick++.
# FIXME: We should handle Magick++ using pkgconfig (and/or
# Magick++-config?) instead of OLN_WITH_LIB.  See how other projects
# handle this.
OLN_WITH_LIB([Magick++], [Magick++.h], [Magick++], [magickxx], [MAGICKXX])

190
191
192
# TIFF library.
OLN_WITH_LIB([TIFF], [tiff.h], [tiff])

193
# Grassroots DiCoM (GDCM).
194
195
OLN_WITH_LIB([GDCM], [gdcm-2.0/gdcmReader.h], [gdcmCommon], [gdcm], [GDCM],
	     [-lgdcmzlib])
196

197
198
199
200
# Tesseract
OLN_WITH_LIB([TESSERACT], [tesseract/baseapi.h], [tesseract_full], [tesseract], [TESSERACT])


201

202
203
204
205
206
## ---------------------------- ##
## (Bundled) trimesh2 library.  ##
## ---------------------------- ##

AC_ARG_ENABLE([trimesh],
207
              [AS_HELP_STRING([--enable-trimesh],
208
                              [build the (bundled) trimesh2 library])])
209
AM_CONDITIONAL([ENABLE_TRIMESH], [test "x$enable_trimesh" = xyes])
210
211
AC_CONFIG_SUBDIRS([external/trimesh])

Roland Levillain's avatar
Roland Levillain committed
212
213
214
215
## --------- ##
## Swilena.  ##
## --------- ##

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
AC_ARG_ENABLE([swilena],
              [AS_HELP_STRING([--enable-swilena],
                              [build Swilena Python bindings])])
AS_IF([test "x$enable_swilena" = xyes],
      [# Ensure dynamic libraries are enabled.
       if test "x$enable_shared" = xno; then
         AC_MSG_ERROR([`--enable-swilena' was given, but dynamic libraries are
disabled.  Try to invoke configure with `--enable-shared'.])
       fi
       # Check for SWIG.
       AC_PROG_SWIG([1.3.35])
       if (eval "$SWIG -version") >/dev/null 2>&1; then :; else
         AC_MSG_ERROR([SWIG 1.3.35 is required for Swilena])
       fi
       # Check for Python.
       AM_PATH_PYTHON([2.4], [],
                      [AC_MSG_ERROR([Python 2.4 is required for Swilena.])])
       adl_CHECK_PYTHON
       # Check for Python headers.
       save_CPPFLAGS=$CPPFLAGS
       CPPFLAGS="$CPPFLAGS -I$PYTHONINC"
       AC_CHECK_HEADERS([Python.h], [],
                        [AC_MSG_ERROR([`Python.h' is required for Swilena.
Try adding `-I <Python include path>' to `CPPFLAGS'.])])
       CPPFLAGS=$save_CPPFLAGS])
AM_CONDITIONAL([ENABLE_SWILENA], [test "x$enable_swilena" = xyes])
Roland Levillain's avatar
Roland Levillain committed
242

243
AC_CONFIG_FILES([swilena/Makefile
244
		 swilena/python/Makefile])
245

Roland Levillain's avatar
Roland Levillain committed
246
247
AC_CONFIG_FILES([swilena/run], [chmod +x swilena/run])

248
AC_CONFIG_FILES(m4_do([swilena/python/sps],
249
250
251
		      [:swilena/python/sps-common.in],
		      [:swilena/python/sps.in]),
		[chmod +x swilena/python/sps])
252
AC_CONFIG_FILES(m4_do([swilena/python/sps-local],
253
254
255
		      [:swilena/python/sps-common.in],
		      [:swilena/python/sps-local.in]),
		[chmod +x swilena/python/sps-local])
256

257
dnl<<lrde
258
259
260
261
## -------- ##
## Scribo.  ##
## -------- ##

262
263
264
AC_ARG_ENABLE([scribo],
              [AS_HELP_STRING([--enable-scribo],
                              [enable Scribo])])
265
AM_CONDITIONAL([ENABLE_SCRIBO], [test "x$enable_scribo" = xyes])
266
267
268

AC_CONFIG_FILES([
  scribo/Makefile
269
    scribo/demo/Makefile
270
271
    scribo/src/Makefile
      scribo/src/binarization/Makefile
272
      scribo/src/debug/Makefile
273
      scribo/src/filter/Makefile
274
275
      scribo/src/misc/Makefile
      scribo/src/multi_scale/Makefile
276
      scribo/src/preprocessing/Makefile
277
278
279
280
      scribo/src/primitive/Makefile
	scribo/src/primitive/extract/Makefile
	scribo/src/primitive/find/Makefile
        scribo/src/primitive/group/Makefile
281
      scribo/src/table/Makefile
282
      scribo/src/text/Makefile
283
284
285
286
287
288
289
290
291
292
])

AC_CONFIG_FILES([scribo/tests/data.hh])

AC_CONFIG_FILES([
  scribo/tests/Makefile
    scribo/tests/filter/Makefile
    scribo/tests/preprocessing/Makefile
    scribo/tests/table/Makefile
    scribo/tests/text/Makefile
293
    scribo/tests/unit_test/Makefile
294
])
295
dnl>>
Roland Levillain's avatar
Roland Levillain committed
296

297
298
299
300
## --------------- ##
## Configuration.  ##
## --------------- ##

301
302
# Ask for config.h creation.
AC_CONFIG_HEADERS([config.h])
303

304
305
306
307
# Ask for the creation of a milena/doc/tool/data.hh, used to access to
# data (images) from the documentation.
AC_CONFIG_FILES([milena/doc/tools/data.hh])

308
309
310
# Ask for the Makefile creations.
AC_CONFIG_FILES([
  Makefile
Roland Levillain's avatar
Roland Levillain committed
311
    external/Makefile
312
313
    milena/Makefile
      milena/doc/Makefile
314
      milena/mesh/Makefile
315
])
316

317

318
319
320
321
## ------- ##
## Tests.  ##
## ------- ##

Roland Levillain's avatar
Roland Levillain committed
322
323
# Ask for the creation of a milena/tests/data.hh, used to access to
# data (images) from tests.
324
325
AC_CONFIG_FILES([milena/tests/data.hh])

Roland Levillain's avatar
Roland Levillain committed
326
# Ask for the creation of tests' Makefiles.
327
AC_CONFIG_FILES([
328
  milena/tests/Makefile
Roland Levillain's avatar
Roland Levillain committed
329
    milena/tests/accu/Makefile
330
    milena/tests/accu/image/Makefile
331
    milena/tests/accu/site_set/Makefile
332
    milena/tests/accu/stat/Makefile
333
    milena/tests/accu/math/Makefile
334
    milena/tests/accu/shape/Makefile
335
    milena/tests/algebra/Makefile
336
    milena/tests/arith/Makefile
337
    milena/tests/binarization/Makefile
Roland Levillain's avatar
Roland Levillain committed
338
    milena/tests/border/Makefile
339
340
341
342
    milena/tests/canvas/Makefile
      milena/tests/canvas/browsing/Makefile
      milena/tests/canvas/morpho/Makefile
    milena/tests/convert/Makefile
343
    milena/tests/convert/impl/Makefile
Roland Levillain's avatar
Roland Levillain committed
344
    milena/tests/core/Makefile
Nicolas Ballas's avatar
Nicolas Ballas committed
345
346
      milena/tests/core/alias/Makefile
      milena/tests/core/image/Makefile
347
	milena/tests/core/image/dmorph/Makefile
348
349
	milena/tests/core/image/imorph/Makefile
	milena/tests/core/image/vmorph/Makefile
Nicolas Ballas's avatar
Nicolas Ballas committed
350
351
352
      milena/tests/core/other/Makefile
      milena/tests/core/routine/Makefile
      milena/tests/core/site_set/Makefile
353
    milena/tests/data/Makefile
354
355
      milena/tests/data/approx/Makefile
      milena/tests/data/naive/Makefile
Roland Levillain's avatar
Roland Levillain committed
356
357
358
    milena/tests/debug/Makefile
    milena/tests/display/Makefile
    milena/tests/draw/Makefile
359
    milena/tests/estim/Makefile
360
    milena/tests/extension/Makefile
361
362
363
    milena/tests/fun/Makefile
      milena/tests/fun/i2v/Makefile
      milena/tests/fun/p2b/Makefile
364
      milena/tests/fun/p2p/Makefile
365
      milena/tests/fun/p2v/Makefile
366
      milena/tests/fun/stat/Makefile
367
      milena/tests/fun/v2v/Makefile
368
      milena/tests/fun/vv2v/Makefile
Roland Levillain's avatar
Roland Levillain committed
369
370
      milena/tests/fun/x2x/Makefile
    milena/tests/geom/Makefile
371
372
    milena/tests/graph/Makefile
      milena/tests/graph/attribute/Makefile
Roland Levillain's avatar
Roland Levillain committed
373
    milena/tests/histo/Makefile
374
    milena/tests/io/Makefile
375
      milena/tests/io/dicom/Makefile
376
      milena/tests/io/dump/Makefile
Roland Levillain's avatar
Roland Levillain committed
377
      milena/tests/io/fits/Makefile
378
      milena/tests/io/fld/Makefile
379
      milena/tests/io/magick/Makefile
380
      milena/tests/io/off/Makefile
Roland Levillain's avatar
Roland Levillain committed
381
      milena/tests/io/pbm/Makefile
382
      milena/tests/io/pbms/Makefile
383
384
      milena/tests/io/pfm/Makefile
      milena/tests/io/pgm/Makefile
385
      milena/tests/io/pgms/Makefile
386
387
      milena/tests/io/pnm/Makefile
      milena/tests/io/ppm/Makefile
388
      milena/tests/io/ppms/Makefile
389
      milena/tests/io/tiff/Makefile
390
    milena/tests/labeling/Makefile
Roland Levillain's avatar
Roland Levillain committed
391
392
393
394
    milena/tests/linear/Makefile
      milena/tests/linear/local/Makefile
    milena/tests/literal/Makefile
    milena/tests/logical/Makefile
395
    milena/tests/make/Makefile
Roland Levillain's avatar
Roland Levillain committed
396
397
398
399
400
    milena/tests/math/Makefile
    milena/tests/metal/Makefile
      milena/tests/metal/make/Makefile
      milena/tests/metal/math/Makefile
    milena/tests/morpho/Makefile
401
      milena/tests/morpho/approx/Makefile
402
      milena/tests/morpho/attribute/Makefile
403
      milena/tests/morpho/closing/Makefile
404
      milena/tests/morpho/closing/approx/Makefile
405
      milena/tests/morpho/elementary/Makefile
406
      milena/tests/morpho/opening/Makefile
407
      milena/tests/morpho/opening/approx/Makefile
408
      milena/tests/morpho/reconstruction/Makefile
409
        milena/tests/morpho/reconstruction/by_dilation/Makefile
410
        milena/tests/morpho/reconstruction/by_erosion/Makefile
411
      milena/tests/morpho/tree/Makefile
Edwin Carlinet's avatar
Edwin Carlinet committed
412
	milena/tests/morpho/tree/filter/Makefile
413
      milena/tests/morpho/watershed/Makefile
414
    milena/tests/norm/Makefile
415
    milena/tests/opt/Makefile
Roland Levillain's avatar
Roland Levillain committed
416
417
418
    milena/tests/pw/Makefile
    milena/tests/set/Makefile
    milena/tests/tag/Makefile
419
    milena/tests/test/Makefile
420
    milena/tests/topo/Makefile
421
      milena/tests/topo/skeleton/Makefile
Roland Levillain's avatar
Roland Levillain committed
422
423
424
425
426
    milena/tests/trace/Makefile
    milena/tests/trait/Makefile
      milena/tests/trait/image/Makefile
      milena/tests/trait/op/Makefile
      milena/tests/trait/value/Makefile
427
    milena/tests/transform/Makefile
428
    milena/tests/unit_test/Makefile
429
430
    milena/tests/upscaling/Makefile
      milena/tests/upscaling/art/Makefile
431
    milena/tests/util/Makefile
Roland Levillain's avatar
Roland Levillain committed
432
433
434
435
    milena/tests/value/Makefile
      milena/tests/value/builtin/Makefile
      milena/tests/value/concept/Makefile
    milena/tests/win/Makefile
436
    milena/tests/world/Makefile
437
      milena/tests/world/binary_2d/Makefile
438
439
      milena/tests/world/inter_pixel/Makefile
	milena/tests/world/inter_pixel/dim2/Makefile
440
])
441

442
443
dnl<<lrde
AC_CONFIG_FILES([
444
  milena/tests/extract/Makefile
445
446
447
448
449
450
  milena/tests/linear/gaussian/Makefile
  milena/tests/registration/Makefile
  milena/tests/subsampling/Makefile
])
dnl>>

451
452
453
454
455

## -------------- ##
## Applications.  ##
## -------------- ##

456
457
458
459
# Ask for the creation of a milena/apps/data.hh, used to access to
# data (images) from apps.
AC_CONFIG_FILES([milena/apps/data.hh])

460
461
462
463
464
AC_ARG_ENABLE([apps],
              [AS_HELP_STRING([--enable-apps],
                              [enable application])])
AM_CONDITIONAL([ENABLE_APPS], [test "x$enable_apps" = "xyes"])

465
# Ask for the creation of applications' Makefiles.
466
467
AC_CONFIG_FILES([
  milena/apps/Makefile
468
    milena/apps/constrained-connectivity/Makefile
469
470
471
472
    milena/apps/graph-morpho/Makefile
    milena/apps/mesh-segm-skel/Makefile
    milena/apps/papers/Makefile
      milena/apps/papers/levillain.09.ismm/Makefile
473
])
474
475

# Configure tests.
476
477
# FIXME: Consider using `sed' instead of `configure' to create these
# tests for the sake of speed.
478
479
480
481
482
483
484
485
486
487
488
489
AC_CONFIG_FILES([milena/apps/mesh-segm-skel/test-mesh-max-curv],
		[chmod +x milena/apps/mesh-segm-skel/test-mesh-max-curv])
AC_CONFIG_FILES([milena/apps/mesh-segm-skel/test-mesh-complex-max-curv],
		[chmod +x milena/apps/mesh-segm-skel/test-mesh-complex-max-curv])
AC_CONFIG_FILES([milena/apps/mesh-segm-skel/test-mesh-segm],
		[chmod +x milena/apps/mesh-segm-skel/test-mesh-segm])
AC_CONFIG_FILES([milena/apps/mesh-segm-skel/test-mesh-complex-segm],
		[chmod +x milena/apps/mesh-segm-skel/test-mesh-complex-segm])
AC_CONFIG_FILES([milena/apps/mesh-segm-skel/test-mesh-complex-max-curv-segm],
		[chmod +x milena/apps/mesh-segm-skel/test-mesh-complex-max-curv-segm])
AC_CONFIG_FILES([milena/apps/mesh-segm-skel/test-mesh-complex-skel],
		[chmod +x milena/apps/mesh-segm-skel/test-mesh-complex-skel])
490

491
492
493
AC_CONFIG_FILES([milena/apps/constrained-connectivity/test-constrained-connectivity],
		[chmod +x milena/apps/constrained-connectivity/test-constrained-connectivity])

494
# Flags for apps.
495
AC_ARG_VAR([APPS_CXXFLAGS], [C++ compiler flags for applications])
496
497
# We want fast binaries for apps.
if test "$GXX" = yes && test -z "$APPS_CXXFLAGS"; then
498
  APPS_CXXFLAGS="-O3 -DNDEBUG -ggdb $WARNINGS_CXXFLAGS"
499
500
fi

501
502
503
504
505
506
507
508
509
510
511
512
513
## ------- ##
## Tools.  ##
## ------- ##

AC_ARG_ENABLE([tools],
              [AS_HELP_STRING([--enable-tools],
                              [enable tools])])
AM_CONDITIONAL([ENABLE_TOOLS], [test "x$enable_tools" = "xyes"])

# Ask for the creation of tools' Makefiles.
AC_CONFIG_FILES([milena/tools/Makefile])

# Flags for tools.
514
AC_ARG_VAR([TOOLS_CXXFLAGS], [C++ compiler flags for tools])
515
516
# We want fast binaries for tools.
if test "$GXX" = yes && test -z "$TOOLS_CXXFLAGS"; then
517
  TOOLS_CXXFLAGS="-O3 -DNDEBUG -ggdb $WARNINGS_CXXFLAGS"
518
519
520
fi


521
AC_OUTPUT