summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2004-08-12 16:00:35 +0000
committerMarcel Holtmann <marcel@holtmann.org>2004-08-12 16:00:35 +0000
commitbb42dcd5202fce11689ba81d73783ccb9b79e8d6 (patch)
treeccc031ef2bc717a8841c84fb627d008a4ff0bf9e
parent8b84723cea240cbd9e55ba2acd683fadb3a79282 (diff)
Make compiling with debug information optional
-rw-r--r--acinclude.m459
-rw-r--r--configure.in6
2 files changed, 62 insertions, 3 deletions
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
+])
diff --git a/configure.in b/configure.in
index e0ab76f0..8d4ce6dc 100644
--- a/configure.in
+++ b/configure.in
@@ -10,9 +10,7 @@ AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
-AC_PREFIX_DEFAULT(/usr)
-
-CFLAGS="-Wall -g -O2"
+AC_INIT_BLUEZ
AC_LANG_C
@@ -24,4 +22,6 @@ m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
AC_PROG_LIBTOOL
+AC_ARG_BLUEZ
+
AC_OUTPUT(Makefile include/Makefile src/Makefile bluez.pc)