~ubuntu-branches/ubuntu/vivid/mpich/vivid-proposed

« back to all changes in this revision

Viewing changes to test/mpi/confdb/aclocal_cc.m4

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2014-04-01 20:24:20 UTC
  • mfrom: (5.2.4 sid)
  • Revision ID: package-import@ubuntu.com-20140401202420-t5ey1ia2klt5dkq3
Tags: 3.1-4
* [c3e3398] Disable test_primitives, which is unreliable on some platforms.
            (Closes: #743047)
* [265a699] Add minimal autotest.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
        dnl developers notice this case.
12
12
        AC_BEFORE([$0],[AC_PROG_CC])
13
13
        PAC_PUSH_FLAG([CFLAGS])
14
 
        AC_PROG_CC([icc pgcc xlc xlC pathcc cc gcc clang])
 
14
        AC_PROG_CC([icc pgcc xlc xlC pathcc gcc clang cc])
15
15
        PAC_POP_FLAG([CFLAGS])
16
16
])
17
17
dnl
338
338
fi
339
339
dnl
340
340
])
341
 
if test "$pac_cv_prog_c_weak_symbols" = "no" ; then
342
 
    ifelse([$2],,:,[$2])
343
 
else
 
341
if test "$pac_cv_prog_c_weak_symbols" != "no" ; then
344
342
    case "$pac_cv_prog_c_weak_symbols" in
345
343
        "pragma weak") AC_DEFINE(HAVE_PRAGMA_WEAK,1,[Supports weak pragma])
346
344
        ;;
349
347
        "pragma _CRI") AC_DEFINE(HAVE_PRAGMA_CRI_DUP,1,[Cray style weak pragma])
350
348
        ;;
351
349
    esac
352
 
    ifelse([$1],,:,[$1])
353
350
fi
354
351
AC_CACHE_CHECK([whether __attribute__ ((weak)) allowed],
355
352
pac_cv_attr_weak,[
364
361
# Check if the alias option for weak attributes is allowed
365
362
AC_CACHE_CHECK([whether __attribute__((weak,alias(...))) allowed],
366
363
pac_cv_attr_weak_alias,[
 
364
PAC_PUSH_FLAG([CFLAGS])
 
365
# force an error exit if the weak attribute isn't understood
 
366
CFLAGS=-Werror
367
367
AC_TRY_COMPILE([int foo(int) __attribute__((weak,alias("__foo")));],[int a;],
368
 
pac_cv_attr_weak_alias=yes,pac_cv_attr_weak_alias=no)])
 
368
pac_cv_attr_weak_alias=yes,pac_cv_attr_weak_alias=no)
 
369
# Restore original CFLAGS
 
370
PAC_POP_FLAG([CFLAGS])])
 
371
if test "$pac_cv_attr_weak_alias" = "yes" ; then
 
372
    AC_DEFINE(HAVE_WEAK_ATTRIBUTE,1,[Attribute style weak pragma])
 
373
fi
 
374
if test "$pac_cv_prog_c_weak_symbols" = "no" -a "$pac_cv_attr_weak_alias" = "no" ; then
 
375
    ifelse([$2],,:,[$2])
 
376
else
 
377
    ifelse([$1],,:,[$1])
 
378
fi
369
379
])
370
380
 
371
381
#
492
502
    #       should never be tolerated.  This also ensures that we get quick
493
503
    #       compilation failures rather than later link failures that usually
494
504
    #       come from a function name typo.
 
505
    #   -Wcast-align -- Casting alignment warnings.  This is an
 
506
    #       important check, but is temporarily disabled, since it is
 
507
    #       throwing too many (correct) warnings currently, causing us
 
508
    #       to miss other warnings.
 
509
    #   -Wshorten-64-to-32 -- Bad type-casting warnings.  This is an
 
510
    #       important check, but is temporarily disabled, since it is
 
511
    #       throwing too many (correct) warnings currently, causing us
 
512
    #       to miss other warnings.
495
513
    # the embedded newlines in this string are safe because we evaluate each
496
514
    # argument in the for-loop below and append them to the CFLAGS with a space
497
515
    # as the separator instead
498
516
    pac_common_strict_flags="
499
517
        -Wall
500
518
        -Wextra
501
 
        -Wshorten-64-to-32
502
519
        -Wno-missing-field-initializers
503
520
        -Wstrict-prototypes
504
521
        -Wmissing-prototypes
512
529
        -Wno-endif-labels
513
530
        -Wpointer-arith
514
531
        -Wbad-function-cast
515
 
        -Wcast-align
516
532
        -Wwrite-strings
517
533
        -Wno-sign-compare
518
534
        -Wold-style-definition
528
544
        -Werror-implicit-function-declaration
529
545
    "
530
546
 
531
 
    enable_c89=yes
532
 
    enable_c99=no
 
547
    enable_c89=no
 
548
    enable_c99=yes
533
549
    enable_posix=2001
534
550
    enable_opt=yes
535
551
    flags="`echo $1 | sed -e 's/:/ /g' -e 's/,/ /g'`"
538
554
             c89)
539
555
                enable_strict_done="yes"
540
556
                enable_c89=yes
 
557
                enable_c99=no
541
558
                ;;
542
559
             c99)
543
560
                enable_strict_done="yes"
 
561
                enable_c89=no
544
562
                enable_c99=yes
545
563
                ;;
546
564
             posix1995)
569
587
                ;;
570
588
             all|yes)
571
589
                enable_strict_done="yes"
572
 
                enable_c89=yes
 
590
                enable_c99=yes
573
591
                enable_posix=2001
574
592
                enable_opt=yes
575
593
                ;;
1197
1215
dnl headerfiles.
1198
1216
dnl
1199
1217
dnl Approach:
1200
 
dnl Try to compile a program with the function, but passed with an incorrect
1201
 
dnl calling sequence.  If the compilation fails, then the declaration
1202
 
dnl is provided within the header files.  If the compilation succeeds,
1203
 
dnl the declaration is required.
1204
 
dnl
1205
 
dnl We use a 'double' as the first argument to try and catch varargs
1206
 
dnl routines that may use an int or pointer as the first argument.
1207
 
dnl
1208
 
dnl There is one difficulty - if the compiler has been instructed to
1209
 
dnl fail on implicitly defined functions, then this test will always
1210
 
dnl fail.
1211
 
dnl 
 
1218
dnl Attempt to assign library function to function pointer.  If the function
 
1219
dnl is not declared in a header, this will fail.  Use a non-static global so
 
1220
dnl the compiler does not warn about an unused variable.
 
1221
dnl
 
1222
dnl Simply calling the function is not enough because C89 compilers allow
 
1223
dnl calls to implicitly-defined functions.  Re-declaring a library function
 
1224
dnl with an incompatible prototype is also not sufficient because some
 
1225
dnl compilers (notably clang-3.2) only produce a warning in this case.
 
1226
dnl
1212
1227
dnl D*/
1213
1228
AC_DEFUN([PAC_FUNC_NEEDS_DECL],[
1214
1229
AC_CACHE_CHECK([whether $2 needs a declaration],
1215
1230
pac_cv_func_decl_$2,[
1216
1231
AC_TRY_COMPILE([$1
1217
 
int $2(double, int, double, const char *);],[int a=$2(1.0,27,1.0,"foo");],
1218
 
pac_cv_func_decl_$2=yes,pac_cv_func_decl_$2=no)])
 
1232
void (*fptr)(void) = (void(*)(void))$2;],[],
 
1233
pac_cv_func_decl_$2=no,pac_cv_func_decl_$2=yes)])
1219
1234
if test "$pac_cv_func_decl_$2" = "yes" ; then
1220
1235
changequote(<<,>>)dnl
1221
1236
define(<<PAC_FUNC_NAME>>, translit(NEEDS_$2_DECL, [a-z *], [A-Z__]))dnl
1620
1635
           pac_cv_struct_alignment="eight"
1621
1636
        fi
1622
1637
])
1623
 
dnl
 
1638
 
1624
1639
dnl PAC_C_MACRO_VA_ARGS
1625
1640
dnl
1626
1641
dnl will AC_DEFINE([HAVE_MACRO_VA_ARGS]) if the compiler supports C99 variable
1627
1642
dnl length argument lists in macros (#define foo(...) bar(__VA_ARGS__))
1628
1643
AC_DEFUN([PAC_C_MACRO_VA_ARGS],[
1629
1644
    AC_MSG_CHECKING([for variable argument list macro functionality])
1630
 
    AC_LINK_IFELSE([AC_LANG_PROGRAM([
 
1645
 
 
1646
    # check if the program links correctly
 
1647
    rm -f pac_test.log
 
1648
    PAC_LINK_IFELSE_LOG([pac_test.log],[AC_LANG_PROGRAM([
1631
1649
        #include <stdio.h>
1632
1650
        #define conftest_va_arg_macro(...) printf(__VA_ARGS__)
1633
1651
    ],
1634
1652
    [conftest_va_arg_macro("a test %d", 3);])],
1635
 
    [AC_DEFINE([HAVE_MACRO_VA_ARGS],[1],[Define if C99-style variable argument list macro functionality])
1636
 
     AC_MSG_RESULT([yes])],
1637
 
    [AC_MSG_RESULT([no])])
 
1653
    prog_links=yes,prog_links=no)
 
1654
 
 
1655
    # If the program linked OK, make sure there were no warnings
 
1656
    if test "$prog_links" = "yes" -a "`cat pac_test.log`" = "" ; then
 
1657
       AC_DEFINE([HAVE_MACRO_VA_ARGS],[1],[Define if C99-style variable argument list macro functionality])
 
1658
       AC_MSG_RESULT([yes])
 
1659
    else
 
1660
       AC_MSG_RESULT([no])
 
1661
    fi
 
1662
    rm -f pac_test.log
1638
1663
])dnl
 
1664
 
 
1665
# Will AC_DEFINE([HAVE_BUILTIN_EXPECT]) if the compiler supports __builtin_expect.
 
1666
AC_DEFUN([PAC_C_BUILTIN_EXPECT],[
 
1667
AC_MSG_CHECKING([if C compiler supports __builtin_expect])
 
1668
 
 
1669
AC_TRY_LINK(, [
 
1670
    return __builtin_expect(1, 1) ? 1 : 0
 
1671
], [
 
1672
    have_builtin_expect=yes
 
1673
    AC_MSG_RESULT([yes])
 
1674
], [
 
1675
    have_builtin_expect=no
 
1676
    AC_MSG_RESULT([no])
 
1677
])
 
1678
if test x$have_builtin_expect = xyes ; then
 
1679
    AC_DEFINE([HAVE_BUILTIN_EXPECT], [1], [Define to 1 if the compiler supports __builtin_expect.])
 
1680
fi
 
1681
])