1##
2## Copyright (C) by Argonne National Laboratory
3##     See COPYRIGHT in top-level directory
4##
5
6AC_PREREQ(2.63)
7
8AC_INIT([MPL], [0.1])
9
10# sanity check that --srcdir was specified correctly
11AC_CONFIG_SRCDIR([src/str/mpl_str.c])
12
13AC_CONFIG_AUX_DIR(confdb)
14AC_CONFIG_MACRO_DIR(confdb)
15AM_INIT_AUTOMAKE([subdir-objects] [-Wall -Werror foreign 1.12.3])
16
17dnl must come before LT_INIT, which AC_REQUIREs AC_PROG_CC
18AC_PROG_CC
19AC_PROG_CC_C99
20AM_PROG_CC_C_O
21
22AC_USE_SYSTEM_EXTENSIONS
23
24AM_PROG_AR
25
26LT_PREREQ([2.2.6])
27
28# Bug in libtool adds -O2 and -g by default
29PAC_PUSH_FLAG([CFLAGS])
30LT_INIT()
31PAC_POP_FLAG([CFLAGS])
32
33# ----------------------------------------------------------------------------
34# Set default library names if names haven't already been provided
35AC_ARG_VAR([MPLLIBNAME],[can be used to override the name of the MPL library (default: "mpl")])
36MPLLIBNAME=${MPLLIBNAME:-"mpl"}
37AC_SUBST(MPLLIBNAME)
38export MPLLIBNAME
39
40if test -s "$srcdir/VERSION" ; then
41   . $srcdir/VERSION
42   AC_SUBST(libmpl_so_version)
43else
44   AC_MSG_ERROR([Version information not found. Configuration aborted.])
45fi
46
47AC_CONFIG_HEADER([include/config.h])
48AC_CONFIG_COMMANDS([prefix-config],[perl $srcdir/confdb/cmd_prefix_config_h.pl MPL include/config.h include/mplconfig.h])
49
50# Non-verbose make
51m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
52
53AC_C_CONST
54AC_C_RESTRICT
55AC_C_INLINE
56
57PAC_C_MACRO_VA_ARGS
58PAC_C_BUILTIN_EXPECT
59PAC_C_STATIC_ASSERT
60
61AC_ARG_ENABLE(embedded,
62    AC_HELP_STRING([--enable-embedded], [Build MPL in embedded mode (default is no)]),
63    [embedded=yes],
64    [embedded=no])
65AM_CONDITIONAL([MPL_EMBEDDED_MODE],[test "x${embedded}" = "xyes"])
66
67AC_ARG_ENABLE(g,
68    AC_HELP_STRING([--enable-g=option],
69	[
70		Control the level of debugging support in MPL.
71		"option" is a list of comma separated names.  Default
72		is "all".
73
74	    none|no   - No debugging
75	    log       - Enable debug event logging
76	    mem       - Enable memory tracing
77	    most|yes|all   - All of the above choices (except "none", obviously)
78	]),,[enable_g=none])
79
80# enable-g
81# strip off multiple options, separated by commas
82PAC_PUSH_FLAG(IFS)
83# Change IFS to process enable_g values; save for use after AC_MSG_WARN
84# below to provide single point of maintenance
85enable_g_IFS=","
86IFS="$enable_g_IFS"
87for option in $enable_g ; do
88    case "$option" in
89	 log)
90	 enable_g_log=yes
91	 ;;
92
93	 mem|memarena)
94	 enable_g_mem=yes
95	 ;;
96
97	 most|yes|all)
98	 enable_g_log=yes
99	 enable_g_mem=yes
100	 ;;
101
102	 no|none)
103	 ;;
104
105	 *)
106	 # Default IFS required by AC_MSG_WARN
107	 PAC_POP_FLAG(IFS)
108	 AC_MSG_WARN([Unknown value $option for enable-g])
109	 # Restore previous IFS to process any remaining enable_g values
110	 PAC_PUSH_FLAG(IFS)
111	 IFS="$enable_g_IFS"
112	 ;;
113    esac
114done
115PAC_POP_FLAG(IFS)
116
117if test "$enable_g_log" = "yes" ; then
118   AC_DEFINE([USE_DBG_LOGGING],[1],[Define to enable logging macros])
119fi
120
121if test "$enable_g_mem" = "yes" ; then
122   AC_DEFINE([USE_MEMORY_TRACING],[1],[Define to enable memory tracing])
123fi
124
125
126# support gcov test coverage information
127PAC_ENABLE_COVERAGE
128
129# check for compiler support for the __typeof() extension
130AC_CACHE_CHECK([whether the compiler supports __typeof(variable)],
131               [pac_cv_have___typeof],
132[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[double foo = 0.0; __typeof(foo) bar = 1.0;]])],
133                  [pac_cv_have___typeof=yes],
134                  [pac_cv_have___typeof=no])]
135)
136if test "$pac_cv_have___typeof" = "yes" ; then
137    AC_DEFINE([HAVE___TYPEOF],[1],[defined if the C compiler supports __typeof(variable)])
138fi
139
140dnl Check if the necessary headers are available
141AC_CHECK_HEADERS(stdio.h stdlib.h string.h stdarg.h ctype.h sys/types.h sys/uio.h execinfo.h unistd.h errno.h windows.h sys/mman.h)
142
143# A C99 compliant compiler should have inttypes.h for fixed-size int types
144AC_CHECK_HEADERS(inttypes.h stdint.h)
145AC_HEADER_STDBOOL
146
147AC_ARG_ENABLE(fast,
148[  --enable-fast=option - Control the level of fast execution supported by MPL.
149        alwaysinline   - Force compiler to always inline functions with MPL_STATIC_INLINE_PREFIX|SUFFIX
150        all|yes  - Same as "alwaysinline"
151        none     - Disable alwaysinline (default)
152],,enable_fast=none)
153
154# enable-fast
155# only alwaysinline option is valid but still need break down multiple options
156# transferred from MPICH separated by commas
157enable_fast_alwaysinline=no
158save_IFS="$IFS"
159IFS=","
160for option in $enable_fast ; do
161    case "$option" in
162        alwaysinline)
163        enable_fast_alwaysinline=yes
164        ;;
165        all|yes)
166        enable_fast_alwaysinline=yes
167        ;;
168        *) # do not change default value (no) for other fast options
169        ;;
170    esac
171done
172IFS="$save_IFS"
173
174if test "$enable_fast_alwaysinline" = "yes"; then
175    AC_DEFINE(ENABLE_ALWAYS_INLINE,1,[Define if force compiler to always inline functions with MPL_STATIC_INLINE_PREFIX|SUFFIX])
176fi
177
178#######################################################################
179# valgrind support
180AC_ARG_WITH([valgrind],
181[AS_HELP_STRING([--without-valgrind],[to disable valgrind support (such as because of version issues)])]
182[AS_HELP_STRING([--with-valgrind=PATH],[use valgrind headers installed in PATH (default is "yes", use no special path)])],
183[],[with_valgrind=yes])
184if test "$with_valgrind" != "no" ; then
185    savedCPPFLAGS="$CPPFLAGS"
186    if test "$with_valgrind" != "yes" ; then
187        # Clients of MPL will either need to respect the localdefs file (as in
188        # MPICH) or add this entry to their own CPPFLAGS-equivalent.
189        # (TODO: a pkg-config file would help with this)
190        PAC_APPEND_FLAG([-I${with_valgrind}], [CPPFLAGS])
191    fi
192    # headers for valgrind client requests
193    AC_CHECK_HEADERS([valgrind.h memcheck.h valgrind/valgrind.h valgrind/memcheck.h])
194    # headers for valgrind-based thread checking tools
195    # TODO: incorporate ThreadSanitizer as well (include dynamic_annotations.h,
196    # link with dynamic_annotations.c)
197    AC_CHECK_HEADERS([helgrind.h valgrind/helgrind.h])
198    AC_CHECK_HEADERS([drd.h valgrind/drd.h])
199
200    # ensure that we have a new enough valgrind with all the client macros
201    # a preproc test would probably be sufficient, but the LINK_IFELSE helps us
202    # double-check that we aren't accidentally grabbing the headers for some
203    # other platform
204    AC_CACHE_CHECK([whether the valgrind headers are broken or too old],
205                   [pac_cv_have_broken_valgrind],
206                   [AC_LINK_IFELSE(
207                       [AC_LANG_PROGRAM([
208#if defined(HAVE_VALGRIND_H) && defined(HAVE_MEMCHECK_H)
209#  include <valgrind.h>
210#  include <memcheck.h>
211#elif defined(HAVE_VALGRIND_VALGRIND_H) && defined(HAVE_VALGRIND_MEMCHECK_H)
212#  include <valgrind/valgrind.h>
213#  include <valgrind/memcheck.h>
214#else
215#  error unexpected valgrind header error
216#endif
217int foo = 10;
218char mempool_obj;
219],[
220#if defined(VALGRIND_MAKE_MEM_DEFINED)
221    VALGRIND_MAKE_MEM_NOACCESS(&foo,sizeof(foo));
222    VALGRIND_MAKE_MEM_UNDEFINED(&foo,sizeof(foo));
223    VALGRIND_MAKE_MEM_DEFINED(&foo,sizeof(foo));
224    VALGRIND_CHECK_MEM_IS_DEFINED(&foo,sizeof(foo));
225    VALGRIND_CHECK_MEM_IS_ADDRESSABLE(&foo,sizeof(foo));
226#elif defined(VALGRIND_MAKE_READABLE)
227/* older (pre-3.2.0), but still supported style */
228    VALGRIND_MAKE_READABLE(&foo,sizeof(foo));
229    VALGRIND_MAKE_NOACCESS(&foo,sizeof(foo));
230    VALGRIND_MAKE_UNDEFINED(&foo,sizeof(foo));
231    VALGRIND_CHECK_READABLE(&foo,sizeof(foo));
232    VALGRIND_CHECK_WRITEABLE(&foo,sizeof(foo));
233#else
234#error missing essential valgrind client macros
235#endif
236    VALGRIND_CREATE_BLOCK(&foo,sizeof(foo),"description");
237    if (RUNNING_ON_VALGRIND) ++foo;
238    VALGRIND_PRINTF_BACKTRACE("testing: %s","valgrind support");
239    VALGRIND_CREATE_MEMPOOL(&mempool_obj,0,0);
240    VALGRIND_MEMPOOL_ALLOC(&mempool_obj,&foo,sizeof(foo));
241    VALGRIND_MEMPOOL_FREE(&mempool_obj,&foo);
242    VALGRIND_DESTROY_MEMPOOL(&mempool_obj);
243]) dnl end PROGRAM
244                       ],
245                       [pac_cv_have_broken_valgrind=no], dnl end if-true
246                       [pac_cv_have_broken_valgrind=yes] dnl end if-false
247                   )] dnl end IFELSE
248                   ) dnl end CACHE_CHECK
249
250    if test "$pac_cv_have_broken_valgrind" = "yes" ; then
251        AC_DEFINE([HAVE_BROKEN_VALGRIND],[1],[define if valgrind is old and/or broken compared to what we are expecting])
252        CPPFLAGS="$savedCPPFLAGS"
253    fi
254fi
255
256
257#######################################################################
258## TIMER CODE
259#######################################################################
260
261# ----------------------------------------------------------------------------
262# Support for timers.  The following code processes the
263#  --enable-timer-type=name argument and selects the timer based on
264# both that field and what configure is able to determine is available.
265# The file src/include/mpl_timer.h is also created.
266# ----------------------------------------------------------------------------
267
268# clock_gettime is the POSIX gettimeofday
269# gethrtime is the Solaris high-resolution timer
270dnl
271dnl Specific checks that a function works correctly
272dnl
273dnl Now that we know what the options are, choose the timer to use
274dnl
275dnl The default preference is
276dnl    Solaris gethrtime
277dnl    Posix   clock_gettime
278dnl    Unix    gettimeofday (one of two versions)
279dnl
280dnl Also available are various hardware time stamps
281dnl    Linux-x86 cycle counter
282dnl    Powerpc-64bit timebase cycle counter
283dnl
284dnl We also allow --enable-timer-type=name to select a timer type
285AC_ARG_ENABLE(timer-type,
286[  --enable-timer-type=name - Select the timer to use for MPI_Wtime and
287                             internal timestamps.
288        ppc64_cycle        - Powerpc-64bit; returns cycle counts using timebase register
289        gethrtime          - Solaris timer (Solaris systems only)
290        clock_gettime      - Posix timer (where available)
291        gettimeofday       - Most Unix systems
292        linux86_cycle      - Linux x86; returns cycle counts, not time in seconds*
293        gcc_ia64_cycle     - IPF ar.itc timer*
294	mach_absolute_time - Mach absolute time (alternative to clock_gettime
295                             for OSX)
296
297        *Note that the cycle timers are intended to be used by
298        developers for internal low-level timing.  Normal users should
299        not use these as they are not guaranteed to be accurate in
300        certain situations.
301],timer_type=$enable_timer_type)
302
303## The user did not specify a timer type.  Try to find a sane option
304## that is supported by the platform.
305if test -z "$timer_type" ; then
306    # Try to pick a timer based on what is available
307    AC_CHECK_FUNCS(clock_gettime clock_getres gethrtime mach_absolute_time gettimeofday)
308    if test "$ac_cv_func_gethrtime" = "yes" ; then
309        # Sigh.  The Solaris include files do not define hrtime_t
310	# Before we accept this choice, make sure that we can
311	# do arithmetic with hrtime_t .
312        AC_CACHE_CHECK([that hrtime_t is properly defined for gethrtime],
313	pac_cv_hrtime_works,[
314	AC_TRY_COMPILE([
315#include <sys/time.h>
316],[hrtime_t t1, t2; t1 = 1; t2 = 2; t1 = t1 + t2;],
317pac_cv_hrtime_works=yes,pac_cv_hrtime_works=no)])
318	# A more ambitious test would look to see if casting an
319	# hrtime_t to int64_t works, and even more ambitious
320	# would check whether long or long long was 64 bits (or even
321	# better, the sizeof hrtime_t).
322
323        # AC_CHECK_FUNCS has false positive when checking whether gethrtime is
324        # available on Solaris with strict configuration. We must use
325        # AC_CHECK_DECL to confirm it.
326        AC_CHECK_DECL(gethrtime)
327    fi
328    if test "$ac_cv_func_gethrtime" = "yes" -a \
329            "$ac_cv_has_decl_gethrtime" = "yes" -a \
330            "$pac_cv_hrtime_works" = "yes" ; then
331        timer_type=gethrtime
332    elif test "$ac_cv_func_clock_gettime" = "yes" -a \
333              "$ac_cv_func_clock_getres" = "yes" ; then
334	 # Test on both because some systems (e.g., cygwin) provide
335	 # clock_gettime but not clock_getres
336        timer_type=clock_gettime
337    elif test "$ac_cv_func_mach_absolute_time" = "yes" ; then
338        timer_type=mach_absolute_time
339    elif test "$ac_cv_func_gettimeofday" = "yes" ; then
340        timer_type=gettimeofday
341    fi
342fi
343if test -z "$timer_type" ; then
344    AC_MSG_ERROR([No timer found])
345fi
346
347# Check for valid timer and select datatypes for the time stamp
348case "$timer_type" in
349
350    gethrtime)
351    MPL_TIMER_TYPE=hrtime_t
352    AC_CHECK_FUNC(gethrtime,,[
353         AC_MSG_ERROR([Requested timer gethrtime is not available])
354])
355    ;;
356
357    clock_gettime)
358    missing_function=no
359    AC_SEARCH_LIBS([clock_gettime],[rt],,AC_MSG_ERROR([clock_gettime is not available]))
360    AC_SEARCH_LIBS([clock_getres],[rt],,AC_MSG_ERROR([clock_getres is not available]))
361    MPL_TIMER_TYPE="struct timespec"
362    # AIX does not always define struct timespec (!)
363    # Make sure that we can use struct timespec
364    AC_CACHE_CHECK([whether struct timespec is defined in time.h],
365                    pac_cv_struct_timespec_defined,[
366    AC_TRY_COMPILE([
367#include <time.h>],[
368    struct timespec t;],pac_cv_struct_timespec_defined=yes,
369    pac_cv_struct_timespec_defined=no)
370])
371    if test "$pac_cv_struct_timespec_defined" != "yes" ; then
372        # Try again, but with -D_XOPEN_SOURCE=500 (works for AIX)
373        AC_CACHE_CHECK([whether struct timespec is defined in time.h with _XOPEN_SOURCE=500],
374                    pac_cv_struct_timespec_defined_with_xopen500,[
375        AC_TRY_COMPILE([
376#define _XOPEN_SOURCE 500
377#include <time.h>],[
378    struct timespec t;],pac_cv_struct_timespec_defined_with_xopen500=yes,
379    pac_cv_struct_timespec_defined_with_xopen500=no)
380])
381	if test "$pac_cv_struct_timespec_defined_with_xopen500" = "yes" ; then
382	    # We need to define _XOPEN_SOURCE=500, but we need to ensure that
383	    # this is done before any include files are loaded.  At
384	    # this point it is really too late to add this definition,
385	    # since it may make other tests incompatible.
386	    AC_MSG_ERROR([The available timer requires _XOPEN_SOURCE=500.  Add -D_XOPEN_SOURCE=500 to CFLAGS and rerun configure])
387        fi
388    fi
389    #
390    # FreeBSD 4.3 incorrectly puts the header into sys/time.h;
391    # time.h is required (see pages 45 and 46 in the POSIX standard).
392    # See if we can compile
393    AC_CACHE_CHECK([for CLOCK_REALTIME defined in time.h],pac_cv_posix_clock_realtime,[
394    AC_TRY_COMPILE([
395#include <time.h>],[
396    clockid_t cid = CLOCK_REALTIME;],pac_cv_posix_clock_realtime=yes,
397pac_cv_posix_clock_realtime=no)])
398    if test "$pac_cv_posix_clock_realtime" = "no" ; then
399         AC_MSG_WARN([POSIX timer requires definitions in time.h])
400	 # Check for the definition in sys/time.h, which is where
401	 # OpenBSD and FreeBSD have put it by mistake
402         AC_TRY_COMPILE([
403#include <time.h>
404#include <sys/time.h>],[
405    clockid_t cid = CLOCK_REALTIME;],pac_cv_posix_clock_realtime=yes,
406pac_cv_posix_clock_realtime=no)
407	if test "$pac_cv_posix_clock_realtime" = yes ; then
408	    AC_MSG_WARN([sys/time.h required for POSIX timer])
409	    AC_DEFINE(NEEDS_SYS_TIME_H,1,[Define if sys/time.h is required to get timer definitions])
410	else
411	    AC_MSG_ERROR([Cannot find the definition of CLOCK_REALTIME for the POSIX timer])
412	fi
413    fi
414    ;;
415
416    gettimeofday)
417    MPL_TIMER_TYPE="struct timeval"
418    # We may have already tested for gettimeofday.  If we got a "yes",
419    # we're good to go
420    if test "$ac_cv_func_gettimeofday" != "yes" ; then
421        AC_CHECK_FUNC(gettimeofday,,[
422         AC_MSG_ERROR([Requested timer gettimeofday is not available])
423])
424    fi
425    ;;
426
427    linux86_cycle|linux86_cycle_2)
428
429# The following AC_TRY_RUN statements are needed because x86_64 compilers
430# usually know about rdtscp but the cpu may or may not actually implement the
431# feature.  This is not cross-compile safe, unfortunately.  In the long run we
432# should allow the user to override this with a configure flag.
433    AC_CACHE_CHECK([that linux86 cycle counter is available],
434        pac_cv_linux86_cycle,
435            AC_TRY_RUN([
436int main()
437{
438    /* rdtscp */
439    long long var, *var_ptr=&var;
440    __asm__ __volatile__("rdtscp; shl \$32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx");
441    return 0;
442}
443            ],pac_cv_linux86_cycle=rdtscp,
444                AC_TRY_RUN([[
445int main()
446{
447    /* cpuid 64 */
448    long long var, *var_ptr=&var;
449    __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx");
450    return 0;
451}
452                ]],pac_cv_linux86_cycle=cpuid_rdtsc64,
453                    AC_TRY_RUN([[[
454int main()
455{
456    /* cpuid 32 */
457    long long var, *var_ptr=&var;
458    __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*var_ptr) : : "ecx");
459    return 0;
460}
461                    ]]],pac_cv_linux86_cycle=cpuid_rdtsc32,
462                        AC_TRY_RUN([[[[
463int main()
464{
465    /* simple */
466    long long var, *var_ptr=&var;
467    __asm__ __volatile__("rdtsc" : "=A" (*var_ptr));
468    return 0;
469}
470                        ]]]],pac_cv_linux86_cycle=rdtsc,
471                        pac_cv_linux86_cycle=no)
472                    )
473                ),
474dnl The if-cross-compiling clause from the first AC_TRY_RUN.  Hope that if the
475dnl compiler knows about the instruction then it's supported by the target
476dnl platform.
477                AC_TRY_COMPILE(,[[
478                    long long var, *var_ptr=&var;
479                    __asm__ __volatile__("rdtscp; shl \$32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx");
480                ]],pac_cv_linux86_cycle=rdtscp,
481                    AC_TRY_COMPILE(,[[[
482                        long long var, *var_ptr=&var;
483                        __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx");
484                    ]]],pac_cv_linux86_cycle=cpuid_rdtsc64,
485                        AC_TRY_COMPILE(,[[[[
486                            long long var, *var_ptr=&var;
487                            __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*var_ptr) : : "ecx");
488                        ]]]],pac_cv_linux86_cycle=cpuid_rdtsc32,
489                            AC_TRY_COMPILE(,[[[[[
490                                long long var, *var_ptr=&var;
491                                __asm__ __volatile__("rdtsc" : "=A" (*var_ptr));
492                            ]]]]],pac_cv_linux86_cycle=rdtsc,
493                            pac_cv_linux86_cycle=no)
494                        )
495                    )
496                )
497            )
498    )
499
500    case "$pac_cv_linux86_cycle" in
501        "rdtscp")
502            AC_DEFINE(LINUX86_CYCLE_RDTSCP,1,[Define which x86 cycle counter to use])
503	    ;;
504        "cpuid_rdtsc64")
505            AC_DEFINE(LINUX86_CYCLE_CPUID_RDTSC64,1,[Define which x86 cycle counter to use])
506            ;;
507        "cpuid_rdtsc32")
508            AC_DEFINE(LINUX86_CYCLE_CPUID_RDTSC32,1,[Define which x86 cycle counter to use])
509	    ;;
510        "rdtsc")
511            AC_DEFINE(LINUX86_CYCLE_RDTSC,1,[Define which x86 cycle counter to use])
512	    ;;
513        *)
514            cpu_gcc_x86_cycle=no
515	    ;;
516    esac
517
518    if test "$cpu_gcc_x86_cycle" = "no" ; then
519        AC_MSG_ERROR([Linux86 cycle counter is not available on this system and or with the $CC compiler])
520    fi
521    MPL_TIMER_TYPE="long long"
522    ;;
523
524    gcc_ia64_cycle)
525    AC_CACHE_CHECK([that IPF timer is available],
526pac_cv_ia64_cycle,[
527    AC_TRY_COMPILE(,[
528    long var, *var_ptr=&var;
529#ifdef __INTEL_COMPILER
530#include "ia64regs.h"
531    var=__getReg(_IA64_REG_AR_ITC);
532#else
533    __asm__ __volatile__("mov %0=ar.itc" : "=r" (var_ptr));
534#endif
535],pac_cv_gcc_ia64_cycle=yes,pac_cv_gcc_ia64_cycle=no)])
536    if test "$pac_cv_gcc_ia64_cycle" != "yes" ; then
537        AC_MSG_ERROR([IPF cycle counter is not available on this system and or with the $CC compiler])
538     fi
539     MPL_TIMER_TYPE="long"
540     ;;
541
542    mach_absolute_time)
543    AC_CHECK_FUNC(mach_absolute_time,,[AC_MSG_ERROR([mach_absolute_time is not available])])
544    AC_CHECK_FUNC(mach_timebase_info,,[AC_MSG_ERROR([mach_timebase_info is not available])])
545    MPL_TIMER_TYPE="uint64_t"
546    ;;
547
548    ppc64_cycle)
549    AC_CACHE_CHECK([that ppc64 timebase cycle counter is available],
550                pac_cv_ppc64_cycle,[
551    AC_TRY_COMPILE([
552    ],[
553        unsigned temp;
554        asm volatile ("mfspr %0,%1" : "=r" (temp)        : "i" (0x10D));
555    ],pac_cv_ppc64_cycle=yes,
556    pac_cv_ppc64_cycle=no)
557    ])
558    if test "$pac_cv_ppc64_cycle" != "yes" ; then
559        AC_MSG_ERROR([The PPC64 cycle counter is not available on this system and or with the $CC compiler])
560    fi
561    MPL_TIMER_TYPE="uint64_t"
562    ;;
563    *)
564    AC_MSG_ERROR([Invalid timer type $timer_type])
565    ;;
566esac
567# Convert timer type to upper case
568timer_type=`echo $timer_type | \
569    tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
570MPL_TIMER_KIND=MPL_TIMER_KIND__$timer_type
571AC_SUBST(MPL_TIMER_KIND)
572AC_SUBST(MPL_TIMER_TYPE)
573AC_MSG_NOTICE([Timer type selected is $timer_type])
574
575#######################################################################
576## END OF TIMER CODE
577#######################################################################
578
579
580#######################################################################
581## START OF PROCESSOR YIELD CODE
582#######################################################################
583# If the user specified a method to use, we check if it's available.
584# If a method was not specified, we make a guess based on the OS.  The
585# default is to use sched_yield() or yield() if one is available,
586# otherwise, default to nothing.  After that we define the appropriate
587# macro.
588
589AC_CHECK_HEADERS(sched.h)
590AC_CHECK_HEADERS(unistd.h)
591AC_CHECK_HEADERS(sys/select.h)
592AC_CHECK_FUNCS(sched_yield yield usleep sleep select)
593
594if test "$ac_cv_func_usleep" = "yes" ; then
595    PAC_FUNC_NEEDS_DECL([#include <unistd.h>],usleep)
596fi
597
598AC_ARG_ENABLE([yield],
599    [AS_HELP_STRING([--enable-yield], [choose a method to yield the processor in busy loops.  Available methods are: sched_yield, yield, select, usleep, sleep, nothing])],
600    [AS_CASE([$enableval],
601        [sched_yield], [AS_IF([test "x$ac_cv_func_sched_yield" != "xyes"], [enable_yield=unavail])],
602        [yield],       [AS_IF([test "x$ac_cv_func_yield"       != "xyes"], [enable_yield=unavail])],
603        [select],      [AS_IF([test "x$ac_cv_func_select"      != "xyes"], [enable_yield=unavail])],
604        [usleep],      [AS_IF([test "x$ac_cv_func_usleep"      != "xyes"], [enable_yield=unavail])],
605        [sleep],       [AS_IF([test "x$ac_cv_func_sleep"       != "xyes"], [enable_yield=unavail])],
606        [nothing|no|none], [],
607        [AC_MSG_ERROR([Invalid option $enableval for --enable-yield])])
608
609     AS_IF([test "x$enable_yield" = "xunavail"],
610              [AC_MSG_ERROR([Yield method $enableval is not available on this platform.])])
611    ],
612    [# none specified by user; make a guess based on os
613     AS_CASE([$host],
614        [*-*-darwin*],
615            [# In Lion, sched_yield worked but none of the other options had any effect
616             # In Mojave x86_64, sched_yield may yield to threads in thread_wait_barrier which is slow to yield back,
617             #    usleep(0) seems work well.
618             AS_IF([test "x$ac_cv_func_usleep" = "xyes"], [enable_yield=usleep],
619                   [enable_yield=nothing])],
620        [*-*-linux*],
621            [# sched_yield() has been broken in linux since 2.6.23, and no good alternative exists.
622             enable_yield=nothing],
623        [# default: just use sched_yield() or yield()
624         AS_IF([test "x$ac_cv_func_sched_yield" = "xyes"], [enable_yield=sched_yield],
625               [test "x$ac_cv_func_yield" = "xyes"], [enable_yield=yield],
626               [enable_yield=nothing])])
627    ]
628)
629
630# set the appropriate macro
631AS_CASE([$enable_yield],
632    [sched_yield],
633        [AC_DEFINE(USE_SCHED_YIELD_FOR_YIELD,1,[Define to use sched_yield to yield processor])],
634    [yield],
635        [AC_DEFINE(USE_YIELD_FOR_YIELD,1,[Define to use yield to yield processor])],
636    [select],
637        [AC_DEFINE(USE_SELECT_FOR_YIELD,1,[Define to use select to yield processor])],
638    [usleep],
639        [AC_DEFINE(USE_USLEEP_FOR_YIELD,1,[Define to use usleep to yield processor])],
640    [sleep],
641        [AC_DEFINE(USE_SLEEP_FOR_YIELD,1,[Define to use sleep to yield processor])],
642    [nothing|no|none],
643        [AC_DEFINE(USE_NOTHING_FOR_YIELD,1,[Define to use nothing to yield processor])],
644    [AC_MSG_ERROR([Invalid value $enable_yield for enable_yield.])]
645)
646
647#######################################################################
648## END OF PROCESSOR YIELD CODE
649#######################################################################
650
651
652#######################################################################
653## START OF THREADS CODE
654#######################################################################
655
656PAC_ARG_THREAD_PACKAGE
657PAC_ARG_POSIX_MUTEX
658
659THREAD_PACKAGE_NAME=MPL_THREAD_PACKAGE_INVALID
660case $with_thread_package in
661    yes|posix|pthreads)
662	AC_CHECK_HEADERS(pthread.h)
663
664        # If pthreads library is found, just include it on the link line. We don't try
665        # to test if the C compiler needs it or not, since the C++ or Fortran
666        # compilers might need it even if the C compiler doesn't
667        # (nvcc with gfortran, for example).
668        #
669        # OSF1 has __pthread_create but not pthread_create (because of
670        # inconsistencies in the pthread spec).  Thus, we look for pthread_key_create
671        AC_CHECK_LIB([pthread],[pthread_key_create],have_pthreads=yes)
672	if test "$have_pthreads" = "yes" ; then
673	   PAC_PREPEND_FLAG([-lpthread],[LIBS])
674	fi
675
676        AC_CHECK_FUNCS(pthread_yield)
677
678        # this check should come after the AC_CHECK_LIB for -lpthread
679        AC_CHECK_FUNC([pthread_key_create],[],[AC_MSG_ERROR([unable to find pthreads library])])
680	THREAD_PACKAGE_NAME=MPL_THREAD_PACKAGE_POSIX
681	;;
682    uti)
683	PAC_CHECK_HEADER_LIB_FATAL(uti,uti.h,uti,uti_attr_init)
684	THREAD_PACKAGE_NAME=MPL_THREAD_PACKAGE_UTI
685	;;
686    solaris)
687	AC_CHECK_HEADERS(thread.h)
688	AC_CHECK_FUNCS(thr_yield)
689	AC_SEARCH_LIBS(thr_create,thread,found=yes,found=no)
690	if test "$found" != "yes" ; then
691	   AC_MSG_ERROR([unable to find Solaris threads library])
692	fi
693	# FIXME: need to add -mt if using solaris compilers
694        THREAD_PACKAGE_NAME=MPL_THREAD_PACKAGE_SOLARIS
695	;;
696    win|windows)
697        with_thread_package=win
698        THREAD_PACKAGE_NAME=MPL_THREAD_PACKAGE_WIN
699        AC_MSG_ERROR([The 'win' thread package is not supported via autoconf builds at this time.])
700        ;;
701    abt|argobots)
702        with_thread_package=argobots
703        PAC_CHECK_HEADER_LIB_FATAL([argobots], [abt.h], [abt], [ABT_key_create])
704        THREAD_PACKAGE_NAME=MPL_THREAD_PACKAGE_ARGOBOTS
705        ;;
706    no|none)
707	with_thread_package=none
708        THREAD_PACKAGE_NAME=MPL_THREAD_PACKAGE_NONE
709	;;
710    *)
711	AC_MSG_ERROR([The specified thread package, $with_thread_package, is not supported.])
712	;;
713esac
714
715case $with_posix_mutex in
716    ticketlock)
717        POSIX_MUTEX_NAME=MPL_POSIX_MUTEX_TICKETLOCK
718        ;;
719    *)
720        POSIX_MUTEX_NAME=MPL_POSIX_MUTEX_NATIVE
721        ;;
722esac
723
724AC_DEFINE_UNQUOTED([THREAD_PACKAGE_NAME],[$THREAD_PACKAGE_NAME],[set to the name of the thread package])
725AC_DEFINE_UNQUOTED([POSIX_MUTEX_NAME],[$POSIX_MUTEX_NAME],[set to the choice of the posix mutex])
726
727# check for compiler-support for thread-local storage (MPL_TLS)
728PAC_CC_CHECK_TLS
729
730#######################################################################
731## END OF THREADS CODE
732#######################################################################
733
734#######################################################################
735## START OF PROCESS MUTEX CODE
736#######################################################################
737
738AC_ARG_WITH([proc-mutex-package],
739[  --with-proc-mutex-package=package     Interprocess mutex package to use. Supported packages include:
740        posix or pthreads - POSIX threads (default, if required)
741        none - no interprocess mutex support
742],,with_proc_mutex_package=posix)
743
744if test "${with_proc_mutex_package}" = "no" ; then
745   with_proc_mutex_package=none
746fi
747if test "${with_proc_mutex_package}" = "yes" ; then
748   with_proc_mutex_package=posix
749fi
750
751PROC_MUTEX_PACKAGE_NAME=MPL_PROC_MUTEX_PACKAGE_INVALID
752case $with_proc_mutex_package in
753  posix|pthreads)
754    if test "${with_proc_mutex_package}" = "pthreads" ; then
755        with_proc_mutex_package=posix
756    fi
757
758    # Do not prepend -lpthread again if already checked by thread package
759    if test "${with_thread_package}" != "posix" ; then
760        AC_CHECK_HEADERS(pthread.h)
761
762        # If pthreads library is found, just include it on the link line. We don't try
763        # to test if the C compiler needs it or not, since the C++ or Fortran
764        # compilers might need it even if the C compiler doesn't
765        # (nvcc with gfortran, for example).
766        AC_CHECK_LIB([pthread],[pthread_mutex_init],have_pthreads=yes)
767        if test "$have_pthreads" = "yes" ; then
768           PAC_PREPEND_FLAG([-lpthread],[LIBS])
769        fi
770    fi
771
772    # this check should come after the AC_CHECK_LIB for -lpthread
773    AC_CHECK_FUNC([pthread_mutex_init],[],[AC_MSG_ERROR([unable to find pthreads library])])
774    # pthread_mutexattr_setpshared is first released in Issue 5
775    AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
776
777    AC_MSG_NOTICE([POSIX will be used for interprocess mutex package.])
778    PROC_MUTEX_PACKAGE_NAME=MPL_PROC_MUTEX_PACKAGE_POSIX
779  ;;
780  no|none)
781    with_proc_mutex_package=none
782    PROC_MUTEX_PACKAGE_NAME=MPL_PROC_MUTEX_PACKAGE_NONE
783  ;;
784  *)
785    AC_MSG_ERROR([The specified interprocess mutex package, $with_proc_mutex_package, is not supported.])
786  ;;
787esac
788
789# Define and export the selected interprocess mutex package so that other packages
790# know what's used in MPL
791AC_DEFINE_UNQUOTED([PROC_MUTEX_PACKAGE_NAME],[$PROC_MUTEX_PACKAGE_NAME],[set to the name of the interprocess mutex package])
792#######################################################################
793## END OF PROCESS MUTEX CODE
794#######################################################################
795
796#######################################################################
797## START OF PTHREAD MUTEX COMMON CHECK
798#######################################################################
799if test "${with_thread_package}" = "pthreads" -o "${with_proc_mutex_package}" = "pthreads"; then
800  # Check for PTHREAD_MUTEX_ERRORCHECK_NP and PTHREAD_MUTEX_ERRORCHECK
801  AC_CACHE_CHECK([whether pthread.h defines PTHREAD_MUTEX_ERRORCHECK_NP],
802  pac_cv_has_pthread_mutex_errorcheck_np,[
803  AC_TRY_COMPILE([#include <pthread.h>],
804                 [int a=PTHREAD_MUTEX_ERRORCHECK_NP;],
805                 pac_cv_has_pthread_mutex_errorcheck_np=yes,
806                 pac_cv_has_pthread_mutex_errorcheck_np=no)])
807  AC_CACHE_CHECK([whether pthread.h defines PTHREAD_MUTEX_ERRORCHECK],
808  pac_cv_has_pthread_mutex_errorcheck,[
809  AC_TRY_COMPILE([#include <pthread.h>],
810                 [int a=PTHREAD_MUTEX_ERRORCHECK;],
811                 pac_cv_has_pthread_mutex_errorcheck=yes,
812                 pac_cv_has_pthread_mutex_errorcheck=no)])
813
814  if test "$pac_cv_has_pthread_mutex_errorcheck" = yes ; then
815      AC_DEFINE(PTHREAD_MUTEX_ERRORCHECK_VALUE,PTHREAD_MUTEX_ERRORCHECK,
816                [Define to an expression that will result in an error checking mutex type.])
817  elif test "$pac_cv_has_pthread_mutex_errorcheck_np" = yes ; then
818      AC_DEFINE(PTHREAD_MUTEX_ERRORCHECK_VALUE,PTHREAD_MUTEX_ERRORCHECK_NP,
819                [Define to an expression that will result in an error checking mutex type.])
820  fi
821
822  PAC_FUNC_NEEDS_DECL([#include <pthread.h>],pthread_mutexattr_settype)
823fi
824#######################################################################
825## END OF PTHREAD MUTEX COMMON CHECK
826#######################################################################
827
828#######################################################################
829## START OF ATOMIC CODE
830#######################################################################
831
832PAC_ARG_ATOMIC_PRIMITIVES
833
834AC_DEFUN([MPL_ATOMIC_TEST_PROGRAM], [AC_LANG_SOURCE([[
835    #include "$1"
836    int main()
837    {
838        struct MPL_atomic_int_t a, b;
839        int c;
840
841        MPL_atomic_relaxed_store_int(&a, 0);
842        MPL_atomic_relaxed_store_int(&b, 1);
843        c = MPL_atomic_relaxed_load_int(&a);
844
845        MPL_atomic_release_store_int(&a, 0);
846        MPL_atomic_release_store_int(&b, 1);
847        c = MPL_atomic_acquire_load_int(&a);
848
849        MPL_atomic_fetch_add_int(&a, 10);
850        MPL_atomic_fetch_sub_int(&a, 10);
851
852        c = MPL_atomic_cas_int(&a, 10, 11);
853        c = MPL_atomic_swap_int(&a, 10);
854
855        MPL_atomic_write_barrier();
856        MPL_atomic_read_barrier();
857        MPL_atomic_read_write_barrier();
858
859        return c;
860    }
861    ]])]
862)
863
864dnl MPL_TRY_ATOMIC_HEADER([header file from src/ dir],
865dnl                       [HAVE_ macro suffix],[feature description])
866dnl Does an AC_LINK_IFELSE() to see if the header file works.
867AC_DEFUN([MPL_TRY_ATOMIC_HEADER],[
868    checked_specified_primitive=yes
869    AC_MSG_CHECKING([for support for $3])
870
871    AC_LINK_IFELSE([MPL_ATOMIC_TEST_PROGRAM([$1])],
872        [AC_DEFINE([HAVE_$2], [1], [Define to 1 if we have support for $3])]
873        [AC_MSG_RESULT([yes])]
874        [mpl_atomic_primitives_set=true]
875    ,
876        [AC_MSG_RESULT([no])]
877    )
878])
879
880AC_CHECK_SIZEOF([void *])
881
882PAC_PUSH_FLAG([CFLAGS])
883CFLAGS="$CFLAGS -I${srcdir}/include"
884# Add -Werror to favor the option that does not result in warnings.
885# Do not add the flag if the compiler doesn't accept -Werror
886PAC_C_CHECK_COMPILER_OPTION([-Werror],[CFLAGS="$CFLAGS -Werror"],)
887mpl_atomic_primitives_set=false
888if test "$with_mpl_atomic_primitives" = "auto" \
889        -o "$with_mpl_atomic_primitives" = "gcc_sync"; then
890    MPL_TRY_ATOMIC_HEADER([mpl_atomic_gcc_sync.h], [GCC_INTRINSIC_SYNC],
891                          [gcc __sync intrinsics])
892fi
893if test "$with_mpl_atomic_primitives" = "auto" \
894        -o "$with_mpl_atomic_primitives" = "gcc_atomic"; then
895    MPL_TRY_ATOMIC_HEADER([mpl_atomic_gcc_atomic.h], [GCC_INTRINSIC_ATOMIC],
896                          [gcc __atomic intrinsics])
897fi
898if test "$with_mpl_atomic_primitives" = "auto" \
899        -o "$with_mpl_atomic_primitives" = "c11"; then
900    MPL_TRY_ATOMIC_HEADER([mpl_atomic_c11.h], [C11_ATOMICS],
901                          [C11 atomic intrinsics])
902fi
903if test "$with_mpl_atomic_primitives" = "auto" \
904        -o "$with_mpl_atomic_primitives" = "windows"; then
905    MPL_TRY_ATOMIC_HEADER([mpl_atomic_nt_intrinsics.h], [NT_INTRINSICS],
906                          [Windows NT atomic intrinsics])
907fi
908PAC_POP_FLAG([CFLAGS])
909
910if test "$mpl_atomic_primitives_set" = "true" ; then
911    : # got native atomic support already
912elif test "$with_mpl_atomic_primitives" = "auto" \
913        -o "$with_mpl_atomic_primitives" = "lock" ; then
914    AC_DEFINE(USE_LOCK_BASED_PRIMITIVES, 1,
915             [Define to 1 if mutex-based synchronization is used])
916    mpl_atomic_primitives_set=true
917elif test "$with_mpl_atomic_primitives" = "no" \
918          -o "$with_mpl_atomic_primitives" = "none" ; then
919    AC_DEFINE(USE_NO_ATOMIC_PRIMITIVES, 1,
920             [Define to 1 if no atomic primitives are used])
921    mpl_atomic_primitives_set=true
922fi
923
924if test "$mpl_atomic_primitives_set" = "false"; then
925    AC_MSG_ERROR([cannot support atomic primitives (argument: \
926`--with-mpl-atomic-primitives=$with_mpl_atomic_primitives`)])
927fi
928
929#######################################################################
930## END OF ATOMIC CODE
931#######################################################################
932
933#######################################################################
934## START OF DBG CODE
935#######################################################################
936
937# mkstemp() is a better replacement for mktemp()
938AC_HAVE_FUNCS(mkstemp)
939if test "$ac_cv_func_mkstemp" = "yes" ; then
940    PAC_FUNC_NEEDS_DECL([#include <stdlib.h>],mkstemp)
941fi
942# fdopen() converts from an fd to a FILE*
943AC_HAVE_FUNCS(fdopen)
944if test "$ac_cv_func_fdopen" = "yes" ; then
945    PAC_FUNC_NEEDS_DECL([#include <stdio.h>],fdopen)
946fi
947
948AC_CHECK_FUNCS(getpid)
949
950#######################################################################
951## END OF DBG CODE
952#######################################################################
953
954#######################################################################
955## START OF SHM CODE
956#######################################################################
957
958dnl Check for shm
959PAC_ARG_SHARED_MEMORY
960
961#######################################################################
962## END OF SHM CODE
963#######################################################################
964
965## Enable creation of libtool-style versioning or no versioning
966AC_ARG_ENABLE(versioning,
967        [AC_HELP_STRING([--enable-versioning],[Enable library versioning])],,
968        [enable_versioning=yes])
969
970if test "$enable_versioning" = "yes" ; then
971   libmpl_so_versionflags="-version-info \$(libmpl_so_version)"
972else
973   libmpl_so_versionflags="-avoid-version"
974fi
975export libmpl_so_versionflags
976AC_SUBST(libmpl_so_versionflags)
977
978#######################################################################
979
980#######################################################################
981## START OF GPU CODE
982#######################################################################
983have_gpu="no"
984# Check CUDA availability
985PAC_CHECK_HEADER_LIB_OPTIONAL([cuda],[cuda_runtime_api.h],[cudart],[cudaStreamSynchronize])
986if test "$pac_have_cuda" = "yes" ; then
987    # also require -lcuda (in addition to -lcudart)
988    PAC_CHECK_HEADER_LIB([cuda.h],[cuda],[cuMemGetAddressRange], pac_have_cuda=yes, pac_have_cuda=no)
989fi
990if test "X${pac_have_cuda}" = "Xyes" ; then
991    PAC_LIBS_ADD(-lcuda)
992    AC_DEFINE([HAVE_CUDA],[1],[Define if CUDA is available])
993    have_gpu="yes"
994fi
995AM_CONDITIONAL([MPL_HAVE_CUDA],[test "X${pac_have_cuda}" = "Xyes"])
996
997if test "$have_gpu" = "no" ; then
998    # Check Level Zero availability when no other GPU library is available
999    PAC_CHECK_HEADER_LIB_OPTIONAL([ze],[level_zero/ze_api.h],[ze_loader],[zeInit])
1000    if test "X${pac_have_ze}" = "Xyes" ; then
1001        AC_DEFINE([HAVE_ZE],[1],[Define if ZE is available])
1002        have_gpu="yes"
1003    fi
1004fi
1005AM_CONDITIONAL([MPL_HAVE_ZE],[test "X${pac_have_ze}" = "Xyes"])
1006#######################################################################
1007## END OF GPU CODE
1008#######################################################################
1009
1010# Check for strdup
1011AC_CHECK_FUNCS(strdup)
1012if test "$ac_cv_func_strdup" = "yes" ; then
1013   PAC_FUNC_NEEDS_DECL([#include <string.h>],strdup)
1014fi
1015
1016# Check for snprintf
1017AC_CHECK_FUNCS(snprintf)
1018if test "$ac_cv_func_snprintf" = "yes" ; then
1019    PAC_FUNC_NEEDS_DECL([#include <stdio.h>],snprintf)
1020fi
1021
1022# Check for putenv
1023AC_CHECK_FUNCS(putenv)
1024if test "$ac_cv_func_putenv" = "yes" ; then
1025    PAC_FUNC_NEEDS_DECL([#include <stdlib.h>],putenv)
1026fi
1027
1028# Check for strerror
1029AC_CHECK_FUNCS(strerror)
1030if test "$ac_cv_func_strerror" = "yes" ; then
1031    PAC_FUNC_NEEDS_DECL([#include <string.h>],strerror)
1032fi
1033
1034# Check for usleep
1035AC_CHECK_FUNCS(usleep)
1036if test "$ac_cv_func_usleep" = "yes" ; then
1037    PAC_FUNC_NEEDS_DECL([#include <unistd.h>],usleep)
1038fi
1039
1040# Check if we can implement MPL_aligned_alloc
1041AC_CHECK_FUNCS(posix_memalign)
1042AC_CHECK_FUNCS(aligned_alloc)
1043if test "$ac_cv_func_aligned_alloc" = "yes" ; then
1044    PAC_FUNC_NEEDS_DECL([#include <stdlib.h>],aligned_alloc)
1045fi
1046if test "$ac_cv_func_posix_memalign" = "yes" -o "$ac_cv_func_aligned_alloc" = "yes"; then
1047   AC_DEFINE([DEFINE_ALIGNED_ALLOC],[1],[Define to 1 if MPL enables MPL_aligned_alloc.])
1048fi
1049
1050# Define some configurable constants
1051AC_ARG_WITH([cacheline],
1052[--with-cacheline=<N>
1053   Define cacheline size (default is 64)],
1054[],
1055[with_cacheline=64])
1056if test $with_cacheline -le 0 ; then
1057    AC_MSG_ERROR(Cache line size must be greater than 0)
1058fi
1059AC_DEFINE_UNQUOTED([CACHELINE_SIZE],[$with_cacheline], [Define cache-line size.])
1060
1061# Check for execinfo backtrace support
1062AX_EXECINFO
1063
1064AX_LIB_SOCKET_NSL
1065AC_CHECK_HEADERS(ifaddrs.h arpa/inet.h)
1066AC_CHECK_FUNCS(inet_ntop getifaddrs)
1067
1068dnl Check for ATTRIBUTE
1069PAC_C_GNU_ATTRIBUTE
1070AX_GCC_VAR_ATTRIBUTE(aligned)
1071AX_GCC_VAR_ATTRIBUTE(used)
1072
1073dnl Check for fallthrough attribute
1074PAC_PUSH_ALL_FLAGS
1075dnl This check requires removing -Wall and -Wextra first or it will fail. Just
1076dnl clear them all.
1077CFLAGS=""
1078AX_GCC_FUNC_ATTRIBUTE(fallthrough)
1079PAC_POP_ALL_FLAGS
1080
1081dnl Final output
1082AC_CONFIG_FILES([Makefile localdefs include/mpl_timer.h])
1083AC_OUTPUT
1084