]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/acinclude.m4
bugfix: boundery check for static hit array
[u/mrichter/AliRoot.git] / HLT / acinclude.m4
CommitLineData
b521659f 1dnl
2dnl $Id$
3dnl
4dnl Copyright (C) 2002 Christian Holm Christensen <cholm@nbi.dk>
5dnl
6dnl This library is free software; you can redistribute it and/or
7dnl modify it under the terms of the GNU Lesser General Public License
8dnl as published by the Free Software Foundation; either version 2.1
9dnl of the License, or (at your option) any later version.
10dnl
11dnl This library is distributed in the hope that it will be useful,
12dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14dnl Lesser General Public License for more details.
15dnl
16dnl You should have received a copy of the GNU Lesser General Public
17dnl License along with this library; if not, write to the Free
18dnl Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19dnl 02111-1307 USA
20dnl
21dnl ------------------------------------------------------------------
22AC_DEFUN([AC_DEBUG],
23[
24 AC_REQUIRE([AC_PROG_CC])
25 AC_REQUIRE([AC_PROG_CXX])
26 AC_MSG_CHECKING(whether to make debug objects)
27 AC_ARG_ENABLE(debug,
28 [AC_HELP_STRING([--enable-debug],[Enable debugging symbols in objects])],
1e27470a 29 [],[enable_debug=no])
b521659f 30 if test "x$enable_debug" = "xno" ; then
31 CFLAGS=`echo $CFLAGS | sed 's,-g,,'`
32 CXXFLAGS=`echo $CXXFLAGS | sed 's,-g,,'`
33 else
34 AC_DEFINE(__DEBUG)
35 case $CXXFLAGS in
36 *-g*) ;;
37 *) CXXFLAGS="$CXXFLAGS -g" ;;
38 esac
39 case $CFLAGS in
40 *-g*) ;;
41 *) CFLAGS="$CFLAGS -g" ;;
42 esac
43 fi
44 AC_MSG_RESULT($enable_debug 'CFLAGS=$CFLAGS')
45])
46
47dnl ------------------------------------------------------------------
48AC_DEFUN([AC_OPTIMIZATION],
49[
50 AC_REQUIRE([AC_PROG_CC])
51 AC_REQUIRE([AC_PROG_CXX])
52
53 AC_ARG_ENABLE(optimization,
f59fee6d 54 [AC_HELP_STRING([--disable-optimization],[Enable optimization of objects])],
b521659f 55 [],[enable_optimization=yes])
56
57 AC_MSG_CHECKING(for optimiztion level)
58
59 changequote(<<, >>)dnl
60 if test "x$enable_optimization" = "xno" ; then
61 CFLAGS=`echo $CFLAGS | sed 's,-O\([0-9][0-9]*\|\),,'`
62 CXXFLAGS=`echo $CXXFLAGS | sed 's,-O\([0-9][0-9]*\|\),,'`
63 elif test "x$enable_optimization" = "xyes" ; then
64 case $CXXFLAGS in
65 *-O*) ;;
66 *) CXXFLAGS="$CXXFLAGS -O2" ;;
67 esac
68 case $CFLAGS in
69 *-O*) ;;
70 *) CFLAGS="$CXXFLAGS -O2" ;;
71 esac
72 else
73 CFLAGS=`echo $CFLAGS | sed "s,-O\([0-9][0-9]*\|\),-O$enable_optimization,"`
74 CXXFLAGS=`echo $CXXFLAGS | sed "s,-O\([0-9][0-9]*\|\),-O$enable_optimization,"`
75 fi
76 changequote([, ])dnl
77 AC_MSG_RESULT($enable_optimization 'CFLAGS=$CFLAGS')
78])
79
80dnl ------------------------------------------------------------------
81
82dnl
83dnl Autoconf macro to check for existence or ROOT on the system
84dnl Synopsis:
85dnl
86dnl ROOT_PATH([MINIMUM-VERSION, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]])
87dnl
88dnl Some examples:
89dnl
90dnl ROOT_PATH(3.03/05, , AC_MSG_ERROR(Your ROOT version is too old))
91dnl ROOT_PATH(, AC_DEFINE([HAVE_ROOT]))
92dnl
93dnl The macro defines the following substitution variables
94dnl
95dnl ROOTCONF full path to root-config
96dnl ROOTEXEC full path to root
97dnl ROOTCINT full path to rootcint
98dnl ROOTLIBDIR Where the ROOT libraries are
99dnl ROOTINCDIR Where the ROOT headers are
100dnl ROOTCFLAGS Extra compiler flags
101dnl ROOTLIBS ROOT basic libraries
102dnl ROOTGLIBS ROOT basic + GUI libraries
103dnl ROOTAUXLIBS Auxilary libraries and linker flags for ROOT
104dnl ROOTAUXCFLAGS Auxilary compiler flags
105dnl ROOTRPATH Same as ROOTLIBDIR
106dnl
107dnl The macro will fail if root-config and rootcint isn't found.
108dnl
109dnl Christian Holm Christensen <cholm@nbi.dk>
110dnl
111AC_DEFUN([ROOT_PATH],
112[
113 AC_ARG_WITH(rootsys,
114 [ --with-rootsys top of the ROOT installation directory],
115 user_rootsys=$withval,
116 user_rootsys="none")
117 if test ! x"$user_rootsys" = xnone; then
118 rootbin="$user_rootsys/bin"
119 elif test ! x"$ROOTSYS" = x ; then
120 rootbin="$ROOTSYS/bin"
121 else
122 rootbin=$PATH
123 fi
124 AC_PATH_PROG(ROOTCONF, root-config , no, $rootbin)
125 AC_PATH_PROG(ROOTEXEC, root , no, $rootbin)
126 AC_PATH_PROG(ROOTCINT, rootcint , no, $rootbin)
127
128 if test ! x"$ROOTCONF" = "xno" && \
129 test ! x"$ROOTCINT" = "xno" ; then
130
131 # define some variables
132 ROOTLIBDIR=`$ROOTCONF --libdir`
133 ROOTINCDIR=`$ROOTCONF --incdir`
134 ROOTCFLAGS=`$ROOTCONF --noauxcflags --cflags`
135 ROOTLIBS=`$ROOTCONF --noauxlibs --noldflags --libs`
136 ROOTGLIBS=`$ROOTCONF --noauxlibs --noldflags --glibs`
137 ROOTAUXCFLAGS=`$ROOTCONF --auxcflags`
138 ROOTAUXLIBS=`$ROOTCONF --auxlibs`
139 ROOTRPATH=$ROOTLIBDIR
140
141 if test $1 ; then
142 AC_MSG_CHECKING(wether ROOT version >= [$1])
143 vers=`$ROOTCONF --version | tr './' ' ' | awk 'BEGIN { FS = " "; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'`
144 requ=`echo $1 | tr './' ' ' | awk 'BEGIN { FS = " "; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'`
145 if test $vers -lt $requ ; then
146 AC_MSG_RESULT(no)
147 no_root="yes"
148 else
149 AC_MSG_RESULT(yes)
150 fi
151 fi
152 else
153 # otherwise, we say no_root
154 no_root="yes"
155 fi
156
157 AC_SUBST(ROOTLIBDIR)
158 AC_SUBST(ROOTINCDIR)
159 AC_SUBST(ROOTCFLAGS)
160 AC_SUBST(ROOTLIBS)
161 AC_SUBST(ROOTGLIBS)
162 AC_SUBST(ROOTAUXLIBS)
163 AC_SUBST(ROOTAUXCFLAGS)
164 AC_SUBST(ROOTRPATH)
165
166 if test "x$no_root" = "x" ; then
167 ifelse([$2], , :, [$2])
168 else
169 ifelse([$3], , :, [$3])
170 fi
171])
172
f59fee6d 173dnl ------------------------------------------------------------------
174dnl
175dnl Autoconf macro to check conditions for an HLT module
176dnl - header dependencies
177dnl - library dependencies
178dnl - AliRoot availability
179dnl The macro also exports the --enable/--disable option for the
180dnl module.
181dnl
182dnl Synopsis:
183dnl
184dnl ROOT_PATH([module],
185dnl [headers], [additional CPPFLAGS],
186dnl [libraries], [LD flags], [LIBS],
187dnl [circ libraries], [LD flags], [LIBS])
188dnl
189dnl First argument is the module name.
190dnl
191dnl Arg 2 and 3 allow to check a list of header files and to specify
192dnl additional CPPFLAGS which might be necessary to perform the checks.
193dnl
194dnl Arg 4 to 6 allow to check a list of libraries, with additional
195dnl LDFLAGS and LIBS to be specified.
196dnl
197dnl Arg 7 to 9 is the same for libraries with circular dependencies
198dnl among each other.
199dnl
200dnl Return:
201dnl enable_module=yes
202dnl - AliRoot was found &&
203dnl - header files found &&
204dnl - module not disabled
205dnl
206dnl enable_module=no...requires.AliRoot
207dnl - AliRoot not found
208dnl
209dnl enable_module=missheader
210dnl - one of the specified header files is missing
211dnl
212dnl Libraries are probed and the variable ALIHLTMODULE_LIBS is set to
213dnl all libraries which could be found.
214dnl
215dnl Some examples:
216dnl
217dnl Matthias Richter <Matthias.Richter@uib.no>
218AC_DEFUN([CHECK_HLTMODULE],
219[
220AH_TEMPLATE([HLT_[$1]],[hlt [$1] library])
221AC_ARG_ENABLE([$1],
222 [AC_HELP_STRING([--disable-[$1]],
223 [ compile the $1 library ])],
c6b46c3f 224 [if test "x$enableval" = "xno";
225 then enable_module=no
226 else
227 enable_module=force
228 fi],
f59fee6d 229 [enable_module=yes
230 if test "x$have_aliroot" = "xno" ; then
231 enable_module="no...requires.AliRoot"
232 else
233 AC_MSG_NOTICE([checking dependencies for [$1] library])
234
235 AC_LANG_PUSH(C++)
236 save_CPPFLAGS="$CPPFLAGS"
237 save_LDFLAGS="$LDFLAGS"
238 save_LIBS="$LIBS"
239 CPPFLAGS="$save_CPPFLAGS [$3]"
240
241 AC_CHECK_HEADERS([$2], [], [enable_module="missheader"])
242
243 dnl ==========================================================================
244 dnl
245 dnl required header files and libraries for the AliHLTxxx library
246 dnl
247
248 dnl ROOT/AliRoot libs needed by libAliHLTxxx
249 CHECKLIBS="[$4]"
250 ALIHLTMODULE_LIBS=
251 LDFLAGS="$save_LDFLAGS [$5]"
252 for CHECKLIB in $CHECKLIBS ; do
253 LIBS="$save_LIBS $ROOTLIBS [$6] $ALIHLTMODULE_LIBS"
254 AC_CHECK_LIB([$CHECKLIB],[_init], [ALIHLTMODULE_LIBS="$ALIHLTMODULE_LIBS -l$CHECKLIB"])
255 done
256
257 dnl libs with circular dependencies needed by libAliHLTxxx
258 CHECKLIBS="[$7]"
259 CIRCULARS=
260 for dep in [$7]; do
261 CIRCULARS="$CIRCULARS -l$dep"
262 done
263 ALIHLTMODULE_LIBS="$ALIHLTMODULE_LIBS"
264 LDFLAGS="$save_LDFLAGS [$8]"
265 for CHECKLIB in $CHECKLIBS ; do
266 LIBS="$save_LIBS [$9] $CIRCULARS $ALIHLTMODULE_LIBS"
267 AC_CHECK_LIB([$CHECKLIB],[_init], [ALIHLTMODULE_LIBS="$ALIHLTMODULE_LIBS -l$CHECKLIB"])
268 done
269 CPPFLAGS="$save_CPPFLAGS"
270 LDFLAGS="$save_LDFLAGS"
271 LIBS="$save_LIBS"
272 AC_LANG_POP(C++)
273
274 fi
275 ])
276])
277
b521659f 278
279#
280# EOF
281#