$OpenBSD: patch-configure_in,v 1.2 2003/02/18 19:10:33 marcm Exp $
--- configure.in.orig	Wed Oct 23 05:24:25 2002
+++ configure.in	Mon Jan 20 20:14:39 2003
@@ -1821,6 +1821,10 @@ AC_ARG_WITH(gtk,
 [  --with-gtk              Use the Gtk toolkit for the user interface.],
   [with_gtk="$withval"; with_gtk_req="$withval"],[with_gtk=yes])
 
+AC_ARG_WITH(gtk2,
+[  --with-gtk2             Use the Gtk2 toolkit for the user interface.],
+  [with_gtk2="$withval"; with_gtk_req2="$withval"],[with_gtk2=no])
+
 # if --with-gtk=/directory/ was specified, remember that directory so that
 # we can also look for the `gtk-config' program in that directory.
 case "$with_gtk" in
@@ -1902,7 +1906,12 @@ if test "$with_gtk" = yes; then
     gtk_path="$foo:$gtk_path"
   fi
 
-  AC_PATH_PROGS(pkg_config, pkg-config,, $gtk_path)
+  # Nifty hack: if we don't specify gtk2 we don't want it.  If gtk2 isn't asked
+  # for specifically, we don't use pkgconfig; therefore we don't pick up gtk2
+  # as gtk2 only uses pkgconfig.
+  if test "$with_gtk2" = yes; then
+    AC_PATH_PROGS(pkg_config, pkg-config,, $gtk_path)
+  fi
 
   if test -n "$pkg_config" ; then
     #
@@ -1952,7 +1961,10 @@ if test "$with_gtk" = yes; then
       fi
     fi
 
-    if test "$have_gtk" = no; then
+    # Nifty hack #2: If we did specify gtk2, don't give us gtk1.  We shouldn't
+    # even be here anymore unless $with_gtk2 == yes, so the gtk1 stuff below
+    # will never get run.
+    if test "$have_gtk" = no -a "$with_gtk2" = no; then
       #
       # we don't have GTK 2.  Let's look for GTK 1.
       #
@@ -2098,7 +2110,7 @@ if test "$with_gtk" = yes; then
 
   fi   # end of {gnome,gtk}-config based tests
 
-  if test "$have_gtk" = yes -a "$have_gtk2" = no; then
+  if test "$have_gnome" = yes -a "$have_gtk2" = no; then
     # check for this function that was not in libcapplet 1.2.
     # (only needed in Gnome/Gtk 1.x, not Gnome/Gtk 2.x)
     AC_CHECK_X_LIB(capplet, capplet_widget_changes_are_immediate,
@@ -2113,7 +2125,7 @@ if test "$with_gtk" = yes; then
       if test "$have_gtk2" = yes; then
         GNOME_DATADIR=`$pkg_config --variable=prefix gtk+-2.0`
       else
-        GNOME_DATADIR=`$pkg_config --variable=prefix gtk+`
+        GNOME_DATADIR=`$gtk_config --prefix`
       fi
     else
       GNOME_DATADIR=`$gtk_config --prefix`
@@ -2511,7 +2523,7 @@ if test "$with_gl" = yes; then
     # link -lpthread after the Mesa libs (be they named -lGL or -lMesaGL.)
     #
     if test "$ac_have_mesa_gl" = yes; then
-      AC_CHECK_LIB(pthread, pthread_create, [GL_LIBS="-lpthread"], [],)
+      AC_CHECK_LIB(pthread, pthread_create, [GL_LIBS="-pthread"], [],)
     fi
 
 
@@ -3326,7 +3338,7 @@ fi
 # config files get installed.
 #
 if test -z "$HACK_CONF_DIR" ; then
-  if test -n "$GNOME_DATADIR" ; then
+  if test "x$with_gnome" == "xyes"; then
     HACK_CONF_DIR='${GNOME_DATADIR}/control-center/screensavers'
   else
     HACK_CONF_DIR='${prefix}/lib/xscreensaver/config'
@@ -3350,7 +3362,7 @@ elif test "$have_gtk" = yes; then
     if test "$have_gtk2" = yes; then
       GLADE_DATADIR=`$pkg_config --variable=prefix gtk+-2.0`
     else
-      GLADE_DATADIR=`$pkg_config --variable=prefix gtk+`
+      GLADE_DATADIR=`$gtk_config --prefix`
     fi
   else
     GLADE_DATADIR=`$gtk_config --prefix`
@@ -3371,7 +3383,7 @@ elif test "$have_gtk" = yes; then
     if test "$have_gtk2" = yes; then
       PO_DATADIR=`$pkg_config --variable=prefix gtk+-2.0`
     else
-      PO_DATADIR=`$pkg_config --variable=prefix gtk+`
+      PO_DATADIR=`$gtk_config --prefix`
     fi
   else
     PO_DATADIR=`$gtk_config --prefix`
