4 dnl Copyright (C) 2002 Christian Holm Christensen <cholm@nbi.dk>
6 dnl This library is free software; you can redistribute it and/or
7 dnl modify it under the terms of the GNU Lesser General Public License
8 dnl as published by the Free Software Foundation; either version 2.1
9 dnl of the License, or (at your option) any later version.
11 dnl This library is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 dnl Lesser General Public License for more details.
16 dnl You should have received a copy of the GNU Lesser General Public
17 dnl License along with this library; if not, write to the Free
18 dnl Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 dnl ------------------------------------------------------------------
24 AC_REQUIRE([AC_PROG_CC])
25 AC_REQUIRE([AC_PROG_CXX])
26 AC_MSG_CHECKING(whether to make debug objects)
28 [AC_HELP_STRING([--enable-debug],[Enable debugging symbols in objects])],
30 if test "x$enable_debug" = "xno" ; then
32 CFLAGS=`echo $CFLAGS | sed 's,-g,,'`
33 CXXFLAGS=`echo $CXXFLAGS | sed 's,-g,,'`
39 *) CXXFLAGS="$CXXFLAGS -g" ;;
43 *) CFLAGS="$CFLAGS -g" ;;
46 AC_MSG_RESULT($enable_debug 'CFLAGS=$CFLAGS')
49 dnl ------------------------------------------------------------------
50 AC_DEFUN([AC_PROFILING],
52 AC_REQUIRE([AC_PROG_CC])
53 AC_REQUIRE([AC_PROG_CXX])
54 AC_MSG_CHECKING(whether to add profiling info)
55 AC_ARG_ENABLE(profiling,
56 [AC_HELP_STRING([--enable-profiling],[Enable profiling info in objects])],
57 [],[enable_profiling=no])
58 if test "x$enable_profiling" = "xno" ; then
59 CFLAGS=`echo $CFLAGS | sed 's,-pg,,'`
60 CXXFLAGS=`echo $CXXFLAGS | sed 's,-pg,,'`
65 *) CXXFLAGS="$CXXFLAGS -pg" ;;
69 *) CFLAGS="$CFLAGS -pg" ;;
72 AC_MSG_RESULT($enable_profiling 'CFLAGS=$CFLAGS')
75 dnl ------------------------------------------------------------------
76 AC_DEFUN([AC_OPTIMIZATION],
78 AC_REQUIRE([AC_PROG_CC])
79 AC_REQUIRE([AC_PROG_CXX])
81 AC_ARG_ENABLE(optimization,
82 [AC_HELP_STRING([--disable-optimization],[Enable optimization of objects])],
83 [],[enable_optimization=yes])
85 AC_MSG_CHECKING(for optimiztion level)
87 changequote(<<, >>)dnl
88 if test "x$enable_optimization" = "xno" ; then
89 CFLAGS=`echo $CFLAGS | sed 's,-O\([0-9][0-9]*\|\),,'`
90 CXXFLAGS=`echo $CXXFLAGS | sed 's,-O\([0-9][0-9]*\|\),,'`
91 elif test "x$enable_optimization" = "xyes" ; then
94 *) CXXFLAGS="$CXXFLAGS -O2" ;;
98 *) CFLAGS="$CXXFLAGS -O2" ;;
101 CFLAGS=`echo $CFLAGS | sed "s,-O\([0-9][0-9]*\|\),-O$enable_optimization,"`
102 CXXFLAGS=`echo $CXXFLAGS | sed "s,-O\([0-9][0-9]*\|\),-O$enable_optimization,"`
105 AC_MSG_RESULT($enable_optimization 'CFLAGS=$CFLAGS')
108 dnl ------------------------------------------------------------------
111 dnl Autoconf macro to check for existence or ROOT on the system
114 dnl ROOT_PATH([MINIMUM-VERSION, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]])
118 dnl ROOT_PATH(3.03/05, , AC_MSG_ERROR(Your ROOT version is too old))
119 dnl ROOT_PATH(, AC_DEFINE([HAVE_ROOT]))
121 dnl The macro defines the following substitution variables
123 dnl ROOTCONF full path to root-config
124 dnl ROOTEXEC full path to root
125 dnl ROOTCINT full path to rootcint
126 dnl ROOTLIBDIR Where the ROOT libraries are
127 dnl ROOTINCDIR Where the ROOT headers are
128 dnl ROOTCFLAGS Extra compiler flags
129 dnl ROOTLIBS ROOT basic libraries
130 dnl ROOTGLIBS ROOT basic + GUI libraries
131 dnl ROOTAUXLIBS Auxilary libraries and linker flags for ROOT
132 dnl ROOTAUXCFLAGS Auxilary compiler flags
133 dnl ROOTRPATH Same as ROOTLIBDIR
135 dnl The macro will fail if root-config and rootcint isn't found.
137 dnl Christian Holm Christensen <cholm@nbi.dk>
139 AC_DEFUN([ROOT_PATH],
142 [ --with-rootsys top of the ROOT installation directory],
143 user_rootsys=$withval,
145 if test ! x"$user_rootsys" = xnone; then
146 rootbin="$user_rootsys/bin"
147 elif test ! x"$ROOTSYS" = x ; then
148 rootbin="$ROOTSYS/bin"
152 AC_PATH_PROG(ROOTCONF, root-config , no, $rootbin) # used by HLT build system
153 AC_PATH_PROG(ROOTCONFIG, root-config , no, $rootbin) # used by AliRoot build system
154 AC_PATH_PROG(ROOTEXEC, root , no, $rootbin)
155 AC_PATH_PROG(ROOTCINT, rootcint , no, $rootbin)
157 if test ! x"$ROOTCONF" = "xno" && \
158 test ! x"$ROOTCINT" = "xno" ; then
160 # define some variables
161 ROOTLIBDIR=`$ROOTCONF --libdir`
162 ROOTINCDIR=`$ROOTCONF --incdir`
163 ROOTCFLAGS=`$ROOTCONF --noauxcflags --cflags`
164 ROOTLIBS=`$ROOTCONF --noauxlibs --noldflags --libs`
165 ROOTGLIBS=`$ROOTCONF --noauxlibs --noldflags --glibs`
166 ROOTAUXCFLAGS=`$ROOTCONF --auxcflags`
167 ROOTAUXLIBS=`$ROOTCONF --auxlibs`
168 ROOTRPATH=$ROOTLIBDIR
171 AC_MSG_CHECKING(wether ROOT version >= [$1])
172 vers=`$ROOTCONF --version | tr './' ' ' | awk 'BEGIN { FS = " "; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'`
173 requ=`echo $1 | tr './' ' ' | awk 'BEGIN { FS = " "; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'`
174 if test $vers -lt $requ ; then
182 # otherwise, we say no_root
191 AC_SUBST(ROOTAUXLIBS)
192 AC_SUBST(ROOTAUXCFLAGS)
195 if test "x$no_root" = "x" ; then
196 ifelse([$2], , :, [$2])
198 ifelse([$3], , :, [$3])
202 dnl ------------------------------------------------------------------
204 dnl Autoconf macro to check conditions for an HLT module
205 dnl - header dependencies
206 dnl - library dependencies
207 dnl - AliRoot availability
208 dnl The macro also exports the --enable/--disable option for the
213 dnl ROOT_PATH([module],
214 dnl [headers], [additional CPPFLAGS],
215 dnl [libraries], [LD flags], [LIBS],
216 dnl [circ libraries], [LD flags], [LIBS])
218 dnl First argument is the module name.
220 dnl Arg 2 and 3 allow to check a list of header files and to specify
221 dnl additional CPPFLAGS which might be necessary to perform the checks.
223 dnl Arg 4 to 6 allow to check a list of libraries, with additional
224 dnl LDFLAGS and LIBS to be specified.
226 dnl Arg 7 to 9 is the same for libraries with circular dependencies
227 dnl among each other.
230 dnl enable_module=yes
231 dnl - AliRoot was found &&
232 dnl - header files found &&
233 dnl - module not disabled
235 dnl enable_module=no...requires.AliRoot
236 dnl - AliRoot not found
238 dnl enable_module=missheader
239 dnl - one of the specified header files is missing
241 dnl Libraries are probed and the variable ALIHLTMODULE_LIBS is set to
242 dnl all libraries which could be found.
246 dnl Matthias Richter <Matthias.Richter@uib.no>
247 AC_DEFUN([CHECK_HLTMODULE],
249 AH_TEMPLATE([HLT_[$1]],[hlt [$1] library])
251 [AC_HELP_STRING([--disable-[$1]],
252 [ compile the $1 library ])],
253 [if test "x$enableval" = "xno";
254 then enable_module=no
255 elif test "x$disable_all" = "xyes"; then
256 # do checks if library has been enabled after global disable
261 [if test "x$disable_all" = "xyes"; then
262 enable_module=no...modules.disabled
265 fi # if test "x$disable_all" = "yes"
267 if test "x$enable_module" = "xyes"; then
268 if test "x$have_aliroot" = "xno" ; then
269 enable_module="no...requires.AliRoot"
271 AC_MSG_NOTICE([-------------------------------------------------])
272 AC_MSG_NOTICE([checking dependencies for [$1] library])
275 save_CPPFLAGS="$CPPFLAGS"
276 save_LDFLAGS="$LDFLAGS"
278 CPPFLAGS="$save_CPPFLAGS [$3]"
280 if test "x[$2]" != "x"; then
281 AC_CHECK_HEADERS([$2], [], [enable_module="missheader"])
284 dnl ==========================================================================
286 dnl required header files and libraries for the AliHLTxxx library
289 dnl ROOT/AliRoot libs needed by libAliHLTxxx
292 LDFLAGS="$save_LDFLAGS [$5]"
293 for CHECKLIB in $CHECKLIBS ; do
294 LIBS="$save_LIBS $ROOTLIBS [$6] $ALIHLTMODULE_LIBS"
295 AC_CHECK_LIB([$CHECKLIB],[_init], [ALIHLTMODULE_LIBS="$ALIHLTMODULE_LIBS -l$CHECKLIB"])
298 dnl libs with circular dependencies needed by libAliHLTxxx
302 CIRCULARS="$CIRCULARS -l$dep"
304 ALIHLTMODULE_LIBS="$ALIHLTMODULE_LIBS"
305 LDFLAGS="$save_LDFLAGS [$8]"
306 for CHECKLIB in $CHECKLIBS ; do
307 CIRCULARS=`echo $CIRCULARS | sed -e "s|-l$CHECKLIB||"`
308 LIBS="$save_LIBS [$9] $CIRCULARS $ALIHLTMODULE_LIBS"
309 AC_CHECK_LIB([$CHECKLIB],[_init], [ALIHLTMODULE_LIBS="$ALIHLTMODULE_LIBS -l$CHECKLIB"])
311 CPPFLAGS="$save_CPPFLAGS"
312 LDFLAGS="$save_LDFLAGS"
316 fi # if test "x$have_aliroot" = "xno"
317 fi # if test "x$enable_module" = "xyes"