]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/configure.ac
set AC_VERSION automatically from AliRoot tag or revision (for trunk)
[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 | grep "URL:" | cut -d: -f3 | sed -e 's|[/]*HLT[/]*$||' | sed -e 's|^[/]*||g' | cut -d '/' -f 4`; rev=`cat configure.ac | sed -e '/^dnl \$Id:/!d'| cut -d ' ' -f4 | tr -d '\n'`; if test "x$url" != "x"; then echo -n $url; elif test "x$rev" != "x"; then echo -n $rev ; else echo -n invalid-version; fi]),
12         [Matthias.Richter@ift.uib.no], 
13         [alice-hlt])
14
15 dnl ------------------------------------------------------------------
16 dnl the package from CVS contains the old Makefiles as well. In order to
17 dnl prevent them from becoming overwritten, we require a separate build
18 dnl directory
19 if test "`dirname $0`" = "." ; then
20    AC_ERROR([please run the script from a separate build directory])
21 fi
22
23 dnl ------------------------------------------------------------------
24 AC_CANONICAL_SYSTEM
25 AC_PREFIX_DEFAULT(${PWD})
26 AC_CONFIG_SRCDIR(BASE/AliHLTComponent.cxx)
27 AM_INIT_AUTOMAKE
28 AC_PROG_CC
29 AC_PROG_CXX
30 AC_PROG_LIBTOOL
31
32 AC_DEBUG
33 AC_OPTIMIZATION
34 AM_CONDITIONAL(STANDALONE_SAMPLELIB, test 0 )
35
36 dnl ------------------------------------------------------------------
37 dnl A warning posted into the auto-generated files
38 dnl Does NOT concern this file ;-)
39 AUTOGENERATED_WARNING="!!!!!!!    DO NOT EDIT THIS FILE !!!!!!"
40 AC_SUBST([AUTOGENERATED_WARNING])
41
42 dnl ------------------------------------------------------------------
43 dnl
44 dnl Check for ROOT
45 dnl
46 ROOT_PATH(, [have_root=1], [AC_ERROR([Stop! The HLT package needs ROOT.])])
47 AM_CONDITIONAL(HAVE_ROOT, test "x$have_root" = "x1" )
48 AC_SUBST([ROOTSYS])
49 ROOTBINDIR=`dirname $ROOTEXEC`
50 AC_SUBST([ROOTBINDIR])
51
52 dnl test for additional required root libraries and headers
53 LIBS='-ldl'
54 if test "x$have_root" = "x1"; then
55   AC_LANG_PUSH(C++)
56   save_CPPFLAGS=$CPPFLAGS
57   save_LDFLAGS=$LDFLAGS
58   save_LIBS=$LIBS
59   CPPFLAGS=`echo $save_CPPFLAGS; for i in ${ROOTINCDIR}; do echo -n "-I$i " ; done`
60   
61   # we check for the libSTEER library which is linked to
62   # - the ROOT libs libGeom libMinuit libVMC libEG
63   # - the AliRoot libESD libRAWData (libRAWDatarec from v4-04-Rev-07)
64   # - ROOT libCint needs also libdl
65   # - from Nov 1 2006 TTreeFormula is needed by AliTagAnalysis and requires
66   #   libTreePlayer.so
67   # - from Jan 07 libESD also depends on libXMLIO
68   # - libSTEER depends on libProofPlayer since Oct 2007 (after v4-07-Release)
69   ROOT_CHECKLIBS='Geom Minuit EG VMC TreePlayer XMLIO Thread Proof ProofPlayer'
70   for CHECKLIB in $ROOT_CHECKLIBS ; do
71     LDFLAGS="$save_LDFLAGS -L${ROOTLIBDIR}"
72     LIBS="$save_LIBS $ROOTLIBS $ADD_ROOTLIBS"
73     AC_CHECK_LIB([$CHECKLIB],[_init], [ADD_ROOTLIBS="$ADD_ROOTLIBS -l$CHECKLIB"])
74   done
75
76   # TBuffer.h has been made pure virtual in root v5-15-02 and one
77   # has to derive from TBufferFile.h (needed for BASE/AliHLTMessage.h)
78   AC_CHECK_HEADERS([TBufferFile.h])
79
80   # TView.h has been made pure virtual right after root v5-15-02 and one
81   # has to derive from TView3D.h (needed for TPCLib/OnlineDisplay/AliHLTTPCDisplay3D)
82   AC_CHECK_HEADERS([TView3D.h])
83
84   CPPFLAGS=$save_CPPFLAGS
85   LDFLAGS=$save_LDFLAGS
86   LIBS=$save_LIBS
87   AC_LANG_POP(C++)
88 fi
89
90 dnl ------------------------------------------------------------------
91 # TODO: make this configurable through arguments
92 #Define whether you want to run with ALIROOT or only ROOT
93 AH_TEMPLATE([ALIHLT_USEPACKAGE],[running environment])
94 ALIHLT_USEPACKAGE=ALIROOT
95 #ALIHLT_USEPACKAGE=ROOT
96 #ALIHLT_USEPACKAGE=STANDALONE
97 AC_DEFINE(use_aliroot)
98 AC_DEFINE(use_root)
99 CPPFLAGS="$CPPFLAGS ${ROOTCFLAGS}"
100
101 dnl ------------------------------------------------------------------
102 dnl check for AliRoot features
103 AC_LANG_PUSH(C++)
104 have_aliroot=no
105 AC_ARG_WITH(aliroot,[  --with-aliroot   top of the AliRoot installation],
106                     [test -d $with_aliroot && ALICE_ROOT=$with_aliroot],
107                     [])
108
109 if test "x$ALICE_ROOT" != "x" && test -d $ALICE_ROOT ; then
110   dnl ------------------------------------------------------------------
111   dnl Try to estimate the system architecture
112   case $host_os:$host_cpu in
113   linux*:x86_64*)       alice_target='linuxx8664gcc'            ;;
114   linux*)               alice_target='linux'                    ;;
115   *)                    alice_target='unknown'                  ;;
116   esac
117   if test "x$alice_target" = "xunknown" ; then
118     if test -z $ALICE_TARGET ; then
119     AC_MSG_ERROR([Can not estimate system architecture.
120     To avoid the problem, set the ALICE_TARGET variable appropriately.
121     Please send the following information to Matthias.Richter@ift.uib.no:
122         ${PACKAGE}: no AliRoot target definition for os=$host_os and cpu=$host_cpu ])
123     else
124     AC_MSG_NOTICE([Unknown system architecture.
125     Please send the following information to Matthias.Richter@ift.uib.no:
126         ${PACKAGE}: no AliRoot target definition for os=$host_os and cpu=$host_cpu ])  
127     fi
128   else
129     if test "x$ALICE_TARGET" != "x" && test "x$ALICE_TARGET" != "x$alice_target" ; then
130     AC_MSG_WARN([The ALICE_TARGET variable does not match your current system
131     overriding $ALICE_TARGET by $alice_target])
132     fi
133     ALICE_TARGET=$alice_target
134   fi
135   ALIROOTBINDIR=${ALICE_ROOT}/bin/tgt_${ALICE_TARGET}
136   ALIROOTLIBDIR=${ALICE_ROOT}/lib/tgt_${ALICE_TARGET}
137   ALIROOTINCDIR=${ALICE_ROOT}/include
138   test -d ${ALIROOTBINDIR} || AC_MSG_WARN([can not find AliRoot binary directory $ALIROOTBINDIR])
139   test -d ${ALIROOTLIBDIR} || AC_MSG_WARN([can not find AliRoot library directory $ALIROOTLIBDIR])
140   test -d ${ALIROOTINCDIR} || AC_MSG_WARN([can not find AliRoot include directory $ALIROOTINCDIR])
141 fi
142
143 AC_MSG_CHECKING([for AliRoot])
144 if test "x$ALICE_ROOT" != "x" \
145    && test -d ${ALIROOTBINDIR} \
146    && test -d ${ALIROOTLIBDIR} \
147    && test -d ${ALIROOTINCDIR}; then
148   have_aliroot=$ALICE_ROOT
149 else
150   ALIROOTBINDIR=
151   ALIROOTLIBDIR=
152   ALIROOTINCDIR=
153 fi
154 AC_MSG_RESULT([$have_aliroot])
155
156 if test ! "x$have_aliroot" = "xno" ; then
157   ALIROOT_CPPFLAGS="-I${ALIROOTINCDIR} -I${ALICE_ROOT}/RAW"
158   ALIROOT_LDFLAGS="-L${ALIROOTLIBDIR}"
159   ALIROOT_LIBS="-lESD $ADD_ROOTLIBS"
160   save_CPPFLAGS=$CPPFLAGS
161   save_LDFLAGS=$LDFLAGS
162   save_LIBS=$LIBS
163   CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS"
164   LDFLAGS="$save_LDFLAGS -L${ROOTLIBDIR} $ALIROOT_LDFLAGS"
165   
166   # check for certain AliRoot libraries/files/features
167   # libSTEERBase present since Aug 7 2007
168   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
169   CHECKLIB=STEERBase
170   AC_CHECK_LIB([$CHECKLIB],[_init],[ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"])
171
172   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
173   CHECKLIB=AOD
174   AC_CHECK_LIB([$CHECKLIB],[_init],[ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"])
175
176   # splitted RAW libraries since AliRoot version v4-04-Rev-07 (09.08.2006)
177   have_alirawdata=no
178   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
179   CHECKLIB=RAWDatabase
180   AC_CHECK_LIB([$CHECKLIB],[_init],
181         [ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"
182          LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
183          CHECKLIB=RAWDatarec
184          AC_CHECK_LIB([$CHECKLIB],[_init],
185                [ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"
186                 have_alirawdata=$CHECKLIB])],
187         [# second pass with -RAWData
188          CHECKLIB="-lRAWData"
189          LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS $CHECKLIB -lSTEER"
190          AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliRawReaderMemory.h>
191                                        #include <AliRawReaderFile.h>
192                                        #include <AliRawReaderDate.h>
193                                        #include <AliRawReaderRoot.h>], 
194                                      [AliRawReaderMemory mreader;
195                                        AliRawReaderFile freader;
196                                        AliRawReaderDate dreader(NULL,0);
197                                        AliRawReaderRoot rreader(NULL,0);])],
198                                      [ALIROOT_LIBS="$ALIROOT_LIBS $CHECKLIB"
199                                        have_alirawdata=$CHECKLIB], 
200                                       [have_alirawdata=no])
201         ]) dnl AC_CHECK_LIB RAWDatabase
202   AC_MSG_CHECKING([for AliRawReader classes in RAWData libraries])
203   AC_MSG_RESULT([$have_alirawdata])
204
205   # CBD library is present since AliRoot version v4-05-00 (02.06.2006)
206   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS -lSTEER"
207   CHECKLIB=CDB
208   AC_CHECK_LIB([$CHECKLIB],[_init],[ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"])
209
210   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
211   CHECKLIB=STEER
212   AC_CHECK_LIB([$CHECKLIB],[_init],[ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"],[have_aliroot=no])
213
214   dnl
215   dnl check whether AliLog supports notification callback
216   dnl
217   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
218   have_alilog_notification=no
219   if test ! "x$have_aliroot" = "xno" ; then
220   AC_MSG_CHECKING([whether AliLog supports notification callback])
221   AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliLog.h>], 
222                                   [AliLog::AliLogNotification fct])],
223                                   [have_alilog_notification=yes], 
224                                   [AC_DEFINE(NO_ALILOG_NOTIFICATION)])
225   AC_MSG_RESULT([$have_alilog_notification])
226   fi
227
228   if test "x$have_aliroot" = "xno" ; then
229     # 2007-08-18 dont reset ALIROOT_CPPFLAGS in order to allow compilation
230     # but library dependencies might not be resolved completely
231     #ALIROOT_CPPFLAGS=
232     AC_MSG_WARN([some of the AliRoot library dependencies are not resolved.
233     This can happen from time to time due to development in AliRoot. You can
234     force compilation of detector libs by --enable-<detector>, but be aware
235     of unresolved references at runtime.])
236     AC_MSG_WARN([       ------------------------------------------ ])
237     AC_MSG_WARN([       Report this to $PACKAGE_BUGREPORT ])
238     AC_MSG_WARN([       please include config.log                  ])
239     AC_MSG_WARN([       ------------------------------------------ ])
240     ALIROOT_LDFLAGS=
241     ALIROOT_LIBS=
242   fi
243
244   dnl
245   dnl required header files and libraries for modules
246   dnl
247   if test ! "x$have_aliroot" = "xno" ; then
248     # the HLTTPCLib needs to link agains TPCbase and TPCrec
249     # TPC library for AliTPCParam and AliSimDigits used in 
250     # AliHLTTPCFileHandler.h and AliHLTTPCDisplay.cxx
251     # from May 07 TPCbase depends on libGui.so
252     CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS -I${ALICE_ROOT}/TPC"
253     have_alitpc=yes
254     AC_MSG_CHECKING(for required classes in TPC libraries)
255     if test ! "x$have_alitpc" = "xno" ; then
256       ALITPC_LIBS="-lGui -lTPCbase -lTPCrec"
257       LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS $ALITPC_LIBS"
258       AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliSimDigits.h>
259                                        #include <AliTPCParam.h>
260                                        #include <AliTPCParamSR.h>
261                                        #include <AliTPCDigitsArray.h>
262                                        #include <AliTPCClustersArray.h>
263                                        #include <AliTPCcluster.h>     
264                                        #include <AliTPCClustersRow.h>], 
265                                       [AliSimDigits dig;
266                                        AliTPCParam param;
267                                        AliTPCParamSR paramsr;
268                                        AliTPCDigitsArray digarray;
269                                        AliTPCClustersArray clustarray;
270                                        AliTPCcluster clust;
271                                        AliTPCClustersRow row])],
272                                       [AC_DEFINE(HAVE_ALITPC)], 
273                                       [have_alitpc=no
274                                        ALITPC_LIBS= ])
275     fi
276     AC_MSG_RESULT($have_alitpc)
277   fi
278   AC_CHECK_HEADERS([AliTPCCalibPulser.h], [], [AC_DEFINE(HAVE_NOT_ALITPCCALIBPULSER)])
279   AC_CHECK_HEADERS([AliTPCCalibPedestal.h], [], [AC_DEFINE(HAVE_NOT_ALITPCCALIBPEDESTAL)])
280
281   have_tpc_mapping=no
282   if test ! "x$have_aliroot" = "xno" ; then
283     # the TPCLib/AliHLTTPCRawReader needs the actual Pad layout of the TPC 
284     # which is stored in the TPC/mapping/Patchx.data files from
285     # AliRoot version v4-04-Release (May 2006)
286     AH_TEMPLATE([HAVE_TPC_MAPPING],[TPC pad mapping available])
287     TPC_PAD_MAPPING_PATH=$have_aliroot/TPC/mapping
288     AC_CHECK_FILE( [$TPC_PAD_MAPPING_PATH/Patch0.data], 
289                    [have_tpc_mapping=yes
290                     AC_SUBST(TPC_PAD_MAPPING_PATH)
291                     AC_DEFINE(HAVE_TPC_MAPPING)],
292                    [])
293     
294   fi
295   AC_MSG_CHECKING([for TPC mapping layout])
296   AC_MSG_RESULT([$have_tpc_mapping])
297
298   dnl
299   dnl Check for the interface of AliExternalTrackParam which has been changed
300   dnl in revision 1.17 of AliExternalTrackParam.h (AliRoot version v4-05-04
301   dnl or higher)
302   externaltrackparam_version=1
303   AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliExternalTrackParam.h>], 
304                                   [AliExternalTrackParam trackparam;
305                                    Double_t param[[5]]; Double_t covar[[15]];
306                                    trackparam.Set(0., 0., param, covar);])],
307                                   [externaltrackparam_version=2],
308                                   [AC_DEFINE(EXTERNALTRACKPARAM_V1)])
309   AC_MSG_CHECKING(for version of AliExternalTrackParam)
310   AC_MSG_RESULT($externaltrackparam_version)
311
312   CPPFLAGS=$save_CPPFLAGS
313   LDFLAGS=$save_LDFLAGS
314   LIBS=$save_LIBS
315 fi
316
317 AC_LANG_POP(C++)
318 AC_SUBST([ALICE_ROOT])
319 AC_SUBST([ALIROOT_CPPFLAGS])
320 AC_SUBST([ALIROOT_LDFLAGS])
321 AC_SUBST([ALIROOTBINDIR])
322 AC_SUBST([ALIROOTLIBDIR])
323 AC_SUBST([ALIROOT_LIBS])
324 AM_CONDITIONAL(USE_TPC_MAPPING, test x$have_tpc_mapping = xyes)
325
326 HLTBASE_CPPFLAGS='-I${top_srcdir}/BASE'
327 HLTBASE_LDFLAGS=
328 AC_SUBST([HLTBASE_CPPFLAGS])
329 AC_SUBST([HLTBASE_LDFLAGS])
330
331 dnl ------------------------------------------------------------------
332 dnl check for the HLT PubSub Framework
333 dnl namely for the existence of the HOMER library
334 dnl from Sep 2007, the HOMER lib has been incorporated into the alice-hlt
335 dnl package. It os though possible to choose an external. library
336 dnl In order to make the origni of the HOMER lib clear, the one in AliRoot
337 dnl got the name libAliHLTHOMER
338 AC_MSG_CHECKING([for HLT PubSub Framework])
339 AC_ARG_WITH(pubsub, [installation path of the HLT PubSub framework],
340                     [],
341                     [ test -n $ALIHLT_DC_DIR && with_pubsub=$ALIHLT_DC_DIR ])
342 if test -z $with_pubsub || ! test -d $with_pubsub ; then
343   with_pubsub=no
344 fi
345 AC_MSG_RESULT([$with_pubsub])
346 HOMER_VERSION=2
347 HOMER_LIBS=
348
349 AH_TEMPLATE([HAVE_HOMERREADER],[the HLT PubSub Homer Reader interface])
350 if test "x$with_pubsub" != "xno" ; then
351   save_CPPFLAGS=$CPPFLAGS
352   save_LDFLAGS=$LDFLAGS
353   save_LIBS=$LIBS
354   # currently the different versions of the HLT PubSub framework have a different
355   # directory layout
356   if test -d ${with_pubsub}/include/HOMER ; then
357     # the 'early' location of the include files with separated HOMER sub dirs
358     HOMER_INCDIRS="${with_pubsub}/include/HOMER ${with_pubsub}/include/HOMER/reader"
359   elif test -d ${with_pubsub}/include/Util/HOMER ; then
360     # location for HLT Framework versions after Sep 2006
361     HOMER_INCDIRS="${with_pubsub}/include/Util/HOMER"
362   elif test -d ${with_pubsub}/src/Util/HOMER/include ; then
363     # fall back if include files were not installed (versions after Sep 06)
364     HOMER_INCDIRS="${with_pubsub}/src/Util/HOMER/include"
365   else
366     # fall back if include files were not installed (versions before Sep 06)
367     HOMER_INCDIRS="${with_pubsub}/src/Util/HOMER/reader/include ${with_pubsub}/src/Util/HOMER/data/include"
368   fi
369   HOMER_CPPFLAGS=`for i in ${HOMER_INCDIRS}; do echo -n "-I$i " ; done`
370
371   AC_ARG_ENABLE(pubsub-debug,
372     [AC_HELP_STRING([--disable-pubsub-debug],
373         [force the production version of the PubSub framework])],
374     [],[enable_pubsub_debug=yes])
375   homer_type="none"
376   HOMER_TARGET="`uname -s`-`uname -m`"
377   AC_MSG_CHECKING([for HLT PubSub Framework release type])
378   if test -d "${with_pubsub}/lib/${HOMER_TARGET}-release" ; then
379     homer_type="production"
380     HOMER_TARGET="${HOMER_TARGET}-release"
381   elif test "x$enable_pubsub_debug" = "xyes" && test -d "${with_pubsub}/lib/${HOMER_TARGET}-debug" ; then
382     homer_type="debug"
383     HOMER_TARGET="${HOMER_TARGET}-debug"
384   fi
385   AC_MSG_RESULT([${homer_type}])
386   HOMERREADER_HEADER=HOMERReader.h
387   HOMER_BINDIR="${with_pubsub}/bin/${HOMER_TARGET}"
388   HOMER_LIBDIR="${with_pubsub}/lib/${HOMER_TARGET}"
389   HOMER_LDFLAGS="-L${HOMER_LIBDIR}"
390   CPPFLAGS="$save_CPPFLAGS $HOMER_CPPFLAGS"
391   LDFLAGS="$save_LDFLAGS $HOMER_LDFLAGS"
392   LIBS="$save_LIBS "
393   with_homer=no
394   AC_LANG_PUSH(C++)
395   AC_CHECK_HEADER([$HOMERREADER_HEADER],
396     [ AC_CHECK_LIB([HOMER],[_init],
397       [with_homer=yes
398        HOMER_LIBS="-lHOMER"],
399       [ AC_CHECK_LIB([HOMERReader],[_init],
400                      [with_homer=yes
401                       HOMER_LIBS="-lHOMERReader"])])
402       LIBS="$LIBS $HOMER_LIBS"
403       AC_MSG_CHECKING([version of HOMER library])
404       dnl The Homer library has no versioning, so we do our own
405       dnl version           description
406       dnl ----------------------------------------------------------------------
407       dnl   1          inintial version
408       dnl   2          GetBlockStatusFlags added to the interface
409       AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <HOMERReader.h>],
410                                       [HOMERReader reader("dummy", 0);
411                                        reader.GetBlockStatusFlags(0);])],
412                                       [],
413                                       [HOMER_VERSION=1])
414       AC_MSG_RESULT([$HOMER_VERSION])
415   ],
416   [HOMERREADER_HEADER=]) #AC_CHECK_HEADER([$HOMERREADER_HEADER])
417   AC_LANG_POP(C++)
418   HOMER_INBUILT_LIB=
419 else
420 dnl no pubsub version defined, check if the HOMER lib is available in AliRoot
421   topdir=`dirname $0`
422   HOMER_CPPFLAGS="-I`(cd $topdir; pwd)`/BASE/HOMER"
423   HOMERREADER_HEADER=AliHLTHOMERReader.h
424   HOMER_INBUILT_LIB=`pwd`/BASE/HOMER/libAliHLTHOMER.la
425   HOMER_BINDIR=
426   HOMER_LIBDIR=
427   HOMER_LDFLAGS=
428 fi
429
430   if test "x$with_homer" = "xno" ; then
431     HOMER_CPPFLAGS=
432     HOMER_LDFLAGS=
433     HOMER_LIBS=
434   else
435     HOMER_CPPFLAGS="$HOMER_CPPFLAGS -DHOMER_VERSION=$HOMER_VERSION"
436     AC_DEFINE(HAVE_HOMERREADER)
437   fi
438   CPPFLAGS="$save_CPPFLAGS"
439   LDFLAGS="$save_LDFLAGS"
440   LIBS="$save_LIBS"  
441
442 AC_SUBST([HOMERREADER_HEADER])
443 AC_SUBST([HOMER_INBUILT_LIB])
444 AC_SUBST([HOMER_CPPFLAGS])
445 AC_SUBST([HOMER_LDFLAGS])
446 AC_SUBST([HOMER_LIBDIR])
447 AC_SUBST([HOMER_BINDIR])
448 AC_SUBST([HOMER_LIBS])
449
450 dnl ------------------------------------------------------------------
451 AC_MSG_CHECKING([whether to impose strict coding conventions])
452 AC_ARG_ENABLE(strict,
453   [AC_HELP_STRING([--disable-strict],
454       [disable coding convention checks ])],
455   [],[enable_strict=yes])
456 if test "x$enable_strict" = "xyes" ; then
457    CPPFLAGS="$CPPFLAGS -W -Weffc++ -Wall"
458 fi
459 AC_MSG_RESULT([$enable_strict])
460
461 dnl ------------------------------------------------------------------
462 AC_MSG_CHECKING([whether to compile sample library])
463 AH_TEMPLATE([HLT_SAMPLE],[hlt sample library])
464 AC_ARG_ENABLE(sample,
465   [AC_HELP_STRING([--disable-sample],
466       [compile the sample library ])],
467   [],
468   [if test "x$have_aliroot" = "xno" ; then
469      enable_sample="no...requires.AliRoot"
470    else
471      enable_sample=yes
472    fi
473   ])
474
475 if test "x$enable_sample" = "xyes" ; then 
476   AC_DEFINE(HLT_SAMPLE)
477 fi
478 AM_CONDITIONAL(EN_HLT_SAMPLE, test x$enable_sample = xyes)
479 AC_MSG_RESULT([$enable_sample])
480
481 dnl ------------------------------------------------------------------
482 AC_MSG_CHECKING([whether to compile util library])
483 AH_TEMPLATE([HLT_UTIL],[HLT utility library])
484 AC_ARG_ENABLE(util,
485   [AC_HELP_STRING([--disable-util],
486       [compile the util library ])],
487   [],
488   [if test "x$have_aliroot" = "xno" ; then
489      enable_util="no...requires.AliRoot"
490    else
491      enable_util=yes
492    fi
493   ])
494
495 if test "x$enable_util" = "xyes" ; then 
496   AC_DEFINE(HLT_UTIL)
497 fi
498 AM_CONDITIONAL(EN_HLT_UTIL, test x$enable_util = xyes)
499 AC_MSG_RESULT([$enable_util])
500
501 dnl ------------------------------------------------------------------
502 AH_TEMPLATE([HLT_TPC],[hlt tpc library])
503
504 CHECK_HLTMODULE([tpc],
505                 [AliTPCRawStream.h], 
506                 [$ALIROOT_CPPFLAGS -I$ALICE_ROOT/TPC],
507                 [], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS],
508                 [], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
509                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
510
511 if test "x$enable_module" = "xmissheader"; then
512   enable_module="no...missing.headers"
513   enable_tpc="no...missing.headers"
514 elif test "x$have_alitpc" = "xno" ; then
515   enable_module="no...requires.AliRoot.TPC.libraries"
516   enable_tpc="no...requires.AliRoot.TPC.libraries"
517 elif test "x$enable_module" = "xforce"; then
518   enable_tpc="yes"
519 else
520   enable_tpc=$enable_module
521 fi
522
523 if test "x$enable_tpc" = "xyes" ; then 
524   AC_DEFINE(HLT_TPC)
525 fi
526 AM_CONDITIONAL(EN_HLT_TPC, test x$enable_tpc = xyes)
527 AC_MSG_CHECKING([whether to compile TPC library])
528 AC_MSG_RESULT([$enable_module])
529 AC_SUBST([ALITPC_LIBS])
530
531 dnl ------------------------------------------------------------------
532 AH_TEMPLATE([HLT_RCU],[hlt rcu library])
533
534 CHECK_HLTMODULE([rcu],
535                 [AliAltroDecoder.h], 
536                 [$ALIROOT_CPPFLAGS -I$ALICE_ROOT/RAW],
537                 [], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS],
538                 [], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
539                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
540
541 if test "x$enable_module" = "xmissheader"; then
542   enable_module="no...missing.headers"
543   enable_rcu="no...missing.headers"
544 elif test "x$have_alircu" = "xno" ; then
545   enable_module="no...requires.AliRoot.RAW.libraries"
546   enable_rcu="no...requires.AliRoot.RAW.libraries"
547 elif test "x$enable_module" = "xforce"; then
548   enable_rcu="yes"
549 else
550   AC_LANG_PUSH(C++)
551   save_CPPFLAGS=$CPPFLAGS
552   save_LDFLAGS=$LDFLAGS
553   save_LIBS=$LIBS
554   CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS"
555   LDFLAGS="$save_LDFLAGS -L${ROOTLIBDIR} $ALIROOT_LDFLAGS"
556   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
557   AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliAltroDecoder.h>], 
558                                   [AliAltroDecoder decoder;
559                                   decoder.CopyBackward(NULL, 0);])],
560                                   [enable_rcu=$enable_module], 
561                                   [enable_module="no...requires.AliRoot>v4-10-Release"
562                                    enable_rcu="no...requires.AliRoot>v4-10-Release"])
563   CPPFLAGS=$save_CPPFLAGS
564   LDFLAGS=$save_LDFLAGS
565   LIBS=$save_LIBS
566   AC_LANG_POP(C++)
567 fi
568
569 if test "x$enable_rcu" = "xyes" ; then 
570   AC_DEFINE(HLT_RCU)
571 fi
572 AM_CONDITIONAL(EN_HLT_RCU, test x$enable_rcu = xyes)
573 AC_MSG_CHECKING([whether to compile RCU library])
574 AC_MSG_RESULT([$enable_module])
575 AC_SUBST([ALIRCU_LIBS])
576
577 dnl ------------------------------------------------------------------
578 AH_TEMPLATE([HLT_PHOS],[hlt phos library])
579   
580 ALIPHOS_LIBS=
581 CHECK_HLTMODULE([phos],
582                 [], [$ALIROOT_CPPFLAGS],
583                 [RAWDatasim], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS],
584                 [PHOSbase PHOSrec PHOSsim], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
585                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
586
587 if test "x$enable_module" = "xmissheader"; then
588   enable_module="no...requires.AliRoot>v4-05-07"
589   enable_phos="no...requires.AliRoot>v4-05-07"
590 elif test "x$enable_module" = "xforce"; then
591   enable_phos="yes"
592 else
593   have_alicalorawstream=no
594   if test ! "x$have_aliroot" = "xno" ; then
595     AC_LANG_PUSH(C++)
596     save_CPPFLAGS="$CPPFLAGS"
597     # this can not be used as AliCaloRawStream.h indirectly depends on TString.h
598     #AC_CHECK_HEADERS([AliCaloRawStream.h], [have_alicalorawstream=yes])
599     CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS"
600     AC_MSG_CHECKING([for AliCaloRawStream.h usability])
601     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <TString.h>
602                                         #include <AliCaloRawStream.h>], 
603                                        [int i])],
604                                        [AC_DEFINE(HAVE_ALICALORAWSTREAM)
605                                         have_alicalorawstream=yes], 
606                                        [])
607     AC_MSG_RESULT([$have_alicalorawstream])
608     AC_LANG_POP(C++)
609     CPPFLAGS="$save_CPPFLAGS"
610   fi
611   if test "x$have_alicalorawstream" != "xyes"; then
612     enable_phos="no...requires.AliRoot>v4-05-07"
613   else
614     enable_phos=$enable_module
615   fi
616 fi
617
618 if test "x$enable_phos" = "xyes" ; then 
619   AC_DEFINE(HLT_PHOS)
620   ALIPHOS_LIBS=$ALIHLTMODULE_LIBS
621 fi
622 AM_CONDITIONAL(EN_HLT_PHOS, test x$enable_phos = xyes)
623 AC_MSG_CHECKING([whether to compile PHOS library])
624 AC_MSG_RESULT([$enable_module])
625 AC_SUBST([ALIPHOS_LIBS])
626
627 dnl ------------------------------------------------------------------
628 AH_TEMPLATE([HLT_TRD],[hlt trd library])
629   
630 ALITRD_LIBS=
631 CHECK_HLTMODULE([trd],
632                 [], [],
633                 [MLP], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS],
634                 [TRDbase TRDrec TRDsim], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
635                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
636
637 if test "x$enable_module" = "xmissheader"; then
638   enable_module="no...requires.AliRoot>v4-07-Release"
639   enable_trd="no...requires.AliRoot>v4-07-Release"
640 elif test "x$enable_module" = "xforce"; then
641   enable_trd="yes"
642 else
643   enable_trd=$enable_module
644   if test "x$enable_trd" = "xyes" ; then
645     AC_LANG_PUSH(C++)
646     save_CPPFLAGS="$CPPFLAGS"
647     CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS -I$ALICE_ROOT/TRD"
648     AC_MSG_CHECKING([for required functions in AliTRDclusterizer])
649     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <AliTRDclusterizer.h>], 
650                                        [AliTRDclusterizer c;
651                                        c.SetRawVersion(0)])],
652                                        [], 
653                                        [enable_trd="no...requires.AliRoot>v4-07-Release"])
654     AC_MSG_RESULT([$enable_trd])       
655     AC_LANG_POP(C++)
656     CPPFLAGS="$save_CPPFLAGS"
657   fi
658 fi
659
660 if test "x$enable_trd" = "xyes" ; then 
661   AC_DEFINE(HLT_TRD)
662   ALITRD_LIBS=$ALIHLTMODULE_LIBS
663 fi
664 AM_CONDITIONAL(EN_HLT_TRD, test x$enable_trd = xyes)
665 AC_MSG_CHECKING([whether to compile TRD library])
666 AC_MSG_RESULT([$enable_module])
667 AC_SUBST([ALITRD_LIBS])
668
669 dnl ------------------------------------------------------------------
670 AH_TEMPLATE([HLT_MUON],[hlt dimuon library])
671
672 ALIMUON_LIBS=
673 CHECK_HLTMODULE([dimuon],
674                 [AliMpExMap.h AliMUONTriggerIO.h], 
675                 [$ALIROOT_CPPFLAGS -I$ALICE_ROOT/MUON -I$ALICE_ROOT/MUON/mapping],
676                 [], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS],
677                 [], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
678                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
679
680 if test "x$enable_module" = "xmissheader"; then
681   enable_module="no...requires.AliRoot>=v4-08-Release"
682   enable_muon="no...requires.AliRoot>=v4-08-Release"
683 elif test "x$enable_module" = "xforce"; then
684   enable_muon="yes"
685 else
686   enable_muon=$enable_module
687 fi
688
689 if test "x$enable_muon" = "xyes" ; then 
690   AC_DEFINE(HLT_MUON)
691   ALIMUON_LIBS=$ALIHLTMODULE_LIBS
692 fi
693 AM_CONDITIONAL(EN_HLT_MUON, test x$enable_muon = xyes)
694 AC_MSG_CHECKING([whether to compile MUON library])
695 AC_MSG_RESULT([$enable_module])
696 AC_SUBST([ALIMUON_LIBS])
697
698 dnl ------------------------------------------------------------------
699 AH_TEMPLATE([HLT_TRIGGER],[hlt trigger library])
700
701 ALITRIGGER_LIBS=
702 CHECK_HLTMODULE([trigger],
703                 [], [$ALIROOT_CPPFLAGS],
704                 [], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS],
705                 [], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
706                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
707
708 if test "x$enable_module" = "xmissheader"; then
709   enable_module="no...header.missing"
710   enable_trigger="no...header.missing"
711 elif test "x$enable_module" = "xforce"; then
712   enable_trigger="yes"
713 else
714   enable_trigger=$enable_module
715 fi
716
717 if test "x$enable_trigger" = "xyes" ; then 
718   AC_DEFINE(HLT_TRIGGER)
719   ALITRIGGER_LIBS=$ALIHLTMODULE_LIBS
720 fi
721 AM_CONDITIONAL(EN_HLT_TRIGGER, test x$enable_trigger = xyes)
722 AC_MSG_CHECKING([whether to compile Trigger library])
723 AC_MSG_RESULT([$enable_module])
724 AC_SUBST([ALITRIGGER_LIBS])
725
726 dnl ------------------------------------------------------------------
727 AH_TEMPLATE([HLT_ITS],[hlt its library])
728
729 ALIITS_LIBS=
730 CHECK_HLTMODULE([its],
731                 [], [$ALIROOT_CPPFLAGS],
732                 [], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS],
733                 [], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
734                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
735
736 if test "x$enable_module" = "xmissheader"; then
737   enable_module="no...header.missing"
738   enable_its="no...header.missing"
739 elif test "x$enable_module" = "xforce"; then
740   enable_its="yes"
741 else
742   enable_its=$enable_module
743 fi
744
745 if test "x$enable_its" = "xyes" ; then 
746   AC_DEFINE(HLT_ITS)
747   ALIITS_LIBS=$ALIHLTMODULE_LIBS
748 fi
749 AM_CONDITIONAL(EN_HLT_ITS, test x$enable_its = xyes)
750 AC_MSG_CHECKING([whether to compile ITS library])
751 AC_MSG_RESULT([$enable_module])
752 AC_SUBST([ALIITS_LIBS])
753
754 dnl ------------------------------------------------------------------
755 AH_TEMPLATE([HLT_COMP],[hlt comp library])
756
757 ALICOMP_LIBS=
758 CHECK_HLTMODULE([comp],
759                 [], [$ALIROOT_CPPFLAGS],
760                 [], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS],
761                 [], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
762                 [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
763
764 if test "x$enable_module" = "xmissheader"; then
765   enable_module="no...header.missing"
766   enable_comp="no...header.missing"
767 elif test "x$enable_module" = "xforce"; then
768   enable_comp="yes"
769 else
770   enable_comp=$enable_module
771 fi
772
773 if test "x$enable_comp" = "xyes" ; then 
774   AC_DEFINE(HLT_COMP)
775   ALICOMP_LIBS=$ALIHLTMODULE_LIBS
776 fi
777 AM_CONDITIONAL(EN_HLT_COMP, test x$enable_comp = xyes)
778 AC_MSG_CHECKING([whether to compile comp library])
779 AC_MSG_RESULT([$enable_module])
780 AC_SUBST([ALICOMP_LIBS])
781
782 dnl ------------------------------------------------------------------
783 AC_MSG_CHECKING([whether to disable AliRoot logging])
784 AH_TEMPLATE([NOALIROOT_LOGGING],[disable AliRoot logging])
785 AC_ARG_ENABLE(aliroot-logging,
786   [AC_HELP_STRING([--disable-aliroot-logging],
787       [disable logging through AliRoot logging methods])],
788   [],[enable_aliroot_logging=no])
789 if test "x$have_aliroot" = "xno" ; then
790   enable_aliroot_logging=yes # this means 'disable'
791 fi
792 if test "x$enable_aliroot_logging" != "xno" ; then 
793   AC_DEFINE(NOALIROOT_LOGGING)
794 fi
795 AM_CONDITIONAL(NOALIROOT_LOGGING, test x$enable_aliroot_logging != no)
796 AC_MSG_RESULT([$enable_aliroot_logging])
797
798 dnl ------------------------------------------------------------------
799 AC_MSG_CHECKING([whether to enable saving MC data through the chain])
800 AH_TEMPLATE([DOMC],[MC saving])
801 AC_ARG_ENABLE(mc-saving,
802   [AC_HELP_STRING([--enable-mc-saving],
803       [enable saving MC data through the chain])],
804   [],[enable_mc_saving=no])
805 if test "x$enable_mc_saving" = "xyes" ; then 
806   AC_DEFINE(DOMC)
807 fi
808 AC_MSG_RESULT([$enable_mc_saving])
809
810 dnl ------------------------------------------------------------------
811 dnl certainly something old, but we keep the define
812 AC_MSG_CHECKING([whether to use ROWHOUGH])
813 AH_TEMPLATE([USEROWHOUGH],[HLT ROWHOUGH])
814 AC_ARG_ENABLE(rowhough,
815   [AC_HELP_STRING([--enable-rowhough],
816       [use ROWHOUGH ])],
817   [],[enable_rowhough=no])
818 if test "x$enable_rowhough" = "xyes" ; then 
819   AC_DEFINE(USEROWHOUGH)
820 fi
821 AC_MSG_RESULT([$enable_rowhough])
822
823 dnl ------------------------------------------------------------------
824 dnl The ROOTVERSION and ALIROOTVERSION defines were used by the old
825 dnl stand-alone build system. This is most likely something old we can
826 dnl get rid off later, or do something more reasonable. Since the define
827 dnl needs the quotes they have to be  escaped. This works well for the
828 dnl Makefile but not for the configure script. So we have to add the
829 dnl defines after all the other checks.
830 CPPFLAGS="$CPPFLAGS -DROOTVERSION=\\\"`${ROOTCONF} --version`\\\""
831 if test ! "x$have_aliroot" = "xno" ; then
832   CPPFLAGS="$CPPFLAGS -DALIROOTVERSION=\\\"Unknown\\\""
833 fi
834
835 dnl ------------------------------------------------------------------
836 dnl
837 dnl Documentation
838 dnl
839 AC_ARG_VAR(DOXYGEN, The Documentation Generator)
840 AC_PATH_PROG(PERL, perl)
841 AC_PATH_PROG(DOXYGEN, doxygen)
842 AM_CONDITIONAL(HAVE_DOXYGEN, test ! "x$DOXYGEN" = "x")
843 AC_ARG_ENABLE(dot,
844   [AC_HELP_STRING([--enable-dot],
845       [enable dot documentation generator])],
846   [],[enable_dot=no])
847 HAVE_DOT=NO
848 DOT_PATH=
849 AC_PATH_PROG(DOT, dot)
850 if test "x$DOT" != "x" && test "x$enable_dot" = "xyes" ; then
851    HAVE_DOT=YES
852    DOT_PATH=`dirname $DOT`
853 fi
854 AC_SUBST([HAVE_DOT])
855 AC_SUBST([DOT_PATH])
856
857 dnl HAVE_SRC_SUBDIR=${abs_top_srcdir}/src
858 dnl echo $HAVE_SRC_SUBDIR
859 dnl if ! test -d $HAVE_SRC_SUBDIR; then
860 dnl   HAVE_SRC_SUBDIR=
861 dnl fi
862 dnl AC_SUBST([HAVE_SRC_SUBDIR])
863
864 dnl ------------------------------------------------------------------
865 dnl inatallation directory for libraries
866 dnl 
867 if test "x$prefix" != "xNONE" && test $ALICE_ROOT = $prefix ; then
868 libdir=\${exec_prefix}/lib/tgt_$ALICE_TARGET
869 AC_MSG_NOTICE([libdir set to $libdir])
870 fi
871 dnl ------------------------------------------------------------------
872 AC_CONFIG_FILES([Makefile 
873                  BASE/Makefile
874                  BASE/setenv.sh
875                  BASE/setenv.csh
876                  BASE/HOMER/Makefile
877                  BASE/util/Makefile
878                  BASE/interface/Makefile
879                  BASE/test/Makefile
880                  sim/Makefile
881                  rec/Makefile
882                  shuttle/Makefile
883                  SampleLib/Makefile
884                  TPCLib/Makefile
885                  TPCLib/test/Makefile
886                  TPCLib/mapping2array.cxx
887                  TPCLib/OnlineDisplay/Makefile
888                  RCU/Makefile
889                  RCU/test/Makefile
890                  PHOS/Makefile
891                  TRD/Makefile
892                  MUON/Makefile
893                  trigger/Makefile
894                  ITS/Makefile
895                  comp/Makefile
896                  doc/Makefile
897                  doc/doxygen.conf
898                  doc/doxymodule.conf])
899
900
901 AC_OUTPUT
902 dnl
903 dnl EOF
904 dnl
905