Mac OS X Support : PPC asm code fix for darwin's ld

Pierre d'Herbemont stegefin at free.fr
Sat May 3 14:40:33 CDT 2003


Hi,
Here is an other patch which fix Mac OS X's ld way for handling PowerPC 
assembler mnemonics.

Cheers,

Pierre

Modified files:
include/winnt.h, scheduler/sysdeps.c, winebuild/import.c, 
winebuild/spec32.c

ChangeLog
Take care of Mac OS X's ld way for handling PowerPC assembler 
mnemonics. Also move TEB to r13 on darwin.

-------------- next part --------------
? .DS_Store
? patch.diff.txt
? wine
? dlls/.DS_Store
? dlls/autom4te.cache
? dlls/libadvapi32.def
? dlls/libavicap32.def
? dlls/libavifil32.def
? dlls/libcabinet.def
? dlls/libcomcat.def
? dlls/libcomctl32.def
? dlls/libcomdlg32.def
? dlls/libcrtdll.def
? dlls/libcrypt32.def
? dlls/libctl3d32.def
? dlls/libd3d8.def
? dlls/libd3dim.def
? dlls/libd3dx8.def
? dlls/libdciman32.def
? dlls/libddraw.def
? dlls/libdevenum.def
? dlls/libdinput.def
? dlls/libdinput8.def
? dlls/libdmband.def
? dlls/libdmcompos.def
? dlls/libdmime.def
? dlls/libdmloader.def
? dlls/libdmscript.def
? dlls/libdmstyle.def
? dlls/libdmsynth.def
? dlls/libdmusic.def
? dlls/libdmusic32.def
? dlls/libdplay.def
? dlls/libdplayx.def
? dlls/libdpnhpast.def
? dlls/libdsound.def
? dlls/libgdi32.def
? dlls/libglu32.def
? dlls/libicmp.def
? dlls/libimagehlp.def
? dlls/libimm32.def
? dlls/libkernel32.def
? dlls/liblz32.def
? dlls/libmapi32.def
? dlls/libmpr.def
? dlls/libmsacm32.def
? dlls/libmsdmo.def
? dlls/libmsimg32.def
? dlls/libmsnet32.def
? dlls/libmsrle32.def
? dlls/libmsvcrt.def
? dlls/libmsvcrt20.def
? dlls/libmsvcrtd.def
? dlls/libmsvfw32.def
? dlls/libnetapi32.def
? dlls/libntdll.def
? dlls/libntdll.dll.dylib
? dlls/libodbc32.def
? dlls/libole32.def
? dlls/liboleaut32.def
? dlls/libolecli32.def
? dlls/liboledlg.def
? dlls/libolepro32.def
? dlls/libolesvr32.def
? dlls/libopengl32.def
? dlls/libpsapi.def
? dlls/libqcap.def
? dlls/libquartz.def
? dlls/librasapi32.def
? dlls/libriched32.def
? dlls/librpcrt4.def
? dlls/libserialui.def
? dlls/libsetupapi.def
? dlls/libshdocvw.def
? dlls/libshell32.def
? dlls/libshfolder.def
? dlls/libshlwapi.def
? dlls/libsnmpapi.def
? dlls/libsti.def
? dlls/libtapi32.def
? dlls/libttydrv.def
? dlls/libtwain_32.def
? dlls/liburl.def
? dlls/liburlmon.def
? dlls/libuser32.def
? dlls/libversion.def
? dlls/libw32skrnl.def
? dlls/libwinedos.def
? dlls/libwineps.def
? dlls/libwininet.def
? dlls/libwinmm.def
? dlls/libwinnls32.def
? dlls/libwinspool.def
? dlls/libwintab32.def
? dlls/libwintrust.def
? dlls/libwnaspi32.def
? dlls/libwow32.def
? dlls/libws2_32.def
? dlls/libwsock32.def
? dlls/libx11drv.def
? dlls/ntdll/.DS_Store
? dlls/ntdll/ntdll.dll.dylib
? dlls/x11drv/.DS_Store
? dlls/x11drv/desktop.s
? graphics/x11drv/.DS_Store
? include/.DS_Store
? libs/.DS_Store
? libs/port/.DS_Store
? libs/unicode/.DS_Store
? libs/unicode/autom4te.cache
? libs/unicode/libwine_unicode.1.dylib
? libs/unicode/libwine_unicode.dylib
? libs/uuid/.DS_Store
? libs/wine/.DS_Store
? libs/wine/libwine.1.dylib
? libs/wine/libwine.dylib
? loader/.DS_Store
? memory/.DS_Store
? scheduler/.DS_Store
? server/.DS_Store
? tools/.DS_Store
? tools/winebuild/.DS_Store
? tools/wpp/lex.yy.c
? tools/wpp/Makefile
? tools/wpp/y.tab.c
? tools/wpp/y.tab.h
? win32/.DS_Store
Index: Make.rules.in
===================================================================
RCS file: /home/wine/wine/Make.rules.in,v
retrieving revision 1.156
diff -u -r1.156 Make.rules.in
--- Make.rules.in	1 May 2003 03:16:21 -0000	1.156
+++ Make.rules.in	3 May 2003 19:18:43 -0000
@@ -34,11 +34,13 @@
 DLLEXT    = @DLLEXT@
 IMPLIBEXT = @IMPLIBEXT@
 LDSHARED  = @LDSHARED@
+LDDYLIB   = @LDDYLIB@
 DLLTOOL   = @DLLTOOL@
 DLLWRAP   = @DLLWRAP@
 AR        = @AR@ rc
 RANLIB    = @RANLIB@
 STRIP     = @STRIP@
+STRIPFLAG = @STRIPFLAG@
 WINDRES   = @WINDRES@
 LN        = @LN@
 LN_S      = @LN_S@
Index: configure
===================================================================
RCS file: /home/wine/wine/configure,v
retrieving revision 1.426
diff -u -r1.426 configure
--- configure	1 May 2003 03:16:21 -0000	1.426
+++ configure	3 May 2003 19:19:26 -0000
@@ -308,8 +308,13 @@
 # include <unistd.h>
 #endif"
 
+<<<<<<< configure
+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 LIBPTHREAD 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 C2MAN LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS DB2HTML DB2PDF DB2PS JPEGLIB EGREP GIFLIB XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ft_devel ft_devel2 FREETYPEINCL ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS EXTRACFLAGS DLLEXT DLLFLAGS DLLIBS LDDLLFLAGS LDSHARED LDDYLIB LIBCFLAGS LIBEXT IMPLIBEXT NTDLLEXTRADEP STRIPFLAG DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP LDEXECFLAGS CROSSTEST CROSSCC CROSSWINDRES LDPATH CRTLIBS LDD ALLOCA LIBOBJS LTLIBOBJS'
+ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_PROG_RULES'
+=======
 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 LIBPTHREAD 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 C2MAN LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS DB2HTML DB2PDF DB2PS JPEGLIB EGREP GIFLIB XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ft_devel ft_devel2 FREETYPEINCL ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS EXTRACFLAGS DLLEXT DLLFLAGS DLLIBS LDDLLFLAGS LDSHARED LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP LDEXECFLAGS CROSSTEST CROSSCC CROSSWINDRES LDPATH CRTLIBS LDD ALLOCA LIBOBJS LTLIBOBJS'
 ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_LIB_RULES MAKE_PROG_RULES'
+>>>>>>> 1.426
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -11293,10 +11298,18 @@
 
 LDSHARED=""
 
+LDDYLIB=""
+
+LIBCFLAGS=""
+
 LIBEXT="so"
 
 IMPLIBEXT="def"
 
+NTDLLEXTRADEP=""
+
+STRIPFLAG="--strip-unneeded"
+
 
 case $host_os in
   cygwin*|mingw32*)
@@ -11371,102 +11384,662 @@
   echo "$as_me:$LINENO: result: $ac_ct_DLLTOOL" >&5
 echo "${ECHO_T}$ac_ct_DLLTOOL" >&6
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  DLLTOOL=$ac_ct_DLLTOOL
+else
+  DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dllwrap", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dllwrap; 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_DLLWRAP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$DLLWRAP"; then
+  ac_cv_prog_DLLWRAP="$DLLWRAP" # 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_DLLWRAP="${ac_tool_prefix}dllwrap"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+DLLWRAP=$ac_cv_prog_DLLWRAP
+if test -n "$DLLWRAP"; then
+  echo "$as_me:$LINENO: result: $DLLWRAP" >&5
+echo "${ECHO_T}$DLLWRAP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_DLLWRAP"; then
+  ac_ct_DLLWRAP=$DLLWRAP
+  # Extract the first word of "dllwrap", so it can be a program name with args.
+set dummy dllwrap; 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_DLLWRAP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_DLLWRAP"; then
+  ac_cv_prog_ac_ct_DLLWRAP="$ac_ct_DLLWRAP" # 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_DLLWRAP="dllwrap"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_DLLWRAP" && ac_cv_prog_ac_ct_DLLWRAP="false"
+fi
+fi
+ac_ct_DLLWRAP=$ac_cv_prog_ac_ct_DLLWRAP
+if test -n "$ac_ct_DLLWRAP"; then
+  echo "$as_me:$LINENO: result: $ac_ct_DLLWRAP" >&5
+echo "${ECHO_T}$ac_ct_DLLWRAP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  DLLWRAP=$ac_ct_DLLWRAP
+else
+  DLLWRAP="$ac_cv_prog_DLLWRAP"
+fi
+
+    if test "$DLLWRAP" = "false"; then
+      LIBEXT="a"
+    else
+            LIBEXT="dll"
+    fi
+    IMPLIBEXT="a"
+    ;;
+  darwin*|macosx*)
+
+for ac_header in dlfcn.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 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_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf at gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf at gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+for ac_func in dlopen
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* 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 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext 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='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
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* 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;
+}
+_ACEOF
+rm -f conftest.$ac_objext 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='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_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DLOPEN 1
+_ACEOF
+
+              DLLIBS="-ldl"
+else
+  have_dlcompat="no"
+fi
+
+fi
+done
+
+else
+  have_dlcompat="no"
+fi
+
+done
+
+    if test "$have_dlcompat" = "no"
+    then
+      { { echo "$as_me:$LINENO: error: No dlcompat found,
+      install it in order to build wine on Mac OS X/Darwin
+      " >&5
+echo "$as_me: error: No dlcompat found,
+      install it in order to build wine on Mac OS X/Darwin
+      " >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+
+    echo "$as_me:$LINENO: checking for poll in -lpoll" >&5
+echo $ECHO_N "checking for poll in -lpoll... $ECHO_C" >&6
+if test "${ac_cv_lib_poll_poll+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpoll  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char poll ();
+int
+main ()
+{
+poll ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext 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='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_lib_poll_poll=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_poll_poll=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_poll_poll" >&5
+echo "${ECHO_T}$ac_cv_lib_poll_poll" >&6
+if test $ac_cv_lib_poll_poll = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DLPOLL 1
+_ACEOF
+
+        LIBS="$LIBS -lpoll"
+else
+  have_lpoll="no"
+fi
+
+
+    if test "$have_lpoll" = "no"
+    then
+      { { echo "$as_me:$LINENO: error: No lpoll library found.
+      install it in order to build wine on Mac OS X/Darwin
+      " >&5
+echo "$as_me: error: No lpoll library found.
+      install it in order to build wine on Mac OS X/Darwin
+      " >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+
+
+for ac_header in mach-o/loader.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 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_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-  DLLTOOL=$ac_ct_DLLTOOL
-else
-  DLLTOOL="$ac_cv_prog_DLLTOOL"
+ac_header_compiler=no
 fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
 
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}dllwrap", so it can be a program name with args.
-set dummy ${ac_tool_prefix}dllwrap; 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_DLLWRAP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$DLLWRAP"; then
-  ac_cv_prog_DLLWRAP="$DLLWRAP" # 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_DLLWRAP="${ac_tool_prefix}dllwrap"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
   fi
-done
-done
-
-fi
-fi
-DLLWRAP=$ac_cv_prog_DLLWRAP
-if test -n "$DLLWRAP"; then
-  echo "$as_me:$LINENO: result: $DLLWRAP" >&5
-echo "${ECHO_T}$DLLWRAP" >&6
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  ac_cpp_err=yes
 fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
+  ac_header_preproc=no
 fi
-if test -z "$ac_cv_prog_DLLWRAP"; then
-  ac_ct_DLLWRAP=$DLLWRAP
-  # Extract the first word of "dllwrap", so it can be a program name with args.
-set dummy dllwrap; 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_DLLWRAP+set}" = set; then
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf at gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf at gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  if test -n "$ac_ct_DLLWRAP"; then
-  ac_cv_prog_ac_ct_DLLWRAP="$ac_ct_DLLWRAP" # 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_DLLWRAP="dllwrap"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-  test -z "$ac_cv_prog_ac_ct_DLLWRAP" && ac_cv_prog_ac_ct_DLLWRAP="false"
-fi
+  eval "$as_ac_Header=$ac_header_preproc"
 fi
-ac_ct_DLLWRAP=$ac_cv_prog_ac_ct_DLLWRAP
-if test -n "$ac_ct_DLLWRAP"; then
-  echo "$as_me:$LINENO: result: $ac_ct_DLLWRAP" >&5
-echo "${ECHO_T}$ac_ct_DLLWRAP" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
 fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MACHO_LOADER_H 1
+_ACEOF
 
-  DLLWRAP=$ac_ct_DLLWRAP
 else
-  DLLWRAP="$ac_cv_prog_DLLWRAP"
+  have_macho_loader_h="no"
 fi
 
-    if test "$DLLWRAP" = "false"; then
-      LIBEXT="a"
-    else
-            LIBEXT="dll"
+done
+
+
+    if test "$have_lpoll" = "no"
+    then
+      { { echo "$as_me:$LINENO: error: No Macho header found,
+      mach-o/loader.h should be installed with the developer tools
+      install them in order to build wine on Mac OS X/Darwin
+      " >&5
+echo "$as_me: error: No Macho header found,
+      mach-o/loader.h should be installed with the developer tools
+      install them in order to build wine on Mac OS X/Darwin
+      " >&2;}
+   { (exit 1); exit 1; }; }
     fi
-    IMPLIBEXT="a"
-    ;;
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_MACHO 1
+_ACEOF
+
+
+    LIBCFLAGS="-fno-common"
+    CFLAGS="$CFLAGS -no-cpp-precomp"
+    LDSHARED="\$(CC) -bundle -flat_namespace -undefined suppress"
+    LDDLLFLAGS=""
+    LIBEXT=dylib
+    LDDYLIB="\$(CC) -dynamiclib"
+
+    DLLEXT=".so"
+    NTDLLEXTRADEP="\$(MODULE).dylib"
+    STRIPFLAG="-u -r"
+  ;;
   *)
 
 for ac_header in dlfcn.h
@@ -12125,6 +12698,9 @@
   cygwin*|mingw32*)
     LDPATH="PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$PATH\""
  ;;
+  darwin*|macosx*)
+    LDPATH="DYLD_LIBRARY_PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$LD_LIBRARY_PATH\""
+ ;;
   *)
     LDPATH="LD_LIBRARY_PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$LD_LIBRARY_PATH\""
  ;;
@@ -15951,6 +16527,70 @@
   LINTFLAGS="$LINTFLAGS -D__sparc__"
 fi
  ;;
+  *powerpc*)        echo "$as_me:$LINENO: checking whether we need to define __powerpc__" >&5
+echo $ECHO_N "checking whether we need to define __powerpc__... $ECHO_C" >&6
+if test "${ac_cv_cpp_def___powerpc__+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifndef __powerpc__
+yes
+#endif
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "yes" >/dev/null 2>&1; then
+  ac_cv_cpp_def___powerpc__=yes
+else
+  ac_cv_cpp_def___powerpc__=no
+fi
+rm -f conftest*
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_cpp_def___powerpc__" >&5
+echo "${ECHO_T}$ac_cv_cpp_def___powerpc__" >&6
+if test $ac_cv_cpp_def___powerpc__ = yes; then
+  CFLAGS="$CFLAGS -D__powerpc__"
+  LINTFLAGS="$LINTFLAGS -D__powerpc__"
+fi
+
+                    echo "$as_me:$LINENO: checking whether we need to define __PPC__" >&5
+echo $ECHO_N "checking whether we need to define __PPC__... $ECHO_C" >&6
+if test "${ac_cv_cpp_def___PPC__+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifndef __PPC__
+yes
+#endif
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "yes" >/dev/null 2>&1; then
+  ac_cv_cpp_def___PPC__=yes
+else
+  ac_cv_cpp_def___PPC__=no
+fi
+rm -f conftest*
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_cpp_def___PPC__" >&5
+echo "${ECHO_T}$ac_cv_cpp_def___PPC__" >&6
+if test $ac_cv_cpp_def___PPC__ = yes; then
+  CFLAGS="$CFLAGS -D__PPC__"
+  LINTFLAGS="$LINTFLAGS -D__PPC__"
+fi
+ ;;
 esac
 
 case $host_vendor in
@@ -15988,6 +16628,41 @@
  ;;
 esac
 
+case $host_os in
+  *darwin*|macosx*) echo "$as_me:$LINENO: checking whether we need to define __darwin__" >&5
+echo $ECHO_N "checking whether we need to define __darwin__... $ECHO_C" >&6
+if test "${ac_cv_cpp_def___darwin__+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifndef __darwin__
+yes
+#endif
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "yes" >/dev/null 2>&1; then
+  ac_cv_cpp_def___darwin__=yes
+else
+  ac_cv_cpp_def___darwin__=no
+fi
+rm -f conftest*
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_cpp_def___darwin__" >&5
+echo "${ECHO_T}$ac_cv_cpp_def___darwin__" >&6
+if test $ac_cv_cpp_def___darwin__ = yes; then
+  CFLAGS="$CFLAGS -D__darwin__"
+  LINTFLAGS="$LINTFLAGS -D__darwin__"
+fi
+ ;;
+esac
+
 
 
 
@@ -16991,8 +17666,12 @@
 s, at DLLIBS@,$DLLIBS,;t t
 s, at LDDLLFLAGS@,$LDDLLFLAGS,;t t
 s, at LDSHARED@,$LDSHARED,;t t
+s, at LDDYLIB@,$LDDYLIB,;t t
+s, at LIBCFLAGS@,$LIBCFLAGS,;t t
 s, at LIBEXT@,$LIBEXT,;t t
 s, at IMPLIBEXT@,$IMPLIBEXT,;t t
+s, at NTDLLEXTRADEP@,$NTDLLEXTRADEP,;t t
+s, at STRIPFLAG@,$STRIPFLAG,;t t
 s, at DLLTOOL@,$DLLTOOL,;t t
 s, at ac_ct_DLLTOOL@,$ac_ct_DLLTOOL,;t t
 s, at DLLWRAP@,$DLLWRAP,;t t
Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.154
diff -u -r1.154 configure.ac
--- configure.ac	1 May 2003 03:16:21 -0000	1.154
+++ configure.ac	3 May 2003 19:19:30 -0000
@@ -772,13 +772,28 @@
 
 dnl **** Check for working dll ****
 
+dnl extension to use when building dlls
 AC_SUBST(DLLEXT,"")
+dnl flags to use when building dlls
 AC_SUBST(DLLFLAGS,"-D_REENTRANT")
+dnl flag to append in order to use the Dynamic Library (dlopen)
 AC_SUBST(DLLIBS,"")
+dnl flags to use when building dlls
 AC_SUBST(LDDLLFLAGS,"")
+dnl linker used when building *.so
 AC_SUBST(LDSHARED,"")
+dnl linker used when building *.dylib
+AC_SUBST(LDDYLIB,"")
+dnl special added flags when building *.c files of libraries (in libs/)
+AC_SUBST(LIBCFLAGS,"")
+dnl type of file to use when building libraries (in libs/)
 AC_SUBST(LIBEXT,"so")
+dnl extension to append onto FIXME : onto what?
 AC_SUBST(IMPLIBEXT,"def")
+dnl if we need to build something like an other lib for ntdll
+AC_SUBST(NTDLLEXTRADEP,"")
+dnl flag to use with strip
+AC_SUBST(STRIPFLAG,"--strip-unneeded")
 
 case $host_os in
   cygwin*|mingw32*)
@@ -792,6 +807,59 @@
     fi
     IMPLIBEXT="a"
     ;;
+  darwin*|macosx*)
+    AC_CHECK_HEADERS(dlfcn.h,
+        [AC_CHECK_FUNCS(dlopen,,
+          [AC_CHECK_LIB(dl,dlopen,
+             [AC_DEFINE(HAVE_DLOPEN,1,[Define if you have dlopen])
+              DLLIBS="-ldl"],
+          [have_dlcompat="no"])])],
+        [have_dlcompat="no"])
+    if test "$have_dlcompat" = "no"
+    then
+      AC_MSG_ERROR(
+      [No dlcompat found,
+      install it in order to build wine on Mac OS X/Darwin
+      ])
+    fi
+    
+    AC_CHECK_LIB(poll,poll,
+       [AC_DEFINE(HAVE_DLPOLL,1,[Define if you have lpoll])
+        LIBS="$LIBS -lpoll"],
+       [have_lpoll="no"])
+    
+    if test "$have_lpoll" = "no"
+    then
+      AC_MSG_ERROR(
+      [No lpoll library found.
+      install it in order to build wine on Mac OS X/Darwin
+      ])
+    fi
+
+    AC_CHECK_HEADERS(mach-o/loader.h,
+       [AC_DEFINE(HAVE_MACHO_LOADER_H,1,[Define if you have mach-o/loader.h])],
+       [have_macho_loader_h="no"])
+
+    if test "$have_lpoll" = "no"
+    then
+      AC_MSG_ERROR(
+      [No Macho header found,
+      mach-o/loader.h should be installed with the developer tools
+      install them in order to build wine on Mac OS X/Darwin
+      ])
+    fi
+    AC_DEFINE(USE_MACHO,1,[Define if you use mach-o])
+    
+    LIBCFLAGS="-fno-common"
+    CFLAGS="$CFLAGS -no-cpp-precomp"
+    LDSHARED="\$(CC) -bundle -flat_namespace -undefined suppress"
+    LDDLLFLAGS=""
+    LIBEXT=dylib
+    AC_SUBST(LDDYLIB,"\$(CC) -dynamiclib")
+    DLLEXT=".so"
+    NTDLLEXTRADEP="\$(MODULE).dylib"
+    STRIPFLAG="-u -r"
+  ;;
   *)
     AC_CHECK_HEADERS(dlfcn.h,
         [AC_CHECK_FUNCS(dlopen,,
@@ -868,6 +936,8 @@
 case $build_os in
   cygwin*|mingw32*)
     AC_SUBST(LDPATH,"PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$PATH\"") ;;
+  darwin*|macosx*)
+    AC_SUBST(LDPATH,"DYLD_LIBRARY_PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$LD_LIBRARY_PATH\"") ;;
   *)
     AC_SUBST(LDPATH,"LD_LIBRARY_PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$LD_LIBRARY_PATH\"") ;;
 esac
@@ -1295,10 +1365,17 @@
   *i[[3456789]]86*) WINE_CHECK_DEFINE([__i386__]) ;;
   *alpha*)          WINE_CHECK_DEFINE([__ALPHA__]) ;;
   *sparc*)          WINE_CHECK_DEFINE([__sparc__]) ;;
+dnl for the powerpc it seems to be two flags, FIXME : they should be unified
+  *powerpc*)        WINE_CHECK_DEFINE([__powerpc__])
+                    WINE_CHECK_DEFINE([__PPC__]) ;;
 esac
 
 case $host_vendor in
   *sun*) WINE_CHECK_DEFINE([__sun__]) ;;
+esac
+
+case $host_os in
+  *darwin*|macosx*) WINE_CHECK_DEFINE([__darwin__]) ;;
 esac
 
 dnl **** Generate output files ****
Index: dlls/Makedll.rules.in
===================================================================
RCS file: /home/wine/wine/dlls/Makedll.rules.in,v
retrieving revision 1.55
diff -u -r1.55 Makedll.rules.in
--- dlls/Makedll.rules.in	21 Apr 2003 23:54:06 -0000	1.55
+++ dlls/Makedll.rules.in	3 May 2003 19:19:30 -0000
@@ -18,7 +18,7 @@
 ALL_LIBS    = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LIBS)
 IMPORTLIBS  = $(DELAYIMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT)) $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
 
-all: $(MODULE)$(DLLEXT) $(SUBDIRS)
+all: $(EXTRADEP) $(MODULE)$(DLLEXT) $(SUBDIRS)
 
 @MAKE_RULES@
 
@@ -32,7 +32,11 @@
 
 $(MODULE).tmp.o: $(ALL_OBJS) Makefile.in
 	$(LDCOMBINE) $(ALL_OBJS) -o $@
-	-$(STRIP) --strip-unneeded $@
+	-$(STRIP) $(STRIPFLAG) $@
+
+# Rule for .dylib files
+$(MODULE).dylib: $(MAINSPEC).o $(ALL_OBJS) Makefile.in
+	$(LDDYLIB) -single_module -flat_namespace -undefined suppress $(LDDLLFLAGS) $(MAINSPEC).o $(ALL_OBJS) -o $@ -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(ALL_LIBS) -lc
 
 # Rule for 16-bit glue
 
Index: dlls/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/Makefile.in,v
retrieving revision 1.173
diff -u -r1.173 Makefile.in
--- dlls/Makefile.in	12 Apr 2003 00:05:27 -0000	1.173
+++ dlls/Makefile.in	3 May 2003 19:19:34 -0000
@@ -1551,15 +1551,25 @@
 
 LINKABLE_DLLS = ntdll.dll
 
-libntdll.dll.$(LIBEXT): ntdll/ntdll.dll$(DLLEXT)
+ntdll/ntdll.dll.dylib:
+        
+
+libntdll.dll.so: ntdll/ntdll.dll$(DLLEXT)
+	$(RM) $@ && $(LN_S) ntdll/ntdll.dll$(DLLEXT) $@
+
+libntdll.dll.a: ntdll/ntdll.dll$(DLLEXT)
 	$(RM) $@ && $(LN_S) ntdll/ntdll.dll$(DLLEXT) $@
 
+libntdll.dll.dylib: ntdll/ntdll.dll.dylib
+	$(RM) $@ && $(LN_S) ntdll/ntdll.dll.dylib $@
+
 kernel: libntdll.dll.$(LIBEXT)
 
 uninstall::
 	$(RM) $(LINKABLE_DLLS:%=$(libdir)/lib%.$(LIBEXT))
+.PHONY: install-lib-so install-lib-a install-lib-dylib
 
-install install-lib:: $(INSTALLSUBDIRS:%=%/__install__)
+install-lib-so:
 	$(RM) $(LINKABLE_DLLS:%=$(libdir)/lib%.$(LIBEXT))
 	cd $(libdir) && if [ "$(dlldir)" = "$(libdir)/wine" ]; \
 	then \
@@ -1567,6 +1577,26 @@
 	else \
 	  $(LN_S) $(dlldir)/ntdll.dll$(DLLEXT) libntdll.dll.$(LIBEXT); \
 	fi
+
+install-lib-a:
+	$(RM) $(LINKABLE_DLLS:%=$(libdir)/lib%.$(LIBEXT))
+	cd $(libdir) && if [ "$(dlldir)" = "$(libdir)/wine" ]; \
+	then \
+	  $(LN_S) wine/ntdll.dll$(DLLEXT) libntdll.dll.$(LIBEXT); \
+	else \
+	  $(LN_S) $(dlldir)/ntdll.dll$(DLLEXT) libntdll.dll.$(LIBEXT); \
+	fi
+
+install-lib-dylib:
+	$(RM) $(LINKABLE_DLLS:%=$(libdir)/lib%.$(LIBEXT))
+	cd $(libdir) && if [ "$(dlldir)" = "$(libdir)/wine" ]; \
+	then \
+	  $(LN_S) wine/ntdll.dll.$(LIBEXT) libntdll.dll.$(LIBEXT); \
+	else \
+	  $(LN_S) $(dlldir)/ntdll.dll.$(LIBEXT) libntdll.dll.$(LIBEXT); \
+	fi
+
+install install-lib:: $(INSTALLSUBDIRS:%=%/__install__) $(LIBEXT:%=install-lib-%)
 
 # Rules for auto documentation
 
Index: dlls/ntdll/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/Makefile.in,v
retrieving revision 1.59
diff -u -r1.59 Makefile.in
--- dlls/ntdll/Makefile.in	30 Apr 2003 00:53:23 -0000	1.59
+++ dlls/ntdll/Makefile.in	3 May 2003 19:19:38 -0000
@@ -5,6 +5,7 @@
 VPATH     = @srcdir@
 MODULE    = ntdll.dll
 EXTRALIBS = $(LIBUNICODE) @LIBPTHREAD@
+EXTRADEP  = @NTDLLEXTRADEP@
 
 C_SRCS = \
 	$(TOPOBJDIR)/files/directory.c \
Index: dlls/ntdll/signal_powerpc.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/signal_powerpc.c,v
retrieving revision 1.12
diff -u -r1.12 signal_powerpc.c
--- dlls/ntdll/signal_powerpc.c	3 Apr 2003 23:57:11 -0000	1.12
+++ dlls/ntdll/signal_powerpc.c	3 May 2003 19:19:40 -0000
@@ -31,6 +31,15 @@
 # include <unistd.h>
 #endif
 
+#ifdef __darwin__
+// FIXME : should use HAVE_SYS_UCONTEXT_H
+# include <sys/ucontext.h>
+// FIXME : should use HAVE_SIGNAL_H
+# include <signal.h>
+#include <sys/types.h>
+typedef siginfo_t siginfo;
+#endif
+
 #ifdef HAVE_SYS_PARAM_H
 # include <sys/param.h>
 #endif
@@ -69,7 +78,12 @@
 
 typedef struct ucontext SIGCONTEXT;
 
-#define HANDLER_DEF(name) void name( int __signal, struct siginfo *__siginfo, SIGCONTEXT *__context )
+#ifdef __darwin__
+# define HANDLER_DEF(name) void name( int __signal,        siginfo *__siginfo, SIGCONTEXT *__context )
+#else
+# define HANDLER_DEF(name) void name( int __signal, struct siginfo *__siginfo, SIGCONTEXT *__context )
+#endif
+
 #define HANDLER_CONTEXT (__context)
 
 typedef int (*wine_signal_handler)(unsigned int sig);
@@ -94,16 +108,27 @@
  */
 static void save_context( CONTEXT *context, const SIGCONTEXT *sigcontext )
 {
-#define CX(x,y) context->x = sigcontext->uc_mcontext.regs->y
-#define C(x) CX(Gpr##x,gpr[x])
+#ifdef __darwin__
+// Handle context using darwin way
+# define CX(x,y) context->x = sigcontext->uc_mcontext->ss.y
+# define C(x) CX(Gpr##x,r##x)
+#else
+# define CX(x,y) context->x = sigcontext->uc_mcontext.regs->y
+# define C(x) CX(Gpr##x,gpr[x])
+#endif
 	C(0); C(1); C(2); C(3); C(4); C(5); C(6); C(7); C(8); C(9); C(10);
 	C(11); C(12); C(13); C(14); C(15); C(16); C(17); C(18); C(19); C(20);
 	C(21); C(22); C(23); C(24); C(25); C(26); C(27); C(28); C(29); C(30);
 	C(31);
-
+#ifdef __darwin__
+	CX(Iar,srr0); /* Program Counter */
+	CX(Msr,srr1);  /* Machine State Reister (Supervisor) */
+	CX(Ctr,ctr);
+#else
 	CX(Iar,nip);
 	CX(Msr,msr);
 	CX(Ctr,ctr);
+#endif /* __darwin__ */
 #undef CX
 	/* FIXME: fp regs? */
 
@@ -128,15 +153,26 @@
  */
 static void restore_context( const CONTEXT *context, SIGCONTEXT *sigcontext )
 {
-#define CX(x,y) sigcontext->uc_mcontext.regs->y = context->x
+#ifdef __darwin__
+# define CX(x,y) sigcontext->uc_mcontext->ss.y = context->x
+#else
+# define CX(x,y) sigcontext->uc_mcontext.regs->y = context->x
+#endif /* __darwin__ */
 	C(0); C(1); C(2); C(3); C(4); C(5); C(6); C(7); C(8); C(9); C(10);
 	C(11); C(12); C(13); C(14); C(15); C(16); C(17); C(18); C(19); C(20);
 	C(21); C(22); C(23); C(24); C(25); C(26); C(27); C(28); C(29); C(30);
 	C(31);
 
+#ifdef __darwin__
+	CX(Iar,srr0); /* Program Counter */
+	CX(Msr,srr1);  /* Machine State Reister (Supervisor) */
+	CX(Ctr,ctr);
+#else /* __darwin__ */
 	CX(Iar,nip);
 	CX(Msr,msr);
 	CX(Ctr,ctr);
+#endif /* __darwin__ */
+
 #undef CX
 }
 
@@ -187,6 +223,67 @@
     return EXCEPTION_FLT_INVALID_OPERATION;  /* generic error */
 }
 
+#ifdef __darwin__
+/**********************************************************************
+ *		segv_handler
+ *
+ * Handler for SIGSEGV and related errors.
+ */
+static HANDLER_DEF(segv_handler)
+{
+    CONTEXT context;
+    EXCEPTION_RECORD rec;
+    DWORD page_fault_code = EXCEPTION_ACCESS_VIOLATION;
+
+    save_context( &context, HANDLER_CONTEXT );
+
+    rec.ExceptionRecord  = NULL;
+    rec.ExceptionFlags   = EXCEPTION_CONTINUABLE;
+    rec.ExceptionAddress = (LPVOID)HANDLER_CONTEXT->uc_mcontext->ss.srr0;
+    rec.NumberParameters = 0;
+    switch (__siginfo->si_signo) {
+    case SIGSEGV:
+    	switch ( __siginfo->si_code & 0xffff ) {
+	case SEGV_MAPERR:
+	case SEGV_ACCERR:
+		rec.NumberParameters = 2;
+		rec.ExceptionInformation[0] = 0; /* FIXME ? */
+		rec.ExceptionInformation[1] = (DWORD)__siginfo->si_addr;
+		if (!(page_fault_code=VIRTUAL_HandleFault(__siginfo->si_addr)))
+			return;
+		rec.ExceptionCode = page_fault_code;
+		break;
+	default:FIXME("Unhandled SIGSEGV/%x\n",__siginfo->si_code);
+		break;
+	}
+    	break;
+    case SIGBUS:
+    	switch ( __siginfo->si_code & 0xffff ) {
+	case BUS_ADRALN:
+		rec.ExceptionCode = EXCEPTION_DATATYPE_MISALIGNMENT;
+		break;
+	default:FIXME("Unhandled SIGBUS/%x\n",__siginfo->si_code);
+		break;
+	}
+    	break;
+    case SIGILL:
+    	switch ( __siginfo->si_code & 0xffff ) {
+	case ILL_ILLOPC: /* illegal opcode */
+	case ILL_ILLTRP: /* illegal trap */
+		rec.ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION;
+		break;
+	case ILL_PRVOPC: /* privileged opcode */
+		rec.ExceptionCode = EXCEPTION_PRIV_INSTRUCTION;
+		break;
+	default:FIXME("Unhandled SIGILL/%x\n",__siginfo->si_code);
+		break;
+	}
+    	break;
+    }
+    EXC_RtlRaiseException( &rec, &context );
+    restore_context( &context, HANDLER_CONTEXT );
+}
+#else /* __darwin__ */
 
 /**********************************************************************
  *		segv_handler
@@ -264,7 +361,35 @@
     EXC_RtlRaiseException( &rec, &context );
     restore_context( &context, HANDLER_CONTEXT );
 }
+#endif /* __darwin__ */
 
+#ifdef __darwin__
+/**********************************************************************
+ *		trap_handler for darwin
+ *
+ * Handler for SIGTRAP.
+ */
+static HANDLER_DEF(trap_handler)
+{
+    CONTEXT context;
+    EXCEPTION_RECORD rec;
+
+    save_context( &context, HANDLER_CONTEXT );
+
+    rec.ExceptionFlags   = EXCEPTION_CONTINUABLE;
+    rec.ExceptionRecord  = NULL;
+    rec.ExceptionAddress = (LPVOID)__context->uc_mcontext->ss.srr0;
+    rec.NumberParameters = 0;
+
+    /* FIXME: check if we might need to modify PC */
+    switch (__siginfo->si_code & 0xffff) {
+    default:FIXME("Unhandled SIGTRAP/%x\n",__siginfo->si_code);
+		break;
+    }
+    EXC_RtlRaiseException( &rec, &context );
+    restore_context( &context, HANDLER_CONTEXT );
+}
+#else /* __darwin__ */
 /**********************************************************************
  *		trap_handler
  *
@@ -294,8 +419,49 @@
     EXC_RtlRaiseException( &rec, &context );
     restore_context( &context, HANDLER_CONTEXT );
 }
+#endif /* __darwin__ */
 
+#ifdef __darwin__
+/**********************************************************************
+ *		fpe_handler
+ *
+ * Handler for SIGFPE.
+ */
+static HANDLER_DEF(fpe_handler)
+{
+    CONTEXT context;
+    EXCEPTION_RECORD rec;
+
+    /*save_fpu( &context, HANDLER_CONTEXT );*/
+    save_context( &context, HANDLER_CONTEXT );
 
+    switch ( __siginfo->si_code  & 0xffff ) {
+    case FPE_FLTDIV:
+        rec.ExceptionCode = EXCEPTION_FLT_DIVIDE_BY_ZERO;
+        break;
+    case FPE_FLTOVF:
+        rec.ExceptionCode = EXCEPTION_FLT_OVERFLOW;
+        break;
+    case FPE_FLTUND:
+        rec.ExceptionCode = EXCEPTION_FLT_UNDERFLOW;
+        break;
+    case FPE_FLTRES:
+        rec.ExceptionCode = EXCEPTION_FLT_INEXACT_RESULT;
+        break;
+    case FPE_FLTINV:
+    default:
+        rec.ExceptionCode = EXCEPTION_FLT_INVALID_OPERATION;
+        break;
+    }
+    rec.ExceptionFlags   = EXCEPTION_CONTINUABLE;
+    rec.ExceptionRecord  = NULL;
+    rec.ExceptionAddress = (LPVOID)__context->uc_mcontext->ss.srr0;
+    rec.NumberParameters = 0;
+    EXC_RtlRaiseException( &rec, &context );
+    restore_context( &context, HANDLER_CONTEXT );
+    /*restore_fpu( &context, HANDLER_CONTEXT );*/
+}
+#else /* __darwin__ */
 /**********************************************************************
  *		fpe_handler
  *
@@ -344,7 +510,7 @@
     restore_context( &context, HANDLER_CONTEXT );
     /*restore_fpu( &context, HANDLER_CONTEXT );*/
 }
-
+#endif /* __darwin__ */
 
 /**********************************************************************
  *		int_handler
@@ -469,7 +635,7 @@
     }
 #endif  /* HAVE_SIGALTSTACK */
 
-    sigfillset( &all_sigs );
+    /* sigfillset( &all_sigs ); Do not use it*/
 
     if (set_handler( SIGINT,  have_sigaltstack, (void (*)())int_handler ) == -1) goto error;
     if (set_handler( SIGFPE,  have_sigaltstack, (void (*)())fpe_handler ) == -1) goto error;
Index: dlls/x11drv/desktop.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/desktop.c,v
retrieving revision 1.11
diff -u -r1.11 desktop.c
--- dlls/x11drv/desktop.c	19 Apr 2003 21:27:19 -0000	1.11
+++ dlls/x11drv/desktop.c	3 May 2003 19:19:45 -0000
@@ -181,4 +181,4 @@
     XFlush( display );
     wine_tsx11_unlock();
     return win;
-}
+}
\ No newline at end of file
Index: include/winnt.h
===================================================================
RCS file: /home/wine/wine/include/winnt.h,v
retrieving revision 1.157
diff -u -r1.157 winnt.h
--- include/winnt.h	10 Apr 2003 00:19:25 -0000	1.157
+++ include/winnt.h	3 May 2003 19:19:55 -0000
@@ -1632,7 +1632,11 @@
 extern inline struct _TEB * WINAPI NtCurrentTeb(void)
 {
     struct _TEB *teb;
+# ifdef __darwin__
+    __asm__("\tmr %0, r13" : "=r" (teb));
+# else
     __asm__("\tmr %0, 2" : "=r" (teb));
+# endif
     return teb;
 }
 #else
Index: libs/port/interlocked.c
===================================================================
RCS file: /home/wine/wine/libs/port/interlocked.c,v
retrieving revision 1.1
diff -u -r1.1 interlocked.c
--- libs/port/interlocked.c	20 Mar 2003 22:06:16 -0000	1.1
+++ libs/port/interlocked.c	3 May 2003 19:19:56 -0000
@@ -107,11 +107,11 @@
     long ret = 0;
     long scratch;
     __asm__ __volatile__(
-        "0:    lwarx %0,0,%2 ;"
+        "0:    lwarx %0,0,%2 \n"
         "      xor. %1,%4,%0;"
-        "      bne 1f;"
-        "      stwcx. %3,0,%2;"
-        "      bne- 0b;"
+        "      bne 1f\n"
+        "      stwcx. %3,0,%2\n"
+        "      bne- 0b\n"
         "1:    "
         : "=&r"(ret), "=&r"(scratch)
         : "r"(dest), "r"(xchg), "r"(compare)
@@ -124,15 +124,15 @@
     long ret = 0;
     long scratch;
     __asm__ __volatile__(
-        "0:    lwarx %0,0,%2 ;"
-        "      xor. %1,%4,%0;"
-        "      bne 1f;"
-        "      stwcx. %3,0,%2;"
-        "      bne- 0b;"
+        "0:    lwarx %0,0,%2 \n"
+        "      xor. %1,%4,%0\n"
+        "      bne 1f\n"
+        "      stwcx. %3,0,%2\n"
+        "      bne- 0b\n"
         "1:    "
         : "=&r"(ret), "=&r"(scratch)
         : "r"(dest), "r"(xchg), "r"(compare)
-        : "cr0","memory");
+        : "cr0","memory","r0");
     return ret;
 }
 
@@ -141,13 +141,13 @@
     long ret = 0;
     long zero = 0;
     __asm__ __volatile__(
-        "0:    lwarx %0, %3, %1;"
-        "      add %0, %2, %0;"
-        "      stwcx. %0, %3, %1;"
-        "      bne- 0b;"
+        "0:    lwarx %0, %3, %1\n"
+        "      add %0, %2, %0\n"
+        "      stwcx. %0, %3, %1\n"
+        "      bne- 0b\n"
         : "=&r" (ret)
         : "r"(dest), "r"(incr), "r"(zero)
-        : "cr0", "memory"
+        : "cr0", "memory", "r0"
     );
     return ret-incr;
 }
@@ -156,12 +156,12 @@
 {
     long ret = 0;
     __asm__ __volatile__(
-        "0:    lwarx %0,0,%1 ;"
-        "      stwcx. %2,0,%1;"
-        "      bne- 0b;"
+        "0:    lwarx %0,0,%1 \n"
+        "      stwcx. %2,0,%1\n"
+        "      bne- 0b\n"
         : "=&r"(ret)
         : "r"(dest), "r"(val)
-        : "cr0","memory");
+        : "cr0","memory","r0");
     return ret;
 }
 
@@ -169,12 +169,12 @@
 {
     void *ret = NULL;
     __asm__ __volatile__(
-        "0:    lwarx %0,0,%1 ;"
-        "      stwcx. %2,0,%1;"
-        "      bne- 0b;"
+        "0:    lwarx %0,0,%1 \n"
+        "      stwcx. %2,0,%1 \n"
+        "      bne- 0b \n"
         : "=&r"(ret)
         : "r"(dest), "r"(val)
-        : "cr0","memory");
+        : "cr0","memory","r0");
     return ret;
 }
 
Index: libs/unicode/Makefile.in
===================================================================
RCS file: /home/wine/wine/libs/unicode/Makefile.in,v
retrieving revision 1.4
diff -u -r1.4 Makefile.in
--- libs/unicode/Makefile.in	1 May 2003 00:39:29 -0000	1.4
+++ libs/unicode/Makefile.in	3 May 2003 19:19:56 -0000
@@ -1,3 +1,7 @@
+<<<<<<< Makefile.in
+DEFS      = @LIBCFLAGS@ @DLLFLAGS@ -D__WINESRC__ -DNO_LIBWINE_PORT
+=======
+>>>>>>> 1.4
 TOPSRCDIR = @top_srcdir@
 TOPOBJDIR = ../..
 SRCDIR    = @srcdir@
@@ -79,6 +83,65 @@
 	wctype.c \
 	$(CODEPAGES:%=c_%.c)
 
+<<<<<<< Makefile.in
+all: $(MODULE) $(MODULE:.dll=.a)
+
+ at MAKE_RULES@
+
+libwine_unicode.$(SOVERSION).dylib: $(OBJS) Makefile.in
+	$(LDDYLIB) $(OBJS) -o $@
+
+libwine_unicode.dylib: libwine_unicode.$(SOVERSION).dylib
+	$(RM) $@ && $(LN_S) libwine_unicode.$(SOVERSION).dylib $@
+
+libwine_unicode.so.$(SOVERSION): $(OBJS) Makefile.in
+	$(LDSHARED) $(OBJS) -o $@
+
+libwine_unicode.so: libwine_unicode.so.$(SOVERSION)
+	$(RM) $@ && $(LN_S) libwine_unicode.so.$(SOVERSION) $@
+
+libwine_unicode.a: wine_unicode.def
+	$(DLLTOOL) -l $@ -d $(SRCDIR)/wine_unicode.def
+
+libwine_unicode.dll: $(OBJS) wine_unicode.def Makefile.in
+	$(DLLWRAP) --def $(SRCDIR)/wine_unicode.def -o $@ $(OBJS)
+
+.PHONY: install-lib-dylib install-lib-so install-lib-dll install-dev-so install-dev-dll
+
+install-lib-dylib: libwine_unicode.$(SOVERSION).dylib dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_PROGRAM) libwine_unicode.$(SOVERSION).dylib $(libdir)/libwine_unicode.$(SOVERSION).dylib
+
+install-lib-so: libwine_unicode.so.$(SOVERSION) dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_PROGRAM) libwine_unicode.so.$(SOVERSION) $(libdir)/libwine_unicode.so.$(SOVERSION)
+
+install-lib-dll: libwine_unicode.dll dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_DATA) libwine_unicode.dll $(libdir)/libwine_unicode.dll
+
+install-dev-dylib: dummy
+	$(MKINSTALLDIRS) $(libdir)
+	cd $(libdir) && $(RM) libwine_unicode.dylib && $(LN_S) libwine_unicode.$(SOVERSION).dylib libwine_unicode.dylib
+
+install-dev-so: dummy
+	$(MKINSTALLDIRS) $(libdir)
+	cd $(libdir) && $(RM) libwine_unicode.so && $(LN_S) libwine_unicode.so.$(SOVERSION) libwine_unicode.so
+
+install-dev-dll: libwine_unicode.a dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_DATA) libwine_unicode.a $(libdir)/libwine_unicode.a
+
+install install-lib:: $(LIBEXT:%=install-lib-%)
+install install-dev:: $(LIBEXT:%=install-dev-%)
+
+uninstall::
+	$(RM) $(libdir)/libwine_unicode.a $(libdir)/libwine_unicode.dll $(libdir)/libwine_unicode.so $(libdir)/libwine_unicode.so.$(SOVERSION) $(libdir)/libwine_unicode.dylib $(libdir)/libwine_unicode.$(SOVERSION).dylib
+
+clean::
+	$(RM) libwine_unicode.so.$(SOVERSION) libwine_unicode.dll libwine_unicode.$(SOVERSION).dylib
+=======
 @MAKE_LIB_RULES@
+>>>>>>> 1.4
 
 ### Dependencies:
Index: libs/uuid/Makefile.in
===================================================================
RCS file: /home/wine/wine/libs/uuid/Makefile.in,v
retrieving revision 1.2
diff -u -r1.2 Makefile.in
--- libs/uuid/Makefile.in	22 Mar 2003 20:40:48 -0000	1.2
+++ libs/uuid/Makefile.in	3 May 2003 19:19:57 -0000
@@ -1,4 +1,4 @@
-DEFS      = @DLLFLAGS@ -D__WINESRC__
+DEFS      = @LIBCFLAGS@ @DLLFLAGS@ -D__WINESRC__
 TOPSRCDIR = @top_srcdir@
 TOPOBJDIR = ../..
 SRCDIR    = @srcdir@
Index: libs/wine/Makefile.in
===================================================================
RCS file: /home/wine/wine/libs/wine/Makefile.in,v
retrieving revision 1.3
diff -u -r1.3 Makefile.in
--- libs/wine/Makefile.in	1 May 2003 00:39:29 -0000	1.3
+++ libs/wine/Makefile.in	3 May 2003 19:19:57 -0000
@@ -1,3 +1,7 @@
+<<<<<<< Makefile.in
+DEFS      = @LIBCFLAGS@ @DLLFLAGS@ -D__WINESRC__ -DDLLDIR="\"$(dlldir)\""
+=======
+>>>>>>> 1.3
 TOPSRCDIR = @top_srcdir@
 TOPOBJDIR = ../..
 SRCDIR    = @srcdir@
@@ -14,6 +18,65 @@
 	ldt.c \
 	loader.c
 
+<<<<<<< Makefile.in
+all: $(MODULE) $(MODULE:.dll=.a)
+
+ at MAKE_RULES@
+
+libwine.$(SOVERSION).dylib: $(OBJS)
+	$(LDDYLIB) $(OBJS) $(EXTRALIBS) $(LIBS) -o $@
+        
+libwine.dylib: libwine.$(SOVERSION).dylib
+	$(RM) $@ && $(LN_S) libwine.$(SOVERSION).dylib $@
+
+libwine.so.$(SOVERSION): $(OBJS) Makefile.in
+	$(LDSHARED) $(OBJS) $(EXTRALIBS) $(LIBS) -o $@
+
+libwine.so: libwine.so.$(SOVERSION)
+	$(RM) $@ && $(LN_S) libwine.so.$(SOVERSION) $@
+
+libwine.a: wine.def
+	$(DLLTOOL) -l $@ -d $(SRCDIR)/wine.def
+
+libwine.dll: $(OBJS) wine.def Makefile.in
+	$(DLLWRAP) --def $(SRCDIR)/wine.def -o $@ $(OBJS) $(EXTRALIBS)
+
+.PHONY: install-lib-dylib install-lib-so install-lib-dll install-dev-so install-dev-dll
+
+install-lib-dylib: libwine.$(SOVERSION).dylib dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_PROGRAM) libwine.$(SOVERSION).dylib $(libdir)/libwine.$(SOVERSION).dylib
+
+install-lib-so: libwine.so.$(SOVERSION) dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_PROGRAM) libwine.so.$(SOVERSION) $(libdir)/libwine.so.$(SOVERSION)
+
+install-lib-dll: libwine.dll dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_DATA) libwine.dll $(libdir)/libwine.dll
+
+install-dev-dylib: dummy
+	$(MKINSTALLDIRS) $(libdir)
+	cd $(libdir) && $(RM) libwine.dylib && $(LN_S) libwine.$(SOVERSION).dylib libwine.dylib
+
+install-dev-so: dummy
+	$(MKINSTALLDIRS) $(libdir)
+	cd $(libdir) && $(RM) libwine.so && $(LN_S) libwine.so.$(SOVERSION) libwine.so
+
+install-dev-dll: libwine.a dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_DATA) libwine.a $(libdir)/libwine.a
+
+install install-lib:: $(LIBEXT:%=install-lib-%)
+install install-dev:: $(LIBEXT:%=install-dev-%)
+
+uninstall::
+	$(RM) $(libdir)/libwine.a $(libdir)/libwine.dll $(libdir)/libwine.so $(libdir)/libwine.so.$(SOVERSION) $(libdir)/libwine.dylib $(libdir)/libwine.$(SOVERSION).dylib
+
+clean::
+	$(RM) libwine.so.$(SOVERSION) libwine.dll libwine.$(SOVERSION).dylib
+=======
 @MAKE_LIB_RULES@
+>>>>>>> 1.3
 
 ### Dependencies:
Index: loader/module.c
===================================================================
RCS file: /home/wine/wine/loader/module.c,v
retrieving revision 1.182
diff -u -r1.182 module.c
--- loader/module.c	5 Apr 2003 05:13:33 -0000	1.182
+++ loader/module.c	3 May 2003 19:20:00 -0000
@@ -30,6 +30,9 @@
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
+#ifdef HAVE_MACHO_LOADER_H_
+# include <mach-o/loader.h>
+#endif
 #include "wine/winbase16.h"
 #include "winerror.h"
 #include "winternl.h"
@@ -255,6 +258,18 @@
             unsigned char ignored[12];
             unsigned short type;
         } elf;
+#ifdef USE_MACHO
+        struct
+        {
+            unsigned long magic;
+            unsigned long cputype;
+            unsigned long cpusubtype;
+            unsigned long filetype;
+            unsigned long ncmds;
+            unsigned long sizeofcmds;
+            unsigned long flags;
+        } macho;
+#endif /* USE_MACHO */
         IMAGE_DOS_HEADER mz;
     } header;
 
@@ -277,6 +292,30 @@
         }
         return BINARY_UNKNOWN;
     }
+    
+#ifdef USE_MACHO
+Ê Ê Ê/* Mach-o File with Endian set to Big Endian */
+    Êif (header.macho.magic == 0xfeedface)
+Ê Ê Ê{
+         /* FIXME: we don't bother to check byte order, architecture, etc. */
+         switch(header.macho.filetype)
+         {
+           case MH_BUNDLE: return BINARY_UNIX_LIB;
+         }
+         return BINARY_UNKNOWN;
+    }
+
+Ê Ê /* Mach-o File with Endian set to Little Endian */
+    if (header.macho.magic == 0xecafdeef)
+    {
+Ê Ê Ê Ê Ê/* FIXME: we don't bother to check byte order, architecture, etc. */
+         switch(header.macho.filetype)
+         {
+           case MH_BUNDLE: return BINARY_UNIX_LIB;
+         }
+         return BINARY_UNKNOWN;
+    }
+#endif /* USE_MACHO */
 
     /* Not ELF, try DOS */
 
Index: memory/environ.c
===================================================================
RCS file: /home/wine/wine/memory/environ.c,v
retrieving revision 1.39
diff -u -r1.39 environ.c
--- memory/environ.c	23 Jan 2003 23:07:39 -0000	1.39
+++ memory/environ.c	3 May 2003 19:20:02 -0000
@@ -24,6 +24,11 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef __darwin__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+#endif
+
 #include "windef.h"
 #include "winerror.h"
 
Index: scheduler/process.c
===================================================================
RCS file: /home/wine/wine/scheduler/process.c,v
retrieving revision 1.213
diff -u -r1.213 process.c
--- scheduler/process.c	27 Apr 2003 00:47:58 -0000	1.213
+++ scheduler/process.c	3 May 2003 19:20:09 -0000
@@ -32,6 +32,11 @@
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
+#ifdef __darwin__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+#endif
+
 #include "wine/winbase16.h"
 #include "wine/winuser16.h"
 #include "wine/exception.h"
Index: scheduler/sysdeps.c
===================================================================
RCS file: /home/wine/wine/scheduler/sysdeps.c,v
retrieving revision 1.65
diff -u -r1.65 sysdeps.c
--- scheduler/sysdeps.c	13 Apr 2003 01:04:25 -0000	1.65
+++ scheduler/sysdeps.c	3 May 2003 19:20:10 -0000
@@ -89,7 +89,11 @@
     wine_ldt_init_fs( teb->teb_sel, &fs_entry );
 #elif defined(__powerpc__)
     /* On PowerPC, the current TEB is in the gpr13 register */
+# ifdef __darwin__
+    __asm__ __volatile__("mr r13, %0" : : "r" (teb));
+# else /* __darwin__ */
     __asm__ __volatile__("mr 2, %0" : : "r" (teb));
+# endif
 #elif defined(HAVE__LWP_CREATE)
     /* On non-i386 Solaris, we use the LWP private pointer */
     _lwp_setprivate( teb );
@@ -394,7 +398,9 @@
  * Get the per-thread errno location.
  */
 int *__errno_location(void) { return errno_location_ptr(); }  /* Linux */
+#ifndef __darwin__
 int *__error(void)          { return errno_location_ptr(); }  /* FreeBSD */
+#endif
 int *__errno(void)          { return errno_location_ptr(); }  /* NetBSD */
 int *___errno(void)         { return errno_location_ptr(); }  /* Solaris */
 int *__thr_errno(void)      { return errno_location_ptr(); }  /* UnixWare */
@@ -465,7 +471,11 @@
     return (struct _TEB *)_lwp_getprivate();
 }
 #elif defined(__powerpc__)
+# ifdef __darwin__
+__ASM_GLOBAL_FUNC( NtCurrentTeb, "\n\tmr r3,r13\n\tblr" );
+# else
 __ASM_GLOBAL_FUNC( NtCurrentTeb, "\n\tmr 3,2\n\tblr" );
+# endif
 #else
 # error NtCurrentTeb not defined for this architecture
 #endif  /* __i386__ */
Index: tools/winebuild/import.c
===================================================================
RCS file: /home/wine/wine/tools/winebuild/import.c,v
retrieving revision 1.49
diff -u -r1.49 import.c
--- tools/winebuild/import.c	10 Apr 2003 18:36:40 -0000	1.49
+++ tools/winebuild/import.c	3 May 2003 19:20:15 -0000
@@ -819,6 +819,28 @@
             }
 
 #elif defined(__PPC__)
+/* Darwin's ld doesn't like the same asm code as linux linker... */
+# ifdef __darwin__
+            fprintf(outfile, "\taddi r1, r1, -0x4\\n\"\n");
+            fprintf(outfile, "\t\"\\tstw r9, 0(r1)\\n\"\n");
+            fprintf(outfile, "\t\"\\taddi r1, r1, -0x4\\n\"\n");
+            fprintf(outfile, "\t\"\\tstw r8, 0(r1)\\n\"\n");
+            fprintf(outfile, "\t\"\\taddi r1, r1, -0x4\\n\"\n");
+            fprintf(outfile, "\t\"\\tstw r7, 0(r1)\\n\"\n");
+
+            fprintf(outfile, "\t\"\\tlis r9,ha16(_imports+%d)\\n\"\n", pos);
+            fprintf(outfile, "\t\"\\tla r8,lo16(_imports+%d)(r9)\\n\"\n", pos);
+            fprintf(outfile, "\t\"\\tlwz r7, 0(r8)\\n\"\n");
+            fprintf(outfile, "\t\"\\tmtctr r7\\n\"\n");
+
+            fprintf(outfile, "\t\"\\tlwz r7, 0(r1)\\n\"\n");
+            fprintf(outfile, "\t\"\\taddi r1, r1, 0x4\\n\"\n");
+            fprintf(outfile, "\t\"\\tlwz r8, 0(r1)\\n\"\n");
+            fprintf(outfile, "\t\"\\taddi r1, r1, 0x4\\n\"\n");
+            fprintf(outfile, "\t\"\\tlwz r9, 0(r1)\\n\"\n");
+            fprintf(outfile, "\t\"\\taddi r1, r1, 0x4\\n\"\n");
+            fprintf(outfile, "\t\"\\tbctr\\n");
+# else /* __darwin__ */
             fprintf(outfile, "\taddi 1, 1, -0x4\\n\"\n");
             fprintf(outfile, "\t\"\\tstw 9, 0(1)\\n\"\n");
             fprintf(outfile, "\t\"\\taddi 1, 1, -0x4\\n\"\n");
@@ -838,6 +860,7 @@
             fprintf(outfile, "\t\"\\tlwz 9, 0(1)\\n\"\n");
             fprintf(outfile, "\t\"\\taddi 1, 1, 0x4\\n\"\n");
             fprintf(outfile, "\t\"\\tbctr\\n");
+# endif /* __darwin__ */
 #else
 #error You need to define import thunks for your architecture!
 #endif
@@ -845,7 +868,13 @@
         }
         pos += 4;
     }
+
+/* darwin and Mach-o have a different behavior */
+#ifdef __darwin__
+    fprintf( outfile, "\".text\");\n#ifndef __GNUC__\n}\n#endif\n\n" );
+#else
     fprintf( outfile, "\".section\\t\\\".text\\\"\");\n#ifndef __GNUC__\n}\n#endif\n\n" );
+#endif /* __darwin__ */
 
  done:
     return nb_imm;
@@ -968,6 +997,11 @@
     fprintf( outfile, "#ifndef __GNUC__\n" );
     fprintf( outfile, "static void __asm__dummy_delay_import(void) {\n" );
     fprintf( outfile, "#endif\n" );
+    
+#ifdef __darwin__
+    /* darwin likes this one */
+    fprintf( outfile, " Ê Ê\"\\t.data\\n\"" );
+#endif
 
     fprintf( outfile, "asm(\".align %d\\n\"\n", get_alignment(8) );
     fprintf( outfile, "    \"\\t" __ASM_FUNC("__wine_delay_load_asm") "\\n\"\n" );
@@ -982,6 +1016,53 @@
     fprintf( outfile, "    \"\\tmov %%g1, %%o0\\n\"\n" );
     fprintf( outfile, "    \"\\tjmp %%o0\\n\\trestore\\n\"\n" );
 #elif defined(__PPC__)
+# ifdef __darwin__
+    /* Save all callee saved registers into a stackframe. */
+    fprintf( outfile, "    \"\\tstwu r1, -48(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tstw Êr3, 4(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tstw Êr4, 8(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tstw Êr5, 12(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tstw Êr6, 16(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tstw Êr7, 20(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tstw Êr8, 24(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tstw Êr9, 28(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tstw Êr10, 32(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tstw Êr11, 36(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tstw Êr12, 40(r1)\\n\"\n" );
+
+    /* r0 -> r3 (arg1) */
+    fprintf( outfile, " Ê Ê\"\\tmr Êr3, r0\\n\"\n" );
+
+    /* save return address */
+    fprintf( outfile, " Ê Ê\"\\tmflr Êr0\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tstw Êr0, 44(r1)\\n\"\n" );
+
+    /* Call the __wine_delay_load function, arg1 is arg1. */
+    fprintf( outfile, " Ê Ê\"\\tbl __wine_delay_load\\n\"\n" );
+
+    /* Load return value from call into ctr register */
+    fprintf( outfile, " Ê Ê\"\\tmtctr r3\\n\"\n" );
+
+    /* restore all saved registers and drop stackframe. */
+    fprintf( outfile, " Ê Ê\"\\tlwz Êr3, 4(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tlwz Êr4, 8(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tlwz Êr5, 12(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tlwz Êr6, 16(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tlwz Êr7, 20(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tlwz Êr8, 24(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tlwz Êr9, 28(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tlwz Êr10, 32(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tlwz Êr11, 36(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tlwz Êr12, 40(r1)\\n\"\n" );
+
+    /* Load return value from call into return register */
+    fprintf( outfile, " Ê Ê\"\\tlwz Êr0, 44(r1)\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\tmtlr r0\\n\"\n" );
+    fprintf( outfile, " Ê Ê\"\\taddi r1, r1, 48\\n\"\n" );
+
+    /* branch to ctr register. */
+    fprintf( outfile, " Ê Ê\"\\tbctr\\n\"\n" );
+# else /* __darwin__ */
     /* Save all callee saved registers into a stackframe. */
     fprintf( outfile, "    \"\\tstwu %%r1, -48(%%r1)\\n\"\n" );
     fprintf( outfile, "    \"\\tstw  %%r3, 4(%%r1)\\n\"\n" );
@@ -1025,7 +1106,7 @@
     fprintf( outfile, "    \"\\taddi %%r1, %%r1, 48\\n\"\n" );
     /* branch to ctr register. */
     fprintf( outfile, "    \"\\tbctr\\n\"\n" );
-
+# endif /* __darwin__ */
 #else
 #error You need to defined delayed import thunks for your architecture!
 #endif
@@ -1092,6 +1173,29 @@
             }
 
 #elif defined(__PPC__)
+# ifdef __darwin
+            fprintf(outfile, "\t\"addi 1, 1, -0x4\\n\"\n");
+            fprintf(outfile, "\t\"\\tstw 9, 0(1)\\n\"\n");
+            fprintf(outfile, "\t\"\\taddi 1, 1, -0x4\\n\"\n");
+            fprintf(outfile, "\t\"\\tstw 8, 0(1)\\n\"\n");
+            fprintf(outfile, "\t\"\\taddi 1, 1, -0x4\\n\"\n");
+            fprintf(outfile, "\t\"\\tstw 7, 0(1)\\n\"\n");
+
+            fprintf(outfile, "\t\"\\tlis 9,ha16(_delay_imports+%d)\\n\"\n", pos);
+            fprintf(outfile, "\t\"\\tla 8,lo16(_delay_imports+%d)(9)\\n\"\n", pos);
+            fprintf(outfile, "\t\"\\tlwz 7, 0(8)\\n\"\n");
+            fprintf(outfile, "\t\"\\tmtctr 7\\n\"\n");
+
+Ê           fprintf(outfile, "\t\"\\tlwz 7, 0(1)\\n\"\n");
+            fprintf(outfile, "\t\"\\taddi 1, 1, 0x4\\n\"\n");
+            fprintf(outfile, "\t\"\\tlwz 8, 0(1)\\n\"\n");
+            fprintf(outfile, "\t\"\\taddi 1, 1, 0x4\\n\"\n");
+            fprintf(outfile, "\t\"\\tlwz 9, 0(1)\\n\"\n");
+
+Ê
+            fprintf(outfile, "\t\"\\taddi 1, 1, 0x4\\n\"\n");
+            fprintf(outfile, "\t\"\\tbctr\\n\"");
+# else /* __darwine__*/ 
             fprintf(outfile, "\t\"addi 1, 1, -0x4\\n\"\n");
             fprintf(outfile, "\t\"\\tstw 9, 0(1)\\n\"\n");
             fprintf(outfile, "\t\"\\taddi 1, 1, -0x4\\n\"\n");
@@ -1116,12 +1220,20 @@
             fprintf(outfile, "\t\"lwz r0, %d(r0)\\n\\t\"\n", pos);
             fprintf(outfile, "\t\"mtctr r0\\n\\t\"\n");
             fprintf(outfile, "\t\"bctr\\n\"");*/
+# endif /* __darwin__ */
 #else
 #error You need to define delayed import thunks for your architecture!
 #endif
             fprintf( outfile, "\n" );
         }
     }
+    
+#ifdef __darwin__
+    fprintf( outfile, "\".text\");\n" );
+#else /* __darwin__ */
+    fprintf( outfile, "\".section \\\".text\\\"\");\n" );
+#endif /* __darwin__ */
+
     fprintf( outfile, "\".section \\\".text\\\"\");\n" );
     fprintf( outfile, "#ifndef __GNUC__\n" );
     fprintf( outfile, "}\n" );
Index: tools/winebuild/spec32.c
===================================================================
RCS file: /home/wine/wine/tools/winebuild/spec32.c,v
retrieving revision 1.65
diff -u -r1.65 spec32.c
--- tools/winebuild/spec32.c	3 Apr 2003 18:05:17 -0000	1.65
+++ tools/winebuild/spec32.c	3 May 2003 19:20:18 -0000
@@ -429,6 +429,20 @@
         fprintf( outfile, "    \"\\t.section\\t\\\".text\\\"\\n\");\n" );
     }
 #elif defined(__PPC__)
+# ifdef __darwin__
+    if (constructor)
+    {
+        fprintf( outfile, "asm(\"\\t.section .init,ax\\n\"\n" );
+        fprintf( outfile, "    \"\\tbl " __ASM_NAME("%s") "\\n\"\n", constructor );
+        fprintf( outfile, "    \"\\t.text\\n\");\n" );
+    }
+    if (destructor)
+    {
+        fprintf( outfile, "asm(\"\\t.section .fini,ax\\n\"\n" );
+        fprintf( outfile, "    \"\\tbl " __ASM_NAME("%s") "\\n\"\n", destructor );
+        fprintf( outfile, "    \"\\t.text\\n\");\n" );
+    }
+# else /* __darwin__ */
     if (constructor)
     {
         fprintf( outfile, "asm(\"\\t.section\\t\\\".init\\\" ,\\\"ax\\\"\\n\"\n" );
@@ -441,6 +455,7 @@
         fprintf( outfile, "    \"\\tbl " __ASM_NAME("%s") "\\n\"\n", destructor );
         fprintf( outfile, "    \"\\t.section\\t\\\".text\\\"\\n\");\n" );
     }
+# endif /* __darwin__ */
 #else
 #error You need to define the DLL constructor for your architecture
 #endif
@@ -489,9 +504,17 @@
     fprintf( outfile, "#ifndef __GNUC__\n" );
     fprintf( outfile, "static void __asm__dummy_header(void) {\n" );
     fprintf( outfile, "#endif\n" );
+#ifdef __darwin__
+    fprintf( outfile, "asm(\".text\\n\\t\"\n" );
+#else
     fprintf( outfile, "asm(\".section \\\".text\\\"\\n\\t\"\n" );
+#endif
     fprintf( outfile, "    \".align %d\\n\"\n", get_alignment(page_size) );
+#ifdef __darwin__
+    fprintf( outfile, "    \"" __ASM_NAME("pe_header") ":\\n\\t\");\n" );
+#else
     fprintf( outfile, "    \"" __ASM_NAME("pe_header") ":\\t.skip 65536\\n\\t\");\n" );
+#endif
     fprintf( outfile, "#ifndef __GNUC__\n" );
     fprintf( outfile, "}\n" );
     fprintf( outfile, "#endif\n" );
@@ -546,7 +569,11 @@
         else
         {
             fprintf( outfile, "#ifdef __GNUC__\n" );
+            fprintf( outfile, "# ifdef __darwin__\n" );
+            fprintf( outfile, "extern void DllMain() __attribute__((weak_import));\n" );
+            fprintf( outfile, "# else\n" );
             fprintf( outfile, "extern void DllMain() __attribute__((weak));\n" );
+            fprintf( outfile, "# endif\n" );
             fprintf( outfile, "#else\n" );
             fprintf( outfile, "extern void DllMain();\n" );
             fprintf( outfile, "static void __asm__dummy_dllmain(void)" );
@@ -920,7 +947,11 @@
     fprintf( outfile, "    \"\\tbl " __ASM_NAME("__wine_dbg_%s_init") "\\n\"\n", prefix );
     fprintf( outfile, "    \"\\t.section\\t\\\".fini\\\" ,\\\"ax\\\"\\n\"\n" );
     fprintf( outfile, "    \"\\tbl " __ASM_NAME("__wine_dbg_%s_fini") "\\n\"\n", prefix );
+# ifdef __darwin__
+    fprintf( outfile, " Ê Ê\"\\t.text\\n\");\n" );
+# else
     fprintf( outfile, "    \"\\t.section\\t\\\".text\\\"\\n\");\n" );
+# endif
 #else
 #error You need to define the DLL constructor for your architecture
 #endif


More information about the wine-patches mailing list