build/autoconf/expandlibs.m4
author Ciure Andrei <aciure@mozilla.com>
Sat, 01 Sep 2018 02:44:44 +0300
changeset 434357 dcef4c14d55eb3e5416ba9ce53356449e57e4a0d
parent 434335 331706d8558f8dadeba4fbf5f56651130d43f092
child 434358 ee4f4e66f861e2b7970f9a0246e0857bb01e32e8
permissions -rw-r--r--
Backed out 1 changesets (bug 1487595) for build bustages CLOSED TREE Backed out changeset 331706d8558f (bug 1487595)

dnl This Source Code Form is subject to the terms of the Mozilla Public
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.

AC_DEFUN([MOZ_EXPAND_LIBS],
[
dnl ========================================================
dnl =
dnl = Check what kind of list files are supported by the
dnl = linker
dnl =
dnl ========================================================

AC_CACHE_CHECK(what kind of list files are supported by the linker,
    EXPAND_LIBS_LIST_STYLE,
    [echo "int main() {return 0;}" > conftest.${ac_ext}
     if AC_TRY_COMMAND(${CC-cc} -o conftest.${OBJ_SUFFIX} -c $CFLAGS $CPPFLAGS conftest.${ac_ext} 1>&5) && test -s conftest.${OBJ_SUFFIX}; then
         echo "INPUT(conftest.${OBJ_SUFFIX})" > conftest.list
         if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.list $LIBS 1>&5) && test -s conftest${ac_exeext}; then
             EXPAND_LIBS_LIST_STYLE=linkerscript
         else
             echo "conftest.${OBJ_SUFFIX}" > conftest.list
             dnl -filelist is for the OS X linker.  We need to try -filelist
             dnl first because clang understands @file, but may pass an
             dnl oversized argument list to the linker depending on the
             dnl contents of @file.
             if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS [-Wl,-filelist,conftest.list] $LIBS 1>&5) && test -s conftest${ac_exeext}; then
                 EXPAND_LIBS_LIST_STYLE=filelist
             elif AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS @conftest.list $LIBS 1>&5) && test -s conftest${ac_exeext}; then
                 EXPAND_LIBS_LIST_STYLE=list
             else
                 AC_ERROR([Couldn't find one that works])
             fi
         fi
     else
         dnl We really don't expect to get here, but just in case
         AC_ERROR([couldn't compile a simple C file])
     fi
     rm -rf conftest*])

AC_SUBST(EXPAND_LIBS_LIST_STYLE)

])