[Home]

Summary:ASTERISK-15827: Configure script inconsistent in using CFLAGS when detecting header files
Reporter:Philip Prindeville (pprindeville)Labels:
Date Opened:2010-03-16 20:15:22Date Closed:2011-06-07 14:05:00
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/BuildSystem
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Building with cross-compiler tools, we get:

configure:34069: checking libpri.h usability
configure:34086: /home/digium/trunk/build_i586/staging_dir/bin/i586-linux-uclibc-gcc -c -Os -pipe -fomit-frame-pointer -march=k6-2 -fno-align-functions -fno-align-loops -fno-align-jumps -fno-align-labels  -isysroot /home/digium/trunk/build_i586/staging_dir -isystem /home/digium/trunk/build_i586/staging_dir/usr/include -D_GNU_SOURCE    conftest.c>&5
configure:34093: $? = 0
configure:34107: result: yes
configure:34111: checking libpri.h presence
configure:34126: /home/digium/trunk/build_i586/staging_dir/bin/i586-linux-uclibc-cpp    conftest.c
conftest.c:206:20: error: libpri.h: No such file or directory
configure:34133: $? = 1

note that on line 34086 $(CC) is invoked with $(CFLAGS) and works properly.

On line 34126, however, $(CPP) is invoked without $(CFLAGS) and fails.

Should CPPFLAGS be forced to CFLAGS if it's not explicitly set?
Comments:By: Leif Madsen (lmadsen) 2010-03-17 09:11:19

Really, the way this is filed feels more like it should have been sent to the asterisk-dev list first to determine if there is a bug here, or some other method of getting around this issue.

By: Philip Prindeville (pprindeville) 2010-03-17 13:36:16

I'm just doing what I was told to do (which isn't to say that I don't sometimes get conflicting directions. :-) )

By: Leif Madsen (lmadsen) 2010-03-17 14:10:53

Well if you got word from Russell to do this, then let it be done :)

By: Tilghman Lesher (tilghman) 2010-06-03 21:43:44

CPPFLAGS are used at a different time than CFLAGS.  CPPFLAGS are used to preprocess the file, whereas CFLAGS are used to compile the code into object format.  This secondary test (checking for header presence) uses the preprocessor alone, which is why it's not finding it.  The correct thing for you to do is to specify the include directories in the CPPFLAGS variable, not the CFLAGS variable, as they are needed at preprocessing time.  Only flags that are exclusive to the compiler should be specified in CFLAGS.

By: Tilghman Lesher (tilghman) 2010-06-03 21:52:29

Some examples of flags that are illegal for the preprocessor, but acceptable to the compiler:  -O, -Wformat.