[PATCH] Add AC_LIB_PROG_LD_GNU m4 macro to check for GNU ld in the test suite.

Dan Nicholson dbn.lists at gmail.com
Mon Jun 8 19:16:14 PDT 2009


On Mon, Jun 8, 2009 at 3:29 PM, Peter Hutterer<peter.hutterer at who-t.net> wrote:
> On Mon, Jun 08, 2009 at 06:04:38AM -0700, Dan Nicholson wrote:
>> As long as we're already using libtool.m4, this macro is just
>> duplication. Libtool already does all this for us in AC_PROG_LD and
>> AC_PROG_LD_GNU. lt_cv_prog_gnu_ld and with_gnu_ld are already set to
>> yes or no.
>>
>> So, you can drop the whole external macro so long as you do your
>> checking after AC_PROG_LIBTOOL/LT_INIT. To be extra safe, you can add
>> a specific call to AC_PROG_LD, but it's probably not necessary.
>
> neat. so something like this below should do then.
>
> Cheers,
>  Peter
>
> From edcfe0f9602a2a2c54e87b895cbc568769abc699 Mon Sep 17 00:00:00 2001
> From: Peter Hutterer <peter.hutterer at who-t.net>
> Date: Fri, 5 Jun 2009 16:38:46 +1000
> Subject: [PATCH] Add check for GNU ld in the test suite.
>
> The GNU linker supports a -wrap option to wrap function calls at link-time.
> This allows for easy overriding of functions in the X server with stubs in
> the test suite. This functionality is only supported on the GNU linker and
> will be used extensively in the tests. Disable the tests if GNU ld is not
> available.
> ---
>  configure.ac |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index fc29bf0..c7c56c8 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1145,11 +1145,19 @@ fi
>  AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
>
>  if test "x$UNITTESTS" = xauto; then
> -       PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.16], [UNITTESTS=yes], [UNITTESTS=no])
> +       PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.16], [HAVE_GLIB=yes], [HAVE_GLIB=no])
> +       if test "x$HAVE_GLIB" = xyes && test "x$with_gnu_ld" = xyes; then
> +           UNITTESTS=yes
> +       else
> +           UNITTESTS=no
> +       fi
>  fi
>  if test "x$UNITTESTS" = xyes; then
>        AC_DEFINE(UNITTESTS, 1, [Enable unit tests])
>        PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.16])
> +       if test "x$with_gnu_ld" = xno; then
> +           AC_MSG_ERROR([GNU ld required to build unit tests])
> +       fi
>        AC_SUBST([GLIB_LIBS])
>        AC_SUBST([GLIB_CFLAGS])
>  fi
> --
> 1.6.3.rc1.2.g0164.dirty

That should work.

--
Dan


More information about the xorg-devel mailing list