lac : diff ba603811 294bc789

Branch: master

Commit: ba603811848f70ec8948d4a67d784cf6baf8614d

Author: Gianluca Guida <glguida@tlbflush.org>
Date: Sun Feb 26 22:22:35 UTC 2017
Parent: 294bc789a5d4019cf0a37fbcafdd4dc1433413ce
Log message:

    Add util m4 require_liblac and fixes.
    
     - require_liblac.m4 can be used by external projects to check
       the presence of lac in the system through autotools.
     - Add missing M4 script needed by aclocal.
     - Add missing libtool script

    1: diff --git a/Makefile.in b/Makefile.in
    2: index cc1b059..e241962 100644
    3: --- a/Makefile.in
    4: +++ b/Makefile.in
    5: @@ -94,7 +94,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/lib-ld.m4 \
    6:  	$(top_srcdir)/m4/libsigsegv.m4 $(top_srcdir)/m4/libtool.m4 \
    7:  	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
    8:  	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
    9: -	$(top_srcdir)/m4/readline.m4 $(top_srcdir)/configure.ac
   10: +	$(top_srcdir)/m4/readline.m4 $(top_srcdir)/m4/std-gnu11.m4 \
   11: +	$(top_srcdir)/configure.ac
   12:  am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
   13:  	$(ACLOCAL_M4)
   14:  DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
   15: @@ -163,9 +164,8 @@ CTAGS = ctags
   16:  CSCOPE = cscope
   17:  DIST_SUBDIRS = $(SUBDIRS)
   18:  am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in AUTHORS \
   19: -	COPYING ChangeLog INSTALL NEWS README TODO compile \
   20: -	config.guess config.rpath config.sub install-sh ltmain.sh \
   21: -	missing ylwrap
   22: +	COPYING ChangeLog INSTALL NEWS README TODO config.guess \
   23: +	config.rpath config.sub install-sh ltmain.sh missing ylwrap
   24:  DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
   25:  distdir = $(PACKAGE)-$(VERSION)
   26:  top_distdir = $(distdir)
   27: diff --git a/aclocal.m4 b/aclocal.m4
   28: index e70ea93..d8c5be4 100644
   29: --- a/aclocal.m4
   30: +++ b/aclocal.m4
   31: @@ -1306,70 +1306,6 @@ AC_DEFUN([_AM_SET_OPTIONS],
   32:  AC_DEFUN([_AM_IF_OPTION],
   33:  [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
   34:  
   35: -# Copyright (C) 1999-2014 Free Software Foundation, Inc.
   36: -#
   37: -# This file is free software; the Free Software Foundation
   38: -# gives unlimited permission to copy and/or distribute it,
   39: -# with or without modifications, as long as this notice is preserved.
   40: -
   41: -# _AM_PROG_CC_C_O
   42: -# ---------------
   43: -# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
   44: -# to automatically call this.
   45: -AC_DEFUN([_AM_PROG_CC_C_O],
   46: -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
   47: -AC_REQUIRE_AUX_FILE([compile])dnl
   48: -AC_LANG_PUSH([C])dnl
   49: -AC_CACHE_CHECK(
   50: -  [whether $CC understands -c and -o together],
   51: -  [am_cv_prog_cc_c_o],
   52: -  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
   53: -  # Make sure it works both with $CC and with simple cc.
   54: -  # Following AC_PROG_CC_C_O, we do the test twice because some
   55: -  # compilers refuse to overwrite an existing .o file with -o,
   56: -  # though they will create one.
   57: -  am_cv_prog_cc_c_o=yes
   58: -  for am_i in 1 2; do
   59: -    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
   60: -         && test -f conftest2.$ac_objext; then
   61: -      : OK
   62: -    else
   63: -      am_cv_prog_cc_c_o=no
   64: -      break
   65: -    fi
   66: -  done
   67: -  rm -f core conftest*
   68: -  unset am_i])
   69: -if test "$am_cv_prog_cc_c_o" != yes; then
   70: -   # Losing compiler, so override with the script.
   71: -   # FIXME: It is wrong to rewrite CC.
   72: -   # But if we don't then we get into trouble of one sort or another.
   73: -   # A longer-term fix would be to have automake use am__CC in this case,
   74: -   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
   75: -   CC="$am_aux_dir/compile $CC"
   76: -fi
   77: -AC_LANG_POP([C])])
   78: -
   79: -# For backward compatibility.
   80: -AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
   81: -
   82: -# Copyright (C) 2001-2014 Free Software Foundation, Inc.
   83: -#
   84: -# This file is free software; the Free Software Foundation
   85: -# gives unlimited permission to copy and/or distribute it,
   86: -# with or without modifications, as long as this notice is preserved.
   87: -
   88: -# AM_RUN_LOG(COMMAND)
   89: -# -------------------
   90: -# Run COMMAND, save the exit status in ac_status, and log it.
   91: -# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
   92: -AC_DEFUN([AM_RUN_LOG],
   93: -[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
   94: -   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
   95: -   ac_status=$?
   96: -   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
   97: -   (exit $ac_status); }])
   98: -
   99:  # Check to make sure that the build environment is sane.    -*- Autoconf -*-
  100:  
  101:  # Copyright (C) 1996-2014 Free Software Foundation, Inc.
  102: @@ -1701,3 +1637,4 @@ m4_include([m4/ltsugar.m4])
  103:  m4_include([m4/ltversion.m4])
  104:  m4_include([m4/lt~obsolete.m4])
  105:  m4_include([m4/readline.m4])
  106: +m4_include([m4/std-gnu11.m4])
  107: diff --git a/compile b/compile
  108: deleted file mode 100755
  109: index a85b723..0000000
  110: --- a/compile
  111: +++ /dev/null
  112: @@ -1,347 +0,0 @@
  113: -#! /bin/sh
  114: -# Wrapper for compilers which do not understand '-c -o'.
  115: -
  116: -scriptversion=2012-10-14.11; # UTC
  117: -
  118: -# Copyright (C) 1999-2014 Free Software Foundation, Inc.
  119: -# Written by Tom Tromey <tromey@cygnus.com>.
  120: -#
  121: -# This program is free software; you can redistribute it and/or modify
  122: -# it under the terms of the GNU General Public License as published by
  123: -# the Free Software Foundation; either version 2, or (at your option)
  124: -# any later version.
  125: -#
  126: -# This program is distributed in the hope that it will be useful,
  127: -# but WITHOUT ANY WARRANTY; without even the implied warranty of
  128: -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  129: -# GNU General Public License for more details.
  130: -#
  131: -# You should have received a copy of the GNU General Public License
  132: -# along with this program.  If not, see <http://www.gnu.org/licenses/>.
  133: -
  134: -# As a special exception to the GNU General Public License, if you
  135: -# distribute this file as part of a program that contains a
  136: -# configuration script generated by Autoconf, you may include it under
  137: -# the same distribution terms that you use for the rest of that program.
  138: -
  139: -# This file is maintained in Automake, please report
  140: -# bugs to <bug-automake@gnu.org> or send patches to
  141: -# <automake-patches@gnu.org>.
  142: -
  143: -nl='
  144: -'
  145: -
  146: -# We need space, tab and new line, in precisely that order.  Quoting is
  147: -# there to prevent tools from complaining about whitespace usage.
  148: -IFS=" ""	$nl"
  149: -
  150: -file_conv=
  151: -
  152: -# func_file_conv build_file lazy
  153: -# Convert a $build file to $host form and store it in $file
  154: -# Currently only supports Windows hosts. If the determined conversion
  155: -# type is listed in (the comma separated) LAZY, no conversion will
  156: -# take place.
  157: -func_file_conv ()
  158: -{
  159: -  file=$1
  160: -  case $file in
  161: -    / | /[!/]*) # absolute file, and not a UNC file
  162: -      if test -z "$file_conv"; then
  163: -	# lazily determine how to convert abs files
  164: -	case `uname -s` in
  165: -	  MINGW*)
  166: -	    file_conv=mingw
  167: -	    ;;
  168: -	  CYGWIN*)
  169: -	    file_conv=cygwin
  170: -	    ;;
  171: -	  *)
  172: -	    file_conv=wine
  173: -	    ;;
  174: -	esac
  175: -      fi
  176: -      case $file_conv/,$2, in
  177: -	*,$file_conv,*)
  178: -	  ;;
  179: -	mingw/*)
  180: -	  file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
  181: -	  ;;
  182: -	cygwin/*)
  183: -	  file=`cygpath -m "$file" || echo "$file"`
  184: -	  ;;
  185: -	wine/*)
  186: -	  file=`winepath -w "$file" || echo "$file"`
  187: -	  ;;
  188: -      esac
  189: -      ;;
  190: -  esac
  191: -}
  192: -
  193: -# func_cl_dashL linkdir
  194: -# Make cl look for libraries in LINKDIR
  195: -func_cl_dashL ()
  196: -{
  197: -  func_file_conv "$1"
  198: -  if test -z "$lib_path"; then
  199: -    lib_path=$file
  200: -  else
  201: -    lib_path="$lib_path;$file"
  202: -  fi
  203: -  linker_opts="$linker_opts -LIBPATH:$file"
  204: -}
  205: -
  206: -# func_cl_dashl library
  207: -# Do a library search-path lookup for cl
  208: -func_cl_dashl ()
  209: -{
  210: -  lib=$1
  211: -  found=no
  212: -  save_IFS=$IFS
  213: -  IFS=';'
  214: -  for dir in $lib_path $LIB
  215: -  do
  216: -    IFS=$save_IFS
  217: -    if $shared && test -f "$dir/$lib.dll.lib"; then
  218: -      found=yes
  219: -      lib=$dir/$lib.dll.lib
  220: -      break
  221: -    fi
  222: -    if test -f "$dir/$lib.lib"; then
  223: -      found=yes
  224: -      lib=$dir/$lib.lib
  225: -      break
  226: -    fi
  227: -    if test -f "$dir/lib$lib.a"; then
  228: -      found=yes
  229: -      lib=$dir/lib$lib.a
  230: -      break
  231: -    fi
  232: -  done
  233: -  IFS=$save_IFS
  234: -
  235: -  if test "$found" != yes; then
  236: -    lib=$lib.lib
  237: -  fi
  238: -}
  239: -
  240: -# func_cl_wrapper cl arg...
  241: -# Adjust compile command to suit cl
  242: -func_cl_wrapper ()
  243: -{
  244: -  # Assume a capable shell
  245: -  lib_path=
  246: -  shared=:
  247: -  linker_opts=
  248: -  for arg
  249: -  do
  250: -    if test -n "$eat"; then
  251: -      eat=
  252: -    else
  253: -      case $1 in
  254: -	-o)
  255: -	  # configure might choose to run compile as 'compile cc -o foo foo.c'.
  256: -	  eat=1
  257: -	  case $2 in
  258: -	    *.o | *.[oO][bB][jJ])
  259: -	      func_file_conv "$2"
  260: -	      set x "$@" -Fo"$file"
  261: -	      shift
  262: -	      ;;
  263: -	    *)
  264: -	      func_file_conv "$2"
  265: -	      set x "$@" -Fe"$file"
  266: -	      shift
  267: -	      ;;
  268: -	  esac
  269: -	  ;;
  270: -	-I)
  271: -	  eat=1
  272: -	  func_file_conv "$2" mingw
  273: -	  set x "$@" -I"$file"
  274: -	  shift
  275: -	  ;;
  276: -	-I*)
  277: -	  func_file_conv "${1#-I}" mingw
  278: -	  set x "$@" -I"$file"
  279: -	  shift
  280: -	  ;;
  281: -	-l)
  282: -	  eat=1
  283: -	  func_cl_dashl "$2"
  284: -	  set x "$@" "$lib"
  285: -	  shift
  286: -	  ;;
  287: -	-l*)
  288: -	  func_cl_dashl "${1#-l}"
  289: -	  set x "$@" "$lib"
  290: -	  shift
  291: -	  ;;
  292: -	-L)
  293: -	  eat=1
  294: -	  func_cl_dashL "$2"
  295: -	  ;;
  296: -	-L*)
  297: -	  func_cl_dashL "${1#-L}"
  298: -	  ;;
  299: -	-static)
  300: -	  shared=false
  301: -	  ;;
  302: -	-Wl,*)
  303: -	  arg=${1#-Wl,}
  304: -	  save_ifs="$IFS"; IFS=','
  305: -	  for flag in $arg; do
  306: -	    IFS="$save_ifs"
  307: -	    linker_opts="$linker_opts $flag"
  308: -	  done
  309: -	  IFS="$save_ifs"
  310: -	  ;;
  311: -	-Xlinker)
  312: -	  eat=1
  313: -	  linker_opts="$linker_opts $2"
  314: -	  ;;
  315: -	-*)
  316: -	  set x "$@" "$1"
  317: -	  shift
  318: -	  ;;
  319: -	*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
  320: -	  func_file_conv "$1"
  321: -	  set x "$@" -Tp"$file"
  322: -	  shift
  323: -	  ;;
  324: -	*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
  325: -	  func_file_conv "$1" mingw
  326: -	  set x "$@" "$file"
  327: -	  shift
  328: -	  ;;
  329: -	*)
  330: -	  set x "$@" "$1"
  331: -	  shift
  332: -	  ;;
  333: -      esac
  334: -    fi
  335: -    shift
  336: -  done
  337: -  if test -n "$linker_opts"; then
  338: -    linker_opts="-link$linker_opts"
  339: -  fi
  340: -  exec "$@" $linker_opts
  341: -  exit 1
  342: -}
  343: -
  344: -eat=
  345: -
  346: -case $1 in
  347: -  '')
  348: -     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
  349: -     exit 1;
  350: -     ;;
  351: -  -h | --h*)
  352: -    cat <<\EOF
  353: -Usage: compile [--help] [--version] PROGRAM [ARGS]
  354: -
  355: -Wrapper for compilers which do not understand '-c -o'.
  356: -Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
  357: -arguments, and rename the output as expected.
  358: -
  359: -If you are trying to build a whole package this is not the
  360: -right script to run: please start by reading the file 'INSTALL'.
  361: -
  362: -Report bugs to <bug-automake@gnu.org>.
  363: -EOF
  364: -    exit $?
  365: -    ;;
  366: -  -v | --v*)
  367: -    echo "compile $scriptversion"
  368: -    exit $?
  369: -    ;;
  370: -  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
  371: -    func_cl_wrapper "$@"      # Doesn't return...
  372: -    ;;
  373: -esac
  374: -
  375: -ofile=
  376: -cfile=
  377: -
  378: -for arg
  379: -do
  380: -  if test -n "$eat"; then
  381: -    eat=
  382: -  else
  383: -    case $1 in
  384: -      -o)
  385: -	# configure might choose to run compile as 'compile cc -o foo foo.c'.
  386: -	# So we strip '-o arg' only if arg is an object.
  387: -	eat=1
  388: -	case $2 in
  389: -	  *.o | *.obj)
  390: -	    ofile=$2
  391: -	    ;;
  392: -	  *)
  393: -	    set x "$@" -o "$2"
  394: -	    shift
  395: -	    ;;
  396: -	esac
  397: -	;;
  398: -      *.c)
  399: -	cfile=$1
  400: -	set x "$@" "$1"
  401: -	shift
  402: -	;;
  403: -      *)
  404: -	set x "$@" "$1"
  405: -	shift
  406: -	;;
  407: -    esac
  408: -  fi
  409: -  shift
  410: -done
  411: -
  412: -if test -z "$ofile" || test -z "$cfile"; then
  413: -  # If no '-o' option was seen then we might have been invoked from a
  414: -  # pattern rule where we don't need one.  That is ok -- this is a
  415: -  # normal compilation that the losing compiler can handle.  If no
  416: -  # '.c' file was seen then we are probably linking.  That is also
  417: -  # ok.
  418: -  exec "$@"
  419: -fi
  420: -
  421: -# Name of file we expect compiler to create.
  422: -cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
  423: -
  424: -# Create the lock directory.
  425: -# Note: use '[/\\:.-]' here to ensure that we don't use the same name
  426: -# that we are using for the .o file.  Also, base the name on the expected
  427: -# object file name, since that is what matters with a parallel build.
  428: -lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
  429: -while true; do
  430: -  if mkdir "$lockdir" >/dev/null 2>&1; then
  431: -    break
  432: -  fi
  433: -  sleep 1
  434: -done
  435: -# FIXME: race condition here if user kills between mkdir and trap.
  436: -trap "rmdir '$lockdir'; exit 1" 1 2 15
  437: -
  438: -# Run the compile.
  439: -"$@"
  440: -ret=$?
  441: -
  442: -if test -f "$cofile"; then
  443: -  test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
  444: -elif test -f "${cofile}bj"; then
  445: -  test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
  446: -fi
  447: -
  448: -rmdir "$lockdir"
  449: -exit $ret
  450: -
  451: -# Local Variables:
  452: -# mode: shell-script
  453: -# sh-indentation: 2
  454: -# eval: (add-hook 'write-file-hooks 'time-stamp)
  455: -# time-stamp-start: "scriptversion="
  456: -# time-stamp-format: "%:y-%02m-%02d.%02H"
  457: -# time-stamp-time-zone: "UTC"
  458: -# time-stamp-end: "; # UTC"
  459: -# End:
  460: diff --git a/configure b/configure
  461: index f16c84a..514000d 100755
  462: --- a/configure
  463: +++ b/configure
  464: @@ -3221,6 +3221,100 @@ esac
  465:  fi
  466:  
  467:  fi
  468: +if test -z "$CC"; then
  469: +  if test -n "$ac_tool_prefix"; then
  470: +  # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args.
  471: +set dummy ${ac_tool_prefix}clang; ac_word=$2
  472: +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  473: +$as_echo_n "checking for $ac_word... " >&6; }
  474: +if ${ac_cv_prog_CC+:} false; then :
  475: +  $as_echo_n "(cached) " >&6
  476: +else
  477: +  if test -n "$CC"; then
  478: +  ac_cv_prog_CC="$CC" # Let the user override the test.
  479: +else
  480: +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  481: +for as_dir in $PATH
  482: +do
  483: +  IFS=$as_save_IFS
  484: +  test -z "$as_dir" && as_dir=.
  485: +    for ac_exec_ext in '' $ac_executable_extensions; do
  486: +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  487: +    ac_cv_prog_CC="${ac_tool_prefix}clang"
  488: +    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
  489: +    break 2
  490: +  fi
  491: +done
  492: +  done
  493: +IFS=$as_save_IFS
  494: +
  495: +fi
  496: +fi
  497: +CC=$ac_cv_prog_CC
  498: +if test -n "$CC"; then
  499: +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
  500: +$as_echo "$CC" >&6; }
  501: +else
  502: +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  503: +$as_echo "no" >&6; }
  504: +fi
  505: +
  506: +
  507: +fi
  508: +if test -z "$ac_cv_prog_CC"; then
  509: +  ac_ct_CC=$CC
  510: +  # Extract the first word of "clang", so it can be a program name with args.
  511: +set dummy clang; ac_word=$2
  512: +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  513: +$as_echo_n "checking for $ac_word... " >&6; }
  514: +if ${ac_cv_prog_ac_ct_CC+:} false; then :
  515: +  $as_echo_n "(cached) " >&6
  516: +else
  517: +  if test -n "$ac_ct_CC"; then
  518: +  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
  519: +else
  520: +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  521: +for as_dir in $PATH
  522: +do
  523: +  IFS=$as_save_IFS
  524: +  test -z "$as_dir" && as_dir=.
  525: +    for ac_exec_ext in '' $ac_executable_extensions; do
  526: +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  527: +    ac_cv_prog_ac_ct_CC="clang"
  528: +    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
  529: +    break 2
  530: +  fi
  531: +done
  532: +  done
  533: +IFS=$as_save_IFS
  534: +
  535: +fi
  536: +fi
  537: +ac_ct_CC=$ac_cv_prog_ac_ct_CC
  538: +if test -n "$ac_ct_CC"; then
  539: +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
  540: +$as_echo "$ac_ct_CC" >&6; }
  541: +else
  542: +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  543: +$as_echo "no" >&6; }
  544: +fi
  545: +
  546: +  if test "x$ac_ct_CC" = x; then
  547: +    CC=""
  548: +  else
  549: +    case $cross_compiling:$ac_tool_warned in
  550: +yes:)
  551: +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
  552: +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
  553: +ac_tool_warned=yes ;;
  554: +esac
  555: +    CC=$ac_ct_CC
  556: +  fi
  557: +else
  558: +  CC="$ac_cv_prog_CC"
  559: +fi
  560: +
  561: +fi
  562:  
  563:  
  564:  test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
  565: @@ -3232,7 +3326,7 @@ See \`config.log' for more details" "$LINENO" 5; }
  566:  $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
  567:  set X $ac_compile
  568:  ac_compiler=$2
  569: -for ac_option in --version -v -V -qversion; do
  570: +for ac_option in --version -v -V -qversion -version; do
  571:    { { ac_try="$ac_compiler $ac_option >&5"
  572:  case "(($ac_try" in
  573:    *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  574: @@ -3618,8 +3712,420 @@ else
  575:      CFLAGS=
  576:    fi
  577:  fi
  578: -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
  579: -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
  580: +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5
  581: +$as_echo_n "checking for $CC option to enable C11 features... " >&6; }
  582: +if ${ac_cv_prog_cc_c11+:} false; then :
  583: +  $as_echo_n "(cached) " >&6
  584: +else
  585: +  ac_cv_prog_cc_c11=no
  586: +ac_save_CC=$CC
  587: +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  588: +/* end confdefs.h.  */
  589: +#include <stdarg.h>
  590: +#include <stdbool.h>
  591: +#include <stddef.h>
  592: +#include <stdlib.h>
  593: +#include <wchar.h>
  594: +#include <stdio.h>
  595: +
  596: +// Check varargs macros.  These examples are taken from C99 6.10.3.5.
  597: +#define debug(...) fprintf (stderr, __VA_ARGS__)
  598: +#define showlist(...) puts (#__VA_ARGS__)
  599: +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
  600: +static void
  601: +test_varargs_macros (void)
  602: +{
  603: +  int x = 1234;
  604: +  int y = 5678;
  605: +  debug ("Flag");
  606: +  debug ("X = %d\n", x);
  607: +  showlist (The first, second, and third items.);
  608: +  report (x>y, "x is %d but y is %d", x, y);
  609: +}
  610: +
  611: +// Check long long types.
  612: +#define BIG64 18446744073709551615ull
  613: +#define BIG32 4294967295ul
  614: +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
  615: +#if !BIG_OK
  616: +  your preprocessor is broken;
  617: +#endif
  618: +#if BIG_OK
  619: +#else
  620: +  your preprocessor is broken;
  621: +#endif
  622: +static long long int bignum = -9223372036854775807LL;
  623: +static unsigned long long int ubignum = BIG64;
  624: +
  625: +struct incomplete_array
  626: +{
  627: +  int datasize;
  628: +  double data[];
  629: +};
  630: +
  631: +struct named_init {
  632: +  int number;
  633: +  const wchar_t *name;
  634: +  double average;
  635: +};
  636: +
  637: +typedef const char *ccp;
  638: +
  639: +static inline int
  640: +test_restrict (ccp restrict text)
  641: +{
  642: +  // See if C++-style comments work.
  643: +  // Iterate through items via the restricted pointer.
  644: +  // Also check for declarations in for loops.
  645: +  for (unsigned int i = 0; *(text+i) != '\0'; ++i)
  646: +    continue;
  647: +  return 0;
  648: +}
  649: +
  650: +// Check varargs and va_copy.
  651: +static bool
  652: +test_varargs (const char *format, ...)
  653: +{
  654: +  va_list args;
  655: +  va_start (args, format);
  656: +  va_list args_copy;
  657: +  va_copy (args_copy, args);
  658: +
  659: +  const char *str = "";
  660: +  int number = 0;
  661: +  float fnumber = 0;
  662: +
  663: +  while (*format)
  664: +    {
  665: +      switch (*format++)
  666: +	{
  667: +	case 's': // string
  668: +	  str = va_arg (args_copy, const char *);
  669: +	  break;
  670: +	case 'd': // int
  671: +	  number = va_arg (args_copy, int);
  672: +	  break;
  673: +	case 'f': // float
  674: +	  fnumber = va_arg (args_copy, double);
  675: +	  break;
  676: +	default:
  677: +	  break;
  678: +	}
  679: +    }
  680: +  va_end (args_copy);
  681: +  va_end (args);
  682: +
  683: +  return *str && number && fnumber;
  684: +}
  685: +// Check _Alignas.
  686: +char _Alignas (double) aligned_as_double;
  687: +char _Alignas (0) no_special_alignment;
  688: +extern char aligned_as_int;
  689: +char _Alignas (0) _Alignas (int) aligned_as_int;
  690: +
  691: +// Check _Alignof.
  692: +enum
  693: +{
  694: +  int_alignment = _Alignof (int),
  695: +  int_array_alignment = _Alignof (int[100]),
  696: +  char_alignment = _Alignof (char)
  697: +};
  698: +_Static_assert (0 < -_Alignof (int), "_Alignof is signed");
  699: +
  700: +// Check _Noreturn.
  701: +int _Noreturn does_not_return (void) { for (;;) continue; }
  702: +
  703: +// Check _Static_assert.
  704: +struct test_static_assert
  705: +{
  706: +  int x;
  707: +  _Static_assert (sizeof (int) <= sizeof (long int),
  708: +                  "_Static_assert does not work in struct");
  709: +  long int y;
  710: +};
  711: +
  712: +// Check UTF-8 literals.
  713: +#define u8 syntax error!
  714: +char const utf8_literal[] = u8"happens to be ASCII" "another string";
  715: +
  716: +// Check duplicate typedefs.
  717: +typedef long *long_ptr;
  718: +typedef long int *long_ptr;
  719: +typedef long_ptr long_ptr;
  720: +
  721: +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1.
  722: +struct anonymous
  723: +{
  724: +  union {
  725: +    struct { int i; int j; };
  726: +    struct { int k; long int l; } w;
  727: +  };
  728: +  int m;
  729: +} v1;
  730: +
  731: +int
  732: +main ()
  733: +{
  734: +
  735: +  // Check bool.
  736: +  _Bool success = false;
  737: +
  738: +  // Check restrict.
  739: +  if (test_restrict ("String literal") == 0)
  740: +    success = true;
  741: +  char *restrict newvar = "Another string";
  742: +
  743: +  // Check varargs.
  744: +  success &= test_varargs ("s, d' f .", "string", 65, 34.234);
  745: +  test_varargs_macros ();
  746: +
  747: +  // Check flexible array members.
  748: +  struct incomplete_array *ia =
  749: +    malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
  750: +  ia->datasize = 10;
  751: +  for (int i = 0; i < ia->datasize; ++i)
  752: +    ia->data[i] = i * 1.234;
  753: +
  754: +  // Check named initializers.
  755: +  struct named_init ni = {
  756: +    .number = 34,
  757: +    .name = L"Test wide string",
  758: +    .average = 543.34343,
  759: +  };
  760: +
  761: +  ni.number = 58;
  762: +
  763: +  int dynamic_array[ni.number];
  764: +  dynamic_array[ni.number - 1] = 543;
  765: +
  766: +  // work around unused variable warnings
  767: +  return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
  768: +	  || dynamic_array[ni.number - 1] != 543);
  769: +
  770: +  v1.i = 2;
  771: +  v1.w.k = 5;
  772: +  _Static_assert ((offsetof (struct anonymous, i)
  773: +		   == offsetof (struct anonymous, w.k)),
  774: +		  "Anonymous union alignment botch");
  775: +
  776: +  ;
  777: +  return 0;
  778: +}
  779: +_ACEOF
  780: +for ac_arg in '' -std=gnu11
  781: +do
  782: +  CC="$ac_save_CC $ac_arg"
  783: +  if ac_fn_c_try_compile "$LINENO"; then :
  784: +  ac_cv_prog_cc_c11=$ac_arg
  785: +fi
  786: +rm -f core conftest.err conftest.$ac_objext
  787: +  test "x$ac_cv_prog_cc_c11" != "xno" && break
  788: +done
  789: +rm -f conftest.$ac_ext
  790: +CC=$ac_save_CC
  791: +
  792: +fi
  793: +# AC_CACHE_VAL
  794: +ac_prog_cc_stdc_options=
  795: +case "x$ac_cv_prog_cc_c11" in
  796: +  x)
  797: +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
  798: +$as_echo "none needed" >&6; } ;;
  799: +  xno)
  800: +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
  801: +$as_echo "unsupported" >&6; } ;;
  802: +  *)
  803: +    ac_prog_cc_stdc_options=" $ac_cv_prog_cc_c11"
  804: +    CC=$CC$ac_prog_cc_stdc_options
  805: +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5
  806: +$as_echo "$ac_cv_prog_cc_c11" >&6; } ;;
  807: +esac
  808: +if test "x$ac_cv_prog_cc_c11" != xno; then :
  809: +  ac_prog_cc_stdc=c11
  810: +		 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11
  811: +else
  812: +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5
  813: +$as_echo_n "checking for $CC option to enable C99 features... " >&6; }
  814: +if ${ac_cv_prog_cc_c99+:} false; then :
  815: +  $as_echo_n "(cached) " >&6
  816: +else
  817: +  ac_cv_prog_cc_c99=no
  818: +ac_save_CC=$CC
  819: +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  820: +/* end confdefs.h.  */
  821: +#include <stdarg.h>
  822: +#include <stdbool.h>
  823: +#include <stddef.h>
  824: +#include <stdlib.h>
  825: +#include <wchar.h>
  826: +#include <stdio.h>
  827: +
  828: +// Check varargs macros.  These examples are taken from C99 6.10.3.5.
  829: +#define debug(...) fprintf (stderr, __VA_ARGS__)
  830: +#define showlist(...) puts (#__VA_ARGS__)
  831: +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
  832: +static void
  833: +test_varargs_macros (void)
  834: +{
  835: +  int x = 1234;
  836: +  int y = 5678;
  837: +  debug ("Flag");
  838: +  debug ("X = %d\n", x);
  839: +  showlist (The first, second, and third items.);
  840: +  report (x>y, "x is %d but y is %d", x, y);
  841: +}
  842: +
  843: +// Check long long types.
  844: +#define BIG64 18446744073709551615ull
  845: +#define BIG32 4294967295ul
  846: +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
  847: +#if !BIG_OK
  848: +  your preprocessor is broken;
  849: +#endif
  850: +#if BIG_OK
  851: +#else
  852: +  your preprocessor is broken;
  853: +#endif
  854: +static long long int bignum = -9223372036854775807LL;
  855: +static unsigned long long int ubignum = BIG64;
  856: +
  857: +struct incomplete_array
  858: +{
  859: +  int datasize;
  860: +  double data[];
  861: +};
  862: +
  863: +struct named_init {
  864: +  int number;
  865: +  const wchar_t *name;
  866: +  double average;
  867: +};
  868: +
  869: +typedef const char *ccp;
  870: +
  871: +static inline int
  872: +test_restrict (ccp restrict text)
  873: +{
  874: +  // See if C++-style comments work.
  875: +  // Iterate through items via the restricted pointer.
  876: +  // Also check for declarations in for loops.
  877: +  for (unsigned int i = 0; *(text+i) != '\0'; ++i)
  878: +    continue;
  879: +  return 0;
  880: +}
  881: +
  882: +// Check varargs and va_copy.
  883: +static bool
  884: +test_varargs (const char *format, ...)
  885: +{
  886: +  va_list args;
  887: +  va_start (args, format);
  888: +  va_list args_copy;
  889: +  va_copy (args_copy, args);
  890: +
  891: +  const char *str = "";
  892: +  int number = 0;
  893: +  float fnumber = 0;
  894: +
  895: +  while (*format)
  896: +    {
  897: +      switch (*format++)
  898: +	{
  899: +	case 's': // string
  900: +	  str = va_arg (args_copy, const char *);
  901: +	  break;
  902: +	case 'd': // int
  903: +	  number = va_arg (args_copy, int);
  904: +	  break;
  905: +	case 'f': // float
  906: +	  fnumber = va_arg (args_copy, double);
  907: +	  break;
  908: +	default:
  909: +	  break;
  910: +	}
  911: +    }
  912: +  va_end (args_copy);
  913: +  va_end (args);
  914: +
  915: +  return *str && number && fnumber;
  916: +}
  917: +int
  918: +main ()
  919: +{
  920: +
  921: +  // Check bool.
  922: +  _Bool success = false;
  923: +
  924: +  // Check restrict.
  925: +  if (test_restrict ("String literal") == 0)
  926: +    success = true;
  927: +  char *restrict newvar = "Another string";
  928: +
  929: +  // Check varargs.
  930: +  success &= test_varargs ("s, d' f .", "string", 65, 34.234);
  931: +  test_varargs_macros ();
  932: +
  933: +  // Check flexible array members.
  934: +  struct incomplete_array *ia =
  935: +    malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
  936: +  ia->datasize = 10;
  937: +  for (int i = 0; i < ia->datasize; ++i)
  938: +    ia->data[i] = i * 1.234;
  939: +
  940: +  // Check named initializers.
  941: +  struct named_init ni = {
  942: +    .number = 34,
  943: +    .name = L"Test wide string",
  944: +    .average = 543.34343,
  945: +  };
  946: +
  947: +  ni.number = 58;
  948: +
  949: +  int dynamic_array[ni.number];
  950: +  dynamic_array[ni.number - 1] = 543;
  951: +
  952: +  // work around unused variable warnings
  953: +  return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
  954: +	  || dynamic_array[ni.number - 1] != 543);
  955: +
  956: +  ;
  957: +  return 0;
  958: +}
  959: +_ACEOF
  960: +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc1x -qlanglvl=extc99
  961: +do
  962: +  CC="$ac_save_CC $ac_arg"
  963: +  if ac_fn_c_try_compile "$LINENO"; then :
  964: +  ac_cv_prog_cc_c99=$ac_arg
  965: +fi
  966: +rm -f core conftest.err conftest.$ac_objext
  967: +  test "x$ac_cv_prog_cc_c99" != "xno" && break
  968: +done
  969: +rm -f conftest.$ac_ext
  970: +CC=$ac_save_CC
  971: +
  972: +fi
  973: +# AC_CACHE_VAL
  974: +ac_prog_cc_stdc_options=
  975: +case "x$ac_cv_prog_cc_c99" in
  976: +  x)
  977: +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
  978: +$as_echo "none needed" >&6; } ;;
  979: +  xno)
  980: +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
  981: +$as_echo "unsupported" >&6; } ;;
  982: +  *)
  983: +    ac_prog_cc_stdc_options=" $ac_cv_prog_cc_c99"
  984: +    CC=$CC$ac_prog_cc_stdc_options
  985: +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
  986: +$as_echo "$ac_cv_prog_cc_c99" >&6; } ;;
  987: +esac
  988: +if test "x$ac_cv_prog_cc_c99" != xno; then :
  989: +  ac_prog_cc_stdc=c99
  990: +		    ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99
  991: +else
  992: +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5
  993: +$as_echo_n "checking for $CC option to enable C89 features... " >&6; }
  994:  if ${ac_cv_prog_cc_c89+:} false; then :
  995:    $as_echo_n "(cached) " >&6
  996:  else
  997: @@ -3692,6 +4198,7 @@ CC=$ac_save_CC
  998:  
  999:  fi
 1000:  # AC_CACHE_VAL
 1001: +ac_prog_cc_stdc_options=
 1002:  case "x$ac_cv_prog_cc_c89" in
 1003:    x)
 1004:      { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
 1005: @@ -3700,78 +4207,28 @@ $as_echo "none needed" >&6; } ;;
 1006:      { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
 1007:  $as_echo "unsupported" >&6; } ;;
 1008:    *)
 1009: -    CC="$CC $ac_cv_prog_cc_c89"
 1010: +    ac_prog_cc_stdc_options=" $ac_cv_prog_cc_c89"
 1011: +    CC=$CC$ac_prog_cc_stdc_options
 1012:      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
 1013:  $as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
 1014:  esac
 1015:  if test "x$ac_cv_prog_cc_c89" != xno; then :
 1016: -
 1017: -fi
 1018: -
 1019: -ac_ext=c
 1020: -ac_cpp='$CPP $CPPFLAGS'
 1021: -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 1022: -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 1023: -ac_compiler_gnu=$ac_cv_c_compiler_gnu
 1024: -
 1025: -ac_ext=c
 1026: -ac_cpp='$CPP $CPPFLAGS'
 1027: -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 1028: -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 1029: -ac_compiler_gnu=$ac_cv_c_compiler_gnu
 1030: -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
 1031: -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
 1032: -if ${am_cv_prog_cc_c_o+:} false; then :
 1033: -  $as_echo_n "(cached) " >&6
 1034: +  ac_prog_cc_stdc=c89
 1035: +		       ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89
 1036:  else
 1037: -  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 1038: -/* end confdefs.h.  */
 1039: +  ac_prog_cc_stdc=no
 1040: +		       ac_cv_prog_cc_stdc=no
 1041: +fi
 1042:  
 1043: -int
 1044: -main ()
 1045: -{
 1046: +fi
 1047:  
 1048: -  ;
 1049: -  return 0;
 1050: -}
 1051: -_ACEOF
 1052: -  # Make sure it works both with $CC and with simple cc.
 1053: -  # Following AC_PROG_CC_C_O, we do the test twice because some
 1054: -  # compilers refuse to overwrite an existing .o file with -o,
 1055: -  # though they will create one.
 1056: -  am_cv_prog_cc_c_o=yes
 1057: -  for am_i in 1 2; do
 1058: -    if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
 1059: -   ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
 1060: -   ac_status=$?
 1061: -   echo "$as_me:$LINENO: \$? = $ac_status" >&5
 1062: -   (exit $ac_status); } \
 1063: -         && test -f conftest2.$ac_objext; then
 1064: -      : OK
 1065: -    else
 1066: -      am_cv_prog_cc_c_o=no
 1067: -      break
 1068: -    fi
 1069: -  done
 1070: -  rm -f core conftest*
 1071: -  unset am_i
 1072: -fi
 1073: -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
 1074: -$as_echo "$am_cv_prog_cc_c_o" >&6; }
 1075: -if test "$am_cv_prog_cc_c_o" != yes; then
 1076: -   # Losing compiler, so override with the script.
 1077: -   # FIXME: It is wrong to rewrite CC.
 1078: -   # But if we don't then we get into trouble of one sort or another.
 1079: -   # A longer-term fix would be to have automake use am__CC in this case,
 1080: -   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
 1081: -   CC="$am_aux_dir/compile $CC"
 1082:  fi
 1083: +
 1084:  ac_ext=c
 1085:  ac_cpp='$CPP $CPPFLAGS'
 1086:  ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 1087:  ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 1088:  ac_compiler_gnu=$ac_cv_c_compiler_gnu
 1089: -
 1090:  DEPDIR="${am__leading_dot}deps"
 1091:  
 1092:  ac_config_commands="$ac_config_commands depfiles"
 1093: diff --git a/examples/Makefile.in b/examples/Makefile.in
 1094: index ee959d3..4f76f1f 100644
 1095: --- a/examples/Makefile.in
 1096: +++ b/examples/Makefile.in
 1097: @@ -95,7 +95,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/lib-ld.m4 \
 1098:  	$(top_srcdir)/m4/libsigsegv.m4 $(top_srcdir)/m4/libtool.m4 \
 1099:  	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
 1100:  	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
 1101: -	$(top_srcdir)/m4/readline.m4 $(top_srcdir)/configure.ac
 1102: +	$(top_srcdir)/m4/readline.m4 $(top_srcdir)/m4/std-gnu11.m4 \
 1103: +	$(top_srcdir)/configure.ac
 1104:  am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 1105:  	$(ACLOCAL_M4)
 1106:  DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 1107: diff --git a/libtool b/libtool
 1108: new file mode 100755
 1109: index 0000000..cf3cc51
 1110: --- /dev/null
 1111: +++ b/libtool
 1112: @@ -0,0 +1,11645 @@
 1113: +#! /bin/sh
 1114: +# Generated automatically by config.status (lac) 0.1.0
 1115: +# Libtool was configured on host work:
 1116: +# NOTE: Changes made to this file will be lost: look at ltmain.sh.
 1117: +
 1118: +# Provide generalized library-building support services.
 1119: +# Written by Gordon Matzigkeit, 1996
 1120: +
 1121: +# Copyright (C) 2014 Free Software Foundation, Inc.
 1122: +# This is free software; see the source for copying conditions.  There is NO
 1123: +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 1124: +
 1125: +# GNU Libtool is free software; you can redistribute it and/or modify
 1126: +# it under the terms of the GNU General Public License as published by
 1127: +# the Free Software Foundation; either version 2 of of the License, or
 1128: +# (at your option) any later version.
 1129: +#
 1130: +# As a special exception to the GNU General Public License, if you
 1131: +# distribute this file as part of a program or library that is built
 1132: +# using GNU Libtool, you may include this file under the  same
 1133: +# distribution terms that you use for the rest of that program.
 1134: +#
 1135: +# GNU Libtool is distributed in the hope that it will be useful, but
 1136: +# WITHOUT ANY WARRANTY; without even the implied warranty of
 1137: +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 1138: +# GNU General Public License for more details.
 1139: +#
 1140: +# You should have received a copy of the GNU General Public License
 1141: +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 1142: +
 1143: +
 1144: +# The names of the tagged configurations supported by this script.
 1145: +available_tags=''
 1146: +
 1147: +# Configured defaults for sys_lib_dlsearch_path munging.
 1148: +: ${LT_SYS_LIBRARY_PATH=""}
 1149: +
 1150: +# ### BEGIN LIBTOOL CONFIG
 1151: +
 1152: +# Which release of libtool.m4 was used?
 1153: +macro_version=2.4.6
 1154: +macro_revision=2.4.6
 1155: +
 1156: +# Whether or not to build shared libraries.
 1157: +build_libtool_libs=yes
 1158: +
 1159: +# Whether or not to build static libraries.
 1160: +build_old_libs=yes
 1161: +
 1162: +# What type of objects to build.
 1163: +pic_mode=default
 1164: +
 1165: +# Whether or not to optimize for fast installation.
 1166: +fast_install=yes
 1167: +
 1168: +# Shared archive member basename,for filename based shared library versioning on AIX.
 1169: +shared_archive_member_spec=
 1170: +
 1171: +# Shell to use when invoking shell scripts.
 1172: +SHELL="/bin/sh"
 1173: +
 1174: +# An echo program that protects backslashes.
 1175: +ECHO="printf %s\\n"
 1176: +
 1177: +# The PATH separator for the build system.
 1178: +PATH_SEPARATOR=":"
 1179: +
 1180: +# The host system.
 1181: +host_alias=
 1182: +host=x86_64-unknown-linux-gnu
 1183: +host_os=linux-gnu
 1184: +
 1185: +# The build system.
 1186: +build_alias=
 1187: +build=x86_64-unknown-linux-gnu
 1188: +build_os=linux-gnu
 1189: +
 1190: +# A sed program that does not truncate output.
 1191: +SED="/usr/bin/sed"
 1192: +
 1193: +# Sed that helps us avoid accidentally triggering echo(1) options like -n.
 1194: +Xsed="$SED -e 1s/^X//"
 1195: +
 1196: +# A grep program that handles long lines.
 1197: +GREP="/usr/bin/grep"
 1198: +
 1199: +# An ERE matcher.
 1200: +EGREP="/usr/bin/grep -E"
 1201: +
 1202: +# A literal string matcher.
 1203: +FGREP="/usr/bin/grep -F"
 1204: +
 1205: +# A BSD- or MS-compatible name lister.
 1206: +NM="/usr/bin/nm -B"
 1207: +
 1208: +# Whether we need soft or hard links.
 1209: +LN_S="ln -s"
 1210: +
 1211: +# What is the maximum length of a command?
 1212: +max_cmd_len=1572864
 1213: +
 1214: +# Object file suffix (normally "o").
 1215: +objext=o
 1216: +
 1217: +# Executable file suffix (normally "").
 1218: +exeext=
 1219: +
 1220: +# whether the shell understands "unset".
 1221: +lt_unset=unset
 1222: +
 1223: +# turn spaces into newlines.
 1224: +SP2NL="tr \\040 \\012"
 1225: +
 1226: +# turn newlines into spaces.
 1227: +NL2SP="tr \\015\\012 \\040\\040"
 1228: +
 1229: +# convert $build file names to $host format.
 1230: +to_host_file_cmd=func_convert_file_noop
 1231: +
 1232: +# convert $build files to toolchain format.
 1233: +to_tool_file_cmd=func_convert_file_noop
 1234: +
 1235: +# An object symbol dumper.
 1236: +OBJDUMP="objdump"
 1237: +
 1238: +# Method to check whether dependent libraries are shared objects.
 1239: +deplibs_check_method="pass_all"
 1240: +
 1241: +# Command to use when deplibs_check_method = "file_magic".
 1242: +file_magic_cmd="\$MAGIC_CMD"
 1243: +
 1244: +# How to find potential files when deplibs_check_method = "file_magic".
 1245: +file_magic_glob=""
 1246: +
 1247: +# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
 1248: +want_nocaseglob="no"
 1249: +
 1250: +# DLL creation program.
 1251: +DLLTOOL="false"
 1252: +
 1253: +# Command to associate shared and link libraries.
 1254: +sharedlib_from_linklib_cmd="printf %s\\n"
 1255: +
 1256: +# The archiver.
 1257: +AR="ar"
 1258: +
 1259: +# Flags to create an archive.
 1260: +AR_FLAGS="cru"
 1261: +
 1262: +# How to feed a file listing to the archiver.
 1263: +archiver_list_spec="@"
 1264: +
 1265: +# A symbol stripping program.
 1266: +STRIP="strip"
 1267: +
 1268: +# Commands used to install an old-style archive.
 1269: +RANLIB="ranlib"
 1270: +old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
 1271: +old_postuninstall_cmds=""
 1272: +
 1273: +# Whether to use a lock for old archive extraction.
 1274: +lock_old_archive_extraction=no
 1275: +
 1276: +# A C compiler.
 1277: +LTCC="gcc"
 1278: +
 1279: +# LTCC compiler flags.
 1280: +LTCFLAGS="-g -O2"
 1281: +
 1282: +# Take the output of nm and produce a listing of raw symbols and C names.
 1283: +global_symbol_pipe="sed -n -e 's/^.*[	 ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[	 ][	 ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
 1284: +
 1285: +# Transform the output of nm in a proper C declaration.
 1286: +global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
 1287: +
 1288: +# Transform the output of nm into a list of symbols to manually relocate.
 1289: +global_symbol_to_import=""
 1290: +
 1291: +# Transform the output of nm in a C name address pair.
 1292: +global_symbol_to_c_name_address="sed -n -e 's/^: \\(.*\\) .*\$/  {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/  {\"\\1\", (void *) \\&\\1},/p'"
 1293: +
 1294: +# Transform the output of nm in a C name address pair when lib prefix is needed.
 1295: +global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\(.*\\) .*\$/  {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(lib.*\\)\$/  {\"\\1\", (void *) \\&\\1},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/  {\"lib\\1\", (void *) \\&\\1},/p'"
 1296: +
 1297: +# The name lister interface.
 1298: +nm_interface="BSD nm"
 1299: +
 1300: +# Specify filename containing input files for $NM.
 1301: +nm_file_list_spec="@"
 1302: +
 1303: +# The root where to search for dependent libraries,and where our libraries should be installed.
 1304: +lt_sysroot=
 1305: +
 1306: +# Command to truncate a binary pipe.
 1307: +lt_truncate_bin="/usr/bin/dd bs=4096 count=1"
 1308: +
 1309: +# The name of the directory that contains temporary libtool files.
 1310: +objdir=.libs
 1311: +
 1312: +# Used to examine libraries when file_magic_cmd begins with "file".
 1313: +MAGIC_CMD=file
 1314: +
 1315: +# Must we lock files when doing compilation?
 1316: +need_locks="no"
 1317: +
 1318: +# Manifest tool.
 1319: +MANIFEST_TOOL=":"
 1320: +
 1321: +# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
 1322: +DSYMUTIL=""
 1323: +
 1324: +# Tool to change global to local symbols on Mac OS X.
 1325: +NMEDIT=""
 1326: +
 1327: +# Tool to manipulate fat objects and archives on Mac OS X.
 1328: +LIPO=""
 1329: +
 1330: +# ldd/readelf like tool for Mach-O binaries on Mac OS X.
 1331: +OTOOL=""
 1332: +
 1333: +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
 1334: +OTOOL64=""
 1335: +
 1336: +# Old archive suffix (normally "a").
 1337: +libext=a
 1338: +
 1339: +# Shared library suffix (normally ".so").
 1340: +shrext_cmds=".so"
 1341: +
 1342: +# The commands to extract the exported symbol list from a shared archive.
 1343: +extract_expsyms_cmds=""
 1344: +
 1345: +# Variables whose values should be saved in libtool wrapper scripts and
 1346: +# restored at link time.
 1347: +variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 1348: +
 1349: +# Do we need the "lib" prefix for modules?
 1350: +need_lib_prefix=no
 1351: +
 1352: +# Do we need a version for libraries?
 1353: +need_version=no
 1354: +
 1355: +# Library versioning type.
 1356: +version_type=linux
 1357: +
 1358: +# Shared library runtime path variable.
 1359: +runpath_var=LD_RUN_PATH
 1360: +
 1361: +# Shared library path variable.
 1362: +shlibpath_var=LD_LIBRARY_PATH
 1363: +
 1364: +# Is shlibpath searched before the hard-coded library search path?
 1365: +shlibpath_overrides_runpath=no
 1366: +
 1367: +# Format of library name prefix.
 1368: +libname_spec="lib\$name"
 1369: +
 1370: +# List of archive names.  First name is the real one, the rest are links.
 1371: +# The last name is the one that the linker finds with -lNAME
 1372: +library_names_spec="\$libname\$release\$shared_ext\$versuffix \$libname\$release\$shared_ext\$major \$libname\$shared_ext"
 1373: +
 1374: +# The coded name of the library, if different from the real name.
 1375: +soname_spec="\$libname\$release\$shared_ext\$major"
 1376: +
 1377: +# Permission mode override for installation of shared libraries.
 1378: +install_override_mode=""
 1379: +
 1380: +# Command to use after installation of a shared archive.
 1381: +postinstall_cmds=""
 1382: +
 1383: +# Command to use after uninstallation of a shared archive.
 1384: +postuninstall_cmds=""
 1385: +
 1386: +# Commands used to finish a libtool library installation in a directory.
 1387: +finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
 1388: +
 1389: +# As "finish_cmds", except a single script fragment to be evaled but
 1390: +# not shown.
 1391: +finish_eval=""
 1392: +
 1393: +# Whether we should hardcode library paths into libraries.
 1394: +hardcode_into_libs=yes
 1395: +
 1396: +# Compile-time system search path for libraries.
 1397: +sys_lib_search_path_spec="/usr/lib/gcc/x86_64-redhat-linux/5.3.1 /usr/lib64 /lib64 /usr/lib /lib "
 1398: +
 1399: +# Detected run-time system search path for libraries.
 1400: +sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib /usr/lib64/bind99 /usr/lib64/llvm "
 1401: +
 1402: +# Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
 1403: +configure_time_lt_sys_library_path=""
 1404: +
 1405: +# Whether dlopen is supported.
 1406: +dlopen_support=unknown
 1407: +
 1408: +# Whether dlopen of programs is supported.
 1409: +dlopen_self=unknown
 1410: +
 1411: +# Whether dlopen of statically linked programs is supported.
 1412: +dlopen_self_static=unknown
 1413: +
 1414: +# Commands to strip libraries.
 1415: +old_striplib="strip --strip-debug"
 1416: +striplib="strip --strip-unneeded"
 1417: +
 1418: +
 1419: +# The linker used to build libraries.
 1420: +LD="/usr/bin/ld -m elf_x86_64"
 1421: +
 1422: +# How to create reloadable object files.
 1423: +reload_flag=" -r"
 1424: +reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
 1425: +
 1426: +# Commands used to build an old-style archive.
 1427: +old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
 1428: +
 1429: +# A language specific compiler.
 1430: +CC="gcc"
 1431: +
 1432: +# Is the compiler the GNU compiler?
 1433: +with_gcc=yes
 1434: +
 1435: +# Compiler flag to turn off builtin functions.
 1436: +no_builtin_flag=" -fno-builtin"
 1437: +
 1438: +# Additional compiler flags for building library objects.
 1439: +pic_flag=" -fPIC -DPIC"
 1440: +
 1441: +# How to pass a linker flag through the compiler.
 1442: +wl="-Wl,"
 1443: +
 1444: +# Compiler flag to prevent dynamic linking.
 1445: +link_static_flag=""
 1446: +
 1447: +# Does compiler simultaneously support -c and -o options?
 1448: +compiler_c_o="yes"
 1449: +
 1450: +# Whether or not to add -lc for building shared libraries.
 1451: +build_libtool_need_lc=no
 1452: +
 1453: +# Whether or not to disallow shared libs when runtime libs are static.
 1454: +allow_libtool_libs_with_static_runtimes=no
 1455: +
 1456: +# Compiler flag to allow reflexive dlopens.
 1457: +export_dynamic_flag_spec="\$wl--export-dynamic"
 1458: +
 1459: +# Compiler flag to generate shared objects directly from archives.
 1460: +whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
 1461: +
 1462: +# Whether the compiler copes with passing no objects directly.
 1463: +compiler_needs_object="no"
 1464: +
 1465: +# Create an old-style archive from a shared archive.
 1466: +old_archive_from_new_cmds=""
 1467: +
 1468: +# Create a temporary old-style archive to link instead of a shared archive.
 1469: +old_archive_from_expsyms_cmds=""
 1470: +
 1471: +# Commands used to build a shared archive.
 1472: +archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
 1473: +archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
 1474: +            cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
 1475: +            echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
 1476: +            \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$output_objdir/\$libname.ver -o \$lib"
 1477: +
 1478: +# Commands used to build a loadable module if different from building
 1479: +# a shared archive.
 1480: +module_cmds=""
 1481: +module_expsym_cmds=""
 1482: +
 1483: +# Whether we are building with GNU ld or not.
 1484: +with_gnu_ld="yes"
 1485: +
 1486: +# Flag that allows shared libraries with undefined symbols to be built.
 1487: +allow_undefined_flag=""
 1488: +
 1489: +# Flag that enforces no undefined symbols.
 1490: +no_undefined_flag=""
 1491: +
 1492: +# Flag to hardcode $libdir into a binary during linking.
 1493: +# This must work even if $libdir does not exist
 1494: +hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir"
 1495: +
 1496: +# Whether we need a single "-rpath" flag with a separated argument.
 1497: +hardcode_libdir_separator=""
 1498: +
 1499: +# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
 1500: +# DIR into the resulting binary.
 1501: +hardcode_direct=no
 1502: +
 1503: +# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
 1504: +# DIR into the resulting binary and the resulting library dependency is
 1505: +# "absolute",i.e impossible to change by setting $shlibpath_var if the
 1506: +# library is relocated.
 1507: +hardcode_direct_absolute=no
 1508: +
 1509: +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
 1510: +# into the resulting binary.
 1511: +hardcode_minus_L=no
 1512: +
 1513: +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
 1514: +# into the resulting binary.
 1515: +hardcode_shlibpath_var=unsupported
 1516: +
 1517: +# Set to "yes" if building a shared library automatically hardcodes DIR
 1518: +# into the library and all subsequent libraries and executables linked
 1519: +# against it.
 1520: +hardcode_automatic=no
 1521: +
 1522: +# Set to yes if linker adds runtime paths of dependent libraries
 1523: +# to runtime path list.
 1524: +inherit_rpath=no
 1525: +
 1526: +# Whether libtool must link a program against all its dependency libraries.
 1527: +link_all_deplibs=unknown
 1528: +
 1529: +# Set to "yes" if exported symbols are required.
 1530: +always_export_symbols=no
 1531: +
 1532: +# The commands to list exported symbols.
 1533: +export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
 1534: +
 1535: +# Symbols that should not be listed in the preloaded symbols.
 1536: +exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
 1537: +
 1538: +# Symbols that must always be exported.
 1539: +include_expsyms=""
 1540: +
 1541: +# Commands necessary for linking programs (against libraries) with templates.
 1542: +prelink_cmds=""
 1543: +
 1544: +# Commands necessary for finishing linking programs.
 1545: +postlink_cmds=""
 1546: +
 1547: +# Specify filename containing input files.
 1548: +file_list_spec=""
 1549: +
 1550: +# How to hardcode a shared library path into an executable.
 1551: +hardcode_action=immediate
 1552: +
 1553: +# ### END LIBTOOL CONFIG
 1554: +
 1555: +
 1556: +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
 1557: +
 1558: +# func_munge_path_list VARIABLE PATH
 1559: +# -----------------------------------
 1560: +# VARIABLE is name of variable containing _space_ separated list of
 1561: +# directories to be munged by the contents of PATH, which is string
 1562: +# having a format:
 1563: +# "DIR[:DIR]:"
 1564: +#       string "DIR[ DIR]" will be prepended to VARIABLE
 1565: +# ":DIR[:DIR]"
 1566: +#       string "DIR[ DIR]" will be appended to VARIABLE
 1567: +# "DIRP[:DIRP]::[DIRA:]DIRA"
 1568: +#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
 1569: +#       "DIRA[ DIRA]" will be appended to VARIABLE
 1570: +# "DIR[:DIR]"
 1571: +#       VARIABLE will be replaced by "DIR[ DIR]"
 1572: +func_munge_path_list ()
 1573: +{
 1574: +    case x$2 in
 1575: +    x)
 1576: +        ;;
 1577: +    *:)
 1578: +        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
 1579: +        ;;
 1580: +    x:*)
 1581: +        eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
 1582: +        ;;
 1583: +    *::*)
 1584: +        eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
 1585: +        eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
 1586: +        ;;
 1587: +    *)
 1588: +        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
 1589: +        ;;
 1590: +    esac
 1591: +}
 1592: +
 1593: +
 1594: +# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
 1595: +func_cc_basename ()
 1596: +{
 1597: +    for cc_temp in $*""; do
 1598: +      case $cc_temp in
 1599: +        compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
 1600: +        distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
 1601: +        \-*) ;;
 1602: +        *) break;;
 1603: +      esac
 1604: +    done
 1605: +    func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
 1606: +}
 1607: +
 1608: +
 1609: +# ### END FUNCTIONS SHARED WITH CONFIGURE
 1610: +
 1611: +#! /bin/sh
 1612: +## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
 1613: +##               by inline-source v2014-01-03.01
 1614: +
 1615: +# libtool (GNU libtool) 2.4.6
 1616: +# Provide generalized library-building support services.
 1617: +# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 1618: +
 1619: +# Copyright (C) 1996-2015 Free Software Foundation, Inc.
 1620: +# This is free software; see the source for copying conditions.  There is NO
 1621: +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 1622: +
 1623: +# GNU Libtool is free software; you can redistribute it and/or modify
 1624: +# it under the terms of the GNU General Public License as published by
 1625: +# the Free Software Foundation; either version 2 of the License, or
 1626: +# (at your option) any later version.
 1627: +#
 1628: +# As a special exception to the GNU General Public License,
 1629: +# if you distribute this file as part of a program or library that
 1630: +# is built using GNU Libtool, you may include this file under the
 1631: +# same distribution terms that you use for the rest of that program.
 1632: +#
 1633: +# GNU Libtool is distributed in the hope that it will be useful, but
 1634: +# WITHOUT ANY WARRANTY; without even the implied warranty of
 1635: +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 1636: +# General Public License for more details.
 1637: +#
 1638: +# You should have received a copy of the GNU General Public License
 1639: +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 1640: +
 1641: +
 1642: +PROGRAM=libtool
 1643: +PACKAGE=libtool
 1644: +VERSION=2.4.6
 1645: +package_revision=2.4.6
 1646: +
 1647: +
 1648: +## ------ ##
 1649: +## Usage. ##
 1650: +## ------ ##
 1651: +
 1652: +# Run './libtool --help' for help with using this script from the
 1653: +# command line.
 1654: +
 1655: +
 1656: +## ------------------------------- ##
 1657: +## User overridable command paths. ##
 1658: +## ------------------------------- ##
 1659: +
 1660: +# After configure completes, it has a better idea of some of the
 1661: +# shell tools we need than the defaults used by the functions shared
 1662: +# with bootstrap, so set those here where they can still be over-
 1663: +# ridden by the user, but otherwise take precedence.
 1664: +
 1665: +: ${AUTOCONF="autoconf"}
 1666: +: ${AUTOMAKE="automake"}
 1667: +
 1668: +
 1669: +## -------------------------- ##
 1670: +## Source external libraries. ##
 1671: +## -------------------------- ##
 1672: +
 1673: +# Much of our low-level functionality needs to be sourced from external
 1674: +# libraries, which are installed to $pkgauxdir.
 1675: +
 1676: +# Set a version string for this script.
 1677: +scriptversion=2015-01-20.17; # UTC
 1678: +
 1679: +# General shell script boiler plate, and helper functions.
 1680: +# Written by Gary V. Vaughan, 2004
 1681: +
 1682: +# Copyright (C) 2004-2015 Free Software Foundation, Inc.
 1683: +# This is free software; see the source for copying conditions.  There is NO
 1684: +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 1685: +
 1686: +# This program is free software; you can redistribute it and/or modify
 1687: +# it under the terms of the GNU General Public License as published by
 1688: +# the Free Software Foundation; either version 3 of the License, or
 1689: +# (at your option) any later version.
 1690: +
 1691: +# As a special exception to the GNU General Public License, if you distribute
 1692: +# this file as part of a program or library that is built using GNU Libtool,
 1693: +# you may include this file under the same distribution terms that you use
 1694: +# for the rest of that program.
 1695: +
 1696: +# This program is distributed in the hope that it will be useful,
 1697: +# but WITHOUT ANY WARRANTY; without even the implied warranty of
 1698: +# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
 1699: +# General Public License for more details.
 1700: +
 1701: +# You should have received a copy of the GNU General Public License
 1702: +# along with this program. If not, see <http://www.gnu.org/licenses/>.
 1703: +
 1704: +# Please report bugs or propose patches to gary@gnu.org.
 1705: +
 1706: +
 1707: +## ------ ##
 1708: +## Usage. ##
 1709: +## ------ ##
 1710: +
 1711: +# Evaluate this file near the top of your script to gain access to
 1712: +# the functions and variables defined here:
 1713: +#
 1714: +#   . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
 1715: +#
 1716: +# If you need to override any of the default environment variable
 1717: +# settings, do that before evaluating this file.
 1718: +
 1719: +
 1720: +## -------------------- ##
 1721: +## Shell normalisation. ##
 1722: +## -------------------- ##
 1723: +
 1724: +# Some shells need a little help to be as Bourne compatible as possible.
 1725: +# Before doing anything else, make sure all that help has been provided!
 1726: +
 1727: +DUALCASE=1; export DUALCASE # for MKS sh
 1728: +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
 1729: +  emulate sh
 1730: +  NULLCMD=:
 1731: +  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
 1732: +  # is contrary to our usage.  Disable this feature.
 1733: +  alias -g '${1+"$@"}'='"$@"'
 1734: +  setopt NO_GLOB_SUBST
 1735: +else
 1736: +  case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
 1737: +fi
 1738: +
 1739: +# NLS nuisances: We save the old values in case they are required later.
 1740: +_G_user_locale=
 1741: +_G_safe_locale=
 1742: +for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
 1743: +do
 1744: +  eval "if test set = \"\${$_G_var+set}\"; then
 1745: +          save_$_G_var=\$$_G_var
 1746: +          $_G_var=C
 1747: +	  export $_G_var
 1748: +	  _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
 1749: +	  _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
 1750: +	fi"
 1751: +done
 1752: +
 1753: +# CDPATH.
 1754: +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 1755: +
 1756: +# Make sure IFS has a sensible default
 1757: +sp=' '
 1758: +nl='
 1759: +'
 1760: +IFS="$sp	$nl"
 1761: +
 1762: +# There are apparently some retarded systems that use ';' as a PATH separator!
 1763: +if test "${PATH_SEPARATOR+set}" != set; then
 1764: +  PATH_SEPARATOR=:
 1765: +  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
 1766: +    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
 1767: +      PATH_SEPARATOR=';'
 1768: +  }
 1769: +fi
 1770: +
 1771: +
 1772: +
 1773: +## ------------------------- ##
 1774: +## Locate command utilities. ##
 1775: +## ------------------------- ##
 1776: +
 1777: +
 1778: +# func_executable_p FILE
 1779: +# ----------------------
 1780: +# Check that FILE is an executable regular file.
 1781: +func_executable_p ()
 1782: +{
 1783: +    test -f "$1" && test -x "$1"
 1784: +}
 1785: +
 1786: +
 1787: +# func_path_progs PROGS_LIST CHECK_FUNC [PATH]
 1788: +# --------------------------------------------
 1789: +# Search for either a program that responds to --version with output
 1790: +# containing "GNU", or else returned by CHECK_FUNC otherwise, by
 1791: +# trying all the directories in PATH with each of the elements of
 1792: +# PROGS_LIST.
 1793: +#
 1794: +# CHECK_FUNC should accept the path to a candidate program, and
 1795: +# set $func_check_prog_result if it truncates its output less than
 1796: +# $_G_path_prog_max characters.
 1797: +func_path_progs ()
 1798: +{
 1799: +    _G_progs_list=$1
 1800: +    _G_check_func=$2
 1801: +    _G_PATH=${3-"$PATH"}
 1802: +
 1803: +    _G_path_prog_max=0
 1804: +    _G_path_prog_found=false
 1805: +    _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
 1806: +    for _G_dir in $_G_PATH; do
 1807: +      IFS=$_G_save_IFS
 1808: +      test -z "$_G_dir" && _G_dir=.
 1809: +      for _G_prog_name in $_G_progs_list; do
 1810: +        for _exeext in '' .EXE; do
 1811: +          _G_path_prog=$_G_dir/$_G_prog_name$_exeext
 1812: +          func_executable_p "$_G_path_prog" || continue
 1813: +          case `"$_G_path_prog" --version 2>&1` in
 1814: +            *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
 1815: +            *)     $_G_check_func $_G_path_prog
 1816: +		   func_path_progs_result=$func_check_prog_result
 1817: +		   ;;
 1818: +          esac
 1819: +          $_G_path_prog_found && break 3
 1820: +        done
 1821: +      done
 1822: +    done
 1823: +    IFS=$_G_save_IFS
 1824: +    test -z "$func_path_progs_result" && {
 1825: +      echo "no acceptable sed could be found in \$PATH" >&2
 1826: +      exit 1
 1827: +    }
 1828: +}
 1829: +
 1830: +
 1831: +# We want to be able to use the functions in this file before configure
 1832: +# has figured out where the best binaries are kept, which means we have
 1833: +# to search for them ourselves - except when the results are already set
 1834: +# where we skip the searches.
 1835: +
 1836: +# Unless the user overrides by setting SED, search the path for either GNU
 1837: +# sed, or the sed that truncates its output the least.
 1838: +test -z "$SED" && {
 1839: +  _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
 1840: +  for _G_i in 1 2 3 4 5 6 7; do
 1841: +    _G_sed_script=$_G_sed_script$nl$_G_sed_script
 1842: +  done
 1843: +  echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
 1844: +  _G_sed_script=
 1845: +
 1846: +  func_check_prog_sed ()
 1847: +  {
 1848: +    _G_path_prog=$1
 1849: +
 1850: +    _G_count=0
 1851: +    printf 0123456789 >conftest.in
 1852: +    while :
 1853: +    do
 1854: +      cat conftest.in conftest.in >conftest.tmp
 1855: +      mv conftest.tmp conftest.in
 1856: +      cp conftest.in conftest.nl
 1857: +      echo '' >> conftest.nl
 1858: +      "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
 1859: +      diff conftest.out conftest.nl >/dev/null 2>&1 || break
 1860: +      _G_count=`expr $_G_count + 1`
 1861: +      if test "$_G_count" -gt "$_G_path_prog_max"; then
 1862: +        # Best one so far, save it but keep looking for a better one
 1863: +        func_check_prog_result=$_G_path_prog
 1864: +        _G_path_prog_max=$_G_count
 1865: +      fi
 1866: +      # 10*(2^10) chars as input seems more than enough
 1867: +      test 10 -lt "$_G_count" && break
 1868: +    done
 1869: +    rm -f conftest.in conftest.tmp conftest.nl conftest.out
 1870: +  }
 1871: +
 1872: +  func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
 1873: +  rm -f conftest.sed
 1874: +  SED=$func_path_progs_result
 1875: +}
 1876: +
 1877: +
 1878: +# Unless the user overrides by setting GREP, search the path for either GNU
 1879: +# grep, or the grep that truncates its output the least.
 1880: +test -z "$GREP" && {
 1881: +  func_check_prog_grep ()
 1882: +  {
 1883: +    _G_path_prog=$1
 1884: +
 1885: +    _G_count=0
 1886: +    _G_path_prog_max=0
 1887: +    printf 0123456789 >conftest.in
 1888: +    while :
 1889: +    do
 1890: +      cat conftest.in conftest.in >conftest.tmp
 1891: +      mv conftest.tmp conftest.in
 1892: +      cp conftest.in conftest.nl
 1893: +      echo 'GREP' >> conftest.nl
 1894: +      "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
 1895: +      diff conftest.out conftest.nl >/dev/null 2>&1 || break
 1896: +      _G_count=`expr $_G_count + 1`
 1897: +      if test "$_G_count" -gt "$_G_path_prog_max"; then
 1898: +        # Best one so far, save it but keep looking for a better one
 1899: +        func_check_prog_result=$_G_path_prog
 1900: +        _G_path_prog_max=$_G_count
 1901: +      fi
 1902: +      # 10*(2^10) chars as input seems more than enough
 1903: +      test 10 -lt "$_G_count" && break
 1904: +    done
 1905: +    rm -f conftest.in conftest.tmp conftest.nl conftest.out
 1906: +  }
 1907: +
 1908: +  func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
 1909: +  GREP=$func_path_progs_result
 1910: +}
 1911: +
 1912: +
 1913: +## ------------------------------- ##
 1914: +## User overridable command paths. ##
 1915: +## ------------------------------- ##
 1916: +
 1917: +# All uppercase variable names are used for environment variables.  These
 1918: +# variables can be overridden by the user before calling a script that
 1919: +# uses them if a suitable command of that name is not already available
 1920: +# in the command search PATH.
 1921: +
 1922: +: ${CP="cp -f"}
 1923: +: ${ECHO="printf %s\n"}
 1924: +: ${EGREP="$GREP -E"}
 1925: +: ${FGREP="$GREP -F"}
 1926: +: ${LN_S="ln -s"}
 1927: +: ${MAKE="make"}
 1928: +: ${MKDIR="mkdir"}
 1929: +: ${MV="mv -f"}
 1930: +: ${RM="rm -f"}
 1931: +: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
 1932: +
 1933: +
 1934: +## -------------------- ##
 1935: +## Useful sed snippets. ##
 1936: +## -------------------- ##
 1937: +
 1938: +sed_dirname='s|/[^/]*$||'
 1939: +sed_basename='s|^.*/||'
 1940: +
 1941: +# Sed substitution that helps us do robust quoting.  It backslashifies
 1942: +# metacharacters that are still active within double-quoted strings.
 1943: +sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
 1944: +
 1945: +# Same as above, but do not quote variable references.
 1946: +sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
 1947: +
 1948: +# Sed substitution that turns a string into a regex matching for the
 1949: +# string literally.
 1950: +sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
 1951: +
 1952: +# Sed substitution that converts a w32 file name or path
 1953: +# that contains forward slashes, into one that contains
 1954: +# (escaped) backslashes.  A very naive implementation.
 1955: +sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
 1956: +
 1957: +# Re-'\' parameter expansions in output of sed_double_quote_subst that
 1958: +# were '\'-ed in input to the same.  If an odd number of '\' preceded a
 1959: +# '$' in input to sed_double_quote_subst, that '$' was protected from
 1960: +# expansion.  Since each input '\' is now two '\'s, look for any number
 1961: +# of runs of four '\'s followed by two '\'s and then a '$'.  '\' that '$'.
 1962: +_G_bs='\\'
 1963: +_G_bs2='\\\\'
 1964: +_G_bs4='\\\\\\\\'
 1965: +_G_dollar='\$'
 1966: +sed_double_backslash="\
 1967: +  s/$_G_bs4/&\\
 1968: +/g
 1969: +  s/^$_G_bs2$_G_dollar/$_G_bs&/
 1970: +  s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
 1971: +  s/\n//g"
 1972: +
 1973: +
 1974: +## ----------------- ##
 1975: +## Global variables. ##
 1976: +## ----------------- ##
 1977: +
 1978: +# Except for the global variables explicitly listed below, the following
 1979: +# functions in the '^func_' namespace, and the '^require_' namespace
 1980: +# variables initialised in the 'Resource management' section, sourcing
 1981: +# this file will not pollute your global namespace with anything
 1982: +# else. There's no portable way to scope variables in Bourne shell
 1983: +# though, so actually running these functions will sometimes place
 1984: +# results into a variable named after the function, and often use
 1985: +# temporary variables in the '^_G_' namespace. If you are careful to
 1986: +# avoid using those namespaces casually in your sourcing script, things
 1987: +# should continue to work as you expect. And, of course, you can freely
 1988: +# overwrite any of the functions or variables defined here before
 1989: +# calling anything to customize them.
 1990: +
 1991: +EXIT_SUCCESS=0
 1992: +EXIT_FAILURE=1
 1993: +EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
 1994: +EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
 1995: +
 1996: +# Allow overriding, eg assuming that you follow the convention of
 1997: +# putting '$debug_cmd' at the start of all your functions, you can get
 1998: +# bash to show function call trace with:
 1999: +#
 2000: +#    debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
 2001: +debug_cmd=${debug_cmd-":"}
 2002: +exit_cmd=:
 2003: +
 2004: +# By convention, finish your script with:
 2005: +#
 2006: +#    exit $exit_status
 2007: +#
 2008: +# so that you can set exit_status to non-zero if you want to indicate
 2009: +# something went wrong during execution without actually bailing out at
 2010: +# the point of failure.
 2011: +exit_status=$EXIT_SUCCESS
 2012: +
 2013: +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
 2014: +# is ksh but when the shell is invoked as "sh" and the current value of
 2015: +# the _XPG environment variable is not equal to 1 (one), the special
 2016: +# positional parameter $0, within a function call, is the name of the
 2017: +# function.
 2018: +progpath=$0
 2019: +
 2020: +# The name of this program.
 2021: +progname=`$ECHO "$progpath" |$SED "$sed_basename"`
 2022: +
 2023: +# Make sure we have an absolute progpath for reexecution:
 2024: +case $progpath in
 2025: +  [\\/]*|[A-Za-z]:\\*) ;;
 2026: +  *[\\/]*)
 2027: +     progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
 2028: +     progdir=`cd "$progdir" && pwd`
 2029: +     progpath=$progdir/$progname
 2030: +     ;;
 2031: +  *)
 2032: +     _G_IFS=$IFS
 2033: +     IFS=${PATH_SEPARATOR-:}
 2034: +     for progdir in $PATH; do
 2035: +       IFS=$_G_IFS
 2036: +       test -x "$progdir/$progname" && break
 2037: +     done
 2038: +     IFS=$_G_IFS
 2039: +     test -n "$progdir" || progdir=`pwd`
 2040: +     progpath=$progdir/$progname
 2041: +     ;;
 2042: +esac
 2043: +
 2044: +
 2045: +## ----------------- ##
 2046: +## Standard options. ##
 2047: +## ----------------- ##
 2048: +
 2049: +# The following options affect the operation of the functions defined
 2050: +# below, and should be set appropriately depending on run-time para-
 2051: +# meters passed on the command line.
 2052: +
 2053: +opt_dry_run=false
 2054: +opt_quiet=false
 2055: +opt_verbose=false
 2056: +
 2057: +# Categories 'all' and 'none' are always available.  Append any others
 2058: +# you will pass as the first argument to func_warning from your own
 2059: +# code.
 2060: +warning_categories=
 2061: +
 2062: +# By default, display warnings according to 'opt_warning_types'.  Set
 2063: +# 'warning_func'  to ':' to elide all warnings, or func_fatal_error to
 2064: +# treat the next displayed warning as a fatal error.
 2065: +warning_func=func_warn_and_continue
 2066: +
 2067: +# Set to 'all' to display all warnings, 'none' to suppress all
 2068: +# warnings, or a space delimited list of some subset of
 2069: +# 'warning_categories' to display only the listed warnings.
 2070: +opt_warning_types=all
 2071: +
 2072: +
 2073: +## -------------------- ##
 2074: +## Resource management. ##
 2075: +## -------------------- ##
 2076: +
 2077: +# This section contains definitions for functions that each ensure a
 2078: +# particular resource (a file, or a non-empty configuration variable for
 2079: +# example) is available, and if appropriate to extract default values
 2080: +# from pertinent package files. Call them using their associated
 2081: +# 'require_*' variable to ensure that they are executed, at most, once.
 2082: +#
 2083: +# It's entirely deliberate that calling these functions can set
 2084: +# variables that don't obey the namespace limitations obeyed by the rest
 2085: +# of this file, in order that that they be as useful as possible to
 2086: +# callers.
 2087: +
 2088: +
 2089: +# require_term_colors
 2090: +# -------------------
 2091: +# Allow display of bold text on terminals that support it.
 2092: +require_term_colors=func_require_term_colors
 2093: +func_require_term_colors ()
 2094: +{
 2095: +    $debug_cmd
 2096: +
 2097: +    test -t 1 && {
 2098: +      # COLORTERM and USE_ANSI_COLORS environment variables take
 2099: +      # precedence, because most terminfo databases neglect to describe
 2100: +      # whether color sequences are supported.
 2101: +      test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
 2102: +
 2103: +      if test 1 = "$USE_ANSI_COLORS"; then
 2104: +        # Standard ANSI escape sequences
 2105: +        tc_reset=''
 2106: +        tc_bold='';   tc_standout=''
 2107: +        tc_red='';   tc_green=''
 2108: +        tc_blue='';  tc_cyan=''
 2109: +      else
 2110: +        # Otherwise trust the terminfo database after all.
 2111: +        test -n "`tput sgr0 2>/dev/null`" && {
 2112: +          tc_reset=`tput sgr0`
 2113: +          test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
 2114: +          tc_standout=$tc_bold
 2115: +          test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
 2116: +          test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
 2117: +          test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
 2118: +          test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
 2119: +          test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
 2120: +        }
 2121: +      fi
 2122: +    }
 2123: +
 2124: +    require_term_colors=:
 2125: +}
 2126: +
 2127: +
 2128: +## ----------------- ##
 2129: +## Function library. ##
 2130: +## ----------------- ##
 2131: +
 2132: +# This section contains a variety of useful functions to call in your
 2133: +# scripts. Take note of the portable wrappers for features provided by
 2134: +# some modern shells, which will fall back to slower equivalents on
 2135: +# less featureful shells.
 2136: +
 2137: +
 2138: +# func_append VAR VALUE
 2139: +# ---------------------
 2140: +# Append VALUE onto the existing contents of VAR.
 2141: +
 2142: +  # We should try to minimise forks, especially on Windows where they are
 2143: +  # unreasonably slow, so skip the feature probes when bash or zsh are
 2144: +  # being used:
 2145: +  if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
 2146: +    : ${_G_HAVE_ARITH_OP="yes"}
 2147: +    : ${_G_HAVE_XSI_OPS="yes"}
 2148: +    # The += operator was introduced in bash 3.1
 2149: +    case $BASH_VERSION in
 2150: +      [12].* | 3.0 | 3.0*) ;;
 2151: +      *)
 2152: +        : ${_G_HAVE_PLUSEQ_OP="yes"}
 2153: +        ;;
 2154: +    esac
 2155: +  fi
 2156: +
 2157: +  # _G_HAVE_PLUSEQ_OP
 2158: +  # Can be empty, in which case the shell is probed, "yes" if += is
 2159: +  # useable or anything else if it does not work.
 2160: +  test -z "$_G_HAVE_PLUSEQ_OP" \
 2161: +    && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
 2162: +    && _G_HAVE_PLUSEQ_OP=yes
 2163: +
 2164: +if test yes = "$_G_HAVE_PLUSEQ_OP"
 2165: +then
 2166: +  # This is an XSI compatible shell, allowing a faster implementation...
 2167: +  eval 'func_append ()
 2168: +  {
 2169: +    $debug_cmd
 2170: +
 2171: +    eval "$1+=\$2"
 2172: +  }'
 2173: +else
 2174: +  # ...otherwise fall back to using expr, which is often a shell builtin.
 2175: +  func_append ()
 2176: +  {
 2177: +    $debug_cmd
 2178: +
 2179: +    eval "$1=\$$1\$2"
 2180: +  }
 2181: +fi
 2182: +
 2183: +
 2184: +# func_append_quoted VAR VALUE
 2185: +# ----------------------------
 2186: +# Quote VALUE and append to the end of shell variable VAR, separated
 2187: +# by a space.
 2188: +if test yes = "$_G_HAVE_PLUSEQ_OP"; then
 2189: +  eval 'func_append_quoted ()
 2190: +  {
 2191: +    $debug_cmd
 2192: +
 2193: +    func_quote_for_eval "$2"
 2194: +    eval "$1+=\\ \$func_quote_for_eval_result"
 2195: +  }'
 2196: +else
 2197: +  func_append_quoted ()
 2198: +  {
 2199: +    $debug_cmd
 2200: +
 2201: +    func_quote_for_eval "$2"
 2202: +    eval "$1=\$$1\\ \$func_quote_for_eval_result"
 2203: +  }
 2204: +fi
 2205: +
 2206: +
 2207: +# func_append_uniq VAR VALUE
 2208: +# --------------------------
 2209: +# Append unique VALUE onto the existing contents of VAR, assuming
 2210: +# entries are delimited by the first character of VALUE.  For example:
 2211: +#
 2212: +#   func_append_uniq options " --another-option option-argument"
 2213: +#
 2214: +# will only append to $options if " --another-option option-argument "
 2215: +# is not already present somewhere in $options already (note spaces at
 2216: +# each end implied by leading space in second argument).
 2217: +func_append_uniq ()
 2218: +{
 2219: +    $debug_cmd
 2220: +
 2221: +    eval _G_current_value='`$ECHO $'$1'`'
 2222: +    _G_delim=`expr "$2" : '\(.\)'`
 2223: +
 2224: +    case $_G_delim$_G_current_value$_G_delim in
 2225: +      *"$2$_G_delim"*) ;;
 2226: +      *) func_append "$@" ;;
 2227: +    esac
 2228: +}
 2229: +
 2230: +
 2231: +# func_arith TERM...
 2232: +# ------------------
 2233: +# Set func_arith_result to the result of evaluating TERMs.
 2234: +  test -z "$_G_HAVE_ARITH_OP" \
 2235: +    && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
 2236: +    && _G_HAVE_ARITH_OP=yes
 2237: +
 2238: +if test yes = "$_G_HAVE_ARITH_OP"; then
 2239: +  eval 'func_arith ()
 2240: +  {
 2241: +    $debug_cmd
 2242: +
 2243: +    func_arith_result=$(( $* ))
 2244: +  }'
 2245: +else
 2246: +  func_arith ()
 2247: +  {
 2248: +    $debug_cmd
 2249: +
 2250: +    func_arith_result=`expr "$@"`
 2251: +  }
 2252: +fi
 2253: +
 2254: +
 2255: +# func_basename FILE
 2256: +# ------------------
 2257: +# Set func_basename_result to FILE with everything up to and including
 2258: +# the last / stripped.
 2259: +if test yes = "$_G_HAVE_XSI_OPS"; then
 2260: +  # If this shell supports suffix pattern removal, then use it to avoid
 2261: +  # forking. Hide the definitions single quotes in case the shell chokes
 2262: +  # on unsupported syntax...
 2263: +  _b='func_basename_result=${1##*/}'
 2264: +  _d='case $1 in
 2265: +        */*) func_dirname_result=${1%/*}$2 ;;
 2266: +        *  ) func_dirname_result=$3        ;;
 2267: +      esac'
 2268: +
 2269: +else
 2270: +  # ...otherwise fall back to using sed.
 2271: +  _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
 2272: +  _d='func_dirname_result=`$ECHO "$1"  |$SED "$sed_dirname"`
 2273: +      if test "X$func_dirname_result" = "X$1"; then
 2274: +        func_dirname_result=$3
 2275: +      else
 2276: +        func_append func_dirname_result "$2"
 2277: +      fi'
 2278: +fi
 2279: +
 2280: +eval 'func_basename ()
 2281: +{
 2282: +    $debug_cmd
 2283: +
 2284: +    '"$_b"'
 2285: +}'
 2286: +
 2287: +
 2288: +# func_dirname FILE APPEND NONDIR_REPLACEMENT
 2289: +# -------------------------------------------
 2290: +# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
 2291: +# otherwise set result to NONDIR_REPLACEMENT.
 2292: +eval 'func_dirname ()
 2293: +{
 2294: +    $debug_cmd
 2295: +
 2296: +    '"$_d"'
 2297: +}'
 2298: +
 2299: +
 2300: +# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
 2301: +# --------------------------------------------------------
 2302: +# Perform func_basename and func_dirname in a single function
 2303: +# call:
 2304: +#   dirname:  Compute the dirname of FILE.  If nonempty,
 2305: +#             add APPEND to the result, otherwise set result
 2306: +#             to NONDIR_REPLACEMENT.
 2307: +#             value returned in "$func_dirname_result"
 2308: +#   basename: Compute filename of FILE.
 2309: +#             value retuned in "$func_basename_result"
 2310: +# For efficiency, we do not delegate to the functions above but instead
 2311: +# duplicate the functionality here.
 2312: +eval 'func_dirname_and_basename ()
 2313: +{
 2314: +    $debug_cmd
 2315: +
 2316: +    '"$_b"'
 2317: +    '"$_d"'
 2318: +}'
 2319: +
 2320: +
 2321: +# func_echo ARG...
 2322: +# ----------------
 2323: +# Echo program name prefixed message.
 2324: +func_echo ()
 2325: +{
 2326: +    $debug_cmd
 2327: +
 2328: +    _G_message=$*
 2329: +
 2330: +    func_echo_IFS=$IFS
 2331: +    IFS=$nl
 2332: +    for _G_line in $_G_message; do
 2333: +      IFS=$func_echo_IFS
 2334: +      $ECHO "$progname: $_G_line"
 2335: +    done
 2336: +    IFS=$func_echo_IFS
 2337: +}
 2338: +
 2339: +
 2340: +# func_echo_all ARG...
 2341: +# --------------------
 2342: +# Invoke $ECHO with all args, space-separated.
 2343: +func_echo_all ()
 2344: +{
 2345: +    $ECHO "$*"
 2346: +}
 2347: +
 2348: +
 2349: +# func_echo_infix_1 INFIX ARG...
 2350: +# ------------------------------
 2351: +# Echo program name, followed by INFIX on the first line, with any
 2352: +# additional lines not showing INFIX.
 2353: +func_echo_infix_1 ()
 2354: +{
 2355: +    $debug_cmd
 2356: +
 2357: +    $require_term_colors
 2358: +
 2359: +    _G_infix=$1; shift
 2360: +    _G_indent=$_G_infix
 2361: +    _G_prefix="$progname: $_G_infix: "
 2362: +    _G_message=$*
 2363: +
 2364: +    # Strip color escape sequences before counting printable length
 2365: +    for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
 2366: +    do
 2367: +      test -n "$_G_tc" && {
 2368: +        _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
 2369: +        _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
 2370: +      }
 2371: +    done
 2372: +    _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
 2373: +
 2374: +    func_echo_infix_1_IFS=$IFS
 2375: +    IFS=$nl
 2376: +    for _G_line in $_G_message; do
 2377: +      IFS=$func_echo_infix_1_IFS
 2378: +      $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
 2379: +      _G_prefix=$_G_indent
 2380: +    done
 2381: +    IFS=$func_echo_infix_1_IFS
 2382: +}
 2383: +
 2384: +
 2385: +# func_error ARG...
 2386: +# -----------------
 2387: +# Echo program name prefixed message to standard error.
 2388: +func_error ()
 2389: +{
 2390: +    $debug_cmd
 2391: +
 2392: +    $require_term_colors
 2393: +
 2394: +    func_echo_infix_1 "  $tc_standout${tc_red}error$tc_reset" "$*" >&2
 2395: +}
 2396: +
 2397: +
 2398: +# func_fatal_error ARG...
 2399: +# -----------------------
 2400: +# Echo program name prefixed message to standard error, and exit.
 2401: +func_fatal_error ()
 2402: +{
 2403: +    $debug_cmd
 2404: +
 2405: +    func_error "$*"
 2406: +    exit $EXIT_FAILURE
 2407: +}
 2408: +
 2409: +
 2410: +# func_grep EXPRESSION FILENAME
 2411: +# -----------------------------
 2412: +# Check whether EXPRESSION matches any line of FILENAME, without output.
 2413: +func_grep ()
 2414: +{
 2415: +    $debug_cmd
 2416: +
 2417: +    $GREP "$1" "$2" >/dev/null 2>&1
 2418: +}
 2419: +
 2420: +
 2421: +# func_len STRING
 2422: +# ---------------
 2423: +# Set func_len_result to the length of STRING. STRING may not
 2424: +# start with a hyphen.
 2425: +  test -z "$_G_HAVE_XSI_OPS" \
 2426: +    && (eval 'x=a/b/c;
 2427: +      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
 2428: +    && _G_HAVE_XSI_OPS=yes
 2429: +
 2430: +if test yes = "$_G_HAVE_XSI_OPS"; then
 2431: +  eval 'func_len ()
 2432: +  {
 2433: +    $debug_cmd
 2434: +
 2435: +    func_len_result=${#1}
 2436: +  }'
 2437: +else
 2438: +  func_len ()
 2439: +  {
 2440: +    $debug_cmd
 2441: +
 2442: +    func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
 2443: +  }
 2444: +fi
 2445: +
 2446: +
 2447: +# func_mkdir_p DIRECTORY-PATH
 2448: +# ---------------------------
 2449: +# Make sure the entire path to DIRECTORY-PATH is available.
 2450: +func_mkdir_p ()
 2451: +{
 2452: +    $debug_cmd
 2453: +
 2454: +    _G_directory_path=$1
 2455: +    _G_dir_list=
 2456: +
 2457: +    if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
 2458: +
 2459: +      # Protect directory names starting with '-'
 2460: +      case $_G_directory_path in
 2461: +        -*) _G_directory_path=./$_G_directory_path ;;
 2462: +      esac
 2463: +
 2464: +      # While some portion of DIR does not yet exist...
 2465: +      while test ! -d "$_G_directory_path"; do
 2466: +        # ...make a list in topmost first order.  Use a colon delimited
 2467: +	# list incase some portion of path contains whitespace.
 2468: +        _G_dir_list=$_G_directory_path:$_G_dir_list
 2469: +
 2470: +        # If the last portion added has no slash in it, the list is done
 2471: +        case $_G_directory_path in */*) ;; *) break ;; esac
 2472: +
 2473: +        # ...otherwise throw away the child directory and loop
 2474: +        _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
 2475: +      done
 2476: +      _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
 2477: +
 2478: +      func_mkdir_p_IFS=$IFS; IFS=:
 2479: +      for _G_dir in $_G_dir_list; do
 2480: +	IFS=$func_mkdir_p_IFS
 2481: +        # mkdir can fail with a 'File exist' error if two processes
 2482: +        # try to create one of the directories concurrently.  Don't
 2483: +        # stop in that case!
 2484: +        $MKDIR "$_G_dir" 2>/dev/null || :
 2485: +      done
 2486: +      IFS=$func_mkdir_p_IFS
 2487: +
 2488: +      # Bail out if we (or some other process) failed to create a directory.
 2489: +      test -d "$_G_directory_path" || \
 2490: +        func_fatal_error "Failed to create '$1'"
 2491: +    fi
 2492: +}
 2493: +
 2494: +
 2495: +# func_mktempdir [BASENAME]
 2496: +# -------------------------
 2497: +# Make a temporary directory that won't clash with other running
 2498: +# libtool processes, and avoids race conditions if possible.  If
 2499: +# given, BASENAME is the basename for that directory.
 2500: +func_mktempdir ()
 2501: +{
 2502: +    $debug_cmd
 2503: +
 2504: +    _G_template=${TMPDIR-/tmp}/${1-$progname}
 2505: +
 2506: +    if test : = "$opt_dry_run"; then
 2507: +      # Return a directory name, but don't create it in dry-run mode
 2508: +      _G_tmpdir=$_G_template-$$
 2509: +    else
 2510: +
 2511: +      # If mktemp works, use that first and foremost
 2512: +      _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
 2513: +
 2514: +      if test ! -d "$_G_tmpdir"; then
 2515: +        # Failing that, at least try and use $RANDOM to avoid a race
 2516: +        _G_tmpdir=$_G_template-${RANDOM-0}$$
 2517: +
 2518: +        func_mktempdir_umask=`umask`
 2519: +        umask 0077
 2520: +        $MKDIR "$_G_tmpdir"
 2521: +        umask $func_mktempdir_umask
 2522: +      fi
 2523: +
 2524: +      # If we're not in dry-run mode, bomb out on failure
 2525: +      test -d "$_G_tmpdir" || \
 2526: +        func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
 2527: +    fi
 2528: +
 2529: +    $ECHO "$_G_tmpdir"
 2530: +}
 2531: +
 2532: +
 2533: +# func_normal_abspath PATH
 2534: +# ------------------------
 2535: +# Remove doubled-up and trailing slashes, "." path components,
 2536: +# and cancel out any ".." path components in PATH after making
 2537: +# it an absolute path.
 2538: +func_normal_abspath ()
 2539: +{
 2540: +    $debug_cmd
 2541: +
 2542: +    # These SED scripts presuppose an absolute path with a trailing slash.
 2543: +    _G_pathcar='s|^/\([^/]*\).*$|\1|'
 2544: +    _G_pathcdr='s|^/[^/]*||'
 2545: +    _G_removedotparts=':dotsl
 2546: +		s|/\./|/|g
 2547: +		t dotsl
 2548: +		s|/\.$|/|'
 2549: +    _G_collapseslashes='s|/\{1,\}|/|g'
 2550: +    _G_finalslash='s|/*$|/|'
 2551: +
 2552: +    # Start from root dir and reassemble the path.
 2553: +    func_normal_abspath_result=
 2554: +    func_normal_abspath_tpath=$1
 2555: +    func_normal_abspath_altnamespace=
 2556: +    case $func_normal_abspath_tpath in
 2557: +      "")
 2558: +        # Empty path, that just means $cwd.
 2559: +        func_stripname '' '/' "`pwd`"
 2560: +        func_normal_abspath_result=$func_stripname_result
 2561: +        return
 2562: +        ;;
 2563: +      # The next three entries are used to spot a run of precisely
 2564: +      # two leading slashes without using negated character classes;
 2565: +      # we take advantage of case's first-match behaviour.
 2566: +      ///*)
 2567: +        # Unusual form of absolute path, do nothing.
 2568: +        ;;
 2569: +      //*)
 2570: +        # Not necessarily an ordinary path; POSIX reserves leading '//'
 2571: +        # and for example Cygwin uses it to access remote file shares
 2572: +        # over CIFS/SMB, so we conserve a leading double slash if found.
 2573: +        func_normal_abspath_altnamespace=/
 2574: +        ;;
 2575: +      /*)
 2576: +        # Absolute path, do nothing.
 2577: +        ;;
 2578: +      *)
 2579: +        # Relative path, prepend $cwd.
 2580: +        func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
 2581: +        ;;
 2582: +    esac
 2583: +
 2584: +    # Cancel out all the simple stuff to save iterations.  We also want
 2585: +    # the path to end with a slash for ease of parsing, so make sure
 2586: +    # there is one (and only one) here.
 2587: +    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
 2588: +          -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
 2589: +    while :; do
 2590: +      # Processed it all yet?
 2591: +      if test / = "$func_normal_abspath_tpath"; then
 2592: +        # If we ascended to the root using ".." the result may be empty now.
 2593: +        if test -z "$func_normal_abspath_result"; then
 2594: +          func_normal_abspath_result=/
 2595: +        fi
 2596: +        break
 2597: +      fi
 2598: +      func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
 2599: +          -e "$_G_pathcar"`
 2600: +      func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
 2601: +          -e "$_G_pathcdr"`
 2602: +      # Figure out what to do with it
 2603: +      case $func_normal_abspath_tcomponent in
 2604: +        "")
 2605: +          # Trailing empty path component, ignore it.
 2606: +          ;;
 2607: +        ..)
 2608: +          # Parent dir; strip last assembled component from result.
 2609: +          func_dirname "$func_normal_abspath_result"
 2610: +          func_normal_abspath_result=$func_dirname_result
 2611: +          ;;
 2612: +        *)
 2613: +          # Actual path component, append it.
 2614: +          func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
 2615: +          ;;
 2616: +      esac
 2617: +    done
 2618: +    # Restore leading double-slash if one was found on entry.
 2619: +    func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
 2620: +}
 2621: +
 2622: +
 2623: +# func_notquiet ARG...
 2624: +# --------------------
 2625: +# Echo program name prefixed message only when not in quiet mode.
 2626: +func_notquiet ()
 2627: +{
 2628: +    $debug_cmd
 2629: +
 2630: +    $opt_quiet || func_echo ${1+"$@"}
 2631: +
 2632: +    # A bug in bash halts the script if the last line of a function
 2633: +    # fails when set -e is in force, so we need another command to
 2634: +    # work around that:
 2635: +    :
 2636: +}
 2637: +
 2638: +
 2639: +# func_relative_path SRCDIR DSTDIR
 2640: +# --------------------------------
 2641: +# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
 2642: +func_relative_path ()
 2643: +{
 2644: +    $debug_cmd
 2645: +
 2646: +    func_relative_path_result=
 2647: +    func_normal_abspath "$1"
 2648: +    func_relative_path_tlibdir=$func_normal_abspath_result
 2649: +    func_normal_abspath "$2"
 2650: +    func_relative_path_tbindir=$func_normal_abspath_result
 2651: +
 2652: +    # Ascend the tree starting from libdir
 2653: +    while :; do
 2654: +      # check if we have found a prefix of bindir
 2655: +      case $func_relative_path_tbindir in
 2656: +        $func_relative_path_tlibdir)
 2657: +          # found an exact match
 2658: +          func_relative_path_tcancelled=
 2659: +          break
 2660: +          ;;
 2661: +        $func_relative_path_tlibdir*)
 2662: +          # found a matching prefix
 2663: +          func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
 2664: +          func_relative_path_tcancelled=$func_stripname_result
 2665: +          if test -z "$func_relative_path_result"; then
 2666: +            func_relative_path_result=.
 2667: +          fi
 2668: +          break
 2669: +          ;;
 2670: +        *)
 2671: +          func_dirname $func_relative_path_tlibdir
 2672: +          func_relative_path_tlibdir=$func_dirname_result
 2673: +          if test -z "$func_relative_path_tlibdir"; then
 2674: +            # Have to descend all the way to the root!
 2675: +            func_relative_path_result=../$func_relative_path_result
 2676: +            func_relative_path_tcancelled=$func_relative_path_tbindir
 2677: +            break
 2678: +          fi
 2679: +          func_relative_path_result=../$func_relative_path_result
 2680: +          ;;
 2681: +      esac
 2682: +    done
 2683: +
 2684: +    # Now calculate path; take care to avoid doubling-up slashes.
 2685: +    func_stripname '' '/' "$func_relative_path_result"
 2686: +    func_relative_path_result=$func_stripname_result
 2687: +    func_stripname '/' '/' "$func_relative_path_tcancelled"
 2688: +    if test -n "$func_stripname_result"; then
 2689: +      func_append func_relative_path_result "/$func_stripname_result"
 2690: +    fi
 2691: +
 2692: +    # Normalisation. If bindir is libdir, return '.' else relative path.
 2693: +    if test -n "$func_relative_path_result"; then
 2694: +      func_stripname './' '' "$func_relative_path_result"
 2695: +      func_relative_path_result=$func_stripname_result
 2696: +    fi
 2697: +
 2698: +    test -n "$func_relative_path_result" || func_relative_path_result=.
 2699: +
 2700: +    :
 2701: +}
 2702: +
 2703: +
 2704: +# func_quote_for_eval ARG...
 2705: +# --------------------------
 2706: +# Aesthetically quote ARGs to be evaled later.
 2707: +# This function returns two values:
 2708: +#   i) func_quote_for_eval_result
 2709: +#      double-quoted, suitable for a subsequent eval
 2710: +#  ii) func_quote_for_eval_unquoted_result
 2711: +#      has all characters that are still active within double
 2712: +#      quotes backslashified.
 2713: +func_quote_for_eval ()
 2714: +{
 2715: +    $debug_cmd
 2716: +
 2717: +    func_quote_for_eval_unquoted_result=
 2718: +    func_quote_for_eval_result=
 2719: +    while test 0 -lt $#; do
 2720: +      case $1 in
 2721: +        *[\\\`\"\$]*)
 2722: +	  _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
 2723: +        *)
 2724: +          _G_unquoted_arg=$1 ;;
 2725: +      esac
 2726: +      if test -n "$func_quote_for_eval_unquoted_result"; then
 2727: +	func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
 2728: +      else
 2729: +        func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
 2730: +      fi
 2731: +
 2732: +      case $_G_unquoted_arg in
 2733: +        # Double-quote args containing shell metacharacters to delay
 2734: +        # word splitting, command substitution and variable expansion
 2735: +        # for a subsequent eval.
 2736: +        # Many Bourne shells cannot handle close brackets correctly
 2737: +        # in scan sets, so we specify it separately.
 2738: +        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
 2739: +          _G_quoted_arg=\"$_G_unquoted_arg\"
 2740: +          ;;
 2741: +        *)
 2742: +          _G_quoted_arg=$_G_unquoted_arg
 2743: +	  ;;
 2744: +      esac
 2745: +
 2746: +      if test -n "$func_quote_for_eval_result"; then
 2747: +	func_append func_quote_for_eval_result " $_G_quoted_arg"
 2748: +      else
 2749: +        func_append func_quote_for_eval_result "$_G_quoted_arg"
 2750: +      fi
 2751: +      shift
 2752: +    done
 2753: +}
 2754: +
 2755: +
 2756: +# func_quote_for_expand ARG
 2757: +# -------------------------
 2758: +# Aesthetically quote ARG to be evaled later; same as above,
 2759: +# but do not quote variable references.
 2760: +func_quote_for_expand ()
 2761: +{
 2762: +    $debug_cmd
 2763: +
 2764: +    case $1 in
 2765: +      *[\\\`\"]*)
 2766: +	_G_arg=`$ECHO "$1" | $SED \
 2767: +	    -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
 2768: +      *)
 2769: +        _G_arg=$1 ;;
 2770: +    esac
 2771: +
 2772: +    case $_G_arg in
 2773: +      # Double-quote args containing shell metacharacters to delay
 2774: +      # word splitting and command substitution for a subsequent eval.
 2775: +      # Many Bourne shells cannot handle close brackets correctly
 2776: +      # in scan sets, so we specify it separately.
 2777: +      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
 2778: +        _G_arg=\"$_G_arg\"
 2779: +        ;;
 2780: +    esac
 2781: +
 2782: +    func_quote_for_expand_result=$_G_arg
 2783: +}
 2784: +
 2785: +
 2786: +# func_stripname PREFIX SUFFIX NAME
 2787: +# ---------------------------------
 2788: +# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
 2789: +# PREFIX and SUFFIX must not contain globbing or regex special
 2790: +# characters, hashes, percent signs, but SUFFIX may contain a leading
 2791: +# dot (in which case that matches only a dot).
 2792: +if test yes = "$_G_HAVE_XSI_OPS"; then
 2793: +  eval 'func_stripname ()
 2794: +  {
 2795: +    $debug_cmd
 2796: +
 2797: +    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
 2798: +    # positional parameters, so assign one to ordinary variable first.
 2799: +    func_stripname_result=$3
 2800: +    func_stripname_result=${func_stripname_result#"$1"}
 2801: +    func_stripname_result=${func_stripname_result%"$2"}
 2802: +  }'
 2803: +else
 2804: +  func_stripname ()
 2805: +  {
 2806: +    $debug_cmd
 2807: +
 2808: +    case $2 in
 2809: +      .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
 2810: +      *)  func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
 2811: +    esac
 2812: +  }
 2813: +fi
 2814: +
 2815: +
 2816: +# func_show_eval CMD [FAIL_EXP]
 2817: +# -----------------------------
 2818: +# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
 2819: +# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
 2820: +# is given, then evaluate it.
 2821: +func_show_eval ()
 2822: +{
 2823: +    $debug_cmd
 2824: +
 2825: +    _G_cmd=$1
 2826: +    _G_fail_exp=${2-':'}
 2827: +
 2828: +    func_quote_for_expand "$_G_cmd"
 2829: +    eval "func_notquiet $func_quote_for_expand_result"
 2830: +
 2831: +    $opt_dry_run || {
 2832: +      eval "$_G_cmd"
 2833: +      _G_status=$?
 2834: +      if test 0 -ne "$_G_status"; then
 2835: +	eval "(exit $_G_status); $_G_fail_exp"
 2836: +      fi
 2837: +    }
 2838: +}
 2839: +
 2840: +
 2841: +# func_show_eval_locale CMD [FAIL_EXP]
 2842: +# ------------------------------------
 2843: +# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
 2844: +# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
 2845: +# is given, then evaluate it.  Use the saved locale for evaluation.
 2846: +func_show_eval_locale ()
 2847: +{
 2848: +    $debug_cmd
 2849: +
 2850: +    _G_cmd=$1
 2851: +    _G_fail_exp=${2-':'}
 2852: +
 2853: +    $opt_quiet || {
 2854: +      func_quote_for_expand "$_G_cmd"
 2855: +      eval "func_echo $func_quote_for_expand_result"
 2856: +    }
 2857: +
 2858: +    $opt_dry_run || {
 2859: +      eval "$_G_user_locale
 2860: +	    $_G_cmd"
 2861: +      _G_status=$?
 2862: +      eval "$_G_safe_locale"
 2863: +      if test 0 -ne "$_G_status"; then
 2864: +	eval "(exit $_G_status); $_G_fail_exp"
 2865: +      fi
 2866: +    }
 2867: +}
 2868: +
 2869: +
 2870: +# func_tr_sh
 2871: +# ----------
 2872: +# Turn $1 into a string suitable for a shell variable name.
 2873: +# Result is stored in $func_tr_sh_result.  All characters
 2874: +# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
 2875: +# if $1 begins with a digit, a '_' is prepended as well.
 2876: +func_tr_sh ()
 2877: +{
 2878: +    $debug_cmd
 2879: +
 2880: +    case $1 in
 2881: +    [0-9]* | *[!a-zA-Z0-9_]*)
 2882: +      func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
 2883: +      ;;
 2884: +    * )
 2885: +      func_tr_sh_result=$1
 2886: +      ;;
 2887: +    esac
 2888: +}
 2889: +
 2890: +
 2891: +# func_verbose ARG...
 2892: +# -------------------
 2893: +# Echo program name prefixed message in verbose mode only.
 2894: +func_verbose ()
 2895: +{
 2896: +    $debug_cmd
 2897: +
 2898: +    $opt_verbose && func_echo "$*"
 2899: +
 2900: +    :
 2901: +}
 2902: +
 2903: +
 2904: +# func_warn_and_continue ARG...
 2905: +# -----------------------------
 2906: +# Echo program name prefixed warning message to standard error.
 2907: +func_warn_and_continue ()
 2908: +{
 2909: +    $debug_cmd
 2910: +
 2911: +    $require_term_colors
 2912: +
 2913: +    func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
 2914: +}
 2915: +
 2916: +
 2917: +# func_warning CATEGORY ARG...
 2918: +# ----------------------------
 2919: +# Echo program name prefixed warning message to standard error. Warning
 2920: +# messages can be filtered according to CATEGORY, where this function
 2921: +# elides messages where CATEGORY is not listed in the global variable
 2922: +# 'opt_warning_types'.
 2923: +func_warning ()
 2924: +{
 2925: +    $debug_cmd
 2926: +
 2927: +    # CATEGORY must be in the warning_categories list!
 2928: +    case " $warning_categories " in
 2929: +      *" $1 "*) ;;
 2930: +      *) func_internal_error "invalid warning category '$1'" ;;
 2931: +    esac
 2932: +
 2933: +    _G_category=$1
 2934: +    shift
 2935: +
 2936: +    case " $opt_warning_types " in
 2937: +      *" $_G_category "*) $warning_func ${1+"$@"} ;;
 2938: +    esac
 2939: +}
 2940: +
 2941: +
 2942: +# func_sort_ver VER1 VER2
 2943: +# -----------------------
 2944: +# 'sort -V' is not generally available.
 2945: +# Note this deviates from the version comparison in automake
 2946: +# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
 2947: +# but this should suffice as we won't be specifying old
 2948: +# version formats or redundant trailing .0 in bootstrap.conf.
 2949: +# If we did want full compatibility then we should probably
 2950: +# use m4_version_compare from autoconf.
 2951: +func_sort_ver ()
 2952: +{
 2953: +    $debug_cmd
 2954: +
 2955: +    printf '%s\n%s\n' "$1" "$2" \
 2956: +      | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
 2957: +}
 2958: +
 2959: +# func_lt_ver PREV CURR
 2960: +# ---------------------
 2961: +# Return true if PREV and CURR are in the correct order according to
 2962: +# func_sort_ver, otherwise false.  Use it like this:
 2963: +#
 2964: +#  func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
 2965: +func_lt_ver ()
 2966: +{
 2967: +    $debug_cmd
 2968: +
 2969: +    test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
 2970: +}
 2971: +
 2972: +
 2973: +# Local variables:
 2974: +# mode: shell-script
 2975: +# sh-indentation: 2
 2976: +# eval: (add-hook 'before-save-hook 'time-stamp)
 2977: +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
 2978: +# time-stamp-time-zone: "UTC"
 2979: +# End:
 2980: +#! /bin/sh
 2981: +
 2982: +# Set a version string for this script.
 2983: +scriptversion=2014-01-07.03; # UTC
 2984: +
 2985: +# A portable, pluggable option parser for Bourne shell.
 2986: +# Written by Gary V. Vaughan, 2010
 2987: +
 2988: +# Copyright (C) 2010-2015 Free Software Foundation, Inc.
 2989: +# This is free software; see the source for copying conditions.  There is NO
 2990: +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 2991: +
 2992: +# This program is free software: you can redistribute it and/or modify
 2993: +# it under the terms of the GNU General Public License as published by
 2994: +# the Free Software Foundation, either version 3 of the License, or
 2995: +# (at your option) any later version.
 2996: +
 2997: +# This program is distributed in the hope that it will be useful,
 2998: +# but WITHOUT ANY WARRANTY; without even the implied warranty of
 2999: +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 3000: +# GNU General Public License for more details.
 3001: +
 3002: +# You should have received a copy of the GNU General Public License
 3003: +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 3004: +
 3005: +# Please report bugs or propose patches to gary@gnu.org.
 3006: +
 3007: +
 3008: +## ------ ##
 3009: +## Usage. ##
 3010: +## ------ ##
 3011: +
 3012: +# This file is a library for parsing options in your shell scripts along
 3013: +# with assorted other useful supporting features that you can make use
 3014: +# of too.
 3015: +#
 3016: +# For the simplest scripts you might need only:
 3017: +#
 3018: +#   #!/bin/sh
 3019: +#   . relative/path/to/funclib.sh
 3020: +#   . relative/path/to/options-parser
 3021: +#   scriptversion=1.0
 3022: +#   func_options ${1+"$@"}
 3023: +#   eval set dummy "$func_options_result"; shift
 3024: +#   ...rest of your script...
 3025: +#
 3026: +# In order for the '--version' option to work, you will need to have a
 3027: +# suitably formatted comment like the one at the top of this file
 3028: +# starting with '# Written by ' and ending with '# warranty; '.
 3029: +#
 3030: +# For '-h' and '--help' to work, you will also need a one line
 3031: +# description of your script's purpose in a comment directly above the
 3032: +# '# Written by ' line, like the one at the top of this file.
 3033: +#
 3034: +# The default options also support '--debug', which will turn on shell
 3035: +# execution tracing (see the comment above debug_cmd below for another
 3036: +# use), and '--verbose' and the func_verbose function to allow your script
 3037: +# to display verbose messages only when your user has specified
 3038: +# '--verbose'.
 3039: +#
 3040: +# After sourcing this file, you can plug processing for additional
 3041: +# options by amending the variables from the 'Configuration' section
 3042: +# below, and following the instructions in the 'Option parsing'
 3043: +# section further down.
 3044: +
 3045: +## -------------- ##
 3046: +## Configuration. ##
 3047: +## -------------- ##
 3048: +
 3049: +# You should override these variables in your script after sourcing this
 3050: +# file so that they reflect the customisations you have added to the
 3051: +# option parser.
 3052: +
 3053: +# The usage line for option parsing errors and the start of '-h' and
 3054: +# '--help' output messages. You can embed shell variables for delayed
 3055: +# expansion at the time the message is displayed, but you will need to
 3056: +# quote other shell meta-characters carefully to prevent them being
 3057: +# expanded when the contents are evaled.
 3058: +usage='$progpath [OPTION]...'
 3059: +
 3060: +# Short help message in response to '-h' and '--help'.  Add to this or
 3061: +# override it after sourcing this library to reflect the full set of
 3062: +# options your script accepts.
 3063: +usage_message="\
 3064: +       --debug        enable verbose shell tracing
 3065: +   -W, --warnings=CATEGORY
 3066: +                      report the warnings falling in CATEGORY [all]
 3067: +   -v, --verbose      verbosely report processing
 3068: +       --version      print version information and exit
 3069: +   -h, --help         print short or long help message and exit
 3070: +"
 3071: +
 3072: +# Additional text appended to 'usage_message' in response to '--help'.
 3073: +long_help_message="
 3074: +Warning categories include:
 3075: +       'all'          show all warnings
 3076: +       'none'         turn off all the warnings
 3077: +       'error'        warnings are treated as fatal errors"
 3078: +
 3079: +# Help message printed before fatal option parsing errors.
 3080: +fatal_help="Try '\$progname --help' for more information."
 3081: +
 3082: +
 3083: +
 3084: +## ------------------------- ##
 3085: +## Hook function management. ##
 3086: +## ------------------------- ##
 3087: +
 3088: +# This section contains functions for adding, removing, and running hooks
 3089: +# to the main code.  A hook is just a named list of of function, that can
 3090: +# be run in order later on.
 3091: +
 3092: +# func_hookable FUNC_NAME
 3093: +# -----------------------
 3094: +# Declare that FUNC_NAME will run hooks added with
 3095: +# 'func_add_hook FUNC_NAME ...'.
 3096: +func_hookable ()
 3097: +{
 3098: +    $debug_cmd
 3099: +
 3100: +    func_append hookable_fns " $1"
 3101: +}
 3102: +
 3103: +
 3104: +# func_add_hook FUNC_NAME HOOK_FUNC
 3105: +# ---------------------------------
 3106: +# Request that FUNC_NAME call HOOK_FUNC before it returns.  FUNC_NAME must
 3107: +# first have been declared "hookable" by a call to 'func_hookable'.
 3108: +func_add_hook ()
 3109: +{
 3110: +    $debug_cmd
 3111: +
 3112: +    case " $hookable_fns " in
 3113: +      *" $1 "*) ;;
 3114: +      *) func_fatal_error "'$1' does not accept hook functions." ;;
 3115: +    esac
 3116: +
 3117: +    eval func_append ${1}_hooks '" $2"'
 3118: +}
 3119: +
 3120: +
 3121: +# func_remove_hook FUNC_NAME HOOK_FUNC
 3122: +# ------------------------------------
 3123: +# Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
 3124: +func_remove_hook ()
 3125: +{
 3126: +    $debug_cmd
 3127: +
 3128: +    eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
 3129: +}
 3130: +
 3131: +
 3132: +# func_run_hooks FUNC_NAME [ARG]...
 3133: +# ---------------------------------
 3134: +# Run all hook functions registered to FUNC_NAME.
 3135: +# It is assumed that the list of hook functions contains nothing more
 3136: +# than a whitespace-delimited list of legal shell function names, and
 3137: +# no effort is wasted trying to catch shell meta-characters or preserve
 3138: +# whitespace.
 3139: +func_run_hooks ()
 3140: +{
 3141: +    $debug_cmd
 3142: +
 3143: +    case " $hookable_fns " in
 3144: +      *" $1 "*) ;;
 3145: +      *) func_fatal_error "'$1' does not support hook funcions.n" ;;
 3146: +    esac
 3147: +
 3148: +    eval _G_hook_fns=\$$1_hooks; shift
 3149: +
 3150: +    for _G_hook in $_G_hook_fns; do
 3151: +      eval $_G_hook '"$@"'
 3152: +
 3153: +      # store returned options list back into positional
 3154: +      # parameters for next 'cmd' execution.
 3155: +      eval _G_hook_result=\$${_G_hook}_result
 3156: +      eval set dummy "$_G_hook_result"; shift
 3157: +    done
 3158: +
 3159: +    func_quote_for_eval ${1+"$@"}
 3160: +    func_run_hooks_result=$func_quote_for_eval_result
 3161: +}
 3162: +
 3163: +
 3164: +
 3165: +## --------------- ##
 3166: +## Option parsing. ##
 3167: +## --------------- ##
 3168: +
 3169: +# In order to add your own option parsing hooks, you must accept the
 3170: +# full positional parameter list in your hook function, remove any
 3171: +# options that you action, and then pass back the remaining unprocessed
 3172: +# options in '<hooked_function_name>_result', escaped suitably for
 3173: +# 'eval'.  Like this:
 3174: +#
 3175: +#    my_options_prep ()
 3176: +#    {
 3177: +#        $debug_cmd
 3178: +#
 3179: +#        # Extend the existing usage message.
 3180: +#        usage_message=$usage_message'
 3181: +#      -s, --silent       don'\''t print informational messages
 3182: +#    '
 3183: +#
 3184: +#        func_quote_for_eval ${1+"$@"}
 3185: +#        my_options_prep_result=$func_quote_for_eval_result
 3186: +#    }
 3187: +#    func_add_hook func_options_prep my_options_prep
 3188: +#
 3189: +#
 3190: +#    my_silent_option ()
 3191: +#    {
 3192: +#        $debug_cmd
 3193: +#
 3194: +#        # Note that for efficiency, we parse as many options as we can
 3195: +#        # recognise in a loop before passing the remainder back to the
 3196: +#        # caller on the first unrecognised argument we encounter.
 3197: +#        while test $# -gt 0; do
 3198: +#          opt=$1; shift
 3199: +#          case $opt in
 3200: +#            --silent|-s) opt_silent=: ;;
 3201: +#            # Separate non-argument short options:
 3202: +#            -s*)         func_split_short_opt "$_G_opt"
 3203: +#                         set dummy "$func_split_short_opt_name" \
 3204: +#                             "-$func_split_short_opt_arg" ${1+"$@"}
 3205: +#                         shift
 3206: +#                         ;;
 3207: +#            *)            set dummy "$_G_opt" "$*"; shift; break ;;
 3208: +#          esac
 3209: +#        done
 3210: +#
 3211: +#        func_quote_for_eval ${1+"$@"}
 3212: +#        my_silent_option_result=$func_quote_for_eval_result
 3213: +#    }
 3214: +#    func_add_hook func_parse_options my_silent_option
 3215: +#
 3216: +#
 3217: +#    my_option_validation ()
 3218: +#    {
 3219: +#        $debug_cmd
 3220: +#
 3221: +#        $opt_silent && $opt_verbose && func_fatal_help "\
 3222: +#    '--silent' and '--verbose' options are mutually exclusive."
 3223: +#
 3224: +#        func_quote_for_eval ${1+"$@"}
 3225: +#        my_option_validation_result=$func_quote_for_eval_result
 3226: +#    }
 3227: +#    func_add_hook func_validate_options my_option_validation
 3228: +#
 3229: +# You'll alse need to manually amend $usage_message to reflect the extra
 3230: +# options you parse.  It's preferable to append if you can, so that
 3231: +# multiple option parsing hooks can be added safely.
 3232: +
 3233: +
 3234: +# func_options [ARG]...
 3235: +# ---------------------
 3236: +# All the functions called inside func_options are hookable. See the
 3237: +# individual implementations for details.
 3238: +func_hookable func_options
 3239: +func_options ()
 3240: +{
 3241: +    $debug_cmd
 3242: +
 3243: +    func_options_prep ${1+"$@"}
 3244: +    eval func_parse_options \
 3245: +        ${func_options_prep_result+"$func_options_prep_result"}
 3246: +    eval func_validate_options \
 3247: +        ${func_parse_options_result+"$func_parse_options_result"}
 3248: +
 3249: +    eval func_run_hooks func_options \
 3250: +        ${func_validate_options_result+"$func_validate_options_result"}
 3251: +
 3252: +    # save modified positional parameters for caller
 3253: +    func_options_result=$func_run_hooks_result
 3254: +}
 3255: +
 3256: +
 3257: +# func_options_prep [ARG]...
 3258: +# --------------------------
 3259: +# All initialisations required before starting the option parse loop.
 3260: +# Note that when calling hook functions, we pass through the list of
 3261: +# positional parameters.  If a hook function modifies that list, and
 3262: +# needs to propogate that back to rest of this script, then the complete
 3263: +# modified list must be put in 'func_run_hooks_result' before
 3264: +# returning.
 3265: +func_hookable func_options_prep
 3266: +func_options_prep ()
 3267: +{
 3268: +    $debug_cmd
 3269: +
 3270: +    # Option defaults:
 3271: +    opt_verbose=false
 3272: +    opt_warning_types=
 3273: +
 3274: +    func_run_hooks func_options_prep ${1+"$@"}
 3275: +
 3276: +    # save modified positional parameters for caller
 3277: +    func_options_prep_result=$func_run_hooks_result
 3278: +}
 3279: +
 3280: +
 3281: +# func_parse_options [ARG]...
 3282: +# ---------------------------
 3283: +# The main option parsing loop.
 3284: +func_hookable func_parse_options
 3285: +func_parse_options ()
 3286: +{
 3287: +    $debug_cmd
 3288: +
 3289: +    func_parse_options_result=
 3290: +
 3291: +    # this just eases exit handling
 3292: +    while test $# -gt 0; do
 3293: +      # Defer to hook functions for initial option parsing, so they
 3294: +      # get priority in the event of reusing an option name.
 3295: +      func_run_hooks func_parse_options ${1+"$@"}
 3296: +
 3297: +      # Adjust func_parse_options positional parameters to match
 3298: +      eval set dummy "$func_run_hooks_result"; shift
 3299: +
 3300: +      # Break out of the loop if we already parsed every option.
 3301: +      test $# -gt 0 || break
 3302: +
 3303: +      _G_opt=$1
 3304: +      shift
 3305: +      case $_G_opt in
 3306: +        --debug|-x)   debug_cmd='set -x'
 3307: +                      func_echo "enabling shell trace mode"
 3308: +                      $debug_cmd
 3309: +                      ;;
 3310: +
 3311: +        --no-warnings|--no-warning|--no-warn)
 3312: +                      set dummy --warnings none ${1+"$@"}
 3313: +                      shift
 3314: +		      ;;
 3315: +
 3316: +        --warnings|--warning|-W)
 3317: +                      test $# = 0 && func_missing_arg $_G_opt && break
 3318: +                      case " $warning_categories $1" in
 3319: +                        *" $1 "*)
 3320: +                          # trailing space prevents matching last $1 above
 3321: +                          func_append_uniq opt_warning_types " $1"
 3322: +                          ;;
 3323: +                        *all)
 3324: +                          opt_warning_types=$warning_categories
 3325: +                          ;;
 3326: +                        *none)
 3327: +                          opt_warning_types=none
 3328: +                          warning_func=:
 3329: +                          ;;
 3330: +                        *error)
 3331: +                          opt_warning_types=$warning_categories
 3332: +                          warning_func=func_fatal_error
 3333: +                          ;;
 3334: +                        *)
 3335: +                          func_fatal_error \
 3336: +                             "unsupported warning category: '$1'"
 3337: +                          ;;
 3338: +                      esac
 3339: +                      shift
 3340: +                      ;;
 3341: +
 3342: +        --verbose|-v) opt_verbose=: ;;
 3343: +        --version)    func_version ;;
 3344: +        -\?|-h)       func_usage ;;
 3345: +        --help)       func_help ;;
 3346: +
 3347: +	# Separate optargs to long options (plugins may need this):
 3348: +	--*=*)        func_split_equals "$_G_opt"
 3349: +	              set dummy "$func_split_equals_lhs" \
 3350: +                          "$func_split_equals_rhs" ${1+"$@"}
 3351: +                      shift
 3352: +                      ;;
 3353: +
 3354: +       # Separate optargs to short options:
 3355: +        -W*)
 3356: +                      func_split_short_opt "$_G_opt"
 3357: +                      set dummy "$func_split_short_opt_name" \
 3358: +                          "$func_split_short_opt_arg" ${1+"$@"}
 3359: +                      shift
 3360: +                      ;;
 3361: +
 3362: +        # Separate non-argument short options:
 3363: +        -\?*|-h*|-v*|-x*)
 3364: +                      func_split_short_opt "$_G_opt"
 3365: +                      set dummy "$func_split_short_opt_name" \
 3366: +                          "-$func_split_short_opt_arg" ${1+"$@"}
 3367: +                      shift
 3368: +                      ;;
 3369: +
 3370: +        --)           break ;;
 3371: +        -*)           func_fatal_help "unrecognised option: '$_G_opt'" ;;
 3372: +        *)            set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
 3373: +      esac
 3374: +    done
 3375: +
 3376: +    # save modified positional parameters for caller
 3377: +    func_quote_for_eval ${1+"$@"}
 3378: +    func_parse_options_result=$func_quote_for_eval_result
 3379: +}
 3380: +
 3381: +
 3382: +# func_validate_options [ARG]...
 3383: +# ------------------------------
 3384: +# Perform any sanity checks on option settings and/or unconsumed
 3385: +# arguments.
 3386: +func_hookable func_validate_options
 3387: +func_validate_options ()
 3388: +{
 3389: +    $debug_cmd
 3390: +
 3391: +    # Display all warnings if -W was not given.
 3392: +    test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
 3393: +
 3394: +    func_run_hooks func_validate_options ${1+"$@"}
 3395: +
 3396: +    # Bail if the options were screwed!
 3397: +    $exit_cmd $EXIT_FAILURE
 3398: +
 3399: +    # save modified positional parameters for caller
 3400: +    func_validate_options_result=$func_run_hooks_result
 3401: +}
 3402: +
 3403: +
 3404: +
 3405: +## ----------------- ##
 3406: +## Helper functions. ##
 3407: +## ----------------- ##
 3408: +
 3409: +# This section contains the helper functions used by the rest of the
 3410: +# hookable option parser framework in ascii-betical order.
 3411: +
 3412: +
 3413: +# func_fatal_help ARG...
 3414: +# ----------------------
 3415: +# Echo program name prefixed message to standard error, followed by
 3416: +# a help hint, and exit.
 3417: +func_fatal_help ()
 3418: +{
 3419: +    $debug_cmd
 3420: +
 3421: +    eval \$ECHO \""Usage: $usage"\"
 3422: +    eval \$ECHO \""$fatal_help"\"
 3423: +    func_error ${1+"$@"}
 3424: +    exit $EXIT_FAILURE
 3425: +}
 3426: +
 3427: +
 3428: +# func_help
 3429: +# ---------
 3430: +# Echo long help message to standard output and exit.
 3431: +func_help ()
 3432: +{
 3433: +    $debug_cmd
 3434: +
 3435: +    func_usage_message
 3436: +    $ECHO "$long_help_message"
 3437: +    exit 0
 3438: +}
 3439: +
 3440: +
 3441: +# func_missing_arg ARGNAME
 3442: +# ------------------------
 3443: +# Echo program name prefixed message to standard error and set global
 3444: +# exit_cmd.
 3445: +func_missing_arg ()
 3446: +{
 3447: +    $debug_cmd
 3448: +
 3449: +    func_error "Missing argument for '$1'."
 3450: +    exit_cmd=exit
 3451: +}
 3452: +
 3453: +
 3454: +# func_split_equals STRING
 3455: +# ------------------------
 3456: +# Set func_split_equals_lhs and func_split_equals_rhs shell variables after
 3457: +# splitting STRING at the '=' sign.
 3458: +test -z "$_G_HAVE_XSI_OPS" \
 3459: +    && (eval 'x=a/b/c;
 3460: +      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
 3461: +    && _G_HAVE_XSI_OPS=yes
 3462: +
 3463: +if test yes = "$_G_HAVE_XSI_OPS"
 3464: +then
 3465: +  # This is an XSI compatible shell, allowing a faster implementation...
 3466: +  eval 'func_split_equals ()
 3467: +  {
 3468: +      $debug_cmd
 3469: +
 3470: +      func_split_equals_lhs=${1%%=*}
 3471: +      func_split_equals_rhs=${1#*=}
 3472: +      test "x$func_split_equals_lhs" = "x$1" \
 3473: +        && func_split_equals_rhs=
 3474: +  }'
 3475: +else
 3476: +  # ...otherwise fall back to using expr, which is often a shell builtin.
 3477: +  func_split_equals ()
 3478: +  {
 3479: +      $debug_cmd
 3480: +
 3481: +      func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
 3482: +      func_split_equals_rhs=
 3483: +      test "x$func_split_equals_lhs" = "x$1" \
 3484: +        || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
 3485: +  }
 3486: +fi #func_split_equals
 3487: +
 3488: +
 3489: +# func_split_short_opt SHORTOPT
 3490: +# -----------------------------
 3491: +# Set func_split_short_opt_name and func_split_short_opt_arg shell
 3492: +# variables after splitting SHORTOPT after the 2nd character.
 3493: +if test yes = "$_G_HAVE_XSI_OPS"
 3494: +then
 3495: +  # This is an XSI compatible shell, allowing a faster implementation...
 3496: +  eval 'func_split_short_opt ()
 3497: +  {
 3498: +      $debug_cmd
 3499: +
 3500: +      func_split_short_opt_arg=${1#??}
 3501: +      func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
 3502: +  }'
 3503: +else
 3504: +  # ...otherwise fall back to using expr, which is often a shell builtin.
 3505: +  func_split_short_opt ()
 3506: +  {
 3507: +      $debug_cmd
 3508: +
 3509: +      func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
 3510: +      func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
 3511: +  }
 3512: +fi #func_split_short_opt
 3513: +
 3514: +
 3515: +# func_usage
 3516: +# ----------
 3517: +# Echo short help message to standard output and exit.
 3518: +func_usage ()
 3519: +{
 3520: +    $debug_cmd
 3521: +
 3522: +    func_usage_message
 3523: +    $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
 3524: +    exit 0
 3525: +}
 3526: +
 3527: +
 3528: +# func_usage_message
 3529: +# ------------------
 3530: +# Echo short help message to standard output.
 3531: +func_usage_message ()
 3532: +{
 3533: +    $debug_cmd
 3534: +
 3535: +    eval \$ECHO \""Usage: $usage"\"
 3536: +    echo
 3537: +    $SED -n 's|^# ||
 3538: +        /^Written by/{
 3539: +          x;p;x
 3540: +        }
 3541: +	h
 3542: +	/^Written by/q' < "$progpath"
 3543: +    echo
 3544: +    eval \$ECHO \""$usage_message"\"
 3545: +}
 3546: +
 3547: +
 3548: +# func_version
 3549: +# ------------
 3550: +# Echo version message to standard output and exit.
 3551: +func_version ()
 3552: +{
 3553: +    $debug_cmd
 3554: +
 3555: +    printf '%s\n' "$progname $scriptversion"
 3556: +    $SED -n '
 3557: +        /(C)/!b go
 3558: +        :more
 3559: +        /\./!{
 3560: +          N
 3561: +          s|\n# | |
 3562: +          b more
 3563: +        }
 3564: +        :go
 3565: +        /^# Written by /,/# warranty; / {
 3566: +          s|^# ||
 3567: +          s|^# *$||
 3568: +          s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
 3569: +          p
 3570: +        }
 3571: +        /^# Written by / {
 3572: +          s|^# ||
 3573: +          p
 3574: +        }
 3575: +        /^warranty; /q' < "$progpath"
 3576: +
 3577: +    exit $?
 3578: +}
 3579: +
 3580: +
 3581: +# Local variables:
 3582: +# mode: shell-script
 3583: +# sh-indentation: 2
 3584: +# eval: (add-hook 'before-save-hook 'time-stamp)
 3585: +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
 3586: +# time-stamp-time-zone: "UTC"
 3587: +# End:
 3588: +
 3589: +# Set a version string.
 3590: +scriptversion='(GNU libtool) 2.4.6'
 3591: +
 3592: +
 3593: +# func_echo ARG...
 3594: +# ----------------
 3595: +# Libtool also displays the current mode in messages, so override
 3596: +# funclib.sh func_echo with this custom definition.
 3597: +func_echo ()
 3598: +{
 3599: +    $debug_cmd
 3600: +
 3601: +    _G_message=$*
 3602: +
 3603: +    func_echo_IFS=$IFS
 3604: +    IFS=$nl
 3605: +    for _G_line in $_G_message; do
 3606: +      IFS=$func_echo_IFS
 3607: +      $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
 3608: +    done
 3609: +    IFS=$func_echo_IFS
 3610: +}
 3611: +
 3612: +
 3613: +# func_warning ARG...
 3614: +# -------------------
 3615: +# Libtool warnings are not categorized, so override funclib.sh
 3616: +# func_warning with this simpler definition.
 3617: +func_warning ()
 3618: +{
 3619: +    $debug_cmd
 3620: +
 3621: +    $warning_func ${1+"$@"}
 3622: +}
 3623: +
 3624: +
 3625: +## ---------------- ##
 3626: +## Options parsing. ##
 3627: +## ---------------- ##
 3628: +
 3629: +# Hook in the functions to make sure our own options are parsed during
 3630: +# the option parsing loop.
 3631: +
 3632: +usage='$progpath [OPTION]... [MODE-ARG]...'
 3633: +
 3634: +# Short help message in response to '-h'.
 3635: +usage_message="Options:
 3636: +       --config             show all configuration variables
 3637: +       --debug              enable verbose shell tracing
 3638: +   -n, --dry-run            display commands without modifying any files
 3639: +       --features           display basic configuration information and exit
 3640: +       --mode=MODE          use operation mode MODE
 3641: +       --no-warnings        equivalent to '-Wnone'
 3642: +       --preserve-dup-deps  don't remove duplicate dependency libraries
 3643: +       --quiet, --silent    don't print informational messages
 3644: +       --tag=TAG            use configuration variables from tag TAG
 3645: +   -v, --verbose            print more informational messages than default
 3646: +       --version            print version information
 3647: +   -W, --warnings=CATEGORY  report the warnings falling in CATEGORY [all]
 3648: +   -h, --help, --help-all   print short, long, or detailed help message
 3649: +"
 3650: +
 3651: +# Additional text appended to 'usage_message' in response to '--help'.
 3652: +func_help ()
 3653: +{
 3654: +    $debug_cmd
 3655: +
 3656: +    func_usage_message
 3657: +    $ECHO "$long_help_message
 3658: +
 3659: +MODE must be one of the following:
 3660: +
 3661: +       clean           remove files from the build directory
 3662: +       compile         compile a source file into a libtool object
 3663: +       execute         automatically set library path, then run a program
 3664: +       finish          complete the installation of libtool libraries
 3665: +       install         install libraries or executables
 3666: +       link            create a library or an executable
 3667: +       uninstall       remove libraries from an installed directory
 3668: +
 3669: +MODE-ARGS vary depending on the MODE.  When passed as first option,
 3670: +'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
 3671: +Try '$progname --help --mode=MODE' for a more detailed description of MODE.
 3672: +
 3673: +When reporting a bug, please describe a test case to reproduce it and
 3674: +include the following information:
 3675: +
 3676: +       host-triplet:   $host
 3677: +       shell:          $SHELL
 3678: +       compiler:       $LTCC
 3679: +       compiler flags: $LTCFLAGS
 3680: +       linker:         $LD (gnu? $with_gnu_ld)
 3681: +       version:        $progname (GNU libtool) 2.4.6
 3682: +       automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
 3683: +       autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
 3684: +
 3685: +Report bugs to <bug-libtool@gnu.org>.
 3686: +GNU libtool home page: <http://www.gnu.org/software/libtool/>.
 3687: +General help using GNU software: <http://www.gnu.org/gethelp/>."
 3688: +    exit 0
 3689: +}
 3690: +
 3691: +
 3692: +# func_lo2o OBJECT-NAME
 3693: +# ---------------------
 3694: +# Transform OBJECT-NAME from a '.lo' suffix to the platform specific
 3695: +# object suffix.
 3696: +
 3697: +lo2o=s/\\.lo\$/.$objext/
 3698: +o2lo=s/\\.$objext\$/.lo/
 3699: +
 3700: +if test yes = "$_G_HAVE_XSI_OPS"; then
 3701: +  eval 'func_lo2o ()
 3702: +  {
 3703: +    case $1 in
 3704: +      *.lo) func_lo2o_result=${1%.lo}.$objext ;;
 3705: +      *   ) func_lo2o_result=$1               ;;
 3706: +    esac
 3707: +  }'
 3708: +
 3709: +  # func_xform LIBOBJ-OR-SOURCE
 3710: +  # ---------------------------
 3711: +  # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
 3712: +  # suffix to a '.lo' libtool-object suffix.
 3713: +  eval 'func_xform ()
 3714: +  {
 3715: +    func_xform_result=${1%.*}.lo
 3716: +  }'
 3717: +else
 3718: +  # ...otherwise fall back to using sed.
 3719: +  func_lo2o ()
 3720: +  {
 3721: +    func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
 3722: +  }
 3723: +
 3724: +  func_xform ()
 3725: +  {
 3726: +    func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
 3727: +  }
 3728: +fi
 3729: +
 3730: +
 3731: +# func_fatal_configuration ARG...
 3732: +# -------------------------------
 3733: +# Echo program name prefixed message to standard error, followed by
 3734: +# a configuration failure hint, and exit.
 3735: +func_fatal_configuration ()
 3736: +{
 3737: +    func__fatal_error ${1+"$@"} \
 3738: +      "See the $PACKAGE documentation for more information." \
 3739: +      "Fatal configuration error."
 3740: +}
 3741: +
 3742: +
 3743: +# func_config
 3744: +# -----------
 3745: +# Display the configuration for all the tags in this script.
 3746: +func_config ()
 3747: +{
 3748: +    re_begincf='^# ### BEGIN LIBTOOL'
 3749: +    re_endcf='^# ### END LIBTOOL'
 3750: +
 3751: +    # Default configuration.
 3752: +    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
 3753: +
 3754: +    # Now print the configurations for the tags.
 3755: +    for tagname in $taglist; do
 3756: +      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
 3757: +    done
 3758: +
 3759: +    exit $?
 3760: +}
 3761: +
 3762: +
 3763: +# func_features
 3764: +# -------------
 3765: +# Display the features supported by this script.
 3766: +func_features ()
 3767: +{
 3768: +    echo "host: $host"
 3769: +    if test yes = "$build_libtool_libs"; then
 3770: +      echo "enable shared libraries"
 3771: +    else
 3772: +      echo "disable shared libraries"
 3773: +    fi
 3774: +    if test yes = "$build_old_libs"; then
 3775: +      echo "enable static libraries"
 3776: +    else
 3777: +      echo "disable static libraries"
 3778: +    fi
 3779: +
 3780: +    exit $?
 3781: +}
 3782: +
 3783: +
 3784: +# func_enable_tag TAGNAME
 3785: +# -----------------------
 3786: +# Verify that TAGNAME is valid, and either flag an error and exit, or
 3787: +# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
 3788: +# variable here.
 3789: +func_enable_tag ()
 3790: +{
 3791: +    # Global variable:
 3792: +    tagname=$1
 3793: +
 3794: +    re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
 3795: +    re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
 3796: +    sed_extractcf=/$re_begincf/,/$re_endcf/p
 3797: +
 3798: +    # Validate tagname.
 3799: +    case $tagname in
 3800: +      *[!-_A-Za-z0-9,/]*)
 3801: +        func_fatal_error "invalid tag name: $tagname"
 3802: +        ;;
 3803: +    esac
 3804: +
 3805: +    # Don't test for the "default" C tag, as we know it's
 3806: +    # there but not specially marked.
 3807: +    case $tagname in
 3808: +        CC) ;;
 3809: +    *)
 3810: +        if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
 3811: +	  taglist="$taglist $tagname"
 3812: +
 3813: +	  # Evaluate the configuration.  Be careful to quote the path
 3814: +	  # and the sed script, to avoid splitting on whitespace, but
 3815: +	  # also don't use non-portable quotes within backquotes within
 3816: +	  # quotes we have to do it in 2 steps:
 3817: +	  extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
 3818: +	  eval "$extractedcf"
 3819: +        else
 3820: +	  func_error "ignoring unknown tag $tagname"
 3821: +        fi
 3822: +        ;;
 3823: +    esac
 3824: +}
 3825: +
 3826: +
 3827: +# func_check_version_match
 3828: +# ------------------------
 3829: +# Ensure that we are using m4 macros, and libtool script from the same
 3830: +# release of libtool.
 3831: +func_check_version_match ()
 3832: +{
 3833: +    if test "$package_revision" != "$macro_revision"; then
 3834: +      if test "$VERSION" != "$macro_version"; then
 3835: +        if test -z "$macro_version"; then
 3836: +          cat >&2 <<_LT_EOF
 3837: +$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
 3838: +$progname: definition of this LT_INIT comes from an older release.
 3839: +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
 3840: +$progname: and run autoconf again.
 3841: +_LT_EOF
 3842: +        else
 3843: +          cat >&2 <<_LT_EOF
 3844: +$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
 3845: +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
 3846: +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
 3847: +$progname: and run autoconf again.
 3848: +_LT_EOF
 3849: +        fi
 3850: +      else
 3851: +        cat >&2 <<_LT_EOF
 3852: +$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
 3853: +$progname: but the definition of this LT_INIT comes from revision $macro_revision.
 3854: +$progname: You should recreate aclocal.m4 with macros from revision $package_revision
 3855: +$progname: of $PACKAGE $VERSION and run autoconf again.
 3856: +_LT_EOF
 3857: +      fi
 3858: +
 3859: +      exit $EXIT_MISMATCH
 3860: +    fi
 3861: +}
 3862: +
 3863: +
 3864: +# libtool_options_prep [ARG]...
 3865: +# -----------------------------
 3866: +# Preparation for options parsed by libtool.
 3867: +libtool_options_prep ()
 3868: +{
 3869: +    $debug_mode
 3870: +
 3871: +    # Option defaults:
 3872: +    opt_config=false
 3873: +    opt_dlopen=
 3874: +    opt_dry_run=false
 3875: +    opt_help=false
 3876: +    opt_mode=
 3877: +    opt_preserve_dup_deps=false
 3878: +    opt_quiet=false
 3879: +
 3880: +    nonopt=
 3881: +    preserve_args=
 3882: +
 3883: +    # Shorthand for --mode=foo, only valid as the first argument
 3884: +    case $1 in
 3885: +    clean|clea|cle|cl)
 3886: +      shift; set dummy --mode clean ${1+"$@"}; shift
 3887: +      ;;
 3888: +    compile|compil|compi|comp|com|co|c)
 3889: +      shift; set dummy --mode compile ${1+"$@"}; shift
 3890: +      ;;
 3891: +    execute|execut|execu|exec|exe|ex|e)
 3892: +      shift; set dummy --mode execute ${1+"$@"}; shift
 3893: +      ;;
 3894: +    finish|finis|fini|fin|fi|f)
 3895: +      shift; set dummy --mode finish ${1+"$@"}; shift
 3896: +      ;;
 3897: +    install|instal|insta|inst|ins|in|i)
 3898: +      shift; set dummy --mode install ${1+"$@"}; shift
 3899: +      ;;
 3900: +    link|lin|li|l)
 3901: +      shift; set dummy --mode link ${1+"$@"}; shift
 3902: +      ;;
 3903: +    uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
 3904: +      shift; set dummy --mode uninstall ${1+"$@"}; shift
 3905: +      ;;
 3906: +    esac
 3907: +
 3908: +    # Pass back the list of options.
 3909: +    func_quote_for_eval ${1+"$@"}
 3910: +    libtool_options_prep_result=$func_quote_for_eval_result
 3911: +}
 3912: +func_add_hook func_options_prep libtool_options_prep
 3913: +
 3914: +
 3915: +# libtool_parse_options [ARG]...
 3916: +# ---------------------------------
 3917: +# Provide handling for libtool specific options.
 3918: +libtool_parse_options ()
 3919: +{
 3920: +    $debug_cmd
 3921: +
 3922: +    # Perform our own loop to consume as many options as possible in
 3923: +    # each iteration.
 3924: +    while test $# -gt 0; do
 3925: +      _G_opt=$1
 3926: +      shift
 3927: +      case $_G_opt in
 3928: +        --dry-run|--dryrun|-n)
 3929: +                        opt_dry_run=:
 3930: +                        ;;
 3931: +
 3932: +        --config)       func_config ;;
 3933: +
 3934: +        --dlopen|-dlopen)
 3935: +                        opt_dlopen="${opt_dlopen+$opt_dlopen
 3936: +}$1"
 3937: +                        shift
 3938: +                        ;;
 3939: +
 3940: +        --preserve-dup-deps)
 3941: +                        opt_preserve_dup_deps=: ;;
 3942: +
 3943: +        --features)     func_features ;;
 3944: +
 3945: +        --finish)       set dummy --mode finish ${1+"$@"}; shift ;;
 3946: +
 3947: +        --help)         opt_help=: ;;
 3948: +
 3949: +        --help-all)     opt_help=': help-all' ;;
 3950: +
 3951: +        --mode)         test $# = 0 && func_missing_arg $_G_opt && break
 3952: +                        opt_mode=$1
 3953: +                        case $1 in
 3954: +                          # Valid mode arguments:
 3955: +                          clean|compile|execute|finish|install|link|relink|uninstall) ;;
 3956: +
 3957: +                          # Catch anything else as an error
 3958: +                          *) func_error "invalid argument for $_G_opt"
 3959: +                             exit_cmd=exit
 3960: +                             break
 3961: +                             ;;
 3962: +                        esac
 3963: +                        shift
 3964: +                        ;;
 3965: +
 3966: +        --no-silent|--no-quiet)
 3967: +                        opt_quiet=false
 3968: +                        func_append preserve_args " $_G_opt"
 3969: +                        ;;
 3970: +
 3971: +        --no-warnings|--no-warning|--no-warn)
 3972: +                        opt_warning=false
 3973: +                        func_append preserve_args " $_G_opt"
 3974: +                        ;;
 3975: +
 3976: +        --no-verbose)
 3977: +                        opt_verbose=false
 3978: +                        func_append preserve_args " $_G_opt"
 3979: +                        ;;
 3980: +
 3981: +        --silent|--quiet)
 3982: +                        opt_quiet=:
 3983: +                        opt_verbose=false
 3984: +                        func_append preserve_args " $_G_opt"
 3985: +                        ;;
 3986: +
 3987: +        --tag)          test $# = 0 && func_missing_arg $_G_opt && break
 3988: +                        opt_tag=$1
 3989: +                        func_append preserve_args " $_G_opt $1"
 3990: +                        func_enable_tag "$1"
 3991: +                        shift
 3992: +                        ;;
 3993: +
 3994: +        --verbose|-v)   opt_quiet=false
 3995: +                        opt_verbose=:
 3996: +                        func_append preserve_args " $_G_opt"
 3997: +                        ;;
 3998: +
 3999: +	# An option not handled by this hook function:
 4000: +        *)		set dummy "$_G_opt" ${1+"$@"};	shift; break  ;;
 4001: +      esac
 4002: +    done
 4003: +
 4004: +
 4005: +    # save modified positional parameters for caller
 4006: +    func_quote_for_eval ${1+"$@"}
 4007: +    libtool_parse_options_result=$func_quote_for_eval_result
 4008: +}
 4009: +func_add_hook func_parse_options libtool_parse_options
 4010: +
 4011: +
 4012: +
 4013: +# libtool_validate_options [ARG]...
 4014: +# ---------------------------------
 4015: +# Perform any sanity checks on option settings and/or unconsumed
 4016: +# arguments.
 4017: +libtool_validate_options ()
 4018: +{
 4019: +    # save first non-option argument
 4020: +    if test 0 -lt $#; then
 4021: +      nonopt=$1
 4022: +      shift
 4023: +    fi
 4024: +
 4025: +    # preserve --debug
 4026: +    test : = "$debug_cmd" || func_append preserve_args " --debug"
 4027: +
 4028: +    case $host in
 4029: +      # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
 4030: +      # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
 4031: +      *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
 4032: +        # don't eliminate duplications in $postdeps and $predeps
 4033: +        opt_duplicate_compiler_generated_deps=:
 4034: +        ;;
 4035: +      *)
 4036: +        opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
 4037: +        ;;
 4038: +    esac
 4039: +
 4040: +    $opt_help || {
 4041: +      # Sanity checks first:
 4042: +      func_check_version_match
 4043: +
 4044: +      test yes != "$build_libtool_libs" \
 4045: +        && test yes != "$build_old_libs" \
 4046: +        && func_fatal_configuration "not configured to build any kind of library"
 4047: +
 4048: +      # Darwin sucks
 4049: +      eval std_shrext=\"$shrext_cmds\"
 4050: +
 4051: +      # Only execute mode is allowed to have -dlopen flags.
 4052: +      if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
 4053: +        func_error "unrecognized option '-dlopen'"
 4054: +        $ECHO "$help" 1>&2
 4055: +        exit $EXIT_FAILURE
 4056: +      fi
 4057: +
 4058: +      # Change the help message to a mode-specific one.
 4059: +      generic_help=$help
 4060: +      help="Try '$progname --help --mode=$opt_mode' for more information."
 4061: +    }
 4062: +
 4063: +    # Pass back the unparsed argument list
 4064: +    func_quote_for_eval ${1+"$@"}
 4065: +    libtool_validate_options_result=$func_quote_for_eval_result
 4066: +}
 4067: +func_add_hook func_validate_options libtool_validate_options
 4068: +
 4069: +
 4070: +# Process options as early as possible so that --help and --version
 4071: +# can return quickly.
 4072: +func_options ${1+"$@"}
 4073: +eval set dummy "$func_options_result"; shift
 4074: +
 4075: +
 4076: +
 4077: +## ----------- ##
 4078: +##    Main.    ##
 4079: +## ----------- ##
 4080: +
 4081: +magic='%%%MAGIC variable%%%'
 4082: +magic_exe='%%%MAGIC EXE variable%%%'
 4083: +
 4084: +# Global variables.
 4085: +extracted_archives=
 4086: +extracted_serial=0
 4087: +
 4088: +# If this variable is set in any of the actions, the command in it
 4089: +# will be execed at the end.  This prevents here-documents from being
 4090: +# left over by shells.
 4091: +exec_cmd=
 4092: +
 4093: +
 4094: +# A function that is used when there is no print builtin or printf.
 4095: +func_fallback_echo ()
 4096: +{
 4097: +  eval 'cat <<_LTECHO_EOF
 4098: +$1
 4099: +_LTECHO_EOF'
 4100: +}
 4101: +
 4102: +# func_generated_by_libtool
 4103: +# True iff stdin has been generated by Libtool. This function is only
 4104: +# a basic sanity check; it will hardly flush out determined imposters.
 4105: +func_generated_by_libtool_p ()
 4106: +{
 4107: +  $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
 4108: +}
 4109: +
 4110: +# func_lalib_p file
 4111: +# True iff FILE is a libtool '.la' library or '.lo' object file.
 4112: +# This function is only a basic sanity check; it will hardly flush out
 4113: +# determined imposters.
 4114: +func_lalib_p ()
 4115: +{
 4116: +    test -f "$1" &&
 4117: +      $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
 4118: +}
 4119: +
 4120: +# func_lalib_unsafe_p file
 4121: +# True iff FILE is a libtool '.la' library or '.lo' object file.
 4122: +# This function implements the same check as func_lalib_p without
 4123: +# resorting to external programs.  To this end, it redirects stdin and
 4124: +# closes it afterwards, without saving the original file descriptor.
 4125: +# As a safety measure, use it only where a negative result would be
 4126: +# fatal anyway.  Works if 'file' does not exist.
 4127: +func_lalib_unsafe_p ()
 4128: +{
 4129: +    lalib_p=no
 4130: +    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
 4131: +	for lalib_p_l in 1 2 3 4
 4132: +	do
 4133: +	    read lalib_p_line
 4134: +	    case $lalib_p_line in
 4135: +		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
 4136: +	    esac
 4137: +	done
 4138: +	exec 0<&5 5<&-
 4139: +    fi
 4140: +    test yes = "$lalib_p"
 4141: +}
 4142: +
 4143: +# func_ltwrapper_script_p file
 4144: +# True iff FILE is a libtool wrapper script
 4145: +# This function is only a basic sanity check; it will hardly flush out
 4146: +# determined imposters.
 4147: +func_ltwrapper_script_p ()
 4148: +{
 4149: +    test -f "$1" &&
 4150: +      $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
 4151: +}
 4152: +
 4153: +# func_ltwrapper_executable_p file
 4154: +# True iff FILE is a libtool wrapper executable
 4155: +# This function is only a basic sanity check; it will hardly flush out
 4156: +# determined imposters.
 4157: +func_ltwrapper_executable_p ()
 4158: +{
 4159: +    func_ltwrapper_exec_suffix=
 4160: +    case $1 in
 4161: +    *.exe) ;;
 4162: +    *) func_ltwrapper_exec_suffix=.exe ;;
 4163: +    esac
 4164: +    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
 4165: +}
 4166: +
 4167: +# func_ltwrapper_scriptname file
 4168: +# Assumes file is an ltwrapper_executable
 4169: +# uses $file to determine the appropriate filename for a
 4170: +# temporary ltwrapper_script.
 4171: +func_ltwrapper_scriptname ()
 4172: +{
 4173: +    func_dirname_and_basename "$1" "" "."
 4174: +    func_stripname '' '.exe' "$func_basename_result"
 4175: +    func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
 4176: +}
 4177: +
 4178: +# func_ltwrapper_p file
 4179: +# True iff FILE is a libtool wrapper script or wrapper executable
 4180: +# This function is only a basic sanity check; it will hardly flush out
 4181: +# determined imposters.
 4182: +func_ltwrapper_p ()
 4183: +{
 4184: +    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
 4185: +}
 4186: +
 4187: +
 4188: +# func_execute_cmds commands fail_cmd
 4189: +# Execute tilde-delimited COMMANDS.
 4190: +# If FAIL_CMD is given, eval that upon failure.
 4191: +# FAIL_CMD may read-access the current command in variable CMD!
 4192: +func_execute_cmds ()
 4193: +{
 4194: +    $debug_cmd
 4195: +
 4196: +    save_ifs=$IFS; IFS='~'
 4197: +    for cmd in $1; do
 4198: +      IFS=$sp$nl
 4199: +      eval cmd=\"$cmd\"
 4200: +      IFS=$save_ifs
 4201: +      func_show_eval "$cmd" "${2-:}"
 4202: +    done
 4203: +    IFS=$save_ifs
 4204: +}
 4205: +
 4206: +
 4207: +# func_source file
 4208: +# Source FILE, adding directory component if necessary.
 4209: +# Note that it is not necessary on cygwin/mingw to append a dot to
 4210: +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
 4211: +# behavior happens only for exec(3), not for open(2)!  Also, sourcing
 4212: +# 'FILE.' does not work on cygwin managed mounts.
 4213: +func_source ()
 4214: +{
 4215: +    $debug_cmd
 4216: +
 4217: +    case $1 in
 4218: +    */* | *\\*)	. "$1" ;;
 4219: +    *)		. "./$1" ;;
 4220: +    esac
 4221: +}
 4222: +
 4223: +
 4224: +# func_resolve_sysroot PATH
 4225: +# Replace a leading = in PATH with a sysroot.  Store the result into
 4226: +# func_resolve_sysroot_result
 4227: +func_resolve_sysroot ()
 4228: +{
 4229: +  func_resolve_sysroot_result=$1
 4230: +  case $func_resolve_sysroot_result in
 4231: +  =*)
 4232: +    func_stripname '=' '' "$func_resolve_sysroot_result"
 4233: +    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
 4234: +    ;;
 4235: +  esac
 4236: +}
 4237: +
 4238: +# func_replace_sysroot PATH
 4239: +# If PATH begins with the sysroot, replace it with = and
 4240: +# store the result into func_replace_sysroot_result.
 4241: +func_replace_sysroot ()
 4242: +{
 4243: +  case $lt_sysroot:$1 in
 4244: +  ?*:"$lt_sysroot"*)
 4245: +    func_stripname "$lt_sysroot" '' "$1"
 4246: +    func_replace_sysroot_result='='$func_stripname_result
 4247: +    ;;
 4248: +  *)
 4249: +    # Including no sysroot.
 4250: +    func_replace_sysroot_result=$1
 4251: +    ;;
 4252: +  esac
 4253: +}
 4254: +
 4255: +# func_infer_tag arg
 4256: +# Infer tagged configuration to use if any are available and
 4257: +# if one wasn't chosen via the "--tag" command line option.
 4258: +# Only attempt this if the compiler in the base compile
 4259: +# command doesn't match the default compiler.
 4260: +# arg is usually of the form 'gcc ...'
 4261: +func_infer_tag ()
 4262: +{
 4263: +    $debug_cmd
 4264: +
 4265: +    if test -n "$available_tags" && test -z "$tagname"; then
 4266: +      CC_quoted=
 4267: +      for arg in $CC; do
 4268: +	func_append_quoted CC_quoted "$arg"
 4269: +      done
 4270: +      CC_expanded=`func_echo_all $CC`
 4271: +      CC_quoted_expanded=`func_echo_all $CC_quoted`
 4272: +      case $@ in
 4273: +      # Blanks in the command may have been stripped by the calling shell,
 4274: +      # but not from the CC environment variable when configure was run.
 4275: +      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
 4276: +      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
 4277: +      # Blanks at the start of $base_compile will cause this to fail
 4278: +      # if we don't check for them as well.
 4279: +      *)
 4280: +	for z in $available_tags; do
 4281: +	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
 4282: +	    # Evaluate the configuration.
 4283: +	    eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
 4284: +	    CC_quoted=
 4285: +	    for arg in $CC; do
 4286: +	      # Double-quote args containing other shell metacharacters.
 4287: +	      func_append_quoted CC_quoted "$arg"
 4288: +	    done
 4289: +	    CC_expanded=`func_echo_all $CC`
 4290: +	    CC_quoted_expanded=`func_echo_all $CC_quoted`
 4291: +	    case "$@ " in
 4292: +	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
 4293: +	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
 4294: +	      # The compiler in the base compile command matches
 4295: +	      # the one in the tagged configuration.
 4296: +	      # Assume this is the tagged configuration we want.
 4297: +	      tagname=$z
 4298: +	      break
 4299: +	      ;;
 4300: +	    esac
 4301: +	  fi
 4302: +	done
 4303: +	# If $tagname still isn't set, then no tagged configuration
 4304: +	# was found and let the user know that the "--tag" command
 4305: +	# line option must be used.
 4306: +	if test -z "$tagname"; then
 4307: +	  func_echo "unable to infer tagged configuration"
 4308: +	  func_fatal_error "specify a tag with '--tag'"
 4309: +#	else
 4310: +#	  func_verbose "using $tagname tagged configuration"
 4311: +	fi
 4312: +	;;
 4313: +      esac
 4314: +    fi
 4315: +}
 4316: +
 4317: +
 4318: +
 4319: +# func_write_libtool_object output_name pic_name nonpic_name
 4320: +# Create a libtool object file (analogous to a ".la" file),
 4321: +# but don't create it if we're doing a dry run.
 4322: +func_write_libtool_object ()
 4323: +{
 4324: +    write_libobj=$1
 4325: +    if test yes = "$build_libtool_libs"; then
 4326: +      write_lobj=\'$2\'
 4327: +    else
 4328: +      write_lobj=none
 4329: +    fi
 4330: +
 4331: +    if test yes = "$build_old_libs"; then
 4332: +      write_oldobj=\'$3\'
 4333: +    else
 4334: +      write_oldobj=none
 4335: +    fi
 4336: +
 4337: +    $opt_dry_run || {
 4338: +      cat >${write_libobj}T <<EOF
 4339: +# $write_libobj - a libtool object file
 4340: +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
 4341: +#
 4342: +# Please DO NOT delete this file!
 4343: +# It is necessary for linking the library.
 4344: +
 4345: +# Name of the PIC object.
 4346: +pic_object=$write_lobj
 4347: +
 4348: +# Name of the non-PIC object
 4349: +non_pic_object=$write_oldobj
 4350: +
 4351: +EOF
 4352: +      $MV "${write_libobj}T" "$write_libobj"
 4353: +    }
 4354: +}
 4355: +
 4356: +
 4357: +##################################################
 4358: +# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
 4359: +##################################################
 4360: +
 4361: +# func_convert_core_file_wine_to_w32 ARG
 4362: +# Helper function used by file name conversion functions when $build is *nix,
 4363: +# and $host is mingw, cygwin, or some other w32 environment. Relies on a
 4364: +# correctly configured wine environment available, with the winepath program
 4365: +# in $build's $PATH.
 4366: +#
 4367: +# ARG is the $build file name to be converted to w32 format.
 4368: +# Result is available in $func_convert_core_file_wine_to_w32_result, and will
 4369: +# be empty on error (or when ARG is empty)
 4370: +func_convert_core_file_wine_to_w32 ()
 4371: +{
 4372: +  $debug_cmd
 4373: +
 4374: +  func_convert_core_file_wine_to_w32_result=$1
 4375: +  if test -n "$1"; then
 4376: +    # Unfortunately, winepath does not exit with a non-zero error code, so we
 4377: +    # are forced to check the contents of stdout. On the other hand, if the
 4378: +    # command is not found, the shell will set an exit code of 127 and print
 4379: +    # *an error message* to stdout. So we must check for both error code of
 4380: +    # zero AND non-empty stdout, which explains the odd construction:
 4381: +    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
 4382: +    if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
 4383: +      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
 4384: +        $SED -e "$sed_naive_backslashify"`
 4385: +    else
 4386: +      func_convert_core_file_wine_to_w32_result=
 4387: +    fi
 4388: +  fi
 4389: +}
 4390: +# end: func_convert_core_file_wine_to_w32
 4391: +
 4392: +
 4393: +# func_convert_core_path_wine_to_w32 ARG
 4394: +# Helper function used by path conversion functions when $build is *nix, and
 4395: +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
 4396: +# configured wine environment available, with the winepath program in $build's
 4397: +# $PATH. Assumes ARG has no leading or trailing path separator characters.
 4398: +#
 4399: +# ARG is path to be converted from $build format to win32.
 4400: +# Result is available in $func_convert_core_path_wine_to_w32_result.
 4401: +# Unconvertible file (directory) names in ARG are skipped; if no directory names
 4402: +# are convertible, then the result may be empty.
 4403: +func_convert_core_path_wine_to_w32 ()
 4404: +{
 4405: +  $debug_cmd
 4406: +
 4407: +  # unfortunately, winepath doesn't convert paths, only file names
 4408: +  func_convert_core_path_wine_to_w32_result=
 4409: +  if test -n "$1"; then
 4410: +    oldIFS=$IFS
 4411: +    IFS=:
 4412: +    for func_convert_core_path_wine_to_w32_f in $1; do
 4413: +      IFS=$oldIFS
 4414: +      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
 4415: +      if test -n "$func_convert_core_file_wine_to_w32_result"; then
 4416: +        if test -z "$func_convert_core_path_wine_to_w32_result"; then
 4417: +          func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
 4418: +        else
 4419: +          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
 4420: +        fi
 4421: +      fi
 4422: +    done
 4423: +    IFS=$oldIFS
 4424: +  fi
 4425: +}
 4426: +# end: func_convert_core_path_wine_to_w32
 4427: +
 4428: +
 4429: +# func_cygpath ARGS...
 4430: +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
 4431: +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
 4432: +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
 4433: +# (2), returns the Cygwin file name or path in func_cygpath_result (input
 4434: +# file name or path is assumed to be in w32 format, as previously converted
 4435: +# from $build's *nix or MSYS format). In case (3), returns the w32 file name
 4436: +# or path in func_cygpath_result (input file name or path is assumed to be in
 4437: +# Cygwin format). Returns an empty string on error.
 4438: +#
 4439: +# ARGS are passed to cygpath, with the last one being the file name or path to
 4440: +# be converted.
 4441: +#
 4442: +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
 4443: +# environment variable; do not put it in $PATH.
 4444: +func_cygpath ()
 4445: +{
 4446: +  $debug_cmd
 4447: +
 4448: +  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
 4449: +    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
 4450: +    if test "$?" -ne 0; then
 4451: +      # on failure, ensure result is empty
 4452: +      func_cygpath_result=
 4453: +    fi
 4454: +  else
 4455: +    func_cygpath_result=
 4456: +    func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
 4457: +  fi
 4458: +}
 4459: +#end: func_cygpath
 4460: +
 4461: +
 4462: +# func_convert_core_msys_to_w32 ARG
 4463: +# Convert file name or path ARG from MSYS format to w32 format.  Return
 4464: +# result in func_convert_core_msys_to_w32_result.
 4465: +func_convert_core_msys_to_w32 ()
 4466: +{
 4467: +  $debug_cmd
 4468: +
 4469: +  # awkward: cmd appends spaces to result
 4470: +  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
 4471: +    $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
 4472: +}
 4473: +#end: func_convert_core_msys_to_w32
 4474: +
 4475: +
 4476: +# func_convert_file_check ARG1 ARG2
 4477: +# Verify that ARG1 (a file name in $build format) was converted to $host
 4478: +# format in ARG2. Otherwise, emit an error message, but continue (resetting
 4479: +# func_to_host_file_result to ARG1).
 4480: +func_convert_file_check ()
 4481: +{
 4482: +  $debug_cmd
 4483: +
 4484: +  if test -z "$2" && test -n "$1"; then
 4485: +    func_error "Could not determine host file name corresponding to"
 4486: +    func_error "  '$1'"
 4487: +    func_error "Continuing, but uninstalled executables may not work."
 4488: +    # Fallback:
 4489: +    func_to_host_file_result=$1
 4490: +  fi
 4491: +}
 4492: +# end func_convert_file_check
 4493: +
 4494: +
 4495: +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
 4496: +# Verify that FROM_PATH (a path in $build format) was converted to $host
 4497: +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
 4498: +# func_to_host_file_result to a simplistic fallback value (see below).
 4499: +func_convert_path_check ()
 4500: +{
 4501: +  $debug_cmd
 4502: +
 4503: +  if test -z "$4" && test -n "$3"; then
 4504: +    func_error "Could not determine the host path corresponding to"
 4505: +    func_error "  '$3'"
 4506: +    func_error "Continuing, but uninstalled executables may not work."
 4507: +    # Fallback.  This is a deliberately simplistic "conversion" and
 4508: +    # should not be "improved".  See libtool.info.
 4509: +    if test "x$1" != "x$2"; then
 4510: +      lt_replace_pathsep_chars="s|$1|$2|g"
 4511: +      func_to_host_path_result=`echo "$3" |
 4512: +        $SED -e "$lt_replace_pathsep_chars"`
 4513: +    else
 4514: +      func_to_host_path_result=$3
 4515: +    fi
 4516: +  fi
 4517: +}
 4518: +# end func_convert_path_check
 4519: +
 4520: +
 4521: +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
 4522: +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
 4523: +# and appending REPL if ORIG matches BACKPAT.
 4524: +func_convert_path_front_back_pathsep ()
 4525: +{
 4526: +  $debug_cmd
 4527: +
 4528: +  case $4 in
 4529: +  $1 ) func_to_host_path_result=$3$func_to_host_path_result
 4530: +    ;;
 4531: +  esac
 4532: +  case $4 in
 4533: +  $2 ) func_append func_to_host_path_result "$3"
 4534: +    ;;
 4535: +  esac
 4536: +}
 4537: +# end func_convert_path_front_back_pathsep
 4538: +
 4539: +
 4540: +##################################################
 4541: +# $build to $host FILE NAME CONVERSION FUNCTIONS #
 4542: +##################################################
 4543: +# invoked via '$to_host_file_cmd ARG'
 4544: +#
 4545: +# In each case, ARG is the path to be converted from $build to $host format.
 4546: +# Result will be available in $func_to_host_file_result.
 4547: +
 4548: +
 4549: +# func_to_host_file ARG
 4550: +# Converts the file name ARG from $build format to $host format. Return result
 4551: +# in func_to_host_file_result.
 4552: +func_to_host_file ()
 4553: +{
 4554: +  $debug_cmd
 4555: +
 4556: +  $to_host_file_cmd "$1"
 4557: +}
 4558: +# end func_to_host_file
 4559: +
 4560: +
 4561: +# func_to_tool_file ARG LAZY
 4562: +# converts the file name ARG from $build format to toolchain format. Return
 4563: +# result in func_to_tool_file_result.  If the conversion in use is listed
 4564: +# in (the comma separated) LAZY, no conversion takes place.
 4565: +func_to_tool_file ()
 4566: +{
 4567: +  $debug_cmd
 4568: +
 4569: +  case ,$2, in
 4570: +    *,"$to_tool_file_cmd",*)
 4571: +      func_to_tool_file_result=$1
 4572: +      ;;
 4573: +    *)
 4574: +      $to_tool_file_cmd "$1"
 4575: +      func_to_tool_file_result=$func_to_host_file_result
 4576: +      ;;
 4577: +  esac
 4578: +}
 4579: +# end func_to_tool_file
 4580: +
 4581: +
 4582: +# func_convert_file_noop ARG
 4583: +# Copy ARG to func_to_host_file_result.
 4584: +func_convert_file_noop ()
 4585: +{
 4586: +  func_to_host_file_result=$1
 4587: +}
 4588: +# end func_convert_file_noop
 4589: +
 4590: +
 4591: +# func_convert_file_msys_to_w32 ARG
 4592: +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
 4593: +# conversion to w32 is not available inside the cwrapper.  Returns result in
 4594: +# func_to_host_file_result.
 4595: +func_convert_file_msys_to_w32 ()
 4596: +{
 4597: +  $debug_cmd
 4598: +
 4599: +  func_to_host_file_result=$1
 4600: +  if test -n "$1"; then
 4601: +    func_convert_core_msys_to_w32 "$1"
 4602: +    func_to_host_file_result=$func_convert_core_msys_to_w32_result
 4603: +  fi
 4604: +  func_convert_file_check "$1" "$func_to_host_file_result"
 4605: +}
 4606: +# end func_convert_file_msys_to_w32
 4607: +
 4608: +
 4609: +# func_convert_file_cygwin_to_w32 ARG
 4610: +# Convert file name ARG from Cygwin to w32 format.  Returns result in
 4611: +# func_to_host_file_result.
 4612: +func_convert_file_cygwin_to_w32 ()
 4613: +{
 4614: +  $debug_cmd
 4615: +
 4616: +  func_to_host_file_result=$1
 4617: +  if test -n "$1"; then
 4618: +    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
 4619: +    # LT_CYGPATH in this case.
 4620: +    func_to_host_file_result=`cygpath -m "$1"`
 4621: +  fi
 4622: +  func_convert_file_check "$1" "$func_to_host_file_result"
 4623: +}
 4624: +# end func_convert_file_cygwin_to_w32
 4625: +
 4626: +
 4627: +# func_convert_file_nix_to_w32 ARG
 4628: +# Convert file name ARG from *nix to w32 format.  Requires a wine environment
 4629: +# and a working winepath. Returns result in func_to_host_file_result.
 4630: +func_convert_file_nix_to_w32 ()
 4631: +{
 4632: +  $debug_cmd
 4633: +
 4634: +  func_to_host_file_result=$1
 4635: +  if test -n "$1"; then
 4636: +    func_convert_core_file_wine_to_w32 "$1"
 4637: +    func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
 4638: +  fi
 4639: +  func_convert_file_check "$1" "$func_to_host_file_result"
 4640: +}
 4641: +# end func_convert_file_nix_to_w32
 4642: +
 4643: +
 4644: +# func_convert_file_msys_to_cygwin ARG
 4645: +# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
 4646: +# Returns result in func_to_host_file_result.
 4647: +func_convert_file_msys_to_cygwin ()
 4648: +{
 4649: +  $debug_cmd
 4650: +
 4651: +  func_to_host_file_result=$1
 4652: +  if test -n "$1"; then
 4653: +    func_convert_core_msys_to_w32 "$1"
 4654: +    func_cygpath -u "$func_convert_core_msys_to_w32_result"
 4655: +    func_to_host_file_result=$func_cygpath_result
 4656: +  fi
 4657: +  func_convert_file_check "$1" "$func_to_host_file_result"
 4658: +}
 4659: +# end func_convert_file_msys_to_cygwin
 4660: +
 4661: +
 4662: +# func_convert_file_nix_to_cygwin ARG
 4663: +# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
 4664: +# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
 4665: +# in func_to_host_file_result.
 4666: +func_convert_file_nix_to_cygwin ()
 4667: +{
 4668: +  $debug_cmd
 4669: +
 4670: +  func_to_host_file_result=$1
 4671: +  if test -n "$1"; then
 4672: +    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
 4673: +    func_convert_core_file_wine_to_w32 "$1"
 4674: +    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
 4675: +    func_to_host_file_result=$func_cygpath_result
 4676: +  fi
 4677: +  func_convert_file_check "$1" "$func_to_host_file_result"
 4678: +}
 4679: +# end func_convert_file_nix_to_cygwin
 4680: +
 4681: +
 4682: +#############################################
 4683: +# $build to $host PATH CONVERSION FUNCTIONS #
 4684: +#############################################
 4685: +# invoked via '$to_host_path_cmd ARG'
 4686: +#
 4687: +# In each case, ARG is the path to be converted from $build to $host format.
 4688: +# The result will be available in $func_to_host_path_result.
 4689: +#
 4690: +# Path separators are also converted from $build format to $host format.  If
 4691: +# ARG begins or ends with a path separator character, it is preserved (but
 4692: +# converted to $host format) on output.
 4693: +#
 4694: +# All path conversion functions are named using the following convention:
 4695: +#   file name conversion function    : func_convert_file_X_to_Y ()
 4696: +#   path conversion function         : func_convert_path_X_to_Y ()
 4697: +# where, for any given $build/$host combination the 'X_to_Y' value is the
 4698: +# same.  If conversion functions are added for new $build/$host combinations,
 4699: +# the two new functions must follow this pattern, or func_init_to_host_path_cmd
 4700: +# will break.
 4701: +
 4702: +
 4703: +# func_init_to_host_path_cmd
 4704: +# Ensures that function "pointer" variable $to_host_path_cmd is set to the
 4705: +# appropriate value, based on the value of $to_host_file_cmd.
 4706: +to_host_path_cmd=
 4707: +func_init_to_host_path_cmd ()
 4708: +{
 4709: +  $debug_cmd
 4710: +
 4711: +  if test -z "$to_host_path_cmd"; then
 4712: +    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
 4713: +    to_host_path_cmd=func_convert_path_$func_stripname_result
 4714: +  fi
 4715: +}
 4716: +
 4717: +
 4718: +# func_to_host_path ARG
 4719: +# Converts the path ARG from $build format to $host format. Return result
 4720: +# in func_to_host_path_result.
 4721: +func_to_host_path ()
 4722: +{
 4723: +  $debug_cmd
 4724: +
 4725: +  func_init_to_host_path_cmd
 4726: +  $to_host_path_cmd "$1"
 4727: +}
 4728: +# end func_to_host_path
 4729: +
 4730: +
 4731: +# func_convert_path_noop ARG
 4732: +# Copy ARG to func_to_host_path_result.
 4733: +func_convert_path_noop ()
 4734: +{
 4735: +  func_to_host_path_result=$1
 4736: +}
 4737: +# end func_convert_path_noop
 4738: +
 4739: +
 4740: +# func_convert_path_msys_to_w32 ARG
 4741: +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
 4742: +# conversion to w32 is not available inside the cwrapper.  Returns result in
 4743: +# func_to_host_path_result.
 4744: +func_convert_path_msys_to_w32 ()
 4745: +{
 4746: +  $debug_cmd
 4747: +
 4748: +  func_to_host_path_result=$1
 4749: +  if test -n "$1"; then
 4750: +    # Remove leading and trailing path separator characters from ARG.  MSYS
 4751: +    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
 4752: +    # and winepath ignores them completely.
 4753: +    func_stripname : : "$1"
 4754: +    func_to_host_path_tmp1=$func_stripname_result
 4755: +    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
 4756: +    func_to_host_path_result=$func_convert_core_msys_to_w32_result
 4757: +    func_convert_path_check : ";" \
 4758: +      "$func_to_host_path_tmp1" "$func_to_host_path_result"
 4759: +    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
 4760: +  fi
 4761: +}
 4762: +# end func_convert_path_msys_to_w32
 4763: +
 4764: +
 4765: +# func_convert_path_cygwin_to_w32 ARG
 4766: +# Convert path ARG from Cygwin to w32 format.  Returns result in
 4767: +# func_to_host_file_result.
 4768: +func_convert_path_cygwin_to_w32 ()
 4769: +{
 4770: +  $debug_cmd
 4771: +
 4772: +  func_to_host_path_result=$1
 4773: +  if test -n "$1"; then
 4774: +    # See func_convert_path_msys_to_w32:
 4775: +    func_stripname : : "$1"
 4776: +    func_to_host_path_tmp1=$func_stripname_result
 4777: +    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
 4778: +    func_convert_path_check : ";" \
 4779: +      "$func_to_host_path_tmp1" "$func_to_host_path_result"
 4780: +    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
 4781: +  fi
 4782: +}
 4783: +# end func_convert_path_cygwin_to_w32
 4784: +
 4785: +
 4786: +# func_convert_path_nix_to_w32 ARG
 4787: +# Convert path ARG from *nix to w32 format.  Requires a wine environment and
 4788: +# a working winepath.  Returns result in func_to_host_file_result.
 4789: +func_convert_path_nix_to_w32 ()
 4790: +{
 4791: +  $debug_cmd
 4792: +
 4793: +  func_to_host_path_result=$1
 4794: +  if test -n "$1"; then
 4795: +    # See func_convert_path_msys_to_w32:
 4796: +    func_stripname : : "$1"
 4797: +    func_to_host_path_tmp1=$func_stripname_result
 4798: +    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
 4799: +    func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
 4800: +    func_convert_path_check : ";" \
 4801: +      "$func_to_host_path_tmp1" "$func_to_host_path_result"
 4802: +    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
 4803: +  fi
 4804: +}
 4805: +# end func_convert_path_nix_to_w32
 4806: +
 4807: +
 4808: +# func_convert_path_msys_to_cygwin ARG
 4809: +# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
 4810: +# Returns result in func_to_host_file_result.
 4811: +func_convert_path_msys_to_cygwin ()
 4812: +{
 4813: +  $debug_cmd
 4814: +
 4815: +  func_to_host_path_result=$1
 4816: +  if test -n "$1"; then
 4817: +    # See func_convert_path_msys_to_w32:
 4818: +    func_stripname : : "$1"
 4819: +    func_to_host_path_tmp1=$func_stripname_result
 4820: +    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
 4821: +    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
 4822: +    func_to_host_path_result=$func_cygpath_result
 4823: +    func_convert_path_check : : \
 4824: +      "$func_to_host_path_tmp1" "$func_to_host_path_result"
 4825: +    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
 4826: +  fi
 4827: +}
 4828: +# end func_convert_path_msys_to_cygwin
 4829: +
 4830: +
 4831: +# func_convert_path_nix_to_cygwin ARG
 4832: +# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
 4833: +# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
 4834: +# func_to_host_file_result.
 4835: +func_convert_path_nix_to_cygwin ()
 4836: +{
 4837: +  $debug_cmd
 4838: +
 4839: +  func_to_host_path_result=$1
 4840: +  if test -n "$1"; then
 4841: +    # Remove leading and trailing path separator characters from
 4842: +    # ARG. msys behavior is inconsistent here, cygpath turns them
 4843: +    # into '.;' and ';.', and winepath ignores them completely.
 4844: +    func_stripname : : "$1"
 4845: +    func_to_host_path_tmp1=$func_stripname_result
 4846: +    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
 4847: +    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
 4848: +    func_to_host_path_result=$func_cygpath_result
 4849: +    func_convert_path_check : : \
 4850: +      "$func_to_host_path_tmp1" "$func_to_host_path_result"
 4851: +    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
 4852: +  fi
 4853: +}
 4854: +# end func_convert_path_nix_to_cygwin
 4855: +
 4856: +
 4857: +# func_dll_def_p FILE
 4858: +# True iff FILE is a Windows DLL '.def' file.
 4859: +# Keep in sync with _LT_DLL_DEF_P in libtool.m4
 4860: +func_dll_def_p ()
 4861: +{
 4862: +  $debug_cmd
 4863: +
 4864: +  func_dll_def_p_tmp=`$SED -n \
 4865: +    -e 's/^[	 ]*//' \
 4866: +    -e '/^\(;.*\)*$/d' \
 4867: +    -e 's/^\(EXPORTS\|LIBRARY\)\([	 ].*\)*$/DEF/p' \
 4868: +    -e q \
 4869: +    "$1"`
 4870: +  test DEF = "$func_dll_def_p_tmp"
 4871: +}
 4872: +
 4873: +
 4874: +# func_mode_compile arg...
 4875: +func_mode_compile ()
 4876: +{
 4877: +    $debug_cmd
 4878: +
 4879: +    # Get the compilation command and the source file.
 4880: +    base_compile=
 4881: +    srcfile=$nonopt  #  always keep a non-empty value in "srcfile"
 4882: +    suppress_opt=yes
 4883: +    suppress_output=
 4884: +    arg_mode=normal
 4885: +    libobj=
 4886: +    later=
 4887: +    pie_flag=
 4888: +
 4889: +    for arg
 4890: +    do
 4891: +      case $arg_mode in
 4892: +      arg  )
 4893: +	# do not "continue".  Instead, add this to base_compile
 4894: +	lastarg=$arg
 4895: +	arg_mode=normal
 4896: +	;;
 4897: +
 4898: +      target )
 4899: +	libobj=$arg
 4900: +	arg_mode=normal
 4901: +	continue
 4902: +	;;
 4903: +
 4904: +      normal )
 4905: +	# Accept any command-line options.
 4906: +	case $arg in
 4907: +	-o)
 4908: +	  test -n "$libobj" && \
 4909: +	    func_fatal_error "you cannot specify '-o' more than once"
 4910: +	  arg_mode=target
 4911: +	  continue
 4912: +	  ;;
 4913: +
 4914: +	-pie | -fpie | -fPIE)
 4915: +          func_append pie_flag " $arg"
 4916: +	  continue
 4917: +	  ;;
 4918: +
 4919: +	-shared | -static | -prefer-pic | -prefer-non-pic)
 4920: +	  func_append later " $arg"
 4921: +	  continue
 4922: +	  ;;
 4923: +
 4924: +	-no-suppress)
 4925: +	  suppress_opt=no
 4926: +	  continue
 4927: +	  ;;
 4928: +
 4929: +	-Xcompiler)
 4930: +	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
 4931: +	  continue      #  The current "srcfile" will either be retained or
 4932: +	  ;;            #  replaced later.  I would guess that would be a bug.
 4933: +
 4934: +	-Wc,*)
 4935: +	  func_stripname '-Wc,' '' "$arg"
 4936: +	  args=$func_stripname_result
 4937: +	  lastarg=
 4938: +	  save_ifs=$IFS; IFS=,
 4939: +	  for arg in $args; do
 4940: +	    IFS=$save_ifs
 4941: +	    func_append_quoted lastarg "$arg"
 4942: +	  done
 4943: +	  IFS=$save_ifs
 4944: +	  func_stripname ' ' '' "$lastarg"
 4945: +	  lastarg=$func_stripname_result
 4946: +
 4947: +	  # Add the arguments to base_compile.
 4948: +	  func_append base_compile " $lastarg"
 4949: +	  continue
 4950: +	  ;;
 4951: +
 4952: +	*)
 4953: +	  # Accept the current argument as the source file.
 4954: +	  # The previous "srcfile" becomes the current argument.
 4955: +	  #
 4956: +	  lastarg=$srcfile
 4957: +	  srcfile=$arg
 4958: +	  ;;
 4959: +	esac  #  case $arg
 4960: +	;;
 4961: +      esac    #  case $arg_mode
 4962: +
 4963: +      # Aesthetically quote the previous argument.
 4964: +      func_append_quoted base_compile "$lastarg"
 4965: +    done # for arg
 4966: +
 4967: +    case $arg_mode in
 4968: +    arg)
 4969: +      func_fatal_error "you must specify an argument for -Xcompile"
 4970: +      ;;
 4971: +    target)
 4972: +      func_fatal_error "you must specify a target with '-o'"
 4973: +      ;;
 4974: +    *)
 4975: +      # Get the name of the library object.
 4976: +      test -z "$libobj" && {
 4977: +	func_basename "$srcfile"
 4978: +	libobj=$func_basename_result
 4979: +      }
 4980: +      ;;
 4981: +    esac
 4982: +
 4983: +    # Recognize several different file suffixes.
 4984: +    # If the user specifies -o file.o, it is replaced with file.lo
 4985: +    case $libobj in
 4986: +    *.[cCFSifmso] | \
 4987: +    *.ada | *.adb | *.ads | *.asm | \
 4988: +    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
 4989: +    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
 4990: +      func_xform "$libobj"
 4991: +      libobj=$func_xform_result
 4992: +      ;;
 4993: +    esac
 4994: +
 4995: +    case $libobj in
 4996: +    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
 4997: +    *)
 4998: +      func_fatal_error "cannot determine name of library object from '$libobj'"
 4999: +      ;;
 5000: +    esac
 5001: +
 5002: +    func_infer_tag $base_compile
 5003: +
 5004: +    for arg in $later; do
 5005: +      case $arg in
 5006: +      -shared)
 5007: +	test yes = "$build_libtool_libs" \
 5008: +	  || func_fatal_configuration "cannot build a shared library"
 5009: +	build_old_libs=no
 5010: +	continue
 5011: +	;;
 5012: +
 5013: +      -static)
 5014: +	build_libtool_libs=no
 5015: +	build_old_libs=yes
 5016: +	continue
 5017: +	;;
 5018: +
 5019: +      -prefer-pic)
 5020: +	pic_mode=yes
 5021: +	continue
 5022: +	;;
 5023: +
 5024: +      -prefer-non-pic)
 5025: +	pic_mode=no
 5026: +	continue
 5027: +	;;
 5028: +      esac
 5029: +    done
 5030: +
 5031: +    func_quote_for_eval "$libobj"
 5032: +    test "X$libobj" != "X$func_quote_for_eval_result" \
 5033: +      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
 5034: +      && func_warning "libobj name '$libobj' may not contain shell special characters."
 5035: +    func_dirname_and_basename "$obj" "/" ""
 5036: +    objname=$func_basename_result
 5037: +    xdir=$func_dirname_result
 5038: +    lobj=$xdir$objdir/$objname
 5039: +
 5040: +    test -z "$base_compile" && \
 5041: +      func_fatal_help "you must specify a compilation command"
 5042: +
 5043: +    # Delete any leftover library objects.
 5044: +    if test yes = "$build_old_libs"; then
 5045: +      removelist="$obj $lobj $libobj ${libobj}T"
 5046: +    else
 5047: +      removelist="$lobj $libobj ${libobj}T"
 5048: +    fi
 5049: +
 5050: +    # On Cygwin there's no "real" PIC flag so we must build both object types
 5051: +    case $host_os in
 5052: +    cygwin* | mingw* | pw32* | os2* | cegcc*)
 5053: +      pic_mode=default
 5054: +      ;;
 5055: +    esac
 5056: +    if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
 5057: +      # non-PIC code in shared libraries is not supported
 5058: +      pic_mode=default
 5059: +    fi
 5060: +
 5061: +    # Calculate the filename of the output object if compiler does
 5062: +    # not support -o with -c
 5063: +    if test no = "$compiler_c_o"; then
 5064: +      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
 5065: +      lockfile=$output_obj.lock
 5066: +    else
 5067: +      output_obj=
 5068: +      need_locks=no
 5069: +      lockfile=
 5070: +    fi
 5071: +
 5072: +    # Lock this critical section if it is needed
 5073: +    # We use this script file to make the link, it avoids creating a new file
 5074: +    if test yes = "$need_locks"; then
 5075: +      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
 5076: +	func_echo "Waiting for $lockfile to be removed"
 5077: +	sleep 2
 5078: +      done
 5079: +    elif test warn = "$need_locks"; then
 5080: +      if test -f "$lockfile"; then
 5081: +	$ECHO "\
 5082: +*** ERROR, $lockfile exists and contains:
 5083: +`cat $lockfile 2>/dev/null`
 5084: +
 5085: +This indicates that another process is trying to use the same
 5086: +temporary object file, and libtool could not work around it because
 5087: +your compiler does not support '-c' and '-o' together.  If you
 5088: +repeat this compilation, it may succeed, by chance, but you had better
 5089: +avoid parallel builds (make -j) in this platform, or get a better
 5090: +compiler."
 5091: +
 5092: +	$opt_dry_run || $RM $removelist
 5093: +	exit $EXIT_FAILURE
 5094: +      fi
 5095: +      func_append removelist " $output_obj"
 5096: +      $ECHO "$srcfile" > "$lockfile"
 5097: +    fi
 5098: +
 5099: +    $opt_dry_run || $RM $removelist
 5100: +    func_append removelist " $lockfile"
 5101: +    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
 5102: +
 5103: +    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
 5104: +    srcfile=$func_to_tool_file_result
 5105: +    func_quote_for_eval "$srcfile"
 5106: +    qsrcfile=$func_quote_for_eval_result
 5107: +
 5108: +    # Only build a PIC object if we are building libtool libraries.
 5109: +    if test yes = "$build_libtool_libs"; then
 5110: +      # Without this assignment, base_compile gets emptied.
 5111: +      fbsd_hideous_sh_bug=$base_compile
 5112: +
 5113: +      if test no != "$pic_mode"; then
 5114: +	command="$base_compile $qsrcfile $pic_flag"
 5115: +      else
 5116: +	# Don't build PIC code
 5117: +	command="$base_compile $qsrcfile"
 5118: +      fi
 5119: +
 5120: +      func_mkdir_p "$xdir$objdir"
 5121: +
 5122: +      if test -z "$output_obj"; then
 5123: +	# Place PIC objects in $objdir
 5124: +	func_append command " -o $lobj"
 5125: +      fi
 5126: +
 5127: +      func_show_eval_locale "$command"	\
 5128: +          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
 5129: +
 5130: +      if test warn = "$need_locks" &&
 5131: +	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 5132: +	$ECHO "\
 5133: +*** ERROR, $lockfile contains:
 5134: +`cat $lockfile 2>/dev/null`
 5135: +
 5136: +but it should contain:
 5137: +$srcfile
 5138: +
 5139: +This indicates that another process is trying to use the same
 5140: +temporary object file, and libtool could not work around it because
 5141: +your compiler does not support '-c' and '-o' together.  If you
 5142: +repeat this compilation, it may succeed, by chance, but you had better
 5143: +avoid parallel builds (make -j) in this platform, or get a better
 5144: +compiler."
 5145: +
 5146: +	$opt_dry_run || $RM $removelist
 5147: +	exit $EXIT_FAILURE
 5148: +      fi
 5149: +
 5150: +      # Just move the object if needed, then go on to compile the next one
 5151: +      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
 5152: +	func_show_eval '$MV "$output_obj" "$lobj"' \
 5153: +	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
 5154: +      fi
 5155: +
 5156: +      # Allow error messages only from the first compilation.
 5157: +      if test yes = "$suppress_opt"; then
 5158: +	suppress_output=' >/dev/null 2>&1'
 5159: +      fi
 5160: +    fi
 5161: +
 5162: +    # Only build a position-dependent object if we build old libraries.
 5163: +    if test yes = "$build_old_libs"; then
 5164: +      if test yes != "$pic_mode"; then
 5165: +	# Don't build PIC code
 5166: +	command="$base_compile $qsrcfile$pie_flag"
 5167: +      else
 5168: +	command="$base_compile $qsrcfile $pic_flag"
 5169: +      fi
 5170: +      if test yes = "$compiler_c_o"; then
 5171: +	func_append command " -o $obj"
 5172: +      fi
 5173: +
 5174: +      # Suppress compiler output if we already did a PIC compilation.
 5175: +      func_append command "$suppress_output"
 5176: +      func_show_eval_locale "$command" \
 5177: +        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
 5178: +
 5179: +      if test warn = "$need_locks" &&
 5180: +	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 5181: +	$ECHO "\
 5182: +*** ERROR, $lockfile contains:
 5183: +`cat $lockfile 2>/dev/null`
 5184: +
 5185: +but it should contain:
 5186: +$srcfile
 5187: +
 5188: +This indicates that another process is trying to use the same
 5189: +temporary object file, and libtool could not work around it because
 5190: +your compiler does not support '-c' and '-o' together.  If you
 5191: +repeat this compilation, it may succeed, by chance, but you had better
 5192: +avoid parallel builds (make -j) in this platform, or get a better
 5193: +compiler."
 5194: +
 5195: +	$opt_dry_run || $RM $removelist
 5196: +	exit $EXIT_FAILURE
 5197: +      fi
 5198: +
 5199: +      # Just move the object if needed
 5200: +      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
 5201: +	func_show_eval '$MV "$output_obj" "$obj"' \
 5202: +	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
 5203: +      fi
 5204: +    fi
 5205: +
 5206: +    $opt_dry_run || {
 5207: +      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
 5208: +
 5209: +      # Unlock the critical section if it was locked
 5210: +      if test no != "$need_locks"; then
 5211: +	removelist=$lockfile
 5212: +        $RM "$lockfile"
 5213: +      fi
 5214: +    }
 5215: +
 5216: +    exit $EXIT_SUCCESS
 5217: +}
 5218: +
 5219: +$opt_help || {
 5220: +  test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
 5221: +}
 5222: +
 5223: +func_mode_help ()
 5224: +{
 5225: +    # We need to display help for each of the modes.
 5226: +    case $opt_mode in
 5227: +      "")
 5228: +        # Generic help is extracted from the usage comments
 5229: +        # at the start of this file.
 5230: +        func_help
 5231: +        ;;
 5232: +
 5233: +      clean)
 5234: +        $ECHO \
 5235: +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
 5236: +
 5237: +Remove files from the build directory.
 5238: +
 5239: +RM is the name of the program to use to delete files associated with each FILE
 5240: +(typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
 5241: +to RM.
 5242: +
 5243: +If FILE is a libtool library, object or program, all the files associated
 5244: +with it are deleted. Otherwise, only FILE itself is deleted using RM."
 5245: +        ;;
 5246: +
 5247: +      compile)
 5248: +      $ECHO \
 5249: +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
 5250: +
 5251: +Compile a source file into a libtool library object.
 5252: +
 5253: +This mode accepts the following additional options:
 5254: +
 5255: +  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
 5256: +  -no-suppress      do not suppress compiler output for multiple passes
 5257: +  -prefer-pic       try to build PIC objects only
 5258: +  -prefer-non-pic   try to build non-PIC objects only
 5259: +  -shared           do not build a '.o' file suitable for static linking
 5260: +  -static           only build a '.o' file suitable for static linking
 5261: +  -Wc,FLAG          pass FLAG directly to the compiler
 5262: +
 5263: +COMPILE-COMMAND is a command to be used in creating a 'standard' object file
 5264: +from the given SOURCEFILE.
 5265: +
 5266: +The output file name is determined by removing the directory component from
 5267: +SOURCEFILE, then substituting the C source code suffix '.c' with the
 5268: +library object suffix, '.lo'."
 5269: +        ;;
 5270: +
 5271: +      execute)
 5272: +        $ECHO \
 5273: +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
 5274: +
 5275: +Automatically set library path, then run a program.
 5276: +
 5277: +This mode accepts the following additional options:
 5278: +
 5279: +  -dlopen FILE      add the directory containing FILE to the library path
 5280: +
 5281: +This mode sets the library path environment variable according to '-dlopen'
 5282: +flags.
 5283: +
 5284: +If any of the ARGS are libtool executable wrappers, then they are translated
 5285: +into their corresponding uninstalled binary, and any of their required library
 5286: +directories are added to the library path.
 5287: +
 5288: +Then, COMMAND is executed, with ARGS as arguments."
 5289: +        ;;
 5290: +
 5291: +      finish)
 5292: +        $ECHO \
 5293: +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
 5294: +
 5295: +Complete the installation of libtool libraries.
 5296: +
 5297: +Each LIBDIR is a directory that contains libtool libraries.
 5298: +
 5299: +The commands that this mode executes may require superuser privileges.  Use
 5300: +the '--dry-run' option if you just want to see what would be executed."
 5301: +        ;;
 5302: +
 5303: +      install)
 5304: +        $ECHO \
 5305: +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
 5306: +
 5307: +Install executables or libraries.
 5308: +
 5309: +INSTALL-COMMAND is the installation command.  The first component should be
 5310: +either the 'install' or 'cp' program.
 5311: +
 5312: +The following components of INSTALL-COMMAND are treated specially:
 5313: +
 5314: +  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
 5315: +
 5316: +The rest of the components are interpreted as arguments to that command (only
 5317: +BSD-compatible install options are recognized)."
 5318: +        ;;
 5319: +
 5320: +      link)
 5321: +        $ECHO \
 5322: +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
 5323: +
 5324: +Link object files or libraries together to form another library, or to
 5325: +create an executable program.
 5326: +
 5327: +LINK-COMMAND is a command using the C compiler that you would use to create
 5328: +a program from several object files.
 5329: +
 5330: +The following components of LINK-COMMAND are treated specially:
 5331: +
 5332: +  -all-static       do not do any dynamic linking at all
 5333: +  -avoid-version    do not add a version suffix if possible
 5334: +  -bindir BINDIR    specify path to binaries directory (for systems where
 5335: +                    libraries must be found in the PATH setting at runtime)
 5336: +  -dlopen FILE      '-dlpreopen' FILE if it cannot be dlopened at runtime
 5337: +  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
 5338: +  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
 5339: +  -export-symbols SYMFILE
 5340: +                    try to export only the symbols listed in SYMFILE
 5341: +  -export-symbols-regex REGEX
 5342: +                    try to export only the symbols matching REGEX
 5343: +  -LLIBDIR          search LIBDIR for required installed libraries
 5344: +  -lNAME            OUTPUT-FILE requires the installed library libNAME
 5345: +  -module           build a library that can dlopened
 5346: +  -no-fast-install  disable the fast-install mode
 5347: +  -no-install       link a not-installable executable
 5348: +  -no-undefined     declare that a library does not refer to external symbols
 5349: +  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
 5350: +  -objectlist FILE  use a list of object files found in FILE to specify objects
 5351: +  -os2dllname NAME  force a short DLL name on OS/2 (no effect on other OSes)
 5352: +  -precious-files-regex REGEX
 5353: +                    don't remove output files matching REGEX
 5354: +  -release RELEASE  specify package release information
 5355: +  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
 5356: +  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
 5357: +  -shared           only do dynamic linking of libtool libraries
 5358: +  -shrext SUFFIX    override the standard shared library file extension
 5359: +  -static           do not do any dynamic linking of uninstalled libtool libraries
 5360: +  -static-libtool-libs
 5361: +                    do not do any dynamic linking of libtool libraries
 5362: +  -version-info CURRENT[:REVISION[:AGE]]
 5363: +                    specify library version info [each variable defaults to 0]
 5364: +  -weak LIBNAME     declare that the target provides the LIBNAME interface
 5365: +  -Wc,FLAG
 5366: +  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
 5367: +  -Wl,FLAG
 5368: +  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
 5369: +  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
 5370: +
 5371: +All other options (arguments beginning with '-') are ignored.
 5372: +
 5373: +Every other argument is treated as a filename.  Files ending in '.la' are
 5374: +treated as uninstalled libtool libraries, other files are standard or library
 5375: +object files.
 5376: +
 5377: +If the OUTPUT-FILE ends in '.la', then a libtool library is created,
 5378: +only library objects ('.lo' files) may be specified, and '-rpath' is
 5379: +required, except when creating a convenience library.
 5380: +
 5381: +If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
 5382: +using 'ar' and 'ranlib', or on Windows using 'lib'.
 5383: +
 5384: +If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
 5385: +is created, otherwise an executable program is created."
 5386: +        ;;
 5387: +
 5388: +      uninstall)
 5389: +        $ECHO \
 5390: +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
 5391: +
 5392: +Remove libraries from an installation directory.
 5393: +
 5394: +RM is the name of the program to use to delete files associated with each FILE
 5395: +(typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
 5396: +to RM.
 5397: +
 5398: +If FILE is a libtool library, all the files associated with it are deleted.
 5399: +Otherwise, only FILE itself is deleted using RM."
 5400: +        ;;
 5401: +
 5402: +      *)
 5403: +        func_fatal_help "invalid operation mode '$opt_mode'"
 5404: +        ;;
 5405: +    esac
 5406: +
 5407: +    echo
 5408: +    $ECHO "Try '$progname --help' for more information about other modes."
 5409: +}
 5410: +
 5411: +# Now that we've collected a possible --mode arg, show help if necessary
 5412: +if $opt_help; then
 5413: +  if test : = "$opt_help"; then
 5414: +    func_mode_help
 5415: +  else
 5416: +    {
 5417: +      func_help noexit
 5418: +      for opt_mode in compile link execute install finish uninstall clean; do
 5419: +	func_mode_help
 5420: +      done
 5421: +    } | $SED -n '1p; 2,$s/^Usage:/  or: /p'
 5422: +    {
 5423: +      func_help noexit
 5424: +      for opt_mode in compile link execute install finish uninstall clean; do
 5425: +	echo
 5426: +	func_mode_help
 5427: +      done
 5428: +    } |
 5429: +    $SED '1d
 5430: +      /^When reporting/,/^Report/{
 5431: +	H
 5432: +	d
 5433: +      }
 5434: +      $x
 5435: +      /information about other modes/d
 5436: +      /more detailed .*MODE/d
 5437: +      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
 5438: +  fi
 5439: +  exit $?
 5440: +fi
 5441: +
 5442: +
 5443: +# func_mode_execute arg...
 5444: +func_mode_execute ()
 5445: +{
 5446: +    $debug_cmd
 5447: +
 5448: +    # The first argument is the command name.
 5449: +    cmd=$nonopt
 5450: +    test -z "$cmd" && \
 5451: +      func_fatal_help "you must specify a COMMAND"
 5452: +
 5453: +    # Handle -dlopen flags immediately.
 5454: +    for file in $opt_dlopen; do
 5455: +      test -f "$file" \
 5456: +	|| func_fatal_help "'$file' is not a file"
 5457: +
 5458: +      dir=
 5459: +      case $file in
 5460: +      *.la)
 5461: +	func_resolve_sysroot "$file"
 5462: +	file=$func_resolve_sysroot_result
 5463: +
 5464: +	# Check to see that this really is a libtool archive.
 5465: +	func_lalib_unsafe_p "$file" \
 5466: +	  || func_fatal_help "'$lib' is not a valid libtool archive"
 5467: +
 5468: +	# Read the libtool library.
 5469: +	dlname=
 5470: +	library_names=
 5471: +	func_source "$file"
 5472: +
 5473: +	# Skip this library if it cannot be dlopened.
 5474: +	if test -z "$dlname"; then
 5475: +	  # Warn if it was a shared library.
 5476: +	  test -n "$library_names" && \
 5477: +	    func_warning "'$file' was not linked with '-export-dynamic'"
 5478: +	  continue
 5479: +	fi
 5480: +
 5481: +	func_dirname "$file" "" "."
 5482: +	dir=$func_dirname_result
 5483: +
 5484: +	if test -f "$dir/$objdir/$dlname"; then
 5485: +	  func_append dir "/$objdir"
 5486: +	else
 5487: +	  if test ! -f "$dir/$dlname"; then
 5488: +	    func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
 5489: +	  fi
 5490: +	fi
 5491: +	;;
 5492: +
 5493: +      *.lo)
 5494: +	# Just add the directory containing the .lo file.
 5495: +	func_dirname "$file" "" "."
 5496: +	dir=$func_dirname_result
 5497: +	;;
 5498: +
 5499: +      *)
 5500: +	func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
 5501: +	continue
 5502: +	;;
 5503: +      esac
 5504: +
 5505: +      # Get the absolute pathname.
 5506: +      absdir=`cd "$dir" && pwd`
 5507: +      test -n "$absdir" && dir=$absdir
 5508: +
 5509: +      # Now add the directory to shlibpath_var.
 5510: +      if eval "test -z \"\$$shlibpath_var\""; then
 5511: +	eval "$shlibpath_var=\"\$dir\""
 5512: +      else
 5513: +	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
 5514: +      fi
 5515: +    done
 5516: +
 5517: +    # This variable tells wrapper scripts just to set shlibpath_var
 5518: +    # rather than running their programs.
 5519: +    libtool_execute_magic=$magic
 5520: +
 5521: +    # Check if any of the arguments is a wrapper script.
 5522: +    args=
 5523: +    for file
 5524: +    do
 5525: +      case $file in
 5526: +      -* | *.la | *.lo ) ;;
 5527: +      *)
 5528: +	# Do a test to see if this is really a libtool program.
 5529: +	if func_ltwrapper_script_p "$file"; then
 5530: +	  func_source "$file"
 5531: +	  # Transform arg to wrapped name.
 5532: +	  file=$progdir/$program
 5533: +	elif func_ltwrapper_executable_p "$file"; then
 5534: +	  func_ltwrapper_scriptname "$file"
 5535: +	  func_source "$func_ltwrapper_scriptname_result"
 5536: +	  # Transform arg to wrapped name.
 5537: +	  file=$progdir/$program
 5538: +	fi
 5539: +	;;
 5540: +      esac
 5541: +      # Quote arguments (to preserve shell metacharacters).
 5542: +      func_append_quoted args "$file"
 5543: +    done
 5544: +
 5545: +    if $opt_dry_run; then
 5546: +      # Display what would be done.
 5547: +      if test -n "$shlibpath_var"; then
 5548: +	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
 5549: +	echo "export $shlibpath_var"
 5550: +      fi
 5551: +      $ECHO "$cmd$args"
 5552: +      exit $EXIT_SUCCESS
 5553: +    else
 5554: +      if test -n "$shlibpath_var"; then
 5555: +	# Export the shlibpath_var.
 5556: +	eval "export $shlibpath_var"
 5557: +      fi
 5558: +
 5559: +      # Restore saved environment variables
 5560: +      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
 5561: +      do
 5562: +	eval "if test \"\${save_$lt_var+set}\" = set; then
 5563: +                $lt_var=\$save_$lt_var; export $lt_var
 5564: +	      else
 5565: +		$lt_unset $lt_var
 5566: +	      fi"
 5567: +      done
 5568: +
 5569: +      # Now prepare to actually exec the command.
 5570: +      exec_cmd=\$cmd$args
 5571: +    fi
 5572: +}
 5573: +
 5574: +test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
 5575: +
 5576: +
 5577: +# func_mode_finish arg...
 5578: +func_mode_finish ()
 5579: +{
 5580: +    $debug_cmd
 5581: +
 5582: +    libs=
 5583: +    libdirs=
 5584: +    admincmds=
 5585: +
 5586: +    for opt in "$nonopt" ${1+"$@"}
 5587: +    do
 5588: +      if test -d "$opt"; then
 5589: +	func_append libdirs " $opt"
 5590: +
 5591: +      elif test -f "$opt"; then
 5592: +	if func_lalib_unsafe_p "$opt"; then
 5593: +	  func_append libs " $opt"
 5594: +	else
 5595: +	  func_warning "'$opt' is not a valid libtool archive"
 5596: +	fi
 5597: +
 5598: +      else
 5599: +	func_fatal_error "invalid argument '$opt'"
 5600: +      fi
 5601: +    done
 5602: +
 5603: +    if test -n "$libs"; then
 5604: +      if test -n "$lt_sysroot"; then
 5605: +        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
 5606: +        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
 5607: +      else
 5608: +        sysroot_cmd=
 5609: +      fi
 5610: +
 5611: +      # Remove sysroot references
 5612: +      if $opt_dry_run; then
 5613: +        for lib in $libs; do
 5614: +          echo "removing references to $lt_sysroot and '=' prefixes from $lib"
 5615: +        done
 5616: +      else
 5617: +        tmpdir=`func_mktempdir`
 5618: +        for lib in $libs; do
 5619: +	  $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
 5620: +	    > $tmpdir/tmp-la
 5621: +	  mv -f $tmpdir/tmp-la $lib
 5622: +	done
 5623: +        ${RM}r "$tmpdir"
 5624: +      fi
 5625: +    fi
 5626: +
 5627: +    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
 5628: +      for libdir in $libdirs; do
 5629: +	if test -n "$finish_cmds"; then
 5630: +	  # Do each command in the finish commands.
 5631: +	  func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
 5632: +'"$cmd"'"'
 5633: +	fi
 5634: +	if test -n "$finish_eval"; then
 5635: +	  # Do the single finish_eval.
 5636: +	  eval cmds=\"$finish_eval\"
 5637: +	  $opt_dry_run || eval "$cmds" || func_append admincmds "
 5638: +       $cmds"
 5639: +	fi
 5640: +      done
 5641: +    fi
 5642: +
 5643: +    # Exit here if they wanted silent mode.
 5644: +    $opt_quiet && exit $EXIT_SUCCESS
 5645: +
 5646: +    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
 5647: +      echo "----------------------------------------------------------------------"
 5648: +      echo "Libraries have been installed in:"
 5649: +      for libdir in $libdirs; do
 5650: +	$ECHO "   $libdir"
 5651: +      done
 5652: +      echo
 5653: +      echo "If you ever happen to want to link against installed libraries"
 5654: +      echo "in a given directory, LIBDIR, you must either use libtool, and"
 5655: +      echo "specify the full pathname of the library, or use the '-LLIBDIR'"
 5656: +      echo "flag during linking and do at least one of the following:"
 5657: +      if test -n "$shlibpath_var"; then
 5658: +	echo "   - add LIBDIR to the '$shlibpath_var' environment variable"
 5659: +	echo "     during execution"
 5660: +      fi
 5661: +      if test -n "$runpath_var"; then
 5662: +	echo "   - add LIBDIR to the '$runpath_var' environment variable"
 5663: +	echo "     during linking"
 5664: +      fi
 5665: +      if test -n "$hardcode_libdir_flag_spec"; then
 5666: +	libdir=LIBDIR
 5667: +	eval flag=\"$hardcode_libdir_flag_spec\"
 5668: +
 5669: +	$ECHO "   - use the '$flag' linker flag"
 5670: +      fi
 5671: +      if test -n "$admincmds"; then
 5672: +	$ECHO "   - have your system administrator run these commands:$admincmds"
 5673: +      fi
 5674: +      if test -f /etc/ld.so.conf; then
 5675: +	echo "   - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
 5676: +      fi
 5677: +      echo
 5678: +
 5679: +      echo "See any operating system documentation about shared libraries for"
 5680: +      case $host in
 5681: +	solaris2.[6789]|solaris2.1[0-9])
 5682: +	  echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
 5683: +	  echo "pages."
 5684: +	  ;;
 5685: +	*)
 5686: +	  echo "more information, such as the ld(1) and ld.so(8) manual pages."
 5687: +	  ;;
 5688: +      esac
 5689: +      echo "----------------------------------------------------------------------"
 5690: +    fi
 5691: +    exit $EXIT_SUCCESS
 5692: +}
 5693: +
 5694: +test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
 5695: +
 5696: +
 5697: +# func_mode_install arg...
 5698: +func_mode_install ()
 5699: +{
 5700: +    $debug_cmd
 5701: +
 5702: +    # There may be an optional sh(1) argument at the beginning of
 5703: +    # install_prog (especially on Windows NT).
 5704: +    if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
 5705: +       # Allow the use of GNU shtool's install command.
 5706: +       case $nonopt in *shtool*) :;; *) false;; esac
 5707: +    then
 5708: +      # Aesthetically quote it.
 5709: +      func_quote_for_eval "$nonopt"
 5710: +      install_prog="$func_quote_for_eval_result "
 5711: +      arg=$1
 5712: +      shift
 5713: +    else
 5714: +      install_prog=
 5715: +      arg=$nonopt
 5716: +    fi
 5717: +
 5718: +    # The real first argument should be the name of the installation program.
 5719: +    # Aesthetically quote it.
 5720: +    func_quote_for_eval "$arg"
 5721: +    func_append install_prog "$func_quote_for_eval_result"
 5722: +    install_shared_prog=$install_prog
 5723: +    case " $install_prog " in
 5724: +      *[\\\ /]cp\ *) install_cp=: ;;
 5725: +      *) install_cp=false ;;
 5726: +    esac
 5727: +
 5728: +    # We need to accept at least all the BSD install flags.
 5729: +    dest=
 5730: +    files=
 5731: +    opts=
 5732: +    prev=
 5733: +    install_type=
 5734: +    isdir=false
 5735: +    stripme=
 5736: +    no_mode=:
 5737: +    for arg
 5738: +    do
 5739: +      arg2=
 5740: +      if test -n "$dest"; then
 5741: +	func_append files " $dest"
 5742: +	dest=$arg
 5743: +	continue
 5744: +      fi
 5745: +
 5746: +      case $arg in
 5747: +      -d) isdir=: ;;
 5748: +      -f)
 5749: +	if $install_cp; then :; else
 5750: +	  prev=$arg
 5751: +	fi
 5752: +	;;
 5753: +      -g | -m | -o)
 5754: +	prev=$arg
 5755: +	;;
 5756: +      -s)
 5757: +	stripme=" -s"
 5758: +	continue
 5759: +	;;
 5760: +      -*)
 5761: +	;;
 5762: +      *)
 5763: +	# If the previous option needed an argument, then skip it.
 5764: +	if test -n "$prev"; then
 5765: +	  if test X-m = "X$prev" && test -n "$install_override_mode"; then
 5766: +	    arg2=$install_override_mode
 5767: +	    no_mode=false
 5768: +	  fi
 5769: +	  prev=
 5770: +	else
 5771: +	  dest=$arg
 5772: +	  continue
 5773: +	fi
 5774: +	;;
 5775: +      esac
 5776: +
 5777: +      # Aesthetically quote the argument.
 5778: +      func_quote_for_eval "$arg"
 5779: +      func_append install_prog " $func_quote_for_eval_result"
 5780: +      if test -n "$arg2"; then
 5781: +	func_quote_for_eval "$arg2"
 5782: +      fi
 5783: +      func_append install_shared_prog " $func_quote_for_eval_result"
 5784: +    done
 5785: +
 5786: +    test -z "$install_prog" && \
 5787: +      func_fatal_help "you must specify an install program"
 5788: +
 5789: +    test -n "$prev" && \
 5790: +      func_fatal_help "the '$prev' option requires an argument"
 5791: +
 5792: +    if test -n "$install_override_mode" && $no_mode; then
 5793: +      if $install_cp; then :; else
 5794: +	func_quote_for_eval "$install_override_mode"
 5795: +	func_append install_shared_prog " -m $func_quote_for_eval_result"
 5796: +      fi
 5797: +    fi
 5798: +
 5799: +    if test -z "$files"; then
 5800: +      if test -z "$dest"; then
 5801: +	func_fatal_help "no file or destination specified"
 5802: +      else
 5803: +	func_fatal_help "you must specify a destination"
 5804: +      fi
 5805: +    fi
 5806: +
 5807: +    # Strip any trailing slash from the destination.
 5808: +    func_stripname '' '/' "$dest"
 5809: +    dest=$func_stripname_result
 5810: +
 5811: +    # Check to see that the destination is a directory.
 5812: +    test -d "$dest" && isdir=:
 5813: +    if $isdir; then
 5814: +      destdir=$dest
 5815: +      destname=
 5816: +    else
 5817: +      func_dirname_and_basename "$dest" "" "."
 5818: +      destdir=$func_dirname_result
 5819: +      destname=$func_basename_result
 5820: +
 5821: +      # Not a directory, so check to see that there is only one file specified.
 5822: +      set dummy $files; shift
 5823: +      test "$#" -gt 1 && \
 5824: +	func_fatal_help "'$dest' is not a directory"
 5825: +    fi
 5826: +    case $destdir in
 5827: +    [\\/]* | [A-Za-z]:[\\/]*) ;;
 5828: +    *)
 5829: +      for file in $files; do
 5830: +	case $file in
 5831: +	*.lo) ;;
 5832: +	*)
 5833: +	  func_fatal_help "'$destdir' must be an absolute directory name"
 5834: +	  ;;
 5835: +	esac
 5836: +      done
 5837: +      ;;
 5838: +    esac
 5839: +
 5840: +    # This variable tells wrapper scripts just to set variables rather
 5841: +    # than running their programs.
 5842: +    libtool_install_magic=$magic
 5843: +
 5844: +    staticlibs=
 5845: +    future_libdirs=
 5846: +    current_libdirs=
 5847: +    for file in $files; do
 5848: +
 5849: +      # Do each installation.
 5850: +      case $file in
 5851: +      *.$libext)
 5852: +	# Do the static libraries later.
 5853: +	func_append staticlibs " $file"
 5854: +	;;
 5855: +
 5856: +      *.la)
 5857: +	func_resolve_sysroot "$file"
 5858: +	file=$func_resolve_sysroot_result
 5859: +
 5860: +	# Check to see that this really is a libtool archive.
 5861: +	func_lalib_unsafe_p "$file" \
 5862: +	  || func_fatal_help "'$file' is not a valid libtool archive"
 5863: +
 5864: +	library_names=
 5865: +	old_library=
 5866: +	relink_command=
 5867: +	func_source "$file"
 5868: +
 5869: +	# Add the libdir to current_libdirs if it is the destination.
 5870: +	if test "X$destdir" = "X$libdir"; then
 5871: +	  case "$current_libdirs " in
 5872: +	  *" $libdir "*) ;;
 5873: +	  *) func_append current_libdirs " $libdir" ;;
 5874: +	  esac
 5875: +	else
 5876: +	  # Note the libdir as a future libdir.
 5877: +	  case "$future_libdirs " in
 5878: +	  *" $libdir "*) ;;
 5879: +	  *) func_append future_libdirs " $libdir" ;;
 5880: +	  esac
 5881: +	fi
 5882: +
 5883: +	func_dirname "$file" "/" ""
 5884: +	dir=$func_dirname_result
 5885: +	func_append dir "$objdir"
 5886: +
 5887: +	if test -n "$relink_command"; then
 5888: +	  # Determine the prefix the user has applied to our future dir.
 5889: +	  inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
 5890: +
 5891: +	  # Don't allow the user to place us outside of our expected
 5892: +	  # location b/c this prevents finding dependent libraries that
 5893: +	  # are installed to the same prefix.
 5894: +	  # At present, this check doesn't affect windows .dll's that
 5895: +	  # are installed into $libdir/../bin (currently, that works fine)
 5896: +	  # but it's something to keep an eye on.
 5897: +	  test "$inst_prefix_dir" = "$destdir" && \
 5898: +	    func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
 5899: +
 5900: +	  if test -n "$inst_prefix_dir"; then
 5901: +	    # Stick the inst_prefix_dir data into the link command.
 5902: +	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 5903: +	  else
 5904: +	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 5905: +	  fi
 5906: +
 5907: +	  func_warning "relinking '$file'"
 5908: +	  func_show_eval "$relink_command" \
 5909: +	    'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
 5910: +	fi
 5911: +
 5912: +	# See the names of the shared library.
 5913: +	set dummy $library_names; shift
 5914: +	if test -n "$1"; then
 5915: +	  realname=$1
 5916: +	  shift
 5917: +
 5918: +	  srcname=$realname
 5919: +	  test -n "$relink_command" && srcname=${realname}T
 5920: +
 5921: +	  # Install the shared library and build the symlinks.
 5922: +	  func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
 5923: +	      'exit $?'
 5924: +	  tstripme=$stripme
 5925: +	  case $host_os in
 5926: +	  cygwin* | mingw* | pw32* | cegcc*)
 5927: +	    case $realname in
 5928: +	    *.dll.a)
 5929: +	      tstripme=
 5930: +	      ;;
 5931: +	    esac
 5932: +	    ;;
 5933: +	  os2*)
 5934: +	    case $realname in
 5935: +	    *_dll.a)
 5936: +	      tstripme=
 5937: +	      ;;
 5938: +	    esac
 5939: +	    ;;
 5940: +	  esac
 5941: +	  if test -n "$tstripme" && test -n "$striplib"; then
 5942: +	    func_show_eval "$striplib $destdir/$realname" 'exit $?'
 5943: +	  fi
 5944: +
 5945: +	  if test "$#" -gt 0; then
 5946: +	    # Delete the old symlinks, and create new ones.
 5947: +	    # Try 'ln -sf' first, because the 'ln' binary might depend on
 5948: +	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
 5949: +	    # so we also need to try rm && ln -s.
 5950: +	    for linkname
 5951: +	    do
 5952: +	      test "$linkname" != "$realname" \
 5953: +		&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
 5954: +	    done
 5955: +	  fi
 5956: +
 5957: +	  # Do each command in the postinstall commands.
 5958: +	  lib=$destdir/$realname
 5959: +	  func_execute_cmds "$postinstall_cmds" 'exit $?'
 5960: +	fi
 5961: +
 5962: +	# Install the pseudo-library for information purposes.
 5963: +	func_basename "$file"
 5964: +	name=$func_basename_result
 5965: +	instname=$dir/${name}i
 5966: +	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
 5967: +
 5968: +	# Maybe install the static library, too.
 5969: +	test -n "$old_library" && func_append staticlibs " $dir/$old_library"
 5970: +	;;
 5971: +
 5972: +      *.lo)
 5973: +	# Install (i.e. copy) a libtool object.
 5974: +
 5975: +	# Figure out destination file name, if it wasn't already specified.
 5976: +	if test -n "$destname"; then
 5977: +	  destfile=$destdir/$destname
 5978: +	else
 5979: +	  func_basename "$file"
 5980: +	  destfile=$func_basename_result
 5981: +	  destfile=$destdir/$destfile
 5982: +	fi
 5983: +
 5984: +	# Deduce the name of the destination old-style object file.
 5985: +	case $destfile in
 5986: +	*.lo)
 5987: +	  func_lo2o "$destfile"
 5988: +	  staticdest=$func_lo2o_result
 5989: +	  ;;
 5990: +	*.$objext)
 5991: +	  staticdest=$destfile
 5992: +	  destfile=
 5993: +	  ;;
 5994: +	*)
 5995: +	  func_fatal_help "cannot copy a libtool object to '$destfile'"
 5996: +	  ;;
 5997: +	esac
 5998: +
 5999: +	# Install the libtool object if requested.
 6000: +	test -n "$destfile" && \
 6001: +	  func_show_eval "$install_prog $file $destfile" 'exit $?'
 6002: +
 6003: +	# Install the old object if enabled.
 6004: +	if test yes = "$build_old_libs"; then
 6005: +	  # Deduce the name of the old-style object file.
 6006: +	  func_lo2o "$file"
 6007: +	  staticobj=$func_lo2o_result
 6008: +	  func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
 6009: +	fi
 6010: +	exit $EXIT_SUCCESS
 6011: +	;;
 6012: +
 6013: +      *)
 6014: +	# Figure out destination file name, if it wasn't already specified.
 6015: +	if test -n "$destname"; then
 6016: +	  destfile=$destdir/$destname
 6017: +	else
 6018: +	  func_basename "$file"
 6019: +	  destfile=$func_basename_result
 6020: +	  destfile=$destdir/$destfile
 6021: +	fi
 6022: +
 6023: +	# If the file is missing, and there is a .exe on the end, strip it
 6024: +	# because it is most likely a libtool script we actually want to
 6025: +	# install
 6026: +	stripped_ext=
 6027: +	case $file in
 6028: +	  *.exe)
 6029: +	    if test ! -f "$file"; then
 6030: +	      func_stripname '' '.exe' "$file"
 6031: +	      file=$func_stripname_result
 6032: +	      stripped_ext=.exe
 6033: +	    fi
 6034: +	    ;;
 6035: +	esac
 6036: +
 6037: +	# Do a test to see if this is really a libtool program.
 6038: +	case $host in
 6039: +	*cygwin* | *mingw*)
 6040: +	    if func_ltwrapper_executable_p "$file"; then
 6041: +	      func_ltwrapper_scriptname "$file"
 6042: +	      wrapper=$func_ltwrapper_scriptname_result
 6043: +	    else
 6044: +	      func_stripname '' '.exe' "$file"
 6045: +	      wrapper=$func_stripname_result
 6046: +	    fi
 6047: +	    ;;
 6048: +	*)
 6049: +	    wrapper=$file
 6050: +	    ;;
 6051: +	esac
 6052: +	if func_ltwrapper_script_p "$wrapper"; then
 6053: +	  notinst_deplibs=
 6054: +	  relink_command=
 6055: +
 6056: +	  func_source "$wrapper"
 6057: +
 6058: +	  # Check the variables that should have been set.
 6059: +	  test -z "$generated_by_libtool_version" && \
 6060: +	    func_fatal_error "invalid libtool wrapper script '$wrapper'"
 6061: +
 6062: +	  finalize=:
 6063: +	  for lib in $notinst_deplibs; do
 6064: +	    # Check to see that each library is installed.
 6065: +	    libdir=
 6066: +	    if test -f "$lib"; then
 6067: +	      func_source "$lib"
 6068: +	    fi
 6069: +	    libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
 6070: +	    if test -n "$libdir" && test ! -f "$libfile"; then
 6071: +	      func_warning "'$lib' has not been installed in '$libdir'"
 6072: +	      finalize=false
 6073: +	    fi
 6074: +	  done
 6075: +
 6076: +	  relink_command=
 6077: +	  func_source "$wrapper"
 6078: +
 6079: +	  outputname=
 6080: +	  if test no = "$fast_install" && test -n "$relink_command"; then
 6081: +	    $opt_dry_run || {
 6082: +	      if $finalize; then
 6083: +	        tmpdir=`func_mktempdir`
 6084: +		func_basename "$file$stripped_ext"
 6085: +		file=$func_basename_result
 6086: +	        outputname=$tmpdir/$file
 6087: +	        # Replace the output file specification.
 6088: +	        relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
 6089: +
 6090: +	        $opt_quiet || {
 6091: +	          func_quote_for_expand "$relink_command"
 6092: +		  eval "func_echo $func_quote_for_expand_result"
 6093: +	        }
 6094: +	        if eval "$relink_command"; then :
 6095: +	          else
 6096: +		  func_error "error: relink '$file' with the above command before installing it"
 6097: +		  $opt_dry_run || ${RM}r "$tmpdir"
 6098: +		  continue
 6099: +	        fi
 6100: +	        file=$outputname
 6101: +	      else
 6102: +	        func_warning "cannot relink '$file'"
 6103: +	      fi
 6104: +	    }
 6105: +	  else
 6106: +	    # Install the binary that we compiled earlier.
 6107: +	    file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
 6108: +	  fi
 6109: +	fi
 6110: +
 6111: +	# remove .exe since cygwin /usr/bin/install will append another
 6112: +	# one anyway
 6113: +	case $install_prog,$host in
 6114: +	*/usr/bin/install*,*cygwin*)
 6115: +	  case $file:$destfile in
 6116: +	  *.exe:*.exe)
 6117: +	    # this is ok
 6118: +	    ;;
 6119: +	  *.exe:*)
 6120: +	    destfile=$destfile.exe
 6121: +	    ;;
 6122: +	  *:*.exe)
 6123: +	    func_stripname '' '.exe' "$destfile"
 6124: +	    destfile=$func_stripname_result
 6125: +	    ;;
 6126: +	  esac
 6127: +	  ;;
 6128: +	esac
 6129: +	func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
 6130: +	$opt_dry_run || if test -n "$outputname"; then
 6131: +	  ${RM}r "$tmpdir"
 6132: +	fi
 6133: +	;;
 6134: +      esac
 6135: +    done
 6136: +
 6137: +    for file in $staticlibs; do
 6138: +      func_basename "$file"
 6139: +      name=$func_basename_result
 6140: +
 6141: +      # Set up the ranlib parameters.
 6142: +      oldlib=$destdir/$name
 6143: +      func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
 6144: +      tool_oldlib=$func_to_tool_file_result
 6145: +
 6146: +      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
 6147: +
 6148: +      if test -n "$stripme" && test -n "$old_striplib"; then
 6149: +	func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
 6150: +      fi
 6151: +
 6152: +      # Do each command in the postinstall commands.
 6153: +      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
 6154: +    done
 6155: +
 6156: +    test -n "$future_libdirs" && \
 6157: +      func_warning "remember to run '$progname --finish$future_libdirs'"
 6158: +
 6159: +    if test -n "$current_libdirs"; then
 6160: +      # Maybe just do a dry run.
 6161: +      $opt_dry_run && current_libdirs=" -n$current_libdirs"
 6162: +      exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
 6163: +    else
 6164: +      exit $EXIT_SUCCESS
 6165: +    fi
 6166: +}
 6167: +
 6168: +test install = "$opt_mode" && func_mode_install ${1+"$@"}
 6169: +
 6170: +
 6171: +# func_generate_dlsyms outputname originator pic_p
 6172: +# Extract symbols from dlprefiles and create ${outputname}S.o with
 6173: +# a dlpreopen symbol table.
 6174: +func_generate_dlsyms ()
 6175: +{
 6176: +    $debug_cmd
 6177: +
 6178: +    my_outputname=$1
 6179: +    my_originator=$2
 6180: +    my_pic_p=${3-false}
 6181: +    my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
 6182: +    my_dlsyms=
 6183: +
 6184: +    if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
 6185: +      if test -n "$NM" && test -n "$global_symbol_pipe"; then
 6186: +	my_dlsyms=${my_outputname}S.c
 6187: +      else
 6188: +	func_error "not configured to extract global symbols from dlpreopened files"
 6189: +      fi
 6190: +    fi
 6191: +
 6192: +    if test -n "$my_dlsyms"; then
 6193: +      case $my_dlsyms in
 6194: +      "") ;;
 6195: +      *.c)
 6196: +	# Discover the nlist of each of the dlfiles.
 6197: +	nlist=$output_objdir/$my_outputname.nm
 6198: +
 6199: +	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
 6200: +
 6201: +	# Parse the name list into a source file.
 6202: +	func_verbose "creating $output_objdir/$my_dlsyms"
 6203: +
 6204: +	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
 6205: +/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
 6206: +/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
 6207: +
 6208: +#ifdef __cplusplus
 6209: +extern \"C\" {
 6210: +#endif
 6211: +
 6212: +#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
 6213: +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
 6214: +#endif
 6215: +
 6216: +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
 6217: +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
 6218: +/* DATA imports from DLLs on WIN32 can't be const, because runtime
 6219: +   relocations are performed -- see ld's documentation on pseudo-relocs.  */
 6220: +# define LT_DLSYM_CONST
 6221: +#elif defined __osf__
 6222: +/* This system does not cope well with relocations in const data.  */
 6223: +# define LT_DLSYM_CONST
 6224: +#else
 6225: +# define LT_DLSYM_CONST const
 6226: +#endif
 6227: +
 6228: +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
 6229: +
 6230: +/* External symbol declarations for the compiler. */\
 6231: +"
 6232: +
 6233: +	if test yes = "$dlself"; then
 6234: +	  func_verbose "generating symbol list for '$output'"
 6235: +
 6236: +	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
 6237: +
 6238: +	  # Add our own program objects to the symbol list.
 6239: +	  progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
 6240: +	  for progfile in $progfiles; do
 6241: +	    func_to_tool_file "$progfile" func_convert_file_msys_to_w32
 6242: +	    func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
 6243: +	    $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
 6244: +	  done
 6245: +
 6246: +	  if test -n "$exclude_expsyms"; then
 6247: +	    $opt_dry_run || {
 6248: +	      eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
 6249: +	      eval '$MV "$nlist"T "$nlist"'
 6250: +	    }
 6251: +	  fi
 6252: +
 6253: +	  if test -n "$export_symbols_regex"; then
 6254: +	    $opt_dry_run || {
 6255: +	      eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
 6256: +	      eval '$MV "$nlist"T "$nlist"'
 6257: +	    }
 6258: +	  fi
 6259: +
 6260: +	  # Prepare the list of exported symbols
 6261: +	  if test -z "$export_symbols"; then
 6262: +	    export_symbols=$output_objdir/$outputname.exp
 6263: +	    $opt_dry_run || {
 6264: +	      $RM $export_symbols
 6265: +	      eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 6266: +	      case $host in
 6267: +	      *cygwin* | *mingw* | *cegcc* )
 6268: +                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 6269: +                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
 6270: +	        ;;
 6271: +	      esac
 6272: +	    }
 6273: +	  else
 6274: +	    $opt_dry_run || {
 6275: +	      eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 6276: +	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
 6277: +	      eval '$MV "$nlist"T "$nlist"'
 6278: +	      case $host in
 6279: +	        *cygwin* | *mingw* | *cegcc* )
 6280: +	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 6281: +	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 6282: +	          ;;
 6283: +	      esac
 6284: +	    }
 6285: +	  fi
 6286: +	fi
 6287: +
 6288: +	for dlprefile in $dlprefiles; do
 6289: +	  func_verbose "extracting global C symbols from '$dlprefile'"
 6290: +	  func_basename "$dlprefile"
 6291: +	  name=$func_basename_result
 6292: +          case $host in
 6293: +	    *cygwin* | *mingw* | *cegcc* )
 6294: +	      # if an import library, we need to obtain dlname
 6295: +	      if func_win32_import_lib_p "$dlprefile"; then
 6296: +	        func_tr_sh "$dlprefile"
 6297: +	        eval "curr_lafile=\$libfile_$func_tr_sh_result"
 6298: +	        dlprefile_dlbasename=
 6299: +	        if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
 6300: +	          # Use subshell, to avoid clobbering current variable values
 6301: +	          dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
 6302: +	          if test -n "$dlprefile_dlname"; then
 6303: +	            func_basename "$dlprefile_dlname"
 6304: +	            dlprefile_dlbasename=$func_basename_result
 6305: +	          else
 6306: +	            # no lafile. user explicitly requested -dlpreopen <import library>.
 6307: +	            $sharedlib_from_linklib_cmd "$dlprefile"
 6308: +	            dlprefile_dlbasename=$sharedlib_from_linklib_result
 6309: +	          fi
 6310: +	        fi
 6311: +	        $opt_dry_run || {
 6312: +	          if test -n "$dlprefile_dlbasename"; then
 6313: +	            eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
 6314: +	          else
 6315: +	            func_warning "Could not compute DLL name from $name"
 6316: +	            eval '$ECHO ": $name " >> "$nlist"'
 6317: +	          fi
 6318: +	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
 6319: +	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
 6320: +	            $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
 6321: +	        }
 6322: +	      else # not an import lib
 6323: +	        $opt_dry_run || {
 6324: +	          eval '$ECHO ": $name " >> "$nlist"'
 6325: +	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
 6326: +	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
 6327: +	        }
 6328: +	      fi
 6329: +	    ;;
 6330: +	    *)
 6331: +	      $opt_dry_run || {
 6332: +	        eval '$ECHO ": $name " >> "$nlist"'
 6333: +	        func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
 6334: +	        eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
 6335: +	      }
 6336: +	    ;;
 6337: +          esac
 6338: +	done
 6339: +
 6340: +	$opt_dry_run || {
 6341: +	  # Make sure we have at least an empty file.
 6342: +	  test -f "$nlist" || : > "$nlist"
 6343: +
 6344: +	  if test -n "$exclude_expsyms"; then
 6345: +	    $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
 6346: +	    $MV "$nlist"T "$nlist"
 6347: +	  fi
 6348: +
 6349: +	  # Try sorting and uniquifying the output.
 6350: +	  if $GREP -v "^: " < "$nlist" |
 6351: +	      if sort -k 3 </dev/null >/dev/null 2>&1; then
 6352: +		sort -k 3
 6353: +	      else
 6354: +		sort +2
 6355: +	      fi |
 6356: +	      uniq > "$nlist"S; then
 6357: +	    :
 6358: +	  else
 6359: +	    $GREP -v "^: " < "$nlist" > "$nlist"S
 6360: +	  fi
 6361: +
 6362: +	  if test -f "$nlist"S; then
 6363: +	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
 6364: +	  else
 6365: +	    echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
 6366: +	  fi
 6367: +
 6368: +	  func_show_eval '$RM "${nlist}I"'
 6369: +	  if test -n "$global_symbol_to_import"; then
 6370: +	    eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
 6371: +	  fi
 6372: +
 6373: +	  echo >> "$output_objdir/$my_dlsyms" "\
 6374: +
 6375: +/* The mapping between symbol names and symbols.  */
 6376: +typedef struct {
 6377: +  const char *name;
 6378: +  void *address;
 6379: +} lt_dlsymlist;
 6380: +extern LT_DLSYM_CONST lt_dlsymlist
 6381: +lt_${my_prefix}_LTX_preloaded_symbols[];\
 6382: +"
 6383: +
 6384: +	  if test -s "$nlist"I; then
 6385: +	    echo >> "$output_objdir/$my_dlsyms" "\
 6386: +static void lt_syminit(void)
 6387: +{
 6388: +  LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
 6389: +  for (; symbol->name; ++symbol)
 6390: +    {"
 6391: +	    $SED 's/.*/      if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
 6392: +	    echo >> "$output_objdir/$my_dlsyms" "\
 6393: +    }
 6394: +}"
 6395: +	  fi
 6396: +	  echo >> "$output_objdir/$my_dlsyms" "\
 6397: +LT_DLSYM_CONST lt_dlsymlist
 6398: +lt_${my_prefix}_LTX_preloaded_symbols[] =
 6399: +{ {\"$my_originator\", (void *) 0},"
 6400: +
 6401: +	  if test -s "$nlist"I; then
 6402: +	    echo >> "$output_objdir/$my_dlsyms" "\
 6403: +  {\"@INIT@\", (void *) <_syminit},"
 6404: +	  fi
 6405: +
 6406: +	  case $need_lib_prefix in
 6407: +	  no)
 6408: +	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
 6409: +	    ;;
 6410: +	  *)
 6411: +	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
 6412: +	    ;;
 6413: +	  esac
 6414: +	  echo >> "$output_objdir/$my_dlsyms" "\
 6415: +  {0, (void *) 0}
 6416: +};
 6417: +
 6418: +/* This works around a problem in FreeBSD linker */
 6419: +#ifdef FREEBSD_WORKAROUND
 6420: +static const void *lt_preloaded_setup() {
 6421: +  return lt_${my_prefix}_LTX_preloaded_symbols;
 6422: +}
 6423: +#endif
 6424: +
 6425: +#ifdef __cplusplus
 6426: +}
 6427: +#endif\
 6428: +"
 6429: +	} # !$opt_dry_run
 6430: +
 6431: +	pic_flag_for_symtable=
 6432: +	case "$compile_command " in
 6433: +	*" -static "*) ;;
 6434: +	*)
 6435: +	  case $host in
 6436: +	  # compiling the symbol table file with pic_flag works around
 6437: +	  # a FreeBSD bug that causes programs to crash when -lm is
 6438: +	  # linked before any other PIC object.  But we must not use
 6439: +	  # pic_flag when linking with -static.  The problem exists in
 6440: +	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
 6441: +	  *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
 6442: +	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
 6443: +	  *-*-hpux*)
 6444: +	    pic_flag_for_symtable=" $pic_flag"  ;;
 6445: +	  *)
 6446: +	    $my_pic_p && pic_flag_for_symtable=" $pic_flag"
 6447: +	    ;;
 6448: +	  esac
 6449: +	  ;;
 6450: +	esac
 6451: +	symtab_cflags=
 6452: +	for arg in $LTCFLAGS; do
 6453: +	  case $arg in
 6454: +	  -pie | -fpie | -fPIE) ;;
 6455: +	  *) func_append symtab_cflags " $arg" ;;
 6456: +	  esac
 6457: +	done
 6458: +
 6459: +	# Now compile the dynamic symbol file.
 6460: +	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
 6461: +
 6462: +	# Clean up the generated files.
 6463: +	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
 6464: +
 6465: +	# Transform the symbol file into the correct name.
 6466: +	symfileobj=$output_objdir/${my_outputname}S.$objext
 6467: +	case $host in
 6468: +	*cygwin* | *mingw* | *cegcc* )
 6469: +	  if test -f "$output_objdir/$my_outputname.def"; then
 6470: +	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
 6471: +	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
 6472: +	  else
 6473: +	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 6474: +	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 6475: +	  fi
 6476: +	  ;;
 6477: +	*)
 6478: +	  compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 6479: +	  finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 6480: +	  ;;
 6481: +	esac
 6482: +	;;
 6483: +      *)
 6484: +	func_fatal_error "unknown suffix for '$my_dlsyms'"
 6485: +	;;
 6486: +      esac
 6487: +    else
 6488: +      # We keep going just in case the user didn't refer to
 6489: +      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
 6490: +      # really was required.
 6491: +
 6492: +      # Nullify the symbol file.
 6493: +      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
 6494: +      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
 6495: +    fi
 6496: +}
 6497: +
 6498: +# func_cygming_gnu_implib_p ARG
 6499: +# This predicate returns with zero status (TRUE) if
 6500: +# ARG is a GNU/binutils-style import library. Returns
 6501: +# with nonzero status (FALSE) otherwise.
 6502: +func_cygming_gnu_implib_p ()
 6503: +{
 6504: +  $debug_cmd
 6505: +
 6506: +  func_to_tool_file "$1" func_convert_file_msys_to_w32
 6507: +  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
 6508: +  test -n "$func_cygming_gnu_implib_tmp"
 6509: +}
 6510: +
 6511: +# func_cygming_ms_implib_p ARG
 6512: +# This predicate returns with zero status (TRUE) if
 6513: +# ARG is an MS-style import library. Returns
 6514: +# with nonzero status (FALSE) otherwise.
 6515: +func_cygming_ms_implib_p ()
 6516: +{
 6517: +  $debug_cmd
 6518: +
 6519: +  func_to_tool_file "$1" func_convert_file_msys_to_w32
 6520: +  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
 6521: +  test -n "$func_cygming_ms_implib_tmp"
 6522: +}
 6523: +
 6524: +# func_win32_libid arg
 6525: +# return the library type of file 'arg'
 6526: +#
 6527: +# Need a lot of goo to handle *both* DLLs and import libs
 6528: +# Has to be a shell function in order to 'eat' the argument
 6529: +# that is supplied when $file_magic_command is called.
 6530: +# Despite the name, also deal with 64 bit binaries.
 6531: +func_win32_libid ()
 6532: +{
 6533: +  $debug_cmd
 6534: +
 6535: +  win32_libid_type=unknown
 6536: +  win32_fileres=`file -L $1 2>/dev/null`
 6537: +  case $win32_fileres in
 6538: +  *ar\ archive\ import\ library*) # definitely import
 6539: +    win32_libid_type="x86 archive import"
 6540: +    ;;
 6541: +  *ar\ archive*) # could be an import, or static
 6542: +    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
 6543: +    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
 6544: +       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
 6545: +      case $nm_interface in
 6546: +      "MS dumpbin")
 6547: +	if func_cygming_ms_implib_p "$1" ||
 6548: +	   func_cygming_gnu_implib_p "$1"
 6549: +	then
 6550: +	  win32_nmres=import
 6551: +	else
 6552: +	  win32_nmres=
 6553: +	fi
 6554: +	;;
 6555: +      *)
 6556: +	func_to_tool_file "$1" func_convert_file_msys_to_w32
 6557: +	win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
 6558: +	  $SED -n -e '
 6559: +	    1,100{
 6560: +		/ I /{
 6561: +		    s|.*|import|
 6562: +		    p
 6563: +		    q
 6564: +		}
 6565: +	    }'`
 6566: +	;;
 6567: +      esac
 6568: +      case $win32_nmres in
 6569: +      import*)  win32_libid_type="x86 archive import";;
 6570: +      *)        win32_libid_type="x86 archive static";;
 6571: +      esac
 6572: +    fi
 6573: +    ;;
 6574: +  *DLL*)
 6575: +    win32_libid_type="x86 DLL"
 6576: +    ;;
 6577: +  *executable*) # but shell scripts are "executable" too...
 6578: +    case $win32_fileres in
 6579: +    *MS\ Windows\ PE\ Intel*)
 6580: +      win32_libid_type="x86 DLL"
 6581: +      ;;
 6582: +    esac
 6583: +    ;;
 6584: +  esac
 6585: +  $ECHO "$win32_libid_type"
 6586: +}
 6587: +
 6588: +# func_cygming_dll_for_implib ARG
 6589: +#
 6590: +# Platform-specific function to extract the
 6591: +# name of the DLL associated with the specified
 6592: +# import library ARG.
 6593: +# Invoked by eval'ing the libtool variable
 6594: +#    $sharedlib_from_linklib_cmd
 6595: +# Result is available in the variable
 6596: +#    $sharedlib_from_linklib_result
 6597: +func_cygming_dll_for_implib ()
 6598: +{
 6599: +  $debug_cmd
 6600: +
 6601: +  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
 6602: +}
 6603: +
 6604: +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
 6605: +#
 6606: +# The is the core of a fallback implementation of a
 6607: +# platform-specific function to extract the name of the
 6608: +# DLL associated with the specified import library LIBNAME.
 6609: +#
 6610: +# SECTION_NAME is either .idata$6 or .idata$7, depending
 6611: +# on the platform and compiler that created the implib.
 6612: +#
 6613: +# Echos the name of the DLL associated with the
 6614: +# specified import library.
 6615: +func_cygming_dll_for_implib_fallback_core ()
 6616: +{
 6617: +  $debug_cmd
 6618: +
 6619: +  match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
 6620: +  $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
 6621: +    $SED '/^Contents of section '"$match_literal"':/{
 6622: +      # Place marker at beginning of archive member dllname section
 6623: +      s/.*/====MARK====/
 6624: +      p
 6625: +      d
 6626: +    }
 6627: +    # These lines can sometimes be longer than 43 characters, but
 6628: +    # are always uninteresting
 6629: +    /:[	 ]*file format pe[i]\{,1\}-/d
 6630: +    /^In archive [^:]*:/d
 6631: +    # Ensure marker is printed
 6632: +    /^====MARK====/p
 6633: +    # Remove all lines with less than 43 characters
 6634: +    /^.\{43\}/!d
 6635: +    # From remaining lines, remove first 43 characters
 6636: +    s/^.\{43\}//' |
 6637: +    $SED -n '
 6638: +      # Join marker and all lines until next marker into a single line
 6639: +      /^====MARK====/ b para
 6640: +      H
 6641: +      $ b para
 6642: +      b
 6643: +      :para
 6644: +      x
 6645: +      s/\n//g
 6646: +      # Remove the marker
 6647: +      s/^====MARK====//
 6648: +      # Remove trailing dots and whitespace
 6649: +      s/[\. \t]*$//
 6650: +      # Print
 6651: +      /./p' |
 6652: +    # we now have a list, one entry per line, of the stringified
 6653: +    # contents of the appropriate section of all members of the
 6654: +    # archive that possess that section. Heuristic: eliminate
 6655: +    # all those that have a first or second character that is
 6656: +    # a '.' (that is, objdump's representation of an unprintable
 6657: +    # character.) This should work for all archives with less than
 6658: +    # 0x302f exports -- but will fail for DLLs whose name actually
 6659: +    # begins with a literal '.' or a single character followed by
 6660: +    # a '.'.
 6661: +    #
 6662: +    # Of those that remain, print the first one.
 6663: +    $SED -e '/^\./d;/^.\./d;q'
 6664: +}
 6665: +
 6666: +# func_cygming_dll_for_implib_fallback ARG
 6667: +# Platform-specific function to extract the
 6668: +# name of the DLL associated with the specified
 6669: +# import library ARG.
 6670: +#
 6671: +# This fallback implementation is for use when $DLLTOOL
 6672: +# does not support the --identify-strict option.
 6673: +# Invoked by eval'ing the libtool variable
 6674: +#    $sharedlib_from_linklib_cmd
 6675: +# Result is available in the variable
 6676: +#    $sharedlib_from_linklib_result
 6677: +func_cygming_dll_for_implib_fallback ()
 6678: +{
 6679: +  $debug_cmd
 6680: +
 6681: +  if func_cygming_gnu_implib_p "$1"; then
 6682: +    # binutils import library
 6683: +    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
 6684: +  elif func_cygming_ms_implib_p "$1"; then
 6685: +    # ms-generated import library
 6686: +    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
 6687: +  else
 6688: +    # unknown
 6689: +    sharedlib_from_linklib_result=
 6690: +  fi
 6691: +}
 6692: +
 6693: +
 6694: +# func_extract_an_archive dir oldlib
 6695: +func_extract_an_archive ()
 6696: +{
 6697: +    $debug_cmd
 6698: +
 6699: +    f_ex_an_ar_dir=$1; shift
 6700: +    f_ex_an_ar_oldlib=$1
 6701: +    if test yes = "$lock_old_archive_extraction"; then
 6702: +      lockfile=$f_ex_an_ar_oldlib.lock
 6703: +      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
 6704: +	func_echo "Waiting for $lockfile to be removed"
 6705: +	sleep 2
 6706: +      done
 6707: +    fi
 6708: +    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
 6709: +		   'stat=$?; rm -f "$lockfile"; exit $stat'
 6710: +    if test yes = "$lock_old_archive_extraction"; then
 6711: +      $opt_dry_run || rm -f "$lockfile"
 6712: +    fi
 6713: +    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
 6714: +     :
 6715: +    else
 6716: +      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
 6717: +    fi
 6718: +}
 6719: +
 6720: +
 6721: +# func_extract_archives gentop oldlib ...
 6722: +func_extract_archives ()
 6723: +{
 6724: +    $debug_cmd
 6725: +
 6726: +    my_gentop=$1; shift
 6727: +    my_oldlibs=${1+"$@"}
 6728: +    my_oldobjs=
 6729: +    my_xlib=
 6730: +    my_xabs=
 6731: +    my_xdir=
 6732: +
 6733: +    for my_xlib in $my_oldlibs; do
 6734: +      # Extract the objects.
 6735: +      case $my_xlib in
 6736: +	[\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
 6737: +	*) my_xabs=`pwd`"/$my_xlib" ;;
 6738: +      esac
 6739: +      func_basename "$my_xlib"
 6740: +      my_xlib=$func_basename_result
 6741: +      my_xlib_u=$my_xlib
 6742: +      while :; do
 6743: +        case " $extracted_archives " in
 6744: +	*" $my_xlib_u "*)
 6745: +	  func_arith $extracted_serial + 1
 6746: +	  extracted_serial=$func_arith_result
 6747: +	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
 6748: +	*) break ;;
 6749: +	esac
 6750: +      done
 6751: +      extracted_archives="$extracted_archives $my_xlib_u"
 6752: +      my_xdir=$my_gentop/$my_xlib_u
 6753: +
 6754: +      func_mkdir_p "$my_xdir"
 6755: +
 6756: +      case $host in
 6757: +      *-darwin*)
 6758: +	func_verbose "Extracting $my_xabs"
 6759: +	# Do not bother doing anything if just a dry run
 6760: +	$opt_dry_run || {
 6761: +	  darwin_orig_dir=`pwd`
 6762: +	  cd $my_xdir || exit $?
 6763: +	  darwin_archive=$my_xabs
 6764: +	  darwin_curdir=`pwd`
 6765: +	  func_basename "$darwin_archive"
 6766: +	  darwin_base_archive=$func_basename_result
 6767: +	  darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
 6768: +	  if test -n "$darwin_arches"; then
 6769: +	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
 6770: +	    darwin_arch=
 6771: +	    func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
 6772: +	    for darwin_arch in  $darwin_arches; do
 6773: +	      func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
 6774: +	      $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
 6775: +	      cd "unfat-$$/$darwin_base_archive-$darwin_arch"
 6776: +	      func_extract_an_archive "`pwd`" "$darwin_base_archive"
 6777: +	      cd "$darwin_curdir"
 6778: +	      $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
 6779: +	    done # $darwin_arches
 6780: +            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
 6781: +	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
 6782: +	    darwin_file=
 6783: +	    darwin_files=
 6784: +	    for darwin_file in $darwin_filelist; do
 6785: +	      darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
 6786: +	      $LIPO -create -output "$darwin_file" $darwin_files
 6787: +	    done # $darwin_filelist
 6788: +	    $RM -rf unfat-$$
 6789: +	    cd "$darwin_orig_dir"
 6790: +	  else
 6791: +	    cd $darwin_orig_dir
 6792: +	    func_extract_an_archive "$my_xdir" "$my_xabs"
 6793: +	  fi # $darwin_arches
 6794: +	} # !$opt_dry_run
 6795: +	;;
 6796: +      *)
 6797: +        func_extract_an_archive "$my_xdir" "$my_xabs"
 6798: +	;;
 6799: +      esac
 6800: +      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
 6801: +    done
 6802: +
 6803: +    func_extract_archives_result=$my_oldobjs
 6804: +}
 6805: +
 6806: +
 6807: +# func_emit_wrapper [arg=no]
 6808: +#
 6809: +# Emit a libtool wrapper script on stdout.
 6810: +# Don't directly open a file because we may want to
 6811: +# incorporate the script contents within a cygwin/mingw
 6812: +# wrapper executable.  Must ONLY be called from within
 6813: +# func_mode_link because it depends on a number of variables
 6814: +# set therein.
 6815: +#
 6816: +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
 6817: +# variable will take.  If 'yes', then the emitted script
 6818: +# will assume that the directory where it is stored is
 6819: +# the $objdir directory.  This is a cygwin/mingw-specific
 6820: +# behavior.
 6821: +func_emit_wrapper ()
 6822: +{
 6823: +	func_emit_wrapper_arg1=${1-no}
 6824: +
 6825: +	$ECHO "\
 6826: +#! $SHELL
 6827: +
 6828: +# $output - temporary wrapper script for $objdir/$outputname
 6829: +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
 6830: +#
 6831: +# The $output program cannot be directly executed until all the libtool
 6832: +# libraries that it depends on are installed.
 6833: +#
 6834: +# This wrapper script should never be moved out of the build directory.
 6835: +# If it is, it will not operate correctly.
 6836: +
 6837: +# Sed substitution that helps us do robust quoting.  It backslashifies
 6838: +# metacharacters that are still active within double-quoted strings.
 6839: +sed_quote_subst='$sed_quote_subst'
 6840: +
 6841: +# Be Bourne compatible
 6842: +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
 6843: +  emulate sh
 6844: +  NULLCMD=:
 6845: +  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
 6846: +  # is contrary to our usage.  Disable this feature.
 6847: +  alias -g '\${1+\"\$@\"}'='\"\$@\"'
 6848: +  setopt NO_GLOB_SUBST
 6849: +else
 6850: +  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
 6851: +fi
 6852: +BIN_SH=xpg4; export BIN_SH # for Tru64
 6853: +DUALCASE=1; export DUALCASE # for MKS sh
 6854: +
 6855: +# The HP-UX ksh and POSIX shell print the target directory to stdout
 6856: +# if CDPATH is set.
 6857: +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 6858: +
 6859: +relink_command=\"$relink_command\"
 6860: +
 6861: +# This environment variable determines our operation mode.
 6862: +if test \"\$libtool_install_magic\" = \"$magic\"; then
 6863: +  # install mode needs the following variables:
 6864: +  generated_by_libtool_version='$macro_version'
 6865: +  notinst_deplibs='$notinst_deplibs'
 6866: +else
 6867: +  # When we are sourced in execute mode, \$file and \$ECHO are already set.
 6868: +  if test \"\$libtool_execute_magic\" != \"$magic\"; then
 6869: +    file=\"\$0\""
 6870: +
 6871: +    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
 6872: +    $ECHO "\
 6873: +
 6874: +# A function that is used when there is no print builtin or printf.
 6875: +func_fallback_echo ()
 6876: +{
 6877: +  eval 'cat <<_LTECHO_EOF
 6878: +\$1
 6879: +_LTECHO_EOF'
 6880: +}
 6881: +    ECHO=\"$qECHO\"
 6882: +  fi
 6883: +
 6884: +# Very basic option parsing. These options are (a) specific to
 6885: +# the libtool wrapper, (b) are identical between the wrapper
 6886: +# /script/ and the wrapper /executable/ that is used only on
 6887: +# windows platforms, and (c) all begin with the string "--lt-"
 6888: +# (application programs are unlikely to have options that match
 6889: +# this pattern).
 6890: +#
 6891: +# There are only two supported options: --lt-debug and
 6892: +# --lt-dump-script. There is, deliberately, no --lt-help.
 6893: +#
 6894: +# The first argument to this parsing function should be the
 6895: +# script's $0 value, followed by "$@".
 6896: +lt_option_debug=
 6897: +func_parse_lt_options ()
 6898: +{
 6899: +  lt_script_arg0=\$0
 6900: +  shift
 6901: +  for lt_opt
 6902: +  do
 6903: +    case \"\$lt_opt\" in
 6904: +    --lt-debug) lt_option_debug=1 ;;
 6905: +    --lt-dump-script)
 6906: +        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
 6907: +        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
 6908: +        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
 6909: +        cat \"\$lt_dump_D/\$lt_dump_F\"
 6910: +        exit 0
 6911: +      ;;
 6912: +    --lt-*)
 6913: +        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
 6914: +        exit 1
 6915: +      ;;
 6916: +    esac
 6917: +  done
 6918: +
 6919: +  # Print the debug banner immediately:
 6920: +  if test -n \"\$lt_option_debug\"; then
 6921: +    echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
 6922: +  fi
 6923: +}
 6924: +
 6925: +# Used when --lt-debug. Prints its arguments to stdout
 6926: +# (redirection is the responsibility of the caller)
 6927: +func_lt_dump_args ()
 6928: +{
 6929: +  lt_dump_args_N=1;
 6930: +  for lt_arg
 6931: +  do
 6932: +    \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
 6933: +    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
 6934: +  done
 6935: +}
 6936: +
 6937: +# Core function for launching the target application
 6938: +func_exec_program_core ()
 6939: +{
 6940: +"
 6941: +  case $host in
 6942: +  # Backslashes separate directories on plain windows
 6943: +  *-*-mingw | *-*-os2* | *-cegcc*)
 6944: +    $ECHO "\
 6945: +      if test -n \"\$lt_option_debug\"; then
 6946: +        \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
 6947: +        func_lt_dump_args \${1+\"\$@\"} 1>&2
 6948: +      fi
 6949: +      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
 6950: +"
 6951: +    ;;
 6952: +
 6953: +  *)
 6954: +    $ECHO "\
 6955: +      if test -n \"\$lt_option_debug\"; then
 6956: +        \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
 6957: +        func_lt_dump_args \${1+\"\$@\"} 1>&2
 6958: +      fi
 6959: +      exec \"\$progdir/\$program\" \${1+\"\$@\"}
 6960: +"
 6961: +    ;;
 6962: +  esac
 6963: +  $ECHO "\
 6964: +      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
 6965: +      exit 1
 6966: +}
 6967: +
 6968: +# A function to encapsulate launching the target application
 6969: +# Strips options in the --lt-* namespace from \$@ and
 6970: +# launches target application with the remaining arguments.
 6971: +func_exec_program ()
 6972: +{
 6973: +  case \" \$* \" in
 6974: +  *\\ --lt-*)
 6975: +    for lt_wr_arg
 6976: +    do
 6977: +      case \$lt_wr_arg in
 6978: +      --lt-*) ;;
 6979: +      *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
 6980: +      esac
 6981: +      shift
 6982: +    done ;;
 6983: +  esac
 6984: +  func_exec_program_core \${1+\"\$@\"}
 6985: +}
 6986: +
 6987: +  # Parse options
 6988: +  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
 6989: +
 6990: +  # Find the directory that this script lives in.
 6991: +  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
 6992: +  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
 6993: +
 6994: +  # Follow symbolic links until we get to the real thisdir.
 6995: +  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
 6996: +  while test -n \"\$file\"; do
 6997: +    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
 6998: +
 6999: +    # If there was a directory component, then change thisdir.
 7000: +    if test \"x\$destdir\" != \"x\$file\"; then
 7001: +      case \"\$destdir\" in
 7002: +      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
 7003: +      *) thisdir=\"\$thisdir/\$destdir\" ;;
 7004: +      esac
 7005: +    fi
 7006: +
 7007: +    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
 7008: +    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
 7009: +  done
 7010: +
 7011: +  # Usually 'no', except on cygwin/mingw when embedded into
 7012: +  # the cwrapper.
 7013: +  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
 7014: +  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
 7015: +    # special case for '.'
 7016: +    if test \"\$thisdir\" = \".\"; then
 7017: +      thisdir=\`pwd\`
 7018: +    fi
 7019: +    # remove .libs from thisdir
 7020: +    case \"\$thisdir\" in
 7021: +    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
 7022: +    $objdir )   thisdir=. ;;
 7023: +    esac
 7024: +  fi
 7025: +
 7026: +  # Try to get the absolute directory name.
 7027: +  absdir=\`cd \"\$thisdir\" && pwd\`
 7028: +  test -n \"\$absdir\" && thisdir=\"\$absdir\"
 7029: +"
 7030: +
 7031: +	if test yes = "$fast_install"; then
 7032: +	  $ECHO "\
 7033: +  program=lt-'$outputname'$exeext
 7034: +  progdir=\"\$thisdir/$objdir\"
 7035: +
 7036: +  if test ! -f \"\$progdir/\$program\" ||
 7037: +     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
 7038: +       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
 7039: +
 7040: +    file=\"\$\$-\$program\"
 7041: +
 7042: +    if test ! -d \"\$progdir\"; then
 7043: +      $MKDIR \"\$progdir\"
 7044: +    else
 7045: +      $RM \"\$progdir/\$file\"
 7046: +    fi"
 7047: +
 7048: +	  $ECHO "\
 7049: +
 7050: +    # relink executable if necessary
 7051: +    if test -n \"\$relink_command\"; then
 7052: +      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
 7053: +      else
 7054: +	\$ECHO \"\$relink_command_output\" >&2
 7055: +	$RM \"\$progdir/\$file\"
 7056: +	exit 1
 7057: +      fi
 7058: +    fi
 7059: +
 7060: +    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
 7061: +    { $RM \"\$progdir/\$program\";
 7062: +      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
 7063: +    $RM \"\$progdir/\$file\"
 7064: +  fi"
 7065: +	else
 7066: +	  $ECHO "\
 7067: +  program='$outputname'
 7068: +  progdir=\"\$thisdir/$objdir\"
 7069: +"
 7070: +	fi
 7071: +
 7072: +	$ECHO "\
 7073: +
 7074: +  if test -f \"\$progdir/\$program\"; then"
 7075: +
 7076: +	# fixup the dll searchpath if we need to.
 7077: +	#
 7078: +	# Fix the DLL searchpath if we need to.  Do this before prepending
 7079: +	# to shlibpath, because on Windows, both are PATH and uninstalled
 7080: +	# libraries must come first.
 7081: +	if test -n "$dllsearchpath"; then
 7082: +	  $ECHO "\
 7083: +    # Add the dll search path components to the executable PATH
 7084: +    PATH=$dllsearchpath:\$PATH
 7085: +"
 7086: +	fi
 7087: +
 7088: +	# Export our shlibpath_var if we have one.
 7089: +	if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
 7090: +	  $ECHO "\
 7091: +    # Add our own library path to $shlibpath_var
 7092: +    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
 7093: +
 7094: +    # Some systems cannot cope with colon-terminated $shlibpath_var
 7095: +    # The second colon is a workaround for a bug in BeOS R4 sed
 7096: +    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
 7097: +
 7098: +    export $shlibpath_var
 7099: +"
 7100: +	fi
 7101: +
 7102: +	$ECHO "\
 7103: +    if test \"\$libtool_execute_magic\" != \"$magic\"; then
 7104: +      # Run the actual program with our arguments.
 7105: +      func_exec_program \${1+\"\$@\"}
 7106: +    fi
 7107: +  else
 7108: +    # The program doesn't exist.
 7109: +    \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
 7110: +    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
 7111: +    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
 7112: +    exit 1
 7113: +  fi
 7114: +fi\
 7115: +"
 7116: +}
 7117: +
 7118: +
 7119: +# func_emit_cwrapperexe_src
 7120: +# emit the source code for a wrapper executable on stdout
 7121: +# Must ONLY be called from within func_mode_link because
 7122: +# it depends on a number of variable set therein.
 7123: +func_emit_cwrapperexe_src ()
 7124: +{
 7125: +	cat <<EOF
 7126: +
 7127: +/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
 7128: +   Generated by $PROGRAM (GNU $PACKAGE) $VERSION
 7129: +
 7130: +   The $output program cannot be directly executed until all the libtool
 7131: +   libraries that it depends on are installed.
 7132: +
 7133: +   This wrapper executable should never be moved out of the build directory.
 7134: +   If it is, it will not operate correctly.
 7135: +*/
 7136: +EOF
 7137: +	    cat <<"EOF"
 7138: +#ifdef _MSC_VER
 7139: +# define _CRT_SECURE_NO_DEPRECATE 1
 7140: +#endif
 7141: +#include <stdio.h>
 7142: +#include <stdlib.h>
 7143: +#ifdef _MSC_VER
 7144: +# include <direct.h>
 7145: +# include <process.h>
 7146: +# include <io.h>
 7147: +#else
 7148: +# include <unistd.h>
 7149: +# include <stdint.h>
 7150: +# ifdef __CYGWIN__
 7151: +#  include <io.h>
 7152: +# endif
 7153: +#endif
 7154: +#include <malloc.h>
 7155: +#include <stdarg.h>
 7156: +#include <assert.h>
 7157: +#include <string.h>
 7158: +#include <ctype.h>
 7159: +#include <errno.h>
 7160: +#include <fcntl.h>
 7161: +#include <sys/stat.h>
 7162: +
 7163: +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
 7164: +
 7165: +/* declarations of non-ANSI functions */
 7166: +#if defined __MINGW32__
 7167: +# ifdef __STRICT_ANSI__
 7168: +int _putenv (const char *);
 7169: +# endif
 7170: +#elif defined __CYGWIN__
 7171: +# ifdef __STRICT_ANSI__
 7172: +char *realpath (const char *, char *);
 7173: +int putenv (char *);
 7174: +int setenv (const char *, const char *, int);
 7175: +# endif
 7176: +/* #elif defined other_platform || defined ... */
 7177: +#endif
 7178: +
 7179: +/* portability defines, excluding path handling macros */
 7180: +#if defined _MSC_VER
 7181: +# define setmode _setmode
 7182: +# define stat    _stat
 7183: +# define chmod   _chmod
 7184: +# define getcwd  _getcwd
 7185: +# define putenv  _putenv
 7186: +# define S_IXUSR _S_IEXEC
 7187: +#elif defined __MINGW32__
 7188: +# define setmode _setmode
 7189: +# define stat    _stat
 7190: +# define chmod   _chmod
 7191: +# define getcwd  _getcwd
 7192: +# define putenv  _putenv
 7193: +#elif defined __CYGWIN__
 7194: +# define HAVE_SETENV
 7195: +# define FOPEN_WB "wb"
 7196: +/* #elif defined other platforms ... */
 7197: +#endif
 7198: +
 7199: +#if defined PATH_MAX
 7200: +# define LT_PATHMAX PATH_MAX
 7201: +#elif defined MAXPATHLEN
 7202: +# define LT_PATHMAX MAXPATHLEN
 7203: +#else
 7204: +# define LT_PATHMAX 1024
 7205: +#endif
 7206: +
 7207: +#ifndef S_IXOTH
 7208: +# define S_IXOTH 0
 7209: +#endif
 7210: +#ifndef S_IXGRP
 7211: +# define S_IXGRP 0
 7212: +#endif
 7213: +
 7214: +/* path handling portability macros */
 7215: +#ifndef DIR_SEPARATOR
 7216: +# define DIR_SEPARATOR '/'
 7217: +# define PATH_SEPARATOR ':'
 7218: +#endif
 7219: +
 7220: +#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
 7221: +  defined __OS2__
 7222: +# define HAVE_DOS_BASED_FILE_SYSTEM
 7223: +# define FOPEN_WB "wb"
 7224: +# ifndef DIR_SEPARATOR_2
 7225: +#  define DIR_SEPARATOR_2 '\\'
 7226: +# endif
 7227: +# ifndef PATH_SEPARATOR_2
 7228: +#  define PATH_SEPARATOR_2 ';'
 7229: +# endif
 7230: +#endif
 7231: +
 7232: +#ifndef DIR_SEPARATOR_2
 7233: +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
 7234: +#else /* DIR_SEPARATOR_2 */
 7235: +# define IS_DIR_SEPARATOR(ch) \
 7236: +	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
 7237: +#endif /* DIR_SEPARATOR_2 */
 7238: +
 7239: +#ifndef PATH_SEPARATOR_2
 7240: +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
 7241: +#else /* PATH_SEPARATOR_2 */
 7242: +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 7243: +#endif /* PATH_SEPARATOR_2 */
 7244: +
 7245: +#ifndef FOPEN_WB
 7246: +# define FOPEN_WB "w"
 7247: +#endif
 7248: +#ifndef _O_BINARY
 7249: +# define _O_BINARY 0
 7250: +#endif
 7251: +
 7252: +#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
 7253: +#define XFREE(stale) do { \
 7254: +  if (stale) { free (stale); stale = 0; } \
 7255: +} while (0)
 7256: +
 7257: +#if defined LT_DEBUGWRAPPER
 7258: +static int lt_debug = 1;
 7259: +#else
 7260: +static int lt_debug = 0;
 7261: +#endif
 7262: +
 7263: +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
 7264: +
 7265: +void *xmalloc (size_t num);
 7266: +char *xstrdup (const char *string);
 7267: +const char *base_name (const char *name);
 7268: +char *find_executable (const char *wrapper);
 7269: +char *chase_symlinks (const char *pathspec);
 7270: +int make_executable (const char *path);
 7271: +int check_executable (const char *path);
 7272: +char *strendzap (char *str, const char *pat);
 7273: +void lt_debugprintf (const char *file, int line, const char *fmt, ...);
 7274: +void lt_fatal (const char *file, int line, const char *message, ...);
 7275: +static const char *nonnull (const char *s);
 7276: +static const char *nonempty (const char *s);
 7277: +void lt_setenv (const char *name, const char *value);
 7278: +char *lt_extend_str (const char *orig_value, const char *add, int to_end);
 7279: +void lt_update_exe_path (const char *name, const char *value);
 7280: +void lt_update_lib_path (const char *name, const char *value);
 7281: +char **prepare_spawn (char **argv);
 7282: +void lt_dump_script (FILE *f);
 7283: +EOF
 7284: +
 7285: +	    cat <<EOF
 7286: +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
 7287: +# define externally_visible volatile
 7288: +#else
 7289: +# define externally_visible __attribute__((externally_visible)) volatile
 7290: +#endif
 7291: +externally_visible const char * MAGIC_EXE = "$magic_exe";
 7292: +const char * LIB_PATH_VARNAME = "$shlibpath_var";
 7293: +EOF
 7294: +
 7295: +	    if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
 7296: +              func_to_host_path "$temp_rpath"
 7297: +	      cat <<EOF
 7298: +const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
 7299: +EOF
 7300: +	    else
 7301: +	      cat <<"EOF"
 7302: +const char * LIB_PATH_VALUE   = "";
 7303: +EOF
 7304: +	    fi
 7305: +
 7306: +	    if test -n "$dllsearchpath"; then
 7307: +              func_to_host_path "$dllsearchpath:"
 7308: +	      cat <<EOF
 7309: +const char * EXE_PATH_VARNAME = "PATH";
 7310: +const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
 7311: +EOF
 7312: +	    else
 7313: +	      cat <<"EOF"
 7314: +const char * EXE_PATH_VARNAME = "";
 7315: +const char * EXE_PATH_VALUE   = "";
 7316: +EOF
 7317: +	    fi
 7318: +
 7319: +	    if test yes = "$fast_install"; then
 7320: +	      cat <<EOF
 7321: +const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
 7322: +EOF
 7323: +	    else
 7324: +	      cat <<EOF
 7325: +const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
 7326: +EOF
 7327: +	    fi
 7328: +
 7329: +
 7330: +	    cat <<"EOF"
 7331: +
 7332: +#define LTWRAPPER_OPTION_PREFIX         "--lt-"
 7333: +
 7334: +static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
 7335: +static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
 7336: +static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
 7337: +
 7338: +int
 7339: +main (int argc, char *argv[])
 7340: +{
 7341: +  char **newargz;
 7342: +  int  newargc;
 7343: +  char *tmp_pathspec;
 7344: +  char *actual_cwrapper_path;
 7345: +  char *actual_cwrapper_name;
 7346: +  char *target_name;
 7347: +  char *lt_argv_zero;
 7348: +  int rval = 127;
 7349: +
 7350: +  int i;
 7351: +
 7352: +  program_name = (char *) xstrdup (base_name (argv[0]));
 7353: +  newargz = XMALLOC (char *, (size_t) argc + 1);
 7354: +
 7355: +  /* very simple arg parsing; don't want to rely on getopt
 7356: +   * also, copy all non cwrapper options to newargz, except
 7357: +   * argz[0], which is handled differently
 7358: +   */
 7359: +  newargc=0;
 7360: +  for (i = 1; i < argc; i++)
 7361: +    {
 7362: +      if (STREQ (argv[i], dumpscript_opt))
 7363: +	{
 7364: +EOF
 7365: +	    case $host in
 7366: +	      *mingw* | *cygwin* )
 7367: +		# make stdout use "unix" line endings
 7368: +		echo "          setmode(1,_O_BINARY);"
 7369: +		;;
 7370: +	      esac
 7371: +
 7372: +	    cat <<"EOF"
 7373: +	  lt_dump_script (stdout);
 7374: +	  return 0;
 7375: +	}
 7376: +      if (STREQ (argv[i], debug_opt))
 7377: +	{
 7378: +          lt_debug = 1;
 7379: +          continue;
 7380: +	}
 7381: +      if (STREQ (argv[i], ltwrapper_option_prefix))
 7382: +        {
 7383: +          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
 7384: +             namespace, but it is not one of the ones we know about and
 7385: +             have already dealt with, above (inluding dump-script), then
 7386: +             report an error. Otherwise, targets might begin to believe
 7387: +             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
 7388: +             namespace. The first time any user complains about this, we'll
 7389: +             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
 7390: +             or a configure.ac-settable value.
 7391: +           */
 7392: +          lt_fatal (__FILE__, __LINE__,
 7393: +		    "unrecognized %s option: '%s'",
 7394: +                    ltwrapper_option_prefix, argv[i]);
 7395: +        }
 7396: +      /* otherwise ... */
 7397: +      newargz[++newargc] = xstrdup (argv[i]);
 7398: +    }
 7399: +  newargz[++newargc] = NULL;
 7400: +
 7401: +EOF
 7402: +	    cat <<EOF
 7403: +  /* The GNU banner must be the first non-error debug message */
 7404: +  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
 7405: +EOF
 7406: +	    cat <<"EOF"
 7407: +  lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
 7408: +  lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
 7409: +
 7410: +  tmp_pathspec = find_executable (argv[0]);
 7411: +  if (tmp_pathspec == NULL)
 7412: +    lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
 7413: +  lt_debugprintf (__FILE__, __LINE__,
 7414: +                  "(main) found exe (before symlink chase) at: %s\n",
 7415: +		  tmp_pathspec);
 7416: +
 7417: +  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
 7418: +  lt_debugprintf (__FILE__, __LINE__,
 7419: +                  "(main) found exe (after symlink chase) at: %s\n",
 7420: +		  actual_cwrapper_path);
 7421: +  XFREE (tmp_pathspec);
 7422: +
 7423: +  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
 7424: +  strendzap (actual_cwrapper_path, actual_cwrapper_name);
 7425: +
 7426: +  /* wrapper name transforms */
 7427: +  strendzap (actual_cwrapper_name, ".exe");
 7428: +  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
 7429: +  XFREE (actual_cwrapper_name);
 7430: +  actual_cwrapper_name = tmp_pathspec;
 7431: +  tmp_pathspec = 0;
 7432: +
 7433: +  /* target_name transforms -- use actual target program name; might have lt- prefix */
 7434: +  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
 7435: +  strendzap (target_name, ".exe");
 7436: +  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
 7437: +  XFREE (target_name);
 7438: +  target_name = tmp_pathspec;
 7439: +  tmp_pathspec = 0;
 7440: +
 7441: +  lt_debugprintf (__FILE__, __LINE__,
 7442: +		  "(main) libtool target name: %s\n",
 7443: +		  target_name);
 7444: +EOF
 7445: +
 7446: +	    cat <<EOF
 7447: +  newargz[0] =
 7448: +    XMALLOC (char, (strlen (actual_cwrapper_path) +
 7449: +		    strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
 7450: +  strcpy (newargz[0], actual_cwrapper_path);
 7451: +  strcat (newargz[0], "$objdir");
 7452: +  strcat (newargz[0], "/");
 7453: +EOF
 7454: +
 7455: +	    cat <<"EOF"
 7456: +  /* stop here, and copy so we don't have to do this twice */
 7457: +  tmp_pathspec = xstrdup (newargz[0]);
 7458: +
 7459: +  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
 7460: +  strcat (newargz[0], actual_cwrapper_name);
 7461: +
 7462: +  /* DO want the lt- prefix here if it exists, so use target_name */
 7463: +  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
 7464: +  XFREE (tmp_pathspec);
 7465: +  tmp_pathspec = NULL;
 7466: +EOF
 7467: +
 7468: +	    case $host_os in
 7469: +	      mingw*)
 7470: +	    cat <<"EOF"
 7471: +  {
 7472: +    char* p;
 7473: +    while ((p = strchr (newargz[0], '\\')) != NULL)
 7474: +      {
 7475: +	*p = '/';
 7476: +      }
 7477: +    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
 7478: +      {
 7479: +	*p = '/';
 7480: +      }
 7481: +  }
 7482: +EOF
 7483: +	    ;;
 7484: +	    esac
 7485: +
 7486: +	    cat <<"EOF"
 7487: +  XFREE (target_name);
 7488: +  XFREE (actual_cwrapper_path);
 7489: +  XFREE (actual_cwrapper_name);
 7490: +
 7491: +  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
 7492: +  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
 7493: +  /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
 7494: +     be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
 7495: +     because on Windows, both *_VARNAMEs are PATH but uninstalled
 7496: +     libraries must come first. */
 7497: +  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
 7498: +  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
 7499: +
 7500: +  lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
 7501: +		  nonnull (lt_argv_zero));
 7502: +  for (i = 0; i < newargc; i++)
 7503: +    {
 7504: +      lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
 7505: +		      i, nonnull (newargz[i]));
 7506: +    }
 7507: +
 7508: +EOF
 7509: +
 7510: +	    case $host_os in
 7511: +	      mingw*)
 7512: +		cat <<"EOF"
 7513: +  /* execv doesn't actually work on mingw as expected on unix */
 7514: +  newargz = prepare_spawn (newargz);
 7515: +  rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
 7516: +  if (rval == -1)
 7517: +    {
 7518: +      /* failed to start process */
 7519: +      lt_debugprintf (__FILE__, __LINE__,
 7520: +		      "(main) failed to launch target \"%s\": %s\n",
 7521: +		      lt_argv_zero, nonnull (strerror (errno)));
 7522: +      return 127;
 7523: +    }
 7524: +  return rval;
 7525: +EOF
 7526: +		;;
 7527: +	      *)
 7528: +		cat <<"EOF"
 7529: +  execv (lt_argv_zero, newargz);
 7530: +  return rval; /* =127, but avoids unused variable warning */
 7531: +EOF
 7532: +		;;
 7533: +	    esac
 7534: +
 7535: +	    cat <<"EOF"
 7536: +}
 7537: +
 7538: +void *
 7539: +xmalloc (size_t num)
 7540: +{
 7541: +  void *p = (void *) malloc (num);
 7542: +  if (!p)
 7543: +    lt_fatal (__FILE__, __LINE__, "memory exhausted");
 7544: +
 7545: +  return p;
 7546: +}
 7547: +
 7548: +char *
 7549: +xstrdup (const char *string)
 7550: +{
 7551: +  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
 7552: +			  string) : NULL;
 7553: +}
 7554: +
 7555: +const char *
 7556: +base_name (const char *name)
 7557: +{
 7558: +  const char *base;
 7559: +
 7560: +#if defined HAVE_DOS_BASED_FILE_SYSTEM
 7561: +  /* Skip over the disk name in MSDOS pathnames. */
 7562: +  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
 7563: +    name += 2;
 7564: +#endif
 7565: +
 7566: +  for (base = name; *name; name++)
 7567: +    if (IS_DIR_SEPARATOR (*name))
 7568: +      base = name + 1;
 7569: +  return base;
 7570: +}
 7571: +
 7572: +int
 7573: +check_executable (const char *path)
 7574: +{
 7575: +  struct stat st;
 7576: +
 7577: +  lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
 7578: +                  nonempty (path));
 7579: +  if ((!path) || (!*path))
 7580: +    return 0;
 7581: +
 7582: +  if ((stat (path, &st) >= 0)
 7583: +      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
 7584: +    return 1;
 7585: +  else
 7586: +    return 0;
 7587: +}
 7588: +
 7589: +int
 7590: +make_executable (const char *path)
 7591: +{
 7592: +  int rval = 0;
 7593: +  struct stat st;
 7594: +
 7595: +  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
 7596: +                  nonempty (path));
 7597: +  if ((!path) || (!*path))
 7598: +    return 0;
 7599: +
 7600: +  if (stat (path, &st) >= 0)
 7601: +    {
 7602: +      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
 7603: +    }
 7604: +  return rval;
 7605: +}
 7606: +
 7607: +/* Searches for the full path of the wrapper.  Returns
 7608: +   newly allocated full path name if found, NULL otherwise
 7609: +   Does not chase symlinks, even on platforms that support them.
 7610: +*/
 7611: +char *
 7612: +find_executable (const char *wrapper)
 7613: +{
 7614: +  int has_slash = 0;
 7615: +  const char *p;
 7616: +  const char *p_next;
 7617: +  /* static buffer for getcwd */
 7618: +  char tmp[LT_PATHMAX + 1];
 7619: +  size_t tmp_len;
 7620: +  char *concat_name;
 7621: +
 7622: +  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
 7623: +                  nonempty (wrapper));
 7624: +
 7625: +  if ((wrapper == NULL) || (*wrapper == '\0'))
 7626: +    return NULL;
 7627: +
 7628: +  /* Absolute path? */
 7629: +#if defined HAVE_DOS_BASED_FILE_SYSTEM
 7630: +  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
 7631: +    {
 7632: +      concat_name = xstrdup (wrapper);
 7633: +      if (check_executable (concat_name))
 7634: +	return concat_name;
 7635: +      XFREE (concat_name);
 7636: +    }
 7637: +  else
 7638: +    {
 7639: +#endif
 7640: +      if (IS_DIR_SEPARATOR (wrapper[0]))
 7641: +	{
 7642: +	  concat_name = xstrdup (wrapper);
 7643: +	  if (check_executable (concat_name))
 7644: +	    return concat_name;
 7645: +	  XFREE (concat_name);
 7646: +	}
 7647: +#if defined HAVE_DOS_BASED_FILE_SYSTEM
 7648: +    }
 7649: +#endif
 7650: +
 7651: +  for (p = wrapper; *p; p++)
 7652: +    if (*p == '/')
 7653: +      {
 7654: +	has_slash = 1;
 7655: +	break;
 7656: +      }
 7657: +  if (!has_slash)
 7658: +    {
 7659: +      /* no slashes; search PATH */
 7660: +      const char *path = getenv ("PATH");
 7661: +      if (path != NULL)
 7662: +	{
 7663: +	  for (p = path; *p; p = p_next)
 7664: +	    {
 7665: +	      const char *q;
 7666: +	      size_t p_len;
 7667: +	      for (q = p; *q; q++)
 7668: +		if (IS_PATH_SEPARATOR (*q))
 7669: +		  break;
 7670: +	      p_len = (size_t) (q - p);
 7671: +	      p_next = (*q == '\0' ? q : q + 1);
 7672: +	      if (p_len == 0)
 7673: +		{
 7674: +		  /* empty path: current directory */
 7675: +		  if (getcwd (tmp, LT_PATHMAX) == NULL)
 7676: +		    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
 7677: +                              nonnull (strerror (errno)));
 7678: +		  tmp_len = strlen (tmp);
 7679: +		  concat_name =
 7680: +		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
 7681: +		  memcpy (concat_name, tmp, tmp_len);
 7682: +		  concat_name[tmp_len] = '/';
 7683: +		  strcpy (concat_name + tmp_len + 1, wrapper);
 7684: +		}
 7685: +	      else
 7686: +		{
 7687: +		  concat_name =
 7688: +		    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
 7689: +		  memcpy (concat_name, p, p_len);
 7690: +		  concat_name[p_len] = '/';
 7691: +		  strcpy (concat_name + p_len + 1, wrapper);
 7692: +		}
 7693: +	      if (check_executable (concat_name))
 7694: +		return concat_name;
 7695: +	      XFREE (concat_name);
 7696: +	    }
 7697: +	}
 7698: +      /* not found in PATH; assume curdir */
 7699: +    }
 7700: +  /* Relative path | not found in path: prepend cwd */
 7701: +  if (getcwd (tmp, LT_PATHMAX) == NULL)
 7702: +    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
 7703: +              nonnull (strerror (errno)));
 7704: +  tmp_len = strlen (tmp);
 7705: +  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
 7706: +  memcpy (concat_name, tmp, tmp_len);
 7707: +  concat_name[tmp_len] = '/';
 7708: +  strcpy (concat_name + tmp_len + 1, wrapper);
 7709: +
 7710: +  if (check_executable (concat_name))
 7711: +    return concat_name;
 7712: +  XFREE (concat_name);
 7713: +  return NULL;
 7714: +}
 7715: +
 7716: +char *
 7717: +chase_symlinks (const char *pathspec)
 7718: +{
 7719: +#ifndef S_ISLNK
 7720: +  return xstrdup (pathspec);
 7721: +#else
 7722: +  char buf[LT_PATHMAX];
 7723: +  struct stat s;
 7724: +  char *tmp_pathspec = xstrdup (pathspec);
 7725: +  char *p;
 7726: +  int has_symlinks = 0;
 7727: +  while (strlen (tmp_pathspec) && !has_symlinks)
 7728: +    {
 7729: +      lt_debugprintf (__FILE__, __LINE__,
 7730: +		      "checking path component for symlinks: %s\n",
 7731: +		      tmp_pathspec);
 7732: +      if (lstat (tmp_pathspec, &s) == 0)
 7733: +	{
 7734: +	  if (S_ISLNK (s.st_mode) != 0)
 7735: +	    {
 7736: +	      has_symlinks = 1;
 7737: +	      break;
 7738: +	    }
 7739: +
 7740: +	  /* search backwards for last DIR_SEPARATOR */
 7741: +	  p = tmp_pathspec + strlen (tmp_pathspec) - 1;
 7742: +	  while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
 7743: +	    p--;
 7744: +	  if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
 7745: +	    {
 7746: +	      /* no more DIR_SEPARATORS left */
 7747: +	      break;
 7748: +	    }
 7749: +	  *p = '\0';
 7750: +	}
 7751: +      else
 7752: +	{
 7753: +	  lt_fatal (__FILE__, __LINE__,
 7754: +		    "error accessing file \"%s\": %s",
 7755: +		    tmp_pathspec, nonnull (strerror (errno)));
 7756: +	}
 7757: +    }
 7758: +  XFREE (tmp_pathspec);
 7759: +
 7760: +  if (!has_symlinks)
 7761: +    {
 7762: +      return xstrdup (pathspec);
 7763: +    }
 7764: +
 7765: +  tmp_pathspec = realpath (pathspec, buf);
 7766: +  if (tmp_pathspec == 0)
 7767: +    {
 7768: +      lt_fatal (__FILE__, __LINE__,
 7769: +		"could not follow symlinks for %s", pathspec);
 7770: +    }
 7771: +  return xstrdup (tmp_pathspec);
 7772: +#endif
 7773: +}
 7774: +
 7775: +char *
 7776: +strendzap (char *str, const char *pat)
 7777: +{
 7778: +  size_t len, patlen;
 7779: +
 7780: +  assert (str != NULL);
 7781: +  assert (pat != NULL);
 7782: +
 7783: +  len = strlen (str);
 7784: +  patlen = strlen (pat);
 7785: +
 7786: +  if (patlen <= len)
 7787: +    {
 7788: +      str += len - patlen;
 7789: +      if (STREQ (str, pat))
 7790: +	*str = '\0';
 7791: +    }
 7792: +  return str;
 7793: +}
 7794: +
 7795: +void
 7796: +lt_debugprintf (const char *file, int line, const char *fmt, ...)
 7797: +{
 7798: +  va_list args;
 7799: +  if (lt_debug)
 7800: +    {
 7801: +      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
 7802: +      va_start (args, fmt);
 7803: +      (void) vfprintf (stderr, fmt, args);
 7804: +      va_end (args);
 7805: +    }
 7806: +}
 7807: +
 7808: +static void
 7809: +lt_error_core (int exit_status, const char *file,
 7810: +	       int line, const char *mode,
 7811: +	       const char *message, va_list ap)
 7812: +{
 7813: +  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
 7814: +  vfprintf (stderr, message, ap);
 7815: +  fprintf (stderr, ".\n");
 7816: +
 7817: +  if (exit_status >= 0)
 7818: +    exit (exit_status);
 7819: +}
 7820: +
 7821: +void
 7822: +lt_fatal (const char *file, int line, const char *message, ...)
 7823: +{
 7824: +  va_list ap;
 7825: +  va_start (ap, message);
 7826: +  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
 7827: +  va_end (ap);
 7828: +}
 7829: +
 7830: +static const char *
 7831: +nonnull (const char *s)
 7832: +{
 7833: +  return s ? s : "(null)";
 7834: +}
 7835: +
 7836: +static const char *
 7837: +nonempty (const char *s)
 7838: +{
 7839: +  return (s && !*s) ? "(empty)" : nonnull (s);
 7840: +}
 7841: +
 7842: +void
 7843: +lt_setenv (const char *name, const char *value)
 7844: +{
 7845: +  lt_debugprintf (__FILE__, __LINE__,
 7846: +		  "(lt_setenv) setting '%s' to '%s'\n",
 7847: +                  nonnull (name), nonnull (value));
 7848: +  {
 7849: +#ifdef HAVE_SETENV
 7850: +    /* always make a copy, for consistency with !HAVE_SETENV */
 7851: +    char *str = xstrdup (value);
 7852: +    setenv (name, str, 1);
 7853: +#else
 7854: +    size_t len = strlen (name) + 1 + strlen (value) + 1;
 7855: +    char *str = XMALLOC (char, len);
 7856: +    sprintf (str, "%s=%s", name, value);
 7857: +    if (putenv (str) != EXIT_SUCCESS)
 7858: +      {
 7859: +        XFREE (str);
 7860: +      }
 7861: +#endif
 7862: +  }
 7863: +}
 7864: +
 7865: +char *
 7866: +lt_extend_str (const char *orig_value, const char *add, int to_end)
 7867: +{
 7868: +  char *new_value;
 7869: +  if (orig_value && *orig_value)
 7870: +    {
 7871: +      size_t orig_value_len = strlen (orig_value);
 7872: +      size_t add_len = strlen (add);
 7873: +      new_value = XMALLOC (char, add_len + orig_value_len + 1);
 7874: +      if (to_end)
 7875: +        {
 7876: +          strcpy (new_value, orig_value);
 7877: +          strcpy (new_value + orig_value_len, add);
 7878: +        }
 7879: +      else
 7880: +        {
 7881: +          strcpy (new_value, add);
 7882: +          strcpy (new_value + add_len, orig_value);
 7883: +        }
 7884: +    }
 7885: +  else
 7886: +    {
 7887: +      new_value = xstrdup (add);
 7888: +    }
 7889: +  return new_value;
 7890: +}
 7891: +
 7892: +void
 7893: +lt_update_exe_path (const char *name, const char *value)
 7894: +{
 7895: +  lt_debugprintf (__FILE__, __LINE__,
 7896: +		  "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
 7897: +                  nonnull (name), nonnull (value));
 7898: +
 7899: +  if (name && *name && value && *value)
 7900: +    {
 7901: +      char *new_value = lt_extend_str (getenv (name), value, 0);
 7902: +      /* some systems can't cope with a ':'-terminated path #' */
 7903: +      size_t len = strlen (new_value);
 7904: +      while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
 7905: +        {
 7906: +          new_value[--len] = '\0';
 7907: +        }
 7908: +      lt_setenv (name, new_value);
 7909: +      XFREE (new_value);
 7910: +    }
 7911: +}
 7912: +
 7913: +void
 7914: +lt_update_lib_path (const char *name, const char *value)
 7915: +{
 7916: +  lt_debugprintf (__FILE__, __LINE__,
 7917: +		  "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
 7918: +                  nonnull (name), nonnull (value));
 7919: +
 7920: +  if (name && *name && value && *value)
 7921: +    {
 7922: +      char *new_value = lt_extend_str (getenv (name), value, 0);
 7923: +      lt_setenv (name, new_value);
 7924: +      XFREE (new_value);
 7925: +    }
 7926: +}
 7927: +
 7928: +EOF
 7929: +	    case $host_os in
 7930: +	      mingw*)
 7931: +		cat <<"EOF"
 7932: +
 7933: +/* Prepares an argument vector before calling spawn().
 7934: +   Note that spawn() does not by itself call the command interpreter
 7935: +     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
 7936: +      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
 7937: +         GetVersionEx(&v);
 7938: +         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
 7939: +      }) ? "cmd.exe" : "command.com").
 7940: +   Instead it simply concatenates the arguments, separated by ' ', and calls
 7941: +   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
 7942: +   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
 7943: +   special way:
 7944: +   - Space and tab are interpreted as delimiters. They are not treated as
 7945: +     delimiters if they are surrounded by double quotes: "...".
 7946: +   - Unescaped double quotes are removed from the input. Their only effect is
 7947: +     that within double quotes, space and tab are treated like normal
 7948: +     characters.
 7949: +   - Backslashes not followed by double quotes are not special.
 7950: +   - But 2*n+1 backslashes followed by a double quote become
 7951: +     n backslashes followed by a double quote (n >= 0):
 7952: +       \" -> "
 7953: +       \\\" -> \"
 7954: +       \\\\\" -> \\"
 7955: + */
 7956: +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
 7957: +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
 7958: +char **
 7959: +prepare_spawn (char **argv)
 7960: +{
 7961: +  size_t argc;
 7962: +  char **new_argv;
 7963: +  size_t i;
 7964: +
 7965: +  /* Count number of arguments.  */
 7966: +  for (argc = 0; argv[argc] != NULL; argc++)
 7967: +    ;
 7968: +
 7969: +  /* Allocate new argument vector.  */
 7970: +  new_argv = XMALLOC (char *, argc + 1);
 7971: +
 7972: +  /* Put quoted arguments into the new argument vector.  */
 7973: +  for (i = 0; i < argc; i++)
 7974: +    {
 7975: +      const char *string = argv[i];
 7976: +
 7977: +      if (string[0] == '\0')
 7978: +	new_argv[i] = xstrdup ("\"\"");
 7979: +      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
 7980: +	{
 7981: +	  int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
 7982: +	  size_t length;
 7983: +	  unsigned int backslashes;
 7984: +	  const char *s;
 7985: +	  char *quoted_string;
 7986: +	  char *p;
 7987: +
 7988: +	  length = 0;
 7989: +	  backslashes = 0;
 7990: +	  if (quote_around)
 7991: +	    length++;
 7992: +	  for (s = string; *s != '\0'; s++)
 7993: +	    {
 7994: +	      char c = *s;
 7995: +	      if (c == '"')
 7996: +		length += backslashes + 1;
 7997: +	      length++;
 7998: +	      if (c == '\\')
 7999: +		backslashes++;
 8000: +	      else
 8001: +		backslashes = 0;
 8002: +	    }
 8003: +	  if (quote_around)
 8004: +	    length += backslashes + 1;
 8005: +
 8006: +	  quoted_string = XMALLOC (char, length + 1);
 8007: +
 8008: +	  p = quoted_string;
 8009: +	  backslashes = 0;
 8010: +	  if (quote_around)
 8011: +	    *p++ = '"';
 8012: +	  for (s = string; *s != '\0'; s++)
 8013: +	    {
 8014: +	      char c = *s;
 8015: +	      if (c == '"')
 8016: +		{
 8017: +		  unsigned int j;
 8018: +		  for (j = backslashes + 1; j > 0; j--)
 8019: +		    *p++ = '\\';
 8020: +		}
 8021: +	      *p++ = c;
 8022: +	      if (c == '\\')
 8023: +		backslashes++;
 8024: +	      else
 8025: +		backslashes = 0;
 8026: +	    }
 8027: +	  if (quote_around)
 8028: +	    {
 8029: +	      unsigned int j;
 8030: +	      for (j = backslashes; j > 0; j--)
 8031: +		*p++ = '\\';
 8032: +	      *p++ = '"';
 8033: +	    }
 8034: +	  *p = '\0';
 8035: +
 8036: +	  new_argv[i] = quoted_string;
 8037: +	}
 8038: +      else
 8039: +	new_argv[i] = (char *) string;
 8040: +    }
 8041: +  new_argv[argc] = NULL;
 8042: +
 8043: +  return new_argv;
 8044: +}
 8045: +EOF
 8046: +		;;
 8047: +	    esac
 8048: +
 8049: +            cat <<"EOF"
 8050: +void lt_dump_script (FILE* f)
 8051: +{
 8052: +EOF
 8053: +	    func_emit_wrapper yes |
 8054: +	      $SED -n -e '
 8055: +s/^\(.\{79\}\)\(..*\)/\1\
 8056: +\2/
 8057: +h
 8058: +s/\([\\"]\)/\\\1/g
 8059: +s/$/\\n/
 8060: +s/\([^\n]*\).*/  fputs ("\1", f);/p
 8061: +g
 8062: +D'
 8063: +            cat <<"EOF"
 8064: +}
 8065: +EOF
 8066: +}
 8067: +# end: func_emit_cwrapperexe_src
 8068: +
 8069: +# func_win32_import_lib_p ARG
 8070: +# True if ARG is an import lib, as indicated by $file_magic_cmd
 8071: +func_win32_import_lib_p ()
 8072: +{
 8073: +    $debug_cmd
 8074: +
 8075: +    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
 8076: +    *import*) : ;;
 8077: +    *) false ;;
 8078: +    esac
 8079: +}
 8080: +
 8081: +# func_suncc_cstd_abi
 8082: +# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
 8083: +# Several compiler flags select an ABI that is incompatible with the
 8084: +# Cstd library. Avoid specifying it if any are in CXXFLAGS.
 8085: +func_suncc_cstd_abi ()
 8086: +{
 8087: +    $debug_cmd
 8088: +
 8089: +    case " $compile_command " in
 8090: +    *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
 8091: +      suncc_use_cstd_abi=no
 8092: +      ;;
 8093: +    *)
 8094: +      suncc_use_cstd_abi=yes
 8095: +      ;;
 8096: +    esac
 8097: +}
 8098: +
 8099: +# func_mode_link arg...
 8100: +func_mode_link ()
 8101: +{
 8102: +    $debug_cmd
 8103: +
 8104: +    case $host in
 8105: +    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
 8106: +      # It is impossible to link a dll without this setting, and
 8107: +      # we shouldn't force the makefile maintainer to figure out
 8108: +      # what system we are compiling for in order to pass an extra
 8109: +      # flag for every libtool invocation.
 8110: +      # allow_undefined=no
 8111: +
 8112: +      # FIXME: Unfortunately, there are problems with the above when trying
 8113: +      # to make a dll that has undefined symbols, in which case not
 8114: +      # even a static library is built.  For now, we need to specify
 8115: +      # -no-undefined on the libtool link line when we can be certain
 8116: +      # that all symbols are satisfied, otherwise we get a static library.
 8117: +      allow_undefined=yes
 8118: +      ;;
 8119: +    *)
 8120: +      allow_undefined=yes
 8121: +      ;;
 8122: +    esac
 8123: +    libtool_args=$nonopt
 8124: +    base_compile="$nonopt $@"
 8125: +    compile_command=$nonopt
 8126: +    finalize_command=$nonopt
 8127: +
 8128: +    compile_rpath=
 8129: +    finalize_rpath=
 8130: +    compile_shlibpath=
 8131: +    finalize_shlibpath=
 8132: +    convenience=
 8133: +    old_convenience=
 8134: +    deplibs=
 8135: +    old_deplibs=
 8136: +    compiler_flags=
 8137: +    linker_flags=
 8138: +    dllsearchpath=
 8139: +    lib_search_path=`pwd`
 8140: +    inst_prefix_dir=
 8141: +    new_inherited_linker_flags=
 8142: +
 8143: +    avoid_version=no
 8144: +    bindir=
 8145: +    dlfiles=
 8146: +    dlprefiles=
 8147: +    dlself=no
 8148: +    export_dynamic=no
 8149: +    export_symbols=
 8150: +    export_symbols_regex=
 8151: +    generated=
 8152: +    libobjs=
 8153: +    ltlibs=
 8154: +    module=no
 8155: +    no_install=no
 8156: +    objs=
 8157: +    os2dllname=
 8158: +    non_pic_objects=
 8159: +    precious_files_regex=
 8160: +    prefer_static_libs=no
 8161: +    preload=false
 8162: +    prev=
 8163: +    prevarg=
 8164: +    release=
 8165: +    rpath=
 8166: +    xrpath=
 8167: +    perm_rpath=
 8168: +    temp_rpath=
 8169: +    thread_safe=no
 8170: +    vinfo=
 8171: +    vinfo_number=no
 8172: +    weak_libs=
 8173: +    single_module=$wl-single_module
 8174: +    func_infer_tag $base_compile
 8175: +
 8176: +    # We need to know -static, to get the right output filenames.
 8177: +    for arg
 8178: +    do
 8179: +      case $arg in
 8180: +      -shared)
 8181: +	test yes != "$build_libtool_libs" \
 8182: +	  && func_fatal_configuration "cannot build a shared library"
 8183: +	build_old_libs=no
 8184: +	break
 8185: +	;;
 8186: +      -all-static | -static | -static-libtool-libs)
 8187: +	case $arg in
 8188: +	-all-static)
 8189: +	  if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
 8190: +	    func_warning "complete static linking is impossible in this configuration"
 8191: +	  fi
 8192: +	  if test -n "$link_static_flag"; then
 8193: +	    dlopen_self=$dlopen_self_static
 8194: +	  fi
 8195: +	  prefer_static_libs=yes
 8196: +	  ;;
 8197: +	-static)
 8198: +	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
 8199: +	    dlopen_self=$dlopen_self_static
 8200: +	  fi
 8201: +	  prefer_static_libs=built
 8202: +	  ;;
 8203: +	-static-libtool-libs)
 8204: +	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
 8205: +	    dlopen_self=$dlopen_self_static
 8206: +	  fi
 8207: +	  prefer_static_libs=yes
 8208: +	  ;;
 8209: +	esac
 8210: +	build_libtool_libs=no
 8211: +	build_old_libs=yes
 8212: +	break
 8213: +	;;
 8214: +      esac
 8215: +    done
 8216: +
 8217: +    # See if our shared archives depend on static archives.
 8218: +    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
 8219: +
 8220: +    # Go through the arguments, transforming them on the way.
 8221: +    while test "$#" -gt 0; do
 8222: +      arg=$1
 8223: +      shift
 8224: +      func_quote_for_eval "$arg"
 8225: +      qarg=$func_quote_for_eval_unquoted_result
 8226: +      func_append libtool_args " $func_quote_for_eval_result"
 8227: +
 8228: +      # If the previous option needs an argument, assign it.
 8229: +      if test -n "$prev"; then
 8230: +	case $prev in
 8231: +	output)
 8232: +	  func_append compile_command " @OUTPUT@"
 8233: +	  func_append finalize_command " @OUTPUT@"
 8234: +	  ;;
 8235: +	esac
 8236: +
 8237: +	case $prev in
 8238: +	bindir)
 8239: +	  bindir=$arg
 8240: +	  prev=
 8241: +	  continue
 8242: +	  ;;
 8243: +	dlfiles|dlprefiles)
 8244: +	  $preload || {
 8245: +	    # Add the symbol object into the linking commands.
 8246: +	    func_append compile_command " @SYMFILE@"
 8247: +	    func_append finalize_command " @SYMFILE@"
 8248: +	    preload=:
 8249: +	  }
 8250: +	  case $arg in
 8251: +	  *.la | *.lo) ;;  # We handle these cases below.
 8252: +	  force)
 8253: +	    if test no = "$dlself"; then
 8254: +	      dlself=needless
 8255: +	      export_dynamic=yes
 8256: +	    fi
 8257: +	    prev=
 8258: +	    continue
 8259: +	    ;;
 8260: +	  self)
 8261: +	    if test dlprefiles = "$prev"; then
 8262: +	      dlself=yes
 8263: +	    elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
 8264: +	      dlself=yes
 8265: +	    else
 8266: +	      dlself=needless
 8267: +	      export_dynamic=yes
 8268: +	    fi
 8269: +	    prev=
 8270: +	    continue
 8271: +	    ;;
 8272: +	  *)
 8273: +	    if test dlfiles = "$prev"; then
 8274: +	      func_append dlfiles " $arg"
 8275: +	    else
 8276: +	      func_append dlprefiles " $arg"
 8277: +	    fi
 8278: +	    prev=
 8279: +	    continue
 8280: +	    ;;
 8281: +	  esac
 8282: +	  ;;
 8283: +	expsyms)
 8284: +	  export_symbols=$arg
 8285: +	  test -f "$arg" \
 8286: +	    || func_fatal_error "symbol file '$arg' does not exist"
 8287: +	  prev=
 8288: +	  continue
 8289: +	  ;;
 8290: +	expsyms_regex)
 8291: +	  export_symbols_regex=$arg
 8292: +	  prev=
 8293: +	  continue
 8294: +	  ;;
 8295: +	framework)
 8296: +	  case $host in
 8297: +	    *-*-darwin*)
 8298: +	      case "$deplibs " in
 8299: +		*" $qarg.ltframework "*) ;;
 8300: +		*) func_append deplibs " $qarg.ltframework" # this is fixed later
 8301: +		   ;;
 8302: +	      esac
 8303: +	      ;;
 8304: +	  esac
 8305: +	  prev=
 8306: +	  continue
 8307: +	  ;;
 8308: +	inst_prefix)
 8309: +	  inst_prefix_dir=$arg
 8310: +	  prev=
 8311: +	  continue
 8312: +	  ;;
 8313: +	mllvm)
 8314: +	  # Clang does not use LLVM to link, so we can simply discard any
 8315: +	  # '-mllvm $arg' options when doing the link step.
 8316: +	  prev=
 8317: +	  continue
 8318: +	  ;;
 8319: +	objectlist)
 8320: +	  if test -f "$arg"; then
 8321: +	    save_arg=$arg
 8322: +	    moreargs=
 8323: +	    for fil in `cat "$save_arg"`
 8324: +	    do
 8325: +#	      func_append moreargs " $fil"
 8326: +	      arg=$fil
 8327: +	      # A libtool-controlled object.
 8328: +
 8329: +	      # Check to see that this really is a libtool object.
 8330: +	      if func_lalib_unsafe_p "$arg"; then
 8331: +		pic_object=
 8332: +		non_pic_object=
 8333: +
 8334: +		# Read the .lo file
 8335: +		func_source "$arg"
 8336: +
 8337: +		if test -z "$pic_object" ||
 8338: +		   test -z "$non_pic_object" ||
 8339: +		   test none = "$pic_object" &&
 8340: +		   test none = "$non_pic_object"; then
 8341: +		  func_fatal_error "cannot find name of object for '$arg'"
 8342: +		fi
 8343: +
 8344: +		# Extract subdirectory from the argument.
 8345: +		func_dirname "$arg" "/" ""
 8346: +		xdir=$func_dirname_result
 8347: +
 8348: +		if test none != "$pic_object"; then
 8349: +		  # Prepend the subdirectory the object is found in.
 8350: +		  pic_object=$xdir$pic_object
 8351: +
 8352: +		  if test dlfiles = "$prev"; then
 8353: +		    if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
 8354: +		      func_append dlfiles " $pic_object"
 8355: +		      prev=
 8356: +		      continue
 8357: +		    else
 8358: +		      # If libtool objects are unsupported, then we need to preload.
 8359: +		      prev=dlprefiles
 8360: +		    fi
 8361: +		  fi
 8362: +
 8363: +		  # CHECK ME:  I think I busted this.  -Ossama
 8364: +		  if test dlprefiles = "$prev"; then
 8365: +		    # Preload the old-style object.
 8366: +		    func_append dlprefiles " $pic_object"
 8367: +		    prev=
 8368: +		  fi
 8369: +
 8370: +		  # A PIC object.
 8371: +		  func_append libobjs " $pic_object"
 8372: +		  arg=$pic_object
 8373: +		fi
 8374: +
 8375: +		# Non-PIC object.
 8376: +		if test none != "$non_pic_object"; then
 8377: +		  # Prepend the subdirectory the object is found in.
 8378: +		  non_pic_object=$xdir$non_pic_object
 8379: +
 8380: +		  # A standard non-PIC object
 8381: +		  func_append non_pic_objects " $non_pic_object"
 8382: +		  if test -z "$pic_object" || test none = "$pic_object"; then
 8383: +		    arg=$non_pic_object
 8384: +		  fi
 8385: +		else
 8386: +		  # If the PIC object exists, use it instead.
 8387: +		  # $xdir was prepended to $pic_object above.
 8388: +		  non_pic_object=$pic_object
 8389: +		  func_append non_pic_objects " $non_pic_object"
 8390: +		fi
 8391: +	      else
 8392: +		# Only an error if not doing a dry-run.
 8393: +		if $opt_dry_run; then
 8394: +		  # Extract subdirectory from the argument.
 8395: +		  func_dirname "$arg" "/" ""
 8396: +		  xdir=$func_dirname_result
 8397: +
 8398: +		  func_lo2o "$arg"
 8399: +		  pic_object=$xdir$objdir/$func_lo2o_result
 8400: +		  non_pic_object=$xdir$func_lo2o_result
 8401: +		  func_append libobjs " $pic_object"
 8402: +		  func_append non_pic_objects " $non_pic_object"
 8403: +	        else
 8404: +		  func_fatal_error "'$arg' is not a valid libtool object"
 8405: +		fi
 8406: +	      fi
 8407: +	    done
 8408: +	  else
 8409: +	    func_fatal_error "link input file '$arg' does not exist"
 8410: +	  fi
 8411: +	  arg=$save_arg
 8412: +	  prev=
 8413: +	  continue
 8414: +	  ;;
 8415: +	os2dllname)
 8416: +	  os2dllname=$arg
 8417: +	  prev=
 8418: +	  continue
 8419: +	  ;;
 8420: +	precious_regex)
 8421: +	  precious_files_regex=$arg
 8422: +	  prev=
 8423: +	  continue
 8424: +	  ;;
 8425: +	release)
 8426: +	  release=-$arg
 8427: +	  prev=
 8428: +	  continue
 8429: +	  ;;
 8430: +	rpath | xrpath)
 8431: +	  # We need an absolute path.
 8432: +	  case $arg in
 8433: +	  [\\/]* | [A-Za-z]:[\\/]*) ;;
 8434: +	  *)
 8435: +	    func_fatal_error "only absolute run-paths are allowed"
 8436: +	    ;;
 8437: +	  esac
 8438: +	  if test rpath = "$prev"; then
 8439: +	    case "$rpath " in
 8440: +	    *" $arg "*) ;;
 8441: +	    *) func_append rpath " $arg" ;;
 8442: +	    esac
 8443: +	  else
 8444: +	    case "$xrpath " in
 8445: +	    *" $arg "*) ;;
 8446: +	    *) func_append xrpath " $arg" ;;
 8447: +	    esac
 8448: +	  fi
 8449: +	  prev=
 8450: +	  continue
 8451: +	  ;;
 8452: +	shrext)
 8453: +	  shrext_cmds=$arg
 8454: +	  prev=
 8455: +	  continue
 8456: +	  ;;
 8457: +	weak)
 8458: +	  func_append weak_libs " $arg"
 8459: +	  prev=
 8460: +	  continue
 8461: +	  ;;
 8462: +	xcclinker)
 8463: +	  func_append linker_flags " $qarg"
 8464: +	  func_append compiler_flags " $qarg"
 8465: +	  prev=
 8466: +	  func_append compile_command " $qarg"
 8467: +	  func_append finalize_command " $qarg"
 8468: +	  continue
 8469: +	  ;;
 8470: +	xcompiler)
 8471: +	  func_append compiler_flags " $qarg"
 8472: +	  prev=
 8473: +	  func_append compile_command " $qarg"
 8474: +	  func_append finalize_command " $qarg"
 8475: +	  continue
 8476: +	  ;;
 8477: +	xlinker)
 8478: +	  func_append linker_flags " $qarg"
 8479: +	  func_append compiler_flags " $wl$qarg"
 8480: +	  prev=
 8481: +	  func_append compile_command " $wl$qarg"
 8482: +	  func_append finalize_command " $wl$qarg"
 8483: +	  continue
 8484: +	  ;;
 8485: +	*)
 8486: +	  eval "$prev=\"\$arg\""
 8487: +	  prev=
 8488: +	  continue
 8489: +	  ;;
 8490: +	esac
 8491: +      fi # test -n "$prev"
 8492: +
 8493: +      prevarg=$arg
 8494: +
 8495: +      case $arg in
 8496: +      -all-static)
 8497: +	if test -n "$link_static_flag"; then
 8498: +	  # See comment for -static flag below, for more details.
 8499: +	  func_append compile_command " $link_static_flag"
 8500: +	  func_append finalize_command " $link_static_flag"
 8501: +	fi
 8502: +	continue
 8503: +	;;
 8504: +
 8505: +      -allow-undefined)
 8506: +	# FIXME: remove this flag sometime in the future.
 8507: +	func_fatal_error "'-allow-undefined' must not be used because it is the default"
 8508: +	;;
 8509: +
 8510: +      -avoid-version)
 8511: +	avoid_version=yes
 8512: +	continue
 8513: +	;;
 8514: +
 8515: +      -bindir)
 8516: +	prev=bindir
 8517: +	continue
 8518: +	;;
 8519: +
 8520: +      -dlopen)
 8521: +	prev=dlfiles
 8522: +	continue
 8523: +	;;
 8524: +
 8525: +      -dlpreopen)
 8526: +	prev=dlprefiles
 8527: +	continue
 8528: +	;;
 8529: +
 8530: +      -export-dynamic)
 8531: +	export_dynamic=yes
 8532: +	continue
 8533: +	;;
 8534: +
 8535: +      -export-symbols | -export-symbols-regex)
 8536: +	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
 8537: +	  func_fatal_error "more than one -exported-symbols argument is not allowed"
 8538: +	fi
 8539: +	if test X-export-symbols = "X$arg"; then
 8540: +	  prev=expsyms
 8541: +	else
 8542: +	  prev=expsyms_regex
 8543: +	fi
 8544: +	continue
 8545: +	;;
 8546: +
 8547: +      -framework)
 8548: +	prev=framework
 8549: +	continue
 8550: +	;;
 8551: +
 8552: +      -inst-prefix-dir)
 8553: +	prev=inst_prefix
 8554: +	continue
 8555: +	;;
 8556: +
 8557: +      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
 8558: +      # so, if we see these flags be careful not to treat them like -L
 8559: +      -L[A-Z][A-Z]*:*)
 8560: +	case $with_gcc/$host in
 8561: +	no/*-*-irix* | /*-*-irix*)
 8562: +	  func_append compile_command " $arg"
 8563: +	  func_append finalize_command " $arg"
 8564: +	  ;;
 8565: +	esac
 8566: +	continue
 8567: +	;;
 8568: +
 8569: +      -L*)
 8570: +	func_stripname "-L" '' "$arg"
 8571: +	if test -z "$func_stripname_result"; then
 8572: +	  if test "$#" -gt 0; then
 8573: +	    func_fatal_error "require no space between '-L' and '$1'"
 8574: +	  else
 8575: +	    func_fatal_error "need path for '-L' option"
 8576: +	  fi
 8577: +	fi
 8578: +	func_resolve_sysroot "$func_stripname_result"
 8579: +	dir=$func_resolve_sysroot_result
 8580: +	# We need an absolute path.
 8581: +	case $dir in
 8582: +	[\\/]* | [A-Za-z]:[\\/]*) ;;
 8583: +	*)
 8584: +	  absdir=`cd "$dir" && pwd`
 8585: +	  test -z "$absdir" && \
 8586: +	    func_fatal_error "cannot determine absolute directory name of '$dir'"
 8587: +	  dir=$absdir
 8588: +	  ;;
 8589: +	esac
 8590: +	case "$deplibs " in
 8591: +	*" -L$dir "* | *" $arg "*)
 8592: +	  # Will only happen for absolute or sysroot arguments
 8593: +	  ;;
 8594: +	*)
 8595: +	  # Preserve sysroot, but never include relative directories
 8596: +	  case $dir in
 8597: +	    [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
 8598: +	    *) func_append deplibs " -L$dir" ;;
 8599: +	  esac
 8600: +	  func_append lib_search_path " $dir"
 8601: +	  ;;
 8602: +	esac
 8603: +	case $host in
 8604: +	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
 8605: +	  testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
 8606: +	  case :$dllsearchpath: in
 8607: +	  *":$dir:"*) ;;
 8608: +	  ::) dllsearchpath=$dir;;
 8609: +	  *) func_append dllsearchpath ":$dir";;
 8610: +	  esac
 8611: +	  case :$dllsearchpath: in
 8612: +	  *":$testbindir:"*) ;;
 8613: +	  ::) dllsearchpath=$testbindir;;
 8614: +	  *) func_append dllsearchpath ":$testbindir";;
 8615: +	  esac
 8616: +	  ;;
 8617: +	esac
 8618: +	continue
 8619: +	;;
 8620: +
 8621: +      -l*)
 8622: +	if test X-lc = "X$arg" || test X-lm = "X$arg"; then
 8623: +	  case $host in
 8624: +	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
 8625: +	    # These systems don't actually have a C or math library (as such)
 8626: +	    continue
 8627: +	    ;;
 8628: +	  *-*-os2*)
 8629: +	    # These systems don't actually have a C library (as such)
 8630: +	    test X-lc = "X$arg" && continue
 8631: +	    ;;
 8632: +	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
 8633: +	    # Do not include libc due to us having libc/libc_r.
 8634: +	    test X-lc = "X$arg" && continue
 8635: +	    ;;
 8636: +	  *-*-rhapsody* | *-*-darwin1.[012])
 8637: +	    # Rhapsody C and math libraries are in the System framework
 8638: +	    func_append deplibs " System.ltframework"
 8639: +	    continue
 8640: +	    ;;
 8641: +	  *-*-sco3.2v5* | *-*-sco5v6*)
 8642: +	    # Causes problems with __ctype
 8643: +	    test X-lc = "X$arg" && continue
 8644: +	    ;;
 8645: +	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 8646: +	    # Compiler inserts libc in the correct place for threads to work
 8647: +	    test X-lc = "X$arg" && continue
 8648: +	    ;;
 8649: +	  esac
 8650: +	elif test X-lc_r = "X$arg"; then
 8651: +	 case $host in
 8652: +	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
 8653: +	   # Do not include libc_r directly, use -pthread flag.
 8654: +	   continue
 8655: +	   ;;
 8656: +	 esac
 8657: +	fi
 8658: +	func_append deplibs " $arg"
 8659: +	continue
 8660: +	;;
 8661: +
 8662: +      -mllvm)
 8663: +	prev=mllvm
 8664: +	continue
 8665: +	;;
 8666: +
 8667: +      -module)
 8668: +	module=yes
 8669: +	continue
 8670: +	;;
 8671: +
 8672: +      # Tru64 UNIX uses -model [arg] to determine the layout of C++
 8673: +      # classes, name mangling, and exception handling.
 8674: +      # Darwin uses the -arch flag to determine output architecture.
 8675: +      -model|-arch|-isysroot|--sysroot)
 8676: +	func_append compiler_flags " $arg"
 8677: +	func_append compile_command " $arg"
 8678: +	func_append finalize_command " $arg"
 8679: +	prev=xcompiler
 8680: +	continue
 8681: +	;;
 8682: +
 8683: +      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
 8684: +      |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
 8685: +	func_append compiler_flags " $arg"
 8686: +	func_append compile_command " $arg"
 8687: +	func_append finalize_command " $arg"
 8688: +	case "$new_inherited_linker_flags " in
 8689: +	    *" $arg "*) ;;
 8690: +	    * ) func_append new_inherited_linker_flags " $arg" ;;
 8691: +	esac
 8692: +	continue
 8693: +	;;
 8694: +
 8695: +      -multi_module)
 8696: +	single_module=$wl-multi_module
 8697: +	continue
 8698: +	;;
 8699: +
 8700: +      -no-fast-install)
 8701: +	fast_install=no
 8702: +	continue
 8703: +	;;
 8704: +
 8705: +      -no-install)
 8706: +	case $host in
 8707: +	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
 8708: +	  # The PATH hackery in wrapper scripts is required on Windows
 8709: +	  # and Darwin in order for the loader to find any dlls it needs.
 8710: +	  func_warning "'-no-install' is ignored for $host"
 8711: +	  func_warning "assuming '-no-fast-install' instead"
 8712: +	  fast_install=no
 8713: +	  ;;
 8714: +	*) no_install=yes ;;
 8715: +	esac
 8716: +	continue
 8717: +	;;
 8718: +
 8719: +      -no-undefined)
 8720: +	allow_undefined=no
 8721: +	continue
 8722: +	;;
 8723: +
 8724: +      -objectlist)
 8725: +	prev=objectlist
 8726: +	continue
 8727: +	;;
 8728: +
 8729: +      -os2dllname)
 8730: +	prev=os2dllname
 8731: +	continue
 8732: +	;;
 8733: +
 8734: +      -o) prev=output ;;
 8735: +
 8736: +      -precious-files-regex)
 8737: +	prev=precious_regex
 8738: +	continue
 8739: +	;;
 8740: +
 8741: +      -release)
 8742: +	prev=release
 8743: +	continue
 8744: +	;;
 8745: +
 8746: +      -rpath)
 8747: +	prev=rpath
 8748: +	continue
 8749: +	;;
 8750: +
 8751: +      -R)
 8752: +	prev=xrpath
 8753: +	continue
 8754: +	;;
 8755: +
 8756: +      -R*)
 8757: +	func_stripname '-R' '' "$arg"
 8758: +	dir=$func_stripname_result
 8759: +	# We need an absolute path.
 8760: +	case $dir in
 8761: +	[\\/]* | [A-Za-z]:[\\/]*) ;;
 8762: +	=*)
 8763: +	  func_stripname '=' '' "$dir"
 8764: +	  dir=$lt_sysroot$func_stripname_result
 8765: +	  ;;
 8766: +	*)
 8767: +	  func_fatal_error "only absolute run-paths are allowed"
 8768: +	  ;;
 8769: +	esac
 8770: +	case "$xrpath " in
 8771: +	*" $dir "*) ;;
 8772: +	*) func_append xrpath " $dir" ;;
 8773: +	esac
 8774: +	continue
 8775: +	;;
 8776: +
 8777: +      -shared)
 8778: +	# The effects of -shared are defined in a previous loop.
 8779: +	continue
 8780: +	;;
 8781: +
 8782: +      -shrext)
 8783: +	prev=shrext
 8784: +	continue
 8785: +	;;
 8786: +
 8787: +      -static | -static-libtool-libs)
 8788: +	# The effects of -static are defined in a previous loop.
 8789: +	# We used to do the same as -all-static on platforms that
 8790: +	# didn't have a PIC flag, but the assumption that the effects
 8791: +	# would be equivalent was wrong.  It would break on at least
 8792: +	# Digital Unix and AIX.
 8793: +	continue
 8794: +	;;
 8795: +
 8796: +      -thread-safe)
 8797: +	thread_safe=yes
 8798: +	continue
 8799: +	;;
 8800: +
 8801: +      -version-info)
 8802: +	prev=vinfo
 8803: +	continue
 8804: +	;;
 8805: +
 8806: +      -version-number)
 8807: +	prev=vinfo
 8808: +	vinfo_number=yes
 8809: +	continue
 8810: +	;;
 8811: +
 8812: +      -weak)
 8813: +        prev=weak
 8814: +	continue
 8815: +	;;
 8816: +
 8817: +      -Wc,*)
 8818: +	func_stripname '-Wc,' '' "$arg"
 8819: +	args=$func_stripname_result
 8820: +	arg=
 8821: +	save_ifs=$IFS; IFS=,
 8822: +	for flag in $args; do
 8823: +	  IFS=$save_ifs
 8824: +          func_quote_for_eval "$flag"
 8825: +	  func_append arg " $func_quote_for_eval_result"
 8826: +	  func_append compiler_flags " $func_quote_for_eval_result"
 8827: +	done
 8828: +	IFS=$save_ifs
 8829: +	func_stripname ' ' '' "$arg"
 8830: +	arg=$func_stripname_result
 8831: +	;;
 8832: +
 8833: +      -Wl,*)
 8834: +	func_stripname '-Wl,' '' "$arg"
 8835: +	args=$func_stripname_result
 8836: +	arg=
 8837: +	save_ifs=$IFS; IFS=,
 8838: +	for flag in $args; do
 8839: +	  IFS=$save_ifs
 8840: +          func_quote_for_eval "$flag"
 8841: +	  func_append arg " $wl$func_quote_for_eval_result"
 8842: +	  func_append compiler_flags " $wl$func_quote_for_eval_result"
 8843: +	  func_append linker_flags " $func_quote_for_eval_result"
 8844: +	done
 8845: +	IFS=$save_ifs
 8846: +	func_stripname ' ' '' "$arg"
 8847: +	arg=$func_stripname_result
 8848: +	;;
 8849: +
 8850: +      -Xcompiler)
 8851: +	prev=xcompiler
 8852: +	continue
 8853: +	;;
 8854: +
 8855: +      -Xlinker)
 8856: +	prev=xlinker
 8857: +	continue
 8858: +	;;
 8859: +
 8860: +      -XCClinker)
 8861: +	prev=xcclinker
 8862: +	continue
 8863: +	;;
 8864: +
 8865: +      # -msg_* for osf cc
 8866: +      -msg_*)
 8867: +	func_quote_for_eval "$arg"
 8868: +	arg=$func_quote_for_eval_result
 8869: +	;;
 8870: +
 8871: +      # Flags to be passed through unchanged, with rationale:
 8872: +      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
 8873: +      # -r[0-9][0-9]*        specify processor for the SGI compiler
 8874: +      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
 8875: +      # +DA*, +DD*           enable 64-bit mode for the HP compiler
 8876: +      # -q*                  compiler args for the IBM compiler
 8877: +      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
 8878: +      # -F/path              path to uninstalled frameworks, gcc on darwin
 8879: +      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
 8880: +      # -fstack-protector*   stack protector flags for GCC
 8881: +      # @file                GCC response files
 8882: +      # -tp=*                Portland pgcc target processor selection
 8883: +      # --sysroot=*          for sysroot support
 8884: +      # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
 8885: +      # -stdlib=*            select c++ std lib with clang
 8886: +      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
 8887: +      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
 8888: +      -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
 8889: +        func_quote_for_eval "$arg"
 8890: +	arg=$func_quote_for_eval_result
 8891: +        func_append compile_command " $arg"
 8892: +        func_append finalize_command " $arg"
 8893: +        func_append compiler_flags " $arg"
 8894: +        continue
 8895: +        ;;
 8896: +
 8897: +      -Z*)
 8898: +        if test os2 = "`expr $host : '.*\(os2\)'`"; then
 8899: +          # OS/2 uses -Zxxx to specify OS/2-specific options
 8900: +	  compiler_flags="$compiler_flags $arg"
 8901: +	  func_append compile_command " $arg"
 8902: +	  func_append finalize_command " $arg"
 8903: +	  case $arg in
 8904: +	  -Zlinker | -Zstack)
 8905: +	    prev=xcompiler
 8906: +	    ;;
 8907: +	  esac
 8908: +	  continue
 8909: +        else
 8910: +	  # Otherwise treat like 'Some other compiler flag' below
 8911: +	  func_quote_for_eval "$arg"
 8912: +	  arg=$func_quote_for_eval_result
 8913: +        fi
 8914: +	;;
 8915: +
 8916: +      # Some other compiler flag.
 8917: +      -* | +*)
 8918: +        func_quote_for_eval "$arg"
 8919: +	arg=$func_quote_for_eval_result
 8920: +	;;
 8921: +
 8922: +      *.$objext)
 8923: +	# A standard object.
 8924: +	func_append objs " $arg"
 8925: +	;;
 8926: +
 8927: +      *.lo)
 8928: +	# A libtool-controlled object.
 8929: +
 8930: +	# Check to see that this really is a libtool object.
 8931: +	if func_lalib_unsafe_p "$arg"; then
 8932: +	  pic_object=
 8933: +	  non_pic_object=
 8934: +
 8935: +	  # Read the .lo file
 8936: +	  func_source "$arg"
 8937: +
 8938: +	  if test -z "$pic_object" ||
 8939: +	     test -z "$non_pic_object" ||
 8940: +	     test none = "$pic_object" &&
 8941: +	     test none = "$non_pic_object"; then
 8942: +	    func_fatal_error "cannot find name of object for '$arg'"
 8943: +	  fi
 8944: +
 8945: +	  # Extract subdirectory from the argument.
 8946: +	  func_dirname "$arg" "/" ""
 8947: +	  xdir=$func_dirname_result
 8948: +
 8949: +	  test none = "$pic_object" || {
 8950: +	    # Prepend the subdirectory the object is found in.
 8951: +	    pic_object=$xdir$pic_object
 8952: +
 8953: +	    if test dlfiles = "$prev"; then
 8954: +	      if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
 8955: +		func_append dlfiles " $pic_object"
 8956: +		prev=
 8957: +		continue
 8958: +	      else
 8959: +		# If libtool objects are unsupported, then we need to preload.
 8960: +		prev=dlprefiles
 8961: +	      fi
 8962: +	    fi
 8963: +
 8964: +	    # CHECK ME:  I think I busted this.  -Ossama
 8965: +	    if test dlprefiles = "$prev"; then
 8966: +	      # Preload the old-style object.
 8967: +	      func_append dlprefiles " $pic_object"
 8968: +	      prev=
 8969: +	    fi
 8970: +
 8971: +	    # A PIC object.
 8972: +	    func_append libobjs " $pic_object"
 8973: +	    arg=$pic_object
 8974: +	  }
 8975: +
 8976: +	  # Non-PIC object.
 8977: +	  if test none != "$non_pic_object"; then
 8978: +	    # Prepend the subdirectory the object is found in.
 8979: +	    non_pic_object=$xdir$non_pic_object
 8980: +
 8981: +	    # A standard non-PIC object
 8982: +	    func_append non_pic_objects " $non_pic_object"
 8983: +	    if test -z "$pic_object" || test none = "$pic_object"; then
 8984: +	      arg=$non_pic_object
 8985: +	    fi
 8986: +	  else
 8987: +	    # If the PIC object exists, use it instead.
 8988: +	    # $xdir was prepended to $pic_object above.
 8989: +	    non_pic_object=$pic_object
 8990: +	    func_append non_pic_objects " $non_pic_object"
 8991: +	  fi
 8992: +	else
 8993: +	  # Only an error if not doing a dry-run.
 8994: +	  if $opt_dry_run; then
 8995: +	    # Extract subdirectory from the argument.
 8996: +	    func_dirname "$arg" "/" ""
 8997: +	    xdir=$func_dirname_result
 8998: +
 8999: +	    func_lo2o "$arg"
 9000: +	    pic_object=$xdir$objdir/$func_lo2o_result
 9001: +	    non_pic_object=$xdir$func_lo2o_result
 9002: +	    func_append libobjs " $pic_object"
 9003: +	    func_append non_pic_objects " $non_pic_object"
 9004: +	  else
 9005: +	    func_fatal_error "'$arg' is not a valid libtool object"
 9006: +	  fi
 9007: +	fi
 9008: +	;;
 9009: +
 9010: +      *.$libext)
 9011: +	# An archive.
 9012: +	func_append deplibs " $arg"
 9013: +	func_append old_deplibs " $arg"
 9014: +	continue
 9015: +	;;
 9016: +
 9017: +      *.la)
 9018: +	# A libtool-controlled library.
 9019: +
 9020: +	func_resolve_sysroot "$arg"
 9021: +	if test dlfiles = "$prev"; then
 9022: +	  # This library was specified with -dlopen.
 9023: +	  func_append dlfiles " $func_resolve_sysroot_result"
 9024: +	  prev=
 9025: +	elif test dlprefiles = "$prev"; then
 9026: +	  # The library was specified with -dlpreopen.
 9027: +	  func_append dlprefiles " $func_resolve_sysroot_result"
 9028: +	  prev=
 9029: +	else
 9030: +	  func_append deplibs " $func_resolve_sysroot_result"
 9031: +	fi
 9032: +	continue
 9033: +	;;
 9034: +
 9035: +      # Some other compiler argument.
 9036: +      *)
 9037: +	# Unknown arguments in both finalize_command and compile_command need
 9038: +	# to be aesthetically quoted because they are evaled later.
 9039: +	func_quote_for_eval "$arg"
 9040: +	arg=$func_quote_for_eval_result
 9041: +	;;
 9042: +      esac # arg
 9043: +
 9044: +      # Now actually substitute the argument into the commands.
 9045: +      if test -n "$arg"; then
 9046: +	func_append compile_command " $arg"
 9047: +	func_append finalize_command " $arg"
 9048: +      fi
 9049: +    done # argument parsing loop
 9050: +
 9051: +    test -n "$prev" && \
 9052: +      func_fatal_help "the '$prevarg' option requires an argument"
 9053: +
 9054: +    if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
 9055: +      eval arg=\"$export_dynamic_flag_spec\"
 9056: +      func_append compile_command " $arg"
 9057: +      func_append finalize_command " $arg"
 9058: +    fi
 9059: +
 9060: +    oldlibs=
 9061: +    # calculate the name of the file, without its directory
 9062: +    func_basename "$output"
 9063: +    outputname=$func_basename_result
 9064: +    libobjs_save=$libobjs
 9065: +
 9066: +    if test -n "$shlibpath_var"; then
 9067: +      # get the directories listed in $shlibpath_var
 9068: +      eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
 9069: +    else
 9070: +      shlib_search_path=
 9071: +    fi
 9072: +    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
 9073: +    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
 9074: +
 9075: +    # Definition is injected by LT_CONFIG during libtool generation.
 9076: +    func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
 9077: +
 9078: +    func_dirname "$output" "/" ""
 9079: +    output_objdir=$func_dirname_result$objdir
 9080: +    func_to_tool_file "$output_objdir/"
 9081: +    tool_output_objdir=$func_to_tool_file_result
 9082: +    # Create the object directory.
 9083: +    func_mkdir_p "$output_objdir"
 9084: +
 9085: +    # Determine the type of output
 9086: +    case $output in
 9087: +    "")
 9088: +      func_fatal_help "you must specify an output file"
 9089: +      ;;
 9090: +    *.$libext) linkmode=oldlib ;;
 9091: +    *.lo | *.$objext) linkmode=obj ;;
 9092: +    *.la) linkmode=lib ;;
 9093: +    *) linkmode=prog ;; # Anything else should be a program.
 9094: +    esac
 9095: +
 9096: +    specialdeplibs=
 9097: +
 9098: +    libs=
 9099: +    # Find all interdependent deplibs by searching for libraries
 9100: +    # that are linked more than once (e.g. -la -lb -la)
 9101: +    for deplib in $deplibs; do
 9102: +      if $opt_preserve_dup_deps; then
 9103: +	case "$libs " in
 9104: +	*" $deplib "*) func_append specialdeplibs " $deplib" ;;
 9105: +	esac
 9106: +      fi
 9107: +      func_append libs " $deplib"
 9108: +    done
 9109: +
 9110: +    if test lib = "$linkmode"; then
 9111: +      libs="$predeps $libs $compiler_lib_search_path $postdeps"
 9112: +
 9113: +      # Compute libraries that are listed more than once in $predeps
 9114: +      # $postdeps and mark them as special (i.e., whose duplicates are
 9115: +      # not to be eliminated).
 9116: +      pre_post_deps=
 9117: +      if $opt_duplicate_compiler_generated_deps; then
 9118: +	for pre_post_dep in $predeps $postdeps; do
 9119: +	  case "$pre_post_deps " in
 9120: +	  *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
 9121: +	  esac
 9122: +	  func_append pre_post_deps " $pre_post_dep"
 9123: +	done
 9124: +      fi
 9125: +      pre_post_deps=
 9126: +    fi
 9127: +
 9128: +    deplibs=
 9129: +    newdependency_libs=
 9130: +    newlib_search_path=
 9131: +    need_relink=no # whether we're linking any uninstalled libtool libraries
 9132: +    notinst_deplibs= # not-installed libtool libraries
 9133: +    notinst_path= # paths that contain not-installed libtool libraries
 9134: +
 9135: +    case $linkmode in
 9136: +    lib)
 9137: +	passes="conv dlpreopen link"
 9138: +	for file in $dlfiles $dlprefiles; do
 9139: +	  case $file in
 9140: +	  *.la) ;;
 9141: +	  *)
 9142: +	    func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
 9143: +	    ;;
 9144: +	  esac
 9145: +	done
 9146: +	;;
 9147: +    prog)
 9148: +	compile_deplibs=
 9149: +	finalize_deplibs=
 9150: +	alldeplibs=false
 9151: +	newdlfiles=
 9152: +	newdlprefiles=
 9153: +	passes="conv scan dlopen dlpreopen link"
 9154: +	;;
 9155: +    *)  passes="conv"
 9156: +	;;
 9157: +    esac
 9158: +
 9159: +    for pass in $passes; do
 9160: +      # The preopen pass in lib mode reverses $deplibs; put it back here
 9161: +      # so that -L comes before libs that need it for instance...
 9162: +      if test lib,link = "$linkmode,$pass"; then
 9163: +	## FIXME: Find the place where the list is rebuilt in the wrong
 9164: +	##        order, and fix it there properly
 9165: +        tmp_deplibs=
 9166: +	for deplib in $deplibs; do
 9167: +	  tmp_deplibs="$deplib $tmp_deplibs"
 9168: +	done
 9169: +	deplibs=$tmp_deplibs
 9170: +      fi
 9171: +
 9172: +      if test lib,link = "$linkmode,$pass" ||
 9173: +	 test prog,scan = "$linkmode,$pass"; then
 9174: +	libs=$deplibs
 9175: +	deplibs=
 9176: +      fi
 9177: +      if test prog = "$linkmode"; then
 9178: +	case $pass in
 9179: +	dlopen) libs=$dlfiles ;;
 9180: +	dlpreopen) libs=$dlprefiles ;;
 9181: +	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
 9182: +	esac
 9183: +      fi
 9184: +      if test lib,dlpreopen = "$linkmode,$pass"; then
 9185: +	# Collect and forward deplibs of preopened libtool libs
 9186: +	for lib in $dlprefiles; do
 9187: +	  # Ignore non-libtool-libs
 9188: +	  dependency_libs=
 9189: +	  func_resolve_sysroot "$lib"
 9190: +	  case $lib in
 9191: +	  *.la)	func_source "$func_resolve_sysroot_result" ;;
 9192: +	  esac
 9193: +
 9194: +	  # Collect preopened libtool deplibs, except any this library
 9195: +	  # has declared as weak libs
 9196: +	  for deplib in $dependency_libs; do
 9197: +	    func_basename "$deplib"
 9198: +            deplib_base=$func_basename_result
 9199: +	    case " $weak_libs " in
 9200: +	    *" $deplib_base "*) ;;
 9201: +	    *) func_append deplibs " $deplib" ;;
 9202: +	    esac
 9203: +	  done
 9204: +	done
 9205: +	libs=$dlprefiles
 9206: +      fi
 9207: +      if test dlopen = "$pass"; then
 9208: +	# Collect dlpreopened libraries
 9209: +	save_deplibs=$deplibs
 9210: +	deplibs=
 9211: +      fi
 9212: +
 9213: +      for deplib in $libs; do
 9214: +	lib=
 9215: +	found=false
 9216: +	case $deplib in
 9217: +	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
 9218: +        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
 9219: +	  if test prog,link = "$linkmode,$pass"; then
 9220: +	    compile_deplibs="$deplib $compile_deplibs"
 9221: +	    finalize_deplibs="$deplib $finalize_deplibs"
 9222: +	  else
 9223: +	    func_append compiler_flags " $deplib"
 9224: +	    if test lib = "$linkmode"; then
 9225: +		case "$new_inherited_linker_flags " in
 9226: +		    *" $deplib "*) ;;
 9227: +		    * ) func_append new_inherited_linker_flags " $deplib" ;;
 9228: +		esac
 9229: +	    fi
 9230: +	  fi
 9231: +	  continue
 9232: +	  ;;
 9233: +	-l*)
 9234: +	  if test lib != "$linkmode" && test prog != "$linkmode"; then
 9235: +	    func_warning "'-l' is ignored for archives/objects"
 9236: +	    continue
 9237: +	  fi
 9238: +	  func_stripname '-l' '' "$deplib"
 9239: +	  name=$func_stripname_result
 9240: +	  if test lib = "$linkmode"; then
 9241: +	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
 9242: +	  else
 9243: +	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
 9244: +	  fi
 9245: +	  for searchdir in $searchdirs; do
 9246: +	    for search_ext in .la $std_shrext .so .a; do
 9247: +	      # Search the libtool library
 9248: +	      lib=$searchdir/lib$name$search_ext
 9249: +	      if test -f "$lib"; then
 9250: +		if test .la = "$search_ext"; then
 9251: +		  found=:
 9252: +		else
 9253: +		  found=false
 9254: +		fi
 9255: +		break 2
 9256: +	      fi
 9257: +	    done
 9258: +	  done
 9259: +	  if $found; then
 9260: +	    # deplib is a libtool library
 9261: +	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
 9262: +	    # We need to do some special things here, and not later.
 9263: +	    if test yes = "$allow_libtool_libs_with_static_runtimes"; then
 9264: +	      case " $predeps $postdeps " in
 9265: +	      *" $deplib "*)
 9266: +		if func_lalib_p "$lib"; then
 9267: +		  library_names=
 9268: +		  old_library=
 9269: +		  func_source "$lib"
 9270: +		  for l in $old_library $library_names; do
 9271: +		    ll=$l
 9272: +		  done
 9273: +		  if test "X$ll" = "X$old_library"; then # only static version available
 9274: +		    found=false
 9275: +		    func_dirname "$lib" "" "."
 9276: +		    ladir=$func_dirname_result
 9277: +		    lib=$ladir/$old_library
 9278: +		    if test prog,link = "$linkmode,$pass"; then
 9279: +		      compile_deplibs="$deplib $compile_deplibs"
 9280: +		      finalize_deplibs="$deplib $finalize_deplibs"
 9281: +		    else
 9282: +		      deplibs="$deplib $deplibs"
 9283: +		      test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
 9284: +		    fi
 9285: +		    continue
 9286: +		  fi
 9287: +		fi
 9288: +		;;
 9289: +	      *) ;;
 9290: +	      esac
 9291: +	    fi
 9292: +	  else
 9293: +	    # deplib doesn't seem to be a libtool library
 9294: +	    if test prog,link = "$linkmode,$pass"; then
 9295: +	      compile_deplibs="$deplib $compile_deplibs"
 9296: +	      finalize_deplibs="$deplib $finalize_deplibs"
 9297: +	    else
 9298: +	      deplibs="$deplib $deplibs"
 9299: +	      test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
 9300: +	    fi
 9301: +	    continue
 9302: +	  fi
 9303: +	  ;; # -l
 9304: +	*.ltframework)
 9305: +	  if test prog,link = "$linkmode,$pass"; then
 9306: +	    compile_deplibs="$deplib $compile_deplibs"
 9307: +	    finalize_deplibs="$deplib $finalize_deplibs"
 9308: +	  else
 9309: +	    deplibs="$deplib $deplibs"
 9310: +	    if test lib = "$linkmode"; then
 9311: +		case "$new_inherited_linker_flags " in
 9312: +		    *" $deplib "*) ;;
 9313: +		    * ) func_append new_inherited_linker_flags " $deplib" ;;
 9314: +		esac
 9315: +	    fi
 9316: +	  fi
 9317: +	  continue
 9318: +	  ;;
 9319: +	-L*)
 9320: +	  case $linkmode in
 9321: +	  lib)
 9322: +	    deplibs="$deplib $deplibs"
 9323: +	    test conv = "$pass" && continue
 9324: +	    newdependency_libs="$deplib $newdependency_libs"
 9325: +	    func_stripname '-L' '' "$deplib"
 9326: +	    func_resolve_sysroot "$func_stripname_result"
 9327: +	    func_append newlib_search_path " $func_resolve_sysroot_result"
 9328: +	    ;;
 9329: +	  prog)
 9330: +	    if test conv = "$pass"; then
 9331: +	      deplibs="$deplib $deplibs"
 9332: +	      continue
 9333: +	    fi
 9334: +	    if test scan = "$pass"; then
 9335: +	      deplibs="$deplib $deplibs"
 9336: +	    else
 9337: +	      compile_deplibs="$deplib $compile_deplibs"
 9338: +	      finalize_deplibs="$deplib $finalize_deplibs"
 9339: +	    fi
 9340: +	    func_stripname '-L' '' "$deplib"
 9341: +	    func_resolve_sysroot "$func_stripname_result"
 9342: +	    func_append newlib_search_path " $func_resolve_sysroot_result"
 9343: +	    ;;
 9344: +	  *)
 9345: +	    func_warning "'-L' is ignored for archives/objects"
 9346: +	    ;;
 9347: +	  esac # linkmode
 9348: +	  continue
 9349: +	  ;; # -L
 9350: +	-R*)
 9351: +	  if test link = "$pass"; then
 9352: +	    func_stripname '-R' '' "$deplib"
 9353: +	    func_resolve_sysroot "$func_stripname_result"
 9354: +	    dir=$func_resolve_sysroot_result
 9355: +	    # Make sure the xrpath contains only unique directories.
 9356: +	    case "$xrpath " in
 9357: +	    *" $dir "*) ;;
 9358: +	    *) func_append xrpath " $dir" ;;
 9359: +	    esac
 9360: +	  fi
 9361: +	  deplibs="$deplib $deplibs"
 9362: +	  continue
 9363: +	  ;;
 9364: +	*.la)
 9365: +	  func_resolve_sysroot "$deplib"
 9366: +	  lib=$func_resolve_sysroot_result
 9367: +	  ;;
 9368: +	*.$libext)
 9369: +	  if test conv = "$pass"; then
 9370: +	    deplibs="$deplib $deplibs"
 9371: +	    continue
 9372: +	  fi
 9373: +	  case $linkmode in
 9374: +	  lib)
 9375: +	    # Linking convenience modules into shared libraries is allowed,
 9376: +	    # but linking other static libraries is non-portable.
 9377: +	    case " $dlpreconveniencelibs " in
 9378: +	    *" $deplib "*) ;;
 9379: +	    *)
 9380: +	      valid_a_lib=false
 9381: +	      case $deplibs_check_method in
 9382: +		match_pattern*)
 9383: +		  set dummy $deplibs_check_method; shift
 9384: +		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
 9385: +		  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
 9386: +		    | $EGREP "$match_pattern_regex" > /dev/null; then
 9387: +		    valid_a_lib=:
 9388: +		  fi
 9389: +		;;
 9390: +		pass_all)
 9391: +		  valid_a_lib=:
 9392: +		;;
 9393: +	      esac
 9394: +	      if $valid_a_lib; then
 9395: +		echo
 9396: +		$ECHO "*** Warning: Linking the shared library $output against the"
 9397: +		$ECHO "*** static library $deplib is not portable!"
 9398: +		deplibs="$deplib $deplibs"
 9399: +	      else
 9400: +		echo
 9401: +		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
 9402: +		echo "*** I have the capability to make that library automatically link in when"
 9403: +		echo "*** you link to this library.  But I can only do this if you have a"
 9404: +		echo "*** shared version of the library, which you do not appear to have"
 9405: +		echo "*** because the file extensions .$libext of this argument makes me believe"
 9406: +		echo "*** that it is just a static archive that I should not use here."
 9407: +	      fi
 9408: +	      ;;
 9409: +	    esac
 9410: +	    continue
 9411: +	    ;;
 9412: +	  prog)
 9413: +	    if test link != "$pass"; then
 9414: +	      deplibs="$deplib $deplibs"
 9415: +	    else
 9416: +	      compile_deplibs="$deplib $compile_deplibs"
 9417: +	      finalize_deplibs="$deplib $finalize_deplibs"
 9418: +	    fi
 9419: +	    continue
 9420: +	    ;;
 9421: +	  esac # linkmode
 9422: +	  ;; # *.$libext
 9423: +	*.lo | *.$objext)
 9424: +	  if test conv = "$pass"; then
 9425: +	    deplibs="$deplib $deplibs"
 9426: +	  elif test prog = "$linkmode"; then
 9427: +	    if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
 9428: +	      # If there is no dlopen support or we're linking statically,
 9429: +	      # we need to preload.
 9430: +	      func_append newdlprefiles " $deplib"
 9431: +	      compile_deplibs="$deplib $compile_deplibs"
 9432: +	      finalize_deplibs="$deplib $finalize_deplibs"
 9433: +	    else
 9434: +	      func_append newdlfiles " $deplib"
 9435: +	    fi
 9436: +	  fi
 9437: +	  continue
 9438: +	  ;;
 9439: +	%DEPLIBS%)
 9440: +	  alldeplibs=:
 9441: +	  continue
 9442: +	  ;;
 9443: +	esac # case $deplib
 9444: +
 9445: +	$found || test -f "$lib" \
 9446: +	  || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
 9447: +
 9448: +	# Check to see that this really is a libtool archive.
 9449: +	func_lalib_unsafe_p "$lib" \
 9450: +	  || func_fatal_error "'$lib' is not a valid libtool archive"
 9451: +
 9452: +	func_dirname "$lib" "" "."
 9453: +	ladir=$func_dirname_result
 9454: +
 9455: +	dlname=
 9456: +	dlopen=
 9457: +	dlpreopen=
 9458: +	libdir=
 9459: +	library_names=
 9460: +	old_library=
 9461: +	inherited_linker_flags=
 9462: +	# If the library was installed with an old release of libtool,
 9463: +	# it will not redefine variables installed, or shouldnotlink
 9464: +	installed=yes
 9465: +	shouldnotlink=no
 9466: +	avoidtemprpath=
 9467: +
 9468: +
 9469: +	# Read the .la file
 9470: +	func_source "$lib"
 9471: +
 9472: +	# Convert "-framework foo" to "foo.ltframework"
 9473: +	if test -n "$inherited_linker_flags"; then
 9474: +	  tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
 9475: +	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
 9476: +	    case " $new_inherited_linker_flags " in
 9477: +	      *" $tmp_inherited_linker_flag "*) ;;
 9478: +	      *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
 9479: +	    esac
 9480: +	  done
 9481: +	fi
 9482: +	dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 9483: +	if test lib,link = "$linkmode,$pass" ||
 9484: +	   test prog,scan = "$linkmode,$pass" ||
 9485: +	   { test prog != "$linkmode" && test lib != "$linkmode"; }; then
 9486: +	  test -n "$dlopen" && func_append dlfiles " $dlopen"
 9487: +	  test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
 9488: +	fi
 9489: +
 9490: +	if test conv = "$pass"; then
 9491: +	  # Only check for convenience libraries
 9492: +	  deplibs="$lib $deplibs"
 9493: +	  if test -z "$libdir"; then
 9494: +	    if test -z "$old_library"; then
 9495: +	      func_fatal_error "cannot find name of link library for '$lib'"
 9496: +	    fi
 9497: +	    # It is a libtool convenience library, so add in its objects.
 9498: +	    func_append convenience " $ladir/$objdir/$old_library"
 9499: +	    func_append old_convenience " $ladir/$objdir/$old_library"
 9500: +	  elif test prog != "$linkmode" && test lib != "$linkmode"; then
 9501: +	    func_fatal_error "'$lib' is not a convenience library"
 9502: +	  fi
 9503: +	  tmp_libs=
 9504: +	  for deplib in $dependency_libs; do
 9505: +	    deplibs="$deplib $deplibs"
 9506: +	    if $opt_preserve_dup_deps; then
 9507: +	      case "$tmp_libs " in
 9508: +	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
 9509: +	      esac
 9510: +	    fi
 9511: +	    func_append tmp_libs " $deplib"
 9512: +	  done
 9513: +	  continue
 9514: +	fi # $pass = conv
 9515: +
 9516: +
 9517: +	# Get the name of the library we link against.
 9518: +	linklib=
 9519: +	if test -n "$old_library" &&
 9520: +	   { test yes = "$prefer_static_libs" ||
 9521: +	     test built,no = "$prefer_static_libs,$installed"; }; then
 9522: +	  linklib=$old_library
 9523: +	else
 9524: +	  for l in $old_library $library_names; do
 9525: +	    linklib=$l
 9526: +	  done
 9527: +	fi
 9528: +	if test -z "$linklib"; then
 9529: +	  func_fatal_error "cannot find name of link library for '$lib'"
 9530: +	fi
 9531: +
 9532: +	# This library was specified with -dlopen.
 9533: +	if test dlopen = "$pass"; then
 9534: +	  test -z "$libdir" \
 9535: +	    && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
 9536: +	  if test -z "$dlname" ||
 9537: +	     test yes != "$dlopen_support" ||
 9538: +	     test no = "$build_libtool_libs"
 9539: +	  then
 9540: +	    # If there is no dlname, no dlopen support or we're linking
 9541: +	    # statically, we need to preload.  We also need to preload any
 9542: +	    # dependent libraries so libltdl's deplib preloader doesn't
 9543: +	    # bomb out in the load deplibs phase.
 9544: +	    func_append dlprefiles " $lib $dependency_libs"
 9545: +	  else
 9546: +	    func_append newdlfiles " $lib"
 9547: +	  fi
 9548: +	  continue
 9549: +	fi # $pass = dlopen
 9550: +
 9551: +	# We need an absolute path.
 9552: +	case $ladir in
 9553: +	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
 9554: +	*)
 9555: +	  abs_ladir=`cd "$ladir" && pwd`
 9556: +	  if test -z "$abs_ladir"; then
 9557: +	    func_warning "cannot determine absolute directory name of '$ladir'"
 9558: +	    func_warning "passing it literally to the linker, although it might fail"
 9559: +	    abs_ladir=$ladir
 9560: +	  fi
 9561: +	  ;;
 9562: +	esac
 9563: +	func_basename "$lib"
 9564: +	laname=$func_basename_result
 9565: +
 9566: +	# Find the relevant object directory and library name.
 9567: +	if test yes = "$installed"; then
 9568: +	  if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 9569: +	    func_warning "library '$lib' was moved."
 9570: +	    dir=$ladir
 9571: +	    absdir=$abs_ladir
 9572: +	    libdir=$abs_ladir
 9573: +	  else
 9574: +	    dir=$lt_sysroot$libdir
 9575: +	    absdir=$lt_sysroot$libdir
 9576: +	  fi
 9577: +	  test yes = "$hardcode_automatic" && avoidtemprpath=yes
 9578: +	else
 9579: +	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 9580: +	    dir=$ladir
 9581: +	    absdir=$abs_ladir
 9582: +	    # Remove this search path later
 9583: +	    func_append notinst_path " $abs_ladir"
 9584: +	  else
 9585: +	    dir=$ladir/$objdir
 9586: +	    absdir=$abs_ladir/$objdir
 9587: +	    # Remove this search path later
 9588: +	    func_append notinst_path " $abs_ladir"
 9589: +	  fi
 9590: +	fi # $installed = yes
 9591: +	func_stripname 'lib' '.la' "$laname"
 9592: +	name=$func_stripname_result
 9593: +
 9594: +	# This library was specified with -dlpreopen.
 9595: +	if test dlpreopen = "$pass"; then
 9596: +	  if test -z "$libdir" && test prog = "$linkmode"; then
 9597: +	    func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
 9598: +	  fi
 9599: +	  case $host in
 9600: +	    # special handling for platforms with PE-DLLs.
 9601: +	    *cygwin* | *mingw* | *cegcc* )
 9602: +	      # Linker will automatically link against shared library if both
 9603: +	      # static and shared are present.  Therefore, ensure we extract
 9604: +	      # symbols from the import library if a shared library is present
 9605: +	      # (otherwise, the dlopen module name will be incorrect).  We do
 9606: +	      # this by putting the import library name into $newdlprefiles.
 9607: +	      # We recover the dlopen module name by 'saving' the la file
 9608: +	      # name in a special purpose variable, and (later) extracting the
 9609: +	      # dlname from the la file.
 9610: +	      if test -n "$dlname"; then
 9611: +	        func_tr_sh "$dir/$linklib"
 9612: +	        eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
 9613: +	        func_append newdlprefiles " $dir/$linklib"
 9614: +	      else
 9615: +	        func_append newdlprefiles " $dir/$old_library"
 9616: +	        # Keep a list of preopened convenience libraries to check
 9617: +	        # that they are being used correctly in the link pass.
 9618: +	        test -z "$libdir" && \
 9619: +	          func_append dlpreconveniencelibs " $dir/$old_library"
 9620: +	      fi
 9621: +	    ;;
 9622: +	    * )
 9623: +	      # Prefer using a static library (so that no silly _DYNAMIC symbols
 9624: +	      # are required to link).
 9625: +	      if test -n "$old_library"; then
 9626: +	        func_append newdlprefiles " $dir/$old_library"
 9627: +	        # Keep a list of preopened convenience libraries to check
 9628: +	        # that they are being used correctly in the link pass.
 9629: +	        test -z "$libdir" && \
 9630: +	          func_append dlpreconveniencelibs " $dir/$old_library"
 9631: +	      # Otherwise, use the dlname, so that lt_dlopen finds it.
 9632: +	      elif test -n "$dlname"; then
 9633: +	        func_append newdlprefiles " $dir/$dlname"
 9634: +	      else
 9635: +	        func_append newdlprefiles " $dir/$linklib"
 9636: +	      fi
 9637: +	    ;;
 9638: +	  esac
 9639: +	fi # $pass = dlpreopen
 9640: +
 9641: +	if test -z "$libdir"; then
 9642: +	  # Link the convenience library
 9643: +	  if test lib = "$linkmode"; then
 9644: +	    deplibs="$dir/$old_library $deplibs"
 9645: +	  elif test prog,link = "$linkmode,$pass"; then
 9646: +	    compile_deplibs="$dir/$old_library $compile_deplibs"
 9647: +	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
 9648: +	  else
 9649: +	    deplibs="$lib $deplibs" # used for prog,scan pass
 9650: +	  fi
 9651: +	  continue
 9652: +	fi
 9653: +
 9654: +
 9655: +	if test prog = "$linkmode" && test link != "$pass"; then
 9656: +	  func_append newlib_search_path " $ladir"
 9657: +	  deplibs="$lib $deplibs"
 9658: +
 9659: +	  linkalldeplibs=false
 9660: +	  if test no != "$link_all_deplibs" || test -z "$library_names" ||
 9661: +	     test no = "$build_libtool_libs"; then
 9662: +	    linkalldeplibs=:
 9663: +	  fi
 9664: +
 9665: +	  tmp_libs=
 9666: +	  for deplib in $dependency_libs; do
 9667: +	    case $deplib in
 9668: +	    -L*) func_stripname '-L' '' "$deplib"
 9669: +	         func_resolve_sysroot "$func_stripname_result"
 9670: +	         func_append newlib_search_path " $func_resolve_sysroot_result"
 9671: +		 ;;
 9672: +	    esac
 9673: +	    # Need to link against all dependency_libs?
 9674: +	    if $linkalldeplibs; then
 9675: +	      deplibs="$deplib $deplibs"
 9676: +	    else
 9677: +	      # Need to hardcode shared library paths
 9678: +	      # or/and link against static libraries
 9679: +	      newdependency_libs="$deplib $newdependency_libs"
 9680: +	    fi
 9681: +	    if $opt_preserve_dup_deps; then
 9682: +	      case "$tmp_libs " in
 9683: +	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
 9684: +	      esac
 9685: +	    fi
 9686: +	    func_append tmp_libs " $deplib"
 9687: +	  done # for deplib
 9688: +	  continue
 9689: +	fi # $linkmode = prog...
 9690: +
 9691: +	if test prog,link = "$linkmode,$pass"; then
 9692: +	  if test -n "$library_names" &&
 9693: +	     { { test no = "$prefer_static_libs" ||
 9694: +	         test built,yes = "$prefer_static_libs,$installed"; } ||
 9695: +	       test -z "$old_library"; }; then
 9696: +	    # We need to hardcode the library path
 9697: +	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
 9698: +	      # Make sure the rpath contains only unique directories.
 9699: +	      case $temp_rpath: in
 9700: +	      *"$absdir:"*) ;;
 9701: +	      *) func_append temp_rpath "$absdir:" ;;
 9702: +	      esac
 9703: +	    fi
 9704: +
 9705: +	    # Hardcode the library path.
 9706: +	    # Skip directories that are in the system default run-time
 9707: +	    # search path.
 9708: +	    case " $sys_lib_dlsearch_path " in
 9709: +	    *" $absdir "*) ;;
 9710: +	    *)
 9711: +	      case "$compile_rpath " in
 9712: +	      *" $absdir "*) ;;
 9713: +	      *) func_append compile_rpath " $absdir" ;;
 9714: +	      esac
 9715: +	      ;;
 9716: +	    esac
 9717: +	    case " $sys_lib_dlsearch_path " in
 9718: +	    *" $libdir "*) ;;
 9719: +	    *)
 9720: +	      case "$finalize_rpath " in
 9721: +	      *" $libdir "*) ;;
 9722: +	      *) func_append finalize_rpath " $libdir" ;;
 9723: +	      esac
 9724: +	      ;;
 9725: +	    esac
 9726: +	  fi # $linkmode,$pass = prog,link...
 9727: +
 9728: +	  if $alldeplibs &&
 9729: +	     { test pass_all = "$deplibs_check_method" ||
 9730: +	       { test yes = "$build_libtool_libs" &&
 9731: +		 test -n "$library_names"; }; }; then
 9732: +	    # We only need to search for static libraries
 9733: +	    continue
 9734: +	  fi
 9735: +	fi
 9736: +
 9737: +	link_static=no # Whether the deplib will be linked statically
 9738: +	use_static_libs=$prefer_static_libs
 9739: +	if test built = "$use_static_libs" && test yes = "$installed"; then
 9740: +	  use_static_libs=no
 9741: +	fi
 9742: +	if test -n "$library_names" &&
 9743: +	   { test no = "$use_static_libs" || test -z "$old_library"; }; then
 9744: +	  case $host in
 9745: +	  *cygwin* | *mingw* | *cegcc* | *os2*)
 9746: +	      # No point in relinking DLLs because paths are not encoded
 9747: +	      func_append notinst_deplibs " $lib"
 9748: +	      need_relink=no
 9749: +	    ;;
 9750: +	  *)
 9751: +	    if test no = "$installed"; then
 9752: +	      func_append notinst_deplibs " $lib"
 9753: +	      need_relink=yes
 9754: +	    fi
 9755: +	    ;;
 9756: +	  esac
 9757: +	  # This is a shared library
 9758: +
 9759: +	  # Warn about portability, can't link against -module's on some
 9760: +	  # systems (darwin).  Don't bleat about dlopened modules though!
 9761: +	  dlopenmodule=
 9762: +	  for dlpremoduletest in $dlprefiles; do
 9763: +	    if test "X$dlpremoduletest" = "X$lib"; then
 9764: +	      dlopenmodule=$dlpremoduletest
 9765: +	      break
 9766: +	    fi
 9767: +	  done
 9768: +	  if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
 9769: +	    echo
 9770: +	    if test prog = "$linkmode"; then
 9771: +	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
 9772: +	    else
 9773: +	      $ECHO "*** Warning: Linking the shared library $output against the loadable module"
 9774: +	    fi
 9775: +	    $ECHO "*** $linklib is not portable!"
 9776: +	  fi
 9777: +	  if test lib = "$linkmode" &&
 9778: +	     test yes = "$hardcode_into_libs"; then
 9779: +	    # Hardcode the library path.
 9780: +	    # Skip directories that are in the system default run-time
 9781: +	    # search path.
 9782: +	    case " $sys_lib_dlsearch_path " in
 9783: +	    *" $absdir "*) ;;
 9784: +	    *)
 9785: +	      case "$compile_rpath " in
 9786: +	      *" $absdir "*) ;;
 9787: +	      *) func_append compile_rpath " $absdir" ;;
 9788: +	      esac
 9789: +	      ;;
 9790: +	    esac
 9791: +	    case " $sys_lib_dlsearch_path " in
 9792: +	    *" $libdir "*) ;;
 9793: +	    *)
 9794: +	      case "$finalize_rpath " in
 9795: +	      *" $libdir "*) ;;
 9796: +	      *) func_append finalize_rpath " $libdir" ;;
 9797: +	      esac
 9798: +	      ;;
 9799: +	    esac
 9800: +	  fi
 9801: +
 9802: +	  if test -n "$old_archive_from_expsyms_cmds"; then
 9803: +	    # figure out the soname
 9804: +	    set dummy $library_names
 9805: +	    shift
 9806: +	    realname=$1
 9807: +	    shift
 9808: +	    libname=`eval "\\$ECHO \"$libname_spec\""`
 9809: +	    # use dlname if we got it. it's perfectly good, no?
 9810: +	    if test -n "$dlname"; then
 9811: +	      soname=$dlname
 9812: +	    elif test -n "$soname_spec"; then
 9813: +	      # bleh windows
 9814: +	      case $host in
 9815: +	      *cygwin* | mingw* | *cegcc* | *os2*)
 9816: +	        func_arith $current - $age
 9817: +		major=$func_arith_result
 9818: +		versuffix=-$major
 9819: +		;;
 9820: +	      esac
 9821: +	      eval soname=\"$soname_spec\"
 9822: +	    else
 9823: +	      soname=$realname
 9824: +	    fi
 9825: +
 9826: +	    # Make a new name for the extract_expsyms_cmds to use
 9827: +	    soroot=$soname
 9828: +	    func_basename "$soroot"
 9829: +	    soname=$func_basename_result
 9830: +	    func_stripname 'lib' '.dll' "$soname"
 9831: +	    newlib=libimp-$func_stripname_result.a
 9832: +
 9833: +	    # If the library has no export list, then create one now
 9834: +	    if test -f "$output_objdir/$soname-def"; then :
 9835: +	    else
 9836: +	      func_verbose "extracting exported symbol list from '$soname'"
 9837: +	      func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
 9838: +	    fi
 9839: +
 9840: +	    # Create $newlib
 9841: +	    if test -f "$output_objdir/$newlib"; then :; else
 9842: +	      func_verbose "generating import library for '$soname'"
 9843: +	      func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
 9844: +	    fi
 9845: +	    # make sure the library variables are pointing to the new library
 9846: +	    dir=$output_objdir
 9847: +	    linklib=$newlib
 9848: +	  fi # test -n "$old_archive_from_expsyms_cmds"
 9849: +
 9850: +	  if test prog = "$linkmode" || test relink != "$opt_mode"; then
 9851: +	    add_shlibpath=
 9852: +	    add_dir=
 9853: +	    add=
 9854: +	    lib_linked=yes
 9855: +	    case $hardcode_action in
 9856: +	    immediate | unsupported)
 9857: +	      if test no = "$hardcode_direct"; then
 9858: +		add=$dir/$linklib
 9859: +		case $host in
 9860: +		  *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
 9861: +		  *-*-sysv4*uw2*) add_dir=-L$dir ;;
 9862: +		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
 9863: +		    *-*-unixware7*) add_dir=-L$dir ;;
 9864: +		  *-*-darwin* )
 9865: +		    # if the lib is a (non-dlopened) module then we cannot
 9866: +		    # link against it, someone is ignoring the earlier warnings
 9867: +		    if /usr/bin/file -L $add 2> /dev/null |
 9868: +			 $GREP ": [^:]* bundle" >/dev/null; then
 9869: +		      if test "X$dlopenmodule" != "X$lib"; then
 9870: +			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
 9871: +			if test -z "$old_library"; then
 9872: +			  echo
 9873: +			  echo "*** And there doesn't seem to be a static archive available"
 9874: +			  echo "*** The link will probably fail, sorry"
 9875: +			else
 9876: +			  add=$dir/$old_library
 9877: +			fi
 9878: +		      elif test -n "$old_library"; then
 9879: +			add=$dir/$old_library
 9880: +		      fi
 9881: +		    fi
 9882: +		esac
 9883: +	      elif test no = "$hardcode_minus_L"; then
 9884: +		case $host in
 9885: +		*-*-sunos*) add_shlibpath=$dir ;;
 9886: +		esac
 9887: +		add_dir=-L$dir
 9888: +		add=-l$name
 9889: +	      elif test no = "$hardcode_shlibpath_var"; then
 9890: +		add_shlibpath=$dir
 9891: +		add=-l$name
 9892: +	      else
 9893: +		lib_linked=no
 9894: +	      fi
 9895: +	      ;;
 9896: +	    relink)
 9897: +	      if test yes = "$hardcode_direct" &&
 9898: +	         test no = "$hardcode_direct_absolute"; then
 9899: +		add=$dir/$linklib
 9900: +	      elif test yes = "$hardcode_minus_L"; then
 9901: +		add_dir=-L$absdir
 9902: +		# Try looking first in the location we're being installed to.
 9903: +		if test -n "$inst_prefix_dir"; then
 9904: +		  case $libdir in
 9905: +		    [\\/]*)
 9906: +		      func_append add_dir " -L$inst_prefix_dir$libdir"
 9907: +		      ;;
 9908: +		  esac
 9909: +		fi
 9910: +		add=-l$name
 9911: +	      elif test yes = "$hardcode_shlibpath_var"; then
 9912: +		add_shlibpath=$dir
 9913: +		add=-l$name
 9914: +	      else
 9915: +		lib_linked=no
 9916: +	      fi
 9917: +	      ;;
 9918: +	    *) lib_linked=no ;;
 9919: +	    esac
 9920: +
 9921: +	    if test yes != "$lib_linked"; then
 9922: +	      func_fatal_configuration "unsupported hardcode properties"
 9923: +	    fi
 9924: +
 9925: +	    if test -n "$add_shlibpath"; then
 9926: +	      case :$compile_shlibpath: in
 9927: +	      *":$add_shlibpath:"*) ;;
 9928: +	      *) func_append compile_shlibpath "$add_shlibpath:" ;;
 9929: +	      esac
 9930: +	    fi
 9931: +	    if test prog = "$linkmode"; then
 9932: +	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
 9933: +	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
 9934: +	    else
 9935: +	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
 9936: +	      test -n "$add" && deplibs="$add $deplibs"
 9937: +	      if test yes != "$hardcode_direct" &&
 9938: +		 test yes != "$hardcode_minus_L" &&
 9939: +		 test yes = "$hardcode_shlibpath_var"; then
 9940: +		case :$finalize_shlibpath: in
 9941: +		*":$libdir:"*) ;;
 9942: +		*) func_append finalize_shlibpath "$libdir:" ;;
 9943: +		esac
 9944: +	      fi
 9945: +	    fi
 9946: +	  fi
 9947: +
 9948: +	  if test prog = "$linkmode" || test relink = "$opt_mode"; then
 9949: +	    add_shlibpath=
 9950: +	    add_dir=
 9951: +	    add=
 9952: +	    # Finalize command for both is simple: just hardcode it.
 9953: +	    if test yes = "$hardcode_direct" &&
 9954: +	       test no = "$hardcode_direct_absolute"; then
 9955: +	      add=$libdir/$linklib
 9956: +	    elif test yes = "$hardcode_minus_L"; then
 9957: +	      add_dir=-L$libdir
 9958: +	      add=-l$name
 9959: +	    elif test yes = "$hardcode_shlibpath_var"; then
 9960: +	      case :$finalize_shlibpath: in
 9961: +	      *":$libdir:"*) ;;
 9962: +	      *) func_append finalize_shlibpath "$libdir:" ;;
 9963: +	      esac
 9964: +	      add=-l$name
 9965: +	    elif test yes = "$hardcode_automatic"; then
 9966: +	      if test -n "$inst_prefix_dir" &&
 9967: +		 test -f "$inst_prefix_dir$libdir/$linklib"; then
 9968: +		add=$inst_prefix_dir$libdir/$linklib
 9969: +	      else
 9970: +		add=$libdir/$linklib
 9971: +	      fi
 9972: +	    else
 9973: +	      # We cannot seem to hardcode it, guess we'll fake it.
 9974: +	      add_dir=-L$libdir
 9975: +	      # Try looking first in the location we're being installed to.
 9976: +	      if test -n "$inst_prefix_dir"; then
 9977: +		case $libdir in
 9978: +		  [\\/]*)
 9979: +		    func_append add_dir " -L$inst_prefix_dir$libdir"
 9980: +		    ;;
 9981: +		esac
 9982: +	      fi
 9983: +	      add=-l$name
 9984: +	    fi
 9985: +
 9986: +	    if test prog = "$linkmode"; then
 9987: +	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
 9988: +	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
 9989: +	    else
 9990: +	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
 9991: +	      test -n "$add" && deplibs="$add $deplibs"
 9992: +	    fi
 9993: +	  fi
 9994: +	elif test prog = "$linkmode"; then
 9995: +	  # Here we assume that one of hardcode_direct or hardcode_minus_L
 9996: +	  # is not unsupported.  This is valid on all known static and
 9997: +	  # shared platforms.
 9998: +	  if test unsupported != "$hardcode_direct"; then
 9999: +	    test -n "$old_library" && linklib=$old_library
10000: +	    compile_deplibs="$dir/$linklib $compile_deplibs"
10001: +	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
10002: +	  else
10003: +	    compile_deplibs="-l$name -L$dir $compile_deplibs"
10004: +	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
10005: +	  fi
10006: +	elif test yes = "$build_libtool_libs"; then
10007: +	  # Not a shared library
10008: +	  if test pass_all != "$deplibs_check_method"; then
10009: +	    # We're trying link a shared library against a static one
10010: +	    # but the system doesn't support it.
10011: +
10012: +	    # Just print a warning and add the library to dependency_libs so
10013: +	    # that the program can be linked against the static library.
10014: +	    echo
10015: +	    $ECHO "*** Warning: This system cannot link to static lib archive $lib."
10016: +	    echo "*** I have the capability to make that library automatically link in when"
10017: +	    echo "*** you link to this library.  But I can only do this if you have a"
10018: +	    echo "*** shared version of the library, which you do not appear to have."
10019: +	    if test yes = "$module"; then
10020: +	      echo "*** But as you try to build a module library, libtool will still create "
10021: +	      echo "*** a static module, that should work as long as the dlopening application"
10022: +	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
10023: +	      if test -z "$global_symbol_pipe"; then
10024: +		echo
10025: +		echo "*** However, this would only work if libtool was able to extract symbol"
10026: +		echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
10027: +		echo "*** not find such a program.  So, this module is probably useless."
10028: +		echo "*** 'nm' from GNU binutils and a full rebuild may help."
10029: +	      fi
10030: +	      if test no = "$build_old_libs"; then
10031: +		build_libtool_libs=module
10032: +		build_old_libs=yes
10033: +	      else
10034: +		build_libtool_libs=no
10035: +	      fi
10036: +	    fi
10037: +	  else
10038: +	    deplibs="$dir/$old_library $deplibs"
10039: +	    link_static=yes
10040: +	  fi
10041: +	fi # link shared/static library?
10042: +
10043: +	if test lib = "$linkmode"; then
10044: +	  if test -n "$dependency_libs" &&
10045: +	     { test yes != "$hardcode_into_libs" ||
10046: +	       test yes = "$build_old_libs" ||
10047: +	       test yes = "$link_static"; }; then
10048: +	    # Extract -R from dependency_libs
10049: +	    temp_deplibs=
10050: +	    for libdir in $dependency_libs; do
10051: +	      case $libdir in
10052: +	      -R*) func_stripname '-R' '' "$libdir"
10053: +	           temp_xrpath=$func_stripname_result
10054: +		   case " $xrpath " in
10055: +		   *" $temp_xrpath "*) ;;
10056: +		   *) func_append xrpath " $temp_xrpath";;
10057: +		   esac;;
10058: +	      *) func_append temp_deplibs " $libdir";;
10059: +	      esac
10060: +	    done
10061: +	    dependency_libs=$temp_deplibs
10062: +	  fi
10063: +
10064: +	  func_append newlib_search_path " $absdir"
10065: +	  # Link against this library
10066: +	  test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
10067: +	  # ... and its dependency_libs
10068: +	  tmp_libs=
10069: +	  for deplib in $dependency_libs; do
10070: +	    newdependency_libs="$deplib $newdependency_libs"
10071: +	    case $deplib in
10072: +              -L*) func_stripname '-L' '' "$deplib"
10073: +                   func_resolve_sysroot "$func_stripname_result";;
10074: +              *) func_resolve_sysroot "$deplib" ;;
10075: +            esac
10076: +	    if $opt_preserve_dup_deps; then
10077: +	      case "$tmp_libs " in
10078: +	      *" $func_resolve_sysroot_result "*)
10079: +                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
10080: +	      esac
10081: +	    fi
10082: +	    func_append tmp_libs " $func_resolve_sysroot_result"
10083: +	  done
10084: +
10085: +	  if test no != "$link_all_deplibs"; then
10086: +	    # Add the search paths of all dependency libraries
10087: +	    for deplib in $dependency_libs; do
10088: +	      path=
10089: +	      case $deplib in
10090: +	      -L*) path=$deplib ;;
10091: +	      *.la)
10092: +	        func_resolve_sysroot "$deplib"
10093: +	        deplib=$func_resolve_sysroot_result
10094: +	        func_dirname "$deplib" "" "."
10095: +		dir=$func_dirname_result
10096: +		# We need an absolute path.
10097: +		case $dir in
10098: +		[\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
10099: +		*)
10100: +		  absdir=`cd "$dir" && pwd`
10101: +		  if test -z "$absdir"; then
10102: +		    func_warning "cannot determine absolute directory name of '$dir'"
10103: +		    absdir=$dir
10104: +		  fi
10105: +		  ;;
10106: +		esac
10107: +		if $GREP "^installed=no" $deplib > /dev/null; then
10108: +		case $host in
10109: +		*-*-darwin*)
10110: +		  depdepl=
10111: +		  eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
10112: +		  if test -n "$deplibrary_names"; then
10113: +		    for tmp in $deplibrary_names; do
10114: +		      depdepl=$tmp
10115: +		    done
10116: +		    if test -f "$absdir/$objdir/$depdepl"; then
10117: +		      depdepl=$absdir/$objdir/$depdepl
10118: +		      darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
10119: +                      if test -z "$darwin_install_name"; then
10120: +                          darwin_install_name=`$OTOOL64 -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
10121: +                      fi
10122: +		      func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
10123: +		      func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
10124: +		      path=
10125: +		    fi
10126: +		  fi
10127: +		  ;;
10128: +		*)
10129: +		  path=-L$absdir/$objdir
10130: +		  ;;
10131: +		esac
10132: +		else
10133: +		  eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
10134: +		  test -z "$libdir" && \
10135: +		    func_fatal_error "'$deplib' is not a valid libtool archive"
10136: +		  test "$absdir" != "$libdir" && \
10137: +		    func_warning "'$deplib' seems to be moved"
10138: +
10139: +		  path=-L$absdir
10140: +		fi
10141: +		;;
10142: +	      esac
10143: +	      case " $deplibs " in
10144: +	      *" $path "*) ;;
10145: +	      *) deplibs="$path $deplibs" ;;
10146: +	      esac
10147: +	    done
10148: +	  fi # link_all_deplibs != no
10149: +	fi # linkmode = lib
10150: +      done # for deplib in $libs
10151: +      if test link = "$pass"; then
10152: +	if test prog = "$linkmode"; then
10153: +	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
10154: +	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
10155: +	else
10156: +	  compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10157: +	fi
10158: +      fi
10159: +      dependency_libs=$newdependency_libs
10160: +      if test dlpreopen = "$pass"; then
10161: +	# Link the dlpreopened libraries before other libraries
10162: +	for deplib in $save_deplibs; do
10163: +	  deplibs="$deplib $deplibs"
10164: +	done
10165: +      fi
10166: +      if test dlopen != "$pass"; then
10167: +	test conv = "$pass" || {
10168: +	  # Make sure lib_search_path contains only unique directories.
10169: +	  lib_search_path=
10170: +	  for dir in $newlib_search_path; do
10171: +	    case "$lib_search_path " in
10172: +	    *" $dir "*) ;;
10173: +	    *) func_append lib_search_path " $dir" ;;
10174: +	    esac
10175: +	  done
10176: +	  newlib_search_path=
10177: +	}
10178: +
10179: +	if test prog,link = "$linkmode,$pass"; then
10180: +	  vars="compile_deplibs finalize_deplibs"
10181: +	else
10182: +	  vars=deplibs
10183: +	fi
10184: +	for var in $vars dependency_libs; do
10185: +	  # Add libraries to $var in reverse order
10186: +	  eval tmp_libs=\"\$$var\"
10187: +	  new_libs=
10188: +	  for deplib in $tmp_libs; do
10189: +	    # FIXME: Pedantically, this is the right thing to do, so
10190: +	    #        that some nasty dependency loop isn't accidentally
10191: +	    #        broken:
10192: +	    #new_libs="$deplib $new_libs"
10193: +	    # Pragmatically, this seems to cause very few problems in
10194: +	    # practice:
10195: +	    case $deplib in
10196: +	    -L*) new_libs="$deplib $new_libs" ;;
10197: +	    -R*) ;;
10198: +	    *)
10199: +	      # And here is the reason: when a library appears more
10200: +	      # than once as an explicit dependence of a library, or
10201: +	      # is implicitly linked in more than once by the
10202: +	      # compiler, it is considered special, and multiple
10203: +	      # occurrences thereof are not removed.  Compare this
10204: +	      # with having the same library being listed as a
10205: +	      # dependency of multiple other libraries: in this case,
10206: +	      # we know (pedantically, we assume) the library does not
10207: +	      # need to be listed more than once, so we keep only the
10208: +	      # last copy.  This is not always right, but it is rare
10209: +	      # enough that we require users that really mean to play
10210: +	      # such unportable linking tricks to link the library
10211: +	      # using -Wl,-lname, so that libtool does not consider it
10212: +	      # for duplicate removal.
10213: +	      case " $specialdeplibs " in
10214: +	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
10215: +	      *)
10216: +		case " $new_libs " in
10217: +		*" $deplib "*) ;;
10218: +		*) new_libs="$deplib $new_libs" ;;
10219: +		esac
10220: +		;;
10221: +	      esac
10222: +	      ;;
10223: +	    esac
10224: +	  done
10225: +	  tmp_libs=
10226: +	  for deplib in $new_libs; do
10227: +	    case $deplib in
10228: +	    -L*)
10229: +	      case " $tmp_libs " in
10230: +	      *" $deplib "*) ;;
10231: +	      *) func_append tmp_libs " $deplib" ;;
10232: +	      esac
10233: +	      ;;
10234: +	    *) func_append tmp_libs " $deplib" ;;
10235: +	    esac
10236: +	  done
10237: +	  eval $var=\"$tmp_libs\"
10238: +	done # for var
10239: +      fi
10240: +
10241: +      # Add Sun CC postdeps if required:
10242: +      test CXX = "$tagname" && {
10243: +        case $host_os in
10244: +        linux*)
10245: +          case `$CC -V 2>&1 | sed 5q` in
10246: +          *Sun\ C*) # Sun C++ 5.9
10247: +            func_suncc_cstd_abi
10248: +
10249: +            if test no != "$suncc_use_cstd_abi"; then
10250: +              func_append postdeps ' -library=Cstd -library=Crun'
10251: +            fi
10252: +            ;;
10253: +          esac
10254: +          ;;
10255: +
10256: +        solaris*)
10257: +          func_cc_basename "$CC"
10258: +          case $func_cc_basename_result in
10259: +          CC* | sunCC*)
10260: +            func_suncc_cstd_abi
10261: +
10262: +            if test no != "$suncc_use_cstd_abi"; then
10263: +              func_append postdeps ' -library=Cstd -library=Crun'
10264: +            fi
10265: +            ;;
10266: +          esac
10267: +          ;;
10268: +        esac
10269: +      }
10270: +
10271: +      # Last step: remove runtime libs from dependency_libs
10272: +      # (they stay in deplibs)
10273: +      tmp_libs=
10274: +      for i in $dependency_libs; do
10275: +	case " $predeps $postdeps $compiler_lib_search_path " in
10276: +	*" $i "*)
10277: +	  i=
10278: +	  ;;
10279: +	esac
10280: +	if test -n "$i"; then
10281: +	  func_append tmp_libs " $i"
10282: +	fi
10283: +      done
10284: +      dependency_libs=$tmp_libs
10285: +    done # for pass
10286: +    if test prog = "$linkmode"; then
10287: +      dlfiles=$newdlfiles
10288: +    fi
10289: +    if test prog = "$linkmode" || test lib = "$linkmode"; then
10290: +      dlprefiles=$newdlprefiles
10291: +    fi
10292: +
10293: +    case $linkmode in
10294: +    oldlib)
10295: +      if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
10296: +	func_warning "'-dlopen' is ignored for archives"
10297: +      fi
10298: +
10299: +      case " $deplibs" in
10300: +      *\ -l* | *\ -L*)
10301: +	func_warning "'-l' and '-L' are ignored for archives" ;;
10302: +      esac
10303: +
10304: +      test -n "$rpath" && \
10305: +	func_warning "'-rpath' is ignored for archives"
10306: +
10307: +      test -n "$xrpath" && \
10308: +	func_warning "'-R' is ignored for archives"
10309: +
10310: +      test -n "$vinfo" && \
10311: +	func_warning "'-version-info/-version-number' is ignored for archives"
10312: +
10313: +      test -n "$release" && \
10314: +	func_warning "'-release' is ignored for archives"
10315: +
10316: +      test -n "$export_symbols$export_symbols_regex" && \
10317: +	func_warning "'-export-symbols' is ignored for archives"
10318: +
10319: +      # Now set the variables for building old libraries.
10320: +      build_libtool_libs=no
10321: +      oldlibs=$output
10322: +      func_append objs "$old_deplibs"
10323: +      ;;
10324: +
10325: +    lib)
10326: +      # Make sure we only generate libraries of the form 'libNAME.la'.
10327: +      case $outputname in
10328: +      lib*)
10329: +	func_stripname 'lib' '.la' "$outputname"
10330: +	name=$func_stripname_result
10331: +	eval shared_ext=\"$shrext_cmds\"
10332: +	eval libname=\"$libname_spec\"
10333: +	;;
10334: +      *)
10335: +	test no = "$module" \
10336: +	  && func_fatal_help "libtool library '$output' must begin with 'lib'"
10337: +
10338: +	if test no != "$need_lib_prefix"; then
10339: +	  # Add the "lib" prefix for modules if required
10340: +	  func_stripname '' '.la' "$outputname"
10341: +	  name=$func_stripname_result
10342: +	  eval shared_ext=\"$shrext_cmds\"
10343: +	  eval libname=\"$libname_spec\"
10344: +	else
10345: +	  func_stripname '' '.la' "$outputname"
10346: +	  libname=$func_stripname_result
10347: +	fi
10348: +	;;
10349: +      esac
10350: +
10351: +      if test -n "$objs"; then
10352: +	if test pass_all != "$deplibs_check_method"; then
10353: +	  func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
10354: +	else
10355: +	  echo
10356: +	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
10357: +	  $ECHO "*** objects $objs is not portable!"
10358: +	  func_append libobjs " $objs"
10359: +	fi
10360: +      fi
10361: +
10362: +      test no = "$dlself" \
10363: +	|| func_warning "'-dlopen self' is ignored for libtool libraries"
10364: +
10365: +      set dummy $rpath
10366: +      shift
10367: +      test 1 -lt "$#" \
10368: +	&& func_warning "ignoring multiple '-rpath's for a libtool library"
10369: +
10370: +      install_libdir=$1
10371: +
10372: +      oldlibs=
10373: +      if test -z "$rpath"; then
10374: +	if test yes = "$build_libtool_libs"; then
10375: +	  # Building a libtool convenience library.
10376: +	  # Some compilers have problems with a '.al' extension so
10377: +	  # convenience libraries should have the same extension an
10378: +	  # archive normally would.
10379: +	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
10380: +	  build_libtool_libs=convenience
10381: +	  build_old_libs=yes
10382: +	fi
10383: +
10384: +	test -n "$vinfo" && \
10385: +	  func_warning "'-version-info/-version-number' is ignored for convenience libraries"
10386: +
10387: +	test -n "$release" && \
10388: +	  func_warning "'-release' is ignored for convenience libraries"
10389: +      else
10390: +
10391: +	# Parse the version information argument.
10392: +	save_ifs=$IFS; IFS=:
10393: +	set dummy $vinfo 0 0 0
10394: +	shift
10395: +	IFS=$save_ifs
10396: +
10397: +	test -n "$7" && \
10398: +	  func_fatal_help "too many parameters to '-version-info'"
10399: +
10400: +	# convert absolute version numbers to libtool ages
10401: +	# this retains compatibility with .la files and attempts
10402: +	# to make the code below a bit more comprehensible
10403: +
10404: +	case $vinfo_number in
10405: +	yes)
10406: +	  number_major=$1
10407: +	  number_minor=$2
10408: +	  number_revision=$3
10409: +	  #
10410: +	  # There are really only two kinds -- those that
10411: +	  # use the current revision as the major version
10412: +	  # and those that subtract age and use age as
10413: +	  # a minor version.  But, then there is irix
10414: +	  # that has an extra 1 added just for fun
10415: +	  #
10416: +	  case $version_type in
10417: +	  # correct linux to gnu/linux during the next big refactor
10418: +	  darwin|freebsd-elf|linux|osf|windows|none)
10419: +	    func_arith $number_major + $number_minor
10420: +	    current=$func_arith_result
10421: +	    age=$number_minor
10422: +	    revision=$number_revision
10423: +	    ;;
10424: +	  freebsd-aout|qnx|sunos)
10425: +	    current=$number_major
10426: +	    revision=$number_minor
10427: +	    age=0
10428: +	    ;;
10429: +	  irix|nonstopux)
10430: +	    func_arith $number_major + $number_minor
10431: +	    current=$func_arith_result
10432: +	    age=$number_minor
10433: +	    revision=$number_minor
10434: +	    lt_irix_increment=no
10435: +	    ;;
10436: +	  esac
10437: +	  ;;
10438: +	no)
10439: +	  current=$1
10440: +	  revision=$2
10441: +	  age=$3
10442: +	  ;;
10443: +	esac
10444: +
10445: +	# Check that each of the things are valid numbers.
10446: +	case $current in
10447: +	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]) ;;
10448: +	*)
10449: +	  func_error "CURRENT '$current' must be a nonnegative integer"
10450: +	  func_fatal_error "'$vinfo' is not valid version information"
10451: +	  ;;
10452: +	esac
10453: +
10454: +	case $revision in
10455: +	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]) ;;
10456: +	*)
10457: +	  func_error "REVISION '$revision' must be a nonnegative integer"
10458: +	  func_fatal_error "'$vinfo' is not valid version information"
10459: +	  ;;
10460: +	esac
10461: +
10462: +	case $age in
10463: +	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]) ;;
10464: +	*)
10465: +	  func_error "AGE '$age' must be a nonnegative integer"
10466: +	  func_fatal_error "'$vinfo' is not valid version information"
10467: +	  ;;
10468: +	esac
10469: +
10470: +	if test "$age" -gt "$current"; then
10471: +	  func_error "AGE '$age' is greater than the current interface number '$current'"
10472: +	  func_fatal_error "'$vinfo' is not valid version information"
10473: +	fi
10474: +
10475: +	# Calculate the version variables.
10476: +	major=
10477: +	versuffix=
10478: +	verstring=
10479: +	case $version_type in
10480: +	none) ;;
10481: +
10482: +	darwin)
10483: +	  # Like Linux, but with the current version available in
10484: +	  # verstring for coding it into the library header
10485: +	  func_arith $current - $age
10486: +	  major=.$func_arith_result
10487: +	  versuffix=$major.$age.$revision
10488: +	  # Darwin ld doesn't like 0 for these options...
10489: +	  func_arith $current + 1
10490: +	  minor_current=$func_arith_result
10491: +	  xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
10492: +	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
10493: +          # On Darwin other compilers
10494: +          case $CC in
10495: +              nagfor*)
10496: +                  verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
10497: +                  ;;
10498: +              *)
10499: +                  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
10500: +                  ;;
10501: +          esac
10502: +	  ;;
10503: +
10504: +	freebsd-aout)
10505: +	  major=.$current
10506: +	  versuffix=.$current.$revision
10507: +	  ;;
10508: +
10509: +	freebsd-elf)
10510: +	  func_arith $current - $age
10511: +	  major=.$func_arith_result
10512: +	  versuffix=$major.$age.$revision
10513: +	  ;;
10514: +
10515: +	irix | nonstopux)
10516: +	  if test no = "$lt_irix_increment"; then
10517: +	    func_arith $current - $age
10518: +	  else
10519: +	    func_arith $current - $age + 1
10520: +	  fi
10521: +	  major=$func_arith_result
10522: +
10523: +	  case $version_type in
10524: +	    nonstopux) verstring_prefix=nonstopux ;;
10525: +	    *)         verstring_prefix=sgi ;;
10526: +	  esac
10527: +	  verstring=$verstring_prefix$major.$revision
10528: +
10529: +	  # Add in all the interfaces that we are compatible with.
10530: +	  loop=$revision
10531: +	  while test 0 -ne "$loop"; do
10532: +	    func_arith $revision - $loop
10533: +	    iface=$func_arith_result
10534: +	    func_arith $loop - 1
10535: +	    loop=$func_arith_result
10536: +	    verstring=$verstring_prefix$major.$iface:$verstring
10537: +	  done
10538: +
10539: +	  # Before this point, $major must not contain '.'.
10540: +	  major=.$major
10541: +	  versuffix=$major.$revision
10542: +	  ;;
10543: +
10544: +	linux) # correct to gnu/linux during the next big refactor
10545: +	  func_arith $current - $age
10546: +	  major=.$func_arith_result
10547: +	  versuffix=$major.$age.$revision
10548: +	  ;;
10549: +
10550: +	osf)
10551: +	  func_arith $current - $age
10552: +	  major=.$func_arith_result
10553: +	  versuffix=.$current.$age.$revision
10554: +	  verstring=$current.$age.$revision
10555: +
10556: +	  # Add in all the interfaces that we are compatible with.
10557: +	  loop=$age
10558: +	  while test 0 -ne "$loop"; do
10559: +	    func_arith $current - $loop
10560: +	    iface=$func_arith_result
10561: +	    func_arith $loop - 1
10562: +	    loop=$func_arith_result
10563: +	    verstring=$verstring:$iface.0
10564: +	  done
10565: +
10566: +	  # Make executables depend on our current version.
10567: +	  func_append verstring ":$current.0"
10568: +	  ;;
10569: +
10570: +	qnx)
10571: +	  major=.$current
10572: +	  versuffix=.$current
10573: +	  ;;
10574: +
10575: +	sco)
10576: +	  major=.$current
10577: +	  versuffix=.$current
10578: +	  ;;
10579: +
10580: +	sunos)
10581: +	  major=.$current
10582: +	  versuffix=.$current.$revision
10583: +	  ;;
10584: +
10585: +	windows)
10586: +	  # Use '-' rather than '.', since we only want one
10587: +	  # extension on DOS 8.3 file systems.
10588: +	  func_arith $current - $age
10589: +	  major=$func_arith_result
10590: +	  versuffix=-$major
10591: +	  ;;
10592: +
10593: +	*)
10594: +	  func_fatal_configuration "unknown library version type '$version_type'"
10595: +	  ;;
10596: +	esac
10597: +
10598: +	# Clear the version info if we defaulted, and they specified a release.
10599: +	if test -z "$vinfo" && test -n "$release"; then
10600: +	  major=
10601: +	  case $version_type in
10602: +	  darwin)
10603: +	    # we can't check for "0.0" in archive_cmds due to quoting
10604: +	    # problems, so we reset it completely
10605: +	    verstring=
10606: +	    ;;
10607: +	  *)
10608: +	    verstring=0.0
10609: +	    ;;
10610: +	  esac
10611: +	  if test no = "$need_version"; then
10612: +	    versuffix=
10613: +	  else
10614: +	    versuffix=.0.0
10615: +	  fi
10616: +	fi
10617: +
10618: +	# Remove version info from name if versioning should be avoided
10619: +	if test yes,no = "$avoid_version,$need_version"; then
10620: +	  major=
10621: +	  versuffix=
10622: +	  verstring=
10623: +	fi
10624: +
10625: +	# Check to see if the archive will have undefined symbols.
10626: +	if test yes = "$allow_undefined"; then
10627: +	  if test unsupported = "$allow_undefined_flag"; then
10628: +	    if test yes = "$build_old_libs"; then
10629: +	      func_warning "undefined symbols not allowed in $host shared libraries; building static only"
10630: +	      build_libtool_libs=no
10631: +	    else
10632: +	      func_fatal_error "can't build $host shared library unless -no-undefined is specified"
10633: +	    fi
10634: +	  fi
10635: +	else
10636: +	  # Don't allow undefined symbols.
10637: +	  allow_undefined_flag=$no_undefined_flag
10638: +	fi
10639: +
10640: +      fi
10641: +
10642: +      func_generate_dlsyms "$libname" "$libname" :
10643: +      func_append libobjs " $symfileobj"
10644: +      test " " = "$libobjs" && libobjs=
10645: +
10646: +      if test relink != "$opt_mode"; then
10647: +	# Remove our outputs, but don't remove object files since they
10648: +	# may have been created when compiling PIC objects.
10649: +	removelist=
10650: +	tempremovelist=`$ECHO "$output_objdir/*"`
10651: +	for p in $tempremovelist; do
10652: +	  case $p in
10653: +	    *.$objext | *.gcno)
10654: +	       ;;
10655: +	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
10656: +	       if test -n "$precious_files_regex"; then
10657: +		 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
10658: +		 then
10659: +		   continue
10660: +		 fi
10661: +	       fi
10662: +	       func_append removelist " $p"
10663: +	       ;;
10664: +	    *) ;;
10665: +	  esac
10666: +	done
10667: +	test -n "$removelist" && \
10668: +	  func_show_eval "${RM}r \$removelist"
10669: +      fi
10670: +
10671: +      # Now set the variables for building old libraries.
10672: +      if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
10673: +	func_append oldlibs " $output_objdir/$libname.$libext"
10674: +
10675: +	# Transform .lo files to .o files.
10676: +	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
10677: +      fi
10678: +
10679: +      # Eliminate all temporary directories.
10680: +      #for path in $notinst_path; do
10681: +      #	lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
10682: +      #	deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
10683: +      #	dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
10684: +      #done
10685: +
10686: +      if test -n "$xrpath"; then
10687: +	# If the user specified any rpath flags, then add them.
10688: +	temp_xrpath=
10689: +	for libdir in $xrpath; do
10690: +	  func_replace_sysroot "$libdir"
10691: +	  func_append temp_xrpath " -R$func_replace_sysroot_result"
10692: +	  case "$finalize_rpath " in
10693: +	  *" $libdir "*) ;;
10694: +	  *) func_append finalize_rpath " $libdir" ;;
10695: +	  esac
10696: +	done
10697: +	if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
10698: +	  dependency_libs="$temp_xrpath $dependency_libs"
10699: +	fi
10700: +      fi
10701: +
10702: +      # Make sure dlfiles contains only unique files that won't be dlpreopened
10703: +      old_dlfiles=$dlfiles
10704: +      dlfiles=
10705: +      for lib in $old_dlfiles; do
10706: +	case " $dlprefiles $dlfiles " in
10707: +	*" $lib "*) ;;
10708: +	*) func_append dlfiles " $lib" ;;
10709: +	esac
10710: +      done
10711: +
10712: +      # Make sure dlprefiles contains only unique files
10713: +      old_dlprefiles=$dlprefiles
10714: +      dlprefiles=
10715: +      for lib in $old_dlprefiles; do
10716: +	case "$dlprefiles " in
10717: +	*" $lib "*) ;;
10718: +	*) func_append dlprefiles " $lib" ;;
10719: +	esac
10720: +      done
10721: +
10722: +      if test yes = "$build_libtool_libs"; then
10723: +	if test -n "$rpath"; then
10724: +	  case $host in
10725: +	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
10726: +	    # these systems don't actually have a c library (as such)!
10727: +	    ;;
10728: +	  *-*-rhapsody* | *-*-darwin1.[012])
10729: +	    # Rhapsody C library is in the System framework
10730: +	    func_append deplibs " System.ltframework"
10731: +	    ;;
10732: +	  *-*-netbsd*)
10733: +	    # Don't link with libc until the a.out ld.so is fixed.
10734: +	    ;;
10735: +	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
10736: +	    # Do not include libc due to us having libc/libc_r.
10737: +	    ;;
10738: +	  *-*-sco3.2v5* | *-*-sco5v6*)
10739: +	    # Causes problems with __ctype
10740: +	    ;;
10741: +	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
10742: +	    # Compiler inserts libc in the correct place for threads to work
10743: +	    ;;
10744: +	  *)
10745: +	    # Add libc to deplibs on all other systems if necessary.
10746: +	    if test yes = "$build_libtool_need_lc"; then
10747: +	      func_append deplibs " -lc"
10748: +	    fi
10749: +	    ;;
10750: +	  esac
10751: +	fi
10752: +
10753: +	# Transform deplibs into only deplibs that can be linked in shared.
10754: +	name_save=$name
10755: +	libname_save=$libname
10756: +	release_save=$release
10757: +	versuffix_save=$versuffix
10758: +	major_save=$major
10759: +	# I'm not sure if I'm treating the release correctly.  I think
10760: +	# release should show up in the -l (ie -lgmp5) so we don't want to
10761: +	# add it in twice.  Is that correct?
10762: +	release=
10763: +	versuffix=
10764: +	major=
10765: +	newdeplibs=
10766: +	droppeddeps=no
10767: +	case $deplibs_check_method in
10768: +	pass_all)
10769: +	  # Don't check for shared/static.  Everything works.
10770: +	  # This might be a little naive.  We might want to check
10771: +	  # whether the library exists or not.  But this is on
10772: +	  # osf3 & osf4 and I'm not really sure... Just
10773: +	  # implementing what was already the behavior.
10774: +	  newdeplibs=$deplibs
10775: +	  ;;
10776: +	test_compile)
10777: +	  # This code stresses the "libraries are programs" paradigm to its
10778: +	  # limits. Maybe even breaks it.  We compile a program, linking it
10779: +	  # against the deplibs as a proxy for the library.  Then we can check
10780: +	  # whether they linked in statically or dynamically with ldd.
10781: +	  $opt_dry_run || $RM conftest.c
10782: +	  cat > conftest.c <<EOF
10783: +	  int main() { return 0; }
10784: +EOF
10785: +	  $opt_dry_run || $RM conftest
10786: +	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
10787: +	    ldd_output=`ldd conftest`
10788: +	    for i in $deplibs; do
10789: +	      case $i in
10790: +	      -l*)
10791: +		func_stripname -l '' "$i"
10792: +		name=$func_stripname_result
10793: +		if test yes = "$allow_libtool_libs_with_static_runtimes"; then
10794: +		  case " $predeps $postdeps " in
10795: +		  *" $i "*)
10796: +		    func_append newdeplibs " $i"
10797: +		    i=
10798: +		    ;;
10799: +		  esac
10800: +		fi
10801: +		if test -n "$i"; then
10802: +		  libname=`eval "\\$ECHO \"$libname_spec\""`
10803: +		  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
10804: +		  set dummy $deplib_matches; shift
10805: +		  deplib_match=$1
10806: +		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
10807: +		    func_append newdeplibs " $i"
10808: +		  else
10809: +		    droppeddeps=yes
10810: +		    echo
10811: +		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
10812: +		    echo "*** I have the capability to make that library automatically link in when"
10813: +		    echo "*** you link to this library.  But I can only do this if you have a"
10814: +		    echo "*** shared version of the library, which I believe you do not have"
10815: +		    echo "*** because a test_compile did reveal that the linker did not use it for"
10816: +		    echo "*** its dynamic dependency list that programs get resolved with at runtime."
10817: +		  fi
10818: +		fi
10819: +		;;
10820: +	      *)
10821: +		func_append newdeplibs " $i"
10822: +		;;
10823: +	      esac
10824: +	    done
10825: +	  else
10826: +	    # Error occurred in the first compile.  Let's try to salvage
10827: +	    # the situation: Compile a separate program for each library.
10828: +	    for i in $deplibs; do
10829: +	      case $i in
10830: +	      -l*)
10831: +		func_stripname -l '' "$i"
10832: +		name=$func_stripname_result
10833: +		$opt_dry_run || $RM conftest
10834: +		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
10835: +		  ldd_output=`ldd conftest`
10836: +		  if test yes = "$allow_libtool_libs_with_static_runtimes"; then
10837: +		    case " $predeps $postdeps " in
10838: +		    *" $i "*)
10839: +		      func_append newdeplibs " $i"
10840: +		      i=
10841: +		      ;;
10842: +		    esac
10843: +		  fi
10844: +		  if test -n "$i"; then
10845: +		    libname=`eval "\\$ECHO \"$libname_spec\""`
10846: +		    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
10847: +		    set dummy $deplib_matches; shift
10848: +		    deplib_match=$1
10849: +		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
10850: +		      func_append newdeplibs " $i"
10851: +		    else
10852: +		      droppeddeps=yes
10853: +		      echo
10854: +		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
10855: +		      echo "*** I have the capability to make that library automatically link in when"
10856: +		      echo "*** you link to this library.  But I can only do this if you have a"
10857: +		      echo "*** shared version of the library, which you do not appear to have"
10858: +		      echo "*** because a test_compile did reveal that the linker did not use this one"
10859: +		      echo "*** as a dynamic dependency that programs can get resolved with at runtime."
10860: +		    fi
10861: +		  fi
10862: +		else
10863: +		  droppeddeps=yes
10864: +		  echo
10865: +		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
10866: +		  echo "*** make it link in!  You will probably need to install it or some"
10867: +		  echo "*** library that it depends on before this library will be fully"
10868: +		  echo "*** functional.  Installing it before continuing would be even better."
10869: +		fi
10870: +		;;
10871: +	      *)
10872: +		func_append newdeplibs " $i"
10873: +		;;
10874: +	      esac
10875: +	    done
10876: +	  fi
10877: +	  ;;
10878: +	file_magic*)
10879: +	  set dummy $deplibs_check_method; shift
10880: +	  file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
10881: +	  for a_deplib in $deplibs; do
10882: +	    case $a_deplib in
10883: +	    -l*)
10884: +	      func_stripname -l '' "$a_deplib"
10885: +	      name=$func_stripname_result
10886: +	      if test yes = "$allow_libtool_libs_with_static_runtimes"; then
10887: +		case " $predeps $postdeps " in
10888: +		*" $a_deplib "*)
10889: +		  func_append newdeplibs " $a_deplib"
10890: +		  a_deplib=
10891: +		  ;;
10892: +		esac
10893: +	      fi
10894: +	      if test -n "$a_deplib"; then
10895: +		libname=`eval "\\$ECHO \"$libname_spec\""`
10896: +		if test -n "$file_magic_glob"; then
10897: +		  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
10898: +		else
10899: +		  libnameglob=$libname
10900: +		fi
10901: +		test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
10902: +		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
10903: +		  if test yes = "$want_nocaseglob"; then
10904: +		    shopt -s nocaseglob
10905: +		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
10906: +		    $nocaseglob
10907: +		  else
10908: +		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
10909: +		  fi
10910: +		  for potent_lib in $potential_libs; do
10911: +		      # Follow soft links.
10912: +		      if ls -lLd "$potent_lib" 2>/dev/null |
10913: +			 $GREP " -> " >/dev/null; then
10914: +			continue
10915: +		      fi
10916: +		      # The statement above tries to avoid entering an
10917: +		      # endless loop below, in case of cyclic links.
10918: +		      # We might still enter an endless loop, since a link
10919: +		      # loop can be closed while we follow links,
10920: +		      # but so what?
10921: +		      potlib=$potent_lib
10922: +		      while test -h "$potlib" 2>/dev/null; do
10923: +			potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
10924: +			case $potliblink in
10925: +			[\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
10926: +			*) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
10927: +			esac
10928: +		      done
10929: +		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
10930: +			 $SED -e 10q |
10931: +			 $EGREP "$file_magic_regex" > /dev/null; then
10932: +			func_append newdeplibs " $a_deplib"
10933: +			a_deplib=
10934: +			break 2
10935: +		      fi
10936: +		  done
10937: +		done
10938: +	      fi
10939: +	      if test -n "$a_deplib"; then
10940: +		droppeddeps=yes
10941: +		echo
10942: +		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
10943: +		echo "*** I have the capability to make that library automatically link in when"
10944: +		echo "*** you link to this library.  But I can only do this if you have a"
10945: +		echo "*** shared version of the library, which you do not appear to have"
10946: +		echo "*** because I did check the linker path looking for a file starting"
10947: +		if test -z "$potlib"; then
10948: +		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
10949: +		else
10950: +		  $ECHO "*** with $libname and none of the candidates passed a file format test"
10951: +		  $ECHO "*** using a file magic. Last file checked: $potlib"
10952: +		fi
10953: +	      fi
10954: +	      ;;
10955: +	    *)
10956: +	      # Add a -L argument.
10957: +	      func_append newdeplibs " $a_deplib"
10958: +	      ;;
10959: +	    esac
10960: +	  done # Gone through all deplibs.
10961: +	  ;;
10962: +	match_pattern*)
10963: +	  set dummy $deplibs_check_method; shift
10964: +	  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
10965: +	  for a_deplib in $deplibs; do
10966: +	    case $a_deplib in
10967: +	    -l*)
10968: +	      func_stripname -l '' "$a_deplib"
10969: +	      name=$func_stripname_result
10970: +	      if test yes = "$allow_libtool_libs_with_static_runtimes"; then
10971: +		case " $predeps $postdeps " in
10972: +		*" $a_deplib "*)
10973: +		  func_append newdeplibs " $a_deplib"
10974: +		  a_deplib=
10975: +		  ;;
10976: +		esac
10977: +	      fi
10978: +	      if test -n "$a_deplib"; then
10979: +		libname=`eval "\\$ECHO \"$libname_spec\""`
10980: +		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
10981: +		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
10982: +		  for potent_lib in $potential_libs; do
10983: +		    potlib=$potent_lib # see symlink-check above in file_magic test
10984: +		    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
10985: +		       $EGREP "$match_pattern_regex" > /dev/null; then
10986: +		      func_append newdeplibs " $a_deplib"
10987: +		      a_deplib=
10988: +		      break 2
10989: +		    fi
10990: +		  done
10991: +		done
10992: +	      fi
10993: +	      if test -n "$a_deplib"; then
10994: +		droppeddeps=yes
10995: +		echo
10996: +		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
10997: +		echo "*** I have the capability to make that library automatically link in when"
10998: +		echo "*** you link to this library.  But I can only do this if you have a"
10999: +		echo "*** shared version of the library, which you do not appear to have"
11000: +		echo "*** because I did check the linker path looking for a file starting"
11001: +		if test -z "$potlib"; then
11002: +		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
11003: +		else
11004: +		  $ECHO "*** with $libname and none of the candidates passed a file format test"
11005: +		  $ECHO "*** using a regex pattern. Last file checked: $potlib"
11006: +		fi
11007: +	      fi
11008: +	      ;;
11009: +	    *)
11010: +	      # Add a -L argument.
11011: +	      func_append newdeplibs " $a_deplib"
11012: +	      ;;
11013: +	    esac
11014: +	  done # Gone through all deplibs.
11015: +	  ;;
11016: +	none | unknown | *)
11017: +	  newdeplibs=
11018: +	  tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
11019: +	  if test yes = "$allow_libtool_libs_with_static_runtimes"; then
11020: +	    for i in $predeps $postdeps; do
11021: +	      # can't use Xsed below, because $i might contain '/'
11022: +	      tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
11023: +	    done
11024: +	  fi
11025: +	  case $tmp_deplibs in
11026: +	  *[!\	\ ]*)
11027: +	    echo
11028: +	    if test none = "$deplibs_check_method"; then
11029: +	      echo "*** Warning: inter-library dependencies are not supported in this platform."
11030: +	    else
11031: +	      echo "*** Warning: inter-library dependencies are not known to be supported."
11032: +	    fi
11033: +	    echo "*** All declared inter-library dependencies are being dropped."
11034: +	    droppeddeps=yes
11035: +	    ;;
11036: +	  esac
11037: +	  ;;
11038: +	esac
11039: +	versuffix=$versuffix_save
11040: +	major=$major_save
11041: +	release=$release_save
11042: +	libname=$libname_save
11043: +	name=$name_save
11044: +
11045: +	case $host in
11046: +	*-*-rhapsody* | *-*-darwin1.[012])
11047: +	  # On Rhapsody replace the C library with the System framework
11048: +	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
11049: +	  ;;
11050: +	esac
11051: +
11052: +	if test yes = "$droppeddeps"; then
11053: +	  if test yes = "$module"; then
11054: +	    echo
11055: +	    echo "*** Warning: libtool could not satisfy all declared inter-library"
11056: +	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
11057: +	    echo "*** a static module, that should work as long as the dlopening"
11058: +	    echo "*** application is linked with the -dlopen flag."
11059: +	    if test -z "$global_symbol_pipe"; then
11060: +	      echo
11061: +	      echo "*** However, this would only work if libtool was able to extract symbol"
11062: +	      echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
11063: +	      echo "*** not find such a program.  So, this module is probably useless."
11064: +	      echo "*** 'nm' from GNU binutils and a full rebuild may help."
11065: +	    fi
11066: +	    if test no = "$build_old_libs"; then
11067: +	      oldlibs=$output_objdir/$libname.$libext
11068: +	      build_libtool_libs=module
11069: +	      build_old_libs=yes
11070: +	    else
11071: +	      build_libtool_libs=no
11072: +	    fi
11073: +	  else
11074: +	    echo "*** The inter-library dependencies that have been dropped here will be"
11075: +	    echo "*** automatically added whenever a program is linked with this library"
11076: +	    echo "*** or is declared to -dlopen it."
11077: +
11078: +	    if test no = "$allow_undefined"; then
11079: +	      echo
11080: +	      echo "*** Since this library must not contain undefined symbols,"
11081: +	      echo "*** because either the platform does not support them or"
11082: +	      echo "*** it was explicitly requested with -no-undefined,"
11083: +	      echo "*** libtool will only create a static version of it."
11084: +	      if test no = "$build_old_libs"; then
11085: +		oldlibs=$output_objdir/$libname.$libext
11086: +		build_libtool_libs=module
11087: +		build_old_libs=yes
11088: +	      else
11089: +		build_libtool_libs=no
11090: +	      fi
11091: +	    fi
11092: +	  fi
11093: +	fi
11094: +	# Done checking deplibs!
11095: +	deplibs=$newdeplibs
11096: +      fi
11097: +      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
11098: +      case $host in
11099: +	*-*-darwin*)
11100: +	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
11101: +	  new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
11102: +	  deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
11103: +	  ;;
11104: +      esac
11105: +
11106: +      # move library search paths that coincide with paths to not yet
11107: +      # installed libraries to the beginning of the library search list
11108: +      new_libs=
11109: +      for path in $notinst_path; do
11110: +	case " $new_libs " in
11111: +	*" -L$path/$objdir "*) ;;
11112: +	*)
11113: +	  case " $deplibs " in
11114: +	  *" -L$path/$objdir "*)
11115: +	    func_append new_libs " -L$path/$objdir" ;;
11116: +	  esac
11117: +	  ;;
11118: +	esac
11119: +      done
11120: +      for deplib in $deplibs; do
11121: +	case $deplib in
11122: +	-L*)
11123: +	  case " $new_libs " in
11124: +	  *" $deplib "*) ;;
11125: +	  *) func_append new_libs " $deplib" ;;
11126: +	  esac
11127: +	  ;;
11128: +	*) func_append new_libs " $deplib" ;;
11129: +	esac
11130: +      done
11131: +      deplibs=$new_libs
11132: +
11133: +      # All the library-specific variables (install_libdir is set above).
11134: +      library_names=
11135: +      old_library=
11136: +      dlname=
11137: +
11138: +      # Test again, we may have decided not to build it any more
11139: +      if test yes = "$build_libtool_libs"; then
11140: +	# Remove $wl instances when linking with ld.
11141: +	# FIXME: should test the right _cmds variable.
11142: +	case $archive_cmds in
11143: +	  *\$LD\ *) wl= ;;
11144: +        esac
11145: +	if test yes = "$hardcode_into_libs"; then
11146: +	  # Hardcode the library paths
11147: +	  hardcode_libdirs=
11148: +	  dep_rpath=
11149: +	  rpath=$finalize_rpath
11150: +	  test relink = "$opt_mode" || rpath=$compile_rpath$rpath
11151: +	  for libdir in $rpath; do
11152: +	    if test -n "$hardcode_libdir_flag_spec"; then
11153: +	      if test -n "$hardcode_libdir_separator"; then
11154: +		func_replace_sysroot "$libdir"
11155: +		libdir=$func_replace_sysroot_result
11156: +		if test -z "$hardcode_libdirs"; then
11157: +		  hardcode_libdirs=$libdir
11158: +		else
11159: +		  # Just accumulate the unique libdirs.
11160: +		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
11161: +		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
11162: +		    ;;
11163: +		  *)
11164: +		    func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
11165: +		    ;;
11166: +		  esac
11167: +		fi
11168: +	      else
11169: +		eval flag=\"$hardcode_libdir_flag_spec\"
11170: +		func_append dep_rpath " $flag"
11171: +	      fi
11172: +	    elif test -n "$runpath_var"; then
11173: +	      case "$perm_rpath " in
11174: +	      *" $libdir "*) ;;
11175: +	      *) func_append perm_rpath " $libdir" ;;
11176: +	      esac
11177: +	    fi
11178: +	  done
11179: +	  # Substitute the hardcoded libdirs into the rpath.
11180: +	  if test -n "$hardcode_libdir_separator" &&
11181: +	     test -n "$hardcode_libdirs"; then
11182: +	    libdir=$hardcode_libdirs
11183: +	    eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
11184: +	  fi
11185: +	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
11186: +	    # We should set the runpath_var.
11187: +	    rpath=
11188: +	    for dir in $perm_rpath; do
11189: +	      func_append rpath "$dir:"
11190: +	    done
11191: +	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
11192: +	  fi
11193: +	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
11194: +	fi
11195: +
11196: +	shlibpath=$finalize_shlibpath
11197: +	test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
11198: +	if test -n "$shlibpath"; then
11199: +	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
11200: +	fi
11201: +
11202: +	# Get the real and link names of the library.
11203: +	eval shared_ext=\"$shrext_cmds\"
11204: +	eval library_names=\"$library_names_spec\"
11205: +	set dummy $library_names
11206: +	shift
11207: +	realname=$1
11208: +	shift
11209: +
11210: +	if test -n "$soname_spec"; then
11211: +	  eval soname=\"$soname_spec\"
11212: +	else
11213: +	  soname=$realname
11214: +	fi
11215: +	if test -z "$dlname"; then
11216: +	  dlname=$soname
11217: +	fi
11218: +
11219: +	lib=$output_objdir/$realname
11220: +	linknames=
11221: +	for link
11222: +	do
11223: +	  func_append linknames " $link"
11224: +	done
11225: +
11226: +	# Use standard objects if they are pic
11227: +	test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
11228: +	test "X$libobjs" = "X " && libobjs=
11229: +
11230: +	delfiles=
11231: +	if test -n "$export_symbols" && test -n "$include_expsyms"; then
11232: +	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
11233: +	  export_symbols=$output_objdir/$libname.uexp
11234: +	  func_append delfiles " $export_symbols"
11235: +	fi
11236: +
11237: +	orig_export_symbols=
11238: +	case $host_os in
11239: +	cygwin* | mingw* | cegcc*)
11240: +	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
11241: +	    # exporting using user supplied symfile
11242: +	    func_dll_def_p "$export_symbols" || {
11243: +	      # and it's NOT already a .def file. Must figure out
11244: +	      # which of the given symbols are data symbols and tag
11245: +	      # them as such. So, trigger use of export_symbols_cmds.
11246: +	      # export_symbols gets reassigned inside the "prepare
11247: +	      # the list of exported symbols" if statement, so the
11248: +	      # include_expsyms logic still works.
11249: +	      orig_export_symbols=$export_symbols
11250: +	      export_symbols=
11251: +	      always_export_symbols=yes
11252: +	    }
11253: +	  fi
11254: +	  ;;
11255: +	esac
11256: +
11257: +	# Prepare the list of exported symbols
11258: +	if test -z "$export_symbols"; then
11259: +	  if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
11260: +	    func_verbose "generating symbol list for '$libname.la'"
11261: +	    export_symbols=$output_objdir/$libname.exp
11262: +	    $opt_dry_run || $RM $export_symbols
11263: +	    cmds=$export_symbols_cmds
11264: +	    save_ifs=$IFS; IFS='~'
11265: +	    for cmd1 in $cmds; do
11266: +	      IFS=$save_ifs
11267: +	      # Take the normal branch if the nm_file_list_spec branch
11268: +	      # doesn't work or if tool conversion is not needed.
11269: +	      case $nm_file_list_spec~$to_tool_file_cmd in
11270: +		*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
11271: +		  try_normal_branch=yes
11272: +		  eval cmd=\"$cmd1\"
11273: +		  func_len " $cmd"
11274: +		  len=$func_len_result
11275: +		  ;;
11276: +		*)
11277: +		  try_normal_branch=no
11278: +		  ;;
11279: +	      esac
11280: +	      if test yes = "$try_normal_branch" \
11281: +		 && { test "$len" -lt "$max_cmd_len" \
11282: +		      || test "$max_cmd_len" -le -1; }
11283: +	      then
11284: +		func_show_eval "$cmd" 'exit $?'
11285: +		skipped_export=false
11286: +	      elif test -n "$nm_file_list_spec"; then
11287: +		func_basename "$output"
11288: +		output_la=$func_basename_result
11289: +		save_libobjs=$libobjs
11290: +		save_output=$output
11291: +		output=$output_objdir/$output_la.nm
11292: +		func_to_tool_file "$output"
11293: +		libobjs=$nm_file_list_spec$func_to_tool_file_result
11294: +		func_append delfiles " $output"
11295: +		func_verbose "creating $NM input file list: $output"
11296: +		for obj in $save_libobjs; do
11297: +		  func_to_tool_file "$obj"
11298: +		  $ECHO "$func_to_tool_file_result"
11299: +		done > "$output"
11300: +		eval cmd=\"$cmd1\"
11301: +		func_show_eval "$cmd" 'exit $?'
11302: +		output=$save_output
11303: +		libobjs=$save_libobjs
11304: +		skipped_export=false
11305: +	      else
11306: +		# The command line is too long to execute in one step.
11307: +		func_verbose "using reloadable object file for export list..."
11308: +		skipped_export=:
11309: +		# Break out early, otherwise skipped_export may be
11310: +		# set to false by a later but shorter cmd.
11311: +		break
11312: +	      fi
11313: +	    done
11314: +	    IFS=$save_ifs
11315: +	    if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
11316: +	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
11317: +	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
11318: +	    fi
11319: +	  fi
11320: +	fi
11321: +
11322: +	if test -n "$export_symbols" && test -n "$include_expsyms"; then
11323: +	  tmp_export_symbols=$export_symbols
11324: +	  test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
11325: +	  $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
11326: +	fi
11327: +
11328: +	if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
11329: +	  # The given exports_symbols file has to be filtered, so filter it.
11330: +	  func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
11331: +	  # FIXME: $output_objdir/$libname.filter potentially contains lots of
11332: +	  # 's' commands, which not all seds can handle. GNU sed should be fine
11333: +	  # though. Also, the filter scales superlinearly with the number of
11334: +	  # global variables. join(1) would be nice here, but unfortunately
11335: +	  # isn't a blessed tool.
11336: +	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
11337: +	  func_append delfiles " $export_symbols $output_objdir/$libname.filter"
11338: +	  export_symbols=$output_objdir/$libname.def
11339: +	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
11340: +	fi
11341: +
11342: +	tmp_deplibs=
11343: +	for test_deplib in $deplibs; do
11344: +	  case " $convenience " in
11345: +	  *" $test_deplib "*) ;;
11346: +	  *)
11347: +	    func_append tmp_deplibs " $test_deplib"
11348: +	    ;;
11349: +	  esac
11350: +	done
11351: +	deplibs=$tmp_deplibs
11352: +
11353: +	if test -n "$convenience"; then
11354: +	  if test -n "$whole_archive_flag_spec" &&
11355: +	    test yes = "$compiler_needs_object" &&
11356: +	    test -z "$libobjs"; then
11357: +	    # extract the archives, so we have objects to list.
11358: +	    # TODO: could optimize this to just extract one archive.
11359: +	    whole_archive_flag_spec=
11360: +	  fi
11361: +	  if test -n "$whole_archive_flag_spec"; then
11362: +	    save_libobjs=$libobjs
11363: +	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
11364: +	    test "X$libobjs" = "X " && libobjs=
11365: +	  else
11366: +	    gentop=$output_objdir/${outputname}x
11367: +	    func_append generated " $gentop"
11368: +
11369: +	    func_extract_archives $gentop $convenience
11370: +	    func_append libobjs " $func_extract_archives_result"
11371: +	    test "X$libobjs" = "X " && libobjs=
11372: +	  fi
11373: +	fi
11374: +
11375: +	if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
11376: +	  eval flag=\"$thread_safe_flag_spec\"
11377: +	  func_append linker_flags " $flag"
11378: +	fi
11379: +
11380: +	# Make a backup of the uninstalled library when relinking
11381: +	if test relink = "$opt_mode"; then
11382: +	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
11383: +	fi
11384: +
11385: +	# Do each of the archive commands.
11386: +	if test yes = "$module" && test -n "$module_cmds"; then
11387: +	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
11388: +	    eval test_cmds=\"$module_expsym_cmds\"
11389: +	    cmds=$module_expsym_cmds
11390: +	  else
11391: +	    eval test_cmds=\"$module_cmds\"
11392: +	    cmds=$module_cmds
11393: +	  fi
11394: +	else
11395: +	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
11396: +	    eval test_cmds=\"$archive_expsym_cmds\"
11397: +	    cmds=$archive_expsym_cmds
11398: +	  else
11399: +	    eval test_cmds=\"$archive_cmds\"
11400: +	    cmds=$archive_cmds
11401: +	  fi
11402: +	fi
11403: +
11404: +	if test : != "$skipped_export" &&
11405: +	   func_len " $test_cmds" &&
11406: +	   len=$func_len_result &&
11407: +	   test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
11408: +	  :
11409: +	else
11410: +	  # The command line is too long to link in one step, link piecewise
11411: +	  # or, if using GNU ld and skipped_export is not :, use a linker
11412: +	  # script.
11413: +
11414: +	  # Save the value of $output and $libobjs because we want to
11415: +	  # use them later.  If we have whole_archive_flag_spec, we
11416: +	  # want to use save_libobjs as it was before
11417: +	  # whole_archive_flag_spec was expanded, because we can't
11418: +	  # assume the linker understands whole_archive_flag_spec.
11419: +	  # This may have to be revisited, in case too many
11420: +	  # convenience libraries get linked in and end up exceeding
11421: +	  # the spec.
11422: +	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
11423: +	    save_libobjs=$libobjs
11424: +	  fi
11425: +	  save_output=$output
11426: +	  func_basename "$output"
11427: +	  output_la=$func_basename_result
11428: +
11429: +	  # Clear the reloadable object creation command queue and
11430: +	  # initialize k to one.
11431: +	  test_cmds=
11432: +	  concat_cmds=
11433: +	  objlist=
11434: +	  last_robj=
11435: +	  k=1
11436: +
11437: +	  if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
11438: +	    output=$output_objdir/$output_la.lnkscript
11439: +	    func_verbose "creating GNU ld script: $output"
11440: +	    echo 'INPUT (' > $output
11441: +	    for obj in $save_libobjs
11442: +	    do
11443: +	      func_to_tool_file "$obj"
11444: +	      $ECHO "$func_to_tool_file_result" >> $output
11445: +	    done
11446: +	    echo ')' >> $output
11447: +	    func_append delfiles " $output"
11448: +	    func_to_tool_file "$output"
11449: +	    output=$func_to_tool_file_result
11450: +	  elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
11451: +	    output=$output_objdir/$output_la.lnk
11452: +	    func_verbose "creating linker input file list: $output"
11453: +	    : > $output
11454: +	    set x $save_libobjs
11455: +	    shift
11456: +	    firstobj=
11457: +	    if test yes = "$compiler_needs_object"; then
11458: +	      firstobj="$1 "
11459: +	      shift
11460: +	    fi
11461: +	    for obj
11462: +	    do
11463: +	      func_to_tool_file "$obj"
11464: +	      $ECHO "$func_to_tool_file_result" >> $output
11465: +	    done
11466: +	    func_append delfiles " $output"
11467: +	    func_to_tool_file "$output"
11468: +	    output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
11469: +	  else
11470: +	    if test -n "$save_libobjs"; then
11471: +	      func_verbose "creating reloadable object files..."
11472: +	      output=$output_objdir/$output_la-$k.$objext
11473: +	      eval test_cmds=\"$reload_cmds\"
11474: +	      func_len " $test_cmds"
11475: +	      len0=$func_len_result
11476: +	      len=$len0
11477: +
11478: +	      # Loop over the list of objects to be linked.
11479: +	      for obj in $save_libobjs
11480: +	      do
11481: +		func_len " $obj"
11482: +		func_arith $len + $func_len_result
11483: +		len=$func_arith_result
11484: +		if test -z "$objlist" ||
11485: +		   test "$len" -lt "$max_cmd_len"; then
11486: +		  func_append objlist " $obj"
11487: +		else
11488: +		  # The command $test_cmds is almost too long, add a
11489: +		  # command to the queue.
11490: +		  if test 1 -eq "$k"; then
11491: +		    # The first file doesn't have a previous command to add.
11492: +		    reload_objs=$objlist
11493: +		    eval concat_cmds=\"$reload_cmds\"
11494: +		  else
11495: +		    # All subsequent reloadable object files will link in
11496: +		    # the last one created.
11497: +		    reload_objs="$objlist $last_robj"
11498: +		    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
11499: +		  fi
11500: +		  last_robj=$output_objdir/$output_la-$k.$objext
11501: +		  func_arith $k + 1
11502: +		  k=$func_arith_result
11503: +		  output=$output_objdir/$output_la-$k.$objext
11504: +		  objlist=" $obj"
11505: +		  func_len " $last_robj"
11506: +		  func_arith $len0 + $func_len_result
11507: +		  len=$func_arith_result
11508: +		fi
11509: +	      done
11510: +	      # Handle the remaining objects by creating one last
11511: +	      # reloadable object file.  All subsequent reloadable object
11512: +	      # files will link in the last one created.
11513: +	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
11514: +	      reload_objs="$objlist $last_robj"
11515: +	      eval concat_cmds=\"\$concat_cmds$reload_cmds\"
11516: +	      if test -n "$last_robj"; then
11517: +	        eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
11518: +	      fi
11519: +	      func_append delfiles " $output"
11520: +
11521: +	    else
11522: +	      output=
11523: +	    fi
11524: +
11525: +	    ${skipped_export-false} && {
11526: +	      func_verbose "generating symbol list for '$libname.la'"
11527: +	      export_symbols=$output_objdir/$libname.exp
11528: +	      $opt_dry_run || $RM $export_symbols
11529: +	      libobjs=$output
11530: +	      # Append the command to create the export file.
11531: +	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
11532: +	      eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
11533: +	      if test -n "$last_robj"; then
11534: +		eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
11535: +	      fi
11536: +	    }
11537: +
11538: +	    test -n "$save_libobjs" &&
11539: +	      func_verbose "creating a temporary reloadable object file: $output"
11540: +
11541: +	    # Loop through the commands generated above and execute them.
11542: +	    save_ifs=$IFS; IFS='~'
11543: +	    for cmd in $concat_cmds; do
11544: +	      IFS=$save_ifs
11545: +	      $opt_quiet || {
11546: +		  func_quote_for_expand "$cmd"
11547: +		  eval "func_echo $func_quote_for_expand_result"
11548: +	      }
11549: +	      $opt_dry_run || eval "$cmd" || {
11550: +		lt_exit=$?
11551: +
11552: +		# Restore the uninstalled library and exit
11553: +		if test relink = "$opt_mode"; then
11554: +		  ( cd "$output_objdir" && \
11555: +		    $RM "${realname}T" && \
11556: +		    $MV "${realname}U" "$realname" )
11557: +		fi
11558: +
11559: +		exit $lt_exit
11560: +	      }
11561: +	    done
11562: +	    IFS=$save_ifs
11563: +
11564: +	    if test -n "$export_symbols_regex" && ${skipped_export-false}; then
11565: +	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
11566: +	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
11567: +	    fi
11568: +	  fi
11569: +
11570: +          ${skipped_export-false} && {
11571: +	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
11572: +	      tmp_export_symbols=$export_symbols
11573: +	      test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
11574: +	      $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
11575: +	    fi
11576: +
11577: +	    if test -n "$orig_export_symbols"; then
11578: +	      # The given exports_symbols file has to be filtered, so filter it.
11579: +	      func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
11580: +	      # FIXME: $output_objdir/$libname.filter potentially contains lots of
11581: +	      # 's' commands, which not all seds can handle. GNU sed should be fine
11582: +	      # though. Also, the filter scales superlinearly with the number of
11583: +	      # global variables. join(1) would be nice here, but unfortunately
11584: +	      # isn't a blessed tool.
11585: +	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
11586: +	      func_append delfiles " $export_symbols $output_objdir/$libname.filter"
11587: +	      export_symbols=$output_objdir/$libname.def
11588: +	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
11589: +	    fi
11590: +	  }
11591: +
11592: +	  libobjs=$output
11593: +	  # Restore the value of output.
11594: +	  output=$save_output
11595: +
11596: +	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
11597: +	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
11598: +	    test "X$libobjs" = "X " && libobjs=
11599: +	  fi
11600: +	  # Expand the library linking commands again to reset the
11601: +	  # value of $libobjs for piecewise linking.
11602: +
11603: +	  # Do each of the archive commands.
11604: +	  if test yes = "$module" && test -n "$module_cmds"; then
11605: +	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
11606: +	      cmds=$module_expsym_cmds
11607: +	    else
11608: +	      cmds=$module_cmds
11609: +	    fi
11610: +	  else
11611: +	    if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
11612: +	      cmds=$archive_expsym_cmds
11613: +	    else
11614: +	      cmds=$archive_cmds
11615: +	    fi
11616: +	  fi
11617: +	fi
11618: +
11619: +	if test -n "$delfiles"; then
11620: +	  # Append the command to remove temporary files to $cmds.
11621: +	  eval cmds=\"\$cmds~\$RM $delfiles\"
11622: +	fi
11623: +
11624: +	# Add any objects from preloaded convenience libraries
11625: +	if test -n "$dlprefiles"; then
11626: +	  gentop=$output_objdir/${outputname}x
11627: +	  func_append generated " $gentop"
11628: +
11629: +	  func_extract_archives $gentop $dlprefiles
11630: +	  func_append libobjs " $func_extract_archives_result"
11631: +	  test "X$libobjs" = "X " && libobjs=
11632: +	fi
11633: +
11634: +	save_ifs=$IFS; IFS='~'
11635: +	for cmd in $cmds; do
11636: +	  IFS=$sp$nl
11637: +	  eval cmd=\"$cmd\"
11638: +	  IFS=$save_ifs
11639: +	  $opt_quiet || {
11640: +	    func_quote_for_expand "$cmd"
11641: +	    eval "func_echo $func_quote_for_expand_result"
11642: +	  }
11643: +	  $opt_dry_run || eval "$cmd" || {
11644: +	    lt_exit=$?
11645: +
11646: +	    # Restore the uninstalled library and exit
11647: +	    if test relink = "$opt_mode"; then
11648: +	      ( cd "$output_objdir" && \
11649: +	        $RM "${realname}T" && \
11650: +		$MV "${realname}U" "$realname" )
11651: +	    fi
11652: +
11653: +	    exit $lt_exit
11654: +	  }
11655: +	done
11656: +	IFS=$save_ifs
11657: +
11658: +	# Restore the uninstalled library and exit
11659: +	if test relink = "$opt_mode"; then
11660: +	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
11661: +
11662: +	  if test -n "$convenience"; then
11663: +	    if test -z "$whole_archive_flag_spec"; then
11664: +	      func_show_eval '${RM}r "$gentop"'
11665: +	    fi
11666: +	  fi
11667: +
11668: +	  exit $EXIT_SUCCESS
11669: +	fi
11670: +
11671: +	# Create links to the real library.
11672: +	for linkname in $linknames; do
11673: +	  if test "$realname" != "$linkname"; then
11674: +	    func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
11675: +	  fi
11676: +	done
11677: +
11678: +	# If -module or -export-dynamic was specified, set the dlname.
11679: +	if test yes = "$module" || test yes = "$export_dynamic"; then
11680: +	  # On all known operating systems, these are identical.
11681: +	  dlname=$soname
11682: +	fi
11683: +      fi
11684: +      ;;
11685: +
11686: +    obj)
11687: +      if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
11688: +	func_warning "'-dlopen' is ignored for objects"
11689: +      fi
11690: +
11691: +      case " $deplibs" in
11692: +      *\ -l* | *\ -L*)
11693: +	func_warning "'-l' and '-L' are ignored for objects" ;;
11694: +      esac
11695: +
11696: +      test -n "$rpath" && \
11697: +	func_warning "'-rpath' is ignored for objects"
11698: +
11699: +      test -n "$xrpath" && \
11700: +	func_warning "'-R' is ignored for objects"
11701: +
11702: +      test -n "$vinfo" && \
11703: +	func_warning "'-version-info' is ignored for objects"
11704: +
11705: +      test -n "$release" && \
11706: +	func_warning "'-release' is ignored for objects"
11707: +
11708: +      case $output in
11709: +      *.lo)
11710: +	test -n "$objs$old_deplibs" && \
11711: +	  func_fatal_error "cannot build library object '$output' from non-libtool objects"
11712: +
11713: +	libobj=$output
11714: +	func_lo2o "$libobj"
11715: +	obj=$func_lo2o_result
11716: +	;;
11717: +      *)
11718: +	libobj=
11719: +	obj=$output
11720: +	;;
11721: +      esac
11722: +
11723: +      # Delete the old objects.
11724: +      $opt_dry_run || $RM $obj $libobj
11725: +
11726: +      # Objects from convenience libraries.  This assumes
11727: +      # single-version convenience libraries.  Whenever we create
11728: +      # different ones for PIC/non-PIC, this we'll have to duplicate
11729: +      # the extraction.
11730: +      reload_conv_objs=
11731: +      gentop=
11732: +      # if reload_cmds runs $LD directly, get rid of -Wl from
11733: +      # whole_archive_flag_spec and hope we can get by with turning comma
11734: +      # into space.
11735: +      case $reload_cmds in
11736: +        *\$LD[\ \$]*) wl= ;;
11737: +      esac
11738: +      if test -n "$convenience"; then
11739: +	if test -n "$whole_archive_flag_spec"; then
11740: +	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
11741: +	  test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
11742: +	  reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
11743: +	else
11744: +	  gentop=$output_objdir/${obj}x
11745: +	  func_append generated " $gentop"
11746: +
11747: +	  func_extract_archives $gentop $convenience
11748: +	  reload_conv_objs="$reload_objs $func_extract_archives_result"
11749: +	fi
11750: +      fi
11751: +
11752: +      # If we're not building shared, we need to use non_pic_objs
11753: +      test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
11754: +
11755: +      # Create the old-style object.
11756: +      reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
11757: +
11758: +      output=$obj
11759: +      func_execute_cmds "$reload_cmds" 'exit $?'
11760: +
11761: +      # Exit if we aren't doing a library object file.
11762: +      if test -z "$libobj"; then
11763: +	if test -n "$gentop"; then
11764: +	  func_show_eval '${RM}r "$gentop"'
11765: +	fi
11766: +
11767: +	exit $EXIT_SUCCESS
11768: +      fi
11769: +
11770: +      test yes = "$build_libtool_libs" || {
11771: +	if test -n "$gentop"; then
11772: +	  func_show_eval '${RM}r "$gentop"'
11773: +	fi
11774: +
11775: +	# Create an invalid libtool object if no PIC, so that we don't
11776: +	# accidentally link it into a program.
11777: +	# $show "echo timestamp > $libobj"
11778: +	# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
11779: +	exit $EXIT_SUCCESS
11780: +      }
11781: +
11782: +      if test -n "$pic_flag" || test default != "$pic_mode"; then
11783: +	# Only do commands if we really have different PIC objects.
11784: +	reload_objs="$libobjs $reload_conv_objs"
11785: +	output=$libobj
11786: +	func_execute_cmds "$reload_cmds" 'exit $?'
11787: +      fi
11788: +
11789: +      if test -n "$gentop"; then
11790: +	func_show_eval '${RM}r "$gentop"'
11791: +      fi
11792: +
11793: +      exit $EXIT_SUCCESS
11794: +      ;;
11795: +
11796: +    prog)
11797: +      case $host in
11798: +	*cygwin*) func_stripname '' '.exe' "$output"
11799: +	          output=$func_stripname_result.exe;;
11800: +      esac
11801: +      test -n "$vinfo" && \
11802: +	func_warning "'-version-info' is ignored for programs"
11803: +
11804: +      test -n "$release" && \
11805: +	func_warning "'-release' is ignored for programs"
11806: +
11807: +      $preload \
11808: +	&& test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
11809: +	&& func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
11810: +
11811: +      case $host in
11812: +      *-*-rhapsody* | *-*-darwin1.[012])
11813: +	# On Rhapsody replace the C library is the System framework
11814: +	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
11815: +	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
11816: +	;;
11817: +      esac
11818: +
11819: +      case $host in
11820: +      *-*-darwin*)
11821: +	# Don't allow lazy linking, it breaks C++ global constructors
11822: +	# But is supposedly fixed on 10.4 or later (yay!).
11823: +	if test CXX = "$tagname"; then
11824: +	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
11825: +	    10.[0123])
11826: +	      func_append compile_command " $wl-bind_at_load"
11827: +	      func_append finalize_command " $wl-bind_at_load"
11828: +	    ;;
11829: +	  esac
11830: +	fi
11831: +	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
11832: +	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
11833: +	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
11834: +	;;
11835: +      esac
11836: +
11837: +
11838: +      # move library search paths that coincide with paths to not yet
11839: +      # installed libraries to the beginning of the library search list
11840: +      new_libs=
11841: +      for path in $notinst_path; do
11842: +	case " $new_libs " in
11843: +	*" -L$path/$objdir "*) ;;
11844: +	*)
11845: +	  case " $compile_deplibs " in
11846: +	  *" -L$path/$objdir "*)
11847: +	    func_append new_libs " -L$path/$objdir" ;;
11848: +	  esac
11849: +	  ;;
11850: +	esac
11851: +      done
11852: +      for deplib in $compile_deplibs; do
11853: +	case $deplib in
11854: +	-L*)
11855: +	  case " $new_libs " in
11856: +	  *" $deplib "*) ;;
11857: +	  *) func_append new_libs " $deplib" ;;
11858: +	  esac
11859: +	  ;;
11860: +	*) func_append new_libs " $deplib" ;;
11861: +	esac
11862: +      done
11863: +      compile_deplibs=$new_libs
11864: +
11865: +
11866: +      func_append compile_command " $compile_deplibs"
11867: +      func_append finalize_command " $finalize_deplibs"
11868: +
11869: +      if test -n "$rpath$xrpath"; then
11870: +	# If the user specified any rpath flags, then add them.
11871: +	for libdir in $rpath $xrpath; do
11872: +	  # This is the magic to use -rpath.
11873: +	  case "$finalize_rpath " in
11874: +	  *" $libdir "*) ;;
11875: +	  *) func_append finalize_rpath " $libdir" ;;
11876: +	  esac
11877: +	done
11878: +      fi
11879: +
11880: +      # Now hardcode the library paths
11881: +      rpath=
11882: +      hardcode_libdirs=
11883: +      for libdir in $compile_rpath $finalize_rpath; do
11884: +	if test -n "$hardcode_libdir_flag_spec"; then
11885: +	  if test -n "$hardcode_libdir_separator"; then
11886: +	    if test -z "$hardcode_libdirs"; then
11887: +	      hardcode_libdirs=$libdir
11888: +	    else
11889: +	      # Just accumulate the unique libdirs.
11890: +	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
11891: +	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
11892: +		;;
11893: +	      *)
11894: +		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
11895: +		;;
11896: +	      esac
11897: +	    fi
11898: +	  else
11899: +	    eval flag=\"$hardcode_libdir_flag_spec\"
11900: +	    func_append rpath " $flag"
11901: +	  fi
11902: +	elif test -n "$runpath_var"; then
11903: +	  case "$perm_rpath " in
11904: +	  *" $libdir "*) ;;
11905: +	  *) func_append perm_rpath " $libdir" ;;
11906: +	  esac
11907: +	fi
11908: +	case $host in
11909: +	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
11910: +	  testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
11911: +	  case :$dllsearchpath: in
11912: +	  *":$libdir:"*) ;;
11913: +	  ::) dllsearchpath=$libdir;;
11914: +	  *) func_append dllsearchpath ":$libdir";;
11915: +	  esac
11916: +	  case :$dllsearchpath: in
11917: +	  *":$testbindir:"*) ;;
11918: +	  ::) dllsearchpath=$testbindir;;
11919: +	  *) func_append dllsearchpath ":$testbindir";;
11920: +	  esac
11921: +	  ;;
11922: +	esac
11923: +      done
11924: +      # Substitute the hardcoded libdirs into the rpath.
11925: +      if test -n "$hardcode_libdir_separator" &&
11926: +	 test -n "$hardcode_libdirs"; then
11927: +	libdir=$hardcode_libdirs
11928: +	eval rpath=\" $hardcode_libdir_flag_spec\"
11929: +      fi
11930: +      compile_rpath=$rpath
11931: +
11932: +      rpath=
11933: +      hardcode_libdirs=
11934: +      for libdir in $finalize_rpath; do
11935: +	if test -n "$hardcode_libdir_flag_spec"; then
11936: +	  if test -n "$hardcode_libdir_separator"; then
11937: +	    if test -z "$hardcode_libdirs"; then
11938: +	      hardcode_libdirs=$libdir
11939: +	    else
11940: +	      # Just accumulate the unique libdirs.
11941: +	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
11942: +	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
11943: +		;;
11944: +	      *)
11945: +		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
11946: +		;;
11947: +	      esac
11948: +	    fi
11949: +	  else
11950: +	    eval flag=\"$hardcode_libdir_flag_spec\"
11951: +	    func_append rpath " $flag"
11952: +	  fi
11953: +	elif test -n "$runpath_var"; then
11954: +	  case "$finalize_perm_rpath " in
11955: +	  *" $libdir "*) ;;
11956: +	  *) func_append finalize_perm_rpath " $libdir" ;;
11957: +	  esac
11958: +	fi
11959: +      done
11960: +      # Substitute the hardcoded libdirs into the rpath.
11961: +      if test -n "$hardcode_libdir_separator" &&
11962: +	 test -n "$hardcode_libdirs"; then
11963: +	libdir=$hardcode_libdirs
11964: +	eval rpath=\" $hardcode_libdir_flag_spec\"
11965: +      fi
11966: +      finalize_rpath=$rpath
11967: +
11968: +      if test -n "$libobjs" && test yes = "$build_old_libs"; then
11969: +	# Transform all the library objects into standard objects.
11970: +	compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
11971: +	finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
11972: +      fi
11973: +
11974: +      func_generate_dlsyms "$outputname" "@PROGRAM@" false
11975: +
11976: +      # template prelinking step
11977: +      if test -n "$prelink_cmds"; then
11978: +	func_execute_cmds "$prelink_cmds" 'exit $?'
11979: +      fi
11980: +
11981: +      wrappers_required=:
11982: +      case $host in
11983: +      *cegcc* | *mingw32ce*)
11984: +        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
11985: +        wrappers_required=false
11986: +        ;;
11987: +      *cygwin* | *mingw* )
11988: +        test yes = "$build_libtool_libs" || wrappers_required=false
11989: +        ;;
11990: +      *)
11991: +        if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
11992: +          wrappers_required=false
11993: +        fi
11994: +        ;;
11995: +      esac
11996: +      $wrappers_required || {
11997: +	# Replace the output file specification.
11998: +	compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
11999: +	link_command=$compile_command$compile_rpath
12000: +
12001: +	# We have no uninstalled library dependencies, so finalize right now.
12002: +	exit_status=0
12003: +	func_show_eval "$link_command" 'exit_status=$?'
12004: +
12005: +	if test -n "$postlink_cmds"; then
12006: +	  func_to_tool_file "$output"
12007: +	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
12008: +	  func_execute_cmds "$postlink_cmds" 'exit $?'
12009: +	fi
12010: +
12011: +	# Delete the generated files.
12012: +	if test -f "$output_objdir/${outputname}S.$objext"; then
12013: +	  func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
12014: +	fi
12015: +
12016: +	exit $exit_status
12017: +      }
12018: +
12019: +      if test -n "$compile_shlibpath$finalize_shlibpath"; then
12020: +	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
12021: +      fi
12022: +      if test -n "$finalize_shlibpath"; then
12023: +	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
12024: +      fi
12025: +
12026: +      compile_var=
12027: +      finalize_var=
12028: +      if test -n "$runpath_var"; then
12029: +	if test -n "$perm_rpath"; then
12030: +	  # We should set the runpath_var.
12031: +	  rpath=
12032: +	  for dir in $perm_rpath; do
12033: +	    func_append rpath "$dir:"
12034: +	  done
12035: +	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
12036: +	fi
12037: +	if test -n "$finalize_perm_rpath"; then
12038: +	  # We should set the runpath_var.
12039: +	  rpath=
12040: +	  for dir in $finalize_perm_rpath; do
12041: +	    func_append rpath "$dir:"
12042: +	  done
12043: +	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
12044: +	fi
12045: +      fi
12046: +
12047: +      if test yes = "$no_install"; then
12048: +	# We don't need to create a wrapper script.
12049: +	link_command=$compile_var$compile_command$compile_rpath
12050: +	# Replace the output file specification.
12051: +	link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
12052: +	# Delete the old output file.
12053: +	$opt_dry_run || $RM $output
12054: +	# Link the executable and exit
12055: +	func_show_eval "$link_command" 'exit $?'
12056: +
12057: +	if test -n "$postlink_cmds"; then
12058: +	  func_to_tool_file "$output"
12059: +	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
12060: +	  func_execute_cmds "$postlink_cmds" 'exit $?'
12061: +	fi
12062: +
12063: +	exit $EXIT_SUCCESS
12064: +      fi
12065: +
12066: +      case $hardcode_action,$fast_install in
12067: +        relink,*)
12068: +	  # Fast installation is not supported
12069: +	  link_command=$compile_var$compile_command$compile_rpath
12070: +	  relink_command=$finalize_var$finalize_command$finalize_rpath
12071: +
12072: +	  func_warning "this platform does not like uninstalled shared libraries"
12073: +	  func_warning "'$output' will be relinked during installation"
12074: +	  ;;
12075: +        *,yes)
12076: +	  link_command=$finalize_var$compile_command$finalize_rpath
12077: +	  relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
12078: +          ;;
12079: +	*,no)
12080: +	  link_command=$compile_var$compile_command$compile_rpath
12081: +	  relink_command=$finalize_var$finalize_command$finalize_rpath
12082: +          ;;
12083: +	*,needless)
12084: +	  link_command=$finalize_var$compile_command$finalize_rpath
12085: +	  relink_command=
12086: +          ;;
12087: +      esac
12088: +
12089: +      # Replace the output file specification.
12090: +      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
12091: +
12092: +      # Delete the old output files.
12093: +      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
12094: +
12095: +      func_show_eval "$link_command" 'exit $?'
12096: +
12097: +      if test -n "$postlink_cmds"; then
12098: +	func_to_tool_file "$output_objdir/$outputname"
12099: +	postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
12100: +	func_execute_cmds "$postlink_cmds" 'exit $?'
12101: +      fi
12102: +
12103: +      # Now create the wrapper script.
12104: +      func_verbose "creating $output"
12105: +
12106: +      # Quote the relink command for shipping.
12107: +      if test -n "$relink_command"; then
12108: +	# Preserve any variables that may affect compiler behavior
12109: +	for var in $variables_saved_for_relink; do
12110: +	  if eval test -z \"\${$var+set}\"; then
12111: +	    relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
12112: +	  elif eval var_value=\$$var; test -z "$var_value"; then
12113: +	    relink_command="$var=; export $var; $relink_command"
12114: +	  else
12115: +	    func_quote_for_eval "$var_value"
12116: +	    relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
12117: +	  fi
12118: +	done
12119: +	relink_command="(cd `pwd`; $relink_command)"
12120: +	relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
12121: +      fi
12122: +
12123: +      # Only actually do things if not in dry run mode.
12124: +      $opt_dry_run || {
12125: +	# win32 will think the script is a binary if it has
12126: +	# a .exe suffix, so we strip it off here.
12127: +	case $output in
12128: +	  *.exe) func_stripname '' '.exe' "$output"
12129: +	         output=$func_stripname_result ;;
12130: +	esac
12131: +	# test for cygwin because mv fails w/o .exe extensions
12132: +	case $host in
12133: +	  *cygwin*)
12134: +	    exeext=.exe
12135: +	    func_stripname '' '.exe' "$outputname"
12136: +	    outputname=$func_stripname_result ;;
12137: +	  *) exeext= ;;
12138: +	esac
12139: +	case $host in
12140: +	  *cygwin* | *mingw* )
12141: +	    func_dirname_and_basename "$output" "" "."
12142: +	    output_name=$func_basename_result
12143: +	    output_path=$func_dirname_result
12144: +	    cwrappersource=$output_path/$objdir/lt-$output_name.c
12145: +	    cwrapper=$output_path/$output_name.exe
12146: +	    $RM $cwrappersource $cwrapper
12147: +	    trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
12148: +
12149: +	    func_emit_cwrapperexe_src > $cwrappersource
12150: +
12151: +	    # The wrapper executable is built using the $host compiler,
12152: +	    # because it contains $host paths and files. If cross-
12153: +	    # compiling, it, like the target executable, must be
12154: +	    # executed on the $host or under an emulation environment.
12155: +	    $opt_dry_run || {
12156: +	      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
12157: +	      $STRIP $cwrapper
12158: +	    }
12159: +
12160: +	    # Now, create the wrapper script for func_source use:
12161: +	    func_ltwrapper_scriptname $cwrapper
12162: +	    $RM $func_ltwrapper_scriptname_result
12163: +	    trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
12164: +	    $opt_dry_run || {
12165: +	      # note: this script will not be executed, so do not chmod.
12166: +	      if test "x$build" = "x$host"; then
12167: +		$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
12168: +	      else
12169: +		func_emit_wrapper no > $func_ltwrapper_scriptname_result
12170: +	      fi
12171: +	    }
12172: +	  ;;
12173: +	  * )
12174: +	    $RM $output
12175: +	    trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
12176: +
12177: +	    func_emit_wrapper no > $output
12178: +	    chmod +x $output
12179: +	  ;;
12180: +	esac
12181: +      }
12182: +      exit $EXIT_SUCCESS
12183: +      ;;
12184: +    esac
12185: +
12186: +    # See if we need to build an old-fashioned archive.
12187: +    for oldlib in $oldlibs; do
12188: +
12189: +      case $build_libtool_libs in
12190: +        convenience)
12191: +	  oldobjs="$libobjs_save $symfileobj"
12192: +	  addlibs=$convenience
12193: +	  build_libtool_libs=no
12194: +	  ;;
12195: +	module)
12196: +	  oldobjs=$libobjs_save
12197: +	  addlibs=$old_convenience
12198: +	  build_libtool_libs=no
12199: +          ;;
12200: +	*)
12201: +	  oldobjs="$old_deplibs $non_pic_objects"
12202: +	  $preload && test -f "$symfileobj" \
12203: +	    && func_append oldobjs " $symfileobj"
12204: +	  addlibs=$old_convenience
12205: +	  ;;
12206: +      esac
12207: +
12208: +      if test -n "$addlibs"; then
12209: +	gentop=$output_objdir/${outputname}x
12210: +	func_append generated " $gentop"
12211: +
12212: +	func_extract_archives $gentop $addlibs
12213: +	func_append oldobjs " $func_extract_archives_result"
12214: +      fi
12215: +
12216: +      # Do each command in the archive commands.
12217: +      if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
12218: +	cmds=$old_archive_from_new_cmds
12219: +      else
12220: +
12221: +	# Add any objects from preloaded convenience libraries
12222: +	if test -n "$dlprefiles"; then
12223: +	  gentop=$output_objdir/${outputname}x
12224: +	  func_append generated " $gentop"
12225: +
12226: +	  func_extract_archives $gentop $dlprefiles
12227: +	  func_append oldobjs " $func_extract_archives_result"
12228: +	fi
12229: +
12230: +	# POSIX demands no paths to be encoded in archives.  We have
12231: +	# to avoid creating archives with duplicate basenames if we
12232: +	# might have to extract them afterwards, e.g., when creating a
12233: +	# static archive out of a convenience library, or when linking
12234: +	# the entirety of a libtool archive into another (currently
12235: +	# not supported by libtool).
12236: +	if (for obj in $oldobjs
12237: +	    do
12238: +	      func_basename "$obj"
12239: +	      $ECHO "$func_basename_result"
12240: +	    done | sort | sort -uc >/dev/null 2>&1); then
12241: +	  :
12242: +	else
12243: +	  echo "copying selected object files to avoid basename conflicts..."
12244: +	  gentop=$output_objdir/${outputname}x
12245: +	  func_append generated " $gentop"
12246: +	  func_mkdir_p "$gentop"
12247: +	  save_oldobjs=$oldobjs
12248: +	  oldobjs=
12249: +	  counter=1
12250: +	  for obj in $save_oldobjs
12251: +	  do
12252: +	    func_basename "$obj"
12253: +	    objbase=$func_basename_result
12254: +	    case " $oldobjs " in
12255: +	    " ") oldobjs=$obj ;;
12256: +	    *[\ /]"$objbase "*)
12257: +	      while :; do
12258: +		# Make sure we don't pick an alternate name that also
12259: +		# overlaps.
12260: +		newobj=lt$counter-$objbase
12261: +		func_arith $counter + 1
12262: +		counter=$func_arith_result
12263: +		case " $oldobjs " in
12264: +		*[\ /]"$newobj "*) ;;
12265: +		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
12266: +		esac
12267: +	      done
12268: +	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
12269: +	      func_append oldobjs " $gentop/$newobj"
12270: +	      ;;
12271: +	    *) func_append oldobjs " $obj" ;;
12272: +	    esac
12273: +	  done
12274: +	fi
12275: +	func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
12276: +	tool_oldlib=$func_to_tool_file_result
12277: +	eval cmds=\"$old_archive_cmds\"
12278: +
12279: +	func_len " $cmds"
12280: +	len=$func_len_result
12281: +	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
12282: +	  cmds=$old_archive_cmds
12283: +	elif test -n "$archiver_list_spec"; then
12284: +	  func_verbose "using command file archive linking..."
12285: +	  for obj in $oldobjs
12286: +	  do
12287: +	    func_to_tool_file "$obj"
12288: +	    $ECHO "$func_to_tool_file_result"
12289: +	  done > $output_objdir/$libname.libcmd
12290: +	  func_to_tool_file "$output_objdir/$libname.libcmd"
12291: +	  oldobjs=" $archiver_list_spec$func_to_tool_file_result"
12292: +	  cmds=$old_archive_cmds
12293: +	else
12294: +	  # the command line is too long to link in one step, link in parts
12295: +	  func_verbose "using piecewise archive linking..."
12296: +	  save_RANLIB=$RANLIB
12297: +	  RANLIB=:
12298: +	  objlist=
12299: +	  concat_cmds=
12300: +	  save_oldobjs=$oldobjs
12301: +	  oldobjs=
12302: +	  # Is there a better way of finding the last object in the list?
12303: +	  for obj in $save_oldobjs
12304: +	  do
12305: +	    last_oldobj=$obj
12306: +	  done
12307: +	  eval test_cmds=\"$old_archive_cmds\"
12308: +	  func_len " $test_cmds"
12309: +	  len0=$func_len_result
12310: +	  len=$len0
12311: +	  for obj in $save_oldobjs
12312: +	  do
12313: +	    func_len " $obj"
12314: +	    func_arith $len + $func_len_result
12315: +	    len=$func_arith_result
12316: +	    func_append objlist " $obj"
12317: +	    if test "$len" -lt "$max_cmd_len"; then
12318: +	      :
12319: +	    else
12320: +	      # the above command should be used before it gets too long
12321: +	      oldobjs=$objlist
12322: +	      if test "$obj" = "$last_oldobj"; then
12323: +		RANLIB=$save_RANLIB
12324: +	      fi
12325: +	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
12326: +	      eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
12327: +	      objlist=
12328: +	      len=$len0
12329: +	    fi
12330: +	  done
12331: +	  RANLIB=$save_RANLIB
12332: +	  oldobjs=$objlist
12333: +	  if test -z "$oldobjs"; then
12334: +	    eval cmds=\"\$concat_cmds\"
12335: +	  else
12336: +	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
12337: +	  fi
12338: +	fi
12339: +      fi
12340: +      func_execute_cmds "$cmds" 'exit $?'
12341: +    done
12342: +
12343: +    test -n "$generated" && \
12344: +      func_show_eval "${RM}r$generated"
12345: +
12346: +    # Now create the libtool archive.
12347: +    case $output in
12348: +    *.la)
12349: +      old_library=
12350: +      test yes = "$build_old_libs" && old_library=$libname.$libext
12351: +      func_verbose "creating $output"
12352: +
12353: +      # Preserve any variables that may affect compiler behavior
12354: +      for var in $variables_saved_for_relink; do
12355: +	if eval test -z \"\${$var+set}\"; then
12356: +	  relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
12357: +	elif eval var_value=\$$var; test -z "$var_value"; then
12358: +	  relink_command="$var=; export $var; $relink_command"
12359: +	else
12360: +	  func_quote_for_eval "$var_value"
12361: +	  relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
12362: +	fi
12363: +      done
12364: +      # Quote the link command for shipping.
12365: +      relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
12366: +      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
12367: +      if test yes = "$hardcode_automatic"; then
12368: +	relink_command=
12369: +      fi
12370: +
12371: +      # Only create the output if not a dry run.
12372: +      $opt_dry_run || {
12373: +	for installed in no yes; do
12374: +	  if test yes = "$installed"; then
12375: +	    if test -z "$install_libdir"; then
12376: +	      break
12377: +	    fi
12378: +	    output=$output_objdir/${outputname}i
12379: +	    # Replace all uninstalled libtool libraries with the installed ones
12380: +	    newdependency_libs=
12381: +	    for deplib in $dependency_libs; do
12382: +	      case $deplib in
12383: +	      *.la)
12384: +		func_basename "$deplib"
12385: +		name=$func_basename_result
12386: +		func_resolve_sysroot "$deplib"
12387: +		eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
12388: +		test -z "$libdir" && \
12389: +		  func_fatal_error "'$deplib' is not a valid libtool archive"
12390: +		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
12391: +		;;
12392: +	      -L*)
12393: +		func_stripname -L '' "$deplib"
12394: +		func_replace_sysroot "$func_stripname_result"
12395: +		func_append newdependency_libs " -L$func_replace_sysroot_result"
12396: +		;;
12397: +	      -R*)
12398: +		func_stripname -R '' "$deplib"
12399: +		func_replace_sysroot "$func_stripname_result"
12400: +		func_append newdependency_libs " -R$func_replace_sysroot_result"
12401: +		;;
12402: +	      *) func_append newdependency_libs " $deplib" ;;
12403: +	      esac
12404: +	    done
12405: +	    dependency_libs=$newdependency_libs
12406: +	    newdlfiles=
12407: +
12408: +	    for lib in $dlfiles; do
12409: +	      case $lib in
12410: +	      *.la)
12411: +	        func_basename "$lib"
12412: +		name=$func_basename_result
12413: +		eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
12414: +		test -z "$libdir" && \
12415: +		  func_fatal_error "'$lib' is not a valid libtool archive"
12416: +		func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
12417: +		;;
12418: +	      *) func_append newdlfiles " $lib" ;;
12419: +	      esac
12420: +	    done
12421: +	    dlfiles=$newdlfiles
12422: +	    newdlprefiles=
12423: +	    for lib in $dlprefiles; do
12424: +	      case $lib in
12425: +	      *.la)
12426: +		# Only pass preopened files to the pseudo-archive (for
12427: +		# eventual linking with the app. that links it) if we
12428: +		# didn't already link the preopened objects directly into
12429: +		# the library:
12430: +		func_basename "$lib"
12431: +		name=$func_basename_result
12432: +		eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
12433: +		test -z "$libdir" && \
12434: +		  func_fatal_error "'$lib' is not a valid libtool archive"
12435: +		func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
12436: +		;;
12437: +	      esac
12438: +	    done
12439: +	    dlprefiles=$newdlprefiles
12440: +	  else
12441: +	    newdlfiles=
12442: +	    for lib in $dlfiles; do
12443: +	      case $lib in
12444: +		[\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
12445: +		*) abs=`pwd`"/$lib" ;;
12446: +	      esac
12447: +	      func_append newdlfiles " $abs"
12448: +	    done
12449: +	    dlfiles=$newdlfiles
12450: +	    newdlprefiles=
12451: +	    for lib in $dlprefiles; do
12452: +	      case $lib in
12453: +		[\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
12454: +		*) abs=`pwd`"/$lib" ;;
12455: +	      esac
12456: +	      func_append newdlprefiles " $abs"
12457: +	    done
12458: +	    dlprefiles=$newdlprefiles
12459: +	  fi
12460: +	  $RM $output
12461: +	  # place dlname in correct position for cygwin
12462: +	  # In fact, it would be nice if we could use this code for all target
12463: +	  # systems that can't hard-code library paths into their executables
12464: +	  # and that have no shared library path variable independent of PATH,
12465: +	  # but it turns out we can't easily determine that from inspecting
12466: +	  # libtool variables, so we have to hard-code the OSs to which it
12467: +	  # applies here; at the moment, that means platforms that use the PE
12468: +	  # object format with DLL files.  See the long comment at the top of
12469: +	  # tests/bindir.at for full details.
12470: +	  tdlname=$dlname
12471: +	  case $host,$output,$installed,$module,$dlname in
12472: +	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
12473: +	      # If a -bindir argument was supplied, place the dll there.
12474: +	      if test -n "$bindir"; then
12475: +		func_relative_path "$install_libdir" "$bindir"
12476: +		tdlname=$func_relative_path_result/$dlname
12477: +	      else
12478: +		# Otherwise fall back on heuristic.
12479: +		tdlname=../bin/$dlname
12480: +	      fi
12481: +	      ;;
12482: +	  esac
12483: +	  $ECHO > $output "\
12484: +# $outputname - a libtool library file
12485: +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
12486: +#
12487: +# Please DO NOT delete this file!
12488: +# It is necessary for linking the library.
12489: +
12490: +# The name that we can dlopen(3).
12491: +dlname='$tdlname'
12492: +
12493: +# Names of this library.
12494: +library_names='$library_names'
12495: +
12496: +# The name of the static archive.
12497: +old_library='$old_library'
12498: +
12499: +# Linker flags that cannot go in dependency_libs.
12500: +inherited_linker_flags='$new_inherited_linker_flags'
12501: +
12502: +# Libraries that this one depends upon.
12503: +dependency_libs='$dependency_libs'
12504: +
12505: +# Names of additional weak libraries provided by this library
12506: +weak_library_names='$weak_libs'
12507: +
12508: +# Version information for $libname.
12509: +current=$current
12510: +age=$age
12511: +revision=$revision
12512: +
12513: +# Is this an already installed library?
12514: +installed=$installed
12515: +
12516: +# Should we warn about portability when linking against -modules?
12517: +shouldnotlink=$module
12518: +
12519: +# Files to dlopen/dlpreopen
12520: +dlopen='$dlfiles'
12521: +dlpreopen='$dlprefiles'
12522: +
12523: +# Directory that this library needs to be installed in:
12524: +libdir='$install_libdir'"
12525: +	  if test no,yes = "$installed,$need_relink"; then
12526: +	    $ECHO >> $output "\
12527: +relink_command=\"$relink_command\""
12528: +	  fi
12529: +	done
12530: +      }
12531: +
12532: +      # Do a symbolic link so that the libtool archive can be found in
12533: +      # LD_LIBRARY_PATH before the program is installed.
12534: +      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
12535: +      ;;
12536: +    esac
12537: +    exit $EXIT_SUCCESS
12538: +}
12539: +
12540: +if test link = "$opt_mode" || test relink = "$opt_mode"; then
12541: +  func_mode_link ${1+"$@"}
12542: +fi
12543: +
12544: +
12545: +# func_mode_uninstall arg...
12546: +func_mode_uninstall ()
12547: +{
12548: +    $debug_cmd
12549: +
12550: +    RM=$nonopt
12551: +    files=
12552: +    rmforce=false
12553: +    exit_status=0
12554: +
12555: +    # This variable tells wrapper scripts just to set variables rather
12556: +    # than running their programs.
12557: +    libtool_install_magic=$magic
12558: +
12559: +    for arg
12560: +    do
12561: +      case $arg in
12562: +      -f) func_append RM " $arg"; rmforce=: ;;
12563: +      -*) func_append RM " $arg" ;;
12564: +      *) func_append files " $arg" ;;
12565: +      esac
12566: +    done
12567: +
12568: +    test -z "$RM" && \
12569: +      func_fatal_help "you must specify an RM program"
12570: +
12571: +    rmdirs=
12572: +
12573: +    for file in $files; do
12574: +      func_dirname "$file" "" "."
12575: +      dir=$func_dirname_result
12576: +      if test . = "$dir"; then
12577: +	odir=$objdir
12578: +      else
12579: +	odir=$dir/$objdir
12580: +      fi
12581: +      func_basename "$file"
12582: +      name=$func_basename_result
12583: +      test uninstall = "$opt_mode" && odir=$dir
12584: +
12585: +      # Remember odir for removal later, being careful to avoid duplicates
12586: +      if test clean = "$opt_mode"; then
12587: +	case " $rmdirs " in
12588: +	  *" $odir "*) ;;
12589: +	  *) func_append rmdirs " $odir" ;;
12590: +	esac
12591: +      fi
12592: +
12593: +      # Don't error if the file doesn't exist and rm -f was used.
12594: +      if { test -L "$file"; } >/dev/null 2>&1 ||
12595: +	 { test -h "$file"; } >/dev/null 2>&1 ||
12596: +	 test -f "$file"; then
12597: +	:
12598: +      elif test -d "$file"; then
12599: +	exit_status=1
12600: +	continue
12601: +      elif $rmforce; then
12602: +	continue
12603: +      fi
12604: +
12605: +      rmfiles=$file
12606: +
12607: +      case $name in
12608: +      *.la)
12609: +	# Possibly a libtool archive, so verify it.
12610: +	if func_lalib_p "$file"; then
12611: +	  func_source $dir/$name
12612: +
12613: +	  # Delete the libtool libraries and symlinks.
12614: +	  for n in $library_names; do
12615: +	    func_append rmfiles " $odir/$n"
12616: +	  done
12617: +	  test -n "$old_library" && func_append rmfiles " $odir/$old_library"
12618: +
12619: +	  case $opt_mode in
12620: +	  clean)
12621: +	    case " $library_names " in
12622: +	    *" $dlname "*) ;;
12623: +	    *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
12624: +	    esac
12625: +	    test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
12626: +	    ;;
12627: +	  uninstall)
12628: +	    if test -n "$library_names"; then
12629: +	      # Do each command in the postuninstall commands.
12630: +	      func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
12631: +	    fi
12632: +
12633: +	    if test -n "$old_library"; then
12634: +	      # Do each command in the old_postuninstall commands.
12635: +	      func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
12636: +	    fi
12637: +	    # FIXME: should reinstall the best remaining shared library.
12638: +	    ;;
12639: +	  esac
12640: +	fi
12641: +	;;
12642: +
12643: +      *.lo)
12644: +	# Possibly a libtool object, so verify it.
12645: +	if func_lalib_p "$file"; then
12646: +
12647: +	  # Read the .lo file
12648: +	  func_source $dir/$name
12649: +
12650: +	  # Add PIC object to the list of files to remove.
12651: +	  if test -n "$pic_object" && test none != "$pic_object"; then
12652: +	    func_append rmfiles " $dir/$pic_object"
12653: +	  fi
12654: +
12655: +	  # Add non-PIC object to the list of files to remove.
12656: +	  if test -n "$non_pic_object" && test none != "$non_pic_object"; then
12657: +	    func_append rmfiles " $dir/$non_pic_object"
12658: +	  fi
12659: +	fi
12660: +	;;
12661: +
12662: +      *)
12663: +	if test clean = "$opt_mode"; then
12664: +	  noexename=$name
12665: +	  case $file in
12666: +	  *.exe)
12667: +	    func_stripname '' '.exe' "$file"
12668: +	    file=$func_stripname_result
12669: +	    func_stripname '' '.exe' "$name"
12670: +	    noexename=$func_stripname_result
12671: +	    # $file with .exe has already been added to rmfiles,
12672: +	    # add $file without .exe
12673: +	    func_append rmfiles " $file"
12674: +	    ;;
12675: +	  esac
12676: +	  # Do a test to see if this is a libtool program.
12677: +	  if func_ltwrapper_p "$file"; then
12678: +	    if func_ltwrapper_executable_p "$file"; then
12679: +	      func_ltwrapper_scriptname "$file"
12680: +	      relink_command=
12681: +	      func_source $func_ltwrapper_scriptname_result
12682: +	      func_append rmfiles " $func_ltwrapper_scriptname_result"
12683: +	    else
12684: +	      relink_command=
12685: +	      func_source $dir/$noexename
12686: +	    fi
12687: +
12688: +	    # note $name still contains .exe if it was in $file originally
12689: +	    # as does the version of $file that was added into $rmfiles
12690: +	    func_append rmfiles " $odir/$name $odir/${name}S.$objext"
12691: +	    if test yes = "$fast_install" && test -n "$relink_command"; then
12692: +	      func_append rmfiles " $odir/lt-$name"
12693: +	    fi
12694: +	    if test "X$noexename" != "X$name"; then
12695: +	      func_append rmfiles " $odir/lt-$noexename.c"
12696: +	    fi
12697: +	  fi
12698: +	fi
12699: +	;;
12700: +      esac
12701: +      func_show_eval "$RM $rmfiles" 'exit_status=1'
12702: +    done
12703: +
12704: +    # Try to remove the $objdir's in the directories where we deleted files
12705: +    for dir in $rmdirs; do
12706: +      if test -d "$dir"; then
12707: +	func_show_eval "rmdir $dir >/dev/null 2>&1"
12708: +      fi
12709: +    done
12710: +
12711: +    exit $exit_status
12712: +}
12713: +
12714: +if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
12715: +  func_mode_uninstall ${1+"$@"}
12716: +fi
12717: +
12718: +test -z "$opt_mode" && {
12719: +  help=$generic_help
12720: +  func_fatal_help "you must specify a MODE"
12721: +}
12722: +
12723: +test -z "$exec_cmd" && \
12724: +  func_fatal_help "invalid operation mode '$opt_mode'"
12725: +
12726: +if test -n "$exec_cmd"; then
12727: +  eval exec "$exec_cmd"
12728: +  exit $EXIT_FAILURE
12729: +fi
12730: +
12731: +exit $exit_status
12732: +
12733: +
12734: +# The TAGs below are defined such that we never get into a situation
12735: +# where we disable both kinds of libraries.  Given conflicting
12736: +# choices, we go for a static library, that is the most portable,
12737: +# since we can't tell whether shared libraries were disabled because
12738: +# the user asked for that or because the platform doesn't support
12739: +# them.  This is particularly important on AIX, because we don't
12740: +# support having both static and shared libraries enabled at the same
12741: +# time on that platform, so we default to a shared-only configuration.
12742: +# If a disable-shared tag is given, we'll fallback to a static-only
12743: +# configuration.  But we'll never go from static-only to shared-only.
12744: +
12745: +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
12746: +build_libtool_libs=no
12747: +build_old_libs=yes
12748: +# ### END LIBTOOL TAG CONFIG: disable-shared
12749: +
12750: +# ### BEGIN LIBTOOL TAG CONFIG: disable-static
12751: +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
12752: +# ### END LIBTOOL TAG CONFIG: disable-static
12753: +
12754: +# Local Variables:
12755: +# mode:shell-script
12756: +# sh-indentation:2
12757: +# End:
12758: diff --git a/m4/require_liblac.m4 b/m4/require_liblac.m4
12759: new file mode 100644
12760: index 0000000..252cd37
12761: --- /dev/null
12762: +++ b/m4/require_liblac.m4
12763: @@ -0,0 +1,12 @@
12764: +# liblac.m4 serial 1
12765: +dnl Copyright (C) 2017 Gianluca Guida.
12766: +dnl This file is free software; the author gives unlimited
12767: +dnl permission to copy and/or distribute it, with or without
12768: +dnl modifications, as long as this notice is preserved.
12769: +
12770: +AC_DEFUN([REQUIRE_LIBLAC],
12771: +[
12772: +  AC_LIB_HAVE_LINKFLAGS([lac], [],
12773: +    [#include <lac.h>], [lac_init();],
12774: +    AC_MSG_ERROR([requires liblac]))
12775: +])
12776: diff --git a/m4/std-gnu11.m4 b/m4/std-gnu11.m4
12777: new file mode 100644
12778: index 0000000..9dae9b1
12779: --- /dev/null
12780: +++ b/m4/std-gnu11.m4
12781: @@ -0,0 +1,824 @@
12782: +# Prefer GNU C11 and C++11 to earlier versions.  -*- coding: utf-8 -*-
12783: +
12784: +# This implementation is taken from GNU Autoconf lib/autoconf/c.m4
12785: +# commit 017d5ddd82854911f0119691d91ea8a1438824d6
12786: +# dated Sun Apr 3 13:57:17 2016 -0700
12787: +# This implementation will be obsolete once we can assume Autoconf 2.70
12788: +# or later is installed everywhere a Gnulib program might be developed.
12789: +
12790: +
12791: +# Copyright (C) 2001-2017 Free Software Foundation, Inc.
12792: +
12793: +# This program is free software; you can redistribute it and/or modify
12794: +# it under the terms of the GNU General Public License as published by
12795: +# the Free Software Foundation, either version 3 of the License, or
12796: +# (at your option) any later version.
12797: +#
12798: +# This program is distributed in the hope that it will be useful,
12799: +# but WITHOUT ANY WARRANTY; without even the implied warranty of
12800: +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12801: +# GNU General Public License for more details.
12802: +#
12803: +# You should have received a copy of the GNU General Public License
12804: +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
12805: +
12806: +# Written by David MacKenzie, with help from
12807: +# Akim Demaille, Paul Eggert,
12808: +# François Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
12809: +# Roland McGrath, Noah Friedman, david d zuhn, and many others.
12810: +
12811: +
12812: +# AC_PROG_CC([COMPILER ...])
12813: +# --------------------------
12814: +# COMPILER ... is a space separated list of C compilers to search for.
12815: +# This just gives the user an opportunity to specify an alternative
12816: +# search list for the C compiler.
12817: +AC_DEFUN_ONCE([AC_PROG_CC],
12818: +[AC_LANG_PUSH(C)dnl
12819: +AC_ARG_VAR([CC],     [C compiler command])dnl
12820: +AC_ARG_VAR([CFLAGS], [C compiler flags])dnl
12821: +_AC_ARG_VAR_LDFLAGS()dnl
12822: +_AC_ARG_VAR_LIBS()dnl
12823: +_AC_ARG_VAR_CPPFLAGS()dnl
12824: +m4_ifval([$1],
12825: +      [AC_CHECK_TOOLS(CC, [$1])],
12826: +[AC_CHECK_TOOL(CC, gcc)
12827: +if test -z "$CC"; then
12828: +  dnl Here we want:
12829: +  dnl	AC_CHECK_TOOL(CC, cc)
12830: +  dnl but without the check for a tool without the prefix.
12831: +  dnl Until the check is removed from there, copy the code:
12832: +  if test -n "$ac_tool_prefix"; then
12833: +    AC_CHECK_PROG(CC, [${ac_tool_prefix}cc], [${ac_tool_prefix}cc])
12834: +  fi
12835: +fi
12836: +if test -z "$CC"; then
12837: +  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
12838: +fi
12839: +if test -z "$CC"; then
12840: +  AC_CHECK_TOOLS(CC, cl.exe)
12841: +fi
12842: +if test -z "$CC"; then
12843: +  AC_CHECK_TOOL(CC, clang)
12844: +fi
12845: +])
12846: +
12847: +test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH])
12848: +
12849: +# Provide some information about the compiler.
12850: +_AS_ECHO_LOG([checking for _AC_LANG compiler version])
12851: +set X $ac_compile
12852: +ac_compiler=$[2]
12853: +for ac_option in --version -v -V -qversion -version; do
12854: +  _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
12855: +done
12856: +
12857: +m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
12858: +m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
12859: +_AC_LANG_COMPILER_GNU
12860: +if test $ac_compiler_gnu = yes; then
12861: +  GCC=yes
12862: +else
12863: +  GCC=
12864: +fi
12865: +_AC_PROG_CC_G
12866: +dnl
12867: +dnl Set ac_prog_cc_stdc to the supported C version.
12868: +dnl Also set the documented variable ac_cv_prog_cc_stdc;
12869: +dnl its name was chosen when it was cached, but it is no longer cached.
12870: +_AC_PROG_CC_C11([ac_prog_cc_stdc=c11
12871: +		 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11],
12872: +  [_AC_PROG_CC_C99([ac_prog_cc_stdc=c99
12873: +		    ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99],
12874: +     [_AC_PROG_CC_C89([ac_prog_cc_stdc=c89
12875: +		       ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89],
12876: +		      [ac_prog_cc_stdc=no
12877: +		       ac_cv_prog_cc_stdc=no])])])
12878: +dnl
12879: +AC_LANG_POP(C)dnl
12880: +])# AC_PROG_CC
12881: +
12882: +
12883: +
12884: +# AC_PROG_CXX([LIST-OF-COMPILERS])
12885: +# --------------------------------
12886: +# LIST-OF-COMPILERS is a space separated list of C++ compilers to search
12887: +# for (if not specified, a default list is used).  This just gives the
12888: +# user an opportunity to specify an alternative search list for the C++
12889: +# compiler.
12890: +# aCC	HP-UX C++ compiler much better than `CC', so test before.
12891: +# FCC   Fujitsu C++ compiler
12892: +# KCC	KAI C++ compiler
12893: +# RCC	Rational C++
12894: +# xlC_r	AIX C Set++ (with support for reentrant code)
12895: +# xlC	AIX C Set++
12896: +AC_DEFUN([AC_PROG_CXX],
12897: +[AC_LANG_PUSH(C++)dnl
12898: +AC_ARG_VAR([CXX],      [C++ compiler command])dnl
12899: +AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])dnl
12900: +_AC_ARG_VAR_LDFLAGS()dnl
12901: +_AC_ARG_VAR_LIBS()dnl
12902: +_AC_ARG_VAR_CPPFLAGS()dnl
12903: +_AC_ARG_VAR_PRECIOUS([CCC])dnl
12904: +if test -z "$CXX"; then
12905: +  if test -n "$CCC"; then
12906: +    CXX=$CCC
12907: +  else
12908: +    AC_CHECK_TOOLS(CXX,
12909: +		   [m4_default([$1],
12910: +			       [g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++])],
12911: +		   g++)
12912: +  fi
12913: +fi
12914: +# Provide some information about the compiler.
12915: +_AS_ECHO_LOG([checking for _AC_LANG compiler version])
12916: +set X $ac_compile
12917: +ac_compiler=$[2]
12918: +for ac_option in --version -v -V -qversion; do
12919: +  _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
12920: +done
12921: +
12922: +m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
12923: +m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
12924: +_AC_LANG_COMPILER_GNU
12925: +if test $ac_compiler_gnu = yes; then
12926: +  GXX=yes
12927: +else
12928: +  GXX=
12929: +fi
12930: +_AC_PROG_CXX_G
12931: +_AC_PROG_CXX_CXX11([ac_prog_cxx_stdcxx=cxx11
12932: +		    ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11
12933: +		    ac_cv_prog_cxx_cxx98=$ac_cv_prog_cxx_cxx11],
12934: +   [_AC_PROG_CXX_CXX98([ac_prog_cxx_stdcxx=cxx98
12935: +		        ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98],
12936: +		       [ac_prog_cxx_stdcxx=no
12937: +		        ac_cv_prog_cxx_stdcxx=no])])
12938: +AC_LANG_POP(C++)dnl
12939: +])# AC_PROG_CXX
12940: +
12941: +
12942: +# _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST,
12943: +#		ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE)
12944: +# --------------------------------------------------------------
12945: +# Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99')
12946: +# by trying to compile a program of TEST-PROLOGUE and TEST-BODY.  If this fails,
12947: +# try again with each compiler option in the space-separated OPTION-LIST; if one
12948: +# helps, append it to CC.  If eventually successful, run ACTION-IF-AVAILABLE,
12949: +# else ACTION-IF-UNAVAILABLE.
12950: +AC_DEFUN([_AC_C_STD_TRY],
12951: +[AC_MSG_CHECKING([for $CC option to enable ]m4_translit($1, [c], [C])[ features])
12952: +AC_CACHE_VAL(ac_cv_prog_cc_$1,
12953: +[ac_cv_prog_cc_$1=no
12954: +ac_save_CC=$CC
12955: +AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
12956: +for ac_arg in '' $4
12957: +do
12958: +  CC="$ac_save_CC $ac_arg"
12959: +  _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg])
12960: +  test "x$ac_cv_prog_cc_$1" != "xno" && break
12961: +done
12962: +rm -f conftest.$ac_ext
12963: +CC=$ac_save_CC
12964: +])# AC_CACHE_VAL
12965: +ac_prog_cc_stdc_options=
12966: +case "x$ac_cv_prog_cc_$1" in
12967: +  x)
12968: +    AC_MSG_RESULT([none needed]) ;;
12969: +  xno)
12970: +    AC_MSG_RESULT([unsupported]) ;;
12971: +  *)
12972: +    ac_prog_cc_stdc_options=" $ac_cv_prog_cc_$1"
12973: +    CC=$CC$ac_prog_cc_stdc_options
12974: +    AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;;
12975: +esac
12976: +AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6])
12977: +])# _AC_C_STD_TRY
12978: +
12979: +# _AC_C_C99_TEST_HEADER
12980: +# ---------------------
12981: +# A C header suitable for testing for C99.
12982: +AC_DEFUN([_AC_C_C99_TEST_HEADER],
12983: +[[#include <stdarg.h>
12984: +#include <stdbool.h>
12985: +#include <stddef.h>
12986: +#include <stdlib.h>
12987: +#include <wchar.h>
12988: +#include <stdio.h>
12989: +
12990: +// Check varargs macros.  These examples are taken from C99 6.10.3.5.
12991: +#define debug(...) fprintf (stderr, __VA_ARGS__)
12992: +#define showlist(...) puts (#__VA_ARGS__)
12993: +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
12994: +static void
12995: +test_varargs_macros (void)
12996: +{
12997: +  int x = 1234;
12998: +  int y = 5678;
12999: +  debug ("Flag");
13000: +  debug ("X = %d\n", x);
13001: +  showlist (The first, second, and third items.);
13002: +  report (x>y, "x is %d but y is %d", x, y);
13003: +}
13004: +
13005: +// Check long long types.
13006: +#define BIG64 18446744073709551615ull
13007: +#define BIG32 4294967295ul
13008: +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
13009: +#if !BIG_OK
13010: +  your preprocessor is broken;
13011: +#endif
13012: +#if BIG_OK
13013: +#else
13014: +  your preprocessor is broken;
13015: +#endif
13016: +static long long int bignum = -9223372036854775807LL;
13017: +static unsigned long long int ubignum = BIG64;
13018: +
13019: +struct incomplete_array
13020: +{
13021: +  int datasize;
13022: +  double data[];
13023: +};
13024: +
13025: +struct named_init {
13026: +  int number;
13027: +  const wchar_t *name;
13028: +  double average;
13029: +};
13030: +
13031: +typedef const char *ccp;
13032: +
13033: +static inline int
13034: +test_restrict (ccp restrict text)
13035: +{
13036: +  // See if C++-style comments work.
13037: +  // Iterate through items via the restricted pointer.
13038: +  // Also check for declarations in for loops.
13039: +  for (unsigned int i = 0; *(text+i) != '\0'; ++i)
13040: +    continue;
13041: +  return 0;
13042: +}
13043: +
13044: +// Check varargs and va_copy.
13045: +static bool
13046: +test_varargs (const char *format, ...)
13047: +{
13048: +  va_list args;
13049: +  va_start (args, format);
13050: +  va_list args_copy;
13051: +  va_copy (args_copy, args);
13052: +
13053: +  const char *str = "";
13054: +  int number = 0;
13055: +  float fnumber = 0;
13056: +
13057: +  while (*format)
13058: +    {
13059: +      switch (*format++)
13060: +	{
13061: +	case 's': // string
13062: +	  str = va_arg (args_copy, const char *);
13063: +	  break;
13064: +	case 'd': // int
13065: +	  number = va_arg (args_copy, int);
13066: +	  break;
13067: +	case 'f': // float
13068: +	  fnumber = va_arg (args_copy, double);
13069: +	  break;
13070: +	default:
13071: +	  break;
13072: +	}
13073: +    }
13074: +  va_end (args_copy);
13075: +  va_end (args);
13076: +
13077: +  return *str && number && fnumber;
13078: +}]])# _AC_C_C99_TEST_HEADER
13079: +
13080: +# _AC_C_C99_TEST_BODY
13081: +# -------------------
13082: +# A C body suitable for testing for C99, assuming the corresponding header.
13083: +AC_DEFUN([_AC_C_C99_TEST_BODY],
13084: +[[
13085: +  // Check bool.
13086: +  _Bool success = false;
13087: +
13088: +  // Check restrict.
13089: +  if (test_restrict ("String literal") == 0)
13090: +    success = true;
13091: +  char *restrict newvar = "Another string";
13092: +
13093: +  // Check varargs.
13094: +  success &= test_varargs ("s, d' f .", "string", 65, 34.234);
13095: +  test_varargs_macros ();
13096: +
13097: +  // Check flexible array members.
13098: +  struct incomplete_array *ia =
13099: +    malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
13100: +  ia->datasize = 10;
13101: +  for (int i = 0; i < ia->datasize; ++i)
13102: +    ia->data[i] = i * 1.234;
13103: +
13104: +  // Check named initializers.
13105: +  struct named_init ni = {
13106: +    .number = 34,
13107: +    .name = L"Test wide string",
13108: +    .average = 543.34343,
13109: +  };
13110: +
13111: +  ni.number = 58;
13112: +
13113: +  int dynamic_array[ni.number];
13114: +  dynamic_array[ni.number - 1] = 543;
13115: +
13116: +  // work around unused variable warnings
13117: +  return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
13118: +	  || dynamic_array[ni.number - 1] != 543);
13119: +]])
13120: +
13121: +# _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
13122: +# ----------------------------------------------------------------
13123: +# If the C compiler is not in ISO C99 mode by default, try to add an
13124: +# option to output variable CC to make it so.  This macro tries
13125: +# various options that select ISO C99 on some system or another.  It
13126: +# considers the compiler to be in ISO C99 mode if it handles _Bool,
13127: +# // comments, flexible array members, inline, long long int, mixed
13128: +# code and declarations, named initialization of structs, restrict,
13129: +# va_copy, varargs macros, variable declarations in for loops and
13130: +# variable length arrays.
13131: +AC_DEFUN([_AC_PROG_CC_C99],
13132: +[_AC_C_STD_TRY([c99],
13133: +[_AC_C_C99_TEST_HEADER],
13134: +[_AC_C_C99_TEST_BODY],
13135: +dnl Try
13136: +dnl GCC		-std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999)
13137: +dnl IBM XL C	-qlanglvl=extc1x (V12.1; does not pass C11 test)
13138: +dnl IBM XL C	-qlanglvl=extc99
13139: +dnl		(pre-V12.1; unused restrictive mode: -qlanglvl=stdc99)
13140: +dnl HP cc	-AC99
13141: +dnl Intel ICC	-std=c99, -c99 (deprecated)
13142: +dnl IRIX	-c99
13143: +dnl Solaris	-D_STDC_C99=
13144: +dnl		cc's -xc99 option uses linker magic to define the external
13145: +dnl		symbol __xpg4 as if by "int __xpg4 = 1;", which enables C99
13146: +dnl		behavior for C library functions.  This is not wanted here,
13147: +dnl		because it means that a single module compiled with -xc99
13148: +dnl		alters C runtime behavior for the entire program, not for
13149: +dnl		just the module.  Instead, define the (private) symbol
13150: +dnl		_STDC_C99, which suppresses a bogus failure in <stdbool.h>.
13151: +dnl		The resulting compiler passes the test case here, and that's
13152: +dnl		good enough.  For more, please see the thread starting at:
13153: +dnl            http://lists.gnu.org/archive/html/autoconf/2010-12/msg00059.html
13154: +dnl Tru64	-c99
13155: +dnl with extended modes being tried first.
13156: +[[-std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc1x -qlanglvl=extc99]], [$1], [$2])[]dnl
13157: +])# _AC_PROG_CC_C99
13158: +
13159: +
13160: +# _AC_PROG_CC_C11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
13161: +# ----------------------------------------------------------------
13162: +# If the C compiler is not in ISO C11 mode by default, try to add an
13163: +# option to output variable CC to make it so.  This macro tries
13164: +# various options that select ISO C11 on some system or another.  It
13165: +# considers the compiler to be in ISO C11 mode if it handles _Alignas,
13166: +# _Alignof, _Noreturn, _Static_assert, UTF-8 string literals,
13167: +# duplicate typedefs, and anonymous structures and unions.
13168: +AC_DEFUN([_AC_PROG_CC_C11],
13169: +[_AC_C_STD_TRY([c11],
13170: +[_AC_C_C99_TEST_HEADER[
13171: +// Check _Alignas.
13172: +char _Alignas (double) aligned_as_double;
13173: +char _Alignas (0) no_special_alignment;
13174: +extern char aligned_as_int;
13175: +char _Alignas (0) _Alignas (int) aligned_as_int;
13176: +
13177: +// Check _Alignof.
13178: +enum
13179: +{
13180: +  int_alignment = _Alignof (int),
13181: +  int_array_alignment = _Alignof (int[100]),
13182: +  char_alignment = _Alignof (char)
13183: +};
13184: +_Static_assert (0 < -_Alignof (int), "_Alignof is signed");
13185: +
13186: +// Check _Noreturn.
13187: +int _Noreturn does_not_return (void) { for (;;) continue; }
13188: +
13189: +// Check _Static_assert.
13190: +struct test_static_assert
13191: +{
13192: +  int x;
13193: +  _Static_assert (sizeof (int) <= sizeof (long int),
13194: +                  "_Static_assert does not work in struct");
13195: +  long int y;
13196: +};
13197: +
13198: +// Check UTF-8 literals.
13199: +#define u8 syntax error!
13200: +char const utf8_literal[] = u8"happens to be ASCII" "another string";
13201: +
13202: +// Check duplicate typedefs.
13203: +typedef long *long_ptr;
13204: +typedef long int *long_ptr;
13205: +typedef long_ptr long_ptr;
13206: +
13207: +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1.
13208: +struct anonymous
13209: +{
13210: +  union {
13211: +    struct { int i; int j; };
13212: +    struct { int k; long int l; } w;
13213: +  };
13214: +  int m;
13215: +} v1;
13216: +]],
13217: +[_AC_C_C99_TEST_BODY[
13218: +  v1.i = 2;
13219: +  v1.w.k = 5;
13220: +  _Static_assert ((offsetof (struct anonymous, i)
13221: +		   == offsetof (struct anonymous, w.k)),
13222: +		  "Anonymous union alignment botch");
13223: +]],
13224: +dnl Try
13225: +dnl GCC		-std=gnu11 (unused restrictive mode: -std=c11)
13226: +dnl with extended modes being tried first.
13227: +dnl
13228: +dnl Do not try -qlanglvl=extc1x, because IBM XL C V12.1 (the latest version as
13229: +dnl of September 2012) does not pass the C11 test.  For now, try extc1x when
13230: +dnl compiling the C99 test instead, since it enables _Static_assert and
13231: +dnl _Noreturn, which is a win.  If -qlanglvl=extc11 or -qlanglvl=extc1x passes
13232: +dnl the C11 test in some future version of IBM XL C, we'll add it here,
13233: +dnl preferably extc11.
13234: +[[-std=gnu11]], [$1], [$2])[]dnl
13235: +])# _AC_PROG_CC_C11
13236: +
13237: +
13238: +# AC_PROG_CC_C89
13239: +# --------------
13240: +# Do not use AU_ALIAS here and in AC_PROG_CC_C99 and AC_PROG_CC_STDC,
13241: +# as that'd be incompatible with how Automake redefines AC_PROG_CC.  See
13242: +# <http://lists.gnu.org/archive/html/autoconf/2012-10/msg00048.html>.
13243: +AU_DEFUN([AC_PROG_CC_C89],
13244: +  [AC_REQUIRE([AC_PROG_CC])],
13245: +  [$0 is obsolete; use AC_PROG_CC]
13246: +)
13247: +
13248: +# AC_PROG_CC_C99
13249: +# --------------
13250: +AU_DEFUN([AC_PROG_CC_C99],
13251: +  [AC_REQUIRE([AC_PROG_CC])],
13252: +  [$0 is obsolete; use AC_PROG_CC]
13253: +)
13254: +
13255: +# AC_PROG_CC_STDC
13256: +# ---------------
13257: +AU_DEFUN([AC_PROG_CC_STDC],
13258: +  [AC_REQUIRE([AC_PROG_CC])],
13259: +  [$0 is obsolete; use AC_PROG_CC]
13260: +)
13261: +
13262: +
13263: +# AC_C_PROTOTYPES
13264: +# ---------------
13265: +# Check if the C compiler supports prototypes, included if it needs
13266: +# options.
13267: +AC_DEFUN([AC_C_PROTOTYPES],
13268: +[AC_REQUIRE([AC_PROG_CC])dnl
13269: +if test "$ac_prog_cc_stdc" != no; then
13270: +  AC_DEFINE(PROTOTYPES, 1,
13271: +	    [Define to 1 if the C compiler supports function prototypes.])
13272: +  AC_DEFINE(__PROTOTYPES, 1,
13273: +	    [Define like PROTOTYPES; this can be used by system headers.])
13274: +fi
13275: +])# AC_C_PROTOTYPES
13276: +
13277: +
13278: +# _AC_CXX_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST,
13279: +#		  ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE)
13280: +# ----------------------------------------------------------------
13281: +# Check whether the C++ compiler accepts features of STANDARD (e.g
13282: +# `cxx98', `cxx11') by trying to compile a program of TEST-PROLOGUE
13283: +# and TEST-BODY.  If this fails, try again with each compiler option
13284: +# in the space-separated OPTION-LIST; if one helps, append it to CXX.
13285: +# If eventually successful, run ACTION-IF-AVAILABLE, else
13286: +# ACTION-IF-UNAVAILABLE.
13287: +AC_DEFUN([_AC_CXX_STD_TRY],
13288: +[AC_MSG_CHECKING([for $CXX option to enable ]m4_translit(m4_translit($1, [x], [+]), [a-z], [A-Z])[ features])
13289: +AC_LANG_PUSH(C++)dnl
13290: +AC_CACHE_VAL(ac_cv_prog_cxx_$1,
13291: +[ac_cv_prog_cxx_$1=no
13292: +ac_save_CXX=$CXX
13293: +AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
13294: +for ac_arg in '' $4
13295: +do
13296: +  CXX="$ac_save_CXX $ac_arg"
13297: +  _AC_COMPILE_IFELSE([], [ac_cv_prog_cxx_$1=$ac_arg])
13298: +  test "x$ac_cv_prog_cxx_$1" != "xno" && break
13299: +done
13300: +rm -f conftest.$ac_ext
13301: +CXX=$ac_save_CXX
13302: +])# AC_CACHE_VAL
13303: +ac_prog_cxx_stdcxx_options=
13304: +case "x$ac_cv_prog_cxx_$1" in
13305: +  x)
13306: +    AC_MSG_RESULT([none needed]) ;;
13307: +  xno)
13308: +    AC_MSG_RESULT([unsupported]) ;;
13309: +  *)
13310: +    ac_prog_cxx_stdcxx_options=" $ac_cv_prog_cxx_$1"
13311: +    CXX=$CXX$ac_prog_cxx_stdcxx_options
13312: +    AC_MSG_RESULT([$ac_cv_prog_cxx_$1]) ;;
13313: +esac
13314: +AC_LANG_POP(C++)dnl
13315: +AS_IF([test "x$ac_cv_prog_cxx_$1" != xno], [$5], [$6])
13316: +])# _AC_CXX_STD_TRY
13317: +
13318: +# _AC_CXX_CXX98_TEST_HEADER
13319: +# -------------------------
13320: +# A C++ header suitable for testing for CXX98.
13321: +AC_DEFUN([_AC_CXX_CXX98_TEST_HEADER],
13322: +[[
13323: +#include <algorithm>
13324: +#include <cstdlib>
13325: +#include <fstream>
13326: +#include <iomanip>
13327: +#include <iostream>
13328: +#include <list>
13329: +#include <map>
13330: +#include <set>
13331: +#include <sstream>
13332: +#include <stdexcept>
13333: +#include <string>
13334: +#include <utility>
13335: +#include <vector>
13336: +
13337: +namespace test {
13338: +  typedef std::vector<std::string> string_vec;
13339: +  typedef std::pair<int,bool> map_value;
13340: +  typedef std::map<std::string,map_value> map_type;
13341: +  typedef std::set<int> set_type;
13342: +
13343: +  template<typename T>
13344: +  class printer {
13345: +  public:
13346: +    printer(std::ostringstream& os): os(os) {}
13347: +    void operator() (T elem) { os << elem << std::endl; }
13348: +  private:
13349: +    std::ostringstream& os;
13350: +  };
13351: +}
13352: +]])# _AC_CXX_CXX98_TEST_HEADER
13353: +
13354: +# _AC_CXX_CXX98_TEST_BODY
13355: +# -----------------------
13356: +# A C++ body suitable for testing for CXX98, assuming the corresponding header.
13357: +AC_DEFUN([_AC_CXX_CXX98_TEST_BODY],
13358: +[[
13359: +
13360: +try {
13361: +  // Basic string.
13362: +  std::string teststr("ASCII text");
13363: +  teststr += " string";
13364: +
13365: +  // Simple vector.
13366: +  test::string_vec testvec;
13367: +  testvec.push_back(teststr);
13368: +  testvec.push_back("foo");
13369: +  testvec.push_back("bar");
13370: +  if (testvec.size() != 3) {
13371: +    throw std::runtime_error("vector size is not 1");
13372: +  }
13373: +
13374: +  // Dump vector into stringstream and obtain string.
13375: +  std::ostringstream os;
13376: +  for (test::string_vec::const_iterator i = testvec.begin();
13377: +       i != testvec.end(); ++i) {
13378: +    if (i + 1 != testvec.end()) {
13379: +      os << teststr << '\n';
13380: +    }
13381: +  }
13382: +  // Check algorithms work.
13383: +  std::for_each(testvec.begin(), testvec.end(), test::printer<std::string>(os));
13384: +  std::string os_out = os.str();
13385: +
13386: +  // Test pair and map.
13387: +  test::map_type testmap;
13388: +  testmap.insert(std::make_pair(std::string("key"),
13389: +                                std::make_pair(53,false)));
13390: +
13391: +  // Test set.
13392: +  int values[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1};
13393: +  test::set_type testset(values, values + sizeof(values)/sizeof(values[0]));
13394: +  std::list<int> testlist(testset.begin(), testset.end());
13395: +  std::copy(testset.begin(), testset.end(), std::back_inserter(testlist));
13396: +} catch (const std::exception& e) {
13397: +  std::cerr << "Caught exception: " << e.what() << std::endl;
13398: +
13399: +  // Test fstream
13400: +  std::ofstream of("test.txt");
13401: +  of << "Test ASCII text\n" << std::flush;
13402: +  of << "N= " << std::hex << std::setw(8) << std::left << 534 << std::endl;
13403: +  of.close();
13404: +}
13405: +std::exit(0);
13406: +]])
13407: +
13408: +# _AC_CXX_CXX11_TEST_HEADER
13409: +# -------------------------
13410: +# A C++ header suitable for testing for CXX11.
13411: +AC_DEFUN([_AC_CXX_CXX11_TEST_HEADER],
13412: +[[
13413: +#include <deque>
13414: +#include <functional>
13415: +#include <memory>
13416: +#include <tuple>
13417: +#include <array>
13418: +#include <regex>
13419: +#include <iostream>
13420: +
13421: +namespace cxx11test
13422: +{
13423: +  typedef std::shared_ptr<std::string> sptr;
13424: +  typedef std::weak_ptr<std::string> wptr;
13425: +
13426: +  typedef std::tuple<std::string,int,double> tp;
13427: +  typedef std::array<int, 20> int_array;
13428: +
13429: +  constexpr int get_val() { return 20; }
13430: +
13431: +  struct testinit
13432: +  {
13433: +    int i;
13434: +    double d;
13435: +  };
13436: +
13437: +  class delegate  {
13438: +  public:
13439: +    delegate(int n) : n(n) {}
13440: +    delegate(): delegate(2354) {}
13441: +
13442: +    virtual int getval() { return this->n; };
13443: +  protected:
13444: +    int n;
13445: +  };
13446: +
13447: +  class overridden : public delegate {
13448: +  public:
13449: +    overridden(int n): delegate(n) {}
13450: +    virtual int getval() override final { return this->n * 2; }
13451: +  };
13452: +
13453: +  class nocopy {
13454: +  public:
13455: +    nocopy(int i): i(i) {}
13456: +    nocopy() = default;
13457: +    nocopy(const nocopy&) = delete;
13458: +    nocopy & operator=(const nocopy&) = delete;
13459: +  private:
13460: +    int i;
13461: +  };
13462: +}
13463: +]])# _AC_CXX_CXX11_TEST_HEADER
13464: +
13465: +# _AC_CXX_CXX11_TEST_BODY
13466: +# -----------------------
13467: +# A C++ body suitable for testing for CXX11, assuming the corresponding header.
13468: +AC_DEFUN([_AC_CXX_CXX11_TEST_BODY],
13469: +[[
13470: +{
13471: +  // Test auto and decltype
13472: +  std::deque<int> d;
13473: +  d.push_front(43);
13474: +  d.push_front(484);
13475: +  d.push_front(3);
13476: +  d.push_front(844);
13477: +  int total = 0;
13478: +  for (auto i = d.begin(); i != d.end(); ++i) { total += *i; }
13479: +
13480: +  auto a1 = 6538;
13481: +  auto a2 = 48573953.4;
13482: +  auto a3 = "String literal";
13483: +
13484: +  decltype(a2) a4 = 34895.034;
13485: +}
13486: +{
13487: +  // Test constexpr
13488: +  short sa[cxx11test::get_val()] = { 0 };
13489: +}
13490: +{
13491: +  // Test initializer lists
13492: +  cxx11test::testinit il = { 4323, 435234.23544 };
13493: +}
13494: +{
13495: +  // Test range-based for and lambda
13496: +  cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1};
13497: +  for (int &x : array) { x += 23; }
13498: +  std::for_each(array.begin(), array.end(), [](int v1){ std::cout << v1; });
13499: +}
13500: +{
13501: +  using cxx11test::sptr;
13502: +  using cxx11test::wptr;
13503: +
13504: +  sptr sp(new std::string("ASCII string"));
13505: +  wptr wp(sp);
13506: +  sptr sp2(wp);
13507: +}
13508: +{
13509: +  cxx11test::tp tuple("test", 54, 45.53434);
13510: +  double d = std::get<2>(tuple);
13511: +  std::string s;
13512: +  int i;
13513: +  std::tie(s,i,d) = tuple;
13514: +}
13515: +{
13516: +  static std::regex filename_regex("^_?([a-z0-9_.]+-)+[a-z0-9]+$");
13517: +  std::string testmatch("Test if this string matches");
13518: +  bool match = std::regex_search(testmatch, filename_regex);
13519: +}
13520: +{
13521: +  cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1};
13522: +  cxx11test::int_array::size_type size = array.size();
13523: +}
13524: +{
13525: +  // Test constructor delegation
13526: +  cxx11test::delegate d1;
13527: +  cxx11test::delegate d2();
13528: +  cxx11test::delegate d3(45);
13529: +}
13530: +{
13531: +  // Test override and final
13532: +  cxx11test::overridden o1(55464);
13533: +}
13534: +{
13535: +  // Test nullptr
13536: +  char *c = nullptr;
13537: +}
13538: +{
13539: +  // Test template brackets
13540: +  std::vector<std::pair<int,char*>> v1;
13541: +}
13542: +{
13543: +  // Unicode literals
13544: +  char const *utf8 = u8"UTF-8 string \u2500";
13545: +  char16_t const *utf16 = u"UTF-8 string \u2500";
13546: +  char32_t const *utf32 = U"UTF-32 string \u2500";
13547: +}
13548: +]])
13549: +
13550: +# _AC_PROG_CXX_CXX98 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
13551: +# -------------------------------------------------------------------
13552: +
13553: +# If the C++ compiler is not in ISO C++98 mode by default, try to add
13554: +# an option to output variable CXX to make it so.  This macro tries
13555: +# various options that select ISO C++98 on some system or another.  It
13556: +# considers the compiler to be in ISO C++98 mode if it handles basic
13557: +# features of the std namespace including: string, containers (list,
13558: +# map, set, vector), streams (fstreams, iostreams, stringstreams,
13559: +# iomanip), pair, exceptions and algorithms.
13560: +
13561: +
13562: +AC_DEFUN([_AC_PROG_CXX_CXX98],
13563: +[_AC_CXX_STD_TRY([cxx98],
13564: +[_AC_CXX_CXX98_TEST_HEADER],
13565: +[_AC_CXX_CXX98_TEST_BODY],
13566: +dnl Try
13567: +dnl GCC		-std=gnu++98 (unused restrictive mode: -std=c++98)
13568: +dnl IBM XL C	-qlanglvl=extended
13569: +dnl HP aC++	-AA
13570: +dnl Intel ICC	-std=gnu++98
13571: +dnl Solaris	N/A (default)
13572: +dnl Tru64	N/A (default, but -std gnu could be used)
13573: +dnl with extended modes being tried first.
13574: +[[-std=gnu++98 -std=c++98 -qlanglvl=extended -AA]], [$1], [$2])[]dnl
13575: +])# _AC_PROG_CXX_CXX98
13576: +
13577: +# _AC_PROG_CXX_CXX11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
13578: +# -------------------------------------------------------------------
13579: +# If the C++ compiler is not in ISO CXX11 mode by default, try to add
13580: +# an option to output variable CXX to make it so.  This macro tries
13581: +# various options that select ISO C++11 on some system or another.  It
13582: +# considers the compiler to be in ISO C++11 mode if it handles all the
13583: +# tests from the C++98 checks, plus the following: Language features
13584: +# (auto, constexpr, decltype, default/deleted constructors, delegate
13585: +# constructors, final, initializer lists, lambda functions, nullptr,
13586: +# override, range-based for loops, template brackets without spaces,
13587: +# unicode literals) and library features (array, memory (shared_ptr,
13588: +# weak_ptr), regex and tuple types).
13589: +AC_DEFUN([_AC_PROG_CXX_CXX11],
13590: +[_AC_CXX_STD_TRY([cxx11],
13591: +[_AC_CXX_CXX11_TEST_HEADER
13592: +_AC_CXX_CXX98_TEST_HEADER],
13593: +[_AC_CXX_CXX11_TEST_BODY
13594: +_AC_CXX_CXX98_TEST_BODY],
13595: +dnl Try
13596: +dnl GCC		-std=gnu++11 (unused restrictive mode: -std=c++11) [and 0x variants]
13597: +dnl IBM XL C	-qlanglvl=extended0x
13598: +dnl		(pre-V12.1; unused restrictive mode: -qlanglvl=stdcxx11)
13599: +dnl HP aC++	-AA
13600: +dnl Intel ICC	-std=c++11 -std=c++0x
13601: +dnl Solaris	N/A (no support)
13602: +dnl Tru64	N/A (no support)
13603: +dnl with extended modes being tried first.
13604: +[[-std=gnu++11 -std=c++11 -std=gnu++0x -std=c++0x -qlanglvl=extended0x -AA]], [$1], [$2])[]dnl
13605: +])# _AC_PROG_CXX_CXX11
13606: diff --git a/src/Makefile.in b/src/Makefile.in
13607: index cc0e485..a2c2849 100644
13608: --- a/src/Makefile.in
13609: +++ b/src/Makefile.in
13610: @@ -94,7 +94,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/lib-ld.m4 \
13611:  	$(top_srcdir)/m4/libsigsegv.m4 $(top_srcdir)/m4/libtool.m4 \
13612:  	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
13613:  	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
13614: -	$(top_srcdir)/m4/readline.m4 $(top_srcdir)/configure.ac
13615: +	$(top_srcdir)/m4/readline.m4 $(top_srcdir)/m4/std-gnu11.m4 \
13616: +	$(top_srcdir)/configure.ac
13617:  am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
13618:  	$(ACLOCAL_M4)
13619:  DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
13620: diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in
13621: index 9987700..c90b6eb 100644
13622: --- a/src/lib/Makefile.in
13623: +++ b/src/lib/Makefile.in
13624: @@ -97,7 +97,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/lib-ld.m4 \
13625:  	$(top_srcdir)/m4/libsigsegv.m4 $(top_srcdir)/m4/libtool.m4 \
13626:  	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
13627:  	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
13628: -	$(top_srcdir)/m4/readline.m4 $(top_srcdir)/configure.ac
13629: +	$(top_srcdir)/m4/readline.m4 $(top_srcdir)/m4/std-gnu11.m4 \
13630: +	$(top_srcdir)/configure.ac
13631:  am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
13632:  	$(ACLOCAL_M4)
13633:  DIST_COMMON = $(srcdir)/Makefile.am $(dist_lac_DATA) \
13634: diff --git a/src/repl/Makefile.in b/src/repl/Makefile.in
13635: index c33668a..d858641 100644
13636: --- a/src/repl/Makefile.in
13637: +++ b/src/repl/Makefile.in
13638: @@ -96,7 +96,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/lib-ld.m4 \
13639:  	$(top_srcdir)/m4/libsigsegv.m4 $(top_srcdir)/m4/libtool.m4 \
13640:  	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
13641:  	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
13642: -	$(top_srcdir)/m4/readline.m4 $(top_srcdir)/configure.ac
13643: +	$(top_srcdir)/m4/readline.m4 $(top_srcdir)/m4/std-gnu11.m4 \
13644: +	$(top_srcdir)/configure.ac
13645:  am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
13646:  	$(ACLOCAL_M4)
13647:  DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)

Generated by git2html.