Blame acinclude.m4

Packit Service 8264ee
AC_DEFUN([AC_PROG_CC_PIE], [
Packit Service 8264ee
	AC_CACHE_CHECK([whether ${CC-cc} accepts -fPIE], ac_cv_prog_cc_pie, [
Packit Service 8264ee
		echo 'void f(){}' > conftest.c
Packit Service 8264ee
		if test -z "`${CC-cc} -fPIE -pie -c conftest.c 2>&1`"; then
Packit Service 8264ee
			ac_cv_prog_cc_pie=yes
Packit Service 8264ee
		else
Packit Service 8264ee
			ac_cv_prog_cc_pie=no
Packit Service 8264ee
		fi
Packit Service 8264ee
		rm -rf conftest*
Packit Service 8264ee
	])
Packit Service 8264ee
])
Packit Service 8264ee
Packit Service 8264ee
AC_DEFUN([COMPILER_FLAGS], [
Packit Service 8264ee
	with_cflags=""
Packit Service 8264ee
	if (test "$USE_MAINTAINER_MODE" = "yes"); then
Packit Service 8264ee
		with_cflags="$with_cflags -Wall -Werror -Wextra"
Packit Service 8264ee
		with_cflags="$with_cflags -Wno-unused-parameter"
Packit Service 8264ee
		with_cflags="$with_cflags -Wno-missing-field-initializers"
Packit Service 8264ee
		with_cflags="$with_cflags -Wdeclaration-after-statement"
Packit Service 8264ee
		with_cflags="$with_cflags -Wmissing-declarations"
Packit Service 8264ee
		with_cflags="$with_cflags -Wredundant-decls"
Packit Service 8264ee
		with_cflags="$with_cflags -Wcast-align"
Packit Service 8264ee
		with_cflags="$with_cflags -Wswitch-enum"
Packit Service 8264ee
		with_cflags="$with_cflags -Wformat -Wformat-security"
Packit Service 8264ee
		with_cflags="$with_cflags -DG_DISABLE_DEPRECATED"
Packit Service 8264ee
		with_cflags="$with_cflags -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28"
Packit Service 8264ee
		with_cflags="$with_cflags -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32"
Packit Service 8264ee
	fi
Packit Service 8264ee
	AC_SUBST([WARNING_CFLAGS], $with_cflags)
Packit Service 8264ee
])
Packit Service 8264ee
Packit Service 8264ee
AC_DEFUN([MISC_FLAGS], [
Packit Service 8264ee
	misc_cflags=""
Packit Service 8264ee
	misc_ldflags=""
Packit Service 8264ee
	AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
Packit Service 8264ee
			[disable code optimization through compiler]), [
Packit Service 8264ee
		if (test "${enableval}" = "no"); then
Packit Service 8264ee
			misc_cflags="$misc_cflags -O0"
Packit Service 8264ee
		fi
Packit Service 8264ee
	])
Packit Service 8264ee
	AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
Packit Service 8264ee
			[enable compiling with debugging information]), [
Packit Service 8264ee
		if (test "${enableval}" = "yes" &&
Packit Service 8264ee
				test "${ac_cv_prog_cc_g}" = "yes"); then
Packit Service 8264ee
			misc_cflags="$misc_cflags -g"
Packit Service 8264ee
		fi
Packit Service 8264ee
	])
Packit Service 8264ee
	AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
Packit Service 8264ee
			[enable position independent executables flag]), [
Packit Service 8264ee
		if (test "${enableval}" = "yes" &&
Packit Service 8264ee
				test "${ac_cv_prog_cc_pie}" = "yes"); then
Packit Service 8264ee
			misc_cflags="$misc_cflags -fPIC"
Packit Service 8264ee
			misc_ldflags="$misc_ldflags -pie -Wl,-z,now"
Packit Service 8264ee
		fi
Packit Service 8264ee
	])
Packit Service 8264ee
	if (test "$enable_coverage" = "yes"); then
Packit Service 8264ee
		misc_cflags="$misc_cflags --coverage"
Packit Service 8264ee
		misc_ldflags="$misc_ldflags --coverage"
Packit Service 8264ee
	fi
Packit Service 8264ee
	AC_SUBST([MISC_CFLAGS], $misc_cflags)
Packit Service 8264ee
	AC_SUBST([MISC_LDFLAGS], $misc_ldflags)
Packit Service 8264ee
])