]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/configure.ac
configure: Implement --enable-host-pie
[thirdparty/gcc.git] / gcc / configure.ac
index f87fab97edd826dd46b87f0d2a61a7e0a2caa103..f5b23b92df1fcb7f6de55e090a4a51296e0cbb80 100644 (file)
@@ -1253,44 +1253,6 @@ else
 fi
 AC_SUBST(GENERATED_MANPAGES)
 
-AC_ARG_WITH(sphinx-build,
-  [AS_HELP_STRING([--with-sphinx-build=],
-                  [Use sphinx-build from a given path])],
-  [CONFIGURE_SPHINX_BUILD=$withval],
-  [CONFIGURE_SPHINX_BUILD=]
-)
-AC_SUBST(CONFIGURE_SPHINX_BUILD)
-
-# See if sphinx-build has been installed and is modern enough
-# that we can use it.
-AC_MSG_CHECKING([for sphinx-build])
-sphinx=sphinx-build
-if test x${CONFIGURE_SPHINX_BUILD} != x ; then
-  sphinx=${CONFIGURE_SPHINX_BUILD}
-fi
-
-tempdir=build.$$
-source=source.$$
-mkdir $source
-grep 'needs_sphinx =' ${srcdir}/../doc/baseconf.py > $source/conf.py
-touch $source/index.rst
-if ${sphinx} $source $tempdir >/dev/null 2>&1; then
-  SPHINX_BUILD=${sphinx}
-  HAS_SPHINX_BUILD=has-sphinx-build
-  AC_MSG_RESULT(yes)
-else
-  AC_MSG_WARN([
-  *** sphinx-build is missing or too old.
-  *** Info and man pages documentation will not be built.])
-  AC_MSG_RESULT(no)
-  SPHINX_BUILD=
-  HAS_SPHINX_BUILD=
-fi
-rm -rf $tempdir
-rm -rf $source
-AC_SUBST(SPHINX_BUILD)
-AC_SUBST(HAS_SPHINX_BUILD)
-
 MISSING="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing"
 
 # How about lex?
@@ -7402,11 +7364,14 @@ fi
 # Enable --enable-host-shared
 AC_ARG_ENABLE(host-shared,
 [AS_HELP_STRING([--enable-host-shared],
-               [build host code as shared libraries])],
-[PICFLAG=-fPIC], [PICFLAG=])
+               [build host code as shared libraries])])
 AC_SUBST(enable_host_shared)
-AC_SUBST(PICFLAG)
 
+# Enable --enable-host-pie
+AC_ARG_ENABLE(host-pie,
+[AS_HELP_STRING([--enable-host-pie],
+               [build host code as PIE])])
+AC_SUBST(enable_host_pie)
 
 AC_ARG_ENABLE(libquadmath-support,
 [AS_HELP_STRING([--disable-libquadmath-support],
@@ -7528,10 +7493,6 @@ AC_CACHE_CHECK([for -fno-PIE option],
      [gcc_cv_c_no_fpie=yes],
      [gcc_cv_c_no_fpie=no])
    CXXFLAGS="$saved_CXXFLAGS"])
-if test "$gcc_cv_c_no_fpie" = "yes"; then
-  NO_PIE_CFLAGS="-fno-PIE"
-fi
-AC_SUBST([NO_PIE_CFLAGS])
 
 # Check if -no-pie works.
 AC_CACHE_CHECK([for -no-pie option],
@@ -7542,10 +7503,27 @@ AC_CACHE_CHECK([for -no-pie option],
      [gcc_cv_no_pie=yes],
      [gcc_cv_no_pie=no])
    LDFLAGS="$saved_LDFLAGS"])
-if test "$gcc_cv_no_pie" = "yes"; then
-  NO_PIE_FLAG="-no-pie"
+
+if test x$enable_host_shared = xyes; then
+  PICFLAG=-fPIC
+elif test x$enable_host_pie = xyes; then
+  PICFLAG=-fPIE
+elif test x$gcc_cv_c_no_fpie = xyes; then
+  PICFLAG=-fno-PIE
+else
+  PICFLAG=
 fi
-AC_SUBST([NO_PIE_FLAG])
+
+if test x$enable_host_pie = xyes; then
+  LD_PICFLAG=-pie
+elif test x$gcc_cv_no_pie = xyes; then
+  LD_PICFLAG=-no-pie
+else
+  LD_PICFLAG=
+fi
+
+AC_SUBST([PICFLAG])
+AC_SUBST([LD_PICFLAG])
 
 # Enable Intel CET on Intel CET enabled host if jit is enabled.
 GCC_CET_HOST_FLAGS(CET_HOST_FLAGS)