Instrument winegcc to use the compilers and options detected at
configure time. Add support for parsing/formatting a string array
from/to a char string. Add option to disable short wchar support in
winegcc.

diff --git a/Make.rules.in b/Make.rules.in
index b6d36de..f38c990 100644
--- a/Make.rules.in
+++ b/Make.rules.in
@@ -35,7 +35,6 @@
 DLLEXT    = @DLLEXT@
 IMPLIBEXT = @IMPLIBEXT@
 LDSHARED  = @LDSHARED@
-LDDLL     = @LDDLL@
 DLLTOOL   = @DLLTOOL@
 DLLWRAP   = @DLLWRAP@
 AR        = @AR@ rc
@@ -53,6 +52,8 @@
 MV        = mv
 LINT      = @LINT@
 LINTFLAGS = @LINTFLAGS@
+LDDLLFLAGS   = @LDDLLFLAGS@
+LDDLL        = $(CC) $(LDDLLFLAGS)
 INCLUDES     = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
 EXTRACFLAGS  = @EXTRACFLAGS@
 ALLCFLAGS    = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS)
diff --git a/configure b/configure
index 4cfb1c4..984e26c 100755
--- a/configure
+++ b/configure
@@ -311,7 +311,7 @@
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS WIN16_FILES WIN16_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP TOOLSDIR X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS YACC LEX LEXLIB LEX_OUTPUT_ROOT XYACC XLEX AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES LN_S LN LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS DB2HTML DB2PDF DB2PS DB2TXT LIBPTHREAD JPEGLIB EGREP GIFLIB XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS GLUT_LIBS GLUT32FILES NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ICULIBS ft_devel ft_devel2 FREETYPEINCL ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS CAPI4LINUXLIBS EXTRACFLAGS DLLEXT DLLFLAGS DLLIBS LDSHARED LDDLL LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP LDEXECFLAGS CROSSTEST CROSSCC CROSSWINDRES LDPATH CRTLIBS WINE_BINARIES MAIN_BINARY LDD ALLOCA LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS WIN16_FILES WIN16_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPP TOOLSDIR X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS YACC LEX LEXLIB LEX_OUTPUT_ROOT XYACC XLEX AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES LN_S LN LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS DB2HTML DB2PDF DB2PS DB2TXT LIBPTHREAD JPEGLIB EGREP GIFLIB XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS GLUT_LIBS GLUT32FILES NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ICULIBS ft_devel ft_devel2 FREETYPEINCL ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS CAPI4LINUXLIBS EXTRACFLAGS DLLEXT DLLFLAGS DLLIBS LDSHARED LDDLLFLAGS LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP LDEXECFLAGS CROSSTEST CROSSCC CROSSWINDRES LDPATH CRTLIBS WINE_BINARIES MAIN_BINARY LDD ALLOCA LIBOBJS LTLIBOBJS'
 ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_LIB_RULES MAKE_PROG_RULES'
 
 # Initialize some variables set by options.
@@ -768,6 +768,14 @@
 ac_env_CPPFLAGS_value=$CPPFLAGS
 ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
 ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CXX_set=${CXX+set}
+ac_env_CXX_value=$CXX
+ac_cv_env_CXX_set=${CXX+set}
+ac_cv_env_CXX_value=$CXX
+ac_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_env_CXXFLAGS_value=$CXXFLAGS
+ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_cv_env_CXXFLAGS_value=$CXXFLAGS
 ac_env_CPP_set=${CPP+set}
 ac_env_CPP_value=$CPP
 ac_cv_env_CPP_set=${CPP+set}
@@ -871,6 +879,8 @@
               nonstandard directory <lib dir>
   CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
               headers in a nonstandard directory <include dir>
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
   CPP         C preprocessor
 
 Use these variables to override the choices made by `configure' or to help
@@ -2421,6 +2431,423 @@
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CXX" && break
+done
+test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
+
+  CXX=$ac_ct_CXX
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+CXXFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cxx_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cxx_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+# Extract the first word of ""cpp"", so it can be a program name with args.
+set dummy "cpp"; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CPP"; then
+  ac_cv_prog_CPP="$CPP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CPP=""cpp""
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CPP=$ac_cv_prog_CPP
+if test -n "$CPP"; then
+  echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+echo "$as_me:$LINENO: checking for the directory containing the Wine tools" >&5
+echo $ECHO_N "checking for the directory containing the Wine tools... $ECHO_C" >&6
+if test "${wine_cv_toolsdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$with_wine_tools"; then
+     if test "$cross_compiling" = "yes"; then
+       { { echo "$as_me:$LINENO: error: you must use the --with-wine-tools option when cross-compiling." >&5
+echo "$as_me: error: you must use the --with-wine-tools option when cross-compiling." >&2;}
+   { (exit 1); exit 1; }; }
+     else
+       wine_cv_toolsdir="\$(TOPOBJDIR)"
+     fi
+   elif test -d "$with_wine_tools/tools/winebuild"; then
+     case $with_wine_tools in
+       /*) wine_cv_toolsdir="$with_wine_tools" ;;
+       *)  wine_cv_toolsdir="\$(TOPOBJDIR)/$with_wine_tools" ;;
+     esac
+   else
+     { { echo "$as_me:$LINENO: error: could not find Wine tools in $with_wine_tools." >&5
+echo "$as_me: error: could not find Wine tools in $with_wine_tools." >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+fi
+echo "$as_me:$LINENO: result: $wine_cv_toolsdir" >&5
+echo "${ECHO_T}$wine_cv_toolsdir" >&6
+TOOLSDIR=$wine_cv_toolsdir
+
+
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2656,37 +3083,6 @@
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-echo "$as_me:$LINENO: checking for the directory containing the Wine tools" >&5
-echo $ECHO_N "checking for the directory containing the Wine tools... $ECHO_C" >&6
-if test "${wine_cv_toolsdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -z "$with_wine_tools"; then
-     if test "$cross_compiling" = "yes"; then
-       { { echo "$as_me:$LINENO: error: you must use the --with-wine-tools option when cross-compiling." >&5
-echo "$as_me: error: you must use the --with-wine-tools option when cross-compiling." >&2;}
-   { (exit 1); exit 1; }; }
-     else
-       wine_cv_toolsdir="\$(TOPOBJDIR)"
-     fi
-   elif test -d "$with_wine_tools/tools/winebuild"; then
-     case $with_wine_tools in
-       /*) wine_cv_toolsdir="$with_wine_tools" ;;
-       *)  wine_cv_toolsdir="\$(TOPOBJDIR)/$with_wine_tools" ;;
-     esac
-   else
-     { { echo "$as_me:$LINENO: error: could not find Wine tools in $with_wine_tools." >&5
-echo "$as_me: error: could not find Wine tools in $with_wine_tools." >&2;}
-   { (exit 1); exit 1; }; }
-   fi
-fi
-echo "$as_me:$LINENO: result: $wine_cv_toolsdir" >&5
-echo "${ECHO_T}$wine_cv_toolsdir" >&6
-TOOLSDIR=$wine_cv_toolsdir
-
-
-
-
 echo "$as_me:$LINENO: checking for X" >&5
 echo $ECHO_N "checking for X... $ECHO_C" >&6
 
@@ -12223,6 +12619,71 @@
     EXTRACFLAGS="$EXTRACFLAGS -fno-strength-reduce"
   fi
 
+    echo "$as_me:$LINENO: checking for gcc -fshort-wchar support" >&5
+echo $ECHO_N "checking for gcc -fshort-wchar support... $ECHO_C" >&6
+if test "${ac_cv_c_gcc_fshort_wchar+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_wine_try_cflags_saved=$CFLAGS
+CFLAGS="$CFLAGS -fshort-wchar"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_c_gcc_fshort_wchar="yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_gcc_fshort_wchar="no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+CFLAGS=$ac_wine_try_cflags_saved
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_gcc_fshort_wchar" >&5
+echo "${ECHO_T}$ac_cv_c_gcc_fshort_wchar" >&6
+  if test "$ac_cv_c_gcc_fshort_wchar" = "yes"
+  then
+
+cat >>confdefs.h <<\_ACEOF
+#define CC_FLAG_SHORT_WCHAR "-fshort-wchar"
+_ACEOF
+
+  fi
+
     echo "$as_me:$LINENO: checking for gcc -mpreferred-stack-boundary=2 support" >&5
 echo $ECHO_N "checking for gcc -mpreferred-stack-boundary=2 support... $ECHO_C" >&6
 if test "${ac_cv_c_gcc_stack_boundary+set}" = set; then
@@ -12981,7 +13442,7 @@
 
 LDSHARED=""
 
-LDDLL=""
+LDDLLFLAGS=""
 
 LIBEXT="so"
 
@@ -13548,7 +14009,7 @@
       if test "$ac_cv_c_dll_gnuelf" = "yes"
       then
         LDSHARED="\$(CC) -shared \$(SONAME:%=-Wl,-soname,%)"
-        LDDLL="\$(CC) -shared -Wl,-Bsymbolic"
+        LDDLLFLAGS="-shared -Wl,-Bsymbolic"
         echo "$as_me:$LINENO: checking whether the linker accepts -z defs" >&5
 echo $ECHO_N "checking whether the linker accepts -z defs... $ECHO_C" >&6
 if test "${ac_cv_c_dll_zdefs+set}" = set; then
@@ -13607,7 +14068,7 @@
 echo "${ECHO_T}$ac_cv_c_dll_zdefs" >&6
         if test "$ac_cv_c_dll_zdefs" = "yes"
         then
-          LDDLL="$LDDLL,-z,defs"
+          LDDLLFLAGS="$LDDLLFLAGS,-z,defs"
         fi
 
         echo "$as_me:$LINENO: checking whether the linker accepts -init and -fini" >&5
@@ -13668,12 +14129,7 @@
 echo "${ECHO_T}$ac_cv_c_dll_init_fini" >&6
         if test "$ac_cv_c_dll_init_fini" = "yes"
         then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LINKER_INIT_FINI 1
-_ACEOF
-
-          LDDLL="$LDDLL,-init,__wine_spec_init,-fini,__wine_spec_fini"
+          LDDLLFLAGS="$LDDLLFLAGS,-init,__wine_spec_init,-fini,__wine_spec_fini"
         fi
 
         echo "$as_me:$LINENO: checking whether the linker accepts version scripts" >&5
@@ -13915,7 +14371,7 @@
         if test "$ac_cv_c_dll_unixware" = "yes"
         then
           LDSHARED="\$(CC) -Wl,-G \$(SONAME:%=-Wl,-h,%)"
-          LDDLL="\$(CC) -Wl,-G,-B,symbolic"
+          LDDLLFLAGS="-Wl,-G,-B,symbolic"
 
         else
           echo "$as_me:$LINENO: checking whether we can build a Mach-O (Mac OS X/Darwin) dll" >&5
@@ -13977,7 +14433,7 @@
           if test "$ac_cv_c_dll_macho" = "yes"
           then
             LIBEXT="dylib"
-            LDDLL="\$(CC) -bundle -flat_namespace -undefined suppress"
+            LDDLLFLAGS="-bundle -flat_namespace -undefined suppress"
             LDSHARED="\$(CC) -dynamiclib"
             CFLAGS="$CFLAGS -ffixed-r13 -no-cpp-precomp"
           fi
@@ -17074,7 +17530,6 @@
 
 
 fi
-
 echo "$as_me:$LINENO: checking for long long" >&5
 echo $ECHO_N "checking for long long... $ECHO_C" >&6
 if test "${ac_cv_type_long_long+set}" = set; then
@@ -17130,357 +17585,15 @@
 fi
 echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
 echo "${ECHO_T}$ac_cv_type_long_long" >&6
+if test $ac_cv_type_long_long = yes; then
 
-echo "$as_me:$LINENO: checking size of long long" >&5
-echo $ECHO_N "checking size of long long... $ECHO_C" >&6
-if test "${ac_cv_sizeof_long_long+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$ac_cv_type_long_long" = yes; then
-  # The cast to unsigned long works around a bug in the HP C Compiler
-  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-  # This bug is HP SR number 8606223364.
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo=`expr $ac_mid + 1`
-		    if test $ac_lo -le $ac_mid; then
-		      ac_lo= ac_hi=
-		      break
-		    fi
-		    ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_lo=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_hi=`expr '(' $ac_mid ')' - 1`
-		       if test $ac_mid -le $ac_hi; then
-			 ac_lo= ac_hi=
-			 break
-		       fi
-		       ac_mid=`expr 2 '*' $ac_mid`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo= ac_hi=
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=$ac_mid
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_long_long=$ac_lo;;
-'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (long long), 77
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; } ;;
-esac
-else
-  if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
-echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
-   { (exit 1); exit 1; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-long longval () { return (long) (sizeof (long long)); }
-unsigned long ulongval () { return (long) (sizeof (long long)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    exit (1);
-  if (((long) (sizeof (long long))) < 0)
-    {
-      long i = longval ();
-      if (i != ((long) (sizeof (long long))))
-	exit (1);
-      fprintf (f, "%ld\n", i);
-    }
-  else
-    {
-      unsigned long i = ulongval ();
-      if (i != ((long) (sizeof (long long))))
-	exit (1);
-      fprintf (f, "%lu\n", i);
-    }
-  exit (ferror (f) || fclose (f) != 0);
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_long_long=`cat conftest.val`
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (long long), 77
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-rm -f conftest.val
-else
-  ac_cv_sizeof_long_long=0
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5
-echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6
 cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+#define HAVE_LONG_LONG 1
 _ACEOF
 
 
+fi
+
 
 echo "$as_me:$LINENO: checking whether linux/input.h is for real" >&5
 echo $ECHO_N "checking whether linux/input.h is for real... $ECHO_C" >&6
@@ -19993,6 +20106,9 @@
 s,@ac_ct_CC@,$ac_ct_CC,;t t
 s,@EXEEXT@,$EXEEXT,;t t
 s,@OBJEXT@,$OBJEXT,;t t
+s,@CXX@,$CXX,;t t
+s,@CXXFLAGS@,$CXXFLAGS,;t t
+s,@ac_ct_CXX@,$ac_ct_CXX,;t t
 s,@CPP@,$CPP,;t t
 s,@TOOLSDIR@,$TOOLSDIR,;t t
 s,@X_CFLAGS@,$X_CFLAGS,;t t
@@ -20060,7 +20176,7 @@
 s,@DLLFLAGS@,$DLLFLAGS,;t t
 s,@DLLIBS@,$DLLIBS,;t t
 s,@LDSHARED@,$LDSHARED,;t t
-s,@LDDLL@,$LDDLL,;t t
+s,@LDDLLFLAGS@,$LDDLLFLAGS,;t t
 s,@LIBEXT@,$LIBEXT,;t t
 s,@IMPLIBEXT@,$IMPLIBEXT,;t t
 s,@DLLTOOL@,$DLLTOOL,;t t
diff --git a/configure.ac b/configure.ac
index d7abfdd..999b7d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,7 +41,9 @@
 AC_CANONICAL_HOST
 AC_PROG_MAKE_SET
 AC_PROG_CC
-AC_PROG_CPP
+AC_PROG_CXX
+dnl We can't use AC_PROG_CPP, it uses by default $(CC) -E
+AC_CHECK_PROG(CPP, "cpp", "cpp")
 
 AC_CACHE_CHECK([for the directory containing the Wine tools], wine_cv_toolsdir,
   [if test -z "$with_wine_tools"; then
@@ -716,6 +718,15 @@
     EXTRACFLAGS="$EXTRACFLAGS -fno-strength-reduce"
   fi
 
+  dnl Check for -fshort-wchar
+  AC_CACHE_CHECK([for gcc -fshort-wchar support], ac_cv_c_gcc_fshort_wchar,
+      [WINE_TRY_CFLAGS([-fshort-wchar],
+                      ac_cv_c_gcc_fshort_wchar="yes",ac_cv_c_gcc_fshort_wchar="no")])
+  if test "$ac_cv_c_gcc_fshort_wchar" = "yes"
+  then
+      AC_DEFINE(CC_FLAG_SHORT_WCHAR, "-fshort-wchar", [Specifies the compiler flag that forces a short wchar_t])
+  fi
+
   dnl Check for -mpreferred-stack-boundary
   AC_CACHE_CHECK([for gcc -mpreferred-stack-boundary=2 support], ac_cv_c_gcc_stack_boundary,
       [WINE_TRY_CFLAGS([-mpreferred-stack-boundary=2],
@@ -822,7 +833,7 @@
 AC_SUBST(DLLFLAGS,"-D_REENTRANT")
 AC_SUBST(DLLIBS,"")
 AC_SUBST(LDSHARED,"")
-AC_SUBST(LDDLL,"")
+AC_SUBST(LDDLLFLAGS,"")
 AC_SUBST(LIBEXT,"so")
 AC_SUBST(IMPLIBEXT,"def")
 
@@ -857,13 +868,13 @@
       if test "$ac_cv_c_dll_gnuelf" = "yes"
       then
         LDSHARED="\$(CC) -shared \$(SONAME:%=-Wl,-soname,%)"
-        LDDLL="\$(CC) -shared -Wl,-Bsymbolic"
+        LDDLLFLAGS="-shared -Wl,-Bsymbolic"
         AC_CACHE_CHECK([whether the linker accepts -z defs], ac_cv_c_dll_zdefs,
           [WINE_TRY_CFLAGS([-fPIC -shared -Wl,-Bsymbolic,-z,defs],
                            ac_cv_c_dll_zdefs="yes",ac_cv_c_dll_zdefs="no")])
         if test "$ac_cv_c_dll_zdefs" = "yes"
         then
-          LDDLL="$LDDLL,-z,defs"
+          LDDLLFLAGS="$LDDLLFLAGS,-z,defs"
         fi
 
         AC_CACHE_CHECK([whether the linker accepts -init and -fini], ac_cv_c_dll_init_fini,
@@ -871,8 +882,7 @@
                            ac_cv_c_dll_init_fini="yes",ac_cv_c_dll_init_fini="no")])
         if test "$ac_cv_c_dll_init_fini" = "yes"
         then
-          AC_DEFINE(HAVE_LINKER_INIT_FINI,1,[Define if the linker supports renaming the init and fini functions])
-          LDDLL="$LDDLL,-init,__wine_spec_init,-fini,__wine_spec_fini"
+          LDDLLFLAGS="$LDDLLFLAGS,-init,__wine_spec_init,-fini,__wine_spec_fini"
         fi
 
         AC_CACHE_CHECK([whether the linker accepts version scripts], ac_cv_c_ld_version_scripts,
@@ -916,7 +926,7 @@
         if test "$ac_cv_c_dll_unixware" = "yes"
         then
           LDSHARED="\$(CC) -Wl,-G \$(SONAME:%=-Wl,-h,%)"
-          LDDLL="\$(CC) -Wl,-G,-B,symbolic"
+          LDDLLFLAGS="-Wl,-G,-B,symbolic"
 
         else
           AC_CACHE_CHECK(whether we can build a Mach-O (Mac OS X/Darwin) dll, ac_cv_c_dll_macho,
@@ -924,7 +934,7 @@
           if test "$ac_cv_c_dll_macho" = "yes"
           then
             LIBEXT="dylib"
-            LDDLL="\$(CC) -bundle -flat_namespace -undefined suppress"
+            LDDLLFLAGS="-bundle -flat_namespace -undefined suppress"
             LDSHARED="\$(CC) -dynamiclib"
             CFLAGS="$CFLAGS -ffixed-r13 -no-cpp-precomp"
           fi
@@ -1226,8 +1236,7 @@
 
 AC_C_CONST
 AC_C_INLINE
-AC_CHECK_TYPES([mode_t, off_t, pid_t, size_t, ssize_t])
-AC_CHECK_SIZEOF(long long,0)
+AC_CHECK_TYPES([mode_t, off_t, pid_t, size_t, ssize_t, long long])
 
 AC_CACHE_CHECK([whether linux/input.h is for real],
 	wine_cv_linux_input_h,
diff --git a/include/config.h.in b/include/config.h.in
index 6c0b598..25747b0 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -2,6 +2,9 @@
 
 #define __WINE_CONFIG_H
 
+/* Specifies the compiler flag that forces a short wchar_t */
+#undef CC_FLAG_SHORT_WCHAR
+
 /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
    systems. This function is required for `alloca.c' support on those systems.
    */
@@ -284,9 +287,6 @@
 /* Define if you have the X Shm extension */
 #undef HAVE_LIBXXSHM
 
-/* Define if the linker supports renaming the init and fini functions */
-#undef HAVE_LINKER_INIT_FINI
-
 /* Define to 1 if you have the <link.h> header file. */
 #undef HAVE_LINK_H
 
@@ -326,6 +326,9 @@
 /* Define to 1 if you have the <linux/ucdrom.h> header file. */
 #undef HAVE_LINUX_UCDROM_H
 
+/* Define to 1 if the system has the type `long long'. */
+#undef HAVE_LONG_LONG
+
 /* Define to 1 if you have the `lseek64' function. */
 #undef HAVE_LSEEK64
 
@@ -815,9 +818,6 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
-/* The size of a `long long', as computed by sizeof. */
-#undef SIZEOF_LONG_LONG
-
 /* Define to the soname of the libcrypto library. */
 #undef SONAME_LIBCRYPTO
 
diff --git a/tools/winegcc/Makefile.in b/tools/winegcc/Makefile.in
index 74bee1a..19c2afb 100644
--- a/tools/winegcc/Makefile.in
+++ b/tools/winegcc/Makefile.in
@@ -1,4 +1,13 @@
-DEFS      = -DINCLUDEDIR="\"$(includedir)\"" -DDLLDIR="\"$(dlldir)\"" -DLIBDIR="\"$(libdir)\""
+DEFS = \
+	-DINCLUDEDIR="\"$(includedir)\"" \
+	-DDLLDIR="\"$(dlldir)\"" \
+	-DLIBDIR="\"$(libdir)\"" \
+	-DDLLFLAGS="\"@DLLFLAGS@\"" \
+	-DLDDLLFLAGS="\"$(LDDLLFLAGS)\"" \
+	-DCC="\"$(CC)\"" \
+	-DCPP="\"$(CPP)\"" \
+	-DCXX="\"$(CXX)\""
+
 TOPSRCDIR = @top_srcdir@
 TOPOBJDIR = ../..
 SRCDIR    = @srcdir@
diff --git a/tools/winegcc/utils.c b/tools/winegcc/utils.c
index d9d716d..5f1bb37 100644
--- a/tools/winegcc/utils.c
+++ b/tools/winegcc/utils.c
@@ -118,6 +118,14 @@
     arr->base[arr->size++] = str;
 }
 
+void strarray_addall(strarray* arr, const strarray* from)
+{
+    int i;
+
+    for (i = 0; i < from->size; i++)
+	strarray_add(arr, from->base[i]);
+}
+
 strarray* strarray_dup(const strarray* arr)
 {
     strarray* dup = strarray_alloc();
@@ -129,6 +137,35 @@
     return dup;
 }
 
+strarray* strarray_fromstring(const char* str, const char* delim)
+{
+    strarray* arr = strarray_alloc();
+    char* buf = strdup(str);
+    const char* tok;
+
+    for(tok = strtok(buf, delim); tok; tok = strtok(0, delim))
+	strarray_add(arr, strdup(tok));
+
+    free(buf);
+    return arr;
+}
+
+char* strarray_tostring(const strarray* arr, const char* sep)
+{
+    char *str, *newstr;
+    int i;
+
+    str = strmake("%s", arr->base[0]);
+    for (i = 1; i < arr->size; i++)
+    {
+	newstr = strmake("%s%s%s", str, sep, arr->base[i]);
+	free(str);
+	str = newstr;
+    }
+
+    return str;
+}
+
 char* get_basename(const char* file)
 {
     const char* name;
diff --git a/tools/winegcc/utils.h b/tools/winegcc/utils.h
index cf35c31..042f267 100644
--- a/tools/winegcc/utils.h
+++ b/tools/winegcc/utils.h
@@ -21,7 +21,17 @@
  */
 
 
-void error(const char* s, ...);
+#ifndef DECLSPEC_NORETURN
+# if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
+#  define DECLSPEC_NORETURN __declspec(noreturn)
+# elif defined(__GNUC__)
+#  define DECLSPEC_NORETURN __attribute__((noreturn))
+# else
+#  define DECLSPEC_NORETURN
+# endif
+#endif
+
+void error(const char* s, ...) DECLSPEC_NORETURN;
 
 void* xmalloc(size_t size);
 void* xrealloc(void* p, size_t size);
@@ -38,6 +48,9 @@
 strarray* strarray_dup(const strarray* arr);
 void strarray_free(strarray* arr);
 void strarray_add(strarray* arr, const char* str);
+void strarray_addall(strarray* arr, const strarray* from);
+strarray* strarray_fromstring(const char* str, const char* delim);
+char* strarray_tostring(const strarray* arr, const char* sep);
 
 typedef enum { 
     file_na, file_other, file_obj, file_res,
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index cfd0ffa..e84b3f9 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -24,7 +24,7 @@
  * all options for gcc start with '-' and are for the most part
  * single options (no parameters as separate argument). 
  * There are of course exceptions to this rule, so here is an 
- * exaustive list of options that do take parameters (potentially) 
+ * exhaustive list of options that do take parameters (potentially)
  * as a separate argument:
  *
  * Compiler:
@@ -60,8 +60,8 @@
  *
  * NOTES
  * There is -G option for compatibility with System V that
- * takes no paramters. This makes "-G num" parsing ambiguous.
- * This option is synonimous to -shared, and as such we will
+ * takes no parameters. This makes "-G num" parsing ambiguous.
+ * This option is synonymous to -shared, and as such we will
  * not support it for now.
  *
  * Special interest options 
@@ -80,8 +80,8 @@
  *      Target Options
  *          -b machine  -V version
  *
- * Please note tehat the Target Options are relevant to everything:
- *   compiler, linker, asssembler, preprocessor. 
+ * Please note that the Target Options are relevant to everything:
+ *   compiler, linker, assembler, preprocessor.
  * 
  */ 
 
@@ -161,6 +161,7 @@
     int nostdinc;
     int nostdlib;
     int nodefaultlibs;
+    int noshortwchar;
     int gui_app;
     int compile_only;
     const char* output_name;
@@ -199,32 +200,47 @@
     return tmp;
 }
 
-static const char* get_translator(struct options* args)
+static const char* get_translator(struct options* opts)
 {
-    const char* cc = proc_cc; /* keep compiler happy */
-
-    switch(args->processor)
+    switch(opts->processor)
     {
-	case proc_pp:  cc = "cpp"; break;
-	case proc_cc:  cc = "gcc"; break;
-	case proc_cpp: cc = "g++"; break;
-	default: error("Unknown processor");
+        case proc_pp:  return CPP;
+        case proc_cc:  return CC;
+        case proc_cpp: return CXX;
     }
-
-    return cc;
+    error("Unknown processor");
 }
 
 static void compile(struct options* opts)
 {
     strarray *comp_args = strarray_alloc();
-    int j;
+    int j, gcc_defs = 0;
 
+    switch(opts->processor)
+    {
+	case proc_pp:  gcc_defs = 1; break;
+#ifdef __GNUC__
+	/* Note: if the C compiler is gcc we assume the C++ compiler is too */
+	/* mixing different C and C++ compilers isn't supported in configure anyway */
+	case proc_cc:  gcc_defs = 1; break;
+	case proc_cpp: gcc_defs = 1; break;
+#else
+	case proc_cc:  gcc_defs = 0; break;
+	case proc_cpp: gcc_defs = 0; break;
+#endif
+    }
     strarray_add(comp_args, get_translator(opts));
 
     if (opts->processor != proc_pp)
     {
-        strarray_add(comp_args, "-fshort-wchar");
-        strarray_add(comp_args, "-fPIC");
+#ifdef CC_FLAG_SHORT_WCHAR
+	if (!opts->noshortwchar)
+	{
+            strarray_add(comp_args, CC_FLAG_SHORT_WCHAR);
+            strarray_add(comp_args, "-DWINE_UNICODE_NATIVE");
+	}
+#endif
+        strarray_addall(comp_args, strarray_fromstring(DLLFLAGS, " "));
     }
     if (!opts->nostdinc)
     {
@@ -242,33 +258,38 @@
     strarray_add(comp_args, "-D__WINNT");
     strarray_add(comp_args, "-D__WINNT__");
 
-    strarray_add(comp_args, "-D__stdcall=__attribute__((__stdcall__))");
-    strarray_add(comp_args, "-D__cdecl=__attribute__((__cdecl__))");
-    strarray_add(comp_args, "-D__fastcall=__attribute__((__fastcall__))");
-    strarray_add(comp_args, "-D_stdcall=__attribute__((__stdcall__))");
-    strarray_add(comp_args, "-D_cdecl=__attribute__((__cdecl__))");
-    strarray_add(comp_args, "-D_fastcall=__attribute__((__fastcall__))");
-    strarray_add(comp_args, "-D__declspec(x)=__declspec_##x");
-    strarray_add(comp_args, "-D__declspec_align(x)=__attribute__((aligned(x)))");
-    strarray_add(comp_args, "-D__declspec_allocate(x)=__attribute__((section(x)))");
-    strarray_add(comp_args, "-D__declspec_deprecated=__attribute__((deprecated))");
-    strarray_add(comp_args, "-D__declspec_dllimport=__attribute__((dllimport))");
-    strarray_add(comp_args, "-D__declspec_dllexport=__attribute__((dllexport))");
-    strarray_add(comp_args, "-D__declspec_naked=__attribute__((naked))");
-    strarray_add(comp_args, "-D__declspec_noinline=__attribute__((noinline))");
-    strarray_add(comp_args, "-D__declspec_noreturn=__attribute__((noreturn))");
-    strarray_add(comp_args, "-D__declspec_nothrow=__attribute__((nothrow))");
-    strarray_add(comp_args, "-D__declspec_novtable=__attribute__(())"); /* ignore it */
-    strarray_add(comp_args, "-D__declspec_selectany=__attribute__((weak))");
-    strarray_add(comp_args, "-D__declspec_thread=__thread");
+    if (gcc_defs)
+    {
+	strarray_add(comp_args, "-D__stdcall=__attribute__((__stdcall__))");
+	strarray_add(comp_args, "-D__cdecl=__attribute__((__cdecl__))");
+	strarray_add(comp_args, "-D__fastcall=__attribute__((__fastcall__))");
+	strarray_add(comp_args, "-D_stdcall=__attribute__((__stdcall__))");
+	strarray_add(comp_args, "-D_cdecl=__attribute__((__cdecl__))");
+	strarray_add(comp_args, "-D_fastcall=__attribute__((__fastcall__))");
+	strarray_add(comp_args, "-D__declspec(x)=__declspec_##x");
+	strarray_add(comp_args, "-D__declspec_align(x)=__attribute__((aligned(x)))");
+	strarray_add(comp_args, "-D__declspec_allocate(x)=__attribute__((section(x)))");
+	strarray_add(comp_args, "-D__declspec_deprecated=__attribute__((deprecated))");
+	strarray_add(comp_args, "-D__declspec_dllimport=__attribute__((dllimport))");
+	strarray_add(comp_args, "-D__declspec_dllexport=__attribute__((dllexport))");
+	strarray_add(comp_args, "-D__declspec_naked=__attribute__((naked))");
+	strarray_add(comp_args, "-D__declspec_noinline=__attribute__((noinline))");
+	strarray_add(comp_args, "-D__declspec_noreturn=__attribute__((noreturn))");
+	strarray_add(comp_args, "-D__declspec_nothrow=__attribute__((nothrow))");
+	strarray_add(comp_args, "-D__declspec_novtable=__attribute__(())"); /* ignore it */
+	strarray_add(comp_args, "-D__declspec_selectany=__attribute__((weak))");
+	strarray_add(comp_args, "-D__declspec_thread=__thread");
+    }
 
     /* Wine specific defines */
     strarray_add(comp_args, "-D__WINE__");
-    strarray_add(comp_args, "-DWINE_UNICODE_NATIVE");
     strarray_add(comp_args, "-D__int8=char");
     strarray_add(comp_args, "-D__int16=short");
+    /* FIXME: what about 64-bit platforms? */
     strarray_add(comp_args, "-D__int32=int");
+#ifdef HAVE_LONG_LONG
     strarray_add(comp_args, "-D__int64=long long");
+#endif
 
     /* options we handle explicitly */
     if (opts->compile_only)
@@ -439,8 +460,8 @@
     /* compile the .spec.c file into a .spec.o file */
     comp_args = strarray_alloc();
     spec_o_name = get_temp_file(base_name, ".spec.o");
-    strarray_add(comp_args, "gcc");
-    strarray_add(comp_args, "-fPIC");
+    strarray_add(comp_args, CC);
+    strarray_addall(comp_args, strarray_fromstring(DLLFLAGS, " "));
     strarray_add(comp_args, "-o");
     strarray_add(comp_args, spec_o_name);
     strarray_add(comp_args, "-c");
@@ -451,12 +472,7 @@
     /* link everything together now */
     link_args = strarray_alloc();
     strarray_add(link_args, get_translator(opts));
-    strarray_add(link_args, "-shared");
-#ifdef HAVE_LINKER_INIT_FINI
-    strarray_add(link_args, "-Wl,-Bsymbolic,-z,defs,-init,__wine_spec_init,-fini,__wine_spec_fini");
-#else
-    strarray_add(link_args, "-Wl,-Bsymbolic,-z,defs");
-#endif
+    strarray_addall(link_args, strarray_fromstring(LDDLLFLAGS, " "));
 
     strarray_add(link_args, "-o");
     strarray_add(link_args, strmake("%s.exe.so", base_file));
@@ -679,6 +695,10 @@
                 case 'E':        /* preprocess only */
                     if (argv[i][2] == 0) linking = 0;
                     break;
+		case 'f':
+		    if (strcmp("-fno-short-wchar", argv[i]) == 0)
+                        opts.noshortwchar = 1;
+		    break;
 		case 'l':
 		    strarray_add(opts.lib_names, option_arg);
 		    break;