Alexandre Julliard : configure: Add a macro to define an stdcall suffix in assembly code.

Alexandre Julliard julliard at winehq.org
Mon Jun 15 07:59:04 CDT 2009


Module: wine
Branch: master
Commit: 9cebf090af110a4760470d16da1b5b076cbe8c78
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9cebf090af110a4760470d16da1b5b076cbe8c78

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sun Jun 14 11:24:20 2009 +0200

configure: Add a macro to define an stdcall suffix in assembly code.

---

 configure           |   78 +++++++++++++++++++++++++++++++++++++++++++++++++++
 configure.ac        |   21 +++++++++++++
 include/config.h.in |    3 ++
 3 files changed, 102 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 5b973e4..1536001 100755
--- a/configure
+++ b/configure
@@ -17615,6 +17615,69 @@ fi
 { $as_echo "$as_me:$LINENO: result: $ac_cv_c_extern_prefix" >&5
 $as_echo "$ac_cv_c_extern_prefix" >&6; }
 
+case $host_cpu in
+  *i[3456789]86*)
+    { $as_echo "$as_me:$LINENO: checking whether external symbols need stdcall decoration" >&5
+$as_echo_n "checking whether external symbols need stdcall decoration... " >&6; }
+if test "${ac_cv_c_stdcall_suffix+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifndef _MSC_VER
+#define __stdcall __attribute__((__stdcall__))
+#endif
+int __stdcall ac_test(int i) { return i; }
+int
+main ()
+{
+asm("jmp _ac_test at 4"); if (ac_test(1)) return 1
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then
+  ac_cv_c_stdcall_suffix="yes"
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_c_stdcall_suffix="no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_stdcall_suffix" >&5
+$as_echo "$ac_cv_c_stdcall_suffix" >&6; } ;;
+  *) ac_cv_c_stdcall_suffix="no" ;;
+esac
+
 
 
 if test "$ac_cv_c_extern_prefix" = "yes"
@@ -17633,6 +17696,21 @@ _ACEOF
 fi
 
 
+
+if test "$ac_cv_c_stdcall_suffix" = "yes"
+then
+    cat >>confdefs.h <<\_ACEOF
+#define __ASM_STDCALL(args) "@" #args
+_ACEOF
+
+else
+    cat >>confdefs.h <<\_ACEOF
+#define __ASM_STDCALL(args) ""
+_ACEOF
+
+fi
+
+
 { $as_echo "$as_me:$LINENO: checking how to define a function in assembly code" >&5
 $as_echo_n "checking how to define a function in assembly code... " >&6; }
 if test "${ac_cv_asm_func_def+set}" = set; then
diff --git a/configure.ac b/configure.ac
index 48c76fe..aa3b892 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1400,6 +1400,19 @@ AC_CACHE_CHECK([whether external symbols need an underscore prefix], ac_cv_c_ext
                       [if (ac_test) return 1],
                       ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no"))
 
+case $host_cpu in
+  *i[[3456789]]86*)
+    AC_CACHE_CHECK([whether external symbols need stdcall decoration], ac_cv_c_stdcall_suffix,
+        WINE_TRY_ASM_LINK(["jmp _ac_test at 4"],
+[#ifndef _MSC_VER
+#define __stdcall __attribute__((__stdcall__))
+#endif
+int __stdcall ac_test(int i) { return i; }],
+                          [if (ac_test(1)) return 1],
+                          ac_cv_c_stdcall_suffix="yes",ac_cv_c_stdcall_suffix="no")) ;;
+  *) ac_cv_c_stdcall_suffix="no" ;;
+esac
+
 AH_TEMPLATE(__ASM_NAME,[Define to a macro to generate an assembly name from a C symbol])
 if test "$ac_cv_c_extern_prefix" = "yes"
 then
@@ -1410,6 +1423,14 @@ else
     asm_name_prefix=""
 fi
 
+AH_TEMPLATE(__ASM_STDCALL,[Define to a macro to generate an stdcall suffix])
+if test "$ac_cv_c_stdcall_suffix" = "yes"
+then
+    AC_DEFINE([__ASM_STDCALL(args)],["@" #args])
+else
+    AC_DEFINE([__ASM_STDCALL(args)],[""])
+fi
+
 dnl **** Check how to define a function in assembly code ****
 
 AC_CACHE_CHECK([how to define a function in assembly code], ac_cv_asm_func_def,
diff --git a/include/config.h.in b/include/config.h.in
index c94523e..5b5f7c8 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -1197,6 +1197,9 @@
 /* Define to a macro to generate an assembly name from a C symbol */
 #undef __ASM_NAME
 
+/* Define to a macro to generate an stdcall suffix */
+#undef __ASM_STDCALL
+
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const
 




More information about the wine-cvs mailing list