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