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_OPTIMIZATION],
52 AC_REQUIRE([AC_PROG_CC])
53 AC_REQUIRE([AC_PROG_CXX])
55 AC_ARG_ENABLE(optimization,
56 [AC_HELP_STRING([--disable-optimization],[Enable optimization of objects])],
57 [],[enable_optimization=yes])
59 AC_MSG_CHECKING(for optimiztion level)
61 changequote(<<, >>)dnl
62 if test "x$enable_optimization" = "xno" ; then
63 CFLAGS=`echo $CFLAGS | sed 's,-O\([0-9][0-9]*\|\),,'`
64 CXXFLAGS=`echo $CXXFLAGS | sed 's,-O\([0-9][0-9]*\|\),,'`
65 elif test "x$enable_optimization" = "xyes" ; then
68 *) CXXFLAGS="$CXXFLAGS -O2" ;;
72 *) CFLAGS="$CXXFLAGS -O2" ;;
75 CFLAGS=`echo $CFLAGS | sed "s,-O\([0-9][0-9]*\|\),-O$enable_optimization,"`
76 CXXFLAGS=`echo $CXXFLAGS | sed "s,-O\([0-9][0-9]*\|\),-O$enable_optimization,"`
79 AC_MSG_RESULT($enable_optimization 'CFLAGS=$CFLAGS')
82 dnl ------------------------------------------------------------------
85 dnl Autoconf macro to check for existence or ROOT on the system
88 dnl ROOT_PATH([MINIMUM-VERSION, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]])
92 dnl ROOT_PATH(3.03/05, , AC_MSG_ERROR(Your ROOT version is too old))
93 dnl ROOT_PATH(, AC_DEFINE([HAVE_ROOT]))
95 dnl The macro defines the following substitution variables
97 dnl ROOTCONF full path to root-config
98 dnl ROOTEXEC full path to root
99 dnl ROOTCINT full path to rootcint
100 dnl ROOTLIBDIR Where the ROOT libraries are
101 dnl ROOTINCDIR Where the ROOT headers are
102 dnl ROOTCFLAGS Extra compiler flags
103 dnl ROOTLIBS ROOT basic libraries
104 dnl ROOTGLIBS ROOT basic + GUI libraries
105 dnl ROOTAUXLIBS Auxilary libraries and linker flags for ROOT
106 dnl ROOTAUXCFLAGS Auxilary compiler flags
107 dnl ROOTRPATH Same as ROOTLIBDIR
109 dnl The macro will fail if root-config and rootcint isn't found.
111 dnl Christian Holm Christensen <cholm@nbi.dk>
113 AC_DEFUN([ROOT_PATH],
116 [ --with-rootsys top of the ROOT installation directory],
117 user_rootsys=$withval,
119 if test ! x"$user_rootsys" = xnone; then
120 rootbin="$user_rootsys/bin"
121 elif test ! x"$ROOTSYS" = x ; then
122 rootbin="$ROOTSYS/bin"
126 AC_PATH_PROG(ROOTCONF, root-config , no, $rootbin)
127 AC_PATH_PROG(ROOTEXEC, root , no, $rootbin)
128 AC_PATH_PROG(ROOTCINT, rootcint , no, $rootbin)
130 if test ! x"$ROOTCONF" = "xno" && \
131 test ! x"$ROOTCINT" = "xno" ; then
133 # define some variables
134 ROOTLIBDIR=`$ROOTCONF --libdir`
135 ROOTINCDIR=`$ROOTCONF --incdir`
136 ROOTCFLAGS=`$ROOTCONF --noauxcflags --cflags`
137 ROOTLIBS=`$ROOTCONF --noauxlibs --noldflags --libs`
138 ROOTGLIBS=`$ROOTCONF --noauxlibs --noldflags --glibs`
139 ROOTAUXCFLAGS=`$ROOTCONF --auxcflags`
140 ROOTAUXLIBS=`$ROOTCONF --auxlibs`
141 ROOTRPATH=$ROOTLIBDIR
144 AC_MSG_CHECKING(wether ROOT version >= [$1])
145 vers=`$ROOTCONF --version | tr './' ' ' | awk 'BEGIN { FS = " "; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'`
146 requ=`echo $1 | tr './' ' ' | awk 'BEGIN { FS = " "; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'`
147 if test $vers -lt $requ ; then
155 # otherwise, we say no_root
164 AC_SUBST(ROOTAUXLIBS)
165 AC_SUBST(ROOTAUXCFLAGS)
168 if test "x$no_root" = "x" ; then
169 ifelse([$2], , :, [$2])
171 ifelse([$3], , :, [$3])
175 dnl ------------------------------------------------------------------
177 dnl Autoconf macro to check conditions for an HLT module
178 dnl - header dependencies
179 dnl - library dependencies
180 dnl - AliRoot availability
181 dnl The macro also exports the --enable/--disable option for the
186 dnl ROOT_PATH([module],
187 dnl [headers], [additional CPPFLAGS],
188 dnl [libraries], [LD flags], [LIBS],
189 dnl [circ libraries], [LD flags], [LIBS])
191 dnl First argument is the module name.
193 dnl Arg 2 and 3 allow to check a list of header files and to specify
194 dnl additional CPPFLAGS which might be necessary to perform the checks.
196 dnl Arg 4 to 6 allow to check a list of libraries, with additional
197 dnl LDFLAGS and LIBS to be specified.
199 dnl Arg 7 to 9 is the same for libraries with circular dependencies
200 dnl among each other.
203 dnl enable_module=yes
204 dnl - AliRoot was found &&
205 dnl - header files found &&
206 dnl - module not disabled
208 dnl enable_module=no...requires.AliRoot
209 dnl - AliRoot not found
211 dnl enable_module=missheader
212 dnl - one of the specified header files is missing
214 dnl Libraries are probed and the variable ALIHLTMODULE_LIBS is set to
215 dnl all libraries which could be found.
219 dnl Matthias Richter <Matthias.Richter@uib.no>
220 AC_DEFUN([CHECK_HLTMODULE],
222 AH_TEMPLATE([HLT_[$1]],[hlt [$1] library])
224 [AC_HELP_STRING([--disable-[$1]],
225 [ compile the $1 library ])],
226 [if test "x$enableval" = "xno";
227 then enable_module=no
228 elif test "x$disable_all" = "xyes"; then
229 # do checks if library has been enabled after global disable
234 [if test "x$disable_all" = "xyes"; then
235 enable_module=no...modules.disabled
238 fi # if test "x$disable_all" = "yes"
240 if test "x$enable_module" = "xyes"; then
241 if test "x$have_aliroot" = "xno" ; then
242 enable_module="no...requires.AliRoot"
244 AC_MSG_NOTICE([-------------------------------------------------])
245 AC_MSG_NOTICE([checking dependencies for [$1] library])
248 save_CPPFLAGS="$CPPFLAGS"
249 save_LDFLAGS="$LDFLAGS"
251 CPPFLAGS="$save_CPPFLAGS [$3]"
253 AC_CHECK_HEADERS([$2], [], [enable_module="missheader"])
255 dnl ==========================================================================
257 dnl required header files and libraries for the AliHLTxxx library
260 dnl ROOT/AliRoot libs needed by libAliHLTxxx
263 LDFLAGS="$save_LDFLAGS [$5]"
264 for CHECKLIB in $CHECKLIBS ; do
265 LIBS="$save_LIBS $ROOTLIBS [$6] $ALIHLTMODULE_LIBS"
266 AC_CHECK_LIB([$CHECKLIB],[_init], [ALIHLTMODULE_LIBS="$ALIHLTMODULE_LIBS -l$CHECKLIB"])
269 dnl libs with circular dependencies needed by libAliHLTxxx
273 CIRCULARS="$CIRCULARS -l$dep"
275 ALIHLTMODULE_LIBS="$ALIHLTMODULE_LIBS"
276 LDFLAGS="$save_LDFLAGS [$8]"
277 for CHECKLIB in $CHECKLIBS ; do
278 CIRCULARS=`echo $CIRCULARS | sed -e "s|-l$CHECKLIB||"`
279 LIBS="$save_LIBS [$9] $CIRCULARS $ALIHLTMODULE_LIBS"
280 AC_CHECK_LIB([$CHECKLIB],[_init], [ALIHLTMODULE_LIBS="$ALIHLTMODULE_LIBS -l$CHECKLIB"])
282 CPPFLAGS="$save_CPPFLAGS"
283 LDFLAGS="$save_LDFLAGS"
287 fi # if test "x$have_aliroot" = "xno"
288 fi # if test "x$enable_module" = "xyes"