$NetBSD$ --- ./configure.in.orig 2008-10-06 21:20:00.000000000 +0000 +++ ./configure.in @@ -64,6 +64,8 @@ AM_PROG_LIBTOOL AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[enable unit test code]),enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE) AC_ARG_ENABLE(ansi, AS_HELP_STRING([--enable-ansi],[enable -ansi -pedantic gcc flags]),enable_ansi=$enableval,enable_ansi=no) +AC_ARG_ENABLE(pie, AS_HELP_STRING([--disable-pie],[disable -pie and related gcc flags]),enable_pie=$enableval,enable_pie=yes) +AC_ARG_ENABLE(gc-sections, AS_HELP_STRING([--disable-gc-sections],[disable -Wl,--gc-sections and related gcc flags]),enable_gc_sections=$enableval,enable_gc_sections=yes) AC_ARG_ENABLE(verbose-mode, AS_HELP_STRING([--enable-verbose-mode],[support verbose debug mode]),enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE) AC_ARG_ENABLE(asserts, AS_HELP_STRING([--enable-asserts],[include assertion checks]),enable_asserts=$enableval,enable_asserts=$USE_MAINTAINER_MODE) AC_ARG_ENABLE(checks, AS_HELP_STRING([--enable-checks],[include sanity checks on public API]),enable_checks=$enableval,enable_checks=yes) @@ -252,18 +254,20 @@ if test "x$GCC" = "xyes"; then ;; esac - case " $CFLAGS " in - *[\ \ ]-fPIE[\ \ ]*) ;; - *) if cc_supports_flag -fPIE; then - PIE_CFLAGS="-fPIE" - if ld_supports_flag -z,relro; then - PIE_LDFLAGS="-pie -Wl,-z,relro" - else - PIE_LDFLAGS="-pie" - fi - fi - ;; - esac + if test "x$enable_pie" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-fPIE[\ \ ]*) ;; + *) if cc_supports_flag -fPIE; then + PIE_CFLAGS="-fPIE" + if ld_supports_flag -z,relro; then + PIE_LDFLAGS="-pie -Wl,-z,relro" + else + PIE_LDFLAGS="-pie" + fi + fi + ;; + esac + fi if test "x$enable_ansi" = "xyes"; then case " $CFLAGS " in @@ -311,9 +315,11 @@ AC_SUBST(PIC_LDFLAGS) AC_SUBST(PIE_CFLAGS) AC_SUBST(PIE_LDFLAGS) -if ld_supports_flag --gc-sections; then - SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" - CFLAGS="-ffunction-sections -fdata-sections $CFLAGS" +if test "x$enable_gc_sections" = xyes; then + if ld_supports_flag --gc-sections; then + SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" + CFLAGS="-ffunction-sections -fdata-sections $CFLAGS" + fi fi AC_SUBST(SECTION_FLAGS) AC_SUBST(SECTION_LDFLAGS)