> On Tue, Jun 2, 2026, at 3:04 PM, Jose E. Marchesi wrote:
>> Hi Pietro.
>>
>>>  if test x$may_have_cet = xyes; then
>>>    if test x$cross_compiling = xno; then
>>> -    AC_TRY_RUN([
>>> +    AC_RUN_IFELSE([AC_LANG_SOURCE([[
>>>  int
>>>  main ()
>>>  {
>>>    asm ("endbr32");
>>>    return 0;
>>>  }
>>> -    ],
>>> +    ]])],
>>>      [have_multi_byte_nop=yes],
>>> -    [have_multi_byte_nop=no])
>>> +    [have_multi_byte_nop=no],
>>> +    [AC_MSG_FAILURE(cannot run test program while cross compiling)])
>>>      have_cet=no
>>>      if test x$have_multi_byte_nop = xyes; then
>>
>> According to the AU_DEFUN in autoconf 2.69:
>>
>>
>>   # AC_TRY_RUN(PROGRAM,
>>   #            [ACTION-IF-TRUE], [ACTION-IF-FALSE],
>>   #            [ACTION-IF-CROSS-COMPILING = RUNTIME-ERROR])
>>   # -------------------------------------------------------
>>   AU_DEFUN([AC_TRY_RUN],
>>   [AC_RUN_IFELSE([AC_LANG_SOURCE([[$1]])], [$2], [$3], [$4])])
>>
>> And AC_RUN_IFELSE provides a default $4 argument with:
>>
>>   [m4_default([$4],
>>         [AC_MSG_FAILURE([cannot run test program while cross
>>         compiling])])]
>>
>> See autoconf/lib/autoconf/general.m4.  Is it necessary to provide an
>> explicit argument here?
>
> It isn't necessary. As you noted, I'm using the same default as
> autoconf and there's no difference in the generated files wheter the
> argument is present. But autoconf prints a warning message when
> AC_RUN_IFELSE has no action-if-cross-compiling argument. And getting
> rid of the warnings is the main goal here.

Yeah I see...

  AC_DEFUN([AC_RUN_IFELSE],
  [AC_LANG_COMPILER_REQUIRE()dnl
  m4_ifval([$4], [],
         [m4_warn([cross],
                  [$0 called without default to allow cross compiling])])dnl
  AS_IF([test "$cross_compiling" = yes],
    [m4_default([$4],
           [AC_MSG_FAILURE([cannot run test program while cross compiling])])],
    [_AC_RUN_IFELSE($@)])
  ])

That's annoying.

Reply via email to