summaryrefslogtreecommitdiffstats
path: root/m4/ld-as-needed.m4
blob: 5ba6e0f9971116b85c272f065932eca84a158d0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# ld-as-needed.m4 serial 2

# Test if ld supports --as-needed

AC_DEFUN([PAM_LD_AS_NEEDED],
  [
    AC_CACHE_CHECK(whether ld supports --as-needed,
      pam_cv_ld_as_needed, [ dnl
    cat > conftest.c <<EOF
int main (void) { return 0; }
EOF
     if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
                                 -o conftest.o conftest.c
                                 -Wl,--as-needed 1>&AS_MESSAGE_LOG_FD])
  then
    pam_cv_ld_as_needed=yes
    LDFLAGS="$LDFLAGS -Wl,--as-needed"
  else
    pam_cv_ld_as_needed=no
  fi
  rm -f conftest*])
  AC_SUBST(pam_cv_ld_as_needed)
  ]
)