From: Jan Kratochvil Date: Tue, 5 Oct 2010 17:15:08 +0000 (+0200) Subject: nasm: add configure support X-Git-Tag: 1.0_branch~876 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7be093ea4d50c8d38438f88cb9fa817c1c9de8dd;p=profile%2Fivi%2Flibvpx.git nasm: add configure support yasm has to be preferred as currently nasm produces marginally less efficient code (longer opcodes). Filed for nasm as: https://sourceforge.net/tracker/?func=detail&atid=106208&aid=3037462&group_id=6208 OTOH package should be built always the same, no matter which additional packages are / are not present on the system. As the package should be built with nasm (as yasm may not be available) we should not use yasm even if it is possibly available. nasm >= approx. 2.09 is required for the nasm compilation as the former versions had a section alignment bug. Provide nasm compatibility. No binary change by this patch with yasm on {x86_64,i686}-fedora13-linux-gnu. Few longer opcodes with nasm on {x86_64,i686}-fedora13-linux-gnu have been checked as safe. Change-Id: Icb0fe39c64bbcc3bcd7972e392fd03f3273340df --- diff --git a/build/make/configure.sh b/build/make/configure.sh index cfac539..e20f0d1 100755 --- a/build/make/configure.sh +++ b/build/make/configure.sh @@ -255,9 +255,10 @@ TMP_H="${TMPDIRx}/vpx-conf-$$-${RANDOM}.h" TMP_C="${TMPDIRx}/vpx-conf-$$-${RANDOM}.c" TMP_O="${TMPDIRx}/vpx-conf-$$-${RANDOM}.o" TMP_X="${TMPDIRx}/vpx-conf-$$-${RANDOM}.x" +TMP_ASM="${TMPDIRx}/vpx-conf-$$-${RANDOM}.asm" clean_temp_files() { - rm -f ${TMP_C} ${TMP_H} ${TMP_O} ${TMP_X} + rm -f ${TMP_C} ${TMP_H} ${TMP_O} ${TMP_X} ${TMP_ASM} } # @@ -322,6 +323,21 @@ check_add_ldflags() { add_ldflags "$@" } +check_asm_align() { + log check_asm_align "$@" + cat >${TMP_ASM} <${TMP_X} + log_file ${TMP_X} + if ! grep -q '\.rodata .* 16$' ${TMP_X}; then + die "${AS} ${ASFLAGS} does not support section alignment (nasm <=2.08?)" + fi +} + write_common_config_banner() { echo '# This file automatically generated by configure. Do not edit!' > config.mk echo "TOOLCHAIN := ${toolchain}" >> config.mk @@ -440,13 +456,18 @@ process_common_cmdline() { disable builtin_libc alt_libc="${optval}" ;; + --as=*) + [ "${optval}" = yasm -o "${optval}" = nasm -o "${optval}" = auto ] \ + || die "Must be yasm, nasm or auto: ${optval}" + alt_as="${optval}" + ;; --prefix=*) prefix="${optval}" ;; --libdir=*) libdir="${optval}" ;; - --libc|--prefix|--libdir) + --libc|--as|--prefix|--libdir) die "Option ${opt} requires argument" ;; --help|-h) show_help @@ -802,6 +823,7 @@ process_common_toolchain() { ;; esac + AS="${alt_as:-${AS:-auto}}" case ${tgt_cc} in icc*) CC=${CC:-icc} @@ -830,7 +852,16 @@ process_common_toolchain() { ;; esac - AS=yasm + case "${AS}" in + auto|"") + which nasm >/dev/null 2>&1 && AS=nasm + which yasm >/dev/null 2>&1 && AS=yasm + [ "${AS}" = auto -o -z "${AS}" ] \ + && die "Neither yasm nor nasm have been found" + ;; + esac + log_echo " using $AS" + [ "${AS##*/}" = nasm ] && add_asflags -Ox AS_SFX=.asm case ${tgt_os} in win*) @@ -839,7 +870,9 @@ process_common_toolchain() { ;; linux*|solaris*) add_asflags -f elf${bits} - enabled debug && add_asflags -g dwarf2 + enabled debug && [ "${AS}" = yasm ] && add_asflags -g dwarf2 + enabled debug && [ "${AS}" = nasm ] && add_asflags -g + [ "${AS##*/}" = nasm ] && check_asm_align ;; darwin*) add_asflags -f macho${bits} @@ -852,7 +885,7 @@ process_common_toolchain() { # enabled icc && ! enabled pic && add_cflags -fno-pic -mdynamic-no-pic enabled icc && ! enabled pic && add_cflags -fno-pic ;; - *) log "Warning: Unknown os $tgt_os while setting up yasm flags" + *) log "Warning: Unknown os $tgt_os while setting up $AS flags" ;; esac ;; diff --git a/configure b/configure index b3cd0c7..0321e1a 100755 --- a/configure +++ b/configure @@ -23,6 +23,7 @@ Advanced options: ${toggle_libs} don't build libraries ${toggle_examples} don't build examples --libc=PATH path to alternate libc + --as={yasm|nasm|auto} use specified assembler [auto, yasm preferred] ${toggle_fast_unaligned} don't use unaligned accesses, even when supported by hardware [auto] ${toggle_codec_srcs} in/exclude codec library source code @@ -266,6 +267,7 @@ CMDLINE_SELECT=" libs examples libc + as fast_unaligned codec_srcs debug_libs