scummvm random work
[patches.git] / sdl-yasm-sections.patch
CommitLineData
5e993f12 1Index: configure.in
2===================================================================
3--- configure.in (revision 2987)
4+++ configure.in (working copy)
5@@ -640,38 +640,56 @@ CheckNASM()
6 AC_HELP_STRING([--enable-nasm], [use nasm assembly blitters on x86 [[default=yes]]]),
7 , enable_nasm=yes)
8 if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_nasm = xyes; then
9+ CompileNASM()
10+ {
11+ # Usage: CompileNASM <filename>
12+ AC_MSG_CHECKING(to see if $NASM supports $1)
13+ if $NASM $NASMFLAGS $1 -o $1.o >&AS_MESSAGE_LOG_FD 2>&1; then
14+ CompileNASM_ret="yes"
15+ else
16+ CompileNASM_ret="no"
17+ fi
18+ rm -f $1 $1.o
19+ AC_MSG_RESULT($CompileNASM_ret)
20+ test "$CompileNASM_ret" = "yes"
21+ }
22+
23+ if test x"$NASMFLAGS" = x; then
24+ case $ARCH in
25+ win32)
26+ NASMFLAGS="-f win32"
27+ ;;
28+ openbsd)
29+ NASMFLAGS="-f aoutb"
30+ ;;
31+ macosx)
32+ NASMFLAGS="-f macho"
33+ ;;
34+ *)
35+ NASMFLAGS="-f elf"
36+ ;;
37+ esac
38+ fi
39+
40 AC_PATH_PROG(NASM, yasm)
41+ echo "%ifidn __OUTPUT_FORMAT__,elf" > unquoted-sections
42+ echo "section .note.GNU-stack noalloc noexec nowrite progbits" >> unquoted-sections
43+ echo "%endif" >> unquoted-sections
44+ CompileNASM unquoted-sections || NASM=""
45+
46 if test "x$NASM" = x -o "x$NASM" = x'"$NASM"'; then
47+ $as_unset ac_cv_path_NASM
48 AC_PATH_PROG(NASM, nasm)
49 fi
50 if test "x$NASM" != x -a "x$NASM" != x'"$NASM"'; then
51 AC_DEFINE(SDL_HERMES_BLITTERS)
52 SOURCES="$SOURCES $srcdir/src/hermes/*.asm"
53- if test x"$NASMFLAGS" = x; then
54- case $ARCH in
55- win32)
56- NASMFLAGS="-f win32"
57- ;;
58- openbsd)
59- NASMFLAGS="-f aoutb"
60- ;;
61- macosx)
62- NASMFLAGS="-f macho"
63- ;;
64- *)
65- NASMFLAGS="-f elf"
66- ;;
67- esac
68- fi
69 NASMFLAGS="$NASMFLAGS -i $srcdir/src/hermes/"
70
71 dnl See if hidden visibility is supported
72- echo "GLOBAL _bar:function hidden" > nasm_vis.asm
73- echo "_bar:" >>nasm_vis.asm
74- if $NASM $NASMFLAGS nasm_vis.asm -o nasm_vis.o >&AS_MESSAGE_LOG_FD 2>&1; then
75- NASMFLAGS="$NASMFLAGS -DHIDDEN_VISIBILITY"
76- fi
77- rm -f nasm_vis.asm nasm_vis.o
78+ echo "GLOBAL _bar:function hidden" > symbol-visibility
79+ echo "_bar:" >> symbol-visibility
80+ CompileNASM symbol-visibility && NASMFLAGS="$NASMFLAGS -DHIDDEN_VISIBILITY"
81
82 AC_SUBST(NASM)
83 AC_SUBST(NASMFLAGS)