1# This macro wraps AC_SYS_LARGEFILE with one exception for Solaris.
2# PR binutils/9992: We have to replicate everywhere the behaviour of
3# bfd's configure script so that all the directories agree on the size
4# of structures used to describe files.
5
6AC_DEFUN([ACX_LARGEFILE],[dnl
7
8# The tests for host and target for $enable_largefile require
9# canonical names.
10AC_REQUIRE([AC_CANONICAL_HOST])
11AC_REQUIRE([AC_CANONICAL_TARGET])
12
13# As the $enable_largefile decision depends on --enable-plugins we must set it
14# even in directories otherwise not depending on the $plugins option.
15
16AC_PLUGINS
17
18case "${host}" in
19  sparc-*-solaris*|i?86-*-solaris*)
20    # On native 32-bit Solaris/SPARC and x86, large-file and procfs support
21    # were mutually exclusive until Solaris 11.3.  Without procfs support,
22    # the bfd/ elf module cannot provide certain routines such as
23    # elfcore_write_prpsinfo or elfcore_write_prstatus.  So unless the user
24    # explicitly requested large-file support through the
25    # --enable-largefile switch, disable large-file support in favor of
26    # procfs support.
27    #
28    # Check if <sys/procfs.h> is incompatible with large-file support.
29    AC_TRY_COMPILE([#define _FILE_OFFSET_BITS 64
30#define _STRUCTURED_PROC 1
31#include <sys/procfs.h>], , acx_cv_procfs_lfs=yes, acx_cv_procfs_lfs=no)
32    #
33    # Forcefully disable large-file support only if necessary, gdb is in
34    # tree and enabled.
35    if test "${target}" = "${host}" -a "$acx_cv_procfs_lfs" = no \
36         -a -d $srcdir/../gdb -a "$enable_gdb" != no; then
37      : ${enable_largefile="no"}
38      if test "$plugins" = yes; then
39	AC_MSG_WARN([
40plugin support disabled; require large-file support which is incompatible with GDB.])
41	plugins=no
42      fi
43    fi
44    #
45    # Explicitly undef _FILE_OFFSET_BITS if enable_largefile=no for the
46    # benefit of g++ 9+ which predefines it on Solaris.
47    if test "$enable_largefile" = no; then
48      LARGEFILE_CPPFLAGS="-U_FILE_OFFSET_BITS"
49      AC_SUBST(LARGEFILE_CPPFLAGS)
50    fi
51    ;;
52esac
53
54AC_SYS_LARGEFILE
55])
56