fi
 
 if test "$USE_OS2" = "1"; then
+    DEFAULT_wxUSE_OMF=no
 
          enablestring=
           echo "$as_me:$LINENO: checking for --${enablestring:-enable}-omf" >&5
       else
                     RESPROGRAMOBJ="\${top_srcdir}/include/wx/os2/wx.res"
       fi
-                                    echo "$as_me:$LINENO: checking for gcc version" >&5
-echo $ECHO_N "checking for gcc version... $ECHO_C" >&6
+                                    echo "$as_me:$LINENO: checking for gcc/libc version" >&5
+echo $ECHO_N "checking for gcc/libc version... $ECHO_C" >&6
 if test "${wx_cv_gccversion+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 echo "$as_me: WARNING: Building DLLs requires OMF mode, enabled" >&2;}
         wxUSE_OMF=yes
        enable_omf=yes
-      fi
-      if test "$wxUSE_OMF" = "yes"; then
-        LDFLAGS="$LDFLAGS -Zomf -Zlinker /EXEPACK -Zlinker /PMTYPE:PM"
       fi
         ;;
   *)
   done
 
                 if test "$ac_find_libraries" != "" ; then
+                    echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
 
   echo "$LDFLAGS" | grep "\-L$ac_find_libraries" > /dev/null
   result=$?
                         LDFLAGS_GL="$ac_path_to_link"
                     fi
 
+                                                                                echo "$as_me:$LINENO: checking for -lGLU" >&5
+echo $ECHO_N "checking for -lGLU... $ECHO_C" >&6
 
 ac_find_libraries=
 for ac_dir in $SEARCH_LIB /usr/lib;
                         OPENGL_LIBS="-lGL -lGLU"
                         echo "$as_me:$LINENO: result: yes" >&5
 echo "${ECHO_T}yes" >&6
+                    else
+                        echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
                     fi
+                else
+                    echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
                 fi
 
                 if test "$found_gl" != 1; then
-                    echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
                     echo "$as_me:$LINENO: checking for -lMesaGL" >&5
 echo $ECHO_N "checking for -lMesaGL... $ECHO_C" >&6
 
         EXE_LINKER="$CXX -o"
 
 fi
+if test "$wxUSE_OMF" = "yes"; then
+    case "${host}" in
+      *-pc-os2_emx | *-pc-os2-emx )
+        LDFLAGS="$LDFLAGS -Zlinker /EXEPACK"
+        LDFLAGS_GUI="-Zlinker /PMTYPE:PM"
+        WXCONFIG_LDFLAGS_GUI="-Zlinker /PMTYPE:PM"
+      ;;
+    esac
+fi
 
 GCC_PRAGMA_FLAGS=""
 PCH_FLAGS=""
 
                 AC_MSG_CHECKING([for -lGL])
                 WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],GL)
                 if test "$ac_find_libraries" != "" ; then
+                    AC_MSG_RESULT([yes])
+
                     WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
                     if test "$ac_path_to_link" != " -L/usr/lib" ; then
                         LDFLAGS_GL="$ac_path_to_link"
                     dnl don't suppose that libGL and libGLU are always in the
                     dnl same directory -- this is not true for some common
                     dnl distributions
+                    AC_MSG_CHECKING([for -lGLU])
                     WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],GLU)
                     if test "$ac_find_libraries" != "" ; then
                         WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
                         found_gl=1
                         OPENGL_LIBS="-lGL -lGLU"
                         AC_MSG_RESULT([yes])
+                    else
+                        AC_MSG_RESULT([no])
                     fi
+                else
+                    AC_MSG_RESULT([no])
                 fi
 
                 if test "$found_gl" != 1; then
-                    AC_MSG_RESULT([no])
                     AC_MSG_CHECKING([for -lMesaGL])
                     WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],MesaGL)
                     if test "$ac_find_libraries" != "" ; then