Enable usage of PIE by default
diff --git a/acinclude.m4 b/acinclude.m4
index e12fd01..6242e39 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -45,13 +45,18 @@
 ])
 
 AC_DEFUN([AC_ARG_BLUEZ], [
-	fortify_enable=yes
 	debug_enable=no
+	fortify_enable=yes
+	pie_enable=yes
 
 	AC_ARG_ENABLE(fortify, AC_HELP_STRING([--disable-fortify], [disable compile time buffer checks]), [
 		fortify_enable=${enableval}
 	])
 
+	AC_ARG_ENABLE(pie, AC_HELP_STRING([--disable-pie], [enable position independent executables flag]), [
+		pie_enable=${enableval}
+	])
+
 	AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable compiling with debugging information]), [
 		debug_enable=${enableval}
 	])
@@ -60,6 +65,11 @@
 		CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
 	fi
 
+	if (test "${pie_enable}" = "yes" && test "${ac_cv_prog_cc_pie}" = "yes"); then
+		CFLAGS="$CFLAGS -fPIC"
+		LDFLAGS="$LDFLAGS -pie"
+	fi
+
 	if (test "${debug_enable}" = "yes" && test "${ac_cv_prog_cc_g}" = "yes"); then
 		CFLAGS="$CFLAGS -g -O0"
 	fi
diff --git a/configure.in b/configure.in
index b086dbd..2e6c551 100644
--- a/configure.in
+++ b/configure.in
@@ -11,6 +11,7 @@
 AC_LANG_C
 
 AC_PROG_CC
+AC_PROG_CC_PIE
 AC_PROG_INSTALL
 
 m4_define([_LT_AC_TAGCONFIG], [])