File: configure.ac

package info (click to toggle)
fastjet 3.0.6+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,404 kB
  • ctags: 3,770
  • sloc: cpp: 21,498; sh: 10,546; fortran: 673; makefile: 527; ansic: 131
file content (472 lines) | stat: -rw-r--r-- 17,863 bytes parent folder | download | duplicates (2)
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
AC_INIT([FastJet],[3.0.6])
AC_CONFIG_SRCDIR([src/JetDefinition.cc])
AM_INIT_AUTOMAKE(tar-ustar)

dnl Make sure users can't install in build directory
if test "$prefix" = "$PWD"; then
  AC_MSG_ERROR([Installation into the build directory is not supported: use a different --prefix argument])
fi

dnl (un_comment the following lines if you want to use autoheader
dnl and also (un_comment the call to autoheader in autogen.sh
dnl 
dnl Notes:
dnl  - the first macro needs to place the files in the correct 
dnl    dir in order to have the correct -I options for the remote build
dnl  - see Makefile.am for distcleaning AX_PREFIX_CONFIG_H leftovers
AC_CONFIG_HEADERS(include/fastjet/config_raw.h:config.h.in)
AX_PREFIX_CONFIG_H(include/fastjet/config_auto.h,FASTJET,include/fastjet/config_raw.h)

dnl check autoconf version
dnl
dnl 2011-07-07 tested explicitly to be working with
dnl   autoconf-2.59 (lxplus)
dnl   autoconf-2.61 (karnak)
dnl   autoconf-2.65 (ipht)
dnl   autoconf-2.68 (virtual&lpthe)
dnl
dnl 2013-03-30, updated and tested it works with
dnl   autoconf-2.63 + automake 1.11 (tycho SLC6)
dnl   autoconf-2.69 + automake 1.13 (gavin's laptop with macports)
dnl
dnl   NB: it is broken on lxplus (SLC5, autoconf 2.59 + automake 1.9), 
dnl       but lxplus will soon migrate to SLC6. For now 
dnl       autogen can be run on lxplus6, links to automake-1.11 
dnl       files replaced with copies and then used on lxplus5
AC_PREREQ(2.63)

dnl load our M4 macro directory
dnl  - this is recommended by latest versions of libtoolize
dnl  - this is equivalent to adding ACLOCAL_AMFLAGS = -I m4 in Makefile.am
dnl  - the libtoolize manpage says that for the moment it's more 
dnl    portable to keep using ACLOCAL_AMFLAGS.
dnl  - the autoconf manual mentions that since we use 'aclocal -I m4'
dnl    we need ACLOCAL_AMFLAGS anyway
dnl as a consequence, we don't use AC_CONFIG_MACRO_DIR for the moment
dnl Question: is it compatible with older versions of libtool?
dnl   AC_CONFIG_MACRO_DIR([m4])

dnl check basic types
AC_CHECK_TYPE(int)
AC_CHECK_TYPE(long)

dnl-------------------------------------------------------------------
dnl if the user has not set CXXFLAGS, then set our own default
dnl-------------------------------------------------------------------
USE_CUSTOM_FLAGS="yes"
if [[ "x$CXXFLAGS" == "x" ]]; then
   CXXFLAGS="-O3 -Wall"
   USE_CUSTOM_FLAGS="no"
fi

# test "x${CXXFLAGS+yes}" == "xyes" || CXXFLAGS="-O3 -Wall"

dnl-------------------------------------------------------------------
dnl check useful programs
dnl-------------------------------------------------------------------
AC_PROG_CXX

dnl ensure CXX presence
cxx_progname=$(basename $CXX)
cxx_dirname=$(dirname $CXX)
AC_CHECK_PROG([cxx_found],[$cxx_progname],[yes],[no].[$cxx_dirname$PATH_SEPARATOR$PATH])
if test "x$cxx_found" == "xno"; then
   AC_MSG_ERROR([No functional C++ compiler found])
fi

AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_SED
AC_PROG_MAKE_SET

AM_CXXFLAGS=""

dnl check standard C headers
AC_STDC_HEADERS

dnl set the default destination directory
AC_PREFIX_DEFAULT(/usr/local)

dnl-------------------------------------------------------------------
dnl initialize compilation and link flags to set in fastjet-config
dnl-------------------------------------------------------------------
CONFIG_CXXFLAGS=""
CONFIG_RUNPATH_FLAGS=""
CONFIG_LIBS=""
CONFIG_LIBS_PLUGINS=""
CONFIG_LIBS_PLUGINS_STATIC=""

dnl-------------------------------------------------------------------
dnl deal with debug option
dnl-------------------------------------------------------------------
dnl if the debug flag is set, build with -g
dnl default is "yes"
AC_ARG_ENABLE(debug,
	[  --enable-debug          Turn on debug compiler information [default=yes]],
	[ENABLE_DEBUG_FLAG="$enableval"],
	[ENABLE_DEBUG_FLAG="yes"])
if [[ "$ENABLE_DEBUG_FLAG" == "yes" ]] ; then
   AM_CXXFLAGS=${AM_CXXFLAGS}" -g "

   dnl-------------------------------------------------------------------
   dnl check if the compiler supports -Woverloaded-virtual
   dnl-------------------------------------------------------------------
   AC_MSG_CHECKING([if $CXX supports -Woverloaded-virtual flag])
   SAVE_CXXFLAGS="$CXXFLAGS"
   CXXFLAGS="-Woverloaded-virtual"
   AC_LANG_PUSH(C++)
   AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void){ return 0;}])],
       [ac_overloaded_virtual_ok=yes],[ac_overloaded_virtual_ok=no])
   AC_LANG_POP(C++)
   CXXFLAGS="$SAVE_CXXFLAGS"
   AC_MSG_RESULT([$ac_overloaded_virtual_ok])
   if [[ "x${ac_overloaded_virtual_ok}" == "xyes" ]]; then
      AM_CXXFLAGS=${AM_CXXFLAGS}" -Woverloaded-virtual "
   fi
fi

dnl check if one wants a high level of warnings
AC_ARG_ENABLE(extra-warnings,
	[  --enable-extra-warnings Turn on additional compiler warnings [default=no]],
	[ENABLE_EXTRA_WARNINGS_FLAG="$enableval"],
	[ENABLE_EXTRA_WARNINGS_FLAG="no"])
if [[ "$ENABLE_EXTRA_WARNINGS_FLAG" == "yes" ]] ; then
   AM_CXXFLAGS=${AM_CXXFLAGS}" -ansi -pedantic -Wextra -Wshadow "
fi

dnl-------------------------------------------------------------------
dnl deal with the choice of shared/static libs
dnl-------------------------------------------------------------------
dnl build the shared lib by default
dnl even though they're enabled by default, AM_ENABLE_SHARED has to
dnl be called so that ${enable_shared} is set to 'yes' instead of ''
AM_ENABLE_SHARED
dnl
dnl comment the previous line and uncomment this one if you want shared 
dnl libs to be disabled by default
dnl AM_DISABLE_SHARED
HAS_SHARED=${enable_shared}

dnl-------------------------------------------------------------------
dnl check headers
dnl-------------------------------------------------------------------
dnl execinfo.h (use in Error.cc to have the backtrace)
AC_CHECK_HEADERS(execinfo.h)

dnl-------------------------------------------------------------------
dnl check libraries
dnl-------------------------------------------------------------------
dnl math lib
AC_CHECK_LIB(m, cos)
CONFIG_CXXFLAGS=""
CONFIG_LIBS=${CONFIG_LIBS}" -lm "

dnl-------------------------------------------------------------------
dnl deal with CGAL
dnl-------------------------------------------------------------------
CGAL_CPPFLAGS=""
CGAL_LIBS=""

dnl first check if the user wants to use CGAL
dnl default value is "no"
dnl Note that CGAL compilation flags are considered as required
dnl so we do store them in "AM_CXXFLAGS"
AC_ARG_ENABLE(cgal,
       [  --enable-cgal           enables link with the CGAL library [default=no]],
       [ENABLE_CGAL_FLAG="$enableval"],
       [ENABLE_CGAL_FLAG="no"])
dnl if asked for, check if the CGAL library can be used
if [[ "x${ENABLE_CGAL_FLAG}" == "xyes" ]] ; then
   dnl if the search for CGAL has been explicitly asked and not found, return an error
   dnl ACX_CHECK_CGAL([],[ENABLE_CGAL_FLAG="no"])
   ACX_CHECK_CGAL([],AC_MSG_ERROR([CGAL explicitly requested and not found or not functional]))
fi

dnl update compilation/link flags for the CGAL lib
if [[ "x$ENABLE_CGAL_FLAG" == "xyes" ]] ; then
   AM_CXXFLAGS=${AM_CXXFLAGS}" $CGAL_CPPFLAGS "
   CONFIG_LIBS=${CONFIG_LIBS}" $CGAL_LDFLAGS $CGAL_LIBS "
else
   AM_CXXFLAGS=${AM_CXXFLAGS}" -DDROP_CGAL "
dnl   CONFIG_CXXFLAGS=${CONFIG_CXXFLAGS}" -DDROP_CGAL "
fi
AC_SUBST(CGAL_CPPFLAGS)
AC_SUBST(CGAL_LIBS)

dnl-------------------------------------------------------------------
dnl check if the linker supports --enable-new-dtags (rpath-related)
dnl-------------------------------------------------------------------
AC_MSG_CHECKING([if $CXX supports -Wl,--enable-new-dtags flag])
SAVE_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="-Werror -Wl,--enable-new-dtags"
AC_LANG_PUSH(C++)
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void){ return 0;}])],
   [ac_enable_new_dtags_ok=yes],[ac_enable_new_dtags_ok=no])
AC_LANG_POP(C++)
CXXFLAGS="$SAVE_CXXFLAGS"
AC_MSG_RESULT([$ac_enable_new_dtags_ok])
HAS_RUNPATH_SUPPORT="no"
CONFIG_RUNPATH_FLAGS=""
dnl if test x"$ac_enable_new_dtags_ok" = x"yes"; then
if [[ "x${ac_enable_new_dtags_ok}" == "xyes" ]]; then
   HAS_RUNPATH_SUPPORT="yes"
   CONFIG_RUNPATH_FLAGS="-Wl,--enable-new-dtags"
fi
AC_SUBST(HAS_RUNPATH_SUPPORT)
AC_SUBST(CONFIG_RUNPATH_FLAGS)

dnl substitutions
AC_SUBST(AM_CXXFLAGS)

dnl create the substitutions variables for the configuration script
AC_SUBST(PACKAGE_VERSION)
AC_SUBST(HAS_SHARED)

dnl-------------------------------------------------------------------
dnl plugin section
dnl
dnl each plugin can be enabled or disabled
dnl We also define a ENABLED_PLUGIN_<name> in config.h when plugin
dnl <name> is enabled
dnl WARNING: for make dist reasons all Makefiles MUST be created
dnl
dnl See m4/plugins.m4 to see what is enabled by default
dnl-------------------------------------------------------------------
dnl general
AC_CONFIG_FILES( plugins/Makefile )
CONFIG_LIBS_PLUGINS=""
CONFIG_LIBS_PLUGINS_STATIC=""

dnl deal with a couple of arguments to allow a whole bunch of plugins at a time
ACX_INIT_PLUGINS
ACX_CHECK_ALLPLUGINS
ACX_CHECK_ALLCXXPLUGINS

dnl initialise the list of allowed plugins
dnl This is meant to enable fastjet-config --list-plugins
LIST_ALL_PLUGINS=""

dnl allow to build all plugins in the same lib
AC_ARG_ENABLE(monolithic,
[  --enable-monolithic  Build all the (compiled) plugins in a single lib [default=yes]],
[case "${enableval}" in
  yes) monolithic=yes ;;
  no)  monolithic=no ;;
  *) AC_MSG_ERROR(bad value ${enableval} for --enable-monolithic) ;;
esac],[monolithic=yes])
AM_CONDITIONAL(MONOLITHIC_PLUGINS, test x$monolithic = xyes)
if [[ "x$monolithic" == "xyes" ]] ; then
   CONFIG_LIBS_PLUGINS=" -lfastjetplugins "
   CONFIG_LIBS_PLUGINS_STATIC=" \${installationdir}/lib/libfastjetplugins.a "
fi

dnl SISCone
ACX_CHECK_PLUGIN(SISCone, siscone, SISCONE, yes)
AC_CONFIG_SUBDIRS(plugins/SISCone/siscone)
dnl alternatively, to build SISCone directly from the FastJet build
dnl system, comment out the previoous lines and uncomment the ones
dnl below. Note that the main drawback of that method is that the
dnl SISCone version number need to be hardcoded in config.h.siscone.in
dnl   AM_CONFIG_HEADER(config.siscone.in.h:plugins/SISCone/siscone/siscone/config.h.in)
dnl   AC_CONFIG_FILES(plugins/SISCone/siscone/Makefile plugins/SISCone/siscone/siscone/Makefile plugins/SISCone/siscone/siscone/spherical/Makefile plugins/SISCone/siscone/examples/Makefile plugins/SISCone/siscone/examples/events/Makefile)

dnl PxCone
ACX_CHECK_PLUGIN(PxCone, pxcone, PXCONE, no)

dnl D0RunIICone
ACX_CHECK_PLUGIN(D0RunIICone, d0runiicone, D0RUNIICONE, no)

dnl NestedDefs
ACX_CHECK_PLUGIN(NestedDefs, nesteddefs, NESTEDDEFS, yes)

dnl TrackJet
ACX_CHECK_PLUGIN(TrackJet, trackjet, TRACKJET, no)

dnl CMSIterativeCone
ACX_CHECK_PLUGIN(CMSIterativeCone, cmsiterativecone, CMSITERATIVECONE, no)

dnl EECambridge
ACX_CHECK_PLUGIN(EECambridge, eecambridge, EECAMBRIDGE, yes)

dnl Jade
ACX_CHECK_PLUGIN(Jade, jade, JADE, yes)

dnl D0RunICone
ACX_CHECK_PLUGIN(D0RunICone, d0runicone, D0RUNICONE, no)

dnl GridJet
ACX_CHECK_PLUGIN(GridJet, gridjet, GRIDJET, yes)

dnl end of plugin section --- don't modify this line

dnl-------------------------------------------------------------------
dnl enable libtool (has to be done after the previous lib checks!)
dnl-------------------------------------------------------------------
AC_PROG_LIBTOOL

dnl-------------------------------------------------------------------
dnl add Fortran flags if any plugin that needs it is enabled
dnl-------------------------------------------------------------------
if [[ "x$ENABLE_PXCONE" == "xyes" ]] ; then
   dnl set up the fortran compiler and libs
   if test "x$FCFLAGS" == "x"; then
      FCFLAGS="-O2"
   fi
   ## Try to respect users' Fortran compiler variables
   if test "x$FC" == "x"; then
      if test "x$F77" != "x"; then
      	 FC="$F77"
      fi
   fi
   AC_PROG_FC
   if test "x$FC" == "x"; then
      AC_MSG_ERROR([Fortran compiler required to build PxCone but not found or not functional])
   fi
   AC_FC_LIBRARY_LDFLAGS
   F77=$FC
   AM_FFLAGS=$AM_FCFLAGS
   FFLAGS="$FFLAGS $FCFLAGS"
   FLIBS="$FLIBS $FCLIBS"
   AC_SUBST(FCFLAGS)
   AC_SUBST(FFLAGS)
   AC_SUBST(FLIBS)
   AC_SUBST(F77)
   AC_SUBST(AM_FFLAGS)
   AC_SUBST(AM_FCFLAGS)

   CONFIG_LIBS_PLUGINS=${CONFIG_LIBS_PLUGINS}" "${FLIBS}
   CONFIG_LIBS_PLUGINS_STATIC=${CONFIG_LIBS_PLUGINS_STATIC}" "${FLIBS}
fi

dnl-------------------------------------------------------------------
dnl be a bit clearer and use only AM_CXXFLAGS
dnl WARNING: this it totally unnecessary! Except for the D0 plugin:
dnl          since the CXXFLAGS are placed after the AM_CXXFLAGS in
dnl          the command line, a potential -O0 would be spoiled by
dnl          the -O3 in CXXFLAGS. By putting  CXXFLAGS in AM_CXXFLAGS
dnl          we have a better control on the order
dnl------------------------------------------------------------------
if [[ "x$USE_CUSTOM_FLAGS" == "xno" ]]; then
   AM_CXXFLAGS=${CXXFLAGS}" "${AM_CXXFLAGS}
   CXXFLAGS=""
fi


dnl------------------------------------------------------------------
dnl there is a problem with optimisation of the D0 code.
dnl One of the solutions to this issue is to disble inlie functions
dnl We ony do that if the compiler supports the option, otherwise, 
dnl we disable optimisation for that plugin
dnl------------------------------------------------------------------
if [[ "x$ENABLE_D0RUNIICONE" == "xyes" ]] ; then
   # check if the compiler supports -fno-inline
   AC_MSG_CHECKING([if $CXX supports -fno-inline])
   SAVE_CXXFLAGS="$CXXFLAGS"
   CXXFLAGS="-Werror -fno-inline"
   AC_LANG_PUSH(C++)
   AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void){ return 0;}])],
      [ac_support_no_inline=yes],[ac_support_no_inline=no])
   AC_LANG_POP(C++)
   CXXFLAGS="$SAVE_CXXFLAGS"
   AC_MSG_RESULT([$ac_support_no_inline])
   D0_CXXFLAGS=""

   dnl if test x"$ac_enable_new_dtags_ok" = x"yes"; then
   if [[ "x${ac_support_no_inline}" == "xyes" ]]; then
      D0_CXXFLAGS=${AM_CXXFLAGS}" -fno-inline"
   else
      # in case of multiple -O options, the last one prevails
      D0_CXXFLAGS=${AM_CXXFLAGS}" -O0"
   fi
   
   AC_SUBST(D0_CXXFLAGS)
fi

dnl-------------------------------------------------------------------
dnl substitutions useful to know what we have to do in fastjet-config
dnl-------------------------------------------------------------------
AC_SUBST(CONFIG_LIBS_PLUGINS)
AC_SUBST(CONFIG_LIBS_PLUGINS_STATIC)
AC_SUBST(CONFIG_CXXFLAGS)
AC_SUBST(CONFIG_LIBS)
AC_SUBST(CONFIG_RUNPATH_FLAGS)
AC_SUBST(LIST_ALL_PLUGINS)

dnl-------------------------------------------------------------------
dnl tools section
dnl-------------------------------------------------------------------
AC_CONFIG_FILES( tools/Makefile tools/fastjet/Makefile tools/fastjet/tools/Makefile )


dnl-------------------------------------------------------------------
dnl make sure examples dir is there
dnl-------------------------------------------------------------------
AC_CONFIG_FILES( example/Makefile example/data/Makefile example/root/Makefile )

dnl-------------------------------------------------------------------
dnl and the documentation
dnl-------------------------------------------------------------------
AC_CONFIG_FILES( doc/Makefile doc/figs/Makefile )

dnl-------------------------------------------------------------------
dnl configuration script
dnl-------------------------------------------------------------------
AC_CONFIG_FILES([fastjet-config:fastjet-config.in], [chmod u+x fastjet-config])

dnl-------------------------------------------------------------------
dnl sample fortran wrapper
dnl-------------------------------------------------------------------
AC_CONFIG_FILES( fortran_wrapper/Makefile )

dnl-------------------------------------------------------------------
dnl main library outputs
dnl-------------------------------------------------------------------
AC_CONFIG_FILES( Makefile src/Makefile include/Makefile include/fastjet/Makefile include/fastjet/internal/Makefile )

dnl-------------------------------------------------------------------
dnl give a nice summary of the config
dnl-------------------------------------------------------------------
dnl echo ""
dnl echo "Configuration summary:"
dnl echo "----------------------"
dnl echo "  Installation directory     "${prefix}
dnl echo "  Shared libraries           "${enable_shared}
dnl echo "  Static libraries           "${enable_static}
dnl echo "  Debug flag                 "$ENABLE_DEBUG_FLAG
dnl echo "  CGAL support               "${ENABLE_CGAL_FLAG}
dnl AC_PLUGIN_SUMMARY
dnl echo "  Monolithic plugins lib     "$monolithic

CONFIG_SUMMARY=""
CONFIG_SUMMARY+="Configuration summary:\n"
CONFIG_SUMMARY+="----------------------\n"
if [[ "x${prefix}" == "xNONE" ]] ; then
CONFIG_SUMMARY+="  Installation directory     /usr/local\n"
else
CONFIG_SUMMARY+="  Installation directory     "${prefix}"\n"
fi
CONFIG_SUMMARY+="  Shared libraries           "${enable_shared}"\n"
CONFIG_SUMMARY+="  Static libraries           "${enable_static}"\n"
CONFIG_SUMMARY+="  Debug flag                 "$ENABLE_DEBUG_FLAG"\n"
CONFIG_SUMMARY+="  CGAL support               "${ENABLE_CGAL_FLAG}"\n"
AC_PLUGIN_SUMMARY([yes])
CONFIG_SUMMARY+="  Monolithic plugins lib     "$monolithic"\n"
AC_SUBST(CONFIG_SUMMARY)


CONFIGURE_INVOCATION="$0 $ac_configure_args"
AC_SUBST(CONFIGURE_INVOCATION)

dnl-------------------------------------------------------------------
dnl finish with a nice message
dnl-------------------------------------------------------------------
AC_OUTPUT
printf "$CONFIG_SUMMARY"
echo "---------------------------------------------------"
echo "        IMPORTANT NOTICE TO FASTJET USERS          "
echo "                                                   "
echo " When using the FastJet library, you can retrieve  "
echo " compilation and link flags using fastjet-config.  "
echo " Type 'fastjet-config --help' for more information "
echo "---------------------------------------------------"