AC_HELP_STRING([--enable-static-tools], [enable static tape tools @<:@default=no@:>@]),
    [
        if test x$enableval = xyes; then
+          if test x$use_libtool = xyes; then
+             echo "Libtool is enabled, not compatible with static tools, please rerun configure with --disable-libtool"
+             exit 1
+          fi
          support_static_tools=yes
        fi
    ]
    AC_HELP_STRING([--enable-static-fd], [enable static File daemon @<:@default=no@:>@]),
    [
        if test x$enableval = xyes; then
+          if test x$use_libtool = xyes; then
+             echo "Libtool is enabled, not compatible with static tools, please rerun configure with --disable-libtool"
+             exit 1
+          fi
          support_static_fd=yes
        fi
    ]
    AC_HELP_STRING([--enable-static-sd], [enable static Storage daemon @<:@default=no@:>@]),
    [
        if test x$enableval = xyes; then
+          if test x$use_libtool = xyes; then
+             echo "Libtool is enabled, not compatible with static tools, please rerun configure with --disable-libtool"
+             exit 1
+          fi
          support_static_sd=yes
        fi
    ]
    AC_HELP_STRING([--enable-static-dir], [enable static Director @<:@default=no@:>@]),
    [
        if test x$enableval = xyes; then
+          if test x$use_libtool = xyes; then
+             echo "Libtool is enabled, not compatible with static tools, please rerun configure with --disable-libtool"
+             exit 1
+          fi
          support_static_dir=yes
        fi
    ]
    AC_HELP_STRING([--enable-static-cons], [enable static Console @<:@default=no@:>@]),
    [
        if test x$enableval = xyes; then
+          if test x$use_libtool = xyes; then
+             echo "Libtool is enabled, not compatible with static tools, please rerun configure with --disable-libtool"
+             exit 1
+          fi
          support_static_cons=yes
        fi
    ]
 
 if test "${enable_static_tools+set}" = set; then
   enableval=$enable_static_tools;
        if test x$enableval = xyes; then
+          if test x$use_libtool = xyes; then
+             echo "Libtool is enabled, not compatible with static tools, please rerun configure with --disable-libtool"
+             exit 1
+          fi
          support_static_tools=yes
        fi
 
 if test "${enable_static_fd+set}" = set; then
   enableval=$enable_static_fd;
        if test x$enableval = xyes; then
+          if test x$use_libtool = xyes; then
+             echo "Libtool is enabled, not compatible with static tools, please rerun configure with --disable-libtool"
+             exit 1
+          fi
          support_static_fd=yes
        fi
 
 if test "${enable_static_sd+set}" = set; then
   enableval=$enable_static_sd;
        if test x$enableval = xyes; then
+          if test x$use_libtool = xyes; then
+             echo "Libtool is enabled, not compatible with static tools, please rerun configure with --disable-libtool"
+             exit 1
+          fi
          support_static_sd=yes
        fi
 
 if test "${enable_static_dir+set}" = set; then
   enableval=$enable_static_dir;
        if test x$enableval = xyes; then
+          if test x$use_libtool = xyes; then
+             echo "Libtool is enabled, not compatible with static tools, please rerun configure with --disable-libtool"
+             exit 1
+          fi
          support_static_dir=yes
        fi
 
 if test "${enable_static_cons+set}" = set; then
   enableval=$enable_static_cons;
        if test x$enableval = xyes; then
+          if test x$use_libtool = xyes; then
+             echo "Libtool is enabled, not compatible with static tools, please rerun configure with --disable-libtool"
+             exit 1
+          fi
          support_static_cons=yes
        fi
 
 
    return true;
 #endif
 
+   /*
+    * Sanity check
+    */
+   if (jcr->acl_data_len <= 0)
+      return true;
+
    /*
     * Send header
     */
 
    return true;
 #endif
 
+   /*
+    * Sanity check
+    */
+   if (jcr->xattr_data_len <= 0)
+      return true;
+
    /*
     * Send header
     */
 
 static bool generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt, int stream)
 {
-   int count = 0;
+   bool retval = true;
+   int count;
    int32_t xattr_list_len,
            xattr_value_len;
    uint32_t expected_serialize_len = 0;
          jcr->last_fname, be.bstrerror());
       Dmsg2(100, "llistxattr error file=%s ERR=%s\n",
          jcr->last_fname, be.bstrerror());
+
       return false;
    } else if (xattr_list_len == 0) {
       return true;
          jcr->last_fname, be.bstrerror());
 
       free(xattr_list);
+
       return false;
    }
    xattr_list[xattr_list_len] = '\0';
    /*
     * Count the number of extended attributes on a file.
     */
+   count = 0;
    bp = xattr_list;
    while ((bp - xattr_list) + 1 < xattr_list_len) {
       count++;
     * Walk the list of extended attributes names and retrieve the data.
     * We already count the bytes needed for serializing the stream later on.
     */
+   count = 0;
    current_xattr = xattr_value_list;
    bp = xattr_list;
    while ((bp - xattr_list) + 1 < xattr_list_len) {
       /*
        * Next attribute.
        */
+      count++;
       current_xattr++;
       bp = strchr(bp, '\0') + 1;
    }
 
-   /*
-    * Serialize the datastream.
-    */
-   if (serialize_xattr_stream(jcr, expected_serialize_len, xattr_value_list) < expected_serialize_len) {
-      Jmsg1(jcr, M_ERROR, 0, _("Failed to serialize extended attributes on file \"%s\"\n"),
-         jcr->last_fname);
-      Dmsg1(100, "Failed to serialize extended attributes on file \"%s\"\n",
-         jcr->last_fname);
+   if (count != 0) {
+      /*
+       * Serialize the datastream.
+       */
+      if (serialize_xattr_stream(jcr, expected_serialize_len, xattr_value_list) < expected_serialize_len) {
+         Jmsg1(jcr, M_ERROR, 0, _("Failed to serialize extended attributes on file \"%s\"\n"),
+            jcr->last_fname);
+         Dmsg1(100, "Failed to serialize extended attributes on file \"%s\"\n",
+            jcr->last_fname);
+
+         goto bail_out;
+      }
 
-      goto bail_out;
+      /*
+       * Send the datastream to the SD.
+       */
+      retval = send_xattr_stream(jcr, stream);
    }
 
    xattr_drop_internal_table(xattr_value_list);
    free(xattr_list);
 
-   /*
-    * Send the datastream to the SD.
-    */
-   return send_xattr_stream(jcr, stream);
+   return retval;
 
 bail_out:
    xattr_drop_internal_table(xattr_value_list);
 
               Technical notes for current SVN
           
 General:
+02Apr09
+mvw  Fixed problem in xattr and acl code trying to send empty acl or xattr
+     streams.
+mvw  Fix for bug #1261 where we send out a null stream when a file only an
+     acl and xattr support is also turned on.
+mvw  Added some warnings to configure when using libtool and static in
+     one configure.
 30Mar09
 ebl  Fix small memory leak in fileregexp bsr code
 29Mar09