]> granicus.if.org Git - sudo/commitdiff
Don't set CC when cross-compiling.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 18 Mar 2011 21:54:47 +0000 (17:54 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 18 Mar 2011 21:54:47 +0000 (17:54 -0400)
Use the Sun Studio C compiler on Solaris if possible.

--HG--
branch : 1.7

mkpkg

diff --git a/mkpkg b/mkpkg
index 3e848e2f7f09c0b7dd3be7908cf8192813bd7551..12c1d849c443ae1452e54362fcf2bc4d0b6bce23 100755 (executable)
--- a/mkpkg
+++ b/mkpkg
@@ -15,6 +15,7 @@ IFS="         $nl"
 usage="usage: mkpkg [--debug] [--flavor flavor] [--platform platform] [--osversion ver]"
 debug=0
 flavor=vanilla
+crossbuild=false
 while test $# -gt 0; do
     case "$1" in
        --debug)
@@ -59,6 +60,10 @@ while test $# -gt 0; do
            osversion="$2"
            shift
            ;;
+       --build|--host)
+           crossbuild=true
+           configure_opts="${configure_opts}${configure_opts+$tab}$1"
+           ;;
        *)
            # Pass unknown options to configure
            configure_opts="${configure_opts}${configure_opts+$tab}$1"
@@ -87,18 +92,29 @@ case "$osversion" in
        ;;
 esac
 
-# Choose compiler options by osversion.
-case "$osversion" in
-    hpux*)
-       # Use the HP ANSI C compiler on HP-UX if possible
-       if [ -z "$CC" -a -x /opt/ansic/bin/cc ]; then
-           CC=/opt/ansic/bin/cc; export CC
-           if [ -z "$CFLAGS" ]; then
-               CFLAGS=-O; export CFLAGS
+# Choose compiler options by osversion if not cross-compiling.
+if [ "$crossbuild" = "false" ]; then
+    case "$osversion" in
+       hpux*)
+           # Use the HP ANSI C compiler on HP-UX if possible
+           if [ -z "$CC" -a -x /opt/ansic/bin/cc ]; then
+               CC=/opt/ansic/bin/cc; export CC
+               if [ -z "$CFLAGS" ]; then
+                   CFLAGS=-O; export CFLAGS
+               fi
            fi
-       fi
-       ;;
-esac
+           ;;
+       sol[0-9]*)
+           # Use the Sun Studio C compiler on Solaris if possible
+           if [ -z "$CC" -a -x /usr/bin/cc ]; then
+               CC=/usr/bin/cc; export CC
+               if [ -z "$CFLAGS" ]; then
+                   CFLAGS=-O; export CFLAGS
+               fi
+           fi
+           ;;
+    esac
+fi
 
 # Choose configure options by osversion.
 # We use the same configure options as vendor packages when possible.