bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sr #110484] CFLAGS/CXXFLAGS and CPPFLAGS order in c.m4 ac_compile is no


From: anonymous
Subject: [sr #110484] CFLAGS/CXXFLAGS and CPPFLAGS order in c.m4 ac_compile is nonstandard
Date: Wed, 5 May 2021 11:10:44 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0

URL:
  <https://savannah.gnu.org/support/?110484>

                 Summary: CFLAGS/CXXFLAGS and CPPFLAGS order in c.m4
ac_compile is nonstandard
                 Project: Autoconf
            Submitted by: None
            Submitted on: Wed 05 May 2021 03:10:42 PM UTC
                Category: None
                Priority: 5 - Normal
                Severity: 4 - Important
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: dev@jpoiret.xyz
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: None

    _______________________________________________________

Details:

The definition of ac_compile in lib/autoconf/c.m4 contains
$CFLAGS/$CXXFLAGS/$OBJCFLAGS before $CPPFLAGS, whereas the usual expected
order (for example in the implicit rules of GNU automake) is the other way
around. This prevents other macros from working as expected when flag
shadowing is involved.

One such case is AX_CHECK_COMPILE_FLAG of autoconf-archive being unable to
properly detect accepted compiler flags: it appends the tested flag to
C/CXXFLAGS and tries to compile with AC_COMPILE_IFELSE, but a flag set in
CPPFLAGS is able to take precedence, falsifying the result.

A minimal working example is attached, using the latest AX_CHECK_COMPILE_FLAG,
where running

autoconf
./configure CPPFLAGS=-march=native

gives

checking whether C compiler accepts "-march=pentiumpro"... yes

whereas running without CPPFLAGS gives

checking whether C compiler accepts "-march=pentiumpro"... no


This leads to projects which use AX_CC_MAXOPT being unable to compile when
CPPFLAG=-march=native is set.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 05 May 2021 03:10:42 PM UTC  Name: configure.ac  Size: 2KiB   By:
None

<http://savannah.gnu.org/support/download.php?file_id=51384>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/support/?110484>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]