[vlc-devel] [PATCH] build: support YASM targets

Rafaël Carré funman at videolan.org
Fri Oct 25 12:45:40 CEST 2013


Hello,

Le 25/10/2013 00:37, Luca Barbato a écrit :
> The files must be .asm
> ---
> 
> Initial working version, sent as preview.
> Something slightly better will come later possibly, feedbacks welcome nonetheless.
> 
>  configure.ac      | 21 +++++++++++++++++++++
>  m4/dolt.m4        | 50 ++++++++++++++++++++++++--------------------------
>  modules/common.am |  5 +++++
>  3 files changed, 50 insertions(+), 26 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index ecf1bdd..219079a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -79,6 +79,7 @@ AM_PROG_AS
> 
>  AC_ARG_VAR([DESKTOP_FILE_VALIDATE], [Validator for desktop entry files])
>  AC_CHECK_PROGS(DESKTOP_FILE_VALIDATE, [${DESKTOP_FILE_VALIDATE} desktop-file-validate], :)
> +AC_CHECK_PROGS(YASM, yasm)
> 
>  dnl Check for compiler properties
>  AC_C_CONST
> @@ -102,6 +103,17 @@ dnl
>  dnl  Check the operating system
>  dnl
>  HAVE_WIN64="0"
> +
> +case "${host}" in
> +    i?86*)
> +    YASMFLAGS="-f elf32"
> +        ;;
> +    x86_64*)
> +    YASMFLAGS="-f elf64"
> +        ;;
> +esac
> +
> +
>  case "${host_os}" in
>    "")
>      SYS=unknown
> @@ -137,6 +149,7 @@ case "${host_os}" in
>      case "${host}" in
>        i?86*)
>          ARCH_flag="-arch i386"
> +        YASMFLAGS="-f macho32"
>        ;;
>        ppc64*)
>          ARCH_flag="-arch ppc64"
> @@ -146,6 +159,7 @@ case "${host_os}" in
>        ;;
>        x86_64*)
>          ARCH_flag="-arch x86_64"
> +        YASMFLAGS="-f macho64"
>        ;;
>        arm*)
>          ac_cv_c_bigendian="no"
> @@ -243,10 +257,12 @@ case "${host_os}" in
>                  HAVE_WIN64="1"
>                  WINDOWS_ARCH="x64"
>                  PROGRAMFILES="PROGRAMFILES64"
> +                YASMFLAGS="-f win64"
>              ;;
>              *)
>                  WINDOWS_ARCH="x86"
>                  PROGRAMFILES="PROGRAMFILES"
> +                YASMFLAGS="-f win32"
>              ;;
>          esac
>          AC_SUBST(WINDOWS_ARCH)
> @@ -265,13 +281,16 @@ case "${host_os}" in
>      ;;
>    symbian*)
>      SYS=symbian
> +    YASMFLAGS=""
>      ;;
>    *os2*)
>      SYS=os2
>      LDFLAGS="${LDFLAGS} -Zomf -Zbin-files -Zargs-wild"
> +    YASMFLAGS=""
>      ;;
>    *)
>      SYS="${host_os}"
> +    YASMFLAGS=""

What about setting it to "" before OS detection so we don't need to set
YASMFLAGS for each OS ? It would look better IMHO.

>      ;;
>  esac
>  AM_CONDITIONAL(HAVE_DARWIN,  test "${SYS}" = "darwin")
> @@ -281,6 +300,8 @@ AM_CONDITIONAL(HAVE_WIN32,   test "${SYS}" = "mingw32")
>  AM_CONDITIONAL(HAVE_WIN64,   test "${HAVE_WIN64}" = "1")
>  AM_CONDITIONAL(HAVE_SYMBIAN, test "${SYS}" = "symbian")
> 
> +AC_SUBST(YASMFLAGS)
> +
>  dnl
>  dnl Sadly autoconf does not think about testing foo.exe when ask to test
>  dnl for program foo on win32
> diff --git a/m4/dolt.m4 b/m4/dolt.m4
> index d14bbe7..ff28bef 100644
> --- a/m4/dolt.m4
> +++ b/m4/dolt.m4

Is this an update from upstream dolt or only your own modifications?

(I see some changes about PIC and I'm not sure if they are related)

> @@ -12,36 +12,24 @@ AC_DEFUN([DOLT], [
>  AC_REQUIRE([AC_CANONICAL_HOST])
>  # dolt, a replacement for libtool
>  # Josh Triplett <josh at freedesktop.org>
> -AC_PATH_PROG(DOLT_BASH, bash)
> +AC_PATH_PROG([DOLT_BASH], [bash])
>  AC_MSG_CHECKING([if dolt supports this host])
>  dolt_supported=yes
> -if test x$DOLT_BASH = x; then
> -    dolt_supported=no
> -fi
> -if test x$GCC != xyes; then
> -    dolt_supported=no
> -fi
> -case $host in
> -*-*-linux* \
> -|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*)
> -    pic_options='-fPIC'
> -    ;;
> -*-apple-darwin*)
> -    pic_options='-fno-common'
> -    ;;
> -*mingw*|*nacl*)
> -    pic_options=''
> -    ;;
> -*)
> -    dolt_supported=no
> -    ;;
> -esac
> -if test x$dolt_supported = xno ; then
> +AS_IF([test x$DOLT_BASH = x], [dolt_supported=no])
> +AS_IF([test x$GCC != xyes], [dolt_supported=no])
> +
> +AS_CASE([$host],
> +    [*-*-linux*|*-*-freebsd*], [pic_options='-fPIC'],
> +    [*-apple-darwin*],         [pic_options='-fno-common'],
> +    [*mingw*|*nacl*],          [pic_options='']
> +    [*],                       [dolt_supported=no]
> +)
> +AS_IF([test x$dolt_supported = xno], [
>      AC_MSG_RESULT([no, falling back to libtool])
>      LTCOMPILE='$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(COMPILE)'
>      LTCXXCOMPILE='$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXXCOMPILE)'
>      m4_pattern_allow([AM_V_lt])
> -else
> +], [
>      AC_MSG_RESULT([yes, replacing libtool])
> 
>  dnl Start writing out doltcompile.
> @@ -85,7 +73,13 @@ pic_object="$libobjdir/$objbase.o"
>  args@<:@$objarg@:>@="$pic_object"
>  __DOLTCOMPILE__EOF__
>      cat <<__DOLTCOMPILE__EOF__ >>doltcompile
> -"\${args@<:@@@:>@}" $pic_options -DPIC || exit \$?
> +    pic_options="$pic_options"
> +    if test x\$passthrough = xtrue; then
> +        pic_options=""
> +    fi
> +__DOLTCOMPILE__EOF__
> +    cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
> +${args@<:@@@:>@} $pic_options -DPIC || exit $?
>  __DOLTCOMPILE__EOF__
>      fi
> 
> @@ -161,6 +155,7 @@ for arg in "$[]@"; do
>      case "$arg" in
>          --mode=compile) modeok=true ;;
>          --tag=CC|--tag=CXX) tagok=true ;;
> +        --tag=ASM|--tag=YASM) tagok=true; passthrough=true;;

Will we only be able to build .asm files on platform where dolt is
supported?

(I'm OK with that btw)

>          --silent|--quiet) ;;
>          *) args@<:@${#args[@]}@:>@="$arg" ;;
>      esac
> @@ -175,7 +170,10 @@ __DOLTLIBTOOL__EOF__
>  dnl Done writing out doltlibtool; substitute it for libtool.
>      chmod +x doltlibtool
>      LIBTOOL='$(top_builddir)/doltlibtool'
> -fi
> +
> +DOLT_CLEANFILES="doltlibtool doltcompile"
> +AC_SUBST(DOLT_CLEANFILES)
> +])
>  AC_SUBST(LTCOMPILE)
>  AC_SUBST(LTCXXCOMPILE)
>  # end dolt
> diff --git a/modules/common.am b/modules/common.am
> index 94fb399..9f78fb9 100644
> --- a/modules/common.am
> +++ b/modules/common.am
> @@ -35,3 +35,8 @@ AM_LDFLAGS = \
>  if HAVE_WIN32
>  AM_LDFLAGS += $(top_builddir)/modules/module.rc.lo
>  endif
> +
> +SUFFIXES = .asm
> +
> +.asm.lo:
> +	$(LIBTOOL) --mode=compile --tag=ASM $(YASM) $(YASMFLAGS) $< -o $@
> --
> 1.8.3.2

Probably ok,

Thanks



More information about the vlc-devel mailing list