]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/acinclude.m4
the final cut: PHOS compilation warnings (Oystein)
[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
adec4ad4 31 AC_DEFINE(NDEBUG)
b521659f 32 CFLAGS=`echo $CFLAGS | sed 's,-g,,'`
33 CXXFLAGS=`echo $CXXFLAGS | sed 's,-g,,'`
34 else
35 AC_DEFINE(__DEBUG)
adec4ad4 36 AC_DEFINE(DEBUG)
b521659f 37 case $CXXFLAGS in
38 *-g*) ;;
39 *) CXXFLAGS="$CXXFLAGS -g" ;;
40 esac
41 case $CFLAGS in
42 *-g*) ;;
43 *) CFLAGS="$CFLAGS -g" ;;
44 esac
45 fi
46 AC_MSG_RESULT($enable_debug 'CFLAGS=$CFLAGS')
47])
48
49dnl ------------------------------------------------------------------
50AC_DEFUN([AC_OPTIMIZATION],
51[
52 AC_REQUIRE([AC_PROG_CC])
53 AC_REQUIRE([AC_PROG_CXX])
54
55 AC_ARG_ENABLE(optimization,
f59fee6d 56 [AC_HELP_STRING([--disable-optimization],[Enable optimization of objects])],
b521659f 57 [],[enable_optimization=yes])
58
59 AC_MSG_CHECKING(for optimiztion level)
60
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
66 case $CXXFLAGS in
67 *-O*) ;;
68 *) CXXFLAGS="$CXXFLAGS -O2" ;;
69 esac
70 case $CFLAGS in
71 *-O*) ;;
72 *) CFLAGS="$CXXFLAGS -O2" ;;
73 esac
74 else
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,"`
77 fi
78 changequote([, ])dnl
79 AC_MSG_RESULT($enable_optimization 'CFLAGS=$CFLAGS')
80])
81
82dnl ------------------------------------------------------------------
83
84dnl
85dnl Autoconf macro to check for existence or ROOT on the system
86dnl Synopsis:
87dnl
88dnl ROOT_PATH([MINIMUM-VERSION, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]])
89dnl
90dnl Some examples:
91dnl
92dnl ROOT_PATH(3.03/05, , AC_MSG_ERROR(Your ROOT version is too old))
93dnl ROOT_PATH(, AC_DEFINE([HAVE_ROOT]))
94dnl
95dnl The macro defines the following substitution variables
96dnl
97dnl ROOTCONF full path to root-config
98dnl ROOTEXEC full path to root
99dnl ROOTCINT full path to rootcint
100dnl ROOTLIBDIR Where the ROOT libraries are
101dnl ROOTINCDIR Where the ROOT headers are
102dnl ROOTCFLAGS Extra compiler flags
103dnl ROOTLIBS ROOT basic libraries
104dnl ROOTGLIBS ROOT basic + GUI libraries
105dnl ROOTAUXLIBS Auxilary libraries and linker flags for ROOT
106dnl ROOTAUXCFLAGS Auxilary compiler flags
107dnl ROOTRPATH Same as ROOTLIBDIR
108dnl
109dnl The macro will fail if root-config and rootcint isn't found.
110dnl
111dnl Christian Holm Christensen <cholm@nbi.dk>
112dnl
113AC_DEFUN([ROOT_PATH],
114[
115 AC_ARG_WITH(rootsys,
116 [ --with-rootsys top of the ROOT installation directory],
117 user_rootsys=$withval,
118 user_rootsys="none")
119 if test ! x"$user_rootsys" = xnone; then
120 rootbin="$user_rootsys/bin"
121 elif test ! x"$ROOTSYS" = x ; then
122 rootbin="$ROOTSYS/bin"
123 else
124 rootbin=$PATH
125 fi
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)
129
130 if test ! x"$ROOTCONF" = "xno" && \
131 test ! x"$ROOTCINT" = "xno" ; then
132
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
142
143 if test $1 ; then
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
148 AC_MSG_RESULT(no)
149 no_root="yes"
150 else
151 AC_MSG_RESULT(yes)
152 fi
153 fi
154 else
155 # otherwise, we say no_root
156 no_root="yes"
157 fi
158
159 AC_SUBST(ROOTLIBDIR)
160 AC_SUBST(ROOTINCDIR)
161 AC_SUBST(ROOTCFLAGS)
162 AC_SUBST(ROOTLIBS)
163 AC_SUBST(ROOTGLIBS)
164 AC_SUBST(ROOTAUXLIBS)
165 AC_SUBST(ROOTAUXCFLAGS)
166 AC_SUBST(ROOTRPATH)
167
168 if test "x$no_root" = "x" ; then
169 ifelse([$2], , :, [$2])
170 else
171 ifelse([$3], , :, [$3])
172 fi
173])
174
f59fee6d 175dnl ------------------------------------------------------------------
176dnl
177dnl Autoconf macro to check conditions for an HLT module
178dnl - header dependencies
179dnl - library dependencies
180dnl - AliRoot availability
181dnl The macro also exports the --enable/--disable option for the
182dnl module.
183dnl
184dnl Synopsis:
185dnl
186dnl ROOT_PATH([module],
187dnl [headers], [additional CPPFLAGS],
188dnl [libraries], [LD flags], [LIBS],
189dnl [circ libraries], [LD flags], [LIBS])
190dnl
191dnl First argument is the module name.
192dnl
193dnl Arg 2 and 3 allow to check a list of header files and to specify
194dnl additional CPPFLAGS which might be necessary to perform the checks.
195dnl
196dnl Arg 4 to 6 allow to check a list of libraries, with additional
197dnl LDFLAGS and LIBS to be specified.
198dnl
199dnl Arg 7 to 9 is the same for libraries with circular dependencies
200dnl among each other.
201dnl
202dnl Return:
203dnl enable_module=yes
204dnl - AliRoot was found &&
205dnl - header files found &&
206dnl - module not disabled
207dnl
208dnl enable_module=no...requires.AliRoot
209dnl - AliRoot not found
210dnl
211dnl enable_module=missheader
212dnl - one of the specified header files is missing
213dnl
214dnl Libraries are probed and the variable ALIHLTMODULE_LIBS is set to
215dnl all libraries which could be found.
216dnl
217dnl Some examples:
218dnl
219dnl Matthias Richter <Matthias.Richter@uib.no>
220AC_DEFUN([CHECK_HLTMODULE],
221[
222AH_TEMPLATE([HLT_[$1]],[hlt [$1] library])
223AC_ARG_ENABLE([$1],
224 [AC_HELP_STRING([--disable-[$1]],
225 [ compile the $1 library ])],
c6b46c3f 226 [if test "x$enableval" = "xno";
227 then enable_module=no
7233bc62 228 elif test "x$disable_all" = "xyes"; then
229 # do checks if library has been enabled after global disable
230 enable_module=yes
c6b46c3f 231 else
232 enable_module=force
233 fi],
7233bc62 234 [if test "x$disable_all" = "xyes"; then
235 enable_module=no...modules.disabled
236 else
237 enable_module=yes
238 fi # if test "x$disable_all" = "yes"
239 ])
240 if test "x$enable_module" = "xyes"; then
f59fee6d 241 if test "x$have_aliroot" = "xno" ; then
242 enable_module="no...requires.AliRoot"
243 else
adec4ad4 244 AC_MSG_NOTICE([-------------------------------------------------])
f59fee6d 245 AC_MSG_NOTICE([checking dependencies for [$1] library])
246
247 AC_LANG_PUSH(C++)
248 save_CPPFLAGS="$CPPFLAGS"
249 save_LDFLAGS="$LDFLAGS"
250 save_LIBS="$LIBS"
251 CPPFLAGS="$save_CPPFLAGS [$3]"
252
253 AC_CHECK_HEADERS([$2], [], [enable_module="missheader"])
254
255 dnl ==========================================================================
256 dnl
257 dnl required header files and libraries for the AliHLTxxx library
258 dnl
259
260 dnl ROOT/AliRoot libs needed by libAliHLTxxx
261 CHECKLIBS="[$4]"
262 ALIHLTMODULE_LIBS=
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"])
267 done
268
269 dnl libs with circular dependencies needed by libAliHLTxxx
270 CHECKLIBS="[$7]"
271 CIRCULARS=
272 for dep in [$7]; do
273 CIRCULARS="$CIRCULARS -l$dep"
274 done
275 ALIHLTMODULE_LIBS="$ALIHLTMODULE_LIBS"
276 LDFLAGS="$save_LDFLAGS [$8]"
277 for CHECKLIB in $CHECKLIBS ; do
278 LIBS="$save_LIBS [$9] $CIRCULARS $ALIHLTMODULE_LIBS"
279 AC_CHECK_LIB([$CHECKLIB],[_init], [ALIHLTMODULE_LIBS="$ALIHLTMODULE_LIBS -l$CHECKLIB"])
280 done
281 CPPFLAGS="$save_CPPFLAGS"
282 LDFLAGS="$save_LDFLAGS"
283 LIBS="$save_LIBS"
284 AC_LANG_POP(C++)
285
7233bc62 286 fi # if test "x$have_aliroot" = "xno"
287 fi # if test "x$enable_module" = "xyes"
f59fee6d 288])
289
b521659f 290
291#
292# EOF
293#