michael@0: dnl This Source Code Form is subject to the terms of the Mozilla Public michael@0: dnl License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: AC_DEFUN([MOZ_EXPAND_LIBS], michael@0: [ michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Check what kind of list files are supported by the michael@0: dnl = linker michael@0: dnl = michael@0: dnl ======================================================== michael@0: michael@0: AC_CACHE_CHECK(what kind of list files are supported by the linker, michael@0: EXPAND_LIBS_LIST_STYLE, michael@0: [echo "int main() {return 0;}" > conftest.${ac_ext} michael@0: if AC_TRY_COMMAND(${CC-cc} -o conftest.${OBJ_SUFFIX} -c $CFLAGS $CPPFLAGS conftest.${ac_ext} 1>&5) && test -s conftest.${OBJ_SUFFIX}; then michael@0: echo "INPUT(conftest.${OBJ_SUFFIX})" > conftest.list michael@0: if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.list $LIBS 1>&5) && test -s conftest${ac_exeext}; then michael@0: EXPAND_LIBS_LIST_STYLE=linkerscript michael@0: else michael@0: echo "conftest.${OBJ_SUFFIX}" > conftest.list michael@0: dnl -filelist is for the OS X linker. We need to try -filelist michael@0: dnl first because clang understands @file, but may pass an michael@0: dnl oversized argument list to the linker depending on the michael@0: dnl contents of @file. michael@0: if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS [-Wl,-filelist,conftest.list] $LIBS 1>&5) && test -s conftest${ac_exeext}; then michael@0: EXPAND_LIBS_LIST_STYLE=filelist michael@0: elif AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS @conftest.list $LIBS 1>&5) && test -s conftest${ac_exeext}; then michael@0: EXPAND_LIBS_LIST_STYLE=list michael@0: else michael@0: EXPAND_LIBS_LIST_STYLE=none michael@0: fi michael@0: fi michael@0: else michael@0: dnl We really don't expect to get here, but just in case michael@0: AC_ERROR([couldn't compile a simple C file]) michael@0: fi michael@0: rm -rf conftest*]) michael@0: michael@0: LIBS_DESC_SUFFIX=desc michael@0: AC_SUBST(LIBS_DESC_SUFFIX) michael@0: AC_SUBST(EXPAND_LIBS_LIST_STYLE) michael@0: michael@0: if test "$GCC_USE_GNU_LD"; then michael@0: AC_CACHE_CHECK(what kind of ordering can be done with the linker, michael@0: EXPAND_LIBS_ORDER_STYLE, michael@0: [> conftest.order michael@0: _SAVE_LDFLAGS="$LDFLAGS" michael@0: LDFLAGS="${LDFLAGS} -Wl,--section-ordering-file,conftest.order" michael@0: AC_TRY_LINK([], [], michael@0: EXPAND_LIBS_ORDER_STYLE=section-ordering-file, michael@0: EXPAND_LIBS_ORDER_STYLE=) michael@0: LDFLAGS="$_SAVE_LDFLAGS" michael@0: if test -z "$EXPAND_LIBS_ORDER_STYLE"; then michael@0: 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 michael@0: EXPAND_LIBS_ORDER_STYLE=linkerscript michael@0: else michael@0: EXPAND_LIBS_ORDER_STYLE=none michael@0: fi michael@0: rm -f ${DLL_PREFIX}conftest${DLL_SUFFIX} michael@0: fi]) michael@0: fi michael@0: AC_SUBST(EXPAND_LIBS_ORDER_STYLE) michael@0: michael@0: ])