Patches for building SANE with GTK+ 0.99.7 and above

Ben Gertzfield (che@debian.org)
20 Mar 1998 22:21:39 -0800

The following patches are to a pristine SANE 0.71 and patch a few
problems with GTK support:

* API changes to GTK+ 0.99.3
* gtk-config program and gtk.m4 autoconf support provide proper
include paths and -l flags; modified configure.in and
frontends/Makefile.in to accomodate changes for this.

Please let me know if anyone runs into any problems with these
patches. These patches *require* GTK+ 0.99.7 and above.

I'm not currently subscribed to sane-devel, so please Cc: responses
to me.

Ben

diff -ruN sane-0.71.orig/frontend/gtkglue.c sane-0.71/frontend/gtkglue.c
--- sane-0.71.orig/frontend/gtkglue.c Mon Jan 26 23:38:36 1998
+++ sane-0.71/frontend/gtkglue.c Fri Mar 13 19:47:13 1998
@@ -71,7 +71,7 @@
set_tooltip (GtkTooltips *tooltips, GtkWidget *widget, const char *desc)
{
if (desc && desc[0])
- gtk_tooltips_set_tips (tooltips, widget, (char *) desc);
+ gtk_tooltips_set_tip (tooltips, widget, (char *) desc, NULL);
}

int
@@ -808,7 +808,7 @@
GSGDialogElement *elem;
int i, j;

- gtk_tooltips_unref (dialog->tooltips);
+ gtk_object_unref (GTK_OBJECT (dialog->tooltips));
gtk_widget_destroy (dialog->main_hbox);

/* free the menu labels of integer/fix-point word-lists: */
diff -ruN sane-0.71.orig/frontend/xcam.c sane-0.71/frontend/xcam.c
--- sane-0.71.orig/frontend/xcam.c Mon Jan 19 23:39:51 1998
+++ sane-0.71/frontend/xcam.c Fri Mar 13 19:47:17 1998
@@ -896,7 +896,7 @@

sane_init (NULL, 0);

- gdk_set_debug_level (0);
+ /* gdk_set_debug_level (0); */
gdk_set_show_events (0);
gtk_init (&argc, &argv);

--- sane-0.71.orig/configure.in Mon Feb 23 21:46:04 1998
+++ sane-0.71/configure.in Fri Mar 20 21:17:14 1998
@@ -82,66 +82,20 @@

dnl Checks for libraries.

-#### Choose a window system.
-
-AC_PATH_X
-if test "$no_x" = yes; then
- window_system=none
-else
- window_system=x11
-fi
-
-if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
- LD_SWITCH_X_SITE=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"`
- LD_SWITCH_X_SITE_AUX=-R`echo ${x_libraries} | sed -e "s/:/ -R/g"`
-fi
-if test "${x_includes}" != NONE && test -n "${x_includes}"; then
- C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"`
-fi
-
-if test "${enable_dynamic}" != "no"; then
- AC_CHECK_HEADERS(dlfcn.h,
- [AC_CHECK_LIB(dl,dlopen)
- AC_CHECK_FUNCS(dlopen, , enable_dynamic=no)],
- [enable_dynamic=no])
-fi
+AM_PATH_GTK(,XSCAN="xscanimage xcam",AC_MSG_WARN(GTK not found. Skipping xscanimage/xcam. Is gtk-config in your path?))
+AC_SUBST(XSCAN)

-# Change CFLAGS temporarily so that C_SWITCH_X_SITE gets used
-# for the tests that follow. We set it back to REAL_CFLAGS later on.
+GIMP_SAVELIBS=$LIBS
+GIMP_SAVECPPFLAGS=$CFLAGS
+LIBS="$LIBS $GTK_LIBS"
+CPPFLAGS="$CFLAGS $GTK_CFLAGS"

-HAVE_X11=yes
-if test "${HAVE_X11}" = "yes"; then
- DEFS="$C_SWITCH_X_SITE $DEFS"
- LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE"
- LIBS="$LIBX $LIBS"
- CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
+AC_CHECK_HEADERS(libgimp/gimp.h,LIBGIMP="-lgimp")
+AC_SUBST(LIBGIMP)

- # On Solaris, arrange for LD_RUN_PATH to point to the X libraries for tests.
- # This is handled by LD_SWITCH_X_SITE_AUX during the real build,
- # but it's more convenient here to set LD_RUN_PATH
- # since this also works on hosts that don't understand LD_SWITCH_X_SITE_AUX.
- if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
- LD_RUN_PATH=$x_libraries${LD_RUN_PATH+:}$LD_RUN_PATH
- export LD_RUN_PATH
- fi
+LIBS=$GIMP_SAVELIBS
+CPPFLAGS=$GIMP_SAVECPPFLAGS

- SAVED_LIBS="$LIBS"
- AC_CHECK_LIB(X11,main)
- AC_CHECK_LIB(Xext,main)
- AC_CHECK_LIB(Xpm,main)
- LIBX11="$LIBS"
- AC_CHECK_LIB(glib,main)
- AC_CHECK_LIB(gdk,main)
- AC_CHECK_LIB(gtk,gtk_gamma_curve_new,XSCAN="xscanimage xcam";
- LIBS="-lgtk ${LIBS}")
- LIBGTK="$LIBS"
- AC_CHECK_HEADERS(libgimp/gimp.h,LIBGIMP="-lgimp")
- LIBS="$SAVED_LIBS"
-fi
-AC_SUBST(XSCAN)
-AC_SUBST(LIBX11)
-AC_SUBST(LIBGTK)
-AC_SUBST(LIBGIMP)
CPPFLAGS="${CPPFLAGS} -DPATH_SANE_CONFIG_DIR=\$(configdir) \
-DPATH_SANE_DATA_DIR=\$(datadir) \
-DV_MAJOR=${V_MAJOR} -DV_MINOR=${V_MINOR}"

--- sane-0.71.orig/frontend/Makefile.in Tue Nov 4 23:36:47 1997
+++ sane-0.71/frontend/Makefile.in Fri Mar 20 21:39:39 1998
@@ -28,13 +28,13 @@

CC = @CC@
INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include \
- -I/usr/local/include
+ -I/usr/local/include @GTK_CFLAGS@
CPPFLAGS = @CPPFLAGS@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
-LIBX11 = @LIBX11@
-LIBGTK = @LIBGTK@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
DEFS = @DEFS@

LIBTOOL = ../libtool
@@ -88,11 +88,11 @@

xscanimage: $(XSCAN_OBJS) $(LIBSANEI) $(LIBSANE) $(LIBLIB)
@$(LIBTOOL) $(MLINK) $(LINK) $(XSCAN_OBJS) $(LIBSANEI) $(LIBSANE) \
- $(LIBLIB) @LIBGIMP@ $(LIBGTK)
+ $(LIBLIB) @LIBGIMP@ $(GTK_LIBS) $(GTK_CFLAGS)

xcam: $(XCAM_OBJS) $(LIBSANE) $(LIBSANEI) $(LIBLIB)
@$(LIBTOOL) $(MLINK) $(LINK) $(XCAM_OBJS) $(LIBSANEI) $(LIBSANE) \
- $(LIBLIB) $(LIBGTK)
+ $(LIBLIB) $(GTK_LIBS) $(GTK_CFLAGS)

clean:
rm -f *.o *~ .*~ *.bak

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com