ab1876e82de5eb6d8ad66449cae26c0d9a6d471f
[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.3], [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 LDFLAGS="$LDFLAGS -L${ROOTLIBDIR} ${ROOTLIBS}"
48
49 dnl ------------------------------------------------------------------
50 dnl check for AliRoot features
51 AC_LANG_PUSH(C++)
52 AC_MSG_CHECKING([for AliRoot])
53 have_aliroot=no
54 with_aliroot=yes
55 if test "x$with_aliroot" = "xyes" || test "x$with_aliroot" = "x" ; then
56   ALIROOTLIBDIR=${ALICE_ROOT}/lib/tgt_${ALICE_TARGET}
57   ALIROOTINCDIR=${ALICE_ROOT}/include
58 elif test "x$with_aliroot" != "xno" ; then
59   # TODO: think about the tgt_* subfolder
60   ALICE_ROOT="$with_aliroot"
61   ALIROOTLIBDIR="$ALICE_ROOT/lib"
62   ALIROOTINCDIR="$ALICE_ROOT/include"
63 fi
64 if test "x$ALICE_ROOT" != "x" \
65    && test -d ${ALIROOTLIBDIR} \
66    && test -d ${ALIROOTINCDIR}; then
67   have_aliroot=$ALICE_ROOT
68 else
69   ALIROOTLIBDIR=
70   ALIROOTINCDIR=
71 fi
72 AC_MSG_RESULT([$have_aliroot])
73
74 if test ! "x$have_aliroot" = "xno" ; then
75   # we check for the libSTEER library which is linked to
76   # - the ROOT libs libGeom libMinuit libVMC libEG
77   # - the AliRoot libESD libRAWData (libRAWDatarec from v4-04-Rev-07)
78   # - ROOT libCint needs also libdl
79   ALIROOT_CPPFLAGS="-I${ALIROOTINCDIR} -I${ALICE_ROOT}/RAW"
80   ALIROOT_LDFLAGS="-L${ALIROOTLIBDIR}"
81   ALIROOT_LIBS="-lESD -lGeom -lMinuit -lVMC -lEG -ldl -lSTEER"
82   save_CPPFLAGS=$CPPFLAGS
83   save_LDFLAGS=$LDFLAGS
84   save_LIBS=$LIBS
85   CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS"
86   LDFLAGS="$save_LDFLAGS $ALIROOT_LDFLAGS"
87   LIBS="$save_LIBS $ALIROOT_LIBS"
88  
89   # check for certain AliRoot libraries/files/features
90   if test ! "x$have_aliroot" = "xno" ; then
91     # the RAWReader classe are needed by the TPCLib/AliHLTTPCDigitReaderPacket
92     # and by the STEER library. From version v4-04-Rev-07 on the RawReader classes
93     # are in libRAWDatarec, before in libRAWData
94     have_alirawdata=yes
95     AC_MSG_CHECKING(for AliRawReader classes in RAWData libraries)
96     if test ! "x$have_alirawdata" = "xno" ; then
97       CHECKLIB="-lRAWDatarec"
98       LIBS="$save_LIBS $ALIROOT_LIBS -lRAWDatabase $CHECKLIB"
99       AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliRawReaderMemory.h>
100                                        #include <AliRawReaderFile.h>
101                                        #include <AliRawReaderDate.h>
102                                        #include <AliRawReaderRoot.h>], 
103                                       [AliRawReaderMemory mreader;
104                                        AliRawReaderFile freader;
105                                        AliRawReaderDate dreader(NULL,0);
106                                        AliRawReaderRoot rreader(NULL,0)])],
107                                       [AC_DEFINE(HAVE_ALIRAWDATA)
108                                        ALIROOT_LIBS="$ALIROOT_LIBS -lRAWDatabase $CHECKLIB"
109                                        have_alirawdata=$CHECKLIB], 
110                                       [have_alirawdata=no])
111       # second pass with -RAWData
112       if test "x$have_alirawdata" = "xno" ; then
113         CHECKLIB="-lRAWData"
114         LIBS="$save_LIBS $ALIROOT_LIBS $CHECKLIB"
115         AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliRawReaderMemory.h>
116                                        #include <AliRawReaderFile.h>
117                                        #include <AliRawReaderDate.h>
118                                        #include <AliRawReaderRoot.h>], 
119                                         [AliRawReaderMemory mreader;
120                                        AliRawReaderFile freader;
121                                        AliRawReaderDate dreader(NULL,0);
122                                        AliRawReaderRoot rreader(NULL,0);])],
123                                         [AC_DEFINE(HAVE_ALIRAWDATA)
124                                        ALIROOT_LIBS="$ALIROOT_LIBS $CHECKLIB"
125                                        have_alirawdata=$CHECKLIB], 
126                                       [have_alirawdata=no])
127       fi
128     fi
129     AC_MSG_RESULT($have_alirawdata)
130   fi
131
132   have_alisteer=yes
133   #AC_CHECK_HEADERS([AliRun.h],[have_alisteer=yes])
134   AC_MSG_CHECKING(for AliRun in -lSTEER)
135   if test "x$have_alisteer" = "xyes" ; then
136     AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliRun.h>], [AliRun aliroot])],
137                                     [AC_DEFINE(HAVE_ALISTEER)], 
138                                     [have_alisteer=no
139                                      have_aliroot=no])
140   fi
141   AC_MSG_RESULT($have_alisteer)
142
143   if test ! "x$have_aliroot" = "xno" ; then
144     # the HLTTPCLib needs to link agains TPCbase and TPCrec
145     # TPC library for AliTPCParam and AliSimDigits used in 
146     # AliHLTTPCFileHandler.h and AliHLTTPCDisplay.cxx
147     saveALIROOT_CPPFLAGS="$ALIROOT_CPPFLAGS"
148     ALIROOT_CPPFLAGS="$saveALIROOT_CPPFLAGS -I${ALICE_ROOT}/TPC"
149     CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS"
150     have_alitpc=yes
151     AC_MSG_CHECKING(for required classes in TPC libraries)
152     if test ! "x$have_alitpc" = "xno" ; then
153       save_ALIROOT_LIBS=$ALIROOT_LIBS
154       ALIROOT_LIBS="$save_ALIROOT_LIBS -lTPCbase -lTPCrec"
155       LIBS="$save_LIBS $ALIROOT_LIBS"
156       AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliSimDigits.h>
157                                        #include <AliTPCParam.h>
158                                        #include <AliTPCParamSR.h>
159                                        #include <AliTPCDigitsArray.h>
160                                        #include <AliTPCClustersArray.h>
161                                        #include <AliTPCcluster.h>     
162                                        #include <AliTPCClustersRow.h>], 
163                                       [AliSimDigits dig;
164                                        AliTPCParam param;
165                                        AliTPCParamSR paramsr;
166                                        AliTPCDigitsArray digarray;
167                                        AliTPCClustersArray clustarray;
168                                        AliTPCcluster clust;
169                                        AliTPCClustersRow row])],
170                                       [AC_DEFINE(HAVE_ALITPC)
171                                        saveALIROOT_CPPFLAGS=$ALIROOT_CPPFLAGS
172                                        saveALIROOT_LIBS=$ALIROOT_LIBS], 
173                                       [have_alitpc=no
174                                        ALIROOT_CPPFLAGS=$saveALIROOT_CPPFLAGS
175                                        ALIROOT_LIBS=$saveALIROOT_LIBS])
176     fi
177     AC_MSG_RESULT($have_alitpc)
178   fi
179
180   if test ! "x$have_alirawdata" = "xno" ; then
181     # check for header files needed by the TPCLib/AliHLTTPCDigitReaderPacket
182     # the header file has been moved to the TPC module
183     CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS"
184     # AliRawReaderMemory.h AliRawReaderFile.h already checked
185     #AC_CHECK_HEADERS([AliRawReaderMemory.h AliRawReaderFile.h AliTPCRawStream.h])
186     AC_CHECK_HEADERS([AliTPCRawStream.h])
187   fi
188
189   if test "x$have_aliroot" = "xno" ; then
190     ALIROOT_CPPFLAGS=
191     ALIROOT_LDFLAGS=
192     ALIROOT_LIBS=
193   fi
194   CPPFLAGS=$save_CPPFLAGS
195   LDFLAGS=$save_LDFLAGS
196   LIBS=$save_LIBS
197   if test ! "x$have_aliroot" = "xno" ; then
198     CPPFLAGS="$CPPFLAGS -DALIROOTVERSION=\\\"Unknown\\\""
199   fi
200 fi
201 AC_LANG_POP(C++)
202 AC_SUBST([ALIROOT_CPPFLAGS])
203 AC_SUBST([ALIROOT_LDFLAGS])
204 AC_SUBST([ALIROOT_LIBS])
205 CPPFLAGS="$CPPFLAGS -DROOTVERSION=\\\"`${ROOTCONF} --version`\\\""
206
207 dnl ------------------------------------------------------------------
208 AC_MSG_CHECKING([whether to impose strict coding conventions])
209 AC_ARG_ENABLE(strict,
210   [AC_HELP_STRING([--enable-strict],
211       [enable coding convention checks ])],
212   [],[enable_strict=no])
213 if test "x$enable_strict" = "xyes" ; then
214    CPPFLAGS="$CPPFLAGS -Weffc++"
215 fi
216 AC_MSG_RESULT([$enable_strict])
217
218 dnl ------------------------------------------------------------------
219 AC_MSG_CHECKING([whether to compile sample library])
220 AH_TEMPLATE([HLT_SAMPLE],[hlt sample library])
221 AC_ARG_ENABLE(sample,
222   [AC_HELP_STRING([--enable-sample],
223       [compile the sample library ])],
224   [],[enable_sample=yes])
225 if test "x$enable_sample" = "xyes" ; then 
226   AC_DEFINE(HLT_SAMPLE)
227 fi
228 AM_CONDITIONAL(EN_HLT_SAMPLE, test x$enable_sample = xyes)
229 AC_MSG_RESULT([$enable_sample])
230
231 dnl ------------------------------------------------------------------
232 AC_MSG_CHECKING([whether to compile tpc library])
233 AH_TEMPLATE([HLT_TPC],[hlt tpc library])
234 AC_ARG_ENABLE(tpc,
235   [AC_HELP_STRING([--enable-tpc],
236       [compile the tpc library ])],
237   [],[enable_tpc=yes])
238 if test "x$have_aliroot" = "xno" ; then
239    enable_tpc="no...requires.AliRoot"
240 elif test "x$have_alitpc" = "xno" ; then
241    enable_tpc="no...requires.AliRoot.TPC.libraries"
242 fi
243 if test "x$enable_tpc" = "xyes" ; then 
244   AC_DEFINE(HLT_TPC)
245 fi
246 AM_CONDITIONAL(EN_HLT_TPC, test x$enable_tpc = xyes)
247 AC_MSG_RESULT([$enable_tpc])
248
249 dnl ------------------------------------------------------------------
250 if test "x$enable_tpc" = "xyes" ; then 
251   AC_MSG_CHECKING([whether to compile tpc reference library])
252   AH_TEMPLATE([HLT_TPCREF],[hlt tpc reference library])
253   AC_ARG_ENABLE(tpcref,
254     [AC_HELP_STRING([--enable-tpcref],
255         [compile the tpc reference library ])],
256     [],[enable_tpcref=no])
257   if test "x$enable_tpcref" = "xyes" ; then 
258     AC_DEFINE(HLT_TPCREF)
259   fi
260   AC_MSG_RESULT([$enable_tpcref])
261 fi
262 AM_CONDITIONAL(EN_HLT_TPCREF, test x$enable_tpcref = xyes)
263
264 dnl ------------------------------------------------------------------
265 AC_MSG_CHECKING([whether to enable HLT logging])
266 AH_TEMPLATE([NOLOGGING],[disable hlt logging])
267 AC_ARG_ENABLE(logging,
268   [AC_HELP_STRING([--enable-logging],
269       [enable logging])],
270   [],[enable_logging=yes])
271 if test "x$enable_logging" != "xyes" ; then 
272   AC_DEFINE(NOLOGGING)
273 fi
274 AC_MSG_RESULT([$enable_logging])
275
276 dnl ------------------------------------------------------------------
277 AC_MSG_CHECKING([whether to enable saving MC data through the chain])
278 AH_TEMPLATE([DOMC],[MC saving])
279 AC_ARG_ENABLE(mc-saving,
280   [AC_HELP_STRING([--enable-mc-saving],
281       [enable saving MC data through the chain])],
282   [],[enable_mc_saving=no])
283 if test "x$enable_mc_saving" = "xyes" ; then 
284   AC_DEFINE(DOMC)
285 fi
286 AC_MSG_RESULT([$enable_mc_saving])
287
288 dnl ------------------------------------------------------------------
289 AC_MSG_CHECKING([whether to enable AliRoot NEWIO])
290 AH_TEMPLATE([use_newio],[AliRoot NEWIO])
291 AC_ARG_ENABLE(newio,
292   [AC_HELP_STRING([--enable-newio],
293       [enable AliRoot NEWIO ])],
294   [],[enable_newio=yes])
295 if test "x$enable_newio" = "xyes" ; then 
296   AC_DEFINE(use_newio)
297 fi
298 AC_MSG_RESULT([$enable_newio])
299
300 dnl ------------------------------------------------------------------
301 dnl certainly something old, but we keep the define
302 AC_MSG_CHECKING([whether to use ROWHOUGH])
303 AH_TEMPLATE([USEROWHOUGH],[HLT ROWHOUGH])
304 AC_ARG_ENABLE(rowhough,
305   [AC_HELP_STRING([--enable-rowhough],
306       [use ROWHOUGH ])],
307   [],[enable_rowhough=no])
308 if test "x$enable_rowhough" = "xyes" ; then 
309   AC_DEFINE(USEROWHOUGH)
310 fi
311 AC_MSG_RESULT([$enable_rowhough])
312
313 dnl ------------------------------------------------------------------
314 dnl
315 dnl Documentation
316 dnl
317 AC_ARG_VAR(DOXYGEN, The Documentation Generator)
318 AC_PATH_PROG(PERL, perl)
319 AC_PATH_PROG(DOXYGEN, doxygen)
320 AM_CONDITIONAL(HAVE_DOXYGEN, test ! "x$DOXYGEN" = "x")
321 HAVE_DOT=NO
322 DOT_PATH=
323 AC_PATH_PROG(DOT, dot)
324 if ! test "x$DOT" = "x" ; then
325    HAVE_DOT=YES
326    DOT_PATH=`dirname $DOT`
327 fi
328 AC_SUBST([HAVE_DOT])
329 AC_SUBST([DOT_PATH])
330
331 dnl ------------------------------------------------------------------
332 AC_CONFIG_FILES([Makefile 
333                  BASE/Makefile
334                  SampleLib/Makefile
335                  TPCLib/Makefile
336                  TPCLib/Ref/Makefile
337                  doc/Makefile
338                  doc/doxygen.conf])
339
340
341 AC_OUTPUT
342 dnl
343 dnl EOF
344 dnl
345