source: branches/fscctrl_safety_limits/.macro_dir/root_path.m4@ 19062

Last change on this file since 19062 was 10443, checked in by tbretz, 14 years ago
Allow giving root with and without bin directory.
File size: 3.8 KB
Line 
1dnl -*- mode: autoconf -*-
2dnl
3dnl $Id: root.m4,v 1.3 2005/03/21 21:42:21 rdm Exp $
4dnl $Author: rdm $
5dnl $Date: 2005/03/21 21:42:21 $
6dnl
7dnl Autoconf macro to check for existence or ROOT on the system
8dnl Synopsis:
9dnl
10dnl ROOT_PATH([MINIMUM-VERSION, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]])
11dnl
12dnl Some examples:
13dnl
14dnl ROOT_PATH(3.03/05, , AC_MSG_ERROR(Your ROOT version is too old))
15dnl ROOT_PATH(, AC_DEFINE([HAVE_ROOT]))
16dnl
17dnl The macro defines the following substitution variables
18dnl
19dnl ROOTCONF full path to root-config
20dnl ROOTEXEC full path to root
21dnl ROOTCINT full path to rootcint
22dnl ROOTLIBDIR Where the ROOT libraries are
23dnl ROOTINCDIR Where the ROOT headers are
24dnl ROOTETCDIR Where the ROOT configuration is
25dnl ROOTCFLAGS Extra compiler flags
26dnl ROOTLIBS ROOT basic libraries
27dnl ROOTGLIBS ROOT basic + GUI libraries
28dnl ROOTAUXLIBS Auxilary libraries and linker flags for ROOT
29dnl ROOTAUXCFLAGS Auxilary compiler flags
30dnl ROOTRPATH Same as ROOTLIBDIR
31dnl
32dnl The macro will fail if root-config and rootcint isn't found.
33dnl
34dnl Christian Holm Christensen <cholm@nbi.dk>
35dnl
36AC_DEFUN([ROOT_PATH],
37[
38 AC_ARG_WITH([rootsys],
39 [AC_HELP_STRING([--with-rootsys],
40 [path to the ROOT executables or top ROOT installation directory])],
41 [user_rootsys=$withval],
42 [user_rootsys="none"])
43 if test ! x"$user_rootsys" = xnone; then
44 rootbin="$user_rootsys:$user_rootsys/bin"
45 elif test ! x"$ROOTSYS" = x ; then
46 rootbin="$ROOTSYS/bin"
47 else
48 rootbin=$PATH
49 fi
50
51 AC_MSG_CHECKING(for root in)
52 AC_MSG_RESULT($rootbin)
53
54 AC_PATH_PROG(ROOTCONF, root-config , no, $rootbin)
55 AC_PATH_PROG(ROOTEXEC, root , no, $rootbin)
56 AC_PATH_PROG(ROOTCINT, rootcint , no, $rootbin)
57
58 if test ! x"$ROOTCONF" = "xno" && \
59 test ! x"$ROOTCINT" = "xno" ; then
60
61 # define some variables
62 ROOTLIBDIR=`$ROOTCONF --libdir`
63 ROOTINCDIR=`$ROOTCONF --incdir`
64# ROOTETCDIR=`$ROOTCONF --etcdir`
65 ROOTCFLAGS=`$ROOTCONF --noauxcflags --cflags`
66 ROOTLIBS=`$ROOTCONF --noauxlibs --noldflags --libs`
67 ROOTGLIBS=`$ROOTCONF --noauxlibs --noldflags --glibs`
68 ROOTAUXCFLAGS=`$ROOTCONF --auxcflags`
69 ROOTAUXLIBS=`$ROOTCONF --auxlibs`
70 ROOTRPATH=$ROOTLIBDIR
71 ROOTVERSION=`$ROOTCONF --version`
72 ROOTSOVERSION=`dirname $ROOTVERSION`
73
74 if test $1 ; then
75 AC_MSG_CHECKING(wether ROOT version >= [$1])
76 vers=`$ROOTCONF --version | tr './' ' ' | awk 'BEGIN { FS = " "; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'`
77 requ=`echo $1 | tr './' ' ' | awk 'BEGIN { FS = " "; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'`
78 if test $vers -lt $requ ; then
79 AC_MSG_RESULT(no)
80 no_root="yes"
81 else
82 AC_MSG_RESULT(yes)
83 fi
84 fi
85 else
86 # otherwise, we say no_root
87 no_root="yes"
88 fi
89
90 AC_SUBST(ROOTLIBDIR)
91 AC_SUBST(ROOTINCDIR)
92# AC_SUBST(ROOTETCDIR)
93 AC_SUBST(ROOTCFLAGS)
94 AC_SUBST(ROOTLIBS)
95 AC_SUBST(ROOTGLIBS)
96 AC_SUBST(ROOTAUXLIBS)
97 AC_SUBST(ROOTAUXCFLAGS)
98 AC_SUBST(ROOTRPATH)
99 AC_SUBST(ROOTVERSION)
100 AC_SUBST(ROOTSOVERSION)
101
102 if test "x$no_root" = "x" ; then
103 ifelse([$2], , :, [$2])
104 else
105 ifelse([$3], , :, [$3])
106 fi
107])
108
109#
110# Macro to check if ROOT has a specific feature:
111#
112# ROOT_FEATURE(FEATURE,[ACTION_IF_HAVE,[ACTION_IF_NOT]])
113#
114# For example
115#
116# ROOT_FEATURE([ldap],[AC_DEFINE([HAVE_ROOT_LDAP])])
117#
118AC_DEFUN([ROOT_FEATURE],
119[
120 AC_REQUIRE([ROOT_PATH])
121 feat=$1
122 res=`$ROOTCONF --has-$feat`
123 if test "x$res" = "xyes" ; then
124 ifelse([$2], , :, [$2])
125 else
126 ifelse([$3], , :, [$3])
127 fi
128
129 AC_MSG_CHECKING(whether root was built with --with-qt)
130 AC_MSG_RESULT($res)
131])
132
133#
134# EOF
135#
Note: See TracBrowser for help on using the repository browser.