8db7e2d699de20f2684f2f3325837dced90676ed
[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
9 dnl Take either the AliRoot tag as version id or the current revision
10 AC_INIT([Alice High Level Trigger] , 
11         m4_esyscmd([url=`svn info 2> /dev/null | grep "URL:" | cut -d: -f3 | sed -e 's|[/]*HLT[/]*$||' | sed -e 's|^[/]*||g' | cut -d '/' -f 4`; \
12                     revision=`svn info 2> /dev/null | grep "Revision:" | cut -d ' ' -f 2 | cut -d '/' -f 4`; \
13                     if test "x$url" != "x"; then echo -n $url; \
14                     elif test "x$revision" != "x"; then echo -n $revision ; \
15                     elif test -e .revision && test x`cat .revision` != x; then \
16                        cat .revision; \
17                     else \
18                        echo -n invalid-version; \
19                     fi]),
20         [Matthias.Richter@ift.uib.no], 
21         [alice-hlt])
22
23 dnl ------------------------------------------------------------------
24 dnl the package from CVS contains the old Makefiles as well. In order to
25 dnl prevent them from becoming overwritten, we require a separate build
26 dnl directory
27 if test "`dirname $0`" = "." ; then
28    AC_ERROR([please run the script from a separate build directory])
29 fi
30
31 dnl ------------------------------------------------------------------
32 AC_CANONICAL_SYSTEM
33 AC_PREFIX_DEFAULT(${PWD})
34 AC_CONFIG_SRCDIR(BASE/AliHLTComponent.cxx)
35 AM_INIT_AUTOMAKE
36 AC_PROG_CC
37 AC_PROG_CXX
38 AC_PROG_LIBTOOL
39
40 AC_DEBUG
41 AC_OPTIMIZATION
42 AM_CONDITIONAL(STANDALONE_SAMPLELIB, test 0 )
43
44 dnl ------------------------------------------------------------------
45 dnl A warning posted into the auto-generated files
46 dnl Does NOT concern this file ;-)
47 AUTOGENERATED_WARNING="!!!!!!!    DO NOT EDIT THIS FILE !!!!!!"
48 AC_SUBST([AUTOGENERATED_WARNING])
49
50 dnl ------------------------------------------------------------------
51 dnl
52 dnl Check for ROOT
53 dnl
54 ROOT_PATH(, [have_root=1], [AC_ERROR([Stop! The HLT package needs ROOT.])])
55 AM_CONDITIONAL(HAVE_ROOT, test "x$have_root" = "x1" )
56 AC_SUBST([ROOTSYS])
57 ROOTBINDIR=`dirname $ROOTEXEC`
58 AC_SUBST([ROOTBINDIR])
59
60 dnl test for additional required root libraries and headers
61 LIBS='-ldl'
62 if test "x$have_root" = "x1"; then
63   AC_LANG_PUSH(C++)
64   save_CPPFLAGS=$CPPFLAGS
65   save_LDFLAGS=$LDFLAGS
66   save_LIBS=$LIBS
67   CPPFLAGS=`echo $save_CPPFLAGS; for i in ${ROOTINCDIR}; do echo -n "-I$i " ; done`
68   
69   # we check for the libSTEER library which is linked to
70   # - the ROOT libs libGeom libMinuit libVMC libEG
71   # - the AliRoot libESD libRAWData (libRAWDatarec from v4-04-Rev-07)
72   # - ROOT libCint needs also libdl
73   # - from Nov 1 2006 TTreeFormula is needed by AliTagAnalysis and requires
74   #   libTreePlayer.so
75   # - from Jan 07 libESD also depends on libXMLIO
76   # - libSTEER depends on libProofPlayer since Oct 2007 (after v4-07-Release)
77   ROOT_CHECKLIBS='Geom Minuit EG VMC TreePlayer XMLIO Thread Proof ProofPlayer'
78   for CHECKLIB in $ROOT_CHECKLIBS ; do
79     LDFLAGS="$save_LDFLAGS -L${ROOTLIBDIR}"
80     LIBS="$save_LIBS $ROOTLIBS $ADD_ROOTLIBS"
81     AC_CHECK_LIB([$CHECKLIB],[_init], [ADD_ROOTLIBS="$ADD_ROOTLIBS -l$CHECKLIB"])
82   done
83
84   # TBuffer.h has been made pure virtual in root v5-15-02 and one
85   # has to derive from TBufferFile.h (needed for BASE/AliHLTMessage.h)
86   AC_CHECK_HEADER([TBufferFile.h], [], [HAVE_NOT_TBUFFERFILE])
87
88   # TView.h has been made pure virtual right after root v5-15-02 and one
89   # has to derive from TView3D.h (needed for TPCLib/OnlineDisplay/AliHLTTPCDisplay3D)
90   AC_CHECK_HEADER([TView3D.h], [], [HAVE_NOT_TVIEW3D])
91
92   CPPFLAGS=$save_CPPFLAGS
93   LDFLAGS=$save_LDFLAGS
94   LIBS=$save_LIBS
95   AC_LANG_POP(C++)
96 fi
97
98 dnl ------------------------------------------------------------------
99 # TODO: make this configurable through arguments
100 #Define whether you want to run with ALIROOT or only ROOT
101 AH_TEMPLATE([ALIHLT_USEPACKAGE],[running environment])
102 ALIHLT_USEPACKAGE=ALIROOT
103 #ALIHLT_USEPACKAGE=ROOT
104 #ALIHLT_USEPACKAGE=STANDALONE
105 AC_DEFINE(use_aliroot)
106 AC_DEFINE(use_root)
107 CPPFLAGS="$CPPFLAGS ${ROOTCFLAGS}"
108 save_CPPFLAGS=$CPPFLAGS
109 save_LDFLAGS=$LDFLAGS
110 save_LIBS=$LIBS
111
112 dnl ------------------------------------------------------------------
113 dnl check for AliRoot features
114 AC_LANG_PUSH(C++)
115 have_aliroot=no
116 AC_ARG_WITH(aliroot,[  --with-aliroot   top of the AliRoot installation],
117                     [test -d $with_aliroot && ALICE_ROOT=$with_aliroot],
118                     [])
119
120 if test "x$ALICE_ROOT" != "x" && test -d $ALICE_ROOT ; then
121   dnl ------------------------------------------------------------------
122   dnl Try to estimate the system architecture
123   case $host_os:$host_cpu in
124   linux*:x86_64*)       alice_target='linuxx8664gcc'            ;;
125   linux*)               alice_target='linux'                    ;;
126   *)                    alice_target='unknown'                  ;;
127   esac
128   if test "x$alice_target" = "xunknown" ; then
129     if test -z $ALICE_TARGET ; then
130     AC_MSG_ERROR([Can not estimate system architecture.
131     To avoid the problem, set the ALICE_TARGET variable appropriately.
132     Please send the following information to Matthias.Richter@ift.uib.no:
133         ${PACKAGE}: no AliRoot target definition for os=$host_os and cpu=$host_cpu ])
134     else
135     AC_MSG_NOTICE([Unknown system architecture.
136     Please send the following information to Matthias.Richter@ift.uib.no:
137         ${PACKAGE}: no AliRoot target definition for os=$host_os and cpu=$host_cpu ])  
138     fi
139   else
140     if test "x$ALICE_TARGET" != "x" && test "x$ALICE_TARGET" != "x$alice_target" ; then
141     AC_MSG_WARN([The ALICE_TARGET variable does not match your current system
142     overriding $ALICE_TARGET by $alice_target])
143     fi
144     ALICE_TARGET=$alice_target
145   fi
146   ALIROOTBINDIR=${ALICE_ROOT}/bin/tgt_${ALICE_TARGET}
147   ALIROOTLIBDIR=${ALICE_ROOT}/lib/tgt_${ALICE_TARGET}
148   ALIROOTINCDIR=${ALICE_ROOT}/include
149   test -d ${ALIROOTBINDIR} || AC_MSG_WARN([can not find AliRoot binary directory $ALIROOTBINDIR])
150   test -d ${ALIROOTLIBDIR} || AC_MSG_WARN([can not find AliRoot library directory $ALIROOTLIBDIR])
151   test -d ${ALIROOTINCDIR} || AC_MSG_WARN([can not find AliRoot include directory $ALIROOTINCDIR])
152 fi
153
154 AC_MSG_CHECKING([for AliRoot])
155 if test "x$ALICE_ROOT" != "x" \
156    && test -d ${ALIROOTBINDIR} \
157    && test -d ${ALIROOTLIBDIR} \
158    && test -d ${ALIROOTINCDIR}; then
159   have_aliroot=$ALICE_ROOT
160 else
161   ALIROOTBINDIR=
162   ALIROOTLIBDIR=
163   ALIROOTINCDIR=
164 fi
165 AC_MSG_RESULT([$have_aliroot])
166
167 if test ! "x$have_aliroot" = "xno" ; then
168   ALIROOT_CPPFLAGS="-I${ALIROOTINCDIR} -I${ALICE_ROOT}/RAW"
169   ALIROOT_LDFLAGS="-L${ALIROOTLIBDIR}"
170   ALIROOT_LIBS="-lESD $ADD_ROOTLIBS"
171   save_CPPFLAGS=$CPPFLAGS
172   save_LDFLAGS=$LDFLAGS
173   save_LIBS=$LIBS
174   CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS"
175   LDFLAGS="$save_LDFLAGS -L${ROOTLIBDIR} $ALIROOT_LDFLAGS"
176   
177   # check for certain AliRoot libraries/files/features
178   # libSTEERBase present since Aug 7 2007
179   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
180   CHECKLIB=STEERBase
181   AC_CHECK_LIB([$CHECKLIB],[_init],[ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"])
182
183   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
184   CHECKLIB=AOD
185   AC_CHECK_LIB([$CHECKLIB],[_init],[ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"])
186
187   # splitted RAW libraries since AliRoot version v4-04-Rev-07 (09.08.2006)
188   have_alirawdata=no
189   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
190   CHECKLIB=RAWDatabase
191   AC_CHECK_LIB([$CHECKLIB],[_init],
192         [ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"
193          LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
194          CHECKLIB=RAWDatarec
195          AC_CHECK_LIB([$CHECKLIB],[_init],
196                [ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"
197                 have_alirawdata=$CHECKLIB])],
198         [# second pass with -RAWData
199          CHECKLIB="-lRAWData"
200          LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS $CHECKLIB -lSTEER"
201          AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliRawReaderMemory.h>
202                                        #include <AliRawReaderFile.h>
203                                        #include <AliRawReaderDate.h>
204                                        #include <AliRawReaderRoot.h>], 
205                                      [AliRawReaderMemory mreader;
206                                        AliRawReaderFile freader;
207                                        AliRawReaderDate dreader(NULL,0);
208                                        AliRawReaderRoot rreader(NULL,0);])],
209                                      [ALIROOT_LIBS="$ALIROOT_LIBS $CHECKLIB"
210                                        have_alirawdata=$CHECKLIB], 
211                                       [have_alirawdata=no])
212         ]) dnl AC_CHECK_LIB RAWDatabase
213   AC_MSG_CHECKING([for AliRawReader classes in RAWData libraries])
214   AC_MSG_RESULT([$have_alirawdata])
215
216   # CBD library is present since AliRoot version v4-05-00 (02.06.2006)
217   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS -lSTEER"
218   CHECKLIB=CDB
219   AC_CHECK_LIB([$CHECKLIB],[_init],[ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"])
220
221   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
222   CHECKLIB=STEER
223   AC_CHECK_LIB([$CHECKLIB],[_init],[ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"],[have_aliroot=no])
224
225   dnl
226   dnl check whether AliLog supports notification callback
227   dnl
228   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
229   have_alilog_notification=no
230   if test ! "x$have_aliroot" = "xno" ; then
231   AC_MSG_CHECKING([whether AliLog supports notification callback])
232   AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliLog.h>], 
233                                   [AliLog::AliLogNotification fct])],
234                                   [have_alilog_notification=yes], 
235                                   [AC_DEFINE(NO_ALILOG_NOTIFICATION)])
236   AC_MSG_RESULT([$have_alilog_notification])
237   fi
238
239   if test "x$have_aliroot" = "xno" ; then
240     # 2007-08-18 dont reset ALIROOT_CPPFLAGS in order to allow compilation
241     # but library dependencies might not be resolved completely
242     #ALIROOT_CPPFLAGS=
243     AC_MSG_WARN([some of the AliRoot library dependencies are not resolved.
244     This can happen from time to time due to development in AliRoot. You can
245     force compilation of detector libs by --enable-<detector>, but be aware
246     of unresolved references at runtime.])
247     AC_MSG_WARN([       ------------------------------------------ ])
248     AC_MSG_WARN([       Report this to $PACKAGE_BUGREPORT ])
249     AC_MSG_WARN([       please include config.log                  ])
250     AC_MSG_WARN([       ------------------------------------------ ])
251     ALIROOT_LDFLAGS=
252     ALIROOT_LIBS=
253   fi
254
255   dnl
256   dnl ESD supports non-std content
257   dnl
258   have_esd_nonstd=no
259   AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <AliESDEvent.h>
260                                    #include <AliExternalTrackParam.h>
261                                    #include <TTree.h>
262                                    #include <TClonesArray.h>],
263                                   [AliESDEvent esd;
264                                    esd.CreateStdContent();
265                                    TTree* tree=new TTree("esdTree", "Tree with HLT ESD objects");
266                                    TClonesArray* a=new TClonesArray("AliExternalTrackParam");
267                                    a->SetName("SomeObject");
268                                    esd.AddObject(a);
269                                    esd.WriteToTree(tree);
270                                    if (!tree->FindBranch("SomeObject")) return 1;
271                                    return 0;])],
272                  [have_esd_nonstd=yes], 
273                  [AC_DEFINE(HAVE_NOT_ESD_NONSTD)])
274   AC_MSG_CHECKING(whether ESD supports non standard content)
275   AC_MSG_RESULT([$have_esd_nonstd])
276
277   dnl
278   dnl ESD copy function added May 9 2008 rev 25667
279   dnl
280   if test "x$have_esd_nonstd" != "xyes"; then
281   have_esd_copy=no
282   AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliESDEvent.h>],
283                                   [AliESDEvent esd1;
284                                    AliESDEvent esd2;
285                                    esd2=esd1;])],
286                  [have_esd_copy=yes], 
287                  [AC_DEFINE(HAVE_NOT_ESD_COPY)])
288   AC_MSG_CHECKING(for ESD assignment operator)
289   AC_MSG_RESULT([$have_esd_copy])
290   fi
291
292   dnl
293   dnl AliRawReaderMemory support for multiple buffers added
294   dnl revision 26829 Jun 2008
295   dnl
296   CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS -I${ALICE_ROOT}/RAW"
297   have_rawreadermemory_multbuffers=no
298   AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliRawReaderMemory.h>],
299                                   [AliRawReaderMemory rr;
300                                    rr.AddBuffer(NULL, 0, 0);])],
301                  [have_rawreadermemory_multbuffers=yes], 
302                  [AC_DEFINE(HAVE_NOT_ALIRAWREADERMEMORY_ADDBUFFER)])
303   AC_MSG_CHECKING(AliRawReaderMemory support for multiple buffers)
304   AC_MSG_RESULT([$have_rawreadermemory_multbuffers])
305
306   dnl
307   dnl required header files and libraries for modules
308   dnl
309
310   dnl
311   dnl Check for the interface of AliExternalTrackParam which has been changed
312   dnl in revision 1.17 of AliExternalTrackParam.h (AliRoot version v4-05-04
313   dnl or higher)
314   externaltrackparam_version=1
315   AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliExternalTrackParam.h>], 
316                                   [AliExternalTrackParam trackparam;
317                                    Double_t param[[5]]; Double_t covar[[15]];
318                                    trackparam.Set(0., 0., param, covar);])],
319                                   [externaltrackparam_version=2],
320                                   [AC_DEFINE(EXTERNALTRACKPARAM_V1)])
321   AC_MSG_CHECKING(for version of AliExternalTrackParam)
322   AC_MSG_RESULT($externaltrackparam_version)
323
324   CPPFLAGS=$save_CPPFLAGS
325   LDFLAGS=$save_LDFLAGS
326   LIBS=$save_LIBS
327 fi # if test ! "x$have_aliroot" = "xno"
328
329 AC_LANG_POP(C++)
330 AC_SUBST([ALICE_ROOT])
331 AC_SUBST([ALIROOT_CPPFLAGS])
332 AC_SUBST([ALIROOT_LDFLAGS])
333 AC_SUBST([ALIROOTBINDIR])
334 AC_SUBST([ALIROOTLIBDIR])
335 AC_SUBST([ALIROOT_LIBS])
336 AM_CONDITIONAL(USE_TPC_MAPPING, test x$have_tpc_mapping = xyes)
337
338 HLTBASE_CPPFLAGS='-I${top_srcdir}/BASE'
339 HLTBASE_LDFLAGS=
340 AC_SUBST([HLTBASE_CPPFLAGS])
341 AC_SUBST([HLTBASE_LDFLAGS])
342
343 dnl ------------------------------------------------------------------
344 dnl check for the HLT PubSub Framework
345 dnl namely for the existence of the HOMER library
346 dnl from Sep 2007, the HOMER lib has been incorporated into the alice-hlt
347 dnl package. It os though possible to choose an external. library
348 dnl In order to make the origni of the HOMER lib clear, the one in AliRoot
349 dnl got the name libAliHLTHOMER
350 AC_MSG_CHECKING([for HLT PubSub Framework])
351 AC_ARG_WITH(pubsub, [installation path of the HLT PubSub framework],
352                     [],
353                     [ test -n $ALIHLT_DC_DIR && with_pubsub=$ALIHLT_DC_DIR ])
354 if test -z $with_pubsub || ! test -d $with_pubsub ; then
355   with_pubsub=no
356 fi
357 AC_MSG_RESULT([$with_pubsub])
358 HOMER_VERSION=2
359 HOMER_LIBS=
360
361 AH_TEMPLATE([HAVE_HOMERREADER],[the HLT PubSub Homer Reader interface])
362 if test "x$with_pubsub" != "xno" ; then
363   save_CPPFLAGS=$CPPFLAGS
364   save_LDFLAGS=$LDFLAGS
365   save_LIBS=$LIBS
366   # currently the different versions of the HLT PubSub framework have a different
367   # directory layout
368   if test -d ${with_pubsub}/include/HOMER ; then
369     # the 'early' location of the include files with separated HOMER sub dirs
370     HOMER_INCDIRS="${with_pubsub}/include/HOMER ${with_pubsub}/include/HOMER/reader"
371   elif test -d ${with_pubsub}/include/Util/HOMER ; then
372     # location for HLT Framework versions after Sep 2006
373     HOMER_INCDIRS="${with_pubsub}/include/Util/HOMER"
374   elif test -d ${with_pubsub}/src/Util/HOMER/include ; then
375     # fall back if include files were not installed (versions after Sep 06)
376     HOMER_INCDIRS="${with_pubsub}/src/Util/HOMER/include"
377   else
378     # fall back if include files were not installed (versions before Sep 06)
379     HOMER_INCDIRS="${with_pubsub}/src/Util/HOMER/reader/include ${with_pubsub}/src/Util/HOMER/data/include"
380   fi
381   HOMER_CPPFLAGS=`for i in ${HOMER_INCDIRS}; do echo -n "-I$i " ; done`
382
383   AC_ARG_ENABLE(pubsub-debug,
384     [AC_HELP_STRING([--disable-pubsub-debug],
385         [force the production version of the PubSub framework])],
386     [],[enable_pubsub_debug=yes])
387   homer_type="none"
388   HOMER_TARGET="`uname -s`-`uname -m`"
389   AC_MSG_CHECKING([for HLT PubSub Framework release type])
390   if test -d "${with_pubsub}/lib/${HOMER_TARGET}-release" ; then
391     homer_type="production"
392     HOMER_TARGET="${HOMER_TARGET}-release"
393   elif test "x$enable_pubsub_debug" = "xyes" && test -d "${with_pubsub}/lib/${HOMER_TARGET}-debug" ; then
394     homer_type="debug"
395     HOMER_TARGET="${HOMER_TARGET}-debug"
396   fi
397   AC_MSG_RESULT([${homer_type}])
398   HOMERREADER_HEADER=HOMERReader.h
399   HOMER_BINDIR="${with_pubsub}/bin/${HOMER_TARGET}"
400   HOMER_LIBDIR="${with_pubsub}/lib/${HOMER_TARGET}"
401   HOMER_LDFLAGS="-L${HOMER_LIBDIR}"
402   CPPFLAGS="$save_CPPFLAGS $HOMER_CPPFLAGS"
403   LDFLAGS="$save_LDFLAGS $HOMER_LDFLAGS"
404   LIBS="$save_LIBS "
405   with_homer=no
406   AC_LANG_PUSH(C++)
407   AC_CHECK_HEADER([$HOMERREADER_HEADER],
408     [ AC_CHECK_LIB([HOMER],[_init],
409       [with_homer=yes
410        HOMER_LIBS="-lHOMER"],
411       [ AC_CHECK_LIB([HOMERReader],[_init],
412                      [with_homer=yes
413                       HOMER_LIBS="-lHOMERReader"])])
414       LIBS="$LIBS $HOMER_LIBS"
415       AC_MSG_CHECKING([version of HOMER library])
416       dnl The Homer library has no versioning, so we do our own
417       dnl version           description
418       dnl ----------------------------------------------------------------------
419       dnl   1          inintial version
420       dnl   2          GetBlockStatusFlags added to the interface
421       AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <HOMERReader.h>],
422                                       [HOMERReader reader("dummy", 0);
423                                        reader.GetBlockStatusFlags(0);])],
424                                       [],
425                                       [HOMER_VERSION=1])
426       AC_MSG_RESULT([$HOMER_VERSION])
427   ],
428   [HOMERREADER_HEADER=]) #AC_CHECK_HEADER([$HOMERREADER_HEADER])
429   AC_LANG_POP(C++)
430   HOMER_INBUILT_LIB=
431 else
432 dnl no pubsub version defined, check if the HOMER lib is available in AliRoot
433   topdir=`dirname $0`
434   HOMER_CPPFLAGS="-I`(cd $topdir; pwd)`/BASE/HOMER"
435   HOMERREADER_HEADER=AliHLTHOMERReader.h
436   HOMER_INBUILT_LIB=`pwd`/BASE/HOMER/libAliHLTHOMER.la
437   HOMER_BINDIR=
438   HOMER_LIBDIR=
439   HOMER_LDFLAGS=
440 fi
441
442   if test "x$with_homer" = "xno" ; then
443     HOMER_CPPFLAGS=
444     HOMER_LDFLAGS=
445     HOMER_LIBS=
446   else
447     HOMER_CPPFLAGS="$HOMER_CPPFLAGS -DHOMER_VERSION=$HOMER_VERSION"
448     AC_DEFINE(HAVE_HOMERREADER)
449   fi
450   CPPFLAGS="$save_CPPFLAGS"
451   LDFLAGS="$save_LDFLAGS"
452   LIBS="$save_LIBS"  
453
454 AC_SUBST([HOMERREADER_HEADER])
455 AC_SUBST([HOMER_INBUILT_LIB])
456 AC_SUBST([HOMER_CPPFLAGS])
457 AC_SUBST([HOMER_LDFLAGS])
458 AC_SUBST([HOMER_LIBDIR])
459 AC_SUBST([HOMER_BINDIR])
460 AC_SUBST([HOMER_LIBS])
461
462 dnl ------------------------------------------------------------------
463 AC_ARG_ENABLE(all,
464   [AC_HELP_STRING([--disable-all],
465       [disable all detector modules, individual modules can be switched on by --enable-det])],
466   [disable_all=yes],[])
467
468 dnl ------------------------------------------------------------------
469 AC_MSG_CHECKING([whether to impose strict coding conventions])
470 AC_ARG_ENABLE(strict,
471   [AC_HELP_STRING([--disable-strict],
472       [disable coding convention checks ])],
473   [],[enable_strict=yes])
474 if test "x$enable_strict" = "xyes" ; then
475    CPPFLAGS="$CPPFLAGS -W -Weffc++ -Wall -Wshadow"
476 fi
477 AC_MSG_RESULT([$enable_strict])
478
479 dnl ------------------------------------------------------------------
480 AC_MSG_CHECKING([whether to enable component statistics])
481 AC_ARG_ENABLE(component-stat,
482   [AC_HELP_STRING([--enable-component-stat],
483       [enable component statistics ])],
484   [],[enable_component_stat=no])
485 if test "x$enable_component_stat" = "xyes" ; then
486    AC_DEFINE(HLT_COMPONENT_STATISTICS)
487 fi
488 AC_MSG_RESULT([$enable_component_stat])
489
490 dnl ------------------------------------------------------------------
491 dnl ----  module checks
492 dnl ------------------------------------------------------------------
493 save_CPPFLAGS=$CPPFLAGS
494 save_LDFLAGS=$LDFLAGS
495 save_LIBS=$LIBS
496
497 dnl ------------------------------------------------------------------
498 AC_MSG_CHECKING([whether to compile sample library])
499 AH_TEMPLATE([HLT_SAMPLE],[hlt sample library])
500 AC_ARG_ENABLE(sample,
501   [AC_HELP_STRING([--disable-sample],
502       [compile the sample library ])],
503   [],
504   [if test "x$have_aliroot" = "xno" ; then
505      enable_sample="no...requires.AliRoot"
506    else
507      enable_sample=yes
508    fi
509   ])
510
511 if test "x$enable_sample" = "xyes" ; then 
512   AC_DEFINE(HLT_SAMPLE)
513 fi
514 AM_CONDITIONAL(EN_HLT_SAMPLE, test x$enable_sample = xyes)
515 AC_MSG_RESULT([$enable_sample])
516
517 dnl ------------------------------------------------------------------
518 AC_MSG_CHECKING([whether to compile util library])
519 AH_TEMPLATE([HLT_UTIL],[HLT utility library])
520 AC_ARG_ENABLE(util,
521   [AC_HELP_STRING([--disable-util],
522       [compile the util library ])],
523   [],
524   [if test "x$have_aliroot" = "xno" ; then
525      enable_util="no...requires.AliRoot"
526    else
527      enable_util=yes
528    fi
529   ])
530
531 if test "x$enable_util" = "xyes" ; then 
532   AC_DEFINE(HLT_UTIL)
533 fi
534 AM_CONDITIONAL(EN_HLT_UTIL, test x$enable_util = xyes)
535 AC_MSG_RESULT([$enable_util])
536
537 dnl ------------------------------------------------------------------
538 AH_TEMPLATE([HLT_TPC],[hlt tpc library])
539
540 ALITPC_LIBS=
541 CHECK_HLTMODULE([tpc],
542                 [AliTPCRawStream.h], 
543                 [$ALIROOT_CPPFLAGS -I$ALICE_ROOT/TPC],
544                 [Gui ANALYSIS STAT], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS],
545                 [TPCbase TPCrec TPCcalib], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
546                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
547
548 if test "x$enable_module" = "xmissheader"; then
549   enable_module="no...missing.headers"
550   enable_tpc=$enable_module
551 elif test "x$enable_module" = "xforce"; then
552   enable_tpc="yes"
553 else
554   enable_tpc=$enable_module
555 fi
556
557 if test "x$enable_tpc" = "xyes" ; then 
558   AC_LANG_PUSH(C++)
559   AC_DEFINE(HLT_TPC)
560   ALITPC_LIBS=$ALIHLTMODULE_LIBS
561   dnl
562   dnl Check for functionality in the TPC reconstruction required for online
563   dnl processing
564   dnl 
565   have_tpc_hltoffline_rec=no
566   AC_MSG_CHECKING(for on-line features of TPC offline reconstruction)
567     CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS -I${ALICE_ROOT}/TPC"
568     LDFLAGS="$save_LDFLAGS -L${ROOTLIBDIR} $ALIROOT_LDFLAGS"
569     LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS $ALITPC_LIBS"
570     AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliTPCtrackerMI.h>
571                                        #include <AliTPCclustererMI.h>   
572                                        #include <TObjArray.h>], 
573                                     [AliTPCtrackerMI tracker;
574                                        TObjArray* array=NULL;
575                                        tracker.LoadClusters(array);
576                                        AliTPCclustererMI cl(NULL, NULL);
577                                        cl.GetOutputClonesArray();])],
578                                     [have_tpc_hltoffline_rec=yes], 
579                                       [AC_DEFINE(HAVE_NOT_TPCOFFLINE_REC)])
580     LIBS=$save_LIBS
581   AC_MSG_RESULT([$have_tpc_hltoffline_rec])
582
583   AC_CHECK_HEADER([AliTPCCalibPulser.h], [], [AC_DEFINE(HAVE_NOT_ALITPCCALIBPULSER)])
584   AC_CHECK_HEADER([AliTPCCalibPedestal.h], [], [AC_DEFINE(HAVE_NOT_ALITPCCALIBPEDESTAL)])
585
586   have_tpc_mapping=no
587   if test ! "x$have_aliroot" = "xno" ; then
588     # the TPCLib/AliHLTTPCRawReader needs the actual Pad layout of the TPC 
589     # which is stored in the TPC/mapping/Patchx.data files from
590     # AliRoot version v4-04-Release (May 2006)
591     AH_TEMPLATE([HAVE_TPC_MAPPING],[TPC pad mapping available])
592     TPC_PAD_MAPPING_PATH=$have_aliroot/TPC/mapping
593     AC_CHECK_FILE( [$TPC_PAD_MAPPING_PATH/Patch0.data], 
594                    [have_tpc_mapping=yes
595                     AC_SUBST(TPC_PAD_MAPPING_PATH)
596                     AC_DEFINE(HAVE_TPC_MAPPING)],
597                    [])
598     
599   fi
600   AC_MSG_CHECKING([for TPC mapping layout])
601   AC_MSG_RESULT([$have_tpc_mapping])
602   AC_LANG_POP(C++)
603
604 else
605   enable_module=$enable_tpc
606 fi
607 AM_CONDITIONAL(EN_HLT_TPC, test x$enable_tpc = xyes)
608 AC_MSG_CHECKING([whether to compile TPC library])
609 AC_MSG_RESULT([$enable_module])
610 AC_SUBST([ALITPC_LIBS])
611
612 dnl ------------------------------------------------------------------
613 AH_TEMPLATE([HLT_RCU],[hlt rcu library])
614
615 CHECK_HLTMODULE([rcu],
616                 [AliAltroDecoder.h], 
617                 [$ALIROOT_CPPFLAGS -I$ALICE_ROOT/RAW],
618                 [], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS],
619                 [], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
620                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
621
622 if test "x$enable_module" = "xmissheader"; then
623   enable_module="no...missing.headers"
624   enable_rcu=$enable_module
625 elif test "x$enable_module" = "xforce"; then
626   enable_rcu="yes"
627 else
628   AC_LANG_PUSH(C++)
629   CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS"
630   LDFLAGS="$save_LDFLAGS -L${ROOTLIBDIR} $ALIROOT_LDFLAGS"
631   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
632   AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliAltroDecoder.h>], 
633                                   [AliAltroDecoder decoder;
634                                   decoder.CopyBackward(NULL, 0);])],
635                                   [enable_rcu=$enable_module], 
636                                   [enable_module="no...requires.AliRoot>v4-10-Release"
637                                    enable_rcu="no...requires.AliRoot>v4-10-Release"])
638   CPPFLAGS=$save_CPPFLAGS
639   LDFLAGS=$save_LDFLAGS
640   LIBS=$save_LIBS
641   AC_LANG_POP(C++)
642 fi
643
644 if test "x$enable_rcu" = "xyes" ; then 
645   AC_DEFINE(HLT_RCU)
646 else
647   enable_module=$enable_rcu
648 fi
649 AM_CONDITIONAL(EN_HLT_RCU, test x$enable_rcu = xyes)
650 AC_MSG_CHECKING([whether to compile RCU library])
651 AC_MSG_RESULT([$enable_module])
652 AC_SUBST([ALIRCU_LIBS])
653
654 dnl ------------------------------------------------------------------
655 AH_TEMPLATE([HLT_PHOS],[hlt phos library])
656   
657 ALIPHOS_LIBS=
658 CHECK_HLTMODULE([phos],
659                 [], [$ALIROOT_CPPFLAGS],
660                 [RAWDatasim], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS],
661                 [PHOSbase PHOSrec PHOSsim PHOSshuttle], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
662                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
663
664 if test "x$enable_module" = "xmissheader"; then
665   enable_module="no...requires.AliRoot>v4-05-07"
666   enable_phos=$enable_module
667 elif test "x$enable_module" = "xforce"; then
668   enable_phos="yes"
669 else
670   have_alicalorawstream=no
671   if test ! "x$have_aliroot" = "xno" ; then
672     AC_LANG_PUSH(C++)
673     save_CPPFLAGS="$CPPFLAGS"
674     # this can not be used as AliCaloRawStream.h indirectly depends on TString.h
675     #AC_CHECK_HEADERS([AliCaloRawStream.h], [have_alicalorawstream=yes])
676     CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS -I$ALICE_ROOT/PHOS"
677     AC_MSG_CHECKING([for AliCaloRawStream.h usability])
678     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <TString.h>
679                                         #include <AliCaloRawStream.h>], 
680                                        [int i])],
681                                        [AC_DEFINE(HAVE_ALICALORAWSTREAM)
682                                         have_alicalorawstream=yes], 
683                                        [])
684     AC_MSG_RESULT([$have_aliphosrecoparam])
685     AC_MSG_CHECKING([for required EMC functionality in AliPHOSRecoParam.h ])
686     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <AliPHOSRecoParam.h>], 
687                                        [AliPHOSRecoParam param;
688                                         param.GetEMCClusteringThreshold()])],
689                                        [have_aliphosrecoparam=yes], 
690                                        [AC_DEFINE(HAVE_NOT_PHOSRECOPARAMEMC)])
691     AC_MSG_RESULT([$have_alicalorawstream])
692     AC_LANG_POP(C++)
693     CPPFLAGS="$save_CPPFLAGS"
694   fi
695   if test "x$have_alicalorawstream" != "xyes"; then
696     enable_phos="no...requires.AliRoot>v4-05-07"
697   else
698     enable_phos=$enable_module
699   fi
700 fi
701
702 if test "x$enable_phos" = "xyes" ; then 
703   AC_DEFINE(HLT_PHOS)
704   ALIPHOS_LIBS=$ALIHLTMODULE_LIBS
705 else
706   enable_module=$enable_phos
707 fi
708 AM_CONDITIONAL(EN_HLT_PHOS, test x$enable_phos = xyes)
709 AC_MSG_CHECKING([whether to compile PHOS library])
710 AC_MSG_RESULT([$enable_module])
711 AC_SUBST([ALIPHOS_LIBS])
712
713 dnl ------------------------------------------------------------------
714 AH_TEMPLATE([HLT_TRD],[hlt trd library])
715   
716 ALITRD_LIBS=
717 CHECK_HLTMODULE([trd],
718                 [], [],
719                 [MLP XMLParser], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS],
720                 [TRDbase TRDrec TRDsim], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
721                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
722
723 if test "x$enable_module" = "xmissheader"; then
724   enable_module="no...requires.AliRoot>v4-07-Release"
725   enable_trd=$enable_module
726 elif test "x$enable_module" = "xforce"; then
727   enable_trd="yes"
728 else
729   enable_trd=$enable_module
730   if test "x$enable_trd" = "xyes" ; then
731     AC_LANG_PUSH(C++)
732     save_CPPFLAGS="$CPPFLAGS"
733     CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS -I$ALICE_ROOT/TRD"
734     # AliTRDclusterizer::SetRawVersion() requires >v4-07-Release
735     # changed to AliTRDrecoParam::SetSeedingOn() due to revision 26327, Mon Jun 2 2008
736     # changed to AliTRDReconstructor::SetStreamLevel() due to revision 27797, Tue Aug 5 2008
737     # changed to AliTRDReconstructor::SetClusters() according to revision 28069, Mon Aug 18 2008
738     AC_MSG_CHECKING([for required functions in AliTRDReconstructor])
739     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <AliTRDReconstructor.h>], 
740                                        [AliTRDReconstructor r;
741                                        r.SetClusters(0)])],
742                                        [], 
743                                        [enable_trd="no...requires.AliRoot>v4-14-Release"])
744     AC_MSG_RESULT([$enable_trd])       
745     AC_LANG_POP(C++)
746     CPPFLAGS="$save_CPPFLAGS"
747   fi
748 fi
749
750 if test "x$enable_trd" = "xyes" ; then 
751   AC_DEFINE(HLT_TRD)
752   ALITRD_LIBS=$ALIHLTMODULE_LIBS
753 else
754   enable_module=$enable_trd
755 fi
756 AM_CONDITIONAL(EN_HLT_TRD, test x$enable_trd = xyes)
757 AC_MSG_CHECKING([whether to compile TRD library])
758 AC_MSG_RESULT([$enable_module])
759 AC_SUBST([ALITRD_LIBS])
760
761 dnl ------------------------------------------------------------------
762 AH_TEMPLATE([HLT_FMD],[hlt fmd library])
763
764 ALIFMD_LIBS=$ALIHLTMODULE_LIBS
765 CHECK_HLTMODULE([fmd],
766                 [], [],
767                 [], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS],
768                 [FMDbase FMDrec], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS],
769                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
770
771 if test "x$enable_module" = "xmissheader"; then
772   enable_module="no...missing.headers"
773   enable_fmd=$enable_module
774 elif test "x$enable_module" = "xforce"; then
775   enable_fmd="yes"
776 else
777   enable_fmd=$enable_module
778 fi
779
780 if test "x$enable_fmd" = "xyes" ; then
781   AC_DEFINE(HLT_FMD)
782   ALIFMD_LIBS=$ALIHLTMODULE_LIBS
783 else
784   enable_module=$enable_fmd
785 fi
786 AM_CONDITIONAL(EN_HLT_FMD, test x$enable_fmd = xyes)
787 AC_MSG_CHECKING([whether to compile FMD library])
788 AC_MSG_RESULT([$enable_module])
789 AC_SUBST([ALIFMD_LIBS])
790
791 dnl ------------------------------------------------------------------
792 AH_TEMPLATE([HLT_MUON],[hlt dimuon library])
793
794 ALIMUON_LIBS=
795 CHECK_HLTMODULE([dimuon],
796                 [AliMpExMap.h AliMUONTriggerIO.h], 
797                 [$ALIROOT_CPPFLAGS -I$ALICE_ROOT/MUON -I$ALICE_ROOT/MUON/mapping],
798                 [Gui RAWDatasim], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS],
799                 [MUONcore MUONraw MUONbase MUONgeometry MUONmapping MUONcalib MUONsim MUONtrigger MUONevaluation MUONrec], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
800                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
801
802 if test "x$enable_module" = "xmissheader"; then
803   enable_module="no...requires.AliRoot>=v4-08-Release"
804   enable_muon=$enable_module
805 elif test "x$enable_module" = "xforce"; then
806   enable_muon="yes"
807 else
808   enable_muon=$enable_module
809 fi
810
811 if test "x$enable_muon" = "xyes" ; then 
812   AC_DEFINE(HLT_MUON)
813   ALIMUON_LIBS=$ALIHLTMODULE_LIBS
814   AC_LANG_PUSH(C++)
815   dnl
816   dnl Check for functionality GetRawStream AliMUONDigitMaker.h
817   dnl 
818   have_muon_digitmaker_getrawstream=no
819   AC_MSG_CHECKING(for GetRawStream methods of AliMUONDigitMaker)
820     CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS -I${ALICE_ROOT}/MUON"
821     LDFLAGS="$save_LDFLAGS -L${ROOTLIBDIR} $ALIROOT_LDFLAGS"
822     LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS $ALIMUON_LIBS"
823     AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliMUONDigitMaker.h>], 
824                                     [AliMUONDigitMaker dm;
825                                        dm.GetRawStreamTracker();])],
826                                     [have_muon_digitmaker_getrawstream=yes], 
827                                       [AC_DEFINE(HAVE_NOT_MUON_DIGITMAKER_GETRAWSTREAM)])
828     LIBS=$save_LIBS
829   AC_MSG_RESULT([$have_muon_digitmaker_getrawstream])
830
831   AC_LANG_POP(C++)
832 else
833   enable_module=$enable_muon
834 fi
835 AM_CONDITIONAL(EN_HLT_MUON, test x$enable_muon = xyes)
836 AC_MSG_CHECKING([whether to compile MUON library])
837 AC_MSG_RESULT([$enable_module])
838 AC_SUBST([ALIMUON_LIBS])
839
840 dnl ------------------------------------------------------------------
841 AH_TEMPLATE([HLT_TRIGGER],[hlt trigger library])
842
843 ALITRIGGER_LIBS=
844 CHECK_HLTMODULE([trigger],
845                 [], [$ALIROOT_CPPFLAGS],
846                 [], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS],
847                 [], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
848                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
849
850 if test "x$enable_module" = "xmissheader"; then
851   enable_module="no...header.missing"
852   enable_trigger=$enable_module
853 elif test "x$enable_module" = "xforce"; then
854   enable_trigger="yes"
855 else
856   enable_trigger=$enable_module
857 fi
858
859 if test "x$enable_trigger" = "xyes" ; then 
860   AC_DEFINE(HLT_TRIGGER)
861   ALITRIGGER_LIBS=$ALIHLTMODULE_LIBS
862 else
863   enable_module=$enable_trigger
864 fi
865 AM_CONDITIONAL(EN_HLT_TRIGGER, test x$enable_trigger = xyes)
866 AC_MSG_CHECKING([whether to compile Trigger library])
867 AC_MSG_RESULT([$enable_module])
868 AC_SUBST([ALITRIGGER_LIBS])
869
870 dnl ------------------------------------------------------------------
871 AH_TEMPLATE([HLT_ITS],[hlt its library])
872
873 ALIITS_LIBS=
874 CHECK_HLTMODULE([its],
875                 [AliITSCompressRawDataSDD.h], [$ALIROOT_CPPFLAGS -I$ALICE_ROOT/ITS],
876                 [Gui RAWDatasim], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS],
877                 [ITSbase ITSrec], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
878                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
879
880 if test "x$enable_module" = "xmissheader"; then
881   enable_module="no...header.missing"
882   enable_its=$enable_module
883 elif test "x$enable_module" = "xforce"; then
884   enable_its="yes"
885 else
886   enable_its=$enable_module
887   if test "x$enable_its" = "xyes" ; then
888     AC_LANG_PUSH(C++)
889     save_CPPFLAGS="$CPPFLAGS"
890     CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS -I$ALICE_ROOT/ITS"
891     # changes in the AliVertexer base class revision 26414, Thu Jun 5 15:36:18 2008
892     # require AliVertexer::GetNominalPos()
893     AC_MSG_CHECKING([for required functions in AliITSVertexer])
894     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <AliITSVertexerZ.h>], 
895                                        [AliITSVertexerZ v;
896                                        v.GetNominalPos()])],
897                                        [], 
898                                        [enable_its="no...requires.AliRoot>v4-13-Release"])
899     AC_MSG_RESULT([$enable_its])       
900     AC_LANG_POP(C++)
901     CPPFLAGS="$save_CPPFLAGS"
902   fi
903 fi
904
905 if test "x$enable_its" = "xyes" ; then 
906   AC_DEFINE(HLT_ITS)
907   ALIITS_LIBS=$ALIHLTMODULE_LIBS
908 else
909   enable_module=$enable_its
910 fi
911 AM_CONDITIONAL(EN_HLT_ITS, test x$enable_its = xyes)
912 AC_MSG_CHECKING([whether to compile ITS library])
913 AC_MSG_RESULT([$enable_module])
914 AC_SUBST([ALIITS_LIBS])
915
916 dnl ------------------------------------------------------------------
917 AH_TEMPLATE([HLT_COMP],[hlt comp library])
918
919 ALICOMP_LIBS=
920 CHECK_HLTMODULE([comp],
921                 [], [$ALIROOT_CPPFLAGS],
922                 [], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS],
923                 [], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
924                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
925
926 if test "x$enable_module" = "xmissheader"; then
927   enable_module="no...header.missing"
928   enable_comp=$enable_module
929 elif test "x$enable_module" = "xforce"; then
930   enable_comp="yes"
931 else
932   enable_comp=$enable_module
933 fi
934
935 if test "x$enable_comp" = "xyes" ; then 
936   AC_DEFINE(HLT_COMP)
937   ALICOMP_LIBS=$ALIHLTMODULE_LIBS
938 else
939   enable_module=$enable_comp
940 fi
941 AM_CONDITIONAL(EN_HLT_COMP, test x$enable_comp = xyes)
942 AC_MSG_CHECKING([whether to compile comp library])
943 AC_MSG_RESULT([$enable_module])
944 AC_SUBST([ALICOMP_LIBS])
945
946 dnl ------------------------------------------------------------------
947 AC_MSG_CHECKING([whether to disable AliRoot logging])
948 AH_TEMPLATE([NOALIROOT_LOGGING],[disable AliRoot logging])
949 AC_ARG_ENABLE(aliroot-logging,
950   [AC_HELP_STRING([--disable-aliroot-logging],
951       [disable logging through AliRoot logging methods])],
952   [],[enable_aliroot_logging=no])
953 if test "x$have_aliroot" = "xno" ; then
954   enable_aliroot_logging=yes # this means 'disable'
955 fi
956 if test "x$enable_aliroot_logging" != "xno" ; then 
957   AC_DEFINE(NOALIROOT_LOGGING)
958 fi
959 AM_CONDITIONAL(NOALIROOT_LOGGING, test x$enable_aliroot_logging != no)
960 AC_MSG_RESULT([$enable_aliroot_logging])
961
962 dnl ------------------------------------------------------------------
963 AC_MSG_CHECKING([whether to enable saving MC data through the chain])
964 AH_TEMPLATE([DOMC],[MC saving])
965 AC_ARG_ENABLE(mc-saving,
966   [AC_HELP_STRING([--enable-mc-saving],
967       [enable saving MC data through the chain])],
968   [],[enable_mc_saving=no])
969 if test "x$enable_mc_saving" = "xyes" ; then 
970   AC_DEFINE(DOMC)
971 fi
972 AC_MSG_RESULT([$enable_mc_saving])
973
974 dnl ------------------------------------------------------------------
975 dnl certainly something old, but we keep the define
976 AC_MSG_CHECKING([whether to use ROWHOUGH])
977 AH_TEMPLATE([USEROWHOUGH],[HLT ROWHOUGH])
978 AC_ARG_ENABLE(rowhough,
979   [AC_HELP_STRING([--enable-rowhough],
980       [use ROWHOUGH ])],
981   [],[enable_rowhough=no])
982 if test "x$enable_rowhough" = "xyes" ; then 
983   AC_DEFINE(USEROWHOUGH)
984 fi
985 AC_MSG_RESULT([$enable_rowhough])
986
987 dnl ------------------------------------------------------------------
988 dnl The ROOTVERSION and ALIROOTVERSION defines were used by the old
989 dnl stand-alone build system. This is most likely something old we can
990 dnl get rid off later, or do something more reasonable. Since the define
991 dnl needs the quotes they have to be  escaped. This works well for the
992 dnl Makefile but not for the configure script. So we have to add the
993 dnl defines after all the other checks.
994 CPPFLAGS="$CPPFLAGS -DROOTVERSION=\\\"`${ROOTCONF} --version`\\\""
995 if test ! "x$have_aliroot" = "xno" ; then
996   CPPFLAGS="$CPPFLAGS -DALIROOTVERSION=\\\"Unknown\\\""
997 fi
998
999 dnl ------------------------------------------------------------------
1000 dnl
1001 dnl Documentation
1002 dnl
1003 AC_ARG_VAR(DOXYGEN, The Documentation Generator)
1004 AC_PATH_PROG(PERL, perl)
1005 AC_PATH_PROG(DOXYGEN, doxygen)
1006 AC_ARG_ENABLE(dot,
1007   [AC_HELP_STRING([--enable-dot],
1008       [enable dot documentation generator])],
1009   [],[enable_dot=no])
1010 HAVE_DOT=NO
1011 DOT_PATH=
1012 AC_PATH_PROG(DOT, dot)
1013 if test "x$DOT" != "x" && test "x$enable_dot" = "xyes" ; then
1014    HAVE_DOT=YES
1015    DOT_PATH=`dirname $DOT`
1016 fi
1017
1018 AC_MSG_CHECKING([for documentation mode])
1019 AC_ARG_ENABLE(doc,
1020   [AC_HELP_STRING([--disable-doc],
1021       [disable documentation build; monolithic build --enable-doc=mono ])],
1022   [],[enable_doc=modules])
1023 if test "x$DOXYGEN" = "x" ; then
1024    enable_doc=no.doxygen
1025 elif test ! "x$enable_doc" = "xmono" && \
1026      test ! "x$enable_doc" = "xmodules"  && \
1027      test ! "x$enable_doc" = "xno"; then
1028    enable_doc=no
1029    AC_MSG_WARN([unknown option])
1030 fi
1031 if test "x$enable_doc" = "xno" ; then
1032    enable_doc=off
1033    DOXYGEN=
1034 fi
1035
1036 AC_MSG_RESULT([$enable_doc])
1037 AM_CONDITIONAL(MONOLITHIC_DOC, test "x$enable_doc" = "xmono")
1038 AM_CONDITIONAL(HAVE_DOXYGEN, test ! "x$DOXYGEN" = "x")
1039 AC_SUBST([HAVE_DOT])
1040 AC_SUBST([DOT_PATH])
1041
1042 dnl HAVE_SRC_SUBDIR=${abs_top_srcdir}/src
1043 dnl echo $HAVE_SRC_SUBDIR
1044 dnl if ! test -d $HAVE_SRC_SUBDIR; then
1045 dnl   HAVE_SRC_SUBDIR=
1046 dnl fi
1047 dnl AC_SUBST([HAVE_SRC_SUBDIR])
1048
1049 dnl ------------------------------------------------------------------
1050 AC_MSG_NOTICE([---------------------------------------------- ])
1051 AC_MSG_NOTICE([                build summary                  ])
1052 AC_MSG_NOTICE([---------------------------------------------- ])
1053
1054 AC_CONFIG_FILES([Makefile 
1055                  BASE/Makefile
1056                  BASE/setenv.sh
1057                  BASE/setenv.csh
1058                  BASE/HOMER/Makefile
1059                  BASE/util/Makefile
1060                  BASE/interface/Makefile
1061                  BASE/test/Makefile
1062                  BASE/interface/test/Makefile
1063                  doc/Makefile
1064                  doc/doxygen.conf
1065                  doc/doxymodule.conf])
1066
1067 dnl AliRoot and installation directory for libraries
1068 dnl 
1069 AC_MSG_NOTICE([AliRoot: $have_aliroot])
1070 AM_CONDITIONAL(HAVE_ALIROOT, test "x$have_aliroot" != "xno" )
1071 if test "x$have_aliroot" != "xno"; then 
1072   AC_CONFIG_FILES([sim/Makefile  
1073                    rec/Makefile  
1074                    rec/test/Makefile     
1075                    shuttle/Makefile
1076                    pendolino/Makefile
1077                    ])
1078 fi
1079 if test "x$prefix" != "xNONE" && test $ALICE_ROOT = $prefix ; then
1080 libdir=\${exec_prefix}/lib/tgt_$ALICE_TARGET
1081 AC_MSG_NOTICE([libdir set to $libdir])
1082 fi
1083
1084 AC_MSG_NOTICE([compile sample library: $enable_sample])
1085 if test "x$enable_sample" = "xyes"; then 
1086   AC_CONFIG_FILES([SampleLib/Makefile])
1087 fi
1088
1089 AC_MSG_NOTICE([compile RCU library: $enable_rcu])
1090 if test "x$enable_rcu" = "xyes"; then 
1091   AC_CONFIG_FILES([RCU/Makefile
1092                    RCU/test/Makefile
1093                    ])
1094 fi
1095
1096 AC_MSG_NOTICE([compile TPC library: $enable_tpc])
1097 if test "x$enable_tpc" = "xyes"; then 
1098   AC_CONFIG_FILES([TPCLib/Makefile            
1099                    TPCLib/test/Makefile       
1100                    TPCLib/mapping2array.cxx     
1101                    TPCLib/OnlineDisplay/Makefile
1102                    ])
1103 fi
1104
1105 AC_MSG_NOTICE([compile PHOS library: $enable_phos])
1106 if test "x$enable_phos" = "xyes"; then 
1107   AC_CONFIG_FILES([PHOS/Makefile])
1108 fi
1109
1110 AC_MSG_NOTICE([compile TRD library: $enable_trd])
1111 if test "x$enable_trd" = "xyes"; then 
1112   AC_CONFIG_FILES([TRD/Makefile])
1113 fi
1114
1115 AC_MSG_NOTICE([compile FMD library: $enable_fmd])
1116 if test "x$enable_fmd" = "xyes"; then 
1117   AC_CONFIG_FILES([FMD/Makefile])
1118 fi
1119
1120 AC_MSG_NOTICE([compile MUON library: $enable_muon])
1121 if test "x$enable_muon" = "xyes"; then 
1122   AC_CONFIG_FILES([MUON/Makefile])
1123 fi
1124
1125 AC_MSG_NOTICE([compile ITS library: $enable_its])
1126 if test "x$enable_its" = "xyes"; then 
1127   AC_CONFIG_FILES([ITS/Makefile])
1128 fi
1129
1130 AC_MSG_NOTICE([compile trigger library: $enable_trigger])
1131 if test "x$enable_trigger" = "xyes"; then 
1132   AC_CONFIG_FILES([trigger/Makefile])
1133 fi
1134
1135 AC_MSG_NOTICE([compile comp library: $enable_comp])
1136 if test "x$enable_comp" = "xyes"; then 
1137   AC_CONFIG_FILES([comp/Makefile])
1138 fi
1139
1140 AC_OUTPUT
1141 dnl
1142 dnl EOF
1143 dnl
1144