From 70ee40161f6faa1faa8670ca2fd7b517c4de0598 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 16 Jun 2008 00:49:28 +0000 Subject: Enable usage of PIE by default --- acinclude.m4 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'acinclude.m4') diff --git a/acinclude.m4 b/acinclude.m4 index e12fd01a..6242e390 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -45,13 +45,18 @@ AC_DEFUN([AC_INIT_BLUEZ], [ ]) 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 @@ AC_DEFUN([AC_ARG_BLUEZ], [ 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 -- cgit