patching config.guess or passing triplets

Jack Howarth howarth at bromo.med.uc.edu
Sat Sep 12 18:16:57 PDT 2009


   If anyone is wondering about the form of the patch to config.guess...

--- config.guess.orig   2009-09-12 20:13:05.000000000 -0400
+++ config.guess        2009-09-12 20:14:07.000000000 -0400
@@ -1259,6 +1259,24 @@
     *:Darwin:*:*)
        UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
        case $UNAME_PROCESSOR in
+           i386)
+               eval $set_cc_for_build
+               if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+                 sed 's/^                //' << EOF >$dummy.c
+                 #if defined(__LP64__)
+                 main()
+                 {
+                 }
+                 #endif
+EOF
+                 if test `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep -c main` = 1 ; then
+                     UNAME_PROCESSOR=x86_64
+                 fi
+               else
+                 if sysctl -a | grep -c hw.cpu64bit_capable>/dev/null 2>&1 ; then
+                   UNAME_PROCESSOR=x86_64
+                 fi
+               fi ;;
            unknown) UNAME_PROCESSOR=powerpc ;;
        esac
        echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}


The first test is if 'uname -p' reports i386 (which will always be the case on Intel Darwin).
In the absence of Xcode being installed, the default code execution is determined via sysctl.
The config.guess maintainer wants to decouple config.guess from depending on gcc being present
which is why that is there. If a compiler is found, the compiler set in CC_FOR_BUILD is used to
determine if the __LP64__ definition is present. The gcc developers wanted to used a much
more concise form of the test with -dM but this is a gcc-centric option that wouldn't work
on other compilers.
            Jack


More information about the macports-dev mailing list