diff --git a/configure b/configure index 2ebe28ac225..2d409910134 100755 --- a/configure +++ b/configure @@ -7402,6 +7402,77 @@ done CARBONLIB="-framework Carbon" enable_winequartz_drv=${enable_winequartz_drv:-yes} + fi + if test "x$enable_win16" = "xyes" + then + { $as_echo "$as_me:$LINENO: checking whether 16-bit code can be built correctly" >&5 +$as_echo_n "checking whether 16-bit code can be built correctly... " >&6; } + if test "$cross_compiling" = yes; then + { $as_echo "$as_me:$LINENO: result: cross-compiling, assuming yes" >&5 +$as_echo "cross-compiling, assuming yes" >&6; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +asm(".text\n" + "bad:\tnop;nop\n" + "good:\tnop;nop\n\t" + ".globl _testfunc\n" + "_testfunc:\tcallw good"); + extern void testfunc(); +int +main () +{ +unsigned short *p = (unsigned short *)testfunc; + return p[0] != 0xe866 || p[1] != 0xfffa + ; + return 0; +} +_ACEOF +rm -f 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>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (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_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:$LINENO: error: Xcode 3.x cannot build 16-bit code correctly. Use --disable-win16 if you don't need 16-bit support." >&5 +$as_echo "$as_me: error: Xcode 3.x cannot build 16-bit code correctly. Use --disable-win16 if you don't need 16-bit support." >&2;} + { (exit 1); exit 1; }; } +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + fi ;; *) diff --git a/configure.ac b/configure.ac index 3ef18dce05f..7f153756966 100644 --- a/configure.ac +++ b/configure.ac @@ -609,6 +609,23 @@ case $host_os in AC_SUBST(CARBONLIB,"-framework Carbon") enable_winequartz_drv=${enable_winequartz_drv:-yes} fi + dnl Check for Xcode 3.x broken 16-bit support + if test "x$enable_win16" = "xyes" + then + AC_MSG_CHECKING([whether 16-bit code can be built correctly]) + AC_RUN_IFELSE(AC_LANG_PROGRAM([[asm(".text\n" + "bad:\tnop;nop\n" + "good:\tnop;nop\n\t" + ".globl _testfunc\n" + "_testfunc:\tcallw good"); + extern void testfunc();]], + [[unsigned short *p = (unsigned short *)testfunc; + return p[[0]] != 0xe866 || p[[1]] != 0xfffa]]), + AC_MSG_RESULT(yes), + [AC_MSG_RESULT(no) + AC_MSG_ERROR([Xcode 3.x cannot build 16-bit code correctly. Use --disable-win16 if you don't need 16-bit support.])], + AC_MSG_RESULT([[cross-compiling, assuming yes]])) + fi ;; *) DLLFLAGS="$DLLFLAGS -fPIC"