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
31 CFLAGS=`echo $CFLAGS | sed 's,-g,,'`
32 CXXFLAGS=`echo $CXXFLAGS | sed 's,-g,,'`
37 *) CXXFLAGS="$CXXFLAGS -g" ;;
41 *) CFLAGS="$CFLAGS -g" ;;
44 AC_MSG_RESULT($enable_debug 'CFLAGS=$CFLAGS')
47 dnl ------------------------------------------------------------------
48 AC_DEFUN([AC_OPTIMIZATION],
50 AC_REQUIRE([AC_PROG_CC])
51 AC_REQUIRE([AC_PROG_CXX])
53 AC_ARG_ENABLE(optimization,
54 [AC_HELP_STRING([--disable-optimization],[Enable optimization of objects])],
55 [],[enable_optimization=yes])
57 AC_MSG_CHECKING(for optimiztion level)
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
66 *) CXXFLAGS="$CXXFLAGS -O2" ;;
70 *) CFLAGS="$CXXFLAGS -O2" ;;
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,"`
77 AC_MSG_RESULT($enable_optimization 'CFLAGS=$CFLAGS')
80 dnl ------------------------------------------------------------------
83 dnl Autoconf macro to check for existence or ROOT on the system
86 dnl ROOT_PATH([MINIMUM-VERSION, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]])
90 dnl ROOT_PATH(3.03/05, , AC_MSG_ERROR(Your ROOT version is too old))
91 dnl ROOT_PATH(, AC_DEFINE([HAVE_ROOT]))
93 dnl The macro defines the following substitution variables
95 dnl ROOTCONF full path to root-config
96 dnl ROOTEXEC full path to root
97 dnl ROOTCINT full path to rootcint
98 dnl ROOTLIBDIR Where the ROOT libraries are
99 dnl ROOTINCDIR Where the ROOT headers are
100 dnl ROOTCFLAGS Extra compiler flags
101 dnl ROOTLIBS ROOT basic libraries
102 dnl ROOTGLIBS ROOT basic + GUI libraries
103 dnl ROOTAUXLIBS Auxilary libraries and linker flags for ROOT
104 dnl ROOTAUXCFLAGS Auxilary compiler flags
105 dnl ROOTRPATH Same as ROOTLIBDIR
107 dnl The macro will fail if root-config and rootcint isn't found.
109 dnl Christian Holm Christensen <cholm@nbi.dk>
111 AC_DEFUN([ROOT_PATH],
114 [ --with-rootsys top of the ROOT installation directory],
115 user_rootsys=$withval,
117 if test ! x"$user_rootsys" = xnone; then
118 rootbin="$user_rootsys/bin"
119 elif test ! x"$ROOTSYS" = x ; then
120 rootbin="$ROOTSYS/bin"
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)
128 if test ! x"$ROOTCONF" = "xno" && \
129 test ! x"$ROOTCINT" = "xno" ; then
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
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
153 # otherwise, we say no_root
162 AC_SUBST(ROOTAUXLIBS)
163 AC_SUBST(ROOTAUXCFLAGS)
166 if test "x$no_root" = "x" ; then
167 ifelse([$2], , :, [$2])
169 ifelse([$3], , :, [$3])
173 dnl ------------------------------------------------------------------
175 dnl Autoconf macro to check conditions for an HLT module
176 dnl - header dependencies
177 dnl - library dependencies
178 dnl - AliRoot availability
179 dnl The macro also exports the --enable/--disable option for the
184 dnl ROOT_PATH([module],
185 dnl [headers], [additional CPPFLAGS],
186 dnl [libraries], [LD flags], [LIBS],
187 dnl [circ libraries], [LD flags], [LIBS])
189 dnl First argument is the module name.
191 dnl Arg 2 and 3 allow to check a list of header files and to specify
192 dnl additional CPPFLAGS which might be necessary to perform the checks.
194 dnl Arg 4 to 6 allow to check a list of libraries, with additional
195 dnl LDFLAGS and LIBS to be specified.
197 dnl Arg 7 to 9 is the same for libraries with circular dependencies
198 dnl among each other.
201 dnl enable_module=yes
202 dnl - AliRoot was found &&
203 dnl - header files found &&
204 dnl - module not disabled
206 dnl enable_module=no...requires.AliRoot
207 dnl - AliRoot not found
209 dnl enable_module=missheader
210 dnl - one of the specified header files is missing
212 dnl Libraries are probed and the variable ALIHLTMODULE_LIBS is set to
213 dnl all libraries which could be found.
217 dnl Matthias Richter <Matthias.Richter@uib.no>
218 AC_DEFUN([CHECK_HLTMODULE],
220 AH_TEMPLATE([HLT_[$1]],[hlt [$1] library])
222 [AC_HELP_STRING([--disable-[$1]],
223 [ compile the $1 library ])],
224 [if test "x$enableval" = "xno";
225 then enable_module=no
226 elif test "x$disable_all" = "xyes"; then
227 # do checks if library has been enabled after global disable
232 [if test "x$disable_all" = "xyes"; then
233 enable_module=no...modules.disabled
236 fi # if test "x$disable_all" = "yes"
238 if test "x$enable_module" = "xyes"; then
239 if test "x$have_aliroot" = "xno" ; then
240 enable_module="no...requires.AliRoot"
242 AC_MSG_NOTICE([checking dependencies for [$1] library])
245 save_CPPFLAGS="$CPPFLAGS"
246 save_LDFLAGS="$LDFLAGS"
248 CPPFLAGS="$save_CPPFLAGS [$3]"
250 AC_CHECK_HEADERS([$2], [], [enable_module="missheader"])
252 dnl ==========================================================================
254 dnl required header files and libraries for the AliHLTxxx library
257 dnl ROOT/AliRoot libs needed by libAliHLTxxx
260 LDFLAGS="$save_LDFLAGS [$5]"
261 for CHECKLIB in $CHECKLIBS ; do
262 LIBS="$save_LIBS $ROOTLIBS [$6] $ALIHLTMODULE_LIBS"
263 AC_CHECK_LIB([$CHECKLIB],[_init], [ALIHLTMODULE_LIBS="$ALIHLTMODULE_LIBS -l$CHECKLIB"])
266 dnl libs with circular dependencies needed by libAliHLTxxx
270 CIRCULARS="$CIRCULARS -l$dep"
272 ALIHLTMODULE_LIBS="$ALIHLTMODULE_LIBS"
273 LDFLAGS="$save_LDFLAGS [$8]"
274 for CHECKLIB in $CHECKLIBS ; do
275 LIBS="$save_LIBS [$9] $CIRCULARS $ALIHLTMODULE_LIBS"
276 AC_CHECK_LIB([$CHECKLIB],[_init], [ALIHLTMODULE_LIBS="$ALIHLTMODULE_LIBS -l$CHECKLIB"])
278 CPPFLAGS="$save_CPPFLAGS"
279 LDFLAGS="$save_LDFLAGS"
283 fi # if test "x$have_aliroot" = "xno"
284 fi # if test "x$enable_module" = "xyes"