bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

linker-script.m4?


From: Simon Josefsson
Subject: linker-script.m4?
Date: Mon, 02 Mar 2009 10:14:36 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.90 (gnu/linux)

In many of my library projects, I use shared library versioning when
possible.  This requires some M4 magic to detect the necessary
parameters.  I've been using this M4 macro for some time now.  What do
you think about including this in gnulib?  Thoughts on better ways to
achieve the same thing?

/Simon

2009-03-02  Simon Josefsson  <address@hidden>

        * m4/linker-script.m4: Add.

# linker-script.m4 serial 1
dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

dnl From Simon Josefsson

# gl_LINKER_SCRIPT(VERSION-SCRIPT)
# -------------
# Check if ld supports linker scripts, and define automake conditional
# HAVE_LD_VERSION_SCRIPT if so.  VERSION-SCRIPT is a valid version script
# file.
AC_DEFUN([gl_LINKER_SCRIPT],
[
  AC_ARG_ENABLE([ld-version-script],
    AS_HELP_STRING([--enable-ld-version-script],
      [enable/disable linker version script (default is enabled when 
possible)]),
      [have_ld_version_script=$enableval], [])
  if test -z "$have_ld_version_script"; then
    AC_MSG_CHECKING([if -Wl,--version-script works])
    save_LDFLAGS="$LDFLAGS"
    LDFLAGS="$LDFLAGS -Wl,--version-script=$1"
    AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
                   [have_ld_version_script=yes], [have_ld_version_script=no])
    LDFLAGS="$save_LDFLAGS"
    AC_MSG_RESULT($have_ld_version_script)
  fi
  AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]