aboutsummaryrefslogtreecommitdiffhomepage
path: root/configure
diff options
context:
space:
mode:
authorGravatar diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-10-01 22:46:33 +0000
committerGravatar diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-10-01 22:46:33 +0000
commit60eaa3a7da6e0e4cffd0c35ce021d0379e6dd3f1 (patch)
treeb3d44d44a27ecbdf3d239670043d6c02d5f86cf5 /configure
parent481669e9aa71470ff3aecf75858c5d90d1564eaf (diff)
Detect support of and add necessary CFLAGS to avoid crashes when loading
Win32 DLLs on Mac OS X / Intel. based on patch by Ulion, ulion2002 gmail com git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24683 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure20
1 files changed, 20 insertions, 0 deletions
diff --git a/configure b/configure
index 55ad0808cb..61228bf4cf 100755
--- a/configure
+++ b/configure
@@ -2301,6 +2301,25 @@ fi
echores $_named_asm_args
+if darwin && test "$cc_vendor" = "gnu" ; then
+echocheck "GCC support of -mstackrealign"
+# GCC 4.2 and some earlier Apple versions support this flag on x86. Since
+# Mac OS X/Intel has an ABI different from Windows this is needed to avoid
+# crashes when loading Win32 DLLs. Unfortunately some gcc versions create
+# wrong code with this flag, but this can be worked around by adding
+# -fno-unit-at-a-time as described in the blog post at
+# http://www.dribin.org/dave/blog/archives/2006/12/05/missing_third_param/
+cat > $TMPC << EOF
+__attribute__((noinline)) static int foo3(int i1, int i2, int i3) { return i3; }
+int main(void) { return foo3(1,2,3) == 3 ? 0 : 1; }
+EOF
+ cc_check -O4 -mstackrealign && tmp_run && _stackrealign=-mstackrealign
+ test -z "$_stackrealign" && cc_check -O4 -mstackrealign -fno-unit-at-a-time \
+ && tmp_run && _stackrealign="-mstackrealign -fno-unit-at-a-time"
+ test -n "$_stackrealign" && echores "yes" || echores "no"
+fi # if darwin && test "$cc_vendor" = "gnu" ; then
+
+
# Checking for CFLAGS
_install_strip="-s"
if test "$_profile" != "" || test "$_debug" != "" ; then
@@ -7527,6 +7546,7 @@ EXTRA_INC = $_inc_extra
EXTRAXX_INC = $_inc_extra $_inc_extraxx
OPTFLAGS = $CFLAGS \$(EXTRA_INC)
CXXFLAGS = $CXXFLAGS \$(EXTRAXX_INC)
+CFLAG_STACKREALIGN = $_stackrealign
INSTALLSTRIP = $_install_strip
CHARSET = $_charset
HELP_FILE = $_mp_help