1 # Decimal representation of Charm++ release line and API revision
2 # Increment the last 2 digits when making an API change
3 # Increase the first three after branching for a release
5 AC_INIT(Charm++, 60900, [charm@cs.illinois.edu], charm, [http://charm.cs.illinois.edu/])
7 AC_CONFIG_SRCDIR(./Makefile)
9 AC_CONFIG_HEADER(conv-autoconfig.h)
11 AC_CONFIG_COMMANDS([config-cleanup],
12 [sed -i -e 's:^#define\s\+PACKAGE://&:' conv-autoconfig.h])
14 get_full_command_name()
16 if test "$(basename "$*")" != "$*"; then
17 echo "$(cd "$(dirname "$*")" && pwd)/$(basename "$*")"
23 ConvSh='../tmp/conv-mach-opt.sh'
24 ConvMak='../tmp/conv-mach-opt.mak'
26 #clean up conv-mach-opt.sh
27 sed -e '/Option added by configure/d' "$ConvSh" | sed -e '/^$/d' > conv-mach-opt.sh.clean
28 cp -f conv-mach-opt.sh.clean "$ConvSh"
29 rm -f conv-mach-opt.sh.clean
31 #clean up conv-mach-opt.mak
32 sed -e '/Option added by configure/d' "$ConvMak" | sed -e '/^$/d' > conv-mach-opt.mak.clean
33 cp -f conv-mach-opt.mak.clean "$ConvMak"
34 rm -f conv-mach-opt.mak.clean
38 test -r ./conv-config.sh && . ./conv-config.sh
40 echo AC_PACKAGE_VERSION > ../include/VERSION
41 AC_DEFINE_UNQUOTED([CHARM_VERSION], AC_PACKAGE_VERSION, [Charm++ Release/API version number])
43 charmout="charmconfig.out"
45 MAKEFILE_EXT=Make.extlib
52 # add into conv-mach-opt.sh
58 last=`grep -w "$key" "$ConvSh" 2>/dev/null | tail -1 | sed -e 's/ *#.*$//'`
60 if test -n "$last" -a "$last" = "$1"
66 cat >> "$ConvSh" << EOT
68 $1 # Option added by configure script's $2 section
75 sed -e '/^'"$1"'=/d' "$ConvSh" > tmp.$$
80 # add into conv-mach-opt.mak
87 last=`grep -w "$key" "$ConvMak" 2>/dev/null | tail -1 | sed -e 's/ *#.*$//'`
89 if test -n "$last" -a "$last" = "$1"
95 # The lack of whitespace around $1 here is necessary.
96 cat >> "$ConvMak" << EOT
98 $1# Option added by configure script's $2 section
103 # remove_make_flag $1
105 sed -e '/^'"$1"'=/d' "$ConvMak" > tmp.$$
110 add_flag "OPTS_CC='$OPTS_CC'" 'Pass through user-provided C compiler options'
111 add_flag "OPTS_CXX='$OPTS_CXX'" 'Pass through user-provided C++ compiler options'
112 add_make_flag "CMK_COMPILER:=$CMK_COMPILER" 'basic setup'
113 add_make_flag "CMK_SMP:=$CMK_SMP" 'basic setup'
114 add_make_flag "CMK_SHARED_SUF:=$CMK_SHARED_SUF" 'basic setup'
115 add_make_flag "CMK_NO_PARTITIONS:=$CMK_NO_PARTITIONS" 'basic setup'
116 add_make_flag "CMK_BLUEGENEQ:=$CMK_BLUEGENEQ" 'basic setup'
117 add_make_flag "BUILD_CUDA:=$BUILD_CUDA" 'basic setup'
119 # enable/disable error checking
120 AC_ARG_ENABLE([error-checking],
121 [AS_HELP_STRING([--enable-error-checking],
122 [enable error checking])], ,
123 [enable_error_checking=yes])
125 if test "$enable_error_checking" = "no"
127 Echo "Error checking is disabled"
128 AC_DEFINE_UNQUOTED(CMK_ERROR_CHECKING, 0, [disable error checking])
129 add_flag 'OPTS_CC="$OPTS_CC -U_FORTIFY_SOURCE"' 'error checking'
130 add_flag 'OPTS_CXX="$OPTS_CXX -U_FORTIFY_SOURCE"' 'error checking'
132 Echo "Error checking is enabled"
133 AC_DEFINE_UNQUOTED(CMK_ERROR_CHECKING, 1, [enable error checking])
136 # enable/disable AMPI error checking
137 AC_ARG_ENABLE([ampi-error-checking],
138 [AS_HELP_STRING([--enable-ampi-error-checking],
139 [enable AMPI error checking])], ,
140 [enable_ampi_error_checking=yes])
142 if test "$enable_ampi_error_checking" = "no"
144 Echo "AMPI error checking is disabled"
145 AC_DEFINE_UNQUOTED(AMPI_ERROR_CHECKING, 0, [disable ampi error checking])
147 Echo "AMPI error checking is enabled"
148 AC_DEFINE_UNQUOTED(AMPI_ERROR_CHECKING, 1, [enable ampi error checking])
151 # enable/disable statistics collection
152 AC_ARG_ENABLE([stats],
153 [AS_HELP_STRING([--enable-stats],
154 [enable statistics collection])], ,
157 if test "$enable_stats" = "no"
159 Echo "Statistics collection is disabled"
160 AC_DEFINE_UNQUOTED(CMK_WITH_STATS, 0, [disable statistics collection])
162 Echo "Statistics collection is enabled"
163 AC_DEFINE_UNQUOTED(CMK_WITH_STATS, 1, [enable statistics collection])
166 # check enable/disable
167 AC_ARG_ENABLE([tracing],
168 [AS_HELP_STRING([--enable-tracing],
169 [enable tracing modules])], ,
170 [enable_tracing=yes])
172 if test "$enable_tracing" = "no"
174 Echo "Charm tracing is disabled"
175 AC_DEFINE_UNQUOTED(CMK_TRACE_ENABLED, 0, [disable tracing])
176 add_flag CMK_TRACE_ENABLED=0
177 add_make_flag 'CMK_TRACE_ENABLED:=0' 'tracing'
179 Echo "Charm tracing is enabled"
180 AC_DEFINE_UNQUOTED(CMK_TRACE_ENABLED, 1, [enable tracing])
181 add_flag CMK_TRACE_ENABLED=1
182 add_make_flag 'CMK_TRACE_ENABLED:=1' 'tracing'
185 AC_ARG_ENABLE([tracing-commthread],
186 [AS_HELP_STRING([--enable-tracing-commthread],
187 [enable tracing communication thread])], ,
188 [enable_tracing_commthread=no])
190 if test "$enable_tracing_commthread" = "yes"
192 Echo "Charm tracing communication thread is enabled"
193 AC_DEFINE_UNQUOTED(CMK_SMP_TRACE_COMMTHREAD, 1, [enable tracing comm thread])
195 Echo "Charm tracing communication thread is disabled"
196 AC_DEFINE_UNQUOTED(CMK_SMP_TRACE_COMMTHREAD, 0, [disable tracing comm thread])
201 AC_ARG_ENABLE([task_queue],
202 [AS_HELP_STRING([--enable-task-queue],
203 [enable task queue])],
204 [enable_task_queue=$enableval],
205 [enable_task_queue=no])
207 if test "$enable_task_queue" = "no"
209 Echo "Task Queue is disabled"
210 AC_DEFINE_UNQUOTED(CMK_TASKQUEUE, 0, [disable task queue])
212 Echo "Task Queue is enabled"
213 AC_DEFINE_UNQUOTED(CMK_TASKQUEUE, 1, [enable task queue])
217 AC_ARG_ENABLE([drone_mode],
218 [AS_HELP_STRING([--enable-drone-mode],
219 [enable drone mode])],
220 [enable_drone_mode=$enableval],
221 [enable_drone_mode=no])
223 if test "$enable_drone_mode" = "no"
225 Echo "Drone mode is disabled"
226 AC_DEFINE_UNQUOTED(CMK_DRONE_MODE, 0, [disable drone mode])
228 Echo "Drone mode is enabled"
229 AC_DEFINE_UNQUOTED(CMK_DRONE_MODE, 1, [enable drone mode])
232 AC_ARG_ENABLE([charmdebug],
233 [AS_HELP_STRING([--enable-charmdebug],
234 [enable charmDebug])], ,
235 [enable_charmdebug=yes])
237 if test "$enable_charmdebug" = "no" -o "$CMK_CCS_AVAILABLE" = '0'
239 Echo "CharmDebug is disabled"
240 AC_DEFINE_UNQUOTED(CMK_CHARMDEBUG, 0, [disable charmdebug])
241 add_flag CMK_CHARMDEBUG=0
242 add_make_flag 'CMK_CHARMDEBUG:=0'
244 Echo "CharmDebug is enabled"
245 AC_DEFINE_UNQUOTED(CMK_CHARMDEBUG, 1, [enable charmdebug])
246 add_flag CMK_CHARMDEBUG=1
247 add_make_flag 'CMK_CHARMDEBUG:=1'
250 AC_ARG_ENABLE([replay],
251 [AS_HELP_STRING([--enable-replay],
252 [enable record/replay])],
253 [enable_replay=$enableval],
256 if test "$enable_replay" = "no"
258 Echo "Charm record/replay is disabled"
259 AC_DEFINE_UNQUOTED(CMK_REPLAYSYSTEM, 0, [disable replay])
261 Echo "Charm record/replay is enabled"
265 [AS_HELP_STRING([--enable-ccs],
269 if test "$enable_ccs" = "no" -o "$CMK_CCS_AVAILABLE" = '0'
271 Echo "CCS is disabled"
272 AC_DEFINE_UNQUOTED(CMK_CCS_AVAILABLE, 0, [disable ccs])
274 Echo "CCS is enabled"
275 AC_DEFINE_UNQUOTED(CMK_CCS_AVAILABLE, 1, [enable ccs])
278 AC_ARG_ENABLE([controlpoint],
279 [AS_HELP_STRING([--enable-controlpoint],
280 [enable control point])],
281 [enable_controlpoint=$enableval],
282 [enable_controlpoint=yes])
284 if test "$enable_controlpoint" = "yes"
286 Echo "Charm control point is enabled"
287 AC_DEFINE_UNQUOTED(CMK_WITH_CONTROLPOINT, 1, [enable controlpoint])
289 Echo "Charm control point is disabled"
290 AC_DEFINE_UNQUOTED(CMK_WITH_CONTROLPOINT, 0, [disable controlpoint])
293 AC_ARG_ENABLE([lbuserdata],
294 [AS_HELP_STRING([--enable-lbuserdata],
295 [enable LB user data])],
296 [enable_lbuserdata=$enableval],
297 [enable_lbuserdata=no])
299 if test "$enable_lbuserdata" = "yes"
301 Echo "Charm LB user data is enabled"
302 AC_DEFINE_UNQUOTED(CMK_LB_USER_DATA, 1, [enable lb user data])
304 Echo "Charm LB user data is disabled"
305 AC_DEFINE_UNQUOTED(CMK_LB_USER_DATA, 0, [disable lb user data])
308 AC_ARG_ENABLE([lockless-queue],
309 [AS_HELP_STRING([--enable-lockless-queue],
310 [enable lockless queue for PE local and node queue])],
311 [enable_lockless_queue=$enableval],
312 [enable_lockless_queue=no])
314 if test "$enable_lockless_queue" = "no"
316 Echo "Lockless queue for PE local and node queue is disabled"
317 AC_DEFINE_UNQUOTED(CMK_LOCKLESS_QUEUE, 0, [disable lockless queue for pe/node queue])
319 Echo "Lockless queue for PE local and node queue is enabled"
320 AC_DEFINE_UNQUOTED(CMK_LOCKLESS_QUEUE, 1, [enable lockless queue for pe/node queue])
324 AC_ARG_ENABLE([shrinkexpand],
325 [AS_HELP_STRING([--enable-shrinkexpand],
326 [enable malleable jobs / shrink expand])],
327 [enable_shrinkexpand=$enableval],
328 [enable_shrinkexpand=no])
330 if test "$enable_shrinkexpand" = "yes"
332 if test "$enable_ccs" = "no"
334 Echo "CCS cannot be disabled when enabling shrink-expand"
337 Echo "Charm shrink expand is enabled - Controlpoint is disabled."
338 AC_DEFINE_UNQUOTED(CMK_SHRINK_EXPAND, 1, [enable shrinkexpand])
339 AC_DEFINE_UNQUOTED(CMK_WITH_CONTROLPOINT, 0, [disable controlpoint])
342 Echo "Charm shrink expand is disabled"
343 AC_DEFINE_UNQUOTED(CMK_SHRINK_EXPAND, 0, [disable shrinkexpand])
346 AC_ARG_ENABLE([charmpy],
347 [AS_HELP_STRING([--enable-charmpy],
348 [enable charm4py support])],
349 [enable_charmpy=$enableval],
352 if test "$enable_charmpy" = "yes"
354 Echo "charm4py support is enabled"
355 AC_DEFINE_UNQUOTED(CMK_CHARMPY, 1, [enable charmpy])
357 Echo "charm4py support is disabled"
358 AC_DEFINE_UNQUOTED(CMK_CHARMPY, 0, [disable charmpy])
362 [AS_HELP_STRING([--with-numa],
363 [support memory affinity with NUMA])],
368 if test "$with_numa" = "yes"
370 Echo "Charm NUMA support is builtin"
374 AC_ARG_WITH([lbtime-type],
375 [AS_HELP_STRING([--with-lbtime-type=type],
376 [load balancing timer type])],
377 [], [with_lbtime_type=double])
379 if test "$with_lbtime_type" = "float" -o "$with_lbtime_type" = "double"
381 Echo "Setting load balancing timer type as '$with_lbtime_type'"
382 AC_DEFINE_UNQUOTED(CMK_LBTIME_TYPE, $with_lbtime_type, [Setting load balancing timer type])
384 Echo "Invalid type specified for load balancing timer type"
388 AC_DEFINE_UNQUOTED(CMK_LBID_64BIT, 1, [enable 64 bit LB ID])
390 AC_DEFINE_UNQUOTED(CMK_CKSECTIONINFO_STL, 1, [enable STL CkSectionInfo])
392 AC_ARG_WITH([qlogic],
393 [AS_HELP_STRING([--with-qlogic],
394 [QLogic based Infiniband])],[with_qlogic=yes],
397 if test "$with_qlogic" = "no"
399 AC_DEFINE_UNQUOTED(QLOGIC, 0, [disable qlogic])
401 Echo "QLogic based Infiniband"
402 AC_DEFINE_UNQUOTED(QLOGIC, 1, [enable qlogic])
406 AC_MSG_CHECKING(machine name)
407 version=`pwd | awk -F/ '{print $(NF-1)}'`
408 base_version="$CMK_VDIR"
409 AC_DEFINE_UNQUOTED(CMK_MACHINE_NAME, "$version",[machine name])
410 AC_MSG_RESULT($version)
411 AC_SUBST(base_version)
416 # test result passed in $1
417 # If the test suceeded, print $3 and set "pass"/clear "fail"
418 # If the test failed, print $2 and clear "pass"/set "fail"
429 # For debugging the configure script, just "export autoconf_debug=1"
430 # to get this verbose data on any failed tests:
431 if test ! -z "$autoconf_debug"
433 echo "------- test script for $2 failed:"
435 echo "------- the test program was:"
442 # Test: tries to compile C file $t (described by $1).
443 # If successful, prints $2 and sets $pass/clears $fail
444 # If failure, prints $3 and sets $pass/clears $fail
445 # additional arguments to c++ compiler are passed as $4
447 AC_MSG_CHECKING("$1")
448 echo "### $1" >> $charmout
450 echo $CMK_CC $CMK_CC_FLAGS -I../include -I. $CMK_INCDIR $CMK_SYSINC $OPTS_CC -c $tc -o test.o $4 >> $charmout
451 $CMK_CC $CMK_CC_FLAGS -I../include -I. $CMK_INCDIR $CMK_SYSINC $OPTS_CC -c $tc -o test.o $4 > out 2>&1
452 test_result $? "$1" "$2" "$3"
457 if grep -i "warn" out > /dev/null 2>&1 || grep -i "(W)" out > /dev/null 2>&1
459 strictpass="0" && strictfail="1"
466 # Test: tries to compile C++ file $t (described by $1).
467 # If successful, prints $2 and sets $pass/clears $fail
468 # If failure, prints $3 and sets $pass/clears $fail
469 # additional arguments to c++ compiler are passed as $4
471 AC_MSG_CHECKING("$1")
472 echo "### $1" >> $charmout
474 echo $CMK_CXX $CMK_CXX_FLAGS -I../include -I. $CMK_INCDIR $CMK_SYSINC $OPTS_CXX -c $t -o test.o $4 >> $charmout
475 $CMK_CXX $CMK_CXX_FLAGS -I../include -I. $CMK_INCDIR $CMK_SYSINC $OPTS_CXX -c $t -o test.o $4 > out 2>&1
476 test_result $? "$1" "$2" "$3"
481 if grep -i "warn" out > /dev/null 2>&1 || grep -i "(W)" out > /dev/null 2>&1
483 strictpass="0" && strictfail="1"
490 # Test: tries to compile C++ file $t (described by $1) using native compiler.
491 # If successful, prints $2 and sets $pass/clears $fail
492 # If failure, prints $3 and sets $pass/clears $fail
493 # additional arguments to c++ compiler are passed as $4
495 AC_MSG_CHECKING("$1")
496 echo "### $1" >> $charmout
498 echo $CMK_NATIVE_CXX $CMK_NATIVE_CXX_FLAGS -I../include -I. $CMK_INCDIR $CMK_SYSINC $OPTS_CXX -c $t -o test.o $4 >> $charmout
499 $CMK_NATIVE_CXX $CMK_NATIVE_CXX_FLAGS -I../include -I. $CMK_INCDIR $CMK_SYSINC $OPTS_CXX -c $t -o test.o $4 > out 2>&1
500 test_result $? "$1" "$2" "$3"
505 if grep -i "warn" out > /dev/null 2>&1 || grep -i "(W)" out > /dev/null 2>&1
507 strictpass="0" && strictfail="1"
514 # Testlink: tries to compile and link a C++ file $t (described by $1).
515 # If successful, prints $2 and sets $pass/clears $fail
516 # If failure, prints $3 and sets $pass/clears $fail
517 # additional arguments to c++ compiler are passed as $4
519 AC_MSG_CHECKING("$1")
520 echo "### $1" >> $charmout
522 echo $CMK_CXX $CMK_CXX_FLAGS -I../include -I. $CMK_INCDIR $CMK_SYSINC $OPTS_CXX -c $t -o test.o $4 >> $charmout
523 $CMK_CXX $CMK_CXX_FLAGS -I../include -I. $CMK_INCDIR $CMK_SYSINC $OPTS_CXX -c $t -o test.o $4 > out 2>&1
526 test_result 1 "$1" "$2" "$3"
528 echo $CMK_LDXX $CMK_LDXX_FLAGS $CMK_LINK_BINARY -o testlink test.o $CMK_LIBDIR $OPTS_LD $CMK_SYSLIBS $4 $5 >> $charmout
529 $CMK_LDXX $CMK_LDXX_FLAGS $CMK_LINK_BINARY -o testlink test.o $CMK_LIBDIR $OPTS_LD $CMK_SYSLIBS $4 $5 >> out 2>&1
531 test ! -x testlink && ret=1
532 test_result $ret "$1" "$2" "$3"
538 if cat out | grep -i "warn" > /dev/null 2>&1
540 strictpass="0" && strictfail="1"
547 # Testlinkc: tries to compile and link a C file $t (described by $1).
548 # If successful, prints $2 and sets $pass/clears $fail
549 # If failure, prints $3 and sets $pass/clears $fail
550 # additional arguments to c++ compiler are passed as $4
552 AC_MSG_CHECKING("$1")
553 echo "### $1" >> $charmout
555 echo $CMK_CC $CMK_CC_FLAGS -I../include -I. $CMK_INCDIR $CMK_SYSINC $OPTS_CC -c $tc -o test.o $4 >> $charmout
556 $CMK_CC $CMK_CC_FLAGS -I../include -I. $CMK_INCDIR $CMK_SYSINC $OPTS_CC -c $tc -o test.o $4 > out 2>&1
559 test_result 1 "$1" "$2" "$3"
561 echo $CMK_LD $CMK_LD_FLAGS $CMK_LINK_BINARY -o testlink test.o $CMK_LIBDIR $OPTS_LD $CMK_SYSLIBS $4 >> $charmout
562 $CMK_LD $CMK_LD_FLAGS $CMK_LINK_BINARY -o testlink test.o $CMK_LIBDIR $OPTS_LD $CMK_SYSLIBS $4 >> out 2>&1
563 test_result $? "$1" "$2" "$3"
569 if cat out | grep -i "warn" > /dev/null 2>&1
571 strictpass="0" && strictfail="1"
578 # test_linkso $1 $2 $3 $4, where
582 # $4: extra link option
584 AC_MSG_CHECKING("$1")
587 echo $CMK_CXX $CMK_CXX_FLAGS -I../include -I. $CMK_INCDIR $CMK_SYSINC $OPTS_CXX $CMK_PIC -c $t -o test.o $4 >> $charmout
588 $CMK_CXX $CMK_CXX_FLAGS -I../include -I. $CMK_INCDIR $CMK_SYSINC $OPTS_CXX -c $CMK_PIC $t -o test.o $4 > out 2>&1
591 test_result 1 "$1" "$2" "$3"
593 echo $CMK_LD $CMK_LD_FLAGS $CMK_LIBDIR $OPTS_LD $CMK_LD_SHARED $CMK_SYSLIBS test.o -o testlink.$CMK_SHARED_SUF $4 >> $charmout
594 $CMK_LD $CMK_LD_FLAGS $CMK_LIBDIR $OPTS_LD $CMK_LD_SHARED $CMK_SYSLIBS test.o -o testlink.$CMK_SHARED_SUF $4 > out 2>&1
595 test_result $? "$1" "$2" "$3"
598 /bin/rm -f out testlink.$CMK_SHARED_SUF
602 rm -f $t $tc testlink test.o > /dev/null 2>&1
604 test $1 -eq 1 && echo "*** Please find detailed output in tmp/charmconfig.out ***"
608 # detect certain architectures
609 if cat /proc/cpuinfo 2>/dev/null | grep 'POWER7' > /dev/null
611 AC_DEFINE_UNQUOTED(CMK_POWER7, 1, [whether is power7])
616 if test $OSNAME = "Linux"
618 AC_DEFINE_UNQUOTED(CMK_OS_IS_LINUX, 1, [OS is Linux])
620 AC_DEFINE_UNQUOTED(CMK_OS_IS_LINUX, 0, [OS is Linux])
624 AC_MSG_CHECKING("cp command as")
627 if ! $CP test_file test_file.cp 2>err
631 rm -f test_file test_file.cp
633 add_flag CP=\""$CP"\" "cp command"
639 printf("Hello, world!\n");
643 if test "$CMK_BUILD_CRAY" = "1"
645 #echo "Test for known incompatible compiler versions"
647 if test "$CRAY_CC_VERSION" = "8.1.4"
649 echo "CCE 8.1.4 produces incorrect Charm++ code"
650 echo "Please use a newer version of the CCE compiler"
651 echo "e.g. module load cce/8.1.7"
656 #echo "set C++ compiler as: $CMK_CXX $OPTS_CXX $OPTS"
657 AC_MSG_CHECKING("C++ compiler as")
658 AC_MSG_RESULT("$CMK_CXX $OPTS_CXX")
659 test_cxx "whether C++ compiler works" "ok" "no" ""
662 echo "Cannot compile C++ programs with $CMK_CXX"
663 echo " (check your charm++ version)"
670 printf("Hello, world!\n");
674 #echo "set C++ linker as: $CMK_LDXX $OPTS_LD"
675 AC_MSG_CHECKING("C++ linker as")
676 AC_MSG_RESULT("$CMK_LDXX $OPTS_LD")
677 test_link "whether linker works" "ok" "no" ""
680 echo "Cannot link C++ programs with $CMK_LDXX"
681 echo " (check your charm++ version)"
685 AC_MSG_CHECKING("Native C++ compiler as")
686 AC_MSG_RESULT("$CMK_NATIVE_CXX")
687 AC_MSG_CHECKING("Sequential C++ compiler as")
688 AC_MSG_RESULT("$CMK_SEQ_CXX")
690 if echo "$CMK_CC" | grep -E "gcc|clang|icc" > /dev/null 2> /dev/null
692 test_link "whether compiler accept -fno-stack-protector" "ok" "no" "-fno-stack-protector"
693 if test $strictpass -eq 1
695 add_flag OPTS_CC='"$OPTS_CC -fno-stack-protector"' "stack-protection disabling"
696 add_flag OPTS_CXX='"$OPTS_CXX -fno-stack-protector"' "stack-protection disabling"
700 #### check if C++ compiler will accept C++11 features without warning ####
702 // Check for Intel compiler incompatibility with the active g++/libstdc++ by
703 // including an arbitrary standard library header (cf bug #1560)
706 // Check for an excessively old g++/libstdc++ that can't handle features we use
709 std::unique_ptr<int> i;
711 class CkMigrateMessage;
715 base(CkMigrateMessage *) { }
718 template <class Parent>
719 struct CBaseT1 : Parent {
720 std::vector<int> v; // check for C++11's shrink_to_fit()
722 CBaseT1(void) :Parent() { v.shrink_to_fit(); }
723 CBaseT1(CkMigrateMessage *m) :Parent(m) { }
724 CBaseT1(CBaseT1&& rhs) :Parent() { }
726 template <typename... Args>
727 CBaseT1(Args... args) : Parent(args...) { }
730 template struct CBaseT1<base>;
733 test_cxx "whether C++ compiler supports C++11 without flags" "yes" "no" ""
734 if test $strictpass -eq 1
738 # Flags for g++/clang++/icpc/xlC++, pgCC, and CrayCC respectively
739 for i in "-std=c++11" "--c++11" "-h std=c++11"; do
740 test_cxx "whether C++ compiler supports C++11 with '$i'" "yes" "no" "$i"
741 if test $strictpass -eq 1
743 add_flag "$(echo OPTS_CXX=\"\$OPTS_CXX $i\")" "Enable C++11 support"
744 OPTS_CXX="$OPTS_CXX $i"
751 if test -z $got_cpp11
753 echo "Charm++ requires C++11 support, but doesn't know the flag to enable it"
755 echo "For Intel's compiler please see"
756 echo "https://charm.cs.illinois.edu/redmine/issues/1560"
757 echo "about making a suitable version of gcc/g++/libstdc++ available"
759 echo "For Blue Gene/Q please use the Clang compiler"
763 test_native_cxx "whether native C++ compiler supports C++11 without flags" "yes" "no" ""
764 if test $strictpass -ne 1
766 # Flags for g++/clang++/icpc/xlC++, pgCC, and CrayCC respectively
767 for i in "-std=c++11" "--c++11" "-h std=c++11"; do
768 test_native_cxx "whether C++ compiler supports C++11 with '$i'" "yes" "no" "$i"
769 if test $strictpass -eq 1
771 add_flag "$(echo CMK_NATIVE_CXX_FLAGS=\"\$CMK_NATIVE_CXX_FLAGS $i\")" "Enable C++11 support"
777 # Workaround for bug #1045 appearing in GCC >6.x
778 test_cxx "whether C++ compiler accepts -fno-lifetime-dse" "yes" "no" "-fno-lifetime-dse"
779 if test $strictpass -eq 1
781 add_flag "$(echo OPTS_CXX=\"\$OPTS_CXX -fno-lifetime-dse\")" "Disable 'Lifetime DSE' optimization to work around bug #1045 in GCC >6.x"
782 OPTS_CXX="$OPTS_CXX -fno-lifetime-dse"
785 # Determine compiler/linker flags to build libcharm.so for charm4py
786 if test "$enable_charmpy" = "yes"
790 int main() { return 0; }
793 test_cxx "whether C++ compiler accepts --no-as-needed" "yes" "no" "--no-as-needed"
794 if test $strictpass -eq 1
796 add_flag "$(echo CXX_NO_AS_NEEDED=\"--no-as-needed\")" "--no-as-needed flag necessary for compilers that default to linking with --as-needed"
799 got_opt_whole_archive=""
800 # Flags for g++/clang++/icpc, Apple-LLVM respectively
801 for i in "-Wl,--whole-archive -Wl,--no-whole-archive" "-Wl,-all_load"; do
802 test_link "whether linker supports '$i'" "yes" "no" "" "$i"
803 if test $strictpass -eq 1
805 got_opt_whole_archive="true"
806 IFS=' ' read LDXX_WHOLE_ARCHIVE_PRE LDXX_WHOLE_ARCHIVE_POST <<< $i
807 add_flag "$(echo LDXX_WHOLE_ARCHIVE_PRE=\"$LDXX_WHOLE_ARCHIVE_PRE\")" "Flags to link whole archives into libcharm.so"
808 add_flag "$(echo LDXX_WHOLE_ARCHIVE_POST=\"$LDXX_WHOLE_ARCHIVE_POST\")" "Flags to link whole archives into libcharm.so"
813 if test -z $got_opt_whole_archive
815 echo "Don't know how to build libcharm.so for Charm4py"
820 # Figure out if the user has asked to enable the latest language standards
821 USER_ASKED_FOR_NEW_STD=`echo "$BUILDOPTS" | grep "\-use-new-std" | wc -l`
823 # If the user has asked for the newer standards, check if the compilers know about them
824 if test $USER_ASKED_FOR_NEW_STD -ge 1
827 #### check if c compiler supports c11 compilation flags ####
836 test_cc "whether c compiler knows of the c11 standard" "ok" "no" "$CMK_ENABLE_C11"
837 AC_DEFINE_UNQUOTED(CMK_COMPILER_KNOWS_C11, $pass, [whether c compiler knows of the c11 standard] )
840 # Record results for charmc's future use
841 add_flag 'CMK_COMPILER_KNOWS_C11="1"' "c11"
842 # For the rest of configure, append this to compilation flags
843 OPTS_CC="$CMK_ENABLE_C11 $OPTS_CC"
845 fi # endif USER_ASKED_FOR_NEW_STD
849 AC_ARG_WITH([refnum-type],
850 [AS_HELP_STRING([--with-refnum-type=type],
851 [size of the envelope refnum field])],
852 [], [with_refnum_type=no])
854 if test "$with_refnum_type" = "no" -o "$with_refnum_type" = "short"
856 Echo "Setting charm++ envelope refnum field to unsigned short"
857 AC_DEFINE_UNQUOTED(CMK_REFNUM_TYPE, unsigned short, [envelope refnum field set to UShort])
858 elif test "$with_refnum_type" = "int"
860 Echo "Setting charm++ envelope refnum field to unsigned int"
861 AC_DEFINE_UNQUOTED(CMK_REFNUM_TYPE, unsigned int, [envelope refnum field set to UInt])
863 Echo "Invalid size specified for refnum field"
868 AC_ARG_WITH([prio-type],
869 [AS_HELP_STRING([--with-prio-type=type],
870 [size of expected message priorities])],
871 [], [with_prio_type=bitvec])
873 if test "$with_prio_type" = "char" -o "$with_prio_type" = "short" -o "$with_prio_type" = "int" -o "$with_prio_type" = "long" -o "$with_prio_type" = "float" -o "$with_prio_type" = "double"
875 Echo "Configuring support for message priorities of sizeof type $with_prio_type"
876 AC_DEFINE_UNQUOTED(CMK_USE_STL_MSGQ, 1, [whether charm scheduler should use an STL-based msg q])
877 AC_DEFINE_UNQUOTED(CMK_MSG_PRIO_TYPE, $with_prio_type, [expected message priorities are sizeof $with_prio_type])
878 elif test "$with_prio_type" = "bitvec"
880 Echo "Configuring support for message priorities of arbitrary size (bitvectors)"
881 AC_DEFINE_UNQUOTED(CMK_USE_STL_MSGQ, 0, [whether charm scheduler should use an STL-based msg q])
882 AC_DEFINE_UNQUOTED(CMK_MSG_PRIO_TYPE, $with_prio_type, [expected message priorities are arbitrarily sized])
884 Echo "Invalid size ($with_prio_type) specified for message priorities. Can only accept char, short, int, long, float, double and bitvec"
888 # enable/disable randomized scheduler queue
889 AC_ARG_ENABLE([randomized-msgq],
890 [AS_HELP_STRING([--enable-randomized-msgq],
891 [enable a randomized msg queue (for debugging etc)])], ,
892 [enable_randomized_msgq=no])
894 if test "$enable_randomized_msgq" = "yes" -a "$with_prio_type" != "bitvec"
896 Echo "The charm message queue will be randomized (and will not respect priorities)"
897 AC_DEFINE_UNQUOTED(CMK_RANDOMIZED_MSGQ, 1, [enable the randomized msgq in the scheduler])
899 AC_DEFINE_UNQUOTED(CMK_RANDOMIZED_MSGQ, 0, [disable the randomized msgq in the scheduler])
900 if test "$enable_randomized_msgq" = "yes"
902 Echo 'A randomized message queue is only available when --with-prio-type != bitvec.'
903 Echo "Specify prio-type to be a data type long enough to hold the message priorities in your application"
904 Echo "for example: --with-prio-type=int (or short / long etc)."
909 AC_ARG_WITH([mempool-cutoff],
910 [AS_HELP_STRING([--with-mempool-cutoff=N],
911 [exponent of the maximum power of two to use for bin sizes in the mempool])],
912 [], [with_mempool_cutoff=26])
914 if test "$((6 < $with_mempool_cutoff && $with_mempool_cutoff < 32))" = '1'
916 Echo "Using mempool cutoff... 2^$with_mempool_cutoff"
917 AC_DEFINE_UNQUOTED(CMK_MEMPOOL_CUTOFFNUM, $((with_mempool_cutoff - 6)), [mempool cutoff])
919 Echo "Invalid number ($with_mempool_cutoff) specified for mempool cutoff. Valid range: 7 <= N <= 31"
923 #### Check if compiler if 64 bit ####
929 int x[[(int)(sizeof(void *) - 7)]]={0};
933 test_cxx "whether compiler generates code for 64-bit" "yes" "no" ""
934 AC_DEFINE_UNQUOTED(CMK_SIZET_64BIT, $strictpass, [whether size_t 64bit])
937 ### Check if compiler supports std::is_constructible<> ###
939 #include <type_traits>
947 return std::is_constructible<s, int>::value;
950 test_cxx "whether compiler supports std::is_constructible" "yes" "no" ""
951 AC_DEFINE_UNQUOTED(CMK_HAS_IS_CONSTRUCTIBLE, $strictpass, [whether compiler supports std::is_constructible])
953 ### Check if compiler supports std::alignment_of<> ###
955 #include <type_traits>
959 return std::alignment_of<int>::value;
962 test_cxx "whether compiler supports std::alignment_of" "yes" "no" ""
963 AC_DEFINE_UNQUOTED(CMK_HAS_ALIGNMENT_OF, $strictpass, [whether compiler supports std::alignment_of])
965 ### Check if compiler implements regex ###
970 #if __cplusplus >= 201103L && \
971 (!defined(__GLIBCXX__) || (__cplusplus >= 201402L) || \
972 (defined(_GLIBCXX_REGEX_DFS_QUANTIFIERS_LIMIT) || \
973 defined(_GLIBCXX_REGEX_STATE_LIMIT) || \
974 (defined(_GLIBCXX_RELEASE) && \
975 _GLIBCXX_RELEASE > 4)))
976 // compiler has regex support, continue
978 // force compilation to fail
979 static_assert(false, "compiler has no regex implementation");
983 test_cxx "whether compiler implements regex" "yes" "no" ""
984 AC_DEFINE_UNQUOTED(CMK_HAS_REGEX, $pass, [whether compiler implements regex])
986 #### test if has values.h ####
990 double d = MAXDOUBLE;
994 test_cxx "whether has values.h " "yes" "no" ""
995 AC_DEFINE_UNQUOTED(CMK_HAS_VALUES_H, $pass, [whether has values.h])
997 #### test if has stdint.h ####
1004 test_cxx "whether has stdint.h " "yes" "no" ""
1005 AC_DEFINE_UNQUOTED(CMK_HAS_STDINT_H, $pass, [whether has stdint.h])
1007 #### test if has malloc.h ####
1014 test_cxx "whether has malloc.h " "yes" "no" ""
1015 AC_DEFINE_UNQUOTED(CMK_HAS_MALLOC_H, $pass, [whether has malloc.h])
1017 #### test if has alloca.h ####
1021 double *s=(double *)alloca(sizeof(double));
1026 test_cxx "whether has alloca.h " "yes" "no" ""
1027 AC_DEFINE_UNQUOTED(CMK_HAS_ALLOCA_H, $pass, [whether has alloca.h])
1029 #### test if has regex.h ####
1034 regcomp(&re, ".*MOD.*", REG_EXTENDED|REG_NOSUB);
1038 test_cxx "whether has regex.h " "yes" "no" ""
1039 AC_DEFINE_UNQUOTED(CMK_HAS_REGEX_H, $pass, [whether has regex.h])
1041 #### Check long long ####
1044 long long foo(void) { return 17; }
1046 test_cxx "whether long long works" "yes" "no" ""
1047 AC_DEFINE_UNQUOTED(CMK_LONG_LONG_DEFINED, $pass, [whether long long works])
1049 #### Check __int64 ####
1052 __int64 foo(void) { return 17; }
1054 test_cxx "whether __int64 works" "yes" "no" ""
1055 AC_DEFINE_UNQUOTED([CMK___int64_DEFINED], $pass, [whether __int64 works])
1060 #### Check __int128 ####
1065 int x[[(int)(sizeof(__int128) - 15)]]={0};
1069 test_cxx "whether __int128 (128-bit integer) works" "yes" "no" ""
1070 AC_DEFINE_UNQUOTED([CMK___int128_DEFINED], $pass, [whether __int128 works])
1074 add_flag CMK_HAS_INT16=1
1077 #### Check __int128_t ####
1084 int x[[(int)(sizeof(__int128_t) - 15)]]={0};
1088 test_cxx "whether __int128_t (128-bit integer) works" "yes" "no" ""
1089 AC_DEFINE_UNQUOTED([CMK___int128_t_DEFINED], $pass, [whether __int128_t works])
1093 add_flag CMK_HAS_INT16=1
1096 #### Summarize *int128* ####
1098 AC_DEFINE_UNQUOTED([CMK_HAS_INT16], $CMK_HAS_INT16, [whether any 128-bit integer works])
1101 ### Check if we have C++11 <atomic> ###
1104 int main(int argc, char** argv) {
1108 test_cxx "whether C++ library has <atomic> " "yes" "no" ""
1109 AC_DEFINE_UNQUOTED(CMK_HAS_CXX11_ATOMIC, $pass, [whether C++ library has <atomic>])
1113 ### Check if we have pre-C++11 <cstdatomic> ###
1115 #include <cstdatomic>
1116 int main(int argc, char** argv) {
1120 test_cxx "whether C++ library has <cstdatomic> " "yes" "no" ""
1121 AC_DEFINE_UNQUOTED(CMK_HAS_CXX0X_CSTDATOMIC, $pass, [whether C++ library has <cstdatomic>])
1124 if test $pass -ne 1 -a "$CMK_COMPILER" != "bgxlc"
1126 echo "Charm++ requires C++11 atomic support"
1130 #### Check long double ####
1133 long double foo(void) { return 17.0; }
1135 test_cxx "whether long double works" "yes" "no" ""
1136 AC_DEFINE_UNQUOTED(CMK_LONG_DOUBLE_DEFINED, $strictpass, [whether long double works])
1138 #### Check ucontext and FPU pointer ####
1140 #include <ucontext.h>
1141 struct _libc_fpstate fpstate;
1144 test_cxx "whether ucontext has FPU pointer" "yes" "no" ""
1145 AC_DEFINE_UNQUOTED(CMK_CONTEXT_FPU_POINTER, $pass, [whether ucontext has pointer])
1150 #include <ucontext.h>
1155 context.uc_mcontext.uc_regs = 0;
1158 test_cxx "whether ucontext uses uc_regs" "yes" "no" ""
1159 AC_DEFINE_UNQUOTED(CMK_CONTEXT_FPU_POINTER_UCREGS, $pass, [whether ucontext uses uc_regs union])
1163 #include <ucontext.h>
1169 vrregset_t *ptr = uc.uc_mcontext.v_regs;
1172 test_cxx "whether ucontext has pointer (v_regs) of vector type" "yes" "no" ""
1173 AC_DEFINE_UNQUOTED(CMK_CONTEXT_V_REGS, $pass, [whether ucontext has pointer (v_regs) of vector type])
1175 #### Check ucontext and FPU pointer ####
1177 #include <infiniband/verbs.h>
1180 struct ibv_context *context;
1182 struct ibv_port_attr attr;
1183 if (ibv_query_port(context, ibPort, &attr) != 0) return;
1184 if (attr.link_layer == IBV_LINK_LAYER_INFINIBAND) return;
1187 test_cxx "whether ibverbs ibv_port_attr has link_layer field" "yes" "no" ""
1188 AC_DEFINE_UNQUOTED(CMK_IBV_PORT_ATTR_HAS_LINK_LAYER, $pass, [whether ibv_port_attr has link_layer field])
1191 ###################### C++ Compiler Features #####################
1193 #### check C inline ####
1195 inline static int foo()
1200 test_cc "whether inline works in C" "yes" "no" ""
1201 AC_DEFINE_UNQUOTED(CMK_C_INLINE, $strictpass, [whether C inline works in C])
1203 #### check if signed char is same as char ####
1208 void operator()(char &v,const char *desc=NULL) {};
1209 void operator()(signed char &v,const char *desc=NULL) {};
1212 test_cxx "whether C++ signed char and char differ" "yes" "no" ""
1213 AC_DEFINE_UNQUOTED(CMK_SIGNEDCHAR_DIFF_CHAR, $pass, [whether C++ signed char and char differ])
1215 #### check if typeinfo exists and works #####
1218 const char *foo(void) {
1220 return typeid(x).name();
1223 test_cxx "whether typeinfo/typeid works" "ok" "no" ""
1224 AC_DEFINE_UNQUOTED(CMK_HAS_TYPEINFO, $pass, [whether typeinfo/typeid works])
1226 #### check if iterator_traits is defined #####
1230 template <typename T> // T models Input Iterator
1231 typename std::iterator_traits<T>::value_type accumulate(T first, T last)
1233 typename std::iterator_traits<T>::value_type result = 0;
1234 while(first != last)
1239 test_cxx "whether std::iterator_traits is defined" "ok" "no" ""
1240 AC_DEFINE_UNQUOTED(CMK_HAS_ITERATOR_TRAITS, $pass, [whether iterator_traits works])
1242 #### check if std::distance is defined #####
1249 std::vector<int> tree;
1250 return std::distance(tree.begin(), tree.end());
1253 test_cxx "whether std::distance is defined" "ok" "no" ""
1254 AC_DEFINE_UNQUOTED(CMK_HAS_STD_DISTANCE, $pass, [whether std::distance works])
1256 #### check if std::inserter is defined #####
1263 using namespace std;
1265 inserter ( L, L.end ( ) ) = 500;
1268 test_cxx "whether std::inserter is defined" "ok" "no" ""
1269 AC_DEFINE_UNQUOTED(CMK_HAS_STD_INSERTER, $pass, [whether std::inserter works])
1271 #### check if C++17's std::void_t is defined #####
1273 #include <type_traits>
1275 template<typename T, typename = std::void_t<>>
1276 struct has_pup_member : std::false_type {};
1279 test_cxx "whether std::void_t is defined" "ok" "no" ""
1280 AC_DEFINE_UNQUOTED(CMK_HAS_STD_VOID_T, $pass, [whether std::void_t works])
1282 ####### Check support for features added by the new C11 and CPP11 standards ########
1284 #### test if we can have multiple delete like this ####
1288 void operator delete(void*p){};
1289 void operator delete(void*p,int*){};
1292 test_cxx "whether operator delete can be overloaded in same class" "ok" "no" ""
1293 AC_DEFINE_UNQUOTED(CMK_MULTIPLE_DELETE, $strictpass, [whether operator delete can be overloaded in same class])
1295 #### test if offsetof exists ####
1307 int off = offsetof(FooType, f2);
1310 test_cxx "whether offsetof is defined" "yes" "no" ""
1311 AC_DEFINE_UNQUOTED(CMK_HAS_OFFSETOF, $pass, [whether offsetof exists])
1313 #### test if we can use gcc x86 assembly like this ####
1317 unsigned long long int v=0;
1318 int *lo=0+(int *)&v;
1319 int *hi=1+(int *)&v;
1320 __asm__ __volatile__(
1321 "rdtsc; movl %%edx,%0; movl %%eax,%1"
1322 : /* output */ "=m" (*hi), "=m" (*lo)
1324 : /* trashes */ "%edx", "%eax"
1329 test_cxx "whether GCC x86 assembly works" "yes" "no" ""
1330 AC_DEFINE_UNQUOTED(CMK_GCC_X86_ASM, $strictpass, [Allows gcc x86 assembly.])
1332 #### test if we can use gcc x86 assembly like this ####
1333 if test $strictpass = 1
1339 asm("lock incl %0" :: "m" (x));
1340 asm("lock decl %0" :: "m" (x));
1344 test_cxx "whether GCC x86 assembly for atomic increment works" "yes" "no" ""
1345 AC_DEFINE_UNQUOTED(CMK_GCC_X86_ASM_ATOMICINCREMENT, $strictpass, [Allows gcc x86 assembly for atomic increment.])
1348 #### test if we can use asm eieio assembly like this ####
1352 unsigned long long int x;
1353 asm volatile("eieio" ::: "memory");
1357 test_cxx "whether asm eieio assembly works" "yes" "no" ""
1358 AC_DEFINE_UNQUOTED(CMK_PPC_ASM, $strictpass, [Allows asm eieio assembly.])
1362 #### test if we can use __thread ####
1364 __thread unsigned long long int x;
1365 static __thread int y;
1372 test_cxx "whether __thread (Thread Local Storage) is supported" "yes" "no" ""
1373 AC_DEFINE_UNQUOTED(CMK_HAS_TLS_VARIABLES, $strictpass, [Allows __thread.])
1375 #### check __sync_add_and_fetch ####
1381 __sync_add_and_fetch(&t, 1);
1385 test_linkc "whether synchronization primitives (__sync_add_and_fetch) works in C" "yes" "no" ""
1386 AC_DEFINE_UNQUOTED(CMK_C_SYNC_ADD_AND_FETCH_PRIMITIVE, $pass, [whether sync_add_and_fetch primitive works in C])
1388 #### check __sync_synchronize ####
1393 __sync_synchronize();
1397 test_linkc "whether synchronization primitives (__sync_synchronize) works in C" "yes" "no" ""
1399 AC_DEFINE_UNQUOTED(CMK_C_SYNC_SYNCHRONIZE_PRIMITIVE, $pass, [whether sync_synchronize primitives works in C])
1402 ### test for __executable_start ###
1405 extern int __executable_start;
1408 return __executable_start;
1411 test_linkc "whether has __executable_start" "yes" "no" ""
1412 AC_DEFINE_UNQUOTED([CMK_HAS_EXECUTABLE_START], $pass, [whether has __executable_start])
1414 ### test if switching TLS register ###
1415 if test $in64bit = 1
1424 asm volatile ("movq %%fs:0x0, %0\n\t"
1425 "movq %1, %%fs:0x0\n\t"
1430 test_cxx "whether switching TLS register (64-bit) is supported" "yes" "no" ""
1431 AC_DEFINE_UNQUOTED(CMK_TLS_SWITCHING64, $strictpass, [Allows switching TLS 64-bit.])
1440 asm volatile ("movl %%gs:0x0, %0\n\t"
1441 "movl %1, %%gs:0x0\n\t"
1446 test_cxx "whether switching TLS register (32-bit) is supported" "yes" "no" ""
1447 AC_DEFINE_UNQUOTED(CMK_TLS_SWITCHING32, $strictpass, [Allows switching TLS in 32-bit.])
1450 ### test for dl_iterate_phdr ###
1454 # define _GNU_SOURCE
1461 static int callback(struct dl_phdr_info* info, size_t size, void* data)
1467 dl_iterate_phdr(callback, NULL);
1471 test_linkc "whether has dl_iterate_phdr" "yes" "no" ""
1472 AC_DEFINE_UNQUOTED([CMK_HAS_DL_ITERATE_PHDR], $pass, [whether has dl_iterate_phdr])
1475 ### test for __malloc_hook ###
1478 extern int __malloc_hook;
1481 return __malloc_hook;
1484 test_linkc "whether has __malloc_hook" "yes" "no" ""
1485 AC_DEFINE_UNQUOTED([CMK_HAS_MALLOC_HOOK], $pass, [whether has __malloc_hook])
1486 add_make_flag "CMK_HAS_MALLOC_HOOK:=$pass" 'whether has __malloc_hook'
1489 #### test if we can build OFI ####
1490 if test "$CMK_BUILD_OFI" = 1
1493 #include <rdma/fabric.h>
1494 int main(int argc, char **argv)
1496 struct fi_info *providers;
1497 int ret = fi_getinfo(FI_VERSION(1,0), NULL, NULL, 0ULL, NULL, &providers);
1501 test_cc "whether build on OFI" "yes" "no" "-lfabric"
1502 AC_DEFINE_UNQUOTED(CMK_BUILD_ON_OFI, $strictpass, [build OFI.])
1503 BUILD_OFI=$strictpass
1505 if test $BUILD_OFI -eq 0
1507 echo "Error: Unable to compile OFI"
1510 test_linkc "whether -lfabric" "ok" "no" "-lfabric"
1513 #test for psm incompatibility
1514 PSM_COMPAT_DIR=/usr/lib64/psm2-compat
1515 if test -d $PSM_COMPAT_DIR
1517 add_flag CMK_LIBDIR='"$CMK_LIBDIR -Wl,-rpath=/usr/lib64/psm2-compat"' "psm2-compat lib"
1518 CMK_LIBDIR="$CMK_LIBDIR -Wl,-rpath=/usr/lib64/psm2-compat"
1519 test_linkc "whether -lfabric after adding psm2-compatible library" "ok" "no" "-lfabric"
1522 echo "Error: -lfabric not found or not working. Pass '--basedir=/path/to/dir/' if -lfabric is located in a different directory"
1526 echo "Error: -lfabric not working, $PSM_COMPAT_DIR not found"
1527 echo "Pass '--basedir=/path/to/dir/' if -lfabric is located in a different directory"
1535 #### test if we can build MPI ####
1536 if test "$CMK_BUILD_MPI" = 1
1541 int main(int argc, char **argv)
1543 MPI_Init(&argc, &argv);
1547 mv -f ../include/mpi.h ../include/mpi.h.bak 2>/dev/null
1548 test_cc "whether build on MPI" "yes" "no" ""
1549 AC_DEFINE_UNQUOTED(CMK_BUILD_ON_MPI, $strictpass, [build MPI.])
1550 BUILD_MPI=$strictpass
1552 if test $BUILD_MPI -eq 0
1554 echo "Error: Cannot compile an MPI program"
1558 if test $BUILD_MPI -eq 1
1560 test_linkc "whether need to specify MPI library" "no" "yes" ""
1563 if test -z "$CMK_MPI_LIB"
1565 test_linkc "whether -lmpich" "ok" "no" "-lmpich"
1568 add_flag CMK_SYSLIBS='"$CMK_SYSLIBS -lmpich"' "mpi lib"
1570 test_linkc "whether -lmpi" "ok" "no" "-lmpi"
1573 add_flag CMK_SYSLIBS='"$CMK_SYSLIBS -lmpi"' "mpi lib"
1575 echo "Error: Cannot find MPI library"
1580 add_flag CMK_SYSLIBS='"$CMK_SYSLIBS $CMK_MPI_LIB"' "mpi lib"
1585 if test "$BUILD_MPI" = "1"
1589 int main(int argc, char **argv)
1591 int thread_level, provided;
1592 thread_level = MPI_THREAD_FUNNELED;
1593 MPI_Init_thread(&argc, &argv, thread_level, &provided);
1596 test_cxx "whether MPI_Init_thread is supported" "yes" "no" ""
1597 AC_DEFINE_UNQUOTED(CMK_MPI_INIT_THREAD, $strictpass, [Allows MPI_Init_thread.])
1599 mv -f ../include/mpi.h.bak ../include/mpi.h 2>/dev/null
1603 if test "$BUILD_MPI" = "1"
1610 int main (int argc, char** argv) {
1614 test_cxx "whether macro conflicts occurs due to C++ MPI bindings" "no" "yes" ""
1615 AC_DEFINE_UNQUOTED(CMK_CXX_MPI_BINDINGS, $strictpass, [Disables conflicting macros.])
1619 ################### Syscalls and Libraries ###################
1621 #### test for getrusage with RUSAGE_THREAD ###
1624 # define _GNU_SOURCE
1629 #include <sys/time.h>
1630 #include <sys/resource.h>
1632 struct rusage usage;
1633 getrusage(RUSAGE_THREAD, &usage);
1637 test_linkc "whether getrusage accepts RUSAGE_THREAD" "yes" "no" ""
1638 AC_DEFINE_UNQUOTED(CMK_HAS_RUSAGE_THREAD, $pass, [whether getrusage accepts RUSAGE_THREAD])
1640 #### test for asctime ###
1648 local = localtime(&t);
1653 test_linkc "whether has asctime" "yes" "no" ""
1654 AC_DEFINE_UNQUOTED(CMK_HAS_ASCTIME, $pass, [whether has asctime])
1656 #### test for log2 ###
1664 test_link "whether has log2" "yes" "no" ""
1665 AC_DEFINE_UNQUOTED(CMK_HAS_LOG2, $pass, [whether has log2])
1667 #### test for sqrtf ###
1671 float i = sqrtf((float)10.0);
1675 test_link "whether has sqrtf" "yes" "no" ""
1676 AC_DEFINE_UNQUOTED(CMK_HAS_SQRTF, $pass, [whether has sqrtf])
1678 #### test for fabsf ###
1682 float i = fabsf((float)10.0);
1686 test_link "whether has fabsf" "yes" "no" ""
1687 AC_DEFINE_UNQUOTED(CMK_HAS_FABSF, $pass, [whether has fabsf])
1689 #### test for mkstemp ###
1695 strcpy(fname, "/tmp/fdXXX.XXX");
1700 test_link "whether has mkstemp" "yes" "no" ""
1701 AC_DEFINE_UNQUOTED(CMK_USE_MKSTEMP, $pass, [whether has mkstemp])
1703 #### test for system ###
1711 test_link "whether has system" "yes" "no" ""
1712 AC_DEFINE_UNQUOTED(CMK_HAS_SYSTEM, $pass, [whether has system])
1714 #### test for sync() ###
1722 test_link "whether has sync()" "yes" "no" ""
1723 AC_DEFINE_UNQUOTED(CMK_HAS_SYNC_FUNC, $pass, [whether has sync])
1725 #### test for fsync() ###
1733 test_link "whether has fsync()" "yes" "no" ""
1734 AC_DEFINE_UNQUOTED(CMK_HAS_FSYNC_FUNC, $pass, [whether has fsync])
1736 #### test for fdatasync() ###
1744 test_link "whether has fdatasync()" "yes" "no" ""
1745 AC_DEFINE_UNQUOTED(CMK_HAS_FDATASYNC_FUNC, $pass, [whether has fdatasync])
1747 #### test for sbrk ###
1751 void *ptr = sbrk(0);
1754 test_link "whether has sbrk" "yes" "no" ""
1755 AC_DEFINE_UNQUOTED(CMK_HAS_SBRK, $pass, [whether has sbrk])
1757 #### test for _setjmp/_longjmp ###
1766 test_link "whether has _setjmp/_longjmp" "yes" "no" ""
1767 AC_DEFINE_UNQUOTED(CMK_HAS_UNDERSCORE_SETJMP, $pass, [whether has _setjmp/_longjmp])
1769 #### test for mstats ###
1773 struct mstats ms = mstats();
1776 test_link "whether has mstats" "yes" "no" ""
1777 AC_DEFINE_UNQUOTED(CMK_HAS_MSTATS, $pass, [whether has mstats])
1779 #### test for mallinfo ###
1783 struct mallinfo mi = mallinfo();
1786 test_link "whether has mallinfo" "yes" "no" ""
1787 AC_DEFINE_UNQUOTED(CMK_HAS_MALLINFO, $pass, [whether has mallinfo])
1789 #### test for __morecore ###
1793 extern void *(*__morecore)(ptrdiff_t);
1798 test_link "whether expects __morecore symbol" "yes" "no" ""
1799 AC_DEFINE_UNQUOTED(CMK_EXPECTS_MORECORE, $pass, [whether expects __morecore symbol])
1801 #### test for popen ###
1805 FILE *p = popen("/bin/ps", "r");
1809 test_link "whether has popen" "yes" "no" ""
1810 AC_DEFINE_UNQUOTED(CMK_HAS_POPEN, $pass, [whether has popen])
1812 #### test for poll ###
1816 struct pollfd pos[[3]];
1820 test_cxx "whether has poll" "yes" "no" ""
1821 AC_DEFINE_UNQUOTED(CMK_USE_POLL, $pass, [whether the poll syscall exists])
1823 #### check if getpagesize exists ####
1827 int main(int argc, char **argv) {
1828 int s = getpagesize();
1831 test_linkc "whether has getpagesize" "yes" "no" ""
1832 AC_DEFINE_UNQUOTED(CMK_HAS_GETPAGESIZE, $pass, [whether getpagesize exists])
1834 #### check if getpid exists ####
1836 #include <sys/types.h>
1839 int main(int argc, char **argv) {
1840 pid_t pid = getpid();
1843 test_linkc "whether has getpid" "yes" "no" ""
1844 AC_DEFINE_UNQUOTED(CMK_HAS_GETPID, $pass, [whether getpid exists])
1846 #### check if kill exists ####
1848 #include <sys/types.h>
1852 int main(int argc, char**argv)
1854 pid_t pid = getpid();
1858 test_linkc "whether has kill" "yes" "no" ""
1859 AC_DEFINE_UNQUOTED(CMK_HAS_KILL, $pass, [whether kill exists])
1861 #### test for setpriority ###
1863 #include <sys/time.h>
1864 #include <sys/resource.h>
1866 setpriority(PRIO_PROCESS, 0, 0);
1869 test_cxx "whether has setpriority" "yes" "no" ""
1870 AC_DEFINE_UNQUOTED(CMK_HAS_SETPRIORITY, $pass, [whether the setpriority exists])
1872 #### test for system ###
1874 #include "ckdll_system.C"
1876 test_cxx "whether to use signal-safe system() " "yes" "no" ""
1877 AC_DEFINE_UNQUOTED(CMK_SIGSAFE_SYSTEM, $pass, [whether to use signal-safe system()])
1879 ### test sched_setaffinity ####
1888 CPU_SET(0, &cpuset);
1889 if (sched_setaffinity(0, sizeof(cpuset), &cpuset) < 0) {
1895 test_linkc "whether sched_setaffinity call exists" "yes" "no" ""
1896 AC_DEFINE_UNQUOTED(CMK_HAS_SETAFFINITY, $pass, [whether the sched_setaffinity() exists])
1898 ### test pthread_setaffinity_np ####
1903 #include <pthread.h>
1907 unsigned long mask = 0xffffffff;
1908 unsigned int len = sizeof(mask);
1910 if (pthread_setaffinity_np(pthread_self(), len, &mask) < 0) {
1916 test_linkc "whether pthread_setaffinity_np call exists" "yes" "no" "-lpthread"
1917 AC_DEFINE_UNQUOTED(CMK_HAS_PTHREAD_SETAFFINITY, $pass, [whether the pthread_setaffinity_np() exists])
1919 ### test pthread_spin_lock ####
1924 #include <pthread.h>
1928 pthread_spinlock_t lock;
1930 pthread_spin_init(&lock, 0);
1932 pthread_spin_lock(&lock);
1937 test_linkc "whether pthread_spin_lock exists" "yes" "no" "-lpthread"
1938 AC_DEFINE_UNQUOTED(CMK_HAS_SPINLOCK, $pass, [whether the pthread_spin_lock exists])
1940 ### check libnuma on Linux ####
1941 if test "$WITH_NUMA" = "yes"
1946 #include <linux/mempolicy.h>
1952 if (get_mempolicy(NULL, NULL, 0, 0, 0) == 0) return 0;
1956 test_linkc "whether libnuma exists" "yes" "no" "-lnuma"
1957 AC_DEFINE_UNQUOTED(CMK_HAS_NUMACTRL, $pass, [whether NUMA control related functions exist])
1960 add_flag 'CMK_SYSLIBS="$CMK_SYSLIBS -lnuma"' "libnuma"
1964 #### check bindprocessors on AIX ####
1970 #include <sys/processor.h>
1977 if (bindprocessor(BINDPROCESS, pid, 0) == -1) return -1;
1981 test_linkc "whether bindprocessor call exists" "yes" "no" ""
1982 AC_DEFINE_UNQUOTED(CMK_HAS_BINDPROCESSOR, $pass, [whether the bindprocessor()
1986 #### check if dlopen works ####
1988 # for bproc, ignore -ldl
1989 test -n "$CMK_BPROC" && skip_dl=1
1990 test -n "$CMK_NO_DL" && skip_dl=1
1992 #workaround for pgcc 4.0, -ldl crash linking, so use -Wl,-ldl to skip the prelinker.
1994 pgCC*) dl_opt='-Wl,-ldl' ;;
1997 if test $skip_dl -eq 0
2001 #include "ckdll_dlopen.C"
2003 CkDll dll("foo.so");
2007 test_link "whether dlopen links without $dl_opt" "yes" "no" ""
2009 test_link "whether dlopen links with $dl_opt" "yes" "no" "$dl_opt"
2012 #dlopen requires -ldl: add it to our link line
2013 add_flag CMK_LIBS='"$CMK_LIBS '$dl_opt'"' "dlopen"
2016 if test $pass -eq 1 -o $noldl -eq 1
2018 # One version or another of dlopen worked: compile it in
2019 AC_DEFINE_UNQUOTED(CMK_DLL_USE_DLOPEN, 1, [dlopen])
2024 # define _GNU_SOURCE
2033 return dlsym(RTLD_DEFAULT, "main") != NULL;
2036 test_cc "whether has RTLD_DEFAULT" "yes" "no" ""
2037 AC_DEFINE_UNQUOTED(CMK_HAS_RTLD_DEFAULT, $pass, [whether has RTLD_DEFAULT])
2041 # define _GNU_SOURCE
2050 return dlsym(RTLD_NEXT, "main") != NULL;
2053 test_cc "whether has RTLD_NEXT" "yes" "no" ""
2054 AC_DEFINE_UNQUOTED(CMK_HAS_RTLD_NEXT, $pass, [whether has RTLD_NEXT])
2056 ### test gethostname ####
2059 #include <Winsock2.h>
2068 char hostname[[1000]];
2069 gethostname(hostname, 999);
2073 test_cc "whether gethostname call exists" "yes" "no" ""
2074 AC_DEFINE_UNQUOTED(CMK_HAS_GETHOSTNAME, $pass, [whether gethostname() exists])
2076 #### check if getProcAddress works ####
2078 #include "ckdll_win32.C"
2080 test_cxx "whether getProcAddress works" "yes" "no" ""
2081 AC_DEFINE_UNQUOTED(CMK_DLL_USE_WIN32, $pass, [whether getProcAddress works])
2085 #### check if socklen_t exists ####
2087 #include <sys/types.h>
2088 #include <sys/socket.h>
2092 socklen_t s=sizeof(i);
2095 test_cxx "whether has socklen_t" "yes" "no" ""
2096 AC_DEFINE_UNQUOTED(CMK_HAS_SOCKLEN, $pass, [whether has socklen_t])
2098 ### test getifaddrs ####
2100 #include <netinet/in.h> /* for sockaddr_in */
2101 #include <ifaddrs.h> /* for getifaddrs */
2102 #include <net/if.h> /* for IFF_RUNNING */
2106 struct ifaddrs *interfaces=0;
2107 if( getifaddrs(&interfaces) == 0 ) {
2108 struct ifaddrs *interface;
2109 for( interface=interfaces; interface; interface=interface->ifa_next ) {
2110 if( (interface->ifa_flags & IFF_UP) && ! (interface->ifa_flags & IFF_LOOPBACK) ) {
2111 const struct sockaddr_in *addr = (const struct sockaddr_in*)interface->ifa_addr;
2112 if( addr && addr->sin_family==AF_INET ) {
2117 freeifaddrs(interfaces);
2121 test_linkc "whether getifaddrs call exists" "yes" "no" ""
2122 AC_DEFINE_UNQUOTED(CMK_HAS_GETIFADDRS, $pass, [whether getifaddrs() exists])
2124 #### check if mmap exists ####
2126 #include <sys/types.h>
2127 #include <sys/mman.h>
2129 void *foo(void *a,int l,int fd) {
2130 return mmap((caddr_t)a,l,PROT_READ+PROT_WRITE,
2131 MAP_FIXED+MAP_PRIVATE,fd,0);
2134 test_cxx "whether the mmap() syscall exists" "yes" "no" ""
2135 AC_DEFINE_UNQUOTED(CMK_HAS_MMAP, $pass, [whether the mmap() syscall exists])
2136 add_flag "CMK_HAS_MMAP=$pass"
2137 add_make_flag "CMK_HAS_MMAP:=$pass"
2139 #### check if mmap accepts MAP_ANON ####
2141 #include <sys/types.h>
2142 #include <sys/mman.h>
2144 void *foo(void *a,int l) {
2145 return mmap((caddr_t)a,l,PROT_READ+PROT_WRITE,
2146 MAP_FIXED+MAP_PRIVATE+MAP_ANON,-1,0);
2149 test_cxx "whether mmap() accepts MAP_ANON" "yes" "no" ""
2150 AC_DEFINE_UNQUOTED(CMK_HAS_MMAP_ANON, $pass, [whether mmap() accepts MAP_ANON])
2152 #### check if mmap accepts MAP_NORESERVE ####
2154 #include <sys/types.h>
2155 #include <sys/mman.h>
2157 void *foo(void *a,int l) {
2158 return mmap((caddr_t)a,l,PROT_READ+PROT_WRITE,
2159 MAP_FIXED+MAP_PRIVATE+MAP_NORESERVE,-1,0);
2162 test_cxx "whether mmap() accepts MAP_NORESERVE" "yes" "no" ""
2163 AC_DEFINE_UNQUOTED(CMK_HAS_MMAP_NORESERVE, $pass, [whether mmap() accepts MAP_NORESERVE])
2165 #### check if get_myaddress exists ####
2167 #include <rpc/rpc.h>
2170 get_myaddress((struct sockaddr_in*)a);
2173 test_cxx "whether has get_myaddress" "yes" "no" ""
2174 AC_DEFINE_UNQUOTED(CMK_HAS_GET_MYADDRESS, $pass, [whether has get_myaddress])
2176 #### check if mprotect exists ####
2179 #include <sys/mman.h>
2181 void foo(void *a,int l,int fd) {
2183 size_t pagesize = 4096;
2184 mprotect(pg, pagesize, PROT_READ | PROT_WRITE);
2187 test_cxx "whether has mprotect" "yes" "no" ""
2188 AC_DEFINE_UNQUOTED(CMK_HAS_MPROTECT, $pass, [whether has mprotect])
2190 #### check if support for SHM through CMA exists ####
2193 #include <sys/uio.h>
2197 struct iovec *local, *remote;
2198 int nread = process_vm_readv(pid, local, 1, remote, 1, 0);
2199 nread = process_vm_writev(pid, local, 1, remote, 1, 0);
2203 test_link "whether has support for shm transport using Cross Memory Attach" "yes" "no" ""
2204 AC_DEFINE_UNQUOTED(CMK_HAS_CMA, $pass, [whether supports cma])
2206 #### check if -rdynamic works ####
2213 CAN_EXPORT_SYMBOLS='0'
2214 for i in '-rdynamic' '-Wl,--export-dynamic'; do
2215 test_link "whether has $i" "yes" "no" "$i"
2216 if test "$strictpass" = '1'; then
2217 TRACE_LINK_FLAG="$i"
2218 CAN_EXPORT_SYMBOLS='1'
2223 if test "$CAN_EXPORT_SYMBOLS" = '1'; then
2224 add_flag 'CMK_LD="$CMK_LD '$TRACE_LINK_FLAG'"' "exporting program symbols to shared objects"
2225 add_flag 'CMK_LDXX="$CMK_LDXX '$TRACE_LINK_FLAG'"' "exporting program symbols to shared objects"
2228 #### check if glibc backtrace exists ####
2230 #include "cmibacktrace.c"
2235 CmiBacktraceRecord(&stack,0,&nLevels);
2239 test_link "whether glibc backtrace works" "yes" "no" "-DCMK_USE_BACKTRACE=1 $TRACE_LINK_FLAG"
2240 AC_DEFINE_UNQUOTED(CMK_USE_BACKTRACE, $pass, [whether glibc backtrace works])
2242 #### test sleep ####
2250 test_cxx "whether has sleep " "yes" "no" ""
2251 AC_DEFINE_UNQUOTED(CMK_HAS_SLEEP, $pass, [whether has sleep])
2253 #### test usleep ####
2261 test_cxx "whether has usleep " "yes" "no" ""
2262 AC_DEFINE_UNQUOTED(CMK_HAS_USLEEP, $pass, [whether has usleep])
2264 #### test personality() and ADDR_NO_RANDOMIZE ####
2265 # Only works on modern Linux systems
2267 #include <sys/personality.h>
2269 int orig_persona = personality(0xffffffff);
2270 personality(orig_persona | ADDR_NO_RANDOMIZE);
2274 test_cxx "whether personality() and ADDR_NO_RANDOMIZE exist" "yes" "no" ""
2275 AC_DEFINE_UNQUOTED(CMK_HAS_ADDR_NO_RANDOMIZE, $pass, [whether personality() and ADDR_NO_RANDOMIZE exist])
2278 # enable/disable zlib
2279 AC_ARG_ENABLE([zlib],
2280 [AS_HELP_STRING([--enable-zlib],
2281 [enable zlib support])],
2282 [enable_zlib=$enableval],
2285 #### test if has zlib ####
2286 # bproc doesnot like -lz in any case
2287 if test -z "$CMK_BPROC" && test "$enable_zlib" = "yes"
2293 gzFile f = gzopen("/tmp/x","r");
2294 gzprintf(f, "test...\n");
2299 test_link "whether has zlib" "yes" "no" "-lz"
2300 AC_DEFINE_UNQUOTED(CMK_USE_ZLIB, $pass, [whether has zlib])
2303 add_flag 'CMK_SYSLIBS="$CMK_SYSLIBS -lz"' "zlib"
2308 #### test if has elf.h ####
2311 typedef Elf32_Addr ELF_TYPE_Addr;
2315 test_cxx "whether has elf.h " "yes" "no" ""
2316 AC_DEFINE_UNQUOTED([CMK_HAS_ELF_H], $pass, [whether has elf.h])
2319 add_flag "CMK_HAS_ELF_H='1'" "elf.h"
2322 #### test if has Multiprocessing.h for apple ####
2324 #include <Carbon/Carbon.h>
2325 #include <Multiprocessing.h>
2327 int a = MPProcessorsScheduled();
2330 test_cxx "whether has Multiprocessing.h for Apple " "yes" "no" ""
2331 AC_DEFINE_UNQUOTED([CMK_HAS_MULTIPROCESSING_H], $pass, [whether has Multiprocessing.h])
2333 #### test if "ntohl" is available ####
2335 #if defined(_WIN32) || defined(__MINGW_H)
2336 #include <winsock.h>
2339 #include <arpa/inet.h>
2340 #include <netinet/in.h>
2349 test_cc "whether ntohl is available" "yes" "no" ""
2350 AC_DEFINE_UNQUOTED(CMK_HAS_NTOHL, $pass, [whether ntohl is available])
2352 ### test for libjpeg ####
2356 #include "jpeglib.h"
2360 struct jpeg_compress_struct cinfo;
2361 jpeg_create_compress(&cinfo);
2365 test_link "whether has libjpeg" "yes" "no" "-ljpeg"
2366 AC_DEFINE_UNQUOTED(CMK_USE_LIBJPEG, $pass, [whether has libjpeg])
2369 add_flag 'CMK_LIBJPEG="-ljpeg"' "libjpeg"
2370 add_make_flag 'CMK_LIBJPEG:=-ljpeg' 'libjpeg'
2373 #### check if PAPI exists ####
2374 if test -n "$CMK_USE_PAPI"
2381 if (PAPI_library_init(PAPI_VER_CURRENT) != PAPI_VER_CURRENT) return 1;
2385 test_link "whether PAPI exists" "yes" "no" "-lpapi"
2386 AC_DEFINE_UNQUOTED(CMK_HAS_COUNTER_PAPI, $pass, [whether PAPI exists])
2387 if test "$enable_tracing" = "no"
2389 echo "Error: Cannot build papi version when tracing is disabled, build with --enable-tracing"
2391 elif test $fail -eq 1
2393 echo "Error: Cannot find papi library"
2396 add_flag 'CMK_LIBS="$CMK_LIBS -lpapi"' "papi"
2400 #### test if Python headers are installed ####
2401 PYTHON_VERSION=`python -V 2>&1 | awk {'print $2'} | awk -F. {'print $1"."$2'}`
2403 #include "python${PYTHON_VERSION}/Python.h"
2404 #include "python${PYTHON_VERSION}/compile.h"
2405 #include "python${PYTHON_VERSION}/eval.h"
2406 #include "python${PYTHON_VERSION}/node.h"
2410 PyEval_InitThreads();
2411 struct _node* programNode = PyParser_SimpleParseString("return 1\n",Py_file_input);
2412 PyCodeObject *program = PyNode_Compile(programNode, "");
2415 test_link "whether Python is installed" "yes" "no" "-lpython$PYTHON_VERSION -lpthread -lutil -ldl"
2416 AC_DEFINE_UNQUOTED(CMK_HAS_PYTHON, $pass, [whether Python is installed])
2417 AC_DEFINE_UNQUOTED(CMK_PYTHON_VERSION, ${PYTHON_VERSION}, [Python version])
2420 add_flag "CMK_BUILD_PYTHON=$PYTHON_VERSION" "python"
2421 add_make_flag "CMK_BUILD_PYTHON:=$PYTHON_VERSION" 'python'
2424 ## Cray specific test
2425 if test "$CMK_BUILD_CRAY" = "1"
2427 #echo "Test for known incompatible compiler versions"
2429 if test "$CRAY_CC_VERSION" = "8.1.4"
2431 echo "CCE 8.1.4 produces incorrect Charm++ code"
2432 echo "Please use a newer version of the CCE compiler"
2433 echo "e.g. module load cce/8.1.7"
2437 #### test if Cray node topology will work ####
2443 PMI_Get_nid(0, &nid);
2448 test_linkc "whether PMI_Get_nid exists" "yes" "no" "$CMK_CRAY_LIBS"
2449 AC_DEFINE_UNQUOTED(CMK_HAS_PMI_GET_NID, $pass, [whether PMI_Get_nid exists])
2451 #### test if Cray mesh topology will work ####
2453 #include <rca_lib.h>
2456 rca_mesh_coord_t xyz;
2457 rca_get_meshcoord(0, &xyz);
2462 test_linkc "whether Cray rca library is available" "yes" "no" "$CRAY_RCA_POST_LINK_OPTS -lrca"
2463 AC_DEFINE_UNQUOTED(CMK_HAS_RCALIB, $pass, [whether Cray rca library is available])
2465 #### test if Cray mesh dimension query function will work ####
2467 #include <rca_lib.h>
2470 rca_mesh_coord_t xyz;
2471 rca_get_max_dimension(&xyz);
2476 test_linkc "whether Cray rca_has get_max_dimension" "yes" "no" "$CRAY_RCA_POST_LINK_OPTS -lrca"
2477 AC_DEFINE_UNQUOTED(CMK_HAS_RCA_MAX_DIMENSION, $pass, [whether Cray rca has rca_get_max_dimension])
2479 #### query Cray machine max NID if get_max_dimension not exist ####
2483 cmd=`which xtprocadmin 2>/dev/null`
2486 #maxnid=`xtprocadmin | tail -1 | awk '{print $1}'`
2487 # workaround for hopper
2488 (export SHELL=/bin/csh; xtprocadmin >& t.$$)
2489 maxnid=`cat t.$$ | tail -1 | awk '{print $1}'`
2491 AC_MSG_CHECKING(Cray machine maxnid)
2492 AC_MSG_RESULT("$maxnid")
2493 if test -n "$maxnid"
2495 AC_DEFINE_UNQUOTED(CMK_CRAY_MAXNID, $maxnid, [Cray MAXNID])
2503 #### query Cray machine supports BANDWIDTH_INJECTION controls####
2505 if test "$CMK_BUILD_MPI" = "1"
2507 echo "BALANCED_INJECTION test disabled on MPI"
2508 elif test "$GNI_CRAYXC" = "1"
2510 echo "BALANCED_INJECTION test disabled on Aries network"
2514 #include <gni_pub.h>
2517 gni_bi_desc_t gni_bi_desc;
2518 uint32_t gni_device_id = 0;
2519 gni_return_t gni_rc = GNI_GetBIConfig(gni_device_id, &gni_bi_desc);
2520 if (gni_rc == GNI_RC_SUCCESS) {
2525 test_linkc "whether GNI_GetBIConfig exists" "yes" "no" "$CMK_CRAY_LIBS"
2526 AC_DEFINE_UNQUOTED(CMK_BALANCED_INJECTION_API, $pass, [whether Cray gni_pub has GNI_GetBIConfig])
2527 fi # end of BIConfig test
2530 fi # end of Cray specific test
2532 #### test if it can build shared library ####
2537 void * t= malloc(2);
2542 test_linkso "whether can build shared library" "yes" "no" ""
2545 add_flag 'CMK_NO_BUILD_SHARED="true"' "build-shared"
2546 add_make_flag 'CMK_NO_BUILD_SHARED:=true' 'build-shared'
2549 if test "$BUILD_MPI" = "1"
2555 int foo(int argc, char ** argv) {
2556 void * t= malloc(2);
2558 MPI_Init(&argc, &argv);
2562 test_linkso "whether can build shared library with MPI" "yes" "no" ""
2565 if test $BUILD_SHARED -eq 0
2567 add_flag 'CMK_NO_BUILD_SHARED="true"' "build-shared"
2568 add_make_flag 'CMK_NO_BUILD_SHARED:=true' 'build-shared'
2572 #### test the version number of bproc ####
2573 if test -n "$CMK_BPROC"
2577 #include <sys/bproc.h>
2580 struct bproc_version_t vers;
2581 bproc_version(&vers);
2582 printf("%s\n", vers.version_string);
2585 test_link "whether bproc compiles" "yes" "no" "-lbproc"
2588 AC_MSG_CHECKING("bproc version")
2589 bproc_ver=`./testlink`
2590 if test x$bproc_ver = x
2592 test_result 0 "bproc version" "ERROR" ""
2595 test_result 0 "bproc version" "$bproc_ver" ""
2597 bproc_ver=`echo $bproc_ver | cut -d'.' -f1`
2598 AC_DEFINE_UNQUOTED(CMK_BPROC_VERSION, $bproc_ver, [bproc version])
2602 #### test the if command sync exists ####
2603 AC_CHECK_PROG(SYNC, sync, sync )
2606 AC_DEFINE_UNQUOTED(CMK_HAS_SYNC, 1, [sync program])
2609 ################## Fortran #########################
2611 #echo "set F77 compiler as: $CMK_CF77"
2612 AC_MSG_CHECKING("F77 compiler as")
2613 AC_MSG_RESULT("$CMK_CF77")
2615 AC_MSG_CHECKING("whether Fortran 77 compiler works")
2616 ### test fortran 77 compiler ###
2617 cat > conftest.f <<EOF
2621 $CMK_CF77 -c conftest.f > /dev/null 2> /dev/null
2622 if test ! -r conftest.o
2626 AC_MSG_RESULT("yes")
2629 ### test fortran 90 compiler ###
2630 #echo "set F90 compiler as: $CMK_CF90"
2631 AC_MSG_CHECKING("F90 compiler as")
2632 AC_MSG_RESULT("$CMK_CF90")
2634 AC_MSG_CHECKING("whether Fortran 90 compiler works")
2635 cat > conftest2.f90 <<EOF
2639 $CMK_CF90 -c conftest2.f90 > /dev/null 2> /dev/null
2640 if test ! -r conftest2.o
2644 AC_MSG_RESULT("yes")
2645 mv -f conftest2.o conftest.o
2649 ### check fortran name mangling
2650 AC_MSG_CHECKING(subroutine name used by Fortran 90 compiler)
2652 if test -r conftest.o
2654 AC_CACHE_VAL(_cv_fortran_postfix,
2656 NAME=`$CMK_NM conftest.o | grep "foo_foo__"`
2657 if test "$NAME" != ""
2659 _cv_fortran_postfix=TWOSCORE
2660 AC_DEFINE_UNQUOTED(CMK_FORTRAN_USES_TWOSCORE, 1, [TWOSCORE])
2662 NAME=`$CMK_NM conftest.o | grep "foo_foo_"`
2663 if test "$NAME" != ""
2665 _cv_fortran_postfix=ONESCORE
2666 AC_DEFINE_UNQUOTED(CMK_FORTRAN_USES_ONESCORE, 1, [ONESCORE])
2668 NAME=`$CMK_NM conftest.o | grep "foo_foo"`
2669 if test "$NAME" != ""
2671 _cv_fortran_postfix=NOSCORE
2672 AC_DEFINE_UNQUOTED(CMK_FORTRAN_USES_NOSCORE, 1, [NOSCORE])
2674 NAME=`$CMK_NM conftest.o | grep "FOO_FOO"`
2675 if test "$NAME" != ""
2677 _cv_fortran_postfix=ALLCAPS
2678 AC_DEFINE_UNQUOTED(CMK_FORTRAN_USES_ALLCAPS, 1, [ALLCAPS])
2680 echo "#################################################"
2681 echo "FORTRAN compiler generated name not supported yet"
2682 echo "#################################################"
2687 rm -f conftest.f conftest.o
2689 AC_MSG_RESULT($_cv_fortran_postfix)
2691 AC_MSG_RESULT("Fortran compiler not working")
2694 ### check module name ###
2696 if test "$USE_FORTRAN90" = 1
2698 cat > conftest.f90 <<EOF
2701 function fpup_issizing(p)
2703 logical fpup_issizing
2708 AC_MSG_CHECKING(Fortran 90 mod name is capital)
2709 $CMK_CF90 -c conftest.f90 > /dev/null 2> /dev/null
2710 name=`ls TESTMOD.* 2>/dev/null`
2713 AC_MSG_RESULT("yes")
2714 add_flag 'CMK_MOD_NAME_ALLCAPS=1' "mod name capital"
2717 name=`ls testmod.* 2>/dev/null`
2721 AC_MSG_CHECKING(Fortran 90 mod name extension)
2722 ext=`echo $name | sed -e 's/^[[^.]]*\.//'`
2723 add_flag 'CMK_MOD_EXT="'$ext'"' "mod name extension"
2724 AC_MSG_RESULT("$ext")
2727 /bin/rm -f conftest.f90
2730 ### test if the C++ linker succeeds with a Fortran entry point ##
2732 cat > conftest.f90 <<EOF
2736 test_link_fortran_main() {
2737 AC_MSG_CHECKING("$1")
2738 echo "### $1" >> $charmout
2739 cat conftest.f90 >> $charmout
2740 echo $CMK_CF90 -c conftest.f90 -o test.o $4 >> $charmout
2741 $CMK_CF90 -c conftest.f90 -o test.o $4 > out 2>&1
2744 test_result 1 "$1" "$2" "$3"
2746 echo $CMK_LDXX $CMK_LDXX_FLAGS $CMK_LINK_BINARY -o testlink test.o $CMK_LIBDIR $OPTS_LD $CMK_SYSLIBS $CMK_F90LIBS $CMK_F90MAINLIBS $4 $5 >> $charmout
2747 $CMK_LDXX $CMK_LDXX_FLAGS $CMK_LINK_BINARY -o testlink test.o $CMK_LIBDIR $OPTS_LD $CMK_SYSLIBS $CMK_F90LIBS $CMK_F90MAINLIBS $4 $5 >> out 2>&1
2749 test ! -x testlink && ret=1
2750 test_result $ret "$1" "$2" "$3"
2752 cat out >> $charmout
2754 test_link_fortran_main "whether the C++ linker succeeds with a Fortran entry point" "yes" "no" ""
2755 /bin/rm -f conftest.f90 test.o testlink out
2758 add_flag "CMK_CAN_LINK_FORTRAN='1'" "Fortran"
2761 ### check for OpenMP availability ###
2768 int iam = 0, np = 1;
2770 #pragma omp parallel default(shared) private(iam, np)
2772 np = omp_get_num_threads();
2773 iam = omp_get_thread_num();
2774 printf("Hello from thread %d of %d\n", iam, np);
2780 test_linkc "whether OpenMP is supported" "yes" "no" "$CMK_C_OPENMP"
2783 add_flag "CMK_HAS_OPENMP='1'" "OpenMP"
2786 ### check for Lustre FS availability ###
2789 #include <lustre/lustreapi.h>
2790 #include <lustre/lustre_user.h>
2793 llapi_printf(LLAPI_MSG_NORMAL, "Lustre FS is available");
2797 test_linkc "whether has lustre fs" "yes" "no" "-llustreapi"
2798 AC_DEFINE_UNQUOTED(CMK_HAS_LUSTREFS, $pass, [whether has lustrefs])
2801 add_make_flag 'CMK_LUSTREAPI:=-llustreapi' "lustreapi"
2803 add_make_flag 'CMK_LUSTREAPI:=' "lustreapi"
2808 eval "`./charmc -print-building-blocks $OPTS`"
2809 export CC="$(get_full_command_name "$CMK_SEQ_CC")"
2810 export CXX="$(get_full_command_name "$CMK_SEQ_CXX")"
2811 export CC_FOR_BUILD="$(get_full_command_name "$CMK_NATIVE_CC")"
2812 AC_SUBST(CC_FOR_BUILD)
2813 export HWLOC_FLAGS="$CHARM_CC_FLAGS"
2814 export CFLAGS="$CMK_SEQ_CC_FLAGS"
2815 export AR="$(get_full_command_name "${CMK_SEQ_AR%% *}")"
2816 export am_libhwloc_embedded_la_rpath="-rpath $CHARMLIBSO"
2817 AC_SUBST(am_libhwloc_embedded_la_rpath)
2818 enable_embedded_mode='yes'
2825 enable_visibility='no'
2828 export libhwloc_so_version
2829 AC_SUBST(libhwloc_so_version)
2831 echo "Configuring hwloc:"
2832 AC_CONFIG_AUX_DIR(hwloc/config)
2834 AC_USE_SYSTEM_EXTENSIONS
2837 AM_INIT_AUTOMAKE([no-define])
2839 AC_CONFIG_MACRO_DIR(hwloc/config)
2840 HWLOC_SET_SYMBOL_PREFIX([cmi_])
2841 HWLOC_SETUP_CORE([hwloc], [happy=yes], [happy=no])
2842 HWLOC_DO_AM_CONDITIONALS
2843 add_flag 'CMK_HWLOC_LIBS="-lhwloc_embedded '"$HWLOC_EMBEDDED_LIBS"'"' "hwloc"
2844 add_flag 'CMK_CC_FLAGS="$CMK_CC_FLAGS '"$HWLOC_EMBEDDED_CFLAGS"'"' 'hwloc'
2845 add_flag 'CMK_CXX_FLAGS="$CMK_CXX_FLAGS '"$HWLOC_EMBEDDED_CFLAGS"'"' 'hwloc'