Index: trunk/configure.ac
===================================================================
--- trunk/configure.ac	(revision 202)
+++ trunk/configure.ac	(revision 203)
@@ -35,10 +35,4 @@
 AC_SUBST(BUILD_CC)
 
-if test "x$GCC" = "xyes"; then
-   GCC_STACK_PROTECT_LIB
-   GCC_STACK_PROTECT_CC
-   GCC_PIE_CC
-fi
-
 AC_HEADER_STDC
 dnl
@@ -49,5 +43,5 @@
 
 
-AC_MSG_CHECKING([for host-specific issues])
+AC_MSG_CHECKING([for OS specific issues])
 mydebugflag=no
 myneedg3=no
@@ -57,4 +51,5 @@
 sh_use_lcaps="undef"
 dnmalloc_ok=yes
+sh_use_pie=yes
 
 case "$host_os" in
@@ -64,5 +59,5 @@
 	AC_DEFINE(HOST_IS_LINUX)
         AC_DEFINE(HAVE_EXT2_IOCTLS)
-	AC_MSG_RESULT(LINUX use ioctl to get e2fs flags)
+	AC_MSG_RESULT(use ioctl to get e2fs flags)
 	case "$host_cpu" in 
 	   i*86*)
@@ -80,5 +75,5 @@
 	  CFLAGS="$CFLAGS -O2 -assume noaligned_objects"
 	  myneedg3=yes
-	  AC_MSG_RESULT(OSF1 compiler needs assume noaligned_objects)
+	  AC_MSG_RESULT(compiler needs assume noaligned_objects)
 	else
 	  AC_MSG_RESULT(none)
@@ -89,12 +84,27 @@
 	AC_DEFINE(HOST_IS_CYGWIN)
 	dnmalloc_ok=no
-	AC_MSG_RESULT(CYGWIN no trusted paths and no dnmalloc)
+	AC_MSG_RESULT(no trusted paths and no dnmalloc)
 	;;
 
 	*darwin*) 
 	AC_DEFINE(HOST_IS_DARWIN)
-	AC_MSG_RESULT(DARWIN check resource forks)
+	AC_MSG_RESULT(check resource forks)
 	;;
 
+	*freebsd7*)
+	AC_DEFINE(HOST_IS_FREEBSD)
+	selectconfig=freebsd
+	case "$host_cpu" in
+		amd64)
+		sh_use_pie=no
+		dnmalloc_ok=no
+		AC_MSG_RESULT([no dnmalloc and broken compiler toolchain])
+		;;
+		*)
+		AC_MSG_RESULT(none)
+		;;
+	esac
+	;;
+	
 	*freebsd*)
 	AC_DEFINE(HOST_IS_FREEBSD)
@@ -107,5 +117,5 @@
 	selectconfig=freebsd
 	dnmalloc_ok=no
-	AC_MSG_RESULT(OpenBSD dnmalloc does not work with pthreads)
+	AC_MSG_RESULT(dnmalloc does not work with pthreads)
 	;;
 
@@ -113,5 +123,5 @@
 	mynetbsd=yes
 	selectconfig=netbsd
-	AC_MSG_RESULT(NETBSD bug with libresolve)
+	AC_MSG_RESULT(bug with libresolve)
 	;;
 
@@ -122,5 +132,5 @@
 		i*86)
 		AC_DEFINE(HOST_IS_I86SOLARIS)
-		AC_MSG_RESULT(SOLARIS I86 vsnprintf prototype)
+		AC_MSG_RESULT(vsnprintf prototype)
 		;;
 		*)
@@ -195,8 +205,4 @@
 AC_DEFINE_UNQUOTED(UID_CAST, ${uid_cast})
 
-dnl Test whether gcc supports -Wno-empty-body
-dnl Suppresses warnings from glibc pthread_cleanup_pop
-dnl
-GCC_WEMPTY_BODY
 
 
@@ -316,4 +322,6 @@
 		AC_HEADER_EGREP(comp_t,   sys/acct.h, AC_DEFINE(HAVE_COMP_T, ,
 								[Define if <sys/acct.h> uses the COMP_T type.]))
+		AC_HEADER_EGREP([struct acct_v3],   sys/acct.h, AC_DEFINE(HAVE_ACCT_V3, ,
+								[Define if <sys/acct.h> has struct acct_v3.]))
  )
 
@@ -624,4 +632,10 @@
 
 AM_SA_SIGACTION_WORKS
+
+if test "x$GCC" = "xyes"; then
+   GCC_STACK_PROTECT_LIB
+   GCC_STACK_PROTECT_CC
+   GCC_PIE_CC
+fi
 
 dnl *****************************************
@@ -975,11 +989,4 @@
 )
 
-if test x$enable_static = xyes; then
-   :
-else
-   LDFLAGS="$LDFLAGS $PIE_LDFLAGS"
-   CFLAGS="$CFLAGS $PIE_CFLAGS"
-fi
-
 if test x"${mytclient}" = x-DSH_STANDALONE -o x"${mytclient}" = x-DSH_WITH_CLIENT;
 then
@@ -993,4 +1000,14 @@
 	CHECK_ZLIB()
 fi
+
+if test x$enable_static = xyes; then
+   :
+else
+   if test x$sh_use_pie = xyes; then
+      LDFLAGS="$LDFLAGS $PIE_LDFLAGS"
+      CFLAGS="$CFLAGS $PIE_CFLAGS"
+   fi
+fi
+
 	
 #
@@ -1440,5 +1457,14 @@
 			   LIBS="-lpcre $LIBS"
 			   ],
-	                   AC_MSG_ERROR([The --enable-logfile-monitor option requires libpcre. For compiling the pcre development package is needed.])
+			   [
+				AC_CHECK_HEADER(pcre/pcre.h,
+			   	[
+			   	AC_DEFINE(USE_LOGFILE_MONITOR, 1, [Define if you want the logfile monitor module.])
+				AC_DEFINE(HAVE_PCRE_PCRE_H, 1, [Define if you have pcre/pcre.h.])
+			   	LIBS="-lpcre $LIBS"
+			   	],
+	                   	AC_MSG_ERROR([The --enable-logfile-monitor option requires libpcre. For compiling the pcre development package is needed.])
+				)
+			  ]
 	   )
         fi
@@ -1584,4 +1610,9 @@
 
 fi
+
+dnl Test whether gcc supports -Wno-empty-body
+dnl Suppresses warnings from glibc pthread_cleanup_pop
+dnl
+GCC_WEMPTY_BODY
 
 AC_MSG_CHECKING([which random module to use])
