build/autoconf/expandlibs.m4

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build/autoconf/expandlibs.m4	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,66 @@
     1.4 +dnl This Source Code Form is subject to the terms of the Mozilla Public
     1.5 +dnl License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 +dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.7 +
     1.8 +AC_DEFUN([MOZ_EXPAND_LIBS],
     1.9 +[
    1.10 +dnl ========================================================
    1.11 +dnl =
    1.12 +dnl = Check what kind of list files are supported by the
    1.13 +dnl = linker
    1.14 +dnl =
    1.15 +dnl ========================================================
    1.16 +
    1.17 +AC_CACHE_CHECK(what kind of list files are supported by the linker,
    1.18 +    EXPAND_LIBS_LIST_STYLE,
    1.19 +    [echo "int main() {return 0;}" > conftest.${ac_ext}
    1.20 +     if AC_TRY_COMMAND(${CC-cc} -o conftest.${OBJ_SUFFIX} -c $CFLAGS $CPPFLAGS conftest.${ac_ext} 1>&5) && test -s conftest.${OBJ_SUFFIX}; then
    1.21 +         echo "INPUT(conftest.${OBJ_SUFFIX})" > conftest.list
    1.22 +         if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.list $LIBS 1>&5) && test -s conftest${ac_exeext}; then
    1.23 +             EXPAND_LIBS_LIST_STYLE=linkerscript
    1.24 +         else
    1.25 +             echo "conftest.${OBJ_SUFFIX}" > conftest.list
    1.26 +             dnl -filelist is for the OS X linker.  We need to try -filelist
    1.27 +             dnl first because clang understands @file, but may pass an
    1.28 +             dnl oversized argument list to the linker depending on the
    1.29 +             dnl contents of @file.
    1.30 +             if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS [-Wl,-filelist,conftest.list] $LIBS 1>&5) && test -s conftest${ac_exeext}; then
    1.31 +                 EXPAND_LIBS_LIST_STYLE=filelist
    1.32 +             elif AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS @conftest.list $LIBS 1>&5) && test -s conftest${ac_exeext}; then
    1.33 +                 EXPAND_LIBS_LIST_STYLE=list
    1.34 +             else
    1.35 +                 EXPAND_LIBS_LIST_STYLE=none
    1.36 +             fi
    1.37 +         fi
    1.38 +     else
    1.39 +         dnl We really don't expect to get here, but just in case
    1.40 +         AC_ERROR([couldn't compile a simple C file])
    1.41 +     fi
    1.42 +     rm -rf conftest*])
    1.43 +
    1.44 +LIBS_DESC_SUFFIX=desc
    1.45 +AC_SUBST(LIBS_DESC_SUFFIX)
    1.46 +AC_SUBST(EXPAND_LIBS_LIST_STYLE)
    1.47 +
    1.48 +if test "$GCC_USE_GNU_LD"; then
    1.49 +    AC_CACHE_CHECK(what kind of ordering can be done with the linker,
    1.50 +        EXPAND_LIBS_ORDER_STYLE,
    1.51 +        [> conftest.order
    1.52 +         _SAVE_LDFLAGS="$LDFLAGS"
    1.53 +         LDFLAGS="${LDFLAGS} -Wl,--section-ordering-file,conftest.order"
    1.54 +         AC_TRY_LINK([], [],
    1.55 +             EXPAND_LIBS_ORDER_STYLE=section-ordering-file,
    1.56 +             EXPAND_LIBS_ORDER_STYLE=)
    1.57 +         LDFLAGS="$_SAVE_LDFLAGS"
    1.58 +         if test -z "$EXPAND_LIBS_ORDER_STYLE"; then
    1.59 +             if AC_TRY_COMMAND(${CC-cc} ${DSO_LDOPTS} ${LDFLAGS} -o ${DLL_PREFIX}conftest${DLL_SUFFIX} -Wl,--verbose 2> /dev/null | sed -n '/^===/,/^===/p' | grep '\.text'); then
    1.60 +                 EXPAND_LIBS_ORDER_STYLE=linkerscript
    1.61 +             else
    1.62 +                 EXPAND_LIBS_ORDER_STYLE=none
    1.63 +             fi
    1.64 +             rm -f ${DLL_PREFIX}conftest${DLL_SUFFIX}
    1.65 +         fi])
    1.66 +fi
    1.67 +AC_SUBST(EXPAND_LIBS_ORDER_STYLE)
    1.68 +
    1.69 +])

mercurial