diff --git a/ChangeLog b/ChangeLog
index ecebc42..1779460 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Oct 30 14:04:43 EET 2009 (edwin)
+------------------------------------
+ * configure, m4/acinclude.m4: Avoid trailing slash in libdir for old gcc (#1738).
+
 Wed Oct 28 16:55:03 CET 2009 (tk)
 ---------------------------------
  * V 0.95.3
diff --git a/configure b/configure
index c17619a..ed9da8a 100755
--- a/configure
+++ b/configure
@@ -12042,7 +12042,7 @@ $as_echo "#define FILEBUFF 8192" >>confdefs.h
 $as_echo_n "checking for multiarch libdir... " >&6; }
 		# Based on http://lists.gnu.org/archive/html/autoconf/2008-09/msg00072.html
 		if test "$GCC" = yes; then
-			ac_multilibdir=`$CC -print-multi-os-directory $CFLAGS $CPPFLAGS $LDFLAGS`
+			ac_multilibdir=`$CC -print-multi-os-directory $CFLAGS $CPPFLAGS $LDFLAGS` || ac_multilibdir=.
 		else
 			ac_multilibdir=.
 		fi
diff --git a/libclamav/Makefile.am b/libclamav/Makefile.am
index 3ced7ff..7a267a0 100644
--- a/libclamav/Makefile.am
+++ b/libclamav/Makefile.am
@@ -304,8 +304,8 @@ version.h: version.h.tmp
 version.h.tmp:
 	@test -f version.h || touch version.h;\
 	rm -f $@;\
-	REVISION="$$(LANG=C cd "$(top_srcdir)"; git describe --always 2>/dev/null)";\
-	if test $$? -ne 0; then\
+	REVISION="$$(LANG=C cd "$(top_srcdir)"; git describe --always 2>/dev/null || echo "exported")";\
+	if test "$$REVISION" = "exported"; then\
 	   REVISION="r$$(LANG=C svnversion "$(top_srcdir)" 2>/dev/null || echo exported)";\
 	   if test "$$REVISION" = "rexported"; then\
 	    REVISION="";\
diff --git a/libclamav/Makefile.in b/libclamav/Makefile.in
index 8420601..a031c14 100644
--- a/libclamav/Makefile.in
+++ b/libclamav/Makefile.in
@@ -1832,8 +1832,8 @@ version.h: version.h.tmp
 version.h.tmp:
 	@test -f version.h || touch version.h;\
 	rm -f $@;\
-	REVISION="$$(LANG=C cd "$(top_srcdir)"; git describe --always 2>/dev/null)";\
-	if test $$? -ne 0; then\
+	REVISION="$$(LANG=C cd "$(top_srcdir)"; git describe --always 2>/dev/null || echo "exported")";\
+	if test "$$REVISION" = "exported"; then\
 	   REVISION="r$$(LANG=C svnversion "$(top_srcdir)" 2>/dev/null || echo exported)";\
 	   if test "$$REVISION" = "rexported"; then\
 	    REVISION="";\
diff --git a/libclamav/others.h b/libclamav/others.h
index 42ca636..ed313d8 100644
--- a/libclamav/others.h
+++ b/libclamav/others.h
@@ -29,6 +29,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include "cltypes.h"
 
 #include "clamav.h"
diff --git a/m4/acinclude.m4 b/m4/acinclude.m4
index 226fd74..1166cef 100644
--- a/m4/acinclude.m4
+++ b/m4/acinclude.m4
@@ -755,7 +755,7 @@ AC_DEFUN([AC_LIB_MULTILIB_GUESS],
 		AC_MSG_CHECKING([for multiarch libdir])
 		# Based on http://lists.gnu.org/archive/html/autoconf/2008-09/msg00072.html
 		if test "$GCC" = yes; then
-			ac_multilibdir=`$CC -print-multi-os-directory $CFLAGS $CPPFLAGS $LDFLAGS`
+			ac_multilibdir=`$CC -print-multi-os-directory $CFLAGS $CPPFLAGS $LDFLAGS` || ac_multilibdir=.
 		else
 			ac_multilibdir=.
 		fi
@@ -778,7 +778,7 @@ AC_DEFUN([AC_LIB_MULTILIB_GUESS],
 					*/lib64 ) acl_libdirstem=lib64 ;;
 				   esac
 			esac
-		fi	
+		fi
 	fi
 ])
 

