summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2003-01-20 16:01:40 +0000
committerwtc%netscape.com <devnull@localhost>2003-01-20 16:01:40 +0000
commit96b912f1dd036f5620ec2d4d7c852d6065369122 (patch)
treed51e1911a47181f16c7d3ff4c13dd025aac20c13
parenteccd4d136004e9cf64da9ae6541599711f4a9e91 (diff)
downloadnspr-hg-96b912f1dd036f5620ec2d4d7c852d6065369122.tar.gz
Bug 134113: make NSPR build on Win32 using MinGW gcc. The patch is
contributed by Chris Seawood <seawood@cls.org> and Dan Mosedale <dmose@mozilla.org>. r=wtc. Modified files: configure configure.in config/Makefile.in autoconf.mk.in now.c rules.mk lib/ds/Makefile.in lib/libc/src/Makefile.in lib/msgc/src/Makefile.in prtypes.h _winnt.h pr/src/Makefile.in prmapopt.c pr/src/md/windows/Makefile.in ntio.c ntmisc.c pr/tests/Makefile.in runtests.ksh pr/tests/dll/Makefile.in Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH
-rw-r--r--config/Makefile.in2
-rw-r--r--config/autoconf.mk.in3
-rw-r--r--config/now.c5
-rw-r--r--config/rules.mk16
-rwxr-xr-xconfigure243
-rw-r--r--configure.in43
-rw-r--r--lib/ds/Makefile.in9
-rw-r--r--lib/libc/src/Makefile.in8
-rw-r--r--lib/msgc/src/Makefile.in4
-rw-r--r--pr/include/md/_winnt.h3
-rw-r--r--pr/include/prtypes.h4
-rw-r--r--pr/src/Makefile.in12
-rw-r--r--pr/src/io/prmapopt.c7
-rw-r--r--pr/src/md/windows/Makefile.in2
-rw-r--r--pr/src/md/windows/ntio.c16
-rw-r--r--pr/src/md/windows/ntmisc.c6
-rw-r--r--pr/tests/Makefile.in9
-rw-r--r--pr/tests/dll/Makefile.in4
-rwxr-xr-xpr/tests/runtests.ksh2
19 files changed, 200 insertions, 198 deletions
diff --git a/config/Makefile.in b/config/Makefile.in
index f2de4164..2e07307a 100644
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -119,8 +119,10 @@ endif
OUTOPTION = -o # end of the line
ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET)))
+ifndef NS_USE_GCC
OUTOPTION = /Fe
endif
+endif
# Redefine MAKE_OBJDIR for just this directory
define MAKE_OBJDIR
diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in
index 489e2513..9135f1af 100644
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -60,9 +60,8 @@ AR_FLAGS = @AR_FLAGS@
LD = @LD@
RANLIB = @RANLIB@
PERL = @PERL@
-DLLTOOL = @DLLTOOL@
-WINDRES = @WINDRES@
RC = @RC@
+RCFLAGS = @RCFLAGS@
STRIP = @STRIP@
NSINSTALL = @NSINSTALL@
FILTER = @FILTER@
diff --git a/config/now.c b/config/now.c
index dec53239..28beb7be 100644
--- a/config/now.c
+++ b/config/now.c
@@ -95,8 +95,13 @@ int main(int argc, char **argv)
* 116444736000000000 is the number of 100-nanosecond intervals
* between Jan. 1, 1601 and Jan. 1, 1970.
*/
+#ifdef __GNUC__
+ now = (now - 116444736000000000LL) / 10LL;
+ fprintf(stdout, "%lld", now);
+#else
now = (now - 116444736000000000i64) / 10i64;
fprintf(stdout, "%I64d", now);
+#endif
#elif defined(XP_OS2_VACPP)
/* no long long or i64 so we use a string */
diff --git a/config/rules.mk b/config/rules.mk
index 92c8db2f..3cecd88d 100644
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -287,7 +287,7 @@ $(NFSPWD):
$(PROGRAM): $(OBJS)
@$(MAKE_OBJDIR)
-ifeq ($(OS_ARCH),WINNT)
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
$(CC) $(OBJS) -Fe$@ -link $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
else
ifeq ($(MOZ_OS2_TOOLS),VACPP)
@@ -314,7 +314,7 @@ ifeq ($(OS_TARGET), OS2)
$(IMPORT_LIBRARY): $(SHARED_LIBRARY)
$(IMPLIB) $@ $(SHARED_LIBRARY).def
endif
-
+
$(SHARED_LIBRARY): $(OBJS) $(MAPFILE)
@$(MAKE_OBJDIR)
rm -f $@
@@ -327,7 +327,7 @@ ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
$(LD) $(XCFLAGS) -o $@ $(OBJS) -bE:$(OBJDIR)/lib$(LIBRARY_NAME)_syms \
-bM:SRE -bnoentry $(OS_LIBS) $(EXTRA_LIBS)
else # AIX 4.1
-ifeq ($(OS_ARCH), WINNT)
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
$(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS)
else
ifeq ($(OS_ARCH),OS2)
@@ -363,7 +363,11 @@ ifeq ($(OS_TARGET),OS2)
$(RC) -DOS2 -r $< $@
else
# The resource compiler does not understand the -U option.
- $(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
+ifdef NS_USE_GCC
+ $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $<
+else
+ $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
+endif # GCC
endif
@echo $(RES) finished
endif
@@ -377,7 +381,7 @@ endif
$(OBJDIR)/%.$(OBJ_SUFFIX): %.cpp
@$(MAKE_OBJDIR)
-ifeq ($(OS_ARCH), WINNT)
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
$(CCC) -Fo$@ -c $(CCCFLAGS) $<
else
ifeq ($(MOZ_OS2_TOOLS),VACPP)
@@ -392,7 +396,7 @@ WCCFLAGS2 = $(subst -I,-i=,$(WCCFLAGS1))
WCCFLAGS3 = $(subst -D,-d,$(WCCFLAGS2))
$(OBJDIR)/%.$(OBJ_SUFFIX): %.c
@$(MAKE_OBJDIR)
-ifeq ($(OS_ARCH), WINNT)
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
$(CC) -Fo$@ -c $(CFLAGS) $<
else
ifeq ($(MOZ_OS2_TOOLS),VACPP)
diff --git a/configure b/configure
index 50a8349a..dbad84cd 100755
--- a/configure
+++ b/configure
@@ -1792,50 +1792,13 @@ done
test -n "$STRIP" || STRIP="echo"
fi
- if test -z "$DLLTOOL"; then
- for ac_prog in "${target_alias}-dlltool" "${target}-dlltool"
-do
-# Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1802: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$DLLTOOL"; then
- ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_DLLTOOL="$ac_prog"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
- echo "$ac_t""$DLLTOOL" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-test -n "$DLLTOOL" && break
-done
-test -n "$DLLTOOL" || DLLTOOL="echo"
-
- fi
if test -z "$WINDRES"; then
for ac_prog in "${target_alias}-windres" "${target}-windres"
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1839: checking for $ac_word" >&5
+echo "configure:1802: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1873,7 +1836,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1877: checking for $ac_word" >&5
+echo "configure:1840: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1905,7 +1868,7 @@ test -n "$CXX" || CXX="gcc"
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1909: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:1872: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1916,12 +1879,12 @@ cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext << EOF
-#line 1920 "configure"
+#line 1883 "configure"
#include "confdefs.h"
int main(){return(0);}
EOF
-if { (eval echo configure:1925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cxx_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -1947,12 +1910,12 @@ if test $ac_cv_prog_cxx_works = no; then
{ echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1951: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1914: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:1956: checking whether we are using GNU C++" >&5
+echo "configure:1919: checking whether we are using GNU C++" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1961,7 +1924,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1965: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1928: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
@@ -1980,7 +1943,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1984: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1947: checking whether ${CXX-g++} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2017,7 +1980,7 @@ fi
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2021: checking for $ac_word" >&5
+echo "configure:1984: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2047,7 +2010,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2051: checking for $ac_word" >&5
+echo "configure:2014: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2098,7 +2061,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2102: checking for $ac_word" >&5
+echo "configure:2065: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2130,7 +2093,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2134: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2097: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -2141,12 +2104,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 2145 "configure"
+#line 2108 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:2150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -2172,12 +2135,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:2176: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2139: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:2181: checking whether we are using GNU C" >&5
+echo "configure:2144: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2186,7 +2149,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2190: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2153: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -2205,7 +2168,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2209: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2172: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2238,7 +2201,7 @@ fi
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2242: checking how to run the C preprocessor" >&5
+echo "configure:2205: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -2253,13 +2216,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 2257 "configure"
+#line 2220 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2226: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -2270,13 +2233,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 2274 "configure"
+#line 2237 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2280: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2243: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -2287,13 +2250,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 2291 "configure"
+#line 2254 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2297: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2260: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -2320,7 +2283,7 @@ echo "$ac_t""$CPP" 1>&6
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2324: checking for $ac_word" >&5
+echo "configure:2287: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2352,7 +2315,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2356: checking for $ac_word" >&5
+echo "configure:2319: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_AS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2393,7 +2356,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2397: checking for $ac_word" >&5
+echo "configure:2360: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2434,7 +2397,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2438: checking for $ac_word" >&5
+echo "configure:2401: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2475,7 +2438,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2479: checking for $ac_word" >&5
+echo "configure:2442: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2511,53 +2474,12 @@ test -n "$STRIP" && break
done
test -n "$STRIP" || STRIP="echo not_strip"
- for ac_prog in dlltool
-do
-# Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2520: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_DLLTOOL'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- case "$DLLTOOL" in
- /*)
- ac_cv_path_DLLTOOL="$DLLTOOL" # Let the user override the test with a path.
- ;;
- ?:/*)
- ac_cv_path_DLLTOOL="$DLLTOOL" # Let the user override the test with a dos path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_path_DLLTOOL="$ac_dir/$ac_word"
- break
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac
-fi
-DLLTOOL="$ac_cv_path_DLLTOOL"
-if test -n "$DLLTOOL"; then
- echo "$ac_t""$DLLTOOL" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-test -n "$DLLTOOL" && break
-done
-test -n "$DLLTOOL" || DLLTOOL="echo not_dlltool"
-
for ac_prog in windres
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2561: checking for $ac_word" >&5
+echo "configure:2483: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_WINDRES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2619,7 +2541,7 @@ else
fi
echo $ac_n "checking for gcc -pipe support""... $ac_c" 1>&6
-echo "configure:2623: checking for gcc -pipe support" >&5
+echo "configure:2545: checking for gcc -pipe support" >&5
if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
echo '#include <stdio.h>' > dummy-hello.c
echo 'int main() { printf("Hello World\n"); return 0; }' >> dummy-hello.c
@@ -2634,14 +2556,14 @@ if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
_SAVE_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -pipe"
cat > conftest.$ac_ext <<EOF
-#line 2638 "configure"
+#line 2560 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {
printf("Hello World\n");
; return 0; }
EOF
-if { (eval echo configure:2645: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2567: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
_res_gcc_pipe="yes"
else
@@ -2674,7 +2596,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2678: checking for $ac_word" >&5
+echo "configure:2600: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2904,17 +2826,17 @@ EOF
DSO_LDOPTS='-brtl -bM:SRE -bnoentry -bexpall'
ac_safe=`echo "sys/atomic_op.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/atomic_op.h""... $ac_c" 1>&6
-echo "configure:2908: checking for sys/atomic_op.h" >&5
+echo "configure:2830: checking for sys/atomic_op.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2913 "configure"
+#line 2835 "configure"
#include "confdefs.h"
#include <sys/atomic_op.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2918: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2840: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3074,7 +2996,7 @@ EOF
_DEBUG_FLAGS='-gdwarf-2 -O0'
MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
echo $ac_n "checking for gethostbyaddr in -lbind""... $ac_c" 1>&6
-echo "configure:3078: checking for gethostbyaddr in -lbind" >&5
+echo "configure:3000: checking for gethostbyaddr in -lbind" >&5
ac_lib_var=`echo bind'_'gethostbyaddr | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3082,7 +3004,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lbind $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3086 "configure"
+#line 3008 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3093,7 +3015,7 @@ int main() {
gethostbyaddr()
; return 0; }
EOF
-if { (eval echo configure:3097: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3019: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3802,27 +3724,28 @@ EOF
PR_MD_ARCH_DIR=windows
RESOLVE_LINK_SYMBOLS=1
NSINSTALL='$(CYGWIN_WRAPPER) nsinstall'
+ CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
if test -n "$GNU_CC"; then
- cat >> confdefs.h <<\EOF
-#define NONAMELESSUNION 1
-EOF
-
- MKSHLIB='$(DLLTOOL) --as=$(AS) -k --dllname $*.dll --output-lib $@'
+ CC="$CC -mno-cygwin"
+ CXX="$CXX -mno-cygwin"
+ DLL_SUFFIX=dll
+ MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
+ RC=$WINDRES
+ RCFLAGS='-O coff'
else
- CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
- CC='$(CYGWIN_WRAPPER) cl'
- CXX='$(CYGWIN_WRAPPER) cl'
+ CC=cl
+ CXX=cl
LD=link
AR='lib -NOLOGO -OUT:"$@"'
AR_FLAGS=
RANLIB='echo not_ranlib'
STRIP='echo not_strip'
- RC='$(CYGWIN_WRAPPER) rc.exe'
+ RC=rc.exe
GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
- OBJ_SUFFIX=obj
- LIB_SUFFIX=lib
- DLL_SUFFIX=dll
+ OBJ_SUFFIX=obj
+ LIB_SUFFIX=lib
+ DLL_SUFFIX=dll
CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
@@ -3894,6 +3817,8 @@ EOF
#define WIN95 1
EOF
+ # undefine WINNT as some versions of mingw gcc define it by default
+ DEFINES="$DEFINES -UWINNT"
cat >> confdefs.h <<\EOF
#define _PR_GLOBAL_THREADS_ONLY 1
EOF
@@ -4235,17 +4160,17 @@ EOF
_OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6
-echo "configure:4239: checking for machine/builtins.h" >&5
+echo "configure:4164: checking for machine/builtins.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4244 "configure"
+#line 4169 "configure"
#include "confdefs.h"
#include <machine/builtins.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4249: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4649,7 +4574,6 @@ EOF
LIB_SUFFIX=lib
DLL_SUFFIX=dll
ASM_SUFFIX=asm
- DLLTOOL=''
RC=rc.exe
PR_MD_ARCH_DIR=os2
PROG_SUFFIX=.exe
@@ -4754,12 +4678,12 @@ esac
if test -z "$SKIP_LIBRARY_CHECKS"; then
echo $ac_n "checking for dlopen""... $ac_c" 1>&6
-echo "configure:4758: checking for dlopen" >&5
+echo "configure:4682: checking for dlopen" >&5
if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4763 "configure"
+#line 4687 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char dlopen(); below. */
@@ -4782,7 +4706,7 @@ dlopen();
; return 0; }
EOF
-if { (eval echo configure:4786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_dlopen=yes"
else
@@ -4801,7 +4725,7 @@ else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:4805: checking for dlopen in -ldl" >&5
+echo "configure:4729: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4809,7 +4733,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4813 "configure"
+#line 4737 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4820,7 +4744,7 @@ int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:4824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4848,13 +4772,13 @@ fi
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:4852: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:4776: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
-#line 4858 "configure"
+#line 4782 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -4872,7 +4796,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 4876 "configure"
+#line 4800 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -4896,12 +4820,12 @@ fi
for ac_func in lchown strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4900: checking for $ac_func" >&5
+echo "configure:4824: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4905 "configure"
+#line 4829 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4924,7 +4848,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4963,7 +4887,7 @@ hpux*)
if test -z "$GNU_CC"; then
echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
-echo "configure:4967: checking for +Olit support" >&5
+echo "configure:4891: checking for +Olit support" >&5
if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4997,7 +4921,7 @@ esac
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:5001: checking for pthread_create in -lpthreads" >&5
+echo "configure:4925: checking for pthread_create in -lpthreads" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5019,7 +4943,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:5023: checking for pthread_create in -lpthread" >&5
+echo "configure:4947: checking for pthread_create in -lpthread" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5041,7 +4965,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:5045: checking for pthread_create in -lc_r" >&5
+echo "configure:4969: checking for pthread_create in -lc_r" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5063,7 +4987,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
-echo "configure:5067: checking for pthread_create in -lc" >&5
+echo "configure:4991: checking for pthread_create in -lc" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5215,7 +5139,7 @@ if test -n "$USE_PTHREADS"; then
rm -f conftest*
ac_cv_have_dash_pthread=no
echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
-echo "configure:5219: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:5143: checking whether ${CC-cc} accepts -pthread" >&5
echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then
@@ -5238,7 +5162,7 @@ echo "configure:5219: checking whether ${CC-cc} accepts -pthread" >&5
ac_cv_have_dash_pthreads=no
if test "$ac_cv_have_dash_pthread" = "no"; then
echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6
-echo "configure:5242: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:5166: checking whether ${CC-cc} accepts -pthreads" >&5
echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then
@@ -5533,6 +5457,13 @@ fi
RELEASE_OBJDIR_NAME="${OS_CONFIG}${CPU_ARCH_TAG}${COMPILER_TAG}${IMPL_STRATEGY}${OBJDIR_TAG}.${OBJDIR_SUFFIX}"
+case "$target_os" in
+mingw*|cygwin*|msvc*|mksnt*)
+ CC="\$(CYGWIN_WRAPPER) $CC"
+ CXX="\$(CYGWIN_WRAPPER) $CXX"
+ RC="\$(CYGWIN_WRAPPER) $RC"
+ ;;
+esac
@@ -5846,7 +5777,6 @@ s%@AR@%$AR%g
s%@AS@%$AS%g
s%@LD@%$LD%g
s%@STRIP@%$STRIP%g
-s%@DLLTOOL@%$DLLTOOL%g
s%@WINDRES@%$WINDRES%g
s%@CPP@%$CPP%g
s%@PERL@%$PERL%g
@@ -5908,6 +5838,7 @@ s%@RELEASE_OBJDIR_NAME@%$RELEASE_OBJDIR_NAME%g
s%@NSINSTALL@%$NSINSTALL%g
s%@OPTIMIZER@%$OPTIMIZER%g
s%@RC@%$RC%g
+s%@RCFLAGS@%$RCFLAGS%g
s%@DLLFLAGS@%$DLLFLAGS%g
s%@EXEFLAGS@%$EXEFLAGS%g
s%@OS_DLLFLAGS@%$OS_DLLFLAGS%g
diff --git a/configure.in b/configure.in
index 44ffe35a..80b5d3aa 100644
--- a/configure.in
+++ b/configure.in
@@ -419,9 +419,6 @@ if test "$target" != "$host"; then
if test -z "$STRIP"; then
AC_CHECK_PROGS(STRIP, "${target_alias}-strip" "${target}-strip", echo)
fi
- if test -z "$DLLTOOL"; then
- AC_CHECK_PROGS(DLLTOOL, "${target_alias}-dlltool" "${target}-dlltool", echo)
- fi
if test -z "$WINDRES"; then
AC_CHECK_PROGS(WINDRES, "${target_alias}-windres" "${target}-windres", echo)
fi
@@ -439,7 +436,6 @@ else
AC_PATH_PROGS(AR, ar, echo not_ar)
AC_PATH_PROGS(LD, ld link, echo not_ld)
AC_PATH_PROGS(STRIP, strip, echo not_strip)
- AC_PATH_PROGS(DLLTOOL, dlltool, echo not_dlltool)
AC_PATH_PROGS(WINDRES, windres, echo not_windres)
if test -z "$HOST_CC"; then
HOST_CC="$CC"
@@ -1217,24 +1213,28 @@ case "$target" in
PR_MD_ARCH_DIR=windows
RESOLVE_LINK_SYMBOLS=1
NSINSTALL='$(CYGWIN_WRAPPER) nsinstall'
+ CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
if test -n "$GNU_CC"; then
- AC_DEFINE(NONAMELESSUNION)
- MKSHLIB='$(DLLTOOL) --as=$(AS) -k --dllname $*.dll --output-lib $@'
+ CC="$CC -mno-cygwin"
+ CXX="$CXX -mno-cygwin"
+ DLL_SUFFIX=dll
+ MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
+ RC=$WINDRES
+ RCFLAGS='-O coff'
else
- CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
- CC='$(CYGWIN_WRAPPER) cl'
- CXX='$(CYGWIN_WRAPPER) cl'
+ CC=cl
+ CXX=cl
LD=link
AR='lib -NOLOGO -OUT:"$@"'
AR_FLAGS=
RANLIB='echo not_ranlib'
STRIP='echo not_strip'
- RC='$(CYGWIN_WRAPPER) rc.exe'
+ RC=rc.exe
GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
- OBJ_SUFFIX=obj
- LIB_SUFFIX=lib
- DLL_SUFFIX=dll
+ OBJ_SUFFIX=obj
+ LIB_SUFFIX=lib
+ DLL_SUFFIX=dll
CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
@@ -1294,6 +1294,8 @@ case "$target" in
AC_DEFINE(WINNT)
else
AC_DEFINE(WIN95)
+ # undefine WINNT as some versions of mingw gcc define it by default
+ DEFINES="$DEFINES -UWINNT"
AC_DEFINE(_PR_GLOBAL_THREADS_ONLY)
fi
@@ -1744,7 +1746,6 @@ mips-sony-newsos*)
LIB_SUFFIX=lib
DLL_SUFFIX=dll
ASM_SUFFIX=asm
- DLLTOOL=''
RC=rc.exe
PR_MD_ARCH_DIR=os2
PROG_SUFFIX=.exe
@@ -2311,6 +2312,17 @@ fi
RELEASE_OBJDIR_NAME="${OS_CONFIG}${CPU_ARCH_TAG}${COMPILER_TAG}${IMPL_STRATEGY}${OBJDIR_TAG}.${OBJDIR_SUFFIX}"
dnl ========================================================
+dnl Use cygwin wrapper for win32 builds
+dnl ========================================================
+case "$target_os" in
+mingw*|cygwin*|msvc*|mksnt*)
+ CC="\$(CYGWIN_WRAPPER) $CC"
+ CXX="\$(CYGWIN_WRAPPER) $CXX"
+ RC="\$(CYGWIN_WRAPPER) $RC"
+ ;;
+esac
+
+dnl ========================================================
dnl Substitution of found variables.
dnl ========================================================
AC_SUBST(SHELL_OVERRIDE)
@@ -2377,8 +2389,6 @@ AC_SUBST(AR_FLAGS)
AC_SUBST(AS)
AC_SUBST(ASFLAGS)
AC_SUBST(LD)
-AC_SUBST(DLLTOOL)
-AC_SUBST(WINDRES)
AC_SUBST(RANLIB)
AC_SUBST(PERL)
AC_SUBST(STRIP)
@@ -2398,6 +2408,7 @@ AC_SUBST(RELEASE_OBJDIR_NAME)
AC_SUBST(NSINSTALL)
AC_SUBST(OPTIMIZER)
AC_SUBST(RC)
+AC_SUBST(RCFLAGS)
AC_SUBST(DLLFLAGS)
AC_SUBST(EXEFLAGS)
AC_SUBST(OS_DLLFLAGS)
diff --git a/lib/ds/Makefile.in b/lib/ds/Makefile.in
index 1b13bfea..7814556a 100644
--- a/lib/ds/Makefile.in
+++ b/lib/ds/Makefile.in
@@ -59,10 +59,13 @@ HEADERS = \
HEADERS := $(addprefix $(srcdir)/, $(HEADERS))
ifeq ($(OS_ARCH), WINNT)
+ifdef NS_USE_GCC
+DLLBASE=-Wl,--image-base -Wl,0x30000000
+else
DLLBASE=/BASE:0x30000000
+endif # GCC
RES=$(OBJDIR)/plds.res
RESNAME=plds.rc
-OS_LIBS = user32.lib
endif # WINNT
ifeq ($(OS_ARCH), AIX)
@@ -124,7 +127,7 @@ NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
SH_DATE = $(shell date "+%Y-%m-%d %T")
SH_NOW = $(shell $(NOW))
-ifeq ($(OS_ARCH), WINNT)
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
SUF = i64
else
SUF = LL
@@ -144,7 +147,7 @@ $(TINC):
$(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC)
-ifeq ($(OS_ARCH), WINNT)
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
else
ifeq ($(MOZ_OS2_TOOLS), VACPP)
diff --git a/lib/libc/src/Makefile.in b/lib/libc/src/Makefile.in
index 2d3b47a7..77379f35 100644
--- a/lib/libc/src/Makefile.in
+++ b/lib/libc/src/Makefile.in
@@ -69,7 +69,11 @@ LIBRARY_VERSION = $(MOD_MAJOR_VERSION)
RELEASE_LIBS = $(TARGETS)
ifeq ($(OS_ARCH),WINNT)
+ifdef NS_USE_GCC
+DLLBASE=-Wl,--image-base -Wl,0x30000000
+else
DLLBASE=/BASE:0x30000000
+endif
RES=$(OBJDIR)/plc.res
RESNAME=plc.rc
endif # WINNT
@@ -126,7 +130,7 @@ NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
SH_DATE = $(shell date "+%Y-%m-%d %T")
SH_NOW = $(shell $(NOW))
-ifeq ($(OS_ARCH), WINNT)
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
SUF = i64
else
SUF = LL
@@ -146,7 +150,7 @@ $(TINC):
$(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC)
-ifeq ($(OS_ARCH), WINNT)
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
else
ifeq ($(MOZ_OS2_TOOLS), VACPP)
diff --git a/lib/msgc/src/Makefile.in b/lib/msgc/src/Makefile.in
index 355f1489..28a971e5 100644
--- a/lib/msgc/src/Makefile.in
+++ b/lib/msgc/src/Makefile.in
@@ -65,7 +65,11 @@ EXTRA_LIBS += $(OS_LIBS)
endif
ifeq ($(OS_ARCH), WINNT)
+ifdef NS_USE_GCC
+DLLBASE=-Wl,--image-base -Wl,0x30000000
+else
DLLBASE=/BASE:0x30000000
+endif # GCC
#RES=$(OBJDIR)/ds.res
#RESNAME=$(MOD_DEPTH)/pr/src/nspr.rc
#OS_LIBS = user32.lib
diff --git a/pr/include/md/_winnt.h b/pr/include/md/_winnt.h
index 321150eb..efc60edd 100644
--- a/pr/include/md/_winnt.h
+++ b/pr/include/md/_winnt.h
@@ -47,6 +47,9 @@
#include <windows.h>
#include <winsock.h>
+#ifdef __MINGW32__
+#include <mswsock.h>
+#endif
#include <errno.h>
#include "prio.h"
diff --git a/pr/include/prtypes.h b/pr/include/prtypes.h
index de9fd2fd..b6836108 100644
--- a/pr/include/prtypes.h
+++ b/pr/include/prtypes.h
@@ -470,8 +470,12 @@ typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus;
*/
#ifndef __PRUNICHAR__
#define __PRUNICHAR__
+#if defined(WIN32) || defined(XP_MAC)
+typedef wchar_t PRUnichar;
+#else
typedef PRUint16 PRUnichar;
#endif
+#endif
#endif /* MOZ_UNICODE */
/*
diff --git a/pr/src/Makefile.in b/pr/src/Makefile.in
index 03021909..f33f124d 100644
--- a/pr/src/Makefile.in
+++ b/pr/src/Makefile.in
@@ -181,8 +181,12 @@ OS_LIBS = -lsocket -lnsl -lgen -lresolv
endif
ifeq ($(OS_ARCH),WINNT)
+ifdef NS_USE_GCC
+OS_LIBS = -ladvapi32 -lws2_32
+else
OS_LIBS = advapi32.lib wsock32.lib
endif
+endif
ifeq ($(OS_TARGET),MacOSX)
OS_LIBS = -framework CoreServices -framework CoreFoundation
@@ -296,7 +300,11 @@ OBJS += memory/$(OBJDIR)/prgcleak.$(OBJ_SUFFIX)
endif
ifeq ($(OS_ARCH), WINNT)
+ifdef NS_USE_GCC
+DLLBASE=-Wl,--image-base -Wl,0x30000000
+else
DLLBASE=/BASE:0x30000000
+endif # GCC
RES=$(OBJDIR)/nspr.res
RESNAME=nspr.rc
endif # WINNT
@@ -335,7 +343,7 @@ NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
SH_DATE = $(shell date "+%Y-%m-%d %T")
SH_NOW = $(shell $(NOW))
-ifeq ($(OS_ARCH), WINNT)
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
SUF = i64
else
SUF = LL
@@ -357,7 +365,7 @@ $(TINC):
$(OBJDIR)/prvrsion.$(OBJ_SUFFIX): prvrsion.c $(TINC)
-ifeq ($(OS_ARCH), WINNT)
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
else
ifeq ($(MOZ_OS2_TOOLS), VACPP)
diff --git a/pr/src/io/prmapopt.c b/pr/src/io/prmapopt.c
index 5828bf9e..d8570ccb 100644
--- a/pr/src/io/prmapopt.c
+++ b/pr/src/io/prmapopt.c
@@ -46,9 +46,14 @@
* includes winsock.h, with _WIN32_WINNT undefined.
*/
-#ifdef WINNT
+#ifdef WIN32
+#ifdef __MINGW32__
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#elif defined(WINNT)
#include <winsock.h>
#endif
+#endif
#include "primpl.h"
diff --git a/pr/src/md/windows/Makefile.in b/pr/src/md/windows/Makefile.in
index d9dce1d0..dd5a613b 100644
--- a/pr/src/md/windows/Makefile.in
+++ b/pr/src/md/windows/Makefile.in
@@ -108,8 +108,10 @@ export:: $(TARGETS)
# Bug 122433 workaround: disable global optimization (-Og-) on ntio.c.
ifdef BUILD_OPT
ifeq ($(OS_TARGET), WINNT)
+ifndef NS_USE_GCC
$(OBJDIR)/ntio.$(OBJ_SUFFIX): ntio.c
@$(MAKE_OBJDIR)
$(CC) -Fo$@ -c $(CFLAGS) -Og- $<
endif
endif
+endif
diff --git a/pr/src/md/windows/ntio.c b/pr/src/md/windows/ntio.c
index f38b2e6a..e206f787 100644
--- a/pr/src/md/windows/ntio.c
+++ b/pr/src/md/windows/ntio.c
@@ -99,7 +99,11 @@ static DWORD dirAccessTable[] = {
* We store the value in a PRTime variable for convenience.
* This constant is used by _PR_FileTimeToPRTime().
*/
+#ifdef __GNUC__
+static const PRTime _pr_filetime_offset = 116444736000000000LL;
+#else
static const PRTime _pr_filetime_offset = 116444736000000000i64;
+#endif
#define _NEED_351_FILE_LOCKING_HACK
#ifdef _NEED_351_FILE_LOCKING_HACK
@@ -2322,7 +2326,7 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len)
}
PRInt32
-_PR_MD_WRITE(PRFileDesc *fd, void *buf, PRInt32 len)
+_PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len)
{
PRInt32 f = fd->secret->md.osfd;
PRInt32 bytes;
@@ -2488,7 +2492,7 @@ _PR_MD_PIPEAVAILABLE(PRFileDesc *fd)
}
PROffset32
-_PR_MD_LSEEK(PRFileDesc *fd, PROffset32 offset, int whence)
+_PR_MD_LSEEK(PRFileDesc *fd, PROffset32 offset, PRSeekWhence whence)
{
DWORD moveMethod;
PROffset32 rv;
@@ -2521,7 +2525,7 @@ _PR_MD_LSEEK(PRFileDesc *fd, PROffset32 offset, int whence)
}
PROffset64
-_PR_MD_LSEEK64(PRFileDesc *fd, PROffset64 offset, int whence)
+_PR_MD_LSEEK64(PRFileDesc *fd, PROffset64 offset, PRSeekWhence whence)
{
DWORD moveMethod;
LARGE_INTEGER li;
@@ -2820,7 +2824,11 @@ _PR_FileTimeToPRTime(const FILETIME *filetime, PRTime *prtm)
{
PR_ASSERT(sizeof(FILETIME) == sizeof(PRTime));
CopyMemory(prtm, filetime, sizeof(PRTime));
+#ifdef __GNUC__
+ *prtm = (*prtm - _pr_filetime_offset) / 10LL;
+#else
*prtm = (*prtm - _pr_filetime_offset) / 10i64;
+#endif
#ifdef DEBUG
/* Doublecheck our calculation. */
@@ -3168,7 +3176,7 @@ _PR_MD_RENAME(const char *from, const char *to)
}
PRInt32
-_PR_MD_ACCESS(const char *name, PRIntn how)
+_PR_MD_ACCESS(const char *name, PRAccessHow how)
{
PRInt32 rv;
diff --git a/pr/src/md/windows/ntmisc.c b/pr/src/md/windows/ntmisc.c
index 41535e83..32a199ce 100644
--- a/pr/src/md/windows/ntmisc.c
+++ b/pr/src/md/windows/ntmisc.c
@@ -786,7 +786,7 @@ PRInt32 _PR_MD_ATOMIC_DECREMENT(PRInt32 *val)
PRInt32 result;
asm volatile ("lock ; xadd %0, %1"
: "=r"(result), "=m"(*val)
- : "0"(1), "m"(*val));
+ : "0"(-1), "m"(*val));
//asm volatile("lock ; xadd %0, %1" : "=m" (val), "=a" (result) : "-1" (1));
return result - 1;
#else
@@ -808,8 +808,8 @@ PRInt32 _PR_MD_ATOMIC_ADD(PRInt32 *intp, PRInt32 val)
PRInt32 result;
//asm volatile("lock ; xadd %1, %0" : "=m" (intp), "=a" (result) : "1" (val));
asm volatile ("lock ; xadd %0, %1"
- : "=r"(result), "=m"(intp)
- : "0"(val), "m"(intp));
+ : "=r"(result), "=m"(*intp)
+ : "0"(val), "m"(*intp));
return result + val;
#else
__asm
diff --git a/pr/tests/Makefile.in b/pr/tests/Makefile.in
index 64870a06..a2def4c3 100644
--- a/pr/tests/Makefile.in
+++ b/pr/tests/Makefile.in
@@ -217,10 +217,15 @@ TARGETS = $(PROGS)
INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
ifeq ($(OS_ARCH), WINNT)
+ifdef NS_USE_GCC
+ EXTRA_LIBS += -lws2_32
+else
+ EXTRA_LIBS += wsock32.lib
LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
ifdef PROFILE
LDOPTS += -PROFILE -MAP
endif # profile
+endif # NS_USE_GCC
endif
ifeq ($(OS_ARCH),OS2)
@@ -478,8 +483,8 @@ else
$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
@$(MAKE_OBJDIR)
-ifeq ($(OS_ARCH), WINNT)
- link $(LDOPTS) $(EXTRA_LDOPTS) $< $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) wsock32.lib -out:$@
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
+ link $(LDOPTS) $(EXTRA_LDOPTS) $< $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -out:$@
else
ifeq ($(OS_ARCH),OS2)
$(LD) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBNSPR) $(OS_LIBS) $(EXTRA_LIBS)
diff --git a/pr/tests/dll/Makefile.in b/pr/tests/dll/Makefile.in
index cd0cca6e..38ad5b8e 100644
--- a/pr/tests/dll/Makefile.in
+++ b/pr/tests/dll/Makefile.in
@@ -64,7 +64,11 @@ ifeq ($(OS_ARCH), WINNT)
ifeq ($(OS_TARGET), WIN16)
# do nothing
else
+ifdef NS_USE_GCC
+DLLBASE=-Wl,--image-base -Wl,0x30000000
+else
DLLBASE=/BASE:0x30000000
+endif
RES=$(OBJDIR)/my.res
RESNAME=../../../pr/src/nspr.rc
endif
diff --git a/pr/tests/runtests.ksh b/pr/tests/runtests.ksh
index c4d027ad..aecd42ab 100755
--- a/pr/tests/runtests.ksh
+++ b/pr/tests/runtests.ksh
@@ -254,7 +254,7 @@ else
fi
wait $test_pid
test_rval=$?
- [ sleep_pid -eq 0 ] || kill $sleep_pid >/dev/null 2>&1
+ [ $sleep_pid -eq 0 ] || kill $sleep_pid >/dev/null 2>&1
if [ 0 = $test_rval ] ; then
echo "\t\t\tPassed";
else