summaryrefslogtreecommitdiffstats
path: root/acinclude.m4
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-07-26 18:40:43 +0200
committerMarcel Holtmann <marcel@holtmann.org>2008-07-26 18:40:43 +0200
commit9f6cffae412046530af84f6f751f3ff8bfb06af0 (patch)
tree3dd6d9d2b9a57734352bde9cc950f3c1abd24306 /acinclude.m4
parentd7afe93cc74f5f29fac8b84dcff88beb945a16ce (diff)
parent9b58ef755fe8dabbd82a9a9f88e172b7b9d9222a (diff)
Import bluez-libs-3.36 revision history
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m476
1 files changed, 76 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 00000000..6242e390
--- /dev/null
+++ b/acinclude.m4
@@ -0,0 +1,76 @@
+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/local)
+
+ if (test "${CFLAGS}" = ""); then
+ CFLAGS="-Wall -O2"
+ fi
+
+ 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
+ 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}
+ ])
+
+ if (test "${fortify_enable}" = "yes"); then
+ 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
+])