From cb20e19028a8996de9305502ba5e5da3bd1181bf Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Tue, 2 Apr 2019 09:19:36 +0200 Subject: [PATCH] configure.ac: add --disable-pie option PIE is not necessarily supported on all architectures, so add an option to allow the user to disable the PIE. This fixes the build on the m68k architecture: - http://autobuild.buildroot.org/results/25985bbc160e3d62b23c4c613b2a81f3711621e3 Signed-off-by: Fabrice Fontaine [Upstream status: merged] --- Makefile.am | 2 +- configure.ac | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 638198d..332bd67 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ ACLOCAL_AMFLAGS = -I m4 -AM_LDFLAGS = -pie +AM_LDFLAGS = @PIE_LDFLAGS@ doc_DATA = \ README.mailserver \ diff --git a/configure.ac b/configure.ac index 095ff86..5af4235 100644 --- a/configure.ac +++ b/configure.ac @@ -55,6 +55,18 @@ AS_IF([test "x${prefix}" = "xNONE"], [ AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${prefix}/share/locale", [Locale-specific data directory]) ]) +# ================ +# Check for ldflags +# ================ +AC_ARG_ENABLE([pie], + [AS_HELP_STRING([--disable-pie], [Disable Position Independent Executable])], + [enable_pie="$enableval"], + [enable_pie=yes] +) +AS_IF([test x"$enable_pie" != "xno"], [ + PIE_LDFLAGS="-pie" +]) +AC_SUBST([PIE_LDFLAGS]) # ================ # Check for cflags -- 2.14.1