differences in configure flags

James Gregurich bayoubengal at mac.com
Wed Feb 2 15:46:57 PST 2011


Here's the bigger story:



Note the expat configure log below:

The second invocation of llvm-g++ is failing because the arch flag is missing. I corrected the problem by  making the following modifications:




foreach tool {cc cxx cpp objc f77 f90 fc} {
    options configure.${tool}_archflags
    default configure.${tool}_archflags  "\[portconfigure::configure_get_archflags $tool\]"
}





proc portconfigure::configure_get_archflags


    } elseif {${configure.build_arch} != ""} {
        if {[arch_flag_supported] && ($tool == "cc" || $tool == "cxx" || $tool == "cpp" || $tool == "objc")} {



proc portconfigure::configure_main



    foreach tool {cc cxx cpp objc f77 f90 fc ld} {
        global configure.${tool} configure.${tool}_archflags
    }



foreach {tool flags} {cc CFLAGS cxx CXXFLAGS cpp CPPFLAGS objc OBJCFLAGS f77 FFLAGS f90 F90FLAGS fc FCFLAGS ld LDFLAGS} {






Basically, by modifying this loop I caused the arch flags to be added to CPPFLAGS. It would appear that atleast some of the g++ invocations in the expat configure script are just using CPPFLAGS rather than also using CXXFLAGS or CFLAGS. Notice that the first compiler invocation has the sdkroot included twice but not the arch flag...suggesting that CPPFLAGS in being used in conjunction with CXXFLAGS or CFLAG.



Bottom line:  Are my changes valid? If not, what should be done instead?




configure log:


configure:4924: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-4.2 -c -pipe -O2 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk -arch armv6 -I/iopt/include -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk conftest.cc >&5
configure:4930: $? = 0
configure:4934: test -z 
			 || test ! -s conftest.err
configure:4937: $? = 0
configure:4940: test -s conftest.o
configure:4943: $? = 0
configure:4976: checking how to run the C++ preprocessor
configure:5007: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-4.2 -E -I/iopt/include -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk conftest.cc
In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/usr/include/limits.h:64,
                 from /Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/include/limits.h:15,
                 from /Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin10/4.2.1/include/limits.h:15,
                 from conftest.cc:24:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/usr/include/machine/limits.h:8:25: error: i386/limits.h: No such file or directory
configure:5013: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME "expat"
| #define PACKAGE_TARNAME "expat"
| #define PACKAGE_VERSION "2.0.1"
| #define PACKAGE_STRING "expat 2.0.1"
| #define PACKAGE_BUGREPORT "expat-bugs at libexpat.org"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #ifdef __cplusplus
| extern "C" void exit (int);
| #endif
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif




On Feb 2, 2011, at 3:24 PM, Joshua Root wrote:

> On 2011-2-3 09:54 , James Gregurich wrote:
>> a couple of questions:
>> 
>> Why doesn't CPPFLAGS contain ${output} like the other c-language flags?
>> 
>> 
>> 
>>        append_list_to_environment_value configure "CFLAGS"
>> ${output}${configure.cflags}
>>        append_list_to_environment_value configure "CPPFLAGS"
>> ${configure.cppflags}
>>        append_list_to_environment_value configure "CXXFLAGS"
>> ${output}${configure.cxxflags}
>>        append_list_to_environment_value configure "OBJCFLAGS"
>> ${output}${configure.objcflags}
> 
> It's not a terribly descriptive variable name. If you look just above
> you see that it's either empty or "-pipe", which doesn't affect the
> preprocessor.
> 
>> from configure_main:
>> 
>> 
>> 
>> 
>> 
>>        # add extra flags that are conditional on whether we're building
>> universal
>>        if {[variant_exists universal] && [variant_isset universal]} {
>>            foreach flags {CFLAGS OBJCFLAGS} {
>>                append_list_to_environment_value configure $flags
>> ${configure.universal_cflags}
>>            }
>>            append_list_to_environment_value configure "CXXFLAGS"
>> ${configure.universal_cxxflags}
>>            append_list_to_environment_value configure "CPPFLAGS"
>> ${configure.universal_cppflags}
>>            append_list_to_environment_value configure "LDFLAGS"
>> ${configure.universal_ldflags}
>>            eval configure.pre_args-append ${configure.universal_args}
>>        } else {
>>            foreach {tool flags} {cc CFLAGS cxx CXXFLAGS objc OBJCFLAGS
>> f77 FFLAGS f90 F90FLAGS fc FCFLAGS ld LDFLAGS} {
>>                append_list_to_environment_value configure $flags [set
>> configure.${tool}_archflags]
>>                if {${configure.march} != {}} {
>>                    append_list_to_environment_value configure $flags
>> "-march=${configure.march}"
>>                }
>>                if {${configure.mtune} != {}} {
>>                    append_list_to_environment_value configure $flags
>> "-mtune=${configure.mtune}"
>>                }
>>            }
>>        }
>> 
>> 
>> 
>> Why isn't CPPFLAGS being updated with the same info as the other
>> c-language flags? Should it be?
> 
> I don't understand the question. How do you think CPPFLAGS should be
> updated here?
> 
> - Josh

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20110202/5499e728/attachment-0001.html>


More information about the macports-dev mailing list