Imported Upstream version 2.5.2p1
[debian/amanda] / config / acinclude.m4i
index ae6ea72e34105e8a7e1a56a3817909e09ac7c2b3..e8e9029cad0a878478635157d977beeb29bd6ec0 100644 (file)
@@ -191,47 +191,6 @@ main() {
     ]
 )
 
-dnl Find out how {awk,gawk,nawk,mawk} likes to assign variables, if it
-dnl can do so at all.
-AC_DEFUN([AMANDA_PROG_AWK_VAR],
-    [
-       AC_REQUIRE([AC_PROG_AWK])
-       AC_CACHE_CHECK(
-           [for $AWK command line variable assignment],
-           amanda_cv_awk_var_assignment,
-           [
-               echo 'BEGIN{print i; exit}' > conftest.awk
-               result=`$AWK -f conftest.awk i=xx | wc -c`
-               if test "$result" -le 1; then
-                   result=`$AWK -f conftest.awk -v i=xx | wc -c`
-                   if test "$result" -le 1; then
-                       amanda_cv_awk_var_assignment=no
-                   else
-                       amanda_cv_awk_var_assignment="yes with -v"
-                   fi
-               else
-                   amanda_cv_awk_var_assignment="yes"
-               fi
-               rm -fr conftest.awk
-           ]
-       )
-       AWK_VAR_ASSIGNMENT_OPT=
-       case "$amanda_cv_awk_var_assignment" in
-           no)
-               HAVE_AWK_WITH_VAR=no
-               ;;
-           yes)
-               HAVE_AWK_WITH_VAR=yes
-               ;;
-           "yes with -v")
-               HAVE_AWK_WITH_VAR=yes
-               AWK_VAR_ASSIGNMENT_OPT=-v
-               ;;
-       esac
-       AC_SUBST(AWK_VAR_ASSIGNMENT_OPT)
-    ]
-)      
-
 dnl Check for the one or two argument version of gettimeofday.
 AC_DEFUN([AMANDA_FUNC_GETTIMEOFDAY_ARGS],
     [
@@ -271,29 +230,6 @@ AC_DEFUN([AMANDA_FUNC_GETTIMEOFDAY_ARGS],
 
 
 
-dnl Check if the compiler understands volatile.
-AC_DEFUN([AMANDA_C_VOLATILE],
-    [
-       AC_CACHE_CHECK(
-           [for working volatile],
-           amanda_cv_c_volatile,
-           [
-               AC_TRY_COMPILE(,
-                   [
-                       volatile int aaa = 0;
-                   ],
-                   amanda_cv_c_volatile=yes,
-                   amanda_cv_c_volatile=no
-               )
-           ]
-       )
-       if test $amanda_cv_c_volatile = no; then
-           AC_DEFINE(volatile, [],[Define to empty if the compiler does not support volatile. ])
-       fi
-    ]
-)
-
-
 dnl Check for if pid_t is a long, int, or short.
 AC_DEFUN([AMANDA_TYPE_PID_T],
     [
@@ -1145,3 +1081,176 @@ ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
 ac_cv_type_intmax_t="$ac_cv_type_intmax_t"
 ])
 ])
+
+# AC_PROG_XSLTPROC
+# -----------------------------------------------------------------
+# Find an xsltproc executable.
+#
+# Input:
+#  $1 is the default $XSLTPROC_FLAGS, which will be overridden if the
+#  user specifies --with-xsltproc-flags.
+# Output:
+#  $XSLTPROC contains the path to xsltproc, or is empty if none was
+#  found or the user specified --without-xsltproc. $XSLTPROC_FLAGS 
+#  contains the flags to use with xsltproc.
+
+AC_DEFUN([AC_PROG_XSLTPROC],
+[
+XSLTPROC_FLAGS="$1"
+AC_SUBST(XSLTPROC_FLAGS)
+
+# The (lack of) whitespace and overquoting here are all necessary for
+# proper formatting.
+AC_ARG_WITH(xsltproc,
+AS_HELP_STRING([--with-xsltproc[[[[[=PATH]]]]]],
+               [Use the xsltproc binary in in PATH.]),
+    [ ac_with_xsltproc=$withval; ],
+    [ ac_with_xsltproc=maybe; ])
+
+AC_ARG_WITH(xsltproc-flags,
+AS_HELP_STRING([  --with-xsltproc-flags=FLAGS],
+               [Flags to pass to xsltproc (default $1)]),
+    [ if test "x$withval" == "xno"; then
+       XSLTPROC_FLAGS=''
+    else
+       if test "x$withval" != "xyes"; then
+           XSLTPROC_FLAGS="$withval"
+       fi
+    fi
+       ])
+
+# search for xsltproc if it wasn't specified
+if test "$ac_with_xsltproc" = "yes" -o "$ac_with_xsltproc" = "maybe"; then
+    AC_PATH_PROGS(XSLTPROC,xsltproc,,$LOCSYSPATH)
+else
+    if test "$ac_with_xsltproc" != "no"; then
+        if test -x "$ac_with_xsltproc"; then
+            XSLTPROC="$ac_with_xsltproc";
+        else
+            AC_MSG_WARN([Specified xsltproc of $ac_with_xsltproc isn't])
+            AC_MSG_WARN([executable; searching for an alternative.])
+            AC_PATH_PROGS(XSLTPROC,xsltproc,,$LOCSYSPATH)
+        fi
+    fi
+fi
+])
+
+# AC_CHECK_DOCBOOK_XSLT
+# -----------------------------------------------------------------
+# Check for access to docbook stylesheets of a particular revision.
+# This macro can be used for multiple versions within the same script.
+#
+# Input:
+#  $1 is the version of docbook to search for; default 'current'
+# Output:
+#  $HAVE_DOCBOOK_XSLT_VERS will be set to 'yes' or 'no' depending
+#  on the results of the test, where VERS is $1, with '_' substituted
+#  for '.'  $HAVE_DOCBOOK_XSLT will also be set to the same value.
+AC_DEFUN([AC_CHECK_DOCBOOK_XSLT],
+[
+    AC_REQUIRE([AC_PROG_XSLTPROC])
+
+    dnl define a temporary variable for the version, so this macro can be
+    dnl used with multiple versions
+    define([_VERS], $1)
+    ifelse(_VERS, [], [define([_VERS], [current])])
+    define([ac_cv_docbook_xslt_VERS], patsubst([ac_cv_docbook_xslt_]_VERS, [\.], [_]))
+    define([HAVE_DOCBOOK_XSLT_VERS], patsubst([HAVE_DOCBOOK_XSLT_]_VERS, [\.], [_]))
+
+    AC_CACHE_CHECK([for Docbook XSLT version ]_VERS, [ac_cv_docbook_xslt_VERS],
+    [
+       ac_cv_docbook_xslt_VERS=no
+       if test -n "$XSLTPROC"; then
+           echo "Trying '$XSLTPROC $XSLTPROC_FLAGS http://docbook.sourceforge.net/release/xsl/_VERS/xhtml/docbook.xsl'" >&AS_MESSAGE_LOG_FD
+           $XSLTPROC $XSLTPROC_FLAGS http://docbook.sourceforge.net/release/xsl/_VERS/xhtml/docbook.xsl >&AS_MESSAGE_LOG_FD 2>&1
+
+           if test "$?" = 0; then
+               ac_cv_docbook_xslt_VERS=yes
+           fi
+       fi
+    ])
+
+    HAVE_DOCBOOK_XSLT_VERS="$ac_cv_docbook_xslt_VERS"
+    HAVE_DOCBOOK_XSLT=HAVE_DOCBOOK_XSLT_VERS
+    undefine([_VERS])
+])
+
+# AC_CHECK_DOCBOOK_DTD
+# -----------------------------------------------------------------
+# Check for access to docbook DTD of a particular revision.
+# This macro can be used for multiple versions within the same script.
+#
+# Input:
+#  $1 is the version of docbook to search for; default 'current'
+# Output:
+#  $HAVE_DOCBOOK_DTD_VERS will be set to 'yes' or 'no' depending
+#  on the results of the test, where VERS is $1, with '_' substituted
+#  for '.'  $HAVE_DOCBOOK_DTD will also be set to the same value.
+AC_DEFUN([AC_CHECK_DOCBOOK_DTD],
+[
+    AC_REQUIRE([AC_PROG_XSLTPROC])
+
+    dnl define a temporary variable for the version, so this macro can be
+    dnl used with multiple versions
+    define([_VERS], $1)
+    ifelse(_VERS, [], [define([_VERS], [current])])
+    define([ac_cv_docbook_dtd_VERS], patsubst([ac_cv_docbook_dtd_]_VERS, [\.], [_]))
+    define([HAVE_DOCBOOK_DTD_VERS], patsubst([HAVE_DOCBOOK_DTD_]_VERS, [\.], [_]))
+
+    AC_CACHE_CHECK([for Docbook DTD version ]_VERS, [ac_cv_docbook_dtd_VERS],
+    [
+       ac_cv_docbook_dtd_VERS=no
+       if test -n "$XSLTPROC"; then
+           MY_XSLTPROC_FLAGS=`echo "" $XSLTPROC_FLAGS|sed -e s/--novalid//g`
+           cat <<EOF >conftest.xml
+<?xml version="1.0" encoding='ISO-8859-1'?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V[]_VERS//EN" "http://www.oasis-open.org/docbook/xml/_VERS/docbookx.dtd">
+<book id="empty">
+</book>
+EOF
+           echo "Trying '$XSLTPROC $MY_XSLTPROC_FLAGS conftest.xml'" >&AS_MESSAGE_LOG_FD
+           $XSLTPROC $MY_XSLTPROC_FLAGS conftest.xml >conftest.out 2>&1
+           if test "$?" = 0; then
+               # failing to load the DTD is just a warning, so check for it in the output.
+               if grep 'warning: failed to load external entity' conftest_out >/dev/null 2>&1; then
+                   : # no good..
+               else
+                   ac_cv_docbook_dtd_VERS=yes
+               fi
+           fi
+           cat conftest.out >&AS_MESSAGE_LOG_FD
+
+           rm -f conftest.xml conftest.out
+       fi
+    ])
+
+    HAVE_DOCBOOK_DTD_VERS="$ac_cv_docbook_dtd_VERS"
+    HAVE_DOCBOOK_DTD=HAVE_DOCBOOK_DTD_VERS
+    undefine([_VERS])
+])
+dnl
+dnl Checks to see if there's a sockaddr_storage structure
+dnl
+dnl usage:
+dnl
+dnl    AC_SOCKADDR_STORAGE
+dnl
+dnl results:
+dnl
+dnl    HAVE_SOCKADDR_STORAGE (defined)
+dnl
+AC_DEFUN([AC_SOCKADDR_STORAGE],
+    [AC_MSG_CHECKING(if sockaddr_storage struct exists)
+    AC_CACHE_VAL(ac_cv_has_sockaddr_storage,
+       AC_TRY_COMPILE([
+#      include <sys/types.h>
+#      include <sys/socket.h>],
+       [u_int i = sizeof (struct sockaddr_storage)],
+       ac_cv_has_sockaddr_storage=yes,
+       ac_cv_has_sockaddr_storage=no))
+    AC_MSG_RESULT($ac_cv_has_sockaddr_storage)
+    if test $ac_cv_has_sockaddr_storage = yes ; then
+           AC_DEFINE(HAVE_SOCKADDR_STORAGE,1,[if struct sockaddr_storage exists])
+    fi])
+
+