=== modified file 'configure.in'
--- configure.in	2012-04-19 18:12:18 +0000
+++ configure.in	2012-04-19 19:10:34 +0000
@@ -56,7 +56,6 @@ else
     dnl  build and build_os. Squash all x86 cpus into one LCD form - i386
     target=`echo $target | sed '[s/^\([^-][^-]*-[^-][^-]*-[^-][^-]*\)-.*$/\1/]'`
     target_os=`echo $target_os | sed '[s/solaris2\..*/solaris/]'`
-    target_os=`echo $target_os | sed '[s/kfreebsd/freebsd/]'`
     target_os=`echo $target_os | sed '[s/^\([^-][^-]*\)-.*$/\1/]' | sed '[s/[\.0-9]*//g]'`
     target_cpu=`echo $target_cpu | sed '[s/i[3-6]86/i386/]'`
 
@@ -114,11 +113,11 @@ elif test $target_os = aix
 then
     AC_DEFINE(IS_AIX)
     export CFLAGS="-qcpluscmt"
-elif test $target_os = freebsd
+elif test $target_os = freebsd || test $target_os = kfreebsd
 then
     AC_DEFINE(IS_FREEBSD)
     test -f /etc/debian_version && target_distro=debian
-    export CFLAGS="-fpic -fno-strict-aliasing"
+    export CFLAGS="-fpic -fno-strict-aliasing -D_GNU_SOURCE"
 else
     echo
     echo "FATAL ERROR: need platform-specific customization for \"$target_os\""
@@ -131,7 +130,8 @@ pcp_platform_paths=""
 case $target_os
 in
     aix)	pcp_platform_paths='/usr/bin/X11:/usr/local/bin';;
-    linux)	pcp_platform_paths='/usr/bin/X11:/usr/local/bin';;
+    linux|kfreebsd)
+		pcp_platform_paths='/usr/bin/X11:/usr/local/bin';;
     mingw)	pcp_platform_paths='/mingw/bin:/perl/bin:/usr/local/bin';;
     darwin)	pcp_platform_paths='/usr/local/bin';;
     solaris)	pcp_platform_paths='/usr/bin/X11:/usr/local/bin:/opt/sfw/bin:/usr/sfw/bin';;
@@ -828,7 +828,7 @@ AC_CHECK_FUNCS(strtod strtol strtoll str
 AC_CHECK_FUNCS(sysinfo)
 
 dnl only define readdir64 on non-linux platforms that support it
-if test $target_os != linux -a $target_os != freebsd; then
+if test $target_os != linux -a $target_os != freebsd -a $target_os != kfreebsd; then
     AC_CHECK_FUNCS(readdir64)
 fi
 
@@ -1477,7 +1477,7 @@ then
     changequote(<<, >>)<<[ 	]st_mtimespec>>changequote([, ]),
     sys/stat.h, [ have_stat_name=true; AC_DEFINE(HAVE_ST_MTIME_WITH_SPEC) ])
 fi
-if test $have_stat_name = false -a $target_os != darwin -a $target_os != linux
+if test $have_stat_name = false -a $target_os != darwin -a $target_os != linux -a $target_os != kfreebsd
 then
     AC_EGREP_HEADER(
     changequote(<<, >>)<<[ 	]st_mtime>>changequote([, ]),

=== modified file 'src/include/builddefs.in'
--- src/include/builddefs.in	2012-04-19 18:12:18 +0000
+++ src/include/builddefs.in	2012-04-19 19:25:27 +0000
@@ -74,7 +74,7 @@ PCP_LIBS = -L$(TOPDIR)/src/libpcp/$(LIBP
 # 	../../configure.in
 #
 PCFLAGS=@PCFLAGS@
-ifeq "$(TARGET_OS)" "linux"
+ifneq (, $(filter linux kfreebsd, $(TARGET_OS)))
 DSOSUFFIX = so
 endif
 ifeq "$(TARGET_OS)" "darwin"

=== modified file 'src/include/buildrules'
--- src/include/buildrules	2012-04-19 18:12:18 +0000
+++ src/include/buildrules	2012-04-19 18:34:47 +0000
@@ -29,7 +29,7 @@ $(CMDTARGET) : $(SUBDIRS) $(OBJECTS)
 endif
 
 ifdef LIBTARGET
-ifeq ($(TARGET_OS), linux)
+ifneq (, $(filter linux kfreebsd, $(TARGET_OS)))
 _SHAREDOPTS	= -shared -Wl,-soname,$(LIBTARGET)
 endif
 ifeq ($(TARGET_OS), solaris)

=== modified file 'src/pmdas/pmcd/src/GNUmakefile'
--- src/pmdas/pmcd/src/GNUmakefile	2012-04-19 18:12:18 +0000
+++ src/pmdas/pmcd/src/GNUmakefile	2012-04-19 18:39:11 +0000
@@ -27,7 +27,7 @@ LSRCFILES = objstyle
 
 # Add to CFLAGS to find files in pmcd/src...
 LCFLAGS = -I$(TOPDIR)/src
-ifeq "$(TARGET_OS)" "linux"
+ifneq (, $(filter linux kfreebsd, $(TARGET_OS)))
 ABI = $(shell ./objstyle)
 LCFLAGS += -DSIM_ABI=\""$(ABI)"\"
 endif

=== modified file 'src/pmie/pmie2col'
--- src/pmie/pmie2col	2012-04-19 18:12:18 +0000
+++ src/pmie/pmie2col	2012-04-19 18:33:04 +0000
@@ -27,7 +27,7 @@
 #
 case "$PCP_PLATFORM"
 in
-    linux|mingw)
+    linux|mingw|kfreebsd)
 	SED="sed -u"
 	;;
     freebsd|darwin)

