From 932f69e9f37f36769312aa2d17e11f42f3f1a186 Mon Sep 17 00:00:00 2001 From: Niels Elburg Date: Sun, 25 Feb 2007 21:05:15 +0000 Subject: [PATCH] recover from hdd crash in veejay-ng git-svn-id: svn://code.dyne.org/veejay/trunk@813 eb8d1916-c9e9-0310-b8de-cf0c9472ead5 --- veejay-ng/INSTALL | 61 +- veejay-ng/aclocal.m4 | 2303 ++++++++++------- veejay-ng/config.guess | 574 ++-- veejay-ng/config.sub | 89 +- veejay-ng/configure.ac | 44 +- veejay-ng/depcomp | 65 +- veejay-ng/examples/lachspiegel.sh | 12 +- veejay-ng/install-sh | 102 +- veejay-ng/libel/avilib.c | 235 +- veejay-ng/libel/avilib.h | 2 +- veejay-ng/libel/vj-avcodec.c | 118 - veejay-ng/libel/vj-el.c | 41 +- veejay-ng/libplugger/freeframe-loader.c | 17 +- veejay-ng/libplugger/livido-loader.c | 2 + veejay-ng/libplugger/utility.c | 96 - veejay-ng/libplugger/utility.h | 3 - veejay-ng/libvevo/vevo.c | 4 +- veejay-ng/libvjmem/Makefile.am | 1 + veejay-ng/libvjmem/memcpy.c | 671 +++-- veejay-ng/libvjmem/vj-x86.c | 37 +- veejay-ng/libvjmem/vjmem.h | 6 +- veejay-ng/libyuv/Makefile.am | 2 +- veejay-ng/libyuv/subsample.c | 1041 ++++---- veejay-ng/libyuv/yuvconv.c | 808 ++++-- veejay-ng/libyuv/yuvconv.h | 66 +- veejay-ng/ltmain.sh | 1261 ++++++--- veejay-ng/missing | 85 +- veejay-ng/pluginpack/lvd_globalmotionsensor.c | 145 +- veejay-ng/veejay/Makefile.am | 14 +- veejay-ng/veejay/defs.h | 10 + veejay-ng/veejay/gl.c | 8 +- veejay-ng/veejay/performer.c | 33 +- veejay-ng/vevosample/vevosample.c | 18 +- veejay-ng/vevosample/vj-unicap.c | 416 ++- veejay-ng/vevosample/vj-unicap.h | 3 +- 35 files changed, 5164 insertions(+), 3229 deletions(-) diff --git a/veejay-ng/INSTALL b/veejay-ng/INSTALL index 56b077d6..54caf7c1 100644 --- a/veejay-ng/INSTALL +++ b/veejay-ng/INSTALL @@ -1,16 +1,13 @@ -Installation Instructions -************************* +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free -Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives + This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== -These are generic installation instructions. + These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses @@ -70,9 +67,9 @@ The simplest way to compile this package is: Compilers and Options ===================== -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here @@ -85,7 +82,7 @@ is an example: Compiling For Multiple Architectures ==================================== -You can compile the package for more than one kind of computer at the + You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the @@ -102,19 +99,19 @@ for another architecture. Installation Names ================== -By default, `make install' will install the package's files in + By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PREFIX'. +option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PREFIX', the package will -use PREFIX as the prefix for installing programs and libraries. +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular +options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. @@ -125,7 +122,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= -Some packages pay attention to `--enable-FEATURE' options to + Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The @@ -140,11 +137,11 @@ you can use the `configure' options `--x-includes=DIR' and Specifying the System Type ========================== -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: @@ -170,9 +167,9 @@ eventually be run) with `--host=TYPE'. Sharing Defaults ================ -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. @@ -181,7 +178,7 @@ A warning: not all `configure' scripts look for a site script. Defining Variables ================== -Variables not defined in a site shell script can be set in the + Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set @@ -189,18 +186,14 @@ them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). Here is a another example: - - /bin/bash ./configure CONFIG_SHELL=/bin/bash - -Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent -configuration-related scripts to be executed by `/bin/bash'. +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). `configure' Invocation ====================== -`configure' recognizes the following options to control how it operates. + `configure' recognizes the following options to control how it +operates. `--help' `-h' diff --git a/veejay-ng/aclocal.m4 b/veejay-ng/aclocal.m4 index bb243dc3..bde9fb04 100644 --- a/veejay-ng/aclocal.m4 +++ b/veejay-ng/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.9.5 -*- Autoconf -*- +# generated automatically by aclocal 1.8.5 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +# Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -210,8 +210,7 @@ main () # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# serial 47 AC_PROG_LIBTOOL -# Debian $Rev: 214 $ +# serial 48 Debian 1.5.22-4 AC_PROG_LIBTOOL # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) @@ -321,7 +320,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' +Xsed='sed -e 1s/^X//' [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] # Same as above, but do not quote variable references. @@ -341,7 +340,7 @@ rm="rm -f" default_ofile=libtool can_build_shared=yes -# All known linkers require a `.a' archive for static linking (except M$VC, +# All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" @@ -361,6 +360,7 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" @@ -380,15 +380,17 @@ old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi +_LT_CC_BASENAME([$compiler]) + # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) @@ -429,11 +431,56 @@ AC_DEFUN([_LT_AC_SYS_COMPILER], # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_AC_SYS_COMPILER +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +AC_DEFUN([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +]) + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +AC_DEFUN([_LT_COMPILER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +AC_DEFUN([_LT_LINKER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_LINKER_BOILERPLATE + + # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable @@ -506,15 +553,15 @@ fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if (echo_test_string="`eval $cmd`") 2>/dev/null && - echo_test_string="`eval $cmd`" && + if (echo_test_string=`eval $cmd`) 2>/dev/null && + echo_test_string=`eval $cmd` && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null then break @@ -683,7 +730,7 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in + case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*linux*) @@ -734,6 +781,22 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) CFLAGS="$SAVE_CFLAGS" fi ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) LD="${LD-ld} -64" ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw* | *-*-pw32*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) @@ -765,7 +828,7 @@ AC_CACHE_CHECK([$1], [$2], # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) @@ -775,8 +838,10 @@ AC_CACHE_CHECK([$1], [$2], echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi @@ -802,11 +867,16 @@ AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], LDFLAGS="$LDFLAGS $3" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized + # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi else $2=yes fi @@ -865,11 +935,55 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl lt_cv_sys_max_cmd_len=8192; ;; - *) + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && @@ -895,7 +1009,7 @@ fi # _LT_AC_CHECK_DLFCN -# -------------------- +# ------------------ AC_DEFUN([_LT_AC_CHECK_DLFCN], [AC_CHECK_HEADERS(dlfcn.h)dnl ])# _LT_AC_CHECK_DLFCN @@ -903,7 +1017,7 @@ AC_DEFUN([_LT_AC_CHECK_DLFCN], # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ------------------------------------------------------------------ +# --------------------------------------------------------------------- AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], [AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl if test "$cross_compiling" = yes; then : @@ -969,17 +1083,19 @@ int main () else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } + else + puts (dlerror ()); exit (status); }] EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; - x$lt_unknown|x*) $3 ;; + x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed @@ -991,7 +1107,7 @@ rm -fr conftest* # AC_LIBTOOL_DLOPEN_SELF -# ------------------- +# ---------------------- AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl if test "x$enable_dlopen" != xyes; then @@ -1062,7 +1178,7 @@ else test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" @@ -1075,7 +1191,7 @@ else ]) if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_AC_TRY_DLOPEN_SELF( @@ -1123,7 +1239,7 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) @@ -1135,11 +1251,13 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi - chmod u+w . + chmod u+w . 2>&AS_MESSAGE_LOG_FD $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation @@ -1203,8 +1321,8 @@ AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_AC_TAGVAR(hardcode_action, $1)= if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ - test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ - test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then + test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existant directories. if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && @@ -1371,7 +1489,7 @@ beos*) shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -1399,7 +1517,8 @@ cygwin* | mingw* | pw32*) dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' @@ -1429,7 +1548,7 @@ cygwin* | mingw* | pw32*) ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac ;; @@ -1452,7 +1571,7 @@ darwin* | rhapsody*) soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` @@ -1475,20 +1594,17 @@ freebsd1*) dynamic_linker=no ;; -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[123]]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) @@ -1506,14 +1622,19 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.[01]* | freebsdelf3.[01]*) + freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; - *) # from 3.2 on + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; + freebsd*) # from 4.6 on + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; esac ;; @@ -1533,7 +1654,7 @@ hpux9* | hpux10* | hpux11*) version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in + case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes @@ -1573,6 +1694,18 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; +interix3*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; @@ -1616,7 +1749,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be Linux ELF. -linux*) +linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no @@ -1632,7 +1765,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -1657,18 +1790,6 @@ netbsdelf*-gnu) dynamic_linker='NetBSD ld.elf_so' ;; -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no @@ -1706,8 +1827,13 @@ nto-qnx*) openbsd*) version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no - need_version=yes + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -1745,13 +1871,6 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - solaris*) version_type=linux need_lib_prefix=no @@ -1777,7 +1896,7 @@ sunos4*) need_version=yes ;; -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) +sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' @@ -1810,6 +1929,29 @@ sysv4*MP*) fi ;; +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -1823,6 +1965,11 @@ uts4*) esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi ])# AC_LIBTOOL_SYS_DYNAMIC_LINKER @@ -1847,6 +1994,9 @@ if test -f "$ltmain" && test -n "$tagnames"; then AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) fi fi + if test -z "$LTCFLAGS"; then + eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" + fi # Extract list of available tagged configurations in $ofile. # Note that this assumes the entire list is on one line. @@ -1873,7 +2023,9 @@ if test -f "$ltmain" && test -n "$tagnames"; then case $tagname in CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then AC_LIBTOOL_LANG_CXX_CONFIG else tagname="" @@ -1935,7 +2087,7 @@ AC_DEFUN([AC_LIBTOOL_DLOPEN], # AC_LIBTOOL_WIN32_DLL # -------------------- -# declare package support for building win32 dll's +# declare package support for building win32 DLLs AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) ])# AC_LIBTOOL_WIN32_DLL @@ -1973,7 +2125,7 @@ AC_ARG_ENABLE([shared], # AC_DISABLE_SHARED # ----------------- -#- set the default shared flag to --disable-shared +# set the default shared flag to --disable-shared AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_SHARED(no) @@ -2109,7 +2261,7 @@ dnl not every word. This closes a longstanding sh security hole. if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then @@ -2219,7 +2371,7 @@ AC_CACHE_VAL(lt_cv_path_LD, if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. + # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; @@ -2356,7 +2517,7 @@ gnu*) hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file - case "$host_cpu" in + case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so @@ -2372,6 +2533,11 @@ hpux10.20* | hpux11*) esac ;; +interix3*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; @@ -2383,11 +2549,11 @@ irix5* | irix6* | nonstopux*) ;; # This must be Linux ELF. -linux*) +linux* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; -netbsd* | netbsdelf*-gnu | knetbsd*-gnu) +netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else @@ -2406,12 +2572,10 @@ nto-qnx*) ;; openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; @@ -2419,15 +2583,11 @@ osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - solaris*) lt_cv_deplibs_check_method=pass_all ;; -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) +sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' @@ -2448,10 +2608,13 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) siemens) lt_cv_deplibs_check_method=pass_all ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; esac ;; -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac @@ -2471,36 +2634,43 @@ AC_DEFUN([AC_PROG_NM], # Let the user override the test. lt_cv_path_NM="$NM" else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/${ac_tool_prefix}nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" break ;; *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac ;; esac - esac - fi + fi + done + IFS="$lt_save_ifs" done - IFS="$lt_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi]) NM="$lt_cv_path_NM" @@ -2532,13 +2702,13 @@ esac # ----------------------------------- # sets LIBLTDL to the link flags for the libltdl convenience library and # LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. +# --enable-ltdl-convenience to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, +# it is assumed to be `libltdl'. LIBLTDL will be prefixed with +# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/' +# (note the single quotes!). If your package is not flat and you're not +# using automake, define top_builddir and top_srcdir appropriately in +# the Makefiles. AC_DEFUN([AC_LIBLTDL_CONVENIENCE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl case $enable_ltdl_convenience in @@ -2557,13 +2727,13 @@ AC_DEFUN([AC_LIBLTDL_CONVENIENCE], # ----------------------------------- # sets LIBLTDL to the link flags for the libltdl installable library and # LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided and an installed libltdl is not found, it is -# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' -# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single -# quotes!). If your package is not flat and you're not using automake, -# define top_builddir and top_srcdir appropriately in the Makefiles. +# --enable-ltdl-install to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, +# and an installed libltdl is not found, it is assumed to be `libltdl'. +# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and top_srcdir +# appropriately in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. AC_DEFUN([AC_LIBLTDL_INSTALLABLE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl @@ -2601,10 +2771,21 @@ AC_DEFUN([AC_LIBTOOL_CXX], # --------------- AC_DEFUN([_LT_AC_LANG_CXX], [AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) ])# _LT_AC_LANG_CXX +# _LT_AC_PROG_CXXCPP +# ------------------ +AC_DEFUN([_LT_AC_PROG_CXXCPP], +[ +AC_REQUIRE([AC_PROG_CXX]) +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +fi +])# _LT_AC_PROG_CXXCPP # AC_LIBTOOL_F77 # -------------- @@ -2644,7 +2825,7 @@ _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) # AC_LIBTOOL_RC -# -------------- +# ------------- # enable support for Windows resource files AC_DEFUN([AC_LIBTOOL_RC], [AC_REQUIRE([LT_AC_PROG_RC]) @@ -2677,36 +2858,9 @@ lt_simple_link_test_code='int main(){return(0);}\n' _LT_AC_SYS_COMPILER -# -# Check for any special shared library compilation flags. -# -_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' - ;; - esac -fi -if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then - AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) - _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), - $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), - [], - [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) - +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) @@ -2716,9 +2870,9 @@ AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) +AC_LIBTOOL_DLOPEN_SELF -# Report which librarie types wil actually be built +# Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -2727,7 +2881,7 @@ test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. -case "$host_os" in +case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then @@ -2739,43 +2893,6 @@ aix3*) aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no - fi - ;; - darwin* | rhapsody*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac @@ -2802,7 +2919,7 @@ AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], [AC_LANG_PUSH(C++) AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(allow_undefined_flag, $1)= @@ -2814,6 +2931,7 @@ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= _LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(hardcode_automatic, $1)=no _LT_AC_TAGVAR(module_cmds, $1)= _LT_AC_TAGVAR(module_expsym_cmds, $1)= @@ -2831,7 +2949,7 @@ _LT_AC_TAGVAR(postdeps, $1)= _LT_AC_TAGVAR(compiler_lib_search_path, $1)= # Source file extension for C++ test sources. -ac_ext=cc +ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o @@ -2841,11 +2959,15 @@ _LT_AC_TAGVAR(objext, $1)=$objext lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' +lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -2856,18 +2978,18 @@ lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else - unset lt_cv_prog_gnu_ld + $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else - unset lt_cv_path_LD + $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -2956,6 +3078,7 @@ case $host_os in ;; esac done + ;; esac exp_sym_flag='-bexport' @@ -2974,7 +3097,7 @@ case $host_os in _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) + case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` @@ -2993,8 +3116,12 @@ case $host_os in _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= fi + ;; esac shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi else # not using gcc if test "$host_cpu" = ia64; then @@ -3021,12 +3148,12 @@ case $host_os in _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX @@ -3035,16 +3162,26 @@ case $host_os in # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + # This is similar to how AIX traditionally builds its shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + chorus*) case $cc_basename in *) @@ -3063,7 +3200,7 @@ case $host_os in _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then @@ -3072,70 +3209,81 @@ case $host_os in echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; - - darwin* | rhapsody*) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; dgux*) case $cc_basename in - ec++) + ec++*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - ghcx) + ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3146,14 +3294,14 @@ case $host_os in ;; esac ;; - freebsd[12]*) + freebsd[[12]]*) # C++ shared libraries reported to be fairly broken before switch to ELF _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; - freebsd* | kfreebsd*-gnu) + freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_AC_TAGVAR(ld_shlibs, $1)=yes @@ -3170,11 +3318,11 @@ case $host_os in # location of the library. case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC) + aCC*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -3184,7 +3332,7 @@ case $host_os in # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then @@ -3198,34 +3346,23 @@ case $host_os in ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi - case "$host_cpu" in - hppa*64*) + case $host_cpu in + hppa*64*|ia64*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; - ia64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; *) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, @@ -3235,14 +3372,17 @@ case $host_os in esac case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + aCC*) + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -3261,9 +3401,12 @@ case $host_os in *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -3277,11 +3420,25 @@ case $host_os in ;; esac ;; + interix3*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; irix5* | irix6*) case $cc_basename in - CC) + CC*) # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -3292,7 +3449,7 @@ case $host_os in *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -3303,9 +3460,9 @@ case $host_os in _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; - linux*) + linux* | k*bsd*-gnu) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3330,17 +3487,41 @@ case $host_os in # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc) + icpc*) # Intel C++ with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - cxx) + pgCC*) + # Portland Group C++ compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -3371,7 +3552,7 @@ case $host_os in ;; mvs*) case $cc_basename in - cxx) + cxx*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3381,7 +3562,7 @@ case $host_os in ;; esac ;; - netbsd* | netbsdelf*-gnu | knetbsd*-gnu) + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= @@ -3392,9 +3573,25 @@ case $host_os in # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; + openbsd2*) + # C++ shared libraries are fairly broken + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + ;; osf3*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3410,14 +3607,14 @@ case $host_os in _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx) + cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3435,7 +3632,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3454,7 +3651,7 @@ case $host_os in ;; osf4* | osf5*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3469,17 +3666,17 @@ case $host_os in # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx) + cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -3498,7 +3695,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3519,27 +3716,14 @@ case $host_os in # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - sco*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - lcc) + lcc*) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3552,36 +3736,33 @@ case $host_os in ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is @@ -3589,7 +3770,7 @@ case $host_os in # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; - gcx) + gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -3627,12 +3808,63 @@ case $host_os in ;; esac ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + # So that behaviour is only enabled if SCOABSPATH is set to a + # non-empty value in the environment. Most likely only useful for + # creating official distributions of packages. + # This is a hack until libtool officially supports absolute path + # names for shared libraries. + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3665,8 +3897,6 @@ AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) AC_LIBTOOL_CONFIG($1) @@ -3684,7 +3914,7 @@ lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld ])# AC_LIBTOOL_LANG_CXX_CONFIG # AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) -# ------------------------ +# ------------------------------------ # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary @@ -3738,7 +3968,7 @@ if AC_TRY_EVAL(ac_compile); then # The `*' in the case matches for architectures that use `case' in # $output_verbose_cmd can trigger glob expansion during the loop # eval without this substitution. - output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" + output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` for p in `eval $output_verbose_link_cmd`; do case $p in @@ -3814,13 +4044,37 @@ fi $rm -f confest.$objext +# PORTME: override above test on systems where it is broken +ifelse([$1],[CXX], +[case $host_os in +interix3*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_AC_TAGVAR(predep_objects,$1)= + _LT_AC_TAGVAR(postdep_objects,$1)= + _LT_AC_TAGVAR(postdeps,$1)= + ;; + +solaris*) + case $cc_basename in + CC*) + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + _LT_AC_TAGVAR(postdeps,$1)='-lCstd -lCrun' + ;; + esac + ;; +esac +]) + case " $_LT_AC_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac ])# AC_LIBTOOL_POSTDEP_PREDEP # AC_LIBTOOL_LANG_F77_CONFIG -# ------------------------ +# -------------------------- # Ensure that the configuration vars for the C compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. @@ -3864,12 +4118,16 @@ lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -3879,7 +4137,7 @@ test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. -case "$host_os" in +case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then @@ -3888,7 +4146,9 @@ aix3*) fi ;; aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi ;; esac AC_MSG_RESULT([$enable_shared]) @@ -3898,8 +4158,6 @@ AC_MSG_CHECKING([whether to build static libraries]) test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - _LT_AC_TAGVAR(GCC, $1)="$G77" _LT_AC_TAGVAR(LD, $1)="$LD" @@ -3909,8 +4167,6 @@ AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP - AC_LIBTOOL_CONFIG($1) @@ -3939,20 +4195,27 @@ _LT_AC_TAGVAR(objext, $1)=$objext lt_simple_compile_test_code="class foo {}\n" # Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds + AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) @@ -3960,8 +4223,6 @@ AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) AC_LIBTOOL_CONFIG($1) @@ -3971,7 +4232,7 @@ CC="$lt_save_CC" # AC_LIBTOOL_LANG_RC_CONFIG -# -------------------------- +# ------------------------- # Ensure that the configuration vars for the Windows resource compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. @@ -3995,11 +4256,16 @@ lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes AC_LIBTOOL_CONFIG($1) @@ -4029,7 +4295,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -4135,7 +4401,7 @@ ifelse([$1], [], # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -4146,11 +4412,11 @@ ifelse([$1], [], SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags= @@ -4181,6 +4447,12 @@ fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo @@ -4192,6 +4464,9 @@ AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + # A language-specific compiler. CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) @@ -4257,7 +4532,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -4531,9 +4806,6 @@ symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" @@ -4555,15 +4827,31 @@ hpux*) # Its linker distinguishes data from code symbols lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; +linux* | k*bsd*-gnu) + if test "$host_cpu" = ia64; then + symcode='[[ABCDGIRSTW]]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; -solaris* | sysv5*) +solaris*) symcode='[[BDRT]]' ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; sysv4) symcode='[[DFNSTU]]' ;; @@ -4586,8 +4874,11 @@ esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no @@ -4743,6 +5034,10 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) # DJGPP does not support shared libraries at all _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ;; + interix3*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; sysv4*MP*) if test -d /usr/nec; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic @@ -4751,7 +5046,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) ;; *) @@ -4776,18 +5071,28 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; chorus*) case $cc_basename in - cxch68) + cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; dgux*) case $cc_basename in - ec++) + ec++*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; - ghcx) + ghcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4795,22 +5100,22 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; esac ;; - freebsd* | kfreebsd*-gnu) + freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; - aCC) + aCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -4823,9 +5128,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; esac ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. @@ -4834,20 +5143,26 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; esac ;; - linux*) + linux* | k*bsd*-gnu) case $cc_basename in - KCC) + KCC*) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; - icpc) + icpc* | ecpc*) # Intel C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - cxx) + pgCC*) + # Portland Group C++ compiler. + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -4864,25 +5179,25 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; mvs*) case $cc_basename in - cxx) + cxx*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; - netbsd* | netbsdelf*-gnu | knetbsd*-gnu) + netbsd* | netbsdelf*-gnu) ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC) + KCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; - RCC) + RCC*) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; - cxx) + cxx*) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -4896,24 +5211,15 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; psos*) ;; - sco*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - *) - ;; - esac - ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; - gcx) + gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; @@ -4923,12 +5229,12 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - lcc) + lcc*) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4938,7 +5244,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; @@ -4946,7 +5252,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; esac ;; - unixware*) + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac ;; vxworks*) ;; @@ -4993,6 +5306,11 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; + interix3*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. @@ -5009,7 +5327,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -5035,6 +5353,16 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being @@ -5046,7 +5374,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -5069,13 +5397,20 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - linux*) - case $CC in + linux* | k*bsd*-gnu) + case $cc_basename in icc* | ecc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; ccc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. @@ -5090,15 +5425,15 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' - ;; - solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac ;; sunos4*) @@ -5107,7 +5442,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + sysv4 | sysv4.2uw2* | sysv4.3*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' @@ -5120,6 +5455,17 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) fi ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + uts4*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' @@ -5147,7 +5493,7 @@ if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi -case "$host_os" in +case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= @@ -5156,6 +5502,16 @@ case "$host_os" in _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" ;; esac + +# +# Check to make sure the static flag actually works. +# +wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\" +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) ]) @@ -5180,9 +5536,9 @@ ifelse([$1],[CXX],[ _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' ;; - linux*) + linux* | k*bsd*-gnu) _LT_AC_TAGVAR(link_all_deplibs, $1)=no ;; *) @@ -5226,7 +5582,8 @@ ifelse([$1],[CXX],[ # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - + # Just being paranoid about ensuring that cc_basename is set. + _LT_CC_BASENAME([$compiler]) case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time @@ -5236,6 +5593,10 @@ ifelse([$1],[CXX],[ with_gnu_ld=no fi ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; openbsd*) with_gnu_ld=no ;; @@ -5246,6 +5607,27 @@ ifelse([$1],[CXX],[ # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -5296,10 +5678,10 @@ EOF _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then @@ -5308,13 +5690,60 @@ EOF echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else - ld_shlibs=no + _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; - netbsd* | netbsdelf*-gnu | knetbsd*-gnu) + interix3*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=no + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= @@ -5324,7 +5753,7 @@ EOF fi ;; - solaris* | sysv5*) + solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then _LT_AC_TAGVAR(ld_shlibs, $1)=no cat <&2 @@ -5345,6 +5774,33 @@ EOF fi ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + sunos4*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= @@ -5352,32 +5808,6 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds" - fi - _LT_AC_TAGVAR(link_all_deplibs, $1)=no - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -5388,16 +5818,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -5409,7 +5834,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported @@ -5443,6 +5868,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ break fi done + ;; esac exp_sym_flag='-bexport' @@ -5461,7 +5887,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) + case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` @@ -5480,8 +5906,12 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= fi + ;; esac shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi else # not using gcc if test "$host_cpu" = ia64; then @@ -5489,11 +5919,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else - if test "$aix_use_runtimelinking" = yes; then + if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' - fi + fi fi fi @@ -5507,12 +5937,12 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX @@ -5521,13 +5951,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + # This is similar to how AIX traditionally builds its shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; @@ -5540,7 +5968,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - bsdi4*) + bsdi[[45]]*) _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; @@ -5561,57 +5989,57 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; darwin* | rhapsody*) - if test "$GXX" = yes ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; + case $host_os in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - _LT_AC_TAGVAR(ld_shlibs, $1)=no + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac fi ;; @@ -5645,7 +6073,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) + freebsd* | dragonfly*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes @@ -5668,47 +6096,62 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; - hpux10* | hpux11*) + hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + case $host_cpu in + hppa*64*|ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' @@ -5732,7 +6175,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; - netbsd* | netbsdelf*-gnu | knetbsd*-gnu) + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else @@ -5756,6 +6199,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else @@ -5801,7 +6245,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -5809,21 +6253,15 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; - sco3.2v5*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -5832,8 +6270,18 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; @@ -5890,36 +6338,45 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ fi ;; - sysv4.2uw2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; + runpath_var='LD_RUN_PATH' - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; - sysv5*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi ;; uts4*) @@ -5937,11 +6394,6 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - # # Do we need to explicitly link libc? # @@ -5969,6 +6421,7 @@ x|xyes) libobjs=conftest.$ac_objext deplibs= wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= @@ -6094,7 +6547,7 @@ lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break + test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in @@ -6119,8 +6572,8 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do fi done done -SED=$lt_cv_path_SED ]) +SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) @@ -6346,7 +6799,7 @@ if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_ifval([$1], [$1], [0.9.0]) + _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) @@ -6382,14 +6835,30 @@ fi]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$PKG_CONFIG"; then + if test -n "$$1"; then + pkg_cv_[]$1="$$1" + else PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], [pkg_failed=yes]) + fi else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # @@ -6411,19 +6880,30 @@ AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + if test $pkg_failed = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + fi # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD ifelse([$4], , [AC_MSG_ERROR(dnl -[Package requirements ($2) were not met. +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables -to avoid the need to call pkg-config. See the pkg-config man page for -more details.])], +_PKG_TEXT +])], [$4]) elif test $pkg_failed = untried; then ifelse([$4], , [AC_MSG_FAILURE(dnl @@ -6431,9 +6911,7 @@ elif test $pkg_failed = untried; then is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. -Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables -to avoid the need to call pkg-config. See the pkg-config man page for -more details. +_PKG_TEXT To get pkg-config, see .])], [$4]) @@ -6467,20 +6945,21 @@ AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run , enable_sdltest=yes) if test x$sdl_exec_prefix != x ; then - sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" - if test x${SDL_CONFIG+set} != xset ; then - SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config - fi + sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config + fi fi if test x$sdl_prefix != x ; then - sdl_args="$sdl_args --prefix=$sdl_prefix" - if test x${SDL_CONFIG+set} != xset ; then - SDL_CONFIG=$sdl_prefix/bin/sdl-config - fi + sdl_args="$sdl_args --prefix=$sdl_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_prefix/bin/sdl-config + fi fi - AC_REQUIRE([AC_CANONICAL_TARGET]) - PATH="$prefix/bin:$prefix/usr/bin:$PATH" + if test "x$prefix" != xNONE; then + PATH="$prefix/bin:$prefix/usr/bin:$PATH" + fi AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH]) min_sdl_version=ifelse([$1], ,0.11.0,$1) AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) @@ -6499,8 +6978,10 @@ AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_sdltest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" + ac_save_CXXFLAGS="$CXXFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $SDL_CFLAGS" + CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" dnl dnl Now check if the installed SDL is sufficiently new. (Also sanity @@ -6566,6 +7047,7 @@ int main (int argc, char *argv[]) ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" + CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" fi fi @@ -6585,6 +7067,7 @@ int main (int argc, char *argv[]) else echo "*** Could not run SDL test program, checking why..." CFLAGS="$CFLAGS $SDL_CFLAGS" + CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" AC_TRY_LINK([ #include @@ -6609,6 +7092,7 @@ int main(int argc, char *argv[]) echo "*** or that you have moved SDL since it was installed. In the latter case, you" echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" + CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" fi fi @@ -6621,34 +7105,57 @@ int main(int argc, char *argv[]) rm -f conf.sdltest ]) -# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# -*- Autoconf -*- +# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Generated from amversion.in; do not edit by hand. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. -AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.9.5])]) + [AM_AUTOMAKE_VERSION([1.8.5])]) -# Figure out how to run the assembler. -*- Autoconf -*- +# Figure out how to run the assembler. -*- Autoconf -*- -# Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# serial 3 -# serial 4 +# Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. # AM_PROG_AS # ---------- @@ -6661,13 +7168,24 @@ AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)]) AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)]) ]) -# AM_AUX_DIR_EXPAND -*- Autoconf -*- +# AM_AUX_DIR_EXPAND -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# Copyright (C) 2001, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to @@ -6715,14 +7233,25 @@ am_aux_dir=`cd $ac_aux_dir && pwd` ]) -# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2005 +# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003 # Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. -# serial 4 +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 # This was merged into AC_PROG_CC in Autoconf. @@ -6737,16 +7266,26 @@ am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc ]) AU_DEFUN([fp_PROG_CC_STDC]) -# AM_CONDITIONAL -*- Autoconf -*- +# AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# Copyright (C) 1997, 2000, 2001, 2003 Free Software Foundation, Inc. -# serial 7 +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 6 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- @@ -6766,19 +7305,30 @@ else fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([[conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]]) + AC_MSG_ERROR([conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]) fi])]) +# serial 7 -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. -# serial 8 +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, @@ -6787,6 +7337,7 @@ fi])]) # CC etc. in the Makefile, will ask for an AC_PROG_CC use... + # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. @@ -6926,16 +7477,26 @@ AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) -# Generate code to set up dependency tracking. -*- Autoconf -*- +# Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -#serial 3 +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +#serial 2 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ @@ -6954,21 +7515,27 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], else continue fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. + grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue @@ -6994,20 +7561,31 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Do all the work for Automake. -*- Autoconf -*- +# Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 12 - -# This macro actually does too much. Some checks are only needed if +# This macro actually does too much some checks are only needed if # your package does certain things. But this isn't really a big deal. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 11 + # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- @@ -7064,6 +7642,7 @@ AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG(AMTAR, tar) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl @@ -7072,9 +7651,7 @@ AC_REQUIRE([AM_PROG_MKDIR_P])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) + _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], @@ -7108,27 +7685,51 @@ for _am_header in $config_headers :; do done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. + +# Copyright (C) 2001, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) -# Copyright (C) 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# -*- Autoconf -*- +# Copyright (C) 2003 Free Software Foundation, Inc. -# serial 2 +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 1 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. @@ -7143,17 +7744,28 @@ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) -# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# Add --enable-maintainer-mode option to configure. # From Jim Meyering -# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. -# serial 4 +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) @@ -7172,15 +7784,26 @@ AC_DEFUN([AM_MAINTAINER_MODE], AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) -# Check to see how 'make' treats includes. -*- Autoconf -*- +# Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. -# serial 3 +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 # AM_MAKE_INCLUDE() # ----------------- @@ -7224,16 +7847,27 @@ AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- +# -*- Autoconf -*- -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. -# serial 4 +# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ @@ -7259,16 +7893,27 @@ else fi ]) -# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. -# + +# Copyright (C) 2003, 2004 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). @@ -7289,21 +7934,13 @@ fi # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in + # Keeping the `.' argument allows $(mkdir_p) to be used without + # argument. Indeed, we sometimes output rules like # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' + # where $(somedir) is conditionally defined. + # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more + # expensive solution, as it forces Make to start a sub-shell.) + mkdir_p='mkdir -p -- .' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as @@ -7322,15 +7959,26 @@ else fi AC_SUBST([mkdir_p])]) -# Helper functions for option handling. -*- Autoconf -*- +# Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. -# serial 3 +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 # _AM_MANGLE_OPTION(NAME) # ----------------------- @@ -7355,16 +8003,28 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 -# Free Software Foundation, Inc. # -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# Check to make sure that the build environment is sane. +# -# serial 4 +# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 # AM_SANITY_CHECK # --------------- @@ -7407,14 +8067,25 @@ Check your system clock]) fi AC_MSG_RESULT(yes)]) -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - # AM_PROG_INSTALL_STRIP -# --------------------- + +# Copyright (C) 2001, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip @@ -7435,99 +8106,3 @@ fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) -m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir - -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - diff --git a/veejay-ng/config.guess b/veejay-ng/config.guess index 45bee139..c38553dc 100755 --- a/veejay-ng/config.guess +++ b/veejay-ng/config.guess @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2005-04-22' +timestamp='2006-02-23' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -17,13 +17,15 @@ timestamp='2005-04-22' # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. @@ -66,11 +68,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -104,7 +106,7 @@ set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; @@ -123,7 +125,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' +esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) @@ -196,55 +198,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" - exit 0 ;; - amd64:OpenBSD:*:*) - echo x86_64-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - cats:OpenBSD:*:*) - echo arm-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - luna88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mips64-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit 0 ;; + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -297,40 +267,43 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; + exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix - exit 0 ;; + exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 - exit 0 ;; + exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 - exit 0;; + exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; + exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; + exit ;; *:OS/390:*:*) echo i370-ibm-openedition - exit 0 ;; + exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe - exit 0 ;; + exit ;; *:OS400:*:*) echo powerpc-ibm-os400 - exit 0 ;; + exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp - exit 0;; + exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then @@ -338,32 +311,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in else echo pyramid-pyramid-bsd fi - exit 0 ;; + exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 - exit 0 ;; + exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 - exit 0 ;; + exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; + sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) @@ -372,10 +345,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; + exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 @@ -387,10 +360,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo sparc-sun-sunos${UNAME_RELEASE} ;; esac - exit 0 ;; + exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -401,40 +374,40 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 - exit 0 ;; + exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; + exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -458,32 +431,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit (-1); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; + exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax - exit 0 ;; + exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix - exit 0 ;; + exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 - exit 0 ;; + exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 - exit 0 ;; + exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` @@ -499,29 +473,29 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit 0 ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 - exit 0 ;; + exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 - exit 0 ;; + exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd - exit 0 ;; + exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; + exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix - exit 0 ;; + exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` @@ -529,7 +503,7 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build @@ -544,14 +518,18 @@ EOF exit(0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi - exit 0 ;; + exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then @@ -565,28 +543,28 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:*:*) echo rs6000-ibm-aix - exit 0 ;; + exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 - exit 0 ;; + exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 + exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx - exit 0 ;; + exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 - exit 0 ;; + exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd - exit 0 ;; + exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 - exit 0 ;; + exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in @@ -648,9 +626,19 @@ EOF esac if [ ${HP_ARCH} = "hppa2.0w" ] then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else @@ -658,11 +646,11 @@ EOF fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -690,161 +678,177 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 - exit 0 ;; + exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd - exit 0 ;; + exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd - exit 0 ;; + exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix - exit 0 ;; + exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf - exit 0 ;; + exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf - exit 0 ;; + exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi - exit 0 ;; + exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites - exit 0 ;; + exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit 0 ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit 0 ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit 0 ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit 0 ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; + exit ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; + exit ;; + i*:MSYS_NT-*:*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:[34]*) - echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' - exit 0 ;; + exit ;; + x86:Interix*:[345]*) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T:Interix*:[345]*) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks - exit 0 ;; + exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix - exit 0 ;; + exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; - amd64:CYGWIN*:*:*) + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin - exit 0 ;; + exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin - exit 0 ;; + exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; + exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit 0 ;; + exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; + exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu - exit 0 ;; + exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu - exit 0 ;; + exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu - exit 0 ;; + exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -861,8 +865,12 @@ EOF #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -880,15 +888,22 @@ EOF #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu - exit 0 ;; + exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu - exit 0 ;; + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -902,7 +917,7 @@ EOF objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -910,25 +925,28 @@ EOF PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac - exit 0 ;; + exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu - exit 0 ;; + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; + exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu - exit 0 ;; + exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent @@ -946,15 +964,15 @@ EOF ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; + exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; + exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; + exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build @@ -971,7 +989,7 @@ EOF LIBC=gnulibc1 # endif #else - #ifdef __INTEL_COMPILER + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun) LIBC=gnu #else LIBC=gnuaout @@ -981,16 +999,23 @@ EOF LIBC=dietlibc #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 - exit 0 ;; + exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... @@ -998,27 +1023,27 @@ EOF # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; + exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; + exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; - i*86:syllable:*:*) + exit ;; + i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable - exit 0 ;; + exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; + exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then @@ -1026,15 +1051,16 @@ EOF else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi - exit 0 ;; - i*86:*:5:[78]*) + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi - exit 0 ;; + exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv - exit 0 ;; + exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv - exit 0 ;; + exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix - exit 0 ;; + exit ;; M68*:*:R3V[5678]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; + && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 - exit 0 ;; + exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; + exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` @@ -1126,73 +1152,72 @@ EOF else echo ns32k-sni-sysv fi - exit 0 ;; + exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 - exit 0 ;; + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 - exit 0 ;; + exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 - exit 0 ;; + exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos - exit 0 ;; + exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos - exit 0 ;; + exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; + exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 - exit 0 ;; + exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi - exit 0 ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos - exit 0 ;; + exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos - exit 0 ;; + exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos - exit 0 ;; + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in - *86) UNAME_PROCESSOR=i686 ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; + exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then @@ -1200,25 +1225,25 @@ EOF UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; + exit ;; *:QNX:*:4*) echo i386-pc-qnx - exit 0 ;; + exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} - exit 0 ;; + exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux - exit 0 ;; + exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv - exit 0 ;; + exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 @@ -1229,41 +1254,47 @@ EOF UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; + exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 - exit 0 ;; + exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex - exit 0 ;; + exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 - exit 0 ;; + exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 - exit 0 ;; + exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 - exit 0 ;; + exit ;; *:ITS:*:*) echo pdp10-unknown-its - exit 0 ;; + exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} - exit 0 ;; + exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; + exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms && exit 0 ;; - I*) echo ia64-dec-vms && exit 0 ;; - V*) echo vax-dec-vms && exit 0 ;; + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix - exit 0 ;; + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1295,7 +1326,7 @@ main () #endif #if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); + printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) @@ -1384,11 +1415,12 @@ main () } EOF -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) @@ -1397,22 +1429,22 @@ then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd - exit 0 ;; + exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; c34*) echo c34-convex-bsd - exit 0 ;; + exit ;; c38*) echo c38-convex-bsd - exit 0 ;; + exit ;; c4*) echo c4-convex-bsd - exit 0 ;; + exit ;; esac fi diff --git a/veejay-ng/config.sub b/veejay-ng/config.sub index 87a1ee49..ad9f3957 100755 --- a/veejay-ng/config.sub +++ b/veejay-ng/config.sub @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2005-04-22' +timestamp='2006-02-23' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -21,14 +21,15 @@ timestamp='2005-04-22' # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # @@ -83,11 +84,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -99,7 +100,7 @@ while test $# -gt 0 ; do *local*) # First pass through any local machine types. echo $1 - exit 0;; + exit ;; * ) break ;; @@ -118,8 +119,9 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ - kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -170,6 +172,10 @@ case $os in -hiux*) os=-hiuxwe2 ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -186,6 +192,10 @@ case $os in # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -238,7 +248,7 @@ case $basic_machine in | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ + | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -247,6 +257,7 @@ case $basic_machine in | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ @@ -255,13 +266,15 @@ case $basic_machine in | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | mt \ | msp430 \ + | nios | nios2 \ | ns16k | ns32k \ - | openrisc | or32 \ + | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b \ @@ -273,6 +286,9 @@ case $basic_machine in | z8k) basic_machine=$basic_machine-unknown ;; + m32c) + basic_machine=$basic_machine-unknown + ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown @@ -280,6 +296,9 @@ case $basic_machine in ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; + ms1) + basic_machine=mt-unknown + ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and @@ -321,6 +340,7 @@ case $basic_machine in | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ @@ -329,14 +349,16 @@ case $basic_machine in | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ + | mt-* \ | msp430-* \ + | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ | sparclite-* \ @@ -351,6 +373,8 @@ case $basic_machine in | ymp-* \ | z8k-*) ;; + m32c-*) + ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) @@ -686,6 +710,9 @@ case $basic_machine in basic_machine=i386-pc os=-msdos ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; mvs) basic_machine=i370-ibm os=-mvs @@ -761,9 +788,8 @@ case $basic_machine in basic_machine=hppa1.1-oki os=-proelf ;; - or32 | or32-*) + openrisc | openrisc-*) basic_machine=or32-unknown - os=-coff ;; os400) basic_machine=powerpc-ibm @@ -794,6 +820,12 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; @@ -850,6 +882,10 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -1089,12 +1125,9 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sh64) - basic_machine=sh64-unknown - ;; sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; @@ -1168,20 +1201,23 @@ case $os in | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1199,7 +1235,7 @@ case $os in os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) @@ -1388,6 +1424,9 @@ case $basic_machine in *-be) os=-beos ;; + *-haiku) + os=-haiku + ;; *-ibm) os=-aix ;; @@ -1559,7 +1598,7 @@ case $basic_machine in esac echo $basic_machine$os -exit 0 +exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) diff --git a/veejay-ng/configure.ac b/veejay-ng/configure.ac index 48e74c58..efa5480d 100644 --- a/veejay-ng/configure.ac +++ b/veejay-ng/configure.ac @@ -123,8 +123,6 @@ AC_SUBST(LIBGETOPT_LIB) AC_TYPE_SIGNAL AC_MSG_NOTICE([The host is $host $host_cpu $host_vendor $host_os .]) -have_glut=false -have_glu=false have_sdl=false have_gl=false have_display=false @@ -149,21 +147,6 @@ if test x$use_display != xno ; then AC_MSG_ERROR([Cannot find openGL library]) fi - AC_CHECK_HEADERS(GL/glut.h ,, - [AC_MSG_ERROR([Cannot find Glut headers]) ]) - - AC_CHECK_LIB([glut], [glutInit], have_glut=true) - if test x$have_glut = xtrue; then - GL_LIBS="$GL_LIBS -lglut" - else - AC_MSG_ERROR([Cannot find glut library]) - fi - AC_CHECK_LIB([GLU], [gluProject], have_glu=true) - if test x$have_glu = xtrue; then - GL_LIBS="$GL_LIBS -lGLU" - else - AC_MSG_ERROR([Cannot find GLU library]) - fi AC_SUBST( GL_LIBS ) AC_SUBST( GL_CFLAGS ) fi @@ -263,10 +246,26 @@ dnl AC_DEFINE(HAVE_AVFORMAT, 1, [use avformat])], [have_avformat=false]) + PKG_CHECK_MODULES(FFMPEG_SWSCALER, [libswscale], + [ + AC_SUBST( FFMPEG_SWSCALER_CFLAGS ) + AC_SUBST( FFMPEG_SWSCALER_LIBS ) + have_swscaler=true + AC_DEFINE(HAVE_SWSCALER,1,[use swscaler])], + [ have_swscaler=false ] ) + + if test x$have_avcodec != xtrue ; then - AC_MSG_ERROR([ FFmpeg not found. Get it from http://ffmpeg.sourceforge.net ] ) + AC_MSG_ERROR([ FFmpeg AVCodec not found. Get it from http://ffmpeg.sourceforge.net ] ) fi +if test x$have_avformat != xtrue; then + AC_MSG_ERROR([ FFmpeg AVFormat not found. ]) +fi + +if test x$have_swscaler != xtrue; then + AC_MSG_ERROR([ FFMpeg swsacler not found. ]) +fi dnl ********************************************************************* @@ -405,7 +404,7 @@ AC_SUBST(SAMPLERATE_LIBS) fi have_unicap=false -PKG_CHECK_MODULES( UNICAP, libunicap >= 1.14.1, +PKG_CHECK_MODULES( UNICAP, libunicap >= 0.1.0, ac_cv_unicap=1, ac_cv_unicap=0) AC_DEFINE_UNQUOTED([HAVE_UNICAP], ${ac_cv_unicap}, @@ -481,6 +480,8 @@ have_mips=false have_ppccpu=false have_ps2=false +YUVCFLAGS="" + AC_MSG_CHECKING([Architecture]) case $host_cpu in i[[3-7]]86) @@ -494,7 +495,8 @@ case $host_cpu in if test "x$enable_debug" != "xyes" ; then dnl optimize if not debugging - CFLAGS="-fno-common -O2 -fomit-frame-pointer" + CFLAGS="-fno-common -O3 -fomit-frame-pointer" + YUVCFLAGS="-fif-conversion" fi dnl If the host is pentium, align on double word boundary @@ -557,6 +559,8 @@ dnl CFLAGS="$CFLAGS -no-cpp-precomp" ;; esac +AC_SUBST(YUVCFLAGS) + dnl This flag is used for PROGRAMS not SHARED LIBRARIES. PIC code is required dnl for shared libraries but is slower than non-pic code. Compute bound dnl programs such as yuvdenoise and y4mspatialfilter can use this flag by diff --git a/veejay-ng/depcomp b/veejay-ng/depcomp index ffcd540c..25bdb188 100755 --- a/veejay-ng/depcomp +++ b/veejay-ng/depcomp @@ -1,9 +1,9 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2005-02-09.22 +scriptversion=2004-04-25.13 -# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -43,18 +43,17 @@ Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF - exit $? + exit 0 ;; -v | --v*) echo "depcomp $scriptversion" - exit $? + exit 0 ;; esac @@ -62,10 +61,18 @@ if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" @@ -287,43 +294,33 @@ tru64) base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mecanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + # Dependencies are output in .lo.d with libtool 1.4. + # They are output in .o.d with libtool 1.5. + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.o.d" + tmpdepfile3="$dir.libs/$base.d" "$@" -Wc,-MD else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + tmpdepfile3="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + elif test -f "$tmpdepfile2"; then + tmpdepfile="$tmpdepfile2" + else + tmpdepfile="$tmpdepfile3" + fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. diff --git a/veejay-ng/examples/lachspiegel.sh b/veejay-ng/examples/lachspiegel.sh index 8a89f28d..e0cdc91b 100755 --- a/veejay-ng/examples/lachspiegel.sh +++ b/veejay-ng/examples/lachspiegel.sh @@ -3,12 +3,12 @@ sayOSC localhost 3490 s /sample_1/fx_1/set "LVDActivity GhostLoop" sayOSC localhost 3490 s /sample_1/fx_2/set "LVDFun House Mirror" sayOSC localhost 3490 d /sample_1/fx_0/alpha 1.0 sayOSC localhost 3490 i /sample_1/fx_0/status 1 -sayOSC localhost 3490 i /sample_1/fx_1/status 1 +#sayOSC localhost 3490 i /sample_1/fx_1/status 1 sayOSC localhost 3490 i /sample_1/fx_2/status 1 -sayOSC localhost 3490 iii /sample_1/fx_0/bind 0 2 0 -sayOSC localhost 3490 iii /sample_1/fx_0/bind 1 2 1 -sayOSC localhost 3490 iii /sample_1/fx_0/bind 2 2 2 -sayOSC localhost 3490 iii /sample_1/fx_0/bind 3 2 3 -sayOSC localhost 3490 iii /sample_1/fx_0/bind 4 1 0 +#sayOSC localhost 3490 iii /sample_1/fx_0/bind 0 2 0 +#sayOSC localhost 3490 iii /sample_1/fx_0/bind 1 2 1 +#sayOSC localhost 3490 iii /sample_1/fx_0/bind 2 2 2 +#sayOSC localhost 3490 iii /sample_1/fx_0/bind 3 2 3 +#sayOSC localhost 3490 iii /sample_1/fx_0/bind 4 1 0 diff --git a/veejay-ng/install-sh b/veejay-ng/install-sh index 1a835340..e4160c99 100755 --- a/veejay-ng/install-sh +++ b/veejay-ng/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2005-02-02.21 +scriptversion=2004-04-01.17 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -58,6 +58,9 @@ stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" +transformbasename= +transform_arg= +instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= @@ -67,27 +70,23 @@ mvcmd="$mvprog" src= dst= dir_arg= -dstarg= -no_target_directory= -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE +usage="Usage: $0 [OPTION]... SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... + or: $0 -d DIRECTORIES... -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. +In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. +In the second, create the directory path DIR. Options: --c (ignored) +-b=TRANSFORMBASENAME +-c copy source (using $cpprog) instead of moving (using $mvprog). -d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. +-g GROUP $chgrp installed files to GROUP. +-m MODE $chmod installed files to MODE. +-o USER $chown installed files to USER. +-s strip installed files (using $stripprog). +-t=TRANSFORM --help display this help and exit. --version display version info and exit. @@ -97,7 +96,12 @@ Environment variables override the default commands: while test -n "$1"; do case $1 in - -c) shift + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + -c) instcmd=$cpprog + shift continue;; -d) dir_arg=true @@ -109,7 +113,7 @@ while test -n "$1"; do shift continue;; - --help) echo "$usage"; exit $?;; + --help) echo "$usage"; exit 0;; -m) chmodcmd="$chmodprog $2" shift @@ -125,20 +129,14 @@ while test -n "$1"; do shift continue;; - -t) dstarg=$2 - shift - shift - continue;; + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit $?;; + --version) echo "$0 $scriptversion"; exit 0;; *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break + test -n "$dir_arg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do @@ -176,13 +174,13 @@ do src= if test -d "$dst"; then - mkdircmd=: + instcmd=: chmodcmd= else - mkdircmd=$mkdirprog + instcmd=$mkdirprog fi else - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then @@ -204,16 +202,12 @@ do # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. @@ -226,8 +220,7 @@ do oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift + set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` IFS=$oIFS pathcomp= @@ -236,42 +229,51 @@ do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" + $mkdirprog "$pathcomp" || lasterr=$? # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. - test -d "$pathcomp" || exit + test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; } fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ + $doit $instcmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else - dstfile=`basename "$dst"` + # If we're going to rename the final executable, determine the name now. + if test -z "$transformarg"; then + dstfile=`basename "$dst"` + else + dstfile=`basename "$dst" $transformbasename \ + | sed $transformarg`$transformbasename + fi + + # don't allow the sed command to completely eliminate the filename. + test -z "$dstfile" && dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 - # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && + # Move or copy the file name to the temp name + $doit $instcmd "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. + # errors from the above "$doit $instcmd $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ @@ -296,7 +298,7 @@ do || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 + (exit 1); exit } else : @@ -307,12 +309,12 @@ do $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } - fi || { (exit 1); exit 1; } + fi || { (exit 1); exit; } done # The final little trick to "correctly" pass the exit status to the exit trap. { - (exit 0); exit 0 + (exit 0); exit } # Local variables: diff --git a/veejay-ng/libel/avilib.c b/veejay-ng/libel/avilib.c index eb982654..c5c23fab 100644 --- a/veejay-ng/libel/avilib.c +++ b/veejay-ng/libel/avilib.c @@ -27,7 +27,8 @@ #include #include - +#include +#include #include "avilib.h" #define INFO_LIST @@ -68,6 +69,9 @@ static char id_str[MAX_INFO_STRLEN]; #define FRAME_RATE_SCALE 1000000 +extern int vj_el_get_decoder_from_fourcc( const char *fourcc ); + + /******************************************************************* * * * Utilities for writing an AVI File * @@ -200,7 +204,7 @@ static int avi_add_chunk(avi_t *AVI, unsigned char *tag, unsigned char *data, in /* Copy tag and length int c, so that we need only 1 write system call for these two values */ - memcpy(c,tag,4); + veejay_memcpy(c,tag,4); long2str(c+4,length); /* Output tag, length and data, restore previous position @@ -227,16 +231,16 @@ static int avi_add_chunk(avi_t *AVI, unsigned char *tag, unsigned char *data, in #define OUTD(n) long2str(ix00+bl,n); bl+=4 #define OUTW(n) ix00[bl] = (n)&0xff; ix00[bl+1] = (n>>8)&0xff; bl+=2 #define OUTC(n) ix00[bl] = (n)&0xff; bl+=1 -#define OUTS(s) memcpy(ix00+bl,s,4); bl+=4 +#define OUTS(s) veejay_memcpy(ix00+bl,s,4); bl+=4 // this does the physical writeout of the ix## structure static int avi_ixnn_entry(avi_t *AVI, avistdindex_chunk *ch, avisuperindex_entry *en) { int bl, k; unsigned int max = ch->nEntriesInUse * sizeof (uint32_t) * ch->wLongsPerEntry + 24; // header - char *ix00 = malloc (max); + char *ix00 = vj_malloc (max); char dfcc[5]; - memcpy (dfcc, ch->fcc, 4); + veejay_memcpy (dfcc, ch->fcc, 4); dfcc[4] = 0; bl = 0; @@ -285,36 +289,36 @@ static int avi_init_super_index(avi_t *AVI, unsigned char *idxtag, avisuperindex avisuperindex_chunk *sil = NULL; - if ((sil = (avisuperindex_chunk *) malloc (sizeof (avisuperindex_chunk))) == NULL) { + if ((sil = (avisuperindex_chunk *) vj_malloc (sizeof (avisuperindex_chunk))) == NULL) { AVI_errno = AVI_ERR_NO_MEM; return -1; } - memset(sil, 0, sizeof (avisuperindex_chunk)); - memcpy (sil->fcc, "indx", 4); + veejay_memset(sil, 0, sizeof (avisuperindex_chunk)); + veejay_memcpy (sil->fcc, "indx", 4); sil->dwSize = 0; // size of this chunk sil->wLongsPerEntry = 4; sil->bIndexSubType = 0; sil->bIndexType = AVI_INDEX_OF_INDEXES; sil->nEntriesInUse = 0; // none are in use - memcpy (sil->dwChunkId, idxtag, 4); - memset (sil->dwReserved, 0, sizeof (sil->dwReserved)); + veejay_memcpy (sil->dwChunkId, idxtag, 4); + veejay_memset (sil->dwReserved, 0, sizeof (sil->dwReserved)); // NR_IXNN_CHUNKS == allow 32 indices which means 32 GB files -- arbitrary - sil->aIndex = malloc (sil->wLongsPerEntry * NR_IXNN_CHUNKS * sizeof (uint32_t)); + sil->aIndex = vj_malloc (sil->wLongsPerEntry * NR_IXNN_CHUNKS * sizeof (uint32_t)); if (!sil->aIndex) { AVI_errno = AVI_ERR_NO_MEM; return -1; } - memset (sil->aIndex, 0, sil->wLongsPerEntry * NR_IXNN_CHUNKS * sizeof (uint32_t)); + veejay_memset (sil->aIndex, 0, sil->wLongsPerEntry * NR_IXNN_CHUNKS * sizeof (uint32_t)); - sil->stdindex = malloc (NR_IXNN_CHUNKS * sizeof (avistdindex_chunk *)); + sil->stdindex = vj_malloc (NR_IXNN_CHUNKS * sizeof (avistdindex_chunk *)); if (!sil->stdindex) { AVI_errno = AVI_ERR_NO_MEM; return -1; } for (k = 0; k < NR_IXNN_CHUNKS; k++) { - sil->stdindex[k] = malloc (sizeof (avistdindex_chunk)); - memset(sil->stdindex[k], 0, sizeof (avistdindex_chunk)); + sil->stdindex[k] = vj_malloc (sizeof (avistdindex_chunk)); + veejay_memset(sil->stdindex[k], 0, sizeof (avistdindex_chunk)); // gets rewritten later sil->stdindex[k]->qwBaseOffset = (uint64_t)k * NEW_RIFF_THRES; } @@ -324,12 +328,12 @@ static int avi_init_super_index(avi_t *AVI, unsigned char *idxtag, avisuperindex return 0; } -// fills an alloc'ed stdindex structure and mallocs some entries for the actual chunks +// fills an alloc'ed stdindex structure and vj_mallocs some entries for the actual chunks static int avi_add_std_index(avi_t *AVI, unsigned char *idxtag, unsigned char *strtag, avistdindex_chunk *stdil) { - memcpy (stdil->fcc, idxtag, 4); + veejay_memcpy (stdil->fcc, idxtag, 4); stdil->dwSize = 4096; stdil->wLongsPerEntry = 2; //sizeof(avistdindex_entry)/sizeof(uint32_t); stdil->bIndexSubType = 0; @@ -337,11 +341,11 @@ static int avi_add_std_index(avi_t *AVI, unsigned char *idxtag, unsigned char *s stdil->nEntriesInUse = 0; // cp 00db ChunkId - memcpy(stdil->dwChunkId, strtag, 4); + veejay_memcpy(stdil->dwChunkId, strtag, 4); //stdil->qwBaseOffset = AVI->video_superindex->aIndex[ cur_std_idx ]->qwOffset; - stdil->aIndex = malloc(stdil->dwSize * sizeof (uint32_t) * stdil->wLongsPerEntry); + stdil->aIndex = vj_malloc(stdil->dwSize * sizeof (uint32_t) * stdil->wLongsPerEntry); if (!stdil->aIndex) { AVI_errno = AVI_ERR_NO_MEM; @@ -452,16 +456,18 @@ static int avi_add_odml_index_entry(avi_t *AVI, unsigned char *tag, long flags, if (AVI->video_superindex && (off_t)(AVI->pos+towrite) > (off_t)((off_t)NEW_RIFF_THRES*AVI->video_superindex->nEntriesInUse)) { - fprintf(stderr, "Adding a new RIFF chunk: %d\n", AVI->video_superindex->nEntriesInUse); +// fprintf(stderr, "Adding a new RIFF chunk: %d\n", AVI->video_superindex->nEntriesInUse); + veejay_msg( 2, "Adding a new RIFF chunk: %d", AVI->video_superindex->nEntriesInUse ); // rotate ALL indices AVI->video_superindex->nEntriesInUse++; cur_std_idx = AVI->video_superindex->nEntriesInUse-1; if (AVI->video_superindex->nEntriesInUse > NR_IXNN_CHUNKS) { - fprintf (stderr, "Internal error in avilib - redefine NR_IXNN_CHUNKS\n"); - fprintf (stderr, "[avilib dump] cur_std_idx=%d NR_IXNN_CHUNKS=%d" - "POS=%lld towrite=%lld\n", + veejay_msg(0, "Internal error in avilib - redefine NR_IXNN_CHUNKS (needed=%d, current=%d)", + AVI->video_superindex->nEntriesInUse, NR_IXNN_CHUNKS); + veejay_msg(0, "[avilib dump] cur_std_idx=%d NR_IXNN_CHUNKS=%d" + "POS=%lld towrite=%lld", cur_std_idx,NR_IXNN_CHUNKS, AVI->pos, towrite); return -1; } @@ -573,9 +579,7 @@ static int avi_add_index_entry(avi_t *AVI, unsigned char *tag, long flags, unsig /* Add index entry */ - // fprintf(stderr, "INDEX %s %ld %lu %lu\n", tag, flags, pos, len); - - memcpy(AVI->idx[AVI->n_idx],tag,4); + veejay_memcpy(AVI->idx[AVI->n_idx],tag,4); long2str(AVI->idx[AVI->n_idx]+ 4,flags); long2str(AVI->idx[AVI->n_idx]+ 8, pos); long2str(AVI->idx[AVI->n_idx]+12, len); @@ -623,13 +627,13 @@ avi_t* AVI_open_output_file(char * filename) /* Allocate the avi_t struct and zero it */ - AVI = (avi_t *) malloc(sizeof(avi_t)); + AVI = (avi_t *) vj_malloc(sizeof(avi_t)); if(AVI==0) { AVI_errno = AVI_ERR_NO_MEM; return 0; } - memset((void *)AVI,0,sizeof(avi_t)); + veejay_memset((void *)AVI,0,sizeof(avi_t)); /* Since Linux needs a long time when deleting big files, we do not truncate the file when we open it. @@ -681,9 +685,9 @@ void AVI_set_video(avi_t *AVI, int width, int height, double fps, char *compress AVI->fps = fps; if(strncmp(compressor, "RGB", 3)==0) { - memset(AVI->compressor, 0, 4); + veejay_memset(AVI->compressor, 0, 4); } else { - memcpy(AVI->compressor,compressor,4); + veejay_memcpy(AVI->compressor,compressor,4); } AVI->compressor[4] = 0; @@ -691,19 +695,19 @@ void AVI_set_video(avi_t *AVI, int width, int height, double fps, char *compress avi_update_header(AVI); } -void AVI_set_audio(avi_t *AVI, int channels, long rate, int bits, int format) +int AVI_set_audio(avi_t *AVI, int channels, long rate, int bits, int format) { /* may only be called if file is open for writing */ - if(AVI->mode==AVI_MODE_READ) return; + if(AVI->mode==AVI_MODE_READ) return -1; //inc audio tracks AVI->aptr=AVI->anum; ++AVI->anum; if(AVI->anum > AVI_MAX_TRACKS) { - fprintf(stderr, "error - only %d audio tracks supported\n", AVI_MAX_TRACKS); - exit(1); + veejay_msg(0, "error - only %d audio tracks supported\n", AVI_MAX_TRACKS); + return -1; } AVI->track[AVI->aptr].a_chans = channels; @@ -712,11 +716,11 @@ void AVI_set_audio(avi_t *AVI, int channels, long rate, int bits, int format) AVI->track[AVI->aptr].a_fmt = format; // AVI->track[AVI->aptr].mp3rate = mp3rate; - avi_update_header(AVI); + return avi_update_header(AVI); } #define OUT4CC(s) \ - if(nhb<=HEADERBYTES-4) memcpy(AVI_header+nhb,s,4); nhb += 4 + if(nhb<=HEADERBYTES-4) veejay_memcpy(AVI_header+nhb,s,4); nhb += 4 #define OUTLONG(n) \ if(nhb<=HEADERBYTES-4) long2str(AVI_header+nhb,n); nhb += 4 @@ -738,7 +742,7 @@ void AVI_set_audio(avi_t *AVI, int channels, long rate, int bits, int format) { \ unsigned int s_ = (s); \ if(nhb <= HEADERBYTES-s_) \ - memcpy(AVI_header+nhb, (d), s_); \ + veejay_memcpy(AVI_header+nhb, (d), s_); \ nhb += s_; \ } @@ -959,13 +963,14 @@ int avi_update_header(avi_t *AVI) if(njunk<=0) { - fprintf(stderr,"AVI_close_output_file: # of header bytes too small\n"); - exit(1); + veejay_msg(0, "%s: # of header bytes too small",__FUNCTION__); + veejay_msg(0, "Somebody has played with HEADERBYTES of this AVI without knowing what (s)he did"); + return -1; } OUT4CC ("JUNK"); OUTLONG(njunk); - memset(AVI_header+nhb,0,njunk); + veejay_memset(AVI_header+nhb,0,njunk); nhb += njunk; @@ -1029,14 +1034,14 @@ static int avi_parse_comments (int fd, char *buf, int space_left) if (fd<=0 || !buf || space_left<=0) return -1; - memset (buf, 0, space_left); + veejay_memset (buf, 0, space_left); if (fstat (fd, &st) == -1) { perror ("stat"); return -1; } - if ( !(data = malloc(st.st_size*sizeof(char)+1)) ) { - fprintf(stderr, "malloc failed\n"); + if ( !(data = vj_malloc(st.st_size*sizeof(char)+1)) ) { + fprintf(stderr, "vj_malloc failed\n"); return -1; } @@ -1087,14 +1092,14 @@ static int avi_parse_comments (int fd, char *buf, int space_left) if (k>=space_left) return len; // write TAG - memcpy(buf+len,c,4); + veejay_memcpy(buf+len,c,4); len += 4; // write length + '\0' long2str(buf+len, k+1); len += 4; // write comment string - memcpy (buf+len, d, k); + veejay_memcpy (buf+len, d, k); // must be null terminated *(buf+len+k+1) = '\0'; @@ -1596,7 +1601,7 @@ static int avi_close_output_file(avi_t *AVI) OUT4CC ("ISFT"); //OUTLONG(MAX_INFO_STRLEN); - memset(id_str, 0, MAX_INFO_STRLEN); + veejay_memset(id_str, 0, MAX_INFO_STRLEN); snprintf(id_str, sizeof(id_str), "%s-%s", PACKAGE, VERSION); real_id_len = id_len = strlen(id_str)+1; @@ -1604,8 +1609,8 @@ static int avi_close_output_file(avi_t *AVI) OUTLONG(real_id_len); - memset(AVI_header+nhb, 0, id_len); - memcpy(AVI_header+nhb, id_str, id_len); + veejay_memset(AVI_header+nhb, 0, id_len); + veejay_memcpy(AVI_header+nhb, id_str, id_len); nhb += id_len; info_len = avi_parse_comments (AVI->comment_fd, AVI_header+nhb, HEADERBYTES - nhb - 8 - 12); @@ -1621,8 +1626,8 @@ static int avi_close_output_file(avi_t *AVI) // calptr=time(NULL); // snprintf(id_str, sizeof(id_str), "\t%s %s", ctime(&calptr), ""); -// memset(AVI_header+nhb, 0, MAX_INFO_STRLEN); -// memcpy(AVI_header+nhb, id_str, 25); +// veejay_memset(AVI_header+nhb, 0, MAX_INFO_STRLEN); +// veejay_memcpy(AVI_header+nhb, id_str, 25); // nhb += MAX_INFO_STRLEN; #endif @@ -1644,7 +1649,7 @@ static int avi_close_output_file(avi_t *AVI) OUT4CC ("JUNK"); OUTLONG(njunk); - memset(AVI_header+nhb,0,njunk); + veejay_memset(AVI_header+nhb,0,njunk); nhb += njunk; @@ -1966,13 +1971,13 @@ avi_t *AVI_open_input_indexfile(char *filename, int getIndex, char *indexfile) /* Create avi_t structure */ - AVI = (avi_t *) malloc(sizeof(avi_t)); + AVI = (avi_t *) vj_malloc(sizeof(avi_t)); if(AVI==NULL) { AVI_errno = AVI_ERR_NO_MEM; return 0; } - memset((void *)AVI,0,sizeof(avi_t)); + veejay_memset((void *)AVI,0,sizeof(avi_t)); AVI->mode = AVI_MODE_READ; /* open for reading */ @@ -2020,13 +2025,13 @@ avi_t *AVI_open_indexfd(int fd, int getIndex, char *indexfile) /* Create avi_t structure */ - AVI = (avi_t *) malloc(sizeof(avi_t)); + AVI = (avi_t *) vj_malloc(sizeof(avi_t)); if(AVI==NULL) { AVI_errno = AVI_ERR_NO_MEM; return 0; } - memset((void *)AVI,0,sizeof(avi_t)); + veejay_memset((void *)AVI,0,sizeof(avi_t)); AVI->mode = AVI_MODE_READ; /* open for reading */ @@ -2054,13 +2059,12 @@ avi_t *AVI_open_input_file(char *filename, int getIndex, int mmap_size) /* Create avi_t structure */ - AVI = (avi_t *) malloc(sizeof(avi_t)); + AVI = (avi_t *) vj_calloc(sizeof(avi_t)); if(AVI==NULL) { AVI_errno = AVI_ERR_NO_MEM; return 0; } - memset((void *)AVI,0,sizeof(avi_t)); AVI->mode = AVI_MODE_READ; /* open for reading */ @@ -2093,13 +2097,13 @@ avi_t *AVI_open_fd(int fd, int getIndex, int mmap_size) /* Create avi_t structure */ - AVI = (avi_t *) malloc(sizeof(avi_t)); + AVI = (avi_t *) vj_malloc(sizeof(avi_t)); if(AVI==NULL) { AVI_errno = AVI_ERR_NO_MEM; return 0; } - memset((void *)AVI,0,sizeof(avi_t)); + veejay_memset((void *)AVI,0,sizeof(avi_t)); AVI->mode = AVI_MODE_READ; /* open for reading */ @@ -2194,12 +2198,12 @@ int avi_parse_index_from_file(avi_t *AVI, char *filename) for(j=0; janum; ++j) AVI->track[j].audio_chunks = aud_chunks[j]; if(AVI->video_frames==0) ERR_EXIT(AVI_ERR_NO_VIDS); - AVI->video_index = (video_index_entry *) malloc(vid_chunks*sizeof(video_index_entry)); + AVI->video_index = (video_index_entry *) vj_malloc(vid_chunks*sizeof(video_index_entry)); if(AVI->video_index==0) ERR_EXIT(AVI_ERR_NO_MEM); for(j=0; janum; ++j) { if(AVI->track[j].audio_chunks) { - AVI->track[j].audio_index = (audio_index_entry *) malloc(aud_chunks[j]*sizeof(audio_index_entry)); + AVI->track[j].audio_index = (audio_index_entry *) vj_malloc(aud_chunks[j]*sizeof(audio_index_entry)); if(AVI->track[j].audio_index==0) ERR_EXIT(AVI_ERR_NO_MEM); } } @@ -2305,7 +2309,7 @@ int avi_parse_input_file(avi_t *AVI, int getIndex) if(strncasecmp(data,"hdrl",4) == 0) { hdrl_len = n; - hdrl_data = (unsigned char *) malloc(n); + hdrl_data = (unsigned char *) vj_malloc(n); if(hdrl_data==0) ERR_EXIT(AVI_ERR_NO_MEM); // offset of header @@ -2328,7 +2332,7 @@ int avi_parse_input_file(avi_t *AVI, int getIndex) break if this is not the case */ AVI->n_idx = AVI->max_idx = n/16; - AVI->idx = (unsigned char((*)[16]) ) malloc(n); + AVI->idx = (unsigned char((*)[16]) ) vj_malloc(n); if(AVI->idx==0) ERR_EXIT(AVI_ERR_NO_MEM) if(avi_read(AVI->fdes, (char *) AVI->idx, n) != n ) { free ( AVI->idx); AVI->idx=NULL; @@ -2368,7 +2372,7 @@ int avi_parse_input_file(avi_t *AVI, int getIndex) #endif if(strncasecmp((char *)hdrl_data+i,"vids",4) == 0 && !vids_strh_seen) { - memcpy(AVI->compressor,hdrl_data+i+4,4); + veejay_memcpy(AVI->compressor,hdrl_data+i+4,4); AVI->compressor[4] = 0; // ThOe @@ -2435,11 +2439,11 @@ int avi_parse_input_file(avi_t *AVI, int getIndex) { alBITMAPINFOHEADER bih; - memcpy(&bih, hdrl_data + i, sizeof(alBITMAPINFOHEADER)); + veejay_memcpy(&bih, hdrl_data + i, sizeof(alBITMAPINFOHEADER)); AVI->bitmap_info_header = (alBITMAPINFOHEADER *) - malloc(str2ulong((unsigned char *)&bih.bi_size)); + vj_malloc(str2ulong((unsigned char *)&bih.bi_size)); if (AVI->bitmap_info_header != NULL) - memcpy(AVI->bitmap_info_header, hdrl_data + i, + veejay_memcpy(AVI->bitmap_info_header, hdrl_data + i, str2ulong((unsigned char *)&bih.bi_size)); AVI->width = str2ulong(hdrl_data+i+4); @@ -2448,7 +2452,7 @@ int avi_parse_input_file(avi_t *AVI, int getIndex) //ThOe AVI->v_codecf_off = header_offset + i+16; - memcpy(AVI->compressor2, hdrl_data+i+16, 4); + veejay_memcpy(AVI->compressor2, hdrl_data+i+16, 4); AVI->compressor2[4] = 0; } @@ -2462,10 +2466,10 @@ int avi_parse_input_file(avi_t *AVI, int getIndex) wfes = hdrl_len - i; else wfes = sizeof(alWAVEFORMATEX); - wfe = (alWAVEFORMATEX *)malloc(sizeof(alWAVEFORMATEX)); + wfe = (alWAVEFORMATEX *)vj_malloc(sizeof(alWAVEFORMATEX)); if (wfe != NULL) { - memset(wfe, 0, sizeof(alWAVEFORMATEX)); - memcpy(wfe, hdrl_data + i, wfes); + veejay_memset(wfe, 0, sizeof(alWAVEFORMATEX)); + veejay_memcpy(wfe, hdrl_data + i, wfes); if (str2ushort((unsigned char *)&wfe->cb_size) != 0) { nwfe = (char *) realloc(wfe, sizeof(alWAVEFORMATEX) + @@ -2507,14 +2511,14 @@ int avi_parse_input_file(avi_t *AVI, int getIndex) a = hdrl_data+i; - AVI->video_superindex = (avisuperindex_chunk *) malloc (sizeof (avisuperindex_chunk)); - memcpy (AVI->video_superindex->fcc, a, 4); a += 4; + AVI->video_superindex = (avisuperindex_chunk *) vj_calloc (sizeof (avisuperindex_chunk)); + veejay_memcpy (AVI->video_superindex->fcc, a, 4); a += 4; AVI->video_superindex->dwSize = str2ulong(a); a += 4; AVI->video_superindex->wLongsPerEntry = str2ushort(a); a += 2; AVI->video_superindex->bIndexSubType = *a; a += 1; AVI->video_superindex->bIndexType = *a; a += 1; AVI->video_superindex->nEntriesInUse = str2ulong(a); a += 4; - memcpy (AVI->video_superindex->dwChunkId, a, 4); a += 4; + veejay_memcpy (AVI->video_superindex->dwChunkId, a, 4); a += 4; // 3 * reserved a += 4; a += 4; a += 4; @@ -2522,7 +2526,7 @@ int avi_parse_input_file(avi_t *AVI, int getIndex) if (AVI->video_superindex->bIndexSubType != 0) {fprintf(stderr, "Invalid Header, bIndexSubType != 0\n"); } AVI->video_superindex->aIndex = - malloc (AVI->video_superindex->wLongsPerEntry * AVI->video_superindex->nEntriesInUse * sizeof (uint32_t)); + vj_malloc (AVI->video_superindex->wLongsPerEntry * AVI->video_superindex->nEntriesInUse * sizeof (uint32_t)); // position of ix## chunks for (j=0; jvideo_superindex->nEntriesInUse; ++j) { @@ -2560,14 +2564,14 @@ int avi_parse_input_file(avi_t *AVI, int getIndex) a = hdrl_data+i; - AVI->track[AVI->aptr].audio_superindex = (avisuperindex_chunk *) malloc (sizeof (avisuperindex_chunk)); - memcpy (AVI->track[AVI->aptr].audio_superindex->fcc, a, 4); a += 4; + AVI->track[AVI->aptr].audio_superindex = (avisuperindex_chunk *) vj_malloc (sizeof (avisuperindex_chunk)); + veejay_memcpy (AVI->track[AVI->aptr].audio_superindex->fcc, a, 4); a += 4; AVI->track[AVI->aptr].audio_superindex->dwSize = str2ulong(a); a += 4; AVI->track[AVI->aptr].audio_superindex->wLongsPerEntry = str2ushort(a); a += 2; AVI->track[AVI->aptr].audio_superindex->bIndexSubType = *a; a += 1; AVI->track[AVI->aptr].audio_superindex->bIndexType = *a; a += 1; AVI->track[AVI->aptr].audio_superindex->nEntriesInUse = str2ulong(a); a += 4; - memcpy (AVI->track[AVI->aptr].audio_superindex->dwChunkId, a, 4); a += 4; + veejay_memcpy (AVI->track[AVI->aptr].audio_superindex->dwChunkId, a, 4); a += 4; // 3 * reserved a += 4; a += 4; a += 4; @@ -2575,7 +2579,7 @@ int avi_parse_input_file(avi_t *AVI, int getIndex) if (AVI->track[AVI->aptr].audio_superindex->bIndexSubType != 0) {fprintf(stderr, "Invalid Header, bIndexSubType != 0\n"); } AVI->track[AVI->aptr].audio_superindex->aIndex = - malloc (AVI->track[AVI->aptr].audio_superindex->wLongsPerEntry * + vj_malloc (AVI->track[AVI->aptr].audio_superindex->wLongsPerEntry * AVI->track[AVI->aptr].audio_superindex->nEntriesInUse * sizeof (uint32_t)); // position of ix## chunks @@ -2762,7 +2766,7 @@ int avi_parse_input_file(avi_t *AVI, int getIndex) for (j=0; jvideo_superindex->nEntriesInUse; j++) { // read from file - chunk_start = en = malloc (AVI->video_superindex->aIndex[j].dwSize+hdrl_len); + chunk_start = en = vj_malloc (AVI->video_superindex->aIndex[j].dwSize+hdrl_len); if (lseek(AVI->fdes, AVI->video_superindex->aIndex[j].qwOffset, SEEK_SET) == (off_t)-1) { fprintf(stderr, "(%s) cannot seek to 0x%llx\n", __FILE__, @@ -2843,7 +2847,7 @@ int avi_parse_input_file(avi_t *AVI, int getIndex) for (j=0; jtrack[audtr].audio_superindex->nEntriesInUse; j++) { // read from file - chunk_start = en = malloc (AVI->track[audtr].audio_superindex->aIndex[j].dwSize+hdrl_len); + chunk_start = en = vj_malloc (AVI->track[audtr].audio_superindex->aIndex[j].dwSize+hdrl_len); if (lseek(AVI->fdes, AVI->track[audtr].audio_superindex->aIndex[j].qwOffset, SEEK_SET) == (off_t)-1) { fprintf(stderr, "(%s) cannot seek to 0x%llx\n", __FILE__, (unsigned long long)AVI->track[audtr].audio_superindex->aIndex[j].qwOffset); @@ -2917,14 +2921,14 @@ multiple_riff: nai[0] = AVI->track[0].audio_chunks = AVI->total_frames; for(j=1; janum; ++j) AVI->track[j].audio_chunks = 0; - AVI->video_index = (video_index_entry *) malloc(nvi*sizeof(video_index_entry)); + AVI->video_index = (video_index_entry *) vj_malloc(nvi*sizeof(video_index_entry)); if(AVI->video_index==0) ERR_EXIT(AVI_ERR_NO_MEM); for(j=0; janum; ++j) { if(AVI->track[j].audio_chunks) { - AVI->track[j].audio_index = (audio_index_entry *) malloc((nai[j]+1)*sizeof(audio_index_entry)); - memset(AVI->track[j].audio_index, 0, (nai[j]+1)*(sizeof(audio_index_entry))); + AVI->track[j].audio_index = (audio_index_entry *) vj_malloc((nai[j]+1)*sizeof(audio_index_entry)); + veejay_memset(AVI->track[j].audio_index, 0, (nai[j]+1)*(sizeof(audio_index_entry))); if(AVI->track[j].audio_index==0) ERR_EXIT(AVI_ERR_NO_MEM); } } @@ -3034,13 +3038,13 @@ multiple_riff: if(AVI->video_frames==0) ERR_EXIT(AVI_ERR_NO_VIDS); - AVI->video_index = (video_index_entry *) malloc(nvi*sizeof(video_index_entry)); + AVI->video_index = (video_index_entry *) vj_malloc(nvi*sizeof(video_index_entry)); if(AVI->video_index==0) ERR_EXIT(AVI_ERR_NO_MEM); for(j=0; janum; ++j) { if(AVI->track[j].audio_chunks) { - AVI->track[j].audio_index = (audio_index_entry *) malloc((nai[j]+1)*sizeof(audio_index_entry)); - memset(AVI->track[j].audio_index, 0, (nai[j]+1)*(sizeof(audio_index_entry))); + AVI->track[j].audio_index = (audio_index_entry *) vj_malloc((nai[j]+1)*sizeof(audio_index_entry)); + veejay_memset(AVI->track[j].audio_index, 0, (nai[j]+1)*(sizeof(audio_index_entry))); if(AVI->track[j].audio_index==0) ERR_EXIT(AVI_ERR_NO_MEM); } } @@ -3355,7 +3359,8 @@ long AVI_read_audio(avi_t *AVI, char *audbuf, long bytes) lseek(AVI->fdes, pos, SEEK_SET); if ( (ret = avi_read(AVI->fdes,audbuf+nr,todo)) != todo) { - fprintf(stderr, "XXX pos = %lld, ret = %lld, todo = %ld\n", pos, ret, todo); +// fprintf(stderr, "XXX pos = %lld, ret = %lld, todo = %ld\n", pos, ret, todo); + veejay_msg(0, "No audio data at position %ld!"); AVI_errno = AVI_ERR_READ; return -1; } @@ -3480,7 +3485,7 @@ char *(avi_errors[]) = /* 5 */ "avilib - Error writing index (file may still be useable)", /* 6 */ "avilib - Error closing AVI file", /* 7 */ "avilib - Operation (read/write) not permitted", - /* 8 */ "avilib - Out of memory (malloc failed)", + /* 8 */ "avilib - Out of memory (vj_malloc failed)", /* 9 */ "avilib - Not an AVI file", /* 10 */ "avilib - AVI file has no header list (corrupted?)", /* 11 */ "avilib - AVI file has no MOVI list (corrupted?)", @@ -3561,22 +3566,22 @@ int AVI_read_wave_header( int fd, struct wave_header * wave ) return -1; } - memcpy(&wave->riff.id ,buf+0, 4); - memcpy(&wave->riff.len ,buf+4, 4); - memcpy(&wave->riff.wave_id ,buf+8, 4); + veejay_memcpy(&wave->riff.id ,buf+0, 4); + veejay_memcpy(&wave->riff.len ,buf+4, 4); + veejay_memcpy(&wave->riff.wave_id ,buf+8, 4); - memcpy(&wave->format.id ,buf+12, 4); - memcpy(&wave->format.len ,buf+16, 4); + veejay_memcpy(&wave->format.id ,buf+12, 4); + veejay_memcpy(&wave->format.len ,buf+16, 4); - memcpy(&wave->common.wFormatTag ,buf+20, 2); - memcpy(&wave->common.wChannels ,buf+22, 2); - memcpy(&wave->common.dwSamplesPerSec ,buf+24, 4); - memcpy(&wave->common.dwAvgBytesPerSec ,buf+28, 4); - memcpy(&wave->common.wBlockAlign ,buf+32, 2); - memcpy(&wave->common.wBitsPerSample ,buf+34, 2); + veejay_memcpy(&wave->common.wFormatTag ,buf+20, 2); + veejay_memcpy(&wave->common.wChannels ,buf+22, 2); + veejay_memcpy(&wave->common.dwSamplesPerSec ,buf+24, 4); + veejay_memcpy(&wave->common.dwAvgBytesPerSec ,buf+28, 4); + veejay_memcpy(&wave->common.wBlockAlign ,buf+32, 2); + veejay_memcpy(&wave->common.wBitsPerSample ,buf+34, 2); - memcpy(&wave->data.id ,buf+36, 4); - memcpy(&wave->data.len ,buf+40, 4); + veejay_memcpy(&wave->data.id ,buf+36, 4); + veejay_memcpy(&wave->data.len ,buf+40, 4); /* @@ -3645,22 +3650,22 @@ int AVI_write_wave_header( int fd, const struct wave_header * wave ) #undef x_FIXUP #endif - memcpy(buf+ 0, &buffer.riff.id, 4); - memcpy(buf+ 4, &buffer.riff.len, 4); - memcpy(buf+ 8, &buffer.riff.wave_id, 4); + veejay_memcpy(buf+ 0, &buffer.riff.id, 4); + veejay_memcpy(buf+ 4, &buffer.riff.len, 4); + veejay_memcpy(buf+ 8, &buffer.riff.wave_id, 4); - memcpy(buf+12, &buffer.format.id, 4); - memcpy(buf+16, &buffer.format.len, 4); + veejay_memcpy(buf+12, &buffer.format.id, 4); + veejay_memcpy(buf+16, &buffer.format.len, 4); - memcpy(buf+20, &buffer.common.wFormatTag, 2); - memcpy(buf+22, &buffer.common.wChannels, 2); - memcpy(buf+24, &buffer.common.dwSamplesPerSec, 4); - memcpy(buf+28, &buffer.common.dwAvgBytesPerSec, 4); - memcpy(buf+32, &buffer.common.wBlockAlign, 2); - memcpy(buf+34, &buffer.common.wBitsPerSample, 2); + veejay_memcpy(buf+20, &buffer.common.wFormatTag, 2); + veejay_memcpy(buf+22, &buffer.common.wChannels, 2); + veejay_memcpy(buf+24, &buffer.common.dwSamplesPerSec, 4); + veejay_memcpy(buf+28, &buffer.common.dwAvgBytesPerSec, 4); + veejay_memcpy(buf+32, &buffer.common.wBlockAlign, 2); + veejay_memcpy(buf+34, &buffer.common.wBitsPerSample, 2); - memcpy(buf+36, &buffer.data.id, 4); - memcpy(buf+40, &buffer.data.len, 4); + veejay_memcpy(buf+36, &buffer.data.id, 4); + veejay_memcpy(buf+40, &buffer.data.len, 4); // write raw data diff --git a/veejay-ng/libel/avilib.h b/veejay-ng/libel/avilib.h index 6cac81b6..0a562e48 100644 --- a/veejay-ng/libel/avilib.h +++ b/veejay-ng/libel/avilib.h @@ -324,7 +324,7 @@ typedef struct avi_t* AVI_open_output_file(char * filename); void AVI_set_video(avi_t *AVI, int width, int height, double fps, char *compressor); -void AVI_set_audio(avi_t *AVI, int channels, long rate, int bits, int format); +int AVI_set_audio(avi_t *AVI, int channels, long rate, int bits, int format); int AVI_write_frame(avi_t *AVI, char *data, long bytes); int AVI_dup_frame(avi_t *AVI); int AVI_write_audio(avi_t *AVI, char *data, long bytes); diff --git a/veejay-ng/libel/vj-avcodec.c b/veejay-ng/libel/vj-avcodec.c index c40287b1..5ceda9a1 100644 --- a/veejay-ng/libel/vj-avcodec.c +++ b/veejay-ng/libel/vj-avcodec.c @@ -291,124 +291,6 @@ void vj_avcodec_close_encoder( vj_encoder *av ) av = NULL; } -void yuv422p_to_yuv420p3( uint8_t *src, uint8_t *dst[3], int w, int h) -{ - AVPicture pict1,pict2; - memset(&pict1,0,sizeof(pict1)); - memset(&pict2,0,sizeof(pict2)); - - pict1.data[0] = src; - pict1.data[1] = src+(w*h); - pict1.data[2] = src+(w*h)+((w*h)/2); - pict1.linesize[0] = w; - pict1.linesize[1] = w >> 1; - pict1.linesize[2] = w >> 1; - pict2.data[0] = dst[0]; - pict2.data[1] = dst[1]; - pict2.data[2] = dst[2]; - pict2.linesize[0] = w; - pict2.linesize[1] = w >> 1; - pict2.linesize[2] = w >> 1; - - img_convert( &pict2, PIX_FMT_YUV420P, &pict1, PIX_FMT_YUV422P, w, h ); - return; -} -void yuv422p_to_yuv420p2( uint8_t *src[3], uint8_t *dst[3], int w, int h) -{ - AVPicture pict1,pict2; - memset(&pict1,0,sizeof(pict1)); - memset(&pict2,0,sizeof(pict2)); - - pict1.data[0] = src[0]; - pict1.data[1] = src[1]; - pict1.data[2] = src[2]; - pict1.linesize[0] = w; - pict1.linesize[1] = w >> 1; - pict1.linesize[2] = w >> 1; - pict2.data[0] = dst[0]; - pict2.data[1] = dst[1]; - pict2.data[2] = dst[2]; - pict2.linesize[0] = w; - pict2.linesize[1] = w >> 1; - pict2.linesize[2] = w >> 1; - - img_convert( &pict2, PIX_FMT_YUV420P, &pict1, PIX_FMT_YUV422P, w, h ); - return; -} - -int yuv422p_to_yuv420p( uint8_t *src[3], uint8_t *dst, int w, int h) -{ - - int len = w* h ; - int uv_len = len / 4; - AVPicture pict1,pict2; - memset(&pict1,0,sizeof(pict1)); - memset(&pict2,0,sizeof(pict2)); - - pict1.data[0] = src[0]; - pict1.data[1] = src[1]; - pict1.data[2] = src[2]; - pict1.linesize[0] = w; - pict1.linesize[1] = w >> 1; - pict1.linesize[2] = w >> 1; - pict2.data[0] = dst; - pict2.data[1] = dst + len; - pict2.data[2] = dst + len + uv_len; - pict2.linesize[0] = w; - pict2.linesize[1] = w >> 1; - pict2.linesize[2] = w >> 1; - - img_convert( &pict2, PIX_FMT_YUV420P, &pict1, PIX_FMT_YUV422P, w, h ); - return (len + uv_len + uv_len); - -} -int yuv420p_to_yuv422p2( uint8_t *sY,uint8_t *sCb, uint8_t *sCr, uint8_t *dst[3], int w, int h ) -{ - const int len = w * h; - const int uv_len = len / 2; - AVPicture pict1,pict2; - memset(&pict1,0,sizeof(pict1)); - memset(&pict2,0,sizeof(pict2)); - pict1.data[0] = sY; - pict1.data[1] = sCb; - pict1.data[2] = sCr; - pict1.linesize[0] = w; - pict1.linesize[1] = w >> 1; - pict1.linesize[2] = w >> 1; - pict2.data[0] = dst[0]; - pict2.data[1] = dst[1]; - pict2.data[2] = dst[2]; - pict2.linesize[0] = w; - pict2.linesize[1] = w >> 1; - pict2.linesize[2] = w >> 1; - - img_convert( &pict2, PIX_FMT_YUV422P, &pict1, PIX_FMT_YUV420P, w, h ); - return (len + uv_len + uv_len); - -} -int yuv420p_to_yuv422p( uint8_t *sY,uint8_t *sCb, uint8_t *sCr, uint8_t *dst[3], int w, int h ) -{ - const int len = w * h; - const int uv_len = len / 2; - AVPicture pict1,pict2; - memset(&pict1,0,sizeof(pict1)); - memset(&pict2,0,sizeof(pict2)); - pict1.data[0] = sY; - pict1.data[1] = sCb; - pict1.data[2] = sCr; - pict1.linesize[0] = w; - pict1.linesize[1] = w >> 1; - pict1.linesize[2] = w >> 1; - pict2.data[0] = dst[0]; - pict2.data[1] = dst[1]; - pict2.data[2] = dst[2]; - pict2.linesize[0] = w; - pict2.linesize[1] = w >> 1; - pict2.linesize[2] = w >> 1; - img_convert( &pict2, PIX_FMT_YUV422P, &pict1, PIX_FMT_YUV420P, w, h ); - return (len + uv_len + uv_len); -} - static int vj_avcodec_copy_frame( vj_encoder *av, uint8_t *src[3], uint8_t *dst ) { uint8_t *yuv[3]; diff --git a/veejay-ng/libel/vj-el.c b/veejay-ng/libel/vj-el.c index 14b2d623..7fbff878 100644 --- a/veejay-ng/libel/vj-el.c +++ b/veejay-ng/libel/vj-el.c @@ -442,9 +442,15 @@ int vj_el_match( void *sv, void *edl) assert( el != NULL ); #endif if ( v->w != el->video_width) + { + veejay_msg(0, "Video width of %d does not match %d",v->w, el->video_width ); return 0; + } if ( v->h != el->video_height) + { + veejay_msg(0, "Video height of %d does not match %d",v->h, el->video_height); return 0; + } return 1; } @@ -1170,8 +1176,8 @@ int vj_el_get_video_frame(void *edl, long nframe, void *fdst) else { inter = lav_video_interlacing(el->lav_fd[N_EL_FILE(n)]); - int src_fmt = d->context->pix_fmt; - int dst_fmt = dst->pixfmt; + int src_fmt = 0; + int dst_fmt = dst->pixfmt; AVPicture pict,pict2; memset(&pict,0,sizeof(AVPicture)); pict.data[0] = dst->data[0]; @@ -1190,6 +1196,15 @@ int vj_el_get_video_frame(void *edl, long nframe, void *fdst) data, res ); + + src_fmt = d->context->pix_fmt; + + if(! got_picture ) + { + veejay_msg(VEEJAY_MSG_ERROR, + "Frame %ld not a keyframe", nframe ); + return 0; + } if( len <= 0 ) { @@ -1214,18 +1229,20 @@ int vj_el_get_video_frame(void *edl, long nframe, void *fdst) src_fmt, el->video_width, el->video_height); - img_convert( &pict, dst_fmt, (const AVPicture*) &pict2, src_fmt, - el->video_width,el->video_height); - } + + VJFrame *src1 = yuv_yuv_template( d->deinterlace_buffer[0], d->deinterlace_buffer[1], + d->deinterlace_buffer[2], el->video_width,el->video_height, src_fmt ); + + yuv_convert_any3( src1, d->frame->linesize, dst, src1->format, dst_fmt ); + free(src1); + } else { - __builtin_prefetch( pict.data[0],1,3 ); - __builtin_prefetch( pict.data[1],1,3 ); - __builtin_prefetch( pict.data[2],1,3 ); - __builtin_prefetch( d->frame->data[0],0,3); - - img_convert( &pict, dst_fmt, (const AVPicture*) d->frame, src_fmt, - el->video_width, el->video_height ); + VJFrame *src1 = yuv_yuv_template( d->frame->data[0],d->frame->data[1],d->frame->data[2], + el->video_width,el->video_height, src_fmt ); + + yuv_convert_any3( src1, d->frame->linesize, dst, src_fmt, dst_fmt ); + free(src1); } } else diff --git a/veejay-ng/libplugger/freeframe-loader.c b/veejay-ng/libplugger/freeframe-loader.c index bb49c75e..80d96175 100644 --- a/veejay-ng/libplugger/freeframe-loader.c +++ b/veejay-ng/libplugger/freeframe-loader.c @@ -15,7 +15,7 @@ #include #define LINUX 1 #include -#define V_BITS 32 +#define V_BITS 24 #include #ifdef STRICT_CHECKING @@ -480,8 +480,13 @@ void freeframe_push_channel( void *instance, const char *key,int n, VJFrame *fra #ifdef STRICT_CHECKING assert( error == VEVO_NO_ERROR ); #endif - util_convertrgba32( frame->data,frame->width,frame->height,frame->pixfmt, frame->shift_v, - space ); + + VJFrame *dst1 = yuv_rgb_template( space, frame->width,frame->height, PIX_FMT_RGB24 ); + + yuv_convert_any( frame, dst1, frame->format, dst1->format ); + + free(dst1); + } } @@ -521,8 +526,10 @@ int freeframe_plug_process( void *plugin, double timecode ) #ifdef STRICT_CHECING assert( error == LIVIDO_NO_ERROR ); #endif - util_convertsrc( in, output_frame->width, output_frame->height, output_frame->pixfmt, - output_frame->data ); + + VJFrame *dst1 = yuv_rgb_template( in, output_frame->width, output_frame->height, PIX_FMT_RGB24 ); + + yuv_convert_any( dst1, output_frame, dst1->format, output_frame->format ); return 1; } diff --git a/veejay-ng/libplugger/livido-loader.c b/veejay-ng/libplugger/livido-loader.c index a6515655..523d6fdf 100644 --- a/veejay-ng/libplugger/livido-loader.c +++ b/veejay-ng/libplugger/livido-loader.c @@ -369,6 +369,8 @@ int livido_plug_parameter_set_bool( void *parameter, void *value ) { error = vevo_property_set( parameter, "value", VEVO_ATOM_TYPE_BOOL, 1, value ); #ifdef STRICT_CHECKING + if( error != VEVO_NO_ERROR ) + veejay_msg(0, "%s: error code %x", __FUNCTION__, error ); assert( error == VEVO_NO_ERROR ); #endif return 1; diff --git a/veejay-ng/libplugger/utility.c b/veejay-ng/libplugger/utility.c index 2b624ae6..54cb04a5 100644 --- a/veejay-ng/libplugger/utility.c +++ b/veejay-ng/libplugger/utility.c @@ -238,99 +238,3 @@ void clone_prop_vevo2( void *port, void *to_port, const char *key, const char * break; } } -void util_convertrgba24( uint8_t **data, int w, int h,int in_pix_fmt,int shiftv, void *out_buffer ) -{ - AVPicture p1,p2; - memset( &p1, 0, sizeof(p1)); - memset( &p2, 0, sizeof(p2)); -#ifdef STRICT_CHECING - assert( data != NULL ); - assert( w > 0 ); - assert( h > 0 ); - assert( out_buffer != NULL ); -#endif - - p1.data[0] = out_buffer; - p1.linesize[0] = w * 3; - - p2.data[0] = data[0]; - p2.data[1] = data[1]; - p2.data[2] = data[2]; - p2.linesize[0] = w; - p2.linesize[1] = w >> shiftv; - p2.linesize[2] = w >> shiftv; - - // dest pix, dest format, informat, w , h - if(img_convert( &p1, PIX_FMT_RGB24,&p2, in_pix_fmt,w,h )) - { -#ifdef STRICT_CHECKING - veejay_msg(0, "Image conversion failed in %s", __FUNCTION__ ); - assert(0); -#endif - } -} -void util_convertrgba32( uint8_t **data, int w, int h,int in_pix_fmt,int shiftv, void *out_buffer ) -{ - AVPicture p1,p2; - memset( &p1, 0, sizeof(p1)); - memset( &p2, 0, sizeof(p2)); -#ifdef STRICT_CHECING - assert( data != NULL ); - assert( w > 0 ); - assert( h > 0 ); - assert( out_buffer != NULL ); -#endif - - p1.data[0] = out_buffer; - p1.linesize[0] = w * 4; - - p2.data[0] = data[0]; - p2.data[1] = data[1]; - p2.data[2] = data[2]; - p2.linesize[0] = w; - p2.linesize[1] = w >> shiftv; - p2.linesize[2] = w >> shiftv; - - // dest pix, dest format, informat, w , h - if(img_convert( &p1, PIX_FMT_RGBA32,&p2, in_pix_fmt,w,h )) - { -#ifdef STRICT_CHECKING - veejay_msg(0, "Image conversion failed in %s", __FUNCTION__ ); - assert(0); -#endif - } - -//@ fixme YUV444 sampled ! reuse functions of move them here ! -} - -void util_convertsrc( void *indata, int w, int h, int out_pix_fmt, uint8_t **data) -{ - AVPicture p1,p2; - memset( &p1, 0, sizeof(p1)); - memset( &p2, 0, sizeof(p2)); - - int shiftv = ( out_pix_fmt == PIX_FMT_YUV444P ? 0 : 1); -#ifdef STRICT_CHECING - assert( data != NULL ); - assert( w > 0 ); - assert( h > 0 ); -#endif - p2.data[0] = indata; - p2.linesize[0] = w * 4; - - p1.data[0] = data[0]; - p1.data[1] = data[1]; - p1.data[2] = data[2]; - p1.linesize[0] = w; - p1.linesize[1] = w >> shiftv; - p1.linesize[2] = w >> shiftv; -//@ fixme YUV444 sampled ! reuse functions of move them here ! - if(img_convert( &p1, out_pix_fmt,&p2, PIX_FMT_RGBA32,w,h )) - { -#ifdef STRICT_CHECKING - veejay_msg(0, "Image conversion failed in %s", __FUNCTION__ ); - assert(0); -#endif - } - -} diff --git a/veejay-ng/libplugger/utility.h b/veejay-ng/libplugger/utility.h index 01a17ea3..3f8e9bb9 100644 --- a/veejay-ng/libplugger/utility.h +++ b/veejay-ng/libplugger/utility.h @@ -23,8 +23,5 @@ char *get_str_vevo( void *port, const char *key ); char *alloc_str_vevo( void *port, const char *key ); double *get_dbl_arr_vevo( void *port, const char *key ); void clone_prop_vevo( void *port, void *to_port, const char *key, const char *as_key ); -void util_convertrgba32( uint8_t **data, int w, int h,int in_pix_fmt,int shiftv, void *out_buffer ); -void util_convertsrc( void *indata, int w, int h, int out_pix_fmt, uint8_t **data); -void util_convertrgba24( uint8_t **data, int w, int h,int in_pix_fmt,int shiftv, void *out_buffer ); #endif diff --git a/veejay-ng/libvevo/vevo.c b/veejay-ng/libvevo/vevo.c index 2215e8f9..f833d2f1 100644 --- a/veejay-ng/libvevo/vevo.c +++ b/veejay-ng/libvevo/vevo.c @@ -1423,9 +1423,9 @@ char **vevo_list_properties(vevo_port_t * p) #ifdef STRICT_CHECKING if( n != nn ) - veejay_msg(0, "%s:%s (%p) Expected %d properties but there are %d", + veejay_msg(VEEJAY_MSG_WARNING, "%s:%s (%p) Expected %d properties but there are %d", __FILE__,__FUNCTION__,p,nn, n ); - assert(nn == n); + assert(n == nn ); #endif list = (char **) malloc(sizeof(char *) * n); diff --git a/veejay-ng/libvjmem/Makefile.am b/veejay-ng/libvjmem/Makefile.am index 0ae57ad8..904b65e0 100644 --- a/veejay-ng/libvjmem/Makefile.am +++ b/veejay-ng/libvjmem/Makefile.am @@ -1,5 +1,6 @@ # Makefile for memory managment / platform specific optimizations INCLUDES = -I$(top_srcdir) -I$(includedir) -I$(top_builddir)/libvjmsg +AM_CFLAGS=$(CFLAGS) VJMEM_LIB_FILE = libvjmem.la noinst_LTLIBRARIES = $(VJMEM_LIB_FILE) libvjmem_la_SOURCES = memcpy.c vj-x86.c diff --git a/veejay-ng/libvjmem/memcpy.c b/veejay-ng/libvjmem/memcpy.c index 4c4de01b..73806a84 100644 --- a/veejay-ng/libvjmem/memcpy.c +++ b/veejay-ng/libvjmem/memcpy.c @@ -134,9 +134,30 @@ #include #include #include -/* definitions */ + #define BUFSIZE 1024 +#if defined ( HAVE_ASM_MMX2 ) || defined ( HAVE_ASM_3DNOW ) || defined( HAVE_ASM_MMX ) +#undef HAVE_MMX1 +#if defined ( HAVE_ASM_MMX ) && !defined(HAVE_ASM_MMX2) && !defined( HAVE_ASM_3DNOW ) && !defined( HAVE_ASM_SSE) +/* means: mmx v.1. Note: Since we added alignment of destinition it speedups + of memory copying on PentMMX, Celeron-1 and P2 upto 12% versus + standard (non MMX-optimized) version. + Note: on K6-2+ it speedups memory copying upto 25% and + on K7 and P3 about 500% (5 times). */ +#define HAVE_MMX1 +#endif +#undef HAVE_K6_2PLUS +#if !defined( HAVE_ASM_MMX2) && defined( HAVE_ASM_3DNOW ) +#define HAVE_K6_2PLUS +#endif +#endif + + +/* definitions */ +#define BLOCK_SIZE 4096 +#define CONFUSION_FACTOR 0 +//Feel free to fine-tune the above 2, it might be possible to get some speedup with them :) #if defined(ARCH_X86) || defined (ARCH_X86_64) /* for small memory blocks (<256 bytes) this version is faster */ @@ -150,6 +171,16 @@ __asm__ __volatile__(\ : "memory");\ } +/* for small memory blocks (<256 bytes) this version is faster */ +#define small_memset(to,val,n)\ +{\ +register unsigned long int dummy;\ +__asm__ __volatile__(\ + "rep; stosb"\ + :"=&D"(to), "=&c"(dummy)\ + :"0" (to), "1" (n), "a"((char)val)\ + :"memory");\ +} static inline unsigned long long int rdtsc() { unsigned long long int x; @@ -157,6 +188,9 @@ static inline unsigned long long int rdtsc() return x; } #else +#define small_memcpy(to,from,n) memcpy( to,from,n ) +#define small_memset(to,val,n) memset(to,val,n) + static inline unsigned long long int rdtsc() { struct timeval tv; @@ -166,16 +200,7 @@ static inline unsigned long long int rdtsc() } #endif - -#if defined (ARCH_X86) || defined(ARCH_X86_64) - -#define MMX1_MIN_LEN 0x800 /* 2K blocks */ -#define MIN_LEN 0x40 /* 64-byte blocks */ -#define SSE_MMREG_SIZE 16 -#define MMX_MMREG_SIZE 8 - - -/* linux kernel __memcpy (from: /include/asm/string.h) */ +#ifdef ARCH_X86 static inline void * __memcpy(void * to, const void * from, size_t n) { int d0, d1, d2; @@ -198,67 +223,6 @@ static inline void * __memcpy(void * to, const void * from, size_t n) return(to); } - -#ifdef HAVE_ASM_MMX -void * mmx_memset(void *what, int v, size_t len ) -{ - return memset( what,v,len ); -} - -void * mmx_memcpy(void * to, const void * from, size_t len) -{ - void *retval; - size_t i; - retval = to; - const unsigned char *f = from; - unsigned char *t = to; - if (len >= MMX1_MIN_LEN) { - register unsigned long int delta; - /* Align destinition to MMREG_SIZE -boundary */ - delta = ((unsigned long int)to)&(MMX_MMREG_SIZE-1); - if (delta) { - delta=MMX_MMREG_SIZE-delta; - len -= delta; - small_memcpy(to, from, delta); - } - i = len >> 6; /* len/64 */ - len&=63; - for (; i>0; i--) { - __asm__ __volatile__ ( - "movq (%0), %%mm0\n" - "movq 8(%0), %%mm1\n" - "movq 16(%0), %%mm2\n" - "movq 24(%0), %%mm3\n" - "movq 32(%0), %%mm4\n" - "movq 40(%0), %%mm5\n" - "movq 48(%0), %%mm6\n" - "movq 56(%0), %%mm7\n" - "movq %%mm0, (%1)\n" - "movq %%mm1, 8(%1)\n" - "movq %%mm2, 16(%1)\n" - "movq %%mm3, 24(%1)\n" - "movq %%mm4, 32(%1)\n" - "movq %%mm5, 40(%1)\n" - "movq %%mm6, 48(%1)\n" - "movq %%mm7, 56(%1)\n" - :: "r" (from), "r" (to) : "memory"); - (f)+=64; - (t)+=64; - } - __asm__ __volatile__ ("emms":::"memory"); - } - /* - * Now do the tail of the block - */ - if (len) __memcpy(to, from, len); - return retval; -} - -#endif - -/* we might want to write optimized versions of these later */ -#define __constant_count_memset(s,c,count) __memset_generic((s),(c),(count)) - /* * memset(x,0,y) is a reasonably common thing to do, so we want to fill * things 32 bits at a time even when we don't know the size of the @@ -281,173 +245,336 @@ __asm__ __volatile__( :"memory"); } -#ifdef HAVE_ASM_MMX2 -static void * mmx2_memcpy(void * to, const void * from, size_t len) -{ - void *retval; - size_t i; - retval = to; - - /* PREFETCH has effect even for MOVSB instruction ;) */ - __asm__ __volatile__ ( - " prefetchnta (%0)\n" - " prefetchnta 32(%0)\n" - " prefetchnta 64(%0)\n" - " prefetchnta 96(%0)\n" - " prefetchnta 128(%0)\n" - " prefetchnta 160(%0)\n" - " prefetchnta 192(%0)\n" - " prefetchnta 224(%0)\n" - " prefetchnta 256(%0)\n" - " prefetchnta 288(%0)\n" - : : "r" (from) ); - - if (len >= MIN_LEN) { - register unsigned long int delta; - /* Align destinition to MMREG_SIZE -boundary */ - delta = ((unsigned long int)to)&(MMX_MMREG_SIZE-1); - if (delta) { - delta=MMX_MMREG_SIZE-delta; - len -= delta; - small_memcpy(to, from, delta); - } - i = len >> 6; /* len/64 */ - len&=63; - for (; i>0; i--) { - __asm__ __volatile__ ( - "prefetchnta 320(%0)\n" - "prefetchnta 352(%0)\n" - "movq (%0), %%mm0\n" - "movq 8(%0), %%mm1\n" - "movq 16(%0), %%mm2\n" - "movq 24(%0), %%mm3\n" - "movq 32(%0), %%mm4\n" - "movq 40(%0), %%mm5\n" - "movq 48(%0), %%mm6\n" - "movq 56(%0), %%mm7\n" - "movntq %%mm0, (%1)\n" - "movntq %%mm1, 8(%1)\n" - "movntq %%mm2, 16(%1)\n" - "movntq %%mm3, 24(%1)\n" - "movntq %%mm4, 32(%1)\n" - "movntq %%mm5, 40(%1)\n" - "movntq %%mm6, 48(%1)\n" - "movntq %%mm7, 56(%1)\n" - :: "r" (from), "r" (to) : "memory"); - ((const unsigned char *)from)+=64; - ((unsigned char *)to)+=64; - } - /* since movntq is weakly-ordered, a "sfence" - * is needed to become ordered again. */ - __asm__ __volatile__ ("sfence":::"memory"); - __asm__ __volatile__ ("emms":::"memory"); - } - /* - * Now do the tail of the block - */ - if (len) __memcpy(to, from, len); - return retval; -} - +#undef _MMREG_SIZE +#ifdef HAVE_ASM_SSE +#define _MMREG_SIZE 16 +#else +#define _MMREG_SIZE 64 #endif -#ifdef HAVE_ASM_SSE -/* SSE note: i tried to move 128 bytes a time instead of 64 but it -didn't make any measureable difference. i'm using 64 for the sake of -simplicity. [MF]*/ -static void * sse_memcpy(void * to, const void * from, size_t len) +#undef _MIN_LEN +#ifdef HAVE_MMX1 +#define _MIN_LEN 0x800 /* 2K blocks */ +#else +#define _MIN_LEN 0x40 /* 64-byte blocks */ +#endif + + +#undef _EMMS +#undef _PREFETCH + +#ifdef HAVE_K6_2PLUS +#define _PREFETCH "prefetch" +/* On K6 femms is faster of emms. On K7 femms is directly mapped on emms. */ +#define _EMMS "femms" +#else +#define _PREFETCH "prefetchnta" +#define _EMMS "emms" +#endif + +static void *fast_memcpy(void * to, const void * from, size_t len) { - void *retval; - size_t i; - retval = to; - const unsigned char *f = from; + void *retval; + size_t i; + retval = to; unsigned char *t = to; - __asm__ __volatile__ ( - " prefetchnta (%0)\n" - " prefetchnta 32(%0)\n" - " prefetchnta 64(%0)\n" - " prefetchnta 128(%0)\n" - " prefetchnta 160(%0)\n" - " prefetchnta 192(%0)\n" - " prefetchnta 224(%0)\n" - " prefetchnta 256(%0)\n" - " prefetchnta 288(%0)\n" - : : "r" (from) ); + unsigned char *f = (unsigned char *)from; +#ifndef HAVE_MMX1 + /* PREFETCH has effect even for MOVSB instruction ;) */ + __asm__ __volatile__ ( + _PREFETCH" (%0)\n" + _PREFETCH" 64(%0)\n" + _PREFETCH" 128(%0)\n" + _PREFETCH" 192(%0)\n" + _PREFETCH" 256(%0)\n" + : : "r" (f) ); +#endif + if(len >= _MIN_LEN) + { + register unsigned long int delta; + /* Align destinition to MMREG_SIZE -boundary */ + delta = ((unsigned long int)to)&(_MMREG_SIZE-1); + if(delta) + { + delta=_MMREG_SIZE-delta; + len -= delta; + small_memcpy(t, f, delta); + } + i = len >> 6; /* len/64 */ + len&=63; + /* + This algorithm is top effective when the code consequently + reads and writes blocks which have size of cache line. + Size of cache line is processor-dependent. + It will, however, be a minimum of 32 bytes on any processors. + It would be better to have a number of instructions which + perform reading and writing to be multiple to a number of + processor's decoders, but it's not always possible. + */ +#ifdef HAVE_ASM_SSE /* Only P3 (may be Cyrix3) */ + if(((unsigned long)f) & 15) + /* if SRC is misaligned */ + for(; i>0; i--) + { + __asm__ __volatile__ ( + _PREFETCH" 320(%0)\n" + "movups (%0), %%xmm0\n" + "movups 16(%0), %%xmm1\n" + "movups 32(%0), %%xmm2\n" + "movups 48(%0), %%xmm3\n" + "movntps %%xmm0, (%1)\n" + "movntps %%xmm1, 16(%1)\n" + "movntps %%xmm2, 32(%1)\n" + "movntps %%xmm3, 48(%1)\n" + :: "r" (f), "r" (t) : "memory"); + f+=64; + t+=64; + } + else + /* + Only if SRC is aligned on 16-byte boundary. + It allows to use movaps instead of movups, which required data + to be aligned or a general-protection exception (#GP) is generated. + */ + for(; i>0; i--) + { + __asm__ __volatile__ ( + _PREFETCH" 320(%0)\n" + "movaps (%0), %%xmm0\n" + "movaps 16(%0), %%xmm1\n" + "movaps 32(%0), %%xmm2\n" + "movaps 48(%0), %%xmm3\n" + "movntps %%xmm0, (%1)\n" + "movntps %%xmm1, 16(%1)\n" + "movntps %%xmm2, 32(%1)\n" + "movntps %%xmm3, 48(%1)\n" + :: "r" (f), "r" (t) : "memory"); + f+=64; + t+=64; + } +#else + // Align destination at BLOCK_SIZE boundary + for(; ((int)to & (BLOCK_SIZE-1)) && i>0; i--) + { + __asm__ __volatile__ ( +#ifndef HAVE_MMX1 + _PREFETCH" 320(%0)\n" +#endif + "movq (%0), %%mm0\n" + "movq 8(%0), %%mm1\n" + "movq 16(%0), %%mm2\n" + "movq 24(%0), %%mm3\n" + "movq 32(%0), %%mm4\n" + "movq 40(%0), %%mm5\n" + "movq 48(%0), %%mm6\n" + "movq 56(%0), %%mm7\n" + MOVNTQ" %%mm0, (%1)\n" + MOVNTQ" %%mm1, 8(%1)\n" + MOVNTQ" %%mm2, 16(%1)\n" + MOVNTQ" %%mm3, 24(%1)\n" + MOVNTQ" %%mm4, 32(%1)\n" + MOVNTQ" %%mm5, 40(%1)\n" + MOVNTQ" %%mm6, 48(%1)\n" + MOVNTQ" %%mm7, 56(%1)\n" + :: "r" (f), "r" (t) : "memory"); + f+=64; + t+=64; + } - if (len >= MIN_LEN) { - register unsigned long int delta; - // Align destinition to MMREG_SIZE -boundary - delta = ((unsigned long int)to)&(SSE_MMREG_SIZE-1); - if (delta) { - delta=SSE_MMREG_SIZE-delta; - len -= delta; - small_memcpy(to, from, delta); - } - i = len >> 6; - len&=63; - if (((unsigned long)from) & 15) - // if SRC is misaligned - for (; i>0; i--) { - __asm__ __volatile__ ( - "prefetchnta 320(%0)\n" - "prefetchnta 352(%0)\n" - "movups (%0), %%xmm0\n" - "movups 16(%0), %%xmm1\n" - "movups 32(%0), %%xmm2\n" - "movups 48(%0), %%xmm3\n" - "movntps %%xmm0, (%1)\n" - "movntps %%xmm1, 16(%1)\n" - "movntps %%xmm2, 32(%1)\n" - "movntps %%xmm3, 48(%1)\n" - :: "r" (from), "r" (to) : "memory"); - (f)+=64; - (t)+=64; - } - else - - // Only if SRC is aligned on 16-byte boundary. - // It allows to use movaps instead of movups, which required - // data to be aligned or a general-protection exception (#GP) - // is generated. - - for (; i>0; i--) { - __asm__ __volatile__ ( - "prefetchnta 320(%0)\n" - "prefetchnta 352(%0)\n" - "movaps (%0), %%xmm0\n" - "movaps 16(%0), %%xmm1\n" - "movaps 32(%0), %%xmm2\n" - "movaps 48(%0), %%xmm3\n" - "movntps %%xmm0, (%1)\n" - "movntps %%xmm1, 16(%1)\n" - "movntps %%xmm2, 32(%1)\n" - "movntps %%xmm3, 48(%1)\n" - :: "r" (from), "r" (to) : "memory"); - (f)+=64; - (t)+=64; - } - // since movntq is weakly-ordered, a "sfence" - // is needed to become ordered again. - __asm__ __volatile__ ("sfence":::"memory"); - /// - __asm__ __volatile__ ("emms":::"memory"); - } - - // Now do the tail of the block - - if (len) __memcpy(to, from, len); - return retval; + // Pure Assembly cuz gcc is a bit unpredictable ;) + if(i>=BLOCK_SIZE/64) + asm volatile( + "xorl %%eax, %%eax \n\t" + ".balign 16 \n\t" + "1: \n\t" + "movl (%0, %%eax), %%ebx \n\t" + "movl 32(%0, %%eax), %%ebx \n\t" + "movl 64(%0, %%eax), %%ebx \n\t" + "movl 96(%0, %%eax), %%ebx \n\t" + "addl $128, %%eax \n\t" + "cmpl %3, %%eax \n\t" + " jb 1b \n\t" + + "xorl %%eax, %%eax \n\t" + + ".balign 16 \n\t" + "2: \n\t" + "movq (%0, %%eax), %%mm0\n" + "movq 8(%0, %%eax), %%mm1\n" + "movq 16(%0, %%eax), %%mm2\n" + "movq 24(%0, %%eax), %%mm3\n" + "movq 32(%0, %%eax), %%mm4\n" + "movq 40(%0, %%eax), %%mm5\n" + "movq 48(%0, %%eax), %%mm6\n" + "movq 56(%0, %%eax), %%mm7\n" + MOVNTQ" %%mm0, (%1, %%eax)\n" + MOVNTQ" %%mm1, 8(%1, %%eax)\n" + MOVNTQ" %%mm2, 16(%1, %%eax)\n" + MOVNTQ" %%mm3, 24(%1, %%eax)\n" + MOVNTQ" %%mm4, 32(%1, %%eax)\n" + MOVNTQ" %%mm5, 40(%1, %%eax)\n" + MOVNTQ" %%mm6, 48(%1, %%eax)\n" + MOVNTQ" %%mm7, 56(%1, %%eax)\n" + "addl $64, %%eax \n\t" + "cmpl %3, %%eax \n\t" + "jb 2b \n\t" + +#if CONFUSION_FACTOR > 0 + // a few percent speedup on out of order executing CPUs + "movl %5, %%eax \n\t" + "2: \n\t" + "movl (%0), %%ebx \n\t" + "movl (%0), %%ebx \n\t" + "movl (%0), %%ebx \n\t" + "movl (%0), %%ebx \n\t" + "decl %%eax \n\t" + " jnz 2b \n\t" +#endif + + "xorl %%eax, %%eax \n\t" + "addl %3, %0 \n\t" + "addl %3, %1 \n\t" + "subl %4, %2 \n\t" + "cmpl %4, %2 \n\t" + " jae 1b \n\t" + : "+r" (f), "+r" (t), "+r" (i) + : "r" (BLOCK_SIZE), "i" (BLOCK_SIZE/64), "i" (CONFUSION_FACTOR) + : "%eax", "%ebx" + ); + + for(; i>0; i--) + { + __asm__ __volatile__ ( +#ifndef HAVE_MMX1 + _PREFETCH" 320(%0)\n" +#endif + "movq (%0), %%mm0\n" + "movq 8(%0), %%mm1\n" + "movq 16(%0), %%mm2\n" + "movq 24(%0), %%mm3\n" + "movq 32(%0), %%mm4\n" + "movq 40(%0), %%mm5\n" + "movq 48(%0), %%mm6\n" + "movq 56(%0), %%mm7\n" + MOVNTQ" %%mm0, (%1)\n" + MOVNTQ" %%mm1, 8(%1)\n" + MOVNTQ" %%mm2, 16(%1)\n" + MOVNTQ" %%mm3, 24(%1)\n" + MOVNTQ" %%mm4, 32(%1)\n" + MOVNTQ" %%mm5, 40(%1)\n" + MOVNTQ" %%mm6, 48(%1)\n" + MOVNTQ" %%mm7, 56(%1)\n" + :: "r" (f), "r" (t) : "memory"); + f+=64; + t+=64; + } + +#endif /* Have SSE */ +#ifdef HAVE_ASM_MMX2 + /* since movntq is weakly-ordered, a "sfence" + * is needed to become ordered again. */ + __asm__ __volatile__ ("sfence":::"memory"); +#endif +#ifndef HAVE_ASM_SSE + /* enables to use FPU */ + __asm__ __volatile__ (_EMMS:::"memory"); +#endif + } + /* + * Now do the tail of the block + */ + if(len) small_memcpy(t, f, len); + return retval; +} +/* Fast memory set. See comments for fast_memcpy */ +void * fast_memset(void * to, int val, size_t len) +{ + void *retval; + size_t i; + unsigned char mm_reg[_MMREG_SIZE], *pmm_reg; + unsigned char *t = to; + retval = to; + if(len >= _MIN_LEN) + { + register unsigned long int delta; + delta = ((unsigned long int)to)&(_MMREG_SIZE-1); + if(delta) + { + delta=_MMREG_SIZE-delta; + len -= delta; + small_memset(t, val, delta); + } + i = len >> 7; /* len/128 */ + len&=127; + pmm_reg = mm_reg; + small_memset(pmm_reg,val,sizeof(mm_reg)); +#ifdef HAVE_ASM_SSE /* Only P3 (may be Cyrix3) */ + __asm__ __volatile__( + "movups (%0), %%xmm0\n" + :: "r"(mm_reg):"memory"); + for(; i>0; i--) + { + __asm__ __volatile__ ( + "movntps %%xmm0, (%0)\n" + "movntps %%xmm0, 16(%0)\n" + "movntps %%xmm0, 32(%0)\n" + "movntps %%xmm0, 48(%0)\n" + "movntps %%xmm0, 64(%0)\n" + "movntps %%xmm0, 80(%0)\n" + "movntps %%xmm0, 96(%0)\n" + "movntps %%xmm0, 112(%0)\n" + :: "r" (t) : "memory"); + t+=128; + } +#else + __asm__ __volatile__( + "movq (%0), %%mm0\n" + :: "r"(mm_reg):"memory"); + for(; i>0; i--) + { + __asm__ __volatile__ ( + MOVNTQ" %%mm0, (%0)\n" + MOVNTQ" %%mm0, 8(%0)\n" + MOVNTQ" %%mm0, 16(%0)\n" + MOVNTQ" %%mm0, 24(%0)\n" + MOVNTQ" %%mm0, 32(%0)\n" + MOVNTQ" %%mm0, 40(%0)\n" + MOVNTQ" %%mm0, 48(%0)\n" + MOVNTQ" %%mm0, 56(%0)\n" + MOVNTQ" %%mm0, 64(%0)\n" + MOVNTQ" %%mm0, 72(%0)\n" + MOVNTQ" %%mm0, 80(%0)\n" + MOVNTQ" %%mm0, 88(%0)\n" + MOVNTQ" %%mm0, 96(%0)\n" + MOVNTQ" %%mm0, 104(%0)\n" + MOVNTQ" %%mm0, 112(%0)\n" + MOVNTQ" %%mm0, 120(%0)\n" + :: "r" (t) : "memory"); + t+=128; + } +#endif /* Have SSE */ +#ifdef HAVE_ASM_MMX2 + /* since movntq is weakly-ordered, a "sfence" + * is needed to become ordered again. */ + __asm__ __volatile__ ("sfence":::"memory"); +#endif +#ifndef HAVE_ASM_SSE + /* enables to use FPU */ + __asm__ __volatile__ (EMMS:::"memory"); +#endif + } + /* + * Now do the tail of the block + */ + if(len) small_memset(t, val, len); + return retval; } - -#endif static void *linux_kernel_memcpy(void *to, const void *from, size_t len) { return __memcpy(to,from,len); } -#endif /* ARCH_X86 */ - -/* save library size on platforms without special memcpy impl. */ +#endif static struct { char *name; @@ -459,27 +586,22 @@ static struct { { "glibc memcpy()", memcpy, 0}, #ifdef ARCH_X86 { "linux kernel memcpy()", linux_kernel_memcpy, 0}, -#ifdef HAVE_ASM_MMX - { "MMX optimized memcpy()", mmx_memcpy, 0}, -#endif -#ifdef HAVE_ASM_MMX2 - { "MMXEXT optimized memcpy()", mmx2_memcpy, 0}, -#endif -#ifdef HAVE_ASM_SSE - { "SSE optimized memcpy()", sse_memcpy, 0}, -#endif + { "MMX/MMX2/SSE optimized memcpy()", fast_memcpy, 0}, #endif { NULL, NULL, 0}, }; static struct { char *name; - void *(*function)(void *to, int c, size_t len); + void *(*function)(void *to, uint8_t c, size_t len); unsigned long long time; } memset_method[] = { { NULL, NULL, 0}, { "glibc memset()", memset, 0}, +#ifdef ARCH_X86 + { "MMX/MMX2/SSE optimized memset()", fast_memset, 0}, +#endif { NULL, NULL, 0}, }; @@ -503,18 +625,12 @@ char *get_memcpy_descr( void ) return res; } - void find_best_memcpy() { /* save library size on platforms without special memcpy impl. */ - unsigned long long t; char *buf1, *buf2; - int i, j, best = 0; - - veejay_memcpy = (void*) memcpy; - veejay_memset = (void*) memset; - return; + int i, best = 0; if (!(buf1 = (char*) malloc( BUFSIZE * 2000 * sizeof(char) ))) return; @@ -541,29 +657,56 @@ void find_best_memcpy() if (best == 0 || t < memcpy_method[best].time) best = i; } - if (best) { veejay_memcpy = memcpy_method[best].function; } - best = 0; - for (i=1; memset_method[i].name; i++) { - t = rdtsc(); - - memset_method[i].function( buf1 , 0, 2000 * BUFSIZE ); - - t = rdtsc() - t; - memset_method[i].time = t; - if (best == 0 || t <= memset_method[best].time) - best = i; - } - - if (best) { - veejay_memset = (void*) memset_method[best].function; - } - - - + free( buf1 ); + free( buf2 ); +} + + + + +void find_best_memset() +{ + /* save library size on platforms without special memcpy impl. */ + unsigned long long t; + char *buf1, *buf2; + int i, best = 0; + + if (!(buf1 = (char*) malloc( BUFSIZE * 2000 * sizeof(char) ))) + return; + + if (!(buf2 = (char*) malloc( BUFSIZE * 2000 * sizeof(char) ))) { + free( buf1 ); + return; + } + + for( i = 0; i < (BUFSIZE*2000); i ++ ) + { + buf1[i] = 0; + buf2[i] = 0; + } + + for (i=1; memset_method[i].name; i++) + { + t = rdtsc(); + + memset_method[i].function( buf1 , 0 , 2000 * BUFSIZE ); + + t = rdtsc() - t; + + memset_method[i].time = t; + + if (best == 0 || t < memset_method[best].time) + best = i; + } + + if (best) { + veejay_memset = memset_method[best].function; + } + free( buf1 ); free( buf2 ); } diff --git a/veejay-ng/libvjmem/vj-x86.c b/veejay-ng/libvjmem/vj-x86.c index 0b55f0b1..c959191e 100644 --- a/veejay-ng/libvjmem/vj-x86.c +++ b/veejay-ng/libvjmem/vj-x86.c @@ -20,14 +20,12 @@ #include #include #include +#include +#include #include -#ifdef STRICT_CHECKING -#include -#endif -/** \defgroup memman Fast memory copy and aligned memory allocation - */ extern void find_best_memcpy(void); +extern void find_best_memset(void); static int MEM_ALIGNMENT_SIZE = 0; @@ -109,7 +107,6 @@ __asm__ __volatile__( } #else - void mymemset_generic(void *s, char c, size_t cc ) { memset(s,c,cc); @@ -122,6 +119,7 @@ unsigned int vj_get_timer() gettimeofday(&tv, 0); return ((tv.tv_sec & 1000000) + tv.tv_usec); } + void vj_mem_init(void) { #ifdef ARCH_X86 @@ -129,8 +127,9 @@ void vj_mem_init(void) #endif if(MEM_ALIGNMENT_SIZE == 0) MEM_ALIGNMENT_SIZE = getpagesize(); - + find_best_memcpy(); + find_best_memset(); } void *vj_malloc(unsigned int size) @@ -138,12 +137,6 @@ void *vj_malloc(unsigned int size) if( size == 0 ) return NULL; void *ptr = NULL; - -#ifdef STRICT_CHECKING - assert( size > 0 ); - assert( MEM_ALIGNMENT_SIZE > 0 ); -#endif - #ifdef HAVE_POSIX_MEMALIGN posix_memalign( &ptr, MEM_ALIGNMENT_SIZE, size ); #else @@ -159,6 +152,24 @@ void *vj_malloc(unsigned int size) return ptr; } +void *vj_calloc( unsigned int size ) +{ + void *ptr = vj_malloc( size ); + if(ptr) + veejay_memset( ptr, 0, size ); + return ptr; +} + + +void *vj_yuvalloc( unsigned int w, unsigned int h ) +{ + size_t len = (w * h * 3); + unsigned char *ptr = vj_malloc( len ); + + veejay_memset( ptr, 0, (w*h)); + veejay_memset( ptr + (w*h), 128, (w*h)*2); + return ptr; +} diff --git a/veejay-ng/libvjmem/vjmem.h b/veejay-ng/libvjmem/vjmem.h index 9644317f..470e7ee4 100644 --- a/veejay-ng/libvjmem/vjmem.h +++ b/veejay-ng/libvjmem/vjmem.h @@ -9,8 +9,6 @@ extern void *(* veejay_memcpy)(void *to, const void *from, size_t len); extern void *(* veejay_memset)(void *to, uint8_t val, size_t len); -//#define veejay_memcpy(t,f,l) memcpy(t,f,l) - extern void mymemset_generic(void *s, char c, size_t count); extern void vj_mem_init(void); @@ -19,4 +17,8 @@ extern char *get_memcpy_descr( void ); extern void *vj_malloc(unsigned int size); +extern void *vj_calloc(unsigned int size ); + +extern void *vj_yuvalloc( unsigned int w, unsigned int h ); + #endif diff --git a/veejay-ng/libyuv/Makefile.am b/veejay-ng/libyuv/Makefile.am index 0c8601d8..680f2548 100644 --- a/veejay-ng/libyuv/Makefile.am +++ b/veejay-ng/libyuv/Makefile.am @@ -1,7 +1,7 @@ # Makefile for veejay MAINTAINERCLEANFILES = Makefile.in - +AM_CFLAGS=$(YUVCFLAGS) INCLUDES = -I$(top_srcdir) -I$(includedir) -I$(top_srcdir)/vjmem -I$(top_srcdir)/vjmsg -I$(top_srcdir)/libpostproc YUV_LIB_FILE = libyuv.la noinst_LTLIBRARIES = $(YUV_LIB_FILE) diff --git a/veejay-ng/libyuv/subsample.c b/veejay-ng/libyuv/subsample.c index 825aebd5..e6a9490a 100644 --- a/veejay-ng/libyuv/subsample.c +++ b/veejay-ng/libyuv/subsample.c @@ -21,9 +21,7 @@ * */ -/** \defgroup Planar YUV sampling - * - */ + #include @@ -67,31 +65,34 @@ const char *ssm_description[SSM_COUNT] = { // forward decl void ss_420_to_422(uint8_t *buffer, int width, int height); void ss_422_to_420(uint8_t *buffer, int width, int height); +static void subsample_y_clamp_plane( + uint8_t *plane, + uint8_t *dplane, + int len ); +static void subsample_uv_clamp_plane( + uint8_t *plane_u, + uint8_t *plane_v, + uint8_t *dplane_u, + uint8_t *dplane_v, + int len); typedef struct { - uint8_t *buf; + uint8_t *buf; uint8_t *YUV_to_YCbCr[2]; int jyuv; uint8_t *planes[4]; } yuv_sampler_t; -static uint8_t *sample_buffer = NULL; -static int go = 0; - void *subsample_init(int len) { - void *ret = NULL; yuv_sampler_t *s = (yuv_sampler_t*) vj_malloc(sizeof(yuv_sampler_t) ); if(!s) - return ret; - memset( s, 0 , sizeof( yuv_sampler_t )); - s->buf = (uint8_t*) vj_malloc(sizeof(uint8_t) * len ); - s->YUV_to_YCbCr[0] = NULL; - s->YUV_to_YCbCr[1] = NULL; + return NULL; + s->buf = (uint8_t*) vj_malloc(sizeof(uint8_t) * (len*2) ); if(!s->buf) - return ret; - + return NULL; + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); return (void*) s; } @@ -112,318 +113,26 @@ void *subsample_init_copy(int w, int h) s->planes[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * w * h ); s->planes[1] = (uint8_t*) vj_malloc( sizeof(uint8_t) * w * h ); s->planes[2] = (uint8_t*) vj_malloc( sizeof(uint8_t) * w * h ); + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); return (void*) s; } - void subsample_free(void *data) { yuv_sampler_t *sampler = (yuv_sampler_t*) data; if(sampler) { - if(sampler->buf) free(sampler->buf); - if(sampler->YUV_to_YCbCr[0]) - free(sampler->YUV_to_YCbCr[0]); - if(sampler->YUV_to_YCbCr[1]) - free(sampler->YUV_to_YCbCr[1]); - if(sampler->planes[0]) - free(sampler->planes[0]); - if(sampler->planes[1]) - free(sampler->planes[1]); - if(sampler->planes[2]) - free(sampler->planes[2]); + if(sampler->buf) + free(sampler->buf); free(sampler); } + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + sampler = NULL; } - -#define CLAMP_Y( f) ( f < 16 ? 16: f > 235 ? 235: f ) -#define CLAMP_C( u) ( u < 16 ? 16: u > 240 ? 240: u ) -static void subsample_init_YUV_to_CbCr(void *data) -{ - unsigned int n; - yuv_sampler_t *sampler = (yuv_sampler_t*) data; - - for( n = 0; n < 2; n ++ ) - { - sampler->YUV_to_YCbCr[n] = - (uint8_t*) vj_malloc(sizeof(uint8_t) * 256 ); - memset( sampler->YUV_to_YCbCr[n], 0, 256 ); - } - uint8_t *y = sampler->YUV_to_YCbCr[0]; - uint8_t *uv = sampler->YUV_to_YCbCr[1]; - for( n = 0; n < 256; n ++ ) - { - y[n] = CLAMP_Y( (n * 219.0 / 256.0 + 16) ); - uv[n] = CLAMP_C( (n* 224.0 / 256.0 + 16) ); - } - sampler->jyuv = 1; -} - -#ifdef HAVE_ASM_MMX -//! Clamp Y to 16-235 - MMX optimized, 64 bytes at a time. -/*! - \param plane Source - \param dplane Destination - \param len Size - */ -static void subsample_y_clamp_plane( - uint8_t *plane, - uint8_t *dplane, - int len ) -{ - uint8_t mi[8] = { 16,16,16,16, 16,16,16,16 }; - uint8_t ma[8] = { 235,235,235,235, 235,235,235,235}; - const uint8_t *min = &mi[0]; - const uint8_t *max = &ma[0]; - unsigned int k = 0; - unsigned int align = (len/8); - - for( k = 0; k < align ; k ++ ) - { - __asm__ __volatile__ ( -#if defined HAVE_ASM_MMX2 || defined HAVE_ASM_SSE - "prefetchnta (%0)\n" - "prefetchnta (%1)\n" - "prefetchnta (%2)\n" -#endif - "movq (%0), %%mm0\n" - "movq (%1), %%mm1\n" //eb - "movq (%2), %%mm2\n" //10 - "pmaxub %%mm0, %%mm2\n" - "pminub %%mm1, %%mm2\n" - "movntq %%mm2, (%3)\n" - :: "r" (plane),"r" (max), "r" (min), "r" (dplane) : "memory"); - - plane += 8; - dplane += 8; - } - if( (align*8) < len) - { - for( k = 8*align; k < len; k ++ ) - *(dplane++) = CLAMP_Y( (*plane++) ); - - } -} -#else -static void subsample_y_clamp_plane( - uint8_t *plane, - uint8_t *dplane, - int len ) -{ - unsigned int n; - for( n = 0 ; n < len; n ++ ) - dplane[n] = CLAMP_Y( plane[n] ); -} -#endif - -#ifdef HAVE_ASM_MMX -//! Clamp Chroma planes 16-240, MMX 8 pixel at a time -static void subsample_uv_clamp_plane( - uint8_t *plane_u, - uint8_t *plane_v, - uint8_t *dplane_u, - uint8_t *dplane_v, - int len) -{ - uint8_t mi[8] = { 16,16,16,16, 16,16,16,16 }; - uint8_t ma[8] = { 240,240,240,240, 240,240,240,240 }; - const uint8_t *min = &mi[0]; - const uint8_t *max = &ma[0]; - unsigned int k = 0; - unsigned int align = (len/8); - - for( k = 0; k < align ; k ++ ) - { - __asm__ __volatile__ ( -#if defined HAVE_ASM_MMX2 || defined HAVE_ASM_SSE - "prefetchnta (%0)\n" - "prefetchnta (%1)\n" - "prefetchnta (%2)\n" - "prefetchnta (%3)\n" -#endif - "movq (%0), %%mm0\n" - "movq (%1), %%mm1\n" - "movq (%2), %%mm2\n" - "pmaxub %%mm0, %%mm2\n" - "pminub %%mm1, %%mm2\n" - "movntq %%mm2, (%3)\n" - :: "r" (plane_u),"r" (max), "r" (min), "r" (dplane_u) : "memory"); - - plane_u += 8; - dplane_u += 8; - } - - for( k = 0; k < align ; k ++ ) - { - __asm__ __volatile__ ( - "prefetchnta (%0)\n" - "prefetchnta (%1)\n" - "prefetchnta (%2)\n" - "prefetchnta (%3)\n" - "movq (%0), %%mm0\n" - "movq (%1), %%mm1\n" - "movq (%2), %%mm2\n" - "pmaxub %%mm0, %%mm2\n" - "pminub %%mm1, %%mm2\n" - "movntq %%mm2, (%3)\n" - :: "r" (plane_v),"r" (max), "r" (min), "r" (dplane_v) : "memory"); - - plane_v += 8; - dplane_v += 8; - } -} -#else -static void subsample_uv_clamp_plane( - uint8_t *plane_u, - uint8_t *plane_v, - uint8_t *dplane_u, - uint8_t *dplane_v, - int len ) -{ - unsigned int n; - for( n = 0 ; n < len; n ++ ) - { - dplane_u[n] = CLAMP_Y( plane_u[n] ); - dplane_v[n] = CLAMP_C( plane_v[n] ); - } -} -#endif -static void subsample_ycbcr_itu601_plane( - uint8_t *plane, - int len, - uint8_t *lookup, - uint8_t *dplane ) -{ - unsigned int n; - for( n = 0 ; n < len; n ++ ) - dplane[n] = lookup[ plane[n] ]; -} - -static void subsample_ycbcr_itu601_chroma_plane( - uint8_t *planeU, - uint8_t *planeV, - int len, - uint8_t *lookup, - uint8_t *dplaneU, - uint8_t *dplaneV ) -{ - unsigned int n; - for( n = 0 ; n < len; n ++ ) - { - dplaneU[n] = lookup[ (planeU[n]) ]; - dplaneV[n] = lookup[ (planeV[n]) ]; - } -} - -void subsample_ycbcr_itu601(void *data, VJFrame *frame) -{ - yuv_sampler_t *sampler = (yuv_sampler_t*) data; - - if(!sampler->jyuv) - subsample_init_YUV_to_CbCr(sampler); - - subsample_ycbcr_itu601_plane( - frame->data[0], - frame->len, - sampler->YUV_to_YCbCr[0], - frame->data[0] ); - subsample_ycbcr_itu601_chroma_plane( - frame->data[1], - frame->data[2], - frame->uv_len, - sampler->YUV_to_YCbCr[1], - frame->data[1], - frame->data[2] ); -} - -void subsample_ycbcr_itu601_copy(void *data, VJFrame *src_frame, VJFrame *dst_frame) -{ - yuv_sampler_t *sampler = (yuv_sampler_t*) data; - if(!sampler->YUV_to_YCbCr[0]) - subsample_init_YUV_to_CbCr(sampler); - - subsample_ycbcr_itu601_plane( - src_frame->data[0], - src_frame->len, - sampler->YUV_to_YCbCr[0], - dst_frame->data[0] ); - subsample_ycbcr_itu601_chroma_plane( - src_frame->data[1], - src_frame->data[2], - src_frame->uv_len, - sampler->YUV_to_YCbCr[1], - dst_frame->data[1], - dst_frame->data[2] ); -} - -void subsample_ycbcr_clamp_itu601_copy(VJFrame *frame, VJFrame *dst_frame) -{ - subsample_y_clamp_plane( - frame->data[0], - dst_frame->data[0], - frame->len ); - subsample_uv_clamp_plane( - frame->data[1], - frame->data[2], - dst_frame->data[1], - dst_frame->data[2], - frame->uv_len ); -#ifdef HAVE_ASM_MMX - __asm__ __volatile__ ("sfence":::"memory"); - __asm__ __volatile__ ("emms":::"memory"); -#endif -} -/* -#ifdef HAVE_ASM_MMX -void subsample_clear_plane( uint8_t bval, uint8_t *plane, uint32_t plane_len ) -{ - unsigned int k = 0; - unsigned int align = (plane_len/64); - - double val = (double) bval; - - __asm__ __volatile__ ( - "pxor %%mm0, %%mm0\n" - "movq %%mm0, (%0)\n" - :: "r" (val) ); - - for( k = 0; k < align ; k ++ ) - { - __asm__ __volatile__ ( - "prefetchnta (%0)\n" - "prefetchnta 8(%0)\n" - "prefetchnta 16(%0)\n" - "prefetchnta 24(%0)\n" - "prefetchnta 32(%0)\n" - "prefetchnta 40(%0)\n" - "prefetchnta 49(%0)\n" - "prefetchnta 56(%0)\n" - "movntq %%mm0,(%0)\n" - "movntq %%mm0,8(%0)\n" - "movntq %%mm0,16(%0)\n" - "movntq %%mm0,24(%0)\n" - "movntq %%mm0,32(%0)\n" - "movntq %%mm0,40(%0)\n" - "movntq %%mm0,48(%0)\n" - "movntq %%mm0,56(%0)\n" - :: "r" (plane) : "memory"); - plane += 64; - } - __asm__ __volatile__ ("sfence":::"memory"); - __asm__ __volatile__ ("emms":::"memory"); -}*/ -//#else -void subsample_clear_plane( uint8_t bval, uint8_t *plane, uint32_t plane_len ) -{ - memset( plane, bval, plane_len ); -} - -//#endif - /************************************************************************* * Chroma Subsampling *************************************************************************/ @@ -477,6 +186,41 @@ static void ss_444_to_420jpeg(uint8_t *buffer, int width, int height) in0 = buffer; in1 = buffer + width; out = buffer; + + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + + for (y = 0; y < height; y += 4) { + for (x = 0; x < width; x += 4) { + out[0] = (in0[0] + 3 * (in0[1] + in1[0]) + (9 * in1[1]) + 8) >> 4; + out[1] = (in0[2] + 3 * (in0[3] + in1[2]) + (9 * in1[3]) + 8) >> 4; + out[2] = (in0[4] + 3 * (in0[5] + in1[4]) + (9 * in1[5]) + 8) >> 4; + out[3] = (in0[6] + 3 * (in0[7] + in1[6]) + (9 * in1[7]) + 8) >> 4; + + in0 += 8; + in1 += 8; + out += 4; + } + for ( ; x < width; x +=2 ) + { + out[0] = (in0[0] + 3 * (in0[1] + in1[0]) + (9 * in1[1]) + 8) >> 4; + in0 += 2; + in1 += 2; + out++; + } + in0 += width*2; + in1 += width*2; + } +} +static void ss_444_to_420jpeg_cp(uint8_t *buffer,uint8_t *dest, int width, int height) +{ + const uint8_t *in0, *in1; + uint8_t *out; + int x, y = height; + in0 = buffer; + in1 = buffer + width; + out = dest; + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + for (y = 0; y < height; y += 4) { for (x = 0; x < width; x += 4) { out[0] = (in0[0] + 3 * (in0[1] + in1[0]) + (9 * in1[1]) + 8) >> 4; @@ -499,7 +243,6 @@ static void ss_444_to_420jpeg(uint8_t *buffer, int width, int height) in1 += width*2; } } - /* horizontal interstitial siting * * Y Y Y Y @@ -548,6 +291,7 @@ static void tr_420jpeg_to_444(void *data, uint8_t *buffer, int width, int height uint8_t *inm, *in0, *inp, *out0, *out1; uint8_t cmm, cm0, cmp, c0m, c00, c0p, cpm, cp0, cpp; int x, y; + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); yuv_sampler_t *sampler = (yuv_sampler_t*) data; @@ -693,6 +437,9 @@ static void tr_420jpeg_to_444(void *data, uint8_t *buffer, int width, int height static void ss_420jpeg_to_444(uint8_t *buffer, int width, int height) { + + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + #ifndef HAVE_ASM_MMX uint8_t *in, *out0, *out1; int x, y; @@ -712,8 +459,8 @@ static void ss_420jpeg_to_444(uint8_t *buffer, int width, int height) } #else int x,y; - const int mmx_stride = width/8; - uint8_t *src = buffer + (width * height/4)-1; + const int mmx_stride = width >> 3; + uint8_t *src = buffer + ((width * height) >> 2)-1; uint8_t *dst = buffer + (width * height) -1; uint8_t *dst2 = dst - width; @@ -740,181 +487,274 @@ static void ss_420jpeg_to_444(uint8_t *buffer, int width, int height) void ss_420_to_422(uint8_t *buffer, int width, int height) { + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + //todo, 1x2 super sampling (box) } void ss_422_to_420(uint8_t *buffer, int width, int height ) { - veejay_msg(0, "%s: Implement me", __FUNCTION__); - + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + //todo 2x1 down sampling (box) } -#ifndef HAVE_ASM_MMX -static void ss_444_to_422(void *data, uint8_t *buffer, int width, int height) +#ifdef HAVE_ASM_MMX +#undef HAVE_K6_2PLUS +#if !defined( HAVE_ASM_MMX2) && defined( HAVE_ASM_3DNOW ) +#define HAVE_K6_2PLUS +#endif + +#undef _EMMS + +#ifdef HAVE_K6_2PLUS +/* On K6 femms is faster of emms. On K7 femms is directly mapped on emms. */ +#define _EMMS "femms" +#else +#define _EMMS "emms" +#endif + +#endif + +#ifdef HAVE_ASM_MMX +/* for small memory blocks (<256 bytes) this version is faster */ +#define small_memcpy(to,from,n)\ +{\ +register unsigned long int dummy;\ +__asm__ __volatile__(\ + "rep; movsb"\ + :"=&D"(to), "=&S"(from), "=&c"(dummy)\ + :"0" (to), "1" (from),"2" (n)\ + : "memory");\ +} + +static inline void copy8( uint8_t *dst, uint8_t *in ) { - const int dst_stride = width/2; - int x,y; - yuv_sampler_t *sampler = (yuv_sampler_t*) data; - - for(y = 0; y < height; y ++) + __asm__ __volatile__ ( + "movq (%0), %%mm0\n" + "movq %%mm0, (%1)\n" + :: "r" (in), "r" (dst) : "memory" ); +} + +static inline void copy16( uint8_t *dst, uint8_t *in) +{ + __asm__ __volatile__ ( + "movq (%0), %%mm0\n" + "movq 8(%0), %%mm1\n" + "movq %%mm0, (%1)\n" + "movq %%mm1, 8(%1)\n" + :: "r" (in), "r" (dst) : "memory" ); +} + +static inline void copy_width( uint8_t *dst, uint8_t *in, int width ) +{ + int w = width >> 4; + int x; + uint8_t *d = dst; + uint8_t *i = in; + + for( x = 0; x < w; x ++ ) { - uint8_t *src = sampler->buf; - uint8_t *dst = buffer + (y*dst_stride); - veejay_memcpy( src, buffer + (y*width), width ); - for(x=0; x < dst_stride; x++) - { - *(dst++) = ( src[0] + src[1] ) >> 1; - src += 2; - } + copy16( d, i ); + d += 16; + i += 16; } + x = (w % 16); + if( x > 4 ) + small_memcpy( d, i, x-1); + } -#else - -/* mmx_average_2_u8 (function taken from mpeg2dec, a free MPEG-2 video - * stream decoder - * - * Copyright (C) 2000-2003 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - */ - -static mmx_t mask1 = {0xfefefefefefefefeLL}; -static mmx_t round4 = {0x0002000200020002LL}; - -static inline void mmx_average_4_U8 (uint8_t * dest, const uint8_t * src1, - const uint8_t * src2, - const uint8_t * src3, - const uint8_t * src4) +static inline void load_mask16to8() { - /* *dest = (*src1 + *src2 + *src3 + *src4 + 2)/ 4; */ + const uint64_t mask = 0x00ff00ff00ff00ffLL; + const uint8_t *m = (uint8_t*)&mask; - movq_m2r (*src1, mm1); /* load 8 src1 bytes */ - movq_r2r (mm1, mm2); /* copy 8 src1 bytes */ + __asm __volatile( + "movq (%0), %%mm4\n\t" + :: "r" (m) + ); - punpcklbw_r2r (mm0, mm1); /* unpack low src1 bytes */ - punpckhbw_r2r (mm0, mm2); /* unpack high src1 bytes */ - - movq_m2r (*src2, mm3); /* load 8 src2 bytes */ - movq_r2r (mm3, mm4); /* copy 8 src2 bytes */ - - punpcklbw_r2r (mm0, mm3); /* unpack low src2 bytes */ - punpckhbw_r2r (mm0, mm4); /* unpack high src2 bytes */ - - paddw_r2r (mm3, mm1); /* add lows */ - paddw_r2r (mm4, mm2); /* add highs */ - - /* now have partials in mm1 and mm2 */ - - movq_m2r (*src3, mm3); /* load 8 src3 bytes */ - movq_r2r (mm3, mm4); /* copy 8 src3 bytes */ - - punpcklbw_r2r (mm0, mm3); /* unpack low src3 bytes */ - punpckhbw_r2r (mm0, mm4); /* unpack high src3 bytes */ - - paddw_r2r (mm3, mm1); /* add lows */ - paddw_r2r (mm4, mm2); /* add highs */ - - movq_m2r (*src4, mm5); /* load 8 src4 bytes */ - movq_r2r (mm5, mm6); /* copy 8 src4 bytes */ - - punpcklbw_r2r (mm0, mm5); /* unpack low src4 bytes */ - punpckhbw_r2r (mm0, mm6); /* unpack high src4 bytes */ - - paddw_r2r (mm5, mm1); /* add lows */ - paddw_r2r (mm6, mm2); /* add highs */ - - /* now have subtotal in mm1 and mm2 */ - - paddw_m2r (round4, mm1); - psraw_i2r (2, mm1); /* /4 */ - paddw_m2r (round4, mm2); - psraw_i2r (2, mm2); /* /4 */ - - packuswb_r2r (mm2, mm1); /* pack (w/ saturation) */ - movq_r2m (mm1, *dest); /* store result in dest */ } - -static inline void mmx_average_2_U8 (uint8_t * dest, const uint8_t * src1, - const uint8_t * src2) +static inline void down_sample16to8( uint8_t *out, uint8_t *in ) { - /* *dest = (*src1 + *src2 + 1)/ 2; */ - - movq_m2r (*src1, mm1); /* load 8 src1 bytes */ - movq_r2r (mm1, mm2); /* copy 8 src1 bytes */ - - movq_m2r (*src2, mm3); /* load 8 src2 bytes */ - movq_r2r (mm3, mm4); /* copy 8 src2 bytes */ - - pxor_r2r (mm1, mm3); /* xor src1 and src2 */ - pand_m2r (mask1, mm3); /* mask lower bits */ - psrlq_i2r (1, mm3); /* /2 */ - por_r2r (mm2, mm4); /* or src1 and src2 */ - psubb_r2r (mm3, mm4); /* subtract subresults */ - movq_r2m (mm4, *dest); /* store result in dest */ + //@ down sample by dropping right pixels + __asm __volatile( + "movq (%0), %%mm1\n\t" + "movq 8(%0),%%mm3\n\t" + "pxor %%mm5,%%mm5\n\t" + "pand %%mm4,%%mm1\n\t" + "pand %%mm4,%%mm3\n\t" + "packuswb %%mm1,%%mm2\n\t" + "packuswb %%mm3,%%mm5\n\t" + "psrlq $32, %%mm2\n\t" + "por %%mm5,%%mm2\n\t" + "movq %%mm2, (%1)\n\t" + :: "r" (in), "r" (out) + ); } -static void ss_444_to_422(void *data,uint8_t *buffer, int width, int height) +#endif +static void ss_444_to_422_cp(void *data, uint8_t *buffer, uint8_t *dest, int width, int height) { - const int dst_stride = width/2; - const int len = width * height; - const int mmx_stride = dst_stride / 8; + const int dst_stride = width >> 1; int x,y; - +#ifdef HAVE_ASM_MMX + int mmxdst_stride=dst_stride >> 3; + int left = dst_stride % 8; +#endif yuv_sampler_t *sampler = (yuv_sampler_t*) data; + uint8_t *src = sampler->buf; + uint8_t *dst; + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); +#ifdef HAVE_ASM_MMX + load_mask16to8(); +#endif for(y = 0; y < height; y ++) { - uint8_t *src = sampler->buf; - uint8_t *dst = buffer + (y*dst_stride); - veejay_memcpy( src, buffer + (y*width), width ); - for(x=0; x < mmx_stride; x++) + src = buffer + (y*width); + dst = dest + (y*dst_stride); + +#ifndef HAVE_ASM_MMX + for(x=0; x < dst_stride; x++) { - mmx_average_2_U8( dst,src, src+8 ); + *(dst++) = ( src[0] + src[1] + 1 ) >> 1; + src += 2; + } +#else + for( x= 0; x < mmxdst_stride; x++ ) + { + down_sample16to8( dst, src ); src += 16; dst += 8; } + for(x=0; x < left; x++) + { + *(dst++) = ( src[0] + src[1] + 1 ) >> 1; + src += 2; + } +#endif } +} + +static void ss_444_to_422(void *data, uint8_t *buffer, int width, int height) +{ + const int dst_stride = width >> 1; + int x,y; +#ifdef HAVE_ASM_MMX + int mmxdst_stride=dst_stride >> 3; + int left = dst_stride % 8; +#endif + yuv_sampler_t *sampler = (yuv_sampler_t*) data; + uint8_t *src = sampler->buf; + uint8_t *dst; + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + +#ifdef HAVE_ASM_MMX + load_mask16to8(); +#endif + for(y = 0; y < height; y ++) + { + src = sampler->buf; + dst = buffer + (y*dst_stride); + +#ifndef HAVE_ASM_MMX + for(x=0; x < dst_stride; x++) + { + *(dst++) = ( src[0] + src[1] + 1 ) >> 1; + src += 2; + } +#else + copy_width( src, buffer + (y*width), width ); + + for( x= 0; x < mmxdst_stride; x++ ) + { + down_sample16to8( dst, src ); + src += 16; + dst += 8; + } + for(x=0; x < left; x++) + { + *(dst++) = ( src[0] + src[1] + 1 ) >> 1; + src += 2; + } +#endif + } +} +#ifdef HAVE_ASM_MMX + +static inline void super_sample8to16( uint8_t *in, uint8_t *out ) +{ + //@ super sample by duplicating pixels + __asm__ __volatile__ ( + "\n\tpxor %%mm2,%%mm2" + "\n\tpxor %%mm4,%%mm4" + "\n\tmovq (%0), %%mm1" + "\n\tpunpcklbw %%mm1,%%mm2" + "\n\tpunpckhbw %%mm1,%%mm4" + "\n\tmovq %%mm2,%%mm5" + "\n\tmovq %%mm4,%%mm6" + "\n\tpsrlq $8, %%mm5" + "\n\tpsrlq $8, %%mm6" + "\n\tpor %%mm5,%%mm2" + "\n\tpor %%mm6,%%mm4" + "\n\tmovq %%mm2, (%1)" + "\n\tmovq %%mm4, 8(%1)" + :: "r" (in), "r" (out) + + ); } #endif -static void tr_422_to_444(uint8_t *buffer, int width, int height) +static void tr_422_to_444(void *data, uint8_t *buffer, int width, int height) { - /* YUV 4:2:2 Planar to 4:4:4 Planar */ - - const int stride = width/2; - const int len = stride * height; -#ifdef HAVE_ASM_MMX - const int mmx_stride = stride / 8; -#endif int x,y; + const int stride = width >> 1; + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + +#ifndef HAVE_ASM_MMX for( y = height-1; y > 0 ; y -- ) { uint8_t *dst = buffer + (y * width); uint8_t *src = buffer + (y * stride); -#ifdef HAVE_ASM_MMX - for( x = 0; x < mmx_stride; x ++ ) - { - movq_m2r( *src,mm0 ); - movq_m2r( *src,mm1 ); - movq_r2m(mm0, *dst ); - movq_r2m(mm1, *(dst+8) ); - dst += 16; - src += 8; - } -#else for(x=0; x < stride; x++) // for 1 row { dst[0] = src[x]; //put to dst dst[1] = src[x]; dst+=2; // increment dst } -#endif } +#else + + const int mmx_stride = stride >> 3; + int left = (mmx_stride % 8)-1; + if( left < 0 ) left = 0; + for( y = height-1; y > 0 ; y -- ) + { + uint8_t *src = buffer + (y * stride); + uint8_t *dst = buffer + (y * width); + for(x=0; x < mmx_stride; x++) // for 1 row + { + super_sample8to16(src,dst ); + src += 8; + dst += 16; + } + /* for(x=0; x < left; x++) // for 1 row + { + dst[0] = src[x]; //put to dst + dst[1] = src[x]; + dst+=2; // increment dst + }*/ + } +#endif } + + + /* vertical intersitial siting; horizontal cositing * * Y Y Y Y @@ -939,6 +779,7 @@ static void ss_444_to_420mpeg2(uint8_t *buffer, int width, int height) { uint8_t *in0, *in1, *out; int x, y; + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); in0 = buffer; /* points to */ in1 = buffer + width; /* second of pair of lines */ @@ -962,7 +803,270 @@ static void ss_444_to_420mpeg2(uint8_t *buffer, int width, int height) in1 += width + 1; } } - + +static void subsample_ycbcr_itu601_plane( + uint8_t *plane, + int len, + uint8_t *lookup, + uint8_t *dplane ) +{ + unsigned int n; + for( n = 0 ; n < len; n ++ ) + dplane[n] = lookup[ plane[n] ]; +} + +static void subsample_ycbcr_itu601_chroma_plane( + uint8_t *planeU, + uint8_t *planeV, + int len, + uint8_t *lookup, + uint8_t *dplaneU, + uint8_t *dplaneV ) +{ + unsigned int n; + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + + for( n = 0 ; n < len; n ++ ) + { + dplaneU[n] = lookup[ (planeU[n]) ]; + dplaneV[n] = lookup[ (planeV[n]) ]; + } +} + + + + +#define CLAMP_Y( f) ( f < 16 ? 16: f > 235 ? 235: f ) +#define CLAMP_C( u) ( u < 16 ? 16: u > 240 ? 240: u ) +static void subsample_init_YUV_to_CbCr(void *data) +{ + unsigned int n; + yuv_sampler_t *sampler = (yuv_sampler_t*) data; + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + + for( n = 0; n < 2; n ++ ) + { + sampler->YUV_to_YCbCr[n] = + (uint8_t*) vj_malloc(sizeof(uint8_t) * 256 ); + memset( sampler->YUV_to_YCbCr[n], 0, 256 ); + } + uint8_t *y = sampler->YUV_to_YCbCr[0]; + uint8_t *uv = sampler->YUV_to_YCbCr[1]; + for( n = 0; n < 256; n ++ ) + { + y[n] = CLAMP_Y( (n * 219.0 / 256.0 + 16) ); + uv[n] = CLAMP_C( (n* 224.0 / 256.0 + 16) ); + } + sampler->jyuv = 1; +} + +#ifdef HAVE_ASM_MMX +//! Clamp Y to 16-235 - MMX optimized, 64 bytes at a time. +/*! + \param plane Source + \param dplane Destination + \param len Size + */ +static void subsample_y_clamp_plane( + uint8_t *plane, + uint8_t *dplane, + int len ) +{ + uint8_t mi[8] = { 16,16,16,16, 16,16,16,16 }; + uint8_t ma[8] = { 235,235,235,235, 235,235,235,235}; + const uint8_t *min = &mi[0]; + const uint8_t *max = &ma[0]; + unsigned int k = 0; + unsigned int align = (len/8); + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + + for( k = 0; k < align ; k ++ ) + { + __asm__ __volatile__ ( +#if defined HAVE_ASM_MMX2 || defined HAVE_ASM_SSE + "prefetchnta (%0)\n" + "prefetchnta (%1)\n" + "prefetchnta (%2)\n" +#endif + "movq (%0), %%mm0\n" + "movq (%1), %%mm1\n" //eb + "movq (%2), %%mm2\n" //10 + "pmaxub %%mm0, %%mm2\n" + "pminub %%mm1, %%mm2\n" + "movntq %%mm2, (%3)\n" + :: "r" (plane),"r" (max), "r" (min), "r" (dplane) : "memory"); + + plane += 8; + dplane += 8; + } + if( (align*8) < len) + { + for( k = 8*align; k < len; k ++ ) + *(dplane++) = CLAMP_Y( (*plane++) ); + + } +} +#else +static void subsample_y_clamp_plane( + uint8_t *plane, + uint8_t *dplane, + int len ) +{ + unsigned int n; + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + + for( n = 0 ; n < len; n ++ ) + dplane[n] = CLAMP_Y( plane[n] ); +} +#endif +#ifdef HAVE_ASM_MMX +//! Clamp Chroma planes 16-240, MMX 8 pixel at a time +static void subsample_uv_clamp_plane( + uint8_t *plane_u, + uint8_t *plane_v, + uint8_t *dplane_u, + uint8_t *dplane_v, + int len) +{ + uint8_t mi[8] = { 16,16,16,16, 16,16,16,16 }; + uint8_t ma[8] = { 240,240,240,240, 240,240,240,240 }; + const uint8_t *min = &mi[0]; + const uint8_t *max = &ma[0]; + unsigned int k = 0; + unsigned int align = (len/8); + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + + for( k = 0; k < align ; k ++ ) + { + __asm__ __volatile__ ( +#if defined HAVE_ASM_MMX2 || defined HAVE_ASM_SSE + "prefetchnta (%0)\n" + "prefetchnta (%1)\n" + "prefetchnta (%2)\n" + "prefetchnta (%3)\n" +#endif + "movq (%0), %%mm0\n" + "movq (%1), %%mm1\n" + "movq (%2), %%mm2\n" + "pmaxub %%mm0, %%mm2\n" + "pminub %%mm1, %%mm2\n" + "movntq %%mm2, (%3)\n" + :: "r" (plane_u),"r" (max), "r" (min), "r" (dplane_u) : "memory"); + + plane_u += 8; + dplane_u += 8; + } + + for( k = 0; k < align ; k ++ ) + { + __asm__ __volatile__ ( + "prefetchnta (%0)\n" + "prefetchnta (%1)\n" + "prefetchnta (%2)\n" + "prefetchnta (%3)\n" + "movq (%0), %%mm0\n" + "movq (%1), %%mm1\n" + "movq (%2), %%mm2\n" + "pmaxub %%mm0, %%mm2\n" + "pminub %%mm1, %%mm2\n" + "movntq %%mm2, (%3)\n" + :: "r" (plane_v),"r" (max), "r" (min), "r" (dplane_v) : "memory"); + + plane_v += 8; + dplane_v += 8; + } +} +#else +static void subsample_uv_clamp_plane( + uint8_t *plane_u, + uint8_t *plane_v, + uint8_t *dplane_u, + uint8_t *dplane_v, + int len ) +{ + unsigned int n; + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + + for( n = 0 ; n < len; n ++ ) + { + dplane_u[n] = CLAMP_Y( plane_u[n] ); + dplane_v[n] = CLAMP_C( plane_v[n] ); + } +} +#endif + + +void subsample_ycbcr_itu601(void *data, VJFrame *frame) +{ + yuv_sampler_t *sampler = (yuv_sampler_t*) data; + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + + if(!sampler->jyuv) + subsample_init_YUV_to_CbCr(sampler); + + subsample_ycbcr_itu601_plane( + frame->data[0], + frame->len, + sampler->YUV_to_YCbCr[0], + frame->data[0] ); + subsample_ycbcr_itu601_chroma_plane( + frame->data[1], + frame->data[2], + frame->uv_len, + sampler->YUV_to_YCbCr[1], + frame->data[1], + frame->data[2] ); +} + +void subsample_ycbcr_itu601_copy(void *data, VJFrame *src_frame, VJFrame *dst_frame) +{ + yuv_sampler_t *sampler = (yuv_sampler_t*) data; + + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + + if(!sampler->YUV_to_YCbCr[0]) + subsample_init_YUV_to_CbCr(sampler); + + subsample_ycbcr_itu601_plane( + src_frame->data[0], + src_frame->len, + sampler->YUV_to_YCbCr[0], + dst_frame->data[0] ); + subsample_ycbcr_itu601_chroma_plane( + src_frame->data[1], + src_frame->data[2], + src_frame->uv_len, + sampler->YUV_to_YCbCr[1], + dst_frame->data[1], + dst_frame->data[2] ); +} + +void subsample_ycbcr_clamp_itu601_copy(VJFrame *frame, VJFrame *dst_frame) +{ + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + + subsample_y_clamp_plane( + frame->data[0], + dst_frame->data[0], + frame->len ); + subsample_uv_clamp_plane( + frame->data[1], + frame->data[2], + dst_frame->data[1], + dst_frame->data[2], + frame->uv_len ); +#ifdef HAVE_ASM_MMX + __asm__ __volatile__ ("sfence":::"memory"); + __asm__ __volatile__ ("emms":::"memory"); +#endif +} +void subsample_clear_plane( uint8_t bval, uint8_t *plane, uint32_t plane_len ) +{ + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + + veejay_memset( plane, bval, plane_len ); +} + @@ -970,7 +1074,8 @@ void chroma_subsample_copy(subsample_mode_t mode, void *data, VJFrame *frame, int width, int height, uint8_t *res[]) { yuv_sampler_t *sampler = (yuv_sampler_t*) data; - + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + veejay_memcpy( sampler->planes[1], frame->data[1], frame->uv_len ); veejay_memcpy( sampler->planes[2], frame->data[2], frame->uv_len ); @@ -1006,10 +1111,44 @@ void chroma_subsample_copy(subsample_mode_t mode, void *data, VJFrame *frame, res[1] = sampler->planes[1]; res[2] = sampler->planes[2]; } + + +void chroma_subsample_cp(subsample_mode_t mode, void *data, uint8_t *ycbcr[], uint8_t *dcbcr[], + int width, int height) +{ + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + + switch (mode) { + case SSM_420_JPEG_BOX: + case SSM_420_JPEG_TR: + ss_444_to_420jpeg_cp(ycbcr[1],dcbcr[1], width, height); + ss_444_to_420jpeg_cp(ycbcr[2],dcbcr[2], width, height); + + break; + case SSM_420_MPEG2: + break; + case SSM_422_444: + ss_444_to_422_cp(data,ycbcr[1],dcbcr[1],width,height); + ss_444_to_422_cp(data,ycbcr[2],dcbcr[2],width,height); +#ifdef HAVE_ASM_MMX + __asm__ __volatile__ ( _EMMS:::"memory"); +#endif + break; + case SSM_420_422: + break; + default: + break; + } +} + + + + void chroma_subsample(subsample_mode_t mode, void *data, uint8_t *ycbcr[], int width, int height) { + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); switch (mode) { case SSM_420_JPEG_BOX: @@ -1017,7 +1156,7 @@ void chroma_subsample(subsample_mode_t mode, void *data, uint8_t *ycbcr[], ss_444_to_420jpeg(ycbcr[1], width, height); ss_444_to_420jpeg(ycbcr[2], width, height); #ifdef HAVE_ASM_MMX - emms(); + __asm__ __volatile__ ( _EMMS:::"memory"); #endif break; case SSM_420_MPEG2: @@ -1028,7 +1167,7 @@ void chroma_subsample(subsample_mode_t mode, void *data, uint8_t *ycbcr[], ss_444_to_422(data,ycbcr[1],width,height); ss_444_to_422(data,ycbcr[2],width,height); #ifdef HAVE_ASM_MMX - emms(); + __asm__ __volatile__ ( _EMMS:::"memory"); #endif break; case SSM_420_422: @@ -1044,12 +1183,14 @@ void chroma_subsample(subsample_mode_t mode, void *data, uint8_t *ycbcr[], void chroma_supersample(subsample_mode_t mode,void *data, uint8_t *ycbcr[], int width, int height) { + veejay_msg(0, "%s:%d",__FUNCTION__,__LINE__); + switch (mode) { case SSM_420_JPEG_BOX: - ss_420jpeg_to_444(ycbcr[1], width, height); - ss_420jpeg_to_444(ycbcr[2], width, height); + ss_420jpeg_to_444(ycbcr[1], width, height); + ss_420jpeg_to_444(ycbcr[2], width, height); #ifdef HAVE_ASM_MMX - emms(); + __asm__ __volatile__ ( _EMMS:::"memory"); #endif break; case SSM_420_JPEG_TR: @@ -1057,21 +1198,19 @@ void chroma_supersample(subsample_mode_t mode,void *data, uint8_t *ycbcr[], tr_420jpeg_to_444(data,ycbcr[2], width, height); break; case SSM_422_444: - tr_422_to_444(ycbcr[2],width,height); - tr_422_to_444(ycbcr[1],width,height); + tr_422_to_444(data,ycbcr[2],width,height); + tr_422_to_444(data,ycbcr[1],width,height); #ifdef HAVE_ASM_MMX - emms(); + __asm__ __volatile__ ( _EMMS:::"memory"); #endif break; case SSM_420_422: ss_420_to_422( ycbcr[1], width, height ); ss_420_to_422( ycbcr[2], width, height ); - exit(0); break; case SSM_420_MPEG2: // ss_420mpeg2_to_444(ycbcr[1], width, height); // ss_420mpeg2_to_444(ycbcr[2], width, height); - exit(4); break; default: break; diff --git a/veejay-ng/libyuv/yuvconv.c b/veejay-ng/libyuv/yuvconv.c index 0e534f58..85274b7f 100644 --- a/veejay-ng/libyuv/yuvconv.c +++ b/veejay-ng/libyuv/yuvconv.c @@ -20,15 +20,201 @@ #include #include #include +#include +#include +#ifdef USE_SWSCALER +#include +#endif #include + +#include #include /* this routine is the same as frame_YUV422_to_YUV420P , unpack * libdv's 4:2:2-packed into 4:2:0 planar * See http://mjpeg.sourceforge.net/ (MJPEG Tools) (lav-common.c) */ -/** \defgroup Planar YUV conversion routines - */ +#ifdef STRICT_CHECKING +#include +#endif + + +#ifdef HAVE_ASM_MMX +#undef HAVE_K6_2PLUS +#if !defined( HAVE_ASM_MMX2) && defined( HAVE_ASM_3DNOW ) +#define HAVE_K6_2PLUS +#endif + +#undef _EMMS + +#ifdef HAVE_K6_2PLUS +/* On K6 femms is faster of emms. On K7 femms is directly mapped on emms. */ +#define _EMMS "femms" +#else +#define _EMMS "emms" +#endif + +#endif + + +static int sws_context_flags_ = 0; + +void yuv_init_lib() +{ + sws_context_flags_ = yuv_sws_get_cpu_flags(); +} + +VJFrame *yuv_yuv_template( uint8_t *Y, uint8_t *U, uint8_t *V, int w, int h, int fmt ) +{ + VJFrame *f = (VJFrame*) vj_calloc(sizeof(VJFrame)); + f->format = fmt; + f->data[0] = Y; + f->data[1] = U; + f->data[2] = V; + f->data[3] = NULL; + f->width = w; + f->height = h; + + veejay_msg(0, "%s:%d Y=%p,U=%p,V=%p,w=%d,h=%d,fmt=%d", + __FUNCTION__,__LINE__,Y,U,V,w,h,fmt ); + + switch(fmt) + { + case PIX_FMT_YUV422P: + case PIX_FMT_YUVJ422P: + f->uv_width = w/2; + f->uv_height= f->height; + f->stride[0] = w; + f->stride[1] = f->stride[2] = f->stride[0]/2; + break; + case PIX_FMT_YUV420P: + case PIX_FMT_YUVJ420P: + f->uv_width = w/2; + f->uv_height=f->height/2; + f->stride[0] = w; + f->stride[1] = f->stride[2] = f->stride[0]/2; + break; + case PIX_FMT_YUV444P: + case PIX_FMT_YUVJ444P: + f->uv_width = w; + f->uv_height=f->height; + f->stride[0] = w; + f->stride[1] = f->stride[2] = f->stride[0]; + break; + default: +#ifdef STRICT_CHECKING + assert(0); +#endif + break; + } + + + return f; +} + +VJFrame *yuv_rgb_template( uint8_t *rgb_buffer, int w, int h, int fmt ) +{ +#ifdef STRICT_CHECKING + assert( fmt == PIX_FMT_RGB24 || fmt == PIX_FMT_BGR24 || + fmt == PIX_FMT_RGBA || fmt == PIX_FMT_RGB32_1 || fmt == PIX_FMT_RGB32 || fmt == PIX_FMT_BGR32); + assert( w > 0 ); + assert( h > 0 ); +#endif + VJFrame *f = (VJFrame*) vj_calloc(sizeof(VJFrame)); + f->format = fmt; + f->data[0] = rgb_buffer; + f->data[1] = NULL; + f->data[2] = NULL; + f->data[3] = NULL; + f->width = w; + f->height = h; + + veejay_msg(0, "%s:%d rgb=%p, w=%d,h=%d,fmt=%d",__FUNCTION__,__LINE__,rgb_buffer, w,h ,fmt); + + switch( fmt ) + { + case PIX_FMT_RGB24: + case PIX_FMT_BGR24: + f->stride[0] = w * 3; + break; + default: + f->stride[0] = w * 4; + break; + } + f->stride[1] = 0; + f->stride[2] = 0; + + return f; +} + +#define ru4(num) (((num)+3)&~3) + +void yuv_convert_any( VJFrame *src, VJFrame *dst, int src_fmt, int dst_fmt ) +{ +#ifdef STRICT_CHECKING + assert( dst_fmt >= 0 && dst_fmt < 32 ); + assert( src_fmt == PIX_FMT_YUV420P || src_fmt == PIX_FMT_YUVJ420P || + src_fmt == PIX_FMT_YUV422P || src_fmt == PIX_FMT_YUVJ422P || + src_fmt == PIX_FMT_YUV444P || src_fmt == PIX_FMT_YUVJ444P || + src_fmt == PIX_FMT_RGB24 || src_fmt == PIX_FMT_RGBA || + src_fmt == PIX_FMT_BGR24 || src_fmt == PIX_FMT_RGB32 || + src_fmt == PIX_FMT_BGR32 || src_fmt == PIX_FMT_RGB32_1 ); + assert( src->width > 0 ); + assert( dst->width > 0 ); +#endif + + veejay_msg(0, "%s:%d src_fmt=%d,dst_fmt=%d, src=%dx%d dst=%dx%d", + __FUNCTION__,__LINE__, src_fmt,dst_fmt, src->width,src->height,dst->width,dst->height ); + + struct SwsContext *ctx = sws_getContext( + src->width, + src->height, + src_fmt, + dst->width, + dst->height, + dst_fmt, + sws_context_flags_, + NULL,NULL,NULL ); + + sws_scale( ctx, src->data, src->stride,0, src->height,dst->data, dst->stride ); + + sws_freeContext( ctx ); +} + + +void yuv_convert_any3( VJFrame *src, int src_stride[3], VJFrame *dst, int src_fmt, int dst_fmt ) +{ +#ifdef STRICT_CHECKING + assert( dst_fmt >= 0 && dst_fmt < 32 ); + assert( src_fmt == PIX_FMT_YUV420P || src_fmt == PIX_FMT_YUVJ420P || + src_fmt == PIX_FMT_YUV422P || src_fmt == PIX_FMT_YUVJ422P || + src_fmt == PIX_FMT_YUV444P || src_fmt == PIX_FMT_YUVJ444P || + src_fmt == PIX_FMT_RGB24 || src_fmt == PIX_FMT_RGBA ); + assert( src_stride[0] > 0 ); + assert( dst->width > 0 ); + assert( dst->height > 0 ); + assert( dst->data[0] != NULL ); + assert( dst->data[1] != NULL ); + assert( dst->data[2] != NULL ); +#endif + veejay_msg(0, "%s:%d src_fmt=%d,dst_fmt=%d, src=%dx%d dst=%dx%d", + __FUNCTION__,__LINE__, src_fmt,dst_fmt, src->width,src->height,dst->width,dst->height ); + + + struct SwsContext *ctx = sws_getContext( + src->width, + src->height, + src_fmt, + dst->width, + dst->height, + dst_fmt, + sws_context_flags_, + NULL,NULL,NULL ); + int dst_stride[3] = { ru4(dst->width),ru4(dst->uv_width),ru4(dst->uv_width) }; + sws_scale( ctx, src->data, src_stride, 0, src->height, dst->data, dst_stride); + + sws_freeContext( ctx ); +} /* convert 4:2:0 to yuv 4:2:2 packed */ @@ -37,6 +223,7 @@ void yuv422p_to_yuv422(uint8_t * yuv420[3], uint8_t * dest, int width, { unsigned int x, y; + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); for (y = 0; y < height; ++y) { uint8_t *Y = yuv420[0] + y * width; @@ -61,34 +248,28 @@ void yuv422p_to_yuv422(uint8_t * yuv420[3], uint8_t * dest, int width, void yuv420p_to_yuv422(uint8_t * yuv420[3], uint8_t * dest, int width, int height) { - unsigned int x, y; - uint8_t *Y = yuv420[0]; - uint8_t *Cb = yuv420[1]; - uint8_t *Cr = yuv420[2]; + unsigned int x, y; + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); - for (y = 0; y < height; y++) - { - for (x = 0; x < width; x += 4) - { - *(dest + 0) = Y[0]; - *(dest + 1) = Cb[0]; - *(dest + 2) = Y[1]; - *(dest + 3) = Cr[0]; - *(dest + 4) = Y[2]; - *(dest + 5) = Cb[1]; - *(dest + 6) = Y[3]; - *(dest + 7) = Cr[1]; - - dest += 8; - Y += 4; - Cb += 2; - Cr += 2; - } - } + for (y = 0; y < height; ++y) { + uint8_t *Y = yuv420[0] + y * width; + uint8_t *Cb = yuv420[1] + (y >> 1) * (width >> 1); + uint8_t *Cr = yuv420[2] + (y >> 1) * (width >> 1); + for (x = 0; x < width; x += 2) { + *(dest + 0) = Y[0]; + *(dest + 1) = Cb[0]; + *(dest + 2) = Y[1]; + *(dest + 3) = Cr[0]; + dest += 4; + Y += 2; + ++Cb; + ++Cr; + } + } } -#ifdef HAVE_MMX +#ifdef HAVE_ASM_MMX #include "mmx_macros.h" #include "mmx.h" @@ -118,7 +299,8 @@ void yuv420p_to_yuv422(uint8_t * yuv420[3], uint8_t * dest, int width, static mmx_t mmx_00ffw = { 0x00ff00ff00ff00ffLL }; -#ifdef MMXEXT +#ifdef HAVE_ASM_MMX2 +//#ifdef MMXEXT #define MOVQ_R2M(reg,mem) movntq_r2m(reg, mem) #else #define MOVQ_R2M(reg,mem) movq_r2m(reg, mem) @@ -171,7 +353,20 @@ static mmx_t mmx_00ffw = { 0x00ff00ff00ff00ffLL }; MOVQ_R2M(mm6, *dst_y);\ movd_r2m(mm0, *dst_u);\ movd_r2m(mm1, *dst_v); -/* FIXME: corruption + +#define MMX_YUV422_YUYV " \n\ +movq (%1), %%mm0 # Load 8 Y y7 y6 y5 y4 y3 y2 y1 y0 \n\ +movd (%2), %%mm1 # Load 4 Cb 00 00 00 00 u3 u2 u1 u0 \n\ +movd (%3), %%mm2 # Load 4 Cr 00 00 00 00 v3 v2 v1 v0 \n\ +punpcklbw %%mm2, %%mm1 # v3 u3 v2 u2 v1 u1 v0 u0 \n\ +movq %%mm0, %%mm2 # y7 y6 y5 y4 y3 y2 y1 y0 \n\ +punpcklbw %%mm1, %%mm2 # v1 y3 u1 y2 v0 y1 u0 y0 \n\ +movq %%mm2, (%0) # Store low YUYV \n\ +punpckhbw %%mm1, %%mm0 # v3 y7 u3 y6 v2 y5 u2 y4 \n\ +movq %%mm0, 8(%0) # Store high YUYV \n\ +" + + void yuv422_to_yuyv(uint8_t *src[3], uint8_t *dstI, int w, int h) { int j,jmax,imax,i; @@ -179,25 +374,30 @@ void yuv422_to_yuyv(uint8_t *src[3], uint8_t *dstI, int w, int h) uint8_t *src_y = src[0]; uint8_t *src_u = src[1]; uint8_t *src_v = src[2]; + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); - jmax = w / 8; + jmax = w >> 3; imax = h; - for( i = 0; i < imax ;i ++ ) + for( i = imax; i-- ; ) { - for( j = 0; j < jmax ; j ++ ) + for( j = jmax ; j -- ; ) { - PLANAR_TO_YUY2 + __asm__( ".align 8" MMX_YUV422_YUYV + : : "r" (dst), "r" (src_y), "r" (src_u), + "r" (src_v) ); + dst += 16; src_y += 8; src_u += 4; src_v += 4; } } - - emms(); +#ifdef HAVE_ASM_MMX + __asm__ __volatile__ ( _EMMS:::"memory"); +#endif } -*/ + void yuy2toyv16(uint8_t *dst_y, uint8_t *dst_u, uint8_t *dst_v, uint8_t *srcI, int w, int h ) { @@ -206,6 +406,7 @@ void yuy2toyv16(uint8_t *dst_y, uint8_t *dst_u, uint8_t *dst_v, uint8_t *srcI, i jmax = w / 8; imax = h; + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); for( i = 0; i < imax ;i ++ ) { @@ -218,7 +419,9 @@ void yuy2toyv16(uint8_t *dst_y, uint8_t *dst_u, uint8_t *dst_v, uint8_t *srcI, i dst_v += 4; } } - +#ifdef HAVE_ASM_MMX + __asm__ __volatile__ ( _EMMS:::"memory"); +#endif } void yuy2toyv12(uint8_t * _y, uint8_t * _u, uint8_t * _v, uint8_t * input, @@ -231,6 +434,8 @@ void yuy2toyv12(uint8_t * _y, uint8_t * _u, uint8_t * _v, uint8_t * input, uint8_t *dst_v = _v; jmax = width / 8; imax = height; + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + for( i = 0; i < imax ;i ++ ) { @@ -245,6 +450,9 @@ void yuy2toyv12(uint8_t * _y, uint8_t * _u, uint8_t * _v, uint8_t * input, dst_u += width; dst_v += width; } +#ifdef HAVE_ASM_MMX + __asm__ __volatile__ ( _EMMS:::"memory"); +#endif } #else // non mmx functions @@ -254,6 +462,7 @@ void yuy2toyv12(uint8_t * _y, uint8_t * _u, uint8_t * _v, uint8_t * input, { int i, j, w2; uint8_t *y, *u, *v; + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); w2 = width / 2; @@ -306,6 +515,7 @@ void yuy2toyv16(uint8_t * _y, uint8_t * _u, uint8_t * _v, uint8_t * input, int i, j, w2; uint8_t *y, *u, *v; + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); w2 = width / 2; @@ -326,72 +536,15 @@ void yuy2toyv16(uint8_t * _y, uint8_t * _u, uint8_t * _v, uint8_t * input, } } -//before: -#endif - -#ifdef HAVE_ASM_MMX -void yuv422_to_yuyv(uint8_t *src[3], uint8_t *dstI, int w, int h) -{ - int j,jmax,imax,i; - uint8_t *dst = dstI; - uint8_t *src_y = src[0]; - uint8_t *src_u = src[1]; - uint8_t *src_v = src[2]; - - jmax = w / 8; - imax = h; - - for( i = 0; i < imax ;i ++ ) - { - for( j = 0; j < jmax ; j ++ ) - { - PLANAR_TO_YUY2 - dst += 16; - src_y += 8; - src_u += 4; - src_v += 4; - } - } - - emms(); -} -#endif -/* -void yuv444_to_yuyv(uint8_t *src[3], uint8_t *dstI, int w, int h) -{ - int j,jmax,imax,i; - uint8_t *dst = dstI; - - jmax = w / 8; - imax = h; - - for( i = 0; i < imax ;i ++ ) - { - uint8_t *src_y = src[0] + i * w; - uint8_t *src_u = src[1] + i * w; - uint8_t *src_v = src[2] + i * w; - - for( j = 0; j < jmax ; j ++ ) - { - PLANAR_TO_YUY2 - dst += 16; - src_y += 8; - src_u += 4; src_y += 8; - - src_v += 4; - } - } - - emms(); -} -*/ -#ifndef HAVE_ASM_MMX void yuv422_to_yuyv(uint8_t *yuv422[3], uint8_t *pixels, int w, int h) { int x,y; uint8_t *Y = yuv422[0]; uint8_t *U = yuv422[1]; uint8_t *V = yuv422[2]; // U Y V Y + + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + for(y = 0; y < h; y ++ ) { Y = yuv422[0] + y * w; @@ -414,41 +567,8 @@ void yuv422_to_yuyv(uint8_t *yuv422[3], uint8_t *pixels, int w, int h) } } } + #endif -//after -//#endif - -void yuv444_to_yuyv(void *sampler, uint8_t *data[3], uint8_t *pixels, int w, int h) -{ - int x,y; - chroma_subsample( SSM_422_444, sampler, data, w, h ); - yuv422_to_yuyv( data, pixels, w,h); - - /*for(y = 0; y < h; y ++ ) - { - uint8_t *Y = data[0] + y * w; - uint8_t *U = data[1] + y * w; - uint8_t *V = data[2] + y * w; - - for( x = 0 ; x < w ; x += 4 ) - { - *(pixels + 0) = Y[0]; - *(pixels + 1) = (U[0] + U[1]) >> 1; - *(pixels + 2) = Y[1]; - *(pixels + 3) = (V[0] + V[1]) >> 1; - *(pixels + 4) = Y[2]; - *(pixels + 5) = (U[2] + U[3]) >> 1; - *(pixels + 6) = Y[3]; - *(pixels + 7) = (V[2] + V[3]) >> 1; - pixels += 8; - Y+=4; - U+=2; - V+=2; - } - }*/ -} - - /* lav_common - some general utility functionality used by multiple @@ -499,12 +619,253 @@ int luminance_mean(uint8_t * frame[], int w, int h) return sum / count; } +typedef struct +{ + struct SwsContext *sws; + SwsFilter *src_filter; + SwsFilter *dst_filter; +} vj_sws; + +void* yuv_init_swscaler(VJFrame *src, VJFrame *dst, sws_template *tmpl, int cpu_flags) +{ + vj_sws *s = (vj_sws*) vj_malloc(sizeof(vj_sws)); + if(!s) + return NULL; + + int sws_type = 0; + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + + veejay_memset( s, 0, sizeof(vj_sws) ); + + switch(tmpl->flags) + { + case 1: + sws_type = SWS_FAST_BILINEAR; + break; + case 2: + sws_type = SWS_BILINEAR; + break; + case 3: + sws_type = SWS_BICUBIC; + break; + case 4: + sws_type = SWS_POINT; + break; + case 5: + sws_type = SWS_X; + break; + case 6: + sws_type = SWS_AREA; + break; + case 7: + sws_type = SWS_BICUBLIN; + break; + case 8: + sws_type = SWS_GAUSS; + break; + case 9: + sws_type = SWS_SINC; + break; + case 10: + sws_type = SWS_LANCZOS; + break; + case 11: + sws_type = SWS_SPLINE; + break; + } + + s->sws = sws_getContext( + src->width, + src->height, + src->format, + dst->width, + dst->height, + dst->format, + sws_type | cpu_flags, + s->src_filter, + s->dst_filter, + NULL + ); + + if(!s->sws) + { + if(s)free(s); + return NULL; + } + + return ((void*)s); + +} + +void yuv_crop(VJFrame *src, VJFrame *dst, VJRectangle *rect ) +{ + int x; + int y; + uint8_t *sy = src->data[0]; + uint8_t *su = src->data[1]; + uint8_t *sv = src->data[2]; + + uint8_t *dstY = dst->data[0]; + uint8_t *dstU = dst->data[1]; + uint8_t *dstV = dst->data[2]; + int i = 0; + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + + for( i = 0 ; i < 3 ; i ++ ) + { + int j = 0; + uint8_t *srcPlane = src->data[i]; + uint8_t *dstPlane = dst->data[i]; + for( y = rect->top ; y < ( src->height - rect->bottom ); y ++ ) + { + for ( x = rect->left ; x < ( src->width - rect->right ); x ++ ) + { + dstPlane[j] = srcPlane[ y * src->width + x ]; + j++; + } + } + } + +} + +VJFrame *yuv_allocate_crop_image( VJFrame *src, VJRectangle *rect ) +{ + int w = src->width - rect->left - rect->right; + int h = src->height - rect->top - rect->bottom; + + if( w <= 0 ) + return NULL; + if( h <= 0 ) + return NULL; + + VJFrame *new = (VJFrame*) vj_malloc(sizeof(VJFrame)); + if(!new) + return NULL; + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + + new->width = w; + new->height = h; + new->uv_len = (w >> src->shift_h) * (h >> src->shift_v ); + new->len = w * h; + new->uv_width = (w >> src->shift_h ); + new->uv_height = (h >> src->shift_v ); + new->shift_v = src->shift_v; + new->shift_h = src->shift_h; + + return new; +} + + +void yuv_free_swscaler(void *sws) +{ + if(sws) + { + vj_sws *s = (vj_sws*) sws; + if(s->sws) + sws_freeContext( s->sws ); + if(s) free(s); + } +} + +void yuv_convert_and_scale_gray_rgb(void *sws,VJFrame *src, VJFrame *dst) +{ + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + + vj_sws *s = (vj_sws*) sws; + int src_stride[3] = { src->width,0,0 }; + int dst_stride[3] = { src->width * 3, 0,0 }; + + sws_scale( s->sws, src->data,src_stride, 0,src->height, + dst->data, dst_stride ); +} + + +void yuv_convert_and_scale_rgb(void *sws , VJFrame *src, VJFrame *dst) +{ + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + + vj_sws *s = (vj_sws*) sws; + int src_stride[3] = { src->width,src->uv_width,src->uv_width }; + int dst_stride[3] = { dst->width*3,0,0 }; + + sws_scale( s->sws, src->data, src_stride, 0, src->height, + dst->data, dst_stride ); +//#ifdef HAVE_ASM_MMX + // __asm__ __volatile__ ( _EMMS:::"memory"); +//#endif +} +void yuv_convert_and_scale(void *sws , VJFrame *src, VJFrame *dst) +{ + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + + vj_sws *s = (vj_sws*) sws; + int src_stride[3] = { src->width,src->uv_width,src->uv_width }; + int dst_stride[3] = { dst->width,dst->uv_width,dst->uv_width }; + + sws_scale( s->sws, src->data, src_stride, 0, src->height, + dst->data, dst_stride ); +//#ifdef HAVE_ASM_MMX + // __asm__ __volatile__ ( _EMMS:::"memory"); +//#endif +} + +int yuv_sws_get_cpu_flags(void) +{ + int cpu_flags = 0; + return 0; +#ifdef HAVE_ASM_MMX + cpu_flags = cpu_flags | SWS_CPU_CAPS_MMX; +#endif +#ifdef HAVE_ASM_3DNOW + cpu_flags = cpu_flags | SWS_CPU_CAPS_3DNOW; +#endif +#ifdef HAVE_ASM_MMX2 + cpu_flags = cpu_flags | SWS_CPU_CAPS_MMX2; +#endif +#ifdef HAVE_ALTIVEC + cpu_flags = cpu_flags | SWS_CPU_CAPS_ALTIVEC; +#endif + + cpu_flags = cpu_flags | SWS_FULL_CHR_H_INT; + + cpu_flags = cpu_flags | SWS_FULL_CHR_H_INP; + + return cpu_flags; +} + +void yuv_deinterlace( + uint8_t *data[3], + const int width, + const int height, + int out_pix_fmt, + int shift, + uint8_t *Y,uint8_t *U, uint8_t *V ) +{ + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + + AVPicture p,q; + p.data[0] = data[0]; + p.data[1] = data[1]; + p.data[2] = data[2]; + p.linesize[0] = width; + p.linesize[1] = width >> shift; + p.linesize[2] = width >> shift; + q.data[0] = Y; + q.data[1] = U; + q.data[2] = V; + q.linesize[0] = width; + q.linesize[1] = width >> shift; + q.linesize[2] = width >> shift; + avpicture_deinterlace( &p,&q, out_pix_fmt, width, height ); +} //! YUV 4:2:0 Planar to 4:4:4 Packed: Y, V, U, Y,V, U , .... */ static void yuv420_444_1plane( VJFrame *frame, uint8_t *dst_buffer) { + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + unsigned int x,y; const unsigned int width = frame->uv_width; const unsigned int height = frame->uv_height; @@ -579,6 +940,38 @@ static void yuv420_444_1plane( */ } +void yuv444_to_yuyv(void *sampler, uint8_t *data[3], uint8_t *pixels, int w, int h) +{ + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + + int x,y; + chroma_subsample( SSM_422_444, sampler, data, w, h ); + yuv422_to_yuyv( data, pixels, w,h); + + /*for(y = 0; y < h; y ++ ) + { + uint8_t *Y = data[0] + y * w; + uint8_t *U = data[1] + y * w; + uint8_t *V = data[2] + y * w; + + for( x = 0 ; x < w ; x += 4 ) + { + *(pixels + 0) = Y[0]; + *(pixels + 1) = (U[0] + U[1]) >> 1; + *(pixels + 2) = Y[1]; + *(pixels + 3) = (V[0] + V[1]) >> 1; + *(pixels + 4) = Y[2]; + *(pixels + 5) = (U[2] + U[3]) >> 1; + *(pixels + 6) = Y[3]; + *(pixels + 7) = (V[2] + V[3]) >> 1; + pixels += 8; + Y+=4; + U+=2; + V+=2; + } + }*/ +} + //! YUV 4:2:2 Planar to 4:4:4 Packed: Y, V, U, Y,V, U , .... */ // // @@ -625,6 +1018,8 @@ static void yuv422_444_1plane( VJFrame *frame, uint8_t *dst_buffer) { + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + unsigned int x,y; const unsigned int stride = frame->uv_width; const unsigned int height = frame->height; @@ -657,21 +1052,23 @@ static void yuv444_444_1plane( VJFrame *frame, uint8_t *dst_buffer) { + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + /* YUV 4:2:2 Planar to 4:4:4 Packed: Y, V, U */ unsigned int x; uint8_t *yp = frame->data[0]; uint8_t *up = frame->data[2]; uint8_t *vp = frame->data[1]; int len = frame->len / 4; - int *dst = dst_buffer; -/* uint8_t *dst = dst_buffer; +// int *dst = dst_buffer; + uint8_t *dst = dst_buffer; for( x = 0 ; x < frame->len ; x ++ ) { *(dst++) = *(yp++); *(dst++) = *(vp++); *(dst++) = *(up++); - }*/ - __builtin_prefetch( yp, 0 ,3); + } +/* __builtin_prefetch( yp, 0 ,3); __builtin_prefetch( up, 0 ,3); __builtin_prefetch( vp, 0 ,3); __builtin_prefetch( dst, 1,3); @@ -686,7 +1083,7 @@ static void yuv444_444_1plane( up += 4; vp += 4; dst += 3; - } + } */ } @@ -694,6 +1091,8 @@ static void yuv444a_444a_1plane( VJFrame *frame, uint8_t *dst_buffer) { + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + #ifdef HAVE_ASM_MMX int len = frame->len / 8; const uint8_t *y = frame->data[0]; @@ -723,33 +1122,17 @@ static void yuv444a_444a_1plane( } #endif } - - -void yuv_planar_to_packed_444yvu( VJFrame *frame, uint8_t *dst_buffer ) -{ - switch(frame->format) - { - case FMT_420: - yuv420_444_1plane(frame,dst_buffer); - break; - case FMT_422: - yuv422_444_1plane(frame,dst_buffer); - break; - case FMT_444: - yuv444_444_1plane(frame,dst_buffer); - break; - } -} - static void yuv_planar_copy( VJFrame *dst, const uint8_t *plane, int len, int uv_len ) { - memcpy(dst->data[0], + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + + veejay_memcpy(dst->data[0], plane, len ); - memcpy(dst->data[1], + veejay_memcpy(dst->data[1], plane + len, uv_len ); - memcpy(dst->data[2], + veejay_memcpy(dst->data[2], plane + len + uv_len, uv_len ); } @@ -758,7 +1141,8 @@ static void yuv_planar_grow( VJFrame *dst, subsample_mode_t mode, void *data, in { int w = dst->width; int h = dst->height; - + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + switch(fmt) { case FMT_420: @@ -780,7 +1164,8 @@ static void yuv_planar_shrink( VJFrame *dst, subsample_mode_t mode, void *data, { int w = dst->width; int h = dst->height; - + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + switch(fmt) { case FMT_422: @@ -799,22 +1184,26 @@ static void yuv_planar_shrink( VJFrame *dst, subsample_mode_t mode, void *data, ); } - void yuv_420_1plane_to_planar(VJFrame *dst, const uint8_t *plane, void *sampler) { + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + switch(dst->format) { case FMT_420: yuv_planar_copy( dst, plane,dst->len,dst->uv_len); break; case FMT_422: - yuv420p_to_yuv422p( + /*yuv420p_to_yuv422p( plane, plane+dst->len, plane+dst->len+(dst->len/4), dst->data, dst->width, - dst->height); + dst->height); */ +#ifdef STRICT_CHECKING + assert(0); +#endif break; case FMT_444: yuv_planar_grow( dst, SSM_420_JPEG_BOX, sampler, FMT_420, plane ); @@ -823,11 +1212,17 @@ void yuv_420_1plane_to_planar(VJFrame *dst, const uint8_t *plane, void *sampler) } void yuv_422_1plane_to_planar(VJFrame *dst, const uint8_t *plane, void *sampler) { + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + + switch(dst->format) { case FMT_420: - yuv422p_to_yuv420p3( plane, dst->data, - dst->width, dst->height ); +#ifdef STRICT_CHECKING + assert(0); +#endif + // yuv422p_to_yuv420p3( plane, dst->data, + // dst->width, dst->height ); break; case FMT_422: yuv_planar_copy(dst, plane,dst->len,dst->uv_len); @@ -838,25 +1233,11 @@ void yuv_422_1plane_to_planar(VJFrame *dst, const uint8_t *plane, void *sampler) } } -void yuv_444_1plane_to_planar(VJFrame *dst,const uint8_t *plane, void *sampler) -{ - switch(dst->format) - { - case FMT_420: - yuv_planar_shrink( dst, SSM_420_JPEG_BOX, sampler, FMT_444, plane ); - break; - case FMT_422: - yuv_planar_shrink( dst, SSM_422_444, sampler, FMT_444, plane ); - break; - case FMT_444: - yuv_planar_copy(dst,plane, dst->len,dst->uv_len); - break; - } -} - -//! void yuv_1plane_to_planar( int fmt, uint8_t *plane, VJFrame *dst, void *sampler ) { + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + + switch(fmt) { case FMT_420: @@ -875,6 +1256,9 @@ void yuv_1plane_to_planar( int fmt, uint8_t *plane, VJFrame *dst, void *sampler /* void yuv_1plane_blend_alpha_channel( uint8_t *A, uint8_t *B, int alpha int slen ) { + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + + const uint8_t *a = A; const uint8_t *b = B; const uint8_t *alpha = Alpha; @@ -931,6 +1315,9 @@ void yuv_1plane_blend_alpha_channel( uint8_t *A, uint8_t *B, int alpha int slen //! Fade A->B , P = (A * o1) + (B * (255-o1)) / 255. MMX optimized static void yuv_1plane_blend_opacity( uint8_t *A, uint8_t *B,uint8_t alpha, int Alen ) { + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + + unsigned int k; const unsigned int len = Alen; const uint8_t op0 = alpha; @@ -974,25 +1361,56 @@ static void yuv_1plane_blend_opacity( uint8_t *A, uint8_t *B,uint8_t alpha, int void yuv_blend_opacity( VJFrame *A, VJFrame *B, uint8_t alpha ) { + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + + yuv_1plane_blend_opacity( A->data[0], B->data[0], alpha, A->len ); yuv_1plane_blend_opacity( A->data[1], B->data[1], alpha, A->uv_len ); yuv_1plane_blend_opacity( A->data[2], B->data[2], alpha, A->uv_len ); } -void yuv_deinterlace( VJFrame *A, uint8_t *Y,uint8_t *U, uint8_t *V ) +void yuv_444_1plane_to_planar(VJFrame *dst,const uint8_t *plane, void *sampler) { - AVPicture p,q; - p.data[0] = A->data[0]; - p.data[1] = A->data[1]; - p.data[2] = A->data[2]; - p.linesize[0] = A->width; - p.linesize[1] = A->uv_width; - p.linesize[2] = A->uv_width; - q.data[0] = Y; - q.data[1] = U; - q.data[2] = V; - q.linesize[0] = A->width; - q.linesize[1] = A->uv_width; - q.linesize[2] = A->uv_width; - avpicture_deinterlace( &p,&q, A->pixfmt, A->width,A->height ); + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + + + switch(dst->format) + { + case FMT_420: + yuv_planar_shrink( dst, SSM_420_JPEG_BOX, sampler, FMT_444, plane ); + break; + case FMT_422: + yuv_planar_shrink( dst, SSM_422_444, sampler, FMT_444, plane ); + break; + case FMT_444: + yuv_planar_copy(dst,plane, dst->len,dst->uv_len); + break; + } } + + + + +void yuv_planar_to_packed_444yvu( VJFrame *frame, uint8_t *dst_buffer ) +{ + veejay_msg(0, "%s:%d",__FUNCTION__, __LINE__ ); + + + switch(frame->format) + { + case FMT_420: + case FMT_420F: + yuv420_444_1plane(frame,dst_buffer); + break; + case FMT_422: + case FMT_422F: + yuv422_444_1plane(frame,dst_buffer); + break; + case FMT_444: + case FMT_444F: + yuv444_444_1plane(frame,dst_buffer); + break; + } +} + + diff --git a/veejay-ng/libyuv/yuvconv.h b/veejay-ng/libyuv/yuvconv.h index 1557b369..7caa2dbc 100644 --- a/veejay-ng/libyuv/yuvconv.h +++ b/veejay-ng/libyuv/yuvconv.h @@ -26,14 +26,13 @@ */ #include - typedef enum subsample_mode { SSM_UNKNOWN = 0, SSM_420_JPEG_TR = 1, SSM_420_JPEG_BOX = 2, SSM_420_MPEG2 = 3, SSM_422_444 = 4, - SSM_420_422 = 5, + SSM_420_422 = 5, SSM_444 = 6, SSM_COUNT = 7, } subsample_mode_t; @@ -44,12 +43,11 @@ extern const char *ssm_description[SSM_COUNT]; void *subsample_init(int buf_len); void subsample_free(void *sampler); -void subsample_clear_plane( uint8_t bval, uint8_t *plane, uint32_t plane_len ); -void subsample_ycbcr_clamp_itu601(VJFrame *frame); -void subsample_ycbcr_itu601(void *data, VJFrame *frame); void chroma_subsample(subsample_mode_t mode, void *sampler, uint8_t * ycbcr[], int width, int height); +void chroma_subsample_cp(subsample_mode_t mode, void *data, uint8_t *ycbcr[], uint8_t *dcbcr[], + int width, int height); void chroma_supersample(subsample_mode_t mode, void *sampler, uint8_t * ycbcr[], int width, int height); @@ -85,19 +83,75 @@ typedef struct int use_filter; } sws_template; +void yuv_init_lib(); + void* yuv_init_swscaler(VJFrame *src, VJFrame *dst, sws_template *templ, int cpu_flags); void yuv_convert_and_scale( void *sws, VJFrame *src, VJFrame *dst ); void yuv_convert_and_scale_rgb( void *sws, VJFrame *src, VJFrame *dst ); -void yuv_deinterlace( VJFrame *A, uint8_t *Y,uint8_t *U, uint8_t *V ); +void yuv_convert_and_scale_gray_rgb(void *sws,VJFrame *src, VJFrame *dst); int yuv_sws_get_cpu_flags(void); void yuv_free_swscaler(void *sws); +void yuv_crop(VJFrame *src, VJFrame *dst, VJRectangle *rect ); + +VJFrame *yuv_allocate_crop_image( VJFrame *src, VJRectangle *rect ); + +void yuv_deinterlace( + uint8_t *data[3], + const int width, + const int height, + int out_pix_fmt, + int shift, + uint8_t *Y,uint8_t *U, uint8_t *V ); + + +void yuv_init_lib(); + +void yuv_free_lib(); + +void yuv_convert_any( VJFrame *src, VJFrame *dst, int a, int b ); + +void yuv_convert_any3( VJFrame *src,int strides[], VJFrame *dst, int a, int b ); + + +void chroma_subsample_copy(subsample_mode_t mode, void *data, VJFrame *frame, + int width, int height, uint8_t *res[]); + +void subsample_clear_plane( uint8_t bval, uint8_t *plane, uint32_t plane_len ); + +void subsample_ycbcr_clamp_itu601_copy(VJFrame *frame, VJFrame *dst_frame); + +void subsample_ycbcr_itu601_copy(void *data, VJFrame *src_frame, VJFrame *dst_frame); + +void subsample_ycbcr_itu601(void *data, VJFrame *frame); + +void *subsample_init_copy(int w, int h); + void yuv_planar_to_packed_444yvu( VJFrame *frame, uint8_t *dst_buffer ); void yuv_blend_opacity( VJFrame *A, VJFrame *B, uint8_t alpha ); + +void yuv_1plane_to_planar( int fmt, uint8_t *plane, VJFrame *dst, void *sampler ); + +void yuv_444_1plane_to_planar(VJFrame *dst,const uint8_t *plane, void *sampler); + +void yuv_422_1plane_to_planar(VJFrame *dst, const uint8_t *plane, void *sampler); + +void yuv_420_1plane_to_planar(VJFrame *dst, const uint8_t *plane, void *sampler); + +void yuv_planar_to_packed_444yvu( VJFrame *frame, uint8_t *dst_buffer ); + +void yuv444_to_yuyv(void *sampler, uint8_t *data[3], uint8_t *pixels, int w, int h); + + +VJFrame *yuv_rgb_template( uint8_t *rgb_buffer, int w, int h, int fmt ); + +VJFrame *yuv_yuv_template( uint8_t *Y, uint8_t *U, uint8_t *V, int w, int h, int fmt ); + + #endif diff --git a/veejay-ng/ltmain.sh b/veejay-ng/ltmain.sh index 1a224ac2..c715b594 100644 --- a/veejay-ng/ltmain.sh +++ b/veejay-ng/ltmain.sh @@ -1,7 +1,7 @@ # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # @@ -17,7 +17,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -43,9 +43,14 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.6 -TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42) Debian$Rev: 224 $" +VERSION="1.5.22 Debian 1.5.22-4" +TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes. +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi # Check that we have a working $echo. if test "X$1" = X--no-reexec; then @@ -83,14 +88,15 @@ rm="rm -f" Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' # test EBCDIC or ASCII -case `echo A|tr A '\301'` in - A) # EBCDIC based system - SP2NL="tr '\100' '\n'" - NL2SP="tr '\r\n' '\100\100'" +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + SP2NL='tr \040 \012' + NL2SP='tr \015\012 \040\040' ;; - *) # Assume ASCII based system - SP2NL="tr '\040' '\012'" - NL2SP="tr '\015\012' '\040\040'" + *) # EBCDIC based system + SP2NL='tr \100 \n' + NL2SP='tr \r\n \100\100' ;; esac @@ -107,8 +113,9 @@ if test "${LANG+set}" = set; then fi # Make sure IFS has a sensible default -: ${IFS=" -"} +lt_nl=' +' +IFS=" $lt_nl" if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then $echo "$modename: not configured to build any kind of library" 1>&2 @@ -125,6 +132,8 @@ run= show="$echo" show_help= execute_dlfiles= +duplicate_deps=no +preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" @@ -132,13 +141,51 @@ o2lo="s/\\.${objext}\$/.lo/" # Shell function definitions: # This seems to be the best place for them +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $mkdir "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || { + $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 + exit $EXIT_FAILURE + } + fi + + $echo "X$my_tmpdir" | $Xsed +} + + # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. -func_win32_libid () { +func_win32_libid () +{ win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in @@ -149,12 +196,11 @@ func_win32_libid () { if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ - sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` - if test "X$win32_nmres" = "Ximport" ; then - win32_libid_type="x86 archive import" - else - win32_libid_type="x86 archive static" - fi + $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac fi ;; *DLL*) @@ -178,7 +224,8 @@ func_win32_libid () { # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' -func_infer_tag () { +func_infer_tag () +{ if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do @@ -235,12 +282,116 @@ func_infer_tag () { esac fi } + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE + fi +} + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + my_status="" + + $show "${rm}r $my_gentop" + $run ${rm}r "$my_gentop" + $show "$mkdir $my_gentop" + $run $mkdir "$my_gentop" + my_status=$? + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then + exit $my_status + fi + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` + my_xdir="$my_gentop/$my_xlib" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then + exit $exit_status + fi + case $host in + *-darwin*) + $show "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + if test -z "$run"; then + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` + if test -n "$darwin_arches"; then + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + $show "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + lipo -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + ${rm}r unfat-$$ + cd "$darwin_orig_dir" + else + cd "$darwin_orig_dir" + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + fi # $run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + func_extract_archives_result="$my_oldobjs" +} # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" +disable_libs=no + # Parse our command line options once, thoroughly. while test "$#" -gt 0 do @@ -305,10 +456,10 @@ do --version) $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo - $echo "Copyright (C) 2003 Free Software Foundation, Inc." + $echo "Copyright (C) 2005 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit $EXIT_SUCCESS + exit $? ;; --config) @@ -317,7 +468,7 @@ do for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done - exit $EXIT_SUCCESS + exit $? ;; --debug) @@ -342,7 +493,7 @@ do else $echo "disable static libraries" fi - exit $EXIT_SUCCESS + exit $? ;; --finish) mode="finish" ;; @@ -357,7 +508,11 @@ do preserve_args="$preserve_args $arg" ;; - --tag) prevopt="--tag" prev=tag ;; + --tag) + prevopt="--tag" + prev=tag + preserve_args="$preserve_args --tag" + ;; --tag=*) set tag "$optarg" ${1+"$@"} shift @@ -389,6 +544,18 @@ if test -n "$prevopt"; then exit $EXIT_FAILURE fi +case $disable_libs in +no) + ;; +shared) + build_libtool_libs=no + build_old_libs=yes + ;; +static) + build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` + ;; +esac + # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. @@ -399,7 +566,7 @@ if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 - $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 + $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link @@ -465,7 +632,7 @@ if test -z "$show_help"; then for arg do - case "$arg_mode" in + case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" @@ -547,7 +714,10 @@ if test -z "$show_help"; then case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. + # in scan sets, and some SunOS ksh mistreat backslash-escaping + # in scan sets (worked around with variable expansion), + # and furthermore cannot handle '|' '&' '(' ')' in scan sets + # at all, so we specify them separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; @@ -621,6 +791,14 @@ if test -z "$show_help"; then esac done + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qlibobj="\"$qlibobj\"" ;; + esac + test "X$libobj" != "X$qlibobj" \ + && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then @@ -693,12 +871,17 @@ compiler." $run $rm $removelist exit $EXIT_FAILURE fi - $echo $srcfile > "$lockfile" + $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qsrcfile="\"$qsrcfile\"" ;; + esac $run $rm "$libobj" "${libobj}T" @@ -720,18 +903,18 @@ EOF fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then - command="$base_compile $srcfile $pic_flag" + command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code - command="$base_compile $srcfile" + command="$base_compile $qsrcfile" fi if test ! -d "${xdir}$objdir"; then $show "$mkdir ${xdir}$objdir" $run $mkdir ${xdir}$objdir - status=$? - if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then - exit $status + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then + exit $exit_status fi fi @@ -803,9 +986,9 @@ EOF if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code - command="$base_compile $srcfile" + command="$base_compile $qsrcfile" else - command="$base_compile $srcfile $pic_flag" + command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" @@ -934,6 +1117,7 @@ EOF no_install=no objs= non_pic_objects= + notinst_path= # paths that contain not-installed libtool libraries precious_files_regex= prefer_static_libs=no preload=no @@ -962,14 +1146,15 @@ EOF if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi + prefer_static_libs=yes else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi + prefer_static_libs=built fi build_libtool_libs=no build_old_libs=yes - prefer_static_libs=yes break ;; esac @@ -1144,6 +1329,11 @@ EOF if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. @@ -1227,6 +1417,13 @@ EOF prev= continue ;; + darwin_framework|darwin_framework_skip) + test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + prev= + continue + ;; *) eval "$prev=\"\$arg\"" prev= @@ -1285,6 +1482,18 @@ EOF continue ;; + -framework|-arch|-isysroot) + case " $CC " in + *" ${arg} ${1} "* | *" ${arg} ${1} "*) + prev=darwin_framework_skip ;; + *) compiler_flags="$compiler_flags $arg" + prev=darwin_framework ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + -inst-prefix-dir) prev=inst_prefix continue @@ -1311,7 +1520,8 @@ EOF absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit $EXIT_FAILURE + absdir="$dir" + notinst_path="$notinst_path $dir" fi dir="$absdir" ;; @@ -1325,10 +1535,15 @@ EOF esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac ;; esac continue @@ -1337,15 +1552,15 @@ EOF -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in - *-*-cygwin* | *-*-pw32* | *-*-beos*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; - *-*-mingw* | *-*-os2*) + *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; - *-*-openbsd* | *-*-freebsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; @@ -1353,10 +1568,19 @@ EOF # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; esac elif test "X$arg" = "X-lc_r"; then case $host in - *-*-openbsd* | *-*-freebsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; @@ -1366,8 +1590,20 @@ EOF continue ;; + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + -model) + compile_command="$compile_command $arg" + compiler_flags="$compiler_flags $arg" + finalize_command="$finalize_command $arg" + prev=xcompiler + continue + ;; + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - deplibs="$deplibs $arg" + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" continue ;; @@ -1376,13 +1612,19 @@ EOF continue ;; - # gcc -m* arguments should be passed to the linker via $compiler_flags - # in order to pass architecture information to the linker - # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo - # but this is not reliable with gcc because gcc may use -mfoo to - # select a different linker, different libraries, etc, while - # -Wl,-mfoo simply passes -mfoo to the linker. - -m*) + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m* pass through architecture-specific compiler args for GCC + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -pg pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ + -t[45]*|-txscale*|@*) + # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` @@ -1393,9 +1635,7 @@ EOF esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" - if test "$with_gcc" = "yes" ; then - compiler_flags="$compiler_flags $arg" - fi + compiler_flags="$compiler_flags $arg" continue ;; @@ -1633,6 +1873,11 @@ EOF if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. @@ -1738,9 +1983,9 @@ EOF if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir - status=$? - if test "$status" -ne 0 && test ! -d "$output_objdir"; then - exit $status + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then + exit $exit_status fi fi @@ -1803,7 +2048,6 @@ EOF newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv link" @@ -1858,7 +2102,7 @@ EOF compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else - deplibs="$deplib $deplibs" + compiler_flags="$compiler_flags $deplib" fi continue ;; @@ -1977,7 +2221,22 @@ EOF fi case $linkmode in lib) - if test "$deplibs_check_method" != pass_all; then + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + if eval $echo \"$deplib\" 2>/dev/null \ + | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" @@ -2027,7 +2286,7 @@ EOF esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else - $echo "$modename: cannot find the library \`$lib'" 1>&2 + $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 exit $EXIT_FAILURE fi @@ -2051,6 +2310,8 @@ EOF # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no + avoidtemprpath= + # Read the .la file case $lib in @@ -2149,11 +2410,19 @@ EOF dir="$libdir" absdir="$libdir" fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` @@ -2226,12 +2495,12 @@ EOF if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path - if test -n "$shlibpath_var"; then + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; + *) temp_rpath="$temp_rpath $absdir" ;; esac fi @@ -2268,8 +2537,12 @@ EOF fi link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes ; then + use_static_libs=no + fi if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + { test "$use_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes @@ -2382,11 +2655,15 @@ EOF if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in - *-*-sco3.2v5* ) add_dir="-L$dir" ;; + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added - if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then + if /usr/bin/file -L $add 2> /dev/null | + $EGREP ": [^:]* bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo @@ -2417,7 +2694,7 @@ EOF add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then - case "$libdir" in + case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; @@ -2490,7 +2767,7 @@ EOF add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then - case "$libdir" in + case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; @@ -2551,8 +2828,6 @@ EOF fi fi else - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi @@ -2670,12 +2945,12 @@ EOF *) continue ;; esac case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$depdepl $deplibs" ;; + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; esac case " $deplibs " in - *" $path "*) ;; - *) deplibs="$deplibs $path" ;; + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no @@ -2947,7 +3222,7 @@ EOF case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -2956,7 +3231,7 @@ EOF case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -2965,7 +3240,7 @@ EOF case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -2991,7 +3266,7 @@ EOF versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) @@ -3144,9 +3419,9 @@ EOF # Eliminate all temporary directories. for path in $notinst_path; do - lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` + lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` + deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` done if test -n "$xrpath"; then @@ -3197,9 +3472,14 @@ EOF *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; - *-*-openbsd* | *-*-freebsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. @@ -3243,11 +3523,11 @@ EOF int main() { return 0; } EOF $rm conftest - $LTCC -o conftest conftest.c $deplibs + $LTCC $LTCFLAGS -o conftest conftest.c $deplibs if test "$?" -eq 0 ; then ldd_output=`ldd conftest` for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" + name=`expr $i : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test "$name" != "" && test "$name" -ne "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then @@ -3284,11 +3564,11 @@ EOF # Error occurred in the first compile. Let's try to salvage # the situation: Compile a separate program for each library. for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" + name=`expr $i : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test "$name" != "" && test "$name" != "0"; then $rm conftest - $LTCC -o conftest conftest.c $i + $LTCC $LTCFLAGS -o conftest conftest.c $i # Did it work? if test "$?" -eq 0 ; then ldd_output=`ldd conftest` @@ -3336,7 +3616,7 @@ EOF set dummy $deplibs_check_method file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do - name="`expr $a_deplib : '-l\(.*\)'`" + name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test "$name" != "" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then @@ -3405,7 +3685,7 @@ EOF set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do - name="`expr $a_deplib : '-l\(.*\)'`" + name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then @@ -3535,6 +3815,35 @@ EOF deplibs=$newdeplibs fi + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + # All the library-specific variables (install_libdir is set above). library_names= old_library= @@ -3618,6 +3927,7 @@ EOF fi lib="$output_objdir/$realname" + linknames= for link do linknames="$linknames $link" @@ -3646,6 +3956,9 @@ EOF # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break fi done IFS="$save_ifs" @@ -3679,67 +3992,13 @@ EOF eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" fi fi - + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" @@ -3769,7 +4028,8 @@ EOF fi fi - if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && + if test "X$skipped_export" != "X:" && + len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else @@ -3788,6 +4048,7 @@ EOF save_libobjs=$libobjs fi save_output=$output + output_la=`$echo "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. @@ -3797,13 +4058,13 @@ EOF delfiles= last_robj= k=1 - output=$output_objdir/$save_output-${k}.$objext + output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || - { len=`expr "X$test_cmds" : ".*"` && + { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else @@ -3817,9 +4078,9 @@ EOF # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi - last_robj=$output_objdir/$save_output-${k}.$objext + last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` - output=$output_objdir/$save_output-${k}.$objext + output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi @@ -3839,13 +4100,13 @@ EOF eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi - # Set up a command to remove the reloadale object files + # Set up a command to remove the reloadable object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" + delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" @@ -3893,13 +4154,30 @@ EOF IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" - $run eval "$cmd" || exit $? + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + fi + fi + exit $EXIT_SUCCESS fi @@ -3977,64 +4255,10 @@ EOF eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi @@ -4135,6 +4359,35 @@ EOF ;; esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" @@ -4179,10 +4432,15 @@ EOF fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac ;; esac done @@ -4296,13 +4554,25 @@ extern \"C\" { # Prepare the list of exported symbols if test -z "$export_symbols"; then - export_symbols="$output_objdir/$output.exp" + export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols - $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac else - $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' - $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac fi fi @@ -4353,7 +4623,26 @@ extern \"C\" { #endif /* The mapping between symbol names and symbols. */ +" + + case $host in + *cygwin* | *mingw* ) + $echo >> "$output_objdir/$dlsyms" "\ +/* DATA imports from DLLs on WIN32 can't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs */ +struct { +" + ;; + * ) + $echo >> "$output_objdir/$dlsyms" "\ const struct { +" + ;; + esac + + + $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } @@ -4400,16 +4689,29 @@ static const void *lt_preloaded_setup() { esac # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + case $host in + *cygwin* | *mingw* ) + if test -f "$output_objdir/${outputname}.def" ; then + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + else + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + fi + ;; + * ) + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + esac ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 @@ -4434,7 +4736,7 @@ static const void *lt_preloaded_setup() { # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" - status=$? + exit_status=$? # Delete the generated files. if test -n "$dlsyms"; then @@ -4442,7 +4744,7 @@ static const void *lt_preloaded_setup() { $run $rm "$output_objdir/${outputname}S.${objext}" fi - exit $status + exit $exit_status fi if test -n "$shlibpath_var"; then @@ -4582,10 +4884,12 @@ static const void *lt_preloaded_setup() { esac case $host in *cygwin* | *mingw* ) - cwrappersource=`$echo ${objdir}/lt-${output}.c` - cwrapper=`$echo ${output}.exe` - $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + output_name=`basename $output` + output_path=`dirname $output` + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource < #include #include +#include +#include +#include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX @@ -4620,15 +4927,19 @@ EOF #endif #ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '/' +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) -#define HAVE_DOS_BASED_FILE_SYSTEM -#ifndef DIR_SEPARATOR_2 -#define DIR_SEPARATOR_2 '\\' -#endif +# define HAVE_DOS_BASED_FILE_SYSTEM +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif #endif #ifndef DIR_SEPARATOR_2 @@ -4638,17 +4949,32 @@ EOF (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) +/* -DDEBUG is fairly common in CFLAGS. */ +#undef DEBUG +#if defined DEBUGWRAPPER +# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) +#else +# define DEBUG(format, ...) +#endif + const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); -char * basename (const char *name); -char * fnqualify(const char *path); +const char * base_name (const char *name); +char * find_executable(const char *wrapper); +int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); @@ -4658,29 +4984,51 @@ main (int argc, char *argv[]) char **newargz; int i; - program_name = (char *) xstrdup ((char *) basename (argv[0])); + program_name = (char *) xstrdup (base_name (argv[0])); + DEBUG("(main) argv[0] : %s\n",argv[0]); + DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF - cat >> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" - newargz[1] = fnqualify(argv[0]); + cat >> $cwrappersource <<"EOF" + newargz[1] = find_executable(argv[0]); + if (newargz[1] == NULL) + lt_fatal("Couldn't find %s", argv[0]); + DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; + + for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" + cat >> $cwrappersource <<"EOF" + return 127; } void * @@ -4700,48 +5048,148 @@ xstrdup (const char *string) ; } -char * -basename (const char *name) +const char * +base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha (name[0]) && name[1] == ':') + if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; - return (char *) base; + return base; } -char * -fnqualify(const char *path) +int +check_executable(const char * path) { - size_t size; - char *p; - char tmp[LT_PATHMAX + 1]; + struct stat st; - assert(path != NULL); + DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); + if ((!path) || (!*path)) + return 0; - /* Is it qualified already? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha (path[0]) && path[1] == ':') - return xstrdup (path); + if ((stat (path, &st) >= 0) && + ( + /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ +#if defined (S_IXOTH) + ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif - if (IS_DIR_SEPARATOR (path[0])) - return xstrdup (path); +#if defined (S_IXGRP) + ((st.st_mode & S_IXGRP) == S_IXGRP) || +#endif + ((st.st_mode & S_IXUSR) == S_IXUSR)) + ) + return 1; + else + return 0; +} - /* prepend the current directory */ - /* doesn't handle '~' */ +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise */ +char * +find_executable (const char* wrapper) +{ + int has_slash = 0; + const char* p; + const char* p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char* concat_name; + + DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char* path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char* q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR(*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); - size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ - p = XMALLOC(char, size); - sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); - return p; + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + return NULL; } char * @@ -4785,16 +5233,16 @@ lt_fatal (const char *message, ...) va_end (ap); } EOF - # we should really use a build-platform specific compiler - # here, but OTOH, the wrappers (shell script and this C one) - # are only useful if you want to execute the "real" binary. - # Since the "real" binary is built for $host, then this - # wrapper might as well be built for $host, too. - $run $LTCC -s -o $cwrapper $cwrappersource - ;; - esac - $rm $output - trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource + ;; + esac + $rm $output + trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL @@ -4815,7 +5263,7 @@ sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" @@ -4944,13 +5392,13 @@ else # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ - exec \$progdir\\\\\$program \${1+\"\$@\"} + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} + exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac @@ -4960,7 +5408,7 @@ else fi else # The program doesn't exist. - \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE @@ -4992,71 +5440,73 @@ fi\ if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - # Add in members from convenience archives. - for xlib in $addlibs; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$gentop"; then + exit $exit_status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && @@ -5070,20 +5520,7 @@ fi\ objlist= concat_cmds= save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi + # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do @@ -5094,7 +5531,7 @@ fi\ oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" - if len=`expr "X$test_cmds" : ".*"` && + if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; then : else @@ -5291,11 +5728,11 @@ relink_command=\"$relink_command\"" # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. - $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then + $echo "X$nonopt" | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac @@ -5304,14 +5741,14 @@ relink_command=\"$relink_command\"" shift else install_prog= - arg="$nonopt" + arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac @@ -5329,28 +5766,31 @@ relink_command=\"$relink_command\"" do if test -n "$dest"; then files="$files $dest" - dest="$arg" + dest=$arg continue fi case $arg in -d) isdir=yes ;; - -f) prev="-f" ;; - -g) prev="-g" ;; - -m) prev="-m" ;; - -o) prev="-o" ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; - -*) ;; - + -*) + ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else - dest="$arg" + dest=$arg continue fi ;; @@ -5359,7 +5799,7 @@ relink_command=\"$relink_command\"" # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac @@ -5528,11 +5968,14 @@ relink_command=\"$relink_command\"" if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. for linkname do if test "$linkname" != "$realname"; then - $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" fi done fi @@ -5545,7 +5988,16 @@ relink_command=\"$relink_command\"" IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" - $run eval "$cmd" || exit $? + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } done IFS="$save_ifs" fi @@ -5639,17 +6091,15 @@ relink_command=\"$relink_command\"" notinst_deplibs= relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # # If there is no directory component, then add one. - case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; esac # Check the variables that should have been set. @@ -5677,34 +6127,21 @@ relink_command=\"$relink_command\"" done relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # # If there is no directory component, then add one. - case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then - tmpdir="/tmp" - test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" - save_umask=`umask` - umask 0077 - if $mkdir "$tmpdir"; then - umask $save_umask - else - umask $save_umask - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue - fi + tmpdir=`func_mktempdir` file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. @@ -5728,7 +6165,7 @@ relink_command=\"$relink_command\"" fi # remove .exe since cygwin /usr/bin/install will append another - # one anyways + # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in @@ -5828,7 +6265,7 @@ relink_command=\"$relink_command\"" # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS - $echo "----------------------------------------------------------------------" + $echo "X----------------------------------------------------------------------" | $Xsed $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" @@ -5861,7 +6298,7 @@ relink_command=\"$relink_command\"" $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." - $echo "----------------------------------------------------------------------" + $echo "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS ;; @@ -6078,9 +6515,17 @@ relink_command=\"$relink_command\"" rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - if test "$mode" = uninstall; then + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds @@ -6113,7 +6558,8 @@ relink_command=\"$relink_command\"" IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. - fi + ;; + esac fi ;; @@ -6398,7 +6844,7 @@ esac $echo $echo "Try \`$modename --help' for more information about other modes." -exit $EXIT_SUCCESS +exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting @@ -6412,12 +6858,11 @@ exit $EXIT_SUCCESS # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes +disable_libs=shared # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` +disable_libs=static # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: diff --git a/veejay-ng/missing b/veejay-ng/missing index 09edd884..e7ef83a1 100755 --- a/veejay-ng/missing +++ b/veejay-ng/missing @@ -1,9 +1,9 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2005-02-08.22 +scriptversion=2003-09-02.23 -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. @@ -60,6 +60,11 @@ case "$1" in msg="probably too old" fi ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in -h|--h|--he|--hel|--help) echo "\ @@ -87,12 +92,10 @@ Supported PROGRAM values: yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." - exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" - exit $? ;; -*) @@ -101,42 +104,12 @@ Send bug reports to ." exit 1 ;; -esac - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). -case "$1" in - lex|yacc) - # Not GNU programs, they don't have --version. - ;; - - tar) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - - *) + aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 fi - ;; -esac -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want @@ -146,6 +119,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the @@ -155,6 +133,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want @@ -174,6 +157,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. @@ -185,6 +173,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the @@ -261,6 +254,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the @@ -281,6 +279,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file @@ -288,20 +291,20 @@ WARNING: \`$1' is $msg. You should only need it if call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error diff --git a/veejay-ng/pluginpack/lvd_globalmotionsensor.c b/veejay-ng/pluginpack/lvd_globalmotionsensor.c index 8ba4d538..7259c43d 100644 --- a/veejay-ng/pluginpack/lvd_globalmotionsensor.c +++ b/veejay-ng/pluginpack/lvd_globalmotionsensor.c @@ -35,6 +35,9 @@ typedef struct } bg_t; +#define ru8(num)(((num)+8)&~8) + + livido_init_f init_instance( livido_port_t *my_instance ) { int w=0; @@ -44,11 +47,11 @@ livido_init_f init_instance( livido_port_t *my_instance ) bg_t *b = (bg_t*) livido_malloc( sizeof( bg_t )); livido_memset( b,0,sizeof(bg_t)); - b->tmpy = (uint8_t*) livido_malloc(sizeof(uint8_t) * w * h ); - b->tmpu = (uint8_t*) livido_malloc(sizeof(uint8_t) * w * h ); + b->tmpy = (uint8_t*) livido_malloc(sizeof(uint8_t) * ru8( w * h )); + b->tmpu = (uint8_t*) livido_malloc(sizeof(uint8_t) * ru8( w * h )); - b->axis_x = (unsigned int*) livido_malloc(sizeof(unsigned int) * w ); - b->axis_y = (unsigned int*) livido_malloc(sizeof(unsigned int) * h ); + b->axis_x = (unsigned int*) livido_malloc(sizeof(unsigned int) * ru8(w) ); + b->axis_y = (unsigned int*) livido_malloc(sizeof(unsigned int) * ru8(h) ); int error = livido_property_set( my_instance, "PLUGIN_private", LIVIDO_ATOM_TYPE_VOIDPTR, 1, &b ); @@ -88,6 +91,108 @@ static int _max(unsigned int *arr, int n) return k; } +static int binarify( uint8_t *dst, uint8_t *bg, uint8_t *src,int threshold,int reverse, const int len ) +{ + int i; + int act = 0; + if(!reverse) + { + for( i = 0; i < len; i ++ ) + { + if ( abs(bg[i] - src[i]) <= threshold ) + dst[i] = 0; + else + { dst[i] = 0xff; act ++ ; } + } + + } + else + { + for( i = 0; i < len; i ++ ) + { + if ( abs(bg[i] - src[i]) >= threshold ) + dst[i] = 0; + else + { dst[i] = 0xff; act ++;} + + } + } + return act; +} + +/* mmx_blur() taken from libvisual plugins + * + * Libvisual-plugins - Standard plugins for libvisual + * + * Copyright (C) 2002, 2003, 2004, 2005 Dennis Smit + * + * Authors: Dennis Smit + */ + +static void mmx_blur(uint8_t *buffer, int width, int height) +{ + __asm __volatile + ("\n\t pxor %%mm6, %%mm6" + ::); + + int scrsh = height / 2; + int i; + int len = width * height; + uint8_t *buf = buffer; + /* Prepare substraction register */ + for (i = 0; i < scrsh; i += 4) { + __asm __volatile + ("\n\t movd %[buf], %%mm0" + "\n\t movd %[add1], %%mm1" + "\n\t punpcklbw %%mm6, %%mm0" + "\n\t movd %[add2], %%mm2" + "\n\t punpcklbw %%mm6, %%mm1" + "\n\t movd %[add3], %%mm3" + "\n\t punpcklbw %%mm6, %%mm2" + "\n\t paddw %%mm1, %%mm0" + "\n\t punpcklbw %%mm6, %%mm3" + "\n\t paddw %%mm2, %%mm0" + "\n\t paddw %%mm3, %%mm0" + "\n\t psrlw $2, %%mm0" + "\n\t packuswb %%mm6, %%mm0" + "\n\t movd %%mm0, %[buf]" + :: [buf] "m" (*(buf + i)) + , [add1] "m" (*(buf + i + width)) + , [add2] "m" (*(buf + i + width + 1)) + , [add3] "m" (*(buf + i + width - 1)) + ); + // : "mm0", "mm1", "mm2", "mm3", "mm6"); + } + + for (i = len - 4; i > scrsh; i -= 4) { + __asm __volatile + ("\n\t movd %[buf], %%mm0" + "\n\t movd %[add1], %%mm1" + "\n\t punpcklbw %%mm6, %%mm0" + "\n\t movd %[add2], %%mm2" + "\n\t punpcklbw %%mm6, %%mm1" + "\n\t movd %[add3], %%mm3" + "\n\t punpcklbw %%mm6, %%mm2" + "\n\t paddw %%mm1, %%mm0" + "\n\t punpcklbw %%mm6, %%mm3" + "\n\t paddw %%mm2, %%mm0" + "\n\t paddw %%mm3, %%mm0" + "\n\t psrlw $2, %%mm0" + "\n\t packuswb %%mm6, %%mm0" + "\n\t movd %%mm0, %[buf]" + :: [buf] "m" (*(buf + i)) + , [add1] "m" (*(buf + i - width)) + , [add2] "m" (*(buf + i - width + 1)) + , [add3] "m" (*(buf + i - width - 1)) + );// : "mm0", "mm1", "mm2", "mm3", "mm6"); + } + + __asm__ __volatile__ ( "emms":::"memory"); + +} + + + static inline double calc( double n, double ip, double x) { double res = x; @@ -148,6 +253,10 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode my_instance, "in_parameters", 2 ); + + int reverse = lvd_extract_param_boolean( + my_instance, "in_parameters", 3 ); + const int threshold = (const int)(255.0 * thres); const int wac = (const int)(100.0 * wacf); @@ -159,6 +268,7 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode if( !b->empty ) { livido_memcpy( b->tmpy, A[0], len ); + mmx_blur( b->tmpy, wid,hei ); b->empty=1; return LIVIDO_NO_ERROR; } @@ -168,6 +278,14 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode uint8_t *diff = b->tmpu; unsigned int activity = 0; //@ construct difference + // + // + mmx_blur( A[0], wid, hei ); + + activity = binarify( diff, prev, A[0], threshold, reverse, len ); + + livido_memcpy( prev, A[0], len ); +/* for( i = 0; i < len ; i ++ ) { uint8_t a = A[0][i]; @@ -177,7 +295,7 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode diff[i] = 0; b->tmpy[i] = a; O[0][i] = diff[i]; - } + }*/ unsigned int *ax_x = b->axis_x; unsigned int *ax_y = b->axis_y; @@ -244,7 +362,7 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode norm[2] = ( 1.0 / (double) max_ta ) * (double) da; norm[3] = ( 1.0 / (double) max_tb ) * (double) db; -// printf(" Measure {%g\t%g\t%g\t%g} %d\n", norm[0],norm[1],norm[2],norm[3], b->h); + printf(" Measure {%g\t%g\t%g\t%g} %d\n", norm[0],norm[1],norm[2],norm[3], b->h); b->ip[0] = calc( norm[0], b->ip[0], b->lx ); b->ip[1] = calc( norm[1], b->ip[1], b->ly ); @@ -261,8 +379,8 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode values[1] = b->ly; values[2] = b->wx; values[3] = b->wy; -// printf(" Set: {%g\t%g\t%g\t%g} | {%g\t%g\t%g\t%g}\n", values[0],values[1],values[2],values[3], -// b->ip[0],b->ip[1],b->ip[2],b->ip[3] ); + printf(" Set: {%g\t%g\t%g\t%g} | {%g\t%g\t%g\t%g}\n", values[0],values[1],values[2],values[3], + b->ip[0],b->ip[1],b->ip[2],b->ip[3] ); lvd_set_param_number(my_instance, "out_parameters",0,b->ip[0] ); lvd_set_param_number(my_instance, "out_parameters",1,1.0 - b->ip[1] ); @@ -364,6 +482,15 @@ livido_port_t *livido_setup(livido_setup_t list[], int version) livido_set_double_value( port, "default", 0.2 ); livido_set_string_value( port, "description" ,"Multiply activity"); + in_params[3] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[3]; + + livido_set_string_value(port, "name", "Invert" ); + livido_set_string_value(port, "kind", "SWITCH" ); + livido_set_int_value( port, "default", 0 ); + + livido_set_string_value( port, "description" ,"Invert mask"); + int i; int np = 0; @@ -395,7 +522,7 @@ livido_port_t *livido_setup(livido_setup_t list[], int version) livido_set_int_value( port, "flags", 0); livido_set_portptr_array( filter, "in_channel_templates", 1 , in_chans ); - livido_set_portptr_array( filter, "in_parameter_templates",3, in_params ); + livido_set_portptr_array( filter, "in_parameter_templates",4, in_params ); livido_set_portptr_array( filter, "out_parameter_templates",np, out_params ); livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); diff --git a/veejay-ng/veejay/Makefile.am b/veejay-ng/veejay/Makefile.am index e9b8220d..16bc13bf 100644 --- a/veejay-ng/veejay/Makefile.am +++ b/veejay-ng/veejay/Makefile.am @@ -17,7 +17,9 @@ INCLUDES = -I$(top_srcdir) -I$(includedir) \ -I$(top_srcdir)/liblavjpeg \ -I$(top_srcdir)/libsamplerec \ -I$(top_srcdir)/libvevo \ - $(FFMPEG_CFLAGS)\ + $(FFMPEG_AVCODEC_CFLAGS)\ + $(FFMPEG_AVFORMAT_CFLAGS)\ + $(FFMMPEG_SWSCALER_CFLAGS)\ ${XML_CFLAGS} ${DV_FLAGS} ${X_CFLAGS} ${XML_CPPFLAGS} ${LIBQUICKTIME_CFLAGS} \ ${PTHREAD_CFLAGS} ${MJPEGTOOLS_CFLAGS} ${GL_CFLAGS} ${SDL_CFLAGS} ${LIBLO_CFLAGS} @@ -52,14 +54,6 @@ libveejayng_la_LIBADD = -L$(top_builddir)/libhash / -lhash \ -L$(top_builddir)/libvjaudio -lvjaudio \ -L$(top_builddir)/vevosample -lvevosample -#libveejay_la_LDFLAGS += ${FFMPEG_LIBS} \ -# ${SDL_LIBS} ${DIRECTFB_LIBS} ${PTHREAD_LIBS} \ -# ${XML_LIBS} ${JPEG_LIBS} ${JACK_LIBS} \ -# ${LIBDV_LIBS} ${LIBM_LIBS} ${PIXBUF_LIBS} ${MJPEGTOOLS_LIBS}\ -# -DDYNAMIC -O3 -Wall -rdynamic -# - - # ********************************************************************* # The tools themselves VEEJAY_BIN = veejayng @@ -67,6 +61,6 @@ VEEJAY_BIN = veejayng bin_PROGRAMS = $(VEEJAY_BIN) veejayng_SOURCES = veejay.c -veejayng_LDADD = libveejayng.la @LIBGETOPT_LIB@ ${FFMPEG_AVCODEC_LIBS} ${FFMPEG_AVFORMAT_LIBS} \ +veejayng_LDADD = libveejayng.la @LIBGETOPT_LIB@ ${FFMPEG_AVCODEC_LIBS} ${FFMPEG_AVFORMAT_LIBS} ${FFMPEG_SWSCALER_LIBS} \ ${PTHREAD_LIBS} ${XML_LIBS} ${LIBDV_LIBS} ${GL_LIBS} ${LIBQUICKTIME_LIBS} \ ${MJPEGTOOLS_LIBS} ${UNICAP_LIBS} ${LIBM_LIBS} ${SDL_LIBS} ${LIBLO_LIBS} diff --git a/veejay-ng/veejay/defs.h b/veejay-ng/veejay/defs.h index 2441ac21..60c26b84 100644 --- a/veejay-ng/veejay/defs.h +++ b/veejay-ng/veejay/defs.h @@ -32,6 +32,7 @@ typedef struct VJFrame_t int width; int height; int sampling; + int stride[4]; double timecode; double fps; } VJFrame; @@ -46,6 +47,15 @@ typedef struct AFrame_t int num_chans; } AFrame; +typedef struct VJRectangle_t +{ + int top; + int bottom; + int left; + int right; +} VJRectangle; + + #define FMT_420 0 #define FMT_422 1 #define FMT_444 2 diff --git a/veejay-ng/veejay/gl.c b/veejay-ng/veejay/gl.c index 4efcb5e0..9878b4f8 100644 --- a/veejay-ng/veejay/gl.c +++ b/veejay-ng/veejay/gl.c @@ -978,12 +978,8 @@ void x_display_push(void *dctx, VJFrame *frame ) if(!ctx->prog) { - util_convertrgba24( frame->data, - frame->width, - frame->height, - PIX_FMT_YUV444P, - 0, - ctx->data ); + veejay_msg(0, "No hardware YUV conversion available"); + return; } else { diff --git a/veejay-ng/veejay/performer.c b/veejay-ng/veejay/performer.c index b68d9466..87643c1c 100644 --- a/veejay-ng/veejay/performer.c +++ b/veejay-ng/veejay/performer.c @@ -113,9 +113,13 @@ static VJFrame *performer_alloc_frame( veejay_t *info, uint8_t *p0, uint8_t *p1, sample_video_info_t *svit = (sample_video_info_t*) info->video_info; VJFrame *f = (VJFrame*) vj_malloc(sizeof(VJFrame)); memset( f,0, sizeof( VJFrame )); + + veejay_msg(0, "%s:%d : %dx%d, fmt=%d",__FUNCTION__,__LINE__,svit->w,svit->h, svit->fmt ); + switch(svit->fmt) { case FMT_420: + case FMT_420F: f->uv_width = svit->w / 2; f->uv_height = svit->h / 2; f->shift_h = 1; @@ -123,6 +127,7 @@ static VJFrame *performer_alloc_frame( veejay_t *info, uint8_t *p0, uint8_t *p1, f->pixfmt = PIX_FMT_YUV420P; break; case FMT_422: + case FMT_422F: f->uv_width = svit->w/2; f->uv_height = svit->h; f->shift_h = 0; @@ -130,6 +135,7 @@ static VJFrame *performer_alloc_frame( veejay_t *info, uint8_t *p0, uint8_t *p1, f->pixfmt = PIX_FMT_YUV422P; break; case FMT_444: + case FMT_444F: f->uv_width = svit->w; f->uv_height = svit->h; f->pixfmt = PIX_FMT_YUV444P; @@ -153,11 +159,11 @@ static VJFrame *performer_alloc_frame( veejay_t *info, uint8_t *p0, uint8_t *p1, f->data[1] = p1; f->data[2] = p2; f->data[3] = p3; - +/* #ifdef STRICT_CHECKING assert( performer_verify_frame( f) ); #endif - +*/ return f; } @@ -929,23 +935,12 @@ static int performer_verify_frame( VJFrame *f ) int fy = 0; long avg = 0; int avg_; - for( i = u; i < un; i ++ ) - { - if( f->data[1][i] < 16 ) - fu ++; - if( f->data[2][i] < 16 ) - fu ++; - } - for( i = y; i < yn; i ++ ) - { - if( f->data[0][i] < 16) - { fy ++; avg += f->data[0][i]; avg_ ++; } - } - if( fu > 0 || fy > 0 ) - { - veejay_msg(0, "Last line fail count: %d,%d, Y average = %d", fu,fy, ( avg > 0 ? avg / avg_ :0 )); - return 0; - } + + veejay_msg(0, "%s:%d, frame %p , len=%d,uv_len=%d, w=%d,h=%d, uw=%d, uh=%d fmt=%d", + __FUNCTION__,__LINE__, f, f->len,f->uv_len,f->width,f->height, + f->uv_width,f->uv_height, f->format ); + + return 1; } #endif diff --git a/veejay-ng/vevosample/vevosample.c b/veejay-ng/vevosample/vevosample.c index b2004907..3fc0f845 100644 --- a/veejay-ng/vevosample/vevosample.c +++ b/veejay-ng/vevosample/vevosample.c @@ -2397,8 +2397,16 @@ int sample_get_frame( void *current_sample , void *dslot ) vj_el_get_video_frame ( srd->data, frame_num,slot); break; case VJ_TAG_TYPE_CAPTURE: - vj_unicap_grab_frame( srd->data, (void*) slot ); - + if( vj_unicap_status( srd->data )) + { + if(!vj_unicap_grab_frame( srd->data, slot, slot->width,slot->height)) + { + vj_unicap_stop_capture( srd->data ); + } + } + else { + vj_unicap_start_capture( srd->data ); + } break; case VJ_TAG_TYPE_NET: break; @@ -3720,6 +3728,7 @@ int sample_apply_bind( void *sample, void *current_entry, int k_entry ) char *output_pval = vevo_sprintf_property_value( slot->out_values, pkey ); sprintf(output_pname, "o%02d", bpt->p[BIND_OUT_P]); + if(bpt->kind == HOST_PARAM_INDEX) { if( vevo_property_get( slot->out_values, pkey,0,&value ) == VEVO_NO_ERROR ) @@ -3740,6 +3749,7 @@ int sample_apply_bind( void *sample, void *current_entry, int k_entry ) { double norm = (1.0 / (bpt->max[0] - bpt->min[0])) * value; double gv = (bpt->max[1] - bpt->min[1]) * norm + bpt->min[1]; + plug_set_parameter( dst_slot->fx_instance, bpt->p[BIND_IN_P], 1, &gv ); if(path && sender) @@ -3772,10 +3782,6 @@ int sample_apply_bind( void *sample, void *current_entry, int k_entry ) if(output_pval) free(output_pval); } - else - { - veejay_msg(0, "Kind is not compatible: %d", bpt->kind ); - } } free( items[i] ); diff --git a/veejay-ng/vevosample/vj-unicap.c b/veejay-ng/vevosample/vj-unicap.c index f6a66404..905f9c01 100644 --- a/veejay-ng/vevosample/vj-unicap.c +++ b/veejay-ng/vevosample/vj-unicap.c @@ -29,6 +29,8 @@ #include #include #include +#include +#include #ifdef STRICT_CHECKING #include #endif @@ -40,13 +42,20 @@ typedef struct unicap_format_t format_spec; unicap_format_t format; unicap_data_buffer_t buffer; - unicap_data_buffer_t *returned_buffer; - int deviceID; - int sizes[3]; - int active; - int deinterlace; - int rgb; - void *sampler; + unicap_data_buffer_t *buf; + pthread_mutex_t mutex; + pthread_t thread; + uint8_t *priv_buf; + int state; + int sizes[3]; + int active; + int deinterlace; + int rgb; + int width; + int pixfmt; + int shift; + int height; + void *sampler; } vj_unicap_t; @@ -62,6 +71,22 @@ typedef struct int num_devices; } unicap_driver_t; +#define BUFFERS 2 + +static void *unicap_reader_thread(void *data); +static void lock_(vj_unicap_t *t) +{ + pthread_mutex_lock( &(t->mutex )); +} + +static void unlock_(vj_unicap_t *t) +{ + pthread_mutex_unlock( &(t->mutex )); +} + + + + static int vj_unicap_scan_enumerate_devices(void *unicap) { int i; @@ -70,25 +95,8 @@ static int vj_unicap_scan_enumerate_devices(void *unicap) for( i = 0; SUCCESS( unicap_enumerate_devices( NULL, &(ud->device), i ) ); i++ ) { - unicap_property_t property; - unicap_format_t format; - int property_count = 0; - int format_count = 0; int j; - - if( !SUCCESS( unicap_open( &(ud->handle), &(ud->device) ) ) ) - { - veejay_msg(0, "Failed to open: %s\n", &(ud->device.identifier) ); - continue; - } - unicap_lock_properties( ud->handle ); - - - - unicap_reenumerate_properties( ud->handle, &property_count ); - unicap_reenumerate_formats( ud->handle, &format_count ); char *device_name = strdup( ud->device.identifier ); - void *device_port = vpn( VEVO_ANONYMOUS_PORT ); char *device_location = strdup( ud->device.device ); @@ -124,9 +132,6 @@ static int vj_unicap_scan_enumerate_devices(void *unicap) #ifdef STRICT_CHECKING assert( error == VEVO_NO_ERROR ); #endif - unicap_unlock_properties( ud->handle ); - - unicap_close( ud->handle ); } return i; } @@ -203,8 +208,6 @@ void vj_unicap_pack_menu( void *ud, char *key , void *osc, void *msg ) unicap_void_property( &property_spec ); unicap_void_property( &property ); vj_unicap_t *vut = (vj_unicap_t*) ud; - unicap_lock_properties( vut->handle ); - for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle, &property_spec, &property, i ) ); i ++ ) { @@ -220,7 +223,6 @@ void vj_unicap_pack_menu( void *ud, char *key , void *osc, void *msg ) } } } - unicap_unlock_properties( vut->handle); } int vj_unicap_property_is_menu( void *ud, char *key ) @@ -231,7 +233,6 @@ int vj_unicap_property_is_menu( void *ud, char *key ) unicap_void_property( &property_spec ); unicap_void_property( &property ); vj_unicap_t *vut = (vj_unicap_t*) ud; - unicap_lock_properties( vut->handle ); for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle, &property_spec, &property, i ) ); i ++ ) @@ -239,14 +240,12 @@ int vj_unicap_property_is_menu( void *ud, char *key ) unicap_get_property( vut->handle, &property); if( strcmp( property.identifier, key ) == 0 ) { - unicap_unlock_properties( vut->handle); if( property.type == UNICAP_PROPERTY_TYPE_MENU ) return 1; else return 0; } } - unicap_unlock_properties( vut->handle); return 0; } int vj_unicap_property_is_range( void *ud, char *key ) @@ -257,7 +256,6 @@ int vj_unicap_property_is_range( void *ud, char *key ) unicap_void_property( &property_spec ); unicap_void_property( &property ); vj_unicap_t *vut = (vj_unicap_t*) ud; - unicap_lock_properties( vut->handle ); for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle, &property_spec, &property, i ) ); i ++ ) @@ -265,14 +263,12 @@ int vj_unicap_property_is_range( void *ud, char *key ) unicap_get_property( vut->handle, &property); if( strcmp( property.identifier, key ) == 0 ) { - unicap_unlock_properties( vut->handle); if( property.type == UNICAP_PROPERTY_TYPE_RANGE ) return 1; else return 0; } } - unicap_unlock_properties( vut->handle); return 0; } @@ -285,7 +281,6 @@ int vj_unicap_select_value( void *ud, char *key, int atom_type, void *val ) unicap_void_property( &property ); vj_unicap_t *vut = (vj_unicap_t*) ud; // memset( &property,0 ,sizeof( unicap_property_t)); - unicap_lock_properties( vut->handle ); for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle, &property_spec, &property, i ) ); i ++ ) @@ -314,7 +309,6 @@ int vj_unicap_select_value( void *ud, char *key, int atom_type, void *val ) veejay_msg(0,"changed menu item %d to %s", idx, property.menu_item ); - unicap_unlock_properties( vut->handle ); return 1; } @@ -331,13 +325,11 @@ int vj_unicap_select_value( void *ud, char *key, int atom_type, void *val ) property.value = (double) *((double*) val); unicap_set_property( vut->handle, &property ); veejay_msg(0, "Changed range value to %f", property.value ); - unicap_unlock_properties( vut->handle ); return 1; } } } - unicap_unlock_properties( vut->handle ); return 0; } @@ -350,7 +342,6 @@ int vj_unicap_get_range( void *ud, char *key, double *min , double *max ) unicap_void_property( &property_spec ); unicap_void_property( &property ); vj_unicap_t *vut = (vj_unicap_t*) ud; - unicap_lock_properties( vut->handle ); for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle, &property_spec, &property, i ) ); i ++ ) @@ -365,7 +356,6 @@ int vj_unicap_get_range( void *ud, char *key, double *min , double *max ) { *min = 0.0; *max = (double) property.menu.menu_item_count; - unicap_unlock_properties( vut->handle ); return 1; } @@ -373,13 +363,11 @@ int vj_unicap_get_range( void *ud, char *key, double *min , double *max ) { *min = property.range.min; *max = property.range.max; - unicap_unlock_properties( vut->handle ); return 1; } } } - unicap_unlock_properties( vut->handle ); return 0; } @@ -391,7 +379,6 @@ char **vj_unicap_get_list( void *ud ) int i; unicap_void_property( &property_spec ); vj_unicap_t *vut = (vj_unicap_t*) ud; - unicap_lock_properties( vut->handle ); for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle, &property_spec, &property, i ) ); i ++ ) @@ -412,7 +399,6 @@ char **vj_unicap_get_list( void *ud ) } } - unicap_unlock_properties( vut->handle ); return res; } @@ -425,7 +411,6 @@ int vj_unicap_get_value( void *ud, char *key, int atom_type, void *value ) int i; unicap_void_property( &property_spec ); vj_unicap_t *vut = (vj_unicap_t*) ud; - unicap_lock_properties( vut->handle ); for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle, &property_spec, &property, i ) ); i ++ ) @@ -448,7 +433,6 @@ int vj_unicap_get_value( void *ud, char *key, int atom_type, void *value ) { double *dval = value; *dval = (double) j; - unicap_unlock_properties( vut->handle ); return 1; } @@ -461,12 +445,10 @@ int vj_unicap_get_value( void *ud, char *key, int atom_type, void *value ) #endif double *dval = value; *dval = property.value; - unicap_unlock_properties( vut->handle ); return 1; } } - unicap_unlock_properties( vut->handle ); return 0; } @@ -493,10 +475,7 @@ void *vj_unicap_new_device( void *dud, int device_id ) return NULL; } - vj_unicap_t *vut = (vj_unicap_t*) vj_malloc(sizeof(vj_unicap_t)); - memset(vut,0,sizeof(vj_unicap_t)); - - vut->deviceID = device_id; + vj_unicap_t *vut = (vj_unicap_t*) vj_calloc(sizeof(vj_unicap_t)); if( !SUCCESS( unicap_enumerate_devices( NULL, &(vut->device), device_id ) ) ) { @@ -509,7 +488,9 @@ void *vj_unicap_new_device( void *dud, int device_id ) { veejay_msg(0, "Failed to open capture device '%s'\n", vut->device.identifier ); } + veejay_msg(2, "Using device '%s'", vut->device.identifier); + return (void*) vut; } static unsigned int @@ -523,31 +504,39 @@ get_fourcc(char * fourcc) int vj_unicap_configure_device( void *ud, int pixel_format, int w, int h ) { vj_unicap_t *vut = (vj_unicap_t*) ud; - unicap_lock_properties( vut->handle ); unicap_void_format( &(vut->format_spec)); unsigned int fourcc = 0; vut->sizes[0] = w * h; - + switch(pixel_format) { case FMT_420: + case FMT_420F: fourcc = get_fourcc( "YU12" ); vut->sizes[1] = (w*h)/4; vut->sizes[2] = vut->sizes[1]; + vut->pixfmt = ( pixel_format == FMT_420 ? PIX_FMT_YUV420P : PIX_FMT_YUVJ420P ); + vut->shift = 1; break; case FMT_422: + case FMT_422F: fourcc = get_fourcc( "422P" ); - vut->sizes[1] = (w*h)/2; + vut->sizes[1] = ((w/2)*h); vut->sizes[2] = vut->sizes[1]; + vut->pixfmt = ( pixel_format == FMT_422 ? PIX_FMT_YUV422P : PIX_FMT_YUVJ422P ); + vut->shift = 1; break; case FMT_444: + case FMT_444F: fourcc = get_fourcc( "422P" ); vut->sampler = subsample_init( w ); - vut->sizes[1] = (w*h)/2; + vut->sizes[1] = (w*h); vut->sizes[2] = vut->sizes[1]; vut->sampler = subsample_init( w ); + vut->pixfmt = ( pixel_format == FMT_444 ? PIX_FMT_YUV444P : PIX_FMT_YUVJ444P ); + vut->shift = 0; break; #ifdef STRICT_CHECKING default: @@ -577,7 +566,6 @@ int vj_unicap_configure_device( void *ud, int pixel_format, int w, int h ) { veejay_msg(0, "Unable to set video size %d x %d in format %s", w,h,vut->format.identifier ); - unicap_unlock_properties( vut->handle ); return 0; } @@ -585,39 +573,42 @@ int vj_unicap_configure_device( void *ud, int pixel_format, int w, int h ) } else { + unsigned int rgb24_fourcc = get_fourcc( "RGB3" ); unsigned int rgb_fourcc = get_fourcc( "RGB4" ); unicap_format_t rgb_spec, rgb_format; unicap_void_format( &rgb_spec); - veejay_msg(1, "Unable to select native pixel format, trying RGB32"); + veejay_msg(1, "Unable to select native pixel format, trying RGB formats"); for( i = 0; SUCCESS( unicap_enumerate_formats( vut->handle, &rgb_spec, &rgb_format, i ) ); i ++ ) { if( rgb_fourcc == rgb_format.fourcc ) { - veejay_msg(0, "Camera can capture in RGB32"); + veejay_msg(0, "Camera can capture in %s", rgb_format.identifier); vut->rgb = 1; rgb_format.size.width = w; rgb_format.size.height = h; break; + } else if ( rgb24_fourcc == rgb_format.fourcc ) + { + veejay_msg(0, "Camera can capture in %s", rgb_format.identifier); + vut->rgb = 2; + rgb_format.size.width = w; + rgb_format.size.height = h; + break; } } if(!vut->rgb) { veejay_msg(0, "No matching formats found. Camera not supported."); - unicap_unlock_properties( vut->handle ); return 0; } else - if( !SUCCESS( unicap_set_format( vut->handle, &rgb_format ) ) ) - { - veejay_msg(0, "Cannot set size %d x %d or format %s", w,h,rgb_format.identifier); - unicap_unlock_properties( vut->handle ); - - return 0; - } + { + veejay_memcpy( &(vut->format), &rgb_format, sizeof( rgb_format )); + } } unicap_format_t test; @@ -642,145 +633,290 @@ int vj_unicap_configure_device( void *ud, int pixel_format, int w, int h ) if( !SUCCESS( unicap_set_format( vut->handle, &(vut->format) ) ) ) { veejay_msg(0, "Cannot set size %d x %d or format %s", w,h,vut->format.identifier); - unicap_unlock_properties( vut->handle ); return 0; } veejay_msg(2, "Capture size set to %d x %d (%s)", w,h,vut->format.identifier); } - -/* - char *comp = "Composite1"; - if(vj_unicap_set_property( vut, "video source", VEVO_ATOM_TYPE_STRING, &comp ) ) - { - veejay_msg(2, "Changed channel to Composite1"); - }*/ - - vut->buffer.data = vj_malloc( test.size.width * test.size.height * 4 ); - vut->buffer.buffer_size = (sizeof(unsigned char) * 4 * test.size.width * test.size.height ); - unicap_unlock_properties( vut->handle ); + + veejay_memset( &(vut->buffer), 0, sizeof(unicap_data_buffer_t)); + vut->buffer.data = vj_calloc( vut->format.buffer_size ); + vut->buffer.buffer_size = vut->format.buffer_size; + + vut->width = w; + vut->height =h ; return 1; } - -int vj_unicap_start_capture( void *vut, void *slot ) +int vj_unicap_start_capture( void *vut ) { - VJFrame *f = (VJFrame*)slot; vj_unicap_t *v = (vj_unicap_t*) vut; +#ifdef STRICT_CHECKING + assert( v->state == 0 ); + assert( v->priv_buf == NULL ); +#endif + v->state = 1; + + pthread_mutex_init( &(v->mutex), NULL ); + + int err = pthread_create( &(v->thread), NULL, + unicap_reader_thread, vut ); + if( err == 0 ) + { + v->active = 1; + return 1; + } + + v->state = 0; + veejay_msg(VEEJAY_MSG_ERROR, + "Unable to start capture thread"); + return 0; +} + +int vj_unicap_stop_capture( void *vut ) +{ + vj_unicap_t *v = (vj_unicap_t*) vut; + + lock_(vut); + v->state = 0; + unlock_(vut); + + pthread_mutex_destroy( &(v->mutex) ); + return 1; +} + +static int vj_unicap_start_capture_( void *vut ) +{ + vj_unicap_t *v = (vj_unicap_t*) vut; +#ifdef STRICT_CHECKING + assert( v->priv_buf == NULL ); + assert( v->state == 1 ); +#endif + v->priv_buf = (uint8_t*) vj_calloc( BUFFERS * v->width * v->height * 4 ); +#ifdef STRICT_CHECKING + assert( v->priv_buf != NULL ); +#endif + + if(!v->rgb) + { + veejay_memset( v->priv_buf + v->sizes[0], 128, v->sizes[1] ); + veejay_memset( v->priv_buf + v->sizes[0] + v->sizes[1] , 128, v->sizes[2] ); + } if( !SUCCESS( unicap_start_capture( v->handle ) ) ) { veejay_msg( 0, "Failed to start capture on device: %s\n", v->device.identifier ); + free(v->priv_buf); + v->priv_buf = NULL; return 0; } - if( !SUCCESS( unicap_queue_buffer( v->handle, &(v->buffer) ) ) ) - { - veejay_msg( 0, "Failed to queue a buffer on device: %s\n", v->device.identifier ); - // unicap_unlock_properties( v->handle ); - return 0; - } - - v->active = 1; + veejay_msg(VEEJAY_MSG_ERROR, "Started capture on device %s", + v->device.identifier ); return 1; } -int vj_unicap_grab_frame( void *vut, void *slot ) -{ - VJFrame *f = (VJFrame*)slot; - vj_unicap_t *v = (vj_unicap_t*) vut; - unicap_lock_properties( v->handle ); +int vj_unicap_grab_a_frame( void *vut ) +{ + vj_unicap_t *v = (vj_unicap_t*) vut; +// unicap_lock_properties( v->handle ); + unicap_data_buffer_t *ready_buffer = NULL; if(!v->active) { - if(!vj_unicap_start_capture( vut, slot )) - { - unicap_unlock_properties( v->handle ); - - return 0; - } + veejay_msg(VEEJAY_MSG_ERROR, "Capture not started!"); + return 0; } - - /* if( !SUCCESS( unicap_queue_buffer( v->handle, &(v->buffer) ) ) ) - { - veejay_msg( 0, "Failed to queue a buffer on device: %s\n", v->device.identifier ); - unicap_unlock_properties( v->handle ); + uint8_t *buffer[3] = { + v->priv_buf, + v->priv_buf + v->sizes[0], + v->priv_buf + v->sizes[1] + v->sizes[0] + }; - return 0; - }*/ - - if( !SUCCESS( unicap_wait_buffer( v->handle, &(v->returned_buffer )) ) ) + if( ! SUCCESS( unicap_queue_buffer( v->handle, &(v->buffer) )) ) { - veejay_msg(0,"Failed to wait for buffer on device: %s\n", v->device.identifier ); - unicap_unlock_properties( v->handle ); - + veejay_msg(VEEJAY_MSG_ERROR, "%s:%d Failed to queue buffer ",__FUNCTION__,__LINE__); return 0; } - if( !SUCCESS( unicap_queue_buffer( v->handle, &(v->buffer) ) ) ) - { - veejay_msg( 0, "Failed to queue a buffer on device: %s\n", v->device.identifier ); - unicap_unlock_properties( v->handle ); + if(! SUCCESS(unicap_wait_buffer(v->handle, &(v->buf)) )) + { + veejay_msg(VEEJAY_MSG_ERROR, "%s:%d Failed to wait for buffer on device %s", + __FUNCTION__,__LINE__, v->device.identifier ); + } + + if( v->buf->buffer_size <= 0 ) + { + veejay_msg(0, "Unicap returned a buffer of size 0!"); return 0; } + if( !v->buf->data ) + { + veejay_msg(0, "Unicap returned a NULL buffer!"); + return 0; + } + + lock_(vut); + if( v->deinterlace ) { - yuv_deinterlace( f, - v->buffer.data, - v->buffer.data + v->sizes[0], - v->buffer.data +v->sizes[0] + v->sizes[1] - ); - if( v->sampler ) - chroma_supersample( SSM_422_444, v->sampler, f->data, f->width,f->height ); + yuv_deinterlace( + buffer, + v->width, + v->height, + v->pixfmt, + v->shift, + v->buf->data, + v->buf->data + v->sizes[0], + v->buf->data +v->sizes[0] + v->sizes[1] + ); } else { if(!v->rgb) { - veejay_memcpy( f->data[0], v->buffer.data, v->sizes[0] ); - veejay_memcpy( f->data[1], v->buffer.data + v->sizes[0], v->sizes[1] ); - veejay_memcpy( f->data[2], v->buffer.data + v->sizes[0] +v->sizes[1] , v->sizes[2]); - if( v->sampler ) - chroma_supersample( SSM_422_444, v->sampler, f->data, f->width,f->height ); - + veejay_memcpy( buffer[0], v->buf->data, v->sizes[0] ); + veejay_memcpy( buffer[1], v->buf->data + v->sizes[0], v->sizes[1] ); + veejay_memcpy( buffer[2], v->buf->data + v->sizes[0] +v->sizes[1] , v->sizes[2]); } else { - util_convertsrc( v->buffer.data, f->width,f->height,f->pixfmt, f->data ); + VJFrame *srci = yuv_rgb_template( v->buf->data, v->width,v->height, (v->rgb==2 ? PIX_FMT_RGB24:PIX_FMT_RGB32) ); + VJFrame *dsti = yuv_yuv_template( buffer[0],buffer[1],buffer[2], v->width,v->height, v->pixfmt ); + + yuv_convert_any(srci,dsti, srci->format, dsti->format ); + + free(srci); + free(dsti); + + } } - unicap_unlock_properties( v->handle ); + unlock_(vut); + return 1; } -int vj_unicap_stop_capture( void *vut ) +int vj_unicap_grab_frame( void *vut, uint8_t *buffer[3], const int width, const int height ) +{ + vj_unicap_t *v = (vj_unicap_t*) vut; + +#ifdef STRICT_CHECKING + assert(v->active == 1 ); + assert(v->state != 0 ); + assert(v->sizes[0] > 0 ); + assert(v->priv_buf != NULL ); +#endif + + lock_(vut); + + uint8_t *src[3] = { + v->priv_buf, + v->priv_buf + v->sizes[0], + v->priv_buf + v->sizes[0] + v->sizes[1] + }; + + veejay_memcpy( buffer[0], src[0], v->sizes[0] ); + veejay_memcpy( buffer[1], src[1], v->sizes[1] ); + veejay_memcpy( buffer[2], src[2], v->sizes[2]); + + unlock_(vut); + + return 1; +} + + +static int vj_unicap_stop_capture_( void *vut ) { vj_unicap_t *v = (vj_unicap_t*) vut; - if( !SUCCESS( unicap_stop_capture( v->handle ) ) ) { veejay_msg(0,"Failed to stop capture on device: %s\n", v->device.identifier ); return 0; } v->active = 0; + veejay_msg(VEEJAY_MSG_ERROR, "Stopped capture on device %s", + v->device.identifier ); + + return 1; } + +int vj_unicap_status(void *vut) +{ + if(!vut) return 0; + vj_unicap_t *v = (vj_unicap_t*) vut; + + return v->active; +} + + + +static void *unicap_reader_thread(void *data) +{ + vj_unicap_t *v = (vj_unicap_t*) data; + + if(! vj_unicap_start_capture_( data ) ) + { + veejay_msg(VEEJAY_MSG_ERROR, "Unable to start capture thread."); + return NULL; + } + + + for( ;; ) + { + if( v->state == 0 ) + { + veejay_msg(VEEJAY_MSG_INFO, "Stopping capture thread"); + break; + } + + if(vj_unicap_grab_a_frame( data )==0) + { + veejay_msg(VEEJAY_MSG_ERROR, "Unable to grab a frame from the capture device. "); + v->state = 0; + } + } + + vj_unicap_stop_capture_( data ); + + free(v->priv_buf); + v->active = 0; + v->priv_buf = NULL; + + + veejay_msg(VEEJAY_MSG_INFO, "Capture thread ended. (Stopped capturing)"); + + return NULL; +} + + void vj_unicap_free_device( void *vut ) { vj_unicap_t *v = (vj_unicap_t*) vut; - if( v->active ) + if( v->active || v->state ) vj_unicap_stop_capture( vut ); - if( !SUCCESS( unicap_close( v->handle ) ) ) - { - veejay_msg(0, "Failed to close the device: %s\n", v->device.identifier ); + + if( v->handle ) + { + if( !SUCCESS( unicap_close( v->handle ) ) ) + { + veejay_msg(0, "Failed to close the device: %s\n", v->device.identifier ); + } } + if(v->buffer.data) + free(v->buffer.data); + + + free( v ); + v = NULL; } diff --git a/veejay-ng/vevosample/vj-unicap.h b/veejay-ng/vevosample/vj-unicap.h index 5af7f6c9..52f1b98e 100644 --- a/veejay-ng/vevosample/vj-unicap.h +++ b/veejay-ng/vevosample/vj-unicap.h @@ -27,8 +27,7 @@ int vj_unicap_num_capture_devices( void *dud ); void *vj_unicap_new_device( void *ud, int device_id ); int vj_unicap_configure_device( void *ud, int pixel_format, int w, int h ); -int vj_unicap_start_capture( void *vut, void *slot ); -int vj_unicap_grab_frame( void *vut, void *slot ); +int vj_unicap_start_capture( void *vut ); int vj_unicap_stop_capture( void *vut ); void vj_unicap_free_device( void *vut );