[Libreoffice] ld dynamic linker hash style

Francois Tigeot ftigeot at wolfpond.org
Wed Apr 6 02:25:08 PDT 2011


On Tue, Apr 05, 2011 at 09:02:48PM +0200, Francois Tigeot wrote:
> On Tue, Apr 05, 2011 at 02:28:40PM +0200, Petr Mladek wrote:
> > > On Tue, Apr 05, 2011 at 11:53:55AM +0100, Michael Meeks wrote:
> > > > 	I guess it might be a good idea to default to 'auto' for hash-style,
> > > > and compile and link a small test program with that, defaulting to 'gnu'
> > > > if that is supported, and no flag if not.
> > 
> > Francois, would you be able to cook up something, please? If it is
> > enough to use AC_TRY_RUN, you might find some samples in
> > bootstrap/configure.in.

Here's a first patch to add a check if the build machine can run
--hash-style=gnu binaries.

I still have to find a way to link this check to the AC_ARG_WITH section.

-- 
Francois Tigeot
-------------- next part --------------
diff --git a/configure.in b/configure.in
index 50ea5e1..0904fdf 100755
--- a/configure.in
+++ b/configure.in
@@ -957,8 +957,13 @@ AC_ARG_WITH(system-mozilla,
 WITH_SYSTEM_MOZILLA=no)
 
 AC_ARG_WITH(linker-hash-style,
-[  --with-linker-hash-style
-], WITH_LINKER_HASH_STYLE=$withval, WITH_LINKER_HASH_STYLE=gnu)
+	AS_HELP_STRING([--with-linker-hash-style],
+		[Tells the linker to use --hash-style=choice when linking shared
+		objects. choice can be one of sysv, gnu, or both, the default
+		beeing gnu if it is supported on the build system, and sysv
+		otherwise.]),
+	WITH_LINKER_HASH_STYLE=$withval,
+	WITH_LINKER_HASH_STYLE=gnu)
 
 AC_ARG_WITH(stlport,
     AS_HELP_STRING([--with-stlport],
@@ -2825,6 +2830,26 @@ fi
 
 AC_SUBST(HAVE_CXX0X)
 
+dnl ===================================================================
+dnl Test whether programs linked with --hash-style=gnu can be run
+dnl ===================================================================
+AC_MSG_CHECKING([whether programs linked with --hash-style=gnu can be run])
+
+save_CFLAGS=$CFLAGS
+CFLAGS="-Wl,--hash-style=gnu"
+
+AC_TRY_RUN([
+int main(char argc, char** argv) {
+  return 0;
+}
+], HAVE_HSGNU_SUPPORT=TRUE,AC_MSG_RESULT([no]))
+
+CFLAGS=$save_CFLAGS
+if test "$HAVE_HSGNU_SUPPORT" = "TRUE"; then
+  AC_MSG_RESULT([yes])
+fi
+AC_SUBST(HAVE_HSGNU_SUPPORT)
+
 # ===================================================================
 # use --ccache-skip?
 # ===================================================================


More information about the LibreOffice mailing list