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