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