helpAutoconf - Support: sr #110484, CFLAGS/CXXFLAGS and CPPFLAGS order...

 
 

sr #110484: CFLAGS/CXXFLAGS and CPPFLAGS order in c.m4 ac_compile is nonstandard

Submitter:  None
Submitted:  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:  -email is unavailable- Open/Closed:  Open
Operating System:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Wed 05 May 2021 03:10:42 PM UTC, original submission:  

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.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #51384:  configure.ac added by None (2KiB - application/vnd.nokia.n-gage.ac+xml)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

     

     

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-05-05 None Attached File- Added configure.ac, #51384

    Back to the top


    Powered by Savane 3.9