From 43b19e1c8e902e6e96a5ca912497268a19255ac5 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Tue, 20 Oct 2020 23:39:23 +0200
Subject: Detected when Position Independent Code is needed.

---
 configure.ac | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/configure.ac b/configure.ac
index 855091f..3837315 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,6 +35,16 @@ AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 AC_PROG_LIBTOOL
 
+AC_EGREP_CPP(yes,
+[#ifdef __PIE__
+  yes
+#endif
+], has_default_pie=yes, has_default_pie=no)
+
+if test "x$has_default_pie" = "xyes"; then
+   CFLAGS="$CFLAGS -fPIC"
+fi
+
 AC_PATH_PROG(YACC_INST, $YACC)
 AC_PATH_PROG(LEX_INST, $LEX)
 
-- 
cgit v0.11.2-87-g4458