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
13 AC_DEFUN([COMPILER_FLAGS], [
15 if (test "$USE_MAINTAINER_MODE" = "yes"); then
16 with_cflags="$with_cflags -Wall -Werror -Wextra"
17 with_cflags="$with_cflags -Wno-unused-parameter"
18 with_cflags="$with_cflags -Wno-missing-field-initializers"
19 with_cflags="$with_cflags -Wdeclaration-after-statement"
20 with_cflags="$with_cflags -Wmissing-declarations"
21 with_cflags="$with_cflags -Wredundant-decls"
22 with_cflags="$with_cflags -Wcast-align"
23 with_cflags="$with_cflags -Wswitch-enum"
24 with_cflags="$with_cflags -Wformat -Wformat-security"
25 with_cflags="$with_cflags -DG_DISABLE_DEPRECATED"
26 with_cflags="$with_cflags -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28"
27 with_cflags="$with_cflags -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_28"
29 AC_SUBST([WARNING_CFLAGS], $with_cflags)
32 AC_DEFUN([MISC_FLAGS], [
35 AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
36 [disable code optimization through compiler]), [
37 if (test "${enableval}" = "no"); then
38 misc_cflags="$misc_cflags -O0"
41 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
42 [enable compiling with debugging information]), [
43 if (test "${enableval}" = "yes" &&
44 test "${ac_cv_prog_cc_g}" = "yes"); then
45 misc_cflags="$misc_cflags -g"
48 AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
49 [enable position independent executables flag]), [
50 if (test "${enableval}" = "yes" &&
51 test "${ac_cv_prog_cc_pie}" = "yes"); then
52 misc_cflags="$misc_cflags -fPIC"
53 misc_ldflags="$misc_ldflags -pie"
56 if (test "$enable_coverage" = "yes"); then
57 misc_cflags="$misc_cflags --coverage"
58 misc_ldflags="$misc_ldflags --coverage"
60 AC_SUBST([MISC_CFLAGS], $misc_cflags)
61 AC_SUBST([MISC_LDFLAGS], $misc_ldflags)