From: Todd C. Miller Date: Fri, 18 Mar 2011 21:54:47 +0000 (-0400) Subject: Don't set CC when cross-compiling. X-Git-Tag: SUDO_1_7_6~32 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=824ccdc4bc6537d24489c3431bfae71d10b360e0;p=sudo Don't set CC when cross-compiling. Use the Sun Studio C compiler on Solaris if possible. --HG-- branch : 1.7 --- diff --git a/mkpkg b/mkpkg index 3e848e2f7..12c1d849c 100755 --- 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.