summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2004-08-12 16:03:09 +0000
committerMarcel Holtmann <marcel@holtmann.org>2004-08-12 16:03:09 +0000
commitde58f635303b1ad9d5c61d4e6d714638ba3b0c32 (patch)
treee9c6805f3ec33cc7a4614548201ed7b6b974f3df
parent750ac6d869c3b4bd94ecdb6dce9c16265326b954 (diff)
Add optional support for PIE and debug information
-rw-r--r--acinclude.m439
-rw-r--r--configure.in8
2 files changed, 41 insertions, 6 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")
diff --git a/configure.in b/configure.in
index db44ef1d..1cf69659 100644
--- a/configure.in
+++ b/configure.in
@@ -10,13 +10,12 @@ AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
-AC_PREFIX_BLUEZ
-
-CFLAGS="-Wall -g -O2"
+AC_INIT_BLUEZ
AC_LANG_C
AC_PROG_CC
+AC_PROG_CC_PIE
AC_PROG_INSTALL
AC_PROG_YACC
AM_PROG_LEX
@@ -24,6 +23,7 @@ AM_PROG_LEX
AC_PATH_BLUEZ
AC_PATH_USB
AC_PATH_DBUS
-AC_PATH_EXTRA
+
+AC_ARG_BLUEZ
AC_OUTPUT(Makefile hcid/Makefile tools/Makefile rfcomm/Makefile sdpd/Makefile dund/Makefile pand/Makefile hidd/Makefile cups/Makefile test/Makefile scripts/Makefile pcmcia/Makefile extra/Makefile)