- use_newio switch removed from libAliHLTTPC, always on; not removed in
[u/mrichter/AliRoot.git] / HLT / configure.ac
1 dnl -*- mode: autoconf -*- 
2 dnl
3 dnl $Id$
4 dnl template for the configuration script for the Alice HLT 
5 dnl framework and components
6 dnl 
7 dnl ------------------------------------------------------------------
8 AC_INIT([Alice High Level Trigger] , [0.5-dev], [Matthias.Richter@ift.uib.no], alice-hlt)
9
10 dnl ------------------------------------------------------------------
11 dnl the package from CVS contains the old Makefiles as well. In order to
12 dnl prevent them from becoming overwritten, we require a separate build
13 dnl directory
14 if test "`dirname $0`" = "." ; then
15    AC_ERROR([please run the script from a separate build directory])
16 fi
17
18 dnl ------------------------------------------------------------------
19 AC_CANONICAL_SYSTEM
20 AC_PREFIX_DEFAULT(${PWD})
21 AC_CONFIG_SRCDIR(BASE/AliHLTComponent.cxx)
22 AM_INIT_AUTOMAKE
23 AC_PROG_CC
24 AC_PROG_CXX
25 AC_PROG_LIBTOOL
26
27 AC_DEBUG
28 AC_OPTIMIZATION
29
30 dnl ------------------------------------------------------------------
31 dnl
32 dnl Check for ROOT
33 dnl
34 ROOT_PATH(, [have_root=1], [AC_ERROR([Stop! The HLT package needs ROOT.])])
35 AM_CONDITIONAL(HAVE_ROOT, test "x$have_root" = "x1" )
36 AC_SUBST([ROOTSYS])
37
38 dnl ------------------------------------------------------------------
39 # TODO: make this configurable through arguments
40 #Define whether you want to run with ALIROOT or only ROOT
41 AH_TEMPLATE([ALIHLT_USEPACKAGE],[running environment])
42 ALIHLT_USEPACKAGE=ALIROOT
43 #ALIHLT_USEPACKAGE=ROOT
44 #ALIHLT_USEPACKAGE=STANDALONE
45 AC_DEFINE(use_aliroot)
46 AC_DEFINE(use_root)
47 CPPFLAGS="$CPPFLAGS ${ROOTCFLAGS}"
48
49 dnl ------------------------------------------------------------------
50 dnl check for AliRoot features
51 AC_LANG_PUSH(C++)
52 have_aliroot=no
53 AC_ARG_WITH(aliroot,[  --with-aliroot   top of the AliRoot installation],
54                     [test -d $with_aliroot && ALICE_ROOT=$with_aliroot],
55                     [])
56
57 if test "x$ALICE_ROOT" != "x" && test -d $ALICE_ROOT ; then
58   dnl ------------------------------------------------------------------
59   dnl Try to estimate the system architecture
60   case $host_os:$host_cpu in
61   linux*:x86_64*)       alice_target='linuxx8664gcc'            ;;
62   linux*)               alice_target='linux'                    ;;
63   *)                    alice_target='unknown'                  ;;
64   esac
65   if test "x$alice_target" = "xunknown" ; then
66     if test -z $ALICE_TARGET ; then
67     AC_MSG_ERROR([Can not estimate system architecture.
68     To avoid the problem, set the ALICE_TARGET variable appropriately.
69     Please send the following information to Matthias.Richter@ift.uib.no:
70         ${PACKAGE}: no AliRoot target definition for os=$host_os and cpu=$host_cpu ])
71     else
72     AC_MSG_NOTICE([Unknown system architecture.
73     Please send the following information to Matthias.Richter@ift.uib.no:
74         ${PACKAGE}: no AliRoot target definition for os=$host_os and cpu=$host_cpu ])  
75     fi
76   else
77     if test "x$ALICE_TARGET" != "x" && test "x$ALICE_TARGET" != "x$alice_target" ; then
78     AC_MSG_WARN([The ALICE_TARGET variable does not match your current system
79     overriding $ALICE_TARGET by $alice_target])
80     fi
81     ALICE_TARGET=$alice_target
82   fi
83   ALIROOTLIBDIR=${ALICE_ROOT}/lib/tgt_${ALICE_TARGET}
84   ALIROOTINCDIR=${ALICE_ROOT}/include
85   test -d ${ALIROOTLIBDIR} || AC_MSG_WARN([can not find AliRoot library directory $ALIROOTLIBDIR])
86   test -d ${ALIROOTINCDIR} || AC_MSG_WARN([can not find AliRoot include directory $ALIROOTINCDIR])
87 fi
88
89 AC_MSG_CHECKING([for AliRoot])
90 if test "x$ALICE_ROOT" != "x" \
91    && test -d ${ALIROOTLIBDIR} \
92    && test -d ${ALIROOTINCDIR}; then
93   have_aliroot=$ALICE_ROOT
94 else
95   ALIROOTLIBDIR=
96   ALIROOTINCDIR=
97 fi
98 AC_MSG_RESULT([$have_aliroot])
99
100 if test ! "x$have_aliroot" = "xno" ; then
101   # we check for the libSTEER library which is linked to
102   # - the ROOT libs libGeom libMinuit libVMC libEG
103   # - the AliRoot libESD libRAWData (libRAWDatarec from v4-04-Rev-07)
104   # - ROOT libCint needs also libdl
105   # - from Nov 1 2006 TTreeFormula is needed by AliTagAnalysis and requires
106   #   libTreePlayer.so
107   ALIROOT_CPPFLAGS="-I${ALIROOTINCDIR} -I${ALICE_ROOT}/RAW"
108   ALIROOT_LDFLAGS="-L${ALIROOTLIBDIR}"
109   ALIROOT_LIBS="-lESD -lGeom -lMinuit -lVMC -lEG -ldl -lTreePlayer"
110   save_CPPFLAGS=$CPPFLAGS
111   save_LDFLAGS=$LDFLAGS
112   save_LIBS=$LIBS
113   CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS"
114   LDFLAGS="$save_LDFLAGS -L${ROOTLIBDIR} $ALIROOT_LDFLAGS"
115   
116   # check for certain AliRoot libraries/files/features
117   # CBD library is present since AliRoot version v4-05-00 (02.06.2006)
118   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
119   CHECKLIB=CDB
120   AC_CHECK_LIB([$CHECKLIB],[_init],[ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"])
121
122   # splitted RAW libraries since AliRoot version v4-04-Rev-07 (09.08.2006)
123   have_alirawdata=no
124   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
125   CHECKLIB=RAWDatabase
126   AC_CHECK_LIB([$CHECKLIB],[_init],
127         [ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"
128          LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
129          CHECKLIB=RAWDatarec
130          AC_CHECK_LIB([$CHECKLIB],[_init],
131                [ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"
132                 AC_DEFINE(HAVE_ALIRAWDATA)
133                 have_alirawdata=$CHECKLIB])],
134         [# second pass with -RAWData
135          CHECKLIB="-lRAWData"
136          LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS $CHECKLIB -lSTEER"
137          AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliRawReaderMemory.h>
138                                        #include <AliRawReaderFile.h>
139                                        #include <AliRawReaderDate.h>
140                                        #include <AliRawReaderRoot.h>], 
141                                      [AliRawReaderMemory mreader;
142                                        AliRawReaderFile freader;
143                                        AliRawReaderDate dreader(NULL,0);
144                                        AliRawReaderRoot rreader(NULL,0);])],
145                                      [AC_DEFINE(HAVE_ALIRAWDATA)
146                                        ALIROOT_LIBS="$ALIROOT_LIBS $CHECKLIB"
147                                        have_alirawdata=$CHECKLIB], 
148                                       [have_alirawdata=no])
149         ]) dnl AC_CHECK_LIB RAWDatabase
150   AC_MSG_CHECKING(for AliRawReader classes in RAWData libraries)
151   AC_MSG_RESULT($have_alirawdata)
152
153   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
154   CHECKLIB=STEER
155   AC_CHECK_LIB([$CHECKLIB],[_init],[ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"])
156
157   if test ! "x$have_aliroot" = "xno" ; then
158     # the HLTTPCLib needs to link agains TPCbase and TPCrec
159     # TPC library for AliTPCParam and AliSimDigits used in 
160     # AliHLTTPCFileHandler.h and AliHLTTPCDisplay.cxx
161     saveALIROOT_CPPFLAGS="$ALIROOT_CPPFLAGS"
162     ALIROOT_CPPFLAGS="$saveALIROOT_CPPFLAGS -I${ALICE_ROOT}/TPC"
163     CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS"
164     have_alitpc=yes
165     AC_MSG_CHECKING(for required classes in TPC libraries)
166     if test ! "x$have_alitpc" = "xno" ; then
167       save_ALIROOT_LIBS=$ALIROOT_LIBS
168       ALIROOT_LIBS="$save_ALIROOT_LIBS -lTPCbase -lTPCrec"
169       LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
170       AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliSimDigits.h>
171                                        #include <AliTPCParam.h>
172                                        #include <AliTPCParamSR.h>
173                                        #include <AliTPCDigitsArray.h>
174                                        #include <AliTPCClustersArray.h>
175                                        #include <AliTPCcluster.h>     
176                                        #include <AliTPCClustersRow.h>], 
177                                       [AliSimDigits dig;
178                                        AliTPCParam param;
179                                        AliTPCParamSR paramsr;
180                                        AliTPCDigitsArray digarray;
181                                        AliTPCClustersArray clustarray;
182                                        AliTPCcluster clust;
183                                        AliTPCClustersRow row])],
184                                       [AC_DEFINE(HAVE_ALITPC)
185                                        saveALIROOT_CPPFLAGS=$ALIROOT_CPPFLAGS
186                                        saveALIROOT_LIBS=$ALIROOT_LIBS], 
187                                       [have_alitpc=no
188                                        ALIROOT_CPPFLAGS=$saveALIROOT_CPPFLAGS
189                                        ALIROOT_LIBS=$saveALIROOT_LIBS])
190     fi
191     AC_MSG_RESULT($have_alitpc)
192   fi
193
194   if test ! "x$have_alirawdata" = "xno" ; then
195     # check for header files needed by the TPCLib/AliHLTTPCDigitReaderPacket
196     # the header file has been moved to the TPC module
197     CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS"
198     # AliRawReaderMemory.h AliRawReaderFile.h already checked
199     #AC_CHECK_HEADERS([AliRawReaderMemory.h AliRawReaderFile.h AliTPCRawStream.h])
200     AC_CHECK_HEADERS([AliTPCRawStream.h])
201   fi
202
203   have_tpc_mapping=no
204   if test ! "x$have_aliroot" = "xno" ; then
205     # the TPCLib/AliHLTTPCRawReader needs the actual Pad layot of the TPC 
206     # which is stored in the TPC/mapping/Patchx.data files from
207     # AliRoot version v4-04-Release (May 2006)
208     AH_TEMPLATE([HAVE_TPC_MAPPING],[TPC pad mapping available])
209     TPC_PAD_MAPPING_PATH=$have_aliroot/TPC/mapping
210     AC_CHECK_FILE( [$TPC_PAD_MAPPING_PATH/Patch0.data], 
211                    [have_tpc_mapping=yes
212                     AC_SUBST(TPC_PAD_MAPPING_PATH)
213                     AC_DEFINE(HAVE_TPC_MAPPING)],
214                    [])
215     
216   fi
217   AC_MSG_CHECKING([for TPC mapping layout])
218   AM_CONDITIONAL(USE_TPC_MAPPING, test x$have_tpc_mapping = xyes)
219   AC_MSG_RESULT([$have_tpc_mapping])
220   
221   if test "x$have_aliroot" = "xno" ; then
222     ALIROOT_CPPFLAGS=
223     ALIROOT_LDFLAGS=
224     ALIROOT_LIBS=
225   fi
226   CPPFLAGS=$save_CPPFLAGS
227   LDFLAGS=$save_LDFLAGS
228   LIBS=$save_LIBS
229 fi
230 AC_LANG_POP(C++)
231 AC_SUBST([ALIROOT_CPPFLAGS])
232 AC_SUBST([ALIROOT_LDFLAGS])
233 AC_SUBST([ALIROOTLIBDIR])
234 AC_SUBST([ALIROOT_LIBS])
235
236 HLTBASE_CPPFLAGS='-I${top_srcdir}/BASE'
237 HLTBASE_LDFLAGS=
238 AC_SUBST([HLTBASE_CPPFLAGS])
239 AC_SUBST([HLTBASE_LDFLAGS])
240
241 dnl ------------------------------------------------------------------
242 dnl check for the HLT PubSub Framework
243 AC_MSG_CHECKING([for HLT PubSub Framework])
244 AC_ARG_WITH(pubsub, [installation path of the HLT PubSub framework],
245                     [],
246                     [ test -n $ALIHLT_DC_DIR && with_pubsub=$ALIHLT_DC_DIR ])
247 if test -z $with_pubsub || ! test -d $with_pubsub ; then
248   with_pubsub=no
249 fi
250 AC_MSG_RESULT([$with_pubsub])
251 HOMER_VERSION=1
252 HOMER_LIBS=
253
254 AH_TEMPLATE([HAVE_HOMERREADER],[the HLT PubSub Homer Reader interface])
255 if test "x$with_pubsub" != "xno" ; then
256   save_CPPFLAGS=$CPPFLAGS
257   save_LDFLAGS=$LDFLAGS
258   save_LIBS=$LIBS
259   # currently the different versions of the HLT PubSub framework have a different
260   # directory layout
261   if test -d ${with_pubsub}/include/HOMER ; then
262     # the 'early' location of the include files with separated HOMER sub dirs
263     HOMER_CPPFLAGS="-I${with_pubsub}/include/HOMER -I${with_pubsub}/include/HOMER/reader"
264   elif test -d ${with_pubsub}/include/Util/HOMER ; then
265     # location for HLT Framework versions after Sep 2006
266     HOMER_CPPFLAGS="-I${with_pubsub}/include/Util/HOMER"
267   elif test -d ${with_pubsub}/src/Util/HOMER/include ; then
268     # fall back if include files were not installed (versions after Sep 06)
269     HOMER_CPPFLAGS="-I${with_pubsub}/src/Util/HOMER/include"
270   else
271     # fall back if include files were not installed (versions before Sep 06)
272     HOMER_CPPFLAGS="-I${with_pubsub}/src/Util/HOMER/reader/include -I${with_pubsub}/src/Util/HOMER/data/include"
273   fi
274   HOMER_BINDIR="${with_pubsub}/bin/`uname -s`-`uname -m`"
275   HOMER_LIBDIR="${with_pubsub}/lib/`uname -s`-`uname -m`"
276   HOMER_LDFLAGS="-L${HOMER_LIBDIR}"
277   CPPFLAGS="$save_CPPFLAGS $HOMER_CPPFLAGS"
278   LDFLAGS="$save_LDFLAGS $HOMER_LDFLAGS"
279   LIBS="$save_LIBS "
280   with_homer=no
281   AC_LANG_PUSH(C++)
282   AC_CHECK_HEADER([HOMERReader.h],
283     [ AC_CHECK_LIB([HOMER],[_init],
284       [with_homer=yes
285        HOMER_LIBS="-lHOMER"],
286       [ AC_CHECK_LIB([HOMERReader],[_init],
287                      [with_homer=yes
288                       HOMER_LIBS="-lHOMERReader"])])
289       LIBS="$LIBS $HOMER_LIBS"
290       AC_MSG_CHECKING([for HOMER version])
291       dnl The Homer library has no versioning, so we do our own
292       dnl version           description
293       dnl ----------------------------------------------------------------------
294       dnl   1          inintial version
295       dnl   2          GetBlockStatusFlags added to the interface
296       AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <HOMERReader.h>],
297                                       [HOMERReader reader("dummy", 0);
298                                        reader.GetBlockStatusFlags(0);])],
299                                       [if test $HOMER_VERSION -lt 2 ; then HOMER_VERSION=2; fi],
300                                       [])
301       AC_MSG_RESULT([$HOMER_VERSION])
302   ]) #AC_CHECK_HEADER([HOMERReader.h])
303   AC_LANG_POP(C++)
304   if test "x$with_homer" = "xno" ; then
305     HOMER_CPPFLAGS=
306     HOMER_LDFLAGS=
307     HOMER_LIBS=
308   else
309     HOMER_CPPFLAGS="$HOMER_CPPFLAGS -DHOMER_VERSION=$HOMER_VERSION"
310     AC_DEFINE(HAVE_HOMERREADER)
311   fi
312   CPPFLAGS="$save_CPPFLAGS"
313   LDFLAGS="$save_LDFLAGS"
314   LIBS="$save_LIBS"  
315 fi
316 AC_SUBST([HOMER_CPPFLAGS])
317 AC_SUBST([HOMER_LDFLAGS])
318 AC_SUBST([HOMER_LIBDIR])
319 AC_SUBST([HOMER_BINDIR])
320 AC_SUBST([HOMER_LIBS])
321
322 dnl ------------------------------------------------------------------
323 AC_MSG_CHECKING([whether to impose strict coding conventions])
324 AC_ARG_ENABLE(strict,
325   [AC_HELP_STRING([--enable-strict],
326       [enable coding convention checks ])],
327   [],[enable_strict=no])
328 if test "x$enable_strict" = "xyes" ; then
329    CPPFLAGS="$CPPFLAGS -Weffc++"
330 fi
331 AC_MSG_RESULT([$enable_strict])
332
333 dnl ------------------------------------------------------------------
334 AC_MSG_CHECKING([whether to compile sample library])
335 AH_TEMPLATE([HLT_SAMPLE],[hlt sample library])
336 AC_ARG_ENABLE(sample,
337   [AC_HELP_STRING([--enable-sample],
338       [compile the sample library ])],
339   [],[enable_sample=yes])
340 if test "x$enable_sample" = "xyes" ; then 
341   AC_DEFINE(HLT_SAMPLE)
342 fi
343 AM_CONDITIONAL(EN_HLT_SAMPLE, test x$enable_sample = xyes)
344 AC_MSG_RESULT([$enable_sample])
345
346 dnl ------------------------------------------------------------------
347 AC_MSG_CHECKING([whether to compile tpc library])
348 AH_TEMPLATE([HLT_TPC],[hlt tpc library])
349 AC_ARG_ENABLE(tpc,
350   [AC_HELP_STRING([--enable-tpc],
351       [compile the tpc library ])],
352   [],[enable_tpc=yes])
353 if test "x$have_aliroot" = "xno" ; then
354    enable_tpc="no...requires.AliRoot"
355 elif test "x$have_alitpc" = "xno" ; then
356    enable_tpc="no...requires.AliRoot.TPC.libraries"
357 fi
358 if test "x$enable_tpc" = "xyes" ; then 
359   AC_DEFINE(HLT_TPC)
360 fi
361 AM_CONDITIONAL(EN_HLT_TPC, test x$enable_tpc = xyes)
362 AC_MSG_RESULT([$enable_tpc])
363
364 dnl ------------------------------------------------------------------
365 AC_MSG_CHECKING([whether to compile phos library])
366 AH_TEMPLATE([HLT_PHOS],[hlt phos library])
367 AC_ARG_ENABLE(phos,
368   [AC_HELP_STRING([--enable-phos],
369       [compile the phos library ])],
370   [],[enable_phos=yes])
371 if test "x$have_aliroot" = "xno" ; then
372    enable_phos="no...requires.AliRoot"
373 fi
374 if test "x$enable_phos" = "xyes" ; then 
375   AC_DEFINE(HLT_PHOS)
376 fi
377 AM_CONDITIONAL(EN_HLT_PHOS, test x$enable_phos = xyes)
378 AC_MSG_RESULT([$enable_phos])
379
380 dnl ------------------------------------------------------------------
381 AC_MSG_CHECKING([whether to enable HLT logging])
382 AH_TEMPLATE([NOLOGGING],[disable hlt logging])
383 AC_ARG_ENABLE(logging,
384   [AC_HELP_STRING([--enable-logging],
385       [enable logging])],
386   [],[enable_logging=yes])
387 if test "x$enable_logging" != "xyes" ; then 
388   AC_DEFINE(NOLOGGING)
389 fi
390 AC_MSG_RESULT([$enable_logging])
391
392 dnl ------------------------------------------------------------------
393 AC_MSG_CHECKING([whether to enable saving MC data through the chain])
394 AH_TEMPLATE([DOMC],[MC saving])
395 AC_ARG_ENABLE(mc-saving,
396   [AC_HELP_STRING([--enable-mc-saving],
397       [enable saving MC data through the chain])],
398   [],[enable_mc_saving=no])
399 if test "x$enable_mc_saving" = "xyes" ; then 
400   AC_DEFINE(DOMC)
401 fi
402 AC_MSG_RESULT([$enable_mc_saving])
403
404 dnl ------------------------------------------------------------------
405 dnl certainly something old, but we keep the define
406 AC_MSG_CHECKING([whether to use ROWHOUGH])
407 AH_TEMPLATE([USEROWHOUGH],[HLT ROWHOUGH])
408 AC_ARG_ENABLE(rowhough,
409   [AC_HELP_STRING([--enable-rowhough],
410       [use ROWHOUGH ])],
411   [],[enable_rowhough=no])
412 if test "x$enable_rowhough" = "xyes" ; then 
413   AC_DEFINE(USEROWHOUGH)
414 fi
415 AC_MSG_RESULT([$enable_rowhough])
416
417 dnl ------------------------------------------------------------------
418 dnl The ROOTVERSION and ALIROOTVERSION defines were used by the old
419 dnl stand-alone build system. This is most likely something old we can
420 dnl get rid off later, or do something more reasonable. Since the define
421 dnl needs the quotes they have to be  escaped. This works well for the
422 dnl Makefile but not for the configure script. So we have to add the
423 dnl defines after all the other checks.
424 CPPFLAGS="$CPPFLAGS -DROOTVERSION=\\\"`${ROOTCONF} --version`\\\""
425 if test ! "x$have_aliroot" = "xno" ; then
426   CPPFLAGS="$CPPFLAGS -DALIROOTVERSION=\\\"Unknown\\\""
427 fi
428
429 dnl ------------------------------------------------------------------
430 dnl
431 dnl Documentation
432 dnl
433 AC_ARG_VAR(DOXYGEN, The Documentation Generator)
434 AC_PATH_PROG(PERL, perl)
435 AC_PATH_PROG(DOXYGEN, doxygen)
436 AM_CONDITIONAL(HAVE_DOXYGEN, test ! "x$DOXYGEN" = "x")
437 HAVE_DOT=NO
438 DOT_PATH=
439 AC_PATH_PROG(DOT, dot)
440 if ! test "x$DOT" = "x" ; then
441    HAVE_DOT=YES
442    DOT_PATH=`dirname $DOT`
443 fi
444 AC_SUBST([HAVE_DOT])
445 AC_SUBST([DOT_PATH])
446
447 dnl ------------------------------------------------------------------
448 dnl inatallation directory for libraries
449 dnl 
450 if test "x$prefix" != "xNONE" && test $ALICE_ROOT = $prefix ; then
451 libdir=\${exec_prefix}/lib/tgt_$ALICE_TARGET
452 AC_MSG_NOTICE([libdir set to $libdir])
453 fi
454 dnl ------------------------------------------------------------------
455 AC_CONFIG_FILES([Makefile 
456                  BASE/Makefile
457                  BASE/setenv.sh
458                  BASE/setenv.csh
459                  SampleLib/Makefile
460                  TPCLib/Makefile
461                  TPCLib/mapping2array.cxx
462                  TPCLib/OnlineDisplay/Makefile
463                  PHOS/Makefile
464                  doc/Makefile
465                  doc/doxygen.conf])
466
467
468 AC_OUTPUT
469 dnl
470 dnl EOF
471 dnl
472