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 -DG_DISABLE_DEPRECATED"
24 with_cflags="$with_cflags -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28"
25 with_cflags="$with_cflags -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_28"
27 AC_SUBST([WARNING_CFLAGS], $with_cflags)
30 AC_DEFUN([MISC_FLAGS], [
33 AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
34 [disable code optimization through compiler]), [
35 if (test "${enableval}" = "no"); then
36 misc_cflags="$misc_cflags -O0"
39 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
40 [enable compiling with debugging information]), [
41 if (test "${enableval}" = "yes" &&
42 test "${ac_cv_prog_cc_g}" = "yes"); then
43 misc_cflags="$misc_cflags -g"
46 AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
47 [enable position independent executables flag]), [
48 if (test "${enableval}" = "yes" &&
49 test "${ac_cv_prog_cc_pie}" = "yes"); then
50 misc_cflags="$misc_cflags -fPIC"
51 misc_ldflags="$misc_ldflags -pie"
54 AC_SUBST([MISC_CFLAGS], $misc_cflags)
55 AC_SUBST([MISC_LDFLAGS], $misc_ldflags)