source: trunk/third/gtkhtml/macros/gnome-libgtop-check.m4 @ 16767

Revision 16767, 7.2 KB checked in by ghudson, 23 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r16766, which included commits to RCS files with non-trunk default branches.
Line 
1dnl
2dnl LIBGTOP_CHECK_TYPE
3dnl
4dnl Improved version of AC_CHECK_TYPE which takes into account
5dnl that we need to #include some other header files on some
6dnl systems to get some types.
7
8dnl AC_LIBGTOP_CHECK_TYPE(TYPE, DEFAULT)
9AC_DEFUN([AC_LIBGTOP_CHECK_TYPE],
10[AC_REQUIRE([AC_HEADER_STDC])dnl
11AC_MSG_CHECKING(for $1)
12AC_CACHE_VAL(ac_cv_type_$1,
13[AC_EGREP_CPP(dnl
14changequote(<<,>>)dnl
15<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
16changequote([,]), [#include <sys/types.h>
17#if STDC_HEADERS
18#include <stdlib.h>
19#include <stddef.h>
20#endif
21
22/* For Tru64 */
23#ifdef HAVE_SYS_BITYPES_H
24#include <sys/bitypes.h>
25#endif
26], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
27AC_MSG_RESULT($ac_cv_type_$1)
28if test $ac_cv_type_$1 = no; then
29  AC_DEFINE($1, $2)
30fi
31])
32
33dnl
34dnl GNOME_LIBGTOP_TYPES
35dnl
36dnl some typechecks for libgtop.
37dnl
38
39AC_DEFUN([GNOME_LIBGTOP_TYPES],
40[
41        AC_CHECK_HEADERS(sys/bitypes.h)
42        AC_LIBGTOP_CHECK_TYPE(u_int64_t, unsigned long long int)
43        AC_LIBGTOP_CHECK_TYPE(int64_t, signed long long int)
44])
45
46dnl
47dnl GNOME_LIBGTOP_HOOK (minversion, script-if-libgtop-enabled, failflag)
48dnl
49dnl if failflag is "fail" then GNOME_LIBGTOP_HOOK will abort if LibGTop
50dnl is not found.
51dnl
52
53AC_DEFUN([GNOME_LIBGTOP_HOOK],
54[       
55        AC_REQUIRE([GNOME_LIBGTOP_TYPES])
56
57        AC_SUBST(LIBGTOP_LIBDIR)
58        AC_SUBST(LIBGTOP_INCLUDEDIR)
59        AC_SUBST(LIBGTOP_EXTRA_LIBS)
60        AC_SUBST(LIBGTOP_LIBS)
61        AC_SUBST(LIBGTOP_INCS)
62        AC_SUBST(LIBGTOP_NAMES_LIBS)
63        AC_SUBST(LIBGTOP_NAMES_INCS)
64        AC_SUBST(LIBGTOP_MAJOR_VERSION)
65        AC_SUBST(LIBGTOP_MINOR_VERSION)
66        AC_SUBST(LIBGTOP_MICRO_VERSION)
67        AC_SUBST(LIBGTOP_VERSION)
68        AC_SUBST(LIBGTOP_VERSION_CODE)
69        AC_SUBST(LIBGTOP_SERVER_VERSION)
70        AC_SUBST(LIBGTOP_INTERFACE_AGE)
71        AC_SUBST(LIBGTOP_BINARY_AGE)
72        AC_SUBST(LIBGTOP_BINDIR)
73        AC_SUBST(LIBGTOP_SERVER)
74
75        dnl Get the cflags and libraries from the libgtop-config script
76        dnl
77        AC_ARG_WITH(libgtop,
78        [  --with-libgtop=PFX      Prefix where LIBGTOP is installed (optional)],
79        libgtop_config_prefix="$withval", libgtop_config_prefix="")
80        AC_ARG_WITH(libgtop-exec,
81        [  --with-libgtop-exec=PFX Exec prefix where LIBGTOP is installed (optional)],
82        libgtop_config_exec_prefix="$withval", libgtop_config_exec_prefix="")
83
84        if test x$libgtop_config_exec_prefix != x ; then
85          libgtop_config_args="$libgtop_config_args --exec-prefix=$libgtop_config_exec_prefix"
86          if test x${LIBGTOP_CONFIG+set} != xset ; then
87            LIBGTOP_CONFIG=$libgtop_config_exec_prefix/bin/libgtop-config
88          fi
89        fi
90        if test x$libgtop_config_prefix != x ; then
91          libgtop_config_args="$libgtop_config_args --prefix=$libgtop_config_prefix"
92          if test x${LIBGTOP_CONFIG+set} != xset ; then
93            LIBGTOP_CONFIG=$libgtop_config_prefix/bin/libgtop-config
94          fi
95        fi
96
97        AC_PATH_PROG(LIBGTOP_CONFIG, libgtop-config, no)
98        dnl IMPORTANT NOTICE:
99        dnl   If you increase this number here, this means that *ALL*
100        dnl   modules will require the new version, even if they explicitly
101        dnl   give a lower number in their `configure.in' !!!
102        real_min_libgtop_version=1.0.0
103        min_libgtop_version=ifelse([$1], ,$real_min_libgtop_version,$1)
104        dnl I know, the following code looks really ugly, but if you want
105        dnl to make changes, please test it with a brain-dead /bin/sh and
106        dnl with a brain-dead /bin/test (not all shells/tests support the
107        dnl `<' operator to compare strings, that's why I convert everything
108        dnl into numbers and test them).
109        min_libgtop_major=`echo $min_libgtop_version | \
110          sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
111        min_libgtop_minor=`echo $min_libgtop_version | \
112          sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
113        min_libgtop_micro=`echo $min_libgtop_version | \
114          sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
115        test x$min_libgtop_micro = x && min_libgtop_micro=0
116        real_min_libgtop_major=`echo $real_min_libgtop_version | \
117          sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
118        real_min_libgtop_minor=`echo $real_min_libgtop_version | \
119          sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
120        real_min_libgtop_micro=`echo $real_min_libgtop_version | \
121          sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
122        test x$real_min_libgtop_micro = x && real_min_libgtop_micro=0
123        dnl You cannot require a version less then $real_min_libgtop_version,
124        dnl so you don't need to update each `configure.in' when it's increased.
125        if test $real_min_libgtop_major -gt $min_libgtop_major ; then
126          min_libgtop_major=$real_min_libgtop_major
127          min_libgtop_minor=$real_min_libgtop_minor
128          min_libgtop_micro=$real_min_libgtop_micro
129        elif test $real_min_libgtop_major = $min_libgtop_major ; then
130          if test $real_min_libgtop_minor -gt $min_libgtop_minor ; then
131            min_libgtop_minor=$real_min_libgtop_minor
132            min_libgtop_micro=$real_min_libgtop_micro
133          elif test $real_min_libgtop_minor = $min_libgtop_minor ; then
134            if test $real_min_libgtop_micro -gt $min_libgtop_micro ; then
135              min_libgtop_micro=$real_min_libgtop_micro
136            fi
137          fi
138        fi
139        min_libgtop_version="$min_libgtop_major.$min_libgtop_minor.$min_libgtop_micro"
140        AC_MSG_CHECKING(for libgtop - version >= $min_libgtop_version)
141        no_libgtop=""
142        if test "$LIBGTOP_CONFIG" = "no" ; then
143          no_libgtop=yes
144        else
145          configfile=`$LIBGTOP_CONFIG --config`
146          libgtop_major_version=`$LIBGTOP_CONFIG --version | \
147            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
148          libgtop_minor_version=`$LIBGTOP_CONFIG --version | \
149            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
150          libgtop_micro_version=`$LIBGTOP_CONFIG --version | \
151            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
152          if test $libgtop_major_version != $min_libgtop_major ; then
153            no_libgtop=mismatch
154          else
155            test $libgtop_minor_version -lt $min_libgtop_minor && no_libgtop=yes
156            if test $libgtop_minor_version = $min_libgtop_minor ; then
157              test $libgtop_micro_version -lt $min_libgtop_micro && no_libgtop=yes
158            fi
159          fi
160          . $configfile
161        fi
162        if test x$no_libgtop = x ; then
163          AC_DEFINE(HAVE_LIBGTOP)
164          AC_DEFINE_UNQUOTED(LIBGTOP_VERSION, "$LIBGTOP_VERSION")
165          AC_DEFINE_UNQUOTED(LIBGTOP_VERSION_CODE, $LIBGTOP_VERSION_CODE)
166          AC_DEFINE_UNQUOTED(LIBGTOP_MAJOR_VERSION, $LIBGTOP_MAJOR_VERSION)
167          AC_DEFINE_UNQUOTED(LIBGTOP_MINOR_VERSION, $LIBGTOP_MINOR_VERSION)
168          AC_DEFINE_UNQUOTED(LIBGTOP_MICRO_VERSION, $LIBGTOP_MICRO_VERSION)
169          AC_DEFINE_UNQUOTED(LIBGTOP_SERVER_VERSION, $LIBGTOP_SERVER_VERSION)
170          AC_MSG_RESULT(yes)
171          dnl Note that an empty true branch is not valid sh syntax.
172          ifelse([$2], [], :, [$2])
173        else
174          AC_MSG_RESULT(no)
175          if test "$no_libgtop"x = mismatchx; then
176            AC_MSG_ERROR(LibGTop major version mismatch $libgtop_major_version != $min_libgtop_major)
177          fi
178          if test "x$3" = "xfail"; then
179            AC_MSG_ERROR(LibGTop >= $min_libgtop_version not found)
180          else
181            AC_MSG_WARN(LibGTop >= $min_libgtop_version not found)
182          fi
183        fi
184
185        AM_CONDITIONAL(HAVE_LIBGTOP, test x$no_libgtop != xyes)
186])
187
188AC_DEFUN([GNOME_INIT_LIBGTOP],[
189        GNOME_LIBGTOP_HOOK($1,[ifelse([$3], [], :, [$3])],$2)
190])
191
192dnl
193dnl GNOME_LIBGTOP_DOCU
194dnl
195dnl checks whether the documentation of LibGTop is installed
196dnl
197
198AC_DEFUN([GNOME_LIBGTOP_DOCU],
199[
200        AC_REQUIRE([GNOME_LIBGTOP_HOOK])
201
202        helpdir="$LIBGTOP_DATADIR/gnome/help/libgtop"
203
204        AC_MSG_CHECKING(whether you have the LibGTop Documentation)
205
206        if test -f "$helpdir/C/topic.dat" ; then
207          have_libgtop_docu=yes
208          AC_DEFINE(HAVE_LIBGTOP_DOCU)
209        else
210          have_libgtop_docu=no
211        fi
212
213        AC_MSG_RESULT($have_libgtop_docu)
214
215        AM_CONDITIONAL(HAVE_LIBGTOP_DOCU, test x$have_libgtop_docu = xyes)
216])
217
Note: See TracBrowser for help on using the repository browser.