Commit 442db643 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Move LD definition to before libtool configuration. Also add GCC and LLVM support.

Don't see much difference in my simple tests..., LLVM support is not checked
parent 5ec0c105
......@@ -38,13 +38,43 @@ AM_PROG_CC_C_O
# Enable POSIX and platform extension preprocessor macros.
AC_USE_SYSTEM_EXTENSIONS
# Add libtool support.
LT_INIT
# Check for compiler version and vendor.
AX_COMPILER_VENDOR
AX_COMPILER_VERSION
# Interprocedural optimization support. Needs special handling for linking and
# archiving as well as compilation with Intels, needs to be done before
# libtool is configured (to use correct LD).
AC_ARG_ENABLE([ipo],
[AS_HELP_STRING([--enable-ipo],
[Enable interprocedural optimization @<:@no/yes@:>@]
)],
[enable_ipo="$enableval"],
[enable_ipo="no"]
)
if test "$enable_ipo" = "yes"; then
if test "$ax_cv_c_compiler_vendor" = "intel"; then
CFLAGS="$CFLAGS -ip -ipo"
LDFLAGS="$LDFLAGS -ipo"
: ${AR="xiar"}
: ${LD="xild"}
AC_MSG_RESULT([added Intel interprocedural optimization support])
elif test "$ax_cv_c_compiler_vendor" = "gnu"; then
CFLAGS="$CFLAGS -flto"
LDFLAGS="$LDFLAGS -flto"
AC_MSG_RESULT([added GCC interprocedural optimization support])
elif test "$ax_cv_c_compiler_vendor" = "clang"; then
CFLAGS="$CFLAGS -emit-llvm"
AC_MSG_RESULT([added LLVM interprocedural optimization support])
else
AC_MSG_WARN([Compiler does not support interprocedural optimization])
fi
fi
# Add libtool support.
LT_INIT
# Check for MPI. Need to do this before characterising the compiler (C99 mode),
# as this changes the compiler.
# We should consider using AX_PROG_CC_MPI to replace AC_PROG_CC when compiling
......@@ -176,32 +206,12 @@ if test "$enable_san" = "yes"; then
fi
if test "$enable_san" = "yes"; then
CFLAGS="$CFLAGS -fsanitize=address -fno-omit-frame-pointer"
AC_MSG_RESULT([added address sanitizer support])
else
AC_MSG_WARN([Compiler does not support address sanitizer option])
fi
fi
# Intel compiler interprocedural optimization support. Needs special
# handling for linking and archiving as well as compilation.
AC_ARG_ENABLE([ipo],
[AS_HELP_STRING([--enable-ipo],
[Enable Intel interprocedural optimization @<:@no/yes@:>@]
)],
[enable_ipo="$enableval"],
[enable_ipo="no"]
)
if test "$enable_ipo" = "yes"; then
if test "$ax_cv_c_compiler_vendor" = "intel"; then
CFLAGS="$CFLAGS -ip -ipo"
LDFLAGS="-ipo"
AR="xiar"
LD="xild"
else
AC_MSG_WARN([Compiler does not support interprocedural optimization])
fi
fi
# Autoconf stuff.
AC_PROG_INSTALL
AC_PROG_MAKE_SET
......@@ -336,12 +346,12 @@ AC_ARG_ENABLE([compiler-warnings],
if test "$enable_warn" != "no"; then
AX_CFLAGS_WARN_ALL
if test "$enable_warn" = "error"; then
case "$ax_cv_c_compiler_vendor" in
intel | gnu )
case "$ax_cv_c_compiler_vendor" in
intel | gnu )
CFLAGS="$CFLAGS -Werror"
;;
esac
fi
fi
fi
# Check for git, needed for revision stamps.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment