ftp://ftp.krokus.ru/pub/OpenBSD/distfiles/xscreensaver-4.06.tar.gz
[xscreensaver] / configure.in
index 901b5a23a02063a67ae8120877436c3e947df445..e5579217d24fd979cc15e28275dd41752365ba5d 100644 (file)
@@ -1,4 +1,4 @@
-# configure.in --- xscreensaver, Copyright (c) 1997-2000 Jamie Zawinski.
+# configure.in --- xscreensaver, Copyright (c) 1997-2002 Jamie Zawinski.
 #
 
 AC_PREREQ(2.52)
@@ -65,7 +65,7 @@ AC_DEFUN(AC_PROG_CC_ANSI,
 
   if test -n "$GCC"; then
     AC_MSG_RESULT(Turning on gcc compiler warnings.)
-    CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format"
+    CC="$CC -Wall -Wstrict-prototypes -Wnested-externs"
   else
     case "$host" in
       *-irix5* |*-irix6.[0-3]* )
@@ -808,9 +808,7 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE")
 AC_DEFINE_UNQUOTED(PACKAGE, "$GETTEXT_PACKAGE")
 AC_SUBST(GETTEXT_PACKAGE)
 
-# #### no sign of  en_GB
-#ALL_LINGUAS="ca de en_GB et fr it ko pl sv da es fi hu ja no pt pt_BR ru wa"
-ALL_LINGUAS="ca de et fr it ko pl sv da es fi hu ja no pt pt_BR ru wa"
+ALL_LINGUAS="ca da de es et fi fr hu it ja ko nl no pl pt pt_BR ru sk sv vi wa zh_CN zh_TW"
 AM_GLIB_GNU_GETTEXT
 
 
@@ -1882,6 +1880,8 @@ parse_gtk_version_string() {
 
 
 jurassic_gtk=no
+gtk2_halfassed=no
+
 if test "$with_gtk" = yes; then
   have_gtk=no
   
@@ -1945,6 +1945,11 @@ if test "$with_gtk" = yes; then
     if test "$have_gtk" = yes; then
       have_gtk2=yes
       AC_DEFINE(HAVE_GTK2)
+    else
+      if test -n "$ac_gtk_version_string" ; then
+        gtk2_halfassed="$ac_gtk_version_string"
+        gtk2_halfassed_lib="$req"
+      fi
     fi
 
     if test "$have_gtk" = no; then
@@ -1959,7 +1964,7 @@ if test "$with_gtk" = yes; then
 
       # Now check for Gnome...
       #
-      if test "$have_gtk" = yes; then
+      if test "$have_gtk" = yes -a "$with_gnome" = yes; then
         old_pkgs="$pkgs"
         ok=yes
         pkg_check_version capplet    1.0
@@ -2039,6 +2044,11 @@ if test "$with_gtk" = yes; then
     ac_gtk_config_libs=$ac_cv_gtk_config_libs
 
     # Check for Gnome Capplet support.
+    # Note that this is only needed with Gnome 1.x, not Gnome 2.x.
+    # In a Gnome 2.x world, libcapplet will not exist.
+    # (In fact, this likely won't even be checked, since in a Gnome 2.x
+    # world, we will probably be up in the "$pkg_config" branch instead
+    # of here in the "$gnome_config" branch.)
     #
     if test "$have_gnome" = yes -a "$have_gtk" = yes; then
       gnome_config_libs="gtk capplet gnomeui gdk_pixbuf"
@@ -2090,6 +2100,7 @@ if test "$with_gtk" = yes; then
 
   if test "$have_gtk" = 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,
                    [AC_DEFINE(HAVE_CRAPPLET_IMMEDIATE)], [true],
                    $ac_gnome_config_libs)
@@ -2097,14 +2108,17 @@ if test "$with_gtk" = yes; then
 
 
   GNOME_DATADIR=""
-  if test "$have_gnome" = yes -a "$have_gtk" = yes; then
-    if test -n "$gnome_config"; then
-      GNOME_DATADIR=`$gnome_config --datadir`
+  if test "$have_gtk" = yes; then
+    if test -n "$pkg_config"; then
+      if test "$have_gtk2" = yes; then
+        GNOME_DATADIR=`$pkg_config --variable=prefix gtk+-2.0`
+      else
+        GNOME_DATADIR=`$pkg_config --variable=prefix gtk+`
+      fi
     else
-      #### is this right?
-      GNOME_DATADIR=`$pkg_config --variable=prefix gtk+`
-      GNOME_DATADIR="$GNOME_DATADIR/share"
+      GNOME_DATADIR=`$gtk_config --prefix`
     fi
+    GNOME_DATADIR="$GNOME_DATADIR/share"
   fi
 
   # .desktop files go in different places in Gnome 1.x and Gnome 2.x...
@@ -2132,10 +2146,11 @@ fi
 
 # Check for the Gnome Help Browser.
 #
-if test "$have_gnome" = yes; then
-  AC_CHECK_PROG(have_gnome_help, gnome-help-browser, yes, no)
-else
-  have_gnome_help=no
+if test "$have_gtk" = yes; then
+  AC_CHECK_PROGS(have_gnome_help, yelp gnome-help-browser, no)
+  if test "$have_gnome_help" != no; then
+    have_gnome_help=yes
+  fi
 fi
 
 
@@ -2200,11 +2215,21 @@ if test "$with_xml" = yes; then
     #
     pkgs=""
     ok="yes"
-    pkg_check_version xml2 1.0
 
-    if test "$ok" = no; then
+    # If we have Gtk 2.x, then *only* XML 2.x will work.
+    # If we have Gtk 1.x, or don't have Gtk at all, then
+    # either XML 1.x or 2.x will work.
+
+    # First check for XML 2.x.
+    #
+    pkg_check_version libxml-2.0 2.4.6
+
+    # If that didn't work (we don't have XML 2.x) and we *don't* have
+    # Gtk 2.x, then check to see if we have XML 1.x
+    #
+    if test "$ok" = no -a "$have_gtk2" = no; then
       ok=yes
-      pkg_check_version xml 1.0
+      pkg_check_version libxml 1.0
     fi
 
     have_xml="$ok"
@@ -2221,7 +2246,7 @@ if test "$with_xml" = yes; then
   else
     #
     # the old way...
-    # run {gnome,gtk}-config based tests.
+    # run {xml2,xml}-config based tests.
     #
 
     AC_PATH_PROGS(xml_config, xml2-config xml-config,, $xml_path)
@@ -2272,7 +2297,7 @@ if test "$with_xml" = yes; then
     # we have the header, now check for the library
     have_xml=no
     xml_halfassed=yes
-    AC_CHECK_X_LIB(xml, xmlParseChunk,
+    AC_CHECK_X_LIB(c, xmlParseChunk,
                    [have_xml=yes
                     xml_halfassed=no
                     XML_LIBS="$ac_xml_config_libs"
@@ -2615,7 +2640,9 @@ HANDLE_X_PATH_ARG(with_gle, --with-gle, GLE)
 
 GLE_LIBS=""
 
-if test "$with_gle" = yes; then
+if test "$have_gl" = no ; then
+ true
+elif test "$with_gle" = yes; then
 
   AC_CHECK_X_HEADER(GL/gle.h, have_gle3=yes, have_gle3=no,
                     [#include <GL/gl.h>])
@@ -2763,20 +2790,33 @@ if test "$with_gdk_pixbuf" = yes; then
     #
     pkgs=''
     ok="yes"
-    pkg_check_version gdk-pixbuf-2.0      2.0.0
-    pkg_check_version gdk-pixbuf-xlib-2.0 2.0.0
-    have_gdk_pixbuf="$ok"
-    have_gdk_pixbuf2="$ok"
 
-    if test "$have_gdk_pixbuf2" = no; then
+    # If we have Gtk 2.x, then *only* gdk-pixbuf 2.x will work.
+    # If we have Gtk 1.x, then *only* gdk-pixbuf 1.x will work.
+    # If we don't have Gtk at all, then either will work.
+
+    if test "$have_gtk" = no -o "$have_gtk2" = yes; then
       #
-      # We don't have pixbuf 2.x; check for 1.x.
+      # we don't have Gtk; or we have Gtk 2.x.  Check for pixbuf 2.x.
       #
-      pkgs=''
-      ok="yes"
-      pkg_check_version gdk-pixbuf      0.0
-      pkg_check_version gdk-pixbuf-xlib 0.0
+      pkg_check_version gdk-pixbuf-2.0      2.0.0
+      pkg_check_version gdk-pixbuf-xlib-2.0 2.0.0
       have_gdk_pixbuf="$ok"
+      have_gdk_pixbuf2="$ok"
+    fi
+
+    if test "$have_gtk" = no -o "$have_gtk2" = no; then
+      #
+      # we don't have Gtk; or we have Gtk 1.x.
+      # If we don't have pixbuf 2.x, then check for pixbuf 1.x.
+      #
+      if test "$have_gdk_pixbuf2" = no; then
+        pkgs=''
+        ok="yes"
+        pkg_check_version gdk-pixbuf      0.0
+        pkg_check_version gdk-pixbuf-xlib 0.0
+        have_gdk_pixbuf="$ok"
+      fi
     fi
 
     if test "$have_gdk_pixbuf" = yes; then
@@ -2789,6 +2829,7 @@ if test "$with_gdk_pixbuf" = yes; then
     ac_gdk_pixbuf_config_libs=$ac_cv_gdk_pixbuf_config_libs
   fi
 
+
   if test "$have_gdk_pixbuf" = no; then
     #
     # the old way...
@@ -2850,10 +2891,10 @@ if test "$with_gdk_pixbuf" = yes; then
 
     have_gdk_pixbuf=no
 
-    # check for header 1...
+    # check for header A...
     AC_CHECK_X_HEADER(gdk-pixbuf/gdk-pixbuf.h, [have_gdk_pixbuf=yes])
 
-    # if that worked, check for header 2...
+    # if that worked, check for header B...
     if test "$have_gdk_pixbuf" = yes; then
       have_gdk_pixbuf=no
       gdk_pixbuf_halfassed=yes
@@ -2861,7 +2902,7 @@ if test "$with_gdk_pixbuf" = yes; then
                         [have_gdk_pixbuf=yes
                          gdk_pixbuf_halfassed=no])
 
-      # yay, it has a new name in GTK2...
+      # yay, it has a new name in Gtk 2.x...
       if test "$have_gdk_pixbuf" = no; then
         have_gdk_pixbuf=no
         gdk_pixbuf_halfassed=yes
@@ -2879,10 +2920,10 @@ if test "$with_gdk_pixbuf" = yes; then
     have_gdk_pixbuf=no
     gdk_pixbuf_halfassed=yes
 
-    # library 1...
+    # library A...
     AC_CHECK_X_LIB(c, gdk_pixbuf_new_from_file, [have_gdk_pixbuf=yes],,
                    $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm)
-    # library 2...
+    # library B...
     if test "$have_gdk_pixbuf" = yes; then
       have_gdk_pixbuf=no
       AC_CHECK_X_LIB(c, gdk_pixbuf_xlib_init,
@@ -3297,19 +3338,77 @@ fi
 # After computing $HACK_CONF_DIR, make sure $GLADE_DATADIR has a value
 # so that we know where to install the Gtk pixmaps.
 #
+# It should usually be "/usr/share/pixmaps/", but we can't just use
+# "$(prefix)/share/pixmaps" because that would usually result in
+# "/usr/X11R6/share/pixmaps/", which is wrong.  It needs to be the
+# Gnome/Gtk prefix, not the overall prefix.
+#
 if test -n "$GNOME_DATADIR" ; then
   GLADE_DATADIR='$(GNOME_DATADIR)/xscreensaver'
 elif test "$have_gtk" = yes; then
-  # should this be "$(prefix)/share/pixmaps"? But /usr/X11R6/share/ is wrong...
-  GLADE_DATADIR='/usr/share/xscreensaver'
+  if test -n "$pkg_config"; then
+    if test "$have_gtk2" = yes; then
+      GLADE_DATADIR=`$pkg_config --variable=prefix gtk+-2.0`
+    else
+      GLADE_DATADIR=`$pkg_config --variable=prefix gtk+`
+    fi
+  else
+    GLADE_DATADIR=`$gtk_config --prefix`
+  fi
+  GLADE_DATADIR="$GLADE_DATADIR/share/xscreensaver"
 else
   GLADE_DATADIR=''
 fi
 
 
+# Set PO_DATADIR to something sensible.
+#
+AC_MSG_CHECKING([for locale directory])
+if test -n "$GNOME_DATADIR" ; then
+  PO_DATADIR="$GNOME_DATADIR"
+elif test "$have_gtk" = yes; then
+  if test -n "$pkg_config"; then
+    if test "$have_gtk2" = yes; then
+      PO_DATADIR=`$pkg_config --variable=prefix gtk+-2.0`
+    else
+      PO_DATADIR=`$pkg_config --variable=prefix gtk+`
+    fi
+  else
+    PO_DATADIR=`$gtk_config --prefix`
+  fi
+  PO_DATADIR="$PO_DATADIR/share"
+fi
+
+if test -z "$PO_DATADIR" ; then
+  #
+  # #### Total fucking kludge --
+  # Map /build/prefix/usr/X11R6/share/ to /build/prefix/usr/share/
+  # but of course we need to expand all the nested variables to do that...
+  #
+  dd=$datadir
+  eval dd=${dd}
+  eval dd=${dd}
+  eval dd=${dd}
+  eval dd=${dd}
+  eval dd=${dd}
+  PO_DATADIR=`echo $dd | sed 's@/X11R6/@/@'`
+fi
+
+AC_MSG_RESULT($PO_DATADIR/locale)
+
+
 # canonicalize slashes.
 HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" | sed 's@/$@@;s@//*@/@g'`
 
+# gcc 3.0 likes to issue this warning for every file:
+#
+# cc1: warning: changing search order for system directory "/usr/local/include"
+# cc1: warning:   as it has already been specified as a non-system directory
+#
+# Yay.  We can only avoid that by deleting "-I${prefix}/include" from the list.
+# Which *should* be totally redundant, and thus an ok thing to delete?
+#
+INCLUDES=`echo "$INCLUDES" | sed 's@ -I${prefix}/include@@g;'`
 
 
 ###############################################################################
@@ -3362,6 +3461,7 @@ AC_SUBST(GNOMEHELP_N)
 AC_SUBST(HACKDIR)
 AC_SUBST(GNOME_DATADIR)
 AC_SUBST(GLADE_DATADIR)
+AC_SUBST(PO_DATADIR)
 AC_SUBST(GNOME_PANELDIR)
 AC_SUBST(HACK_CONF_DIR)
 AC_SUBST(GTK_EXTRA_OBJS)
@@ -3380,7 +3480,8 @@ AC_OUTPUT(Makefile
           hacks/Makefile
           hacks/glx/Makefile
           po/Makefile.in
-          driver/XScreenSaver.ad)
+          driver/XScreenSaver.ad
+          driver/xscreensaver.kss)
 
 ###############################################################################
 #
@@ -3503,8 +3604,19 @@ elif test "$jurassic_gtk" = yes ; then
   warn2 "Gtk $pref_gtk or newer is required.  Motif will be used instead."
 
 elif test "$with_gtk_req" = yes -a "$have_gtk" = no ; then
-  warnL "Use of Gtk was requested, but it wasn't found;"
-  warn2 "Motif will be used instead."
+  warnL "Use of Gtk was requested, but it wasn't found."
+  if test "$have_motif" = yes; then
+    warn2 "Motif will be used instead."
+  fi
+fi
+
+if test "$gtk2_halfassed" != no ; then
+  warnL "GTK version $gtk2_halfassed was found, but at least one supporting"
+  warn2 "library ($gtk2_halfassed_lib) was not, so GTK 2.x can't be used."
+  v="$ac_gtk_version_string"
+  warn2 "GTK $v is also installed, so it will be used instead."
+  warn2 "Please read the above output and the \`config.log' file"
+  warn2 "for more details."
 fi
 
 
@@ -3544,6 +3656,12 @@ if test "$have_gtk" = yes ; then
   fi
 fi
 
+if test "$have_gtk" = yes -a "$have_gdk_pixbuf" = no ; then
+  warn  "GTK is being used, but the GDK-Pixbuf library and/or"
+  warn2 "headers were not found.  That can't be good.  Please"
+  warn2 "install the GDK-Pixbuf development kit and re-configure."
+fi
+
 if test "$have_motif" = yes -a "$have_lesstif" = yes ; then
 
   preferred_lesstif=0.92