Home | History | Annotate | Download | only in hcidump
      1 AC_DEFUN([AC_PROG_CC_PIE], [
      2 	AC_CACHE_CHECK([whether ${CC-cc} accepts -fPIE], ac_cv_prog_cc_pie, [
      3 		echo 'void f(){}' > conftest.c
      4 		if test -z "`${CC-cc} -fPIE -pie -c conftest.c 2>&1`"; then
      5 			ac_cv_prog_cc_pie=yes
      6 		else
      7 			ac_cv_prog_cc_pie=no
      8 		fi
      9 		rm -rf conftest*
     10 	])
     11 ])
     12 
     13 AC_DEFUN([AC_INIT_BLUEZ], [
     14 	AC_PREFIX_DEFAULT(/usr/local)
     15 
     16 	if (test "${CFLAGS}" = ""); then
     17 		CFLAGS="-Wall -O2"
     18 	fi
     19 
     20 	if (test "${prefix}" = "NONE"); then
     21 		dnl no prefix and no sysconfdir, so default to /etc
     22 		if (test "$sysconfdir" = '${prefix}/etc'); then
     23 			AC_SUBST([sysconfdir], ['/etc'])
     24 		fi
     25 
     26 		dnl no prefix and no mandir, so use ${prefix}/share/man as default
     27 		if (test "$mandir" = '${prefix}/man'); then
     28 			AC_SUBST([mandir], ['${prefix}/share/man'])
     29 		fi
     30 
     31 		prefix="${ac_default_prefix}"
     32 	fi
     33 
     34 	if (test "${libdir}" = '${exec_prefix}/lib'); then
     35 		libdir="${prefix}/lib"
     36 	fi
     37 
     38 	if (test "$sysconfdir" = '${prefix}/etc'); then
     39 		configdir="${prefix}/etc/bluetooth"
     40 	else
     41 		configdir="${sysconfdir}/bluetooth"
     42 	fi
     43 
     44 	AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}", [Directory for the configuration files])
     45 ])
     46 
     47 AC_DEFUN([AC_PATH_BLUEZ], [
     48 	PKG_CHECK_MODULES(BLUEZ, bluez, dummy=yes, AC_MSG_ERROR(Bluetooth library is required))
     49 	AC_SUBST(BLUEZ_CFLAGS)
     50 	AC_SUBST(BLUEZ_LIBS)
     51 ])
     52 
     53 AC_DEFUN([AC_ARG_BLUEZ], [
     54 	debug_enable=no
     55 	fortify_enable=yes
     56 	pie_enable=yes
     57 
     58 	AC_ARG_ENABLE(fortify, AC_HELP_STRING([--disable-fortify], [disable compile time buffer checks]), [
     59 		fortify_enable=${enableval}
     60 	])
     61 
     62 	AC_ARG_ENABLE(pie, AC_HELP_STRING([--disable-pie], [enable position independent executables flag]), [
     63 		pie_enable=${enableval}
     64 	])
     65 
     66 	AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable compiling with debugging information]), [
     67 		debug_enable=${enableval}
     68 	])
     69 
     70 	if (test "${fortify_enable}" = "yes"); then
     71 		CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
     72 	fi
     73 
     74 	if (test "${pie_enable}" = "yes" && test "${ac_cv_prog_cc_pie}" = "yes"); then
     75 		CFLAGS="$CFLAGS -fPIE"
     76 		LDFLAGS="$LDFLAGS -pie"
     77 	fi
     78 
     79 	if (test "${debug_enable}" = "yes" && test "${ac_cv_prog_cc_g}" = "yes"); then
     80 		CFLAGS="$CFLAGS -g -O0"
     81 	fi
     82 ])
     83