Initial OS/2 nspr autoconf support. Bug #58804 NSPRPUB_CLIENT_BRANCH
authorcls%seawood.org
Fri, 23 Feb 2001 06:44:40 +0000
branchNSPRPUB_CLIENT_BRANCH
changeset 1735 e8037ace99488ab1f461561443a110930b645493
parent 1734 3494fedc2fb4a4c14a73a13c32e460da0be4f8f4
child 1736 368eea7e2693b451dd5e9ecb5d802a67a82c62ee
push idunknown
push userunknown
push dateunknown
bugs58804
Initial OS/2 nspr autoconf support. Bug #58804 Thanks to "Javier H Pedemonte" <pedemont@us.ibm.com> for the patch.
build/autoconf/config.guess
build/autoconf/config.sub
config/Makefile.in
config/autoconf.mk.in
config/rules.mk
configure
configure.in
pr/src/md/os2/Makefile.in
--- a/build/autoconf/config.guess
+++ b/build/autoconf/config.guess
@@ -1189,21 +1189,23 @@ EOF
 	# operating systems.
 	if test "$cputype" = "386"; then
 	    UNAME_MACHINE=i386
 	else
 	    UNAME_MACHINE="$cputype"
 	fi
 	echo ${UNAME_MACHINE}-unknown-plan9
 	exit 0 ;;
-    i?86:OS/2:*:*)
-	# If we were able to find `uname', then EMX Unix compatibility
-	# is probably installed.
-	echo ${UNAME_MACHINE}-pc-os2-emx
-	exit 0 ;;
+    *:OS/2:*:*)
+	if test "$VACPP" = "yes"; then
+		echo "i386-pc-os2_vacpp"
+	else
+		echo "i386-pc-os2_emx"
+	fi
+    exit 0;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
 
 cat >$dummy.c <<EOF
 #ifdef _SEQUENT_
 # include <sys/types.h>
--- a/build/autoconf/config.sub
+++ b/build/autoconf/config.sub
@@ -990,16 +990,20 @@ case $os in
 		os=-sysv4
 		;;
 	-unixware*)
 		os=-sysv4.2uw
 		;;
 	-gnu/linux*)
 		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
 		;;
+	-os2_emx)
+		;;
+	-os2_vacpp)
+		;;
 	# First accept the basic system types.
 	# The portable systems comes first.
 	# Each alternative MUST END IN A *, to match a version number.
 	# -sysv* is not here because it comes later, after sysvr4.
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
 	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -85,20 +85,16 @@ XLDOPTS = -Zlinker /PM:VIO
 endif
 endif
 
 ifeq ($(MOZ_OS2_TOOLS),PGCC)
 XCFLAGS = $(OS_EXE_CFLAGS)
 XLDOPTS = -Zlinker /PM:VIO
 endif
 
-ifeq ($(MOZ_OS2_TOOLS),VACPP)
-OS_CFLAGS = $(OS_EXE_CFLAGS)
-endif
-
 include $(topsrcdir)/config/rules.mk
 
 PROGS	= $(OBJDIR)/now$(PROG_SUFFIX)
 
 ifeq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
 TARGETS = $(PROGS)
 else
 PROGS	+= $(OBJDIR)/nsinstall$(PROG_SUFFIX)
@@ -115,12 +111,12 @@ define MAKE_OBJDIR
 if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); else true; fi
 endef
 
 export:: $(TARGETS)
 
 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
 	@$(MAKE_OBJDIR)
 ifeq ($(MOZ_OS2_TOOLS),VACPP)
-	$(LINK) $(EXEFLAGS) $<
+	$(LD) $(EXEFLAGS) $<
 else
 	$(CC) $(XCFLAGS) $< $(XLDOPTS) $(OUTOPTION)$@
 endif
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -40,23 +40,26 @@ AR_FLAGS	= @AR_FLAGS@
 LD		= @LD@
 RANLIB		= @RANLIB@
 PERL		= @PERL@
 DLLTOOL		= @DLLTOOL@
 WINDRES		= @WINDRES@
 RC		= @RC@
 STRIP		= @STRIP@
 NSINSTALL	= @NSINSTALL@
+FILTER		= @FILTER@
+IMPLIB		= @IMPLIB@
 
 OS_CFLAGS	= @CFLAGS@ $(DSO_CFLAGS)
 OS_CXXFLAGS	= @CXXFLAGS@ $(DSO_CFLAGS)
 OS_LIBS         = @OS_LIBS@
 OS_LDFLAGS	= @LDFLAGS@
 OS_DLLFLAGS	= @OS_DLLFLAGS@
 DLLFLAGS	= @DLLFLAGS@
+EXEFLAGS  = @EXEFLAGS@
 OPTIMIZER	= @OPTIMIZER@
 
 MKSHLIB		= @MKSHLIB@
 DSO_CFLAGS	= @DSO_CFLAGS@
 DSO_LDOPTS	= @DSO_LDOPTS@
 
 RESOLVE_LINK_SYMBOLS = @RESOLVE_LINK_SYMBOLS@
 
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -270,17 +270,17 @@ endif
 ifdef BUILD_OPT
 	$(STRIP) $@
 endif
 
 $(LIBRARY): $(OBJS)
 	@$(MAKE_OBJDIR)
 	rm -f $@
 ifeq ($(MOZ_OS2_TOOLS),VACPP)
-	$(AR) $(subst /,\\,$(OBJS)) $(AR_EXTRA_ARGS)
+	$(AR) $(subst /,\\,$(OBJS)) $(AR_FLAGS)
 else
 ifdef USE_AUTOCONF
 	$(AR) $(AR_FLAGS) $(OBJS) $(AR_EXTRA_ARGS)
 else
 	$(AR) $(OBJS) $(AR_EXTRA_ARGS)
 endif # USE_AUTOCONF
 endif
 	$(RANLIB) $@
--- a/configure
+++ b/configure
@@ -2429,17 +2429,17 @@ if test "$OS_ARCH" = "WIN95"; then
     OS_ARCH=WINNT
     OS_TARGET=WIN95
 elif test "$OS_ARCH" = 'Windows_95'; then
     OS_ARCH=Windows_NT
     OS_TARGET=WIN95
 elif test "$OS_ARCH" = "CYGWIN_95-4.0"; then
     OS_ARCH='CYGWIN_NT-4.0'
     OS_TARGET=WIN95
-elif test "$OS_ARCH" = "OS2"; then
+elif test "$OS_ARCH" = "OS_2"; then
     OS_ARCH=OS2
     OS_TARGET=OS2
 fi
 
 #
 # On WIN32, we also define the variable CPU_ARCH.
 #
 
@@ -2523,16 +2523,18 @@ OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
 
 
 case "$host" in
 *-mingw*|*-cygwin*|*-msvc*)
     ;;
 *-beos*)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
     ;;
+*os2*)
+    ;;
 *)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
     ;;
 esac
 
 case "$target" in
 
 *-aix*)
@@ -4003,38 +4005,137 @@ EOF
 #define _PR_HAVE_SOCKADDR_LEN 1
 EOF
 
     fi
     DSO_LDOPTS=-G
     CPU_ARCH=x86
     ;;
 
+*-os2*)
+    cat >> confdefs.h <<\EOF
+#define XP_OS2 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define BSD_SELECT 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define XP_PC 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define _PR_GLOBAL_THREADS_ONLY 1
+EOF
+
+    OBJ_SUFFIX=obj
+    LIB_SUFFIX=lib
+    DLL_SUFFIX=dll
+    DLLTOOL=''
+    RC=rc.exe
+    PR_MD_ARCH_DIR=os2
+    PROG_SUFFIX=.exe
+    NSINSTALL=nsinstall
+
+    case "$target" in
+    *-os2_emx)
+        cat >> confdefs.h <<\EOF
+#define XP_OS2_EMX 1
+EOF
+
+        cat >> confdefs.h <<\EOF
+#define OS2 1
+EOF
+
+        AR=emxomfar
+        AR_FLAGS='-p256 r $@'
+        CFLAGS="-Zmtd -Zomf"
+        HOST_CFLAGS="$CFLAGS"
+        CXXFLAGS="-Zmtd -Zomf"
+        OS_LIBS="-lsocket -lemxio"
+        LD='$(CC)'
+        IMPLIB='emximp -o'
+        FILTER='emxexp'
+        _OPTIMIZE_FLAGS=-O3
+        _DEBUG_FLAGS=-g
+        if test -n "$MOZ_DEBUG"; then
+          DLLFLAGS='-g'
+          EXEFLAGS='-g $(OMF_FLAG) -Zmtd -L$(DIST)/lib -o $@'
+        else
+          DLLFLAGS=
+          EXEFLAGS='-Zmtd -o $@'
+        fi
+        ;;
+    *-os2_vacpp)
+        cat >> confdefs.h <<\EOF
+#define XP_OS2_VACPP 1
+EOF
+
+        cat >> confdefs.h <<\EOF
+#define OS2 4
+EOF
+
+        cat >> confdefs.h <<\EOF
+#define TCPV40HDRS 1
+EOF
+
+        cat >> confdefs.h <<\EOF
+#define _X86_ 1
+EOF
+
+        AR=-ilib
+        AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
+        CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl-'
+        HOST_CFLAGS="$CFLAGS"
+        OS_CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Ge- /Tl-'
+        OS_EXE_CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Ge+ /Tl-'
+        CXXFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl-'
+        OS_LIBS='so32dll.lib tcp32dll.lib'
+        LD='-ilink'
+        LDFLAGS='/FREE /DE /NOE /LINENUMBERS /nologo'
+        MKSHLIB='$(LD) $(DSO_LDOPTS)'
+        IMPLIB='implib -nologo -noignorecase'
+        FILTER='cppfilt -q -B -P'
+        _OPTIMIZE_FLAGS=/O+
+        _DEBUG_FLAGS=/Ti+ 
+        if test -n "$MOZ_DEBUG"; then
+          DLLFLAGS='/O:$@ /DLL /INC:_dllentry /MAP:$(@:.dll=.map) /nologo /DEBUG /NOE'
+          EXEFLAGS='/OUT:$@ /PMTYPE:VIO /MAP:$(@:.exe=.map) /nologo /DEBUG /NOE'
+        else
+          DLLFLAGS='/O:$@ /DLL /INC:_dllentry /MAP:$(@:.dll=.map) /nologo'
+          EXEFLAGS='/OUT:$@ /PMTYPE:VIO /MAP:$(@:.exe=.map) /nologo'
+        fi
+        ;;
+    esac
+
+    ;;
+
 *)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     ;;
    
 esac
 
 if test "$enable_shared" = no; then
     MKSHLIB=
 fi
 
 if test -z "$SKIP_LIBRARY_CHECKS"; then
 
 echo $ac_n "checking for dlopen""... $ac_c" 1>&6
-echo "configure:4028: checking for dlopen" >&5
+echo "configure:4129: 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 4033 "configure"
+#line 4134 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dlopen(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
 char dlopen();
@@ -4047,17 +4148,17 @@ int main() {
 #if defined (__stub_dlopen) || defined (__stub___dlopen)
 choke me
 #else
 dlopen();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:4056: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4157: \"$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
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_func_dlopen=no"
 fi
@@ -4066,36 +4167,36 @@ fi
 
 if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   :
 else
   echo "$ac_t""no" 1>&6
 
     echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:4075: checking for dlopen in -ldl" >&5
+echo "configure:4176: 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
 else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4083 "configure"
+#line 4184 "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
     builtin and then its argument prototype would still apply.  */
 char dlopen();
 
 int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:4094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4195: \"$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
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=no"
 fi
@@ -4112,72 +4213,72 @@ fi
 
 
 fi
 
 
 
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:4121: checking how to run the C preprocessor" >&5
+echo "configure:4222: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
 if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     # This must be in double quotes, not single quotes, because CPP may get
   # substituted into the Makefile and "${CC-cc}" will confuse make.
   CPP="${CC-cc} -E"
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 4136 "configure"
+#line 4237 "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:4142: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4243: \"$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
   :
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 4153 "configure"
+#line 4254 "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:4159: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4260: \"$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
   :
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 4170 "configure"
+#line 4271 "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:4176: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4277: \"$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
   :
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
@@ -4193,23 +4294,23 @@ fi
   CPP="$ac_cv_prog_CPP"
 else
   ac_cv_prog_CPP="$CPP"
 fi
 echo "$ac_t""$CPP" 1>&6
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:4202: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:4303: 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 4208 "configure"
+#line 4309 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "$ac_pattern" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_prog_gcc_traditional=yes
@@ -4217,17 +4318,17 @@ else
   rm -rf conftest*
   ac_cv_prog_gcc_traditional=no
 fi
 rm -f conftest*
 
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 4226 "configure"
+#line 4327 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "$ac_pattern" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_prog_gcc_traditional=yes
@@ -4241,22 +4342,22 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional
   if test $ac_cv_prog_gcc_traditional = yes; then
     CC="$CC -traditional"
   fi
 fi
 
 for ac_func in lchown strerror
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4250: checking for $ac_func" >&5
+echo "configure:4351: 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 4255 "configure"
+#line 4356 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
 char $ac_func();
@@ -4269,17 +4370,17 @@ int main() {
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
 $ac_func();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:4278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4379: \"$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
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=no"
 fi
@@ -4300,17 +4401,17 @@ done
 
 
 
 
 
 
 
 echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:4309: checking for pthread_create in -lpthreads" >&5
+echo "configure:4410: checking for pthread_create in -lpthreads" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { int a = 1;  } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -4322,17 +4423,17 @@ echo "
     rm -f dummy.c dummy${ac_exeext} ;
     if test "$_res" = "0"; then
         echo "$ac_t""yes" 1>&6
         _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads"
     else
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:4331: checking for pthread_create in -lpthread" >&5
+echo "configure:4432: checking for pthread_create in -lpthread" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { int a = 1;  } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -4344,17 +4445,17 @@ echo "
     rm -f dummy.c dummy${ac_exeext} ;
     if test "$_res" = "0"; then
         echo "$ac_t""yes" 1>&6
         _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread"
     else
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:4353: checking for pthread_create in -lc_r" >&5
+echo "configure:4454: checking for pthread_create in -lc_r" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { int a = 1;  } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -4366,17 +4467,17 @@ echo "
     rm -f dummy.c dummy${ac_exeext} ;
     if test "$_res" = "0"; then
         echo "$ac_t""yes" 1>&6
         _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r"
     else
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
-echo "configure:4375: checking for pthread_create in -lc" >&5
+echo "configure:4476: checking for pthread_create in -lc" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { int a = 1;  } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -4516,33 +4617,33 @@ EOF
     fi
 fi
 
 
 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:4525: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:4626: 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
 	if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
 	    ac_cv_have_dash_pthread=yes
 	    CFLAGS="$CFLAGS -pthread"
 	    CXXFLAGS="$CXXFLAGS -pthread"
 	fi
     fi
     rm -f conftest*
     echo "$ac_t""$ac_cv_have_dash_pthread" 1>&6
 
 			    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:4541: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:4642: 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
 	    	if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
 			    ac_cv_have_dash_pthreads=yes
 			    CFLAGS="$CFLAGS -pthreads"
 			    CXXFLAGS="$CXXFLAGS -pthreads"
 		    fi
@@ -4781,16 +4882,19 @@ fi
 
 
 
 
 
 
 
 
+
+
+
 MAKEFILES="
 Makefile 
 config/Makefile
 config/autoconf.mk
 config/nsprincl.mk
 config/nsprincl.sh
 lib/Makefile 
 lib/ds/Makefile 
@@ -5031,30 +5135,33 @@ s%@DSO_CFLAGS@%$DSO_CFLAGS%g
 s%@DSO_LDOPTS@%$DSO_LDOPTS%g
 s%@OS_TARGET@%$OS_TARGET%g
 s%@OS_ARCH@%$OS_ARCH%g
 s%@OS_RELEASE@%$OS_RELEASE%g
 s%@OS_TEST@%$OS_TEST%g
 s%@DEFINES@%$DEFINES%g
 s%@AR_FLAGS@%$AR_FLAGS%g
 s%@ASFLAGS@%$ASFLAGS%g
+s%@FILTER@%$FILTER%g
+s%@IMPLIB@%$IMPLIB%g
 s%@OS_LIBS@%$OS_LIBS%g
 s%@RESOLVE_LINK_SYMBOLS@%$RESOLVE_LINK_SYMBOLS%g
 s%@AIX_LINK_OPTS@%$AIX_LINK_OPTS%g
 s%@NOSUCHFILE@%$NOSUCHFILE%g
 s%@MOZ_OBJFORMAT@%$MOZ_OBJFORMAT%g
 s%@ULTRASPARC_LIBRARY@%$ULTRASPARC_LIBRARY%g
 s%@ULTRASPARC_FILTER_LIBRARY@%$ULTRASPARC_FILTER_LIBRARY%g
 s%@OBJDIR@%$OBJDIR%g
 s%@OBJDIR_NAME@%$OBJDIR_NAME%g
 s%@NSINSTALL@%$NSINSTALL%g
 s%@OPTIMIZER@%$OPTIMIZER%g
 s%@RC@%$RC%g
 s%@CPU_ARCH_TAG@%$CPU_ARCH_TAG%g
 s%@DLLFLAGS@%$DLLFLAGS%g
+s%@EXEFLAGS@%$EXEFLAGS%g
 s%@OS_DLLFLAGS@%$OS_DLLFLAGS%g
 
 CEOF
 EOF
 
 cat >> $CONFIG_STATUS <<\EOF
 
 # Split the substitutions into bite-sized pieces for seds with
--- a/configure.in
+++ b/configure.in
@@ -351,17 +351,17 @@ if test "$OS_ARCH" = "WIN95"; then
     OS_ARCH=WINNT
     OS_TARGET=WIN95
 elif test "$OS_ARCH" = 'Windows_95'; then
     OS_ARCH=Windows_NT
     OS_TARGET=WIN95
 elif test "$OS_ARCH" = "CYGWIN_95-4.0"; then
     OS_ARCH='CYGWIN_NT-4.0'
     OS_TARGET=WIN95
-elif test "$OS_ARCH" = "OS2"; then
+elif test "$OS_ARCH" = "OS_2"; then
     OS_ARCH=OS2
     OS_TARGET=OS2
 fi
 
 #
 # On WIN32, we also define the variable CPU_ARCH.
 #
 
@@ -449,16 +449,18 @@ dnl ====================================
 dnl Override of system specific host options
 dnl ========================================================
 case "$host" in
 *-mingw*|*-cygwin*|*-msvc*)
     ;;
 *-beos*)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
     ;;
+*os2*)
+    ;;
 *)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
     ;;
 esac
 
 dnl ========================================================
 dnl Override of system specific target options
 dnl ========================================================
@@ -1359,16 +1361,85 @@ mips-sony-newsos*)
         AC_DEFINE(_LARGEFILE64_SOURCE)
         AC_DEFINE(_PR_HAVE_OFF64_T)
         AC_DEFINE(_PR_HAVE_SOCKADDR_LEN)
     fi
     DSO_LDOPTS=-G
     CPU_ARCH=x86
     ;;
 
+*-os2*)
+    AC_DEFINE(XP_OS2)
+    AC_DEFINE(BSD_SELECT)
+    AC_DEFINE(XP_PC)
+    AC_DEFINE(_PR_GLOBAL_THREADS_ONLY)
+    OBJ_SUFFIX=obj
+    LIB_SUFFIX=lib
+    DLL_SUFFIX=dll
+    DLLTOOL=''
+    RC=rc.exe
+    PR_MD_ARCH_DIR=os2
+    PROG_SUFFIX=.exe
+    NSINSTALL=nsinstall
+
+    case "$target" in
+    *-os2_emx)
+        AC_DEFINE(XP_OS2_EMX)
+        AC_DEFINE(OS2)
+        AR=emxomfar
+        AR_FLAGS='-p256 r $@'
+        CFLAGS="-Zmtd -Zomf"
+        HOST_CFLAGS="$CFLAGS"
+        CXXFLAGS="-Zmtd -Zomf"
+        OS_LIBS="-lsocket -lemxio"
+        LD='$(CC)'
+        IMPLIB='emximp -o'
+        FILTER='emxexp'
+        _OPTIMIZE_FLAGS=-O3
+        _DEBUG_FLAGS=-g
+        if test -n "$MOZ_DEBUG"; then
+          DLLFLAGS='-g'
+          EXEFLAGS='-g $(OMF_FLAG) -Zmtd -L$(DIST)/lib -o $@'
+        else
+          DLLFLAGS=
+          EXEFLAGS='-Zmtd -o $@'
+        fi
+        ;;
+    *-os2_vacpp)
+        AC_DEFINE(XP_OS2_VACPP)
+        AC_DEFINE(OS2,4)
+        AC_DEFINE(TCPV40HDRS)
+        AC_DEFINE(_X86_)
+        AR=-ilib
+        AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
+        CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl-'
+        HOST_CFLAGS="$CFLAGS"
+        OS_CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Ge- /Tl-'
+        OS_EXE_CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Ge+ /Tl-'
+        CXXFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl-'
+        OS_LIBS='so32dll.lib tcp32dll.lib'
+        LD='-ilink'
+        LDFLAGS='/FREE /DE /NOE /LINENUMBERS /nologo'
+        MKSHLIB='$(LD) $(DSO_LDOPTS)'
+        IMPLIB='implib -nologo -noignorecase'
+        FILTER='cppfilt -q -B -P'
+        _OPTIMIZE_FLAGS=/O+
+        _DEBUG_FLAGS=/Ti+ 
+        if test -n "$MOZ_DEBUG"; then
+          DLLFLAGS='/O:$@ /DLL /INC:_dllentry /MAP:$(@:.dll=.map) /nologo /DEBUG /NOE'
+          EXEFLAGS='/OUT:$@ /PMTYPE:VIO /MAP:$(@:.exe=.map) /nologo /DEBUG /NOE'
+        else
+          DLLFLAGS='/O:$@ /DLL /INC:_dllentry /MAP:$(@:.dll=.map) /nologo'
+          EXEFLAGS='/OUT:$@ /PMTYPE:VIO /MAP:$(@:.exe=.map) /nologo'
+        fi
+        ;;
+    esac
+
+    ;;
+
 *)
     AC_DEFINE(XP_UNIX)
     ;;
    
 esac
 
 dnl Turn off shared libraries if asked to do so.
 if test "$enable_shared" = no; then
@@ -1786,32 +1857,35 @@ 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)
+AC_SUBST(FILTER)
+AC_SUBST(IMPLIB)
 
 AC_SUBST(OS_LIBS)
 AC_SUBST(RESOLVE_LINK_SYMBOLS)
 AC_SUBST(AIX_LINK_OPTS)
 AC_SUBST(NOSUCHFILE)
 AC_SUBST(MOZ_OBJFORMAT)
 AC_SUBST(ULTRASPARC_LIBRARY)
 AC_SUBST(ULTRASPARC_FILTER_LIBRARY)
 
 AC_SUBST(OBJDIR)
 AC_SUBST(OBJDIR_NAME)
 AC_SUBST(NSINSTALL)
 AC_SUBST(OPTIMIZER)
 AC_SUBST(RC)
 AC_SUBST(CPU_ARCH_TAG)
 AC_SUBST(DLLFLAGS)
+AC_SUBST(EXEFLAGS)
 AC_SUBST(OS_DLLFLAGS)
 
 dnl ========================================================
 dnl Generate output files.
 dnl ========================================================
 MAKEFILES="
 Makefile 
 config/Makefile
--- a/pr/src/md/os2/Makefile.in
+++ b/pr/src/md/os2/Makefile.in
@@ -39,17 +39,17 @@ CSRCS = \
     os2_errors.c \
     os2poll.c \
     os2rng.c \
     $(NULL)
 endif
 
 TARGETS	= $(OBJS)
 
-INCLUDES = -I$(includedir) -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private
+INCLUDES = -I$(includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 DEFINES	+= -D_NSPR_BUILD_
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(TARGETS)