diff options
author | Christopher Faylor <me@cgf.cx> | 2008-10-12 23:54:03 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2008-10-12 23:54:03 +0000 |
commit | 391f2a8eed772409ed8c95020e079c98eeaefce2 (patch) | |
tree | 3841ee10b75caa610e251c9553a13e83728bb045 /winsup/utils/mingw | |
parent | 4941ce49c562e3103b7a61d8f167db6bbf98dac3 (diff) | |
download | newlib-391f2a8eed772409ed8c95020e079c98eeaefce2.zip newlib-391f2a8eed772409ed8c95020e079c98eeaefce2.tar.gz newlib-391f2a8eed772409ed8c95020e079c98eeaefce2.tar.bz2 |
* mingw: Add more checks to allow more varied use.
Diffstat (limited to 'winsup/utils/mingw')
-rwxr-xr-x | winsup/utils/mingw | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/winsup/utils/mingw b/winsup/utils/mingw index 720a25e..d24a372 100755 --- a/winsup/utils/mingw +++ b/winsup/utils/mingw @@ -34,6 +34,9 @@ newargs=() sawcomp() { return 1; } sawcfile() { return 1; } sawofile() { return 1; } +sawshared() { return 1; } +sawnostdinc() { return 1; } +sawnostdlib() { return 1; } eatnext() { return 1; } pushnext() { return 1; } for f do @@ -45,13 +48,16 @@ for f do pushnext() { return 1; } else case "$f" in - *cygwin/include*|*newlib*) continue ;; + *cygwin/include*|*newlib|-mno-cygwin) continue ;; -c|-E) sawcomp() { return 0; } ;; -isystem) eatnext() { return 0; }; continue ;; - -o) pushnext() { return 0; } ; /bin/true ;; + -o) pushnext() { return 0; } ;; + -nostdinc*) sawnostdinc() { return 0; } ;; + -nostdlib) sawnostdlib() { return 0; } ;; + -shared|-Wl,-shared) sawshared() { return 0; } ;; -*) ;; *.cc|*.c) sawcfile() { return 0; } ;; - *.o) sawofile() { return 0; }; /bin/true ;; + *.o) sawofile() { return 0; };; esac fi newargs[${#newargs[*]}]="$f" @@ -65,18 +71,22 @@ set -- -B"$mingw_dir"/lib/ "${newargs[@]}" # an attempt to link, compile, or both. if sawcomp || sawcfile; then ccdir=$(dirname $($compiler -print-libgcc-file-name)) - set -- -isystem "$ccdir"/include -D__MINGW32__ -D__MSVCRT__ -DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -U__CYGWIN__ -Uunix -U__unix__ -U__unix -U __CYGWIN32__ -I"${mingw_dir}"/include "$@" - case "$compiler" in - *++*) set -- -nostdinc++ "$@" ;; - *) set -- -nostdinc "$@" ;; - esac + sawnostdinc || set -- -isystem "$ccdir"/include -I"${mingw_dir}"/include "$@" + set -- -D__MINGW32__ -D__MSVCRT__ -DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -U__CYGWIN__ -Uunix -U__unix__ -U__unix -U __CYGWIN32__ "$@" + if ! sawnostdinc; then + case "$compiler" in + *++*) set -- -nostdinc++ "$@" ;; + *) set -- -nostdinc "$@" ;; + esac + fi fi if sawofile || ! sawcfile || ! sawcomp; then w32api=$($compiler -print-file-name=libc.a) w32api=$(cd $(dirname "$w32api")/w32api; pwd) - set -- "$@" -nostdlib -Wl,-nostdlib -L"$w32api" -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -lmingw32 -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt - { sawofile || sawcfile; } && set -- "$mingw_dir"/lib/crt2.o "$@" + set -- -Wl,-nostdlib -L"${w32api}" "$@" + ! sawnostdlib && set -- -nostdlib "$@" -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -lmingw32 -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt + ! sawnostdlib && ! sawshared && { sawofile || sawcfile; } && set -- "$mingw_dir"/lib/crt2.o "$@" fi # Execute the compiler with new mingw-specific options. |