1
# Configure paths for Bonobo
2
# Miguel de Icaza, 99-04-12
3
# Stolen from Chris Lahey 99-2-5
4
# stolen from Manish Singh again
5
# stolen back from Frank Belew
6
# stolen from Manish Singh
7
# Shamelessly stolen from Owen Taylor
9
dnl AM_PATH_BONOBO ([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
10
dnl Test for Bonobo, and define BONOBO_CFLAGS and BONOBO_LIBS
12
AC_DEFUN([AM_PATH_BONOBO],
15
dnl Get the cflags and libraries from the gnome-config script
17
AC_ARG_WITH(bonobo-prefix,[ --with-bonobo-prefix=PFX Prefix where Bonobo is installed (optional)],
18
bonobo_prefix="$withval", bonobo_prefix="")
19
AC_ARG_WITH(bonobo-exec-prefix,[ --with-bonobo-exec-prefix=PFX Exec prefix where Bonobo is installed (optional)],
20
bonobo_exec_prefix="$withval", bonobo_exec_prefix="")
21
AC_ARG_ENABLE(bonobotest, [ --disable-bonobotest Do not try to compile and run a test Bonobo program],
22
, enable_bonobotest=yes)
24
if test x$bonobo_exec_prefix != x ; then
25
bonobo_args="$bonobo_args --exec-prefix=$bonobo_exec_prefix"
26
if test x${GNOME_CONFIG+set} != xset ; then
27
GNOME_CONFIG=$bonobo_exec_prefix/bin/gnome-config
30
if test x$bonobo_prefix != x ; then
31
bonobo_args="$bonobo_args --prefix=$bonobo_prefix"
32
if test x${GNOME_CONFIG+set} != xset ; then
33
GNOME_CONFIG=$bonobo_prefix/bin/gnome-config
37
AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
38
min_bonobo_version=ifelse([$1], ,0.1.0,$1)
39
AC_MSG_CHECKING(for BONOBO - version >= $min_bonobo_version)
41
if test "$GNOME_CONFIG" = "no" ; then
44
BONOBO_CFLAGS=`$GNOME_CONFIG $bonoboconf_args --cflags bonobo`
45
BONOBO_LIBS=`$GNOME_CONFIG $bonoboconf_args --libs bonobo`
47
bonobo_major_version=`$GNOME_CONFIG $bonobo_args --version | \
48
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
49
bonobo_minor_version=`$GNOME_CONFIG $bonobo_args --version | \
50
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
51
bonobo_micro_version=`$GNOME_CONFIG $bonobo_config_args --version | \
52
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
53
if test "x$enable_bonobotest" = "xyes" ; then
54
ac_save_CFLAGS="$CFLAGS"
56
CFLAGS="$CFLAGS $BONOBO_CFLAGS"
57
LIBS="$LIBS $BONOBO_LIBS"
59
dnl Now check if the installed BONOBO is sufficiently new. (Also sanity
60
dnl checks the results of gnome-config to some extent
76
new_str = malloc ((strlen (str) + 1) * sizeof(char));
77
strcpy (new_str, str);
87
int major, minor, micro;
90
system ("touch conf.bonobotest");
91
bonobo_object_get_type ();
95
],, no_bonobo=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
96
CFLAGS="$ac_save_CFLAGS"
100
if test "x$no_bonobo" = x ; then
102
ifelse([$2], , :, [$2])
105
if test "$GNOME_CONFIG" = "no" ; then
106
echo "*** The gnome-config script installed by GNOME-LIBS could not be found"
107
echo "*** If BONOBO was installed in PREFIX, make sure PREFIX/bin is in"
108
echo "*** your path, or set the GNOME_CONFIG environment variable to the"
109
echo "*** full path to gnome-config."
111
if test -f conf.bonobotest ; then
114
echo "*** Could not run BONOBO test program, checking why..."
115
CFLAGS="$CFLAGS $BONOBO_CFLAGS"
116
LIBS="$LIBS $BONOBO_LIBS"
119
#include <bonobo/gnome-object.h>
121
[ echo "*** The test program compiled, but did not run. This usually means"
122
echo "*** that the run-time linker is not finding BONOBO or finding the wrong"
123
echo "*** version of BONOBO. If it is not finding BONOBO, you'll need to set your"
124
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
125
echo "*** to the installed location Also, make sure you have run ldconfig if that"
126
echo "*** is required on your system"
128
echo "*** If you have an old version installed, it is best to remove it, although"
129
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
130
[ echo "*** The test program failed to compile or link. See the file config.log for the"
131
echo "*** exact error that occured. This usually means BONOBO was incorrectly installed"
132
echo "*** or that you have moved BONOBO since it was installed. In the latter case, you"
133
echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ])
134
CFLAGS="$ac_save_CFLAGS"
140
ifelse([$3], , :, [$3])
142
AC_SUBST(BONOBO_CFLAGS)
143
AC_SUBST(BONOBO_LIBS)
144
rm -f conf.bonobotest
147
AC_DEFUN([BONOBO_CHECK], [
148
AM_PATH_BONOBO(0.1.0,,[AC_MSG_ERROR(BONOBO not found)])
151
AC_DEFUN([AM_BONOBO_USES_OAF],
153
AC_REQUIRE([AM_PATH_BONOBO])
155
AC_MSG_CHECKING(if Bonobo uses OAF)
156
if ( gnome-config --libs bonobo | grep oaf ) > /dev/null 2>&1 ; then
158
AC_DEFINE(BONOBO_USES_OAF)
163
AC_MSG_RESULT("$using_oaf")
165
AM_CONDITIONAL(BONOBO_USES_OAF, test x"using_oaf" = "xyes")