diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2004-08-12 16:03:09 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2004-08-12 16:03:09 +0000 |
commit | de58f635303b1ad9d5c61d4e6d714638ba3b0c32 (patch) | |
tree | e9c6805f3ec33cc7a4614548201ed7b6b974f3df /acinclude.m4 | |
parent | 750ac6d869c3b4bd94ecdb6dce9c16265326b954 (diff) |
Add optional support for PIE and debug information
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index e9aa2aca..3bf506ce 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2,9 +2,23 @@ dnl dnl $Id$ dnl -AC_DEFUN([AC_PREFIX_BLUEZ], [ +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 @@ -149,7 +163,9 @@ AC_DEFUN([AC_PATH_DBUS], [ AC_SUBST(DBUS_LIBS) ]) -AC_DEFUN([AC_PATH_EXTRA], [ +AC_DEFUN([AC_ARG_BLUEZ], [ + pie_enable=no + debug_enable=no dbus_enable=${dbus_found} test_enable=no cups_enable=no @@ -160,6 +176,8 @@ AC_DEFUN([AC_PATH_EXTRA], [ bcm203x_enable=no AC_ARG_ENABLE(all, AC_HELP_STRING([--enable-all], [enable all extra options]), [ + pie_enable=${enableval} + debug_enable=${enableval} dbus_enable=${enableval} test_enable=${enableval} cups_enable=${enableval} @@ -170,6 +188,14 @@ AC_DEFUN([AC_PATH_EXTRA], [ bcm203x_enable=${enableval} ]) + AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie], [enable position independent executables option]), [ + pie_enable=${enableval} + ]) + + AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable compiling with debugging information]), [ + debug_enable=${enableval} + ]) + AC_ARG_ENABLE(dbus, AC_HELP_STRING([--enable-dbus], [enable D-BUS support]), [ dbus_enable=${enableval} ]) @@ -202,6 +228,15 @@ AC_DEFUN([AC_PATH_EXTRA], [ bcm203x_enable=${enableval} ]) + if (test "${pie_enable}" = "yes" && test "${ac_cv_prog_cc_pie}" = "yes"); then + CFLAGS="$CFLAGS -fPIE" + LDFLAGS="$LDFLAGS -pie" + fi + + if (test "${debug_enable}" = "yes" && test "${ac_cv_prog_cc_g}" = "yes"); then + CFLAGS="$CFLAGS -g" + fi + AM_CONDITIONAL(DBUS, test "${dbus_enable}" = "yes" && test "${dbus_found}" = "yes") AM_CONDITIONAL(TEST, test "${test_enable}" = "yes") AM_CONDITIONAL(CUPS, test "${cups_enable}" = "yes") |