2004-01-07 10:42:50 +03:00
|
|
|
dnl -*- shell-script -*-
|
|
|
|
dnl
|
|
|
|
dnl $HEADER$
|
|
|
|
dnl
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_DEFUN([OMPI_SETUP_CC],[
|
2004-01-07 10:42:50 +03:00
|
|
|
|
|
|
|
# Modularize this setup so that sub-configure.in scripts can use this
|
|
|
|
# same setup code.
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_show_subtitle "C compiler and preprocessor"
|
2004-01-07 10:42:50 +03:00
|
|
|
|
|
|
|
# $%@#!@#% AIX!! This has to be called before anything invokes the C
|
|
|
|
# compiler.
|
|
|
|
|
|
|
|
dnl AC_AIX
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check for the compiler
|
|
|
|
#
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_cflags_save="$CFLAGS"
|
2004-01-07 10:42:50 +03:00
|
|
|
AC_PROG_CC
|
|
|
|
BASECC="`basename $CC`"
|
2004-06-07 19:33:53 +04:00
|
|
|
CFLAGS="$ompi_cflags_save"
|
|
|
|
AC_DEFINE_UNQUOTED(OMPI_CC, "$CC", [OMPI underlying C compiler])
|
2004-01-07 10:42:50 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
# When building OMPI, we need this everywhere
|
2004-01-07 10:42:50 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
CPPFLAGS="$CPPFLAGS -DOMPI_BUILDING=1"
|
2004-01-07 10:42:50 +03:00
|
|
|
|
|
|
|
# Do we want debugging?
|
|
|
|
|
|
|
|
if test "$WANT_DEBUG" = "1"; then
|
2004-01-11 03:07:54 +03:00
|
|
|
CFLAGS="$CFLAGS -g"
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_UNIQ(CFLAGS)
|
2004-03-29 00:39:15 +04:00
|
|
|
AC_MSG_WARN([-g has been added to CFLAGS (--enable-debug)])
|
2004-01-11 03:07:54 +03:00
|
|
|
fi
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_CFLAGS_BEFORE_PICKY="$CFLAGS"
|
2004-03-19 09:07:54 +03:00
|
|
|
if test "$GCC" = "yes" -a "$WANT_PICKY_COMPILER" = 1; then
|
2004-01-11 03:07:54 +03:00
|
|
|
add="-Wall -Wundef -Wno-long-long"
|
|
|
|
add="$add -Wmissing-prototypes -Wstrict-prototypes"
|
2004-03-26 10:04:45 +03:00
|
|
|
add="$add -Wcomment -pedantic"
|
2004-01-11 03:07:54 +03:00
|
|
|
|
|
|
|
# see if -Wno-long-double works...
|
|
|
|
CFLAGS_orig="$CFLAGS"
|
|
|
|
CFLAGS="$CFLAGS -Wno-long-double"
|
|
|
|
AC_TRY_COMPILE([], [], add="$add -Wno-long-double")
|
|
|
|
CFLAGS="$CFLAGS_orig"
|
|
|
|
|
|
|
|
add="$add -Werror-implicit-function-declaration "
|
|
|
|
|
2004-01-07 10:42:50 +03:00
|
|
|
CFLAGS="$CFLAGS $add"
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_UNIQ(CFLAGS)
|
2004-01-11 03:07:54 +03:00
|
|
|
AC_MSG_WARN([$add has been added to CFLAGS (developer copy)])
|
2004-01-07 10:42:50 +03:00
|
|
|
unset add
|
|
|
|
fi
|
|
|
|
|
2004-05-18 18:14:12 +04:00
|
|
|
# See if this version of gcc allows -finline-functions
|
|
|
|
if test "$GCC" = "yes"; then
|
|
|
|
CFLAGS_orig="$CFLAGS"
|
|
|
|
CFLAGS="$CFLAGS -finline-functions"
|
|
|
|
add=
|
|
|
|
AC_TRY_COMPILE([], [], add=" -finline-functions")
|
|
|
|
CFLAGS="$CFLAGS_orig$add"
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_UNIQ(CFLAGS)
|
2004-05-18 18:14:12 +04:00
|
|
|
AC_MSG_WARN([$add has been added to CFLAGS])
|
|
|
|
unset add
|
|
|
|
fi
|
|
|
|
|
2004-01-07 10:42:50 +03:00
|
|
|
# Preload the optflags for the case where the user didn't specify any.
|
|
|
|
# If we're using GNU compilers, use -O3 (since it GNU doesn't require
|
|
|
|
# all compilation units to be compiled with the same level of
|
|
|
|
# optimization -- selecting a high level of optimization is not
|
|
|
|
# prohibitive). If we're using anything else, be conservative and
|
|
|
|
# just use -O.
|
|
|
|
|
|
|
|
if test "$GCC" = yes; then
|
|
|
|
OPTFLAGS="-O3"
|
|
|
|
else
|
|
|
|
OPTFLAGS="-O"
|
|
|
|
fi
|
2004-01-16 04:31:56 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_CHECK_OPTFLAGS("$OMPI_CFLAGS_BEFORE_PICKY")
|
|
|
|
OMPI_CFLAGS_BEFORE_PICKY="$co_result"
|
2004-01-16 04:31:56 +03:00
|
|
|
|
2004-01-07 10:42:50 +03:00
|
|
|
AC_MSG_CHECKING([for C optimization flags])
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_CHECK_OPTFLAGS("$CFLAGS")
|
2004-01-07 10:42:50 +03:00
|
|
|
AC_MSG_RESULT([$co_result])
|
2004-01-16 04:31:56 +03:00
|
|
|
CFLAGS="$co_result"])
|