]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - intl/configure.ac
configure: Implement --enable-host-pie
[thirdparty/binutils-gdb.git] / intl / configure.ac
index 36cf97fe4b19cf5ecdd30f54c39cde413c128d09..a5fc45b3602b94a7a0fba8ce2ae149645cde61c4 100644 (file)
@@ -1,5 +1,5 @@
-AC_PREREQ(2.64)
 AC_INIT
+AC_USE_SYSTEM_EXTENSIONS
 AC_CONFIG_SRCDIR(gettext.c)
 AC_CONFIG_HEADER(config.h)
 AC_CONFIG_MACRO_DIR(../config)
@@ -40,12 +40,59 @@ LIBINTL_DEP=
 INCINTL=
 case $USE_INCLUDED_LIBINTL in
   yes)
-    LIBINTL=`echo $LIBINTL | sed 's,${top_builddir},&/..,' `
-    LTLIBINTL=`echo $LTLIBINTL | sed 's,${top_builddir},&/..,' `
+    LIBINTL=`echo $LIBINTL | sed 's,${top_builddir},-L&/..,; s,\.\./intl/libintl\.a,../intl -lintl,' `
     LIBINTL_DEP='${top_builddir}/../intl/libintl.a'
     INCINTL='-I${top_builddir}/../intl'
     ;;
 esac
 
+# intl is sometimes linked into shared libraries even without --enable-shared
+# (e.g. gdbsupport's inprocess agent): so always PICify, just in case.
+GCC_PICFLAG
+AC_SUBST(PICFLAG)
+
+BISON3_YES='#'
+BISON3_NO=
+if test "$INTLBISON" != :; then
+  ac_bison3=no
+  AC_MSG_CHECKING([bison 3 or later])
+changequote(<<,>>)dnl
+  ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+  case $ac_prog_version in
+    [3-9].*)
+changequote([,])dnl
+      ac_prog_version="$ac_prog_version, bison3"; ac_bison3=yes;;
+    *) ac_prog_version="$ac_prog_version, old";;
+  esac
+  AC_MSG_RESULT([$ac_prog_version])
+  if test $ac_bison3 = yes; then
+    BISON3_YES=
+    BISON3_NO='#'
+  fi
+fi
+AC_SUBST(BISON3_YES)
+AC_SUBST(BISON3_NO)
+
+# Enable --enable-host-shared.
+AC_ARG_ENABLE(host-shared,
+[AS_HELP_STRING([--enable-host-shared],
+       [build host code as shared libraries])])
+AC_SUBST(enable_host_shared)
+
+# 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)
+
+if test x$enable_host_shared = xyes; then
+  PICFLAG=-fPIC
+elif test x$enable_host_pie = xyes; then
+  PICFLAG=-fPIE
+else
+  PICFLAG=
+fi
+AC_SUBST(PICFLAG)
+
 AC_CONFIG_FILES(Makefile config.intl)
 AC_OUTPUT