Bug 1295072 - Focus urlbar after opening an empty new tab r=kmag
[gecko.git] / build / autoconf / expandlibs.m4
blob898e5ce01206fd3e6ba57b2474b12b3d591b0842
1 dnl This Source Code Form is subject to the terms of the Mozilla Public
2 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
3 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 AC_DEFUN([MOZ_EXPAND_LIBS],
7 dnl ========================================================
8 dnl =
9 dnl = Check what kind of list files are supported by the
10 dnl = linker
11 dnl =
12 dnl ========================================================
14 AC_CACHE_CHECK(what kind of list files are supported by the linker,
15     EXPAND_LIBS_LIST_STYLE,
16     [echo "int main() {return 0;}" > conftest.${ac_ext}
17      if AC_TRY_COMMAND(${CC-cc} -o conftest.${OBJ_SUFFIX} -c $CFLAGS $CPPFLAGS conftest.${ac_ext} 1>&5) && test -s conftest.${OBJ_SUFFIX}; then
18          echo "INPUT(conftest.${OBJ_SUFFIX})" > conftest.list
19          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.list $LIBS 1>&5) && test -s conftest${ac_exeext}; then
20              EXPAND_LIBS_LIST_STYLE=linkerscript
21          else
22              echo "conftest.${OBJ_SUFFIX}" > conftest.list
23              dnl -filelist is for the OS X linker.  We need to try -filelist
24              dnl first because clang understands @file, but may pass an
25              dnl oversized argument list to the linker depending on the
26              dnl contents of @file.
27              if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS [-Wl,-filelist,conftest.list] $LIBS 1>&5) && test -s conftest${ac_exeext}; then
28                  EXPAND_LIBS_LIST_STYLE=filelist
29              elif AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS @conftest.list $LIBS 1>&5) && test -s conftest${ac_exeext}; then
30                  EXPAND_LIBS_LIST_STYLE=list
31              else
32                  EXPAND_LIBS_LIST_STYLE=none
33              fi
34          fi
35      else
36          dnl We really don't expect to get here, but just in case
37          AC_ERROR([couldn't compile a simple C file])
38      fi
39      rm -rf conftest*])
41 LIBS_DESC_SUFFIX=desc
42 AC_SUBST(LIBS_DESC_SUFFIX)
43 AC_SUBST(EXPAND_LIBS_LIST_STYLE)
45 if test "$GCC_USE_GNU_LD"; then
46     AC_CACHE_CHECK(what kind of ordering can be done with the linker,
47         EXPAND_LIBS_ORDER_STYLE,
48         [> conftest.order
49          _SAVE_LDFLAGS="$LDFLAGS"
50          LDFLAGS="${LDFLAGS} -Wl,--section-ordering-file,conftest.order"
51          AC_TRY_LINK([], [],
52              EXPAND_LIBS_ORDER_STYLE=section-ordering-file,
53              EXPAND_LIBS_ORDER_STYLE=)
54          LDFLAGS="$_SAVE_LDFLAGS"
55          if test -z "$EXPAND_LIBS_ORDER_STYLE"; then
56              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
57                  EXPAND_LIBS_ORDER_STYLE=linkerscript
58              else
59                  EXPAND_LIBS_ORDER_STYLE=none
60              fi
61              rm -f ${DLL_PREFIX}conftest${DLL_SUFFIX}
62          fi])
64 AC_SUBST(EXPAND_LIBS_ORDER_STYLE)