Check if yasm supports a nasm-specific syntax we use (it doesn't in 0.5.0, SDL-1.2
authorRyan C. Gordon <icculus@icculus.org>
Mon, 04 Jun 2007 11:06:48 +0000
branchSDL-1.2
changeset 39509d9e15ab1697
parent 3949 70dac8976f94
child 3951 e1e525d96838
Check if yasm supports a nasm-specific syntax we use (it doesn't in 0.5.0,
which is still common in Linux distros, and does in 0.6.0). Disable it if we
don't, attempting to fallback to using nasm. Thanks to Mike Frysinger for the
patch.

Fixes Bugzilla #393.
configure.in
     1.1 --- a/configure.in	Sun Jun 03 19:21:07 2007 +0000
     1.2 +++ b/configure.in	Mon Jun 04 11:06:48 2007 +0000
     1.3 @@ -662,38 +662,56 @@
     1.4  AC_HELP_STRING([--enable-nasm], [use nasm assembly blitters on x86 [[default=yes]]]),
     1.5                    , enable_nasm=yes)
     1.6      if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_nasm = xyes; then
     1.7 +        CompileNASM()
     1.8 +        {
     1.9 +            # Usage: CompileNASM <filename>
    1.10 +            AC_MSG_CHECKING(to see if $NASM supports $1)
    1.11 +            if $NASM $NASMFLAGS $1 -o $1.o >&AS_MESSAGE_LOG_FD 2>&1; then
    1.12 +                CompileNASM_ret="yes"
    1.13 +            else
    1.14 +                CompileNASM_ret="no"
    1.15 +            fi
    1.16 +            rm -f $1 $1.o
    1.17 +            AC_MSG_RESULT($CompileNASM_ret)
    1.18 +            test "$CompileNASM_ret" = "yes"
    1.19 +        }
    1.20 +
    1.21 +        if test x"$NASMFLAGS" = x; then
    1.22 +            case $ARCH in
    1.23 +              win32)
    1.24 +                  NASMFLAGS="-f win32"
    1.25 +                  ;;
    1.26 +              openbsd)
    1.27 +                  NASMFLAGS="-f aoutb"
    1.28 +                  ;;
    1.29 +              macosx)
    1.30 +                  NASMFLAGS="-f macho"
    1.31 +                  ;;
    1.32 +              *)
    1.33 +                  NASMFLAGS="-f elf"
    1.34 +                  ;;
    1.35 +            esac
    1.36 +        fi
    1.37 +
    1.38          AC_PATH_PROG(NASM, yasm)
    1.39 +        echo "%ifidn __OUTPUT_FORMAT__,elf" > unquoted-sections
    1.40 +        echo "section .note.GNU-stack noalloc noexec nowrite progbits" >> unquoted-sections
    1.41 +        echo "%endif" >> unquoted-sections
    1.42 +        CompileNASM unquoted-sections || NASM=""
    1.43 +
    1.44          if test "x$NASM" = x -o "x$NASM" = x'"$NASM"'; then
    1.45 +            $as_unset ac_cv_path_NASM
    1.46              AC_PATH_PROG(NASM, nasm)
    1.47          fi
    1.48          if test "x$NASM" != x -a "x$NASM" != x'"$NASM"'; then
    1.49              AC_DEFINE(SDL_HERMES_BLITTERS)
    1.50              SOURCES="$SOURCES $srcdir/src/hermes/*.asm"
    1.51 -            if test x"$NASMFLAGS" = x; then
    1.52 -                case $ARCH in
    1.53 -                  win32)
    1.54 -                      NASMFLAGS="-f win32"
    1.55 -                      ;;
    1.56 -                  openbsd)
    1.57 -                      NASMFLAGS="-f aoutb"
    1.58 -                      ;;
    1.59 -                  macosx)
    1.60 -                      NASMFLAGS="-f macho"
    1.61 -                      ;;
    1.62 -                  *)
    1.63 -                      NASMFLAGS="-f elf"
    1.64 -                      ;;
    1.65 -                esac
    1.66 -            fi
    1.67              NASMFLAGS="$NASMFLAGS -i $srcdir/src/hermes/"
    1.68  
    1.69              dnl See if hidden visibility is supported
    1.70 -            echo "GLOBAL _bar:function hidden" > nasm_vis.asm
    1.71 -            echo "_bar:" >>nasm_vis.asm
    1.72 -            if $NASM $NASMFLAGS nasm_vis.asm -o nasm_vis.o >&AS_MESSAGE_LOG_FD 2>&1; then
    1.73 -                NASMFLAGS="$NASMFLAGS -DHIDDEN_VISIBILITY"
    1.74 -            fi
    1.75 -            rm -f nasm_vis.asm nasm_vis.o
    1.76 +            echo "GLOBAL _bar:function hidden" > symbol-visibility
    1.77 +            echo "_bar:" >> symbol-visibility
    1.78 +            CompileNASM symbol-visibility && NASMFLAGS="$NASMFLAGS -DHIDDEN_VISIBILITY"
    1.79  
    1.80              AC_SUBST(NASM)
    1.81              AC_SUBST(NASMFLAGS)