Skip to content

Commit d199429

Browse files
authored
Merge pull request #11449 from jsquyres/pr/fix-romio431-mpl-configure-ac271-issues
3rd-party/romio/mpl/configure.ac: fix AC 2.71 and m4 quoting issues
2 parents bb40271 + 9bf920e commit d199429

File tree

1 file changed

+72
-68
lines changed

1 file changed

+72
-68
lines changed

3rd-party/romio341/mpl/configure.ac

Lines changed: 72 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -425,77 +425,81 @@ pac_cv_posix_clock_realtime=no)
425425
;;
426426

427427
linux86_cycle|linux86_cycle_2)
428-
429-
# The following AC_TRY_RUN statements are needed because x86_64 compilers
428+
429+
# OMPI: The following block was copy and pasted from
430+
# https://github.com/pmodels/mpich/blob/38552cfab7ac139754066e09f2a85e8b5a7d3df7/src/mpl/configure.ac#L451-L513
431+
# to wholly replace the same block set of tests that we there
432+
# previously. This fixed some Autoconf 2.71 portability issues and m4
433+
# quoting issues. See https://github.com/open-mpi/ompi/issues/11364
434+
# for details.
435+
436+
# The following AC_RUN_IFELSE statements are needed because x86_64 compilers
430437
# usually know about rdtscp but the cpu may or may not actually implement the
431438
# feature. This is not cross-compile safe, unfortunately. In the long run we
432439
# 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([
436-
int 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([[
445-
int 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([[[
454-
int 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([[[[
463-
int 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-
),
474-
dnl The if-cross-compiling clause from the first AC_TRY_RUN. Hope that if the
475-
dnl compiler knows about the instruction then it's supported by the target
476-
dnl 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-
)
440+
AC_CACHE_CHECK([that linux86 cycle counter is available], pac_cv_linux86_cycle, [
441+
AC_RUN_IFELSE([AC_LANG_SOURCE([[
442+
int main()
443+
{
444+
/* rdtscp */
445+
long long var, *var_ptr=&var;
446+
__asm__ __volatile__("rdtscp; shl \$32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx");
447+
return 0;
448+
}
449+
]])],pac_cv_linux86_cycle=rdtscp,[
450+
AC_RUN_IFELSE([AC_LANG_SOURCE([[
451+
int main()
452+
{
453+
/* cpuid 64 */
454+
long long var, *var_ptr=&var;
455+
__asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx");
456+
return 0;
457+
}
458+
]])],pac_cv_linux86_cycle=cpuid_rdtsc64,[
459+
AC_RUN_IFELSE([AC_LANG_SOURCE([[
460+
int main()
461+
{
462+
/* cpuid 32 */
463+
long long var, *var_ptr=&var;
464+
__asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*var_ptr) : : "ecx");
465+
return 0;
466+
}
467+
]])],pac_cv_linux86_cycle=cpuid_rdtsc32,[
468+
AC_RUN_IFELSE([AC_LANG_SOURCE([[
469+
int main()
470+
{
471+
/* simple */
472+
long long var, *var_ptr=&var;
473+
__asm__ __volatile__("rdtsc" : "=A" (*var_ptr));
474+
return 0;
475+
}
476+
]])],pac_cv_linux86_cycle=rdtsc,
477+
pac_cv_linux86_cycle=no)
478+
])])], dnl closing the last 3 AC_RUN_IFELSE
479+
[
480+
dnl The if-cross-compiling clause from the first AC_RUN_IFELSE. Hope that if the
481+
dnl compiler knows about the instruction then it's supported by the target
482+
dnl platform.
483+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[
484+
long long var, *var_ptr=&var;
485+
__asm__ __volatile__("rdtscp; shl \$32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx");
486+
]])],pac_cv_linux86_cycle=rdtscp,[
487+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[
488+
long long var, *var_ptr=&var;
489+
__asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx");
490+
]])],pac_cv_linux86_cycle=cpuid_rdtsc64,[
491+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[
492+
long long var, *var_ptr=&var;
493+
__asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*var_ptr) : : "ecx");
494+
]])],pac_cv_linux86_cycle=cpuid_rdtsc32,[
495+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[
496+
long long var, *var_ptr=&var;
497+
__asm__ __volatile__("rdtsc" : "=A" (*var_ptr));
498+
]])],pac_cv_linux86_cycle=rdtsc,
499+
pac_cv_linux86_cycle=no
500+
)])])]) dnl closing the 4 AC_COMPILE_IFELSE
501+
]) dnl end of first AC_RUN_IFELSE
502+
]) dnl end of AC_CACHE_CHECK
499503

500504
case "$pac_cv_linux86_cycle" in
501505
"rdtscp")

0 commit comments

Comments
 (0)