$NetBSD: patch-ad,v 1.8 2012/12/23 10:33:34 ryoon Exp $

*BSD and qnx are identified as linux.
Add another SDK path on Mac OS X.

--- build/make/configure.sh.orig	2012-05-08 23:14:00.000000000 +0000
+++ build/make/configure.sh
@@ -596,7 +596,7 @@ process_common_toolchain() {
                 [ -z "$tgt_isa" ] && tgt_isa=x86
                 tgt_os=win32
                 ;;
-            *linux*|*bsd*)
+            *linux*|*bsd*|*qnx6*)
                 tgt_os=linux
                 ;;
             *solaris2.10)
@@ -656,6 +656,9 @@ process_common_toolchain() {
                     if [ -d "${OSX_SDK_ROOTS}/${v}" ]; then
                         osx_sdk_dir="${OSX_SDK_ROOTS}/${v}"
                     fi
+		    if [ -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk" ]; then
+		    osx_sdk_dir="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"
+		    fi
                 done
             fi
             ;;
@@ -890,12 +893,9 @@ process_common_toolchain() {
         esac
     ;;
     mips*)
-        CROSS=${CROSS:-mipsel-linux-uclibc-}
         link_with_cc=gcc
         setup_gnu_toolchain
         tune_cflags="-mtune="
-        check_add_cflags -march=${tgt_isa}
-    check_add_asflags -march=${tgt_isa}
     check_add_asflags -KPIC
     ;;
     ppc*)
@@ -1082,10 +1082,29 @@ EOF
         case ${toolchain} in
             *-win*);;
             *-android-gcc);;
-            *) check_header pthread.h && add_extralibs -lpthread
+            *) check_header pthread.h && add_extralibs ${PTHREAD_LDFLAGS} ${PTHREAD_LIBS}
         esac
     fi
 
+    case ${tgt_os} in
+    darwin*)
+	add_extralibs -lm
+	;;
+    solaris*)
+	add_extralibs -lm -lrt
+	;;
+	linux*)
+	case ${gcctarget} in
+	*qnx6*)
+	    add_extralibs -lm
+	    ;;
+	*)
+	    add_extralibs -lm -lrt
+	    ;;
+	esac
+	;;
+    esac
+
     # for sysconf(3) and friends.
     check_header unistd.h
 
