1 | dnl -*- mode: autoconf -*-
|
---|
2 | dnl
|
---|
3 | dnl $Id: root.m4,v 1.3 2005/03/21 21:42:21 rdm Exp $
|
---|
4 | dnl $Author: rdm $
|
---|
5 | dnl $Date: 2005/03/21 21:42:21 $
|
---|
6 | dnl
|
---|
7 | dnl Autoconf macro to check for existence or ROOT on the system
|
---|
8 | dnl Synopsis:
|
---|
9 | dnl
|
---|
10 | dnl ROOT_PATH([MINIMUM-VERSION, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]])
|
---|
11 | dnl
|
---|
12 | dnl Some examples:
|
---|
13 | dnl
|
---|
14 | dnl ROOT_PATH(3.03/05, , AC_MSG_ERROR(Your ROOT version is too old))
|
---|
15 | dnl ROOT_PATH(, AC_DEFINE([HAVE_ROOT]))
|
---|
16 | dnl
|
---|
17 | dnl The macro defines the following substitution variables
|
---|
18 | dnl
|
---|
19 | dnl ROOTCONF full path to root-config
|
---|
20 | dnl ROOTEXEC full path to root
|
---|
21 | dnl ROOTCINT full path to rootcint
|
---|
22 | dnl ROOTLIBDIR Where the ROOT libraries are
|
---|
23 | dnl ROOTINCDIR Where the ROOT headers are
|
---|
24 | dnl ROOTETCDIR Where the ROOT configuration is
|
---|
25 | dnl ROOTCFLAGS Extra compiler flags
|
---|
26 | dnl ROOTLIBS ROOT basic libraries
|
---|
27 | dnl ROOTGLIBS ROOT basic + GUI libraries
|
---|
28 | dnl ROOTAUXLIBS Auxilary libraries and linker flags for ROOT
|
---|
29 | dnl ROOTAUXCFLAGS Auxilary compiler flags
|
---|
30 | dnl ROOTRPATH Same as ROOTLIBDIR
|
---|
31 | dnl
|
---|
32 | dnl The macro will fail if root-config and rootcint isn't found.
|
---|
33 | dnl
|
---|
34 | dnl Christian Holm Christensen <cholm@nbi.dk>
|
---|
35 | dnl
|
---|
36 | AC_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 | #
|
---|
118 | AC_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 | #
|
---|