2 dnl GNOME_LIBGTOP_TYPES
4 dnl some typechecks for libgtop.
7 AC_DEFUN([GNOME_LIBGTOP_TYPES],
9 AC_CHECK_TYPE(u_int64_t, unsigned long long int)
10 AC_CHECK_TYPE(int64_t, signed long long int)
11 AC_CHECK_TYPE(u_int8_t, unsigned char)
12 AC_CHECK_TYPE(int8_t, signed char)
16 dnl GNOME_LIBGTOP_HOOK (minversion, script-if-libgtop-enabled, failflag)
18 dnl if failflag is "fail" then GNOME_LIBGTOP_HOOK will abort if LibGTop
22 AC_DEFUN([GNOME_LIBGTOP_HOOK],
24 AC_REQUIRE([GNOME_LIBGTOP_TYPES])
26 AC_SUBST(LIBGTOP_LIBDIR)
27 AC_SUBST(LIBGTOP_INCLUDEDIR)
28 AC_SUBST(LIBGTOP_EXTRA_LIBS)
29 AC_SUBST(LIBGTOP_LIBS)
30 AC_SUBST(LIBGTOP_INCS)
31 AC_SUBST(LIBGTOP_NAMES_LIBS)
32 AC_SUBST(LIBGTOP_NAMES_INCS)
33 AC_SUBST(LIBGTOP_MAJOR_VERSION)
34 AC_SUBST(LIBGTOP_MINOR_VERSION)
35 AC_SUBST(LIBGTOP_MICRO_VERSION)
36 AC_SUBST(LIBGTOP_VERSION)
37 AC_SUBST(LIBGTOP_VERSION_CODE)
38 AC_SUBST(LIBGTOP_SERVER_VERSION)
39 AC_SUBST(LIBGTOP_INTERFACE_AGE)
40 AC_SUBST(LIBGTOP_BINARY_AGE)
41 AC_SUBST(LIBGTOP_BINDIR)
42 AC_SUBST(LIBGTOP_SERVER)
44 dnl Get the cflags and libraries from the libgtop-config script
47 [ --with-libgtop=PFX Prefix where LIBGTOP is installed (optional)],
48 libgtop_config_prefix="$withval", libgtop_config_prefix="")
49 AC_ARG_WITH(libgtop-exec,
50 [ --with-libgtop-exec=PFX Exec prefix where LIBGTOP is installed (optional)],
51 libgtop_config_exec_prefix="$withval", libgtop_config_exec_prefix="")
53 if test x$libgtop_config_exec_prefix != x ; then
54 libgtop_config_args="$libgtop_config_args --exec-prefix=$libgtop_config_exec_prefix"
55 if test x${LIBGTOP_CONFIG+set} != xset ; then
56 LIBGTOP_CONFIG=$libgtop_config_exec_prefix/bin/libgtop-config
59 if test x$libgtop_config_prefix != x ; then
60 libgtop_config_args="$libgtop_config_args --prefix=$libgtop_config_prefix"
61 if test x${LIBGTOP_CONFIG+set} != xset ; then
62 LIBGTOP_CONFIG=$libgtop_config_prefix/bin/libgtop-config
66 AC_PATH_PROG(LIBGTOP_CONFIG, libgtop-config, no)
68 dnl If you increase this number here, this means that *ALL*
69 dnl modules will require the new version, even if they explicitly
70 dnl give a lower number in their `configure.in' !!!
71 real_min_libgtop_version=1.0.0
72 min_libgtop_version=ifelse([$1], ,$real_min_libgtop_version,$1)
73 dnl I know, the following code looks really ugly, but if you want
74 dnl to make changes, please test it with a brain-dead /bin/sh and
75 dnl with a brain-dead /bin/test (not all shells/tests support the
76 dnl `<' operator to compare strings, that's why I convert everything
77 dnl into numbers and test them).
78 min_libgtop_major=`echo $min_libgtop_version | \
79 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
80 min_libgtop_minor=`echo $min_libgtop_version | \
81 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
82 min_libgtop_micro=`echo $min_libgtop_version | \
83 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
84 test x$min_libgtop_micro = x && min_libgtop_micro=0
85 real_min_libgtop_major=`echo $real_min_libgtop_version | \
86 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
87 real_min_libgtop_minor=`echo $real_min_libgtop_version | \
88 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
89 real_min_libgtop_micro=`echo $real_min_libgtop_version | \
90 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
91 test x$real_min_libgtop_micro = x && real_min_libgtop_micro=0
92 dnl You cannot require a version less then $real_min_libgtop_version,
93 dnl so you don't need to update each `configure.in' when it's increased.
94 if test $real_min_libgtop_major -gt $min_libgtop_major ; then
95 min_libgtop_major=$real_min_libgtop_major
96 min_libgtop_minor=$real_min_libgtop_minor
97 min_libgtop_micro=$real_min_libgtop_micro
98 elif test $real_min_libgtop_major = $min_libgtop_major ; then
99 if test $real_min_libgtop_minor -gt $min_libgtop_minor ; then
100 min_libgtop_minor=$real_min_libgtop_minor
101 min_libgtop_micro=$real_min_libgtop_micro
102 elif test $real_min_libgtop_minor = $min_libgtop_minor ; then
103 if test $real_min_libgtop_micro -gt $min_libgtop_micro ; then
104 min_libgtop_micro=$real_min_libgtop_micro
108 min_libgtop_version="$min_libgtop_major.$min_libgtop_minor.$min_libgtop_micro"
109 AC_MSG_CHECKING(for libgtop - version >= $min_libgtop_version)
111 if test "$LIBGTOP_CONFIG" = "no" ; then
114 configfile=`$LIBGTOP_CONFIG --config`
115 libgtop_major_version=`$LIBGTOP_CONFIG --version | \
116 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
117 libgtop_minor_version=`$LIBGTOP_CONFIG --version | \
118 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
119 libgtop_micro_version=`$LIBGTOP_CONFIG --version | \
120 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
121 if test $libgtop_major_version != $min_libgtop_major ; then
124 test $libgtop_minor_version -lt $min_libgtop_minor && no_libgtop=yes
125 if test $libgtop_minor_version = $min_libgtop_minor ; then
126 test $libgtop_micro_version -lt $min_libgtop_micro && no_libgtop=yes
131 if test x$no_libgtop = x ; then
132 AC_DEFINE(HAVE_LIBGTOP)
133 AC_DEFINE_UNQUOTED(LIBGTOP_VERSION, "$LIBGTOP_VERSION")
134 AC_DEFINE_UNQUOTED(LIBGTOP_VERSION_CODE, $LIBGTOP_VERSION_CODE)
135 AC_DEFINE_UNQUOTED(LIBGTOP_MAJOR_VERSION, $LIBGTOP_MAJOR_VERSION)
136 AC_DEFINE_UNQUOTED(LIBGTOP_MINOR_VERSION, $LIBGTOP_MINOR_VERSION)
137 AC_DEFINE_UNQUOTED(LIBGTOP_MICRO_VERSION, $LIBGTOP_MICRO_VERSION)
138 AC_DEFINE_UNQUOTED(LIBGTOP_SERVER_VERSION, $LIBGTOP_SERVER_VERSION)
140 dnl Note that an empty true branch is not valid sh syntax.
141 ifelse([$2], [], :, [$2])
144 if test "$no_libgtop"x = mismatchx; then
145 AC_MSG_ERROR(LibGTop major version mismatch $libgtop_major_version != $min_libgtop_major)
147 if test "x$3" = "xfail"; then
148 AC_MSG_ERROR(LibGTop >= $min_libgtop_version not found)
150 AC_MSG_WARN(LibGTop >= $min_libgtop_version not found)
154 AM_CONDITIONAL(HAVE_LIBGTOP, test x$no_libgtop != xyes)
157 AC_DEFUN([GNOME_INIT_LIBGTOP],[
158 GNOME_LIBGTOP_HOOK($1,[ifelse([$3], [], :, [$3])],$2)
162 dnl GNOME_LIBGTOP_DOCU
164 dnl checks whether the documentation of LibGTop is installed
167 AC_DEFUN([GNOME_LIBGTOP_DOCU],
169 AC_REQUIRE([GNOME_LIBGTOP_HOOK])
171 helpdir="$LIBGTOP_DATADIR/gnome/help/libgtop"
173 AC_MSG_CHECKING(whether you have the LibGTop Documentation)
175 if test -f "$helpdir/C/topic.dat" ; then
176 have_libgtop_docu=yes
177 AC_DEFINE(HAVE_LIBGTOP_DOCU)
182 AC_MSG_RESULT($have_libgtop_docu)
184 AM_CONDITIONAL(HAVE_LIBGTOP_DOCU, test x$have_libgtop_docu = xyes)