From bb42dcd5202fce11689ba81d73783ccb9b79e8d6 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 12 Aug 2004 16:00:35 +0000 Subject: Make compiling with debug information optional --- acinclude.m4 | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 acinclude.m4 (limited to 'acinclude.m4') diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 00000000..eaeb4ffc --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,59 @@ +dnl +dnl $Id$ +dnl + +AC_DEFUN([AC_PROG_CC_PIE], [ + AC_CACHE_CHECK([whether ${CC-cc} accepts -fPIE], ac_cv_prog_cc_pie, [ + echo 'void f(){}' > conftest.c + if test -z "`${CC-cc} -fPIE -pie -c conftest.c 2>&1`"; then + ac_cv_prog_cc_pie=yes + else + ac_cv_prog_cc_pie=no + fi + rm -rf conftest* + ]) +]) + +AC_DEFUN([AC_INIT_BLUEZ], [ + AC_PREFIX_DEFAULT(/usr) + + CFLAGS="-Wall -O2" + + if (test "${prefix}" = "NONE"); then + dnl no prefix and no sysconfdir, so default to /etc + if (test "$sysconfdir" = '${prefix}/etc'); then + AC_SUBST([sysconfdir], ['/etc']) + fi + + dnl no prefix and no mandir, so use ${prefix}/share/man as default + if (test "$mandir" = '${prefix}/man'); then + AC_SUBST([mandir], ['${prefix}/share/man']) + fi + + prefix="${ac_default_prefix}" + fi + + if (test "${libdir}" = '${exec_prefix}/lib'); then + libdir="${prefix}/lib" + fi + + if (test "$sysconfdir" = '${prefix}/etc'); then + configdir="${prefix}/etc/bluetooth" + else + configdir="${sysconfdir}/bluetooth" + fi + + AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}", [Directory for the configuration files]) +]) + +AC_DEFUN([AC_ARG_BLUEZ], [ + debug_enable=no + + AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable compiling with debugging information]), [ + debug_enable=${enableval} + ]) + + if (test "${debug_enable}" = "yes" && test "${ac_cv_prog_cc_g}" = "yes"); then + CFLAGS="$CFLAGS -g" + fi +]) -- cgit From 083f0466ab9b77d6320f91dcca315860da1a54b2 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 13 Aug 2004 12:34:54 +0000 Subject: Don't override CFLAGS --- acinclude.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'acinclude.m4') diff --git a/acinclude.m4 b/acinclude.m4 index eaeb4ffc..2f1077ea 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -17,7 +17,9 @@ AC_DEFUN([AC_PROG_CC_PIE], [ AC_DEFUN([AC_INIT_BLUEZ], [ AC_PREFIX_DEFAULT(/usr) - CFLAGS="-Wall -O2" + if (test "${CFLAGS}" = ""); then + CFLAGS="-Wall -O2" + fi if (test "${prefix}" = "NONE"); then dnl no prefix and no sysconfdir, so default to /etc -- cgit From 0fccefa9c8f3299917f72f9afc37f8fc64c08f00 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 9 Oct 2005 22:45:07 +0000 Subject: Add compile time buffer checks (FORTIFY SOURCE) --- acinclude.m4 | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'acinclude.m4') diff --git a/acinclude.m4 b/acinclude.m4 index 2f1077ea..92cde650 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -49,12 +49,21 @@ AC_DEFUN([AC_INIT_BLUEZ], [ ]) AC_DEFUN([AC_ARG_BLUEZ], [ + fortify_enable=yes debug_enable=no + AC_ARG_ENABLE(fortify, AC_HELP_STRING([--disable-fortify], [disable compile time buffer checks]), [ + fortify_enable=${enableval} + ]) + AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable compiling with debugging information]), [ debug_enable=${enableval} ]) + if (test "${fortify_enable}" = "yes"); then + CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2" + fi + if (test "${debug_enable}" = "yes" && test "${ac_cv_prog_cc_g}" = "yes"); then CFLAGS="$CFLAGS -g" fi -- cgit From c0d524486a50e8366c12c5ebea1a4441e9db46aa Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 29 Oct 2005 19:25:42 +0000 Subject: Big cleanup of CVS relics --- acinclude.m4 | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'acinclude.m4') diff --git a/acinclude.m4 b/acinclude.m4 index 92cde650..f450f9ad 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,7 +1,3 @@ -dnl -dnl $Id$ -dnl - AC_DEFUN([AC_PROG_CC_PIE], [ AC_CACHE_CHECK([whether ${CC-cc} accepts -fPIE], ac_cv_prog_cc_pie, [ echo 'void f(){}' > conftest.c @@ -15,7 +11,7 @@ AC_DEFUN([AC_PROG_CC_PIE], [ ]) AC_DEFUN([AC_INIT_BLUEZ], [ - AC_PREFIX_DEFAULT(/usr) + AC_PREFIX_DEFAULT(/usr/local) if (test "${CFLAGS}" = ""); then CFLAGS="-Wall -O2" -- cgit From 8e294a5cbd81dadb65f9420dd03e40c75195c6f9 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 11 Apr 2008 23:39:00 +0000 Subject: Don't optimize when debug is enabled --- acinclude.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'acinclude.m4') diff --git a/acinclude.m4 b/acinclude.m4 index f450f9ad..e12fd01a 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -61,6 +61,6 @@ AC_DEFUN([AC_ARG_BLUEZ], [ fi if (test "${debug_enable}" = "yes" && test "${ac_cv_prog_cc_g}" = "yes"); then - CFLAGS="$CFLAGS -g" + CFLAGS="$CFLAGS -g -O0" fi ]) -- cgit 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