1AC_PREREQ(2.64)
2AC_INIT([LTO plugin for ld], 0.1,,[lto-plugin])
3AC_CANONICAL_SYSTEM
4GCC_TOPLEV_SUBDIRS
5AM_INIT_AUTOMAKE([foreign no-dist])
6AM_MAINTAINER_MODE
7AC_ARG_WITH(libiberty,
8  [AS_HELP_STRING([--with-libiberty=PATH],
9    [specify the directory where to find libiberty [../libiberty]])],
10  [], with_libiberty=../libiberty)
11AC_SUBST(with_libiberty)
12AC_USE_SYSTEM_EXTENSIONS
13AC_PROG_CC
14AC_SYS_LARGEFILE
15ACX_PROG_CC_WARNING_OPTS([-Wall], [ac_lto_plugin_warn_cflags])
16
17# Check whether -static-libgcc is supported.
18saved_LDFLAGS="$LDFLAGS"
19LDFLAGS="$LDFLAGS -static-libgcc"
20AC_MSG_CHECKING([for -static-libgcc])
21AC_LINK_IFELSE([
22  int main() {}], [have_static_libgcc=yes], [have_static_libgcc=no])
23AC_MSG_RESULT($have_static_libgcc);
24LDFLAGS="$saved_LDFLAGS"
25# Need -Wc to get it through libtool.
26if test "x$have_static_libgcc" = xyes; then
27   ac_lto_plugin_ldflags="-Wc,-static-libgcc"
28fi
29AC_SUBST(ac_lto_plugin_ldflags)
30
31if test x"$host_subdir" = x.; then
32   gcc_build_dir=../gcc
33else
34   gcc_build_dir=../../$host_subdir/gcc
35fi
36AC_SUBST(gcc_build_dir)
37
38# Used for constructing correct paths for offload compilers.
39accel_dir_suffix=
40real_target_noncanonical=${target_noncanonical}
41if test x"$enable_as_accelerator_for" != x; then
42  accel_dir_suffix=/accel/${target_noncanonical}
43  real_target_noncanonical=${enable_as_accelerator_for}
44fi
45AC_SUBST(accel_dir_suffix)
46AC_SUBST(real_target_noncanonical)
47
48# Determine what GCC version number to use in filesystem paths.
49GCC_BASE_VER
50
51AM_PROG_LIBTOOL
52ACX_LT_HOST_FLAGS
53AC_SUBST(target_noncanonical)
54AC_TYPE_INT64_T
55AC_TYPE_UINT64_T
56AC_HEADER_SYS_WAIT
57AC_CONFIG_FILES(Makefile)
58AC_CONFIG_HEADERS(config.h)
59AC_OUTPUT
60