extensions in AliHLTTPCDisplay
[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   ALIROOT_CPPFLAGS="-I${ALIROOTINCDIR} -I${ALICE_ROOT}/RAW"
105   ALIROOT_LDFLAGS="-L${ALIROOTLIBDIR}"
106   ALIROOT_LIBS="-lESD -lGeom -lMinuit -lVMC -lEG -ldl"
107   save_CPPFLAGS=$CPPFLAGS
108   save_LDFLAGS=$LDFLAGS
109   save_LIBS=$LIBS
110   CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS"
111   LDFLAGS="$save_LDFLAGS -L${ROOTLIBDIR} $ALIROOT_LDFLAGS"
112   
113   # check for certain AliRoot libraries/files/features
114   # CBD library is present since AliRoot version v4-05-00 (02.06.2006)
115   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
116   CHECKLIB=CDB
117   AC_CHECK_LIB([$CHECKLIB],[_init],[ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"])
118
119   # splitted RAW libraries since AliRoot version v4-04-Rev-07 (09.08.2006)
120   have_alirawdata=no
121   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
122   CHECKLIB=RAWDatabase
123   AC_CHECK_LIB([$CHECKLIB],[_init],
124         [ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"
125          LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
126          CHECKLIB=RAWDatarec
127          AC_CHECK_LIB([$CHECKLIB],[_init],
128                [ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"
129                 AC_DEFINE(HAVE_ALIRAWDATA)
130                 have_alirawdata=$CHECKLIB])],
131         [# second pass with -RAWData
132          CHECKLIB="-lRAWData"
133          LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS $CHECKLIB -lSTEER"
134          AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliRawReaderMemory.h>
135                                        #include <AliRawReaderFile.h>
136                                        #include <AliRawReaderDate.h>
137                                        #include <AliRawReaderRoot.h>], 
138                                      [AliRawReaderMemory mreader;
139                                        AliRawReaderFile freader;
140                                        AliRawReaderDate dreader(NULL,0);
141                                        AliRawReaderRoot rreader(NULL,0);])],
142                                      [AC_DEFINE(HAVE_ALIRAWDATA)
143                                        ALIROOT_LIBS="$ALIROOT_LIBS $CHECKLIB"
144                                        have_alirawdata=$CHECKLIB], 
145                                       [have_alirawdata=no])
146         ]) dnl AC_CHECK_LIB RAWDatabase
147   AC_MSG_CHECKING(for AliRawReader classes in RAWData libraries)
148   AC_MSG_RESULT($have_alirawdata)
149
150   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
151   CHECKLIB=STEER
152   AC_CHECK_LIB([$CHECKLIB],[_init],[ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"])
153
154   if test ! "x$have_aliroot" = "xno" ; then
155     # the HLTTPCLib needs to link agains TPCbase and TPCrec
156     # TPC library for AliTPCParam and AliSimDigits used in 
157     # AliHLTTPCFileHandler.h and AliHLTTPCDisplay.cxx
158     saveALIROOT_CPPFLAGS="$ALIROOT_CPPFLAGS"
159     ALIROOT_CPPFLAGS="$saveALIROOT_CPPFLAGS -I${ALICE_ROOT}/TPC"
160     CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS"
161     have_alitpc=yes
162     AC_MSG_CHECKING(for required classes in TPC libraries)
163     if test ! "x$have_alitpc" = "xno" ; then
164       save_ALIROOT_LIBS=$ALIROOT_LIBS
165       ALIROOT_LIBS="$save_ALIROOT_LIBS -lTPCbase -lTPCrec"
166       LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS"
167       AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliSimDigits.h>
168                                        #include <AliTPCParam.h>
169                                        #include <AliTPCParamSR.h>
170                                        #include <AliTPCDigitsArray.h>
171                                        #include <AliTPCClustersArray.h>
172                                        #include <AliTPCcluster.h>     
173                                        #include <AliTPCClustersRow.h>], 
174                                       [AliSimDigits dig;
175                                        AliTPCParam param;
176                                        AliTPCParamSR paramsr;
177                                        AliTPCDigitsArray digarray;
178                                        AliTPCClustersArray clustarray;
179                                        AliTPCcluster clust;
180                                        AliTPCClustersRow row])],
181                                       [AC_DEFINE(HAVE_ALITPC)
182                                        saveALIROOT_CPPFLAGS=$ALIROOT_CPPFLAGS
183                                        saveALIROOT_LIBS=$ALIROOT_LIBS], 
184                                       [have_alitpc=no
185                                        ALIROOT_CPPFLAGS=$saveALIROOT_CPPFLAGS
186                                        ALIROOT_LIBS=$saveALIROOT_LIBS])
187     fi
188     AC_MSG_RESULT($have_alitpc)
189   fi
190
191   if test ! "x$have_alirawdata" = "xno" ; then
192     # check for header files needed by the TPCLib/AliHLTTPCDigitReaderPacket
193     # the header file has been moved to the TPC module
194     CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS"
195     # AliRawReaderMemory.h AliRawReaderFile.h already checked
196     #AC_CHECK_HEADERS([AliRawReaderMemory.h AliRawReaderFile.h AliTPCRawStream.h])
197     AC_CHECK_HEADERS([AliTPCRawStream.h])
198   fi
199
200   have_tpc_mapping=no
201   if test ! "x$have_aliroot" = "xno" ; then
202     # the TPCLib/AliHLTTPCRawReader needs the actual Pad layot of the TPC 
203     # which is stored in the TPC/mapping/Patchx.data files from
204     # AliRoot version v4-04-Release (May 2006)
205     AH_TEMPLATE([HAVE_TPC_MAPPING],[TPC pad mapping available])
206     TPC_PAD_MAPPING_PATH=$have_aliroot/TPC/mapping
207     AC_CHECK_FILE( [$TPC_PAD_MAPPING_PATH/Patch0.data], 
208                    [have_tpc_mapping=yes
209                     AC_SUBST(TPC_PAD_MAPPING_PATH)
210                     AC_DEFINE(HAVE_TPC_MAPPING)],
211                    [])
212     
213   fi
214   AC_MSG_CHECKING([for TPC mapping layout])
215   AM_CONDITIONAL(USE_TPC_MAPPING, test x$have_tpc_mapping = xyes)
216   AC_MSG_RESULT([$have_tpc_mapping])
217   
218   if test "x$have_aliroot" = "xno" ; then
219     ALIROOT_CPPFLAGS=
220     ALIROOT_LDFLAGS=
221     ALIROOT_LIBS=
222   fi
223   CPPFLAGS=$save_CPPFLAGS
224   LDFLAGS=$save_LDFLAGS
225   LIBS=$save_LIBS
226   if test ! "x$have_aliroot" = "xno" ; then
227     CPPFLAGS="$CPPFLAGS -DALIROOTVERSION=\\\"Unknown\\\""
228   fi
229 fi
230 AC_LANG_POP(C++)
231 AC_SUBST([ALIROOT_CPPFLAGS])
232 AC_SUBST([ALIROOT_LDFLAGS])
233 AC_SUBST([ALIROOT_LIBS])
234 CPPFLAGS="$CPPFLAGS -DROOTVERSION=\\\"`${ROOTCONF} --version`\\\""
235
236 dnl ------------------------------------------------------------------
237 dnl check for the HLT PubSub Framework
238 AC_MSG_CHECKING([for HLT PubSub Framework])
239 AC_ARG_WITH(pubsub, [installation path of the HLT PubSub framework],
240                     [],
241                     [ test -n $ALIHLT_DC_DIR && with_pubsub=$ALIHLT_DC_DIR ])
242 if test -z $with_pubsub || ! test -d $with_pubsub ; then
243   with_pubsub=no
244 fi
245 AC_MSG_RESULT([$with_pubsub])
246
247 AH_TEMPLATE([HAVE_HOMERREADER],[the HLT PubSub Homer Reader interface])
248 if test "x$with_pubsub" != "xno" ; then
249   save_CPPFLAGS=$CPPFLAGS
250   save_LDFLAGS=$LDFLAGS
251   save_LIBS=$LIBS
252   # currently the different versions of the HLT PubSub framework have a different
253   # directory layout
254   if test -d ${with_pubsub}/include/HOMER ; then
255     HOMER_CPPFLAGS="-I${with_pubsub}/include/HOMER -I${with_pubsub}/include/HOMER/reader"
256   else
257     HOMER_CPPFLAGS="-I${with_pubsub}/src/Util/HOMER/reader/include -I${with_pubsub}/src/Util/HOMER/data/include"
258   fi
259   HOMER_LDFLAGS="-L${with_pubsub}/lib/`uname -s`-`uname -m`"
260   CPPFLAGS="$save_CPPFLAGS $HOMER_CPPFLAGS"
261   LDFLAGS="$save_LDFLAGS $HOMER_LDFLAGS"
262   LIBS="$save_LIBS "
263   with_homer=no
264   AC_LANG_PUSH(C++)
265   AC_CHECK_HEADER([HOMERReader.h],
266     [ AC_CHECK_LIB([HOMERReader],[_init],[with_homer=yes])])
267   AC_LANG_POP(C++)
268   if test "x$with_homer" = "xno" ; then
269     HOMER_CPPFLAGS=
270     HOMER_LDFLAGS=
271   else
272     AC_DEFINE(HAVE_HOMERREADER)
273   fi
274   CPPFLAGS="$save_CPPFLAGS"
275   LDFLAGS="$save_LDFLAGS"
276   LIBS="$save_LIBS"  
277 fi
278 AC_SUBST([HOMER_CPPFLAGS])
279 AC_SUBST([HOMER_LDFLAGS])
280
281 dnl ------------------------------------------------------------------
282 AC_MSG_CHECKING([whether to impose strict coding conventions])
283 AC_ARG_ENABLE(strict,
284   [AC_HELP_STRING([--enable-strict],
285       [enable coding convention checks ])],
286   [],[enable_strict=no])
287 if test "x$enable_strict" = "xyes" ; then
288    CPPFLAGS="$CPPFLAGS -Weffc++"
289 fi
290 AC_MSG_RESULT([$enable_strict])
291
292 dnl ------------------------------------------------------------------
293 AC_MSG_CHECKING([whether to compile sample library])
294 AH_TEMPLATE([HLT_SAMPLE],[hlt sample library])
295 AC_ARG_ENABLE(sample,
296   [AC_HELP_STRING([--enable-sample],
297       [compile the sample library ])],
298   [],[enable_sample=yes])
299 if test "x$enable_sample" = "xyes" ; then 
300   AC_DEFINE(HLT_SAMPLE)
301 fi
302 AM_CONDITIONAL(EN_HLT_SAMPLE, test x$enable_sample = xyes)
303 AC_MSG_RESULT([$enable_sample])
304
305 dnl ------------------------------------------------------------------
306 AC_MSG_CHECKING([whether to compile tpc library])
307 AH_TEMPLATE([HLT_TPC],[hlt tpc library])
308 AC_ARG_ENABLE(tpc,
309   [AC_HELP_STRING([--enable-tpc],
310       [compile the tpc library ])],
311   [],[enable_tpc=yes])
312 if test "x$have_aliroot" = "xno" ; then
313    enable_tpc="no...requires.AliRoot"
314 elif test "x$have_alitpc" = "xno" ; then
315    enable_tpc="no...requires.AliRoot.TPC.libraries"
316 fi
317 if test "x$enable_tpc" = "xyes" ; then 
318   AC_DEFINE(HLT_TPC)
319 fi
320 AM_CONDITIONAL(EN_HLT_TPC, test x$enable_tpc = xyes)
321 AC_MSG_RESULT([$enable_tpc])
322
323 dnl ------------------------------------------------------------------
324 AC_MSG_CHECKING([whether to enable HLT logging])
325 AH_TEMPLATE([NOLOGGING],[disable hlt logging])
326 AC_ARG_ENABLE(logging,
327   [AC_HELP_STRING([--enable-logging],
328       [enable logging])],
329   [],[enable_logging=yes])
330 if test "x$enable_logging" != "xyes" ; then 
331   AC_DEFINE(NOLOGGING)
332 fi
333 AC_MSG_RESULT([$enable_logging])
334
335 dnl ------------------------------------------------------------------
336 AC_MSG_CHECKING([whether to enable saving MC data through the chain])
337 AH_TEMPLATE([DOMC],[MC saving])
338 AC_ARG_ENABLE(mc-saving,
339   [AC_HELP_STRING([--enable-mc-saving],
340       [enable saving MC data through the chain])],
341   [],[enable_mc_saving=no])
342 if test "x$enable_mc_saving" = "xyes" ; then 
343   AC_DEFINE(DOMC)
344 fi
345 AC_MSG_RESULT([$enable_mc_saving])
346
347 dnl ------------------------------------------------------------------
348 AC_MSG_CHECKING([whether to enable AliRoot NEWIO])
349 AH_TEMPLATE([use_newio],[AliRoot NEWIO])
350 AC_ARG_ENABLE(newio,
351   [AC_HELP_STRING([--enable-newio],
352       [enable AliRoot NEWIO ])],
353   [],[enable_newio=yes])
354 if test "x$enable_newio" = "xyes" ; then 
355   AC_DEFINE(use_newio)
356 fi
357 AC_MSG_RESULT([$enable_newio])
358
359 dnl ------------------------------------------------------------------
360 dnl certainly something old, but we keep the define
361 AC_MSG_CHECKING([whether to use ROWHOUGH])
362 AH_TEMPLATE([USEROWHOUGH],[HLT ROWHOUGH])
363 AC_ARG_ENABLE(rowhough,
364   [AC_HELP_STRING([--enable-rowhough],
365       [use ROWHOUGH ])],
366   [],[enable_rowhough=no])
367 if test "x$enable_rowhough" = "xyes" ; then 
368   AC_DEFINE(USEROWHOUGH)
369 fi
370 AC_MSG_RESULT([$enable_rowhough])
371
372 dnl ------------------------------------------------------------------
373 dnl
374 dnl Documentation
375 dnl
376 AC_ARG_VAR(DOXYGEN, The Documentation Generator)
377 AC_PATH_PROG(PERL, perl)
378 AC_PATH_PROG(DOXYGEN, doxygen)
379 AM_CONDITIONAL(HAVE_DOXYGEN, test ! "x$DOXYGEN" = "x")
380 HAVE_DOT=NO
381 DOT_PATH=
382 AC_PATH_PROG(DOT, dot)
383 if ! test "x$DOT" = "x" ; then
384    HAVE_DOT=YES
385    DOT_PATH=`dirname $DOT`
386 fi
387 AC_SUBST([HAVE_DOT])
388 AC_SUBST([DOT_PATH])
389
390 dnl ------------------------------------------------------------------
391 dnl inatallation directory for libraries
392 dnl 
393 if test "x$prefix" != "xNONE" && test $ALICE_ROOT = $prefix ; then
394 libdir=\${exec_prefix}/lib/tgt_$ALICE_TARGET
395 AC_MSG_NOTICE([libdir set to $libdir])
396 fi
397 dnl ------------------------------------------------------------------
398 AC_CONFIG_FILES([Makefile 
399                  BASE/Makefile
400                  SampleLib/Makefile
401                  TPCLib/Makefile
402                  TPCLib/mapping2array.cxx
403                  TPCLib/OnlineDisplay/Makefile
404                  doc/Makefile
405                  doc/doxygen.conf])
406
407
408 AC_OUTPUT
409 dnl
410 dnl EOF
411 dnl
412