xref: /freebsd/sys/contrib/libsodium/m4/ld-output-def.m4 (revision f81cdf24ba5436367377f7c8e8f51f6df2a75ca7)
1# ld-output-def.m4 serial 2
2dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Simon Josefsson
8
9# gl_LD_OUTPUT_DEF()
10# -------------
11# Check if linker supports -Wl,--output-def and define automake
12# conditional HAVE_LD_OUTPUT_DEF if it is.
13AC_DEFUN([gl_LD_OUTPUT_DEF],
14[
15  AC_CACHE_CHECK([if gcc/ld supports -Wl,--output-def],
16    [gl_cv_ld_output_def],
17    [if test "$enable_shared" = no; then
18       gl_cv_ld_output_def="not needed, shared libraries are disabled"
19     else
20       gl_ldflags_save=$LDFLAGS
21       LDFLAGS="-Wl,--output-def,conftest.def"
22       AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
23                   [gl_cv_ld_output_def=yes],
24                   [gl_cv_ld_output_def=no])
25       rm -f conftest.def
26       LDFLAGS="$gl_ldflags_save"
27     fi])
28  AM_CONDITIONAL([HAVE_LD_OUTPUT_DEF], test "x$gl_cv_ld_output_def" = "xyes")
29])
30