1 # Configure paths for GNOME-PRINT
3 # stolen from Manish Singh again
4 # stolen back from Frank Belew
5 # stolen from Manish Singh
6 # Shamelessly stolen from Owen Taylor
8 dnl AM_PATH_GNOME_PRINT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
9 dnl Test for GNOME-PRINT, and define GNOME_PRINT_CFLAGS and GNOME_PRINT_LIBS
11 AC_DEFUN(AM_PATH_GNOME_PRINT,
13 dnl Get the cflags and libraries from the gnome-config script
15 AC_ARG_WITH(gnome-print-prefix,[ --with-gnome-print-prefix=PFX Prefix where GNOME-PRINT is installed (optional)],
16 gnome_print_prefix="$withval", gnome_print_prefix="")
17 AC_ARG_WITH(gnome-print-exec-prefix,[ --with-gnome-print-exec-prefix=PFX Exec prefix where GNOME-PRINT is installed (optional)],
18 gnome_print_exec_prefix="$withval", gnome_print_exec_prefix="")
19 AC_ARG_ENABLE(gnome-printtest, [ --disable-gnome-printtest Do not try to compile and run a test GNOME-PRINT program],
20 , enable_gnome_printtest=yes)
22 if test x$gnome_print_exec_prefix != x ; then
23 gnome_print_args="$gnome_print_args --exec-prefix=$gnome_print_exec_prefix"
24 if test x${GNOME_CONFIG+set} != xset ; then
25 GNOME_CONFIG=$gnome_print_exec_prefix/bin/gnome-config
28 if test x$gnome_print_prefix != x ; then
29 gnome_print_args="$gnome_print_args --prefix=$gnome_print_prefix"
30 if test x${GNOME_CONFIG+set} != xset ; then
31 GNOME_CONFIG=$gnome_print_prefix/bin/gnome-config
35 AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
36 min_gnome_print_version=ifelse([$1], ,0.1.0,$1)
37 AC_MSG_CHECKING(for GNOME-PRINT - version >= $min_gnome_print_version)
39 if test "$GNOME_CONFIG" = "no" ; then
42 GNOME_PRINT_CFLAGS=`$GNOME_CONFIG $gnome_printconf_args --cflags print`
43 GNOME_PRINT_LIBS=`$GNOME_CONFIG $gnome_printconf_args --libs print`
45 gnome_print_major_version=`$GNOME_CONFIG $gnome_print_args --version | \
46 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
47 gnome_print_minor_version=`$GNOME_CONFIG $gnome_print_args --version | \
48 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
49 gnome_print_micro_version=`$GNOME_CONFIG $gnome_print_config_args --version | \
50 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
51 if test "x$enable_gnome_printtest" = "xyes" ; then
52 ac_save_CFLAGS="$CFLAGS"
54 CFLAGS="$CFLAGS $GNOME_PRINT_CFLAGS"
55 LIBS="$LIBS $GNOME_PRINT_LIBS"
57 dnl Now check if the installed GNOME-PRINT is sufficiently new. (Also sanity
58 dnl checks the results of gnome-config to some extent
60 rm -f conf.gnome_printtest
65 #include <libgnomeprint/gnome-print.h>
74 new_str = malloc ((strlen (str) + 1) * sizeof(char));
75 strcpy (new_str, str);
85 int major, minor, micro;
88 system ("touch conf.gnome_printtest");
90 /* HP/UX 9 (%@#!) writes to sscanf strings */
91 tmp_version = my_strdup("$min_gnome_print_version");
92 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
93 printf("%s, bad version string\n", "$min_gnome_print_version");
98 if (($gnome_print_major_version > major) ||
99 (($gnome_print_major_version == major) && ($gnome_print_minor_version > minor)) ||
100 (($gnome_print_major_version == major) && ($gnome_print_minor_version == minor) && ($gnome_print_micro_version >= micro)))
106 printf("\n*** 'gnome-config print --version' returned %d.%d.%d, but the minimum version\n", $gnome_print_major_version, $gnome_print_minor_version, $gnome_print_micro_version);
107 printf("*** of GNOME-PRINT required is %d.%d.%d. If gnome-config is correct, then it is\n", major, minor, micro);
108 printf("*** best to upgrade to the required version.\n");
109 printf("*** If gnome-config was wrong, set the environment variable GNOME_CONFIG\n");
110 printf("*** to point to the correct copy of gnome-config, and remove the file\n");
111 printf("*** config.cache before re-running configure\n");
117 ],, no_gnome_print=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
118 CFLAGS="$ac_save_CFLAGS"
122 if test "x$no_gnome_print" = x ; then
124 ifelse([$2], , :, [$2])
127 if test "$GNOME_CONFIG" = "no" ; then
128 echo "*** The gnome-config script installed by GNOME-LIBS could not be found"
129 echo "*** If GNOME-PRINT was installed in PREFIX, make sure PREFIX/bin is in"
130 echo "*** your path, or set the GNOME_CONFIG environment variable to the"
131 echo "*** full path to gnome-config."
133 if test -f conf.gnome_printtest ; then
136 echo "*** Could not run GNOME-PRINT test program, checking why..."
137 CFLAGS="$CFLAGS $GNOME_PRINT_CFLAGS"
138 LIBS="$LIBS $GNOME_PRINT_LIBS"
141 #include <libgnomeprint/gnome-print.h>
143 [ echo "*** The test program compiled, but did not run. This usually means"
144 echo "*** that the run-time linker is not finding GNOME-PRINT or finding the wrong"
145 echo "*** version of GNOME-PRINT. If it is not finding GNOME-PRINT, you'll need to set your"
146 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
147 echo "*** to the installed location Also, make sure you have run ldconfig if that"
148 echo "*** is required on your system"
150 echo "*** If you have an old version installed, it is best to remove it, although"
151 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
152 [ echo "*** The test program failed to compile or link. See the file config.log for the"
153 echo "*** exact error that occured. This usually means GNOME-PRINT was incorrectly installed"
154 echo "*** or that you have moved GNOME-PRINT since it was installed. In the latter case, you"
155 echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ])
156 CFLAGS="$ac_save_CFLAGS"
160 GNOME_PRINT_CFLAGS=""
162 ifelse([$3], , :, [$3])
164 AC_SUBST(GNOME_PRINT_CFLAGS)
165 AC_SUBST(GNOME_PRINT_LIBS)
166 rm -f conf.gnome_printtest
169 AC_DEFUN([GNOME_PRINT_CHECK], [
170 AM_PATH_GNOME_PRINT(0.1.0,,[AC_MSG_ERROR(GNOME-PRINT not found)])