utput of the tested commands.
  at_stdout=$at_job_dir/stdout
  at_stder1=$at_job_dir/stder1
  at_stderr=$at_job_dir/stderr
  # The file containing the code for a test group.
  at_test_source=$at_job_dir/test-source
  # The file containing dates.
  at_times_file=$at_job_dir/times

  # Be sure to come back to the top test directory.
  cd "$at_suite_dir"

  # Clearly separate the test groups when verbose.
  $at_first || $at_verbose echo

  at_group_normalized=$at_group

  eval 'while :; do
    case $at_group_normalized in #(
    '"$at_format"'*) break;;
    esac
    at_group_normalized=0$at_group_normalized
  done'


  # Create a fresh directory for the next test group, and enter.
  # If one already exists, the user may have invoked ./run from
  # within that directory; we remove the contents, but not the
  # directory itself, so that we aren't pulling the rug out from
  # under the shell's notion of the current directory.
  at_group_dir=$at_suite_dir/$at_group_normalized
  at_group_log=$at_group_dir/$as_me.log
  if test -d "$at_group_dir"; then
  find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx {} \;
  rm -fr "$at_group_dir"/* "$at_group_dir"/.[!.] "$at_group_dir"/.??*
fi ||
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: test directory for $at_group_normalized could not be cleaned" >&5
$as_echo "$as_me: WARNING: test directory for $at_group_normalized could not be cleaned" >&2;}
  # Be tolerant if the above `rm' was not able to remove the directory.
  as_dir="$at_group_dir"; as_fn_mkdir_p

  echo 0 > "$at_status_file"

  # In verbose mode, append to the log file *and* show on
  # the standard output; in quiet mode only write to the log.
  if test -z "$at_verbose"; then
    at_tee_pipe='tee -a "$at_group_log"'
  else
    at_tee_pipe='cat >> "$at_group_log"'
  fi
}

# at_fn_group_banner ORDINAL LINE DESC PAD [BANNER]
# -------------------------------------------------
# Declare the test group ORDINAL, located at LINE with group description DESC,
# and residing under BANNER. Use PAD to align the status column.
at_fn_group_banner ()
{
  at_setup_line="$2"
  test -n "$5" && at_fn_banner $5
  at_desc="$3"
  case $1 in
    [0-9])      at_desc_line="  $1: ";;
    [0-9][0-9]) at_desc_line=" $1: " ;;
    *)          at_desc_line="$1: "  ;;
  esac
  as_fn_append at_desc_line "$3$4"
  $at_quiet $as_echo_n "$at_desc_line"
  echo "#                             -*- compilation -*-" >> "$at_group_log"
}

# at_fn_group_postprocess
# -----------------------
# Perform cleanup after running a test group.
at_fn_group_postprocess ()
{
  # Be sure to come back to the suite directory, in particular
  # since below we might `rm' the group directory we are in currently.
  cd "$at_suite_dir"

  if test ! -f "$at_check_line_file"; then
    sed "s/^ */$as_me: WARNING: /" <<_ATEOF
      A failure happened in a test group before any test could be
      run. This means that test suite is improperly designed.  Please
      report this failure to <bug-libtool@gnu.org>.
_ATEOF
    $as_echo "$at_setup_line" >"$at_check_line_file"
    at_status=99
  fi
  $at_verbose $as_echo_n "$at_group. $at_setup_line: "
  $as_echo_n "$at_group. $at_setup_line: " >> "$at_group_log"
  case $at_xfail:$at_status in
    yes:0)
	at_msg="UNEXPECTED PASS"
	at_res=xpass
	at_errexit=$at_errexit_p
	at_color=$at_red
	;;
    no:0)
	at_msg="ok"
	at_res=pass
	at_errexit=false
	at_color=$at_grn
	;;
    *:77)
	at_msg='skipped ('`cat "$at_check_line_file"`')'
	at_res=skip
	at_errexit=false
	at_color=$at_blu
	;;
    no:* | *:99)
	at_msg='FAILED ('`cat "$at_check_line_file"`')'
	at_res=fail
	at_errexit=$at_errexit_p
	at_color=$at_red
	;;
    yes:*)
	at_msg='expected failure ('`cat "$at_check_line_file"`')'
	at_res=xfail
	at_errexit=false
	at_color=$at_lgn
	;;
  esac
  echo "$at_res" > "$at_job_dir/$at_res"
  # In parallel mode, output the summary line only afterwards.
  if test $at_jobs -ne 1 && test -n "$at_verbose"; then
    $as_echo "$at_desc_line $at_color$at_msg$at_std"
  else
    # Make sure there is a separator even with long titles.
    $as_echo " $at_color$at_msg$at_std"
  fi
  at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg"
  case $at_status in
    0|77)
      # $at_times_file is only available if the group succeeded.
      # We're not including the group log, so the success message
      # is written in the global log separately.  But we also
      # write to the group log in case they're using -d.
      if test -f "$at_times_file"; then
	at_log_msg="$at_log_msg     ("`sed 1d "$at_times_file"`')'
	rm -f "$at_times_file"
      fi
      $as_echo "$at_log_msg" >> "$at_group_log"
      $as_echo "$at_log_msg" >&5

      # Cleanup the group directory, unless the user wants the files
      # or the success was unexpected.
      if $at_debug_p || test $at_res = xpass; then
	at_fn_create_debugging_script
	if test $at_res = xpass && $at_errexit; then
	  echo stop > "$at_stop_file"
	fi
      else
	if test -d "$at_group_dir"; then
	  find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
	  rm -fr "$at_group_dir"
	fi
	rm -f "$at_test_source"
      fi
      ;;
    *)
      # Upon failure, include the log into the testsuite's global
      # log.  The failure message is written in the group log.  It
      # is later included in the global log.
      $as_echo "$at_log_msg" >> "$at_group_log"

      # Upon failure, keep the group directory for autopsy, and create
      # the debugging script.  With -e, do not start any further tests.
      at_fn_create_debugging_script
      if $at_errexit; then
	echo stop > "$at_stop_file"
      fi
      ;;
  esac
}


## ------------ ##
## Driver loop. ##
## ------------ ##


if (set -m && set +m && set +b) >/dev/null 2>&1; then
  set +b
  at_job_control_on='set -m' at_job_control_off='set +m' at_job_group=-
else
  at_job_control_on=: at_job_control_off=: at_job_group=
fi

for at_signal in 1 2 15; do
  trap 'set +x; set +e
	$at_job_control_off
	at_signal='"$at_signal"'
	echo stop > "$at_stop_file"
	trap "" $at_signal
	at_pgids=
	for at_pgid in `jobs -p 2>/dev/null`; do
	  at_pgids="$at_pgids $at_job_group$at_pgid"
	done
	test -z "$at_pgids" || kill -$at_signal $at_pgids 2>/dev/null
	wait
	if test "$at_jobs" -eq 1 || test -z "$at_verbose"; then
	  echo >&2
	fi
	at_signame=`kill -l $at_signal 2>&1 || echo $at_signal`
	set x $at_signame
	test 0 -gt 2 && at_signame=$at_signal
	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: caught signal $at_signame, bailing out" >&5
$as_echo "$as_me: WARNING: caught signal $at_signame, bailing out" >&2;}
	as_fn_arith 128 + $at_signal && exit_status=$as_val
	as_fn_exit $exit_status' $at_signal
done

rm -f "$at_stop_file"
at_first=:

if test $at_jobs -ne 1 &&
     rm -f "$at_job_fifo" &&
     test -n "$at_job_group" &&
     ( mkfifo "$at_job_fifo" && trap 'exit 1' PIPE STOP TSTP ) 2>/dev/null
then
  # FIFO job dispatcher.

  trap 'at_pids=
	for at_pid in `jobs -p`; do
	  at_pids="$at_pids $at_job_group$at_pid"
	done
	if test -n "$at_pids"; then
	  at_sig=TSTP
	  test "${TMOUT+set}" = set && at_sig=STOP
	  kill -$at_sig $at_pids 2>/dev/null
	fi
	kill -STOP $$
	test -z "$at_pids" || kill -CONT $at_pids 2>/dev/null' TSTP

  echo
  # Turn jobs into a list of numbers, starting from 1.
  at_joblist=`$as_echo "$at_groups" | sed -n 1,${at_jobs}p`

  set X $at_joblist
  shift
  for at_group in $at_groups; do
    $at_job_control_on 2>/dev/null
    (
      # Start one test group.
      $at_job_control_off
      if $at_first; then
	exec 7>"$at_job_fifo"
      else
	exec 6<&-
      fi
      trap 'set +x; set +e
	    trap "" PIPE
	    echo stop > "$at_stop_file"
	    echo >&7
	    as_fn_exit 141' PIPE
      at_fn_group_prepare
      if cd "$at_group_dir" &&
	 at_fn_test $at_group &&
	 . "$at_test_source"
      then :; else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to parse test group: $at_group" >&5
$as_echo "$as_me: WARNING: unable to parse test group: $at_group" >&2;}
	at_failed=:
      fi
      at_fn_group_postprocess
      echo >&7
    ) &
    $at_job_control_off
    if $at_first; then
      at_first=false
      exec 6<"$at_job_fifo" 7>"$at_job_fifo"
    fi
    shift # Consume one token.
    if test $# -gt 0; then :; else
      read at_token <&6 || break
      set x $*
    fi
    test -f "$at_stop_file" && break
  done
  exec 7>&-
  # Read back the remaining ($at_jobs - 1) tokens.
  set X $at_joblist
  shift
  if test $# -gt 0; then
    shift
    for at_job
    do
      read at_token
    done <&6
  fi
  exec 6<&-
  wait
else
  # Run serially, avoid forks and other potential surprises.
  for at_group in $at_groups; do
    at_fn_group_prepare
    if cd "$at_group_dir" &&
       at_fn_test $at_group &&
       . "$at_test_source"; then :; else
      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to parse test group: $at_group" >&5
$as_echo "$as_me: WARNING: unable to parse test group: $at_group" >&2;}
      at_failed=:
    fi
    at_fn_group_postprocess
    test -f "$at_stop_file" && break
    at_first=false
  done
fi

# Wrap up the test suite with summary statistics.
cd "$at_helper_dir"

# Use ?..???? when the list must remain sorted, the faster * otherwise.
at_pass_list=`for f in */pass; do echo $f; done | sed '/\*/d; s,/pass,,'`
at_skip_list=`for f in */skip; do echo $f; done | sed '/\*/d; s,/skip,,'`
at_xfail_list=`for f in */xfail; do echo $f; done | sed '/\*/d; s,/xfail,,'`
at_xpass_list=`for f in ?/xpass ??/xpass ???/xpass ????/xpass; do
		 echo $f; done | sed '/?/d; s,/xpass,,'`
at_fail_list=`for f in ?/fail ??/fail ???/fail ????/fail; do
		echo $f; done | sed '/?/d; s,/fail,,'`

set X $at_pass_list $at_xpass_list $at_xfail_list $at_fail_list $at_skip_list
shift; at_group_count=$#
set X $at_xpass_list; shift; at_xpass_count=$#; at_xpass_list=$*
set X $at_xfail_list; shift; at_xfail_count=$#
set X $at_fail_list; shift; at_fail_count=$#; at_fail_list=$*
set X $at_skip_list; shift; at_skip_count=$#

as_fn_arith $at_group_count - $at_skip_count && at_run_count=$as_val
as_fn_arith $at_xpass_count + $at_fail_count && at_unexpected_count=$as_val
as_fn_arith $at_xfail_count + $at_fail_count && at_total_fail_count=$as_val

# Back to the top directory.
cd "$at_dir"
rm -rf "$at_helper_dir"

# Compute the duration of the suite.
at_stop_date=`date`
at_stop_time=`date +%s 2>/dev/null`
$as_echo "$as_me: ending at: $at_stop_date" >&5
case $at_start_time,$at_stop_time in
  [0-9]*,[0-9]*)
    as_fn_arith $at_stop_time - $at_start_time && at_duration_s=$as_val
    as_fn_arith $at_duration_s / 60 && at_duration_m=$as_val
    as_fn_arith $at_duration_m / 60 && at_duration_h=$as_val
    as_fn_arith $at_duration_s % 60 && at_duration_s=$as_val
    as_fn_arith $at_duration_m % 60 && at_duration_m=$as_val
    at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s"
    $as_echo "$as_me: test suite duration: $at_duration" >&5
    ;;
esac

echo
$as_echo "## ------------- ##
## Test results. ##
## ------------- ##"
echo
{
  echo
  $as_echo "## ------------- ##
## Test results. ##
## ------------- ##"
  echo
} >&5

if test $at_run_count = 1; then
  at_result="1 test"
  at_were=was
else
  at_result="$at_run_count tests"
  at_were=were
fi
if $at_errexit_p && test $at_unexpected_count != 0; then
  if test $at_xpass_count = 1; then
    at_result="$at_result $at_were run, one passed"
  else
    at_result="$at_result $at_were run, one failed"
  fi
  at_result="$at_result unexpectedly and inhibited subsequent tests."
  at_color=$at_red
else
  # Don't you just love exponential explosion of the number of cases?
  at_color=$at_red
  case $at_xpass_count:$at_fail_count:$at_xfail_count in
    # So far, so good.
    0:0:0) at_result="$at_result $at_were successful." at_color=$at_grn ;;
    0:0:*) at_result="$at_result behaved as expected." at_color=$at_lgn ;;

    # Some unexpected failures
    0:*:0) at_result="$at_result $at_were run,
$at_fail_count failed unexpectedly." ;;

    # Some failures, both expected and unexpected
    0:*:1) at_result="$at_result $at_were run,
$at_total_fail_count failed ($at_xfail_count expected failure)." ;;
    0:*:*) at_result="$at_result $at_were run,
$at_total_fail_count failed ($at_xfail_count expected failures)." ;;

    # No unexpected failures, but some xpasses
    *:0:*) at_result="$at_result $at_were run,
$at_xpass_count passed unexpectedly." ;;

    # No expected failures, but failures and xpasses
    *:1:0) at_result="$at_result $at_were run,
$at_unexpected_count did not behave as expected ($at_fail_count unexpected failure)." ;;
    *:*:0) at_result="$at_result $at_were run,
$at_unexpected_count did not behave as expected ($at_fail_count unexpected failures)." ;;

    # All of them.
    *:*:1) at_result="$at_result $at_were run,
$at_xpass_count passed unexpectedly,
$at_total_fail_count failed ($at_xfail_count expected failure)." ;;
    *:*:*) at_result="$at_result $at_were run,
$at_xpass_count passed unexpectedly,
$at_total_fail_count failed ($at_xfail_count expected failures)." ;;
  esac

  if test $at_skip_count = 0 && test $at_run_count -gt 1; then
    at_result="All $at_result"
  fi
fi

# Now put skips in the mix.
case $at_skip_count in
  0) ;;
  1) at_result="$at_result
1 test was skipped." ;;
  *) at_result="$at_result
$at_skip_count tests were skipped." ;;
esac

if test $at_unexpected_count = 0; then
  echo "$at_color$at_result$at_std"
  echo "$at_result" >&5
else
  echo "${at_color}ERROR: $at_result$at_std" >&2
  echo "ERROR: $at_result" >&5
  {
    echo
    $as_echo "## ------------------------ ##
## Summary of the failures. ##
## ------------------------ ##"

    # Summary of failed and skipped tests.
    if test $at_fail_count != 0; then
      echo "Failed tests:"
      $SHELL "$at_myself" $at_fail_list --list
      echo
    fi
    if test $at_skip_count != 0; then
      echo "Skipped tests:"
      $SHELL "$at_myself" $at_skip_list --list
      echo
    fi
    if test $at_xpass_count != 0; then
      echo "Unexpected passes:"
      $SHELL "$at_myself" $at_xpass_list --list
      echo
    fi
    if test $at_fail_count != 0; then
      $as_echo "## ---------------------- ##
## Detailed failed tests. ##
## ---------------------- ##"
      echo
      for at_group in $at_fail_list
      do
	at_group_normalized=$at_group

  eval 'while :; do
    case $at_group_normalized in #(
    '"$at_format"'*) break;;
    esac
    at_group_normalized=0$at_group_normalized
  done'

	cat "$at_suite_dir/$at_group_normalized/$as_me.log"
	echo
      done
      echo
    fi
    if test -n "$at_top_srcdir"; then
      sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## ${at_top_build_prefix}config.log ##
_ASBOX
      sed 's/^/| /' ${at_top_build_prefix}config.log
      echo
    fi
  } >&5

  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## $as_me.log was created. ##
_ASBOX

  echo
  if $at_debug_p; then
    at_msg='per-test log files'
  else
    at_msg="\`${at_testdir+${at_testdir}/}$as_me.log'"
  fi
  $as_echo "Please send $at_msg and all information you think might help:

   To: <bug-libtool@gnu.org>
   Subject: [GNU Libtool 2.4.7] $as_me: $at_fail_list${at_fail_list:+ failed${at_xpass_list:+, }}$at_xpass_list${at_xpass_list:+ passed unexpectedly}

You may investigate any problem if you feel able to do so, in which
case the test suite provides a good starting point.  Its output may
be found below \`${at_testdir+${at_testdir}/}$as_me.dir'.
"
  exit 1
fi

exit 0

## ------------- ##
## Actual tests. ##
## ------------- ##
#AT_START_1
at_fn_group_banner 1 'configure-funcs.at:39' \
  "func_munge_path_list works" "                     " 1
at_xfail=no
(
  $as_echo "1. $at_setup_line: testing $at_desc ..."
  $at_traceon
_lt_bin=$abs_top_builddir/libtool
re_begincf='^# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE'
re_endcf='^# ### END FUNCTIONS SHARED WITH CONFIGURE'

$ECHO '#!/bin/sh'       > "func_munge_path_list"
$ECHO '#: ${SED=sed}'   >> "func_munge_path_list"
$ECHO '#: ${ECHO=echo}' >> "func_munge_path_list"

sed "1,/$re_begincf/d;/$re_endcf/,\$d" < "$_lt_bin" >> "func_munge_path_list"


cat <<\EOF >> func_munge_path_list
for orig in "/usr/lib" " /lib /usr/lib "; do
  $ECHO "'$orig':"
  for path in "/p1:" "/p3:/p2:" ":/a1" ":/a2:/a3" "/p4::/a4" "/p6:/p5::/a5:/a6"; do
    old=$orig
    func_munge_path_list orig "$path" || exit 1
    $ECHO "munge ($path) = $orig"
  done
done
EOF
chmod +x func_munge_path_list

{ set +x
$as_echo "$at_srcdir/configure-funcs.at:53: ECHO=\"\$ECHO\" SED=\"\$SED\" ./func_munge_path_list"
at_fn_check_prepare_dynamic "ECHO=\"$ECHO\" SED=\"$SED\" ./func_munge_path_list" "configure-funcs.at:53"
( $at_check_trace; ECHO="$ECHO" SED="$SED" ./func_munge_path_list
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "'/usr/lib':
munge (/p1:) = /p1 /usr/lib
munge (/p3:/p2:) = /p3 /p2 /p1 /usr/lib
munge (:/a1) = /p3 /p2 /p1 /usr/lib /a1
munge (:/a2:/a3) = /p3 /p2 /p1 /usr/lib /a1 /a2 /a3
munge (/p4::/a4) = /p4 /p3 /p2 /p1 /usr/lib /a1 /a2 /a3 /a4
munge (/p6:/p5::/a5:/a6) = /p6 /p5 /p4 /p3 /p2 /p1 /usr/lib /a1 /a2 /a3 /a4 /a5 /a6
' /lib /usr/lib ':
munge (/p1:) = /p1  /lib /usr/lib 
munge (/p3:/p2:) = /p3 /p2 /p1  /lib /usr/lib 
munge (:/a1) = /p3 /p2 /p1  /lib /usr/lib  /a1
munge (:/a2:/a3) = /p3 /p2 /p1  /lib /usr/lib  /a1 /a2 /a3
munge (/p4::/a4) = /p4 /p3 /p2 /p1  /lib /usr/lib  /a1 /a2 /a3 /a4
munge (/p6:/p5::/a5:/a6) = /p6 /p5 /p4 /p3 /p2 /p1  /lib /usr/lib  /a1 /a2 /a3 /a4 /a5 /a6
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/configure-funcs.at:53"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_1
#AT_START_2
at_fn_group_banner 2 'libtoolize.at:84' \
  "libtoolize macro installation" "                  " 2
at_xfail=no
(
  $as_echo "2. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_INIT
AC_OUTPUT
_ATEOF



cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:100: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:100"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:100"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_2
#AT_START_3
at_fn_group_banner 3 'libtoolize.at:109' \
  "libtoolize macro directory mismatch error" "      " 2
at_xfail=no
(
  $as_echo "3. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_INIT
AC_OUTPUT
_ATEOF



cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I me2
_ATEOF


cat >experr <<'_ATEOF'
libtoolize:   error: AC_CONFIG_MACRO_DIRS([m4]) conflicts with ACLOCAL_AMFLAGS=-I me2.
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < experr > experr.t
mv -f experr.t experr
{ set +x
$as_echo "$at_srcdir/libtoolize.at:121: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:121"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
$at_diff experr "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/libtoolize.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_3
#AT_START_4
at_fn_group_banner 4 'libtoolize.at:130' \
  "multiple AC_CONFIG_MACRO_DIRS invocation" "       " 2
at_xfail=no
(
  $as_echo "4. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([first])
AC_CONFIG_MACRO_DIRS([second])
LT_INIT
AC_OUTPUT
_ATEOF


cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'first'.
libtoolize: copying file 'first/libtool.m4'
libtoolize: copying file 'first/ltoptions.m4'
libtoolize: copying file 'first/ltsugar.m4'
libtoolize: copying file 'first/ltversion.m4'
libtoolize: copying file 'first/lt~obsolete.m4'
libtoolize: Consider adding '-I first' to ACLOCAL_AMFLAGS in Makefile.am.
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:153: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:153"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:153"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_4
#AT_START_5
at_fn_group_banner 5 'libtoolize.at:158' \
  "multiple AC_CONFIG_MACRO_DIRS directories" "      " 2
at_xfail=no
(
  $as_echo "5. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([libtooize-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([first second third])
LT_INIT
AC_OUTPUT
_ATEOF


cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'first'.
libtoolize: copying file 'first/libtool.m4'
libtoolize: copying file 'first/ltoptions.m4'
libtoolize: copying file 'first/ltsugar.m4'
libtoolize: copying file 'first/ltversion.m4'
libtoolize: copying file 'first/lt~obsolete.m4'
libtoolize: Consider adding '-I first' to ACLOCAL_AMFLAGS in Makefile.am.
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:180: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:180"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:180"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_5
#AT_START_6
at_fn_group_banner 6 'libtoolize.at:190' \
  "libtoolize ACLOCAL_AMFLAGS extraction" "          " 2
at_xfail=no
(
  $as_echo "6. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
LT_INIT
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I first -I second
_ATEOF


cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in 'first'.
libtoolize: copying file 'first/libtool.m4'
libtoolize: copying file 'first/ltoptions.m4'
libtoolize: copying file 'first/ltsugar.m4'
libtoolize: copying file 'first/ltversion.m4'
libtoolize: copying file 'first/lt~obsolete.m4'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([first])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:216: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:216"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:216"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_6
#AT_START_7
at_fn_group_banner 7 'libtoolize.at:225' \
  "libtoolize macro serial update" "                 " 2
at_xfail=no
(
  $as_echo "7. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_INIT
AC_OUTPUT
_ATEOF



test -d m4 || { rm -f m4 && mkdir m4; }

rm -f m4/libtool.m4 m4/ltoptions.m4 build-aux/ltmain.sh

cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I m4
_ATEOF


# This file should be upgraded.
cat >m4/libtool.m4 <<'_ATEOF'

# serial 25 LT_INIT
_ATEOF


# This file has a very high serial number, and should be left unchanged
# until --force is passed.
cat >m4/ltoptions.m4 <<'_ATEOF'

# serial 99999 ltoptions.m4
_ATEOF


test -d build-aux || { rm -f build-aux && mkdir build-aux; }

# This file has a very high serial number, and needs --force to be updated.
cat >build-aux/ltmain.sh <<'_ATEOF'

package_revision=9999.9999
_ATEOF


# This file has a very old serial number, but should be left unchanged
# unless the --install flag is invoked.
cat >build-aux/config.guess <<'_ATEOF'

timestamp='1970-01-01'
_ATEOF





## -------------------------------------------------------------------- ##
## First we try to update with some newer files in the destination dir. ##
## -------------------------------------------------------------------- ##

cat >expout <<'_ATEOF'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
_ATEOF


cat >experr <<'_ATEOF'
libtoolize:   error: 'build-aux/ltmain.sh' is newer: use '--force' to overwrite
libtoolize:   error: 'm4/ltoptions.m4' is newer: use '--force' to overwrite
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < experr > experr.t
mv -f experr.t experr
{ set +x
$as_echo "$at_srcdir/libtoolize.at:248: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:248"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
$at_diff experr "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:248"
$at_failed && at_fn_log_failure
$at_traceon; }




## ---------------------------------------------------------- ##
## Next, a second update attempt with everything now updated. ##
## ---------------------------------------------------------- ##

: >expout

cat >experr <<'_ATEOF'
libtoolize:   error: 'build-aux/ltmain.sh' is newer: use '--force' to overwrite
libtoolize:   error: 'm4/ltoptions.m4' is newer: use '--force' to overwrite
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < experr > experr.t
mv -f experr.t experr
{ set +x
$as_echo "$at_srcdir/libtoolize.at:262: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:262"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
$at_diff experr "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:262"
$at_failed && at_fn_log_failure
$at_traceon; }




## ----------------------------------------------------------- ##
## Now, a forced update to downgrade files with newer serials. ##
## ----------------------------------------------------------- ##

cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:280: \$LIBTOOLIZE --copy --force

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:280"
( $at_check_trace; $LIBTOOLIZE --copy --force


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:280"
$at_failed && at_fn_log_failure
$at_traceon; }




## ---------------------------------------------------------------- ##
## A final update attempt with everything previously force updated. ##
## ---------------------------------------------------------------- ##

: >expout

lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:289: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:289"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:289"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_7
#AT_START_8
at_fn_group_banner 8 'libtoolize.at:298' \
  "libtoolize config files serial update" "          " 2
at_xfail=no
(
  $as_echo "8. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_INIT
AC_OUTPUT
_ATEOF



test -d m4 || { rm -f m4 && mkdir m4; }

rm -f m4/libtool.m4 m4/ltoptions.m4 build-aux/ltmain.sh

cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I m4
_ATEOF


# This file should be upgraded.
cat >m4/libtool.m4 <<'_ATEOF'

# serial 25 LT_INIT
_ATEOF


# This file has a very high serial number, and should be left unchanged
# until --force is passed.
cat >m4/ltoptions.m4 <<'_ATEOF'

# serial 99999 ltoptions.m4
_ATEOF


test -d build-aux || { rm -f build-aux && mkdir build-aux; }

# This file has a very high serial number, and needs --force to be updated.
cat >build-aux/ltmain.sh <<'_ATEOF'

package_revision=9999.9999
_ATEOF


# This file has a very old serial number, but should be left unchanged
# unless the --install flag is invoked.
cat >build-aux/config.guess <<'_ATEOF'

timestamp='1970-01-01'
_ATEOF





## -------------------------------------------------------------------- ##
## First we try to update with some newer files in the destination dir. ##
## -------------------------------------------------------------------- ##

cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/config.guess'
libtoolize: copying file 'build-aux/config.sub'
libtoolize: copying file 'build-aux/install-sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
_ATEOF


cat >experr <<'_ATEOF'
libtoolize:   error: 'build-aux/ltmain.sh' is newer: use '--force' to overwrite
libtoolize:   error: 'm4/ltoptions.m4' is newer: use '--force' to overwrite
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < experr > experr.t
mv -f experr.t experr
{ set +x
$as_echo "$at_srcdir/libtoolize.at:325: \$LIBTOOLIZE --copy --install

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:325"
( $at_check_trace; $LIBTOOLIZE --copy --install


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
$at_diff experr "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:325"
$at_failed && at_fn_log_failure
$at_traceon; }




## ---------------------------------------------------------- ##
## Next, a second update attempt with everything now updated. ##
## ---------------------------------------------------------- ##

: >expout

cat >experr <<'_ATEOF'
libtoolize:   error: 'build-aux/ltmain.sh' is newer: use '--force' to overwrite
libtoolize:   error: 'm4/ltoptions.m4' is newer: use '--force' to overwrite
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < experr > experr.t
mv -f experr.t experr
{ set +x
$as_echo "$at_srcdir/libtoolize.at:339: \$LIBTOOLIZE --copy --install

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:339"
( $at_check_trace; $LIBTOOLIZE --copy --install


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
$at_diff experr "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:339"
$at_failed && at_fn_log_failure
$at_traceon; }




## ----------------------------------------------------------- ##
## Now, a forced update to downgrade files with newer serials. ##
## ----------------------------------------------------------- ##

cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/config.guess'
libtoolize: copying file 'build-aux/config.sub'
libtoolize: copying file 'build-aux/install-sh'
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:360: \$LIBTOOLIZE --copy --force --install

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:360"
( $at_check_trace; $LIBTOOLIZE --copy --force --install


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:360"
$at_failed && at_fn_log_failure
$at_traceon; }




## ---------------------------------------------------------------- ##
## A final update attempt with everything previously force updated. ##
## ---------------------------------------------------------------- ##

: >expout

lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:369: \$LIBTOOLIZE --copy --install

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:369"
( $at_check_trace; $LIBTOOLIZE --copy --install


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:369"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_8
#AT_START_9
at_fn_group_banner 9 'libtoolize.at:378' \
  "diagnose missing LT_CONFIG_LTDL_DIR" "            " 2
at_xfail=no
(
  $as_echo "9. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/config.guess'
libtoolize: copying file 'build-aux/config.sub'
libtoolize: copying file 'build-aux/install-sh'
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltargz.m4'
libtoolize: copying file 'm4/ltdl.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
libtoolize: putting libltdl files in 'ltdl'.
libtoolize: copying file 'ltdl/COPYING.LIB'
libtoolize: copying file 'ltdl/README'
libtoolize: copying file 'ltdl/libltdl/lt__alloc.h'
libtoolize: copying file 'ltdl/libltdl/lt__argz_.h'
libtoolize: copying file 'ltdl/libltdl/lt__dirent.h'
libtoolize: copying file 'ltdl/libltdl/lt__glibc.h'
libtoolize: copying file 'ltdl/libltdl/lt__private.h'
libtoolize: copying file 'ltdl/libltdl/lt__strl.h'
libtoolize: copying file 'ltdl/libltdl/lt_dlloader.h'
libtoolize: copying file 'ltdl/libltdl/lt_error.h'
libtoolize: copying file 'ltdl/libltdl/lt_system.h'
libtoolize: copying file 'ltdl/libltdl/slist.h'
libtoolize: copying file 'ltdl/loaders/dld_link.c'
libtoolize: copying file 'ltdl/loaders/dlopen.c'
libtoolize: copying file 'ltdl/loaders/dyld.c'
libtoolize: copying file 'ltdl/loaders/load_add_on.c'
libtoolize: copying file 'ltdl/loaders/loadlibrary.c'
libtoolize: copying file 'ltdl/loaders/preopen.c'
libtoolize: copying file 'ltdl/loaders/shl_load.c'
libtoolize: copying file 'ltdl/lt__alloc.c'
libtoolize: copying file 'ltdl/lt__argz.c'
libtoolize: copying file 'ltdl/lt__dirent.c'
libtoolize: copying file 'ltdl/lt__strl.c'
libtoolize: copying file 'ltdl/lt_dlloader.c'
libtoolize: copying file 'ltdl/lt_error.c'
libtoolize: copying file 'ltdl/ltdl.c'
libtoolize: copying file 'ltdl/ltdl.h'
libtoolize: creating file 'ltdl/ltdl.mk'
libtoolize: copying file 'ltdl/slist.c'
libtoolize: Remember to add 'LT_CONFIG_LTDL_DIR([ltdl])' to 'configure.ac'.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
_ATEOF


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_INIT
LTDL_INIT([nonrecursive])
AC_OUTPUT
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:437: \$LIBTOOLIZE --copy --install --ltdl=ltdl

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:437"
( $at_check_trace; $LIBTOOLIZE --copy --install --ltdl=ltdl


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:437"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_9
#AT_START_10
at_fn_group_banner 10 'libtoolize.at:523' \
  "copy ltdl.m4 with shared macro directory" "       " 2
at_xfail=no
(
  $as_echo "10. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: linking file 'build-aux/compile'
libtoolize: linking file 'build-aux/config.guess'
libtoolize: linking file 'build-aux/config.sub'
libtoolize: linking file 'build-aux/depcomp'
libtoolize: linking file 'build-aux/install-sh'
libtoolize: linking file 'build-aux/missing'
libtoolize: linking file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: linking file 'm4/libtool.m4'
libtoolize: linking file 'm4/ltargz.m4'
libtoolize: linking file 'm4/ltdl.m4'
libtoolize: linking file 'm4/ltoptions.m4'
libtoolize: linking file 'm4/ltsugar.m4'
libtoolize: linking file 'm4/ltversion.m4'
libtoolize: linking file 'm4/lt~obsolete.m4'
libtoolize: putting libltdl files in LT_CONFIG_LTDL_DIR, 'ltdl'.
libtoolize: linking file 'ltdl/COPYING.LIB'
libtoolize: linking file 'ltdl/Makefile.am'
libtoolize: linking file 'ltdl/README'
libtoolize: linking file 'ltdl/configure.ac'
libtoolize: copying file 'ltdl/aclocal.m4'
libtoolize: linking file 'ltdl/Makefile.in'
libtoolize: linking file 'ltdl/config-h.in'
libtoolize: copying file 'ltdl/configure'
libtoolize: linking file 'ltdl/libltdl/lt__alloc.h'
libtoolize: linking file 'ltdl/libltdl/lt__argz_.h'
libtoolize: linking file 'ltdl/libltdl/lt__dirent.h'
libtoolize: linking file 'ltdl/libltdl/lt__glibc.h'
libtoolize: linking file 'ltdl/libltdl/lt__private.h'
libtoolize: linking file 'ltdl/libltdl/lt__strl.h'
libtoolize: linking file 'ltdl/libltdl/lt_dlloader.h'
libtoolize: linking file 'ltdl/libltdl/lt_error.h'
libtoolize: linking file 'ltdl/libltdl/lt_system.h'
libtoolize: linking file 'ltdl/libltdl/slist.h'
libtoolize: linking file 'ltdl/loaders/dld_link.c'
libtoolize: linking file 'ltdl/loaders/dlopen.c'
libtoolize: linking file 'ltdl/loaders/dyld.c'
libtoolize: linking file 'ltdl/loaders/load_add_on.c'
libtoolize: linking file 'ltdl/loaders/loadlibrary.c'
libtoolize: linking file 'ltdl/loaders/preopen.c'
libtoolize: linking file 'ltdl/loaders/shl_load.c'
libtoolize: linking file 'ltdl/lt__alloc.c'
libtoolize: linking file 'ltdl/lt__argz.c'
libtoolize: linking file 'ltdl/lt__dirent.c'
libtoolize: linking file 'ltdl/lt__strl.c'
libtoolize: linking file 'ltdl/lt_dlloader.c'
libtoolize: linking file 'ltdl/lt_error.c'
libtoolize: linking file 'ltdl/ltdl.c'
libtoolize: linking file 'ltdl/ltdl.h'
libtoolize: linking file 'ltdl/slist.c'
_ATEOF


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
LT_CONFIG_LTDL_DIR([ltdl])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_INIT
LTDL_INIT
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I m4
_ATEOF



lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:527: \$LIBTOOLIZE --ltdl

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:527"
( $at_check_trace; $LIBTOOLIZE --ltdl


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:527"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_10
#AT_START_11
at_fn_group_banner 11 'libtoolize.at:535' \
  "correctly parse LTDL_INIT from configure.ac" "    " 2
at_xfail=no
(
  $as_echo "11. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: linking file 'build-aux/compile'
libtoolize: linking file 'build-aux/config.guess'
libtoolize: linking file 'build-aux/config.sub'
libtoolize: linking file 'build-aux/depcomp'
libtoolize: linking file 'build-aux/install-sh'
libtoolize: linking file 'build-aux/missing'
libtoolize: linking file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: linking file 'm4/libtool.m4'
libtoolize: linking file 'm4/ltargz.m4'
libtoolize: linking file 'm4/ltdl.m4'
libtoolize: linking file 'm4/ltoptions.m4'
libtoolize: linking file 'm4/ltsugar.m4'
libtoolize: linking file 'm4/ltversion.m4'
libtoolize: linking file 'm4/lt~obsolete.m4'
libtoolize: putting libltdl files in LT_CONFIG_LTDL_DIR, 'ltdl'.
libtoolize: linking file 'ltdl/COPYING.LIB'
libtoolize: linking file 'ltdl/Makefile.am'
libtoolize: linking file 'ltdl/README'
libtoolize: linking file 'ltdl/configure.ac'
libtoolize: copying file 'ltdl/aclocal.m4'
libtoolize: linking file 'ltdl/Makefile.in'
libtoolize: linking file 'ltdl/config-h.in'
libtoolize: copying file 'ltdl/configure'
libtoolize: linking file 'ltdl/libltdl/lt__alloc.h'
libtoolize: linking file 'ltdl/libltdl/lt__argz_.h'
libtoolize: linking file 'ltdl/libltdl/lt__dirent.h'
libtoolize: linking file 'ltdl/libltdl/lt__glibc.h'
libtoolize: linking file 'ltdl/libltdl/lt__private.h'
libtoolize: linking file 'ltdl/libltdl/lt__strl.h'
libtoolize: linking file 'ltdl/libltdl/lt_dlloader.h'
libtoolize: linking file 'ltdl/libltdl/lt_error.h'
libtoolize: linking file 'ltdl/libltdl/lt_system.h'
libtoolize: linking file 'ltdl/libltdl/slist.h'
libtoolize: linking file 'ltdl/loaders/dld_link.c'
libtoolize: linking file 'ltdl/loaders/dlopen.c'
libtoolize: linking file 'ltdl/loaders/dyld.c'
libtoolize: linking file 'ltdl/loaders/load_add_on.c'
libtoolize: linking file 'ltdl/loaders/loadlibrary.c'
libtoolize: linking file 'ltdl/loaders/preopen.c'
libtoolize: linking file 'ltdl/loaders/shl_load.c'
libtoolize: linking file 'ltdl/lt__alloc.c'
libtoolize: linking file 'ltdl/lt__argz.c'
libtoolize: linking file 'ltdl/lt__dirent.c'
libtoolize: linking file 'ltdl/lt__strl.c'
libtoolize: linking file 'ltdl/lt_dlloader.c'
libtoolize: linking file 'ltdl/lt_error.c'
libtoolize: linking file 'ltdl/ltdl.c'
libtoolize: linking file 'ltdl/ltdl.h'
libtoolize: linking file 'ltdl/slist.c'
_ATEOF


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
LT_CONFIG_LTDL_DIR([ltdl])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_INIT
LTDL_INIT
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I m4
_ATEOF



lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:539: \$LIBTOOLIZE

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:539"
( $at_check_trace; $LIBTOOLIZE


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:539"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_11
#AT_START_12
at_fn_group_banner 12 'libtoolize.at:547' \
  "diagnose missing LTDL_INIT invocation" "          " 2
at_xfail=no
(
  $as_echo "12. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/compile'
libtoolize: copying file 'build-aux/config.guess'
libtoolize: copying file 'build-aux/config.sub'
libtoolize: copying file 'build-aux/depcomp'
libtoolize: copying file 'build-aux/install-sh'
libtoolize: copying file 'build-aux/missing'
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltargz.m4'
libtoolize: copying file 'm4/ltdl.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
libtoolize: putting libltdl files in LT_CONFIG_LTDL_DIR, 'ltdl'.
libtoolize: copying file 'ltdl/COPYING.LIB'
libtoolize: copying file 'ltdl/Makefile.am'
libtoolize: copying file 'ltdl/README'
libtoolize: copying file 'ltdl/configure.ac'
libtoolize: copying file 'ltdl/aclocal.m4'
libtoolize: copying file 'ltdl/Makefile.in'
libtoolize: copying file 'ltdl/config-h.in'
libtoolize: copying file 'ltdl/configure'
libtoolize: copying file 'ltdl/libltdl/lt__alloc.h'
libtoolize: copying file 'ltdl/libltdl/lt__argz_.h'
libtoolize: copying file 'ltdl/libltdl/lt__dirent.h'
libtoolize: copying file 'ltdl/libltdl/lt__glibc.h'
libtoolize: copying file 'ltdl/libltdl/lt__private.h'
libtoolize: copying file 'ltdl/libltdl/lt__strl.h'
libtoolize: copying file 'ltdl/libltdl/lt_dlloader.h'
libtoolize: copying file 'ltdl/libltdl/lt_error.h'
libtoolize: copying file 'ltdl/libltdl/lt_system.h'
libtoolize: copying file 'ltdl/libltdl/slist.h'
libtoolize: copying file 'ltdl/loaders/dld_link.c'
libtoolize: copying file 'ltdl/loaders/dlopen.c'
libtoolize: copying file 'ltdl/loaders/dyld.c'
libtoolize: copying file 'ltdl/loaders/load_add_on.c'
libtoolize: copying file 'ltdl/loaders/loadlibrary.c'
libtoolize: copying file 'ltdl/loaders/preopen.c'
libtoolize: copying file 'ltdl/loaders/shl_load.c'
libtoolize: copying file 'ltdl/lt__alloc.c'
libtoolize: copying file 'ltdl/lt__argz.c'
libtoolize: copying file 'ltdl/lt__dirent.c'
libtoolize: copying file 'ltdl/lt__strl.c'
libtoolize: copying file 'ltdl/lt_dlloader.c'
libtoolize: copying file 'ltdl/lt_error.c'
libtoolize: copying file 'ltdl/ltdl.c'
libtoolize: copying file 'ltdl/ltdl.h'
libtoolize: copying file 'ltdl/slist.c'
libtoolize: Remember to add 'LTDL_INIT' to configure.ac.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
_ATEOF


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
LT_CONFIG_LTDL_DIR([ltdl])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_INIT
AC_OUTPUT
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:614: \$LIBTOOLIZE --ltdl --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:614"
( $at_check_trace; $LIBTOOLIZE --ltdl --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:614"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_12
#AT_START_13
at_fn_group_banner 13 'libtoolize.at:624' \
  "upgrading verbatim style aclocal.m4" "            " 2
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
(
  $as_echo "13. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
LT_INIT
AC_OUTPUT
_ATEOF


cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: You should add the contents of the following files to 'aclocal.m4':
libtoolize:   '/usr/local/share/aclocal/libtool.m4'
libtoolize:   '/usr/local/share/aclocal/ltoptions.m4'
libtoolize:   '/usr/local/share/aclocal/ltsugar.m4'
libtoolize:   '/usr/local/share/aclocal/ltversion.m4'
libtoolize:   '/usr/local/share/aclocal/lt~obsolete.m4'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:647: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:647"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:647"
$at_failed && at_fn_log_failure
$at_traceon; }




## --------------------------------------- ##
## Upgrading a hand maintained aclocal.m4. ##
## --------------------------------------- ##

cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_INIT
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I m4
_ATEOF


cat >aclocal.m4 <<'_ATEOF'
# This should need upgrading:
# serial 25 LT_INIT
AC_DEFUN([LT_INIT],
[blah])

# This is newer than the upgrade version:
# serial 99999 ltoptions.m4

# This is older than the upgrade version:
# serial 1 ltversion.m4
_ATEOF


cat >expout <<'_ATEOF'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: You should add the contents of 'm4/ltsugar.m4' to 'aclocal.m4'.
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: You should add the contents of 'm4/ltversion.m4' to 'aclocal.m4'.
libtoolize: copying file 'm4/lt~obsolete.m4'
libtoolize: You should add the contents of 'm4/lt~obsolete.m4' to 'aclocal.m4'.
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:691: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:691"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:691"
$at_failed && at_fn_log_failure
$at_traceon; }




## ------------------------------------------- ##
## Upgrading an aclocal maintained aclocal.m4. ##
## ------------------------------------------- ##

macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/libtoolize.at:698: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "libtoolize.at:698"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:698"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1




rm -f m4/libtool.m4 m4/ltoptions.m4

# This file should be upgraded.
cat >m4/libtool.m4 <<'_ATEOF'

# serial 25 LT_INIT
AC_DEFUN([LT_INIT])
_ATEOF


# This file has a very high serial number, and should be left unchanged.
cat >m4/ltoptions.m4 <<'_ATEOF'

# serial 99999 ltoptions.m4
_ATEOF


cat >expout <<'_ATEOF'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
_ATEOF


cat >experr <<'_ATEOF'
libtoolize:   error: 'm4/ltoptions.m4' is newer: use '--force' to overwrite
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < experr > experr.t
mv -f experr.t experr
{ set +x
$as_echo "$at_srcdir/libtoolize.at:722: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:722"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
$at_diff experr "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:722"
$at_failed && at_fn_log_failure
$at_traceon; }



## ----------------------------------------------------------- ##
## Now, a forced update to downgrade files with newer serials. ##
## ----------------------------------------------------------- ##

cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:739: \$LIBTOOLIZE --copy --force

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:739"
( $at_check_trace; $LIBTOOLIZE --copy --force


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:739"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_13
#AT_START_14
at_fn_group_banner 14 'libtoolize.at:748' \
  "verbatim aclocal.m4 w/o AC_CONFIG_MACRO_DIRS" "   " 2
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
(
  $as_echo "14. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
LT_INIT
AC_OUTPUT
_ATEOF


cat >aclocal.m4 <<'_ATEOF'
# This should need upgrading:
# serial 25 LT_INIT
AC_DEFUN([LT_INIT],
[blah])

# This is newer than the upgrade version:
# serial 99999 ltoptions.m4

# This is older than the upgrade version:
# serial 1 ltversion.m4
_ATEOF


cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: You should add the contents of the following files to 'aclocal.m4':
libtoolize:   '/usr/local/share/aclocal/libtool.m4'
libtoolize:   '/usr/local/share/aclocal/ltsugar.m4'
libtoolize:   '/usr/local/share/aclocal/ltversion.m4'
libtoolize:   '/usr/local/share/aclocal/lt~obsolete.m4'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:782: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:782"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:782"
$at_failed && at_fn_log_failure
$at_traceon; }




## ------------------------------------------------------------------------ ##
## Upgrading an aclocal maintained aclocal.m4 without AC_CONFIG_MACRO_DIRS. ##
## ------------------------------------------------------------------------ ##

macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I $abs_top_srcdir/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/libtoolize.at:789: \$ACLOCAL -I \$abs_top_srcdir/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I $abs_top_srcdir/m4$macro_dir" "libtoolize.at:789"
( $at_check_trace; $ACLOCAL -I $abs_top_srcdir/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:789"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1




## The following code is adapted (and simplified) from libtoolize.in
####
basename='s|^.*/||'

# func_grep expression filename
# Check whether EXPRESSION matches any line of FILENAME, without output.
func_grep ()
{
    $GREP "$1" "$2" >/dev/null 2>&1
}

# func_serial filename [macro_regex]
# Output the value of the serial number comment in FILENAME, where the
# comment line must also match MACRO_REGEX, if given.
func_serial ()
{
    my_filename=$1
    my_macro_regex=$2
    my_sed_serial='
	/^# serial [1-9][0-9.]*[	 ]*'"$my_macro_regex"'[	 ]*$/ {
	    s|^# serial \([1-9][0-9.]*\).*$|\1|
	    q
	}
	d'

    # Search FILENAME and all the files it m4_includes for a serial number
    # in the file that AC_DEFUNs MACRO_REGEX.
    my_serial=
    if test -z "$my_macro_regex" ||
       test aclocal.m4 = "$my_filename" ||
       test "$my_macro_regex" = `echo "$my_filename" | $SED "$basename"` ||
       func_grep '^AC_DEFUN(\['"$my_macro_regex" "$my_filename"
    then
      my_serial=`$SED -e "$my_sed_serial" "$my_filename"`
    fi

    # If the file has no serial number, something is badly wrong!
    test -n "$my_serial" || exit 1

    echo $my_serial
}

# Make the serial number in aclocal.m4 higher than installed ltoptions.m4,
# and the others match the macro files that libtoolize will compare against.
libtool_serial=`func_serial "$tst_aclocaldir/libtool.m4" LT_INIT`
ltversion_serial=`func_serial "$tst_aclocaldir/ltversion.m4" ltversion.m4`
ltsugar_serial=`func_serial "$tst_aclocaldir/ltsugar.m4" ltsugar.m4`
lt_obsolete_serial=`func_serial "$tst_aclocaldir/lt~obsolete.m4" lt~obsolete.m4`
$SED -e 's|^#.*serial.*ltoptions.m4$|# serial 99999 ltoptions.m4|' \
   -e "s|^#.*serial.*libtool.m4\$|# serial $libtool_serial libtool.m4|" \
  -e "s|^#.*serial.*ltversion.m4\$|# serial $ltversion_serial ltversion.m4|" \
  -e "s|^#.*serial.*ltsugar.m4\$|# serial $ltsugar_serial ltsugar.m4|" \
  -e "s|^#.*serial.*lt~obsolete.m4\$|# serial $lt_obsolete_serial lt~obsolete.m4|" \
 < aclocal.m4 > aclocal.m4t
mv -f aclocal.m4t aclocal.m4

cat >expout <<'_ATEOF'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:853: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:853"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:853"
$at_failed && at_fn_log_failure
$at_traceon; }




## --------------------- ##
## Now, a forced update. ##
## --------------------- ##

cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:868: \$LIBTOOLIZE --copy --force

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:868"
( $at_check_trace; $LIBTOOLIZE --copy --force


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:868"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_14
#AT_START_15
at_fn_group_banner 15 'libtoolize.at:877' \
  "nonrecursive ltdl with AC_CONFIG_MACRO_DIRS" "    " 2
at_xfail=no
(
  $as_echo "15. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/config.guess'
libtoolize: copying file 'build-aux/config.sub'
libtoolize: copying file 'build-aux/install-sh'
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltargz.m4'
libtoolize: copying file 'm4/ltdl.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
libtoolize: putting libltdl files in LT_CONFIG_LTDL_DIR, 'ltdl'.
libtoolize: copying file 'ltdl/COPYING.LIB'
libtoolize: copying file 'ltdl/README'
libtoolize: copying file 'ltdl/libltdl/lt__alloc.h'
libtoolize: copying file 'ltdl/libltdl/lt__argz_.h'
libtoolize: copying file 'ltdl/libltdl/lt__dirent.h'
libtoolize: copying file 'ltdl/libltdl/lt__glibc.h'
libtoolize: copying file 'ltdl/libltdl/lt__private.h'
libtoolize: copying file 'ltdl/libltdl/lt__strl.h'
libtoolize: copying file 'ltdl/libltdl/lt_dlloader.h'
libtoolize: copying file 'ltdl/libltdl/lt_error.h'
libtoolize: copying file 'ltdl/libltdl/lt_system.h'
libtoolize: copying file 'ltdl/libltdl/slist.h'
libtoolize: copying file 'ltdl/loaders/dld_link.c'
libtoolize: copying file 'ltdl/loaders/dlopen.c'
libtoolize: copying file 'ltdl/loaders/dyld.c'
libtoolize: copying file 'ltdl/loaders/load_add_on.c'
libtoolize: copying file 'ltdl/loaders/loadlibrary.c'
libtoolize: copying file 'ltdl/loaders/preopen.c'
libtoolize: copying file 'ltdl/loaders/shl_load.c'
libtoolize: copying file 'ltdl/lt__alloc.c'
libtoolize: copying file 'ltdl/lt__argz.c'
libtoolize: copying file 'ltdl/lt__dirent.c'
libtoolize: copying file 'ltdl/lt__strl.c'
libtoolize: copying file 'ltdl/lt_dlloader.c'
libtoolize: copying file 'ltdl/lt_error.c'
libtoolize: copying file 'ltdl/ltdl.c'
libtoolize: copying file 'ltdl/ltdl.h'
libtoolize: creating file 'ltdl/ltdl.mk'
libtoolize: copying file 'ltdl/slist.c'
_ATEOF


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
LT_CONFIG_LTDL_DIR([ltdl])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_INIT
LTDL_INIT([nonrecursive])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I m4
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:939: \$LIBTOOLIZE --copy --install --ltdl=ltdl

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:939"
( $at_check_trace; $LIBTOOLIZE --copy --install --ltdl=ltdl


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:939"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_15
#AT_START_16
at_fn_group_banner 16 'libtoolize.at:948' \
  "subproject ltdl with unconventional layout" "     " 2
at_xfail=no
(
  $as_echo "16. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'acaux'.
libtoolize: copying file 'acaux/compile'
libtoolize: copying file 'acaux/config.guess'
libtoolize: copying file 'acaux/config.sub'
libtoolize: copying file 'acaux/depcomp'
libtoolize: copying file 'acaux/install-sh'
libtoolize: copying file 'acaux/missing'
libtoolize: copying file 'acaux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'acm4'.
libtoolize: copying file 'acm4/libtool.m4'
libtoolize: copying file 'acm4/ltargz.m4'
libtoolize: copying file 'acm4/ltdl.m4'
libtoolize: copying file 'acm4/ltoptions.m4'
libtoolize: copying file 'acm4/ltsugar.m4'
libtoolize: copying file 'acm4/ltversion.m4'
libtoolize: copying file 'acm4/lt~obsolete.m4'
libtoolize: putting libltdl files in LT_CONFIG_LTDL_DIR, 'ltdl'.
libtoolize: copying file 'ltdl/COPYING.LIB'
libtoolize: creating file 'ltdl/Makefile.am'
libtoolize: copying file 'ltdl/README'
libtoolize: creating file 'ltdl/configure.ac'
libtoolize: creating file 'ltdl/aclocal.m4'
libtoolize: creating file 'ltdl/Makefile.in'
libtoolize: copying file 'ltdl/config-h.in'
libtoolize: creating file 'ltdl/configure'
libtoolize: copying file 'ltdl/libltdl/lt__alloc.h'
libtoolize: copying file 'ltdl/libltdl/lt__argz_.h'
libtoolize: copying file 'ltdl/libltdl/lt__dirent.h'
libtoolize: copying file 'ltdl/libltdl/lt__glibc.h'
libtoolize: copying file 'ltdl/libltdl/lt__private.h'
libtoolize: copying file 'ltdl/libltdl/lt__strl.h'
libtoolize: copying file 'ltdl/libltdl/lt_dlloader.h'
libtoolize: copying file 'ltdl/libltdl/lt_error.h'
libtoolize: copying file 'ltdl/libltdl/lt_system.h'
libtoolize: copying file 'ltdl/libltdl/slist.h'
libtoolize: copying file 'ltdl/loaders/dld_link.c'
libtoolize: copying file 'ltdl/loaders/dlopen.c'
libtoolize: copying file 'ltdl/loaders/dyld.c'
libtoolize: copying file 'ltdl/loaders/load_add_on.c'
libtoolize: copying file 'ltdl/loaders/loadlibrary.c'
libtoolize: copying file 'ltdl/loaders/preopen.c'
libtoolize: copying file 'ltdl/loaders/shl_load.c'
libtoolize: copying file 'ltdl/lt__alloc.c'
libtoolize: copying file 'ltdl/lt__argz.c'
libtoolize: copying file 'ltdl/lt__dirent.c'
libtoolize: copying file 'ltdl/lt__strl.c'
libtoolize: copying file 'ltdl/lt_dlloader.c'
libtoolize: copying file 'ltdl/lt_error.c'
libtoolize: copying file 'ltdl/ltdl.c'
libtoolize: copying file 'ltdl/ltdl.h'
libtoolize: copying file 'ltdl/slist.c'
libtoolize: Consider adding '-I acm4' to ACLOCAL_AMFLAGS in Makefile.am.
_ATEOF


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
LT_CONFIG_LTDL_DIR([ltdl])
AC_CONFIG_AUX_DIR([acaux])
AC_CONFIG_MACRO_DIRS([acm4])
LT_INIT
LTDL_INIT([subproject])
AC_OUTPUT
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/libtoolize.at:1015: \$LIBTOOLIZE --copy --install

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:1015"
( $at_check_trace; $LIBTOOLIZE --copy --install


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:1015"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_16
#AT_START_17
at_fn_group_banner 17 'libtoolize.at:1024' \
  "Subproject ltdl without GNU M4" "                 " 2
at_xfail=no
(
  $as_echo "17. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in 'ltdl'.
libtoolize: linking file 'ltdl/compile'
libtoolize: linking file 'ltdl/config.guess'
libtoolize: linking file 'ltdl/config.sub'
libtoolize: linking file 'ltdl/depcomp'
libtoolize: linking file 'ltdl/install-sh'
libtoolize: linking file 'ltdl/missing'
libtoolize: linking file 'ltdl/ltmain.sh'
libtoolize: putting macros in 'ltdl/m4'.
libtoolize: linking file 'ltdl/m4/libtool.m4'
libtoolize: linking file 'ltdl/m4/ltargz.m4'
libtoolize: linking file 'ltdl/m4/ltdl.m4'
libtoolize: linking file 'ltdl/m4/ltoptions.m4'
libtoolize: linking file 'ltdl/m4/ltsugar.m4'
libtoolize: linking file 'ltdl/m4/ltversion.m4'
libtoolize: linking file 'ltdl/m4/lt~obsolete.m4'
libtoolize: putting libltdl files in 'ltdl'.
libtoolize: linking file 'ltdl/COPYING.LIB'
libtoolize: creating file 'ltdl/Makefile.am'
libtoolize: linking file 'ltdl/README'
libtoolize: creating file 'ltdl/configure.ac'
libtoolize: creating file 'ltdl/aclocal.m4'
libtoolize: creating file 'ltdl/Makefile.in'
libtoolize: linking file 'ltdl/config-h.in'
libtoolize: creating file 'ltdl/configure'
libtoolize: linking file 'ltdl/libltdl/lt__alloc.h'
libtoolize: linking file 'ltdl/libltdl/lt__argz_.h'
libtoolize: linking file 'ltdl/libltdl/lt__dirent.h'
libtoolize: linking file 'ltdl/libltdl/lt__glibc.h'
libtoolize: linking file 'ltdl/libltdl/lt__private.h'
libtoolize: linking file 'ltdl/libltdl/lt__strl.h'
libtoolize: linking file 'ltdl/libltdl/lt_dlloader.h'
libtoolize: linking file 'ltdl/libltdl/lt_error.h'
libtoolize: linking file 'ltdl/libltdl/lt_system.h'
libtoolize: linking file 'ltdl/libltdl/slist.h'
libtoolize: linking file 'ltdl/loaders/dld_link.c'
libtoolize: linking file 'ltdl/loaders/dlopen.c'
libtoolize: linking file 'ltdl/loaders/dyld.c'
libtoolize: linking file 'ltdl/loaders/load_add_on.c'
libtoolize: linking file 'ltdl/loaders/loadlibrary.c'
libtoolize: linking file 'ltdl/loaders/preopen.c'
libtoolize: linking file 'ltdl/loaders/shl_load.c'
libtoolize: linking file 'ltdl/lt__alloc.c'
libtoolize: linking file 'ltdl/lt__argz.c'
libtoolize: linking file 'ltdl/lt__dirent.c'
libtoolize: linking file 'ltdl/lt__strl.c'
libtoolize: linking file 'ltdl/lt_dlloader.c'
libtoolize: linking file 'ltdl/lt_error.c'
libtoolize: linking file 'ltdl/ltdl.c'
libtoolize: linking file 'ltdl/ltdl.h'
libtoolize: linking file 'ltdl/slist.c'
_ATEOF


cat >no-m4 <<'_ATEOF'
#! /bin/sh
echo 'error: do not call m4' >&2
exit 1
_ATEOF

chmod a+x ./no-m4

{ set +x
$as_echo "$at_srcdir/libtoolize.at:1087: PATH=\`pwd\`:\$PATH M4=\`pwd\`/no-m4 \$LIBTOOLIZE --ltdl=ltdl"
at_fn_check_prepare_notrace 'a `...` command substitution' "libtoolize.at:1087"
( $at_check_trace; PATH=`pwd`:$PATH M4=`pwd`/no-m4 $LIBTOOLIZE --ltdl=ltdl
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:1087"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_17
#AT_START_18
at_fn_group_banner 18 'libtoolize.at:1096' \
  "LIBTOOLIZE_OPTIONS" "                             " 2
at_xfail=no
(
  $as_echo "18. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_INIT
AC_OUTPUT
_ATEOF



LIBTOOLIZE_OPTIONS=narf
export LIBTOOLIZE_OPTIONS

cat >experr <<'_ATEOF'
libtoolize:   error: garbled LIBTOOLIZE_OPTIONS near 'narf'
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < experr > experr.t
mv -f experr.t experr
{ set +x
$as_echo "$at_srcdir/libtoolize.at:1107: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:1107"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
$at_diff experr "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/libtoolize.at:1107"
$at_failed && at_fn_log_failure
$at_traceon; }




## --------------------------- ##
## Unknown LIBTOOLIZE_OPTIONS. ##
## --------------------------- ##

LIBTOOLIZE_OPTIONS=--no-such-option
export LIBTOOLIZE_OPTIONS

cat >experr <<'_ATEOF'
libtoolize: warning: unrecognized environment option '--no-such-option'
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < experr > experr.t
mv -f experr.t experr
{ set +x
$as_echo "$at_srcdir/libtoolize.at:1121: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:1121"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
$at_diff experr "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:1121"
$at_failed && at_fn_log_failure
$at_traceon; }




## ----------------------------- ##
## --no-warn environment option. ##
## ----------------------------- ##

LIBTOOLIZE_OPTIONS=--no-warn,--no-such-option
export LIBTOOLIZE_OPTIONS

: >experr

lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < experr > experr.t
mv -f experr.t experr
{ set +x
$as_echo "$at_srcdir/libtoolize.at:1133: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:1133"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
$at_diff experr "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:1133"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_18
#AT_START_19
at_fn_group_banner 19 'libtoolize.at:1142' \
  "cleanup old installation" "                       " 2
at_xfail=no
(
  $as_echo "19. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_INIT
AC_OUTPUT
_ATEOF



cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I m4
_ATEOF


cat >acinclude.m4 <<'_ATEOF'
AC_DEFUN([LT_INIT],
[: keep me, I might be hand maintained!]) # LT_INIT
_ATEOF


cat >libltdl/acinclude.m4 <<'_ATEOF'
AC_DEFUN([LT_INIT],
[: delete me, I was left here by on old libltdl build]) # LT_INIT
_ATEOF


{ set +x
$as_echo "$at_srcdir/libtoolize.at:1160: \$LIBTOOLIZE --copy --force --ltdl

"
at_fn_check_prepare_notrace 'an embedded newline' "libtoolize.at:1160"
( $at_check_trace; $LIBTOOLIZE --copy --force --ltdl


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:1160"
$at_failed && at_fn_log_failure
$at_traceon; }



# check files are left as expected
{ set +x
$as_echo "$at_srcdir/libtoolize.at:1163: \$GREP 'keep me' acinclude.m4"
at_fn_check_prepare_dynamic "$GREP 'keep me' acinclude.m4" "libtoolize.at:1163"
( $at_check_trace; $GREP 'keep me' acinclude.m4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtoolize.at:1163"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/libtoolize.at:1164: test -f libltdl/acinclude.m4"
at_fn_check_prepare_trace "libtoolize.at:1164"
( $at_check_trace; test -f libltdl/acinclude.m4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/libtoolize.at:1164"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_19
#AT_START_20
at_fn_group_banner 20 'libtool.at:33' \
  "check help output" "                              " 3
at_xfail=no
(
  $as_echo "20. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/libtool.at:35: \$LIBTOOL --help"
at_fn_check_prepare_dynamic "$LIBTOOL --help" "libtool.at:35"
( $at_check_trace; $LIBTOOL --help
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:35"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/libtool.at:36: \$GREP '^Usage:' stdout stderr"
at_fn_check_prepare_dynamic "$GREP '^Usage:' stdout stderr" "libtool.at:36"
( $at_check_trace; $GREP '^Usage:' stdout stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:36"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/libtool.at:38: \$LIBTOOL --mode=link --help"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --help" "libtool.at:38"
( $at_check_trace; $LIBTOOL --mode=link --help
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:38"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/libtool.at:39: \$GREP '^Usage:' stdout stderr"
at_fn_check_prepare_dynamic "$GREP '^Usage:' stdout stderr" "libtool.at:39"
( $at_check_trace; $GREP '^Usage:' stdout stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:39"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_20
#AT_START_21
at_fn_group_banner 21 'libtool.at:48' \
  "diagnose no mode specified" "                     " 3
at_xfail=no
(
  $as_echo "21. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/libtool.at:50: \$LIBTOOL"
at_fn_check_prepare_dynamic "$LIBTOOL" "libtool.at:50"
( $at_check_trace; $LIBTOOL
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/libtool.at:50"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/libtool.at:51: \$GREP 'you must specify a MODE' stderr"
at_fn_check_prepare_dynamic "$GREP 'you must specify a MODE' stderr" "libtool.at:51"
( $at_check_trace; $GREP 'you must specify a MODE' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:51"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_21
#AT_START_22
at_fn_group_banner 22 'libtool.at:60' \
  "quote shell meta-characters in filenames" "       " 3
at_xfail=no
(
  $as_echo "22. $at_setup_line: testing $at_desc ..."
  $at_traceon


eval `$LIBTOOL --config | $GREP '^wl='`

# Do the torture test.
for mode in compile link install; do

  # Unfortunately, without an array data type, it is nearly impossible
  # to protect libtool from metacharacters in filenames.  So, we just
  # try metacharacters in the options it needs to pass to other programs.

  # preargs and postargs need to go through libtool unmodified.
  case $mode in
  compile)
    preargs="$CC -c"
    preflag=
    match_preflag=
    flag=-DVAR=
    postargs=foo.c
    ;;

  link)
    preargs="$CC -o hell -g -O"
    preflag=-Wl,
    match_preflag=$wl
    flag=-someflag=
    postargs=foo.o
    ;;

  install)
    preargs="install -c"
    preflag=
    match_preflag=
    flag=--something=
    postargs="hell /usr/local/bin/hell"
    ;;
  esac


  # Trivial...

  { set +x
$as_echo "$at_srcdir/libtool.at:101: \$LIBTOOL -n --mode=\$mode \$preargs \$preflag\"\$flag:test\" \$postargs"
at_fn_check_prepare_dynamic "$LIBTOOL -n --mode=$mode $preargs $preflag\"$flag:test\" $postargs" "libtool.at:101"
( $at_check_trace; $LIBTOOL -n --mode=$mode $preargs $preflag"$flag:test" $postargs
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:101"
$at_failed && at_fn_log_failure
$at_traceon; }

  # We must not attempt to match $preargs in the output, because libtool
  # may modify them.  For example, on Cygwin, 'libtool --mode=link gcc -o
  # foo foo.o'  becomes 'gcc -o foo.exe foo.o'.
  { set +x
$as_echo "$at_srcdir/libtool.at:106: \$GREP \"\$mode:.*\$match_preflag\$flag:test \" stdout"
at_fn_check_prepare_dynamic "$GREP \"$mode:.*$match_preflag$flag:test \" stdout" "libtool.at:106"
( $at_check_trace; $GREP "$mode:.*$match_preflag$flag:test " stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:106"
$at_failed && at_fn_log_failure
$at_traceon; }



  # Non-trivial...

  # Backslash needs to be double-escaped: one escape is stripped as the shell
  # collects arguments for grep (\\\\\\\\ => \\\\), and then another escape
  # is stripped by grep itself (\\\\ => \\) before the resulting expression is
  # matched (grepping for \\ matches \):
  { set +x
$as_echo "$at_srcdir/libtool.at:115: \$LIBTOOL -n --mode=\$mode \$preargs \$preflag\"\$flag\\\\:test\\\\\" \$postargs"
at_fn_check_prepare_dynamic "$LIBTOOL -n --mode=$mode $preargs $preflag\"$flag\\\\:test\\\\\" $postargs" "libtool.at:115"
( $at_check_trace; $LIBTOOL -n --mode=$mode $preargs $preflag"$flag\\:test\\" $postargs
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:115"
$at_failed && at_fn_log_failure
$at_traceon; }

  # NOTE: we use "..."'"'"..." to insert a literal quote into the expression
  #       because "...\"..." is not expanded consistently by all shells.
  { set +x
$as_echo "$at_srcdir/libtool.at:119: \$GREP \"\$mode:.*\$match_preflag\"'\"\\{0,1\\}'\"\$flag\\\\\\\\\\\\\\\\:test\\\\\\\\\\\\\\\\\"'\"\\{0,1\\} ' stdout"
at_fn_check_prepare_dynamic "$GREP \"$mode:.*$match_preflag\"'\"\\{0,1\\}'\"$flag\\\\\\\\\\\\\\\\:test\\\\\\\\\\\\\\\\\"'\"\\{0,1\\} ' stdout" "libtool.at:119"
( $at_check_trace; $GREP "$mode:.*$match_preflag"'"\{0,1\}'"$flag\\\\\\\\:test\\\\\\\\"'"\{0,1\} ' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:119"
$at_failed && at_fn_log_failure
$at_traceon; }


  # Shell metacharacters that should be backslashified by libtool.
  for mchar in \" \` \$; do
    { set +x
$as_echo "$at_srcdir/libtool.at:124: \$LIBTOOL -n --mode=\$mode \$preargs \$preflag\"\$flag\$mchar:test\$mchar\" \$postargs"
at_fn_check_prepare_dynamic "$LIBTOOL -n --mode=$mode $preargs $preflag\"$flag$mchar:test$mchar\" $postargs" "libtool.at:124"
( $at_check_trace; $LIBTOOL -n --mode=$mode $preargs $preflag"$flag$mchar:test$mchar" $postargs
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:124"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/libtool.at:126: \$GREP \"\$mode:.*\$match_preflag\"'\"'\"\\{0,1\\}\$flag\\\\\\\\\$mchar:test\\\\\\\\\$mchar\"'\"'\"\\{0,1\\} \" stdout"
at_fn_check_prepare_dynamic "$GREP \"$mode:.*$match_preflag\"'\"'\"\\{0,1\\}$flag\\\\\\\\$mchar:test\\\\\\\\$mchar\"'\"'\"\\{0,1\\} \" stdout" "libtool.at:126"
( $at_check_trace; $GREP "$mode:.*$match_preflag"'"'"\{0,1\}$flag\\\\$mchar:test\\\\$mchar"'"'"\{0,1\} " stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:126"
$at_failed && at_fn_log_failure
$at_traceon; }

  done

  # Shell metacharacters that should be double quoted by libtool, and need
  # backslash escaping for input to grep.
  for mchar in "[" "]" "^" "*"; do

    { set +x
$as_echo "$at_srcdir/libtool.at:133: \$LIBTOOL -n --mode=\$mode \$preargs \$preflag\"\$flag\$mchar:test\$mchar\" \$postargs"
at_fn_check_prepare_dynamic "$LIBTOOL -n --mode=$mode $preargs $preflag\"$flag$mchar:test$mchar\" $postargs" "libtool.at:133"
( $at_check_trace; $LIBTOOL -n --mode=$mode $preargs $preflag"$flag$mchar:test$mchar" $postargs
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:133"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/libtool.at:135: \$GREP \"\$mode:.*\$match_preflag\\\"\$flag\\\\\$mchar:test\\\\\$mchar\\\" \" stdout"
at_fn_check_prepare_dynamic "$GREP \"$mode:.*$match_preflag\\\"$flag\\\\$mchar:test\\\\$mchar\\\" \" stdout" "libtool.at:135"
( $at_check_trace; $GREP "$mode:.*$match_preflag\"$flag\\$mchar:test\\$mchar\" " stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:135"
$at_failed && at_fn_log_failure
$at_traceon; }

  done

  # Metacharacters that should be double quoted by libtool, but which are
  # not special to grep (NOTE: Some of these ARE special to $EGREP!!).
  for mchar in "~" "#" "&" "(" ")" "{" "}" "|" ";" "<" ">" "?" "'" " " "	"; do

    { set +x
$as_echo "$at_srcdir/libtool.at:142: \$LIBTOOL -n --mode=\$mode \$preargs \$preflag\"\$flag\$mchar:test\$mchar\" \$postargs"
at_fn_check_prepare_dynamic "$LIBTOOL -n --mode=$mode $preargs $preflag\"$flag$mchar:test$mchar\" $postargs" "libtool.at:142"
( $at_check_trace; $LIBTOOL -n --mode=$mode $preargs $preflag"$flag$mchar:test$mchar" $postargs
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:142"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/libtool.at:144: \$GREP \"\$mode:.*\$match_preflag\\\"\$flag\$mchar:test\$mchar\\\" \" stdout"
at_fn_check_prepare_dynamic "$GREP \"$mode:.*$match_preflag\\\"$flag$mchar:test$mchar\\\" \" stdout" "libtool.at:144"
( $at_check_trace; $GREP "$mode:.*$match_preflag\"$flag$mchar:test$mchar\" " stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:144"
$at_failed && at_fn_log_failure
$at_traceon; }

  done
done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_22
#AT_START_23
at_fn_group_banner 23 'libtool.at:155' \
  "transform source suffices" "                      " 3
at_xfail=no
(
  $as_echo "23. $at_setup_line: testing $at_desc ..."
  $at_traceon


# Extensions taken from the ones that Automake recognizes, plus Objective C,
# and GNU Ada.  Also test that multiple dots are handled correctly.
extensions="C F S ada adb ads asm c c++ cc cpp cxx f f90 F90 f95 F95 f03 F03 for go m s sx ada.ada"
bad_names=foo.

for ext in $extensions; do
  # Try a sample compile command.
  { set +x
$as_echo "$at_srcdir/libtool.at:164: \$LIBTOOL -n --mode=compile compiler -c foo.\$ext"
at_fn_check_prepare_dynamic "$LIBTOOL -n --mode=compile compiler -c foo.$ext" "libtool.at:164"
( $at_check_trace; $LIBTOOL -n --mode=compile compiler -c foo.$ext
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/libtool.at:164"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/libtool.at:166: \$GREP 'cannot' stderr"
at_fn_check_prepare_dynamic "$GREP 'cannot' stderr" "libtool.at:166"
( $at_check_trace; $GREP 'cannot' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/libtool.at:166"
$at_failed && at_fn_log_failure
$at_traceon; }

done

# Make sure that invalid suffixes are not recognized.
for name in $bad_names; do
  { set +x
$as_echo "$at_srcdir/libtool.at:171: \$LIBTOOL -n --mode=compile compiler -c \$name"
at_fn_check_prepare_dynamic "$LIBTOOL -n --mode=compile compiler -c $name" "libtool.at:171"
( $at_check_trace; $LIBTOOL -n --mode=compile compiler -c $name
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/libtool.at:171"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/libtool.at:173: \$GREP 'cannot' stderr"
at_fn_check_prepare_dynamic "$GREP 'cannot' stderr" "libtool.at:173"
( $at_check_trace; $GREP 'cannot' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:173"
$at_failed && at_fn_log_failure
$at_traceon; }

done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_23
#AT_START_24
at_fn_group_banner 24 'libtool.at:183' \
  "check link mode operation" "                      " 3
at_xfail=no
(
  $as_echo "24. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/libtool.at:185: \$LIBTOOL -n --mode=link \$CC -o gettext ../lib/libnlsut.a"
at_fn_check_prepare_dynamic "$LIBTOOL -n --mode=link $CC -o gettext ../lib/libnlsut.a" "libtool.at:185"
( $at_check_trace; $LIBTOOL -n --mode=link $CC -o gettext ../lib/libnlsut.a
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/libtool.at:186: \$EGREP '../lib/libnlsut.a' stdout"
at_fn_check_prepare_dynamic "$EGREP '../lib/libnlsut.a' stdout" "libtool.at:186"
( $at_check_trace; $EGREP '../lib/libnlsut.a' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }



cat >hell.lo <<'_ATEOF'
# Generated by libtool
pic_object=none
non_pic_object=hell.o
_ATEOF


{ set +x
$as_echo "$at_srcdir/libtool.at:195: \$LIBTOOL -n --mode=link \$CC -o something foo.o hell.lo"
at_fn_check_prepare_dynamic "$LIBTOOL -n --mode=link $CC -o something foo.o hell.lo" "libtool.at:195"
( $at_check_trace; $LIBTOOL -n --mode=link $CC -o something foo.o hell.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:195"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/libtool.at:196: \$FGREP '.lo ' stdout"
at_fn_check_prepare_dynamic "$FGREP '.lo ' stdout" "libtool.at:196"
( $at_check_trace; $FGREP '.lo ' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/libtool.at:196"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_24
#AT_START_25
at_fn_group_banner 25 'libtool.at:205' \
  "check objectlist file operation" "                " 3
at_xfail=no
(
  $as_echo "25. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/libtool.at:207: \$LIBTOOL -n --mode=link \$CC -objectlist nonexistent"
at_fn_check_prepare_dynamic "$LIBTOOL -n --mode=link $CC -objectlist nonexistent" "libtool.at:207"
( $at_check_trace; $LIBTOOL -n --mode=link $CC -objectlist nonexistent
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/libtool.at:207"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/libtool.at:208: \$GREP 'nonexistent' stderr"
at_fn_check_prepare_dynamic "$GREP 'nonexistent' stderr" "libtool.at:208"
( $at_check_trace; $GREP 'nonexistent' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:208"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_25
#AT_START_26
at_fn_group_banner 26 'libtool.at:217' \
  "test LT_SUPPORTED_TAG interface" "                " 3
at_xfail=no
(
  $as_echo "26. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/libtool.at:219: test no != \"\$AUTOCONF\" || exit 77"
at_fn_check_prepare_dynamic "test no != \"$AUTOCONF\" || exit 77" "libtool.at:219"
( $at_check_trace; test no != "$AUTOCONF" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:219"
$at_failed && at_fn_log_failure
$at_traceon; }


cp $abs_top_srcdir/aclocal.m4 ./aclocal.m4
cp $abs_top_srcdir/configure.ac ./configure.ac
cp -r $abs_top_srcdir/build-aux ./build-aux
cp -r $abs_top_srcdir/m4 ./m4

# Retrieve the list of tags supported by our main libtool script.
traced_tags=`$AUTOCONF --trace 'LT_SUPPORTED_TAG:$1'`
{ set +x
$as_echo "$at_srcdir/libtool.at:228: test -n \"\$traced_tags\""
at_fn_check_prepare_dynamic "test -n \"$traced_tags\"" "libtool.at:228"
( $at_check_trace; test -n "$traced_tags"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:228"
$at_failed && at_fn_log_failure
$at_traceon; }


# Ensure each of them is accepted by --tag.
# (We do some useless operation like erasing an empty file, because
# we are just interested in whether --tag accepts the tag or not.)
for tag in $traced_tags; do
  { set +x
$as_echo "$at_srcdir/libtool.at:234: \$LIBTOOL -n --mode=link --tag=\$tag compiler -o liba.la foo.lo"
at_fn_check_prepare_dynamic "$LIBTOOL -n --mode=link --tag=$tag compiler -o liba.la foo.lo" "libtool.at:234"
( $at_check_trace; $LIBTOOL -n --mode=link --tag=$tag compiler -o liba.la foo.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:234"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/libtool.at:236: \$GREP 'ignoring unknown tag' stderr"
at_fn_check_prepare_dynamic "$GREP 'ignoring unknown tag' stderr" "libtool.at:236"
( $at_check_trace; $GREP 'ignoring unknown tag' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/libtool.at:236"
$at_failed && at_fn_log_failure
$at_traceon; }

done

# Ensure the above command would have failed for unknown tags
{ set +x
$as_echo "$at_srcdir/libtool.at:240: \$LIBTOOL -n --mode=link --tag=UnKnOwN compiler -o liba.la foo.lo"
at_fn_check_prepare_dynamic "$LIBTOOL -n --mode=link --tag=UnKnOwN compiler -o liba.la foo.lo" "libtool.at:240"
( $at_check_trace; $LIBTOOL -n --mode=link --tag=UnKnOwN compiler -o liba.la foo.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:240"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/libtool.at:242: \$GREP 'ignoring unknown tag' stderr"
at_fn_check_prepare_dynamic "$GREP 'ignoring unknown tag' stderr" "libtool.at:242"
( $at_check_trace; $GREP 'ignoring unknown tag' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/libtool.at:242"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_26
#AT_START_27
at_fn_group_banner 27 'demo.at:384' \
  "link against a preloaded static library" "        " 4
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "27. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([dlopen win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

case $lt_cv_sys_global_symbol_pipe in
  ?*) binary_helldl=yes ;;
esac
AM_CONDITIONAL([BINARY_HELLDL], [test yes = "$binary_helldl"])

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LIBADD = $(LIBM)
libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
libhello_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO

include_HEADERS = foo.h

if BINARY_HELLDL
BUILD_helldl = helldl
else
BUILD_helldl =
endif

bin_PROGRAMS = hell hell_static $(BUILD_helldl)

# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la

# Create a statically linked version of hell.
hell_static_SOURCES = main.c
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = $(STATIC)

if BINARY_HELLDL

# Create a version of hell that does a preloaded dlopen.
helldl_SOURCES = dlmain.c
helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
helldl_DEPENDENCIES = libhello.la

else

# Create a script that says that -dlopen is not supported.
bin_SCRIPTS = helldl
helldl helldl$(EXEEXT):
	rm -rf
	echo '#! /bin/sh' >
	echo 'echo sorry, -dlopen is unsupported' >>
	chmod +x

endif

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

include $(srcdir)/demo.mk
_ATEOF


cat >demo.mk <<'_ATEOF'
## Don't abort for lack of demo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
 * earlier do not define __CYGWIN__.  This snippet allows us to check
 * for __CYGWIN__ reliably for both current, old, and (probable) future
 * releases.
 */
#ifdef __CYGWIN32__
#  ifndef __CYGWIN__
#    define __CYGWIN__
#  endif
#endif

#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
# ifdef BUILDING_LIBHELLO
#  ifdef DLL_EXPORT
#   define LIBHELLO_SCOPE extern __declspec (dllexport)
#  endif
# else
#  define LIBHELLO_SCOPE extern __declspec (dllimport)
# endif
#endif
#ifndef LIBHELLO_SCOPE
# define LIBHELLO_SCOPE extern
#endif

/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
# define LT_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data.  */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

#ifdef __cplusplus
extern "C" {
#endif

int foo (void);
int hello (void);
LIBHELLO_SCOPE int nothing;

#ifdef __cplusplus
}
#endif

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

/* Give a global variable definition. */
int nothing = FOO_RET;

int foo (void) {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}
_ATEOF


cat >hell1.c <<'_ATEOF'
#include <config.h>
int hell1 (void) { return 1; }
_ATEOF


cat >hell2.c <<'_ATEOF'
#include <config.h>
int hell2 (void) { return 2; }
_ATEOF


cat >hello.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int hello (void) {
  printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int main ()
{
  printf ("Welcome to GNU Hell!\n");

  /* Try assigning to the nothing variable. */
  nothing = 1;

  /* Just call the functions and check return values. */
  if (foo () != FOO_RET)
    return 1;

  if (hello () != HELLO_RET)
    return 2;

  return 0;
}
_ATEOF


cat >dlmain.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"

#define STREQ !strcmp

#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols

typedef struct
{
  const char *name;
  void *address;
} lt_dlsymlist;

extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];

int main ()
{
  const lt_dlsymlist *s;
  int (*pfoo)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;

  printf ("Welcome to *modular* GNU Hell!\n");

  /* Look up the symbols we require for this demonstration. */
  s = lt_preloaded_symbols;
  while (s->name)
    {
      if (s->address) {
        const char *name = s->name;
        printf ("found symbol: %s\n", name);
        if (STREQ ("@INIT@", name))
	  ((void(*)())s->address)();
        if (STREQ ("hello", name))
	  phello = (int(*)())s->address;
        else if (STREQ ("foo", name))
	  pfoo = (int(*)())s->address;
        else if (STREQ ("nothing", name))
#ifndef _WIN32
	  /* In an ideal world we could do this... */
	  pnothing = (int*)s->address;
#else /* !_WIN32 */
	  /* In an ideal world a shared lib would be able to export data */
	  pnothing = (int*)&nothing;
#endif
      } else
        printf ("found file: %s\n", s->name);
      s ++;
    }

  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    fprintf (stderr, "did not find the 'nothing' variable\n");

  /* Just call the functions and check return values. */
  if (pfoo)
    {
      if ((*pfoo) () != FOO_RET)
	return 1;
    }
  else
    fprintf (stderr, "did not find the 'foo' function\n");

  if (phello)
    {
      if ((*phello) () != HELLO_RET)
	return 3;
    }
  else
    fprintf (stderr, "did not find the 'hello' function\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/demo.at:388: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "demo.at:388"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:388"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/demo.at:388: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "demo.at:388"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:388"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:388: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "demo.at:388"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:388"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/demo.at:388: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "demo.at:388"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/demo.at:388"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:388: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "demo.at:388"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:388"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:388: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-shared"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "demo.at:388"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-shared
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:388"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:388: \$EGREP '^build_old_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=yes' libtool" "demo.at:388"
( $at_check_trace; $EGREP '^build_old_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:388"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/demo.at:388: \$EGREP '^build_libtool_libs=no' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=no' libtool" "demo.at:388"
( $at_check_trace; $EGREP '^build_libtool_libs=no' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:388"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/demo.at:390: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:390"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:390"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./hell_static; if test -f "./hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:390: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:390"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:390"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./hell; if test -f "./hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:390: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:390"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:390"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:390: ./helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:390"
( $at_check_trace; ./helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:390"
$at_failed && at_fn_log_failure
$at_traceon; }


# Windows hosts search for dlls in the command path.
PATH=$prefix/lib:$PATH

for target in install
do
  { set +x
$as_echo "$at_srcdir/demo.at:391: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:391"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:391"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=$prefix/bin/hell_static; if test -f "$prefix/bin/hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:391: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:391"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:391"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$prefix/bin/hell; if test -f "$prefix/bin/hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:391: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:391"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:391"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:391: \$prefix/bin/helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:391"
( $at_check_trace; $prefix/bin/helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:391"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in uninstall
do
  { set +x
$as_echo "$at_srcdir/demo.at:392: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:392"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:392"
$at_failed && at_fn_log_failure
$at_traceon; }

done


leftovers=`find $prefix ! -type d ! -name '.*' -print`
{ set +x
$as_echo "$at_srcdir/demo.at:392: test -z \"\$leftovers\""
at_fn_check_prepare_dynamic "test -z \"$leftovers\"" "demo.at:392"
( $at_check_trace; test -z "$leftovers"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:392"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_27
#AT_START_28
at_fn_group_banner 28 'demo.at:401' \
  "build and dynamically load a module" "            " 4
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "28. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([dlopen win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

case $lt_cv_sys_global_symbol_pipe in
  ?*) binary_helldl=yes ;;
esac
AM_CONDITIONAL([BINARY_HELLDL], [test yes = "$binary_helldl"])

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LIBADD = $(LIBM)
libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
libhello_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO

include_HEADERS = foo.h

if BINARY_HELLDL
BUILD_helldl = helldl
else
BUILD_helldl =
endif

bin_PROGRAMS = hell hell_static $(BUILD_helldl)

# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la

# Create a statically linked version of hell.
hell_static_SOURCES = main.c
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = $(STATIC)

if BINARY_HELLDL

# Create a version of hell that does a preloaded dlopen.
helldl_SOURCES = dlmain.c
helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
helldl_DEPENDENCIES = libhello.la

else

# Create a script that says that -dlopen is not supported.
bin_SCRIPTS = helldl
helldl helldl$(EXEEXT):
	rm -rf
	echo '#! /bin/sh' >
	echo 'echo sorry, -dlopen is unsupported' >>
	chmod +x

endif

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

include $(srcdir)/demo.mk
_ATEOF


cat >demo.mk <<'_ATEOF'
## Don't abort for lack of demo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
 * earlier do not define __CYGWIN__.  This snippet allows us to check
 * for __CYGWIN__ reliably for both current, old, and (probable) future
 * releases.
 */
#ifdef __CYGWIN32__
#  ifndef __CYGWIN__
#    define __CYGWIN__
#  endif
#endif

#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
# ifdef BUILDING_LIBHELLO
#  ifdef DLL_EXPORT
#   define LIBHELLO_SCOPE extern __declspec (dllexport)
#  endif
# else
#  define LIBHELLO_SCOPE extern __declspec (dllimport)
# endif
#endif
#ifndef LIBHELLO_SCOPE
# define LIBHELLO_SCOPE extern
#endif

/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
# define LT_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data.  */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

#ifdef __cplusplus
extern "C" {
#endif

int foo (void);
int hello (void);
LIBHELLO_SCOPE int nothing;

#ifdef __cplusplus
}
#endif

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

/* Give a global variable definition. */
int nothing = FOO_RET;

int foo (void) {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}
_ATEOF


cat >hell1.c <<'_ATEOF'
#include <config.h>
int hell1 (void) { return 1; }
_ATEOF


cat >hell2.c <<'_ATEOF'
#include <config.h>
int hell2 (void) { return 2; }
_ATEOF


cat >hello.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int hello (void) {
  printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int main ()
{
  printf ("Welcome to GNU Hell!\n");

  /* Try assigning to the nothing variable. */
  nothing = 1;

  /* Just call the functions and check return values. */
  if (foo () != FOO_RET)
    return 1;

  if (hello () != HELLO_RET)
    return 2;

  return 0;
}
_ATEOF


cat >dlmain.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"

#define STREQ !strcmp

#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols

typedef struct
{
  const char *name;
  void *address;
} lt_dlsymlist;

extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];

int main ()
{
  const lt_dlsymlist *s;
  int (*pfoo)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;

  printf ("Welcome to *modular* GNU Hell!\n");

  /* Look up the symbols we require for this demonstration. */
  s = lt_preloaded_symbols;
  while (s->name)
    {
      if (s->address) {
        const char *name = s->name;
        printf ("found symbol: %s\n", name);
        if (STREQ ("@INIT@", name))
	  ((void(*)())s->address)();
        if (STREQ ("hello", name))
	  phello = (int(*)())s->address;
        else if (STREQ ("foo", name))
	  pfoo = (int(*)())s->address;
        else if (STREQ ("nothing", name))
#ifndef _WIN32
	  /* In an ideal world we could do this... */
	  pnothing = (int*)s->address;
#else /* !_WIN32 */
	  /* In an ideal world a shared lib would be able to export data */
	  pnothing = (int*)&nothing;
#endif
      } else
        printf ("found file: %s\n", s->name);
      s ++;
    }

  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    fprintf (stderr, "did not find the 'nothing' variable\n");

  /* Just call the functions and check return values. */
  if (pfoo)
    {
      if ((*pfoo) () != FOO_RET)
	return 1;
    }
  else
    fprintf (stderr, "did not find the 'foo' function\n");

  if (phello)
    {
      if ((*phello) () != HELLO_RET)
	return 3;
    }
  else
    fprintf (stderr, "did not find the 'hello' function\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/demo.at:405: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "demo.at:405"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:405"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/demo.at:405: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "demo.at:405"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:405"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:405: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "demo.at:405"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:405"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/demo.at:405: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "demo.at:405"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/demo.at:405"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:405: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "demo.at:405"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:405"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:405: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-static"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "demo.at:405"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-static
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:405"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:405: \$EGREP '^build_old_libs=no' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=no' libtool" "demo.at:405"
( $at_check_trace; $EGREP '^build_old_libs=no' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:405"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/demo.at:405: \$EGREP '^build_libtool_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=yes' libtool" "demo.at:405"
( $at_check_trace; $EGREP '^build_libtool_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:405"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/demo.at:407: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:407"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:407"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./hell_static; if test -f "./hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:407: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:407"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:407"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./hell; if test -f "./hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:407: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:407"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:407"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:407: ./helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:407"
( $at_check_trace; ./helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:407"
$at_failed && at_fn_log_failure
$at_traceon; }


# Windows hosts search for dlls in the command path.
PATH=$prefix/lib:$PATH

for target in install
do
  { set +x
$as_echo "$at_srcdir/demo.at:408: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:408"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:408"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=$prefix/bin/hell_static; if test -f "$prefix/bin/hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:408: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:408"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:408"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$prefix/bin/hell; if test -f "$prefix/bin/hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:408: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:408"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:408"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:408: \$prefix/bin/helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:408"
( $at_check_trace; $prefix/bin/helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:408"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in uninstall
do
  { set +x
$as_echo "$at_srcdir/demo.at:409: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:409"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:409"
$at_failed && at_fn_log_failure
$at_traceon; }

done


leftovers=`find $prefix ! -type d ! -name '.*' -print`
{ set +x
$as_echo "$at_srcdir/demo.at:409: test -z \"\$leftovers\""
at_fn_check_prepare_dynamic "test -z \"$leftovers\"" "demo.at:409"
( $at_check_trace; test -z "$leftovers"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:409"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_28
#AT_START_29
at_fn_group_banner 29 'demo.at:418' \
  "preload static and dynamic module" "              " 4
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "29. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([dlopen win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

case $lt_cv_sys_global_symbol_pipe in
  ?*) binary_helldl=yes ;;
esac
AM_CONDITIONAL([BINARY_HELLDL], [test yes = "$binary_helldl"])

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LIBADD = $(LIBM)
libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
libhello_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO

include_HEADERS = foo.h

if BINARY_HELLDL
BUILD_helldl = helldl
else
BUILD_helldl =
endif

bin_PROGRAMS = hell hell_static $(BUILD_helldl)

# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la

# Create a statically linked version of hell.
hell_static_SOURCES = main.c
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = $(STATIC)

if BINARY_HELLDL

# Create a version of hell that does a preloaded dlopen.
helldl_SOURCES = dlmain.c
helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
helldl_DEPENDENCIES = libhello.la

else

# Create a script that says that -dlopen is not supported.
bin_SCRIPTS = helldl
helldl helldl$(EXEEXT):
	rm -rf
	echo '#! /bin/sh' >
	echo 'echo sorry, -dlopen is unsupported' >>
	chmod +x

endif

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

include $(srcdir)/demo.mk
_ATEOF


cat >demo.mk <<'_ATEOF'
## Don't abort for lack of demo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
 * earlier do not define __CYGWIN__.  This snippet allows us to check
 * for __CYGWIN__ reliably for both current, old, and (probable) future
 * releases.
 */
#ifdef __CYGWIN32__
#  ifndef __CYGWIN__
#    define __CYGWIN__
#  endif
#endif

#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
# ifdef BUILDING_LIBHELLO
#  ifdef DLL_EXPORT
#   define LIBHELLO_SCOPE extern __declspec (dllexport)
#  endif
# else
#  define LIBHELLO_SCOPE extern __declspec (dllimport)
# endif
#endif
#ifndef LIBHELLO_SCOPE
# define LIBHELLO_SCOPE extern
#endif

/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
# define LT_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data.  */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

#ifdef __cplusplus
extern "C" {
#endif

int foo (void);
int hello (void);
LIBHELLO_SCOPE int nothing;

#ifdef __cplusplus
}
#endif

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

/* Give a global variable definition. */
int nothing = FOO_RET;

int foo (void) {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}
_ATEOF


cat >hell1.c <<'_ATEOF'
#include <config.h>
int hell1 (void) { return 1; }
_ATEOF


cat >hell2.c <<'_ATEOF'
#include <config.h>
int hell2 (void) { return 2; }
_ATEOF


cat >hello.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int hello (void) {
  printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int main ()
{
  printf ("Welcome to GNU Hell!\n");

  /* Try assigning to the nothing variable. */
  nothing = 1;

  /* Just call the functions and check return values. */
  if (foo () != FOO_RET)
    return 1;

  if (hello () != HELLO_RET)
    return 2;

  return 0;
}
_ATEOF


cat >dlmain.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"

#define STREQ !strcmp

#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols

typedef struct
{
  const char *name;
  void *address;
} lt_dlsymlist;

extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];

int main ()
{
  const lt_dlsymlist *s;
  int (*pfoo)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;

  printf ("Welcome to *modular* GNU Hell!\n");

  /* Look up the symbols we require for this demonstration. */
  s = lt_preloaded_symbols;
  while (s->name)
    {
      if (s->address) {
        const char *name = s->name;
        printf ("found symbol: %s\n", name);
        if (STREQ ("@INIT@", name))
	  ((void(*)())s->address)();
        if (STREQ ("hello", name))
	  phello = (int(*)())s->address;
        else if (STREQ ("foo", name))
	  pfoo = (int(*)())s->address;
        else if (STREQ ("nothing", name))
#ifndef _WIN32
	  /* In an ideal world we could do this... */
	  pnothing = (int*)s->address;
#else /* !_WIN32 */
	  /* In an ideal world a shared lib would be able to export data */
	  pnothing = (int*)&nothing;
#endif
      } else
        printf ("found file: %s\n", s->name);
      s ++;
    }

  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    fprintf (stderr, "did not find the 'nothing' variable\n");

  /* Just call the functions and check return values. */
  if (pfoo)
    {
      if ((*pfoo) () != FOO_RET)
	return 1;
    }
  else
    fprintf (stderr, "did not find the 'foo' function\n");

  if (phello)
    {
      if ((*phello) () != HELLO_RET)
	return 3;
    }
  else
    fprintf (stderr, "did not find the 'hello' function\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/demo.at:422: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "demo.at:422"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/demo.at:422: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "demo.at:422"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:422: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "demo.at:422"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:422"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/demo.at:422: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "demo.at:422"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/demo.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:422: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "demo.at:422"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:422: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "demo.at:422"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:422: \$EGREP '^build_old_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=yes' libtool" "demo.at:422"
( $at_check_trace; $EGREP '^build_old_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/demo.at:422: \$EGREP '^build_libtool_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=yes' libtool" "demo.at:422"
( $at_check_trace; $EGREP '^build_libtool_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/demo.at:424: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:424"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:424"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./hell_static; if test -f "./hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:424: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:424"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:424"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./hell; if test -f "./hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:424: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:424"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:424"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:424: ./helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:424"
( $at_check_trace; ./helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:424"
$at_failed && at_fn_log_failure
$at_traceon; }


# Windows hosts search for dlls in the command path.
PATH=$prefix/lib:$PATH

for target in install
do
  { set +x
$as_echo "$at_srcdir/demo.at:425: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:425"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:425"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=$prefix/bin/hell_static; if test -f "$prefix/bin/hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:425: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:425"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:425"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$prefix/bin/hell; if test -f "$prefix/bin/hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:425: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:425"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:425"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:425: \$prefix/bin/helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:425"
( $at_check_trace; $prefix/bin/helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:425"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in uninstall
do
  { set +x
$as_echo "$at_srcdir/demo.at:426: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:426"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:426"
$at_failed && at_fn_log_failure
$at_traceon; }

done


leftovers=`find $prefix ! -type d ! -name '.*' -print`
{ set +x
$as_echo "$at_srcdir/demo.at:426: test -z \"\$leftovers\""
at_fn_check_prepare_dynamic "test -z \"$leftovers\"" "demo.at:426"
( $at_check_trace; test -z "$leftovers"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:426"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_29
#AT_START_30
at_fn_group_banner 30 'demo.at:438' \
  "deplibs_check_method" "                           " 4
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "30. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([dlopen win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

case $lt_cv_sys_global_symbol_pipe in
  ?*) binary_helldl=yes ;;
esac
AM_CONDITIONAL([BINARY_HELLDL], [test yes = "$binary_helldl"])

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LIBADD = $(LIBM)
libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
libhello_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO

include_HEADERS = foo.h

if BINARY_HELLDL
BUILD_helldl = helldl
else
BUILD_helldl =
endif

bin_PROGRAMS = hell hell_static $(BUILD_helldl)

# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la

# Create a statically linked version of hell.
hell_static_SOURCES = main.c
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = $(STATIC)

if BINARY_HELLDL

# Create a version of hell that does a preloaded dlopen.
helldl_SOURCES = dlmain.c
helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
helldl_DEPENDENCIES = libhello.la

else

# Create a script that says that -dlopen is not supported.
bin_SCRIPTS = helldl
helldl helldl$(EXEEXT):
	rm -rf
	echo '#! /bin/sh' >
	echo 'echo sorry, -dlopen is unsupported' >>
	chmod +x

endif

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

include $(srcdir)/demo.mk
_ATEOF


cat >demo.mk <<'_ATEOF'
## Don't abort for lack of demo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
 * earlier do not define __CYGWIN__.  This snippet allows us to check
 * for __CYGWIN__ reliably for both current, old, and (probable) future
 * releases.
 */
#ifdef __CYGWIN32__
#  ifndef __CYGWIN__
#    define __CYGWIN__
#  endif
#endif

#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
# ifdef BUILDING_LIBHELLO
#  ifdef DLL_EXPORT
#   define LIBHELLO_SCOPE extern __declspec (dllexport)
#  endif
# else
#  define LIBHELLO_SCOPE extern __declspec (dllimport)
# endif
#endif
#ifndef LIBHELLO_SCOPE
# define LIBHELLO_SCOPE extern
#endif

/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
# define LT_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data.  */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

#ifdef __cplusplus
extern "C" {
#endif

int foo (void);
int hello (void);
LIBHELLO_SCOPE int nothing;

#ifdef __cplusplus
}
#endif

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

/* Give a global variable definition. */
int nothing = FOO_RET;

int foo (void) {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}
_ATEOF


cat >hell1.c <<'_ATEOF'
#include <config.h>
int hell1 (void) { return 1; }
_ATEOF


cat >hell2.c <<'_ATEOF'
#include <config.h>
int hell2 (void) { return 2; }
_ATEOF


cat >hello.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int hello (void) {
  printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int main ()
{
  printf ("Welcome to GNU Hell!\n");

  /* Try assigning to the nothing variable. */
  nothing = 1;

  /* Just call the functions and check return values. */
  if (foo () != FOO_RET)
    return 1;

  if (hello () != HELLO_RET)
    return 2;

  return 0;
}
_ATEOF


cat >dlmain.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"

#define STREQ !strcmp

#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols

typedef struct
{
  const char *name;
  void *address;
} lt_dlsymlist;

extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];

int main ()
{
  const lt_dlsymlist *s;
  int (*pfoo)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;

  printf ("Welcome to *modular* GNU Hell!\n");

  /* Look up the symbols we require for this demonstration. */
  s = lt_preloaded_symbols;
  while (s->name)
    {
      if (s->address) {
        const char *name = s->name;
        printf ("found symbol: %s\n", name);
        if (STREQ ("@INIT@", name))
	  ((void(*)())s->address)();
        if (STREQ ("hello", name))
	  phello = (int(*)())s->address;
        else if (STREQ ("foo", name))
	  pfoo = (int(*)())s->address;
        else if (STREQ ("nothing", name))
#ifndef _WIN32
	  /* In an ideal world we could do this... */
	  pnothing = (int*)s->address;
#else /* !_WIN32 */
	  /* In an ideal world a shared lib would be able to export data */
	  pnothing = (int*)&nothing;
#endif
      } else
        printf ("found file: %s\n", s->name);
      s ++;
    }

  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    fprintf (stderr, "did not find the 'nothing' variable\n");

  /* Just call the functions and check return values. */
  if (pfoo)
    {
      if ((*pfoo) () != FOO_RET)
	return 1;
    }
  else
    fprintf (stderr, "did not find the 'foo' function\n");

  if (phello)
    {
      if ((*phello) () != HELLO_RET)
	return 3;
    }
  else
    fprintf (stderr, "did not find the 'hello' function\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


cat >demo.mk <<'_ATEOF'
EXTRA_LIBRARIES = libhell0.a
libhell0_a_SOURCES =
libhell0_a_LIBADD = hello.$(OBJEXT) foo.$(OBJEXT)
EXTRA_LTLIBRARIES = libhell1.la libhell2.la
libhell1_la_SOURCES = hell1.c
libhell1_la_LIBADD = -L. -lhell0
libhell1_la_LDFLAGS = -no-undefined -rpath $(libdir)
libhell1_la_DEPENDENCIES = libhell0.a
libhell2_la_SOURCES = hell2.c
libhell2_la_LIBADD = -L. -lhell0
libhell2_la_LDFLAGS = -no-undefined -rpath $(libdir)
libhell2_la_DEPENDENCIES = libhell0.a
EXTRA_PROGRAMS = hell0
hell0_SOURCES = main.c
hell0_LDADD = libhell1.la libhell2.la $(LIBM)

# 'hell0' in EXTRA_PROGRAMS gets translated to 'hell0.exe'; but we
# must explicitly list the wrapper script 'hell0'.  (bin_PROGRAMS
# are handled seamlessly by automake rules; the extra step is only
# necessary for EXTRA_PROGRAMS)
CLEANFILES = $(EXTRA_LIBRARIES) $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS) hell0

deplibs-check: hell0$(EXEEXT)
_ATEOF


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/demo.at:468: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "demo.at:468"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:468"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/demo.at:468: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "demo.at:468"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:468"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:468: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "demo.at:468"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:468"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/demo.at:468: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "demo.at:468"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/demo.at:468"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:468: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "demo.at:468"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:468"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:468: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-static"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "demo.at:468"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-static
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:468"
$at_failed && at_fn_log_failure
$at_traceon; }






for target in deplibs-check
do
  { set +x
$as_echo "$at_srcdir/demo.at:469: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:469"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:469"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./hell0; if test -f "./hell0$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:470: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:470"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:470"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_30
#AT_START_31
at_fn_group_banner 31 'demo.at:479' \
  "disable fast install" "                           " 4
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "31. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([dlopen win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

case $lt_cv_sys_global_symbol_pipe in
  ?*) binary_helldl=yes ;;
esac
AM_CONDITIONAL([BINARY_HELLDL], [test yes = "$binary_helldl"])

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LIBADD = $(LIBM)
libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
libhello_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO

include_HEADERS = foo.h

if BINARY_HELLDL
BUILD_helldl = helldl
else
BUILD_helldl =
endif

bin_PROGRAMS = hell hell_static $(BUILD_helldl)

# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la

# Create a statically linked version of hell.
hell_static_SOURCES = main.c
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = $(STATIC)

if BINARY_HELLDL

# Create a version of hell that does a preloaded dlopen.
helldl_SOURCES = dlmain.c
helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
helldl_DEPENDENCIES = libhello.la

else

# Create a script that says that -dlopen is not supported.
bin_SCRIPTS = helldl
helldl helldl$(EXEEXT):
	rm -rf
	echo '#! /bin/sh' >
	echo 'echo sorry, -dlopen is unsupported' >>
	chmod +x

endif

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

include $(srcdir)/demo.mk
_ATEOF


cat >demo.mk <<'_ATEOF'
## Don't abort for lack of demo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
 * earlier do not define __CYGWIN__.  This snippet allows us to check
 * for __CYGWIN__ reliably for both current, old, and (probable) future
 * releases.
 */
#ifdef __CYGWIN32__
#  ifndef __CYGWIN__
#    define __CYGWIN__
#  endif
#endif

#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
# ifdef BUILDING_LIBHELLO
#  ifdef DLL_EXPORT
#   define LIBHELLO_SCOPE extern __declspec (dllexport)
#  endif
# else
#  define LIBHELLO_SCOPE extern __declspec (dllimport)
# endif
#endif
#ifndef LIBHELLO_SCOPE
# define LIBHELLO_SCOPE extern
#endif

/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
# define LT_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data.  */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

#ifdef __cplusplus
extern "C" {
#endif

int foo (void);
int hello (void);
LIBHELLO_SCOPE int nothing;

#ifdef __cplusplus
}
#endif

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

/* Give a global variable definition. */
int nothing = FOO_RET;

int foo (void) {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}
_ATEOF


cat >hell1.c <<'_ATEOF'
#include <config.h>
int hell1 (void) { return 1; }
_ATEOF


cat >hell2.c <<'_ATEOF'
#include <config.h>
int hell2 (void) { return 2; }
_ATEOF


cat >hello.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int hello (void) {
  printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int main ()
{
  printf ("Welcome to GNU Hell!\n");

  /* Try assigning to the nothing variable. */
  nothing = 1;

  /* Just call the functions and check return values. */
  if (foo () != FOO_RET)
    return 1;

  if (hello () != HELLO_RET)
    return 2;

  return 0;
}
_ATEOF


cat >dlmain.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"

#define STREQ !strcmp

#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols

typedef struct
{
  const char *name;
  void *address;
} lt_dlsymlist;

extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];

int main ()
{
  const lt_dlsymlist *s;
  int (*pfoo)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;

  printf ("Welcome to *modular* GNU Hell!\n");

  /* Look up the symbols we require for this demonstration. */
  s = lt_preloaded_symbols;
  while (s->name)
    {
      if (s->address) {
        const char *name = s->name;
        printf ("found symbol: %s\n", name);
        if (STREQ ("@INIT@", name))
	  ((void(*)())s->address)();
        if (STREQ ("hello", name))
	  phello = (int(*)())s->address;
        else if (STREQ ("foo", name))
	  pfoo = (int(*)())s->address;
        else if (STREQ ("nothing", name))
#ifndef _WIN32
	  /* In an ideal world we could do this... */
	  pnothing = (int*)s->address;
#else /* !_WIN32 */
	  /* In an ideal world a shared lib would be able to export data */
	  pnothing = (int*)&nothing;
#endif
      } else
        printf ("found file: %s\n", s->name);
      s ++;
    }

  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    fprintf (stderr, "did not find the 'nothing' variable\n");

  /* Just call the functions and check return values. */
  if (pfoo)
    {
      if ((*pfoo) () != FOO_RET)
	return 1;
    }
  else
    fprintf (stderr, "did not find the 'foo' function\n");

  if (phello)
    {
      if ((*phello) () != HELLO_RET)
	return 3;
    }
  else
    fprintf (stderr, "did not find the 'hello' function\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/demo.at:483: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "demo.at:483"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:483"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/demo.at:483: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "demo.at:483"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:483"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:483: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "demo.at:483"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:483"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/demo.at:483: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "demo.at:483"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/demo.at:483"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:483: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "demo.at:483"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:483"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:483: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --enable-fast-install=no"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "demo.at:483"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --enable-fast-install=no
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:483"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:484: \$EGREP '^hardcode_action=relink' libtool && (exit 77)"
at_fn_check_prepare_dynamic "$EGREP '^hardcode_action=relink' libtool && (exit 77)" "demo.at:484"
( $at_check_trace; $EGREP '^hardcode_action=relink' libtool && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/demo.at:484"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/demo.at:486: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:486"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:486"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./hell_static; if test -f "./hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:486: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:486"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:486"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./hell; if test -f "./hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:486: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:486"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:486"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:486: ./helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:486"
( $at_check_trace; ./helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:486"
$at_failed && at_fn_log_failure
$at_traceon; }


# Windows hosts search for dlls in the command path.
PATH=$prefix/lib:$PATH

for target in install
do
  { set +x
$as_echo "$at_srcdir/demo.at:487: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:487"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:487"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=$prefix/bin/hell_static; if test -f "$prefix/bin/hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:487: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:487"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:487"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$prefix/bin/hell; if test -f "$prefix/bin/hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:487: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:487"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:487"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:487: \$prefix/bin/helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:487"
( $at_check_trace; $prefix/bin/helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:487"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in uninstall
do
  { set +x
$as_echo "$at_srcdir/demo.at:488: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:488"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:488"
$at_failed && at_fn_log_failure
$at_traceon; }

done


leftovers=`find $prefix ! -type d ! -name '.*' -print`
{ set +x
$as_echo "$at_srcdir/demo.at:488: test -z \"\$leftovers\""
at_fn_check_prepare_dynamic "test -z \"$leftovers\"" "demo.at:488"
( $at_check_trace; test -z "$leftovers"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:488"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_31
#AT_START_32
at_fn_group_banner 32 'demo.at:497' \
  "force PIC objects" "                              " 4
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "32. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([dlopen win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

case $lt_cv_sys_global_symbol_pipe in
  ?*) binary_helldl=yes ;;
esac
AM_CONDITIONAL([BINARY_HELLDL], [test yes = "$binary_helldl"])

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LIBADD = $(LIBM)
libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
libhello_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO

include_HEADERS = foo.h

if BINARY_HELLDL
BUILD_helldl = helldl
else
BUILD_helldl =
endif

bin_PROGRAMS = hell hell_static $(BUILD_helldl)

# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la

# Create a statically linked version of hell.
hell_static_SOURCES = main.c
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = $(STATIC)

if BINARY_HELLDL

# Create a version of hell that does a preloaded dlopen.
helldl_SOURCES = dlmain.c
helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
helldl_DEPENDENCIES = libhello.la

else

# Create a script that says that -dlopen is not supported.
bin_SCRIPTS = helldl
helldl helldl$(EXEEXT):
	rm -rf
	echo '#! /bin/sh' >
	echo 'echo sorry, -dlopen is unsupported' >>
	chmod +x

endif

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

include $(srcdir)/demo.mk
_ATEOF


cat >demo.mk <<'_ATEOF'
## Don't abort for lack of demo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
 * earlier do not define __CYGWIN__.  This snippet allows us to check
 * for __CYGWIN__ reliably for both current, old, and (probable) future
 * releases.
 */
#ifdef __CYGWIN32__
#  ifndef __CYGWIN__
#    define __CYGWIN__
#  endif
#endif

#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
# ifdef BUILDING_LIBHELLO
#  ifdef DLL_EXPORT
#   define LIBHELLO_SCOPE extern __declspec (dllexport)
#  endif
# else
#  define LIBHELLO_SCOPE extern __declspec (dllimport)
# endif
#endif
#ifndef LIBHELLO_SCOPE
# define LIBHELLO_SCOPE extern
#endif

/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
# define LT_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data.  */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

#ifdef __cplusplus
extern "C" {
#endif

int foo (void);
int hello (void);
LIBHELLO_SCOPE int nothing;

#ifdef __cplusplus
}
#endif

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

/* Give a global variable definition. */
int nothing = FOO_RET;

int foo (void) {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}
_ATEOF


cat >hell1.c <<'_ATEOF'
#include <config.h>
int hell1 (void) { return 1; }
_ATEOF


cat >hell2.c <<'_ATEOF'
#include <config.h>
int hell2 (void) { return 2; }
_ATEOF


cat >hello.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int hello (void) {
  printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int main ()
{
  printf ("Welcome to GNU Hell!\n");

  /* Try assigning to the nothing variable. */
  nothing = 1;

  /* Just call the functions and check return values. */
  if (foo () != FOO_RET)
    return 1;

  if (hello () != HELLO_RET)
    return 2;

  return 0;
}
_ATEOF


cat >dlmain.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"

#define STREQ !strcmp

#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols

typedef struct
{
  const char *name;
  void *address;
} lt_dlsymlist;

extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];

int main ()
{
  const lt_dlsymlist *s;
  int (*pfoo)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;

  printf ("Welcome to *modular* GNU Hell!\n");

  /* Look up the symbols we require for this demonstration. */
  s = lt_preloaded_symbols;
  while (s->name)
    {
      if (s->address) {
        const char *name = s->name;
        printf ("found symbol: %s\n", name);
        if (STREQ ("@INIT@", name))
	  ((void(*)())s->address)();
        if (STREQ ("hello", name))
	  phello = (int(*)())s->address;
        else if (STREQ ("foo", name))
	  pfoo = (int(*)())s->address;
        else if (STREQ ("nothing", name))
#ifndef _WIN32
	  /* In an ideal world we could do this... */
	  pnothing = (int*)s->address;
#else /* !_WIN32 */
	  /* In an ideal world a shared lib would be able to export data */
	  pnothing = (int*)&nothing;
#endif
      } else
        printf ("found file: %s\n", s->name);
      s ++;
    }

  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    fprintf (stderr, "did not find the 'nothing' variable\n");

  /* Just call the functions and check return values. */
  if (pfoo)
    {
      if ((*pfoo) () != FOO_RET)
	return 1;
    }
  else
    fprintf (stderr, "did not find the 'foo' function\n");

  if (phello)
    {
      if ((*phello) () != HELLO_RET)
	return 3;
    }
  else
    fprintf (stderr, "did not find the 'hello' function\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/demo.at:501: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "demo.at:501"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:501"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/demo.at:501: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "demo.at:501"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:501"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:501: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "demo.at:501"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:501"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/demo.at:501: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "demo.at:501"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/demo.at:501"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:501: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "demo.at:501"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:501"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:501: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --with-pic"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "demo.at:501"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --with-pic
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:501"
$at_failed && at_fn_log_failure
$at_traceon; }






for target in all
do
  { set +x
$as_echo "$at_srcdir/demo.at:502: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:502"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:502"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./hell_static; if test -f "./hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:502: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:502"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:502"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./hell; if test -f "./hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:502: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:502"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:502"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:502: ./helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:502"
( $at_check_trace; ./helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:502"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_32
#AT_START_33
at_fn_group_banner 33 'demo.at:511' \
  "force non-PIC objects" "                          " 4
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "33. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/demo.at:513: case \$host in
hppa*|x86_64*|s390*)
  # These hosts cannot use non-PIC shared libs
  exit 77 ;;
*-solaris*|*-sunos*)
  # Libtool does not build non-PIC shared libs on these hosts
  exit 77 ;;
esac

if test \"X\$build\" = \"X\$host\" && test -d \"/etc/selinux\"; then
	_selinux=\`getenforce 2>/dev/null || echo \"Disabled\"\`
	case \$_selinux in
	*Enforcing)
		_sebool_allow_execmod=\`getsebool allow_execmod 2>/dev/null\`
		case \$_sebool_allow_execmod in
		*off)
			# SELinux policy disallows non-PIC
			exit 77
			;;
		esac
		;;
	esac
fi
"
at_fn_check_prepare_notrace 'a `...` command substitution' "demo.at:513"
( $at_check_trace; case $host in
hppa*|x86_64*|s390*)
  # These hosts cannot use non-PIC shared libs
  exit 77 ;;
*-solaris*|*-sunos*)
  # Libtool does not build non-PIC shared libs on these hosts
  exit 77 ;;
esac

if test "X$build" = "X$host" && test -d "/etc/selinux"; then
	_selinux=`getenforce 2>/dev/null || echo "Disabled"`
	case $_selinux in
	*Enforcing)
		_sebool_allow_execmod=`getsebool allow_execmod 2>/dev/null`
		case $_sebool_allow_execmod in
		*off)
			# SELinux policy disallows non-PIC
			exit 77
			;;
		esac
		;;
	esac
fi

) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:513"
$at_failed && at_fn_log_failure
$at_traceon; }


cat >configure.ac <<'_ATEOF'
AC_INIT([demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([dlopen win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

case $lt_cv_sys_global_symbol_pipe in
  ?*) binary_helldl=yes ;;
esac
AM_CONDITIONAL([BINARY_HELLDL], [test yes = "$binary_helldl"])

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LIBADD = $(LIBM)
libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
libhello_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO

include_HEADERS = foo.h

if BINARY_HELLDL
BUILD_helldl = helldl
else
BUILD_helldl =
endif

bin_PROGRAMS = hell hell_static $(BUILD_helldl)

# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la

# Create a statically linked version of hell.
hell_static_SOURCES = main.c
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = $(STATIC)

if BINARY_HELLDL

# Create a version of hell that does a preloaded dlopen.
helldl_SOURCES = dlmain.c
helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
helldl_DEPENDENCIES = libhello.la

else

# Create a script that says that -dlopen is not supported.
bin_SCRIPTS = helldl
helldl helldl$(EXEEXT):
	rm -rf
	echo '#! /bin/sh' >
	echo 'echo sorry, -dlopen is unsupported' >>
	chmod +x

endif

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

include $(srcdir)/demo.mk
_ATEOF


cat >demo.mk <<'_ATEOF'
## Don't abort for lack of demo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
 * earlier do not define __CYGWIN__.  This snippet allows us to check
 * for __CYGWIN__ reliably for both current, old, and (probable) future
 * releases.
 */
#ifdef __CYGWIN32__
#  ifndef __CYGWIN__
#    define __CYGWIN__
#  endif
#endif

#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
# ifdef BUILDING_LIBHELLO
#  ifdef DLL_EXPORT
#   define LIBHELLO_SCOPE extern __declspec (dllexport)
#  endif
# else
#  define LIBHELLO_SCOPE extern __declspec (dllimport)
# endif
#endif
#ifndef LIBHELLO_SCOPE
# define LIBHELLO_SCOPE extern
#endif

/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
# define LT_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data.  */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

#ifdef __cplusplus
extern "C" {
#endif

int foo (void);
int hello (void);
LIBHELLO_SCOPE int nothing;

#ifdef __cplusplus
}
#endif

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

/* Give a global variable definition. */
int nothing = FOO_RET;

int foo (void) {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}
_ATEOF


cat >hell1.c <<'_ATEOF'
#include <config.h>
int hell1 (void) { return 1; }
_ATEOF


cat >hell2.c <<'_ATEOF'
#include <config.h>
int hell2 (void) { return 2; }
_ATEOF


cat >hello.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int hello (void) {
  printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int main ()
{
  printf ("Welcome to GNU Hell!\n");

  /* Try assigning to the nothing variable. */
  nothing = 1;

  /* Just call the functions and check return values. */
  if (foo () != FOO_RET)
    return 1;

  if (hello () != HELLO_RET)
    return 2;

  return 0;
}
_ATEOF


cat >dlmain.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"

#define STREQ !strcmp

#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols

typedef struct
{
  const char *name;
  void *address;
} lt_dlsymlist;

extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];

int main ()
{
  const lt_dlsymlist *s;
  int (*pfoo)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;

  printf ("Welcome to *modular* GNU Hell!\n");

  /* Look up the symbols we require for this demonstration. */
  s = lt_preloaded_symbols;
  while (s->name)
    {
      if (s->address) {
        const char *name = s->name;
        printf ("found symbol: %s\n", name);
        if (STREQ ("@INIT@", name))
	  ((void(*)())s->address)();
        if (STREQ ("hello", name))
	  phello = (int(*)())s->address;
        else if (STREQ ("foo", name))
	  pfoo = (int(*)())s->address;
        else if (STREQ ("nothing", name))
#ifndef _WIN32
	  /* In an ideal world we could do this... */
	  pnothing = (int*)s->address;
#else /* !_WIN32 */
	  /* In an ideal world a shared lib would be able to export data */
	  pnothing = (int*)&nothing;
#endif
      } else
        printf ("found file: %s\n", s->name);
      s ++;
    }

  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    fprintf (stderr, "did not find the 'nothing' variable\n");

  /* Just call the functions and check return values. */
  if (pfoo)
    {
      if ((*pfoo) () != FOO_RET)
	return 1;
    }
  else
    fprintf (stderr, "did not find the 'foo' function\n");

  if (phello)
    {
      if ((*phello) () != HELLO_RET)
	return 3;
    }
  else
    fprintf (stderr, "did not find the 'hello' function\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst

$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/demo.at:539: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "demo.at:539"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:539"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/demo.at:539: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "demo.at:539"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:539"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:539: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "demo.at:539"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:539"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/demo.at:539: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "demo.at:539"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/demo.at:539"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:539: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "demo.at:539"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:539"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:539: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --with-pic=no"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "demo.at:539"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --with-pic=no
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:539"
$at_failed && at_fn_log_failure
$at_traceon; }






for target in all
do
  { set +x
$as_echo "$at_srcdir/demo.at:540: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:540"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:540"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./hell_static; if test -f "./hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:540: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:540"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:540"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./hell; if test -f "./hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:540: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:540"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:540"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:540: ./helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:540"
( $at_check_trace; ./helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:540"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_33
#AT_START_34
at_fn_group_banner 34 'demo.at:549' \
  "hardcoding library path" "                        " 4
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "34. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([dlopen win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

case $lt_cv_sys_global_symbol_pipe in
  ?*) binary_helldl=yes ;;
esac
AM_CONDITIONAL([BINARY_HELLDL], [test yes = "$binary_helldl"])

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LIBADD = $(LIBM)
libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
libhello_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO

include_HEADERS = foo.h

if BINARY_HELLDL
BUILD_helldl = helldl
else
BUILD_helldl =
endif

bin_PROGRAMS = hell hell_static $(BUILD_helldl)

# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la

# Create a statically linked version of hell.
hell_static_SOURCES = main.c
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = $(STATIC)

if BINARY_HELLDL

# Create a version of hell that does a preloaded dlopen.
helldl_SOURCES = dlmain.c
helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
helldl_DEPENDENCIES = libhello.la

else

# Create a script that says that -dlopen is not supported.
bin_SCRIPTS = helldl
helldl helldl$(EXEEXT):
	rm -rf
	echo '#! /bin/sh' >
	echo 'echo sorry, -dlopen is unsupported' >>
	chmod +x

endif

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

include $(srcdir)/demo.mk
_ATEOF


cat >demo.mk <<'_ATEOF'
## Don't abort for lack of demo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
 * earlier do not define __CYGWIN__.  This snippet allows us to check
 * for __CYGWIN__ reliably for both current, old, and (probable) future
 * releases.
 */
#ifdef __CYGWIN32__
#  ifndef __CYGWIN__
#    define __CYGWIN__
#  endif
#endif

#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
# ifdef BUILDING_LIBHELLO
#  ifdef DLL_EXPORT
#   define LIBHELLO_SCOPE extern __declspec (dllexport)
#  endif
# else
#  define LIBHELLO_SCOPE extern __declspec (dllimport)
# endif
#endif
#ifndef LIBHELLO_SCOPE
# define LIBHELLO_SCOPE extern
#endif

/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
# define LT_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data.  */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

#ifdef __cplusplus
extern "C" {
#endif

int foo (void);
int hello (void);
LIBHELLO_SCOPE int nothing;

#ifdef __cplusplus
}
#endif

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

/* Give a global variable definition. */
int nothing = FOO_RET;

int foo (void) {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}
_ATEOF


cat >hell1.c <<'_ATEOF'
#include <config.h>
int hell1 (void) { return 1; }
_ATEOF


cat >hell2.c <<'_ATEOF'
#include <config.h>
int hell2 (void) { return 2; }
_ATEOF


cat >hello.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int hello (void) {
  printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int main ()
{
  printf ("Welcome to GNU Hell!\n");

  /* Try assigning to the nothing variable. */
  nothing = 1;

  /* Just call the functions and check return values. */
  if (foo () != FOO_RET)
    return 1;

  if (hello () != HELLO_RET)
    return 2;

  return 0;
}
_ATEOF


cat >dlmain.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"

#define STREQ !strcmp

#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols

typedef struct
{
  const char *name;
  void *address;
} lt_dlsymlist;

extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];

int main ()
{
  const lt_dlsymlist *s;
  int (*pfoo)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;

  printf ("Welcome to *modular* GNU Hell!\n");

  /* Look up the symbols we require for this demonstration. */
  s = lt_preloaded_symbols;
  while (s->name)
    {
      if (s->address) {
        const char *name = s->name;
        printf ("found symbol: %s\n", name);
        if (STREQ ("@INIT@", name))
	  ((void(*)())s->address)();
        if (STREQ ("hello", name))
	  phello = (int(*)())s->address;
        else if (STREQ ("foo", name))
	  pfoo = (int(*)())s->address;
        else if (STREQ ("nothing", name))
#ifndef _WIN32
	  /* In an ideal world we could do this... */
	  pnothing = (int*)s->address;
#else /* !_WIN32 */
	  /* In an ideal world a shared lib would be able to export data */
	  pnothing = (int*)&nothing;
#endif
      } else
        printf ("found file: %s\n", s->name);
      s ++;
    }

  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    fprintf (stderr, "did not find the 'nothing' variable\n");

  /* Just call the functions and check return values. */
  if (pfoo)
    {
      if ((*pfoo) () != FOO_RET)
	return 1;
    }
  else
    fprintf (stderr, "did not find the 'foo' function\n");

  if (phello)
    {
      if ((*phello) () != HELLO_RET)
	return 3;
    }
  else
    fprintf (stderr, "did not find the 'hello' function\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


cat >demo.mk <<'_ATEOF'
hardcode_tests = hc-direct hc-libflag hc-libpath hc-minusL
CLEANFILES = $(hardcode_tests)

# Unfortunately, in order to test libtool thoroughly, we need access
# to its private directory.
objdir = `$(LIBTOOL) --config | $(SED) -n -e 's/^objdir=\(.*\)$$/\1/p'`

# Test programs to see what gets hardcoded.
.PHONY: hardcode
hardcode: $(hardcode_tests)
SET_HARDCODE_FLAGS = \
  eval `$(LIBTOOL) --config | $(SED) -n -e '/^hardcode_.*=/p; /^wl=/p'`
hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
	@rm -f hc-direct
	@echo "You may ignore any linking errors from the following command:"
	@shlib=./$(objdir)/libhello.a; \
	  eval "`$(GREP) '^library_names' libhello.la`"; \
	  for lib in $$library_names; do \
	    shlib="./$(objdir)/$$lib"; \
	  done; \
	  $(SET_HARDCODE_FLAGS); \
	  libdir=$(libdir); \
	  flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
	  echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
	  eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@"

hc-libflag: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
	@$(SET_HARDCODE_FLAGS); \
	  libdir=`pwd`/$(objdir); \
	  flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
	  if test -z "$$flag"; then \
	    echo "echo unsupported > $@"; \
	    echo unsupported > $@ || status="$$?"; \
	  else \
	    echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM)"; \
	    $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM) || status="$$?"; \
	  fi; \
	  exit $$status

hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
	@rm -f hc-libpath
	@echo "You may ignore any linking errors from the following command:"
	@$(SET_HARDCODE_FLAGS); \
	  eval `$(LIBTOOL) --config | $(GREP) '^shlibpath_var='`; \
	  libdir=$(libdir); \
	  flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
	  echo "$$shlibpath_var=./$(objdir) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
	  eval "$$shlibpath_var=./$(objdir) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"

hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES)
	@rm -f hc-minusL
	@$(SET_HARDCODE_FLAGS); \
	  libdir=$(libdir); \
	  flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
	  echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
	  eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"
_ATEOF


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/demo.at:612: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "demo.at:612"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:612"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/demo.at:612: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "demo.at:612"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:612"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:612: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "demo.at:612"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:612"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/demo.at:612: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "demo.at:612"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/demo.at:612"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:612: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "demo.at:612"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:612"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:612: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-static"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "demo.at:612"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-static
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:612"
$at_failed && at_fn_log_failure
$at_traceon; }






for target in all
do
  { set +x
$as_echo "$at_srcdir/demo.at:613: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:613"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:613"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./hell_static; if test -f "./hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:613: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:613"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:613"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./hell; if test -f "./hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:613: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:613"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:613"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:613: ./helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:613"
( $at_check_trace; ./helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:613"
$at_failed && at_fn_log_failure
$at_traceon; }


# Windows hosts search for dlls in the command path.
PATH=$prefix/lib:$PATH

for target in install
do
  { set +x
$as_echo "$at_srcdir/demo.at:614: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:614"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:614"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=$prefix/bin/hell_static; if test -f "$prefix/bin/hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:614: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:614"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:614"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$prefix/bin/hell; if test -f "$prefix/bin/hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:614: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:614"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:614"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:614: \$prefix/bin/helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:614"
( $at_check_trace; $prefix/bin/helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:614"
$at_failed && at_fn_log_failure
$at_traceon; }



eval `$EGREP '^library_names=' libhello.la`
{ set +x
$as_echo "$at_srcdir/demo.at:617: test -n \"\$library_names\" || (exit 77)"
at_fn_check_prepare_dynamic "test -n \"$library_names\" || (exit 77)" "demo.at:617"
( $at_check_trace; test -n "$library_names" || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:617"
$at_failed && at_fn_log_failure
$at_traceon; }


# Extra tools we may need
: ${DUMPSTABS="dumpstabs"}

for target in hardcode
do
  { set +x
$as_echo "$at_srcdir/demo.at:622: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:622"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:622"
$at_failed && at_fn_log_failure
$at_traceon; }

done


eval "`$LIBTOOL --config | $EGREP '^hardcode_(direct|minus_L|shlibpath_var|libdir_flag_spec)='`"

{ set +x
$as_echo "$at_srcdir/demo.at:626: exit_status=0
func_hardcode_filter_fp ()
{
  \$FGREP -v \"LT_OBJDIR \\\"\$objdir/\\\"\" 2>/dev/null
}
for file in hc-*; do
  case \$file in
  hc-direct)  expected=\"\$hardcode_direct\" ;;
  hc-libpath) expected=\"\$hardcode_shlibpath_var\" ;;
  hc-minusL)  expected=\"\$hardcode_minus_L\" ;;

  hc-libflag)
    if test -n \"\$hardcode_libdir_flag_spec\"; then
      expected=yes
    else
      expected=unsupported
    fi
    ;;

  *)
    continue
    ;;
  esac

  # Discover whether the objdir really was hardcoded.
  hardcoded=no

  # Solaris cc may store the command line in a debugging section,
  # which leads to false positives.  Unfortunately, Solaris strip
  # is not capable to remove the section (unlike GNU binutils strip).
  # So we use dumpstabs if it seems to work.
  if { \$DUMPSTABS -d \$file; } >/dev/null 2>&1; then
    if \$DUMPSTABS -d \$file 2>/dev/null | \$FGREP \"\$objdir\" >/dev/null 2>&1; then
      hardcoded=yes
    else
      hardcoded=no
    fi

  # At least AIX fgrep doesn't work for binary files, and AIX also
  # doesn't have strings(1), so we need this strange conversion
  # (which only works on ASCII).
  # AIX fgrep also has a limited line length, so we turn unprintable
  # characters into newlines.
  elif cat \$file | (tr '\\000-\\037\\200-\\377' '\\n' || cat) 2>/dev/null \\
                 | func_hardcode_filter_fp | \$FGREP \"\$objdir\" > /dev/null 2>&1; then
    hardcoded=yes

  elif cat \$file | func_hardcode_filter_fp | \$FGREP \"\$objdir\" > /dev/null 2>&1; then
    # We retry fgrep without tr, in case the above lead to a false negative.
    hardcoded=yes
  elif (\$SED -e '1!d' \$file | \$GREP 'unsupported') >/dev/null 2>&1; then
    hardcoded=unsupported
  fi

  # Check the result.
  case \$hardcoded in
  yes)
    if test yes = \"\$expected\"; then
      echo \"\$objdir was hardcoded in '\$file', as libtool expected\"
    else
      echo \"\$objdir was hardcoded in '\$file', which fooled libtool\" 1>&2
      exit_status=1
    fi
    ;;

  no)
    if test no = \"\$expected\"; then
      echo \"\$objdir was not hardcoded in '\$file', as libtool expected\"
    else
      echo \"\$objdir was not hardcoded in '\$file', which fooled libtool\" 1>&2
      exit_status=1
    fi
    ;;

  unsupported)
    if test unsupported = \"\$expected\"; then
      echo \"'\$file' was not linked properly, as libtool expected\"
    else
      echo \"'\$file' was not linked properly, which fooled libtool\" 1>&2
      exit_status=1
    fi
    ;;
  esac
done
"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:626"
( $at_check_trace; exit_status=0
func_hardcode_filter_fp ()
{
  $FGREP -v "LT_OBJDIR \"$objdir/\"" 2>/dev/null
}
for file in hc-*; do
  case $file in
  hc-direct)  expected="$hardcode_direct" ;;
  hc-libpath) expected="$hardcode_shlibpath_var" ;;
  hc-minusL)  expected="$hardcode_minus_L" ;;

  hc-libflag)
    if test -n "$hardcode_libdir_flag_spec"; then
      expected=yes
    else
      expected=unsupported
    fi
    ;;

  *)
    continue
    ;;
  esac

  # Discover whether the objdir really was hardcoded.
  hardcoded=no

  # Solaris cc may store the command line in a debugging section,
  # which leads to false positives.  Unfortunately, Solaris strip
  # is not capable to remove the section (unlike GNU binutils strip).
  # So we use dumpstabs if it seems to work.
  if { $DUMPSTABS -d $file; } >/dev/null 2>&1; then
    if $DUMPSTABS -d $file 2>/dev/null | $FGREP "$objdir" >/dev/null 2>&1; then
      hardcoded=yes
    else
      hardcoded=no
    fi

  # At least AIX fgrep doesn't work for binary files, and AIX also
  # doesn't have strings(1), so we need this strange conversion
  # (which only works on ASCII).
  # AIX fgrep also has a limited line length, so we turn unprintable
  # characters into newlines.
  elif cat $file | (tr '\000-\037\200-\377' '\n' || cat) 2>/dev/null \
                 | func_hardcode_filter_fp | $FGREP "$objdir" > /dev/null 2>&1; then
    hardcoded=yes

  elif cat $file | func_hardcode_filter_fp | $FGREP "$objdir" > /dev/null 2>&1; then
    # We retry fgrep without tr, in case the above lead to a false negative.
    hardcoded=yes
  elif ($SED -e '1!d' $file | $GREP 'unsupported') >/dev/null 2>&1; then
    hardcoded=unsupported
  fi

  # Check the result.
  case $hardcoded in
  yes)
    if test yes = "$expected"; then
      echo "$objdir was hardcoded in '$file', as libtool expected"
    else
      echo "$objdir was hardcoded in '$file', which fooled libtool" 1>&2
      exit_status=1
    fi
    ;;

  no)
    if test no = "$expected"; then
      echo "$objdir was not hardcoded in '$file', as libtool expected"
    else
      echo "$objdir was not hardcoded in '$file', which fooled libtool" 1>&2
      exit_status=1
    fi
    ;;

  unsupported)
    if test unsupported = "$expected"; then
      echo "'$file' was not linked properly, as libtool expected"
    else
      echo "'$file' was not linked properly, which fooled libtool" 1>&2
      exit_status=1
    fi
    ;;
  esac
done

) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:626"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_34
#AT_START_35
at_fn_group_banner 35 'demo.at:719' \
  "binary relinking at install time" "               " 4
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "35. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([dlopen win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

case $lt_cv_sys_global_symbol_pipe in
  ?*) binary_helldl=yes ;;
esac
AM_CONDITIONAL([BINARY_HELLDL], [test yes = "$binary_helldl"])

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LIBADD = $(LIBM)
libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
libhello_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO

include_HEADERS = foo.h

if BINARY_HELLDL
BUILD_helldl = helldl
else
BUILD_helldl =
endif

bin_PROGRAMS = hell hell_static $(BUILD_helldl)

# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la

# Create a statically linked version of hell.
hell_static_SOURCES = main.c
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = $(STATIC)

if BINARY_HELLDL

# Create a version of hell that does a preloaded dlopen.
helldl_SOURCES = dlmain.c
helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
helldl_DEPENDENCIES = libhello.la

else

# Create a script that says that -dlopen is not supported.
bin_SCRIPTS = helldl
helldl helldl$(EXEEXT):
	rm -rf
	echo '#! /bin/sh' >
	echo 'echo sorry, -dlopen is unsupported' >>
	chmod +x

endif

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

include $(srcdir)/demo.mk
_ATEOF


cat >demo.mk <<'_ATEOF'
## Don't abort for lack of demo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
 * earlier do not define __CYGWIN__.  This snippet allows us to check
 * for __CYGWIN__ reliably for both current, old, and (probable) future
 * releases.
 */
#ifdef __CYGWIN32__
#  ifndef __CYGWIN__
#    define __CYGWIN__
#  endif
#endif

#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
# ifdef BUILDING_LIBHELLO
#  ifdef DLL_EXPORT
#   define LIBHELLO_SCOPE extern __declspec (dllexport)
#  endif
# else
#  define LIBHELLO_SCOPE extern __declspec (dllimport)
# endif
#endif
#ifndef LIBHELLO_SCOPE
# define LIBHELLO_SCOPE extern
#endif

/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
# define LT_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data.  */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

#ifdef __cplusplus
extern "C" {
#endif

int foo (void);
int hello (void);
LIBHELLO_SCOPE int nothing;

#ifdef __cplusplus
}
#endif

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

/* Give a global variable definition. */
int nothing = FOO_RET;

int foo (void) {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}
_ATEOF


cat >hell1.c <<'_ATEOF'
#include <config.h>
int hell1 (void) { return 1; }
_ATEOF


cat >hell2.c <<'_ATEOF'
#include <config.h>
int hell2 (void) { return 2; }
_ATEOF


cat >hello.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int hello (void) {
  printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int main ()
{
  printf ("Welcome to GNU Hell!\n");

  /* Try assigning to the nothing variable. */
  nothing = 1;

  /* Just call the functions and check return values. */
  if (foo () != FOO_RET)
    return 1;

  if (hello () != HELLO_RET)
    return 2;

  return 0;
}
_ATEOF


cat >dlmain.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"

#define STREQ !strcmp

#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols

typedef struct
{
  const char *name;
  void *address;
} lt_dlsymlist;

extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];

int main ()
{
  const lt_dlsymlist *s;
  int (*pfoo)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;

  printf ("Welcome to *modular* GNU Hell!\n");

  /* Look up the symbols we require for this demonstration. */
  s = lt_preloaded_symbols;
  while (s->name)
    {
      if (s->address) {
        const char *name = s->name;
        printf ("found symbol: %s\n", name);
        if (STREQ ("@INIT@", name))
	  ((void(*)())s->address)();
        if (STREQ ("hello", name))
	  phello = (int(*)())s->address;
        else if (STREQ ("foo", name))
	  pfoo = (int(*)())s->address;
        else if (STREQ ("nothing", name))
#ifndef _WIN32
	  /* In an ideal world we could do this... */
	  pnothing = (int*)s->address;
#else /* !_WIN32 */
	  /* In an ideal world a shared lib would be able to export data */
	  pnothing = (int*)&nothing;
#endif
      } else
        printf ("found file: %s\n", s->name);
      s ++;
    }

  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    fprintf (stderr, "did not find the 'nothing' variable\n");

  /* Just call the functions and check return values. */
  if (pfoo)
    {
      if ((*pfoo) () != FOO_RET)
	return 1;
    }
  else
    fprintf (stderr, "did not find the 'foo' function\n");

  if (phello)
    {
      if ((*phello) () != HELLO_RET)
	return 3;
    }
  else
    fprintf (stderr, "did not find the 'hello' function\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/demo.at:724: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "demo.at:724"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:724"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/demo.at:724: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "demo.at:724"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:724"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:724: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "demo.at:724"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:724"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/demo.at:724: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "demo.at:724"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/demo.at:724"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:724: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "demo.at:724"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:724"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:724: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "demo.at:724"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:724"
$at_failed && at_fn_log_failure
$at_traceon; }






for target in all
do
  { set +x
$as_echo "$at_srcdir/demo.at:725: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:725"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:725"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./hell_static; if test -f "./hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:725: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:725"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:725"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./hell; if test -f "./hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:725: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:725"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:725"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:725: ./helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:725"
( $at_check_trace; ./helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:725"
$at_failed && at_fn_log_failure
$at_traceon; }


# Windows hosts search for dlls in the command path.
PATH=$prefix/lib:$PATH

for target in install
do
  { set +x
$as_echo "$at_srcdir/demo.at:726: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:726"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:726"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=$prefix/bin/hell_static; if test -f "$prefix/bin/hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:726: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:726"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:726"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$prefix/bin/hell; if test -f "$prefix/bin/hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:726: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:726"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:726"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:726: \$prefix/bin/helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:726"
( $at_check_trace; $prefix/bin/helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:726"
$at_failed && at_fn_log_failure
$at_traceon; }



# Check to make sure we have a dynamic library.
eval `$EGREP '^library_names=' libhello.la`
{ set +x
$as_echo "$at_srcdir/demo.at:730: test -n \"\$library_names\" || (exit 77)"
at_fn_check_prepare_dynamic "test -n \"$library_names\" || (exit 77)" "demo.at:730"
( $at_check_trace; test -n "$library_names" || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:730"
$at_failed && at_fn_log_failure
$at_traceon; }


func_save_files
# AIX 5.3 '/bin/sh' will invoke the trap for 0 at the end of a
# function, so we set the trap outside of a function to be portable.
trap func_restore_files 0 1 2 13 15

eval "`$LIBTOOL --config | $EGREP '^shlibpath_overrides_runpath='`"
eval "`$LIBTOOL --config | $EGREP '^hardcode_(action|direct|into_libs)='`"

# Allow the binary to link on-demand if need be.
./hell$EXEEXT >/dev/null || :

# Remove libhello.la from build tree.
rm -f libhello.la "$objdir"/libhello.*

# Either uninstalled ./hell will run using the just installed libraries
# when the uninstalled libs are missing, or relinking at install time
# is necessary, and the uninstalled ./hell has only the uninstalled
# library paths hardcoded.
{ set +x
$as_echo "$at_srcdir/demo.at:750: ./hell\$EXEEXT >/dev/null || test relink,yes = \"\$hardcode_action,\$hardcode_direct\""
at_fn_check_prepare_dynamic "./hell$EXEEXT >/dev/null || test relink,yes = \"$hardcode_action,$hardcode_direct\"" "demo.at:750"
( $at_check_trace; ./hell$EXEEXT >/dev/null || test relink,yes = "$hardcode_action,$hardcode_direct"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:750"
$at_failed && at_fn_log_failure
$at_traceon; }


# Link an incomplete libhello.la.
for target in libhello.la
do
  { set +x
$as_echo "$at_srcdir/demo.at:753: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target libhello_la_OBJECTS=hello.lo"
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target libhello_la_OBJECTS=hello.lo" "demo.at:753"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target libhello_la_OBJECTS=hello.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:753"
$at_failed && at_fn_log_failure
$at_traceon; }

done

{ set +x
$as_echo "$at_srcdir/demo.at:754: test -f libhello.la"
at_fn_check_prepare_trace "demo.at:754"
( $at_check_trace; test -f libhello.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:754"
$at_failed && at_fn_log_failure
$at_traceon; }


# Try running uninstalled ./hell with only broken libhello.la in build tree.
# If the following has normal exit status, shlibpath_overrides_runpath is
# wrong, and should be set to 'no' on this host.
# The unusual '|| (exit 1)' is to normalize all non-zero exit statuses.
echo "./hell || (exit 1)"; { set +x
$as_echo "$at_srcdir/demo.at:760: ./hell || (exit 1)"
at_fn_check_prepare_trace "demo.at:760"
( $at_check_trace; ./hell || (exit 1)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/demo.at:760"
$at_failed && at_fn_log_failure
$at_traceon; }


test relink = "$hardcode_action" ||
test yes = "$shlibpath_overrides_runpath" ||
{
    { set +x
$as_echo "$at_srcdir/demo.at:765: rm -f \$objdir/lt-hell\$EXEEXT"
at_fn_check_prepare_dynamic "rm -f $objdir/lt-hell$EXEEXT" "demo.at:765"
( $at_check_trace; rm -f $objdir/lt-hell$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:765"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/demo.at:766: cp \$objdir/hell\$EXEEXT \$objdir/lt-hell\$EXEEXT"
at_fn_check_prepare_dynamic "cp $objdir/hell$EXEEXT $objdir/lt-hell$EXEEXT" "demo.at:766"
( $at_check_trace; cp $objdir/hell$EXEEXT $objdir/lt-hell$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:766"
$at_failed && at_fn_log_failure
$at_traceon; }


    # Running demo/hell with installed libhello.la.
    # If the following check fails, then shlibpath_overrides_runpath is
    # wrong, and should be set to 'yes' on this host.
    echo "./hell"; { set +x
$as_echo "$at_srcdir/demo.at:771: ./hell"
at_fn_check_prepare_trace "demo.at:771"
( $at_check_trace; ./hell
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:771"
$at_failed && at_fn_log_failure
$at_traceon; }

}

func_restore_files

# Undo the effect of the previous 'trap' command. Some shellology:
# We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
# execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
# exit); for the others we need to call 'exit' explicitly. The value of $? is
# 128 + signal number and is set before the trap-registered command is run.
trap '' 0
trap 'func_exit $?' 1 2 3 13 15

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_35
#AT_START_36
at_fn_group_banner 36 'demo.at:791' \
  "uninstalled libraries have priority" "            " 4
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "36. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([dlopen win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

case $lt_cv_sys_global_symbol_pipe in
  ?*) binary_helldl=yes ;;
esac
AM_CONDITIONAL([BINARY_HELLDL], [test yes = "$binary_helldl"])

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LIBADD = $(LIBM)
libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
libhello_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO

include_HEADERS = foo.h

if BINARY_HELLDL
BUILD_helldl = helldl
else
BUILD_helldl =
endif

bin_PROGRAMS = hell hell_static $(BUILD_helldl)

# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la

# Create a statically linked version of hell.
hell_static_SOURCES = main.c
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = $(STATIC)

if BINARY_HELLDL

# Create a version of hell that does a preloaded dlopen.
helldl_SOURCES = dlmain.c
helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
helldl_DEPENDENCIES = libhello.la

else

# Create a script that says that -dlopen is not supported.
bin_SCRIPTS = helldl
helldl helldl$(EXEEXT):
	rm -rf
	echo '#! /bin/sh' >
	echo 'echo sorry, -dlopen is unsupported' >>
	chmod +x

endif

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

include $(srcdir)/demo.mk
_ATEOF


cat >demo.mk <<'_ATEOF'
## Don't abort for lack of demo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
 * earlier do not define __CYGWIN__.  This snippet allows us to check
 * for __CYGWIN__ reliably for both current, old, and (probable) future
 * releases.
 */
#ifdef __CYGWIN32__
#  ifndef __CYGWIN__
#    define __CYGWIN__
#  endif
#endif

#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
# ifdef BUILDING_LIBHELLO
#  ifdef DLL_EXPORT
#   define LIBHELLO_SCOPE extern __declspec (dllexport)
#  endif
# else
#  define LIBHELLO_SCOPE extern __declspec (dllimport)
# endif
#endif
#ifndef LIBHELLO_SCOPE
# define LIBHELLO_SCOPE extern
#endif

/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
# define LT_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data.  */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

#ifdef __cplusplus
extern "C" {
#endif

int foo (void);
int hello (void);
LIBHELLO_SCOPE int nothing;

#ifdef __cplusplus
}
#endif

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

/* Give a global variable definition. */
int nothing = FOO_RET;

int foo (void) {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}
_ATEOF


cat >hell1.c <<'_ATEOF'
#include <config.h>
int hell1 (void) { return 1; }
_ATEOF


cat >hell2.c <<'_ATEOF'
#include <config.h>
int hell2 (void) { return 2; }
_ATEOF


cat >hello.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int hello (void) {
  printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int main ()
{
  printf ("Welcome to GNU Hell!\n");

  /* Try assigning to the nothing variable. */
  nothing = 1;

  /* Just call the functions and check return values. */
  if (foo () != FOO_RET)
    return 1;

  if (hello () != HELLO_RET)
    return 2;

  return 0;
}
_ATEOF


cat >dlmain.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"

#define STREQ !strcmp

#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols

typedef struct
{
  const char *name;
  void *address;
} lt_dlsymlist;

extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];

int main ()
{
  const lt_dlsymlist *s;
  int (*pfoo)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;

  printf ("Welcome to *modular* GNU Hell!\n");

  /* Look up the symbols we require for this demonstration. */
  s = lt_preloaded_symbols;
  while (s->name)
    {
      if (s->address) {
        const char *name = s->name;
        printf ("found symbol: %s\n", name);
        if (STREQ ("@INIT@", name))
	  ((void(*)())s->address)();
        if (STREQ ("hello", name))
	  phello = (int(*)())s->address;
        else if (STREQ ("foo", name))
	  pfoo = (int(*)())s->address;
        else if (STREQ ("nothing", name))
#ifndef _WIN32
	  /* In an ideal world we could do this... */
	  pnothing = (int*)s->address;
#else /* !_WIN32 */
	  /* In an ideal world a shared lib would be able to export data */
	  pnothing = (int*)&nothing;
#endif
      } else
        printf ("found file: %s\n", s->name);
      s ++;
    }

  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    fprintf (stderr, "did not find the 'nothing' variable\n");

  /* Just call the functions and check return values. */
  if (pfoo)
    {
      if ((*pfoo) () != FOO_RET)
	return 1;
    }
  else
    fprintf (stderr, "did not find the 'foo' function\n");

  if (phello)
    {
      if ((*phello) () != HELLO_RET)
	return 3;
    }
  else
    fprintf (stderr, "did not find the 'hello' function\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/demo.at:795: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "demo.at:795"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:795"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/demo.at:795: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "demo.at:795"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:795"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:795: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "demo.at:795"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:795"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/demo.at:795: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "demo.at:795"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/demo.at:795"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:795: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "demo.at:795"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:795"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:795: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "demo.at:795"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:795"
$at_failed && at_fn_log_failure
$at_traceon; }






for target in all
do
  { set +x
$as_echo "$at_srcdir/demo.at:796: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:796"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:796"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./hell_static; if test -f "./hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:796: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:796"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:796"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./hell; if test -f "./hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:796: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:796"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:796"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:796: ./helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:796"
( $at_check_trace; ./helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:796"
$at_failed && at_fn_log_failure
$at_traceon; }


# Windows hosts search for dlls in the command path.
PATH=$prefix/lib:$PATH

for target in install
do
  { set +x
$as_echo "$at_srcdir/demo.at:797: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:797"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:797"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=$prefix/bin/hell_static; if test -f "$prefix/bin/hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:797: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:797"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:797"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$prefix/bin/hell; if test -f "$prefix/bin/hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:797: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:797"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:797"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:797: \$prefix/bin/helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:797"
( $at_check_trace; $prefix/bin/helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:797"
$at_failed && at_fn_log_failure
$at_traceon; }



# Remove libhello.la and hell from build tree.
rm -f libhello.la "hell$EXEEXT"

# If this check fails (i.e. the make succeeds), then the installed library
# was used, which is wrong.
{ set +x
$as_echo "$at_srcdir/demo.at:804: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE hell\$EXEEXT libhello_la_OBJECTS=hello.lo || (exit 1)"
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE hell$EXEEXT libhello_la_OBJECTS=hello.lo || (exit 1)" "demo.at:804"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE hell$EXEEXT libhello_la_OBJECTS=hello.lo || (exit 1)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/demo.at:804"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_36
#AT_START_37
at_fn_group_banner 37 'demo.at:814' \
  "linking with long file names" "                   " 4
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "37. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([dlopen win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

case $lt_cv_sys_global_symbol_pipe in
  ?*) binary_helldl=yes ;;
esac
AM_CONDITIONAL([BINARY_HELLDL], [test yes = "$binary_helldl"])

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LIBADD = $(LIBM)
libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
libhello_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO

include_HEADERS = foo.h

if BINARY_HELLDL
BUILD_helldl = helldl
else
BUILD_helldl =
endif

bin_PROGRAMS = hell hell_static $(BUILD_helldl)

# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la

# Create a statically linked version of hell.
hell_static_SOURCES = main.c
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = $(STATIC)

if BINARY_HELLDL

# Create a version of hell that does a preloaded dlopen.
helldl_SOURCES = dlmain.c
helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
helldl_DEPENDENCIES = libhello.la

else

# Create a script that says that -dlopen is not supported.
bin_SCRIPTS = helldl
helldl helldl$(EXEEXT):
	rm -rf
	echo '#! /bin/sh' >
	echo 'echo sorry, -dlopen is unsupported' >>
	chmod +x

endif

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

include $(srcdir)/demo.mk
_ATEOF


cat >demo.mk <<'_ATEOF'
## Don't abort for lack of demo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
 * earlier do not define __CYGWIN__.  This snippet allows us to check
 * for __CYGWIN__ reliably for both current, old, and (probable) future
 * releases.
 */
#ifdef __CYGWIN32__
#  ifndef __CYGWIN__
#    define __CYGWIN__
#  endif
#endif

#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
# ifdef BUILDING_LIBHELLO
#  ifdef DLL_EXPORT
#   define LIBHELLO_SCOPE extern __declspec (dllexport)
#  endif
# else
#  define LIBHELLO_SCOPE extern __declspec (dllimport)
# endif
#endif
#ifndef LIBHELLO_SCOPE
# define LIBHELLO_SCOPE extern
#endif

/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
# define LT_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data.  */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

#ifdef __cplusplus
extern "C" {
#endif

int foo (void);
int hello (void);
LIBHELLO_SCOPE int nothing;

#ifdef __cplusplus
}
#endif

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

/* Give a global variable definition. */
int nothing = FOO_RET;

int foo (void) {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}
_ATEOF


cat >hell1.c <<'_ATEOF'
#include <config.h>
int hell1 (void) { return 1; }
_ATEOF


cat >hell2.c <<'_ATEOF'
#include <config.h>
int hell2 (void) { return 2; }
_ATEOF


cat >hello.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int hello (void) {
  printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int main ()
{
  printf ("Welcome to GNU Hell!\n");

  /* Try assigning to the nothing variable. */
  nothing = 1;

  /* Just call the functions and check return values. */
  if (foo () != FOO_RET)
    return 1;

  if (hello () != HELLO_RET)
    return 2;

  return 0;
}
_ATEOF


cat >dlmain.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"

#define STREQ !strcmp

#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols

typedef struct
{
  const char *name;
  void *address;
} lt_dlsymlist;

extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];

int main ()
{
  const lt_dlsymlist *s;
  int (*pfoo)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;

  printf ("Welcome to *modular* GNU Hell!\n");

  /* Look up the symbols we require for this demonstration. */
  s = lt_preloaded_symbols;
  while (s->name)
    {
      if (s->address) {
        const char *name = s->name;
        printf ("found symbol: %s\n", name);
        if (STREQ ("@INIT@", name))
	  ((void(*)())s->address)();
        if (STREQ ("hello", name))
	  phello = (int(*)())s->address;
        else if (STREQ ("foo", name))
	  pfoo = (int(*)())s->address;
        else if (STREQ ("nothing", name))
#ifndef _WIN32
	  /* In an ideal world we could do this... */
	  pnothing = (int*)s->address;
#else /* !_WIN32 */
	  /* In an ideal world a shared lib would be able to export data */
	  pnothing = (int*)&nothing;
#endif
      } else
        printf ("found file: %s\n", s->name);
      s ++;
    }

  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    fprintf (stderr, "did not find the 'nothing' variable\n");

  /* Just call the functions and check return values. */
  if (pfoo)
    {
      if ((*pfoo) () != FOO_RET)
	return 1;
    }
  else
    fprintf (stderr, "did not find the 'foo' function\n");

  if (phello)
    {
      if ((*phello) () != HELLO_RET)
	return 3;
    }
  else
    fprintf (stderr, "did not find the 'hello' function\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = longer_file_name_hello.c longer_file_name_foo.c longer_file_name_foo2.c
libhello_la_LIBADD = $(LIBM)
libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
libhello_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO

include_HEADERS = foo.h

if BINARY_HELLDL
BUILD_helldl = helldl
else
BUILD_helldl =
endif

bin_PROGRAMS = hell hell_static $(BUILD_helldl)

# Build hell from longer_file_name_main.c and libhello.la
hell_SOURCES = longer_file_name_main.c
hell_LDADD = libhello.la

# Create a statically linked version of hell.
hell_static_SOURCES = longer_file_name_main.c
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = $(STATIC)

if BINARY_HELLDL

# Create a version of hell that does a preloaded dlopen.
helldl_SOURCES = longer_file_name_dlmain.c
helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
helldl_DEPENDENCIES = libhello.la

else

# Create a script that says that -dlopen is not supported.
bin_SCRIPTS = helldl
helldl helldl$(EXEEXT):
	rm -rf $@
	echo '#! /bin/sh' > $@
	echo 'echo sorry, -dlopen is unsupported' >> $@
	chmod +x $@

endif

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int main ()
{
  printf ("Welcome to GNU Hell!\n");

  /* Try assigning to the nothing variable. */
  nothing = 1;

  /* Just call the functions and check return values. */
  if (foo () != FOO_RET)
    return 1;

  if (foo2 () != FOO_RET)
    return 1;

  if (hello () != HELLO_RET)
    return 2;

  return 0;
}
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
 * earlier do not define __CYGWIN__.  This snippet allows us to check
 * for __CYGWIN__ reliably for both current, old, and (probable) future
 * releases.
 */
#ifdef __CYGWIN32__
#  ifndef __CYGWIN__
#    define __CYGWIN__
#  endif
#endif

#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
# ifdef BUILDING_LIBHELLO
#  ifdef DLL_EXPORT
#   define LIBHELLO_SCOPE extern __declspec (dllexport)
#  endif
# else
#  define LIBHELLO_SCOPE extern __declspec (dllimport)
# endif
#endif
#ifndef LIBHELLO_SCOPE
# define LIBHELLO_SCOPE extern
#endif

/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
# define LT_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data.  */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

#ifdef __cplusplus
extern "C" {
#endif

int foo (void);
int foo2 (void);
int hello (void);
LIBHELLO_SCOPE int nothing;

#ifdef __cplusplus
}
#endif

#endif
_ATEOF


cat >foo2.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

int foo2 (void) {
  printf ("foo2 cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
foo2 cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

for file in dlmain.c foo.c foo2.c hello.c main.c; do
  mv $file longer_file_name_$file
done

$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/demo.at:982: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "demo.at:982"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:982"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/demo.at:982: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "demo.at:982"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:982"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:982: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "demo.at:982"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:982"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/demo.at:982: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "demo.at:982"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/demo.at:982"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:982: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "demo.at:982"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:982"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/demo.at:982: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "demo.at:982"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:982"
$at_failed && at_fn_log_failure
$at_traceon; }






for target in all
do
  { set +x
$as_echo "$at_srcdir/demo.at:983: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:983"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:983"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./hell_static; if test -f "./hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:983: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:983"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:983"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./hell; if test -f "./hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:983: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:983"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:983"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:983: ./helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:983"
( $at_check_trace; ./helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:983"
$at_failed && at_fn_log_failure
$at_traceon; }


# Windows hosts search for dlls in the command path.
PATH=$prefix/lib:$PATH

for target in install
do
  { set +x
$as_echo "$at_srcdir/demo.at:984: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "demo.at:984"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:984"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=$prefix/bin/hell_static; if test -f "$prefix/bin/hell_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:984: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:984"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:984"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$prefix/bin/hell; if test -f "$prefix/bin/hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/demo.at:984: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "demo.at:984"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:984"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/demo.at:984: \$prefix/bin/helldl\$EXEEXT |
    \$EGREP '(Welcome to .*GNU Hell|unsupported)'"
at_fn_check_prepare_notrace 'an embedded newline' "demo.at:984"
( $at_check_trace; $prefix/bin/helldl$EXEEXT |
    $EGREP '(Welcome to .*GNU Hell|unsupported)'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/demo.at:984"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_37
#AT_START_38
at_fn_group_banner 38 'pic_flag.at:24' \
  "override pic_flag at configure time" "            " 4
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "38. $at_setup_line: testing $at_desc ..."
  $at_traceon


# Just try to configure the Libtool package with -fpic if we can compile
# with it, for C and C++.

cat >foo.c <<'_ATEOF'
int data = 42;
int func(void) { return data; }
_ATEOF


cp foo.c foo.cpp
C_pic_flag='-fpic -DPIC'
{ set +x
$as_echo "$at_srcdir/pic_flag.at:36: \$CC \$CPPFLAGS \$CFLAGS \$C_pic_flag -c foo.c || exit 77"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS $C_pic_flag -c foo.c || exit 77" "pic_flag.at:36"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS $C_pic_flag -c foo.c || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/pic_flag.at:36"
$at_failed && at_fn_log_failure
$at_traceon; }

# The configure test for the PIC flag also checks for warnings.
{ set +x
$as_echo "$at_srcdir/pic_flag.at:39: \$GREP fpic stdout stderr && exit 77"
at_fn_check_prepare_dynamic "$GREP fpic stdout stderr && exit 77" "pic_flag.at:39"
( $at_check_trace; $GREP fpic stdout stderr && exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/pic_flag.at:39"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/pic_flag.at:40: \$GREP '[uU]nknown.*option' stdout stderr && exit 77"
at_fn_check_prepare_dynamic "$GREP '[uU]nknown.*option' stdout stderr && exit 77" "pic_flag.at:40"
( $at_check_trace; $GREP '[uU]nknown.*option' stdout stderr && exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/pic_flag.at:40"
$at_failed && at_fn_log_failure
$at_traceon; }


CXX_pic_flag='-fpic -DPIC'
if $CXX $CPPFLAGS $CXXFLAGS $CXX_pic_flag -c foo.cpp; then :; else
  CXX_pic_flag=
fi

# Set up a tests/demo.at style project.
cat >configure.ac <<'_ATEOF'
AC_INIT([demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([dlopen win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

case $lt_cv_sys_global_symbol_pipe in
  ?*) binary_helldl=yes ;;
esac
AM_CONDITIONAL([BINARY_HELLDL], [test yes = "$binary_helldl"])

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LIBADD = $(LIBM)
libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
libhello_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO

include_HEADERS = foo.h

if BINARY_HELLDL
BUILD_helldl = helldl
else
BUILD_helldl =
endif

bin_PROGRAMS = hell hell_static $(BUILD_helldl)

# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la

# Create a statically linked version of hell.
hell_static_SOURCES = main.c
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = $(STATIC)

if BINARY_HELLDL

# Create a version of hell that does a preloaded dlopen.
helldl_SOURCES = dlmain.c
helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
helldl_DEPENDENCIES = libhello.la

else

# Create a script that says that -dlopen is not supported.
bin_SCRIPTS = helldl
helldl helldl$(EXEEXT):
	rm -rf
	echo '#! /bin/sh' >
	echo 'echo sorry, -dlopen is unsupported' >>
	chmod +x

endif

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

include $(srcdir)/demo.mk
_ATEOF


cat >demo.mk <<'_ATEOF'
## Don't abort for lack of demo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
 * earlier do not define __CYGWIN__.  This snippet allows us to check
 * for __CYGWIN__ reliably for both current, old, and (probable) future
 * releases.
 */
#ifdef __CYGWIN32__
#  ifndef __CYGWIN__
#    define __CYGWIN__
#  endif
#endif

#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
# ifdef BUILDING_LIBHELLO
#  ifdef DLL_EXPORT
#   define LIBHELLO_SCOPE extern __declspec (dllexport)
#  endif
# else
#  define LIBHELLO_SCOPE extern __declspec (dllimport)
# endif
#endif
#ifndef LIBHELLO_SCOPE
# define LIBHELLO_SCOPE extern
#endif

/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
# define LT_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data.  */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

#ifdef __cplusplus
extern "C" {
#endif

int foo (void);
int hello (void);
LIBHELLO_SCOPE int nothing;

#ifdef __cplusplus
}
#endif

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

/* Give a global variable definition. */
int nothing = FOO_RET;

int foo (void) {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}
_ATEOF


cat >hell1.c <<'_ATEOF'
#include <config.h>
int hell1 (void) { return 1; }
_ATEOF


cat >hell2.c <<'_ATEOF'
#include <config.h>
int hell2 (void) { return 2; }
_ATEOF


cat >hello.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int hello (void) {
  printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int main ()
{
  printf ("Welcome to GNU Hell!\n");

  /* Try assigning to the nothing variable. */
  nothing = 1;

  /* Just call the functions and check return values. */
  if (foo () != FOO_RET)
    return 1;

  if (hello () != HELLO_RET)
    return 2;

  return 0;
}
_ATEOF


cat >dlmain.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"

#define STREQ !strcmp

#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols

typedef struct
{
  const char *name;
  void *address;
} lt_dlsymlist;

extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];

int main ()
{
  const lt_dlsymlist *s;
  int (*pfoo)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;

  printf ("Welcome to *modular* GNU Hell!\n");

  /* Look up the symbols we require for this demonstration. */
  s = lt_preloaded_symbols;
  while (s->name)
    {
      if (s->address) {
        const char *name = s->name;
        printf ("found symbol: %s\n", name);
        if (STREQ ("@INIT@", name))
	  ((void(*)())s->address)();
        if (STREQ ("hello", name))
	  phello = (int(*)())s->address;
        else if (STREQ ("foo", name))
	  pfoo = (int(*)())s->address;
        else if (STREQ ("nothing", name))
#ifndef _WIN32
	  /* In an ideal world we could do this... */
	  pnothing = (int*)s->address;
#else /* !_WIN32 */
	  /* In an ideal world a shared lib would be able to export data */
	  pnothing = (int*)&nothing;
#endif
      } else
        printf ("found file: %s\n", s->name);
      s ++;
    }

  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    fprintf (stderr, "did not find the 'nothing' variable\n");

  /* Just call the functions and check return values. */
  if (pfoo)
    {
      if ((*pfoo) () != FOO_RET)
	return 1;
    }
  else
    fprintf (stderr, "did not find the 'foo' function\n");

  if (phello)
    {
      if ((*phello) () != HELLO_RET)
	return 3;
    }
  else
    fprintf (stderr, "did not find the 'hello' function\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


# Bootstrap, and configure it so that we can extract libtool --config
# settings.
$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/pic_flag.at:52: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "pic_flag.at:52"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/pic_flag.at:52"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/pic_flag.at:52: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "pic_flag.at:52"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/pic_flag.at:52"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/pic_flag.at:52: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "pic_flag.at:52"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/pic_flag.at:52"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/pic_flag.at:52: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "pic_flag.at:52"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/pic_flag.at:52"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/pic_flag.at:52: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "pic_flag.at:52"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/pic_flag.at:52"
$at_failed && at_fn_log_failure
$at_traceon; }








{ set +x
$as_echo "$at_srcdir/pic_flag.at:55: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" lt_cv_prog_compiler_pic=\"\$C_pic_flag\" 		lt_cv_prog_compiler_pic_CXX=\"\$CXX_pic_flag\""
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "pic_flag.at:55"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" lt_cv_prog_compiler_pic="$C_pic_flag" 		lt_cv_prog_compiler_pic_CXX="$CXX_pic_flag"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/pic_flag.at:55"
$at_failed && at_fn_log_failure
$at_traceon; }


: ${MAKE=make}
{ set +x
$as_echo "$at_srcdir/pic_flag.at:59: \$MAKE"
at_fn_check_prepare_dynamic "$MAKE" "pic_flag.at:59"
( $at_check_trace; $MAKE
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/pic_flag.at:59"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/pic_flag.at:60: if ./libtool --features | \$GREP 'enable shared libraries'; then 	   \$GREP ' -fpic' stdout; else exit 77; fi"
at_fn_check_prepare_notrace 'a shell pipeline' "pic_flag.at:60"
( $at_check_trace; if ./libtool --features | $GREP 'enable shared libraries'; then 	   $GREP ' -fpic' stdout; else exit 77; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/pic_flag.at:60"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_38
#AT_START_39
at_fn_group_banner 39 'with-pic.at:24' \
  "test --with-pic" "                                " 4
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "39. $at_setup_line: testing $at_desc ..."
  $at_traceon


# Set up a tests/demo.at style project.
cat >configure.ac <<'_ATEOF'
AC_INIT([demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([dlopen win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

case $lt_cv_sys_global_symbol_pipe in
  ?*) binary_helldl=yes ;;
esac
AM_CONDITIONAL([BINARY_HELLDL], [test yes = "$binary_helldl"])

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LIBADD = $(LIBM)
libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
libhello_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO

include_HEADERS = foo.h

if BINARY_HELLDL
BUILD_helldl = helldl
else
BUILD_helldl =
endif

bin_PROGRAMS = hell hell_static $(BUILD_helldl)

# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la

# Create a statically linked version of hell.
hell_static_SOURCES = main.c
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = $(STATIC)

if BINARY_HELLDL

# Create a version of hell that does a preloaded dlopen.
helldl_SOURCES = dlmain.c
helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
helldl_DEPENDENCIES = libhello.la

else

# Create a script that says that -dlopen is not supported.
bin_SCRIPTS = helldl
helldl helldl$(EXEEXT):
	rm -rf
	echo '#! /bin/sh' >
	echo 'echo sorry, -dlopen is unsupported' >>
	chmod +x

endif

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

include $(srcdir)/demo.mk
_ATEOF


cat >demo.mk <<'_ATEOF'
## Don't abort for lack of demo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
 * earlier do not define __CYGWIN__.  This snippet allows us to check
 * for __CYGWIN__ reliably for both current, old, and (probable) future
 * releases.
 */
#ifdef __CYGWIN32__
#  ifndef __CYGWIN__
#    define __CYGWIN__
#  endif
#endif

#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
# ifdef BUILDING_LIBHELLO
#  ifdef DLL_EXPORT
#   define LIBHELLO_SCOPE extern __declspec (dllexport)
#  endif
# else
#  define LIBHELLO_SCOPE extern __declspec (dllimport)
# endif
#endif
#ifndef LIBHELLO_SCOPE
# define LIBHELLO_SCOPE extern
#endif

/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
# define LT_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data.  */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

#ifdef __cplusplus
extern "C" {
#endif

int foo (void);
int hello (void);
LIBHELLO_SCOPE int nothing;

#ifdef __cplusplus
}
#endif

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

/* Give a global variable definition. */
int nothing = FOO_RET;

int foo (void) {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}
_ATEOF


cat >hell1.c <<'_ATEOF'
#include <config.h>
int hell1 (void) { return 1; }
_ATEOF


cat >hell2.c <<'_ATEOF'
#include <config.h>
int hell2 (void) { return 2; }
_ATEOF


cat >hello.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int hello (void) {
  printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int main ()
{
  printf ("Welcome to GNU Hell!\n");

  /* Try assigning to the nothing variable. */
  nothing = 1;

  /* Just call the functions and check return values. */
  if (foo () != FOO_RET)
    return 1;

  if (hello () != HELLO_RET)
    return 2;

  return 0;
}
_ATEOF


cat >dlmain.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"

#define STREQ !strcmp

#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols

typedef struct
{
  const char *name;
  void *address;
} lt_dlsymlist;

extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];

int main ()
{
  const lt_dlsymlist *s;
  int (*pfoo)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;

  printf ("Welcome to *modular* GNU Hell!\n");

  /* Look up the symbols we require for this demonstration. */
  s = lt_preloaded_symbols;
  while (s->name)
    {
      if (s->address) {
        const char *name = s->name;
        printf ("found symbol: %s\n", name);
        if (STREQ ("@INIT@", name))
	  ((void(*)())s->address)();
        if (STREQ ("hello", name))
	  phello = (int(*)())s->address;
        else if (STREQ ("foo", name))
	  pfoo = (int(*)())s->address;
        else if (STREQ ("nothing", name))
#ifndef _WIN32
	  /* In an ideal world we could do this... */
	  pnothing = (int*)s->address;
#else /* !_WIN32 */
	  /* In an ideal world a shared lib would be able to export data */
	  pnothing = (int*)&nothing;
#endif
      } else
        printf ("found file: %s\n", s->name);
      s ++;
    }

  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    fprintf (stderr, "did not find the 'nothing' variable\n");

  /* Just call the functions and check return values. */
  if (pfoo)
    {
      if ((*pfoo) () != FOO_RET)
	return 1;
    }
  else
    fprintf (stderr, "did not find the 'foo' function\n");

  if (phello)
    {
      if ((*phello) () != HELLO_RET)
	return 3;
    }
  else
    fprintf (stderr, "did not find the 'hello' function\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


# Bootstrap, and configure it so that we can extract libtool --config
# settings.
$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/with-pic.at:31: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "with-pic.at:31"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:31"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/with-pic.at:31: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "with-pic.at:31"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:31"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/with-pic.at:31: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "with-pic.at:31"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:31"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/with-pic.at:31: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "with-pic.at:31"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/with-pic.at:31"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/with-pic.at:31: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "with-pic.at:31"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:31"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/with-pic.at:31: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "with-pic.at:31"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:31"
$at_failed && at_fn_log_failure
$at_traceon; }




eval `$LIBTOOL --config | $EGREP '^(pic_flag|FGREP)='`

no_dlls=:
case " $pic_flag " in
*" -DDLL_EXPORT "*) no_dlls=false ;;
esac
{ set +x
$as_echo "$at_srcdir/with-pic.at:39: \$no_dlls || exit 77"
at_fn_check_prepare_dynamic "$no_dlls || exit 77" "with-pic.at:39"
( $at_check_trace; $no_dlls || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:39"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/with-pic.at:40: test . != \"\$at_srcdir\" || exit 77"
at_fn_check_prepare_dynamic "test . != \"$at_srcdir\" || exit 77" "with-pic.at:40"
( $at_check_trace; test . != "$at_srcdir" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:40"
$at_failed && at_fn_log_failure
$at_traceon; }


: ${MAKE=make}

{ set +x
$as_echo "$at_srcdir/with-pic.at:44: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-shared --with-pic=no"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "with-pic.at:44"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-shared --with-pic=no
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:44"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/with-pic.at:45: \$MAKE"
at_fn_check_prepare_dynamic "$MAKE" "with-pic.at:45"
( $at_check_trace; $MAKE
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:45"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/with-pic.at:46: \$FGREP -v \"\$pic_flag\" stdout"
at_fn_check_prepare_dynamic "$FGREP -v \"$pic_flag\" stdout" "with-pic.at:46"
( $at_check_trace; $FGREP -v "$pic_flag" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:46"
$at_failed && at_fn_log_failure
$at_traceon; }

$MAKE clean

{ set +x
$as_echo "$at_srcdir/with-pic.at:49: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-shared --with-pic=yes"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "with-pic.at:49"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-shared --with-pic=yes
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:49"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/with-pic.at:50: \$MAKE"
at_fn_check_prepare_dynamic "$MAKE" "with-pic.at:50"
( $at_check_trace; $MAKE
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:50"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/with-pic.at:51: \$FGREP \"\$pic_flag\" stdout"
at_fn_check_prepare_dynamic "$FGREP \"$pic_flag\" stdout" "with-pic.at:51"
( $at_check_trace; $FGREP "$pic_flag" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:51"
$at_failed && at_fn_log_failure
$at_traceon; }

$MAKE clean

{ set +x
$as_echo "$at_srcdir/with-pic.at:54: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-shared --with-pic=\"demo,foo,bar\""
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "with-pic.at:54"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-shared --with-pic="demo,foo,bar"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:54"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/with-pic.at:55: \$MAKE"
at_fn_check_prepare_dynamic "$MAKE" "with-pic.at:55"
( $at_check_trace; $MAKE
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:55"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/with-pic.at:56: \$FGREP \"\$pic_flag\" stdout"
at_fn_check_prepare_dynamic "$FGREP \"$pic_flag\" stdout" "with-pic.at:56"
( $at_check_trace; $FGREP "$pic_flag" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

$MAKE clean

{ set +x
$as_echo "$at_srcdir/with-pic.at:59: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-shared --with-pic=\"foo,bar\""
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "with-pic.at:59"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-shared --with-pic="foo,bar"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:59"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/with-pic.at:60: \$MAKE"
at_fn_check_prepare_dynamic "$MAKE" "with-pic.at:60"
( $at_check_trace; $MAKE
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:60"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/with-pic.at:61: \$FGREP -v \"\$pic_flag\" stdout"
at_fn_check_prepare_dynamic "$FGREP -v \"$pic_flag\" stdout" "with-pic.at:61"
( $at_check_trace; $FGREP -v "$pic_flag" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/with-pic.at:61"
$at_failed && at_fn_log_failure
$at_traceon; }

$MAKE clean

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_39
#AT_START_40
at_fn_group_banner 40 'cdemo.at:136' \
  "build and link against a static library" "        " 5
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "40. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([cdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC
LT_INIT
AC_SUBST([LIBTOOL_DEPS])
LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

noinst_LTLIBRARIES = libfoo.la
libfoo_la_SOURCES = foo.c
libfoo_la_LIBADD = $(LIBM)
libfoo_la_LDFLAGS = -no-undefined
noinst_HEADERS = foo.h

bin_PROGRAMS = cdemo
cdemo_SOURCES = main.c
cdemo_LDADD = libfoo.la

libtool: $(LIBTOOL_DEPS)
	 $(SHELL) ./config.status --recheck
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H 1

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

extern int foo();

extern int hello();

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

int foo() {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}

int hello() {
  printf ("** This is libfoo **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include "foo.h"

int main ()
{
  int value;

  printf ("Welcome to GNU libtool cdemo!\n");

  value = hello();
  printf ("hello returned: %i\n", value);
  if (value == HELLO_RET)
    printf("hello is ok!\n");

  if (foo () == FOO_RET)
    printf("foo is ok!\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU libtool cdemo!
** This is libfoo **
hello returned: 57616
hello is ok!
cos (0.0) = 1
foo is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/cdemo.at:140: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "cdemo.at:140"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:140"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/cdemo.at:140: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "cdemo.at:140"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:140"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/cdemo.at:140: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "cdemo.at:140"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:140"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/cdemo.at:140: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "cdemo.at:140"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/cdemo.at:140"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/cdemo.at:140: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "cdemo.at:140"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:140"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/cdemo.at:140: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-shared"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "cdemo.at:140"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-shared
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:140"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/cdemo.at:140: \$EGREP '^build_old_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=yes' libtool" "cdemo.at:140"
( $at_check_trace; $EGREP '^build_old_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:140"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/cdemo.at:140: \$EGREP '^build_libtool_libs=no' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=no' libtool" "cdemo.at:140"
( $at_check_trace; $EGREP '^build_libtool_libs=no' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:140"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/cdemo.at:142: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "cdemo.at:142"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:142"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./cdemo; if test -f "./cdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/cdemo.at:142: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "cdemo.at:142"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:142"
$at_failed && at_fn_log_failure
$at_traceon; }






  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_40
#AT_START_41
at_fn_group_banner 41 'cdemo.at:151' \
  "build and link against a dynamic library" "       " 5
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "41. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([cdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC
LT_INIT
AC_SUBST([LIBTOOL_DEPS])
LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

noinst_LTLIBRARIES = libfoo.la
libfoo_la_SOURCES = foo.c
libfoo_la_LIBADD = $(LIBM)
libfoo_la_LDFLAGS = -no-undefined
noinst_HEADERS = foo.h

bin_PROGRAMS = cdemo
cdemo_SOURCES = main.c
cdemo_LDADD = libfoo.la

libtool: $(LIBTOOL_DEPS)
	 $(SHELL) ./config.status --recheck
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H 1

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

extern int foo();

extern int hello();

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

int foo() {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}

int hello() {
  printf ("** This is libfoo **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include "foo.h"

int main ()
{
  int value;

  printf ("Welcome to GNU libtool cdemo!\n");

  value = hello();
  printf ("hello returned: %i\n", value);
  if (value == HELLO_RET)
    printf("hello is ok!\n");

  if (foo () == FOO_RET)
    printf("foo is ok!\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU libtool cdemo!
** This is libfoo **
hello returned: 57616
hello is ok!
cos (0.0) = 1
foo is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/cdemo.at:155: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "cdemo.at:155"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:155"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/cdemo.at:155: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "cdemo.at:155"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:155"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/cdemo.at:155: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "cdemo.at:155"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:155"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/cdemo.at:155: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "cdemo.at:155"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/cdemo.at:155"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/cdemo.at:155: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "cdemo.at:155"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:155"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/cdemo.at:155: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-static"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "cdemo.at:155"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-static
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:155"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/cdemo.at:155: \$EGREP '^build_old_libs=no' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=no' libtool" "cdemo.at:155"
( $at_check_trace; $EGREP '^build_old_libs=no' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:155"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/cdemo.at:155: \$EGREP '^build_libtool_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=yes' libtool" "cdemo.at:155"
( $at_check_trace; $EGREP '^build_libtool_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:155"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/cdemo.at:157: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "cdemo.at:157"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:157"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./cdemo; if test -f "./cdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/cdemo.at:157: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "cdemo.at:157"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:157"
$at_failed && at_fn_log_failure
$at_traceon; }






  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_41
#AT_START_42
at_fn_group_banner 42 'cdemo.at:166' \
  "build both static and dynamic" "                  " 5
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "42. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([cdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC
LT_INIT
AC_SUBST([LIBTOOL_DEPS])
LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

noinst_LTLIBRARIES = libfoo.la
libfoo_la_SOURCES = foo.c
libfoo_la_LIBADD = $(LIBM)
libfoo_la_LDFLAGS = -no-undefined
noinst_HEADERS = foo.h

bin_PROGRAMS = cdemo
cdemo_SOURCES = main.c
cdemo_LDADD = libfoo.la

libtool: $(LIBTOOL_DEPS)
	 $(SHELL) ./config.status --recheck
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H 1

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

extern int foo();

extern int hello();

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

int foo() {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}

int hello() {
  printf ("** This is libfoo **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include "foo.h"

int main ()
{
  int value;

  printf ("Welcome to GNU libtool cdemo!\n");

  value = hello();
  printf ("hello returned: %i\n", value);
  if (value == HELLO_RET)
    printf("hello is ok!\n");

  if (foo () == FOO_RET)
    printf("foo is ok!\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU libtool cdemo!
** This is libfoo **
hello returned: 57616
hello is ok!
cos (0.0) = 1
foo is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/cdemo.at:170: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "cdemo.at:170"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:170"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/cdemo.at:170: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "cdemo.at:170"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:170"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/cdemo.at:170: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "cdemo.at:170"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:170"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/cdemo.at:170: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "cdemo.at:170"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/cdemo.at:170"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/cdemo.at:170: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "cdemo.at:170"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:170"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/cdemo.at:170: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "cdemo.at:170"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:170"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/cdemo.at:170: \$EGREP '^build_old_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=yes' libtool" "cdemo.at:170"
( $at_check_trace; $EGREP '^build_old_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:170"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/cdemo.at:170: \$EGREP '^build_libtool_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=yes' libtool" "cdemo.at:170"
( $at_check_trace; $EGREP '^build_libtool_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:170"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/cdemo.at:172: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "cdemo.at:172"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:172"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./cdemo; if test -f "./cdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/cdemo.at:172: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "cdemo.at:172"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:172"
$at_failed && at_fn_log_failure
$at_traceon; }






  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_42
#AT_START_43
at_fn_group_banner 43 'cdemo.at:181' \
  "allow_undefined_flag" "                           " 5
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "43. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([cdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC
LT_INIT
AC_SUBST([LIBTOOL_DEPS])
LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

noinst_LTLIBRARIES = libfoo.la
libfoo_la_SOURCES = foo.c
libfoo_la_LIBADD = $(LIBM)
libfoo_la_LDFLAGS = -no-undefined
noinst_HEADERS = foo.h

bin_PROGRAMS = cdemo
cdemo_SOURCES = main.c
cdemo_LDADD = libfoo.la

libtool: $(LIBTOOL_DEPS)
	 $(SHELL) ./config.status --recheck
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H 1

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

extern int foo();

extern int hello();

#endif
_ATEOF


cat >foo.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

int foo() {
  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
  return FOO_RET;
}

int hello() {
  printf ("** This is libfoo **\n");
  return HELLO_RET;
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include "foo.h"

int main ()
{
  int value;

  printf ("Welcome to GNU libtool cdemo!\n");

  value = hello();
  printf ("hello returned: %i\n", value);
  if (value == HELLO_RET)
    printf("hello is ok!\n");

  if (foo () == FOO_RET)
    printf("foo is ok!\n");

  return 0;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU libtool cdemo!
** This is libfoo **
hello returned: 57616
hello is ok!
cos (0.0) = 1
foo is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/cdemo.at:185: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "cdemo.at:185"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/cdemo.at:185: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "cdemo.at:185"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/cdemo.at:185: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "cdemo.at:185"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:185"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/cdemo.at:185: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "cdemo.at:185"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/cdemo.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/cdemo.at:185: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "cdemo.at:185"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/cdemo.at:185: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-static"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "cdemo.at:185"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-static
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }







{ set +x
$as_echo "$at_srcdir/cdemo.at:187: \$EGREP \"^allow_undefined_flag=.\\{0,1\\}unsupported.\\{0,1\\}\$\" libtool && (exit 77)"
at_fn_check_prepare_dynamic "$EGREP \"^allow_undefined_flag=.\\{0,1\\}unsupported.\\{0,1\\}$\" libtool && (exit 77)" "cdemo.at:187"
( $at_check_trace; $EGREP "^allow_undefined_flag=.\{0,1\}unsupported.\{0,1\}$" libtool && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/cdemo.at:187"
$at_failed && at_fn_log_failure
$at_traceon; }


$SED 's|allow_undefined=no|allow_undefined=yes|g' libtool > ltnew && mv -f ltnew libtool

for target in all
do
  { set +x
$as_echo "$at_srcdir/cdemo.at:192: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "cdemo.at:192"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:192"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./cdemo; if test -f "./cdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/cdemo.at:192: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "cdemo.at:192"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/cdemo.at:192"
$at_failed && at_fn_log_failure
$at_traceon; }






  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_43
#AT_START_44
at_fn_group_banner 44 'convenience.at:31' \
  "C convenience archives" "                         " 5
at_xfail=no
(
  $as_echo "44. $at_setup_line: testing $at_desc ..."
  $at_traceon



cat >main1.c <<EOF
extern int a1(void);
int main(void) { return a1() != 1; }
EOF
cat >main2.c <<EOF
extern int a1(void), a2(void);
int main(void) { return a1() + a2() != 3; }
EOF
cat >main3.c <<EOF
extern int a1(void), a2(void), a3(void);
int main(void) { return a1() + a2() + a3() != 6; }
EOF
for i in 1 2 3; do
  echo "int a$i(void) { return $i; }" > a$i.c
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c main$i.c
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a$i.c
  $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba$i.la a$i.lo
done
{ set +x
$as_echo "$at_srcdir/convenience.at:52: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist" "convenience.at:52"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:52"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/convenience.at:54: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba123.la a3.lo liba1.la liba2.la -rpath /notexist"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba123.la a3.lo liba1.la liba2.la -rpath /notexist" "convenience.at:54"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba123.la a3.lo liba1.la liba2.la -rpath /notexist
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:54"
$at_failed && at_fn_log_failure
$at_traceon; }


conv=
for i in 1 2 3; do
  conv=$conv$i
  { set +x
$as_echo "$at_srcdir/convenience.at:60: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -static -o main_static\$EXEEXT main\$i.lo liba\$conv.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -static -o main_static$EXEEXT main$i.lo liba$conv.la" "convenience.at:60"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -static -o main_static$EXEEXT main$i.lo liba$conv.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:60"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/convenience.at:62: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main\$i.lo liba\$conv.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main$i.lo liba$conv.la" "convenience.at:62"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main$i.lo liba$conv.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:62"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./main_static; if test -f "./main_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/convenience.at:64: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "convenience.at:64"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:64"
$at_failed && at_fn_log_failure
$at_traceon; }


  lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/convenience.at:65: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "convenience.at:65"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:65"
$at_failed && at_fn_log_failure
$at_traceon; }


done
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_44
#AT_START_45
at_fn_group_banner 45 'convenience.at:70' \
  "C++ convenience archives" "                       " 5
at_xfail=no
(
  $as_echo "45. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/convenience.at:71: { test -n \"\$CXX\" && test \"X\$CXX\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$CXX\" && test \"X$CXX\" != Xno; } || (exit 77)" "convenience.at:71"
( $at_check_trace; { test -n "$CXX" && test "X$CXX" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:71"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/convenience.at:71: test g++ != \"\$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)"
at_fn_check_prepare_dynamic "test g++ != \"$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)" "convenience.at:71"
( $at_check_trace; test g++ != "$CXX" || (g++ -v >/dev/null 2>&1) || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:71"
$at_failed && at_fn_log_failure
$at_traceon; }




cat >main1.cpp <<EOF
extern int a1(void);
int main(void) { return a1() != 1; }
EOF
cat >main2.cpp <<EOF
extern int a1(void), a2(void);
int main(void) { return a1() + a2() != 3; }
EOF
cat >main3.cpp <<EOF
extern int a1(void), a2(void), a3(void);
int main(void) { return a1() + a2() + a3() != 6; }
EOF
for i in 1 2 3; do
  echo "int a$i(void) { return $i; }" > a$i.cpp
  $LIBTOOL --tag=CXX --mode=compile $CXX $CXXFLAGS -c main$i.cpp
  $LIBTOOL --tag=CXX --mode=compile $CXX $CXXFLAGS -c a$i.cpp
  $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o liba$i.la a$i.lo
done
{ set +x
$as_echo "$at_srcdir/convenience.at:92: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist" "convenience.at:92"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:92"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/convenience.at:94: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o liba123.la a3.lo liba1.la liba2.la -rpath /notexist"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o liba123.la a3.lo liba1.la liba2.la -rpath /notexist" "convenience.at:94"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o liba123.la a3.lo liba1.la liba2.la -rpath /notexist
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:94"
$at_failed && at_fn_log_failure
$at_traceon; }


conv=
for i in 1 2 3; do
  conv=$conv$i
  { set +x
$as_echo "$at_srcdir/convenience.at:100: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -static -o main_static\$EXEEXT main\$i.lo liba\$conv.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -static -o main_static$EXEEXT main$i.lo liba$conv.la" "convenience.at:100"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -static -o main_static$EXEEXT main$i.lo liba$conv.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:100"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/convenience.at:102: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o main\$EXEEXT main\$i.lo liba\$conv.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o main$EXEEXT main$i.lo liba$conv.la" "convenience.at:102"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o main$EXEEXT main$i.lo liba$conv.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:102"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./main_static; if test -f "./main_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/convenience.at:104: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "convenience.at:104"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:104"
$at_failed && at_fn_log_failure
$at_traceon; }


  lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/convenience.at:105: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "convenience.at:105"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:105"
$at_failed && at_fn_log_failure
$at_traceon; }


done
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_45
#AT_START_46
at_fn_group_banner 46 'convenience.at:110' \
  "F77 convenience archives" "                       " 5
at_xfail=no
(
  $as_echo "46. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/convenience.at:111: { test -n \"\$F77\" && test \"X\$F77\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$F77\" && test \"X$F77\" != Xno; } || (exit 77)" "convenience.at:111"
( $at_check_trace; { test -n "$F77" && test "X$F77" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:111"
$at_failed && at_fn_log_failure
$at_traceon; }





cat >main1.f <<EOF
      program main
      implicit none
      integer*4 res
      call a1(res)
      end
EOF
cat >main2.f <<EOF
      program main
      implicit none
      integer*4 res
      call a1(res)
      call a2(res)
      end
EOF
cat >main3.f <<EOF
      program main
      implicit none
      integer*4 res
      call a1(res)
      call a2(res)
      call a3(res)
      end
EOF

for i in 1 2 3; do
  cat >a$i.f <<EOF
      subroutine a$i(res)
      implicit none
      integer*4 res
      res=$i
      return
      end
EOF
  $LIBTOOL --tag=F77 --mode=compile $F77 $FFLAGS -c main$i.f
  $LIBTOOL --tag=F77 --mode=compile $F77 $FFLAGS -c a$i.f
  $LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -o liba$i.la a$i.lo
done
{ set +x
$as_echo "$at_srcdir/convenience.at:152: \$LIBTOOL --tag=F77 --mode=link \$F77 \$FFLAGS \$LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist" "convenience.at:152"
( $at_check_trace; $LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:152"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/convenience.at:154: \$LIBTOOL --tag=F77 --mode=link \$F77 \$FFLAGS \$LDFLAGS -o liba123.la a3.lo liba1.la liba2.la -rpath /notexist"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -o liba123.la a3.lo liba1.la liba2.la -rpath /notexist" "convenience.at:154"
( $at_check_trace; $LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -o liba123.la a3.lo liba1.la liba2.la -rpath /notexist
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:154"
$at_failed && at_fn_log_failure
$at_traceon; }


conv=
for i in 1 2 3; do
  conv=$conv$i
  { set +x
$as_echo "$at_srcdir/convenience.at:160: \$LIBTOOL --tag=F77 --mode=link \$F77 \$FFLAGS \$LDFLAGS -static -o main_static\$EXEEXT main\$i.lo liba\$conv.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -static -o main_static$EXEEXT main$i.lo liba$conv.la" "convenience.at:160"
( $at_check_trace; $LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -static -o main_static$EXEEXT main$i.lo liba$conv.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:160"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/convenience.at:162: \$LIBTOOL --tag=F77 --mode=link \$F77 \$FFLAGS \$LDFLAGS -o main\$EXEEXT main\$i.lo liba\$conv.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -o main$EXEEXT main$i.lo liba$conv.la" "convenience.at:162"
( $at_check_trace; $LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -o main$EXEEXT main$i.lo liba$conv.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:162"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./main_static; if test -f "./main_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/convenience.at:164: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "convenience.at:164"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:164"
$at_failed && at_fn_log_failure
$at_traceon; }


  lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/convenience.at:165: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "convenience.at:165"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:165"
$at_failed && at_fn_log_failure
$at_traceon; }


done
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_46
#AT_START_47
at_fn_group_banner 47 'convenience.at:170' \
  "FC convenience archives" "                        " 5
at_xfail=no
(
  $as_echo "47. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/convenience.at:171: { test -n \"\$FC\" && test \"X\$FC\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$FC\" && test \"X$FC\" != Xno; } || (exit 77)" "convenience.at:171"
( $at_check_trace; { test -n "$FC" && test "X$FC" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:171"
$at_failed && at_fn_log_failure
$at_traceon; }

# Autoconf will accept f77 or similar as a valid FC, but often f77
   # will not compile fortran90 code; in that case skip the FC checks.
   cat >fc_test.f90 <<'_ATEOF'
	program main

	end
_ATEOF

   { set +x
$as_echo "$at_srcdir/convenience.at:171: \$FC \$FCFLAGS fc_test.f90 || exit 77"
at_fn_check_prepare_dynamic "$FC $FCFLAGS fc_test.f90 || exit 77" "convenience.at:171"
( $at_check_trace; $FC $FCFLAGS fc_test.f90 || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:171"
$at_failed && at_fn_log_failure
$at_traceon; }




cat >main1.f <<EOF
      program main
      implicit none
      integer*4 res
      call a1(res)
      end
EOF
cat >main2.f <<EOF
      program main
      implicit none
      integer*4 res
      call a1(res)
      call a2(res)
      end
EOF
cat >main3.f <<EOF
      program main
      implicit none
      integer*4 res
      call a1(res)
      call a2(res)
      call a3(res)
      end
EOF

for i in 1 2 3; do
  cat >a$i.f <<EOF
      subroutine a$i(res)
      implicit none
      integer*4 res
      res=$i
      return
      end
EOF
  $LIBTOOL --tag=FC --mode=compile $FC $FCFLAGS -c main$i.f
  $LIBTOOL --tag=FC --mode=compile $FC $FCFLAGS -c a$i.f
  $LIBTOOL --tag=FC --mode=link $FC $FCFLAGS $LDFLAGS -o liba$i.la a$i.lo
done
{ set +x
$as_echo "$at_srcdir/convenience.at:212: \$LIBTOOL --tag=FC --mode=link \$FC \$FCFLAGS \$LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=FC --mode=link $FC $FCFLAGS $LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist" "convenience.at:212"
( $at_check_trace; $LIBTOOL --tag=FC --mode=link $FC $FCFLAGS $LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:212"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/convenience.at:214: \$LIBTOOL --tag=FC --mode=link \$FC \$FCFLAGS \$LDFLAGS -o liba123.la a3.lo liba1.la liba2.la -rpath /notexist"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=FC --mode=link $FC $FCFLAGS $LDFLAGS -o liba123.la a3.lo liba1.la liba2.la -rpath /notexist" "convenience.at:214"
( $at_check_trace; $LIBTOOL --tag=FC --mode=link $FC $FCFLAGS $LDFLAGS -o liba123.la a3.lo liba1.la liba2.la -rpath /notexist
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:214"
$at_failed && at_fn_log_failure
$at_traceon; }


conv=
for i in 1 2 3; do
  conv=$conv$i
  { set +x
$as_echo "$at_srcdir/convenience.at:220: \$LIBTOOL --tag=FC --mode=link \$FC \$FCFLAGS \$LDFLAGS -static -o main_static\$EXEEXT main\$i.lo liba\$conv.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=FC --mode=link $FC $FCFLAGS $LDFLAGS -static -o main_static$EXEEXT main$i.lo liba$conv.la" "convenience.at:220"
( $at_check_trace; $LIBTOOL --tag=FC --mode=link $FC $FCFLAGS $LDFLAGS -static -o main_static$EXEEXT main$i.lo liba$conv.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:220"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/convenience.at:222: \$LIBTOOL --tag=FC --mode=link \$FC \$FCFLAGS \$LDFLAGS -o main\$EXEEXT main\$i.lo liba\$conv.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=FC --mode=link $FC $FCFLAGS $LDFLAGS -o main$EXEEXT main$i.lo liba$conv.la" "convenience.at:222"
( $at_check_trace; $LIBTOOL --tag=FC --mode=link $FC $FCFLAGS $LDFLAGS -o main$EXEEXT main$i.lo liba$conv.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:222"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./main_static; if test -f "./main_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/convenience.at:224: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "convenience.at:224"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:224"
$at_failed && at_fn_log_failure
$at_traceon; }


  lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/convenience.at:225: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "convenience.at:225"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:225"
$at_failed && at_fn_log_failure
$at_traceon; }


done
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_47
#AT_START_48
at_fn_group_banner 48 'convenience.at:230' \
  "Java convenience archives" "                      " 5
at_xfail=no
(
  $as_echo "48. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/convenience.at:231: { test -n \"\$GCJ\" && test \"X\$GCJ\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$GCJ\" && test \"X$GCJ\" != Xno; } || (exit 77)" "convenience.at:231"
( $at_check_trace; { test -n "$GCJ" && test "X$GCJ" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:231"
$at_failed && at_fn_log_failure
$at_traceon; }

# There are just too many broken gcj installations out there, either missing
   # libgcj.spec or unable to find it.  Skip the test for them.
   cat >gcj_test.java <<'_ATEOF'
public class gcj_test {
    public static void main(String[] argv) { }
  }
_ATEOF

   { set +x
$as_echo "$at_srcdir/convenience.at:231: \$GCJ \$GCJFLAGS -c gcj_test.java || exit 77"
at_fn_check_prepare_dynamic "$GCJ $GCJFLAGS -c gcj_test.java || exit 77" "convenience.at:231"
( $at_check_trace; $GCJ $GCJFLAGS -c gcj_test.java || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:231"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/convenience.at:231: \$GCJ \$GCJFLAGS --main=gcj_test -o gcj_test\$EXEEXT gcj_test.java 	    || exit 77"
at_fn_check_prepare_dynamic "$GCJ $GCJFLAGS --main=gcj_test -o gcj_test$EXEEXT gcj_test.java 	    || exit 77" "convenience.at:231"
( $at_check_trace; $GCJ $GCJFLAGS --main=gcj_test -o gcj_test$EXEEXT gcj_test.java 	    || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:231"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/convenience.at:231: ./gcj_test\$EXEEXT || exit 77"
at_fn_check_prepare_dynamic "./gcj_test$EXEEXT || exit 77" "convenience.at:231"
( $at_check_trace; ./gcj_test$EXEEXT || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:231"
$at_failed && at_fn_log_failure
$at_traceon; }




cat >foo1.java <<EOF
public class foo1 {
  public static void main(String[] argv) {
    A1 a1 = new A1();
  }
}
EOF
cat >foo2.java <<EOF
public class foo2 {
  public static void main(String[] argv) {
    A1 a1 = new A1(); A2 a2 = new A2();
  }
}
EOF
cat >foo3.java <<EOF
public class foo3 {
  public static void main(String[] argv) {
    A1 a1 = new A1(); A2 a2 = new A2(); A3 a3 = new A3();
  }
}
EOF
for i in 1 2 3; do
  cat >A$i.java <<EOF
public class A$i {
  private int a;
  public A$i () { a = 0; }
};
EOF

  # Workaround http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42143
  # Some 4.3.x and 4.4.x releases of gcj insert a spurious dummy symbol
  # into every object file when compiling directly from .java to .o, so
  # we have to make .class files first, and then compile those to native
  # objects:
  $GCJ $GCJFLAGS -C foo$i.java
  $GCJ $GCJFLAGS -C A$i.java

  $LIBTOOL --tag=GCJ --mode=compile $GCJ $GCJFLAGS -c foo$i.class
  $LIBTOOL --tag=GCJ --mode=compile $GCJ $GCJFLAGS -c A$i.class
  $LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS -o liba$i.la A$i.lo
done
{ set +x
$as_echo "$at_srcdir/convenience.at:275: \$LIBTOOL --tag=GCJ --mode=link \$GCJ \$GCJFLAGS \$LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist" "convenience.at:275"
( $at_check_trace; $LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:275"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/convenience.at:277: \$LIBTOOL --tag=GCJ --mode=link \$GCJ \$GCJFLAGS \$LDFLAGS -o liba123.la A3.lo liba1.la liba2.la -rpath /notexist"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS -o liba123.la A3.lo liba1.la liba2.la -rpath /notexist" "convenience.at:277"
( $at_check_trace; $LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS -o liba123.la A3.lo liba1.la liba2.la -rpath /notexist
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:277"
$at_failed && at_fn_log_failure
$at_traceon; }


conv=
for i in 1 2 3; do
  conv=$conv$i
  { set +x
$as_echo "$at_srcdir/convenience.at:283: \$LIBTOOL --tag=GCJ --mode=link \$GCJ \$GCJFLAGS \$LDFLAGS -static --main=foo\$i -o main_static\$EXEEXT foo\$i.lo liba\$conv.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS -static --main=foo$i -o main_static$EXEEXT foo$i.lo liba$conv.la" "convenience.at:283"
( $at_check_trace; $LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS -static --main=foo$i -o main_static$EXEEXT foo$i.lo liba$conv.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:283"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/convenience.at:285: \$LIBTOOL --tag=GCJ --mode=link \$GCJ \$GCJFLAGS \$LDFLAGS --main=foo\$i -o main\$EXEEXT foo\$i.lo liba\$conv.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS --main=foo$i -o main$EXEEXT foo$i.lo liba$conv.la" "convenience.at:285"
( $at_check_trace; $LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS --main=foo$i -o main$EXEEXT foo$i.lo liba$conv.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:285"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./main_static; if test -f "./main_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/convenience.at:287: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "convenience.at:287"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:287"
$at_failed && at_fn_log_failure
$at_traceon; }


  lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/convenience.at:288: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "convenience.at:288"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/convenience.at:288"
$at_failed && at_fn_log_failure
$at_traceon; }


done
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_48
#AT_START_49
at_fn_group_banner 49 'depdemo.at:286' \
  "static library interdependencies" "               " 6
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "49. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([depdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

LT_LIB_M
AC_CONFIG_FILES([Makefile l1/Makefile l2/Makefile l3/Makefile l4/Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

SUBDIRS = l1 l2 l3 l4

bin_PROGRAMS = depdemo depdemo_static

depdemo_SOURCES = main.c
depdemo_LDADD = $(top_builddir)/l1/libl1.la $(top_builddir)/l2/libl2.la \
		$(top_builddir)/l4/libl4.la
depdemo_DEPENDENCIES = $(top_builddir)/l1/libl1.la \
		$(top_builddir)/l2/libl2.la $(top_builddir)/l4/libl4.la

depdemo_static_SOURCES = $(depdemo_SOURCES)
depdemo_static_LDADD = $(depdemo_LDADD)
depdemo_static_DEPENDENCIES = $(depdemo_DEPENDENCIES)
depdemo_static_LDFLAGS = $(STATIC)

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "l1/l1.h"
#include "l2/l2.h"
#include "l4/l4.h"

#define STREQ !strcmp

int main (int argc, char **argv)
{
  printf("dependencies:\n");
  func_l1(0);
  func_l2(0);
  func_l4(0);
  if (argc == 2 && STREQ (argv[1], "-alt")
      && var_l1 + var_l2 + var_l4 == 8)
	return 0;
  printf("var_l1(%d) + var_l2(%d) + var_l4(%d) == %d\n",
         var_l1,var_l2,var_l4, var_l1 + var_l2 + var_l4);
  if (var_l1 + var_l2 + var_l4 != 19)
    {
	printf("var_l1(%d) + var_l2(%d) + var_l4(%d) != 19\n",
               var_l1,var_l2,var_l4);
	return 1;
    }
  return 0;
}
_ATEOF


# Create 4 directorys of mostly identical files.
for i in 1 2 3 4; do
  mkdir l$i

  # l$i/Makefile.am:
  {
    $ECHO     'AUTOMAKE_OPTIONS = no-dependencies foreign'
    $ECHO     'AM_CPPFLAGS = -I$(top_srcdir) -DBUILDING_LIBL'$i
    $ECHO     'lib_LTLIBRARIES = libl'$i'.la'
    $ECHO     'libl'$i'_la_SOURCES = l'$i'.c l'$i'.h'
    $ECHO     'libl'$i'_la_LDFLAGS = -no-undefined'
    $ECHO     'libl'$i'_la_LIBADD ='
    if test 4 != $i; then
      j=1; while test "$j" -lt "$i"; do
        $ECHO 'libl'$i'_la_LIBADD += $(top_builddir)/l'$j'/libl'$j'.la'
        j=`expr 1 + $j`
      done
    else
      j=3
      $ECHO   'libl'$i'_la_LIBADD += $(top_builddir)/l'$j'/libl'$j'.la $(LIBM)'
    fi
  } > l$i/Makefile.am

  # l$i/l$i.h
  {
    $ECHO '#ifndef L'$i'_H'
    $ECHO '#define L'$i'_H'
    $ECHO
    $ECHO '#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__'
    $ECHO '#  ifdef BUILDING_LIBL'$i
    $ECHO '#    ifdef DLL_EXPORT'
    $ECHO '#      define LIBL'$i'_SCOPE extern __declspec (dllexport)'
    $ECHO '#    endif'
    $ECHO '#  else'
    $ECHO '#    define LIBL'$i'_SCOPE extern __declspec (dllimport)'
    $ECHO '#  endif'
    $ECHO '#endif'
    $ECHO '#ifndef LIBL'$i'_SCOPE'
    $ECHO '#  define LIBL'$i'_SCOPE extern'
    $ECHO '#endif'
    $ECHO
    $ECHO '#ifdef __cplusplus'
    $ECHO 'extern "C" {'
    $ECHO '#endif'
    $ECHO
    $ECHO '  LIBL'$i'_SCOPE int var_l'$i';'
    $ECHO '  int func_l'$i' (int);'
    $ECHO
    $ECHO '#ifdef __cplusplus'
    $ECHO '}'
    $ECHO '#endif'
    $ECHO '#endif'
  } > l$i/l$i.h

  # l$i/l$i.c:
  {
    if test 4 -ne $i; then
      $ECHO     '#include <config.h>'
      $ECHO     '#include <stdio.h>'
      $ECHO
      $ECHO     '#include "l'$i'/l'$i'.h"'
      j=1; while test "$j" -lt "$i"; do
        $ECHO   '#include "l'$j'/l'$j'.h"'
        j=`expr 1 + $j`
      done
      $ECHO
      $ECHO     'int var_l'$i' = 0;'
      $ECHO     'int func_l'$i' (int indent) {'
      $ECHO     '  int i;'
      $ECHO     '  for (i = 0; i < indent; i++)'
      $ECHO     "    putchar (' ');"
      $ECHO     '  printf ("l'$i' (%i)\n", var_l'$i');'
      if test 1 -eq $i; then
        $ECHO   '  var_l1++;'
      else
        j=1; while test "$j" -lt "$i"; do
          $ECHO '  func_l'$j'(indent+1);'
          $ECHO '  var_l'$i' += var_l'$j';'
          j=`expr 1 + $j`
        done
      fi
      $ECHO     '  return 0;'
      $ECHO     '}'
    else
      j=3
      $ECHO     '#include <config.h>'
      $ECHO     '#include <stdio.h>'
      $ECHO     '#include <math.h>'
      $ECHO     '#include "l'$i'/l'$i'.h"'
      $ECHO     '#include "l'$j'/l'$j'.h"'
      $ECHO
      $ECHO     'int var_l'$i' = 0;'
      $ECHO     'int func_l'$i' (int indent) {'
      $ECHO     '  int i;'
      $ECHO     '  for (i = 0; i < indent; i++)'
      $ECHO     "    putchar (' ');"
      $ECHO     '  printf ("l'$i' (%i)\n", var_l'$i');'
      $ECHO     '  func_l'$j'(indent+1);'
      $ECHO     '  for (i = 0; i < indent; i++)'
      $ECHO     "    putchar (' ');"
      $ECHO     '  printf("libm cos (0.0) = %g\n", (double) cos ((double) 0.0));'
      $ECHO     '  var_l'$i' += var_l'$j';'
      $ECHO     '  return 0;'
      $ECHO     '}'
    fi
  } > l$i/l$i.c
done


cat >expout <<'_ATEOF'
dependencies:
l1 (0)
l2 (0)
 l1 (1)
l4 (0)
 l3 (0)
  l1 (2)
  l2 (2)
   l1 (3)
libm cos (0.0) = 1
var_l1(4) + var_l2(6) + var_l4(9) == 19
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/depdemo.at:290: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "depdemo.at:290"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:290"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/depdemo.at:290: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "depdemo.at:290"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:290"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:290: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "depdemo.at:290"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:290"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/depdemo.at:290: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "depdemo.at:290"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/depdemo.at:290"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:290: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "depdemo.at:290"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:290"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:290: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-shared"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "depdemo.at:290"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-shared
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:290"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:290: \$EGREP '^build_old_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=yes' libtool" "depdemo.at:290"
( $at_check_trace; $EGREP '^build_old_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:290"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/depdemo.at:290: \$EGREP '^build_libtool_libs=no' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=no' libtool" "depdemo.at:290"
( $at_check_trace; $EGREP '^build_libtool_libs=no' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:290"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/depdemo.at:292: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "depdemo.at:292"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:292"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./depdemo_static; if test -f "./depdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:292: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:292"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:292"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./depdemo; if test -f "./depdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:292: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:292"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:292"
$at_failed && at_fn_log_failure
$at_traceon; }







# Windows hosts search for dlls in the command path.
PATH=$prefix/lib:$PATH
for target in install
do
  { set +x
$as_echo "$at_srcdir/depdemo.at:293: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "depdemo.at:293"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:293"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=$prefix/bin/depdemo_static; if test -f "$prefix/bin/depdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:293: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:293"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:293"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$prefix/bin/depdemo; if test -f "$prefix/bin/depdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:293: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:293"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:293"
$at_failed && at_fn_log_failure
$at_traceon; }







for target in uninstall
do
  { set +x
$as_echo "$at_srcdir/depdemo.at:294: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "depdemo.at:294"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:294"
$at_failed && at_fn_log_failure
$at_traceon; }

done


leftovers=`find $prefix ! -type d ! -name '.*' -print`
{ set +x
$as_echo "$at_srcdir/depdemo.at:294: test -z \"\$leftovers\""
at_fn_check_prepare_dynamic "test -z \"$leftovers\"" "depdemo.at:294"
( $at_check_trace; test -z "$leftovers"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:294"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_49
#AT_START_50
at_fn_group_banner 50 'depdemo.at:303' \
  "shared library interdependencies" "               " 6
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "50. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([depdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

LT_LIB_M
AC_CONFIG_FILES([Makefile l1/Makefile l2/Makefile l3/Makefile l4/Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

SUBDIRS = l1 l2 l3 l4

bin_PROGRAMS = depdemo depdemo_static

depdemo_SOURCES = main.c
depdemo_LDADD = $(top_builddir)/l1/libl1.la $(top_builddir)/l2/libl2.la \
		$(top_builddir)/l4/libl4.la
depdemo_DEPENDENCIES = $(top_builddir)/l1/libl1.la \
		$(top_builddir)/l2/libl2.la $(top_builddir)/l4/libl4.la

depdemo_static_SOURCES = $(depdemo_SOURCES)
depdemo_static_LDADD = $(depdemo_LDADD)
depdemo_static_DEPENDENCIES = $(depdemo_DEPENDENCIES)
depdemo_static_LDFLAGS = $(STATIC)

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "l1/l1.h"
#include "l2/l2.h"
#include "l4/l4.h"

#define STREQ !strcmp

int main (int argc, char **argv)
{
  printf("dependencies:\n");
  func_l1(0);
  func_l2(0);
  func_l4(0);
  if (argc == 2 && STREQ (argv[1], "-alt")
      && var_l1 + var_l2 + var_l4 == 8)
	return 0;
  printf("var_l1(%d) + var_l2(%d) + var_l4(%d) == %d\n",
         var_l1,var_l2,var_l4, var_l1 + var_l2 + var_l4);
  if (var_l1 + var_l2 + var_l4 != 19)
    {
	printf("var_l1(%d) + var_l2(%d) + var_l4(%d) != 19\n",
               var_l1,var_l2,var_l4);
	return 1;
    }
  return 0;
}
_ATEOF


# Create 4 directorys of mostly identical files.
for i in 1 2 3 4; do
  mkdir l$i

  # l$i/Makefile.am:
  {
    $ECHO     'AUTOMAKE_OPTIONS = no-dependencies foreign'
    $ECHO     'AM_CPPFLAGS = -I$(top_srcdir) -DBUILDING_LIBL'$i
    $ECHO     'lib_LTLIBRARIES = libl'$i'.la'
    $ECHO     'libl'$i'_la_SOURCES = l'$i'.c l'$i'.h'
    $ECHO     'libl'$i'_la_LDFLAGS = -no-undefined'
    $ECHO     'libl'$i'_la_LIBADD ='
    if test 4 != $i; then
      j=1; while test "$j" -lt "$i"; do
        $ECHO 'libl'$i'_la_LIBADD += $(top_builddir)/l'$j'/libl'$j'.la'
        j=`expr 1 + $j`
      done
    else
      j=3
      $ECHO   'libl'$i'_la_LIBADD += $(top_builddir)/l'$j'/libl'$j'.la $(LIBM)'
    fi
  } > l$i/Makefile.am

  # l$i/l$i.h
  {
    $ECHO '#ifndef L'$i'_H'
    $ECHO '#define L'$i'_H'
    $ECHO
    $ECHO '#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__'
    $ECHO '#  ifdef BUILDING_LIBL'$i
    $ECHO '#    ifdef DLL_EXPORT'
    $ECHO '#      define LIBL'$i'_SCOPE extern __declspec (dllexport)'
    $ECHO '#    endif'
    $ECHO '#  else'
    $ECHO '#    define LIBL'$i'_SCOPE extern __declspec (dllimport)'
    $ECHO '#  endif'
    $ECHO '#endif'
    $ECHO '#ifndef LIBL'$i'_SCOPE'
    $ECHO '#  define LIBL'$i'_SCOPE extern'
    $ECHO '#endif'
    $ECHO
    $ECHO '#ifdef __cplusplus'
    $ECHO 'extern "C" {'
    $ECHO '#endif'
    $ECHO
    $ECHO '  LIBL'$i'_SCOPE int var_l'$i';'
    $ECHO '  int func_l'$i' (int);'
    $ECHO
    $ECHO '#ifdef __cplusplus'
    $ECHO '}'
    $ECHO '#endif'
    $ECHO '#endif'
  } > l$i/l$i.h

  # l$i/l$i.c:
  {
    if test 4 -ne $i; then
      $ECHO     '#include <config.h>'
      $ECHO     '#include <stdio.h>'
      $ECHO
      $ECHO     '#include "l'$i'/l'$i'.h"'
      j=1; while test "$j" -lt "$i"; do
        $ECHO   '#include "l'$j'/l'$j'.h"'
        j=`expr 1 + $j`
      done
      $ECHO
      $ECHO     'int var_l'$i' = 0;'
      $ECHO     'int func_l'$i' (int indent) {'
      $ECHO     '  int i;'
      $ECHO     '  for (i = 0; i < indent; i++)'
      $ECHO     "    putchar (' ');"
      $ECHO     '  printf ("l'$i' (%i)\n", var_l'$i');'
      if test 1 -eq $i; then
        $ECHO   '  var_l1++;'
      else
        j=1; while test "$j" -lt "$i"; do
          $ECHO '  func_l'$j'(indent+1);'
          $ECHO '  var_l'$i' += var_l'$j';'
          j=`expr 1 + $j`
        done
      fi
      $ECHO     '  return 0;'
      $ECHO     '}'
    else
      j=3
      $ECHO     '#include <config.h>'
      $ECHO     '#include <stdio.h>'
      $ECHO     '#include <math.h>'
      $ECHO     '#include "l'$i'/l'$i'.h"'
      $ECHO     '#include "l'$j'/l'$j'.h"'
      $ECHO
      $ECHO     'int var_l'$i' = 0;'
      $ECHO     'int func_l'$i' (int indent) {'
      $ECHO     '  int i;'
      $ECHO     '  for (i = 0; i < indent; i++)'
      $ECHO     "    putchar (' ');"
      $ECHO     '  printf ("l'$i' (%i)\n", var_l'$i');'
      $ECHO     '  func_l'$j'(indent+1);'
      $ECHO     '  for (i = 0; i < indent; i++)'
      $ECHO     "    putchar (' ');"
      $ECHO     '  printf("libm cos (0.0) = %g\n", (double) cos ((double) 0.0));'
      $ECHO     '  var_l'$i' += var_l'$j';'
      $ECHO     '  return 0;'
      $ECHO     '}'
    fi
  } > l$i/l$i.c
done


cat >expout <<'_ATEOF'
dependencies:
l1 (0)
l2 (0)
 l1 (1)
l4 (0)
 l3 (0)
  l1 (2)
  l2 (2)
   l1 (3)
libm cos (0.0) = 1
var_l1(4) + var_l2(6) + var_l4(9) == 19
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/depdemo.at:307: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "depdemo.at:307"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:307"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/depdemo.at:307: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "depdemo.at:307"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:307"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:307: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "depdemo.at:307"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:307"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/depdemo.at:307: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "depdemo.at:307"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/depdemo.at:307"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:307: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "depdemo.at:307"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:307"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:307: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-static"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "depdemo.at:307"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-static
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:307"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:307: \$EGREP '^build_old_libs=no' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=no' libtool" "depdemo.at:307"
( $at_check_trace; $EGREP '^build_old_libs=no' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:307"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/depdemo.at:307: \$EGREP '^build_libtool_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=yes' libtool" "depdemo.at:307"
( $at_check_trace; $EGREP '^build_libtool_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:307"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/depdemo.at:309: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "depdemo.at:309"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:309"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./depdemo_static; if test -f "./depdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:309: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:309"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:309"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./depdemo; if test -f "./depdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:309: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:309"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:309"
$at_failed && at_fn_log_failure
$at_traceon; }







# Windows hosts search for dlls in the command path.
PATH=$prefix/lib:$PATH
for target in install
do
  { set +x
$as_echo "$at_srcdir/depdemo.at:310: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "depdemo.at:310"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:310"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=$prefix/bin/depdemo_static; if test -f "$prefix/bin/depdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:310: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:310"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:310"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$prefix/bin/depdemo; if test -f "$prefix/bin/depdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:310: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:310"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:310"
$at_failed && at_fn_log_failure
$at_traceon; }







for target in uninstall
do
  { set +x
$as_echo "$at_srcdir/depdemo.at:311: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "depdemo.at:311"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

done


leftovers=`find $prefix ! -type d ! -name '.*' -print`
{ set +x
$as_echo "$at_srcdir/depdemo.at:311: test -z \"\$leftovers\""
at_fn_check_prepare_dynamic "test -z \"$leftovers\"" "depdemo.at:311"
( $at_check_trace; test -z "$leftovers"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_50
#AT_START_51
at_fn_group_banner 51 'depdemo.at:320' \
  "shared and static interdependencies" "            " 6
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "51. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([depdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

LT_LIB_M
AC_CONFIG_FILES([Makefile l1/Makefile l2/Makefile l3/Makefile l4/Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

SUBDIRS = l1 l2 l3 l4

bin_PROGRAMS = depdemo depdemo_static

depdemo_SOURCES = main.c
depdemo_LDADD = $(top_builddir)/l1/libl1.la $(top_builddir)/l2/libl2.la \
		$(top_builddir)/l4/libl4.la
depdemo_DEPENDENCIES = $(top_builddir)/l1/libl1.la \
		$(top_builddir)/l2/libl2.la $(top_builddir)/l4/libl4.la

depdemo_static_SOURCES = $(depdemo_SOURCES)
depdemo_static_LDADD = $(depdemo_LDADD)
depdemo_static_DEPENDENCIES = $(depdemo_DEPENDENCIES)
depdemo_static_LDFLAGS = $(STATIC)

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "l1/l1.h"
#include "l2/l2.h"
#include "l4/l4.h"

#define STREQ !strcmp

int main (int argc, char **argv)
{
  printf("dependencies:\n");
  func_l1(0);
  func_l2(0);
  func_l4(0);
  if (argc == 2 && STREQ (argv[1], "-alt")
      && var_l1 + var_l2 + var_l4 == 8)
	return 0;
  printf("var_l1(%d) + var_l2(%d) + var_l4(%d) == %d\n",
         var_l1,var_l2,var_l4, var_l1 + var_l2 + var_l4);
  if (var_l1 + var_l2 + var_l4 != 19)
    {
	printf("var_l1(%d) + var_l2(%d) + var_l4(%d) != 19\n",
               var_l1,var_l2,var_l4);
	return 1;
    }
  return 0;
}
_ATEOF


# Create 4 directorys of mostly identical files.
for i in 1 2 3 4; do
  mkdir l$i

  # l$i/Makefile.am:
  {
    $ECHO     'AUTOMAKE_OPTIONS = no-dependencies foreign'
    $ECHO     'AM_CPPFLAGS = -I$(top_srcdir) -DBUILDING_LIBL'$i
    $ECHO     'lib_LTLIBRARIES = libl'$i'.la'
    $ECHO     'libl'$i'_la_SOURCES = l'$i'.c l'$i'.h'
    $ECHO     'libl'$i'_la_LDFLAGS = -no-undefined'
    $ECHO     'libl'$i'_la_LIBADD ='
    if test 4 != $i; then
      j=1; while test "$j" -lt "$i"; do
        $ECHO 'libl'$i'_la_LIBADD += $(top_builddir)/l'$j'/libl'$j'.la'
        j=`expr 1 + $j`
      done
    else
      j=3
      $ECHO   'libl'$i'_la_LIBADD += $(top_builddir)/l'$j'/libl'$j'.la $(LIBM)'
    fi
  } > l$i/Makefile.am

  # l$i/l$i.h
  {
    $ECHO '#ifndef L'$i'_H'
    $ECHO '#define L'$i'_H'
    $ECHO
    $ECHO '#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__'
    $ECHO '#  ifdef BUILDING_LIBL'$i
    $ECHO '#    ifdef DLL_EXPORT'
    $ECHO '#      define LIBL'$i'_SCOPE extern __declspec (dllexport)'
    $ECHO '#    endif'
    $ECHO '#  else'
    $ECHO '#    define LIBL'$i'_SCOPE extern __declspec (dllimport)'
    $ECHO '#  endif'
    $ECHO '#endif'
    $ECHO '#ifndef LIBL'$i'_SCOPE'
    $ECHO '#  define LIBL'$i'_SCOPE extern'
    $ECHO '#endif'
    $ECHO
    $ECHO '#ifdef __cplusplus'
    $ECHO 'extern "C" {'
    $ECHO '#endif'
    $ECHO
    $ECHO '  LIBL'$i'_SCOPE int var_l'$i';'
    $ECHO '  int func_l'$i' (int);'
    $ECHO
    $ECHO '#ifdef __cplusplus'
    $ECHO '}'
    $ECHO '#endif'
    $ECHO '#endif'
  } > l$i/l$i.h

  # l$i/l$i.c:
  {
    if test 4 -ne $i; then
      $ECHO     '#include <config.h>'
      $ECHO     '#include <stdio.h>'
      $ECHO
      $ECHO     '#include "l'$i'/l'$i'.h"'
      j=1; while test "$j" -lt "$i"; do
        $ECHO   '#include "l'$j'/l'$j'.h"'
        j=`expr 1 + $j`
      done
      $ECHO
      $ECHO     'int var_l'$i' = 0;'
      $ECHO     'int func_l'$i' (int indent) {'
      $ECHO     '  int i;'
      $ECHO     '  for (i = 0; i < indent; i++)'
      $ECHO     "    putchar (' ');"
      $ECHO     '  printf ("l'$i' (%i)\n", var_l'$i');'
      if test 1 -eq $i; then
        $ECHO   '  var_l1++;'
      else
        j=1; while test "$j" -lt "$i"; do
          $ECHO '  func_l'$j'(indent+1);'
          $ECHO '  var_l'$i' += var_l'$j';'
          j=`expr 1 + $j`
        done
      fi
      $ECHO     '  return 0;'
      $ECHO     '}'
    else
      j=3
      $ECHO     '#include <config.h>'
      $ECHO     '#include <stdio.h>'
      $ECHO     '#include <math.h>'
      $ECHO     '#include "l'$i'/l'$i'.h"'
      $ECHO     '#include "l'$j'/l'$j'.h"'
      $ECHO
      $ECHO     'int var_l'$i' = 0;'
      $ECHO     'int func_l'$i' (int indent) {'
      $ECHO     '  int i;'
      $ECHO     '  for (i = 0; i < indent; i++)'
      $ECHO     "    putchar (' ');"
      $ECHO     '  printf ("l'$i' (%i)\n", var_l'$i');'
      $ECHO     '  func_l'$j'(indent+1);'
      $ECHO     '  for (i = 0; i < indent; i++)'
      $ECHO     "    putchar (' ');"
      $ECHO     '  printf("libm cos (0.0) = %g\n", (double) cos ((double) 0.0));'
      $ECHO     '  var_l'$i' += var_l'$j';'
      $ECHO     '  return 0;'
      $ECHO     '}'
    fi
  } > l$i/l$i.c
done


cat >expout <<'_ATEOF'
dependencies:
l1 (0)
l2 (0)
 l1 (1)
l4 (0)
 l3 (0)
  l1 (2)
  l2 (2)
   l1 (3)
libm cos (0.0) = 1
var_l1(4) + var_l2(6) + var_l4(9) == 19
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/depdemo.at:324: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "depdemo.at:324"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:324"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/depdemo.at:324: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "depdemo.at:324"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:324"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:324: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "depdemo.at:324"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:324"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/depdemo.at:324: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "depdemo.at:324"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/depdemo.at:324"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:324: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "depdemo.at:324"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:324"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:324: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "depdemo.at:324"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:324"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:324: \$EGREP '^build_old_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=yes' libtool" "depdemo.at:324"
( $at_check_trace; $EGREP '^build_old_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:324"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/depdemo.at:324: \$EGREP '^build_libtool_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=yes' libtool" "depdemo.at:324"
( $at_check_trace; $EGREP '^build_libtool_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:324"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/depdemo.at:326: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "depdemo.at:326"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:326"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./depdemo_static; if test -f "./depdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:326: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:326"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:326"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./depdemo; if test -f "./depdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:326: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:326"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:326"
$at_failed && at_fn_log_failure
$at_traceon; }







# Windows hosts search for dlls in the command path.
PATH=$prefix/lib:$PATH
for target in install
do
  { set +x
$as_echo "$at_srcdir/depdemo.at:327: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "depdemo.at:327"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:327"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=$prefix/bin/depdemo_static; if test -f "$prefix/bin/depdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:327: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:327"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:327"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$prefix/bin/depdemo; if test -f "$prefix/bin/depdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:327: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:327"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:327"
$at_failed && at_fn_log_failure
$at_traceon; }







for target in uninstall
do
  { set +x
$as_echo "$at_srcdir/depdemo.at:328: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "depdemo.at:328"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:328"
$at_failed && at_fn_log_failure
$at_traceon; }

done


leftovers=`find $prefix ! -type d ! -name '.*' -print`
{ set +x
$as_echo "$at_srcdir/depdemo.at:328: test -z \"\$leftovers\""
at_fn_check_prepare_dynamic "test -z \"$leftovers\"" "depdemo.at:328"
( $at_check_trace; test -z "$leftovers"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:328"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_51
#AT_START_52
at_fn_group_banner 52 'depdemo.at:337' \
  "disable fast install" "                           " 6
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "52. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([depdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

LT_LIB_M
AC_CONFIG_FILES([Makefile l1/Makefile l2/Makefile l3/Makefile l4/Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

SUBDIRS = l1 l2 l3 l4

bin_PROGRAMS = depdemo depdemo_static

depdemo_SOURCES = main.c
depdemo_LDADD = $(top_builddir)/l1/libl1.la $(top_builddir)/l2/libl2.la \
		$(top_builddir)/l4/libl4.la
depdemo_DEPENDENCIES = $(top_builddir)/l1/libl1.la \
		$(top_builddir)/l2/libl2.la $(top_builddir)/l4/libl4.la

depdemo_static_SOURCES = $(depdemo_SOURCES)
depdemo_static_LDADD = $(depdemo_LDADD)
depdemo_static_DEPENDENCIES = $(depdemo_DEPENDENCIES)
depdemo_static_LDFLAGS = $(STATIC)

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "l1/l1.h"
#include "l2/l2.h"
#include "l4/l4.h"

#define STREQ !strcmp

int main (int argc, char **argv)
{
  printf("dependencies:\n");
  func_l1(0);
  func_l2(0);
  func_l4(0);
  if (argc == 2 && STREQ (argv[1], "-alt")
      && var_l1 + var_l2 + var_l4 == 8)
	return 0;
  printf("var_l1(%d) + var_l2(%d) + var_l4(%d) == %d\n",
         var_l1,var_l2,var_l4, var_l1 + var_l2 + var_l4);
  if (var_l1 + var_l2 + var_l4 != 19)
    {
	printf("var_l1(%d) + var_l2(%d) + var_l4(%d) != 19\n",
               var_l1,var_l2,var_l4);
	return 1;
    }
  return 0;
}
_ATEOF


# Create 4 directorys of mostly identical files.
for i in 1 2 3 4; do
  mkdir l$i

  # l$i/Makefile.am:
  {
    $ECHO     'AUTOMAKE_OPTIONS = no-dependencies foreign'
    $ECHO     'AM_CPPFLAGS = -I$(top_srcdir) -DBUILDING_LIBL'$i
    $ECHO     'lib_LTLIBRARIES = libl'$i'.la'
    $ECHO     'libl'$i'_la_SOURCES = l'$i'.c l'$i'.h'
    $ECHO     'libl'$i'_la_LDFLAGS = -no-undefined'
    $ECHO     'libl'$i'_la_LIBADD ='
    if test 4 != $i; then
      j=1; while test "$j" -lt "$i"; do
        $ECHO 'libl'$i'_la_LIBADD += $(top_builddir)/l'$j'/libl'$j'.la'
        j=`expr 1 + $j`
      done
    else
      j=3
      $ECHO   'libl'$i'_la_LIBADD += $(top_builddir)/l'$j'/libl'$j'.la $(LIBM)'
    fi
  } > l$i/Makefile.am

  # l$i/l$i.h
  {
    $ECHO '#ifndef L'$i'_H'
    $ECHO '#define L'$i'_H'
    $ECHO
    $ECHO '#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__'
    $ECHO '#  ifdef BUILDING_LIBL'$i
    $ECHO '#    ifdef DLL_EXPORT'
    $ECHO '#      define LIBL'$i'_SCOPE extern __declspec (dllexport)'
    $ECHO '#    endif'
    $ECHO '#  else'
    $ECHO '#    define LIBL'$i'_SCOPE extern __declspec (dllimport)'
    $ECHO '#  endif'
    $ECHO '#endif'
    $ECHO '#ifndef LIBL'$i'_SCOPE'
    $ECHO '#  define LIBL'$i'_SCOPE extern'
    $ECHO '#endif'
    $ECHO
    $ECHO '#ifdef __cplusplus'
    $ECHO 'extern "C" {'
    $ECHO '#endif'
    $ECHO
    $ECHO '  LIBL'$i'_SCOPE int var_l'$i';'
    $ECHO '  int func_l'$i' (int);'
    $ECHO
    $ECHO '#ifdef __cplusplus'
    $ECHO '}'
    $ECHO '#endif'
    $ECHO '#endif'
  } > l$i/l$i.h

  # l$i/l$i.c:
  {
    if test 4 -ne $i; then
      $ECHO     '#include <config.h>'
      $ECHO     '#include <stdio.h>'
      $ECHO
      $ECHO     '#include "l'$i'/l'$i'.h"'
      j=1; while test "$j" -lt "$i"; do
        $ECHO   '#include "l'$j'/l'$j'.h"'
        j=`expr 1 + $j`
      done
      $ECHO
      $ECHO     'int var_l'$i' = 0;'
      $ECHO     'int func_l'$i' (int indent) {'
      $ECHO     '  int i;'
      $ECHO     '  for (i = 0; i < indent; i++)'
      $ECHO     "    putchar (' ');"
      $ECHO     '  printf ("l'$i' (%i)\n", var_l'$i');'
      if test 1 -eq $i; then
        $ECHO   '  var_l1++;'
      else
        j=1; while test "$j" -lt "$i"; do
          $ECHO '  func_l'$j'(indent+1);'
          $ECHO '  var_l'$i' += var_l'$j';'
          j=`expr 1 + $j`
        done
      fi
      $ECHO     '  return 0;'
      $ECHO     '}'
    else
      j=3
      $ECHO     '#include <config.h>'
      $ECHO     '#include <stdio.h>'
      $ECHO     '#include <math.h>'
      $ECHO     '#include "l'$i'/l'$i'.h"'
      $ECHO     '#include "l'$j'/l'$j'.h"'
      $ECHO
      $ECHO     'int var_l'$i' = 0;'
      $ECHO     'int func_l'$i' (int indent) {'
      $ECHO     '  int i;'
      $ECHO     '  for (i = 0; i < indent; i++)'
      $ECHO     "    putchar (' ');"
      $ECHO     '  printf ("l'$i' (%i)\n", var_l'$i');'
      $ECHO     '  func_l'$j'(indent+1);'
      $ECHO     '  for (i = 0; i < indent; i++)'
      $ECHO     "    putchar (' ');"
      $ECHO     '  printf("libm cos (0.0) = %g\n", (double) cos ((double) 0.0));'
      $ECHO     '  var_l'$i' += var_l'$j';'
      $ECHO     '  return 0;'
      $ECHO     '}'
    fi
  } > l$i/l$i.c
done


cat >expout <<'_ATEOF'
dependencies:
l1 (0)
l2 (0)
 l1 (1)
l4 (0)
 l3 (0)
  l1 (2)
  l2 (2)
   l1 (3)
libm cos (0.0) = 1
var_l1(4) + var_l2(6) + var_l4(9) == 19
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/depdemo.at:341: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "depdemo.at:341"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:341"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/depdemo.at:341: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "depdemo.at:341"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:341"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:341: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "depdemo.at:341"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:341"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/depdemo.at:341: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "depdemo.at:341"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/depdemo.at:341"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:341: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "depdemo.at:341"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:341"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:341: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --enable-fast-install=no"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "depdemo.at:341"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --enable-fast-install=no
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:341"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/depdemo.at:342: \$EGREP '^hardcode_action=relink' libtool && (exit 77)"
at_fn_check_prepare_dynamic "$EGREP '^hardcode_action=relink' libtool && (exit 77)" "depdemo.at:342"
( $at_check_trace; $EGREP '^hardcode_action=relink' libtool && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/depdemo.at:342"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/depdemo.at:344: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "depdemo.at:344"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:344"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./depdemo_static; if test -f "./depdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:344: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:344"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:344"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./depdemo; if test -f "./depdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:344: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:344"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:344"
$at_failed && at_fn_log_failure
$at_traceon; }







# Windows hosts search for dlls in the command path.
PATH=$prefix/lib:$PATH
for target in install
do
  { set +x
$as_echo "$at_srcdir/depdemo.at:345: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "depdemo.at:345"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:345"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=$prefix/bin/depdemo_static; if test -f "$prefix/bin/depdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:345: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:345"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:345"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$prefix/bin/depdemo; if test -f "$prefix/bin/depdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:345: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:345"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:345"
$at_failed && at_fn_log_failure
$at_traceon; }







for target in uninstall
do
  { set +x
$as_echo "$at_srcdir/depdemo.at:346: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "depdemo.at:346"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:346"
$at_failed && at_fn_log_failure
$at_traceon; }

done


leftovers=`find $prefix ! -type d ! -name '.*' -print`
{ set +x
$as_echo "$at_srcdir/depdemo.at:346: test -z \"\$leftovers\""
at_fn_check_prepare_dynamic "test -z \"$leftovers\"" "depdemo.at:346"
( $at_check_trace; test -z "$leftovers"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:346"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_52
#AT_START_53
at_fn_group_banner 53 'depdemo.at:355' \
  "binary relinking at install time" "               " 6
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "53. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([depdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC

LT_INIT([win32-dll])
AC_SUBST([LIBTOOL_DEPS])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])

LT_LIB_M
AC_CONFIG_FILES([Makefile l1/Makefile l2/Makefile l3/Makefile l4/Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

SUBDIRS = l1 l2 l3 l4

bin_PROGRAMS = depdemo depdemo_static

depdemo_SOURCES = main.c
depdemo_LDADD = $(top_builddir)/l1/libl1.la $(top_builddir)/l2/libl2.la \
		$(top_builddir)/l4/libl4.la
depdemo_DEPENDENCIES = $(top_builddir)/l1/libl1.la \
		$(top_builddir)/l2/libl2.la $(top_builddir)/l4/libl4.la

depdemo_static_SOURCES = $(depdemo_SOURCES)
depdemo_static_LDADD = $(depdemo_LDADD)
depdemo_static_DEPENDENCIES = $(depdemo_DEPENDENCIES)
depdemo_static_LDFLAGS = $(STATIC)

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "l1/l1.h"
#include "l2/l2.h"
#include "l4/l4.h"

#define STREQ !strcmp

int main (int argc, char **argv)
{
  printf("dependencies:\n");
  func_l1(0);
  func_l2(0);
  func_l4(0);
  if (argc == 2 && STREQ (argv[1], "-alt")
      && var_l1 + var_l2 + var_l4 == 8)
	return 0;
  printf("var_l1(%d) + var_l2(%d) + var_l4(%d) == %d\n",
         var_l1,var_l2,var_l4, var_l1 + var_l2 + var_l4);
  if (var_l1 + var_l2 + var_l4 != 19)
    {
	printf("var_l1(%d) + var_l2(%d) + var_l4(%d) != 19\n",
               var_l1,var_l2,var_l4);
	return 1;
    }
  return 0;
}
_ATEOF


# Create 4 directorys of mostly identical files.
for i in 1 2 3 4; do
  mkdir l$i

  # l$i/Makefile.am:
  {
    $ECHO     'AUTOMAKE_OPTIONS = no-dependencies foreign'
    $ECHO     'AM_CPPFLAGS = -I$(top_srcdir) -DBUILDING_LIBL'$i
    $ECHO     'lib_LTLIBRARIES = libl'$i'.la'
    $ECHO     'libl'$i'_la_SOURCES = l'$i'.c l'$i'.h'
    $ECHO     'libl'$i'_la_LDFLAGS = -no-undefined'
    $ECHO     'libl'$i'_la_LIBADD ='
    if test 4 != $i; then
      j=1; while test "$j" -lt "$i"; do
        $ECHO 'libl'$i'_la_LIBADD += $(top_builddir)/l'$j'/libl'$j'.la'
        j=`expr 1 + $j`
      done
    else
      j=3
      $ECHO   'libl'$i'_la_LIBADD += $(top_builddir)/l'$j'/libl'$j'.la $(LIBM)'
    fi
  } > l$i/Makefile.am

  # l$i/l$i.h
  {
    $ECHO '#ifndef L'$i'_H'
    $ECHO '#define L'$i'_H'
    $ECHO
    $ECHO '#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__'
    $ECHO '#  ifdef BUILDING_LIBL'$i
    $ECHO '#    ifdef DLL_EXPORT'
    $ECHO '#      define LIBL'$i'_SCOPE extern __declspec (dllexport)'
    $ECHO '#    endif'
    $ECHO '#  else'
    $ECHO '#    define LIBL'$i'_SCOPE extern __declspec (dllimport)'
    $ECHO '#  endif'
    $ECHO '#endif'
    $ECHO '#ifndef LIBL'$i'_SCOPE'
    $ECHO '#  define LIBL'$i'_SCOPE extern'
    $ECHO '#endif'
    $ECHO
    $ECHO '#ifdef __cplusplus'
    $ECHO 'extern "C" {'
    $ECHO '#endif'
    $ECHO
    $ECHO '  LIBL'$i'_SCOPE int var_l'$i';'
    $ECHO '  int func_l'$i' (int);'
    $ECHO
    $ECHO '#ifdef __cplusplus'
    $ECHO '}'
    $ECHO '#endif'
    $ECHO '#endif'
  } > l$i/l$i.h

  # l$i/l$i.c:
  {
    if test 4 -ne $i; then
      $ECHO     '#include <config.h>'
      $ECHO     '#include <stdio.h>'
      $ECHO
      $ECHO     '#include "l'$i'/l'$i'.h"'
      j=1; while test "$j" -lt "$i"; do
        $ECHO   '#include "l'$j'/l'$j'.h"'
        j=`expr 1 + $j`
      done
      $ECHO
      $ECHO     'int var_l'$i' = 0;'
      $ECHO     'int func_l'$i' (int indent) {'
      $ECHO     '  int i;'
      $ECHO     '  for (i = 0; i < indent; i++)'
      $ECHO     "    putchar (' ');"
      $ECHO     '  printf ("l'$i' (%i)\n", var_l'$i');'
      if test 1 -eq $i; then
        $ECHO   '  var_l1++;'
      else
        j=1; while test "$j" -lt "$i"; do
          $ECHO '  func_l'$j'(indent+1);'
          $ECHO '  var_l'$i' += var_l'$j';'
          j=`expr 1 + $j`
        done
      fi
      $ECHO     '  return 0;'
      $ECHO     '}'
    else
      j=3
      $ECHO     '#include <config.h>'
      $ECHO     '#include <stdio.h>'
      $ECHO     '#include <math.h>'
      $ECHO     '#include "l'$i'/l'$i'.h"'
      $ECHO     '#include "l'$j'/l'$j'.h"'
      $ECHO
      $ECHO     'int var_l'$i' = 0;'
      $ECHO     'int func_l'$i' (int indent) {'
      $ECHO     '  int i;'
      $ECHO     '  for (i = 0; i < indent; i++)'
      $ECHO     "    putchar (' ');"
      $ECHO     '  printf ("l'$i' (%i)\n", var_l'$i');'
      $ECHO     '  func_l'$j'(indent+1);'
      $ECHO     '  for (i = 0; i < indent; i++)'
      $ECHO     "    putchar (' ');"
      $ECHO     '  printf("libm cos (0.0) = %g\n", (double) cos ((double) 0.0));'
      $ECHO     '  var_l'$i' += var_l'$j';'
      $ECHO     '  return 0;'
      $ECHO     '}'
    fi
  } > l$i/l$i.c
done


cat >expout <<'_ATEOF'
dependencies:
l1 (0)
l2 (0)
 l1 (1)
l4 (0)
 l3 (0)
  l1 (2)
  l2 (2)
   l1 (3)
libm cos (0.0) = 1
var_l1(4) + var_l2(6) + var_l4(9) == 19
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/depdemo.at:360: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "depdemo.at:360"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:360"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/depdemo.at:360: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "depdemo.at:360"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:360"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:360: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "depdemo.at:360"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:360"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/depdemo.at:360: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "depdemo.at:360"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/depdemo.at:360"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:360: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "depdemo.at:360"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:360"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/depdemo.at:360: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "depdemo.at:360"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:360"
$at_failed && at_fn_log_failure
$at_traceon; }






for target in all
do
  { set +x
$as_echo "$at_srcdir/depdemo.at:361: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "depdemo.at:361"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:361"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./depdemo_static; if test -f "./depdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:361: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:361"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:361"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./depdemo; if test -f "./depdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:361: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:361"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:361"
$at_failed && at_fn_log_failure
$at_traceon; }







# Windows hosts search for dlls in the command path.
PATH=$prefix/lib:$PATH
for target in install
do
  { set +x
$as_echo "$at_srcdir/depdemo.at:362: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "depdemo.at:362"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:362"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=$prefix/bin/depdemo_static; if test -f "$prefix/bin/depdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:362: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:362"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:362"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$prefix/bin/depdemo; if test -f "$prefix/bin/depdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/depdemo.at:362: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "depdemo.at:362"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:362"
$at_failed && at_fn_log_failure
$at_traceon; }








# Check to make sure we have a dynamic library.
eval `$EGREP '^library_names=' l3/libl3.la`
{ set +x
$as_echo "$at_srcdir/depdemo.at:366: test -n \"\$library_names\" || (exit 77)"
at_fn_check_prepare_dynamic "test -n \"$library_names\" || (exit 77)" "depdemo.at:366"
( $at_check_trace; test -n "$library_names" || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:366"
$at_failed && at_fn_log_failure
$at_traceon; }


func_save_files

# AIX 5.3 '/bin/sh' will invoke the trap for 0 at the end of a
# function, so we set the trap outside of a function to be portable.
trap func_restore_files 0 1 2 13 15

eval "`$LIBTOOL --config | $EGREP '^shlibpath_overrides_runpath='`"
eval "`$LIBTOOL --config | $EGREP '^hardcode_(action|direct|into_libs)='`"

# Can't finish these tests reliably when cross-compiling.
{ set +x
$as_echo "$at_srcdir/depdemo.at:378: test \"X\$host\" = \"X\$build\" || (exit 77)"
at_fn_check_prepare_dynamic "test \"X$host\" = \"X$build\" || (exit 77)" "depdemo.at:378"
( $at_check_trace; test "X$host" = "X$build" || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:378"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow the binary to link on-demand if need be.
./depdemo$EXEEXT >/dev/null || :

# Remove l3/libl3.la from build tree.
rm -f l3/libl3.la "l3/$objdir"/libl3.*

# Either:
#  - uninstalled ./depdem will run using the just installed libraries
#    when the uninstalled libs are missing;
#  - on AIX 4.1, when the installed copy of libl3 is loaded, it brings
#    with it the installed copies of libl1 and libl2, with disjoint
#    counters var_l1 and var_l2.  This is arguably unacceptable behaviour
#    but definitely not enough of a reason for the test to fail;
#  - or relinking at install time is necessary, and the uninstalled
#    depdemo has only the uninstalled library paths hardcoded.
{ set +x
$as_echo "$at_srcdir/depdemo.at:395: ./depdemo\$EXEEXT >/dev/null ||
    ./depdemo\$EXEEXT -alt ||
    test relink,yes = \"\$hardcode_action,\$hardcode_direct\""
at_fn_check_prepare_notrace 'an embedded newline' "depdemo.at:395"
( $at_check_trace; ./depdemo$EXEEXT >/dev/null ||
    ./depdemo$EXEEXT -alt ||
    test relink,yes = "$hardcode_action,$hardcode_direct"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:395"
$at_failed && at_fn_log_failure
$at_traceon; }


# Link an incomplete l3/libl3.la.
(cd l3 &&
 for target in libl3.la
do
  { set +x
$as_echo "$at_srcdir/depdemo.at:401: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target libl3_la_OBJECTS=../l2/l2.lo"
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target libl3_la_OBJECTS=../l2/l2.lo" "depdemo.at:401"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target libl3_la_OBJECTS=../l2/l2.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:401"
$at_failed && at_fn_log_failure
$at_traceon; }

done

)
{ set +x
$as_echo "$at_srcdir/depdemo.at:403: test -f l3/libl3.la"
at_fn_check_prepare_trace "depdemo.at:403"
( $at_check_trace; test -f l3/libl3.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:403"
$at_failed && at_fn_log_failure
$at_traceon; }


# Try running uninstalled ./depdemo with only broken libl3.la in build tree.
# If the following has normal exit status, shlibpath_overrides_runpath is
# wrong, and should be set to 'no' on this host.
# The unusual '|| (exit 1)' is to normalize all non-zero exit statuses.
{ set +x
$as_echo "$at_srcdir/depdemo.at:409: ./depdemo\$EXEEXT || (exit 1)"
at_fn_check_prepare_dynamic "./depdemo$EXEEXT || (exit 1)" "depdemo.at:409"
( $at_check_trace; ./depdemo$EXEEXT || (exit 1)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/depdemo.at:409"
$at_failed && at_fn_log_failure
$at_traceon; }


test relink = "$hardcode_action" ||
test yes = "$shlibpath_overrides_runpath" ||
{
    { set +x
$as_echo "$at_srcdir/depdemo.at:414: rm -f \$objdir/lt-depdemo\$EXEEXT"
at_fn_check_prepare_dynamic "rm -f $objdir/lt-depdemo$EXEEXT" "depdemo.at:414"
( $at_check_trace; rm -f $objdir/lt-depdemo$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:414"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/depdemo.at:415: cp \$objdir/depdemo\$EXEEXT \$objdir/lt-depdemo\$EXEEXT"
at_fn_check_prepare_dynamic "cp $objdir/depdemo$EXEEXT $objdir/lt-depdemo$EXEEXT" "depdemo.at:415"
( $at_check_trace; cp $objdir/depdemo$EXEEXT $objdir/lt-depdemo$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:415"
$at_failed && at_fn_log_failure
$at_traceon; }


    # Running depdemo with installed libl3.la.
    # If the following check fails, then shlibpath_overrides_runpath is
    # wrong, and should be set to 'yes' on this host.
    echo "./depdemo"; { set +x
$as_echo "$at_srcdir/depdemo.at:420: ./depdemo"
at_fn_check_prepare_trace "depdemo.at:420"
( $at_check_trace; ./depdemo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/depdemo.at:420"
$at_failed && at_fn_log_failure
$at_traceon; }

}

# Undo the effect of the previous 'trap' command. Some shellology:
# We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
# execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
# exit); for the others we need to call 'exit' explicitly. The value of $? is
# 128 + signal number and is set before the trap-registered command is run.
trap '' 0
trap 'func_exit $?' 1 2 3 13 15

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_53
#AT_START_54
at_fn_group_banner 54 'help.at:26' \
  "standard command line options" "                  " 7
at_xfail=no
(
  $as_echo "54. $at_setup_line: testing $at_desc ..."
  $at_traceon




{ set +x
$as_echo "$at_srcdir/help.at:30: \$LIBTOOLIZE --help"
at_fn_check_prepare_dynamic "$LIBTOOLIZE --help" "help.at:30"
( $at_check_trace; $LIBTOOLIZE --help
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:30"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:31: \$LIBTOOLIZE --version"
at_fn_check_prepare_dynamic "$LIBTOOLIZE --version" "help.at:31"
( $at_check_trace; $LIBTOOLIZE --version
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:31"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:32: \$GREP 'Copyright.*Free Software Foundation' stdout"
at_fn_check_prepare_dynamic "$GREP 'Copyright.*Free Software Foundation' stdout" "help.at:32"
( $at_check_trace; $GREP 'Copyright.*Free Software Foundation' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:32"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:33: \$LIBTOOL --help"
at_fn_check_prepare_dynamic "$LIBTOOL --help" "help.at:33"
( $at_check_trace; $LIBTOOL --help
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:33"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:34: \$LIBTOOL --help-all"
at_fn_check_prepare_dynamic "$LIBTOOL --help-all" "help.at:34"
( $at_check_trace; $LIBTOOL --help-all
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:34"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:35: \$LIBTOOL --version"
at_fn_check_prepare_dynamic "$LIBTOOL --version" "help.at:35"
( $at_check_trace; $LIBTOOL --version
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:35"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:36: \$GREP 'Copyright.*Free Software Foundation' stdout"
at_fn_check_prepare_dynamic "$GREP 'Copyright.*Free Software Foundation' stdout" "help.at:36"
( $at_check_trace; $GREP 'Copyright.*Free Software Foundation' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:36"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/help.at:38: \$LIBTOOL"
at_fn_check_prepare_dynamic "$LIBTOOL" "help.at:38"
( $at_check_trace; $LIBTOOL
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/help.at:38"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:39: \$GREP 'specify a MODE' stderr"
at_fn_check_prepare_dynamic "$GREP 'specify a MODE' stderr" "help.at:39"
( $at_check_trace; $GREP 'specify a MODE' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:39"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:40: \$GREP ' --help' stdout"
at_fn_check_prepare_dynamic "$GREP ' --help' stdout" "help.at:40"
( $at_check_trace; $GREP ' --help' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:40"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_54
#AT_START_55
at_fn_group_banner 55 'help.at:45' \
  "mode short-hands" "                               " 7
at_xfail=no
(
  $as_echo "55. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >a.c <<'_ATEOF'
int a () { return 0; }
_ATEOF


cat >main.c <<'_ATEOF'
extern int a ();
int main () { return a (); }
_ATEOF


inst=`pwd`/inst
libdir=$inst/lib
bindir=$inst/bin
mkdir $inst $libdir $bindir

{ set +x
$as_echo "$at_srcdir/help.at:61: \$LIBTOOL compile \$CC \$CPPFLAGS \$CFLAGS -c a.c"
at_fn_check_prepare_dynamic "$LIBTOOL compile $CC $CPPFLAGS $CFLAGS -c a.c" "help.at:61"
( $at_check_trace; $LIBTOOL compile $CC $CPPFLAGS $CFLAGS -c a.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:61"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:63: \$LIBTOOL co \$CC \$CPPFLAGS \$CFLAGS -c main.c"
at_fn_check_prepare_dynamic "$LIBTOOL co $CC $CPPFLAGS $CFLAGS -c main.c" "help.at:63"
( $at_check_trace; $LIBTOOL co $CC $CPPFLAGS $CFLAGS -c main.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:63"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:65: \$LIBTOOL co \$CC \$CPPFLAGS \$CFLAGS -c main.c"
at_fn_check_prepare_dynamic "$LIBTOOL co $CC $CPPFLAGS $CFLAGS -c main.c" "help.at:65"
( $at_check_trace; $LIBTOOL co $CC $CPPFLAGS $CFLAGS -c main.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:65"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:67: \$LIBTOOL link \$CC \$CFLAGS \$LDFLAGS -o liba.la a.lo 	 -no-undefined -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL link $CC $CFLAGS $LDFLAGS -o liba.la a.lo 	 -no-undefined -rpath $libdir" "help.at:67"
( $at_check_trace; $LIBTOOL link $CC $CFLAGS $LDFLAGS -o liba.la a.lo 	 -no-undefined -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:67"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:69: \$LIBTOOL l \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.lo 	 liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL l $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.lo 	 liba.la" "help.at:69"
( $at_check_trace; $LIBTOOL l $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.lo 	 liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:69"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:71: \$LIBTOOL execute --dry-run ./main\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL execute --dry-run ./main$EXEEXT" "help.at:71"
( $at_check_trace; $LIBTOOL execute --dry-run ./main$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:71"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:73: \$LIBTOOL exe --dry-run ./main\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL exe --dry-run ./main$EXEEXT" "help.at:73"
( $at_check_trace; $LIBTOOL exe --dry-run ./main$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:73"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:75: \$LIBTOOL e --dry-run ./main\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL e --dry-run ./main$EXEEXT" "help.at:75"
( $at_check_trace; $LIBTOOL e --dry-run ./main$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:75"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:77: \$LIBTOOL install cp liba.la \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL install cp liba.la $libdir" "help.at:77"
( $at_check_trace; $LIBTOOL install cp liba.la $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:77"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:79: \$LIBTOOL i cp main\$EXEEXT \$bindir"
at_fn_check_prepare_dynamic "$LIBTOOL i cp main$EXEEXT $bindir" "help.at:79"
( $at_check_trace; $LIBTOOL i cp main$EXEEXT $bindir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:79"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:81: \$LIBTOOL finish \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL finish $libdir" "help.at:81"
( $at_check_trace; $LIBTOOL finish $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:81"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:83: \$LIBTOOL f \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL f $libdir" "help.at:83"
( $at_check_trace; $LIBTOOL f $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:83"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:85: \$LIBTOOL uninstall rm -f \$libdir/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL uninstall rm -f $libdir/liba.la" "help.at:85"
( $at_check_trace; $LIBTOOL uninstall rm -f $libdir/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:85"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:87: \$LIBTOOL u rm -f \$bindir/main\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL u rm -f $bindir/main$EXEEXT" "help.at:87"
( $at_check_trace; $LIBTOOL u rm -f $bindir/main$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:87"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:89: \$LIBTOOL clean rm -f main\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL clean rm -f main$EXEEXT" "help.at:89"
( $at_check_trace; $LIBTOOL clean rm -f main$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:89"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/help.at:91: \$LIBTOOL cl liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL cl liba.la" "help.at:91"
( $at_check_trace; $LIBTOOL cl liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:91"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_55
#AT_START_56
at_fn_group_banner 56 'help.at:97' \
  "debug tracing" "                                  " 7
at_xfail=no
(
  $as_echo "56. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >a.c <<'_ATEOF'
int a () { return 0; }
_ATEOF


cat >b.c <<'_ATEOF'
extern int a ();
int b () { return a (); }
_ATEOF


cat >main.c <<'_ATEOF'
extern int b ();
int main () { return b (); }
_ATEOF


inst=`pwd`/inst
libdir=$inst/lib
bindir=$inst/bin
mkdir $inst $libdir $bindir

# This test will not work correctly if --debug is passed.
{ set +x
$as_echo "$at_srcdir/help.at:119: case \"\$LIBTOOL \$CC \$CPPFLAGS \$CFLAGS \$LDFLAGS \" in 	   *\\ --debug\\ *) exit 77;; *) :;; esac"
at_fn_check_prepare_dynamic "case \"$LIBTOOL $CC $CPPFLAGS $CFLAGS $LDFLAGS \" in 	   *\\ --debug\\ *) exit 77;; *) :;; esac" "help.at:119"
( $at_check_trace; case "$LIBTOOL $CC $CPPFLAGS $CFLAGS $LDFLAGS " in 	   *\ --debug\ *) exit 77;; *) :;; esac
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/help.at:119"
$at_failed && at_fn_log_failure
$at_traceon; }


check_trace ()
{
  if test X--debug = "X$trace"; then
    { set +x
$as_echo "$at_srcdir/help.at:125: \$GREP 'enabling shell trace mode' stdout stderr"
at_fn_check_prepare_dynamic "$GREP 'enabling shell trace mode' stdout stderr" "help.at:125"
( $at_check_trace; $GREP 'enabling shell trace mode' stdout stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:125"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/help.at:126: \$GREP ' --mode' stderr"
at_fn_check_prepare_dynamic "$GREP ' --mode' stderr" "help.at:126"
( $at_check_trace; $GREP ' --mode' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:126"
$at_failed && at_fn_log_failure
$at_traceon; }

  else
    { set +x
$as_echo "$at_srcdir/help.at:128: \$GREP 'enabling shell trace mode' stdout stderr"
at_fn_check_prepare_dynamic "$GREP 'enabling shell trace mode' stdout stderr" "help.at:128"
( $at_check_trace; $GREP 'enabling shell trace mode' stdout stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/help.at:128"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/help.at:129: \$GREP ' --mode' stderr"
at_fn_check_prepare_dynamic "$GREP ' --mode' stderr" "help.at:129"
( $at_check_trace; $GREP ' --mode' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/help.at:129"
$at_failed && at_fn_log_failure
$at_traceon; }

  fi
}

orig_LIBTOOL=$LIBTOOL
for trace in '' --debug; do
  LIBTOOL="$orig_LIBTOOL $trace"

  # Hypothesis: debug output should happen if (and only if) --debug is
  # passed, for compile, link, install, uninstall, and clean modes.
  { set +x
$as_echo "$at_srcdir/help.at:139: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c a.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c" "help.at:139"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:139"
$at_failed && at_fn_log_failure
$at_traceon; }

  check_trace
  { set +x
$as_echo "$at_srcdir/help.at:142: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c b.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c b.c" "help.at:142"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c b.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:142"
$at_failed && at_fn_log_failure
$at_traceon; }

  check_trace
  { set +x
$as_echo "$at_srcdir/help.at:145: \$CC \$CPPFLAGS \$CFLAGS -c main.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c main.c" "help.at:145"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c main.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:145"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/help.at:146: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la a.lo 	    -no-undefined -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo 	    -no-undefined -rpath $libdir" "help.at:146"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo 	    -no-undefined -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:146"
$at_failed && at_fn_log_failure
$at_traceon; }

  check_trace
  { set +x
$as_echo "$at_srcdir/help.at:149: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o libb.la b.lo 	    -no-undefined -rpath \$libdir liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la b.lo 	    -no-undefined -rpath $libdir liba.la" "help.at:149"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la b.lo 	    -no-undefined -rpath $libdir liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:149"
$at_failed && at_fn_log_failure
$at_traceon; }

  check_trace
  { set +x
$as_echo "$at_srcdir/help.at:152: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT 	   libb.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT 	   libb.la" "help.at:152"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT 	   libb.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:152"
$at_failed && at_fn_log_failure
$at_traceon; }

  check_trace
  lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/help.at:155: if \$LIBTOOL --mode=execute  \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if $LIBTOOL --mode=execute  \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "help.at:155"
( $at_check_trace; if $LIBTOOL --mode=execute  "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:155"
$at_failed && at_fn_log_failure
$at_traceon; }


  check_trace

  { set +x
$as_echo "$at_srcdir/help.at:158: \$LIBTOOL --mode=install cp liba.la libb.la \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp liba.la libb.la $libdir" "help.at:158"
( $at_check_trace; $LIBTOOL --mode=install cp liba.la libb.la $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:158"
$at_failed && at_fn_log_failure
$at_traceon; }

  check_trace

  # Hypothesis: --debug should be passed to relink mode if (and only if)
  # it was passed at link mode.
  { set +x
$as_echo "$at_srcdir/help.at:164: \$orig_LIBTOOL --mode=install \$lt_INSTALL liba.la libb.la \$libdir"
at_fn_check_prepare_dynamic "$orig_LIBTOOL --mode=install $lt_INSTALL liba.la libb.la $libdir" "help.at:164"
( $at_check_trace; $orig_LIBTOOL --mode=install $lt_INSTALL liba.la libb.la $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:164"
$at_failed && at_fn_log_failure
$at_traceon; }

  if $GREP ': relinking ' stdout stderr; then
    if test X--debug = "X$trace"; then
      { set +x
$as_echo "$at_srcdir/help.at:168: \$GREP ' --mode=relink' stdout stderr | \$GREP ' --debug '"
at_fn_check_prepare_notrace 'a shell pipeline' "help.at:168"
( $at_check_trace; $GREP ' --mode=relink' stdout stderr | $GREP ' --debug '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:168"
$at_failed && at_fn_log_failure
$at_traceon; }

    else
      { set +x
$as_echo "$at_srcdir/help.at:171: \$GREP ' --mode=relink' stdout stderr | \$GREP ' --debug '"
at_fn_check_prepare_notrace 'a shell pipeline' "help.at:171"
( $at_check_trace; $GREP ' --mode=relink' stdout stderr | $GREP ' --debug '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/help.at:171"
$at_failed && at_fn_log_failure
$at_traceon; }

    fi
  fi

  { set +x
$as_echo "$at_srcdir/help.at:176: \$LIBTOOL --mode=install cp main\$EXEEXT \$bindir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp main$EXEEXT $bindir" "help.at:176"
( $at_check_trace; $LIBTOOL --mode=install cp main$EXEEXT $bindir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:176"
$at_failed && at_fn_log_failure
$at_traceon; }

  check_trace
  { set +x
$as_echo "$at_srcdir/help.at:179: \$LIBTOOL --mode=finish \$bindir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=finish $bindir" "help.at:179"
( $at_check_trace; $LIBTOOL --mode=finish $bindir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:179"
$at_failed && at_fn_log_failure
$at_traceon; }

  check_trace

  { set +x
$as_echo "$at_srcdir/help.at:182: \$LIBTOOL --mode=uninstall rm -f \$bindir/main\$EXEEXT 	   \$libdir/libb.la \$libdir/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=uninstall rm -f $bindir/main$EXEEXT 	   $libdir/libb.la $libdir/liba.la" "help.at:182"
( $at_check_trace; $LIBTOOL --mode=uninstall rm -f $bindir/main$EXEEXT 	   $libdir/libb.la $libdir/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:182"
$at_failed && at_fn_log_failure
$at_traceon; }

  check_trace
  { set +x
$as_echo "$at_srcdir/help.at:185: \$LIBTOOL --mode=clean rm -f \$bindir/main\$EXEEXT 	   \$libdir/libb.la \$libdir/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=clean rm -f $bindir/main$EXEEXT 	   $libdir/libb.la $libdir/liba.la" "help.at:185"
( $at_check_trace; $LIBTOOL --mode=clean rm -f $bindir/main$EXEEXT 	   $libdir/libb.la $libdir/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/help.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }

  check_trace

done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_56
#AT_START_57
at_fn_group_banner 57 'duplicate_members.at:26' \
  "duplicate members in archive tests" "             " 7
at_xfail=no
(
  $as_echo "57. $at_setup_line: testing $at_desc ..."
  $at_traceon



# we don't want to use whole_archive_flag_spec, even if available
$SED -e 's|^whole_archive_flag_spec=.*|whole_archive_flag_spec=|g' < $LIBTOOL > libtool

chmod +x ./libtool
LIBTOOL=./libtool

cat >bar.c <<'_ATEOF'
extern int foo1 (), foo2 (), foo3 (), foo4 (), foo5 (), foo6 ();
int bar() {
    int result = foo1 () + foo2 () + foo3 () + foo4 () + foo5 () + foo6 ();
    return result;
}
_ATEOF


cat >main.c <<'_ATEOF'
int bar();
int main()
{
if (bar() == 21) return 0;
return 1;
}
_ATEOF



for a in 1 2 3 4 5 6
do
  mkdir $a
  echo "int foo$a() {return $a;}" > $a/a.c
done


for a in 1 2 3 4 5 6
do
  $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o $a/a.lo $a/a.c
done
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libc0.la 6/a.lo
{ set +x
$as_echo "$at_srcdir/duplicate_members.at:65: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS -o libconv.la 	 1/a.lo 2/a.lo 3/a.lo 4/a.lo 5/a.lo libc0.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libconv.la 	 1/a.lo 2/a.lo 3/a.lo 4/a.lo 5/a.lo libc0.la" "duplicate_members.at:65"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libconv.la 	 1/a.lo 2/a.lo 3/a.lo 4/a.lo 5/a.lo libc0.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_members.at:65"
$at_failed && at_fn_log_failure
$at_traceon; }


$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o bar.lo bar.c
{ set +x
$as_echo "$at_srcdir/duplicate_members.at:69: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS -o libbar.la 	  bar.lo libconv.la -rpath /notexist"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbar.la 	  bar.lo libconv.la -rpath /notexist" "duplicate_members.at:69"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbar.la 	  bar.lo libconv.la -rpath /notexist
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_members.at:69"
$at_failed && at_fn_log_failure
$at_traceon; }


$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o main.lo main.c
{ set +x
$as_echo "$at_srcdir/duplicate_members.at:73: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT 	 main.lo ./libbar.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main$EXEEXT 	 main.lo ./libbar.la" "duplicate_members.at:73"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main$EXEEXT 	 main.lo ./libbar.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_members.at:73"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/duplicate_members.at:76: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "duplicate_members.at:76"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_members.at:76"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_57
#AT_START_58
at_fn_group_banner 58 'duplicate_conv.at:26' \
  "duplicate convenience archive names" "            " 7
at_xfail=no
(
  $as_echo "58. $at_setup_line: testing $at_desc ..."
  $at_traceon



eval `$LIBTOOL --config | $SED -n '/^reload_cmds=/,/^$/p'`

# We create two convenience archives with the same name, and _also_
# containing an object with the same name.  This is necessary to detect
# the failure with both 1.5.22 and HEAD, since the latter does not (did
# not?) remove the temporary output directory, thus masking the failure
# when all objects have distinct names.

mkdir a b c

echo 'int a () { return 0; }' > a/a.c
echo 'int a2() { return 0; }' > b/a.c
echo 'int b () { return 0; }' > b/b.c
echo 'extern int a(), a2(), b(); int c() { return a() + a2() + b(); }' > c.c
echo 'extern int c(); int main() { return c(); }' > main.c

$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c a/a.c -o a/a.lo
$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c b/a.c -o b/a.lo
$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c b/b.c -o b/b.lo
$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c c.c
$CC $CPPFLAGS $CFLAGS -c main.c
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o a/liba.la a/a.lo
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o b/liba.la b/a.lo b/b.lo

# Fold into convenience archive.
{ set +x
$as_echo "$at_srcdir/duplicate_conv.at:54: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS -no-undefined -o libcee.la c.lo a/liba.la b/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -no-undefined -o libcee.la c.lo a/liba.la b/liba.la" "duplicate_conv.at:54"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -no-undefined -o libcee.la c.lo a/liba.la b/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_conv.at:54"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/duplicate_conv.at:56: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT ./libcee.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT ./libcee.la" "duplicate_conv.at:56"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT ./libcee.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_conv.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/duplicate_conv.at:58: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "duplicate_conv.at:58"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_conv.at:58"
$at_failed && at_fn_log_failure
$at_traceon; }


$LIBTOOL --mode=clean rm -f libcee.la


# FIXME: For this test, we may want to zero out whole_archive_flag_spec;
#        OTOH, we'd like to test the other situation, too.

# Fold into static library.
{ set +x
$as_echo "$at_srcdir/duplicate_conv.at:66: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS -no-undefined -rpath /foo -static -o libcee.la c.lo a/liba.la b/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -no-undefined -rpath /foo -static -o libcee.la c.lo a/liba.la b/liba.la" "duplicate_conv.at:66"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -no-undefined -rpath /foo -static -o libcee.la c.lo a/liba.la b/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_conv.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/duplicate_conv.at:68: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT ./libcee.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT ./libcee.la" "duplicate_conv.at:68"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT ./libcee.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_conv.at:68"
$at_failed && at_fn_log_failure
$at_traceon; }

lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/duplicate_conv.at:70: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "duplicate_conv.at:70"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_conv.at:70"
$at_failed && at_fn_log_failure
$at_traceon; }


$LIBTOOL --mode=clean rm -f libcee.la

# Fold into library.
{ set +x
$as_echo "$at_srcdir/duplicate_conv.at:74: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS -no-undefined -rpath /foo -o libcee.la c.lo a/liba.la b/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -no-undefined -rpath /foo -o libcee.la c.lo a/liba.la b/liba.la" "duplicate_conv.at:74"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -no-undefined -rpath /foo -o libcee.la c.lo a/liba.la b/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_conv.at:74"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/duplicate_conv.at:76: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT ./libcee.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT ./libcee.la" "duplicate_conv.at:76"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT ./libcee.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_conv.at:76"
$at_failed && at_fn_log_failure
$at_traceon; }

lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/duplicate_conv.at:78: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "duplicate_conv.at:78"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_conv.at:78"
$at_failed && at_fn_log_failure
$at_traceon; }


$LIBTOOL --mode=clean rm -f libcee.la

{ set +x
$as_echo "$at_srcdir/duplicate_conv.at:81: test false = \"\$reload_cmds\" && exit 77"
at_fn_check_prepare_dynamic "test false = \"$reload_cmds\" && exit 77" "duplicate_conv.at:81"
( $at_check_trace; test false = "$reload_cmds" && exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/duplicate_conv.at:81"
$at_failed && at_fn_log_failure
$at_traceon; }


# Test whether this works with reloadable objects as well.
{ set +x
$as_echo "$at_srcdir/duplicate_conv.at:84: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS -o cee.\$OBJEXT c.lo a/liba.la b/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o cee.$OBJEXT c.lo a/liba.la b/liba.la" "duplicate_conv.at:84"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o cee.$OBJEXT c.lo a/liba.la b/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_conv.at:84"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/duplicate_conv.at:86: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT cee.\$OBJEXT"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT cee.$OBJEXT" "duplicate_conv.at:86"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT cee.$OBJEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_conv.at:86"
$at_failed && at_fn_log_failure
$at_traceon; }

lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/duplicate_conv.at:88: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "duplicate_conv.at:88"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_conv.at:88"
$at_failed && at_fn_log_failure
$at_traceon; }



# TODO: test dlpreloading of duplicates (when it is implemented)

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_58
#AT_START_59
at_fn_group_banner 59 'duplicate_deps.at:26' \
  "preserve duplicate convenience deps" "            " 7
at_xfail=yes
(
  $as_echo "59. $at_setup_line: testing $at_desc ..."
  $at_traceon



# --preserve-dup-deps should work for convenience archives.

# Create a circular dependency of liba and libb:
# a1 pulls in b1, that pulls in a2.
cat >a1.c <<\EOF
extern int b1 ();
int a1 () { return b1 (); }
EOF
cat >a2.c <<\EOF
int a2 () { return 0; }
EOF
cat >b1.c <<\EOF
extern int a2 ();
int b1 () { return a2 (); }
EOF
cat >main.c <<\EOF
extern int a1 ();
int main () { return a1 (); }
EOF

for file in a1.c a2.c b1.c; do
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file
done
$CC $CPPFLAGS $CFLAGS -c main.c
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o liba.la a1.lo a2.lo

# This could be worked around by adding liba.la to libb.la
# (in that case all objects from liba would be merged into
# libb.a as well, possibly renamed.)
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libb.la b1.lo liba.la
{ set +x
$as_echo "$at_srcdir/duplicate_deps.at:59: \$LIBTOOL --mode=link --tag=CC \\
	  \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT liba.la libb.la"
at_fn_check_prepare_notrace 'an embedded newline' "duplicate_deps.at:59"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC \
	  $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la libb.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_deps.at:59"
$at_failed && at_fn_log_failure
$at_traceon; }

lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/duplicate_deps.at:62: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "duplicate_deps.at:62"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_deps.at:62"
$at_failed && at_fn_log_failure
$at_traceon; }



# Forgo the workaround and create a true circular dependency.
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libb.la b1.lo
# Some systems find all symbols anyway; skip this test on such systems.
{ set +x
$as_echo "$at_srcdir/duplicate_deps.at:67: \$LIBTOOL --mode=link --tag=CC \\
	  \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT liba.la libb.la liba.la \\
	  && exit 77"
at_fn_check_prepare_notrace 'an embedded newline' "duplicate_deps.at:67"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC \
	  $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la libb.la liba.la \
	  && exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/duplicate_deps.at:67"
$at_failed && at_fn_log_failure
$at_traceon; }

# Other systems need special treatment, which currently fails.

{ set +x
$as_echo "$at_srcdir/duplicate_deps.at:73: \$LIBTOOL --mode=link --preserve-dup-deps --tag=CC \\
	  \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT liba.la libb.la liba.la"
at_fn_check_prepare_notrace 'an embedded newline' "duplicate_deps.at:73"
( $at_check_trace; $LIBTOOL --mode=link --preserve-dup-deps --tag=CC \
	  $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la libb.la liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/duplicate_deps.at:73"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_59
#AT_START_60
at_fn_group_banner 60 'flags.at:24' \
  "passing CC flags through libtool" "               " 7
at_xfail=no
(
  $as_echo "60. $at_setup_line: testing $at_desc ..."
  $at_traceon



{ set +x
$as_echo "$at_srcdir/flags.at:24: { test -n \"\$CC\" && test \"X\$CC\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$CC\" && test \"X$CC\" != Xno; } || (exit 77)" "flags.at:24"
( $at_check_trace; { test -n "$CC" && test "X$CC" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }




LDFLAGS="$LDFLAGS -no-undefined"
eval "`$LIBTOOL --config | $EGREP '^(FGREP)='`"

cat >a.c <<'_ATEOF'
int main () { return 0; }
_ATEOF

compile="$CC $CPPFLAGS $CFLAGS" link="$CC $CFLAGS $LDFLAGS" source=a.c


# Linker flags are not passed to the archiver, so don't test static libraries.
if $LIBTOOL --features | $GREP 'enable shared libraries'; then
  library_and_module='library.la "module.la -module -avoid-version"'
else
  library_and_module=
fi

eval "`$LIBTOOL --tag=CC --config | $EGREP '^(wl|archive_cmds)='`"

{ set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL --tag=CC --mode=compile \$compile -c \$source"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CC --mode=compile $compile -c $source" "flags.at:24"
( $at_check_trace; $LIBTOOL --tag=CC --mode=compile $compile -c $source
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }


# Linker flags are prefixed with $wl iff they are passed to the
# compiler driver, instead of directly to the linker.
case $archive_cmds in
*\$LD*\$linker_flags*) maybe_wl= compiler_flags_in_liblink=false ;;
*) maybe_wl=$wl compiler_flags_in_liblink=: ;;
esac

for flag in -Wc, -Wl, '-Xcompiler ' '-Xlinker '; do
  case $flag in
  -Wc, | -Xcompiler\ )
    { set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL -n --tag=CC --mode=compile \$compile 	     \$flag-foo -c \$source"
at_fn_check_prepare_dynamic "$LIBTOOL -n --tag=CC --mode=compile $compile 	     $flag-foo -c $source" "flags.at:24"
( $at_check_trace; $LIBTOOL -n --tag=CC --mode=compile $compile 	     $flag-foo -c $source
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" -foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" -foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " -foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    flag_prefix_prog=
    flag_prefix_lib=
    flags_in_liblink=$compiler_flags_in_liblink
    ;;
  -Wl, | -Xlinker\ )
    flag_prefix_prog=$wl
    flag_prefix_lib=$maybe_wl
    flags_in_liblink=:
    ;;
  esac

  { set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL -n --tag=CC --mode=link \$link 	   -o program\$EXEEXT a.lo \$flag-foo"
at_fn_check_prepare_dynamic "$LIBTOOL -n --tag=CC --mode=link $link 	   -o program$EXEEXT a.lo $flag-foo" "flags.at:24"
( $at_check_trace; $LIBTOOL -n --tag=CC --mode=link $link 	   -o program$EXEEXT a.lo $flag-foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" \$flag_prefix_prog-foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" $flag_prefix_prog-foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " $flag_prefix_prog-foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }


  eval set x "$library_and_module"
  for output
  do
    test x = "$output" && continue
    { set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL -n --tag=CC --mode=link \$link 	     -o \$output a.lo -rpath /nowhere \$flag-foo"
at_fn_check_prepare_dynamic "$LIBTOOL -n --tag=CC --mode=link $link 	     -o $output a.lo -rpath /nowhere $flag-foo" "flags.at:24"
( $at_check_trace; $LIBTOOL -n --tag=CC --mode=link $link 	     -o $output a.lo -rpath /nowhere $flag-foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    if $flags_in_liblink; then
      { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" \$flag_prefix_lib-foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" $flag_prefix_lib-foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " $flag_prefix_lib-foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    else
      { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" \$flag_prefix_lib-foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" $flag_prefix_lib-foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " $flag_prefix_lib-foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    fi
  done
done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_60
#AT_START_61
at_fn_group_banner 61 'flags.at:24' \
  "passing CXX flags through libtool" "              " 7
at_xfail=no
(
  $as_echo "61. $at_setup_line: testing $at_desc ..."
  $at_traceon



{ set +x
$as_echo "$at_srcdir/flags.at:24: { test -n \"\$CXX\" && test \"X\$CXX\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$CXX\" && test \"X$CXX\" != Xno; } || (exit 77)" "flags.at:24"
( $at_check_trace; { test -n "$CXX" && test "X$CXX" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/flags.at:24: test g++ != \"\$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)"
at_fn_check_prepare_dynamic "test g++ != \"$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)" "flags.at:24"
( $at_check_trace; test g++ != "$CXX" || (g++ -v >/dev/null 2>&1) || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }



LDFLAGS="$LDFLAGS -no-undefined"
eval "`$LIBTOOL --config | $EGREP '^(FGREP)='`"

cat >a.cpp <<'_ATEOF'
int main () { return 0; }
_ATEOF

compile="$CXX $CPPFLAGS $CXXFLAGS" link="$CXX $CXXFLAGS $LDFLAGS" source=a.cpp


# Linker flags are not passed to the archiver, so don't test static libraries.
if $LIBTOOL --features | $GREP 'enable shared libraries'; then
  library_and_module='library.la "module.la -module -avoid-version"'
else
  library_and_module=
fi

eval "`$LIBTOOL --tag=CXX --config | $EGREP '^(wl|archive_cmds)='`"

{ set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL --tag=CXX --mode=compile \$compile -c \$source"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=compile $compile -c $source" "flags.at:24"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=compile $compile -c $source
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }


# Linker flags are prefixed with $wl iff they are passed to the
# compiler driver, instead of directly to the linker.
case $archive_cmds in
*\$LD*\$linker_flags*) maybe_wl= compiler_flags_in_liblink=false ;;
*) maybe_wl=$wl compiler_flags_in_liblink=: ;;
esac

for flag in -Wc, -Wl, '-Xcompiler ' '-Xlinker '; do
  case $flag in
  -Wc, | -Xcompiler\ )
    { set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL -n --tag=CXX --mode=compile \$compile 	     \$flag-foo -c \$source"
at_fn_check_prepare_dynamic "$LIBTOOL -n --tag=CXX --mode=compile $compile 	     $flag-foo -c $source" "flags.at:24"
( $at_check_trace; $LIBTOOL -n --tag=CXX --mode=compile $compile 	     $flag-foo -c $source
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" -foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" -foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " -foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    flag_prefix_prog=
    flag_prefix_lib=
    flags_in_liblink=$compiler_flags_in_liblink
    ;;
  -Wl, | -Xlinker\ )
    flag_prefix_prog=$wl
    flag_prefix_lib=$maybe_wl
    flags_in_liblink=:
    ;;
  esac

  { set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL -n --tag=CXX --mode=link \$link 	   -o program\$EXEEXT a.lo \$flag-foo"
at_fn_check_prepare_dynamic "$LIBTOOL -n --tag=CXX --mode=link $link 	   -o program$EXEEXT a.lo $flag-foo" "flags.at:24"
( $at_check_trace; $LIBTOOL -n --tag=CXX --mode=link $link 	   -o program$EXEEXT a.lo $flag-foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" \$flag_prefix_prog-foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" $flag_prefix_prog-foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " $flag_prefix_prog-foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }


  eval set x "$library_and_module"
  for output
  do
    test x = "$output" && continue
    { set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL -n --tag=CXX --mode=link \$link 	     -o \$output a.lo -rpath /nowhere \$flag-foo"
at_fn_check_prepare_dynamic "$LIBTOOL -n --tag=CXX --mode=link $link 	     -o $output a.lo -rpath /nowhere $flag-foo" "flags.at:24"
( $at_check_trace; $LIBTOOL -n --tag=CXX --mode=link $link 	     -o $output a.lo -rpath /nowhere $flag-foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    if $flags_in_liblink; then
      { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" \$flag_prefix_lib-foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" $flag_prefix_lib-foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " $flag_prefix_lib-foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    else
      { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" \$flag_prefix_lib-foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" $flag_prefix_lib-foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " $flag_prefix_lib-foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    fi
  done
done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_61
#AT_START_62
at_fn_group_banner 62 'flags.at:24' \
  "passing F77 flags through libtool" "              " 7
at_xfail=no
(
  $as_echo "62. $at_setup_line: testing $at_desc ..."
  $at_traceon



{ set +x
$as_echo "$at_srcdir/flags.at:24: { test -n \"\$F77\" && test \"X\$F77\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$F77\" && test \"X$F77\" != Xno; } || (exit 77)" "flags.at:24"
( $at_check_trace; { test -n "$F77" && test "X$F77" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }




LDFLAGS="$LDFLAGS -no-undefined"
eval "`$LIBTOOL --config | $EGREP '^(FGREP)='`"

cat >a.f <<'_ATEOF'
      program main
      end
_ATEOF

compile="$F77 $FFLAGS" link="$F77 $FFLAGS $LDFLAGS" source=a.f


# Linker flags are not passed to the archiver, so don't test static libraries.
if $LIBTOOL --features | $GREP 'enable shared libraries'; then
  library_and_module='library.la "module.la -module -avoid-version"'
else
  library_and_module=
fi

eval "`$LIBTOOL --tag=F77 --config | $EGREP '^(wl|archive_cmds)='`"

{ set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL --tag=F77 --mode=compile \$compile -c \$source"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=F77 --mode=compile $compile -c $source" "flags.at:24"
( $at_check_trace; $LIBTOOL --tag=F77 --mode=compile $compile -c $source
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }


# Linker flags are prefixed with $wl iff they are passed to the
# compiler driver, instead of directly to the linker.
case $archive_cmds in
*\$LD*\$linker_flags*) maybe_wl= compiler_flags_in_liblink=false ;;
*) maybe_wl=$wl compiler_flags_in_liblink=: ;;
esac

for flag in -Wc, -Wl, '-Xcompiler ' '-Xlinker '; do
  case $flag in
  -Wc, | -Xcompiler\ )
    { set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL -n --tag=F77 --mode=compile \$compile 	     \$flag-foo -c \$source"
at_fn_check_prepare_dynamic "$LIBTOOL -n --tag=F77 --mode=compile $compile 	     $flag-foo -c $source" "flags.at:24"
( $at_check_trace; $LIBTOOL -n --tag=F77 --mode=compile $compile 	     $flag-foo -c $source
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" -foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" -foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " -foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    flag_prefix_prog=
    flag_prefix_lib=
    flags_in_liblink=$compiler_flags_in_liblink
    ;;
  -Wl, | -Xlinker\ )
    flag_prefix_prog=$wl
    flag_prefix_lib=$maybe_wl
    flags_in_liblink=:
    ;;
  esac

  { set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL -n --tag=F77 --mode=link \$link 	   -o program\$EXEEXT a.lo \$flag-foo"
at_fn_check_prepare_dynamic "$LIBTOOL -n --tag=F77 --mode=link $link 	   -o program$EXEEXT a.lo $flag-foo" "flags.at:24"
( $at_check_trace; $LIBTOOL -n --tag=F77 --mode=link $link 	   -o program$EXEEXT a.lo $flag-foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" \$flag_prefix_prog-foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" $flag_prefix_prog-foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " $flag_prefix_prog-foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }


  eval set x "$library_and_module"
  for output
  do
    test x = "$output" && continue
    { set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL -n --tag=F77 --mode=link \$link 	     -o \$output a.lo -rpath /nowhere \$flag-foo"
at_fn_check_prepare_dynamic "$LIBTOOL -n --tag=F77 --mode=link $link 	     -o $output a.lo -rpath /nowhere $flag-foo" "flags.at:24"
( $at_check_trace; $LIBTOOL -n --tag=F77 --mode=link $link 	     -o $output a.lo -rpath /nowhere $flag-foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    if $flags_in_liblink; then
      { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" \$flag_prefix_lib-foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" $flag_prefix_lib-foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " $flag_prefix_lib-foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    else
      { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" \$flag_prefix_lib-foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" $flag_prefix_lib-foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " $flag_prefix_lib-foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    fi
  done
done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_62
#AT_START_63
at_fn_group_banner 63 'flags.at:24' \
  "passing FC flags through libtool" "               " 7
at_xfail=no
(
  $as_echo "63. $at_setup_line: testing $at_desc ..."
  $at_traceon



{ set +x
$as_echo "$at_srcdir/flags.at:24: { test -n \"\$FC\" && test \"X\$FC\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$FC\" && test \"X$FC\" != Xno; } || (exit 77)" "flags.at:24"
( $at_check_trace; { test -n "$FC" && test "X$FC" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

# Autoconf will accept f77 or similar as a valid FC, but often f77
   # will not compile fortran90 code; in that case skip the FC checks.
   cat >fc_test.f90 <<'_ATEOF'
	program main

	end
_ATEOF

   { set +x
$as_echo "$at_srcdir/flags.at:24: \$FC \$FCFLAGS fc_test.f90 || exit 77"
at_fn_check_prepare_dynamic "$FC $FCFLAGS fc_test.f90 || exit 77" "flags.at:24"
( $at_check_trace; $FC $FCFLAGS fc_test.f90 || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }



LDFLAGS="$LDFLAGS -no-undefined"
eval "`$LIBTOOL --config | $EGREP '^(FGREP)='`"

cat >a.f90 <<'_ATEOF'
      program main
      end
_ATEOF

compile="$FC $FCFLAGS" link="$FC $FCFLAGS $LDFLAGS" source=a.f90


# Linker flags are not passed to the archiver, so don't test static libraries.
if $LIBTOOL --features | $GREP 'enable shared libraries'; then
  library_and_module='library.la "module.la -module -avoid-version"'
else
  library_and_module=
fi

eval "`$LIBTOOL --tag=FC --config | $EGREP '^(wl|archive_cmds)='`"

{ set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL --tag=FC --mode=compile \$compile -c \$source"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=FC --mode=compile $compile -c $source" "flags.at:24"
( $at_check_trace; $LIBTOOL --tag=FC --mode=compile $compile -c $source
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }


# Linker flags are prefixed with $wl iff they are passed to the
# compiler driver, instead of directly to the linker.
case $archive_cmds in
*\$LD*\$linker_flags*) maybe_wl= compiler_flags_in_liblink=false ;;
*) maybe_wl=$wl compiler_flags_in_liblink=: ;;
esac

for flag in -Wc, -Wl, '-Xcompiler ' '-Xlinker '; do
  case $flag in
  -Wc, | -Xcompiler\ )
    { set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL -n --tag=FC --mode=compile \$compile 	     \$flag-foo -c \$source"
at_fn_check_prepare_dynamic "$LIBTOOL -n --tag=FC --mode=compile $compile 	     $flag-foo -c $source" "flags.at:24"
( $at_check_trace; $LIBTOOL -n --tag=FC --mode=compile $compile 	     $flag-foo -c $source
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" -foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" -foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " -foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    flag_prefix_prog=
    flag_prefix_lib=
    flags_in_liblink=$compiler_flags_in_liblink
    ;;
  -Wl, | -Xlinker\ )
    flag_prefix_prog=$wl
    flag_prefix_lib=$maybe_wl
    flags_in_liblink=:
    ;;
  esac

  { set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL -n --tag=FC --mode=link \$link 	   -o program\$EXEEXT a.lo \$flag-foo"
at_fn_check_prepare_dynamic "$LIBTOOL -n --tag=FC --mode=link $link 	   -o program$EXEEXT a.lo $flag-foo" "flags.at:24"
( $at_check_trace; $LIBTOOL -n --tag=FC --mode=link $link 	   -o program$EXEEXT a.lo $flag-foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" \$flag_prefix_prog-foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" $flag_prefix_prog-foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " $flag_prefix_prog-foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }


  eval set x "$library_and_module"
  for output
  do
    test x = "$output" && continue
    { set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL -n --tag=FC --mode=link \$link 	     -o \$output a.lo -rpath /nowhere \$flag-foo"
at_fn_check_prepare_dynamic "$LIBTOOL -n --tag=FC --mode=link $link 	     -o $output a.lo -rpath /nowhere $flag-foo" "flags.at:24"
( $at_check_trace; $LIBTOOL -n --tag=FC --mode=link $link 	     -o $output a.lo -rpath /nowhere $flag-foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    if $flags_in_liblink; then
      { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" \$flag_prefix_lib-foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" $flag_prefix_lib-foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " $flag_prefix_lib-foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    else
      { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" \$flag_prefix_lib-foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" $flag_prefix_lib-foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " $flag_prefix_lib-foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    fi
  done
done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_63
#AT_START_64
at_fn_group_banner 64 'flags.at:24' \
  "passing GCJ flags through libtool" "              " 7
at_xfail=no
(
  $as_echo "64. $at_setup_line: testing $at_desc ..."
  $at_traceon



{ set +x
$as_echo "$at_srcdir/flags.at:24: { test -n \"\$GCJ\" && test \"X\$GCJ\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$GCJ\" && test \"X$GCJ\" != Xno; } || (exit 77)" "flags.at:24"
( $at_check_trace; { test -n "$GCJ" && test "X$GCJ" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

# There are just too many broken gcj installations out there, either missing
   # libgcj.spec or unable to find it.  Skip the test for them.
   cat >gcj_test.java <<'_ATEOF'
public class gcj_test {
    public static void main(String[] argv) { }
  }
_ATEOF

   { set +x
$as_echo "$at_srcdir/flags.at:24: \$GCJ \$GCJFLAGS -c gcj_test.java || exit 77"
at_fn_check_prepare_dynamic "$GCJ $GCJFLAGS -c gcj_test.java || exit 77" "flags.at:24"
( $at_check_trace; $GCJ $GCJFLAGS -c gcj_test.java || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }



LDFLAGS="$LDFLAGS -no-undefined"
eval "`$LIBTOOL --config | $EGREP '^(FGREP)='`"

cat >a.java <<'_ATEOF'
class a {}
_ATEOF

compile="$GCJ $GCJFLAGS" link="$GCJ $GCJFLAGS $LDFLAGS" source=a.java


# Linker flags are not passed to the archiver, so don't test static libraries.
if $LIBTOOL --features | $GREP 'enable shared libraries'; then
  library_and_module='library.la "module.la -module -avoid-version"'
else
  library_and_module=
fi

eval "`$LIBTOOL --tag=GCJ --config | $EGREP '^(wl|archive_cmds)='`"

{ set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL --tag=GCJ --mode=compile \$compile -c \$source"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=GCJ --mode=compile $compile -c $source" "flags.at:24"
( $at_check_trace; $LIBTOOL --tag=GCJ --mode=compile $compile -c $source
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }


# Linker flags are prefixed with $wl iff they are passed to the
# compiler driver, instead of directly to the linker.
case $archive_cmds in
*\$LD*\$linker_flags*) maybe_wl= compiler_flags_in_liblink=false ;;
*) maybe_wl=$wl compiler_flags_in_liblink=: ;;
esac

for flag in -Wc, -Wl, '-Xcompiler ' '-Xlinker '; do
  case $flag in
  -Wc, | -Xcompiler\ )
    { set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL -n --tag=GCJ --mode=compile \$compile 	     \$flag-foo -c \$source"
at_fn_check_prepare_dynamic "$LIBTOOL -n --tag=GCJ --mode=compile $compile 	     $flag-foo -c $source" "flags.at:24"
( $at_check_trace; $LIBTOOL -n --tag=GCJ --mode=compile $compile 	     $flag-foo -c $source
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" -foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" -foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " -foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    flag_prefix_prog=
    flag_prefix_lib=
    flags_in_liblink=$compiler_flags_in_liblink
    ;;
  -Wl, | -Xlinker\ )
    flag_prefix_prog=$wl
    flag_prefix_lib=$maybe_wl
    flags_in_liblink=:
    ;;
  esac

  { set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL -n --tag=GCJ --mode=link \$link 	   -o program\$EXEEXT a.lo \$flag-foo"
at_fn_check_prepare_dynamic "$LIBTOOL -n --tag=GCJ --mode=link $link 	   -o program$EXEEXT a.lo $flag-foo" "flags.at:24"
( $at_check_trace; $LIBTOOL -n --tag=GCJ --mode=link $link 	   -o program$EXEEXT a.lo $flag-foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" \$flag_prefix_prog-foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" $flag_prefix_prog-foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " $flag_prefix_prog-foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }


  eval set x "$library_and_module"
  for output
  do
    test x = "$output" && continue
    { set +x
$as_echo "$at_srcdir/flags.at:24: \$LIBTOOL -n --tag=GCJ --mode=link \$link 	     -o \$output a.lo -rpath /nowhere \$flag-foo"
at_fn_check_prepare_dynamic "$LIBTOOL -n --tag=GCJ --mode=link $link 	     -o $output a.lo -rpath /nowhere $flag-foo" "flags.at:24"
( $at_check_trace; $LIBTOOL -n --tag=GCJ --mode=link $link 	     -o $output a.lo -rpath /nowhere $flag-foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    if $flags_in_liblink; then
      { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" \$flag_prefix_lib-foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" $flag_prefix_lib-foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " $flag_prefix_lib-foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    else
      { set +x
$as_echo "$at_srcdir/flags.at:24: \$FGREP \" \$flag_prefix_lib-foo\" stdout"
at_fn_check_prepare_dynamic "$FGREP \" $flag_prefix_lib-foo\" stdout" "flags.at:24"
( $at_check_trace; $FGREP " $flag_prefix_lib-foo" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/flags.at:24"
$at_failed && at_fn_log_failure
$at_traceon; }

    fi
  done
done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_64
#AT_START_65
at_fn_group_banner 65 'inherited_flags.at:27' \
  "inherited_linker_flags" "                         " 7
at_xfail=no
(
  $as_echo "65. $at_setup_line: testing $at_desc ..."
  $at_traceon



cat >foo.c <<'_ATEOF'

int foo() { return 1;}
_ATEOF


cat >bar.c <<'_ATEOF'

int bar() { return 1;}
_ATEOF


cat >baz.c <<'_ATEOF'

int baz() { return 1;}
_ATEOF


cat >both.c <<'_ATEOF'

int both() { return 1;}
_ATEOF


cat >main.c <<'_ATEOF'

int main() { return 0;}
_ATEOF


$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o foo.lo foo.c
$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o bar.lo bar.c
$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o baz.lo baz.c
$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o both.lo both.c
$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o main.lo main.c
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libfoo.la foo.lo -rpath /nonexistent -no-undefined
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbar.la bar.lo -rpath /nonexistent -no-undefined
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libboth.la both.lo -rpath /nonexistent -no-undefined


mv libfoo.la libfoo.la.bak
$SED -e 's/^inherited_linker_flags.*/inherited_linker_flags=-llt_inlikely_existing_lib/g' < libfoo.la.bak > libfoo.la
rm libfoo.la.bak

mv libbar.la libbar.la.bak
$SED -e 's/^inherited_linker_flags.*/inherited_linker_flags=-llt_unlikely_existing_lib/g' < libbar.la.bak > libbar.la
rm libbar.la.bak

mv libboth.la libboth.la.bak
$SED -e "s/^inherited_linker_flags.*/inherited_linker_flags='-llt_inlikely_existing_lib -llt_unlikely_existing_lib'/g" < libboth.la.bak > libboth.la
rm libboth.la.bak

{ set +x
$as_echo "$at_srcdir/inherited_flags.at:77: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS -o libbaz.la baz.lo -no-undefined -rpath /nonexistent ./libfoo.la ./libbar.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbaz.la baz.lo -no-undefined -rpath /nonexistent ./libfoo.la ./libbar.la" "inherited_flags.at:77"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbaz.la baz.lo -no-undefined -rpath /nonexistent ./libfoo.la ./libbar.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_skip $at_status "$at_srcdir/inherited_flags.at:77"
$at_failed && at_fn_log_failure
$at_traceon; }

# We used to grep for
# 'llt_[[ui]]nlikely_existing_lib.*llt_[[ui]]nlikely_existing_lib'
# here.  This fails on win32/MSVC because the generated command lines have a
# different syntax.  So drop the first 'l'.
{ set +x
$as_echo "$at_srcdir/inherited_flags.at:83: \$LIBTOOL --features | \$GREP 'disable shared libraries' && (exit 77)"
at_fn_check_prepare_notrace 'a shell pipeline' "inherited_flags.at:83"
( $at_check_trace; $LIBTOOL --features | $GREP 'disable shared libraries' && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/inherited_flags.at:83"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/inherited_flags.at:84: \$GREP 'lt_[ui]nlikely_existing_lib.*lt_[ui]nlikely_existing_lib' stdout"
at_fn_check_prepare_dynamic "$GREP 'lt_[ui]nlikely_existing_lib.*lt_[ui]nlikely_existing_lib' stdout" "inherited_flags.at:84"
( $at_check_trace; $GREP 'lt_[ui]nlikely_existing_lib.*lt_[ui]nlikely_existing_lib' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/inherited_flags.at:84"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/inherited_flags.at:86: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.lo -no-undefined -rpath /nonexistent  ./libfoo.la ./libbar.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.lo -no-undefined -rpath /nonexistent  ./libfoo.la ./libbar.la" "inherited_flags.at:86"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.lo -no-undefined -rpath /nonexistent  ./libfoo.la ./libbar.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_skip $at_status "$at_srcdir/inherited_flags.at:86"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/inherited_flags.at:88: \$GREP 'lt_[ui]nlikely_existing_lib.*lt_[ui]nlikely_existing_lib' stdout"
at_fn_check_prepare_dynamic "$GREP 'lt_[ui]nlikely_existing_lib.*lt_[ui]nlikely_existing_lib' stdout" "inherited_flags.at:88"
( $at_check_trace; $GREP 'lt_[ui]nlikely_existing_lib.*lt_[ui]nlikely_existing_lib' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/inherited_flags.at:88"
$at_failed && at_fn_log_failure
$at_traceon; }


# now check for duplicates
{ set +x
$as_echo "$at_srcdir/inherited_flags.at:92: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS -o libbaz.la baz.lo -no-undefined -rpath /nonexistent ./libfoo.la ./libbar.la ./libboth.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbaz.la baz.lo -no-undefined -rpath /nonexistent ./libfoo.la ./libbar.la ./libboth.la" "inherited_flags.at:92"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbaz.la baz.lo -no-undefined -rpath /nonexistent ./libfoo.la ./libbar.la ./libboth.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_skip $at_status "$at_srcdir/inherited_flags.at:92"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/inherited_flags.at:94: \$GREP 'lt_inlikely_existing_lib.*lt_inlikely_existing_lib' stdout"
at_fn_check_prepare_dynamic "$GREP 'lt_inlikely_existing_lib.*lt_inlikely_existing_lib' stdout" "inherited_flags.at:94"
( $at_check_trace; $GREP 'lt_inlikely_existing_lib.*lt_inlikely_existing_lib' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/inherited_flags.at:94"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/inherited_flags.at:96: \$GREP 'lt_unlikely_existing_lib.*lt_unlikely_existing_lib' stdout"
at_fn_check_prepare_dynamic "$GREP 'lt_unlikely_existing_lib.*lt_unlikely_existing_lib' stdout" "inherited_flags.at:96"
( $at_check_trace; $GREP 'lt_unlikely_existing_lib.*lt_unlikely_existing_lib' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/inherited_flags.at:96"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/inherited_flags.at:98: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.lo -no-undefined -rpath /nonexistent  ./libfoo.la ./libbar.la ./libboth.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.lo -no-undefined -rpath /nonexistent  ./libfoo.la ./libbar.la ./libboth.la" "inherited_flags.at:98"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.lo -no-undefined -rpath /nonexistent  ./libfoo.la ./libbar.la ./libboth.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_skip $at_status "$at_srcdir/inherited_flags.at:98"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/inherited_flags.at:100: \$GREP 'lt_inlikely_existing_lib.*lt_inlikely_existing_lib' stdout"
at_fn_check_prepare_dynamic "$GREP 'lt_inlikely_existing_lib.*lt_inlikely_existing_lib' stdout" "inherited_flags.at:100"
( $at_check_trace; $GREP 'lt_inlikely_existing_lib.*lt_inlikely_existing_lib' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/inherited_flags.at:100"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/inherited_flags.at:102: \$GREP 'lt_unlikely_existing_lib.*lt_unlikely_existing_lib' stdout"
at_fn_check_prepare_dynamic "$GREP 'lt_unlikely_existing_lib.*lt_unlikely_existing_lib' stdout" "inherited_flags.at:102"
( $at_check_trace; $GREP 'lt_unlikely_existing_lib.*lt_unlikely_existing_lib' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/inherited_flags.at:102"
$at_failed && at_fn_log_failure
$at_traceon; }


mv libboth.la libboth.la.bak
$SED "s/^inherited_linker_flags.*/inherited_linker_flags='-framework Cocoa -framework ApplicationServices'/" < libboth.la.bak > libboth.la
rm libboth.la.bak

{ set +x
$as_echo "$at_srcdir/inherited_flags.at:109: \$LIBTOOL -n --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS -framework Cocoa -framework ApplicationServices -o libbaz.la baz.lo libboth.la -no-undefined -rpath /nonexistent"
at_fn_check_prepare_dynamic "$LIBTOOL -n --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -framework Cocoa -framework ApplicationServices -o libbaz.la baz.lo libboth.la -no-undefined -rpath /nonexistent" "inherited_flags.at:109"
( $at_check_trace; $LIBTOOL -n --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -framework Cocoa -framework ApplicationServices -o libbaz.la baz.lo libboth.la -no-undefined -rpath /nonexistent
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/inherited_flags.at:109"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/inherited_flags.at:111: \$GREP Cocoa.ltframework stdout"
at_fn_check_prepare_dynamic "$GREP Cocoa.ltframework stdout" "inherited_flags.at:111"
( $at_check_trace; $GREP Cocoa.ltframework stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/inherited_flags.at:111"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/inherited_flags.at:112: \$GREP ' -framework Cocoa' stdout"
at_fn_check_prepare_dynamic "$GREP ' -framework Cocoa' stdout" "inherited_flags.at:112"
( $at_check_trace; $GREP ' -framework Cocoa' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/inherited_flags.at:112"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_65
#AT_START_66
at_fn_group_banner 66 'link-order.at:27' \
  "Link order test" "                                " 7
at_xfail=no
(
  $as_echo "66. $at_setup_line: testing $at_desc ..."
  $at_traceon


eval `$LIBTOOL --config | $EGREP '^(hardcode_direct|hardcode_direct_absolute|shrext_cmds)='`
LDFLAGS="$LDFLAGS -no-undefined"

module=no
eval shared_ext=\"$shrext_cmds\"

prefix_old=`pwd`/old
prefix_new=`pwd`/new
mkdir src $prefix_old $prefix_new $prefix_old/lib $prefix_new/lib

cat >src/c.c <<'_ATEOF'
int c = 1;
_ATEOF


$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c src/c.c -o src/c.lo
$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/libcee.la src/c.lo -rpath $prefix_old/lib
$LIBTOOL --mode=install cp src/libcee.la $prefix_old/lib/libcee.la

for i in old new; do
  rm -rf src
  mkdir src

  cat >src/a_$i.c <<EOF
/* w32 fun, MSVC needs to dllimport when using a shared library, so use
 * DLL_EXPORT to discriminate as that happens to coinside in this case.
 * gnu has auto import.
 */
#if defined _MSC_VER && defined DLL_EXPORT
#  define LIBCEE_SCOPE __declspec(dllimport)
#else
#  define LIBCEE_SCOPE extern
#endif
LIBCEE_SCOPE int c;
extern int b_$i();
int a_$i() { return c + b_$i(); }
EOF

  cat >src/b_$i.c <<EOF
/* w32 fun, MSVC needs to dllimport when using a shared library, so use
 * DLL_EXPORT to discriminate as that happens to coinside in this case.
 * gnu has auto import.
 */
#if defined _MSC_VER && defined DLL_EXPORT
#  define LIBCEE_SCOPE __declspec(dllimport)
#else
#  define LIBCEE_SCOPE extern
#endif
LIBCEE_SCOPE int c;
int b_$i() { return 1 + c; }
EOF

  prefix=`eval echo \\$prefix_$i`
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c src/a_$i.c -o src/a.lo
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c src/b_$i.c -o src/b.lo
  $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/libb.la src/b.lo \
      -L$prefix_old/lib -lcee -rpath $prefix/lib
  $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/liba.la src/a.lo \
      src/libb.la -L$prefix_old/lib -lcee -rpath $prefix/lib
  $LIBTOOL --mode=install cp src/libb.la $prefix/lib/libb.la
  { set +x
$as_echo "$at_srcdir/link-order.at:88: \$LIBTOOL --mode=install cp src/liba.la \$prefix/lib/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp src/liba.la $prefix/lib/liba.la" "link-order.at:88"
( $at_check_trace; $LIBTOOL --mode=install cp src/liba.la $prefix/lib/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/link-order.at:88"
$at_failed && at_fn_log_failure
$at_traceon; }

done

$LIBTOOL --mode=clean rm -f src/libb.la
$LIBTOOL --mode=clean rm -f src/liba.la

case $host_os in
aix* | interix*) ;;  # These systems have different path syntax
*)
  # Do not error if we do not relink (e.g. static-only systems)
  case $hardcode_direct$hardcode_direct_absolute in
  yesno)
    { set +x
$as_echo "$at_srcdir/link-order.at:101: if \$EGREP relinking stderr; then
         \$EGREP \" .*\\/new\\/lib/libb\$shared_ext .*\\/old\\/lib/libcee\$shared_ext\" stdout
       else :; fi"
at_fn_check_prepare_notrace 'an embedded newline' "link-order.at:101"
( $at_check_trace; if $EGREP relinking stderr; then
         $EGREP " .*\/new\/lib/libb$shared_ext .*\/old\/lib/libcee$shared_ext" stdout
       else :; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/link-order.at:101"
if $at_failed; then :
  echo "wrong link order"
fi
$at_failed && at_fn_log_failure
$at_traceon; }

    ;;
  *)
    { set +x
$as_echo "$at_srcdir/link-order.at:106: if \$EGREP relinking stderr; then
         \$EGREP \" -L.*\\/new\\/lib -lb -L.*\\/old\\/lib -lcee\" stdout
       else :; fi"
at_fn_check_prepare_notrace 'an embedded newline' "link-order.at:106"
( $at_check_trace; if $EGREP relinking stderr; then
         $EGREP " -L.*\/new\/lib -lb -L.*\/old\/lib -lcee" stdout
       else :; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/link-order.at:106"
if $at_failed; then :
  echo "wrong link order"
fi
$at_failed && at_fn_log_failure
$at_traceon; }

    ;;
  esac
  ;;
esac

for i in old new; do
  cat >src/main_$i.c <<EOF
extern int a_$i();
int main(void) { return a_$i() != 3; }
EOF

  prefix=`eval echo \\$prefix_$i`
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c src/main_$i.c -o src/main_$i.lo
  { set +x
$as_echo "$at_srcdir/link-order.at:122: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o src/main_\$i\$EXEEXT src/main_\$i.lo -L\$prefix/lib -la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/main_$i$EXEEXT src/main_$i.lo -L$prefix/lib -la" "link-order.at:122"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/main_$i$EXEEXT src/main_$i.lo -L$prefix/lib -la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/link-order.at:122"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=src/main_$i; if test -f "src/main_$i$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/link-order.at:124: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "link-order.at:124"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/link-order.at:124"
$at_failed && at_fn_log_failure
$at_traceon; }


done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_66
#AT_START_67
at_fn_group_banner 67 'link-order2.at:47' \
  "Link order of deplibs" "                          " 7
at_xfail=no
(
  $as_echo "67. $at_setup_line: testing $at_desc ..."
  $at_traceon



eval `$LIBTOOL --config | $EGREP '^(shlibpath_var|allow_undefined_flag)='`

undefined_setting=-no-undefined
shared_fails=no
case $host_os,$LDFLAGS,$allow_undefined_flag in
aix*,*-brtl*,*) ;;
aix*) shared_fails=yes ;;
darwin*,*,*-flat_namespace*) undefined_setting= ;;
darwin*,*,*) shared_fails=yes ;;
esac

deflibdir=`pwd`/lib
defbindir=`pwd`/lib
libdir=`pwd`/inst/lib
bindir=`pwd`/inst/bin
mkdir bin lib inst inst/bin inst/lib
LDFLAGS="$LDFLAGS $undefined_setting -L$deflibdir"

cat >a0.c <<\EOF
int a (void) { return 1; }
EOF

cat >a1.c <<\EOF
int a (void) { return 0; }
EOF

cat >b.c <<\EOF
int a (void);
int b (void) { return a (); }
EOF

cat >main.c <<\EOF
#include <stdlib.h>
extern int a (void);
extern int b (void);
int main (void)
{
  return !(a () + b () == 0);
}
EOF

for file in a0 a1 b; do
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file.c
done
$CC $CPPFLAGS $CFLAGS -c main.c

# Build an old, installed library.
$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o liba0.la a0.lo -rpath $deflibdir
$LIBTOOL --mode=install cp liba0.la $deflibdir/liba0.la
$LIBTOOL --mode=clean rm -f liba0.la

for type_of_depdepl in libtool non-libtool; do
  echo "type of depdepl: $type_of_depdepl"
  if test non-libtool = "$type_of_depdepl"; then
    # Simulate a non-Libtool system library.
    rm $deflibdir/liba1.la
    addpath=$deflibdir
    if test PATH = "$shlibpath_var"; then
      addpath=$defbindir
    fi
    sep=
    eval test -n \"\$$shlibpath_var\" && sep=:
    eval $shlibpath_var='$addpath$sep$'$shlibpath_var
    export $shlibpath_var
  fi
  for static in '' -static-libtool-libs; do
    case `$LIBTOOL --features` in
    *disable\ static\ libraries*) test -z "$static" || continue;;
    esac
    test non-libtool,-static-libtool-libs = "$type_of_depdepl,$static" &&
       static=-all-static
    $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o liba1.la a1.lo -rpath $libdir
    $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o libb.la b.lo liba1.la -rpath $libdir
    { set +x
$as_echo "$at_srcdir/link-order2.at:124: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS \$static -o main\$EXEEXT main.\$OBJEXT libb.la -la0"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o main$EXEEXT main.$OBJEXT libb.la -la0" "link-order2.at:124"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o main$EXEEXT main.$OBJEXT libb.la -la0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/link-order2.at:124"
$at_failed && at_fn_log_failure
$at_traceon; }

    lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/link-order2.at:126: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "link-order2.at:126"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/link-order2.at:126"
$at_failed && at_fn_log_failure
$at_traceon; }


    # Now test that if we reverse the link order, the program fails.
    { set +x
$as_echo "$at_srcdir/link-order2.at:128: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS \$static -o wrong\$EXEEXT main.\$OBJEXT -la0 libb.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o wrong$EXEEXT main.$OBJEXT -la0 libb.la" "link-order2.at:128"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o wrong$EXEEXT main.$OBJEXT -la0 libb.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/link-order2.at:128"
$at_failed && at_fn_log_failure
$at_traceon; }

    if test yes, != "$shared_fails,$static"; then
      lt_exe=./wrong; if test -f "./wrong$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/link-order2.at:131: if \"\$lt_exe\" || (exit 1); then :; else lt_status=\$?; 	   test \"\$lt_status\" != 1 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" || (exit 1); then :; else lt_status=$?; 	   test \"$lt_status\" != 1 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "link-order2.at:131"
( $at_check_trace; if "$lt_exe" || (exit 1); then :; else lt_status=$?; 	   test "$lt_status" != 1 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/link-order2.at:131"
$at_failed && at_fn_log_failure
$at_traceon; }


    fi

    $LIBTOOL --mode=install cp liba1.la $libdir/liba1.la
    $LIBTOOL --mode=install cp libb.la $libdir/libb.la
    $LIBTOOL --mode=install cp main$EXEEXT $bindir/main$EXEEXT
    $LIBTOOL --mode=install cp wrong$EXEEXT $bindir/wrong$EXEEXT
    $LIBTOOL --mode=clean rm -f liba1.la libb.la
    lt_exe=$bindir/main; if test -f "$bindir/main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/link-order2.at:139: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "link-order2.at:139"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/link-order2.at:139"
$at_failed && at_fn_log_failure
$at_traceon; }


    if test yes, = "$shared_fails,$static"; then
      lt_exe=$bindir/wrong; if test -f "$bindir/wrong$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/link-order2.at:141: if \"\$lt_exe\" || (exit 1); then :; else lt_status=\$?; 	   test \"\$lt_status\" != 1 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" || (exit 1); then :; else lt_status=$?; 	   test \"$lt_status\" != 1 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "link-order2.at:141"
( $at_check_trace; if "$lt_exe" || (exit 1); then :; else lt_status=$?; 	   test "$lt_status" != 1 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/link-order2.at:141"
$at_failed && at_fn_log_failure
$at_traceon; }


    fi
  done
done

{ set +x
$as_echo "$at_srcdir/link-order2.at:146: test no = \"\$shared_fails\" || (exit 77)"
at_fn_check_prepare_dynamic "test no = \"$shared_fails\" || (exit 77)" "link-order2.at:146"
( $at_check_trace; test no = "$shared_fails" || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/link-order2.at:146"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now the converse: if both the program and the library need libm, then
# it needs to be sorted last.  (TODO)

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_67
#AT_START_68
at_fn_group_banner 68 'fail.at:28' \
  "Failure tests" "                                  " 7
at_xfail=no
(
  $as_echo "68. $at_setup_line: testing $at_desc ..."
  $at_traceon


eval `$LIBTOOL --config | $EGREP '^(pic_mode|pic_flag|build_old_libs|build_libtool_libs)='`
LDFLAGS="$LDFLAGS -no-undefined"



cat >script <<'_ATEOF'
#! /bin/sh
exit 0
_ATEOF

chmod +x script
if test -x script >/dev/null 2>&1; then
  test_x="test -x"
else
  test_x=:
fi

# compile failure
echo 'choke me' > a.c
{ set +x
$as_echo "$at_srcdir/fail.at:50: if \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c a.c; then (exit 1); else :; fi"
at_fn_check_prepare_dynamic "if $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c; then (exit 1); else :; fi" "fail.at:50"
( $at_check_trace; if $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c; then (exit 1); else :; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fail.at:50"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/fail.at:51: test -f a.lo"
at_fn_check_prepare_trace "fail.at:51"
( $at_check_trace; test -f a.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/fail.at:51"
$at_failed && at_fn_log_failure
$at_traceon; }


# non-PIC compile failure
case $pic_mode in default | no)
  case " $CFLAGS " in
   *\ -prefer-pic\ *) ;;
   *)
    case $build_old_libs,$pic_flag in yes,*-DPIC*)
      cat >a.c <<'_ATEOF'

#ifndef PIC
  choke me
#endif
_ATEOF

      { set +x
$as_echo "$at_srcdir/fail.at:64: if \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -no-suppress -c a.c; then (exit 1); else :; fi"
at_fn_check_prepare_dynamic "if $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -no-suppress -c a.c; then (exit 1); else :; fi" "fail.at:64"
( $at_check_trace; if $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -no-suppress -c a.c; then (exit 1); else :; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fail.at:64"
$at_failed && at_fn_log_failure
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/fail.at:65: test -f a.lo"
at_fn_check_prepare_trace "fail.at:65"
( $at_check_trace; test -f a.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/fail.at:65"
$at_failed && at_fn_log_failure
$at_traceon; }

      ;;
    esac
    ;;
  esac
  ;;
esac

# program creation failure.
# We can't rely on 'main' not being present: the QNX linker
# won't error out in that case, although the resulting binary won't work.
# So we provoke a link failure due to an unresolved symbol, and require
# libtool to fail only if the link without libtool would have failed, too.
cat > a.c <<'EOF'
extern int nonexistent_function (void);
int main (void)
{
  return nonexistent_function ();
}
EOF
$CC $CPPFLAGS $CFLAGS -c a.c
if $CC $CFLAGS $LDFLAGS -o a$EXEEXT a.$OBJEXT; then :; else
  rm -f a a$EXEEXT
  { set +x
$as_echo "$at_srcdir/fail.at:88: if \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o a\$EXEEXT a.\$OBJEXT; then (exit 1); else :; fi"
at_fn_check_prepare_dynamic "if $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o a$EXEEXT a.$OBJEXT; then (exit 1); else :; fi" "fail.at:88"
( $at_check_trace; if $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o a$EXEEXT a.$OBJEXT; then (exit 1); else :; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fail.at:88"
$at_failed && at_fn_log_failure
$at_traceon; }


  { set +x
$as_echo "$at_srcdir/fail.at:89: { test -f a && \$test_x a; } || { test -f a\$EXEEXT && \$test_x a\$EXEEXT; }"
at_fn_check_prepare_dynamic "{ test -f a && $test_x a; } || { test -f a$EXEEXT && $test_x a$EXEEXT; }" "fail.at:89"
( $at_check_trace; { test -f a && $test_x a; } || { test -f a$EXEEXT && $test_x a$EXEEXT; }
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/fail.at:89"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/fail.at:90: if \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o a\$EXEEXT a.\$OBJEXT -static; then (exit 1); else :; fi"
at_fn_check_prepare_dynamic "if $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o a$EXEEXT a.$OBJEXT -static; then (exit 1); else :; fi" "fail.at:90"
( $at_check_trace; if $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o a$EXEEXT a.$OBJEXT -static; then (exit 1); else :; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fail.at:90"
$at_failed && at_fn_log_failure
$at_traceon; }


  { set +x
$as_echo "$at_srcdir/fail.at:91: { test -f a && \$test_x a; } || { test -f a\$EXEEXT && \$test_x a\$EXEEXT; }"
at_fn_check_prepare_dynamic "{ test -f a && $test_x a; } || { test -f a$EXEEXT && $test_x a$EXEEXT; }" "fail.at:91"
( $at_check_trace; { test -f a && $test_x a; } || { test -f a$EXEEXT && $test_x a$EXEEXT; }
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/fail.at:91"
$at_failed && at_fn_log_failure
$at_traceon; }

fi

# shared library creation failure
case $build_libtool_libs in yes)
  echo 'int duplicate_name(void) { return 0; }' > a.c
  echo 'double duplicate_name(double x) { return 2.*x; }' > b.c
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c b.c
  # Unfortunately, this may actually succeed on AIX and IRIX  :(
  # So, also add a bogus object file to provoke more failure.
  echo 'int whatever(void) { return 0;}' > c.c
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c c.c
  (
    . ./c.lo
    test none = "$pic_object"     || echo choke me >"$pic_object"
    test none = "$non_pic_object" || echo choke me >"$non_pic_object"
  )
  { set +x
$as_echo "$at_srcdir/fail.at:109: if \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la a.lo b.lo c.lo -rpath /foo; then (exit 1); else :; fi"
at_fn_check_prepare_dynamic "if $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo b.lo c.lo -rpath /foo; then (exit 1); else :; fi" "fail.at:109"
( $at_check_trace; if $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo b.lo c.lo -rpath /foo; then (exit 1); else :; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fail.at:109"
$at_failed && at_fn_log_failure
$at_traceon; }


  { set +x
$as_echo "$at_srcdir/fail.at:110: test -f liba.la"
at_fn_check_prepare_trace "fail.at:110"
( $at_check_trace; test -f liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/fail.at:110"
$at_failed && at_fn_log_failure
$at_traceon; }

  ;;
esac

# Ensure we diagnose '-L path'.
echo 'int main () { return 0; }' > d.c
echo 'int foo () { return 0; }' > space-after-L.c
$CC $CPPFLAGS $CFLAGS -c d.c
$CC $CPPFLAGS $CFLAGS -c space-after-L.c
{ set +x
$as_echo "$at_srcdir/fail.at:119: if \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -L space-after-L.\$OBJEXT -o d\$EXEEXT d.\$OBJEXT; then (exit 1); else :; fi"
at_fn_check_prepare_dynamic "if $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -L space-after-L.$OBJEXT -o d$EXEEXT d.$OBJEXT; then (exit 1); else :; fi" "fail.at:119"
( $at_check_trace; if $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -L space-after-L.$OBJEXT -o d$EXEEXT d.$OBJEXT; then (exit 1); else :; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fail.at:119"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/fail.at:120: if \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o d\$EXEEXT d.\$OBJEXT -L; then (exit 1); else :; fi"
at_fn_check_prepare_dynamic "if $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o d$EXEEXT d.$OBJEXT -L; then (exit 1); else :; fi" "fail.at:120"
( $at_check_trace; if $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o d$EXEEXT d.$OBJEXT -L; then (exit 1); else :; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fail.at:120"
$at_failed && at_fn_log_failure
$at_traceon; }




  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_68
#AT_START_69
at_fn_group_banner 69 'shlibpath.at:26' \
  "shlibpath_overrides_runpath" "                    " 7
at_xfail=no
(
  $as_echo "69. $at_setup_line: testing $at_desc ..."
  $at_traceon



mkdir sub sub/lib sub/bin
echo 'int a () { return 0; }' > a.c
echo 'extern int a (); int main () { return a(); }' > m.c
$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath `pwd`/sub/lib
$LIBTOOL --mode=install cp liba.la `pwd`/sub/lib/liba.la
$LIBTOOL --mode=clean rm -f liba.la
rm -f sub/lib/liba.la

$CC $CPPFLAGS $CFLAGS -c m.c
{ set +x
$as_echo "$at_srcdir/shlibpath.at:39: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o m\$EXEEXT m.\$OBJEXT -Lsub/lib -la -R\`pwd\`/sub/lib"
at_fn_check_prepare_notrace 'a `...` command substitution' "shlibpath.at:39"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m$EXEEXT m.$OBJEXT -Lsub/lib -la -R`pwd`/sub/lib
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/shlibpath.at:39"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/shlibpath.at:41: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o m2\$EXEEXT m.\$OBJEXT -Lsub/lib -la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m2$EXEEXT m.$OBJEXT -Lsub/lib -la" "shlibpath.at:41"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m2$EXEEXT m.$OBJEXT -Lsub/lib -la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/shlibpath.at:41"
$at_failed && at_fn_log_failure
$at_traceon; }


$mkdir_p moved
(cd sub && find . -type d) | (cd moved && xargs $mkdir_p)
for file in `cd sub && find . -type f -print -o -type l -print`
do
  mv sub/$file moved/$file
done
rm -rf sub

mkdir sub sub/lib sub/bin
echo 'int wrong_lib () { return 0; }' > a.c
$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath `pwd`/sub/lib
$LIBTOOL --mode=install cp liba.la `pwd`/sub/lib/liba.la
$LIBTOOL --mode=clean rm -f liba.la

eval `$LIBTOOL --config | $EGREP '^(shlibpath_var|shlibpath_overrides_runpath)='`

# No point checking a system with static libraries:
lt_exe=./m; if test -f "./m$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/shlibpath.at:55: if \"\$lt_exe\" || exit 1 && exit 77; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 1 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" || exit 1 && exit 77; then :; else lt_status=$?; 	   test \"$lt_status\" != 1 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "shlibpath.at:55"
( $at_check_trace; if "$lt_exe" || exit 1 && exit 77; then :; else lt_status=$?; 	   test "$lt_status" != 1 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/shlibpath.at:55"
$at_failed && at_fn_log_failure
$at_traceon; }



if test PATH = "$shlibpath_var"; then
  addpath=`pwd`/moved/bin
else
  addpath=`pwd`/moved/lib
fi
sep=
eval test -n \"\$$shlibpath_var\" && sep=:
eval $shlibpath_var='$addpath$sep$'$shlibpath_var
export $shlibpath_var
if test no != "$shlibpath_overrides_runpath"; then
  lt_exe=./m; if test -f "./m$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/shlibpath.at:67: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "shlibpath.at:67"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/shlibpath.at:67"
$at_failed && at_fn_log_failure
$at_traceon; }


else
  lt_exe=./m; if test -f "./m$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/shlibpath.at:69: if \"\$lt_exe\" || exit 1; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 1 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" || exit 1; then :; else lt_status=$?; 	   test \"$lt_status\" != 1 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "shlibpath.at:69"
( $at_check_trace; if "$lt_exe" || exit 1; then :; else lt_status=$?; 	   test "$lt_status" != 1 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/shlibpath.at:69"
$at_failed && at_fn_log_failure
$at_traceon; }


fi
# Test that shlibpath_var is effective in adding paths at all:
lt_exe=./m2; if test -f "./m2$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/shlibpath.at:72: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "shlibpath.at:72"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/shlibpath.at:72"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_69
#AT_START_70
at_fn_group_banner 70 'runpath-in-lalib.at:26' \
  "Runpath in libtool library files" "               " 7
at_xfail=no
(
  $as_echo "70. $at_setup_line: testing $at_desc ..."
  $at_traceon



cat >a.c <<'_ATEOF'
int a () { return 0; }
_ATEOF

cat >b.c <<'_ATEOF'
extern int a ();
int b () { return a (); }
_ATEOF

cat >m.c <<'_ATEOF'
extern int b ();
int main () { return b (); }
_ATEOF


instdir=`pwd`/inst
libdir=$instdir/lib
bindir=$instdir/bin
addrunpath=`pwd`/foobar

mkdir $instdir $libdir $bindir

for file in a.c b.c; do
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file
done
$CC $CPPFLAGS $CFLAGS -c m.c
{ set +x
$as_echo "$at_srcdir/runpath-in-lalib.at:52: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la a.lo -rpath \$libdir -R\$addrunpath"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath $libdir -R$addrunpath" "runpath-in-lalib.at:52"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath $libdir -R$addrunpath
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/runpath-in-lalib.at:52"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/runpath-in-lalib.at:54: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o libb.la b.lo -rpath \$libdir liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la b.lo -rpath $libdir liba.la" "runpath-in-lalib.at:54"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la b.lo -rpath $libdir liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/runpath-in-lalib.at:54"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/runpath-in-lalib.at:56: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o m\$EXEEXT m.\$OBJEXT libb.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m$EXEEXT m.$OBJEXT libb.la" "runpath-in-lalib.at:56"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m$EXEEXT m.$OBJEXT libb.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/runpath-in-lalib.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/runpath-in-lalib.at:58: \$LIBTOOL --mode=install cp liba.la \$libdir/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp liba.la $libdir/liba.la" "runpath-in-lalib.at:58"
( $at_check_trace; $LIBTOOL --mode=install cp liba.la $libdir/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/runpath-in-lalib.at:58"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/runpath-in-lalib.at:59: \$LIBTOOL --mode=install cp libb.la \$libdir/libb.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp libb.la $libdir/libb.la" "runpath-in-lalib.at:59"
( $at_check_trace; $LIBTOOL --mode=install cp libb.la $libdir/libb.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/runpath-in-lalib.at:59"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/runpath-in-lalib.at:60: \$LIBTOOL --mode=install cp m\$EXEEXT \$bindir/m\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp m$EXEEXT $bindir/m$EXEEXT" "runpath-in-lalib.at:60"
( $at_check_trace; $LIBTOOL --mode=install cp m$EXEEXT $bindir/m$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/runpath-in-lalib.at:60"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/runpath-in-lalib.at:62: \$GREP /foobar \$libdir/liba.la"
at_fn_check_prepare_dynamic "$GREP /foobar $libdir/liba.la" "runpath-in-lalib.at:62"
( $at_check_trace; $GREP /foobar $libdir/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/runpath-in-lalib.at:62"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/runpath-in-lalib.at:63: \$GREP /foobar \$libdir/libb.la"
at_fn_check_prepare_dynamic "$GREP /foobar $libdir/libb.la" "runpath-in-lalib.at:63"
( $at_check_trace; $GREP /foobar $libdir/libb.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/runpath-in-lalib.at:63"
$at_failed && at_fn_log_failure
$at_traceon; }


# TODO: check that m gets -R, too.

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_70
#AT_START_71
at_fn_group_banner 71 'static.at:69' \
  "static linking flags for programs" "              " 7
at_xfail=no
(
  $as_echo "71. $at_setup_line: testing $at_desc ..."
  $at_traceon



LDFLAGS="$LDFLAGS -no-undefined"
prefix=`pwd`/inst
bindir=$prefix/bin
prefix1=`pwd`/inst1
prefix2=`pwd`/inst2
prefix3=`pwd`/inst3
libdir1=$prefix1/lib
libdir2=$prefix2/lib
libdir3=$prefix3/lib
srcdir_broken=`pwd`/broken-src
prefix_broken=`pwd`/broken
libdir_broken=$prefix_broken/lib
bindir_broken=$prefix_broken/bin

have_static=false
have_shared=false
per_deplib=false
$LIBTOOL --features | $GREP 'enable static libraries' >/dev/null && have_static=:
$LIBTOOL --features | $GREP 'enable shared libraries' >/dev/null && have_shared=:
eval `$LIBTOOL --config |
        $EGREP '^(per_deplib_(static|dynamic)_flag|shlibpath_var|link_static_flag)='`
if test -n "$per_deplib_static_flag" && test -n "$per_deplib_dynamic_flag"; then
  per_deplib=:
fi
# On GNU/Linux with --disable-static, m-all-static fails to link.
# What we'd like to state here is: if the user actively passed
# --disable-static (as opposed to: the libtool.m4 macros set
# enable_static=no), then they cannot expect -all-static to work.
# So we punt, knowing that we mangle enable_static on AIX only.
can_link_all_static=-all-static
case $host_os,$have_static,$link_static_flag in
  aix*) ;;
  *,false,?*) can_link_all_static= ;;
esac

# Create broken libraries.  They will later be moved to those
# directories where the respective libraries should be linked
# statically from.  This detects both failure to link statically
# and failure to omit extraneous run paths.
mkdir $srcdir_broken $prefix_broken $libdir_broken
(
  cd $srcdir_broken
  echo 'int this_should_not_be_linked_against() { return 0; }' > a.c
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
  for i in 1 1dep 2 2dep 3 3dep; do
    $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba$i.la a.lo -rpath $libdir_broken
    $LIBTOOL --mode=install cp liba$i.la $libdir_broken/liba$i.la
  done
)

func_fix_path ()
{
  # For w32, hardcoding cannot work, but $libdir/../bin is where binaries
  # usually are installed.  Since we use several prefixes for testing
  # convenience -- it allows us to replace the good libraries easily with
  # broken ones and vice versa -- we have to set PATH to find them.
  # Since OTOH we put broken libs of all names in the "moved" prefixes,
  # we have to ensure that this prefix comes last: otherwise we may link
  # against a broken library but the good one would come later in the PATH.
  # So we let the caller of this function set the order: the "other" two
  # come first.
  if test PATH = "$shlibpath_var"; then
    save_PATH=$PATH
    sep=
    test -z "$PATH" || sep=:
    PATH=$2/bin:$3/bin:$1/bin$sep$PATH
  fi

}

func_restore_path ()
{
  test PATH = "$shlibpath_var" && PATH=$save_PATH
}

# func_move_libs srcdir_to_move prefix_to_move other_prefix other_prefix
func_move_libs ()
{
  $mkdir_p "$1-moved"
(cd "$1" && find . -type d) | (cd "$1-moved" && xargs $mkdir_p)
for file in `cd "$1" && find . -type f -print -o -type l -print`
do
  mv "$1"/$file "$1-moved"/$file
done
rm -rf "$1"

  $mkdir_p "$2-moved"
(cd "$2" && find . -type d) | (cd "$2-moved" && xargs $mkdir_p)
for file in `cd "$2" && find . -type f -print -o -type l -print`
do
  mv "$2"/$file "$2-moved"/$file
done
rm -rf "$2"

  $mkdir_p "$1"
(cd "$srcdir_broken" && find . -type d) | (cd "$1" && xargs $mkdir_p)
for file in `cd "$srcdir_broken" && find . -type f -print -o -type l -print`
do
  mv "$srcdir_broken"/$file "$1"/$file
done
rm -rf "$srcdir_broken"

  $mkdir_p "$2"
(cd "$prefix_broken" && find . -type d) | (cd "$2" && xargs $mkdir_p)
for file in `cd "$prefix_broken" && find . -type f -print -o -type l -print`
do
  mv "$prefix_broken"/$file "$2"/$file
done
rm -rf "$prefix_broken"

  func_fix_path "$2" "$3" "$4"
}

# func_restore_libs srcdir_to_restore prefix_to_restore
func_restore_libs ()
{
  func_restore_path
  $mkdir_p "$prefix_broken"
(cd "$2" && find . -type d) | (cd "$prefix_broken" && xargs $mkdir_p)
for file in `cd "$2" && find . -type f -print -o -type l -print`
do
  mv "$2"/$file "$prefix_broken"/$file
done
rm -rf "$2"

  $mkdir_p "$srcdir_broken"
(cd "$1" && find . -type d) | (cd "$srcdir_broken" && xargs $mkdir_p)
for file in `cd "$1" && find . -type f -print -o -type l -print`
do
  mv "$1"/$file "$srcdir_broken"/$file
done
rm -rf "$1"

  $mkdir_p "$2"
(cd "$2-moved" && find . -type d) | (cd "$2" && xargs $mkdir_p)
for file in `cd "$2-moved" && find . -type f -print -o -type l -print`
do
  mv "$2-moved"/$file "$2"/$file
done
rm -rf "$2-moved"

  $mkdir_p "$1"
(cd "$1-moved" && find . -type d) | (cd "$1" && xargs $mkdir_p)
for file in `cd "$1-moved" && find . -type f -print -o -type l -print`
do
  mv "$1-moved"/$file "$1"/$file
done
rm -rf "$1-moved"

}

# make sure the program can be run.
func_test_exec ()
{
  # On AIX without runtimelinking, this does not make sense.
  if $have_static; then
    echo "## The following should succeed:"
    for st
    do
      echo "# m$st"
      lt_exe=./m$st; if test -f "./m$st$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/static.at:177: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "static.at:177"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/static.at:177"
$at_failed && at_fn_log_failure
$at_traceon; }


      # For some per-deplib flag combinations there may be no installed program,
      # because liba2 is not yet installed.
      if test -f "$bindir/m$st$EXEEXT"; then
	lt_exe=$bindir/m$st; if test -f "$bindir/m$st$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/static.at:181: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "static.at:181"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/static.at:181"
$at_failed && at_fn_log_failure
$at_traceon; }


      fi
    done
  fi
}

# make sure the program cannot be run.
func_test_exec_fail ()
{
  # No point in testing if we're linking statically anyway.
  # TODO: Maybe in the 'else' case we could test for success?
  if $have_shared; then
    echo "## The following should fail:"
    for st
    do
      echo "# m$st"
      lt_exe=./m$st; if test -f "./m$st$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/static.at:197: if \"\$lt_exe\" || (exit 1); then :; else lt_status=\$?; 	   test \"\$lt_status\" != 1 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" || (exit 1); then :; else lt_status=$?; 	   test \"$lt_status\" != 1 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "static.at:197"
( $at_check_trace; if "$lt_exe" || (exit 1); then :; else lt_status=$?; 	   test "$lt_status" != 1 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/static.at:197"
$at_failed && at_fn_log_failure
$at_traceon; }


      # For some per-deplib flag combinations there may be no installed program,
      # because liba2 is not yet installed.
      if test -f "$bindir/m$st$EXEEXT"; then
	lt_exe=$bindir/m$st; if test -f "$bindir/m$st$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/static.at:201: if \"\$lt_exe\" || (exit 1); then :; else lt_status=\$?; 	   test \"\$lt_status\" != 1 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" || (exit 1); then :; else lt_status=$?; 	   test \"$lt_status\" != 1 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "static.at:201"
( $at_check_trace; if "$lt_exe" || (exit 1); then :; else lt_status=$?; 	   test "$lt_status" != 1 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/static.at:201"
$at_failed && at_fn_log_failure
$at_traceon; }


      fi
    done
  fi
}


# Try three independent libraries,
#   one installed libtool library,
#   one uninstalled libtool library,
#   one non-libtool library,
# the libtool libraries each having a dependency, or not.
# Try both an uninstalled and the corresponding installed program.

for withdep in no yes; do
  echo
  echo "### libraries with dependencies: $withdep"
  rm -rf src $prefix $prefix1 $prefix2 $prefix3
  mkdir src $prefix $bindir $prefix1 $prefix2 $prefix3
  cd src

  ### build the libraries.
  for i in 1 2 3; do
    eval ldir=\$libdir$i
    mkdir a$i $ldir
    cd a$i
    case $withdep,$i in
    no,* | yes,3)
      echo "int a$i() { return 0; }" > a$i.c
      $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a$i.c
      $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba$i.la a$i.lo -rpath $ldir
      ;;
    *)
      echo "int a${i}dep() { return 0; }" > a${i}dep.c
      $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a${i}dep.c
      $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba${i}dep.la a${i}dep.lo -rpath $ldir
      echo "extern int a${i}dep(); int a$i() { return a${i}dep(); }" > a$i.c
      $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a$i.c
      $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba$i.la a$i.lo -rpath $ldir ./liba${i}dep.la
      ;;
    esac
    cd ..
  done

  ### install the libraries.
  test yes = "$withdep" && $LIBTOOL --mode=install cp a1/liba1dep.la $libdir1/liba1dep.la
  $LIBTOOL --mode=install cp a1/liba1.la $libdir1/liba1.la
  $LIBTOOL --mode=install cp a3/liba3.la $libdir3/liba3.la
  $LIBTOOL --mode=clean rm -f a1/liba1.la a3/liba3.la
  test yes = "$withdep" && $LIBTOOL --mode=clean rm -f a1/liba1dep.la
  # simulate a non-libtool lib:
  rm -f $libdir3/liba3.la


  ### build the programs.
  echo 'extern int a1(), a2(), a3();
  int main() { return a1() + a2() + a3(); }' > m.c
  $CC $CPPFLAGS $CFLAGS -c m.c

  # global static flags.
  for st in -static -static-libtool-libs $can_link_all_static; do
    { set +x
$as_echo "$at_srcdir/static.at:262: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS \$st -o m\$st\$EXEEXT m.\$OBJEXT \\
	-L\$libdir1 -la1 a2/liba2.la -L\$libdir3 -R\$libdir3 -la3"
at_fn_check_prepare_notrace 'an embedded newline' "static.at:262"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $st -o m$st$EXEEXT m.$OBJEXT \
	-L$libdir1 -la1 a2/liba2.la -L$libdir3 -R$libdir3 -la3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/static.at:262"
$at_failed && at_fn_log_failure
$at_traceon; }

  done

  # per-deplib static/shared flags.
  # also try a bit redundant flags, and shuffled order (for run paths check).
  if $per_deplib; then
    { set +x
$as_echo "$at_srcdir/static.at:270: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o m1\$EXEEXT m.\$OBJEXT \\
	      -L\$libdir1 -Bstatic -la1 -Bdynamic a2/liba2.la -L\$libdir3 -R\$libdir3 -la3"
at_fn_check_prepare_notrace 'an embedded newline' "static.at:270"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m1$EXEEXT m.$OBJEXT \
	      -L$libdir1 -Bstatic -la1 -Bdynamic a2/liba2.la -L$libdir3 -R$libdir3 -la3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/static.at:270"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/static.at:273: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o m2\$EXEEXT m.\$OBJEXT \\
	      -L\$libdir1 -la1 -Bstatic a2/liba2.la -Bdynamic -L\$libdir3 -R\$libdir3 -la3"
at_fn_check_prepare_notrace 'an embedded newline' "static.at:273"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m2$EXEEXT m.$OBJEXT \
	      -L$libdir1 -la1 -Bstatic a2/liba2.la -Bdynamic -L$libdir3 -R$libdir3 -la3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/static.at:273"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/static.at:276: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o m3\$EXEEXT m.\$OBJEXT \\
	      -L\$libdir1 -la1 a2/liba2.la -L\$libdir3 -Bstatic -la3 -Bdynamic"
at_fn_check_prepare_notrace 'an embedded newline' "static.at:276"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m3$EXEEXT m.$OBJEXT \
	      -L$libdir1 -la1 a2/liba2.la -L$libdir3 -Bstatic -la3 -Bdynamic
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/static.at:276"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/static.at:279: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o m12\$EXEEXT m.\$OBJEXT \\
	      -L\$libdir1 -Bstatic -la1 a2/liba2.la -Bdynamic -L\$libdir3 -R\$libdir3 -la3"
at_fn_check_prepare_notrace 'an embedded newline' "static.at:279"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m12$EXEEXT m.$OBJEXT \
	      -L$libdir1 -Bstatic -la1 a2/liba2.la -Bdynamic -L$libdir3 -R$libdir3 -la3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/static.at:279"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/static.at:282: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o m13\$EXEEXT m.\$OBJEXT \\
	      -L\$libdir1 -Bstatic -la1 -Bdynamic a2/liba2.la \\
	      -L\$libdir3 -Bstatic -la3 -Bdynamic"
at_fn_check_prepare_notrace 'an embedded newline' "static.at:282"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m13$EXEEXT m.$OBJEXT \
	      -L$libdir1 -Bstatic -la1 -Bdynamic a2/liba2.la \
	      -L$libdir3 -Bstatic -la3 -Bdynamic
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/static.at:282"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/static.at:286: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o m31\$EXEEXT m.\$OBJEXT \\
	      -L\$libdir3 -Bstatic -la3 -Bdynamic a2/liba2.la \\
	      -L\$libdir1 -Bstatic -la1 -Bdynamic"
at_fn_check_prepare_notrace 'an embedded newline' "static.at:286"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m31$EXEEXT m.$OBJEXT \
	      -L$libdir3 -Bstatic -la3 -Bdynamic a2/liba2.la \
	      -L$libdir1 -Bstatic -la1 -Bdynamic
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/static.at:286"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/static.at:290: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o m23\$EXEEXT m.\$OBJEXT \\
	      -L\$libdir1 -la1 -Bstatic a2/liba2.la -Bdynamic \\
	      -L\$libdir3 -Bstatic -la3 -Bdynamic"
at_fn_check_prepare_notrace 'an embedded newline' "static.at:290"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m23$EXEEXT m.$OBJEXT \
	      -L$libdir1 -la1 -Bstatic a2/liba2.la -Bdynamic \
	      -L$libdir3 -Bstatic -la3 -Bdynamic
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/static.at:290"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/static.at:294: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o m123\$EXEEXT m.\$OBJEXT \\
	      -L\$libdir1 -Bstatic -la1 a2/liba2.la -L\$libdir3 -la3 -Bdynamic"
at_fn_check_prepare_notrace 'an embedded newline' "static.at:294"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m123$EXEEXT m.$OBJEXT \
	      -L$libdir1 -Bstatic -la1 a2/liba2.la -L$libdir3 -la3 -Bdynamic
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/static.at:294"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/static.at:297: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o m123a\$EXEEXT m.\$OBJEXT \\
	      -L\$libdir1 -Bstatic -la1 -Bdynamic -Bstatic a2/liba2.la -Bdynamic \\
	      -Bstatic -L\$libdir3 -la3 -Bdynamic"
at_fn_check_prepare_notrace 'an embedded newline' "static.at:297"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m123a$EXEEXT m.$OBJEXT \
	      -L$libdir1 -Bstatic -la1 -Bdynamic -Bstatic a2/liba2.la -Bdynamic \
	      -Bstatic -L$libdir3 -la3 -Bdynamic
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/static.at:297"
$at_failed && at_fn_log_failure
$at_traceon; }

                  fi

  ### install the programs.
  # We can't install any program that links dynamically against liba2.
  for st in -static -static-libtool-libs $can_link_all_static `$per_deplib && echo 2 12 23 123 123a`; do
    echo "# m$st"
    { set +x
$as_echo "$at_srcdir/static.at:311: \$LIBTOOL --mode=install cp m\$st\$EXEEXT \$bindir/m\$st\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp m$st$EXEEXT $bindir/m$st$EXEEXT" "static.at:311"
( $at_check_trace; $LIBTOOL --mode=install cp m$st$EXEEXT $bindir/m$st$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/static.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

    if $have_static; then
      { set +x
$as_echo "$at_srcdir/static.at:313: \$EGREP 'relinking|has not been installed' stderr"
at_fn_check_prepare_notrace 'a shell pipeline' "static.at:313"
( $at_check_trace; $EGREP 'relinking|has not been installed' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/static.at:313"
$at_failed && at_fn_log_failure
$at_traceon; }

    fi
  done


  ### Run each program once so that relinking has happened.

  func_fix_path $prefix1 $prefix2 $prefix3
  func_test_exec -static -static-libtool-libs -all-static `$per_deplib && echo 1 2 3 12 13 23 31 123 123a`
  func_restore_path

  # For each library:
  # - remove the library images to catch failure to link statically/dynamically,
  # - add false other deplibs in the paths to catch (some) wrongly added run paths.

  # if '-all-static' does not work, do not exercise it any more.
  all_static=-all-static
  test -z "$link_static_flag" && all_static=

  echo "### test whether installed libtool library liba2 was linked statically"
  func_move_libs a2 $prefix2 $prefix3 $prefix1
  func_test_exec -static -static-libtool-libs $all_static `$per_deplib && echo 2 12 23 123 123a`
  $per_deplib && func_test_exec_fail 1 3 13 31
  func_restore_libs a2 $prefix2

  echo "### test whether uninstalled libtool library liba1 was linked statically"
  func_move_libs a1 $prefix1 $prefix2 $prefix3
  func_test_exec -static-libtool-libs $all_static `$per_deplib && echo 1 12 13 31 123 123a`
  $per_deplib && func_test_exec_fail -static 2 3 23
  func_restore_libs a1 $prefix1

  echo "### test whether non-libtool library liba3 was linked statically"
  func_move_libs a3 $prefix3 $prefix1 $prefix2
  func_test_exec $all_static `$per_deplib && echo 3 13 23 31 123 123a`
  # no '-static-libtool-libs' flag below, because some hosts such as
  # Cray prefer static libs by default.
  # and doesn't exercise anything not already tested above:
  func_test_exec_fail -static `$per_deplib && echo 1 2 12`
  func_restore_libs a3 $prefix3

  cd ..
done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_71
#AT_START_72
at_fn_group_banner 72 'static.at:360' \
  "ccache -all-static" "                             " 7
at_xfail=no
(
  $as_echo "72. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >ccache <<'_ATEOF'
#! /bin/sh
# poor man's ccache clone
case $1 in
-*) echo "bogus argument: $1" >&2; exit 1 ;;
esac
exec "$@"
_ATEOF

chmod +x ./ccache

cat >a.c <<'_ATEOF'
int main(void) { return 0; }
_ATEOF


{ set +x
$as_echo "$at_srcdir/static.at:376: \$CC \$CPPFLAGS \$CFLAGS -c a.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c a.c" "static.at:376"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c a.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/static.at:376"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/static.at:377: \$LIBTOOL --mode=link --tag=CC ./ccache \$CC \$CFLAGS \$LDFLAGS -all-static a.\$OBJEXT -o a\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC ./ccache $CC $CFLAGS $LDFLAGS -all-static a.$OBJEXT -o a$EXEEXT" "static.at:377"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC ./ccache $CC $CFLAGS $LDFLAGS -all-static a.$OBJEXT -o a$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/static.at:377"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_72
#AT_START_73
at_fn_group_banner 73 'export.at:26' \
  "Export test" "                                    " 7
at_xfail=no
(
  $as_echo "73. $at_setup_line: testing $at_desc ..."
  $at_traceon



{ set +x
$as_echo "$at_srcdir/export.at:29: \$LIBTOOL --features | \$GREP 'disable shared libraries' && (exit 77)"
at_fn_check_prepare_notrace 'a shell pipeline' "export.at:29"
( $at_check_trace; $LIBTOOL --features | $GREP 'disable shared libraries' && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/export.at:29"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/export.at:31: eval \`\$LIBTOOL --config | \$SED -n '/^archive_expsym_cmds=/,/^\$/p'\`
	  test -n \"\$archive_expsym_cmds\" || echo false >can-hide
	  case \$archive_expsym_cmds in
	  *-retain-symbols-file*) echo false >can-hide ;;
	  esac"
at_fn_check_prepare_notrace 'a `...` command substitution' "export.at:31"
( $at_check_trace; eval `$LIBTOOL --config | $SED -n '/^archive_expsym_cmds=/,/^$/p'`
	  test -n "$archive_expsym_cmds" || echo false >can-hide
	  case $archive_expsym_cmds in
	  *-retain-symbols-file*) echo false >can-hide ;;
	  esac
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/export.at:31"
$at_failed && at_fn_log_failure
$at_traceon; }

can_hide=:
test -s can-hide && can_hide=false

LDFLAGS="$LDFLAGS -no-undefined"
libdir=`pwd`/inst/lib
mkdir inst inst/lib

cat >a.c <<'_ATEOF'
/* all kinds of data items */
#ifdef __cplusplus
extern "C" {
#endif

int v1;
static int v2;
int v3 = 0;
int v4 = 1;
extern const int v5, v6;
extern const char *v7;
extern const char v8[];
extern int (*const v12) (void);
const int v5 = 0;
const int v6 = 1;
const char* v7 = "\01foo";
const char v8[] = "\01bar";
int v9(void) { return v2 + 1; }
int (*v10) (void);
int (*v11) (void) = v9;
int (*const v12) (void) = v9;

typedef struct { int arr[1000]; } large;
large v13;
large v14 = { { 0 } };
large v15 = { { 1 } };

int w1 (void) { return 0; }

#ifdef __cplusplus
}
#endif
_ATEOF


cat >asyms <<'_ATEOF'
v1
v3
v4
v5
v6
v7
v8
v9
v10
v11
v12
v13
v14
v15
_ATEOF


cat >main.c <<'_ATEOF'

/* w32 fun.  With GCC, you can have auto-import, which will work for
 * functions and non-const variables.  With MSVC, you have to explicitly
 * import all variables.  Depending on the amount of portability, you
 * need these annotations: LIBA_SCOPE for GCC, and also LIBA_SCOPE_VAR
 * for MSVC.  Of course you can merge both to one, this test only avoids
 * that in order to expose the auto-import feature on Cygwin.
 *
 * For users, it's best to realize that they should not provide any
 * non-function API at all.
 */
#if defined LIBA_DLL_IMPORT
#  if defined _WIN32 || defined WIN32 || defined __CYGWIN__
#    define LIBA_SCOPE extern __declspec(dllimport)
#    if defined _MSC_VER
#      define LIBA_SCOPE_VAR LIBA_SCOPE
#    endif
#  endif
#endif
#if !defined LIBA_SCOPE
#  define LIBA_SCOPE extern
#endif
#if !defined LIBA_SCOPE_VAR
#  define LIBA_SCOPE_VAR extern
#endif
#ifdef __cplusplus
extern "C" {
#endif
LIBA_SCOPE_VAR int v1;
LIBA_SCOPE_VAR int v3, v4;
LIBA_SCOPE const int v5, v6;
LIBA_SCOPE_VAR const char* v7;
LIBA_SCOPE_VAR const char v8[];
extern int v9(void);
LIBA_SCOPE_VAR int (*v10) (void);
LIBA_SCOPE_VAR int (*v11) (void);
LIBA_SCOPE int (*const v12) (void);
#ifdef __cplusplus
}
#endif

typedef struct { int arr[1000]; } large;
LIBA_SCOPE_VAR large v13, v14, v15;

int main (void)
{
  char s = v7[0] + v8[0];
  return s + v1 + v3 + v4 + v5 + v6 + v9() + v11() + v12()
	   + v13.arr[0] + v14.arr[0] + v15.arr[0]
           - 8;
}
_ATEOF


cat >broken.c <<'_ATEOF'

/* these symbols should not be exported */
#ifdef __cplusplus
extern "C" {
#endif
extern int w1 (void);
#ifdef __cplusplus
}
#endif
int main (void)
{
  return w1 ();
}
_ATEOF


{ set +x
$as_echo "$at_srcdir/export.at:165: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c a.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c" "export.at:165"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/export.at:165"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/export.at:166: \$CC \$CPPFLAGS -DLIBA_DLL_IMPORT \$CFLAGS -c main.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS -DLIBA_DLL_IMPORT $CFLAGS -c main.c" "export.at:166"
( $at_check_trace; $CC $CPPFLAGS -DLIBA_DLL_IMPORT $CFLAGS -c main.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/export.at:166"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/export.at:167: \$CC \$CPPFLAGS \$CFLAGS -c broken.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c broken.c" "export.at:167"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c broken.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/export.at:167"
$at_failed && at_fn_log_failure
$at_traceon; }


for exportsyms in '' '-export-symbols-regex "v.*"' '-export-symbols asyms'
do
  # case 1: shared library built from object.
  echo "eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo \\
	       -rpath $libdir' $exportsyms"; { set +x
$as_echo "$at_srcdir/export.at:172: eval '\$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la a.lo \\
	       -rpath \$libdir' \$exportsyms"
at_fn_check_prepare_notrace 'an embedded newline' "export.at:172"
( $at_check_trace; eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo \
	       -rpath $libdir' $exportsyms
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/export.at:172"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/export.at:174: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la" "export.at:174"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/export.at:174"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/export.at:176: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "export.at:176"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/export.at:176"
$at_failed && at_fn_log_failure
$at_traceon; }


  if test -n "$exportsyms" && $can_hide; then
    { set +x
$as_echo "$at_srcdir/export.at:178: if \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o broken\$EXEEXT broken.\$OBJEXT liba.la
	      then (exit 1); else :; fi"
at_fn_check_prepare_notrace 'an embedded newline' "export.at:178"
( $at_check_trace; if $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o broken$EXEEXT broken.$OBJEXT liba.la
	      then (exit 1); else :; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/export.at:178"
$at_failed && at_fn_log_failure
$at_traceon; }

  fi

  # case 2: shared library built from convenience archive.
  { set +x
$as_echo "$at_srcdir/export.at:183: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o libconv.la a.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libconv.la a.lo" "export.at:183"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libconv.la a.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/export.at:183"
$at_failed && at_fn_log_failure
$at_traceon; }

  echo "eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la libconv.la \\
	       -rpath $libdir' $exportsyms"; { set +x
$as_echo "$at_srcdir/export.at:185: eval '\$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la libconv.la \\
	       -rpath \$libdir' \$exportsyms"
at_fn_check_prepare_notrace 'an embedded newline' "export.at:185"
( $at_check_trace; eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la libconv.la \
	       -rpath $libdir' $exportsyms
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/export.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/export.at:187: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la" "export.at:187"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/export.at:187"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/export.at:189: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "export.at:189"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/export.at:189"
$at_failed && at_fn_log_failure
$at_traceon; }


  if test -n "$exportsyms" && $can_hide; then
    { set +x
$as_echo "$at_srcdir/export.at:191: if \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o broken\$EXEEXT broken.\$OBJEXT liba.la
	      then (exit 1); else :; fi"
at_fn_check_prepare_notrace 'an embedded newline' "export.at:191"
( $at_check_trace; if $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o broken$EXEEXT broken.$OBJEXT liba.la
	      then (exit 1); else :; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/export.at:191"
$at_failed && at_fn_log_failure
$at_traceon; }

  fi
done

{ set +x
$as_echo "$at_srcdir/export.at:196: \$can_hide || (exit 77)"
at_fn_check_prepare_dynamic "$can_hide || (exit 77)" "export.at:196"
( $at_check_trace; $can_hide || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/export.at:196"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_73
#AT_START_74
at_fn_group_banner 74 'export-def.at:25' \
  "export from a DLL with a .def file" "             " 7
at_xfail=no
(
  $as_echo "74. $at_setup_line: testing $at_desc ..."
  $at_traceon



{ set +x
$as_echo "$at_srcdir/export-def.at:28: \$LIBTOOL --features | \$GREP 'disable shared libraries' && (exit 77)"
at_fn_check_prepare_notrace 'a shell pipeline' "export-def.at:28"
( $at_check_trace; $LIBTOOL --features | $GREP 'disable shared libraries' && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/export-def.at:28"
$at_failed && at_fn_log_failure
$at_traceon; }

eval `$LIBTOOL --config | $EGREP '^(shrext_cmds|libname_spec|soname_spec)='`

eval shared_ext=\"$shrext_cmds\"

# skip if not building a .dll
{ set +x
$as_echo "$at_srcdir/export-def.at:35: test .dll = \"\$shared_ext\" || (exit 77)"
at_fn_check_prepare_dynamic "test .dll = \"$shared_ext\" || (exit 77)" "export-def.at:35"
( $at_check_trace; test .dll = "$shared_ext" || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/export-def.at:35"
$at_failed && at_fn_log_failure
$at_traceon; }


LDFLAGS="$LDFLAGS -no-undefined"
libdir=`pwd`/inst/lib
mkdir inst inst/lib

cat >a.c <<'_ATEOF'
/* a */
#ifdef __cplusplus
extern "C" {
#endif

int v1 = -1;
int v2 (void) { return -2; }

#ifdef __cplusplus
}
#endif
_ATEOF


cat >syms <<'_ATEOF'
v1
v2
_ATEOF


cat >def1 <<'_ATEOF'
EXPORTS
v1 DATA
v2
_ATEOF


cat >def2 <<'_ATEOF'
; Def file
    ; with some very important comments
EXPORTS
v1 DATA
v2
_ATEOF


cat >def3 <<'_ATEOF'

   EXPORTS v1 DATA
   v2
_ATEOF


cat >def4 <<'_ATEOF'
	LIBRARY %soname%
EXPORTS
v1 DATA
v2
_ATEOF


cat >main.c <<'_ATEOF'

/* w32 fun.  With GCC, you can have auto-import, which will work for
 * functions and non-const variables.  With MSVC, you have to explicitly
 * import all variables.
 *
 * For users, it's best to realize that they should not provide any
 * non-function API at all.
 */
#if defined LIBA_DLL_IMPORT
#  if defined _WIN32 && defined _MSC_VER
#    define LIBA_SCOPE_VAR extern __declspec(dllimport)
#  endif
#endif
#if !defined LIBA_SCOPE_VAR
#  define LIBA_SCOPE_VAR extern
#endif
#ifdef __cplusplus
extern "C" {
#endif
LIBA_SCOPE_VAR int v1;
extern int v2(void);
#ifdef __cplusplus
}
#endif

int main (void)
{
  return v1 + v2() + 3;
}
_ATEOF


name=a
eval libname=\"$libname_spec\"
major=0
versuffix=-$major
eval soname=\"$soname_spec\"

{ set +x
$as_echo "$at_srcdir/export-def.at:125: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c a.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c" "export-def.at:125"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/export-def.at:125"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/export-def.at:126: \$CC \$CPPFLAGS -DLIBA_DLL_IMPORT \$CFLAGS -c main.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS -DLIBA_DLL_IMPORT $CFLAGS -c main.c" "export-def.at:126"
( $at_check_trace; $CC $CPPFLAGS -DLIBA_DLL_IMPORT $CFLAGS -c main.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/export-def.at:126"
$at_failed && at_fn_log_failure
$at_traceon; }


for exportsyms in syms def1 def2 def3 def4
do
  $SED "s/%soname%/$soname/" -i $exportsyms

  echo "eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo \\
	       -rpath $libdir' -export-symbols $exportsyms"; { set +x
$as_echo "$at_srcdir/export-def.at:132: eval '\$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la a.lo \\
	       -rpath \$libdir' -export-symbols \$exportsyms"
at_fn_check_prepare_notrace 'an embedded newline' "export-def.at:132"
( $at_check_trace; eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo \
	       -rpath $libdir' -export-symbols $exportsyms
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/export-def.at:132"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/export-def.at:134: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la" "export-def.at:134"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/export-def.at:134"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/export-def.at:136: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "export-def.at:136"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/export-def.at:136"
$at_failed && at_fn_log_failure
$at_traceon; }


done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_74
#AT_START_75
at_fn_group_banner 75 'search-path.at:25' \
  "sys_lib_search_path" "                            " 7
at_xfail=no
(
  $as_echo "75. $at_setup_line: testing $at_desc ..."
  $at_traceon


LDFLAGS="$LDFLAGS -no-undefined"

cat >main.c <<'_ATEOF'
extern
#ifdef __cplusplus
"C"
#endif
int inflate ();
int main()
{
  return inflate ();
}
_ATEOF


$CC $CPPFLAGS $CFLAGS -c main.c
eval `$LIBTOOL --config | $EGREP '^(sys_lib_search_path_spec)='`
eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
no_libz=:
for path in $sys_lib_search_path; do
  if $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT -L$path -lz
  then
    { set +x
$as_echo "$at_srcdir/search-path.at:48: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT -lz"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT -lz" "search-path.at:48"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT -lz
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/search-path.at:48"
$at_failed && at_fn_log_failure
$at_traceon; }

    no_libz=false
    break
  fi
done

# If -lz doesn't exist (hello, cross compiler!), we need a dummy test.
if $no_libz; then
  { set +x
$as_echo "$at_srcdir/search-path.at:57: exit 77"
at_fn_check_prepare_trace "search-path.at:57"
( $at_check_trace; exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/search-path.at:57"
$at_failed && at_fn_log_failure
$at_traceon; }

fi

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_75
#AT_START_76
at_fn_group_banner 76 'search-path.at:63' \
  "sys_lib_search_path on w32" "                     " 7
at_xfail=no
(
  $as_echo "76. $at_setup_line: testing $at_desc ..."
  $at_traceon



# Check if libtool knows the path to system libraries.  Using
# a w32 system library since the test is designed to check if
# the libtool handling of the sys_lib_search_path variable is
# correct for MSVC.

LDFLAGS="$LDFLAGS -no-undefined"

cat >gc.c <<'_ATEOF'
#include <windows.h>
HCURSOR get_cursor (void)
{
  return GetCursor ();
}
_ATEOF


eval "`$LIBTOOL --config | $GREP '^build_libtool_libs='`"
{ set +x
$as_echo "$at_srcdir/search-path.at:82: test yes = \"\$build_libtool_libs\" || exit 77"
at_fn_check_prepare_dynamic "test yes = \"$build_libtool_libs\" || exit 77" "search-path.at:82"
( $at_check_trace; test yes = "$build_libtool_libs" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/search-path.at:82"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/search-path.at:84: \$LIBTOOL --mode=compile --tag=CC \\
	  \$CC \$CPPFLAGS \$CFLAGS -o gc.lo -c gc.c || exit 77"
at_fn_check_prepare_notrace 'an embedded newline' "search-path.at:84"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CC \
	  $CC $CPPFLAGS $CFLAGS -o gc.lo -c gc.c || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/search-path.at:84"
$at_failed && at_fn_log_failure
$at_traceon; }


# Ok, compile was fine, then it should be possible to link too.

{ set +x
$as_echo "$at_srcdir/search-path.at:90: \$LIBTOOL --mode=link --tag=CC --tag=disable-static \\
	  \$CC \$CFLAGS \$LDFLAGS -o libgc.la gc.lo -rpath /nowhere -luser32"
at_fn_check_prepare_notrace 'an embedded newline' "search-path.at:90"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC --tag=disable-static \
	  $CC $CFLAGS $LDFLAGS -o libgc.la gc.lo -rpath /nowhere -luser32
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/search-path.at:90"
$at_failed && at_fn_log_failure
$at_traceon; }


# If -luser32 was found, then libtool will build a shared library,
# otherwise libtool will fall back to creating a static library.
{ set +x
$as_echo "$at_srcdir/search-path.at:96: \$GREP old_library=\\'\\' libgc.la"
at_fn_check_prepare_dynamic "$GREP old_library=\\'\\' libgc.la" "search-path.at:96"
( $at_check_trace; $GREP old_library=\'\' libgc.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/search-path.at:96"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_76
#AT_START_77
at_fn_group_banner 77 'indirect_deps.at:26' \
  "indirect convenience" "                           " 7
at_xfail=no
(
  $as_echo "77. $at_setup_line: testing $at_desc ..."
  $at_traceon



cat >a.c <<'_ATEOF'

#include <math.h>
int a () { return 0; }
double ad (double x) { return sin (x); }
_ATEOF

cat >b.c <<'_ATEOF'

extern int a ();
extern double ad (double);
int b () { return a () + (int) ad (0.0); }
_ATEOF

cat >c.c <<'_ATEOF'

extern int b ();
int c () { return b (); }
_ATEOF

cat >m.c <<'_ATEOF'

extern int c ();
int main () { return c (); }
_ATEOF


LDFLAGS="$LDFLAGS -no-undefined"
for file in a.c b.c c.c; do
  $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c $file
done
$CC $CPPFLAGS $CFLAGS -c m.c

# liba is an indirect dependency of libd and of libconv.
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath /nowhere -lm
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libb.la b.lo liba.la -rpath /nowhere
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libconv.la c.lo libb.la
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libd.la libconv.la -rpath /nowhere

for st in '' -static; do
  { set +x
$as_echo "$at_srcdir/indirect_deps.at:61: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS \$st -o m1\$EXEEXT m.\$OBJEXT libd.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS $st -o m1$EXEEXT m.$OBJEXT libd.la" "indirect_deps.at:61"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS $st -o m1$EXEEXT m.$OBJEXT libd.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/indirect_deps.at:61"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/indirect_deps.at:63: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS \$st -o m2\$EXEEXT m.\$OBJEXT libconv.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS $st -o m2$EXEEXT m.$OBJEXT libconv.la" "indirect_deps.at:63"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS $st -o m2$EXEEXT m.$OBJEXT libconv.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/indirect_deps.at:63"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./m1; if test -f "./m1$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/indirect_deps.at:65: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "indirect_deps.at:65"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/indirect_deps.at:65"
$at_failed && at_fn_log_failure
$at_traceon; }


  lt_exe=./m2; if test -f "./m2$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/indirect_deps.at:66: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "indirect_deps.at:66"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/indirect_deps.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }


done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_77
#AT_START_78
at_fn_group_banner 78 'indirect_deps.at:72' \
  "indirect uninstalled" "                           " 7
at_xfail=no
(
  $as_echo "78. $at_setup_line: testing $at_desc ..."
  $at_traceon



cat >a.c <<'_ATEOF'

int a () { return 0; }
_ATEOF

cat >b.c <<'_ATEOF'

extern int a ();
int b () { return a (); }
_ATEOF

cat >c.c <<'_ATEOF'

extern int b ();
int c () { return b (); }
_ATEOF


cat >m1.c <<'_ATEOF'

extern int b ();
int main () { return b (); }
_ATEOF

cat >m2.c <<'_ATEOF'

extern int c ();
int main () { return c (); }
_ATEOF


mkdir a b c
LDFLAGS="$LDFLAGS -no-undefined"
for file in a.c b.c c.c; do
  $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c $file
done
for file in m1.c m2.c; do
  $CC $CPPFLAGS $CFLAGS -c $file
done

for st in '' -static; do
  $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o a/liba.la a.lo -rpath /nowherea
  $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o b/libb.la b.lo a/liba.la -rpath /nowhereb
  $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o c/libcee.la c.lo b/libb.la -rpath /nowherec

  { set +x
$as_echo "$at_srcdir/indirect_deps.at:110: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS \$st -o m1\$EXEEXT m1.\$OBJEXT b/libb.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS $st -o m1$EXEEXT m1.$OBJEXT b/libb.la" "indirect_deps.at:110"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS $st -o m1$EXEEXT m1.$OBJEXT b/libb.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/indirect_deps.at:110"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/indirect_deps.at:112: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS \$st -o m2\$EXEEXT m2.\$OBJEXT c/libcee.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS $st -o m2$EXEEXT m2.$OBJEXT c/libcee.la" "indirect_deps.at:112"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS $st -o m2$EXEEXT m2.$OBJEXT c/libcee.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/indirect_deps.at:112"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./m1; if test -f "./m1$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/indirect_deps.at:114: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "indirect_deps.at:114"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/indirect_deps.at:114"
$at_failed && at_fn_log_failure
$at_traceon; }


  lt_exe=./m2; if test -f "./m2$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/indirect_deps.at:115: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "indirect_deps.at:115"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/indirect_deps.at:115"
$at_failed && at_fn_log_failure
$at_traceon; }


done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_78
#AT_START_79
at_fn_group_banner 79 'archive-in-archive.at:27' \
  "static library contains static library" "         " 7
at_xfail=no
      case $AR in ar-lib\ * | *[/\\]ar-lib\ *) false;; *) :;; esac && at_xfail=yes
(
  $as_echo "79. $at_setup_line: testing $at_desc ..."
  $at_traceon



# This test passes with MS lib.


cat >foo.c <<'_ATEOF'

int foo() { return 1;}
_ATEOF


cat >bar.c <<'_ATEOF'

int bar() { return 1;}
_ATEOF


thisdir=`cd . && pwd`
$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o foo.lo foo.c
$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o bar.lo bar.c
$LIBTOOL --mode=link --tag=CC --tag=disable-shared $CC $CFLAGS $LDFLAGS \
-o libfoo.la foo.lo -version-info 1:0:0 -rpath $thisdir
$LIBTOOL --mode=install cp libfoo.la $thisdir
eval `$EGREP '^(old_library)=' < libfoo.la`
libfoo=$old_library
{ set +x
$as_echo "$at_srcdir/archive-in-archive.at:51: \$LIBTOOL --mode=link --tag=CC --tag=disable-shared \$CC \$CFLAGS \$LDFLAGS \\
	 -o libbar.la bar.lo \$libfoo -version-info 1:0:0 -rpath \$thisdir"
at_fn_check_prepare_notrace 'an embedded newline' "archive-in-archive.at:51"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC --tag=disable-shared $CC $CFLAGS $LDFLAGS \
	 -o libbar.la bar.lo $libfoo -version-info 1:0:0 -rpath $thisdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/archive-in-archive.at:51"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/archive-in-archive.at:54: \$LIBTOOL --mode=install cp libbar.la \$thisdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp libbar.la $thisdir" "archive-in-archive.at:54"
( $at_check_trace; $LIBTOOL --mode=install cp libbar.la $thisdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/archive-in-archive.at:54"
$at_failed && at_fn_log_failure
$at_traceon; }

eval `$EGREP '^(old_library)=' < libbar.la`
libbar=$old_library
{ set +x
$as_echo "$at_srcdir/archive-in-archive.at:57: \$AR -t \$libbar | \$GREP \$libfoo"
at_fn_check_prepare_notrace 'a shell pipeline' "archive-in-archive.at:57"
( $at_check_trace; $AR -t $libbar | $GREP $libfoo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/archive-in-archive.at:57"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/archive-in-archive.at:58: \$AR -t \$libbar | \$GREP foo.\$OBJEXT"
at_fn_check_prepare_notrace 'a shell pipeline' "archive-in-archive.at:58"
( $at_check_trace; $AR -t $libbar | $GREP foo.$OBJEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/archive-in-archive.at:58"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/archive-in-archive.at:59: \$AR -t \$libbar | \$GREP bar.\$OBJEXT"
at_fn_check_prepare_notrace 'a shell pipeline' "archive-in-archive.at:59"
( $at_check_trace; $AR -t $libbar | $GREP bar.$OBJEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/archive-in-archive.at:59"
$at_failed && at_fn_log_failure
$at_traceon; }

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_79
#AT_START_80
at_fn_group_banner 80 'exeext.at:26' \
  "both of -o prog and -o prog\$EXEEXT work" "        " 7
at_xfail=no
(
  $as_echo "80. $at_setup_line: testing $at_desc ..."
  $at_traceon



{ set +x
$as_echo "$at_srcdir/exeext.at:29: test -n \"\$EXEEXT\" || exit 77"
at_fn_check_prepare_dynamic "test -n \"$EXEEXT\" || exit 77" "exeext.at:29"
( $at_check_trace; test -n "$EXEEXT" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/exeext.at:29"
$at_failed && at_fn_log_failure
$at_traceon; }


bin=`pwd`/bin
binext=`pwd`/binext
mkdir src $bin srcext $binext

cat >src/prog.c <<'_ATEOF'

int main(void) { return 0; }
_ATEOF


$CC $CPPFLAGS $CFLAGS -c src/prog.c -o src/prog.$OBJEXT

{ set +x
$as_echo "$at_srcdir/exeext.at:42: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o src/prog src/prog.\$OBJEXT"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/prog src/prog.$OBJEXT" "exeext.at:42"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/prog src/prog.$OBJEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exeext.at:42"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/exeext.at:44: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o srcext/prog\$EXEEXT src/prog.\$OBJEXT"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o srcext/prog$EXEEXT src/prog.$OBJEXT" "exeext.at:44"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o srcext/prog$EXEEXT src/prog.$OBJEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exeext.at:44"
$at_failed && at_fn_log_failure
$at_traceon; }


$LIBTOOL --mode=install cp src/prog $bin/prog
$LIBTOOL --mode=install cp srcext/prog$EXEEXT $binext/prog$EXEEXT

lt_exe=$bin/prog; if test -f "$bin/prog$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/exeext.at:50: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "exeext.at:50"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/exeext.at:50"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$binext/prog$EXEEXT; if test -f "$binext/prog$EXEEXT$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/exeext.at:51: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "exeext.at:51"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/exeext.at:51"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_80
#AT_START_81
at_fn_group_banner 81 'execute-mode.at:25' \
  "execute mode" "                                   " 7
at_xfail=no
(
  $as_echo "81. $at_setup_line: testing $at_desc ..."
  $at_traceon



eval `$LIBTOOL --config | $EGREP '^(FGREP)='`

cat >foo <<'_ATEOF'
#! /bin/sh
if test $# -gt 0; then
  for arg
  do
    printf %s\\n "$arg"
  done
else
  :
fi
_ATEOF


cat >lt-wrapper <<'_ATEOF'
#! /bin/sh
# Generated by GNU libtool.
# fake wrapper script.
program=lt-real
progdir=.
if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
  # Run the actual program with our arguments.
  exec "$progdir/$program" ${1+"$@"}
  echo "$0: cannot exec $program $*" >&2
  exit 1
fi
_ATEOF


cat >lt-real <<'_ATEOF'
#! /bin/sh
for arg
do
  printf %s\\n "$arg"
done
cat
_ATEOF


cat >libfakelib.la <<'_ATEOF'
# libfakelib.la - a libtool library file
# Generated by ltmain.sh (GNU libtool 1.2605 2008/03/04 22:31:32) 2.3a
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

dlname=''
library_names=''
old_library='libfakelib.a'
inherited_linker_flags=''
dependency_libs=''
weak_library_names=''
current=
age=
revision=
installed=no
shouldnotlink=yes
dlopen=''
dlpreopen=''
libdir=''
_ATEOF


mkdir sub
cp foo sub/foo
chmod +x foo sub/foo lt-wrapper lt-real

cat >liba.c <<'_ATEOF'
int a () { return 0; }
_ATEOF


cat >main.c <<'_ATEOF'
#include <stdio.h>
extern int a ();
int main (int argc, char **argv)
{
  int i;
  for (i=1; i<argc; ++i)
    {
      if (i != 1)
	fputc ('\n', stdout);
      fputs (argv[i], stdout);
    }
  fputc ('\n', stdout);
  return a ();
}
_ATEOF


LDFLAGS="$LDFLAGS -no-undefined"
instdir=`pwd`/inst
libdir=$instdir/lib

{ set +x
$as_echo "$at_srcdir/execute-mode.at:117: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c liba.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c liba.c" "execute-mode.at:117"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c liba.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:117"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/execute-mode.at:119: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la -rpath \$libdir liba.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la -rpath $libdir liba.lo" "execute-mode.at:119"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la -rpath $libdir liba.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:119"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/execute-mode.at:121: \$CC \$CPPFLAGS \$CFLAGS -c main.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c main.c" "execute-mode.at:121"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c main.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/execute-mode.at:123: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la" "execute-mode.at:123"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:123"
$at_failed && at_fn_log_failure
$at_traceon; }


# end of preparatory blurb.
# Now, when doing the tests, we both try the fake wrappers plus the real one
# (only the latter exposes the C wrappers used for w32 systems).
# With the latter, however, we need to ignore additional output; esp. wine
# may be rather noisy.

{ set +x
$as_echo "$at_srcdir/execute-mode.at:132: \$LIBTOOL --mode=execute ./foo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=execute ./foo" "execute-mode.at:132"
( $at_check_trace; $LIBTOOL --mode=execute ./foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:132"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/execute-mode.at:133: \$LIBTOOL --mode=execute sub/foo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=execute sub/foo" "execute-mode.at:133"
( $at_check_trace; $LIBTOOL --mode=execute sub/foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:133"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/execute-mode.at:134: \$LIBTOOL --mode=execute ./foo foo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=execute ./foo foo" "execute-mode.at:134"
( $at_check_trace; $LIBTOOL --mode=execute ./foo foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "foo
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:134"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/execute-mode.at:136: \$LIBTOOL --mode=execute ./lt-wrapper foo </dev/null"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=execute ./lt-wrapper foo </dev/null" "execute-mode.at:136"
( $at_check_trace; $LIBTOOL --mode=execute ./lt-wrapper foo </dev/null
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "foo
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:136"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/execute-mode.at:138: cd sub && \$LIBTOOL --mode=execute ./foo ../foo"
at_fn_check_prepare_dynamic "cd sub && $LIBTOOL --mode=execute ./foo ../foo" "execute-mode.at:138"
( $at_check_trace; cd sub && $LIBTOOL --mode=execute ./foo ../foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "../foo
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:138"
$at_failed && at_fn_log_failure
$at_traceon; }

# suppose that ./foo is gdb, and lt-wrapper is the wrapper script.
{ set +x
$as_echo "$at_srcdir/execute-mode.at:141: \$LIBTOOL --mode=execute ./foo lt-wrapper bar baz </dev/null"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=execute ./foo lt-wrapper bar baz </dev/null" "execute-mode.at:141"
( $at_check_trace; $LIBTOOL --mode=execute ./foo lt-wrapper bar baz </dev/null
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "./lt-real
bar
baz
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:141"
$at_failed && at_fn_log_failure
$at_traceon; }


# check that stdin works even with -dlopen.
{ set +x
$as_echo "$at_srcdir/execute-mode.at:148: echo bar | \$LIBTOOL --mode=execute -dlopen libfakelib.la ./lt-wrapper foo"
at_fn_check_prepare_notrace 'a shell pipeline' "execute-mode.at:148"
( $at_check_trace; echo bar | $LIBTOOL --mode=execute -dlopen libfakelib.la ./lt-wrapper foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "foo
bar
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:148"
$at_failed && at_fn_log_failure
$at_traceon; }


# Check that a missing real program causes an error.
# The error message and code are likely to be 126,
# "No such file or directory" but system-dependent.
mv -f lt-real lt-backup
{ set +x
$as_echo "$at_srcdir/execute-mode.at:157: \$LIBTOOL --mode=execute ./lt-wrapper foo </dev/null || exit 1"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=execute ./lt-wrapper foo </dev/null || exit 1" "execute-mode.at:157"
( $at_check_trace; $LIBTOOL --mode=execute ./lt-wrapper foo </dev/null || exit 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/execute-mode.at:157"
$at_failed && at_fn_log_failure
$at_traceon; }

mv -f lt-backup lt-real

# Now use arguments that require decent quoting.
{ set +x
$as_echo "$at_srcdir/execute-mode.at:162: \$LIBTOOL --mode=execute ./foo \"arg  with special chars: \\\$!&*'\\\`()\""
at_fn_check_prepare_notrace 'a `...` command substitution' "execute-mode.at:162"
( $at_check_trace; $LIBTOOL --mode=execute ./foo "arg  with special chars: \$!&*'\`()"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "arg  with special chars: \$!&*'\`()
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:162"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/execute-mode.at:165: \$LIBTOOL --mode=execute ./lt-wrapper \"arg  with special chars: \\\$!&*'\\\`()\" </dev/null"
at_fn_check_prepare_notrace 'a `...` command substitution' "execute-mode.at:165"
( $at_check_trace; $LIBTOOL --mode=execute ./lt-wrapper "arg  with special chars: \$!&*'\`()" </dev/null
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "arg  with special chars: \$!&*'\`()
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:165"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/execute-mode.at:168: \$LIBTOOL --mode=execute ./foo lt-wrapper \"arg  with special chars: \\\$!&*'\\\`()\""
at_fn_check_prepare_notrace 'a `...` command substitution' "execute-mode.at:168"
( $at_check_trace; $LIBTOOL --mode=execute ./foo lt-wrapper "arg  with special chars: \$!&*'\`()"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "./lt-real
arg  with special chars: \$!&*'\`()
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:168"
$at_failed && at_fn_log_failure
$at_traceon; }

lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/execute-mode.at:172: if \$LIBTOOL --mode=execute  \"\$lt_exe\" \"arg  with special chars: \\\$!&*'\\\`()\"; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a `...` command substitution' "execute-mode.at:172"
( $at_check_trace; if $LIBTOOL --mode=execute  "$lt_exe" "arg  with special chars: \$!&*'\`()"; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:172"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/execute-mode.at:174: \$FGREP 'arg  with special chars: \$!&*'\\''\`()' stdout"
at_fn_check_prepare_notrace 'a `...` command substitution' "execute-mode.at:174"
( $at_check_trace; $FGREP 'arg  with special chars: $!&*'\''`()' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:174"
$at_failed && at_fn_log_failure
$at_traceon; }


# We always pair two args.  The first one is never the empty string.
arg1=
for arg2 in \
   'def ghi' '' \
   'd"e' 'f"g' \
   'd\"e' 'f\"g' \
   'd\\"e' 'f\\"g' \
   'd\\\"e' 'f\\\"g' \
   'd\' '' \
   'd\\' '' \
   'd\\\' '' \
   'd\\\\' '' \
   '<' '>' \
   '<def>' ''
do
  if test -z "$arg1"; then
    arg1=$arg2; continue
  fi
  { set +x
$as_echo "$at_srcdir/execute-mode.at:194: \$LIBTOOL --mode=execute ./foo abc \"\$arg1\" \"\$arg2\" xyz"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=execute ./foo abc \"$arg1\" \"$arg2\" xyz" "execute-mode.at:194"
( $at_check_trace; $LIBTOOL --mode=execute ./foo abc "$arg1" "$arg2" xyz
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:194"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/execute-mode.at:195: \$FGREP \"\$arg1\" stdout"
at_fn_check_prepare_dynamic "$FGREP \"$arg1\" stdout" "execute-mode.at:195"
( $at_check_trace; $FGREP "$arg1" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:195"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/execute-mode.at:196: test -z \"\$arg2\" || \$FGREP \"\$arg2\" stdout"
at_fn_check_prepare_dynamic "test -z \"$arg2\" || $FGREP \"$arg2\" stdout" "execute-mode.at:196"
( $at_check_trace; test -z "$arg2" || $FGREP "$arg2" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:196"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/execute-mode.at:197: test \`\$SED -n '/^abc\$/,/^xyz\$/p' stdout | wc -l\` -eq 4"
at_fn_check_prepare_notrace 'a `...` command substitution' "execute-mode.at:197"
( $at_check_trace; test `$SED -n '/^abc$/,/^xyz$/p' stdout | wc -l` -eq 4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:197"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/execute-mode.at:198: \$LIBTOOL --mode=execute ./lt-wrapper abc \"\$arg1\" \"\$arg2\" xyz </dev/null"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=execute ./lt-wrapper abc \"$arg1\" \"$arg2\" xyz </dev/null" "execute-mode.at:198"
( $at_check_trace; $LIBTOOL --mode=execute ./lt-wrapper abc "$arg1" "$arg2" xyz </dev/null
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:198"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/execute-mode.at:199: \$FGREP \"\$arg1\" stdout"
at_fn_check_prepare_dynamic "$FGREP \"$arg1\" stdout" "execute-mode.at:199"
( $at_check_trace; $FGREP "$arg1" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:199"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/execute-mode.at:200: test -z \"\$arg2\" || \$FGREP \"\$arg2\" stdout"
at_fn_check_prepare_dynamic "test -z \"$arg2\" || $FGREP \"$arg2\" stdout" "execute-mode.at:200"
( $at_check_trace; test -z "$arg2" || $FGREP "$arg2" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:200"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/execute-mode.at:201: test \`\$SED -n '/^abc\$/,/^xyz\$/p' stdout | wc -l\` -eq 4"
at_fn_check_prepare_notrace 'a `...` command substitution' "execute-mode.at:201"
( $at_check_trace; test `$SED -n '/^abc$/,/^xyz$/p' stdout | wc -l` -eq 4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:201"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/execute-mode.at:202: \$LIBTOOL --mode=execute ./foo lt-wrapper abc \"\$arg1\" \"\$arg2\" xyz"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=execute ./foo lt-wrapper abc \"$arg1\" \"$arg2\" xyz" "execute-mode.at:202"
( $at_check_trace; $LIBTOOL --mode=execute ./foo lt-wrapper abc "$arg1" "$arg2" xyz
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:202"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/execute-mode.at:203: \$FGREP \"\$arg1\" stdout"
at_fn_check_prepare_dynamic "$FGREP \"$arg1\" stdout" "execute-mode.at:203"
( $at_check_trace; $FGREP "$arg1" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:203"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/execute-mode.at:204: test -z \"\$arg2\" || \$FGREP \"\$arg2\" stdout"
at_fn_check_prepare_dynamic "test -z \"$arg2\" || $FGREP \"$arg2\" stdout" "execute-mode.at:204"
( $at_check_trace; test -z "$arg2" || $FGREP "$arg2" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/execute-mode.at:205: test \`\$SED -n '/^abc\$/,/^xyz\$/p' stdout | wc -l\` -eq 4"
at_fn_check_prepare_notrace 'a `...` command substitution' "execute-mode.at:205"
( $at_check_trace; test `$SED -n '/^abc$/,/^xyz$/p' stdout | wc -l` -eq 4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/execute-mode.at:206: \$LIBTOOL --mode=execute ./main\$EXEEXT abc \"\$arg1\" \"\$arg2\" xyz"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=execute ./main$EXEEXT abc \"$arg1\" \"$arg2\" xyz" "execute-mode.at:206"
( $at_check_trace; $LIBTOOL --mode=execute ./main$EXEEXT abc "$arg1" "$arg2" xyz
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/execute-mode.at:207: \$FGREP \"\$arg1\" stdout"
at_fn_check_prepare_dynamic "$FGREP \"$arg1\" stdout" "execute-mode.at:207"
( $at_check_trace; $FGREP "$arg1" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:207"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/execute-mode.at:208: test -z \"\$arg2\" || \$FGREP \"\$arg2\" stdout"
at_fn_check_prepare_dynamic "test -z \"$arg2\" || $FGREP \"$arg2\" stdout" "execute-mode.at:208"
( $at_check_trace; test -z "$arg2" || $FGREP "$arg2" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:208"
$at_failed && at_fn_log_failure
$at_traceon; }

  # Do not match EOL here, cross setups may have an extra \r here.
  { set +x
$as_echo "$at_srcdir/execute-mode.at:210: test \`\$SED -n '/^abc/,/^xyz/p' stdout | wc -l\` -eq 4"
at_fn_check_prepare_notrace 'a `...` command substitution' "execute-mode.at:210"
( $at_check_trace; test `$SED -n '/^abc/,/^xyz/p' stdout | wc -l` -eq 4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:210"
$at_failed && at_fn_log_failure
$at_traceon; }

  arg1=
done

# Check that .la files are not transformed by the wrapper searching loop.
{ set +x
$as_echo "$at_srcdir/execute-mode.at:215: \$LIBTOOL --mode=execute echo ./main\$EXEEXT liba.lo libfakelib.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=execute echo ./main$EXEEXT liba.lo libfakelib.la" "execute-mode.at:215"
( $at_check_trace; $LIBTOOL --mode=execute echo ./main$EXEEXT liba.lo libfakelib.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:215"
$at_failed && at_fn_log_failure
$at_traceon; }

# This could be .libs/lt-main or similar (or just plain 'main').
{ set +x
$as_echo "$at_srcdir/execute-mode.at:217: \$GREP main stdout"
at_fn_check_prepare_dynamic "$GREP main stdout" "execute-mode.at:217"
( $at_check_trace; $GREP main stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:217"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/execute-mode.at:218: \$GREP liba.lo stdout"
at_fn_check_prepare_dynamic "$GREP liba.lo stdout" "execute-mode.at:218"
( $at_check_trace; $GREP liba.lo stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:218"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/execute-mode.at:219: \$GREP libfakelib.la stdout"
at_fn_check_prepare_dynamic "$GREP libfakelib.la stdout" "execute-mode.at:219"
( $at_check_trace; $GREP libfakelib.la stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/execute-mode.at:219"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_81
#AT_START_82
at_fn_group_banner 82 'bindir.at:64' \
  "bindir basic lib test" "                          " 7
at_xfail=no
(
  $as_echo "82. $at_setup_line: testing $at_desc ..."
  $at_traceon


bindirneeded=:
case $host_os in
  cygwin*|mingw*|cegcc*)
    ;;
  *)
    bindirneeded=false
    ;;
esac

####
# These routines save the PATH before a test and restore it after,
# prepending a chosen directory to the path on the platforms where
# -bindir is needed after saving.
#

func_save_and_prepend_path ()
{
  save_PATH=$PATH
  if $bindirneeded; then
    PATH=$1$PATH_SEPARATOR$PATH
  fi
  export PATH
}

func_restore_path ()
{
  PATH=$save_PATH
  export PATH
}

cat >foo.c <<'_ATEOF'

int x=11;
_ATEOF


cat >baz.c <<'_ATEOF'

extern int x;
int baz (void);
int baz (void) { return x;}
_ATEOF


cat >bar.c <<'_ATEOF'

extern int baz (void);
int y=3;
int bar (void);
int bar (void) { return y + baz ();}
_ATEOF


cat >main.c <<'_ATEOF'

#include <stdlib.h>
extern int baz (void);
extern int bar (void);
int main() {
if (baz () + bar () - 25) abort ();
return 0;
}
_ATEOF



curdir=`pwd`
eval "`$LIBTOOL --config | $GREP '^objdir='`"

{ set +x
$as_echo "$at_srcdir/bindir.at:127: \$LIBTOOL --mode=compile --tag=CC \$CC -c -o foo.lo \$CPPFLAGS \$CFLAGS foo.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CC $CC -c -o foo.lo $CPPFLAGS $CFLAGS foo.c" "bindir.at:127"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CC $CC -c -o foo.lo $CPPFLAGS $CFLAGS foo.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:127"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/bindir.at:128: \$LIBTOOL --mode=compile --tag=CC \$CC -c -o baz.lo \$CPPFLAGS \$CFLAGS baz.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CC $CC -c -o baz.lo $CPPFLAGS $CFLAGS baz.c" "bindir.at:128"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CC $CC -c -o baz.lo $CPPFLAGS $CFLAGS baz.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:128"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/bindir.at:129: \$LIBTOOL --mode=link --tag=CC \$CC -no-undefined -o libfoo.la \$CPPFLAGS \$CFLAGS \$LDFLAGS foo.lo baz.lo -rpath \$curdir/\$objdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC -no-undefined -o libfoo.la $CPPFLAGS $CFLAGS $LDFLAGS foo.lo baz.lo -rpath $curdir/$objdir" "bindir.at:129"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC -no-undefined -o libfoo.la $CPPFLAGS $CFLAGS $LDFLAGS foo.lo baz.lo -rpath $curdir/$objdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:129"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/bindir.at:131: \$LIBTOOL --mode=compile --tag=CC \$CC -c -o bar.lo \$CPPFLAGS \$CFLAGS bar.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CC $CC -c -o bar.lo $CPPFLAGS $CFLAGS bar.c" "bindir.at:131"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CC $CC -c -o bar.lo $CPPFLAGS $CFLAGS bar.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:131"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/bindir.at:132: \$LIBTOOL --mode=link --tag=CC \$CC -no-undefined -o libbar.la \$CPPFLAGS \$CFLAGS \$LDFLAGS bar.lo libfoo.la -rpath \$curdir/\$objdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC -no-undefined -o libbar.la $CPPFLAGS $CFLAGS $LDFLAGS bar.lo libfoo.la -rpath $curdir/$objdir" "bindir.at:132"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC -no-undefined -o libbar.la $CPPFLAGS $CFLAGS $LDFLAGS bar.lo libfoo.la -rpath $curdir/$objdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:132"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/bindir.at:134: \$LIBTOOL --mode=compile --tag=CC \$CC -c -o main.lo \$CPPFLAGS \$CFLAGS main.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CC $CC -c -o main.lo $CPPFLAGS $CFLAGS main.c" "bindir.at:134"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CC $CC -c -o main.lo $CPPFLAGS $CFLAGS main.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:134"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/bindir.at:135: \$LIBTOOL --mode=link --tag=CC \$CC -o main\$EXEEXT \$CPPFLAGS \$CFLAGS \$LDFLAGS main.lo libbar.la libfoo.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC -o main$EXEEXT $CPPFLAGS $CFLAGS $LDFLAGS main.lo libbar.la libfoo.la" "bindir.at:135"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC -o main$EXEEXT $CPPFLAGS $CFLAGS $LDFLAGS main.lo libbar.la libfoo.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:135"
$at_failed && at_fn_log_failure
$at_traceon; }


# Check both static and shared versions run.  We don't install them
# here, that will be covered by the later tests; we've rpath'd things
# so that they can all be run in situ.

lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/bindir.at:141: if \$LIBTOOL --mode=execute  \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if $LIBTOOL --mode=execute  \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "bindir.at:141"
( $at_check_trace; if $LIBTOOL --mode=execute  "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:141"
$at_failed && at_fn_log_failure
$at_traceon; }



# Ensure libraries can be found on PATH, if we are on one
# of the affected platforms, before testing the shared version.

func_save_and_prepend_path "$curdir/$objdir"
$bindirneeded && {
  lt_exe=$objdir/main; if test -f "$objdir/main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/bindir.at:148: if \$LIBTOOL --mode=execute  \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if $LIBTOOL --mode=execute  \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "bindir.at:148"
( $at_check_trace; if $LIBTOOL --mode=execute  "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:148"
$at_failed && at_fn_log_failure
$at_traceon; }


}

#  In fact, prepending the PATH as above is superfluous on the windows
# platforms that this feature is primarily aimed at, as the DLL search
# path always includes the directory from which the app was launched.
# To make sure it still works even when not side-by-side, we'll install
# the main executable and execute it from there while the PATH still
# points to the shared libs in the .libs subdir.  On other platforms,
# the rpaths we set at link time will guarantee it runs from the bindir.

mkdir $curdir/bin
{ set +x
$as_echo "$at_srcdir/bindir.at:160: \$LIBTOOL --mode=install \$lt_INSTALL main\$EXEEXT \$curdir/bin/main\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install $lt_INSTALL main$EXEEXT $curdir/bin/main$EXEEXT" "bindir.at:160"
( $at_check_trace; $LIBTOOL --mode=install $lt_INSTALL main$EXEEXT $curdir/bin/main$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:160"
$at_failed && at_fn_log_failure
$at_traceon; }

lt_exe=$curdir/bin/main$EXEEXT; if test -f "$curdir/bin/main$EXEEXT$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/bindir.at:161: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "bindir.at:161"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:161"
$at_failed && at_fn_log_failure
$at_traceon; }


func_restore_path

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_82
#AT_START_83
at_fn_group_banner 83 'bindir.at:173' \
  "bindir install tests" "                           " 7
at_xfail=no
(
  $as_echo "83. $at_setup_line: testing $at_desc ..."
  $at_traceon


bindirneeded=:
case $host_os in
  cygwin*|mingw*|cegcc*)
    ;;
  *)
    bindirneeded=false
    ;;
esac

eval "`$LIBTOOL --config | $GREP '^build_libtool_libs='`"
{ set +x
$as_echo "$at_srcdir/bindir.at:185: test yes = \"\$build_libtool_libs\" || exit 77"
at_fn_check_prepare_dynamic "test yes = \"$build_libtool_libs\" || exit 77" "bindir.at:185"
( $at_check_trace; test yes = "$build_libtool_libs" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }


####
# These routines save the PATH before a test and restore it after,
# prepending a chosen directory to the path on the platforms where
# -bindir is needed after saving.
#

func_save_and_prepend_path ()
{
  save_PATH=$PATH
  if $bindirneeded; then
    PATH=$1$PATH_SEPARATOR$PATH
  fi
  export PATH
}

func_restore_path ()
{
  PATH=$save_PATH
  export PATH
}

cat >foo.c <<'_ATEOF'

int x=11;
_ATEOF


cat >baz.c <<'_ATEOF'

extern int x;
int baz (void);
int baz (void) { return x;}
_ATEOF


cat >bar.c <<'_ATEOF'

extern int baz (void);
int y=3;
int bar (void);
int bar (void) { return y + baz ();}
_ATEOF


cat >main.c <<'_ATEOF'

#include <stdlib.h>
extern int baz (void);
extern int bar (void);
int main() {
if (baz () + bar () - 25) abort ();
return 0;
}
_ATEOF


# We only need to compile once, but we'll need to relink for each different value
# of libdir in order to set the rpath, and we'll install for each combination of
# libdir and bindir.

{ set +x
$as_echo "$at_srcdir/bindir.at:239: \$LIBTOOL --mode=compile --tag=CC \$CC -c -o foo.lo \$CPPFLAGS \$CFLAGS foo.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CC $CC -c -o foo.lo $CPPFLAGS $CFLAGS foo.c" "bindir.at:239"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CC $CC -c -o foo.lo $CPPFLAGS $CFLAGS foo.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:239"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/bindir.at:240: \$LIBTOOL --mode=compile --tag=CC \$CC -c -o baz.lo \$CPPFLAGS \$CFLAGS baz.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CC $CC -c -o baz.lo $CPPFLAGS $CFLAGS baz.c" "bindir.at:240"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CC $CC -c -o baz.lo $CPPFLAGS $CFLAGS baz.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:240"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/bindir.at:241: \$LIBTOOL --mode=compile --tag=CC \$CC -c -o bar.lo \$CPPFLAGS \$CFLAGS bar.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CC $CC -c -o bar.lo $CPPFLAGS $CFLAGS bar.c" "bindir.at:241"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CC $CC -c -o bar.lo $CPPFLAGS $CFLAGS bar.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:241"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/bindir.at:242: \$LIBTOOL --mode=compile --tag=CC \$CC -c -o main.lo \$CPPFLAGS \$CFLAGS main.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CC $CC -c -o main.lo $CPPFLAGS $CFLAGS main.c" "bindir.at:242"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CC $CC -c -o main.lo $CPPFLAGS $CFLAGS main.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:242"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now try installing the libs.  There are the following cases:
# No -bindir
# -bindir below lib install dir
# -bindir is lib install dir
# -bindir beside lib install dir
# -bindir above lib dir
# -bindir above and beside lib dir
# -bindir in entirely unrelated prefix.

curdir=`pwd`
for libdir in \
	$curdir/usr/lib/gcc/i686-pc-cygwin/4.5.0 \
	$curdir/usr/lib/gcc/../gcc/.//i686-pc-cygwin/4.5.0/../../././//. \
	$curdir/usr/lib/ \
	$curdir/usr/lib \
	$curdir/baz \
	$curdir/baz/lib/;
do

  # Do a basic install with no -bindir option for reference.  We use the sbin/
  # dir for the main exe to avoid the potential "this only works because it's
  # side-by-side with the libs" default DLL search path problem mentioned above.
  rm -rf $libdir $curdir/bin $curdir/sbin $curdir/baz $curdir/usr
  as_dir=$libdir; as_fn_mkdir_p
  as_dir=$curdir/sbin; as_fn_mkdir_p
  { set +x
$as_echo "$at_srcdir/bindir.at:269: \$LIBTOOL --mode=link --tag=CC \$CC -no-undefined -o libfoo.la \$CPPFLAGS \$CFLAGS \$LDFLAGS foo.lo bar.lo baz.lo -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC -no-undefined -o libfoo.la $CPPFLAGS $CFLAGS $LDFLAGS foo.lo bar.lo baz.lo -rpath $libdir" "bindir.at:269"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC -no-undefined -o libfoo.la $CPPFLAGS $CFLAGS $LDFLAGS foo.lo bar.lo baz.lo -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:269"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/bindir.at:270: \$LIBTOOL --mode=link --tag=CC \$CC -o main\$EXEEXT \$CPPFLAGS \$CFLAGS \$LDFLAGS main.lo libfoo.la -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC -o main$EXEEXT $CPPFLAGS $CFLAGS $LDFLAGS main.lo libfoo.la -rpath $libdir" "bindir.at:270"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC -o main$EXEEXT $CPPFLAGS $CFLAGS $LDFLAGS main.lo libfoo.la -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:270"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/bindir.at:271: \$LIBTOOL --mode=install \$lt_INSTALL libfoo.la \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install $lt_INSTALL libfoo.la $libdir" "bindir.at:271"
( $at_check_trace; $LIBTOOL --mode=install $lt_INSTALL libfoo.la $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:271"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/bindir.at:272: \$LIBTOOL --mode=install \$lt_INSTALL main\$EXEEXT \$curdir/sbin/main\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install $lt_INSTALL main$EXEEXT $curdir/sbin/main$EXEEXT" "bindir.at:272"
( $at_check_trace; $LIBTOOL --mode=install $lt_INSTALL main$EXEEXT $curdir/sbin/main$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:272"
$at_failed && at_fn_log_failure
$at_traceon; }


  # And ensure it went where we expect.  Could be looking for any of
  # 'cygfoo-0.dll', 'libfoo-0.dll', 'foo-0.dll', or 'libfoo.so.0'.  We'll
  # simplify this check by taking advantage of the fact that if it's a DLL,
  # it has to go in bindir, so we'll not check for both forms in libdir.
  if $bindirneeded; then
    { set +x
$as_echo "$at_srcdir/bindir.at:279: test -f \"\$libdir\"/../bin/???foo-0.dll || ls \"\$libdir\"/../bin/*foo*0*"
at_fn_check_prepare_dynamic "test -f \"$libdir\"/../bin/???foo-0.dll || ls \"$libdir\"/../bin/*foo*0*" "bindir.at:279"
( $at_check_trace; test -f "$libdir"/../bin/???foo-0.dll || ls "$libdir"/../bin/*foo*0*
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:279"
$at_failed && at_fn_log_failure
$at_traceon; }

  else
    { set +x
$as_echo "$at_srcdir/bindir.at:281: ls \$libdir/*foo*"
at_fn_check_prepare_dynamic "ls $libdir/*foo*" "bindir.at:281"
( $at_check_trace; ls $libdir/*foo*
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:281"
$at_failed && at_fn_log_failure
$at_traceon; }

  fi

  # And that it can be executed.
  func_save_and_prepend_path "$libdir/../bin"
  lt_exe=$curdir/sbin/main$EXEEXT; if test -f "$curdir/sbin/main$EXEEXT$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/bindir.at:286: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "bindir.at:286"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:286"
$at_failed && at_fn_log_failure
$at_traceon; }


  func_restore_path

  for bindir in \
	$curdir/usr/lib/gcc/i686-pc-cygwin/4.5.0/bin/ \
	$curdir/usr/lib/gcc/i686-pc-cygwin/4.5.0/bin \
	$curdir/usr/lib/gcc/i686-pc-cygwin/bin \
	$curdir/usr/lib/bin \
	$curdir/usr/bin/ \
	$curdir/usr/bin \
	/tmp/foo/bar;
  do

    # Clear any old stuff out before we install.  Because bindir
    # may be in /tmp, we have to take care to create it securely
    # and not to delete and recreate it if we do.
    rm -rf $libdir $curdir/bin $curdir/sbin $curdir/baz $curdir/usr

    tmp=
    case $bindir in
      /tmp*)
        # Create a temporary directory $tmp in $TMPDIR (default /tmp).
        # Use mktemp if possible; otherwise fall back on mkdir,
        # with $RANDOM to make collisions less likely.
        : ${TMPDIR=/tmp}
        {
          tmp=`
            (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null
          ` &&
          test -n "$tmp" && test -d "$tmp"
        } || {
          tmp=$TMPDIR/foo$$-$RANDOM
          (umask 077 && mkdir "$tmp")
        } || { set +x
$as_echo "$at_srcdir/bindir.at:319: exit 77"
at_fn_check_prepare_trace "bindir.at:319"
( $at_check_trace; exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:319"
$at_failed && at_fn_log_failure
$at_traceon; }

        bindir=$tmp/bar
      ;;
      *)
        # Clear any old stuff out before we install.
        rm -rf $bindir
        as_dir=$bindir; as_fn_mkdir_p
      ;;
    esac

    # Relink with new rpaths.
    { set +x
$as_echo "$at_srcdir/bindir.at:330: \$LIBTOOL --mode=link --tag=CC \$CC -no-undefined -bindir \$bindir -o libfoo.la \$CPPFLAGS \$CFLAGS \$LDFLAGS foo.lo bar.lo baz.lo -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC -no-undefined -bindir $bindir -o libfoo.la $CPPFLAGS $CFLAGS $LDFLAGS foo.lo bar.lo baz.lo -rpath $libdir" "bindir.at:330"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC -no-undefined -bindir $bindir -o libfoo.la $CPPFLAGS $CFLAGS $LDFLAGS foo.lo bar.lo baz.lo -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:330"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/bindir.at:331: \$LIBTOOL --mode=link --tag=CC \$CC -o main\$EXEEXT \$CPPFLAGS \$CFLAGS \$LDFLAGS main.lo libfoo.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC -o main$EXEEXT $CPPFLAGS $CFLAGS $LDFLAGS main.lo libfoo.la" "bindir.at:331"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC -o main$EXEEXT $CPPFLAGS $CFLAGS $LDFLAGS main.lo libfoo.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:331"
$at_failed && at_fn_log_failure
$at_traceon; }


    # Recreate directories (bindir already done) and install.
    as_dir=$libdir; as_fn_mkdir_p
    as_dir=$curdir/sbin; as_fn_mkdir_p
    { set +x
$as_echo "$at_srcdir/bindir.at:336: \$LIBTOOL --mode=install \$lt_INSTALL libfoo.la \"\$libdir\""
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install $lt_INSTALL libfoo.la \"$libdir\"" "bindir.at:336"
( $at_check_trace; $LIBTOOL --mode=install $lt_INSTALL libfoo.la "$libdir"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:336"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/bindir.at:337: \$LIBTOOL --mode=install \$lt_INSTALL main\$EXEEXT \"\$curdir/sbin/main\$EXEEXT\""
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install $lt_INSTALL main$EXEEXT \"$curdir/sbin/main$EXEEXT\"" "bindir.at:337"
( $at_check_trace; $LIBTOOL --mode=install $lt_INSTALL main$EXEEXT "$curdir/sbin/main$EXEEXT"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:337"
$at_failed && at_fn_log_failure
$at_traceon; }


    # Ensure it went to bindir rather than default dir this time.
    if $bindirneeded; then
      { set +x
$as_echo "$at_srcdir/bindir.at:341: test -f \"\$bindir\"/???foo-0.dll || ls \"\$bindir\"/*foo*0*"
at_fn_check_prepare_dynamic "test -f \"$bindir\"/???foo-0.dll || ls \"$bindir\"/*foo*0*" "bindir.at:341"
( $at_check_trace; test -f "$bindir"/???foo-0.dll || ls "$bindir"/*foo*0*
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:341"
$at_failed && at_fn_log_failure
$at_traceon; }

    else
      { set +x
$as_echo "$at_srcdir/bindir.at:343: ls \"\$libdir\"/*foo*"
at_fn_check_prepare_dynamic "ls \"$libdir\"/*foo*" "bindir.at:343"
( $at_check_trace; ls "$libdir"/*foo*
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:343"
$at_failed && at_fn_log_failure
$at_traceon; }

    fi

    # And that it can be executed.
    func_save_and_prepend_path "$bindir"
    lt_exe=$curdir/sbin/main$EXEEXT; if test -f "$curdir/sbin/main$EXEEXT$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/bindir.at:348: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "bindir.at:348"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/bindir.at:348"
$at_failed && at_fn_log_failure
$at_traceon; }


    func_restore_path

    # Clean up if we made a temp dir.  Subdirs under our testdir get rm'd
    # and recreated at the top of the loop.  Securely created subdirs under
    # /tmp get created precisely once and rm'd when we're done with them.
    if test ! -z "$tmp"; then
      rm -rf "$tmp"
    fi

  done
done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_83
#AT_START_84
at_fn_group_banner 84 'cwrapper.at:25' \
  "cwrapper for uninstalled executables" "           " 7
at_xfail=no
(
  $as_echo "84. $at_setup_line: testing $at_desc ..."
  $at_traceon



# make sure existing libtool is configured for shared libraries
{ set +x
$as_echo "$at_srcdir/cwrapper.at:29: \$LIBTOOL --features | \$GREP 'disable shared libraries' && exit 77"
at_fn_check_prepare_notrace 'a shell pipeline' "cwrapper.at:29"
( $at_check_trace; $LIBTOOL --features | $GREP 'disable shared libraries' && exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/cwrapper.at:29"
$at_failed && at_fn_log_failure
$at_traceon; }


cat >trivial.c <<'_ATEOF'

int main (void)
{
  return 0;
}
_ATEOF

cat >liba.c <<'_ATEOF'
int liba_func1 (int arg)
{
  return arg + 1;
}
_ATEOF

cat >usea.c <<'_ATEOF'
extern int liba_func1 (int arg);
int main (void)
{
  int a = 2;
  int b = liba_func1 (a);
  if (b == 3) return 0;
  return 1;
}
_ATEOF


orig_CFLAGS=$CFLAGS
orig_LIBTOOL=$LIBTOOL
for restrictive_flags in '-Wall -Werror' '-std=c89 -Wall -Werror' '-std=c99 -Wall -Werror'; do
  CFLAGS="$orig_CFLAGS $restrictive_flags"
  $SED "s/LTCFLAGS=.*/&' $restrictive_flags'/" < "$orig_LIBTOOL" > ./libtool
  chmod +x libtool
  LIBTOOL=./libtool

  # Make sure $restrictive_flags do not cause a failure
  # themselves (e.g. because a non-gcc compiler doesn't
  # understand them).  Tru64 cc only fails when linking.
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS trivial.c || continue

  { set +x
$as_echo "$at_srcdir/cwrapper.at:69: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c liba.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c liba.c" "cwrapper.at:69"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c liba.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:69"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/cwrapper.at:71: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -version-info=0.0.0 -no-undefined -o liba.la -rpath /foo liba.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -version-info=0.0.0 -no-undefined -o liba.la -rpath /foo liba.lo" "cwrapper.at:71"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -version-info=0.0.0 -no-undefined -o liba.la -rpath /foo liba.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:71"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/cwrapper.at:73: test -f liba.la"
at_fn_check_prepare_trace "cwrapper.at:73"
( $at_check_trace; test -f liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:73"
$at_failed && at_fn_log_failure
$at_traceon; }


  { set +x
$as_echo "$at_srcdir/cwrapper.at:75: \$CC \$CPPFLAGS \$CFLAGS -c usea.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c usea.c" "cwrapper.at:75"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c usea.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:75"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/cwrapper.at:77: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o usea\$EXEEXT usea.\$OBJEXT liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o usea$EXEEXT usea.$OBJEXT liba.la" "cwrapper.at:77"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o usea$EXEEXT usea.$OBJEXT liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:77"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./usea; if test -f "./usea$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/cwrapper.at:79: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "cwrapper.at:79"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:79"
$at_failed && at_fn_log_failure
$at_traceon; }


done


# Test run-time activation of wrapper debugging.
# This is not part of the loop above, because we
# need to check, not ignore, the output.
CFLAGS=$orig_CFLAGS
LIBTOOL=$orig_LIBTOOL

{ set +x
$as_echo "$at_srcdir/cwrapper.at:89: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c liba.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c liba.c" "cwrapper.at:89"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c liba.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:89"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/cwrapper.at:91: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -no-undefined -o liba.la -rpath /foo liba.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -no-undefined -o liba.la -rpath /foo liba.lo" "cwrapper.at:91"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -no-undefined -o liba.la -rpath /foo liba.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:91"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/cwrapper.at:93: test -f liba.la"
at_fn_check_prepare_trace "cwrapper.at:93"
( $at_check_trace; test -f liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:93"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/cwrapper.at:95: \$CC \$CPPFLAGS \$CFLAGS -c usea.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c usea.c" "cwrapper.at:95"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c usea.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:95"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/cwrapper.at:97: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o usea\$EXEEXT usea.\$OBJEXT liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o usea$EXEEXT usea.$OBJEXT liba.la" "cwrapper.at:97"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o usea$EXEEXT usea.$OBJEXT liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:97"
$at_failed && at_fn_log_failure
$at_traceon; }

lt_exe=./usea; if test -f "./usea$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/cwrapper.at:99: if \"\$lt_exe\" --lt-debug; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" --lt-debug; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "cwrapper.at:99"
( $at_check_trace; if "$lt_exe" --lt-debug; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:99"
$at_failed && at_fn_log_failure
$at_traceon; }


case $host_os in
  mingw*)
    tr -d '\015' < stderr > stderr.t
    mv -f stderr.t stderr ;;
esac
{ set +x
$as_echo "$at_srcdir/cwrapper.at:101: \$GREP 'libtool wrapper' stderr"
at_fn_check_prepare_dynamic "$GREP 'libtool wrapper' stderr" "cwrapper.at:101"
( $at_check_trace; $GREP 'libtool wrapper' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:101"
$at_failed && at_fn_log_failure
$at_traceon; }



# Test compile-time activation of wrapper debugging.
# We structure this test as a loop, so that we can 'break' out of it
# if necessary -- even though the loop by design executes only once.
for debugwrapper_flags in '-DLT_DEBUGWRAPPER'; do
  CFLAGS="$orig_CFLAGS $debugwrapper_flags"
  $SED -e "s/LTCFLAGS=.*/&' $debugwrapper_flags'/" \
       -e "s/^lt_option_debug=/lt_option_debug=1/" \
    < "$orig_LIBTOOL" > ./libtool
  LIBTOOL=./libtool

  # Make sure $debugwrapper_flags do not cause a failure
  # themselves (e.g. because a non-gcc compiler doesn't
  # understand them).  Tru64 cc only fails when linking.
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS trivial.c || continue

  { set +x
$as_echo "$at_srcdir/cwrapper.at:119: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c liba.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c liba.c" "cwrapper.at:119"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c liba.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:119"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/cwrapper.at:121: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -no-undefined -o liba.la -rpath /foo liba.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -no-undefined -o liba.la -rpath /foo liba.lo" "cwrapper.at:121"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -no-undefined -o liba.la -rpath /foo liba.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/cwrapper.at:123: test -f liba.la"
at_fn_check_prepare_trace "cwrapper.at:123"
( $at_check_trace; test -f liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:123"
$at_failed && at_fn_log_failure
$at_traceon; }


  { set +x
$as_echo "$at_srcdir/cwrapper.at:125: \$CC \$CPPFLAGS \$CFLAGS -c usea.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c usea.c" "cwrapper.at:125"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c usea.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:125"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/cwrapper.at:127: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o usea\$EXEEXT usea.\$OBJEXT liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o usea$EXEEXT usea.$OBJEXT liba.la" "cwrapper.at:127"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o usea$EXEEXT usea.$OBJEXT liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:127"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./usea; if test -f "./usea$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/cwrapper.at:129: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "cwrapper.at:129"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:129"
$at_failed && at_fn_log_failure
$at_traceon; }


  case $host_os in
  mingw*)
    tr -d '\015' < stderr > stderr.t
    mv -f stderr.t stderr ;;
esac
  { set +x
$as_echo "$at_srcdir/cwrapper.at:131: \$GREP 'libtool wrapper' stderr"
at_fn_check_prepare_dynamic "$GREP 'libtool wrapper' stderr" "cwrapper.at:131"
( $at_check_trace; $GREP 'libtool wrapper' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:131"
$at_failed && at_fn_log_failure
$at_traceon; }

done


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_84
#AT_START_85
at_fn_group_banner 85 'cwrapper.at:138' \
  "cwrapper string length" "                         " 7
at_xfail=no
(
  $as_echo "85. $at_setup_line: testing $at_desc ..."
  $at_traceon


eval "`$LIBTOOL --config | $EGREP '^(objdir)='`"

cat >liba.c <<'_ATEOF'
int liba_func1 (int arg)
{
  return arg + 1;
}
_ATEOF

cat >usea.c <<'_ATEOF'
extern int liba_func1 (int arg);
int main (void)
{
  int a = 2;
  int b = liba_func1 (a);
  if (b == 3) return 0;
  return 1;
}
_ATEOF


{ set +x
$as_echo "$at_srcdir/cwrapper.at:159: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c liba.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c liba.c" "cwrapper.at:159"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c liba.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:159"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/cwrapper.at:161: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -no-undefined 	 -o liba.la -rpath /foo liba.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -no-undefined 	 -o liba.la -rpath /foo liba.lo" "cwrapper.at:161"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -no-undefined 	 -o liba.la -rpath /foo liba.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:161"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/cwrapper.at:164: \$CC \$CPPFLAGS \$CFLAGS -c usea.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c usea.c" "cwrapper.at:164"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c usea.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:164"
$at_failed && at_fn_log_failure
$at_traceon; }



# Make sure PATH is at least 250 chars, which should force line breaks
# in lt-usea.c.

dirpath=
save_IFS=$IFS
IFS=$PATH_SEPARATOR
for dirpath in $PATH; do
  IFS=$save_IFS
  break
done
IFS=$save_IFS

until $ECHO "PATH=$PATH" | $GREP 'PATH=.\{250\}'; do
  PATH=$PATH$PATH_SEPARATOR$dirpath
done
export PATH

{ set +x
$as_echo "$at_srcdir/cwrapper.at:185: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -no-fast-install 	 -o usea\$EXEEXT usea.\$OBJEXT liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -no-fast-install 	 -o usea$EXEEXT usea.$OBJEXT liba.la" "cwrapper.at:185"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -no-fast-install 	 -o usea$EXEEXT usea.$OBJEXT liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }


# Skip if no cwrapper is generated.
{ set +x
$as_echo "$at_srcdir/cwrapper.at:190: test -f \"\$objdir/lt-usea.c\" || exit 77"
at_fn_check_prepare_dynamic "test -f \"$objdir/lt-usea.c\" || exit 77" "cwrapper.at:190"
( $at_check_trace; test -f "$objdir/lt-usea.c" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:190"
$at_failed && at_fn_log_failure
$at_traceon; }


# Try to make sure the test is relevant.
{ set +x
$as_echo "$at_srcdir/cwrapper.at:193: \$GREP ' *fputs' \$objdir/lt-usea.c > /dev/null"
at_fn_check_prepare_dynamic "$GREP ' *fputs' $objdir/lt-usea.c > /dev/null" "cwrapper.at:193"
( $at_check_trace; $GREP ' *fputs' $objdir/lt-usea.c > /dev/null
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:193"
$at_failed && at_fn_log_failure
$at_traceon; }

# Check for no overly long fputs.
{ set +x
$as_echo "$at_srcdir/cwrapper.at:195: \$GREP ' *fputs.\\{250\\}' \$objdir/lt-usea.c"
at_fn_check_prepare_dynamic "$GREP ' *fputs.\\{250\\}' $objdir/lt-usea.c" "cwrapper.at:195"
( $at_check_trace; $GREP ' *fputs.\{250\}' $objdir/lt-usea.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/cwrapper.at:195"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_85
#AT_START_86
at_fn_group_banner 86 'cwrapper.at:201' \
  "cwrapper and installed shared libraries" "        " 7
at_xfail=no
(
  $as_echo "86. $at_setup_line: testing $at_desc ..."
  $at_traceon



# make sure existing libtool is configured for shared libraries
{ set +x
$as_echo "$at_srcdir/cwrapper.at:205: \$LIBTOOL --features | \$GREP 'enable shared libraries' || exit 77"
at_fn_check_prepare_notrace 'a shell pipeline' "cwrapper.at:205"
( $at_check_trace; $LIBTOOL --features | $GREP 'enable shared libraries' || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }


LDFLAGS="$LDFLAGS -no-undefined"

inst=`pwd`/inst
libdir=$inst/lib
bindir=$inst/bin
mkdir $inst $libdir $bindir

# Build the library in a separate directory to avoid the special case
# of loading from the current directory.

mkdir foo
cd foo
# build and install "old" library version
cat >a.c <<'_ATEOF'

int liba_ver (void) { return 1; }
_ATEOF

{ set +x
$as_echo "$at_srcdir/cwrapper.at:224: \$LIBTOOL --mode=compile --tag=CC \$CC \$CPPFLAGS \$CFLAGS -c a.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c a.c" "cwrapper.at:224"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c a.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:224"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/cwrapper.at:226: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -version-info=0.0.0 -o liba.la -rpath \$libdir a.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -version-info=0.0.0 -o liba.la -rpath $libdir a.lo" "cwrapper.at:226"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -version-info=0.0.0 -o liba.la -rpath $libdir a.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:226"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/cwrapper.at:228: \$LIBTOOL --mode=install \$lt_INSTALL liba.la \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install $lt_INSTALL liba.la $libdir" "cwrapper.at:228"
( $at_check_trace; $LIBTOOL --mode=install $lt_INSTALL liba.la $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:228"
$at_failed && at_fn_log_failure
$at_traceon; }


# build a new library version
cat >a.c <<'_ATEOF'

int liba_ver (void) { return 2; }
_ATEOF

{ set +x
$as_echo "$at_srcdir/cwrapper.at:235: \$LIBTOOL --mode=compile --tag=CC \$CC \$CPPFLAGS \$CFLAGS -c a.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c a.c" "cwrapper.at:235"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c a.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:235"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/cwrapper.at:237: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -version-info=0.0.0 -o liba.la -rpath \$libdir a.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -version-info=0.0.0 -o liba.la -rpath $libdir a.lo" "cwrapper.at:237"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -version-info=0.0.0 -o liba.la -rpath $libdir a.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:237"
$at_failed && at_fn_log_failure
$at_traceon; }


cd ..

# build and run test application
cat >m.c <<'_ATEOF'

extern int liba_ver (void);
int main (void)
{
  int r = (liba_ver () == 2) ? 0 : 1;
  return r;
}
_ATEOF


{ set +x
$as_echo "$at_srcdir/cwrapper.at:252: \$CC \$CPPFLAGS \$CFLAGS -c m.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c m.c" "cwrapper.at:252"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c m.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:252"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/cwrapper.at:254: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o m1\$EXEEXT m.\$OBJEXT foo/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m1$EXEEXT m.$OBJEXT foo/liba.la" "cwrapper.at:254"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m1$EXEEXT m.$OBJEXT foo/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:254"
$at_failed && at_fn_log_failure
$at_traceon; }

lt_exe=./m1; if test -f "./m1$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/cwrapper.at:256: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "cwrapper.at:256"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:256"
$at_failed && at_fn_log_failure
$at_traceon; }



{ set +x
$as_echo "$at_srcdir/cwrapper.at:258: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o m2\$EXEEXT m.\$OBJEXT foo/liba.la -L\$inst/lib"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m2$EXEEXT m.$OBJEXT foo/liba.la -L$inst/lib" "cwrapper.at:258"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m2$EXEEXT m.$OBJEXT foo/liba.la -L$inst/lib
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:258"
$at_failed && at_fn_log_failure
$at_traceon; }

lt_exe=./m2; if test -f "./m2$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/cwrapper.at:260: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "cwrapper.at:260"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cwrapper.at:260"
$at_failed && at_fn_log_failure
$at_traceon; }




  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_86
#AT_START_87
at_fn_group_banner 87 'deplib-in-subdir.at:34' \
  "deplib in subdir" "                               " 7
at_xfail=no
(
  $as_echo "87. $at_setup_line: testing $at_desc ..."
  $at_traceon



cat >a1.c <<'_ATEOF'
int a1 () { return 0; }
_ATEOF

cat >a2.c <<'_ATEOF'
int a2 () { return 0; }
_ATEOF

cat >a3.c <<'_ATEOF'
int a3 () { return 0; }
_ATEOF

cat >b1.c <<'_ATEOF'
extern int a1 ();
int b1 () { return a1 (); }
_ATEOF

cat >b2.c <<'_ATEOF'
extern int a2 ();
int b2 () { return a2 (); }
_ATEOF

cat >b3.c <<'_ATEOF'
extern int a3 ();
int b3 () { return a3 (); }
_ATEOF

cat >m.c <<'_ATEOF'
extern int b1 ();
extern int b2 ();
extern int b3 ();
int main () { return b1 () + b2 () + b3 (); }
_ATEOF


cwd=`pwd`
instdir=$cwd/inst
lib1dir=$instdir/lib1
lib2dir=$instdir/lib2
bindir=$instdir/bin
addrunpath=$cwd/foobar
LDFLAGS="$LDFLAGS -no-undefined"

flags='-export-symbols-regex ".*"'

mkdir -p sub1 sub2/subsub sub3/subsub $instdir $lib1dir $lib2dir $bindir

for file in a1.c a2.c a3.c b1.c b2.c b3.c; do
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file
done
$CC $CPPFLAGS $CFLAGS -c m.c
{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:81: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o sub1/liba1.la a1.lo -rpath \$lib1dir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o sub1/liba1.la a1.lo -rpath $lib1dir" "deplib-in-subdir.at:81"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o sub1/liba1.la a1.lo -rpath $lib1dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:81"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:83: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o sub1/liba2.la a2.lo -rpath \$lib1dir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o sub1/liba2.la a2.lo -rpath $lib1dir" "deplib-in-subdir.at:83"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o sub1/liba2.la a2.lo -rpath $lib1dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:83"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:85: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o sub1/liba3.la a3.lo -rpath \$lib1dir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o sub1/liba3.la a3.lo -rpath $lib1dir" "deplib-in-subdir.at:85"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o sub1/liba3.la a3.lo -rpath $lib1dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:85"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:88: eval '\$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o sub2/subsub/libb1.la b1.lo 	 -rpath \$lib2dir sub1/liba1.la' \"\$flags\""
at_fn_check_prepare_dynamic "eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o sub2/subsub/libb1.la b1.lo 	 -rpath $lib2dir sub1/liba1.la' \"$flags\"" "deplib-in-subdir.at:88"
( $at_check_trace; eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o sub2/subsub/libb1.la b1.lo 	 -rpath $lib2dir sub1/liba1.la' "$flags"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:88"
$at_failed && at_fn_log_failure
$at_traceon; }

cd sub2
{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:92: eval '\$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o subsub/libb2.la ../b2.lo 	 -rpath \$lib2dir ../sub1/liba2.la' \"\$flags\""
at_fn_check_prepare_dynamic "eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o subsub/libb2.la ../b2.lo 	 -rpath $lib2dir ../sub1/liba2.la' \"$flags\"" "deplib-in-subdir.at:92"
( $at_check_trace; eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o subsub/libb2.la ../b2.lo 	 -rpath $lib2dir ../sub1/liba2.la' "$flags"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:92"
$at_failed && at_fn_log_failure
$at_traceon; }

cd subsub
{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:96: eval '\$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o libb3.la ../../b3.lo 	 -rpath \$lib2dir ../../sub1/liba3.la' \"\$flags\""
at_fn_check_prepare_dynamic "eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb3.la ../../b3.lo 	 -rpath $lib2dir ../../sub1/liba3.la' \"$flags\"" "deplib-in-subdir.at:96"
( $at_check_trace; eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb3.la ../../b3.lo 	 -rpath $lib2dir ../../sub1/liba3.la' "$flags"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:96"
$at_failed && at_fn_log_failure
$at_traceon; }

cd ../..
{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:100: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o sub3/subsub/m1\$EXEEXT m.\$OBJEXT 	 sub2/subsub/libb1.la sub2/subsub/libb2.la sub2/subsub/libb3.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o sub3/subsub/m1$EXEEXT m.$OBJEXT 	 sub2/subsub/libb1.la sub2/subsub/libb2.la sub2/subsub/libb3.la" "deplib-in-subdir.at:100"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o sub3/subsub/m1$EXEEXT m.$OBJEXT 	 sub2/subsub/libb1.la sub2/subsub/libb2.la sub2/subsub/libb3.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:100"
$at_failed && at_fn_log_failure
$at_traceon; }

cd sub3
{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:104: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o subsub/m2\$EXEEXT ../m.\$OBJEXT 	 ../sub2/subsub/libb1.la ../sub2/subsub/libb2.la ../sub2/subsub/libb3.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o subsub/m2$EXEEXT ../m.$OBJEXT 	 ../sub2/subsub/libb1.la ../sub2/subsub/libb2.la ../sub2/subsub/libb3.la" "deplib-in-subdir.at:104"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o subsub/m2$EXEEXT ../m.$OBJEXT 	 ../sub2/subsub/libb1.la ../sub2/subsub/libb2.la ../sub2/subsub/libb3.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:104"
$at_failed && at_fn_log_failure
$at_traceon; }

cd subsub
{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:108: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o m3\$EXEEXT ../../m.\$OBJEXT 	 ../../sub2/subsub/libb1.la ../../sub2/subsub/libb2.la ../../sub2/subsub/libb3.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m3$EXEEXT ../../m.$OBJEXT 	 ../../sub2/subsub/libb1.la ../../sub2/subsub/libb2.la ../../sub2/subsub/libb3.la" "deplib-in-subdir.at:108"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m3$EXEEXT ../../m.$OBJEXT 	 ../../sub2/subsub/libb1.la ../../sub2/subsub/libb2.la ../../sub2/subsub/libb3.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:108"
$at_failed && at_fn_log_failure
$at_traceon; }

cd ../..

for i in 1 2 3; do
  lt_exe=./sub3/subsub/m$i; if test -f "./sub3/subsub/m$i$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:114: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "deplib-in-subdir.at:114"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:114"
$at_failed && at_fn_log_failure
$at_traceon; }


  cd sub3
  lt_exe=./subsub/m$i; if test -f "./subsub/m$i$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:116: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "deplib-in-subdir.at:116"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:116"
$at_failed && at_fn_log_failure
$at_traceon; }


  cd subsub
  lt_exe=./m$i; if test -f "./m$i$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:118: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "deplib-in-subdir.at:118"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:118"
$at_failed && at_fn_log_failure
$at_traceon; }


  cd ../..
done

for i in 1 2 3; do
  { set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:123: \$LIBTOOL --mode=install cp sub1/liba\$i.la \$lib1dir/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp sub1/liba$i.la $lib1dir/liba.la" "deplib-in-subdir.at:123"
( $at_check_trace; $LIBTOOL --mode=install cp sub1/liba$i.la $lib1dir/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:123"
$at_failed && at_fn_log_failure
$at_traceon; }

done

{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:126: \$LIBTOOL --mode=install cp sub2/subsub/libb1.la \$lib2dir/libb1.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp sub2/subsub/libb1.la $lib2dir/libb1.la" "deplib-in-subdir.at:126"
( $at_check_trace; $LIBTOOL --mode=install cp sub2/subsub/libb1.la $lib2dir/libb1.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:126"
$at_failed && at_fn_log_failure
$at_traceon; }

cd sub2
{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:128: \$LIBTOOL --mode=install cp subsub/libb2.la \$lib2dir/libb2.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp subsub/libb2.la $lib2dir/libb2.la" "deplib-in-subdir.at:128"
( $at_check_trace; $LIBTOOL --mode=install cp subsub/libb2.la $lib2dir/libb2.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:128"
$at_failed && at_fn_log_failure
$at_traceon; }

cd subsub
{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:130: \$LIBTOOL --mode=install cp libb3.la \$lib2dir/libb3.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp libb3.la $lib2dir/libb3.la" "deplib-in-subdir.at:130"
( $at_check_trace; $LIBTOOL --mode=install cp libb3.la $lib2dir/libb3.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:130"
$at_failed && at_fn_log_failure
$at_traceon; }

cd ../..

{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:133: \$LIBTOOL --mode=install cp sub3/subsub/m1\$EXEEXT \$bindir/m1\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp sub3/subsub/m1$EXEEXT $bindir/m1$EXEEXT" "deplib-in-subdir.at:133"
( $at_check_trace; $LIBTOOL --mode=install cp sub3/subsub/m1$EXEEXT $bindir/m1$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:133"
$at_failed && at_fn_log_failure
$at_traceon; }

cd sub3
{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:135: \$LIBTOOL --mode=install cp subsub/m2\$EXEEXT \$bindir/m2\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp subsub/m2$EXEEXT $bindir/m2$EXEEXT" "deplib-in-subdir.at:135"
( $at_check_trace; $LIBTOOL --mode=install cp subsub/m2$EXEEXT $bindir/m2$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:135"
$at_failed && at_fn_log_failure
$at_traceon; }

cd subsub
{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:137: \$LIBTOOL --mode=install cp m3\$EXEEXT \$bindir/m3\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp m3$EXEEXT $bindir/m3$EXEEXT" "deplib-in-subdir.at:137"
( $at_check_trace; $LIBTOOL --mode=install cp m3$EXEEXT $bindir/m3$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:137"
$at_failed && at_fn_log_failure
$at_traceon; }

cd ../..

{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:140: \$LIBTOOL --mode=clean rm -f sub1/liba1.la sub1/liba2.la sub1/liba3.la 	 sub2/subsub/libb1.la sub2/subsub/libb2.la sub2/subsub/libb3.la 	 sub3/subsub/m1\$EXEEXT sub3/subsub/m2\$EXEEXT sub3/subsub/m3\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=clean rm -f sub1/liba1.la sub1/liba2.la sub1/liba3.la 	 sub2/subsub/libb1.la sub2/subsub/libb2.la sub2/subsub/libb3.la 	 sub3/subsub/m1$EXEEXT sub3/subsub/m2$EXEEXT sub3/subsub/m3$EXEEXT" "deplib-in-subdir.at:140"
( $at_check_trace; $LIBTOOL --mode=clean rm -f sub1/liba1.la sub1/liba2.la sub1/liba3.la 	 sub2/subsub/libb1.la sub2/subsub/libb2.la sub2/subsub/libb3.la 	 sub3/subsub/m1$EXEEXT sub3/subsub/m2$EXEEXT sub3/subsub/m3$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:140"
$at_failed && at_fn_log_failure
$at_traceon; }


for i in 1 2 3; do
  lt_exe=$bindir/m$i$EXEEXT; if test -f "$bindir/m$i$EXEEXT$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:146: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "deplib-in-subdir.at:146"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:146"
$at_failed && at_fn_log_failure
$at_traceon; }


  cd $bindir
  lt_exe=./m$i$EXEEXT; if test -f "./m$i$EXEEXT$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:148: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "deplib-in-subdir.at:148"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:148"
$at_failed && at_fn_log_failure
$at_traceon; }


  cd $cwd
done

PATH=$bindir${PATH_SEPARATOR-:}$PATH
for i in 1 2 3; do
  lt_exe=m$i$EXEEXT; if test -f "m$i$EXEEXT$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/deplib-in-subdir.at:154: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "deplib-in-subdir.at:154"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/deplib-in-subdir.at:154"
$at_failed && at_fn_log_failure
$at_traceon; }


done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_87
#AT_START_88
at_fn_group_banner 88 'infer-tag.at:31' \
  "inferred tag" "                                   " 7
at_xfail=no
(
  $as_echo "88. $at_setup_line: testing $at_desc ..."
  $at_traceon



cat >a.c <<'_ATEOF'
int a (void) { return 0; }
_ATEOF


{ set +x
$as_echo "$at_srcdir/infer-tag.at:38: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c a.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c" "infer-tag.at:38"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/infer-tag.at:38"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_88
#AT_START_89
at_fn_group_banner 89 'infer-tag.at:43' \
  "CXX inferred tag" "                               " 7
at_xfail=no
(
  $as_echo "89. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/infer-tag.at:44: { test -n \"\$CXX\" && test \"X\$CXX\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$CXX\" && test \"X$CXX\" != Xno; } || (exit 77)" "infer-tag.at:44"
( $at_check_trace; { test -n "$CXX" && test "X$CXX" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/infer-tag.at:44"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/infer-tag.at:44: test g++ != \"\$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)"
at_fn_check_prepare_dynamic "test g++ != \"$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)" "infer-tag.at:44"
( $at_check_trace; test g++ != "$CXX" || (g++ -v >/dev/null 2>&1) || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/infer-tag.at:44"
$at_failed && at_fn_log_failure
$at_traceon; }




cat >a.cpp <<'_ATEOF'
int a (void) { return 0; }
_ATEOF


{ set +x
$as_echo "$at_srcdir/infer-tag.at:51: \$LIBTOOL --mode=compile \$CXX \$CPPFLAGS \$CXXFLAGS -c a.cpp"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CXX $CPPFLAGS $CXXFLAGS -c a.cpp" "infer-tag.at:51"
( $at_check_trace; $LIBTOOL --mode=compile $CXX $CPPFLAGS $CXXFLAGS -c a.cpp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/infer-tag.at:51"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_89
#AT_START_90
at_fn_group_banner 90 'infer-tag.at:56' \
  "F77 inferred tag" "                               " 7
at_xfail=no
(
  $as_echo "90. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/infer-tag.at:57: { test -n \"\$F77\" && test \"X\$F77\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$F77\" && test \"X$F77\" != Xno; } || (exit 77)" "infer-tag.at:57"
( $at_check_trace; { test -n "$F77" && test "X$F77" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/infer-tag.at:57"
$at_failed && at_fn_log_failure
$at_traceon; }





cat >a.f <<'_ATEOF'
      program main
      end
_ATEOF


{ set +x
$as_echo "$at_srcdir/infer-tag.at:65: \$LIBTOOL --mode=compile \$F77 \$FFLAGS -c a.f"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $F77 $FFLAGS -c a.f" "infer-tag.at:65"
( $at_check_trace; $LIBTOOL --mode=compile $F77 $FFLAGS -c a.f
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/infer-tag.at:65"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_90
#AT_START_91
at_fn_group_banner 91 'infer-tag.at:70' \
  "FC inferred tag" "                                " 7
at_xfail=no
(
  $as_echo "91. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/infer-tag.at:71: { test -n \"\$FC\" && test \"X\$FC\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$FC\" && test \"X$FC\" != Xno; } || (exit 77)" "infer-tag.at:71"
( $at_check_trace; { test -n "$FC" && test "X$FC" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/infer-tag.at:71"
$at_failed && at_fn_log_failure
$at_traceon; }

# Autoconf will accept f77 or similar as a valid FC, but often f77
   # will not compile fortran90 code; in that case skip the FC checks.
   cat >fc_test.f90 <<'_ATEOF'
	program main

	end
_ATEOF

   { set +x
$as_echo "$at_srcdir/infer-tag.at:71: \$FC \$FCFLAGS fc_test.f90 || exit 77"
at_fn_check_prepare_dynamic "$FC $FCFLAGS fc_test.f90 || exit 77" "infer-tag.at:71"
( $at_check_trace; $FC $FCFLAGS fc_test.f90 || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/infer-tag.at:71"
$at_failed && at_fn_log_failure
$at_traceon; }




cat >a.f <<'_ATEOF'
      program main
      end
_ATEOF


{ set +x
$as_echo "$at_srcdir/infer-tag.at:79: \$LIBTOOL --mode=compile \$FC \$FCFLAGS -c a.f"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $FC $FCFLAGS -c a.f" "infer-tag.at:79"
( $at_check_trace; $LIBTOOL --mode=compile $FC $FCFLAGS -c a.f
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/infer-tag.at:79"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_91
#AT_START_92
at_fn_group_banner 92 'infer-tag.at:84' \
  "GCJ inferred tag" "                               " 7
at_xfail=no
(
  $as_echo "92. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/infer-tag.at:85: { test -n \"\$GCJ\" && test \"X\$GCJ\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$GCJ\" && test \"X$GCJ\" != Xno; } || (exit 77)" "infer-tag.at:85"
( $at_check_trace; { test -n "$GCJ" && test "X$GCJ" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/infer-tag.at:85"
$at_failed && at_fn_log_failure
$at_traceon; }

# There are just too many broken gcj installations out there, either missing
   # libgcj.spec or unable to find it.  Skip the test for them.
   cat >gcj_test.java <<'_ATEOF'
public class gcj_test {
    public static void main(String[] argv) { }
  }
_ATEOF

   { set +x
$as_echo "$at_srcdir/infer-tag.at:85: \$GCJ \$GCJFLAGS -c gcj_test.java || exit 77"
at_fn_check_prepare_dynamic "$GCJ $GCJFLAGS -c gcj_test.java || exit 77" "infer-tag.at:85"
( $at_check_trace; $GCJ $GCJFLAGS -c gcj_test.java || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/infer-tag.at:85"
$at_failed && at_fn_log_failure
$at_traceon; }




cat >A.java <<'_ATEOF'
public class A {
  private int a;
  public A () { a = 0; }
};
_ATEOF


{ set +x
$as_echo "$at_srcdir/infer-tag.at:95: \$LIBTOOL --mode=compile \$GCJ \$GCJCFLAGS -c A.java"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $GCJ $GCJCFLAGS -c A.java" "infer-tag.at:95"
( $at_check_trace; $LIBTOOL --mode=compile $GCJ $GCJCFLAGS -c A.java
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/infer-tag.at:95"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_92
#AT_START_93
at_fn_group_banner 93 'localization.at:24' \
  "localized compiler messages" "                    " 7
at_xfail=no
(
  $as_echo "93. $at_setup_line: testing $at_desc ..."
  $at_traceon



# Let's try German locale.  :-)


cat >a.c <<'_ATEOF'
int x[-1];
_ATEOF

cat >b.c <<'_ATEOF'
int y;
_ATEOF


# First see if setting a locale is accepted at all.
{ set +x
$as_echo "$at_srcdir/localization.at:39: (LANG=de_DE LANGUAGE=de_DE LC_ALL=de_DE \$CC \$CPPFLAGS \$CFLAGS -c b.c) || exit 77"
at_fn_check_prepare_dynamic "(LANG=de_DE LANGUAGE=de_DE LC_ALL=de_DE $CC $CPPFLAGS $CFLAGS -c b.c) || exit 77" "localization.at:39"
( $at_check_trace; (LANG=de_DE LANGUAGE=de_DE LC_ALL=de_DE $CC $CPPFLAGS $CFLAGS -c b.c) || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/localization.at:39"
$at_failed && at_fn_log_failure
$at_traceon; }


# Find out about expected output.
{ set +x
$as_echo "$at_srcdir/localization.at:43: (LANG=de_DE LANGUAGE=de_DE LC_ALL=de_DE \$CC \$CPPFLAGS \$CFLAGS -c a.c) || exit 1"
at_fn_check_prepare_dynamic "(LANG=de_DE LANGUAGE=de_DE LC_ALL=de_DE $CC $CPPFLAGS $CFLAGS -c a.c) || exit 1" "localization.at:43"
( $at_check_trace; (LANG=de_DE LANGUAGE=de_DE LC_ALL=de_DE $CC $CPPFLAGS $CFLAGS -c a.c) || exit 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/localization.at:43"
$at_failed && at_fn_log_failure
$at_traceon; }

_ltbase=`$ECHO "$LIBTOOL" | $SED 's|^.*/||'`
$SED "/^distcc\[[0-9]*\]/d
      /^$_ltbase: compile/d
      s/\(tmp\/\{1,\}cc\)\([a-zA-Z0-9_]\{1,\}\)/\1-normalized-tmpname/g" < stdout > stdout.t
case $host_os in
  mingw*)
    tr -d '\015' < stdout.t > expected-stdout ;;
  *)
    cp stdout.t expected-stdout ;;
esac
_ltbase=`$ECHO "$LIBTOOL" | $SED 's|^.*/||'`
$SED "/^distcc\[[0-9]*\]/d
      /^$_ltbase: compile/d
      s/\(tmp\/\{1,\}cc\)\([a-zA-Z0-9_]\{1,\}\)/\1-normalized-tmpname/g" < stderr > stderr.t
case $host_os in
  mingw*)
    tr -d '\015' < stderr.t > expected-stderr ;;
  *)
    cp stderr.t expected-stderr ;;
esac
{ set +x
$as_echo "$at_srcdir/localization.at:47: (LANG=de_DE LANGUAGE=de_DE LC_ALL=de_DE \$LIBTOOL --mode=compile --tag=CC \$CC \$CPPFLAGS \$CFLAGS -c a.c) || exit 1"
at_fn_check_prepare_dynamic "(LANG=de_DE LANGUAGE=de_DE LC_ALL=de_DE $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c a.c) || exit 1" "localization.at:47"
( $at_check_trace; (LANG=de_DE LANGUAGE=de_DE LC_ALL=de_DE $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c a.c) || exit 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/localization.at:47"
$at_failed && at_fn_log_failure
$at_traceon; }

_ltbase=`$ECHO "$LIBTOOL" | $SED 's|^.*/||'`
$SED "/^distcc\[[0-9]*\]/d
      /^$_ltbase: compile/d
      s/\(tmp\/\{1,\}cc\)\([a-zA-Z0-9_]\{1,\}\)/\1-normalized-tmpname/g" < stdout > stdout.t
case $host_os in
  mingw*)
    tr -d '\015' < stdout.t > libtool-stdout ;;
  *)
    cp stdout.t libtool-stdout ;;
esac
_ltbase=`$ECHO "$LIBTOOL" | $SED 's|^.*/||'`
$SED "/^distcc\[[0-9]*\]/d
      /^$_ltbase: compile/d
      s/\(tmp\/\{1,\}cc\)\([a-zA-Z0-9_]\{1,\}\)/\1-normalized-tmpname/g" < stderr > stderr.t
case $host_os in
  mingw*)
    tr -d '\015' < stderr.t > libtool-stderr ;;
  *)
    cp stderr.t libtool-stderr ;;
esac
# Avoid these errors:
# GNU/Linux:
#   /bin/sh: warning: setlocale: LC_ALL: cannot change locale (de_DE)
# HP-UX:
#   Warning! One or more of your selected locales are not available.
#   Please invoke the commands "locale" and "locale -a" to verify your
#   selections and the available locales.
#
#   Continuing processing using the "C" locale.
{ set +x
$as_echo "$at_srcdir/localization.at:60: \$GREP locale stdout stderr && exit 77"
at_fn_check_prepare_dynamic "$GREP locale stdout stderr && exit 77" "localization.at:60"
( $at_check_trace; $GREP locale stdout stderr && exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/localization.at:60"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/localization.at:61: diff expected-stderr libtool-stderr"
at_fn_check_prepare_trace "localization.at:61"
( $at_check_trace; diff expected-stderr libtool-stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/localization.at:61"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/localization.at:62: diff expected-stdout libtool-stdout"
at_fn_check_prepare_trace "localization.at:62"
( $at_check_trace; diff expected-stdout libtool-stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/localization.at:62"
$at_failed && at_fn_log_failure
$at_traceon; }


# check that we get our quoting right.

{ set +x
$as_echo "$at_srcdir/localization.at:67: (LANGUAGE='a; nosuchprogram \" '\\''  & \$x /#+*(){}|,:\`\\ !%' \$LIBTOOL --mode=compile --tag=CC \$CC \$CPPFLAGS \$CFLAGS -c b.c)"
at_fn_check_prepare_notrace 'a `...` command substitution' "localization.at:67"
( $at_check_trace; (LANGUAGE='a; nosuchprogram " '\''  & $x /#+*(){}|,:`\ !%' $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c b.c)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/localization.at:67"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/localization.at:69: \$GREP nosuchprogram stdout stderr"
at_fn_check_prepare_dynamic "$GREP nosuchprogram stdout stderr" "localization.at:69"
( $at_check_trace; $GREP nosuchprogram stdout stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/localization.at:69"
$at_failed && at_fn_log_failure
$at_traceon; }




  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_93
#AT_START_94
at_fn_group_banner 94 'nocase.at:26' \
  "nocase library search" "                          " 7
at_xfail=no
(
  $as_echo "94. $at_setup_line: testing $at_desc ..."
  $at_traceon



eval `$LIBTOOL --config | $EGREP '^(want_nocaseglob|file_magic_glob)='`

{ set +x
$as_echo "$at_srcdir/nocase.at:31: test yes != \"\$want_nocaseglob\" &&          test -z \"\$file_magic_glob\" && exit 77"
at_fn_check_prepare_dynamic "test yes != \"$want_nocaseglob\" &&          test -z \"$file_magic_glob\" && exit 77" "nocase.at:31"
( $at_check_trace; test yes != "$want_nocaseglob" &&          test -z "$file_magic_glob" && exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/nocase.at:31"
$at_failed && at_fn_log_failure
$at_traceon; }


mkdir foo
cat >foo/Foo.c <<'_ATEOF'

int Foo (void) { return 1; }
_ATEOF


mkdir bar
cat >bar/bar.c <<'_ATEOF'

extern int Foo (void);
int bar (void) { return Foo (); }
_ATEOF


cat >main.c <<'_ATEOF'

extern int bar (void);
int main (void) { return bar (); }
_ATEOF


libdir=`pwd`/inst/lib
mkdir inst inst/bin inst/lib

$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o foo/Foo.lo foo/Foo.c
{ set +x
$as_echo "$at_srcdir/nocase.at:58: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS -o foo/libFoo.la foo/Foo.lo 	 -no-undefined -version-info 1:0:0 -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o foo/libFoo.la foo/Foo.lo 	 -no-undefined -version-info 1:0:0 -rpath $libdir" "nocase.at:58"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o foo/libFoo.la foo/Foo.lo 	 -no-undefined -version-info 1:0:0 -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nocase.at:58"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/nocase.at:61: \$LIBTOOL --mode=install cp foo/libFoo.la \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp foo/libFoo.la $libdir" "nocase.at:61"
( $at_check_trace; $LIBTOOL --mode=install cp foo/libFoo.la $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nocase.at:61"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/nocase.at:63: \$LIBTOOL --mode=clean rm -f foo/libFoo.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=clean rm -f foo/libFoo.la" "nocase.at:63"
( $at_check_trace; $LIBTOOL --mode=clean rm -f foo/libFoo.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nocase.at:63"
$at_failed && at_fn_log_failure
$at_traceon; }


rm -f $libdir/libFoo.la

$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o bar/bar.lo bar/bar.c
{ set +x
$as_echo "$at_srcdir/nocase.at:69: \$LIBTOOL --mode=link --tag=CC \$CC \$CFLAGS \$LDFLAGS -o bar/libbar.la bar/bar.lo 	 -L\$libdir -lfoo -no-undefined -version-info 1:0:0 -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o bar/libbar.la bar/bar.lo 	 -L$libdir -lfoo -no-undefined -version-info 1:0:0 -rpath $libdir" "nocase.at:69"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o bar/libbar.la bar/bar.lo 	 -L$libdir -lfoo -no-undefined -version-info 1:0:0 -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nocase.at:69"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/nocase.at:72: \$LIBTOOL --mode=install cp bar/libbar.la \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp bar/libbar.la $libdir" "nocase.at:72"
( $at_check_trace; $LIBTOOL --mode=install cp bar/libbar.la $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nocase.at:72"
$at_failed && at_fn_log_failure
$at_traceon; }


str=`$EGREP '^(old_library)=' < $libdir/libbar.la`
eval "$str"
libbar=$old_library
rm -f $libdir/$libbar

$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o main.$OBJEXT main.c

{ set +x
$as_echo "$at_srcdir/nocase.at:82: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT -L\$libdir -lbar"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT -L$libdir -lbar" "nocase.at:82"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT -L$libdir -lbar
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nocase.at:82"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_94
#AT_START_95
at_fn_group_banner 95 'install.at:26' \
  "Install tests" "                                  " 7
at_xfail=no
(
  $as_echo "95. $at_setup_line: testing $at_desc ..."
  $at_traceon



# Ensure that install_override_mode overrides the mode of the shared
# library (and only the shared library).

{ set +x
$as_echo "$at_srcdir/install.at:32: \$LIBTOOL --features | \$GREP 'enable shared libraries' || exit 77"
at_fn_check_prepare_notrace 'a shell pipeline' "install.at:32"
( $at_check_trace; $LIBTOOL --features | $GREP 'enable shared libraries' || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/install.at:32"
$at_failed && at_fn_log_failure
$at_traceon; }

$SED 's|^\(install_override_mode\)=.*|\1=755|' < $LIBTOOL > ./libtool
LIBTOOL=./libtool
chmod a+rx $LIBTOOL

inst=`pwd`/inst
mkdir inst

echo 'int a () { return 0; }' > a.c
$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
{ set +x
$as_echo "$at_srcdir/install.at:43: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la a.lo 	 -rpath \$inst -no-undefined"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo 	 -rpath $inst -no-undefined" "install.at:43"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo 	 -rpath $inst -no-undefined
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/install.at:43"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/install.at:45: \$LIBTOOL --mode=install \$lt_INSTALL liba.la \$inst"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install $lt_INSTALL liba.la $inst" "install.at:45"
( $at_check_trace; $LIBTOOL --mode=install $lt_INSTALL liba.la $inst
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/install.at:45"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/install.at:47: \$GREP ' -m 755' stdout"
at_fn_check_prepare_dynamic "$GREP ' -m 755' stdout" "install.at:47"
( $at_check_trace; $GREP ' -m 755' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/install.at:47"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/install.at:48: \$LIBTOOL --mode=install \$lt_INSTALL -m 644 liba.la \$inst"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install $lt_INSTALL -m 644 liba.la $inst" "install.at:48"
( $at_check_trace; $LIBTOOL --mode=install $lt_INSTALL -m 644 liba.la $inst
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/install.at:48"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/install.at:50: \$GREP ' -m 755' stdout"
at_fn_check_prepare_dynamic "$GREP ' -m 755' stdout" "install.at:50"
( $at_check_trace; $GREP ' -m 755' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/install.at:50"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/install.at:51: \$GREP ' -m 644.*liba.la' stdout"
at_fn_check_prepare_dynamic "$GREP ' -m 644.*liba.la' stdout" "install.at:51"
( $at_check_trace; $GREP ' -m 644.*liba.la' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/install.at:51"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_95
#AT_START_96
at_fn_group_banner 96 'versioning.at:24' \
  "versioning" "                                     " 7
at_xfail=no
(
  $as_echo "96. $at_setup_line: testing $at_desc ..."
  $at_traceon



eval "`$LIBTOOL --config | $EGREP '^(objdir|host_os|shared_archive_member_spec)='`"

# Setup some library and program sources:
# a library (a1), a new revision (a2), a compatible update (a3),
# an incompatible update (a4).
# Another library (libb) using liba, and a couple of programs,
# using liba directly and indirectly through libb.

cat >liba1.c <<'_ATEOF'

int a (void)
{
  return 0;
}
_ATEOF


cat >liba2.c <<'_ATEOF'

/* The internal detail should be static.  It isn't static in this test,
   so we can later find out that it's this revision of the library. */
int internal_detail = 42;
int a (void)
{
  return internal_detail - 42;
}
_ATEOF


cat >liba3.c <<'_ATEOF'

int a (void)
{
  return 0;
}
int aa (void)
{
  return 0;
}
_ATEOF


cat >liba4.c <<'_ATEOF'

int aa (void)
{
  return 0;
}
_ATEOF


cat >libb.c <<'_ATEOF'

extern int a (void);
int b (void)
{
  return a ();
}
_ATEOF


cat >prog1.c <<'_ATEOF'

extern int a (void);
int main (void)
{
  return a ();
}
_ATEOF


cat >prog2.c <<'_ATEOF'

extern int b (void);
int main (void)
{
  return b ();
}
_ATEOF



inst=`pwd`/inst
libdir=$inst/lib
bindir=$inst/bin
LDFLAGS="$LDFLAGS -no-undefined"
mkdir $inst $libdir $bindir

for file in liba1.c liba2.c liba3.c liba4.c libb.c; do
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file
done
for file in prog1.c prog2.c; do
  $CC $CPPFLAGS $CFLAGS -c $file
done

# Setup is finished here.

# Hypothesis: -version-info is ignored for convenience archives.
{ set +x
$as_echo "$at_srcdir/versioning.at:111: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la liba1.lo 	 -version-info 0:0:0"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba1.lo 	 -version-info 0:0:0" "versioning.at:111"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba1.lo 	 -version-info 0:0:0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:111"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/versioning.at:113: \$GREP 'version-info.*ignored for convenience' stderr"
at_fn_check_prepare_dynamic "$GREP 'version-info.*ignored for convenience' stderr" "versioning.at:113"
( $at_check_trace; $GREP 'version-info.*ignored for convenience' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:113"
$at_failed && at_fn_log_failure
$at_traceon; }


# Hypothesis: the deprecated -version-number works.
# Be sure not to use zero here, it's not portable.
for version_number in 1 1:1 2:1 1:1:1 3:2:1; do
  { set +x
$as_echo "$at_srcdir/versioning.at:118: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la liba1.lo 	   -version-number \$version_number -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba1.lo 	   -version-number $version_number -rpath $libdir" "versioning.at:118"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba1.lo 	   -version-number $version_number -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:118"
$at_failed && at_fn_log_failure
$at_traceon; }

done

# Hypothesis: -version-info can be passed kinds of values, esp. zero ones
# and large ones.
# TODO: check something like 1001:2419:189 after fixing issues
# for 'version_type's of 'irix', 'nonstopux', or 'osf'.
for version_info in 1 1:2 0:0:0 1:1:1 13:241:7; do
  { set +x
$as_echo "$at_srcdir/versioning.at:127: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la liba1.lo 	   -version-info \$version_info -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba1.lo 	   -version-info $version_info -rpath $libdir" "versioning.at:127"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba1.lo 	   -version-info $version_info -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:127"
$at_failed && at_fn_log_failure
$at_traceon; }

done

# Hypothesis: we diagnose when AGE is higher than CURRENT.
{ set +x
$as_echo "$at_srcdir/versioning.at:132: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la liba1.lo 	 -version-info 1:3:2 -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba1.lo 	 -version-info 1:3:2 -rpath $libdir" "versioning.at:132"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba1.lo 	 -version-info 1:3:2 -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/versioning.at:132"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/versioning.at:134: \$GREP 'AGE.*is greater than' stderr"
at_fn_check_prepare_dynamic "$GREP 'AGE.*is greater than' stderr" "versioning.at:134"
( $at_check_trace; $GREP 'AGE.*is greater than' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:134"
$at_failed && at_fn_log_failure
$at_traceon; }


# Hypothesis: we diagnose invalid values.
for version_info in 1:2:3:4 -1 0:-1 0:0:-1; do
  { set +x
$as_echo "$at_srcdir/versioning.at:138: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la liba1.lo 	   -version-info \$version_info -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba1.lo 	   -version-info $version_info -rpath $libdir" "versioning.at:138"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba1.lo 	   -version-info $version_info -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/versioning.at:138"
$at_failed && at_fn_log_failure
$at_traceon; }

done


# Now, create an original version of the library and associated users.
# This setup will be reused for further hypotheses below, and these
# functions will be used to test working programs.

test_uninstalled ()
{
  # temporarily move installed libraries out of the way in order to avoid
  # skewing test results:
  mv $libdir temp-lib
  mv $bindir temp-bin
  lt_exe=./prog1; if test -f "./prog1$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/versioning.at:153: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "versioning.at:153"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:153"
$at_failed && at_fn_log_failure
$at_traceon; }


  lt_exe=./prog2; if test -f "./prog2$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/versioning.at:154: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "versioning.at:154"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:154"
$at_failed && at_fn_log_failure
$at_traceon; }


  mv temp-lib $libdir
  mv temp-bin $bindir
}

test_installed ()
{
  # temporarily move uninstalled libraries out of the way in order to avoid
  # skewing test results:
  mv $objdir temp
  lt_exe=$bindir/prog1; if test -f "$bindir/prog1$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/versioning.at:164: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "versioning.at:164"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:164"
$at_failed && at_fn_log_failure
$at_traceon; }


  lt_exe=$bindir/prog2; if test -f "$bindir/prog2$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/versioning.at:165: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "versioning.at:165"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:165"
$at_failed && at_fn_log_failure
$at_traceon; }


  mv temp $objdir
}

{ set +x
$as_echo "$at_srcdir/versioning.at:169: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la liba1.lo 	 -version-info 0:0:0 -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba1.lo 	 -version-info 0:0:0 -rpath $libdir" "versioning.at:169"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba1.lo 	 -version-info 0:0:0 -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:169"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/versioning.at:171: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o libb.la libb.lo liba.la 	 -version-info 0:0:0 -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la libb.lo liba.la 	 -version-info 0:0:0 -rpath $libdir" "versioning.at:171"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la libb.lo liba.la 	 -version-info 0:0:0 -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:171"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/versioning.at:173: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o prog1\$EXEEXT prog1.\$OBJEXT 	 liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o prog1$EXEEXT prog1.$OBJEXT 	 liba.la" "versioning.at:173"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o prog1$EXEEXT prog1.$OBJEXT 	 liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:173"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/versioning.at:175: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o prog2\$EXEEXT prog2.\$OBJEXT 	 libb.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o prog2$EXEEXT prog2.$OBJEXT 	 libb.la" "versioning.at:175"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o prog2$EXEEXT prog2.$OBJEXT 	 libb.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:175"
$at_failed && at_fn_log_failure
$at_traceon; }

test_uninstalled
{ set +x
$as_echo "$at_srcdir/versioning.at:178: \$LIBTOOL --mode=install cp liba.la libb.la \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp liba.la libb.la $libdir" "versioning.at:178"
( $at_check_trace; $LIBTOOL --mode=install cp liba.la libb.la $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:178"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/versioning.at:180: \$LIBTOOL --mode=install cp prog1\$EXEEXT prog2\$EXEEXT \$bindir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp prog1$EXEEXT prog2$EXEEXT $bindir" "versioning.at:180"
( $at_check_trace; $LIBTOOL --mode=install cp prog1$EXEEXT prog2$EXEEXT $bindir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:180"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/versioning.at:182: \$LIBTOOL --mode=clean rm -f liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=clean rm -f liba.la" "versioning.at:182"
( $at_check_trace; $LIBTOOL --mode=clean rm -f liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:182"
$at_failed && at_fn_log_failure
$at_traceon; }

test_installed
{ set +x
$as_echo "$at_srcdir/versioning.at:184: \$LIBTOOL --mode=uninstall rm -f \$libdir/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=uninstall rm -f $libdir/liba.la" "versioning.at:184"
( $at_check_trace; $LIBTOOL --mode=uninstall rm -f $libdir/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:184"
$at_failed && at_fn_log_failure
$at_traceon; }



# Hypothesis: library revision updates do not require (uninstalled
# nor installed) programs or libraries to be relinked.
{ set +x
$as_echo "$at_srcdir/versioning.at:189: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la liba2.lo 	 -version-info 0:1:0 -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba2.lo 	 -version-info 0:1:0 -rpath $libdir" "versioning.at:189"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba2.lo 	 -version-info 0:1:0 -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:189"
$at_failed && at_fn_log_failure
$at_traceon; }

test_uninstalled
{ set +x
$as_echo "$at_srcdir/versioning.at:192: \$LIBTOOL --mode=install cp liba.la \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp liba.la $libdir" "versioning.at:192"
( $at_check_trace; $LIBTOOL --mode=install cp liba.la $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:192"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/versioning.at:193: \$LIBTOOL --mode=clean rm -f liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=clean rm -f liba.la" "versioning.at:193"
( $at_check_trace; $LIBTOOL --mode=clean rm -f liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:193"
$at_failed && at_fn_log_failure
$at_traceon; }

test_installed
# do not uninstall here: the library may be reused in the next test.

# Hypothesis: backward compatible library updates do not require
# (uninstalled nor installed) programs or libraries to be relinked.
# This can have one of several reasons:
# - the soname is the difference between $current and $age, thus
#   unchanged; in this case, the newly installed library will be used,
# - the soname is only $current, or we are linking statically, in which case
#   the old installed library code will be used,
# - the numbers are not encoded at all, in which case the newly installed
#   library will be used.
{ set +x
$as_echo "$at_srcdir/versioning.at:206: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la liba3.lo 	 -version-info 1:0:1 -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba3.lo 	 -version-info 1:0:1 -rpath $libdir" "versioning.at:206"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba3.lo 	 -version-info 1:0:1 -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

# Do not test the uninstalled program, it may be broken (in the second case).
{ set +x
$as_echo "$at_srcdir/versioning.at:209: \$LIBTOOL --mode=install cp liba.la \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp liba.la $libdir" "versioning.at:209"
( $at_check_trace; $LIBTOOL --mode=install cp liba.la $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:209"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/versioning.at:210: \$LIBTOOL --mode=clean rm -f liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=clean rm -f liba.la" "versioning.at:210"
( $at_check_trace; $LIBTOOL --mode=clean rm -f liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:210"
$at_failed && at_fn_log_failure
$at_traceon; }

test_installed
# do not uninstall here: the library may be reused in the next test.


# Hypothesis: with shared libraries, incompatible library updates
# will not cause old installed programs or libraries (linked against the old
# library version) to break.
# This can have one of several reasons:
# - the soname has changed, so the old installed library will still be
#   available,
# - we are linking statically, so the old library code will still be used.
# In order to be sure we are still linking against the old library version,
# we must ensure that libb is not relinked, so we must not reinstall libb here.
{ set +x
$as_echo "$at_srcdir/versioning.at:224: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la liba4.lo 	 -version-info 2:0:0 -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba4.lo 	 -version-info 2:0:0 -rpath $libdir" "versioning.at:224"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba4.lo 	 -version-info 2:0:0 -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:224"
$at_failed && at_fn_log_failure
$at_traceon; }

# We do not guarantee that old versions of an uninstalled library are still
# available, so test_uninstalled will not necessarily work here any more.
{ set +x
$as_echo "$at_srcdir/versioning.at:228: \$LIBTOOL --mode=install cp liba.la \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp liba.la $libdir" "versioning.at:228"
( $at_check_trace; $LIBTOOL --mode=install cp liba.la $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:228"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/versioning.at:229: \$LIBTOOL --mode=clean rm -f liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=clean rm -f liba.la" "versioning.at:229"
( $at_check_trace; $LIBTOOL --mode=clean rm -f liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:229"
$at_failed && at_fn_log_failure
$at_traceon; }


# On AIX, this test only works when the 'aix-soname' feature is enabled and
# active, which is reflected in shared_archive_member_spec being set and LDFLAGS
# containing -brtl. Otherwise, even with runtime linking, the linker always
# records the unversioned name as dependency.
{ set +x
$as_echo "$at_srcdir/versioning.at:235: :; case \$host_os,\$shared_archive_member_spec,\$LDFLAGS in
aix*,,*) exit 77 ;;
aix*,*,*-brtl*) ;;
aix*,*) exit 77 ;;
esac"
at_fn_check_prepare_notrace 'an embedded newline' "versioning.at:235"
( $at_check_trace; :; case $host_os,$shared_archive_member_spec,$LDFLAGS in
aix*,,*) exit 77 ;;
aix*,*,*-brtl*) ;;
aix*,*) exit 77 ;;
esac
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/versioning.at:235"
$at_failed && at_fn_log_failure
$at_traceon; }


test_installed


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_96
#AT_START_97
at_fn_group_banner 97 'destdir.at:49' \
  "Simple DESTDIR install" "                         " 8
at_xfail=no
      eval `$LIBTOOL --config | $GREP '^fast_install='`
           case $fast_install in no) :;; *) false;; esac && at_xfail=yes
(
  $as_echo "97. $at_setup_line: testing $at_desc ..."
  $at_traceon



# A program that depends upon a library, both in the same package.
# DESTDIR installs do not work with relink at install time.

LDFLAGS="$LDFLAGS -no-undefined"
if test -n "$we_are_on_a_safe_system"; then # let's read shorter cmdlines.
  DESTDIR=/tmp/dest
  prefix=/tmp/inst
  rm -rf $DESTDIR $prefix
else
  DESTDIR=`pwd`/dest
  prefix=`pwd`/inst
fi
libdir=$prefix/lib
bindir=$prefix/bin
$mkdir_p src $prefix $DESTDIR $DESTDIR$prefix
eval `$LIBTOOL --config | $EGREP '^(FGREP|OBJDUMP)='`

cd src
echo 'int a() { return 0; }' > a.c
$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath $libdir
echo 'extern int a(); int main() { return a(); }' > m.c
$CC $CPPFLAGS $CFLAGS -c m.c
$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m$EXEEXT m.$OBJEXT liba.la
mkdir $DESTDIR$libdir $DESTDIR$bindir
{ set +x
$as_echo "$at_srcdir/destdir.at:62: \$LIBTOOL --mode=install cp liba.la \$DESTDIR\$libdir/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp liba.la $DESTDIR$libdir/liba.la" "destdir.at:62"
( $at_check_trace; $LIBTOOL --mode=install cp liba.la $DESTDIR$libdir/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/destdir.at:62"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/destdir.at:64: \$LIBTOOL --mode=install cp m\$EXEEXT \$DESTDIR\$bindir/m\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp m$EXEEXT $DESTDIR$bindir/m$EXEEXT" "destdir.at:64"
( $at_check_trace; $LIBTOOL --mode=install cp m$EXEEXT $DESTDIR$bindir/m$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/destdir.at:64"
$at_failed && at_fn_log_failure
$at_traceon; }

$LIBTOOL --mode=clean rm -f liba.la m
$mkdir_p "$libdir"
(cd "$DESTDIR$libdir" && find . -type d) | (cd "$libdir" && xargs $mkdir_p)
for file in `cd "$DESTDIR$libdir" && find . -type f -print -o -type l -print`
do
  mv "$DESTDIR$libdir"/$file "$libdir"/$file
done
rm -rf "$DESTDIR$libdir"

$mkdir_p "$bindir"
(cd "$DESTDIR$bindir" && find . -type d) | (cd "$bindir" && xargs $mkdir_p)
for file in `cd "$DESTDIR$bindir" && find . -type f -print -o -type l -print`
do
  mv "$DESTDIR$bindir"/$file "$bindir"/$file
done
rm -rf "$DESTDIR$bindir"

# We ignore failure on purpose here: we may not be root.
{ set +x
$as_echo "$at_srcdir/destdir.at:70: \$LIBTOOL --mode=finish \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=finish $libdir" "destdir.at:70"
( $at_check_trace; $LIBTOOL --mode=finish $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_skip $at_status "$at_srcdir/destdir.at:70"
$at_failed && at_fn_log_failure
$at_traceon; }

lt_exe=$bindir/m$EXEEXT; if test -f "$bindir/m$EXEEXT$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/destdir.at:71: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "destdir.at:71"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/destdir.at:71"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_97
#AT_START_98
at_fn_group_banner 98 'destdir.at:76' \
  "DESTDIR with in-package deplibs" "                " 8
at_xfail=no
      eval `$LIBTOOL --config | $GREP '^fast_install='`
           case $fast_install in no) :;; *) false;; esac && at_xfail=yes
(
  $as_echo "98. $at_setup_line: testing $at_desc ..."
  $at_traceon



# A program that depends upon a library that depends upon another
# library, all in the same package.  Use two deplibs, one in $libdir
# and one in another directory.
# DESTDIR installs do not work with relink at install time.

LDFLAGS="$LDFLAGS -no-undefined"
if test -n "$we_are_on_a_safe_system"; then # let's read shorter cmdlines.
  DESTDIR=/tmp/dest
  prefix=/tmp/inst
  rm -rf $DESTDIR $prefix
else
  DESTDIR=`pwd`/dest
  prefix=`pwd`/inst
fi
libdir=$prefix/lib
bindir=$prefix/bin
$mkdir_p src $prefix $DESTDIR $DESTDIR$prefix
eval `$LIBTOOL --config | $EGREP '^(FGREP|OBJDUMP)='`

cd src
echo 'int a1dep() { return 0; }' > a1dep.c
$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a1dep.c
$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba1dep.la a1dep.lo -rpath $libdir
echo 'int a2dep() { return 0; }' > a2dep.c
$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a2dep.c
$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba2dep.la a2dep.lo -rpath ${libdir}2
echo 'extern int a1dep(), a2dep(); int a() { return a1dep() + a2dep(); }' > a.c
$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath $libdir liba1dep.la liba2dep.la
echo 'extern int a(); int main() { return a(); }' > m.c
$CC $CPPFLAGS $CFLAGS -c m.c
$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m$EXEEXT m.$OBJEXT liba.la
mkdir $DESTDIR$libdir $DESTDIR${libdir}2 $DESTDIR$bindir
{ set +x
$as_echo "$at_srcdir/destdir.at:97: \$LIBTOOL --mode=install cp liba1dep.la \$DESTDIR\$libdir/liba1dep.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp liba1dep.la $DESTDIR$libdir/liba1dep.la" "destdir.at:97"
( $at_check_trace; $LIBTOOL --mode=install cp liba1dep.la $DESTDIR$libdir/liba1dep.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/destdir.at:97"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/destdir.at:99: \$LIBTOOL --mode=install cp liba2dep.la \$DESTDIR\${libdir}2/liba2dep.la"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "destdir.at:99"
( $at_check_trace; $LIBTOOL --mode=install cp liba2dep.la $DESTDIR${libdir}2/liba2dep.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/destdir.at:99"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/destdir.at:101: \$LIBTOOL --mode=install cp liba.la \$DESTDIR\$libdir/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp liba.la $DESTDIR$libdir/liba.la" "destdir.at:101"
( $at_check_trace; $LIBTOOL --mode=install cp liba.la $DESTDIR$libdir/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/destdir.at:101"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/destdir.at:103: \$LIBTOOL --mode=install cp m\$EXEEXT \$DESTDIR\$bindir/m\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp m$EXEEXT $DESTDIR$bindir/m$EXEEXT" "destdir.at:103"
( $at_check_trace; $LIBTOOL --mode=install cp m$EXEEXT $DESTDIR$bindir/m$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/destdir.at:103"
$at_failed && at_fn_log_failure
$at_traceon; }

$LIBTOOL --mode=clean rm -f liba1dep.la liba2dep.la liba.la m
$mkdir_p "$libdir"
(cd "$DESTDIR$libdir" && find . -type d) | (cd "$libdir" && xargs $mkdir_p)
for file in `cd "$DESTDIR$libdir" && find . -type f -print -o -type l -print`
do
  mv "$DESTDIR$libdir"/$file "$libdir"/$file
done
rm -rf "$DESTDIR$libdir"

$mkdir_p "${libdir}2"
(cd "$DESTDIR${libdir}2" && find . -type d) | (cd "${libdir}2" && xargs $mkdir_p)
for file in `cd "$DESTDIR${libdir}2" && find . -type f -print -o -type l -print`
do
  mv "$DESTDIR${libdir}2"/$file "${libdir}2"/$file
done
rm -rf "$DESTDIR${libdir}2"

$mkdir_p "$bindir"
(cd "$DESTDIR$bindir" && find . -type d) | (cd "$bindir" && xargs $mkdir_p)
for file in `cd "$DESTDIR$bindir" && find . -type f -print -o -type l -print`
do
  mv "$DESTDIR$bindir"/$file "$bindir"/$file
done
rm -rf "$DESTDIR$bindir"

# We ignore failure on purpose here: we may not be root.
{ set +x
$as_echo "$at_srcdir/destdir.at:110: \$LIBTOOL --mode=finish \$libdir \${libdir}2"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "destdir.at:110"
( $at_check_trace; $LIBTOOL --mode=finish $libdir ${libdir}2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_skip $at_status "$at_srcdir/destdir.at:110"
$at_failed && at_fn_log_failure
$at_traceon; }


# put false libraries in the DESTDIR paths: if the installed program
# refers to them, that is a bug.
mkdir $DESTDIR$libdir $DESTDIR${libdir}2 $DESTDIR$bindir
for lib in a1dep a2dep a; do
  case $lib in
  a2dep) ldir=${libdir}2;;
  *)     ldir=$libdir;;
  esac
  echo "int this_should_not_be_linked_against () { return 0; }" > $lib.c
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $lib.c
  # Note the rpath argument includes $DESTDIR: the installed false libs
  # should be functional (i.e., not need 'libtool --mode=finish').
  $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o lib$lib.la $lib.lo -rpath $DESTDIR$ldir
  $LIBTOOL --mode=install cp lib$lib.la $DESTDIR$ldir/lib$lib.la
done

lt_exe=$bindir/m$EXEEXT; if test -f "$bindir/m$EXEEXT$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/destdir.at:128: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "destdir.at:128"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/destdir.at:128"
$at_failed && at_fn_log_failure
$at_traceon; }



# TODO: make this more portable:
if test false != "$OBJDUMP" && ($OBJDUMP -p $bindir/m$EXEEXT) >/dev/null 2>&1; then
  { set +x
$as_echo "$at_srcdir/destdir.at:132: \$OBJDUMP -p \$bindir/m\$EXEEXT | \$EGREP -i \"R(UN)?PATH.*\$DESTDIR\""
at_fn_check_prepare_notrace 'a shell pipeline' "destdir.at:132"
( $at_check_trace; $OBJDUMP -p $bindir/m$EXEEXT | $EGREP -i "R(UN)?PATH.*$DESTDIR"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/destdir.at:132"
$at_failed && at_fn_log_failure
$at_traceon; }

  . $libdir/liba.la
  set x $library_names
  lname=$2
  if test -n "$lname"; then
    { set +x
$as_echo "$at_srcdir/destdir.at:137: \$OBJDUMP -p \$libdir/\$lname | \$EGREP -i \"R(UN)?PATH.*\$DESTDIR\""
at_fn_check_prepare_notrace 'a shell pipeline' "destdir.at:137"
( $at_check_trace; $OBJDUMP -p $libdir/$lname | $EGREP -i "R(UN)?PATH.*$DESTDIR"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/destdir.at:137"
$at_failed && at_fn_log_failure
$at_traceon; }

  fi
fi

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_98
#AT_START_99
at_fn_group_banner 99 'old-m4-iface.at:41' \
  "AM_PROG_LIBTOOL" "                                " 9
at_xfail=no
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "99. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.in <<'_ATEOF'
AC_INIT(old.c)
AM_PROG_LIBTOOL
AC_SUBST([LIBTOOL_DEPS])
AC_OUTPUT(Makefile)
_ATEOF


cat >Makefile.in <<'_ATEOF'
COMPILE = @CC@ @CPPFLAGS@ @CFLAGS@
LINK      = @CC@ @CFLAGS@ @LDFLAGS@ -o $@
SHELL     = @SHELL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@

all: libtool old@EXEEXT@

old@EXEEXT@: old.@OBJEXT@
	$(LINK) old.@OBJEXT@

.SUFFIXES:
.SUFFIXES: .c .@OBJEXT@

.c.@OBJEXT@:
	$(COMPILE) -c $<

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck
_ATEOF



cat >old.c <<'_ATEOF'
#include <stdio.h>

int main (void)
{
  printf ("Hello, World!");
  return 0;
}
_ATEOF


$LIBTOOLIZE --install



# This is slightly bogus, since only libtool.m4 was required in aclocal.m4
# with libtool-1.5x...
{ set +x
$as_echo "$at_srcdir/old-m4-iface.at:86: test -f aclocal.m4 ||
  cat \"\$tst_aclocaldir/libtool.m4\" \"\$tst_aclocaldir/ltoptions.m4\" \\
    \"\$tst_aclocaldir/ltsugar.m4\" \"\$tst_aclocaldir/ltversion.m4\" \\
    \"\$tst_aclocaldir/lt~obsolete.m4\" > aclocal.m4"
at_fn_check_prepare_notrace 'an embedded newline' "old-m4-iface.at:86"
( $at_check_trace; test -f aclocal.m4 ||
  cat "$tst_aclocaldir/libtool.m4" "$tst_aclocaldir/ltoptions.m4" \
    "$tst_aclocaldir/ltsugar.m4" "$tst_aclocaldir/ltversion.m4" \
    "$tst_aclocaldir/lt~obsolete.m4" > aclocal.m4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/old-m4-iface.at:86"
$at_failed && at_fn_log_failure
$at_traceon; }






{ set +x
$as_echo "$at_srcdir/old-m4-iface.at:91: \$AUTOCONF --force"
at_fn_check_prepare_dynamic "$AUTOCONF --force" "old-m4-iface.at:91"
( $at_check_trace; $AUTOCONF --force
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/old-m4-iface.at:91"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/old-m4-iface.at:91: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "old-m4-iface.at:91"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/old-m4-iface.at:91"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/old-m4-iface.at:91: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "old-m4-iface.at:91"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/old-m4-iface.at:91"
$at_failed && at_fn_log_failure
$at_traceon; }

done



lt_exe=./old; if test -f "./old$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/old-m4-iface.at:93: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "old-m4-iface.at:93"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Hello, World!" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/old-m4-iface.at:93"
$at_failed && at_fn_log_failure
$at_traceon; }



# Now, test that libtoolize doesn't mistakenly think the user called
# any libtool macros if in fact she didn't.
$SED '/AM_PROG_LIBTOOL/d' configure.in >configure.int
mv -f configure.int configure.in
{ set +x
$as_echo "$at_srcdir/old-m4-iface.at:99: \$LIBTOOLIZE -n"
at_fn_check_prepare_dynamic "$LIBTOOLIZE -n" "old-m4-iface.at:99"
( $at_check_trace; $LIBTOOLIZE -n
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/old-m4-iface.at:99"
$at_failed && at_fn_log_failure
$at_traceon; }

# ensure no shell errors:
{ set +x
$as_echo "$at_srcdir/old-m4-iface.at:101: \$GREP -v \"^libtoolize: \" stderr"
at_fn_check_prepare_dynamic "$GREP -v \"^libtoolize: \" stderr" "old-m4-iface.at:101"
( $at_check_trace; $GREP -v "^libtoolize: " stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/old-m4-iface.at:101"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/old-m4-iface.at:102: \$GREP \"Remember to add.*LT_INIT.*to configure.in\" stdout"
at_fn_check_prepare_dynamic "$GREP \"Remember to add.*LT_INIT.*to configure.in\" stdout" "old-m4-iface.at:102"
( $at_check_trace; $GREP "Remember to add.*LT_INIT.*to configure.in" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/old-m4-iface.at:102"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/old-m4-iface.at:103: \$GREP \"Consider adding.*LT_WITH_LTDL\" stdout"
at_fn_check_prepare_dynamic "$GREP \"Consider adding.*LT_WITH_LTDL\" stdout" "old-m4-iface.at:103"
( $at_check_trace; $GREP "Consider adding.*LT_WITH_LTDL" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/old-m4-iface.at:103"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/old-m4-iface.at:104: \$GREP \"Remember to add.*LT_CONFIG_LTDL_DIR\" stdout"
at_fn_check_prepare_dynamic "$GREP \"Remember to add.*LT_CONFIG_LTDL_DIR\" stdout" "old-m4-iface.at:104"
( $at_check_trace; $GREP "Remember to add.*LT_CONFIG_LTDL_DIR" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/old-m4-iface.at:104"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_99
#AT_START_100
at_fn_group_banner 100 'old-m4-iface.at:113' \
  "AC_WITH_LTDL" "                                   " 9
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "100. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >module.c <<'_ATEOF'
#ifdef __cplusplus
extern "C"
#endif
const char *
hello (void)
{
  return "Hello!";
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <stdio.h>
#include "ltdl.h"

int
main ()
{
  lt_dlhandle module;
  const char *(*func) (void) = 0;
  int status = 1;

  LTDL_SET_PRELOADED_SYMBOLS();
  if (lt_dlinit() != 0) {
    fprintf (stderr, "error during initialisation: %s\n", lt_dlerror());
    return 1;
  }

  module = lt_dlopen("./module.la");
  if (!module) {
    fprintf (stderr, "error dlopening ./module.la: %s\n", lt_dlerror());
    goto finish;
  }

  func = (const char *(*)(void)) lt_dlsym (module, "hello");
  if (!func) {
    fprintf (stderr, "error fetching func: %s\n", lt_dlerror());
    goto finish;
  }

  printf ("%s\n", (*func) ());
  status = 0;

finish:
  if (lt_dlexit() != 0) {
    fprintf (stderr, "error during finalisation: %s\n", lt_dlerror());
    status = 1;
  }

  return status;
}
_ATEOF







cat >configure.in <<'_ATEOF'
AC_PREREQ(2.50)
AC_INIT([main.c])
AC_PROG_MAKE_SET
AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AC_WITH_LTDL
AC_OUTPUT(Makefile)
_ATEOF


cat >Makefile.in <<'_ATEOF'
top_srcdir	= .
top_builddir	= .
COMPILE		= @CC@ @INCLTDL@  @CPPFLAGS@ @CFLAGS@
LTCOMPILE	= @LIBTOOL@ --mode=compile $(COMPILE)
LTLINK		= @LIBTOOL@ --mode=link @CC@ -no-undefined @CFLAGS@ @LDFLAGS@ -o $@
SHELL		= @SHELL@
@SET_MAKE@

TARGETS    = libltdl/libltdlc.la module.la ltdldemo@EXEEXT@

all: $(TARGETS)

libltdl/libltdlc.la:
	cd libltdl && $(MAKE)

module.la: module.lo
	$(LTLINK) module.lo -module -avoid-version -rpath /dev/null

ltdldemo@EXEEXT@: main.@OBJEXT@ module.la libltdl/libltdlc.la
	$(LTLINK) main.@OBJEXT@ -dlopen module.la @LIBLTDL@ @LIBS@

.SUFFIXES:
.SUFFIXES: .c .@OBJEXT@ .lo

.c.@OBJEXT@:
	$(COMPILE) -c $<

.c.lo:
	$(LTCOMPILE) -c -o $@ $<
_ATEOF


# Be sure to use the in-tree libltdl, somebody might have removed
# an installed libltdl.la file.
$LIBTOOLIZE --ltdl --install


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I libltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/old-m4-iface.at:161: \$ACLOCAL -I libltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I libltdl/m4$macro_dir" "old-m4-iface.at:161"
( $at_check_trace; $ACLOCAL -I libltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/old-m4-iface.at:161"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1





{ set +x
$as_echo "$at_srcdir/old-m4-iface.at:161: \$AUTOCONF --force"
at_fn_check_prepare_dynamic "$AUTOCONF --force" "old-m4-iface.at:161"
( $at_check_trace; $AUTOCONF --force
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/old-m4-iface.at:161"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/old-m4-iface.at:161: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --with-included-ltdl"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "old-m4-iface.at:161"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --with-included-ltdl
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/old-m4-iface.at:161"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/old-m4-iface.at:161: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "old-m4-iface.at:161"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/old-m4-iface.at:161"
$at_failed && at_fn_log_failure
$at_traceon; }

done



lt_exe=./ltdldemo; if test -f "./ltdldemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/old-m4-iface.at:164: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "old-m4-iface.at:164"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/old-m4-iface.at:164"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_100
#AT_START_101
at_fn_group_banner 101 'old-m4-iface.at:173' \
  "AC_CONFIG_MACRO_DIR" "                            " 9
at_xfail=no
(
  $as_echo "101. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([libtoolize-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
LT_INIT
AC_OUTPUT
_ATEOF


cat >expout <<'_ATEOF'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
_ATEOF


lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"`
$SED "s/libtoolize/$lt_name/g
s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < expout > expout.t
mv -f expout.t expout
{ set +x
$as_echo "$at_srcdir/old-m4-iface.at:195: \$LIBTOOLIZE --copy

"
at_fn_check_prepare_notrace 'an embedded newline' "old-m4-iface.at:195"
( $at_check_trace; $LIBTOOLIZE --copy


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/old-m4-iface.at:195"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_101
#AT_START_102
at_fn_group_banner 102 'am-subdir.at:34' \
  "C subdir-objects" "                               " 10
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "102. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([subdir-demo], 2.4.7, bug-libtool@gnu.org)
AM_INIT_AUTOMAKE
LT_INIT([win32-dll])
AC_PROG_CC
AM_PROG_CC_C_O
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = subdir-objects foreign 1.6
AM_CPPFLAGS	= -I$(top_srcdir)/../..

lib_LTLIBRARIES		= subdir/libsub.la
subdir_libsub_la_SOURCES= subdir/sub.c

bin_PROGRAMS		= subdir/subdemo
subdir_subdemo_SOURCES	= subdir/main.c
subdir_subdemo_LDADD	= subdir/libsub.la
_ATEOF


test -d subdir || { rm -f subdir && mkdir subdir; }

cat >subdir/main.c <<'_ATEOF'
#include <stdio.h>

extern void sub (void);

int main (void)
{
  printf ("Welcome to GNU Libtool subdir-objects test!\n");
  sub();
  return 0;
}
_ATEOF


cat >subdir/sub.c <<'_ATEOF'
#include <stdio.h>
void sub (void) { printf ("** This is libsub **\n"); }
_ATEOF


$LIBTOOLIZE --copy


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/am-subdir.at:79: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "am-subdir.at:79"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/am-subdir.at:79"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1




{ set +x
$as_echo "$at_srcdir/am-subdir.at:79: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "am-subdir.at:79"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/am-subdir.at:79"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/am-subdir.at:79: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "am-subdir.at:79"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/am-subdir.at:79"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/am-subdir.at:79: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "am-subdir.at:79"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/am-subdir.at:79"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/am-subdir.at:79: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "am-subdir.at:79"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/am-subdir.at:79"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/am-subdir.at:79: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "am-subdir.at:79"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/am-subdir.at:79"
$at_failed && at_fn_log_failure
$at_traceon; }

done



lt_exe=subdir/subdemo; if test -f "subdir/subdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/am-subdir.at:81: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "am-subdir.at:81"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/am-subdir.at:81"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/am-subdir.at:82: \$GREP 'Welcome to GNU Libtool subdir-objects test' stdout"
at_fn_check_prepare_dynamic "$GREP 'Welcome to GNU Libtool subdir-objects test' stdout" "am-subdir.at:82"
( $at_check_trace; $GREP 'Welcome to GNU Libtool subdir-objects test' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/am-subdir.at:82"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/am-subdir.at:84: \$GREP 'This is libsub' stdout"
at_fn_check_prepare_dynamic "$GREP 'This is libsub' stdout" "am-subdir.at:84"
( $at_check_trace; $GREP 'This is libsub' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/am-subdir.at:84"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_102
#AT_START_103
at_fn_group_banner 103 'am-subdir.at:94' \
  "C++ subdir-objects" "                             " 10
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "103. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/am-subdir.at:95: { test -n \"\$CXX\" && test \"X\$CXX\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$CXX\" && test \"X$CXX\" != Xno; } || (exit 77)" "am-subdir.at:95"
( $at_check_trace; { test -n "$CXX" && test "X$CXX" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/am-subdir.at:95"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/am-subdir.at:95: test g++ != \"\$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)"
at_fn_check_prepare_dynamic "test g++ != \"$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)" "am-subdir.at:95"
( $at_check_trace; test g++ != "$CXX" || (g++ -v >/dev/null 2>&1) || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/am-subdir.at:95"
$at_failed && at_fn_log_failure
$at_traceon; }



cat >configure.ac <<'_ATEOF'
AC_INIT([subdir-demo], 2.4.7, bug-libtool@gnu.org)
AM_INIT_AUTOMAKE
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_CXXCPP

AC_LANG([C++])
LT_INIT([win32-dll])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = subdir-objects foreign 1.6
AM_CPPFLAGS	= -I$(top_srcdir)/../..

lib_LTLIBRARIES		= subdir/libsub.la
subdir_libsub_la_SOURCES= subdir/sub.cxx subdir/sub.hxx

bin_PROGRAMS		= subdir/subdemo
subdir_subdemo_SOURCES	= subdir/main.cxx
subdir_subdemo_LDADD	= subdir/libsub.la
_ATEOF


test -d subdir || { rm -f subdir && mkdir subdir; }

cat >subdir/sub.hxx <<'_ATEOF'
class libsub { public: int sub (void); };
_ATEOF


cat >subdir/main.cxx <<'_ATEOF'
#include "sub.hxx"

int main (void)
{
  libsub SUB;
  return SUB.sub() != 27;
}
_ATEOF


cat >subdir/sub.cxx <<'_ATEOF'
#include "sub.hxx"

int libsub::sub (void) { return 27; }
_ATEOF


$LIBTOOLIZE --copy


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/am-subdir.at:147: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "am-subdir.at:147"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/am-subdir.at:147"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1




{ set +x
$as_echo "$at_srcdir/am-subdir.at:147: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "am-subdir.at:147"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/am-subdir.at:147"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/am-subdir.at:147: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "am-subdir.at:147"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/am-subdir.at:147"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/am-subdir.at:147: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "am-subdir.at:147"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/am-subdir.at:147"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/am-subdir.at:147: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "am-subdir.at:147"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/am-subdir.at:147"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/am-subdir.at:147: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "am-subdir.at:147"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/am-subdir.at:147"
$at_failed && at_fn_log_failure
$at_traceon; }

done



lt_exe=subdir/subdemo; if test -f "subdir/subdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/am-subdir.at:149: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "am-subdir.at:149"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/am-subdir.at:149"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_103
#AT_START_104
at_fn_group_banner 104 'lt_dlexit.at:31' \
  "lt_dlexit unloading libs" "                       " 11
at_xfail=no
(
  $as_echo "104. $at_setup_line: testing $at_desc ..."
  $at_traceon



# Test for
# http://lists.gnu.org/archive/html/bug-libtool/2007-01/msg00014.html
# http://lists.gnu.org/archive/html/bug-libtool/2008-03/msg00013.html

cat >main.c <<'_ATEOF'
#include <ltdl.h>
#include <stdio.h>
#include <string.h>

typedef int (*pfun_T) (int);
typedef int *pvar_T;

/* lt_dlopen wrapper */
static lt_dlhandle
xdlopen (const char *filename)
{
  lt_dlhandle handle = lt_dlopen (filename);
  if (!handle) {
    fprintf (stderr, "can't open the module %s!\n", filename);
    fprintf (stderr, "error was: %s\n", lt_dlerror());
  }
  return handle;
}

/* lt_dlsym wrapper: try one function and one variable */
static int
xdlsymtest (lt_dlhandle handle, const char *func, const char *var)
{
  pfun_T pf = (pfun_T) lt_dlsym (handle, func);
  pvar_T pv = (pvar_T) lt_dlsym (handle, var);
  if (pf == NULL) {
    fprintf (stderr, "function '%s' not found\n", func);
    return 1;
  }
  if (pv == NULL) {
    fprintf (stderr, "variable '%s' not found\n", var);
    return 1;
  }
  return (*pf) (*pv);
}

int
main (void)
{
  lt_dlhandle b1;

  LTDL_SET_PRELOADED_SYMBOLS();
  if (lt_dlinit() != 0) {
    fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
    return 1;
  }
  if (lt_dlexit() != 0) {
    fprintf (stderr, "error during first lt_dlexit: %s\n", lt_dlerror());
    return 1;
  }
  if (lt_dlinit() != 0) {
    fprintf (stderr, "error during second initialization: %s\n", lt_dlerror());
    return 1;
  }
  if (!(b1 = xdlopen ("modb1.la"))) return 1;
  if (xdlsymtest (b1, "fb1", "vb1")) return 1;
  /* do not lt_dlclose here on purpose.  */

  if (lt_dlexit() != 0) {
    fprintf (stderr, "error during exit: %s\n", lt_dlerror());
    return 1;
  }
  return 0;
}
_ATEOF



cat >a1.c <<'_ATEOF'
#ifdef __cplusplus
extern "C" {
#endif
int f1 (int x) { return x - 1; }
int v1 = 1;
#ifdef __cplusplus
}
#endif
_ATEOF


cat >b1.c <<'_ATEOF'
#ifdef __cplusplus
extern "C" {
#endif
#if defined DLL_EXPORT && defined _WIN32 && defined _MSC_VER
#  define LIBA1_SCOPE extern __declspec (dllimport)
#endif
#if !defined LIBA1_SCOPE
#  define LIBA1_SCOPE extern
#endif
LIBA1_SCOPE int f1 (int);
LIBA1_SCOPE int v1;
int fb1 (int x) { return f1 (v1) + x - 3; }
int vb1 = 3;
#ifdef __cplusplus
}
#endif
_ATEOF



: ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
: ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}

# Skip this test when called from:
#    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
{ set +x
$as_echo "$at_srcdir/lt_dlexit.at:142: case \$LIBLTDL in #(
 */_inst/lib/*) test -f \"\$LIBLTDL\" || (exit 77) ;;
esac"
at_fn_check_prepare_notrace 'an embedded newline' "lt_dlexit.at:142"
( $at_check_trace; case $LIBLTDL in #(
 */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
esac
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlexit.at:142"
$at_failed && at_fn_log_failure
$at_traceon; }


CPPFLAGS="$LTDLINCL $CPPFLAGS"
LDFLAGS="$LDFLAGS -no-undefined"

for file in a1 b1; do
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file.c
done
$CC $CPPFLAGS $CFLAGS -c main.c
{ set +x
$as_echo "$at_srcdir/lt_dlexit.at:153: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba1.la a1.lo \\
          -rpath /foo -avoid-version"
at_fn_check_prepare_notrace 'an embedded newline' "lt_dlexit.at:153"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba1.la a1.lo \
          -rpath /foo -avoid-version
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlexit.at:153"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/lt_dlexit.at:155: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o modb1.la b1.lo \\
          -rpath /foo -module -avoid-version liba1.la"
at_fn_check_prepare_notrace 'an embedded newline' "lt_dlexit.at:155"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o modb1.la b1.lo \
          -rpath /foo -module -avoid-version liba1.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlexit.at:155"
$at_failed && at_fn_log_failure
$at_traceon; }


# TODO: test -dlpreopen
for dlopen in -dlopen; do
  { set +x
$as_echo "$at_srcdir/lt_dlexit.at:160: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT \\
           \$dlopen modb1.la \$LIBLTDL"
at_fn_check_prepare_notrace 'an embedded newline' "lt_dlexit.at:160"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT \
           $dlopen modb1.la $LIBLTDL
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlexit.at:160"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/lt_dlexit.at:162: if \$LIBTOOL --mode=execute -dlopen modb1.la \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if $LIBTOOL --mode=execute -dlopen modb1.la \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "lt_dlexit.at:162"
( $at_check_trace; if $LIBTOOL --mode=execute -dlopen modb1.la "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlexit.at:162"
$at_failed && at_fn_log_failure
$at_traceon; }


done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_104
#AT_START_105
at_fn_group_banner 105 'lt_dladvise.at:29' \
  "lt_dlopenadvise library loading" "                " 11
at_xfail=no
(
  $as_echo "105. $at_setup_line: testing $at_desc ..."
  $at_traceon



cat >main.c <<'_ATEOF'
#include <ltdl.h>
#include <stdio.h>

typedef int funcp (int);

static int errors = 0;

static void
complain (const char *msg)
{
  const char *errmsg = lt_dlerror ();
  fprintf (stderr, "%s", msg);
  if (errmsg)
    fprintf (stderr, ": %s\n", errmsg);
  else
    fprintf (stderr, ".\n");
  ++errors;
}

static lt_dlhandle
moduleopen (const char *filename, lt_dladvise advise)
{
  lt_dlhandle handle;

  handle = lt_dlopenadvise (filename, advise);
  if (!handle)
    {
      fprintf (stderr, "can't open the module %s!\n", filename);
      complain ("error was");
    }

  return handle;
}

static int
moduletest (lt_dlhandle handle, const char *fname, const char *vname)
{
  funcp *f = (funcp *) lt_dlsym (handle, fname);
  int   *v = (int *)   lt_dlsym (handle, vname);

  if (!f)
    {
      fprintf (stderr, "function '%s' not found\n", fname);
      ++errors;
      return -1;
    }
  if (!v)
    {
      fprintf (stderr, "variable '%s' not found\n", vname);
      ++errors;
      return -1;
    }
  return f (*v);
}

void
hint_ext (void)
{
  lt_dlhandle handle;
  lt_dladvise advise;

  if (lt_dladvise_init (&advise) || lt_dladvise_ext (&advise))
    complain ("error setting advise ext");

  handle = moduleopen ("libdepend", advise);

  if (handle)
    printf ("depend: %d\n", moduletest (handle, "g", "j"));

  lt_dladvise_destroy (&advise);
}

void
hint_resident (void)
{
  const lt_dlinfo *info;
  lt_dlhandle handle;
  lt_dladvise advise;

  if (lt_dladvise_init (&advise) || lt_dladvise_resident (&advise))
    complain ("error setting advise resident");

  handle = moduleopen ("libresident.la", advise);

  if (handle)
    {
      info = lt_dlgetinfo (handle);
      if (!info->is_resident)
	complain ("error taking advise resident");

      /* cannot close resident modules */
      if (lt_dlclose (handle) == 0)
	complain ("successfully unloaded resident module");

      printf ("resident: %d\n", moduletest (handle, "func", "numb"));
    }

  lt_dladvise_destroy (&advise);
}

void
hint_local (void)
{
  const lt_dlinfo *info;
  lt_dlhandle handle;
  lt_dladvise advise;

  if (lt_dladvise_init (&advise) || lt_dladvise_local (&advise))
    complain ("error setting advise local");

  handle = moduleopen ("liblocal.la", advise);

  if (handle)
    {
      info = lt_dlgetinfo (handle);
      printf ("local: %d\n", moduletest (handle, "f", "i"));

      /* If the symlocal hint was taken, don't unload this module
         and test that our local symbolnames won't clash with modglobal.  */
      if (!info->is_symlocal && lt_dlclose (handle))
	complain ("error unloading modlocal");
    }

  lt_dladvise_destroy (&advise);
}

void
hint_global (void)
{
  const lt_dlinfo *info;
  lt_dlhandle handle;
  lt_dladvise advise;

  if (lt_dladvise_init (&advise) || lt_dladvise_global (&advise))
    complain ("error setting advise global");

  handle = moduleopen ("libglobal.la", advise);

  if (handle)
    {
      info = lt_dlgetinfo (handle);
      printf ("global: %d\n", moduletest (handle, "f", "i"));

      /* Don't attempt to load moddepend unless modglobal was successfully
         loaded and the symglobal hint was taken, and the system allows to
	 have undefined symbols.  */
      if (info && info->is_symglobal && HAVE_UNDEFINED_SYMBOLS)
        {
          hint_ext ();
        }
      else
        {
          /* Fake the output so the test won't fail when using a dlloader
             unable to take symglobal hints.  */
          printf ("depend: 5\n");
        }
    }

  lt_dladvise_destroy (&advise);
}

void
hint_preload (void)
{
  lt_dlhandle handle;
  lt_dladvise advise;

  if (lt_dladvise_init (&advise) || lt_dladvise_preload (&advise))
    complain ("error setting advise preload");

  handle = moduleopen ("libpreload.la", advise);

  if (handle)
    {
      printf("preload: %d\n", moduletest (handle, "h", "k"));
    }

  lt_dladvise_destroy (&advise);
}

int
main (void)
{

  LTDL_SET_PRELOADED_SYMBOLS();

  if (lt_dlinit() != 0)
    {
      fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
      return 1;
    }

  hint_resident ();
  hint_local ();
#ifdef HAVE_SHARED
  hint_global ();
#else
  /* This ugly hack is because we have symbols with the same name in both the
     global module and the local one, we can't lt_dlopen the local module
     locally and then later load the global module globally because of this.
     Instead of skipping the test entirely, we test what we can and
     have this hack. */
  printf ("global: 4\n");
  printf ("depend: 5\n");
#endif
  hint_preload ();

  if (lt_dlexit () != 0)
    complain ("error during exit");

  return (errors != 0);
}
_ATEOF


cat >modresident.c <<'_ATEOF'
#ifdef __cplusplus
extern "C" {
#endif
int func (int x) { return x / 3; }
int numb = 7;
#ifdef __cplusplus
}
#endif
_ATEOF


cat >modlocal.c <<'_ATEOF'
#ifdef __cplusplus
extern "C" {
#endif
int f (int x) { return (x * x) / 10; }
int i = 6;
#ifdef __cplusplus
}
#endif
_ATEOF


cat >modglobal.c <<'_ATEOF'
#ifdef __cplusplus
extern "C" {
#endif
int f (int x) { return x - 1; }
int i = 5;
#ifdef __cplusplus
}
#endif
_ATEOF


cat >moddepend.c <<'_ATEOF'
#ifdef __cplusplus
extern "C" {
#endif
extern int f (int), i;
int g (int x) { return f (i) + x - 3; }
int j = 4;
#ifdef __cplusplus
}
#endif
_ATEOF


cat >modpreload.c <<'_ATEOF'
#ifdef __cplusplus
extern "C" {
#endif
int h (int x) { return 2 * x; }
int k = 3;
#ifdef __cplusplus
}
#endif
_ATEOF


cat >expout <<'_ATEOF'
resident: 2
local: 3
global: 4
depend: 5
preload: 6
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

: ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
: ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}

# Skip this test when called from:
#    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
{ set +x
$as_echo "$at_srcdir/lt_dladvise.at:316: case \$LIBLTDL in #(
 */_inst/lib/*) test -f \"\$LIBLTDL\" || (exit 77) ;;
esac"
at_fn_check_prepare_notrace 'an embedded newline' "lt_dladvise.at:316"
( $at_check_trace; case $LIBLTDL in #(
 */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
esac
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dladvise.at:316"
$at_failed && at_fn_log_failure
$at_traceon; }


CPPFLAGS="$LTDLINCL $CPPFLAGS"

dlopenable='resident local global'
dlpreloadable='preload'

# ------------------------------------------------------------------------- #
# The depend test makes no sense unless compiled without -no-undefined. By  #
# not building the depend module in that case, when this test passes we can #
# be sure that hint_global() above, is being correctly informed those hosts #
# are reporting not able to accept the global hint to lt_dlopenadvise().    #
# ------------------------------------------------------------------------- #

have_shared=false
$LIBTOOL --features | $GREP 'enable shared libraries' >/dev/null && have_shared=:

case $host_os,$have_shared in
cygwin* | mingw* | cegcc* | *,false)
  # These hosts do not support linking without -no-undefined
  CPPFLAGS="$CPPFLAGS -DHAVE_UNDEFINED_SYMBOLS=0"
  ;;
*)
  CPPFLAGS="$CPPFLAGS -DHAVE_UNDEFINED_SYMBOLS=1"
  dlopenable="$dlopen depend"
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c moddepend.c
  { set +x
$as_echo "$at_srcdir/lt_dladvise.at:344: \$LIBTOOL --mode=link \$CC -module \$CFLAGS \$LDFLAGS -o libdepend.la            moddepend.lo -rpath /foo -avoid-version"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC -module $CFLAGS $LDFLAGS -o libdepend.la            moddepend.lo -rpath /foo -avoid-version" "lt_dladvise.at:344"
( $at_check_trace; $LIBTOOL --mode=link $CC -module $CFLAGS $LDFLAGS -o libdepend.la            moddepend.lo -rpath /foo -avoid-version
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dladvise.at:344"
$at_failed && at_fn_log_failure
$at_traceon; }

  ;;
esac

$have_shared && CPPFLAGS="$CPPFLAGS -DHAVE_SHARED"

# ------------------------------------------------------------------------- #
# Other modules can be tested correctly even when built with -no-undefined. #
# ------------------------------------------------------------------------- #

LDFLAGS="$LDFLAGS -no-undefined"

$CC $CPPFLAGS $CFLAGS -c main.c
for name in resident local global preload; do
  # FIXME: adding -static to libpreload shouldn't be necessary.
  #        Fix this properly in ltmain, then remove this workaround.
  if test preload = "$name"; then
    st=-static
  else
    st=
  fi
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c mod$name.c
  { set +x
$as_echo "$at_srcdir/lt_dladvise.at:367: \$LIBTOOL --mode=link \$CC -module \$CFLAGS \$LDFLAGS -o lib\$name.la            mod\$name.lo \$st -rpath /foo -avoid-version"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC -module $CFLAGS $LDFLAGS -o lib$name.la            mod$name.lo $st -rpath /foo -avoid-version" "lt_dladvise.at:367"
( $at_check_trace; $LIBTOOL --mode=link $CC -module $CFLAGS $LDFLAGS -o lib$name.la            mod$name.lo $st -rpath /foo -avoid-version
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dladvise.at:367"
$at_failed && at_fn_log_failure
$at_traceon; }

done

preloaded=
for module in $dlpreloadable; do
  preloaded="${preloaded+$preloaded }-dlpreopen lib$module.la"
done

modules=
for module in $dlopenable; do
  modules="${modules+$modules }-dlopen lib$module.la"
done

{ set +x
$as_echo "$at_srcdir/lt_dladvise.at:381: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT \$preloaded \$modules \$LIBLTDL"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT $preloaded $modules $LIBLTDL" "lt_dladvise.at:381"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT $preloaded $modules $LIBLTDL
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dladvise.at:381"
$at_failed && at_fn_log_failure
$at_traceon; }


# Remove loadable libpreload module, so we know it is the preloaded module
# that is being executed by a successful test invocation:
{ set +x
$as_echo "$at_srcdir/lt_dladvise.at:386: \$LIBTOOL --mode=clean rm -f libpreload.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=clean rm -f libpreload.la" "lt_dladvise.at:386"
( $at_check_trace; $LIBTOOL --mode=clean rm -f libpreload.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dladvise.at:386"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/lt_dladvise.at:388: if \$LIBTOOL --mode=execute \$modules \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if $LIBTOOL --mode=execute $modules \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "lt_dladvise.at:388"
( $at_check_trace; if $LIBTOOL --mode=execute $modules "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/lt_dladvise.at:388"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_105
#AT_START_106
at_fn_group_banner 106 'lt_dlopen.at:24' \
  "lt_dlopen error messages" "                       " 11
at_xfail=yes
(
  $as_echo "106. $at_setup_line: testing $at_desc ..."
  $at_traceon



# The bug is not fixed:


# This test only works if the system allows undefined symbols.
eval `$LIBTOOL --config | $GREP '^allow_undefined_flag='`
{ set +x
$as_echo "$at_srcdir/lt_dlopen.at:32: test unsupported != \"\$allow_undefined_flag\" || exit 77"
at_fn_check_prepare_dynamic "test unsupported != \"$allow_undefined_flag\" || exit 77" "lt_dlopen.at:32"
( $at_check_trace; test unsupported != "$allow_undefined_flag" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopen.at:32"
$at_failed && at_fn_log_failure
$at_traceon; }


cat >main.c <<'_ATEOF'
#include <ltdl.h>
#include <stdio.h>

int
main (int argc, char* argv[])
{
  int err = 0;
  lt_dlhandle plugin_handle;

  if (argc < 2)
    {
      fprintf (stderr, "usage: %s plugin\n", argv[0]);
      return 1;
    }

  lt_dlinit ();
  plugin_handle = lt_dlopenext (argv[1]);
  if (NULL != plugin_handle)
    {
      printf ("plugin opened successfully!\n");
      lt_dlclose (plugin_handle);
    }
  else
    {
      printf ("plugin failed to open: %s\n", lt_dlerror());
      err = 1;
    }
  lt_dlexit ();
  return err;
}
_ATEOF


cat >good-plugin.c <<'_ATEOF'
int foo;
int *i = &foo;
_ATEOF


cat >missing-symbol-plugin.c <<'_ATEOF'
/* On systems that allow undefined symbols, this will compile,
     but the symbol "foo" won't be found at runtime */
extern int foo;
int *i = &foo;
_ATEOF


: ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
: ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}

CPPFLAGS="$LTDLINCL $CPPFLAGS"
inst=`pwd`/inst
libdir=$inst/lib

{ set +x
$as_echo "$at_srcdir/lt_dlopen.at:86: \$CC \$CPPFLAGS \$CFLAGS -c main.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c main.c" "lt_dlopen.at:86"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c main.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopen.at:86"
$at_failed && at_fn_log_failure
$at_traceon; }

for file in good-plugin.c missing-symbol-plugin.c; do
  { set +x
$as_echo "$at_srcdir/lt_dlopen.at:88: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c \$file"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file" "lt_dlopen.at:88"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopen.at:88"
$at_failed && at_fn_log_failure
$at_traceon; }

done
{ set +x
$as_echo "$at_srcdir/lt_dlopen.at:91: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o good-plugin.la -rpath \$libdir 	 -module -avoid-version good-plugin.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o good-plugin.la -rpath $libdir 	 -module -avoid-version good-plugin.lo" "lt_dlopen.at:91"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o good-plugin.la -rpath $libdir 	 -module -avoid-version good-plugin.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopen.at:91"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/lt_dlopen.at:93: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o missing-symbol-plugin.la -rpath \$libdir	 -module -avoid-version missing-symbol-plugin.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o missing-symbol-plugin.la -rpath $libdir	 -module -avoid-version missing-symbol-plugin.lo" "lt_dlopen.at:93"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o missing-symbol-plugin.la -rpath $libdir	 -module -avoid-version missing-symbol-plugin.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopen.at:93"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/lt_dlopen.at:96: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT 	 -dlopen good-plugin.la -dlopen missing-symbol-plugin.la \$LIBLTDL"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT 	 -dlopen good-plugin.la -dlopen missing-symbol-plugin.la $LIBLTDL" "lt_dlopen.at:96"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT 	 -dlopen good-plugin.la -dlopen missing-symbol-plugin.la $LIBLTDL
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopen.at:96"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/lt_dlopen.at:100: if \"\$lt_exe\" ./good-plugin.la; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ./good-plugin.la; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "lt_dlopen.at:100"
( $at_check_trace; if "$lt_exe" ./good-plugin.la; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopen.at:100"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/lt_dlopen.at:101: if \"\$lt_exe\" ./missing-symbol-plugin.la; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 1 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ./missing-symbol-plugin.la; then :; else lt_status=$?; 	   test \"$lt_status\" != 1 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "lt_dlopen.at:101"
( $at_check_trace; if "$lt_exe" ./missing-symbol-plugin.la; then :; else lt_status=$?; 	   test "$lt_status" != 1 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/lt_dlopen.at:101"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/lt_dlopen.at:102: \$GREP 'missing symbol' stderr"
at_fn_check_prepare_dynamic "$GREP 'missing symbol' stderr" "lt_dlopen.at:102"
( $at_check_trace; $GREP 'missing symbol' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopen.at:102"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_106
#AT_START_107
at_fn_group_banner 107 'lt_dlopen_a.at:24' \
  "lt_dlopen archive" "                              " 11
at_xfail=no
(
  $as_echo "107. $at_setup_line: testing $at_desc ..."
  $at_traceon



cat >main.c <<'_ATEOF'
#include <ltdl.h>
#include <stdio.h>

/* This dlopen() in the main executable should override any dlopen()s in
   shared libraries etc.

   If that is not the case (or the platform does not use dlopen()) then this
   test should exit 77, causing the test to SKIP.
*/
static int retcde = 77;

void * dlopen(const char *path, int mode) {
  if (!(strcmp(path,"plugin.a") && strcmp(path,"plugin.lib")))
    {
      fprintf(stderr,"Tried to open archive %s\n",path);
      retcde = 1;
    }
  else
    {
      fprintf(stderr,"Opening ... %s\n", path);
      if (retcde == 77) retcde = 0;
    }
  return NULL;
}

int
main (int argc, char* argv[])
{
  int err = 0;
  lt_dlhandle plugin_handle;

  lt_dlinit ();
  plugin_handle = lt_dlopenext (argv[1]);
  lt_dlexit ();
  return retcde;
}
_ATEOF


cat >plugin.c <<'_ATEOF'

int i = 1;
_ATEOF


: ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
: ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}

CPPFLAGS="$LTDLINCL $CPPFLAGS"
inst=`pwd`/inst
libdir=$inst/lib
bindir=$inst/bin

{ set +x
$as_echo "$at_srcdir/lt_dlopen_a.at:79: \$CC \$CPPFLAGS \$CFLAGS -c main.c || exit 77"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c main.c || exit 77" "lt_dlopen_a.at:79"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c main.c || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopen_a.at:79"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/lt_dlopen_a.at:80: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c plugin.c || exit 77"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c plugin.c || exit 77" "lt_dlopen_a.at:80"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c plugin.c || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopen_a.at:80"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/lt_dlopen_a.at:82: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o plugin.la -rpath 	 \$libdir -module -no-undefined -avoid-version plugin.lo || exit 77"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o plugin.la -rpath 	 $libdir -module -no-undefined -avoid-version plugin.lo || exit 77" "lt_dlopen_a.at:82"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o plugin.la -rpath 	 $libdir -module -no-undefined -avoid-version plugin.lo || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopen_a.at:82"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/lt_dlopen_a.at:86: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT 	 main.\$OBJEXT -dlopen plugin.la \$LIBLTDL || exit 77"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT 	 main.$OBJEXT -dlopen plugin.la $LIBLTDL || exit 77" "lt_dlopen_a.at:86"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT 	 main.$OBJEXT -dlopen plugin.la $LIBLTDL || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopen_a.at:86"
$at_failed && at_fn_log_failure
$at_traceon; }


mkdir -p $libdir
mkdir -p $bindir

{ set +x
$as_echo "$at_srcdir/lt_dlopen_a.at:93: \$LIBTOOL --mode=install cp plugin.la \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp plugin.la $libdir" "lt_dlopen_a.at:93"
( $at_check_trace; $LIBTOOL --mode=install cp plugin.la $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopen_a.at:93"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/lt_dlopen_a.at:94: \$LIBTOOL --mode=install cp main\$EXEEXT \$bindir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp main$EXEEXT $bindir" "lt_dlopen_a.at:94"
( $at_check_trace; $LIBTOOL --mode=install cp main$EXEEXT $bindir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopen_a.at:94"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/lt_dlopen_a.at:95: test -f \"\$libdir/plugin.a\" || exit 77"
at_fn_check_prepare_dynamic "test -f \"$libdir/plugin.a\" || exit 77" "lt_dlopen_a.at:95"
( $at_check_trace; test -f "$libdir/plugin.a" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopen_a.at:95"
$at_failed && at_fn_log_failure
$at_traceon; }

lt_exe=$bindir/main; if test -f "$bindir/main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/lt_dlopen_a.at:96: if \"\$lt_exe\" \$libdir/plugin.la; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" $libdir/plugin.la; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "lt_dlopen_a.at:96"
( $at_check_trace; if "$lt_exe" $libdir/plugin.la; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopen_a.at:96"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_107
#AT_START_108
at_fn_group_banner 108 'lt_dlopenext.at:23' \
  "lt_dlopenext error messages" "                    " 11
at_xfail=no
(
  $as_echo "108. $at_setup_line: testing $at_desc ..."
  $at_traceon



# This test requires shared library support.
{ set +x
$as_echo "$at_srcdir/lt_dlopenext.at:27: \$LIBTOOL --features | \$GREP 'enable shared libraries' || exit 77"
at_fn_check_prepare_notrace 'a shell pipeline' "lt_dlopenext.at:27"
( $at_check_trace; $LIBTOOL --features | $GREP 'enable shared libraries' || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopenext.at:27"
$at_failed && at_fn_log_failure
$at_traceon; }


prefix=`pwd`/inst
libdir=$prefix/lib
bindir=$prefix/bin
mkdir $prefix $libdir $bindir

# This code is copied from the Autobook:
# <http://sources.redhat.com/autobook/autobook/autobook_169.html>
# so if it needs changes, be sure to notify the Autobook authors
# about them.

cat >simple-module.c <<'_ATEOF'

#include <stdio.h>

#ifdef __cplusplus
extern "C"
#endif
int
run (const char *argument)
{
  printf ("Hello, %s!\n", argument);
  return 0;
}
_ATEOF


cat >ltdl-loader.c <<'_ATEOF'

#include <stdio.h>
#include <stdlib.h>
#ifndef EXIT_FAILURE
#  define EXIT_FAILURE        1
#  define EXIT_SUCCESS        0
#endif

#include <limits.h>
#ifndef PATH_MAX
#  define PATH_MAX 255
#endif

#include <string.h>
#include <ltdl.h>

#ifndef MODULE_PATH_ENV
#  define MODULE_PATH_ENV        "MODULE_PATH"
#endif

typedef int entrypoint (const char *argument);

/* Save and return a copy of the dlerror() error  message,
   since the next API call may overwrite the original. */
static char *dlerrordup (char *errormsg);

int
main (int argc, const char *argv[])
{
  char *errormsg = NULL;
  lt_dlhandle module = NULL;
  entrypoint *run = NULL;
  int errors = 0;

  if (argc != 3)
    {
      fprintf (stderr, "USAGE: main MODULENAME ARGUMENT\n");
      exit (EXIT_FAILURE);
    }

  /* Initialise libltdl. */
  errors = lt_dlinit ();

  /* Set the module search path. */
  if (!errors)
    {
      const char *path = getenv (MODULE_PATH_ENV);

      if (path != NULL)
        errors = lt_dlsetsearchpath (path);
    }

  /* Load the module. */
  if (!errors)
    module = lt_dlopenext (argv[1]);

  /* Find the entry point. */
  if (module)
    {
      run = (entrypoint *) lt_dlsym (module, "run");

      /* In principle, run might legitimately be NULL, so
         I don't use run == NULL as an error indicator
         in general. */
      errormsg = dlerrordup (errormsg);
      if (errormsg != NULL)
        {
          errors = lt_dlclose (module);
          module = NULL;
        }
    }
  else
    errors = 1;

  /* Call the entry point function. */
  if (!errors)
    {
      int result = (*run) (argv[2]);
      if (result < 0)
        errormsg = strdup ("module entry point execution failed");
      else
        printf ("\t=> %d\n", result);
    }

  /* Unload the module, now that we are done with it. */
  if (!errors)
    errors = lt_dlclose (module);

  if (errors)
    {
      /* Diagnose the encountered error. */
      errormsg = dlerrordup (errormsg);

      if (!errormsg)
        {
          fprintf (stderr, "%s: dlerror() failed.\n", argv[0]);
          return EXIT_FAILURE;
        }
    }

  /* Finished with ltdl now. */
  if (!errors)
    if (lt_dlexit () != 0)
      errormsg = dlerrordup (errormsg);

  if (errormsg)
    {
      fprintf (stderr, "%s: %s.\n", argv[0], errormsg);
      free (errormsg);
      exit (EXIT_FAILURE);
    }

  return EXIT_SUCCESS;
}

/* Be careful to save a copy of the error message,
   since the  next API call may overwrite the original. */
static char *
dlerrordup (char *errormsg)
{
  char *error = (char *) lt_dlerror ();
  if (error && !errormsg)
    errormsg = strdup (error);
  return errormsg;
}
_ATEOF


: ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
: ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}

# Skip this test when called from:
#    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
{ set +x
$as_echo "$at_srcdir/lt_dlopenext.at:188: case \$LIBLTDL in #(
 */_inst/lib/*) test -f \"\$LIBLTDL\" || (exit 77) ;;
esac"
at_fn_check_prepare_notrace 'an embedded newline' "lt_dlopenext.at:188"
( $at_check_trace; case $LIBLTDL in #(
 */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
esac
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopenext.at:188"
$at_failed && at_fn_log_failure
$at_traceon; }


CPPFLAGS="$LTDLINCL $CPPFLAGS"
LDFLAGS="$LDFLAGS -no-undefined"

{ set +x
$as_echo "$at_srcdir/lt_dlopenext.at:195: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c simple-module.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c simple-module.c" "lt_dlopenext.at:195"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c simple-module.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopenext.at:195"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/lt_dlopenext.at:197: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o simple-module.la 	 simple-module.lo -rpath \$libdir -module -avoid-version"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o simple-module.la 	 simple-module.lo -rpath $libdir -module -avoid-version" "lt_dlopenext.at:197"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o simple-module.la 	 simple-module.lo -rpath $libdir -module -avoid-version
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopenext.at:197"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/lt_dlopenext.at:200: \$CC \$CPPFLAGS \$CFLAGS -c ltdl-loader.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c ltdl-loader.c" "lt_dlopenext.at:200"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c ltdl-loader.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopenext.at:200"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/lt_dlopenext.at:202: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o ltdl-loader\$EXEEXT 	 ltdl-loader.\$OBJEXT -dlopen self \$LIBLTDL"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o ltdl-loader$EXEEXT 	 ltdl-loader.$OBJEXT -dlopen self $LIBLTDL" "lt_dlopenext.at:202"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o ltdl-loader$EXEEXT 	 ltdl-loader.$OBJEXT -dlopen self $LIBLTDL
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopenext.at:202"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/lt_dlopenext.at:205: \$LIBTOOL --mode=install cp simple-module.la \$libdir/simple-module.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp simple-module.la $libdir/simple-module.la" "lt_dlopenext.at:205"
( $at_check_trace; $LIBTOOL --mode=install cp simple-module.la $libdir/simple-module.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopenext.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/lt_dlopenext.at:206: \$LIBTOOL --mode=clean rm -f simple-module.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=clean rm -f simple-module.la" "lt_dlopenext.at:206"
( $at_check_trace; $LIBTOOL --mode=clean rm -f simple-module.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopenext.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }


# Try finding the module with and without the .la file, with absolute
# path, relative path, or one of the path variables.  Do not override
# $PATH for w32, see shlibpath.at for the hacks this requires.
#
# Finding the module without the .la file will not work if MODULE_EXT
# aka. shared_ext is empty.

eval `$LIBTOOL --config | $EGREP '^(shlibpath_var|shrext_cmds)='`

module=no
eval shared_ext=\"$shrext_cmds\"
if test -n "$shared_ext"; then
  have_lafile="with without"
else
  have=with
fi

if test PATH = "$shlibpath_var"; then
  $unset shlibpath_var || shlibpath_var=
fi

for lafile in $have_lafile; do
  if test without = "$lafile"; then
    rm $libdir/simple-module.la
  fi

  for dir in inst/lib "$libdir"; do
    lt_exe=./ltdl-loader; if test -f "./ltdl-loader$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/lt_dlopenext.at:235: if \"\$lt_exe\" \$dir/simple-module World; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" $dir/simple-module World; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "lt_dlopenext.at:235"
( $at_check_trace; if "$lt_exe" $dir/simple-module World; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopenext.at:235"
$at_failed && at_fn_log_failure
$at_traceon; }


    { set +x
$as_echo "$at_srcdir/lt_dlopenext.at:237: \$GREP \"Hello, World\" stdout"
at_fn_check_prepare_dynamic "$GREP \"Hello, World\" stdout" "lt_dlopenext.at:237"
( $at_check_trace; $GREP "Hello, World" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopenext.at:237"
$at_failed && at_fn_log_failure
$at_traceon; }


    for var in MODULE_PATH LTDL_LIBRARY_PATH $shlibpath_var
    do
      eval $var=\$dir
      export $var
      lt_exe=./ltdl-loader; if test -f "./ltdl-loader$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/lt_dlopenext.at:243: if \"\$lt_exe\" simple-module World; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" simple-module World; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "lt_dlopenext.at:243"
( $at_check_trace; if "$lt_exe" simple-module World; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopenext.at:243"
$at_failed && at_fn_log_failure
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/lt_dlopenext.at:245: \$GREP \"Hello, World\" stdout"
at_fn_check_prepare_dynamic "$GREP \"Hello, World\" stdout" "lt_dlopenext.at:245"
( $at_check_trace; $GREP "Hello, World" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lt_dlopenext.at:245"
$at_failed && at_fn_log_failure
$at_traceon; }

      $unset $var || eval $var=
    done
  done
done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_108
#AT_START_109
at_fn_group_banner 109 'ltdl-libdir.at:23' \
  "libdir of installed modules" "                    " 11
at_xfail=no
(
  $as_echo "109. $at_setup_line: testing $at_desc ..."
  $at_traceon



# This test requires shared library support.
{ set +x
$as_echo "$at_srcdir/ltdl-libdir.at:27: \$LIBTOOL --features | \$GREP 'enable shared libraries' || exit 77"
at_fn_check_prepare_notrace 'a shell pipeline' "ltdl-libdir.at:27"
( $at_check_trace; $LIBTOOL --features | $GREP 'enable shared libraries' || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ltdl-libdir.at:27"
$at_failed && at_fn_log_failure
$at_traceon; }


# With MinGW, try Windows-style paths only.
if pwd -W >/dev/null 2>&1; then
  prefix=`pwd -W`/inst
else
  prefix=`pwd`/inst
fi
libdir=$prefix/lib
bindir=$prefix/bin
mkdir $prefix $libdir $bindir

cat >a.c <<'_ATEOF'
#ifdef __cplusplus
extern "C"
#endif
int f (void)
{
  return 42;
}
_ATEOF


cat >m.c <<'_ATEOF'

#include <stdio.h>
#include <ltdl.h>

typedef int func_f(void);

int
main (int argc, const char *argv[])
{
  lt_dlhandle module = NULL;
  func_f *f = NULL;

  if (lt_dlinit()) {
    fprintf(stderr, "lt_dlinit failed '%s'\n", lt_dlerror());
    return 1;
  }

  module = lt_dlopen("./a.la");

  if (!module) {
    fprintf(stderr, "lt_dlopen failed '%s'\n", lt_dlerror());
    return 1;
  }

  f = (func_f *)lt_dlsym(module, "f");

  if (!f) {
    fprintf(stderr, "lt_dlsym failed '%s'\n", lt_dlerror());
    return 1;
  }

  if (f() != 42) {
    fprintf(stderr, "f did not return 42\n");
    return 1;
  }

  lt_dlclose(module);
  lt_dlexit();
  return 0;
}
_ATEOF


: ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
: ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}

# Skip installcheck if --disable-ltdl-install was used.
{ set +x
$as_echo "$at_srcdir/ltdl-libdir.at:97: test -f \"\$LIBLTDL\" || exit 77"
at_fn_check_prepare_dynamic "test -f \"$LIBLTDL\" || exit 77" "ltdl-libdir.at:97"
( $at_check_trace; test -f "$LIBLTDL" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ltdl-libdir.at:97"
$at_failed && at_fn_log_failure
$at_traceon; }


CPPFLAGS="$LTDLINCL $CPPFLAGS"
LDFLAGS="$LDFLAGS -no-undefined"

{ set +x
$as_echo "$at_srcdir/ltdl-libdir.at:102: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c a.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c" "ltdl-libdir.at:102"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ltdl-libdir.at:102"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ltdl-libdir.at:104: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o a.la 	 a.lo -rpath \$libdir -module -shared -avoid-version"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o a.la 	 a.lo -rpath $libdir -module -shared -avoid-version" "ltdl-libdir.at:104"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o a.la 	 a.lo -rpath $libdir -module -shared -avoid-version
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ltdl-libdir.at:104"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ltdl-libdir.at:107: \$CC \$CPPFLAGS \$CFLAGS -c m.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c m.c" "ltdl-libdir.at:107"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c m.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ltdl-libdir.at:107"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ltdl-libdir.at:109: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o m\$EXEEXT 	 m.\$OBJEXT \$LIBLTDL"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m$EXEEXT 	 m.$OBJEXT $LIBLTDL" "ltdl-libdir.at:109"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m$EXEEXT 	 m.$OBJEXT $LIBLTDL
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ltdl-libdir.at:109"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ltdl-libdir.at:112: \$LIBTOOL --mode=install cp a.la \$libdir/a.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp a.la $libdir/a.la" "ltdl-libdir.at:112"
( $at_check_trace; $LIBTOOL --mode=install cp a.la $libdir/a.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ltdl-libdir.at:112"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ltdl-libdir.at:114: \$LIBTOOL --mode=install cp m\$EXEEXT \$bindir/m\$EXEEXT"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp m$EXEEXT $bindir/m$EXEEXT" "ltdl-libdir.at:114"
( $at_check_trace; $LIBTOOL --mode=install cp m$EXEEXT $bindir/m$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ltdl-libdir.at:114"
$at_failed && at_fn_log_failure
$at_traceon; }


# Try finding the module via the libdir entry in a misplaced .la file.

mv $libdir/a.la $bindir/a.la
cd $bindir
lt_exe=./m; if test -f "./m$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/ltdl-libdir.at:121: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "ltdl-libdir.at:121"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ltdl-libdir.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_109
#AT_START_110
at_fn_group_banner 110 'ltdl-api.at:26' \
  "ltdl API" "                                       " 11
at_xfail=no
(
  $as_echo "110. $at_setup_line: testing $at_desc ..."
  $at_traceon



# Ensure that no symbols from argz are unrenamed.
eval `$LIBTOOL --config | $EGREP '^(NM|global_symbol_pipe|objext)='`
lt__argz_o=$abs_top_builddir/libltdl/lt__argz.$objext
{ set +x
$as_echo "$at_srcdir/ltdl-api.at:32: test -f \"\$lt__argz_o\" || exit 77"
at_fn_check_prepare_dynamic "test -f \"$lt__argz_o\" || exit 77" "ltdl-api.at:32"
( $at_check_trace; test -f "$lt__argz_o" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ltdl-api.at:32"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ltdl-api.at:33: eval \"\$NM \\\"\\\$lt__argz_o\\\" | \$global_symbol_pipe\""
at_fn_check_prepare_notrace 'a shell pipeline' "ltdl-api.at:33"
( $at_check_trace; eval "$NM \"\$lt__argz_o\" | $global_symbol_pipe"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ltdl-api.at:33"
$at_failed && at_fn_log_failure
$at_traceon; }

# Check for global symbols beginning with "argz_"
{ set +x
$as_echo "$at_srcdir/ltdl-api.at:36: \$GREP \"^T argz_\" stdout"
at_fn_check_prepare_dynamic "$GREP \"^T argz_\" stdout" "ltdl-api.at:36"
( $at_check_trace; $GREP "^T argz_" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ltdl-api.at:36"
$at_failed && at_fn_log_failure
$at_traceon; }

# and also for the _ prefixed version "_argz_"
{ set +x
$as_echo "$at_srcdir/ltdl-api.at:38: \$GREP \"^T _argz_\" stdout"
at_fn_check_prepare_dynamic "$GREP \"^T _argz_\" stdout" "ltdl-api.at:38"
( $at_check_trace; $GREP "^T _argz_" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ltdl-api.at:38"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_110
#AT_START_111
at_fn_group_banner 111 'dlloader-api.at:23' \
  "dlloader API" "                                   " 11
at_xfail=no
(
  $as_echo "111. $at_setup_line: testing $at_desc ..."
  $at_traceon



cat >main.c <<'_ATEOF'
#include <ltdl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static int
first_init (lt_user_data data)
{
  const char *ctx = (const char *) data;

  printf ("first_init: %s\n", ctx);

  return 0;
}

static lt_module
first_open (lt_user_data data, const char *filename, lt_dladvise advise)
{
  static const char *first_module = "first";
  const char *ctx = (const char *) data;

  /* Use a magic string to avoid possible interactions with file system
   * objects.  Prepend '/' to short-circuit libltdl's search of
   * $shlibpath_var (e.g. PATH, LD_LIBRARY_PATH, or similar).
   */
  if (!filename || strcmp (filename, "/libltdl_dlloader_api_test_first"))
    {
      printf ("first_open denies a request\n");
      lt_dlseterror (LT_ERROR_FILE_NOT_FOUND);
      return NULL;
    }

  printf ("first_open (\"%s\"): %s\n", filename, ctx);

  return (lt_module) first_module;
}

static const char *
first_symbol (void)
{
  return "first_symbol";
}

static void *
first_sym (lt_user_data data, lt_module module, const char *symbolname)
{
  const char *ctx = (const char *) data;
  const char *filename = (const char *) module;

  printf ("first_sym (%s): %s\n", filename, ctx);

  return (void *) first_symbol;
}

static int
first_close (lt_user_data data, lt_module module)
{
  const char *ctx = (const char *) data;
  const char *filename = (const char *) module;

  printf ("first_close (%s): %s\n", filename, ctx);

  return 0;
}

static int
first_exit (lt_user_data data)
{
  const char *ctx = (const char *) data;

  printf ("first_exit: %s\n", ctx);

  return 0;
}

static int
last_init (lt_user_data data)
{
  const char *ctx = (const char *) data;

  printf ("last_init: %s\n", ctx);

  return 0;
}

static lt_module
last_open (lt_user_data data, const char *filename, lt_dladvise advise)
{
  static const char *last_module = "last";
  const char *ctx = (const char *) data;

  /* Use a magic string to avoid possible interactions with file system
   * objects.  Prepend '/' to short-circuit libltdl's search of
   * $shlibpath_var (e.g. PATH, LD_LIBRARY_PATH, or similar).
   */
  if (!filename || strcmp (filename, "/libltdl_dlloader_api_test_last"))
    {
      printf ("last_open denies a request\n");
      lt_dlseterror (LT_ERROR_FILE_NOT_FOUND);
      return NULL;
    }

  printf ("last_open (\"%s\"): %s\n", filename, ctx);

  return (lt_module) last_module;
}

static const char *
last_symbol (void)
{
  return "last_symbol";
}

static void *
last_sym (lt_user_data data, lt_module module, const char *symbolname)
{
  const char *ctx = (const char *) data;
  const char *filename = (const char *) module;

  printf ("last_sym (%s): %s\n", filename, ctx);

  return (void *) last_symbol;
}

static int
last_close (lt_user_data data, lt_module module)
{
  const char *ctx = (const char *) data;
  const char *filename = (const char *) module;

  printf ("last_close (%s): %s\n", filename, ctx);

  return 0;
}

static int
last_exit (lt_user_data data)
{
  const char *ctx = (const char *) data;

  printf ("last_exit: %s\n", ctx);

  return 0;
}

typedef const char *module_func (void);

int
main (int argc, char* argv[])
{
  int err = 0;
  lt_dlvtable *first;
  lt_dlvtable *last;
  lt_dlhandle module = NULL;
  module_func *symbol;
  const char *first_ctx = "first_ctx";
  const char *last_ctx = "last_ctx";
  const lt_dlvtable *finder;

  LTDL_SET_PRELOADED_SYMBOLS ();

  if (lt_dlinit ())
    {
      printf ("lt_dlinit failed\n");
      return 1;
    }

  first = (lt_dlvtable *) malloc (sizeof (*first));
  if (!first)
    {
      printf ("malloc failed\n");
      err = 1;
      goto cleanup;
    }

  first->name = "first";
  first->sym_prefix = NULL;
  first->module_open = first_open;
  first->module_close = first_close;
  first->find_sym = first_sym;
  first->dlloader_init = first_init; /* test that it isn't called twice */
  first->dlloader_exit = first_exit;
  first->dlloader_data = (lt_user_data) first_ctx;
  first->priority = LT_DLLOADER_PREPEND;

  if (first_init (first->dlloader_data))
    {
      printf ("first_init failed\n");
      err = 1;
      goto cleanup;
    }

  if (lt_dlloader_add (first))
    {
      printf ("lt_dlloader_add failed: %s\n", lt_dlerror ());
      err = 1;
      goto cleanup;
    }

  finder = lt_dlloader_find ("first");

  if (!finder)
    {
      printf ("lt_dlloader_find failed: %s\n", lt_dlerror ());
      err = 1;
      goto cleanup;
    }

  printf ("Found loader \"%s\"\n", finder->name);

  last = (lt_dlvtable *) malloc (sizeof (*last));
  if (!last)
    {
      printf ("malloc failed\n");
      err = 1;
      goto cleanup;
    }

  last->name = "last";
  last->sym_prefix = NULL;
  last->module_open = last_open;
  last->module_close = last_close;
  last->find_sym = last_sym;
  last->dlloader_init = last_init; /* test that it isn't called twice */
  last->dlloader_exit = last_exit;
  last->dlloader_data = (lt_user_data) last_ctx;
  last->priority = LT_DLLOADER_APPEND;

  if (last_init (last->dlloader_data))
    {
      printf ("last_init failed\n");
      err = 1;
      goto cleanup;
    }

  if (lt_dlloader_add (last))
    {
      printf ("lt_dlloader_add failed: %s\n", lt_dlerror ());
      err = 1;
      goto cleanup;
    }

  finder = lt_dlloader_find ("last");

  if (!finder)
    {
      printf ("lt_dlloader_find failed: %s\n", lt_dlerror ());
      err = 1;
      goto cleanup;
    }

  printf ("Found loader \"%s\"\n", finder->name);

  /* Use a magic string to avoid possible interactions with file system
   * objects.  Prepend '/' to short-circuit libltdl's search of
   * $shlibpath_var (e.g. PATH, LD_LIBRARY_PATH, or similar).
   */
  module = lt_dlopen ("/libltdl_dlloader_api_test_first");

  if (!module)
    {
      printf ("lt_dlopen failed: %s\n", lt_dlerror ());
      err = 1;
      goto cleanup;
    }

  symbol = (module_func *) lt_dlsym (module, "symbol");

  if (!symbol)
    {
      printf ("lt_dlsym failed: %s\n", lt_dlerror ());
      err = 1;
      goto cleanup;
    }

  printf ("result: %s\n", symbol ());

  lt_dlclose (module);
  module = lt_dlopen ("./module.la");

  if (!module)
    {
      printf ("lt_dlopen failed: %s\n", lt_dlerror ());
      err = 1;
      goto cleanup;
    }

  symbol = (module_func *) lt_dlsym (module, "symbol");

  if (!symbol)
    {
      printf ("lt_dlsym failed: %s\n", lt_dlerror ());
      err = 1;
      goto cleanup;
    }

  printf ("result: %s\n", symbol ());

  lt_dlclose (module);

  /* Use a magic string to avoid possible interactions with file system
   * objects.  Prepend '/' to short-circuit libltdl's search of
   * $shlibpath_var (e.g. PATH, LD_LIBRARY_PATH, or similar).
   */
  module = lt_dlopen ("/libltdl_dlloader_api_test_last");

  if (!module)
    {
      printf ("lt_dlopen failed: %s\n", lt_dlerror ());
      err = 1;
      goto cleanup;
    }

  symbol = (module_func *) lt_dlsym (module, "symbol");

  if (!symbol)
    {
      printf ("lt_dlsym failed: %s\n", lt_dlerror ());
      err = 1;
      goto cleanup;
    }

  printf ("result: %s\n", symbol ());

  if (lt_dlopen ("no-module"))
    {
      printf ("lt_dlopen unexpectedly opened \"no-module\"\n");
      err = 1;
      goto cleanup;
    }

  if (lt_dlloader_remove ("first") != first)
    {
      printf ("vtable of first loader has changed\n");
      err = 1;
      goto cleanup;
    }

  free (first);

cleanup:
  if (module)
    {
      lt_dlclose (module);
    }
  lt_dlexit ();
  return err;
}
_ATEOF


cat >module.c <<'_ATEOF'

#ifdef __cplusplus
extern "C"
#endif
const char *symbol (void);
const char *
symbol (void)
{
  return "module_symbol";
}
_ATEOF


cat >expout <<'_ATEOF'
first_init: first_ctx
Found loader "first"
last_init: last_ctx
Found loader "last"
first_open ("/libltdl_dlloader_api_test_first"): first_ctx
first_sym (first): first_ctx
result: first_symbol
first_close (first): first_ctx
first_open denies a request
result: module_symbol
first_open denies a request
last_open ("/libltdl_dlloader_api_test_last"): last_ctx
last_sym (last): last_ctx
result: last_symbol
first_open denies a request
last_open denies a request
first_exit: first_ctx
last_close (last): last_ctx
last_exit: last_ctx
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

: ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
: ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}

# Skip this test when called from:
#    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
{ set +x
$as_echo "$at_srcdir/dlloader-api.at:417: case \$LIBLTDL in #(
 */_inst/lib/*) test -f \"\$LIBLTDL\" || (exit 77) ;;
esac"
at_fn_check_prepare_notrace 'an embedded newline' "dlloader-api.at:417"
( $at_check_trace; case $LIBLTDL in #(
 */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
esac
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/dlloader-api.at:417"
$at_failed && at_fn_log_failure
$at_traceon; }


CPPFLAGS="$LTDLINCL $CPPFLAGS"

{ set +x
$as_echo "$at_srcdir/dlloader-api.at:423: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c module.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c module.c" "dlloader-api.at:423"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c module.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/dlloader-api.at:423"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/dlloader-api.at:425: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o module.la 	 -rpath /nowhere -module -avoid-version -no-undefined 	 module.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o module.la 	 -rpath /nowhere -module -avoid-version -no-undefined 	 module.lo" "dlloader-api.at:425"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o module.la 	 -rpath /nowhere -module -avoid-version -no-undefined 	 module.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/dlloader-api.at:425"
$at_failed && at_fn_log_failure
$at_traceon; }


. ./module.la
{ set +x
$as_echo "$at_srcdir/dlloader-api.at:432: test -n \"\$dlname\" || (exit 77)"
at_fn_check_prepare_dynamic "test -n \"$dlname\" || (exit 77)" "dlloader-api.at:432"
( $at_check_trace; test -n "$dlname" || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/dlloader-api.at:432"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/dlloader-api.at:434: \$CC \$CPPFLAGS \$CFLAGS -c main.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c main.c" "dlloader-api.at:434"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c main.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/dlloader-api.at:434"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/dlloader-api.at:435: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT 	 main.\$OBJEXT -dlopen module.la \$LIBLTDL"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT 	 main.$OBJEXT -dlopen module.la $LIBLTDL" "dlloader-api.at:435"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT 	 main.$OBJEXT -dlopen module.la $LIBLTDL
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/dlloader-api.at:435"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/dlloader-api.at:439: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "dlloader-api.at:439"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/dlloader-api.at:439"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_111
#AT_START_112
at_fn_group_banner 112 'loadlibrary.at:23' \
  "loadlibrary error messages" "                     " 11
at_xfail=no
(
  $as_echo "112. $at_setup_line: testing $at_desc ..."
  $at_traceon



eval "`$LIBTOOL --config | $EGREP '^(objdir)='`"

cat >main.c <<'_ATEOF'
#include <ltdl.h>
#include <stdio.h>

static int
standard_error_message(const char *error)
{
  int error_number;

  for (error_number = 0; error_number < LT_ERROR_MAX; ++error_number)
    {
      lt_dlseterror (error_number);
      if (error == lt_dlerror ())
	{
	  return 1;
	}
    }

  lt_dlseterror (LT_ERROR_UNKNOWN);
  return 0;
}

int
main (int argc, char* argv[])
{
  int err = 0;
  lt_dlhandle module = NULL;
  const lt_dlvtable *loadlibrary;
  const lt_dlvtable *preopen;
  lt_dlloader loader = NULL;
  lt_dlloader next;
  const lt_dlvtable *vtable;
  void *symbol;
  const char *error;

  if (argc < 2)
    {
      fprintf (stderr, "usage: %s plugin [symbol]\n", argv[0]);
      return 1;
    }

  lt_dlinit ();

  loadlibrary = lt_dlloader_find ("lt_loadlibrary");
  if (!loadlibrary)
    {
      /* Skip if the loadlibrary loader isn't supported */
      printf ("loadlibrary loader not found\n");
      err = 77;
      goto cleanup;
    }

  preopen = lt_dlloader_find ("lt_preopen");
  if (!loadlibrary)
    {
      printf ("preopen loader not found\n");
      err = 2;
      goto cleanup;
    }

  /* Remove all loaders except the preopen and loadlibrary loaders. */
  while (next = lt_dlloader_next (loader))
    {
      if (lt_dlloader_get (next) == loadlibrary)
	{
	  loader = next;
	  continue;
	}

      if (lt_dlloader_get (next) == preopen)
	{
	  loader = next;
	  continue;
	}

      lt_dlloader_remove (lt_dlloader_get (next)->name);
    }

  module = lt_dlopen (argv[1]);
  error = lt_dlerror ();

  if (module)
    {
      printf ("lt_dlopen: success!\n");

      if (argc == 2)
	{
	  /* But failure was the desired result... */
	  printf ("expected failure\n");
	  err = 2;
	  goto cleanup;
	}
    }
  else if (argc > 2)
    {
      /* Didn't expect failure... */
      printf ("lt_dlopen: failure: %s\n", error);
      err = 2;
      goto cleanup;
    }
  else if (standard_error_message (error))
    {
      /* Expected custom error message... */
      printf ("lt_dlopen: standard error (bad): %s\n", error);
      err = 1;
      goto cleanup;
    }
  else
    {
      printf ("lt_dlopen: custom error (good): %s\n", error);
      goto cleanup;
    }

  symbol = lt_dlsym (module, argv[2]);
  error = lt_dlerror ();

  if (symbol)
    {
      printf ("lt_dlsym: success!\n");
    }
  else if (standard_error_message (error))
    {
      /* Expected custom failure message... */
      printf ("lt_dlsym: standard error (bad): %s\n", error);
      err = 1;
    }
  else
    {
      printf ("lt_dlsym: custom error (good): %s\n", error);
    }

cleanup:
  if (module)
    {
      lt_dlclose (module);
    }
  lt_dlexit ();
  return err;
}
_ATEOF


cat >foomod.c <<'_ATEOF'

#ifdef __cplusplus
extern "C"
#endif
int foosym (void);
int
foosym (void)
{
  return 0;
}
_ATEOF


cat >bardep.c <<'_ATEOF'

#ifdef __cplusplus
extern "C"
#endif
int bardep (void);
int
bardep (void)
{
  return 0;
}
_ATEOF


cat >barmod.c <<'_ATEOF'

#ifdef __cplusplus
extern "C" {
#endif
int bardep (void);
int barsym (void);
#ifdef __cplusplus
}
#endif
int
barsym (void)
{
  return bardep ();
}
_ATEOF


: ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
: ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}

# Skip this test when called from:
#    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
{ set +x
$as_echo "$at_srcdir/loadlibrary.at:217: case \$LIBLTDL in #(
 */_inst/lib/*) test -f \"\$LIBLTDL\" || (exit 77) ;;
esac"
at_fn_check_prepare_notrace 'an embedded newline' "loadlibrary.at:217"
( $at_check_trace; case $LIBLTDL in #(
 */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
esac
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/loadlibrary.at:217"
$at_failed && at_fn_log_failure
$at_traceon; }


CPPFLAGS="$LTDLINCL $CPPFLAGS"
inst=`pwd`/inst
libdir=$inst/lib

{ set +x
$as_echo "$at_srcdir/loadlibrary.at:225: \$CC \$CPPFLAGS \$CFLAGS -c main.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c main.c" "loadlibrary.at:225"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c main.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/loadlibrary.at:225"
$at_failed && at_fn_log_failure
$at_traceon; }

for file in foomod.c bardep.c barmod.c; do
  { set +x
$as_echo "$at_srcdir/loadlibrary.at:227: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c \$file"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file" "loadlibrary.at:227"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/loadlibrary.at:227"
$at_failed && at_fn_log_failure
$at_traceon; }

done
{ set +x
$as_echo "$at_srcdir/loadlibrary.at:230: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o foomod.la 	 -rpath \$libdir -module -avoid-version -no-undefined 	 foomod.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o foomod.la 	 -rpath $libdir -module -avoid-version -no-undefined 	 foomod.lo" "loadlibrary.at:230"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o foomod.la 	 -rpath $libdir -module -avoid-version -no-undefined 	 foomod.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/loadlibrary.at:230"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/loadlibrary.at:234: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o libbardep.la 	 -rpath \$libdir -avoid-version -no-undefined 	 bardep.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libbardep.la 	 -rpath $libdir -avoid-version -no-undefined 	 bardep.lo" "loadlibrary.at:234"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libbardep.la 	 -rpath $libdir -avoid-version -no-undefined 	 bardep.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/loadlibrary.at:234"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/loadlibrary.at:238: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o barmod.la 	 -rpath \$libdir -module -avoid-version -no-undefined 	 barmod.lo ./libbardep.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o barmod.la 	 -rpath $libdir -module -avoid-version -no-undefined 	 barmod.lo ./libbardep.la" "loadlibrary.at:238"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o barmod.la 	 -rpath $libdir -module -avoid-version -no-undefined 	 barmod.lo ./libbardep.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/loadlibrary.at:238"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/loadlibrary.at:243: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT 	 main.\$OBJEXT \$LIBLTDL"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT 	 main.$OBJEXT $LIBLTDL" "loadlibrary.at:243"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT 	 main.$OBJEXT $LIBLTDL
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/loadlibrary.at:243"
$at_failed && at_fn_log_failure
$at_traceon; }


. ./foomod.la
{ set +x
$as_echo "$at_srcdir/loadlibrary.at:248: test -n \"\$dlname\" || (exit 77)"
at_fn_check_prepare_dynamic "test -n \"$dlname\" || (exit 77)" "loadlibrary.at:248"
( $at_check_trace; test -n "$dlname" || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/loadlibrary.at:248"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/loadlibrary.at:250: if \"\$lt_exe\" ./foomod.la no_symbol; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ./foomod.la no_symbol; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "loadlibrary.at:250"
( $at_check_trace; if "$lt_exe" ./foomod.la no_symbol; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/loadlibrary.at:250"
$at_failed && at_fn_log_failure
$at_traceon; }



#   chmod -x doesn't appear to work in MSYS, and Wine can load no-exec dlls.

rm -f $objdir/$dlname
lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/loadlibrary.at:257: if \"\$lt_exe\" ./foomod.la; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ./foomod.la; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "loadlibrary.at:257"
( $at_check_trace; if "$lt_exe" ./foomod.la; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/loadlibrary.at:257"
$at_failed && at_fn_log_failure
$at_traceon; }



lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/loadlibrary.at:259: if \"\$lt_exe\" ./barmod.la no_symbol; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ./barmod.la no_symbol; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "loadlibrary.at:259"
( $at_check_trace; if "$lt_exe" ./barmod.la no_symbol; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/loadlibrary.at:259"
$at_failed && at_fn_log_failure
$at_traceon; }



. ./libbardep.la
#   chmod -x doesn't appear to work in MSYS, and Wine can load no-exec dlls.

rm -f $objdir/$dlname
lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/loadlibrary.at:267: if \"\$lt_exe\" ./barmod.la; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ./barmod.la; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "loadlibrary.at:267"
( $at_check_trace; if "$lt_exe" ./barmod.la; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/loadlibrary.at:267"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_112
#AT_START_113
at_fn_group_banner 113 'lalib-syntax.at:24' \
  "syntax of .la files" "                            " 11
at_xfail=yes
(
  $as_echo "113. $at_setup_line: testing $at_desc ..."
  $at_traceon





cat >main.c <<'_ATEOF'
#include <ltdl.h>
#include <stdio.h>
#include <assert.h>

int
main (int argc, char* argv[])
{
  int err = 0;
  lt_dlhandle plugin_handle;

  if (argc < 2)
    {
      fprintf (stderr, "usage: %s plugin\n", argv[0]);
      return 1;
    }

  lt_dlinit ();
  plugin_handle = lt_dlopenext (argv[1]);
  if (NULL != plugin_handle)
    {
      printf ("plugin opened successfully!\n");
      lt_dlclose (plugin_handle);
    }
  else
    {
      const char *error = lt_dlerror ();
      assert (error != NULL);
      printf ("plugin failed to open: %s\n", error);
      err = 1;
    }
  lt_dlexit ();
  return err;
}
_ATEOF


cat >module.c <<'_ATEOF'
int foo (void) { return 0; }
_ATEOF


: ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
: ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}

# Skip this test when called from:
#    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
{ set +x
$as_echo "$at_srcdir/lalib-syntax.at:75: case \$LIBLTDL in #(
 */_inst/lib/*) test -f \"\$LIBLTDL\" || (exit 77) ;;
esac"
at_fn_check_prepare_notrace 'an embedded newline' "lalib-syntax.at:75"
( $at_check_trace; case $LIBLTDL in #(
 */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
esac
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lalib-syntax.at:75"
$at_failed && at_fn_log_failure
$at_traceon; }


CPPFLAGS="$CPPFLAGS $LTDLINCL"

{ set +x
$as_echo "$at_srcdir/lalib-syntax.at:81: \$CC \$CPPFLAGS \$CFLAGS -c main.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c main.c" "lalib-syntax.at:81"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c main.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lalib-syntax.at:81"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/lalib-syntax.at:82: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c module.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c module.c" "lalib-syntax.at:82"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c module.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lalib-syntax.at:82"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/lalib-syntax.at:84: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o module.la module.lo 	 -module -avoid-version -rpath /somewhere"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o module.la module.lo 	 -module -avoid-version -rpath /somewhere" "lalib-syntax.at:84"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o module.la module.lo 	 -module -avoid-version -rpath /somewhere
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lalib-syntax.at:84"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/lalib-syntax.at:86: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main main.\$OBJEXT \$LIBLTDL"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main main.$OBJEXT $LIBLTDL" "lalib-syntax.at:86"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main main.$OBJEXT $LIBLTDL
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lalib-syntax.at:86"
$at_failed && at_fn_log_failure
$at_traceon; }



# Several bogus test cases.

cat >missing-closing-quote.la <<'_ATEOF'
# missing-closing-quote.la - a libtool library file
# Generated by libtool
dlname='module.so
library_names='module.so module.so module.so'
old_library='module.a'
installed=no
shouldnotlink=yes
libdir='/somewhere'
_ATEOF


cat >wrong-quotes.la <<'_ATEOF'
# wrong-quotes.la - a libtool library file
# Generated by libtool
dlname=module.so
library_names='module.so module.so module.so'
old_library='module.a'
installed=no
shouldnotlink=yes
libdir='/somewhere'
_ATEOF


cat >no-dlname.la <<'_ATEOF'
# no-dlname.la - a libtool library file
# Generated by libtool
installed=no
shouldnotlink=yes
libdir='/somewhere'
_ATEOF


cat >nonexistent-dlname.la <<'_ATEOF'
# nonexistent-dlname.la - a libtool library file
# Generated by libtool
dlname='does-not-exist.so'
installed=no
shouldnotlink=yes
libdir='/somewhere'
_ATEOF


for file in ./missing-closing-quote.la ./wrong-quotes.la \
	    ./no-dlname.la ./nonexistent-dlname.la; do
  lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/lalib-syntax.at:133: if \"\$lt_exe\" \$file; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 1 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" $file; then :; else lt_status=$?; 	   test \"$lt_status\" != 1 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "lalib-syntax.at:133"
( $at_check_trace; if "$lt_exe" $file; then :; else lt_status=$?; 	   test "$lt_status" != 1 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/lalib-syntax.at:133"
$at_failed && at_fn_log_failure
$at_traceon; }


  { set +x
$as_echo "$at_srcdir/lalib-syntax.at:134: \$GREP 'plugin failed to open' stdout"
at_fn_check_prepare_dynamic "$GREP 'plugin failed to open' stdout" "lalib-syntax.at:134"
( $at_check_trace; $GREP 'plugin failed to open' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/lalib-syntax.at:134"
$at_failed && at_fn_log_failure
$at_traceon; }

done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_113
#AT_START_114
at_fn_group_banner 114 'resident.at:27' \
  "resident modules" "                               " 11
at_xfail=no
(
  $as_echo "114. $at_setup_line: testing $at_desc ..."
  $at_traceon



cat >main.c <<'_ATEOF'
#include <ltdl.h>
#include <stdio.h>

int
main (int argc, char* argv[])
{
  int err = 0;
  lt_dlhandle plugin_handle;
  lt_dladvise advise;

  LTDL_SET_PRELOADED_SYMBOLS();

  if (argc < 2)
    {
      fprintf (stderr, "usage: %s plugin\n", argv[0]);
      return 1;
    }

  lt_dlinit ();
  if (lt_dladvise_init (&advise) != 0
      || lt_dladvise_ext (&advise) != 0
      || lt_dladvise_resident (&advise) != 0)
    {
      printf ("advise failure: %s\n", lt_dlerror ());
      err = 1;
    }
  else
    {
      plugin_handle = lt_dlopenadvise (argv[1], advise);
      if (NULL != plugin_handle)
	{
	  int (*pf) (void);
	  printf ("plugin opened successfully!\n");
	  pf = (int (*) (void)) lt_dlsym (plugin_handle, "setup_plugin");
	  if (pf)
	    pf ();
	  else
	    {
	      printf ("dlsym failure: %s\n", lt_dlerror ());
	      err = 1;
	    }
	  if (!lt_dlisresident (plugin_handle))
	    {
	      printf ("module wrongly not marked resident\n");
	      err = 1;
	    }
	  if (lt_dlclose (plugin_handle) != 0)
	    {
	      printf ("close failure (expected): %s\n", lt_dlerror ());
	    }
	  else
	    {
	      printf ("wrongly closed resident module\n");
	      err = 1;
	    }
	}
      else
	{
	  printf ("plugin failed to open: %s\n", lt_dlerror ());
	  err = 1;
	}
      if (lt_dladvise_destroy (&advise) != 0)
	{
	  printf ("advise destroy failure: %s\n", lt_dlerror ());
	  err = 1;
	}
    }
  lt_dlexit ();
  return err;
}
_ATEOF


cat >plugin.c <<'_ATEOF'
#include <stdlib.h>
#include <stdio.h>

void
bye (void)
{
  puts ("called from atexit handler");
}

#ifdef __cplusplus
extern "C"
#endif
int
setup_plugin (void)
{
  atexit (bye);
}
_ATEOF


: ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
: ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}

# Skip this test when called from:
#    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
{ set +x
$as_echo "$at_srcdir/resident.at:128: case \$LIBLTDL in #(
 */_inst/lib/*) test -f \"\$LIBLTDL\" || (exit 77) ;;
esac"
at_fn_check_prepare_notrace 'an embedded newline' "resident.at:128"
( $at_check_trace; case $LIBLTDL in #(
 */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
esac
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/resident.at:128"
$at_failed && at_fn_log_failure
$at_traceon; }


CPPFLAGS="$LTDLINCL $CPPFLAGS"
LDFLAGS="$LDFLAGS -no-undefined"
inst=`pwd`/inst
libdir=$inst/lib

{ set +x
$as_echo "$at_srcdir/resident.at:137: \$CC \$CPPFLAGS \$CFLAGS -c main.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c main.c" "resident.at:137"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c main.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/resident.at:137"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/resident.at:138: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c plugin.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c plugin.c" "resident.at:138"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c plugin.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/resident.at:138"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/resident.at:140: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o plugin.la -rpath \$libdir 	 -module -avoid-version plugin.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o plugin.la -rpath $libdir 	 -module -avoid-version plugin.lo" "resident.at:140"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o plugin.la -rpath $libdir 	 -module -avoid-version plugin.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/resident.at:140"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/resident.at:142: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT 	 -dlopen plugin.la \$LIBLTDL"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT 	 -dlopen plugin.la $LIBLTDL" "resident.at:142"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT 	 -dlopen plugin.la $LIBLTDL
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/resident.at:142"
$at_failed && at_fn_log_failure
$at_traceon; }

lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/resident.at:145: if \"\$lt_exe\" ./plugin.la; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ./plugin.la; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "resident.at:145"
( $at_check_trace; if "$lt_exe" ./plugin.la; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/resident.at:145"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/resident.at:146: \$GREP 'called from atexit handler' stdout"
at_fn_check_prepare_dynamic "$GREP 'called from atexit handler' stdout" "resident.at:146"
( $at_check_trace; $GREP 'called from atexit handler' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/resident.at:146"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_114
#AT_START_115
at_fn_group_banner 115 'slist.at:25' \
  "SList functionality" "                            " 11
at_xfail=no
(
  $as_echo "115. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >test-slist.c <<'_ATEOF'

#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include "slist.h"

#define STREQ(s1, s2)	(strcmp ((s1), (s2)) == 0)

void *find_string (SList *item, void *data)
{
  if (data != NULL && STREQ ((const char *) item->userdata, (const char *)data))
    return item;
  else
    return NULL;
}

void boxed_delete (void *item)
{
  free (slist_unbox ((SList *) item));
}

void *print_item (SList *item, void *userdata)
{
  userdata = userdata; /* unused */
  printf ("%s\n", (const char*)item->userdata);
  return NULL;
}

int list_compare (const SList *item1, const SList *item2, void *userdata)
{
  userdata = userdata;
  return strcmp ((const char *) item1->userdata, (const char *)item2->userdata);
}

int main ()
{
  int i;
  SList *empty_list = NULL, *list = NULL, *item, *list_save;
  char *data = NULL;

  /* slist_cons */
  list = slist_cons (NULL, NULL);

  for (i=0; i < 10; ++i) {
    data = (char *) malloc (42);
    assert (data);
    sprintf (data, "foo%d", i);
    list = slist_cons (slist_box (data), list);
  }
  list_save = list;
  list = slist_cons (NULL, list);
  assert (list == list_save);


  /* slist_find */
  assert (slist_find (NULL, find_string, (void *) "whatever") == NULL);
  assert (slist_find (empty_list, find_string, (void *) "whatever") == NULL);
  assert (slist_find (list, find_string, (void *) "foo10") == NULL);
  item = (SList *) slist_find (list, find_string, (void *) "foo1");
  assert (item != NULL);
  assert (STREQ ((const char *) item->userdata, "foo1"));

  item = slist_nth (list, 10);
  assert (item != NULL && STREQ ((const char *) item->userdata, "foo0"));

  puts ("list as inserted:");
  slist_foreach (list, print_item, NULL);
  puts ("reversed list:");
  list = slist_reverse (list);
  slist_foreach (list, print_item, NULL);

  item = slist_nth (list, 1);
  assert (item != NULL && STREQ ((const char *) item->userdata, "foo0"));

  assert (10 == slist_length (list));

  /* slist_tail is the second item, not the last one */
  item = slist_tail (list);
  assert (item != NULL && STREQ ((const char *) item->userdata, "foo1"));

  assert (slist_tail (slist_nth (list, 10)) == NULL);

  /* slist_sort and implicitly, slist_sort_merge */
  assert (slist_sort (NULL, list_compare, NULL) == NULL);
  list = slist_sort (list, list_compare, NULL);
  puts ("list after no-op sort:");
  slist_foreach (list, print_item, NULL);

  list = slist_reverse (list);
  puts ("reversed list:");
  slist_foreach (list, print_item, NULL);
  puts ("sorting reversed list:");
  list = slist_sort (list, list_compare, NULL);
  slist_foreach (list, print_item, NULL);

  /* slist_remove */
  assert (slist_remove (NULL, find_string, NULL) == NULL);
  assert (slist_remove (&empty_list, find_string, NULL) == NULL);

  list_save = list;
  assert (slist_remove (&list, find_string, NULL) == NULL);
  assert (list_save == list);

  /* remove entries: middle, last, first, not present */
  /* slist_reverse above has left us with increasing order */
  list_save = list;
  item = slist_remove (&list, find_string, (void *) "foo5");
  assert (list_save == list);
  assert (item != NULL && STREQ (data = (char *) slist_unbox (item), "foo5"));
  free (data);

  list_save = list;
  item = slist_remove (&list, find_string, (void *) "foo9");
  assert (list_save == list);
  assert (item != NULL && STREQ (data = (char *) slist_unbox (item), "foo9"));
  free (data);

  list_save = list;
  item = slist_remove (&list, find_string, (void *) "foo0");
  assert (list_save != list);
  assert (item != NULL && STREQ (data = (char *) slist_unbox (item), "foo0"));
  free (data);

  list_save = list;
  item = slist_remove (&list, find_string, (void *) "foo5");
  assert (list_save == list);
  assert (item == NULL);

  assert (slist_delete (list, boxed_delete) == NULL);
  return 0;
}
_ATEOF


CPPFLAGS="-I$top_srcdir/libltdl -I$top_srcdir/libltdl/libltdl -I$abs_top_builddir"
{ set +x
$as_echo "$at_srcdir/slist.at:163: \$CC \$CPPFLAGS \$CFLAGS -c test-slist.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c test-slist.c" "slist.at:163"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c test-slist.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/slist.at:163"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/slist.at:165: \$CC \$CPPFLAGS \$CFLAGS -c \$top_srcdir/libltdl/slist.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c $top_srcdir/libltdl/slist.c" "slist.at:165"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c $top_srcdir/libltdl/slist.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/slist.at:165"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/slist.at:167: \$CC \$CFLAGS \$LDFLAGS -o test-slist test-slist.\$OBJEXT slist.\$OBJEXT"
at_fn_check_prepare_dynamic "$CC $CFLAGS $LDFLAGS -o test-slist test-slist.$OBJEXT slist.$OBJEXT" "slist.at:167"
( $at_check_trace; $CC $CFLAGS $LDFLAGS -o test-slist test-slist.$OBJEXT slist.$OBJEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/slist.at:167"
$at_failed && at_fn_log_failure
$at_traceon; }

lt_exe=./test-slist; if test -f "./test-slist$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/slist.at:169: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "slist.at:169"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/slist.at:169"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_115
#AT_START_116
at_fn_group_banner 116 'need_lib_prefix.at:26' \
  "enforced lib prefix" "                            " 11
at_xfail=no
(
  $as_echo "116. $at_setup_line: testing $at_desc ..."
  $at_traceon



# Originally written to simulate a failure visible on systems
# that need a library prefix like 'lib', such as BeOS.  Currently
# the prefix is hardcoded as 'lib', so systems that require a
# different prefix skips the test.

cat >main.c <<'_ATEOF'
#include <ltdl.h>
#include <stdio.h>

typedef int fun (int);

static int errors = 0;

static void
complain (const char *msg)
{
  const char *errmsg = lt_dlerror ();
  fprintf (stderr, "%s", msg);
  if (errmsg)
    fprintf (stderr, ": %s\n", errmsg);
  else
    fprintf (stderr, ".\n");
  ++errors;
}

static lt_dlhandle
moduleopen (const char *filename)
{
  lt_dlhandle handle;

  handle = lt_dlopen (filename);
  if (!handle)
    {
      fprintf (stderr, "can't open the module %s!\n", filename);
      complain ("error was");
    }

  return handle;
}

static int
moduletest (lt_dlhandle handle)
{
  const lt_dlinfo *info = lt_dlgetinfo (handle);
  fun *f = (fun *) lt_dlsym (handle, "f");
  int *v = (int *) lt_dlsym (handle, "i");

  if (!f)
    {
      complain ("function 'f' not found");
      return 1;
    }
  if (!v)
    {
      complain ("variable 'i' not found");
      return 1;
    }
  printf ("%s: %d\n", info->name, f (*v));

  return 0;
}

int
main (int argc, char **argv)
{
  lt_dlhandle handle;

  LTDL_SET_PRELOADED_SYMBOLS();

  if (lt_dlinit() != 0)
    {
      fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
      return 1;
    }

  if (lt_dlpreload_open (0, moduletest) != 0)
    complain ("error during preloading");

  if (lt_dlexit () != 0)
    complain ("error during exit");

  return (errors != 0);
}
_ATEOF


cat >foo1.c <<'_ATEOF'
#define f foo1_LTX_f
#define i foo1_LTX_i
#ifdef __cplusplus
extern "C" {
#endif
int f (int x) { return x / 3; }
int i = 7;
#ifdef __cplusplus
}
#endif
_ATEOF


cat >foo2.c <<'_ATEOF'
#define f libfoo2_LTX_f
#define i libfoo2_LTX_i
#ifdef __cplusplus
extern "C" {
#endif
int f (int x) { return (x * x) / 10; }
int i = 6;
#ifdef __cplusplus
}
#endif
_ATEOF


cat >expout <<'_ATEOF'
libfoo1: 2
libfoo2: 3
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

: ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
: ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}

# Skip this test when called from:
#    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
{ set +x
$as_echo "$at_srcdir/need_lib_prefix.at:150: case \$LIBLTDL in #(
 */_inst/lib/*) test -f \"\$LIBLTDL\" || (exit 77) ;;
esac"
at_fn_check_prepare_notrace 'an embedded newline' "need_lib_prefix.at:150"
( $at_check_trace; case $LIBLTDL in #(
 */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
esac
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/need_lib_prefix.at:150"
$at_failed && at_fn_log_failure
$at_traceon; }


CPPFLAGS="$LTDLINCL $CPPFLAGS"
LDFLAGS=$LDFLAGS

# Skip this test when libraries are not normally prefixed with lib.
# E.g., for MSVC and OS/2.
eval "`$LIBTOOL --config | $EGREP '^(libname_spec)='`"
name=
eval libname=\"$libname_spec\"
{ set +x
$as_echo "$at_srcdir/need_lib_prefix.at:162: test lib = \"\$libname\" || exit 77"
at_fn_check_prepare_dynamic "test lib = \"$libname\" || exit 77" "need_lib_prefix.at:162"
( $at_check_trace; test lib = "$libname" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/need_lib_prefix.at:162"
$at_failed && at_fn_log_failure
$at_traceon; }


# Create our own libtool, forcing need_lib_prefix setting
$SED 's|^\(need_lib_prefix\)=.*$|\1=unknown|' $LIBTOOL > ./libtool
LIBTOOL="$SHELL ./libtool"

# Installation directory:
instdir=`pwd`/_inst

$CC $CPPFLAGS $CFLAGS -c main.c
for file in foo1 foo2; do
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file.c
done

{ set +x
$as_echo "$at_srcdir/need_lib_prefix.at:176: \$LIBTOOL --mode=link \$CC -module -avoid-version \$CFLAGS \$LDFLAGS -o foo1.la foo1.lo -rpath \$instdir/lib"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC -module -avoid-version $CFLAGS $LDFLAGS -o foo1.la foo1.lo -rpath $instdir/lib" "need_lib_prefix.at:176"
( $at_check_trace; $LIBTOOL --mode=link $CC -module -avoid-version $CFLAGS $LDFLAGS -o foo1.la foo1.lo -rpath $instdir/lib
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/need_lib_prefix.at:176"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/need_lib_prefix.at:178: \$LIBTOOL --mode=link \$CC -module -avoid-version \$CFLAGS \$LDFLAGS -o libfoo2.la foo2.lo -rpath \$instdir/lib"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC -module -avoid-version $CFLAGS $LDFLAGS -o libfoo2.la foo2.lo -rpath $instdir/lib" "need_lib_prefix.at:178"
( $at_check_trace; $LIBTOOL --mode=link $CC -module -avoid-version $CFLAGS $LDFLAGS -o libfoo2.la foo2.lo -rpath $instdir/lib
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/need_lib_prefix.at:178"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/need_lib_prefix.at:180: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o main\$EXEEXT main.\$OBJEXT -dlpreopen foo1.la -dlpreopen libfoo2.la \$LIBLTDL"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT -dlpreopen foo1.la -dlpreopen libfoo2.la $LIBLTDL" "need_lib_prefix.at:180"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT -dlpreopen foo1.la -dlpreopen libfoo2.la $LIBLTDL
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/need_lib_prefix.at:180"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/need_lib_prefix.at:183: if \$LIBTOOL --mode=execute -dlopen foo1.la -dlopen libfoo2.la \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if $LIBTOOL --mode=execute -dlopen foo1.la -dlopen libfoo2.la \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "need_lib_prefix.at:183"
( $at_check_trace; if $LIBTOOL --mode=execute -dlopen foo1.la -dlopen libfoo2.la "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/need_lib_prefix.at:183"
$at_failed && at_fn_log_failure
$at_traceon; }



# Install the libraries.
mkdir $instdir
mkdir $instdir/lib
$LIBTOOL --mode=install cp foo1.la $instdir/lib/foo1.la
$LIBTOOL --mode=install cp libfoo2.la $instdir/lib/libfoo2.la

# Install the binary
mkdir $instdir/bin
$LIBTOOL --mode=install cp main$EXEEXT $instdir/bin/main$EXEEXT

lt_exe=$instdir/bin/main; if test -f "$instdir/bin/main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/need_lib_prefix.at:196: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "need_lib_prefix.at:196"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/need_lib_prefix.at:196"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_116
#AT_START_117
at_fn_group_banner 117 'mdemo.at:625' \
  "dynamically ltdl preload static modules" "        " 12
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "117. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<_EOT_
AC_INIT([mdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_CONFIG_LTDL_DIR([libltdl])
AM_INIT_AUTOMAKE
AC_PROG_CC
LT_INIT([dlopen win32-dll])
LTDL_INIT([nonrecursive convenience])
AC_SUBST([LIBTOOL_DEPS])
AC_SUBST([INCLTDL])
AC_SUBST([LIBLTDL])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])
LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_EOT_


cat >Makefile.am <<_EOT_
AUTOMAKE_OPTIONS = no-dependencies subdir-objects foreign
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = \$(INCLTDL)
AM_LDFLAGS =

noinst_LTLIBRARIES =
EXTRA_LTLIBRARIES =

include_HEADERS =

EXTRA_DIST =

BUILT_SOURCES =
CLEANFILES =
MOSTLYCLEANFILES =

lib_LTLIBRARIES = libsub.la foo1.la libfoo2.la libmlib.la

foo1_la_SOURCES = foo1.c
foo1_la_LIBADD = \$(LIBM) libsub.la
foo1_la_LDFLAGS = -no-undefined -module -avoid-version

libfoo2_la_SOURCES = foo2.c
libfoo2_la_LIBADD = \$(LIBM) libsub.la
libfoo2_la_LDFLAGS = -no-undefined -module -export-symbols-regex "libfoo2.*"

libsub_la_SOURCES = sub.c
libsub_la_LDFLAGS = -no-undefined

## Use -export-symbols-regex here explicitly because libltdl marks
## its exported symbols, and we use libltdl as a convenience archive.
## Thus, on w32, auto-exporting is turned off.
libmlib_la_SOURCES = mlib.c
libmlib_la_LIBADD = \$(LIBLTDL) "-dlopen" foo1.la "-dlopen" libfoo2.la
libmlib_la_LDFLAGS = -no-undefined -export-symbols-regex ".*"
libmlib_la_DEPENDENCIES = \$(LIBLTDL) libsub.la foo1.la libfoo2.la

noinst_HEADERS = foo.h

bin_PROGRAMS = mdemo mdemo_static

# Create a version of mdemo that does dlopen.
mdemo_SOURCES = main.c
mdemo_LDFLAGS = -export-dynamic
## The quotes around -dlopen below fool automake into accepting it
mdemo_LDADD = \$(LIBLTDL) libsub.la "-dlopen" self \
		"-dlopen" foo1.la "-dlopen" libfoo2.la
mdemo_DEPENDENCIES = \$(LIBLTDL) libsub.la foo1.la libfoo2.la

# Create a statically linked version of mdemo.
mdemo_static_SOURCES = \$(mdemo_SOURCES)
mdemo_static_LDFLAGS = \$(STATIC) \$(mdemo_LDFLAGS)
mdemo_static_LDADD = \$(mdemo_LDADD)
mdemo_static_DEPENDENCIES = \$(mdemo_DEPENDENCIES)

libtool: \$(LIBTOOL_DEPS)
	\$(SHELL) ./config.status --recheck

include \$(srcdir)/libltdl/ltdl.mk
include \$(srcdir)/mdemo.mk
_EOT_

cat >mdemo.mk <<'_ATEOF'
# Don't abort for lack of mdemo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

int sub (void);

#endif
_ATEOF


cat >foo1.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

#define nothing foo1_LTX_nothing
#define foo1    foo1_LTX_foo1
#define hello   foo1_LTX_hello

/* Give a global variable definition. */
int nothing = FOO_RET;

/* private function */
int _foo1_helper (void) {
  sub ();
  return FOO_RET;
}

/* export functions */
#ifdef __cplusplus
extern "C" {
#endif

int foo1 (void) {
    printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
    return _foo1_helper ();
}

int hello () {
    printf ("** This is foolib 1 **\n");
    return HELLO_RET;
}

#ifdef __cplusplus
}
#endif
_ATEOF


cat >foo2.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

#define nothing libfoo2_LTX_nothing
#define foo2    libfoo2_LTX_foo2
#define hello   libfoo2_LTX_hello

/* Give a global variable definition. */
int nothing;

/* private function */
int _foo2_helper (void) {
  sub ();
  return FOO_RET;
}

/* export functions */
#ifdef __cplusplus
extern "C" {
#endif

int foo2 (void) {
    printf ("sin (0.0) = %g\n", (double) sin ((double) 0.0));
    return _foo2_helper ();
}

int hello () {
    printf ("** This is foolib 2 **\n");
    return HELLO_RET;
}

#ifdef __cplusplus
}
#endif
_ATEOF


cat >mlib.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"
#include "ltdl.h"

int test_dl (char *filename) {
  lt_dlhandle handle;
  const lt_dlinfo *info;
  int (*pfoo1)() = 0;
  int (*pfoo2)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;
  int ret = 0;

  handle = lt_dlopen(filename);
  if (!handle) {
    fprintf (stderr, "can't open the module %s!\n", filename);
    fprintf (stderr, "error was: %s\n", lt_dlerror());
    return 1;
  }

  info = lt_dlgetinfo(handle);
  if (!info) {
    fprintf (stderr, "can't get module info: %s\n", lt_dlerror());
    return 1;
  }
  if (info->name) {
    printf ("module name: %s\n", info->name);
  } else {
    printf ("module is not a libtool module\n");
  }
  printf ("module filename: %s\n", info->filename);
  printf ("module reference count: %i\n", info->ref_count);

  phello = (int(*)())lt_dlsym(handle, "hello");
  if (phello)
    {
      int value = (*phello) ();

      printf ("hello returned: %i\n", value);
      if (value == HELLO_RET)
        printf("hello is ok!\n");
    }
  else
    {
      fprintf (stderr, "did not find the 'hello' function\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pnothing = (int*)lt_dlsym(handle, "nothing");
  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    {
      fprintf (stderr, "did not find the 'nothing' variable\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pfoo1 = (int(*)())lt_dlsym(handle, "foo1");
  /* Just call the functions and check return values. */
  if (pfoo1)
    {
      if ((*pfoo1) () == FOO_RET)
        printf("foo1 is ok!\n");
      else
	ret = 1;
    }
  else {
    pfoo2 = (int(*)())lt_dlsym(handle, "foo2");
    if (pfoo2)
      {
        if ((*pfoo2) () == FOO_RET)
          printf("foo2 is ok!\n");
        else ret = 1;
      }
    else
      {
        fprintf (stderr, "did not find any of the 'foo' functions\n");
        fprintf (stderr, "error was: %s\n", lt_dlerror());
        ret = 1;
      }
  }
  lt_dlclose(handle);
  return ret;
}

int
mlib_func (int argc, char **argv)
{
  int ret = 0;
  int i;
  /*
   * Would be nice if this somehow worked for libraries, not just executables.
   * LTDL_SET_PRELOADED_SYMBOLS();
   */
  if (lt_dlinit() != 0) {
    fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
    return 1;
  }

  for (i = 1; i < argc; i++)
    if (test_dl(argv[i]))
       ret = 1;

  lt_dlexit();
  return ret;
}
_ATEOF


cat >sub.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
void sub (void) { printf ("sub() called\n"); }
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"
#include "ltdl.h"

#ifdef __cplusplus
#  define EXPORT extern "C"
#else
#  define EXPORT extern
#endif

EXPORT int myfunc (void);

int
test_dl (char *filename, int test_ext)
{
  lt_dlhandle handle;
  const lt_dlinfo *info;
  int (*pfoo1)() = 0;
  int (*pfoo2)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;
  int ret = 0;

  if (test_ext)
    handle = lt_dlopenext (filename);
  else
    handle = lt_dlopen (filename);

  if (!handle) {
    fprintf (stderr, "can't open the module %s!\n", filename);
    fprintf (stderr, "error was: %s\n", lt_dlerror());
    return 1;
  }

  info = lt_dlgetinfo(handle);
  if (!info) {
    fprintf (stderr, "can't get module info: %s\n", lt_dlerror());
    return 1;
  }
  if (info->name) {
    printf ("module name: %s\n", info->name);
  } else {
    printf ("module is not a libtool module\n");
  }
  printf ("module filename: %s\n", info->filename);
  printf ("module reference count: %i\n", info->ref_count);

  phello = (int(*)())lt_dlsym(handle, "hello");
  if (phello)
    {
      int value = (*phello) ();

      printf ("hello returned: %i\n", value);
      if (value == HELLO_RET)
        printf("hello is ok!\n");
    }
  else
    {
      fprintf (stderr, "did not find the 'hello' function\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pnothing = (int*)lt_dlsym(handle, "nothing");
  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    {
      fprintf (stderr, "did not find the 'nothing' variable\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pfoo1 = (int(*)())lt_dlsym(handle, "foo1");
  /* Just call the functions and check return values. */
  if (pfoo1)
    {
      if ((*pfoo1) () == FOO_RET)
        printf("foo1 is ok!\n");
      else
	ret = 1;
    }
  else {
    pfoo2 = (int(*)())lt_dlsym(handle, "foo2");
    if (pfoo2)
      {
        if ((*pfoo2) () == FOO_RET)
          printf("foo2 is ok!\n");
        else ret = 1;
      }
    else
      {
        fprintf (stderr, "did not find any of the 'foo' functions\n");
        fprintf (stderr, "error was: %s\n", lt_dlerror());
        ret = 1;
      }
  }
  lt_dlclose(handle);
  return ret;
}

int
myfunc ()
{
  return HELLO_RET;
}

int myvar;

int
test_dlself ()
{
  lt_dlhandle handle;
  int (*pmyfunc)() = 0;
  int *pmyvar = 0;
  int ret = 0;

  handle = lt_dlopen(0);
  if (!handle) {
    fprintf (stderr, "can't dlopen the program!\n");
    fprintf (stderr, "error was: %s\n", lt_dlerror());
    return 1;
  }

  pmyfunc = (int(*)())lt_dlsym(handle, "myfunc");
  if (pmyfunc)
    {
      int value = (*pmyfunc) ();

      printf ("myfunc returned: %i\n", value);
      if (value == HELLO_RET)
        printf("myfunc is ok!\n");
    }
  else
    {
      fprintf (stderr, "did not find the 'myfunc' function\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pmyvar = (int*)lt_dlsym(handle, "myvar");
  /* Try assigning to the variable. */
  if (pmyvar)
    *pmyvar = 1;
  else
    {
      fprintf (stderr, "did not find the 'myvar' variable\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  lt_dlclose(handle);
  return ret;
}

static int
callback (const char *filename, void *data)
{
  printf ("%s: %s\n", (char *)data, filename);
  return 0;
}

static int
try_iterate (const char *search_path)
{
  char *s = "try_iterate";
  return lt_dlforeachfile (search_path, callback, s);
}

/* cheap dirname clone.  We require a '/' separator, nonempty and large
   enough input, not ending with '/', and we will overwrite the input. */
static char *
my_dirname (char *path)
{
  char *p = strrchr (path, '/');
  if (p)
    *p = '\0';
  else
    {
      path[0] = '.';
      path[1] = '\0';
    }
  return path;
}

int
main (int argc, char **argv)
{
  int i;
  int ret = 0;
  char *p;

  printf ("Welcome to GNU libtool mdemo!\n");

  if (argc < 2) {
    fprintf (stderr, "usage: %s module [module...]\n", argv[0]);
  }

  LTDL_SET_PRELOADED_SYMBOLS();
  if (lt_dlinit() != 0) {
    fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
    return 1;
  }

  for (i = 1; i < argc; i++)
  {
    if (test_dl(argv[i], 0))
       ret = 1;
    p = strrchr(argv[i], '.');
    if (p)
      {
	*p = '\0';
	if (test_dl(argv[i], 1))
	  ret = 1;
	*p = '.';
      }
  }

  if (test_dlself())
    ret = 1;

  for (i = 1; i < argc; i++)
    if (argv[i][0] != '\0')
      {
	my_dirname (argv[i]);
	if (try_iterate (argv[i]))
	  ret = 1;
      }

  lt_dlexit();
  return ret;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/mdemo.at:629: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "mdemo.at:629"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:629"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/mdemo.at:629: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "mdemo.at:629"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:629"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:629: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "mdemo.at:629"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:629"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/mdemo.at:629: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "mdemo.at:629"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/mdemo.at:629"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:629: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "mdemo.at:629"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:629"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:629: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --with-included-ltdl --disable-shared"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "mdemo.at:629"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --with-included-ltdl --disable-shared
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:629"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:629: \$EGREP '^build_old_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=yes' libtool" "mdemo.at:629"
( $at_check_trace; $EGREP '^build_old_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:629"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/mdemo.at:629: \$EGREP '^build_libtool_libs=no' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=no' libtool" "mdemo.at:629"
( $at_check_trace; $EGREP '^build_libtool_libs=no' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:629"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:631: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:631"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:631"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./mdemo_static; if test -f "./mdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:631: if \"\$lt_exe\" ./foo1.la ./libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a shell pipeline' "mdemo.at:631"
( $at_check_trace; if "$lt_exe" ./foo1.la ./libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:631"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./mdemo; if test -f "./mdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:631: if \"\$lt_exe\" ./foo1.la ./libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a shell pipeline' "mdemo.at:631"
( $at_check_trace; if "$lt_exe" ./foo1.la ./libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:631"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./mdemo_static; if test -f "./mdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:631: if \"\$lt_exe\" \`pwd\`/foo1.la \`pwd\`/libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a `...` command substitution' "mdemo.at:631"
( $at_check_trace; if "$lt_exe" `pwd`/foo1.la `pwd`/libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:631"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./mdemo; if test -f "./mdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:631: if \"\$lt_exe\" \`pwd\`/foo1.la \`pwd\`/libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a `...` command substitution' "mdemo.at:631"
( $at_check_trace; if "$lt_exe" `pwd`/foo1.la `pwd`/libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:631"
$at_failed && at_fn_log_failure
$at_traceon; }



for target in install
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:632: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:632"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:632"
$at_failed && at_fn_log_failure
$at_traceon; }

done


# Windows hosts search for dlls in the command path.
PATH=$prefix/lib:$PATH

lt_exe=$prefix/bin/mdemo_static; if test -f "$prefix/bin/mdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:632: if \"\$lt_exe\" \$prefix/lib/foo1.la \$prefix/lib/libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a shell pipeline' "mdemo.at:632"
( $at_check_trace; if "$lt_exe" $prefix/lib/foo1.la $prefix/lib/libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:632"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$prefix/bin/mdemo; if test -f "$prefix/bin/mdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:632: if \"\$lt_exe\" \$prefix/lib/foo1.la \$prefix/lib/libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a shell pipeline' "mdemo.at:632"
( $at_check_trace; if "$lt_exe" $prefix/lib/foo1.la $prefix/lib/libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:632"
$at_failed && at_fn_log_failure
$at_traceon; }



for target in uninstall
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:633: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:633"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:633"
$at_failed && at_fn_log_failure
$at_traceon; }

done


leftovers=`find $prefix ! -type d ! -name '.*' -print`
{ set +x
$as_echo "$at_srcdir/mdemo.at:633: test -z \"\$leftovers\""
at_fn_check_prepare_dynamic "test -z \"$leftovers\"" "mdemo.at:633"
( $at_check_trace; test -z "$leftovers"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:633"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_117
#AT_START_118
at_fn_group_banner 118 'mdemo.at:642' \
  "dynamically ltdl load a shared module" "          " 12
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "118. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<_EOT_
AC_INIT([mdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_CONFIG_LTDL_DIR([libltdl])
AM_INIT_AUTOMAKE
AC_PROG_CC
LT_INIT([dlopen win32-dll])
LTDL_INIT([nonrecursive convenience])
AC_SUBST([LIBTOOL_DEPS])
AC_SUBST([INCLTDL])
AC_SUBST([LIBLTDL])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])
LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_EOT_


cat >Makefile.am <<_EOT_
AUTOMAKE_OPTIONS = no-dependencies subdir-objects foreign
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = \$(INCLTDL)
AM_LDFLAGS =

noinst_LTLIBRARIES =
EXTRA_LTLIBRARIES =

include_HEADERS =

EXTRA_DIST =

BUILT_SOURCES =
CLEANFILES =
MOSTLYCLEANFILES =

lib_LTLIBRARIES = libsub.la foo1.la libfoo2.la libmlib.la

foo1_la_SOURCES = foo1.c
foo1_la_LIBADD = \$(LIBM) libsub.la
foo1_la_LDFLAGS = -no-undefined -module -avoid-version

libfoo2_la_SOURCES = foo2.c
libfoo2_la_LIBADD = \$(LIBM) libsub.la
libfoo2_la_LDFLAGS = -no-undefined -module -export-symbols-regex "libfoo2.*"

libsub_la_SOURCES = sub.c
libsub_la_LDFLAGS = -no-undefined

## Use -export-symbols-regex here explicitly because libltdl marks
## its exported symbols, and we use libltdl as a convenience archive.
## Thus, on w32, auto-exporting is turned off.
libmlib_la_SOURCES = mlib.c
libmlib_la_LIBADD = \$(LIBLTDL) "-dlopen" foo1.la "-dlopen" libfoo2.la
libmlib_la_LDFLAGS = -no-undefined -export-symbols-regex ".*"
libmlib_la_DEPENDENCIES = \$(LIBLTDL) libsub.la foo1.la libfoo2.la

noinst_HEADERS = foo.h

bin_PROGRAMS = mdemo mdemo_static

# Create a version of mdemo that does dlopen.
mdemo_SOURCES = main.c
mdemo_LDFLAGS = -export-dynamic
## The quotes around -dlopen below fool automake into accepting it
mdemo_LDADD = \$(LIBLTDL) libsub.la "-dlopen" self \
		"-dlopen" foo1.la "-dlopen" libfoo2.la
mdemo_DEPENDENCIES = \$(LIBLTDL) libsub.la foo1.la libfoo2.la

# Create a statically linked version of mdemo.
mdemo_static_SOURCES = \$(mdemo_SOURCES)
mdemo_static_LDFLAGS = \$(STATIC) \$(mdemo_LDFLAGS)
mdemo_static_LDADD = \$(mdemo_LDADD)
mdemo_static_DEPENDENCIES = \$(mdemo_DEPENDENCIES)

libtool: \$(LIBTOOL_DEPS)
	\$(SHELL) ./config.status --recheck

include \$(srcdir)/libltdl/ltdl.mk
include \$(srcdir)/mdemo.mk
_EOT_

cat >mdemo.mk <<'_ATEOF'
# Don't abort for lack of mdemo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

int sub (void);

#endif
_ATEOF


cat >foo1.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

#define nothing foo1_LTX_nothing
#define foo1    foo1_LTX_foo1
#define hello   foo1_LTX_hello

/* Give a global variable definition. */
int nothing = FOO_RET;

/* private function */
int _foo1_helper (void) {
  sub ();
  return FOO_RET;
}

/* export functions */
#ifdef __cplusplus
extern "C" {
#endif

int foo1 (void) {
    printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
    return _foo1_helper ();
}

int hello () {
    printf ("** This is foolib 1 **\n");
    return HELLO_RET;
}

#ifdef __cplusplus
}
#endif
_ATEOF


cat >foo2.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

#define nothing libfoo2_LTX_nothing
#define foo2    libfoo2_LTX_foo2
#define hello   libfoo2_LTX_hello

/* Give a global variable definition. */
int nothing;

/* private function */
int _foo2_helper (void) {
  sub ();
  return FOO_RET;
}

/* export functions */
#ifdef __cplusplus
extern "C" {
#endif

int foo2 (void) {
    printf ("sin (0.0) = %g\n", (double) sin ((double) 0.0));
    return _foo2_helper ();
}

int hello () {
    printf ("** This is foolib 2 **\n");
    return HELLO_RET;
}

#ifdef __cplusplus
}
#endif
_ATEOF


cat >mlib.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"
#include "ltdl.h"

int test_dl (char *filename) {
  lt_dlhandle handle;
  const lt_dlinfo *info;
  int (*pfoo1)() = 0;
  int (*pfoo2)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;
  int ret = 0;

  handle = lt_dlopen(filename);
  if (!handle) {
    fprintf (stderr, "can't open the module %s!\n", filename);
    fprintf (stderr, "error was: %s\n", lt_dlerror());
    return 1;
  }

  info = lt_dlgetinfo(handle);
  if (!info) {
    fprintf (stderr, "can't get module info: %s\n", lt_dlerror());
    return 1;
  }
  if (info->name) {
    printf ("module name: %s\n", info->name);
  } else {
    printf ("module is not a libtool module\n");
  }
  printf ("module filename: %s\n", info->filename);
  printf ("module reference count: %i\n", info->ref_count);

  phello = (int(*)())lt_dlsym(handle, "hello");
  if (phello)
    {
      int value = (*phello) ();

      printf ("hello returned: %i\n", value);
      if (value == HELLO_RET)
        printf("hello is ok!\n");
    }
  else
    {
      fprintf (stderr, "did not find the 'hello' function\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pnothing = (int*)lt_dlsym(handle, "nothing");
  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    {
      fprintf (stderr, "did not find the 'nothing' variable\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pfoo1 = (int(*)())lt_dlsym(handle, "foo1");
  /* Just call the functions and check return values. */
  if (pfoo1)
    {
      if ((*pfoo1) () == FOO_RET)
        printf("foo1 is ok!\n");
      else
	ret = 1;
    }
  else {
    pfoo2 = (int(*)())lt_dlsym(handle, "foo2");
    if (pfoo2)
      {
        if ((*pfoo2) () == FOO_RET)
          printf("foo2 is ok!\n");
        else ret = 1;
      }
    else
      {
        fprintf (stderr, "did not find any of the 'foo' functions\n");
        fprintf (stderr, "error was: %s\n", lt_dlerror());
        ret = 1;
      }
  }
  lt_dlclose(handle);
  return ret;
}

int
mlib_func (int argc, char **argv)
{
  int ret = 0;
  int i;
  /*
   * Would be nice if this somehow worked for libraries, not just executables.
   * LTDL_SET_PRELOADED_SYMBOLS();
   */
  if (lt_dlinit() != 0) {
    fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
    return 1;
  }

  for (i = 1; i < argc; i++)
    if (test_dl(argv[i]))
       ret = 1;

  lt_dlexit();
  return ret;
}
_ATEOF


cat >sub.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
void sub (void) { printf ("sub() called\n"); }
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"
#include "ltdl.h"

#ifdef __cplusplus
#  define EXPORT extern "C"
#else
#  define EXPORT extern
#endif

EXPORT int myfunc (void);

int
test_dl (char *filename, int test_ext)
{
  lt_dlhandle handle;
  const lt_dlinfo *info;
  int (*pfoo1)() = 0;
  int (*pfoo2)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;
  int ret = 0;

  if (test_ext)
    handle = lt_dlopenext (filename);
  else
    handle = lt_dlopen (filename);

  if (!handle) {
    fprintf (stderr, "can't open the module %s!\n", filename);
    fprintf (stderr, "error was: %s\n", lt_dlerror());
    return 1;
  }

  info = lt_dlgetinfo(handle);
  if (!info) {
    fprintf (stderr, "can't get module info: %s\n", lt_dlerror());
    return 1;
  }
  if (info->name) {
    printf ("module name: %s\n", info->name);
  } else {
    printf ("module is not a libtool module\n");
  }
  printf ("module filename: %s\n", info->filename);
  printf ("module reference count: %i\n", info->ref_count);

  phello = (int(*)())lt_dlsym(handle, "hello");
  if (phello)
    {
      int value = (*phello) ();

      printf ("hello returned: %i\n", value);
      if (value == HELLO_RET)
        printf("hello is ok!\n");
    }
  else
    {
      fprintf (stderr, "did not find the 'hello' function\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pnothing = (int*)lt_dlsym(handle, "nothing");
  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    {
      fprintf (stderr, "did not find the 'nothing' variable\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pfoo1 = (int(*)())lt_dlsym(handle, "foo1");
  /* Just call the functions and check return values. */
  if (pfoo1)
    {
      if ((*pfoo1) () == FOO_RET)
        printf("foo1 is ok!\n");
      else
	ret = 1;
    }
  else {
    pfoo2 = (int(*)())lt_dlsym(handle, "foo2");
    if (pfoo2)
      {
        if ((*pfoo2) () == FOO_RET)
          printf("foo2 is ok!\n");
        else ret = 1;
      }
    else
      {
        fprintf (stderr, "did not find any of the 'foo' functions\n");
        fprintf (stderr, "error was: %s\n", lt_dlerror());
        ret = 1;
      }
  }
  lt_dlclose(handle);
  return ret;
}

int
myfunc ()
{
  return HELLO_RET;
}

int myvar;

int
test_dlself ()
{
  lt_dlhandle handle;
  int (*pmyfunc)() = 0;
  int *pmyvar = 0;
  int ret = 0;

  handle = lt_dlopen(0);
  if (!handle) {
    fprintf (stderr, "can't dlopen the program!\n");
    fprintf (stderr, "error was: %s\n", lt_dlerror());
    return 1;
  }

  pmyfunc = (int(*)())lt_dlsym(handle, "myfunc");
  if (pmyfunc)
    {
      int value = (*pmyfunc) ();

      printf ("myfunc returned: %i\n", value);
      if (value == HELLO_RET)
        printf("myfunc is ok!\n");
    }
  else
    {
      fprintf (stderr, "did not find the 'myfunc' function\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pmyvar = (int*)lt_dlsym(handle, "myvar");
  /* Try assigning to the variable. */
  if (pmyvar)
    *pmyvar = 1;
  else
    {
      fprintf (stderr, "did not find the 'myvar' variable\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  lt_dlclose(handle);
  return ret;
}

static int
callback (const char *filename, void *data)
{
  printf ("%s: %s\n", (char *)data, filename);
  return 0;
}

static int
try_iterate (const char *search_path)
{
  char *s = "try_iterate";
  return lt_dlforeachfile (search_path, callback, s);
}

/* cheap dirname clone.  We require a '/' separator, nonempty and large
   enough input, not ending with '/', and we will overwrite the input. */
static char *
my_dirname (char *path)
{
  char *p = strrchr (path, '/');
  if (p)
    *p = '\0';
  else
    {
      path[0] = '.';
      path[1] = '\0';
    }
  return path;
}

int
main (int argc, char **argv)
{
  int i;
  int ret = 0;
  char *p;

  printf ("Welcome to GNU libtool mdemo!\n");

  if (argc < 2) {
    fprintf (stderr, "usage: %s module [module...]\n", argv[0]);
  }

  LTDL_SET_PRELOADED_SYMBOLS();
  if (lt_dlinit() != 0) {
    fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
    return 1;
  }

  for (i = 1; i < argc; i++)
  {
    if (test_dl(argv[i], 0))
       ret = 1;
    p = strrchr(argv[i], '.');
    if (p)
      {
	*p = '\0';
	if (test_dl(argv[i], 1))
	  ret = 1;
	*p = '.';
      }
  }

  if (test_dlself())
    ret = 1;

  for (i = 1; i < argc; i++)
    if (argv[i][0] != '\0')
      {
	my_dirname (argv[i]);
	if (try_iterate (argv[i]))
	  ret = 1;
      }

  lt_dlexit();
  return ret;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/mdemo.at:646: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "mdemo.at:646"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:646"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/mdemo.at:646: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "mdemo.at:646"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:646"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:646: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "mdemo.at:646"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:646"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/mdemo.at:646: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "mdemo.at:646"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/mdemo.at:646"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:646: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "mdemo.at:646"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:646"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:646: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --with-included-ltdl --disable-static"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "mdemo.at:646"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --with-included-ltdl --disable-static
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:646"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:646: \$EGREP '^build_old_libs=no' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=no' libtool" "mdemo.at:646"
( $at_check_trace; $EGREP '^build_old_libs=no' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:646"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/mdemo.at:646: \$EGREP '^build_libtool_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=yes' libtool" "mdemo.at:646"
( $at_check_trace; $EGREP '^build_libtool_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:646"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:648: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:648"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:648"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./mdemo_static; if test -f "./mdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:648: if \"\$lt_exe\" ./foo1.la ./libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a shell pipeline' "mdemo.at:648"
( $at_check_trace; if "$lt_exe" ./foo1.la ./libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:648"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./mdemo; if test -f "./mdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:648: if \"\$lt_exe\" ./foo1.la ./libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a shell pipeline' "mdemo.at:648"
( $at_check_trace; if "$lt_exe" ./foo1.la ./libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:648"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./mdemo_static; if test -f "./mdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:648: if \"\$lt_exe\" \`pwd\`/foo1.la \`pwd\`/libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a `...` command substitution' "mdemo.at:648"
( $at_check_trace; if "$lt_exe" `pwd`/foo1.la `pwd`/libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:648"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./mdemo; if test -f "./mdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:648: if \"\$lt_exe\" \`pwd\`/foo1.la \`pwd\`/libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a `...` command substitution' "mdemo.at:648"
( $at_check_trace; if "$lt_exe" `pwd`/foo1.la `pwd`/libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:648"
$at_failed && at_fn_log_failure
$at_traceon; }



for target in install
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:649: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:649"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:649"
$at_failed && at_fn_log_failure
$at_traceon; }

done


# Windows hosts search for dlls in the command path.
PATH=$prefix/lib:$PATH

lt_exe=$prefix/bin/mdemo_static; if test -f "$prefix/bin/mdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:649: if \"\$lt_exe\" \$prefix/lib/foo1.la \$prefix/lib/libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a shell pipeline' "mdemo.at:649"
( $at_check_trace; if "$lt_exe" $prefix/lib/foo1.la $prefix/lib/libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:649"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$prefix/bin/mdemo; if test -f "$prefix/bin/mdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:649: if \"\$lt_exe\" \$prefix/lib/foo1.la \$prefix/lib/libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a shell pipeline' "mdemo.at:649"
( $at_check_trace; if "$lt_exe" $prefix/lib/foo1.la $prefix/lib/libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:649"
$at_failed && at_fn_log_failure
$at_traceon; }



for target in uninstall
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:650: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:650"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:650"
$at_failed && at_fn_log_failure
$at_traceon; }

done


leftovers=`find $prefix ! -type d ! -name '.*' -print`
{ set +x
$as_echo "$at_srcdir/mdemo.at:650: test -z \"\$leftovers\""
at_fn_check_prepare_dynamic "test -z \"$leftovers\"" "mdemo.at:650"
( $at_check_trace; test -z "$leftovers"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:650"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_118
#AT_START_119
at_fn_group_banner 119 'mdemo.at:659' \
  "ltdl load shared and static modules" "            " 12
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "119. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<_EOT_
AC_INIT([mdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_CONFIG_LTDL_DIR([libltdl])
AM_INIT_AUTOMAKE
AC_PROG_CC
LT_INIT([dlopen win32-dll])
LTDL_INIT([nonrecursive convenience])
AC_SUBST([LIBTOOL_DEPS])
AC_SUBST([INCLTDL])
AC_SUBST([LIBLTDL])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])
LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_EOT_


cat >Makefile.am <<_EOT_
AUTOMAKE_OPTIONS = no-dependencies subdir-objects foreign
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = \$(INCLTDL)
AM_LDFLAGS =

noinst_LTLIBRARIES =
EXTRA_LTLIBRARIES =

include_HEADERS =

EXTRA_DIST =

BUILT_SOURCES =
CLEANFILES =
MOSTLYCLEANFILES =

lib_LTLIBRARIES = libsub.la foo1.la libfoo2.la libmlib.la

foo1_la_SOURCES = foo1.c
foo1_la_LIBADD = \$(LIBM) libsub.la
foo1_la_LDFLAGS = -no-undefined -module -avoid-version

libfoo2_la_SOURCES = foo2.c
libfoo2_la_LIBADD = \$(LIBM) libsub.la
libfoo2_la_LDFLAGS = -no-undefined -module -export-symbols-regex "libfoo2.*"

libsub_la_SOURCES = sub.c
libsub_la_LDFLAGS = -no-undefined

## Use -export-symbols-regex here explicitly because libltdl marks
## its exported symbols, and we use libltdl as a convenience archive.
## Thus, on w32, auto-exporting is turned off.
libmlib_la_SOURCES = mlib.c
libmlib_la_LIBADD = \$(LIBLTDL) "-dlopen" foo1.la "-dlopen" libfoo2.la
libmlib_la_LDFLAGS = -no-undefined -export-symbols-regex ".*"
libmlib_la_DEPENDENCIES = \$(LIBLTDL) libsub.la foo1.la libfoo2.la

noinst_HEADERS = foo.h

bin_PROGRAMS = mdemo mdemo_static

# Create a version of mdemo that does dlopen.
mdemo_SOURCES = main.c
mdemo_LDFLAGS = -export-dynamic
## The quotes around -dlopen below fool automake into accepting it
mdemo_LDADD = \$(LIBLTDL) libsub.la "-dlopen" self \
		"-dlopen" foo1.la "-dlopen" libfoo2.la
mdemo_DEPENDENCIES = \$(LIBLTDL) libsub.la foo1.la libfoo2.la

# Create a statically linked version of mdemo.
mdemo_static_SOURCES = \$(mdemo_SOURCES)
mdemo_static_LDFLAGS = \$(STATIC) \$(mdemo_LDFLAGS)
mdemo_static_LDADD = \$(mdemo_LDADD)
mdemo_static_DEPENDENCIES = \$(mdemo_DEPENDENCIES)

libtool: \$(LIBTOOL_DEPS)
	\$(SHELL) ./config.status --recheck

include \$(srcdir)/libltdl/ltdl.mk
include \$(srcdir)/mdemo.mk
_EOT_

cat >mdemo.mk <<'_ATEOF'
# Don't abort for lack of mdemo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

int sub (void);

#endif
_ATEOF


cat >foo1.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

#define nothing foo1_LTX_nothing
#define foo1    foo1_LTX_foo1
#define hello   foo1_LTX_hello

/* Give a global variable definition. */
int nothing = FOO_RET;

/* private function */
int _foo1_helper (void) {
  sub ();
  return FOO_RET;
}

/* export functions */
#ifdef __cplusplus
extern "C" {
#endif

int foo1 (void) {
    printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
    return _foo1_helper ();
}

int hello () {
    printf ("** This is foolib 1 **\n");
    return HELLO_RET;
}

#ifdef __cplusplus
}
#endif
_ATEOF


cat >foo2.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

#define nothing libfoo2_LTX_nothing
#define foo2    libfoo2_LTX_foo2
#define hello   libfoo2_LTX_hello

/* Give a global variable definition. */
int nothing;

/* private function */
int _foo2_helper (void) {
  sub ();
  return FOO_RET;
}

/* export functions */
#ifdef __cplusplus
extern "C" {
#endif

int foo2 (void) {
    printf ("sin (0.0) = %g\n", (double) sin ((double) 0.0));
    return _foo2_helper ();
}

int hello () {
    printf ("** This is foolib 2 **\n");
    return HELLO_RET;
}

#ifdef __cplusplus
}
#endif
_ATEOF


cat >mlib.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"
#include "ltdl.h"

int test_dl (char *filename) {
  lt_dlhandle handle;
  const lt_dlinfo *info;
  int (*pfoo1)() = 0;
  int (*pfoo2)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;
  int ret = 0;

  handle = lt_dlopen(filename);
  if (!handle) {
    fprintf (stderr, "can't open the module %s!\n", filename);
    fprintf (stderr, "error was: %s\n", lt_dlerror());
    return 1;
  }

  info = lt_dlgetinfo(handle);
  if (!info) {
    fprintf (stderr, "can't get module info: %s\n", lt_dlerror());
    return 1;
  }
  if (info->name) {
    printf ("module name: %s\n", info->name);
  } else {
    printf ("module is not a libtool module\n");
  }
  printf ("module filename: %s\n", info->filename);
  printf ("module reference count: %i\n", info->ref_count);

  phello = (int(*)())lt_dlsym(handle, "hello");
  if (phello)
    {
      int value = (*phello) ();

      printf ("hello returned: %i\n", value);
      if (value == HELLO_RET)
        printf("hello is ok!\n");
    }
  else
    {
      fprintf (stderr, "did not find the 'hello' function\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pnothing = (int*)lt_dlsym(handle, "nothing");
  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    {
      fprintf (stderr, "did not find the 'nothing' variable\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pfoo1 = (int(*)())lt_dlsym(handle, "foo1");
  /* Just call the functions and check return values. */
  if (pfoo1)
    {
      if ((*pfoo1) () == FOO_RET)
        printf("foo1 is ok!\n");
      else
	ret = 1;
    }
  else {
    pfoo2 = (int(*)())lt_dlsym(handle, "foo2");
    if (pfoo2)
      {
        if ((*pfoo2) () == FOO_RET)
          printf("foo2 is ok!\n");
        else ret = 1;
      }
    else
      {
        fprintf (stderr, "did not find any of the 'foo' functions\n");
        fprintf (stderr, "error was: %s\n", lt_dlerror());
        ret = 1;
      }
  }
  lt_dlclose(handle);
  return ret;
}

int
mlib_func (int argc, char **argv)
{
  int ret = 0;
  int i;
  /*
   * Would be nice if this somehow worked for libraries, not just executables.
   * LTDL_SET_PRELOADED_SYMBOLS();
   */
  if (lt_dlinit() != 0) {
    fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
    return 1;
  }

  for (i = 1; i < argc; i++)
    if (test_dl(argv[i]))
       ret = 1;

  lt_dlexit();
  return ret;
}
_ATEOF


cat >sub.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
void sub (void) { printf ("sub() called\n"); }
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"
#include "ltdl.h"

#ifdef __cplusplus
#  define EXPORT extern "C"
#else
#  define EXPORT extern
#endif

EXPORT int myfunc (void);

int
test_dl (char *filename, int test_ext)
{
  lt_dlhandle handle;
  const lt_dlinfo *info;
  int (*pfoo1)() = 0;
  int (*pfoo2)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;
  int ret = 0;

  if (test_ext)
    handle = lt_dlopenext (filename);
  else
    handle = lt_dlopen (filename);

  if (!handle) {
    fprintf (stderr, "can't open the module %s!\n", filename);
    fprintf (stderr, "error was: %s\n", lt_dlerror());
    return 1;
  }

  info = lt_dlgetinfo(handle);
  if (!info) {
    fprintf (stderr, "can't get module info: %s\n", lt_dlerror());
    return 1;
  }
  if (info->name) {
    printf ("module name: %s\n", info->name);
  } else {
    printf ("module is not a libtool module\n");
  }
  printf ("module filename: %s\n", info->filename);
  printf ("module reference count: %i\n", info->ref_count);

  phello = (int(*)())lt_dlsym(handle, "hello");
  if (phello)
    {
      int value = (*phello) ();

      printf ("hello returned: %i\n", value);
      if (value == HELLO_RET)
        printf("hello is ok!\n");
    }
  else
    {
      fprintf (stderr, "did not find the 'hello' function\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pnothing = (int*)lt_dlsym(handle, "nothing");
  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    {
      fprintf (stderr, "did not find the 'nothing' variable\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pfoo1 = (int(*)())lt_dlsym(handle, "foo1");
  /* Just call the functions and check return values. */
  if (pfoo1)
    {
      if ((*pfoo1) () == FOO_RET)
        printf("foo1 is ok!\n");
      else
	ret = 1;
    }
  else {
    pfoo2 = (int(*)())lt_dlsym(handle, "foo2");
    if (pfoo2)
      {
        if ((*pfoo2) () == FOO_RET)
          printf("foo2 is ok!\n");
        else ret = 1;
      }
    else
      {
        fprintf (stderr, "did not find any of the 'foo' functions\n");
        fprintf (stderr, "error was: %s\n", lt_dlerror());
        ret = 1;
      }
  }
  lt_dlclose(handle);
  return ret;
}

int
myfunc ()
{
  return HELLO_RET;
}

int myvar;

int
test_dlself ()
{
  lt_dlhandle handle;
  int (*pmyfunc)() = 0;
  int *pmyvar = 0;
  int ret = 0;

  handle = lt_dlopen(0);
  if (!handle) {
    fprintf (stderr, "can't dlopen the program!\n");
    fprintf (stderr, "error was: %s\n", lt_dlerror());
    return 1;
  }

  pmyfunc = (int(*)())lt_dlsym(handle, "myfunc");
  if (pmyfunc)
    {
      int value = (*pmyfunc) ();

      printf ("myfunc returned: %i\n", value);
      if (value == HELLO_RET)
        printf("myfunc is ok!\n");
    }
  else
    {
      fprintf (stderr, "did not find the 'myfunc' function\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pmyvar = (int*)lt_dlsym(handle, "myvar");
  /* Try assigning to the variable. */
  if (pmyvar)
    *pmyvar = 1;
  else
    {
      fprintf (stderr, "did not find the 'myvar' variable\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  lt_dlclose(handle);
  return ret;
}

static int
callback (const char *filename, void *data)
{
  printf ("%s: %s\n", (char *)data, filename);
  return 0;
}

static int
try_iterate (const char *search_path)
{
  char *s = "try_iterate";
  return lt_dlforeachfile (search_path, callback, s);
}

/* cheap dirname clone.  We require a '/' separator, nonempty and large
   enough input, not ending with '/', and we will overwrite the input. */
static char *
my_dirname (char *path)
{
  char *p = strrchr (path, '/');
  if (p)
    *p = '\0';
  else
    {
      path[0] = '.';
      path[1] = '\0';
    }
  return path;
}

int
main (int argc, char **argv)
{
  int i;
  int ret = 0;
  char *p;

  printf ("Welcome to GNU libtool mdemo!\n");

  if (argc < 2) {
    fprintf (stderr, "usage: %s module [module...]\n", argv[0]);
  }

  LTDL_SET_PRELOADED_SYMBOLS();
  if (lt_dlinit() != 0) {
    fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
    return 1;
  }

  for (i = 1; i < argc; i++)
  {
    if (test_dl(argv[i], 0))
       ret = 1;
    p = strrchr(argv[i], '.');
    if (p)
      {
	*p = '\0';
	if (test_dl(argv[i], 1))
	  ret = 1;
	*p = '.';
      }
  }

  if (test_dlself())
    ret = 1;

  for (i = 1; i < argc; i++)
    if (argv[i][0] != '\0')
      {
	my_dirname (argv[i]);
	if (try_iterate (argv[i]))
	  ret = 1;
      }

  lt_dlexit();
  return ret;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/mdemo.at:663: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "mdemo.at:663"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:663"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/mdemo.at:663: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "mdemo.at:663"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:663"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:663: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "mdemo.at:663"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:663"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/mdemo.at:663: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "mdemo.at:663"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/mdemo.at:663"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:663: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "mdemo.at:663"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:663"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:663: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --with-included-ltdl"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "mdemo.at:663"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --with-included-ltdl
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:663"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:663: \$EGREP '^build_old_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=yes' libtool" "mdemo.at:663"
( $at_check_trace; $EGREP '^build_old_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:663"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/mdemo.at:663: \$EGREP '^build_libtool_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=yes' libtool" "mdemo.at:663"
( $at_check_trace; $EGREP '^build_libtool_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:663"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:665: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:665"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:665"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./mdemo_static; if test -f "./mdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:665: if \"\$lt_exe\" ./foo1.la ./libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a shell pipeline' "mdemo.at:665"
( $at_check_trace; if "$lt_exe" ./foo1.la ./libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:665"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./mdemo; if test -f "./mdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:665: if \"\$lt_exe\" ./foo1.la ./libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a shell pipeline' "mdemo.at:665"
( $at_check_trace; if "$lt_exe" ./foo1.la ./libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:665"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./mdemo_static; if test -f "./mdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:665: if \"\$lt_exe\" \`pwd\`/foo1.la \`pwd\`/libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a `...` command substitution' "mdemo.at:665"
( $at_check_trace; if "$lt_exe" `pwd`/foo1.la `pwd`/libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:665"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./mdemo; if test -f "./mdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:665: if \"\$lt_exe\" \`pwd\`/foo1.la \`pwd\`/libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a `...` command substitution' "mdemo.at:665"
( $at_check_trace; if "$lt_exe" `pwd`/foo1.la `pwd`/libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:665"
$at_failed && at_fn_log_failure
$at_traceon; }



for target in install
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:666: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:666"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:666"
$at_failed && at_fn_log_failure
$at_traceon; }

done


# Windows hosts search for dlls in the command path.
PATH=$prefix/lib:$PATH

lt_exe=$prefix/bin/mdemo_static; if test -f "$prefix/bin/mdemo_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:666: if \"\$lt_exe\" \$prefix/lib/foo1.la \$prefix/lib/libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a shell pipeline' "mdemo.at:666"
( $at_check_trace; if "$lt_exe" $prefix/lib/foo1.la $prefix/lib/libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:666"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=$prefix/bin/mdemo; if test -f "$prefix/bin/mdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:666: if \"\$lt_exe\" \$prefix/lib/foo1.la \$prefix/lib/libfoo2.la | \$GREP '^try_iterate: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a shell pipeline' "mdemo.at:666"
( $at_check_trace; if "$lt_exe" $prefix/lib/foo1.la $prefix/lib/libfoo2.la | $GREP '^try_iterate: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:666"
$at_failed && at_fn_log_failure
$at_traceon; }



for target in uninstall
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:667: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:667"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:667"
$at_failed && at_fn_log_failure
$at_traceon; }

done


leftovers=`find $prefix ! -type d ! -name '.*' -print`
{ set +x
$as_echo "$at_srcdir/mdemo.at:667: test -z \"\$leftovers\""
at_fn_check_prepare_dynamic "test -z \"$leftovers\"" "mdemo.at:667"
( $at_check_trace; test -z "$leftovers"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:667"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_119
#AT_START_120
at_fn_group_banner 120 'mdemo.at:676' \
  "ltdl dryrun" "                                    " 12
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "120. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<_EOT_
AC_INIT([mdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_CONFIG_LTDL_DIR([libltdl])
AM_INIT_AUTOMAKE
AC_PROG_CC
LT_INIT([dlopen win32-dll])
LTDL_INIT([nonrecursive convenience])
AC_SUBST([LIBTOOL_DEPS])
AC_SUBST([INCLTDL])
AC_SUBST([LIBLTDL])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])
LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_EOT_


cat >Makefile.am <<_EOT_
AUTOMAKE_OPTIONS = no-dependencies subdir-objects foreign
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = \$(INCLTDL)
AM_LDFLAGS =

noinst_LTLIBRARIES =
EXTRA_LTLIBRARIES =

include_HEADERS =

EXTRA_DIST =

BUILT_SOURCES =
CLEANFILES =
MOSTLYCLEANFILES =

lib_LTLIBRARIES = libsub.la foo1.la libfoo2.la libmlib.la

foo1_la_SOURCES = foo1.c
foo1_la_LIBADD = \$(LIBM) libsub.la
foo1_la_LDFLAGS = -no-undefined -module -avoid-version

libfoo2_la_SOURCES = foo2.c
libfoo2_la_LIBADD = \$(LIBM) libsub.la
libfoo2_la_LDFLAGS = -no-undefined -module -export-symbols-regex "libfoo2.*"

libsub_la_SOURCES = sub.c
libsub_la_LDFLAGS = -no-undefined

## Use -export-symbols-regex here explicitly because libltdl marks
## its exported symbols, and we use libltdl as a convenience archive.
## Thus, on w32, auto-exporting is turned off.
libmlib_la_SOURCES = mlib.c
libmlib_la_LIBADD = \$(LIBLTDL) "-dlopen" foo1.la "-dlopen" libfoo2.la
libmlib_la_LDFLAGS = -no-undefined -export-symbols-regex ".*"
libmlib_la_DEPENDENCIES = \$(LIBLTDL) libsub.la foo1.la libfoo2.la

noinst_HEADERS = foo.h

bin_PROGRAMS = mdemo mdemo_static

# Create a version of mdemo that does dlopen.
mdemo_SOURCES = main.c
mdemo_LDFLAGS = -export-dynamic
## The quotes around -dlopen below fool automake into accepting it
mdemo_LDADD = \$(LIBLTDL) libsub.la "-dlopen" self \
		"-dlopen" foo1.la "-dlopen" libfoo2.la
mdemo_DEPENDENCIES = \$(LIBLTDL) libsub.la foo1.la libfoo2.la

# Create a statically linked version of mdemo.
mdemo_static_SOURCES = \$(mdemo_SOURCES)
mdemo_static_LDFLAGS = \$(STATIC) \$(mdemo_LDFLAGS)
mdemo_static_LDADD = \$(mdemo_LDADD)
mdemo_static_DEPENDENCIES = \$(mdemo_DEPENDENCIES)

libtool: \$(LIBTOOL_DEPS)
	\$(SHELL) ./config.status --recheck

include \$(srcdir)/libltdl/ltdl.mk
include \$(srcdir)/mdemo.mk
_EOT_

cat >mdemo.mk <<'_ATEOF'
# Don't abort for lack of mdemo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

int sub (void);

#endif
_ATEOF


cat >foo1.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

#define nothing foo1_LTX_nothing
#define foo1    foo1_LTX_foo1
#define hello   foo1_LTX_hello

/* Give a global variable definition. */
int nothing = FOO_RET;

/* private function */
int _foo1_helper (void) {
  sub ();
  return FOO_RET;
}

/* export functions */
#ifdef __cplusplus
extern "C" {
#endif

int foo1 (void) {
    printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
    return _foo1_helper ();
}

int hello () {
    printf ("** This is foolib 1 **\n");
    return HELLO_RET;
}

#ifdef __cplusplus
}
#endif
_ATEOF


cat >foo2.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

#define nothing libfoo2_LTX_nothing
#define foo2    libfoo2_LTX_foo2
#define hello   libfoo2_LTX_hello

/* Give a global variable definition. */
int nothing;

/* private function */
int _foo2_helper (void) {
  sub ();
  return FOO_RET;
}

/* export functions */
#ifdef __cplusplus
extern "C" {
#endif

int foo2 (void) {
    printf ("sin (0.0) = %g\n", (double) sin ((double) 0.0));
    return _foo2_helper ();
}

int hello () {
    printf ("** This is foolib 2 **\n");
    return HELLO_RET;
}

#ifdef __cplusplus
}
#endif
_ATEOF


cat >mlib.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"
#include "ltdl.h"

int test_dl (char *filename) {
  lt_dlhandle handle;
  const lt_dlinfo *info;
  int (*pfoo1)() = 0;
  int (*pfoo2)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;
  int ret = 0;

  handle = lt_dlopen(filename);
  if (!handle) {
    fprintf (stderr, "can't open the module %s!\n", filename);
    fprintf (stderr, "error was: %s\n", lt_dlerror());
    return 1;
  }

  info = lt_dlgetinfo(handle);
  if (!info) {
    fprintf (stderr, "can't get module info: %s\n", lt_dlerror());
    return 1;
  }
  if (info->name) {
    printf ("module name: %s\n", info->name);
  } else {
    printf ("module is not a libtool module\n");
  }
  printf ("module filename: %s\n", info->filename);
  printf ("module reference count: %i\n", info->ref_count);

  phello = (int(*)())lt_dlsym(handle, "hello");
  if (phello)
    {
      int value = (*phello) ();

      printf ("hello returned: %i\n", value);
      if (value == HELLO_RET)
        printf("hello is ok!\n");
    }
  else
    {
      fprintf (stderr, "did not find the 'hello' function\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pnothing = (int*)lt_dlsym(handle, "nothing");
  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    {
      fprintf (stderr, "did not find the 'nothing' variable\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pfoo1 = (int(*)())lt_dlsym(handle, "foo1");
  /* Just call the functions and check return values. */
  if (pfoo1)
    {
      if ((*pfoo1) () == FOO_RET)
        printf("foo1 is ok!\n");
      else
	ret = 1;
    }
  else {
    pfoo2 = (int(*)())lt_dlsym(handle, "foo2");
    if (pfoo2)
      {
        if ((*pfoo2) () == FOO_RET)
          printf("foo2 is ok!\n");
        else ret = 1;
      }
    else
      {
        fprintf (stderr, "did not find any of the 'foo' functions\n");
        fprintf (stderr, "error was: %s\n", lt_dlerror());
        ret = 1;
      }
  }
  lt_dlclose(handle);
  return ret;
}

int
mlib_func (int argc, char **argv)
{
  int ret = 0;
  int i;
  /*
   * Would be nice if this somehow worked for libraries, not just executables.
   * LTDL_SET_PRELOADED_SYMBOLS();
   */
  if (lt_dlinit() != 0) {
    fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
    return 1;
  }

  for (i = 1; i < argc; i++)
    if (test_dl(argv[i]))
       ret = 1;

  lt_dlexit();
  return ret;
}
_ATEOF


cat >sub.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
void sub (void) { printf ("sub() called\n"); }
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"
#include "ltdl.h"

#ifdef __cplusplus
#  define EXPORT extern "C"
#else
#  define EXPORT extern
#endif

EXPORT int myfunc (void);

int
test_dl (char *filename, int test_ext)
{
  lt_dlhandle handle;
  const lt_dlinfo *info;
  int (*pfoo1)() = 0;
  int (*pfoo2)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;
  int ret = 0;

  if (test_ext)
    handle = lt_dlopenext (filename);
  else
    handle = lt_dlopen (filename);

  if (!handle) {
    fprintf (stderr, "can't open the module %s!\n", filename);
    fprintf (stderr, "error was: %s\n", lt_dlerror());
    return 1;
  }

  info = lt_dlgetinfo(handle);
  if (!info) {
    fprintf (stderr, "can't get module info: %s\n", lt_dlerror());
    return 1;
  }
  if (info->name) {
    printf ("module name: %s\n", info->name);
  } else {
    printf ("module is not a libtool module\n");
  }
  printf ("module filename: %s\n", info->filename);
  printf ("module reference count: %i\n", info->ref_count);

  phello = (int(*)())lt_dlsym(handle, "hello");
  if (phello)
    {
      int value = (*phello) ();

      printf ("hello returned: %i\n", value);
      if (value == HELLO_RET)
        printf("hello is ok!\n");
    }
  else
    {
      fprintf (stderr, "did not find the 'hello' function\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pnothing = (int*)lt_dlsym(handle, "nothing");
  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    {
      fprintf (stderr, "did not find the 'nothing' variable\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pfoo1 = (int(*)())lt_dlsym(handle, "foo1");
  /* Just call the functions and check return values. */
  if (pfoo1)
    {
      if ((*pfoo1) () == FOO_RET)
        printf("foo1 is ok!\n");
      else
	ret = 1;
    }
  else {
    pfoo2 = (int(*)())lt_dlsym(handle, "foo2");
    if (pfoo2)
      {
        if ((*pfoo2) () == FOO_RET)
          printf("foo2 is ok!\n");
        else ret = 1;
      }
    else
      {
        fprintf (stderr, "did not find any of the 'foo' functions\n");
        fprintf (stderr, "error was: %s\n", lt_dlerror());
        ret = 1;
      }
  }
  lt_dlclose(handle);
  return ret;
}

int
myfunc ()
{
  return HELLO_RET;
}

int myvar;

int
test_dlself ()
{
  lt_dlhandle handle;
  int (*pmyfunc)() = 0;
  int *pmyvar = 0;
  int ret = 0;

  handle = lt_dlopen(0);
  if (!handle) {
    fprintf (stderr, "can't dlopen the program!\n");
    fprintf (stderr, "error was: %s\n", lt_dlerror());
    return 1;
  }

  pmyfunc = (int(*)())lt_dlsym(handle, "myfunc");
  if (pmyfunc)
    {
      int value = (*pmyfunc) ();

      printf ("myfunc returned: %i\n", value);
      if (value == HELLO_RET)
        printf("myfunc is ok!\n");
    }
  else
    {
      fprintf (stderr, "did not find the 'myfunc' function\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pmyvar = (int*)lt_dlsym(handle, "myvar");
  /* Try assigning to the variable. */
  if (pmyvar)
    *pmyvar = 1;
  else
    {
      fprintf (stderr, "did not find the 'myvar' variable\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  lt_dlclose(handle);
  return ret;
}

static int
callback (const char *filename, void *data)
{
  printf ("%s: %s\n", (char *)data, filename);
  return 0;
}

static int
try_iterate (const char *search_path)
{
  char *s = "try_iterate";
  return lt_dlforeachfile (search_path, callback, s);
}

/* cheap dirname clone.  We require a '/' separator, nonempty and large
   enough input, not ending with '/', and we will overwrite the input. */
static char *
my_dirname (char *path)
{
  char *p = strrchr (path, '/');
  if (p)
    *p = '\0';
  else
    {
      path[0] = '.';
      path[1] = '\0';
    }
  return path;
}

int
main (int argc, char **argv)
{
  int i;
  int ret = 0;
  char *p;

  printf ("Welcome to GNU libtool mdemo!\n");

  if (argc < 2) {
    fprintf (stderr, "usage: %s module [module...]\n", argv[0]);
  }

  LTDL_SET_PRELOADED_SYMBOLS();
  if (lt_dlinit() != 0) {
    fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
    return 1;
  }

  for (i = 1; i < argc; i++)
  {
    if (test_dl(argv[i], 0))
       ret = 1;
    p = strrchr(argv[i], '.');
    if (p)
      {
	*p = '\0';
	if (test_dl(argv[i], 1))
	  ret = 1;
	*p = '.';
      }
  }

  if (test_dlself())
    ret = 1;

  for (i = 1; i < argc; i++)
    if (argv[i][0] != '\0')
      {
	my_dirname (argv[i]);
	if (try_iterate (argv[i]))
	  ret = 1;
      }

  lt_dlexit();
  return ret;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/mdemo.at:680: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "mdemo.at:680"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:680"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/mdemo.at:680: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "mdemo.at:680"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:680"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:680: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "mdemo.at:680"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:680"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/mdemo.at:680: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "mdemo.at:680"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/mdemo.at:680"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:680: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "mdemo.at:680"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:680"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:680: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --with-included-ltdl"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "mdemo.at:680"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --with-included-ltdl
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:680"
$at_failed && at_fn_log_failure
$at_traceon; }






for target in all-local libltdl/libltdlc.la
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:681: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:681"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:681"
$at_failed && at_fn_log_failure
$at_traceon; }

done


# create 'before' and 'after' in a directory deep within objdir,
# so that their creation and removal does not modify even a timestamp
# in the output of 'ls -l . $objdir'
$lt_INSTALL -d "$objdir/temp/temp"
before=$objdir/temp/temp/before
after=$objdir/temp/temp/after

# Create a new libtool script that will enter dry run if the environment
# variable force_dry_run is set
$SED 's|^[	 ]*opt_dry_run=.*$|opt_dry_run=$force_dry_run|' libtool > ltnew && mv ltnew libtool
export force_dry_run

# main.o is not compiled with libtool, but it depends on it, so make
# sure it is up-to-date.  libfoo2.la is linked with libsub.la, so make
# sure it exists, otherwise libtool will complain.
force_dry_run=false
for target in main.$objext
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:699: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:699"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:699"
$at_failed && at_fn_log_failure
$at_traceon; }

done


# Making object files
# ls -l in MSYS sometimes shows year, not time, for really fresh files.
sleep 1
ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$before"
force_dry_run=:
for target in foo1.lo foo2.lo libsub.la
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:706: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:706"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:706"
$at_failed && at_fn_log_failure
$at_traceon; }

done

ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$after"
{ set +x
$as_echo "$at_srcdir/mdemo.at:708: cmp \"\$before\" \"\$after\""
at_fn_check_prepare_dynamic "cmp \"$before\" \"$after\"" "mdemo.at:708"
( $at_check_trace; cmp "$before" "$after"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:708"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now really make them
force_dry_run=false
for target in foo1.lo foo2.lo libsub.la
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:712: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:712"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:712"
$at_failed && at_fn_log_failure
$at_traceon; }

done


# Making libraries
sleep 1 # for MSYS
ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$before"
force_dry_run=:
for target in foo1.la libfoo2.la
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:718: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:718"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:718"
$at_failed && at_fn_log_failure
$at_traceon; }

done

ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$after"
{ set +x
$as_echo "$at_srcdir/mdemo.at:720: cmp \"\$before\" \"\$after\""
at_fn_check_prepare_dynamic "cmp \"$before\" \"$after\"" "mdemo.at:720"
( $at_check_trace; cmp "$before" "$after"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:720"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now really make them
force_dry_run=false
for target in foo1.la libfoo2.la
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:724: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:724"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:724"
$at_failed && at_fn_log_failure
$at_traceon; }

done


# Making programs
sleep 1 # for MSYS
ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$before"
force_dry_run=:
for target in mdemo$EXEEXT mdemo_static$EXEEXT
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:730: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:730"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:730"
$at_failed && at_fn_log_failure
$at_traceon; }

done

ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$after"
{ set +x
$as_echo "$at_srcdir/mdemo.at:732: cmp \"\$before\" \"\$after\""
at_fn_check_prepare_dynamic "cmp \"$before\" \"$after\"" "mdemo.at:732"
( $at_check_trace; cmp "$before" "$after"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:732"
$at_failed && at_fn_log_failure
$at_traceon; }


# Running $MAKE install
# Libtool does not create these directories
$lt_INSTALL -d "$prefix/bin"
$lt_INSTALL -d "$prefix/include"
$lt_INSTALL -d "$prefix/lib"

sleep 1 # for MSYS
ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$before"
ls -lR "$prefix" | $EGREP -v '(^total|testsuite.log$)' >> "$before"
force_dry_run=:
for target in install
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:744: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:744"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:744"
$at_failed && at_fn_log_failure
$at_traceon; }

done


ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$after"
ls -lR "$prefix" | $EGREP -v '(^total|testsuite.log$)' >> "$after"
{ set +x
$as_echo "$at_srcdir/mdemo.at:748: cmp \"\$before\" \"\$after\""
at_fn_check_prepare_dynamic "cmp \"$before\" \"$after\"" "mdemo.at:748"
( $at_check_trace; cmp "$before" "$after"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:748"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now really install
force_dry_run=false
for target in install
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:752: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:752"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:752"
$at_failed && at_fn_log_failure
$at_traceon; }

done


# Running $MAKE uninstall
# Libtool does not uninstall the programs, remove them first
rm -f "$prefix/bin/mdemo$EXEEXT" "$prefix/bin/mdemo_static$EXEEXT"

sleep 1 # for MSYS
ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$before"
ls -lR "$prefix" | $EGREP -v '(^total|testsuite.log$)' >> "$before"
force_dry_run=:
for target in uninstall
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:762: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:762"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:762"
$at_failed && at_fn_log_failure
$at_traceon; }

done

ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$after"
ls -lR "$prefix" | $EGREP -v '(^total|testsuite.log$)' >> "$after"
{ set +x
$as_echo "$at_srcdir/mdemo.at:765: cmp \"\$before\" \"\$after\""
at_fn_check_prepare_dynamic "cmp \"$before\" \"$after\"" "mdemo.at:765"
( $at_check_trace; cmp "$before" "$after"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:765"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now really uninstall
force_dry_run=false
for target in uninstall
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:769: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:769"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:769"
$at_failed && at_fn_log_failure
$at_traceon; }

done


leftovers=`find $prefix ! -type d ! -name '.*' -print`
{ set +x
$as_echo "$at_srcdir/mdemo.at:769: test -z \"\$leftovers\""
at_fn_check_prepare_dynamic "test -z \"$leftovers\"" "mdemo.at:769"
( $at_check_trace; test -z "$leftovers"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:769"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_120
#AT_START_121
at_fn_group_banner 121 'mdemo.at:777' \
  "link with library that loads ltdl modules" "      " 12
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "121. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<_EOT_
AC_INIT([mdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
LT_CONFIG_LTDL_DIR([libltdl])
AM_INIT_AUTOMAKE
AC_PROG_CC
LT_INIT([dlopen win32-dll])
LTDL_INIT([nonrecursive convenience])
AC_SUBST([LIBTOOL_DEPS])
AC_SUBST([INCLTDL])
AC_SUBST([LIBLTDL])
STATIC=
test yes = "$enable_static" && STATIC=-static
AC_SUBST([STATIC])
LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_EOT_


cat >Makefile.am <<_EOT_
AUTOMAKE_OPTIONS = no-dependencies subdir-objects foreign
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = \$(INCLTDL)
AM_LDFLAGS =

noinst_LTLIBRARIES =
EXTRA_LTLIBRARIES =

include_HEADERS =

EXTRA_DIST =

BUILT_SOURCES =
CLEANFILES =
MOSTLYCLEANFILES =

lib_LTLIBRARIES = libsub.la foo1.la libfoo2.la libmlib.la

foo1_la_SOURCES = foo1.c
foo1_la_LIBADD = \$(LIBM) libsub.la
foo1_la_LDFLAGS = -no-undefined -module -avoid-version

libfoo2_la_SOURCES = foo2.c
libfoo2_la_LIBADD = \$(LIBM) libsub.la
libfoo2_la_LDFLAGS = -no-undefined -module -export-symbols-regex "libfoo2.*"

libsub_la_SOURCES = sub.c
libsub_la_LDFLAGS = -no-undefined

## Use -export-symbols-regex here explicitly because libltdl marks
## its exported symbols, and we use libltdl as a convenience archive.
## Thus, on w32, auto-exporting is turned off.
libmlib_la_SOURCES = mlib.c
libmlib_la_LIBADD = \$(LIBLTDL) "-dlopen" foo1.la "-dlopen" libfoo2.la
libmlib_la_LDFLAGS = -no-undefined -export-symbols-regex ".*"
libmlib_la_DEPENDENCIES = \$(LIBLTDL) libsub.la foo1.la libfoo2.la

noinst_HEADERS = foo.h

bin_PROGRAMS = mdemo mdemo_static

# Create a version of mdemo that does dlopen.
mdemo_SOURCES = main.c
mdemo_LDFLAGS = -export-dynamic
## The quotes around -dlopen below fool automake into accepting it
mdemo_LDADD = \$(LIBLTDL) libsub.la "-dlopen" self \
		"-dlopen" foo1.la "-dlopen" libfoo2.la
mdemo_DEPENDENCIES = \$(LIBLTDL) libsub.la foo1.la libfoo2.la

# Create a statically linked version of mdemo.
mdemo_static_SOURCES = \$(mdemo_SOURCES)
mdemo_static_LDFLAGS = \$(STATIC) \$(mdemo_LDFLAGS)
mdemo_static_LDADD = \$(mdemo_LDADD)
mdemo_static_DEPENDENCIES = \$(mdemo_DEPENDENCIES)

libtool: \$(LIBTOOL_DEPS)
	\$(SHELL) ./config.status --recheck

include \$(srcdir)/libltdl/ltdl.mk
include \$(srcdir)/mdemo.mk
_EOT_

cat >mdemo.mk <<'_ATEOF'
# Don't abort for lack of mdemo.mk
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H

/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

int sub (void);

#endif
_ATEOF


cat >foo1.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

#define nothing foo1_LTX_nothing
#define foo1    foo1_LTX_foo1
#define hello   foo1_LTX_hello

/* Give a global variable definition. */
int nothing = FOO_RET;

/* private function */
int _foo1_helper (void) {
  sub ();
  return FOO_RET;
}

/* export functions */
#ifdef __cplusplus
extern "C" {
#endif

int foo1 (void) {
    printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
    return _foo1_helper ();
}

int hello () {
    printf ("** This is foolib 1 **\n");
    return HELLO_RET;
}

#ifdef __cplusplus
}
#endif
_ATEOF


cat >foo2.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <math.h>

#include "foo.h"

#define nothing libfoo2_LTX_nothing
#define foo2    libfoo2_LTX_foo2
#define hello   libfoo2_LTX_hello

/* Give a global variable definition. */
int nothing;

/* private function */
int _foo2_helper (void) {
  sub ();
  return FOO_RET;
}

/* export functions */
#ifdef __cplusplus
extern "C" {
#endif

int foo2 (void) {
    printf ("sin (0.0) = %g\n", (double) sin ((double) 0.0));
    return _foo2_helper ();
}

int hello () {
    printf ("** This is foolib 2 **\n");
    return HELLO_RET;
}

#ifdef __cplusplus
}
#endif
_ATEOF


cat >mlib.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"
#include "ltdl.h"

int test_dl (char *filename) {
  lt_dlhandle handle;
  const lt_dlinfo *info;
  int (*pfoo1)() = 0;
  int (*pfoo2)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;
  int ret = 0;

  handle = lt_dlopen(filename);
  if (!handle) {
    fprintf (stderr, "can't open the module %s!\n", filename);
    fprintf (stderr, "error was: %s\n", lt_dlerror());
    return 1;
  }

  info = lt_dlgetinfo(handle);
  if (!info) {
    fprintf (stderr, "can't get module info: %s\n", lt_dlerror());
    return 1;
  }
  if (info->name) {
    printf ("module name: %s\n", info->name);
  } else {
    printf ("module is not a libtool module\n");
  }
  printf ("module filename: %s\n", info->filename);
  printf ("module reference count: %i\n", info->ref_count);

  phello = (int(*)())lt_dlsym(handle, "hello");
  if (phello)
    {
      int value = (*phello) ();

      printf ("hello returned: %i\n", value);
      if (value == HELLO_RET)
        printf("hello is ok!\n");
    }
  else
    {
      fprintf (stderr, "did not find the 'hello' function\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pnothing = (int*)lt_dlsym(handle, "nothing");
  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    {
      fprintf (stderr, "did not find the 'nothing' variable\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pfoo1 = (int(*)())lt_dlsym(handle, "foo1");
  /* Just call the functions and check return values. */
  if (pfoo1)
    {
      if ((*pfoo1) () == FOO_RET)
        printf("foo1 is ok!\n");
      else
	ret = 1;
    }
  else {
    pfoo2 = (int(*)())lt_dlsym(handle, "foo2");
    if (pfoo2)
      {
        if ((*pfoo2) () == FOO_RET)
          printf("foo2 is ok!\n");
        else ret = 1;
      }
    else
      {
        fprintf (stderr, "did not find any of the 'foo' functions\n");
        fprintf (stderr, "error was: %s\n", lt_dlerror());
        ret = 1;
      }
  }
  lt_dlclose(handle);
  return ret;
}

int
mlib_func (int argc, char **argv)
{
  int ret = 0;
  int i;
  /*
   * Would be nice if this somehow worked for libraries, not just executables.
   * LTDL_SET_PRELOADED_SYMBOLS();
   */
  if (lt_dlinit() != 0) {
    fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
    return 1;
  }

  for (i = 1; i < argc; i++)
    if (test_dl(argv[i]))
       ret = 1;

  lt_dlexit();
  return ret;
}
_ATEOF


cat >sub.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
void sub (void) { printf ("sub() called\n"); }
_ATEOF


cat >main.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>
#include <string.h>

#include "foo.h"
#include "ltdl.h"

#ifdef __cplusplus
#  define EXPORT extern "C"
#else
#  define EXPORT extern
#endif

EXPORT int myfunc (void);

int
test_dl (char *filename, int test_ext)
{
  lt_dlhandle handle;
  const lt_dlinfo *info;
  int (*pfoo1)() = 0;
  int (*pfoo2)() = 0;
  int (*phello)() = 0;
  int *pnothing = 0;
  int ret = 0;

  if (test_ext)
    handle = lt_dlopenext (filename);
  else
    handle = lt_dlopen (filename);

  if (!handle) {
    fprintf (stderr, "can't open the module %s!\n", filename);
    fprintf (stderr, "error was: %s\n", lt_dlerror());
    return 1;
  }

  info = lt_dlgetinfo(handle);
  if (!info) {
    fprintf (stderr, "can't get module info: %s\n", lt_dlerror());
    return 1;
  }
  if (info->name) {
    printf ("module name: %s\n", info->name);
  } else {
    printf ("module is not a libtool module\n");
  }
  printf ("module filename: %s\n", info->filename);
  printf ("module reference count: %i\n", info->ref_count);

  phello = (int(*)())lt_dlsym(handle, "hello");
  if (phello)
    {
      int value = (*phello) ();

      printf ("hello returned: %i\n", value);
      if (value == HELLO_RET)
        printf("hello is ok!\n");
    }
  else
    {
      fprintf (stderr, "did not find the 'hello' function\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pnothing = (int*)lt_dlsym(handle, "nothing");
  /* Try assigning to the nothing variable. */
  if (pnothing)
    *pnothing = 1;
  else
    {
      fprintf (stderr, "did not find the 'nothing' variable\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pfoo1 = (int(*)())lt_dlsym(handle, "foo1");
  /* Just call the functions and check return values. */
  if (pfoo1)
    {
      if ((*pfoo1) () == FOO_RET)
        printf("foo1 is ok!\n");
      else
	ret = 1;
    }
  else {
    pfoo2 = (int(*)())lt_dlsym(handle, "foo2");
    if (pfoo2)
      {
        if ((*pfoo2) () == FOO_RET)
          printf("foo2 is ok!\n");
        else ret = 1;
      }
    else
      {
        fprintf (stderr, "did not find any of the 'foo' functions\n");
        fprintf (stderr, "error was: %s\n", lt_dlerror());
        ret = 1;
      }
  }
  lt_dlclose(handle);
  return ret;
}

int
myfunc ()
{
  return HELLO_RET;
}

int myvar;

int
test_dlself ()
{
  lt_dlhandle handle;
  int (*pmyfunc)() = 0;
  int *pmyvar = 0;
  int ret = 0;

  handle = lt_dlopen(0);
  if (!handle) {
    fprintf (stderr, "can't dlopen the program!\n");
    fprintf (stderr, "error was: %s\n", lt_dlerror());
    return 1;
  }

  pmyfunc = (int(*)())lt_dlsym(handle, "myfunc");
  if (pmyfunc)
    {
      int value = (*pmyfunc) ();

      printf ("myfunc returned: %i\n", value);
      if (value == HELLO_RET)
        printf("myfunc is ok!\n");
    }
  else
    {
      fprintf (stderr, "did not find the 'myfunc' function\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  pmyvar = (int*)lt_dlsym(handle, "myvar");
  /* Try assigning to the variable. */
  if (pmyvar)
    *pmyvar = 1;
  else
    {
      fprintf (stderr, "did not find the 'myvar' variable\n");
      fprintf (stderr, "error was: %s\n", lt_dlerror());
      ret = 1;
    }

  lt_dlclose(handle);
  return ret;
}

static int
callback (const char *filename, void *data)
{
  printf ("%s: %s\n", (char *)data, filename);
  return 0;
}

static int
try_iterate (const char *search_path)
{
  char *s = "try_iterate";
  return lt_dlforeachfile (search_path, callback, s);
}

/* cheap dirname clone.  We require a '/' separator, nonempty and large
   enough input, not ending with '/', and we will overwrite the input. */
static char *
my_dirname (char *path)
{
  char *p = strrchr (path, '/');
  if (p)
    *p = '\0';
  else
    {
      path[0] = '.';
      path[1] = '\0';
    }
  return path;
}

int
main (int argc, char **argv)
{
  int i;
  int ret = 0;
  char *p;

  printf ("Welcome to GNU libtool mdemo!\n");

  if (argc < 2) {
    fprintf (stderr, "usage: %s module [module...]\n", argv[0]);
  }

  LTDL_SET_PRELOADED_SYMBOLS();
  if (lt_dlinit() != 0) {
    fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
    return 1;
  }

  for (i = 1; i < argc; i++)
  {
    if (test_dl(argv[i], 0))
       ret = 1;
    p = strrchr(argv[i], '.');
    if (p)
      {
	*p = '\0';
	if (test_dl(argv[i], 1))
	  ret = 1;
	*p = '.';
      }
  }

  if (test_dlself())
    ret = 1;

  for (i = 1; i < argc; i++)
    if (argv[i][0] != '\0')
      {
	my_dirname (argv[i]);
	if (try_iterate (argv[i]))
	  ret = 1;
      }

  lt_dlexit();
  return ret;
}
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU Hell!
cos (0.0) = 1
** This is not GNU Hello. There is no built-in mail reader. **
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


cat >mdemo.mk <<'_ATEOF'
bin_PROGRAMS += mdemo2 mdemo2_static

# Create a version of mdemo2 that links a library that does dlopen.
mdemo2_LDFLAGS = -export-dynamic "-dlopen" force
mdemo2_LDADD = libmlib.la

# Create a statically linked version of mdemo.
mdemo2_static_SOURCES = mdemo2.c
mdemo2_static_LDFLAGS = $(STATIC) $(mdemo2_LDFLAGS)
mdemo2_static_LDADD = $(mdemo2_LDADD)
mdemo2_static_DEPENDENCIES = $(mdemo2_DEPENDENCIES)
_ATEOF


cat >mdemo2.c <<'_ATEOF'
#include <stdio.h>
#include "ltdl.h"

extern int mlib_func (int, char **);

int main (int argc, char **argv)
{
  int ret = 0;

  printf ("Welcome to GNU libtool mdemo2!\n");
  if (argc < 2) {
    fprintf (stderr, "usage: %s module [module...]\n", argv[0]);
  }

  /* This must be called in the program to get the preloaded symbols */
  LTDL_SET_PRELOADED_SYMBOLS();

  ret = mlib_func(argc, argv);

  return ret;
}
_ATEOF


# Normalize line endings after $EGREP instead of using LT_AT_HOST_DATA
# here, since $EGREP *may* normalize line endings for us.
cat >expout <<'_ATEOF'
Welcome to GNU libtool mdemo2!
module name: foo1
module reference count: 1
** This is foolib 1 **
hello returned: 57616
hello is ok!
cos (0.0) = 1
sub() called
foo1 is ok!
module name: libfoo2
module reference count: 1
** This is foolib 2 **
hello returned: 57616
hello is ok!
sin (0.0) = 0
sub() called
foo2 is ok!
_ATEOF


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/mdemo.at:841: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "mdemo.at:841"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:841"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/mdemo.at:841: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "mdemo.at:841"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:841"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:841: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "mdemo.at:841"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:841"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/mdemo.at:841: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "mdemo.at:841"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/mdemo.at:841"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:841: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "mdemo.at:841"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:841"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/mdemo.at:841: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --with-included-ltdl"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "mdemo.at:841"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --with-included-ltdl
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:841"
$at_failed && at_fn_log_failure
$at_traceon; }







for target in all
do
  { set +x
$as_echo "$at_srcdir/mdemo.at:843: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "mdemo.at:843"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:843"
$at_failed && at_fn_log_failure
$at_traceon; }

done


lt_exe=./mdemo2_static; if test -f "./mdemo2_static$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:845: if \"\$lt_exe\" ./foo1.la ./libfoo2.la | \$EGREP -v '^module filename: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a shell pipeline' "mdemo.at:845"
( $at_check_trace; if "$lt_exe" ./foo1.la ./libfoo2.la | $EGREP -v '^module filename: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:845"
$at_failed && at_fn_log_failure
$at_traceon; }


case $host_os in
  mingw*)
    tr -d '\015' < stdout > stdout.t
    mv -f stdout.t stdout ;;
esac
echo "diff expout stdout"; { set +x
$as_echo "$at_srcdir/mdemo.at:848: diff expout stdout"
at_fn_check_prepare_trace "mdemo.at:848"
( $at_check_trace; diff expout stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:848"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./mdemo2; if test -f "./mdemo2$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/mdemo.at:850: if \"\$lt_exe\" ./foo1.la ./libfoo2.la | \$EGREP -v '^module filename: '; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_notrace 'a shell pipeline' "mdemo.at:850"
( $at_check_trace; if "$lt_exe" ./foo1.la ./libfoo2.la | $EGREP -v '^module filename: '; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:850"
$at_failed && at_fn_log_failure
$at_traceon; }


case $host_os in
  mingw*)
    tr -d '\015' < stdout > stdout.t
    mv -f stdout.t stdout ;;
esac
echo "diff expout stdout"; { set +x
$as_echo "$at_srcdir/mdemo.at:853: diff expout stdout"
at_fn_check_prepare_trace "mdemo.at:853"
( $at_check_trace; diff expout stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/mdemo.at:853"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_121
#AT_START_122
at_fn_group_banner 122 'standalone.at:32' \
  "compiling softlinked libltdl" "                   " 13
at_xfail=no
(
  $as_echo "122. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/standalone.at:34: \$LIBTOOLIZE --ltdl=.

"
at_fn_check_prepare_notrace 'an embedded newline' "standalone.at:34"
( $at_check_trace; $LIBTOOLIZE --ltdl=.


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/standalone.at:34"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/standalone.at:35: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "standalone.at:35"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/standalone.at:35"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all $tst_dist
do
  { set +x
$as_echo "$at_srcdir/standalone.at:36: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "standalone.at:36"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/standalone.at:36"
$at_failed && at_fn_log_failure
$at_traceon; }

done


{ set +x
$as_echo "$at_srcdir/standalone.at:38: test -f libltdlc.la"
at_fn_check_prepare_trace "standalone.at:38"
( $at_check_trace; test -f libltdlc.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/standalone.at:38"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_122
#AT_START_123
at_fn_group_banner 123 'standalone.at:47' \
  "compiling copied libltdl" "                       " 13
at_xfail=no
(
  $as_echo "123. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/standalone.at:49: \$LIBTOOLIZE --copy --ltdl=.

"
at_fn_check_prepare_notrace 'an embedded newline' "standalone.at:49"
( $at_check_trace; $LIBTOOLIZE --copy --ltdl=.


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/standalone.at:49"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/standalone.at:50: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "standalone.at:50"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/standalone.at:50"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all $tst_dist
do
  { set +x
$as_echo "$at_srcdir/standalone.at:51: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "standalone.at:51"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/standalone.at:51"
$at_failed && at_fn_log_failure
$at_traceon; }

done


{ set +x
$as_echo "$at_srcdir/standalone.at:53: test -f libltdlc.la"
at_fn_check_prepare_trace "standalone.at:53"
( $at_check_trace; test -f libltdlc.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/standalone.at:53"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_123
#AT_START_124
at_fn_group_banner 124 'standalone.at:62' \
  "installable libltdl" "                            " 13
at_xfail=no
(
  $as_echo "124. $at_setup_line: testing $at_desc ..."
  $at_traceon


prefix=`pwd`/_inst

{ set +x
$as_echo "$at_srcdir/standalone.at:66: \$LIBTOOLIZE --copy --ltdl=.

"
at_fn_check_prepare_notrace 'an embedded newline' "standalone.at:66"
( $at_check_trace; $LIBTOOLIZE --copy --ltdl=.


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/standalone.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/standalone.at:67: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --enable-ltdl-install --prefix=\$prefix"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "standalone.at:67"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --enable-ltdl-install --prefix=$prefix
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/standalone.at:67"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all install $tst_dist
do
  { set +x
$as_echo "$at_srcdir/standalone.at:68: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "standalone.at:68"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/standalone.at:68"
$at_failed && at_fn_log_failure
$at_traceon; }

done


{ set +x
$as_echo "$at_srcdir/standalone.at:70: test -f \"\$prefix/lib/libltdl.la\""
at_fn_check_prepare_dynamic "test -f \"$prefix/lib/libltdl.la\"" "standalone.at:70"
( $at_check_trace; test -f "$prefix/lib/libltdl.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/standalone.at:70"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/standalone.at:71: test -f \"\$prefix/include/ltdl.h\""
at_fn_check_prepare_dynamic "test -f \"$prefix/include/ltdl.h\"" "standalone.at:71"
( $at_check_trace; test -f "$prefix/include/ltdl.h"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/standalone.at:71"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_124
#AT_START_125
at_fn_group_banner 125 'standalone.at:80' \
  "linking libltdl without autotools" "              " 13
at_xfail=no
(
  $as_echo "125. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >module.c <<'_ATEOF'
#ifdef __cplusplus
extern "C"
#endif
const char *
hello (void)
{
  return "Hello!";
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <stdio.h>
#include "ltdl.h"

int
main ()
{
  lt_dlhandle module;
  const char *(*func) (void) = 0;
  int status = 1;

  LTDL_SET_PRELOADED_SYMBOLS();
  if (lt_dlinit() != 0) {
    fprintf (stderr, "error during initialisation: %s\n", lt_dlerror());
    return 1;
  }

  module = lt_dlopen("./module.la");
  if (!module) {
    fprintf (stderr, "error dlopening ./module.la: %s\n", lt_dlerror());
    goto finish;
  }

  func = (const char *(*)(void)) lt_dlsym (module, "hello");
  if (!func) {
    fprintf (stderr, "error fetching func: %s\n", lt_dlerror());
    goto finish;
  }

  printf ("%s\n", (*func) ());
  status = 0;

finish:
  if (lt_dlexit() != 0) {
    fprintf (stderr, "error during finalisation: %s\n", lt_dlerror());
    status = 1;
  }

  return status;
}
_ATEOF



cat >Makefile <<'_ATEOF'
top_builddir	= .
LIBTOOL		= ./libltdl/libtool
INCLUDES	= -I./libltdl
MODFLAGS	= -module -avoid-version -no-undefined

LTCOMPILE = $(LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=compile \
        $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LTLINK    = $(LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=link \
        $(CC) $(CFLAGS) $(LDFLAGS)

TARGETS		= libltdl/libltdlc.la module.la ltdldemo$(EXEEXT)

all: $(TARGETS)

libltdl/libltdlc.la: $(LIBTOOL) libltdl/Makefile
	MAKE='$(MAKE)'; test -n "$$MAKE" || MAKE=make; \
	cd libltdl && $$MAKE CC="$(CC)" LIBTOOLFLAGS="$(LIBTOOLFLAGS)" \
	  CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
          CONFIGURE_OPTIONS="$(CONFIGURE_OPTIONS)"

$(LIBTOOL): libltdl/Makefile

libltdl/Makefile:
	cd libltdl && CONFIG_SHELL="$(SHELL)" $(SHELL) ./configure $(CONFIGURE_OPTIONS)

ltdldemo$(EXEEXT): $(LIBTOOL) module.la libltdl/libltdlc.la main.lo
	$(LTLINK) -o ltdldemo$(EXEEXT) main.lo -dlopen module.la ./libltdl/libltdlc.la

main.lo: $(LIBTOOL) main.c
	$(LTCOMPILE) -c main.c

module.la: $(LIBTOOL) module.lo
	$(LTLINK) -o module.la module.lo $(MODFLAGS) -rpath /dev/null

module.lo: $(LIBTOOL) module.c
	$(LTCOMPILE) -c module.c
_ATEOF

cat >> Makefile <<EOF
SHELL = $SHELL
EOF



{ set +x
$as_echo "$at_srcdir/standalone.at:83: \$LIBTOOLIZE --copy --ltdl

"
at_fn_check_prepare_notrace 'an embedded newline' "standalone.at:83"
( $at_check_trace; $LIBTOOLIZE --copy --ltdl


) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/standalone.at:83"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/standalone.at:84: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target CC=\"\$CC\" LIBTOOLFLAGS=\"\$LIBTOOLFLAGS\" CPPFLAGS=\"\$CPPFLAGS\"         CFLAGS=\"\$CFLAGS\" LDFLAGS=\"\$LDFLAGS\" 	CONFIGURE_OPTIONS=\"\$configure_options\""
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target CC=\"$CC\" LIBTOOLFLAGS=\"$LIBTOOLFLAGS\" CPPFLAGS=\"$CPPFLAGS\"         CFLAGS=\"$CFLAGS\" LDFLAGS=\"$LDFLAGS\" 	CONFIGURE_OPTIONS=\"$configure_options\"" "standalone.at:84"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target CC="$CC" LIBTOOLFLAGS="$LIBTOOLFLAGS" CPPFLAGS="$CPPFLAGS"         CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" 	CONFIGURE_OPTIONS="$configure_options"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/standalone.at:84"
$at_failed && at_fn_log_failure
$at_traceon; }

done


lt_exe=./ltdldemo; if test -f "./ltdldemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/standalone.at:88: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "standalone.at:88"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/standalone.at:88"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_125
#AT_START_126
at_fn_group_banner 126 'subproject.at:58' \
  "compiling softlinked libltdl" "                   " 14
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "126. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([subproject-demo], 2.4.7, bug-libtool@gnu.org)
LT_CONFIG_LTDL_DIR([sub/ltdl])
AC_CONFIG_AUX_DIR([sub/ltdl/config])
AC_CONFIG_MACRO_DIRS([sub/ltdl/m4])
AM_INIT_AUTOMAKE([foreign])
LT_INIT
LT_WITH_LTDL
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I sub/ltdl/m4
AUTOMAKE_OPTIONS = 1.9
SUBDIRS = sub/ltdl
lib_LTLIBRARIES = foo.la
foo_la_LDFLAGS = -module -avoid-version -no-undefined
_ATEOF


echo 'int dummy = 0;' > foo.c


$LIBTOOLIZE --ltdl


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I sub/ltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/subproject.at:62: \$ACLOCAL -I sub/ltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I sub/ltdl/m4$macro_dir" "subproject.at:62"
( $at_check_trace; $ACLOCAL -I sub/ltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:62"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1




{ set +x
$as_echo "$at_srcdir/subproject.at:62: \$AUTOMAKE --add-missing --copy"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing --copy" "subproject.at:62"
( $at_check_trace; $AUTOMAKE --add-missing --copy
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:62"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/subproject.at:62: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "subproject.at:62"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/subproject.at:62"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/subproject.at:62: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "subproject.at:62"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:62"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/subproject.at:62: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "subproject.at:62"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:62"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all $tst_dist
do
  { set +x
$as_echo "$at_srcdir/subproject.at:62: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "subproject.at:62"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:62"
$at_failed && at_fn_log_failure
$at_traceon; }

done



{ set +x
$as_echo "$at_srcdir/subproject.at:65: test -f sub/ltdl/libltdlc.la"
at_fn_check_prepare_trace "subproject.at:65"
( $at_check_trace; test -f sub/ltdl/libltdlc.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:65"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_126
#AT_START_127
at_fn_group_banner 127 'subproject.at:74' \
  "compiling copied libltdl" "                       " 14
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "127. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([subproject-demo], 2.4.7, bug-libtool@gnu.org)
LT_CONFIG_LTDL_DIR([sub/ltdl])
AC_CONFIG_AUX_DIR([sub/ltdl/config])
AC_CONFIG_MACRO_DIRS([sub/ltdl/m4])
AM_INIT_AUTOMAKE([foreign])
LT_INIT
LT_WITH_LTDL
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I sub/ltdl/m4
AUTOMAKE_OPTIONS = 1.9
SUBDIRS = sub/ltdl
lib_LTLIBRARIES = foo.la
foo_la_LDFLAGS = -module -avoid-version -no-undefined
_ATEOF


echo 'int dummy = 0;' > foo.c


$LIBTOOLIZE --copy --ltdl


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I sub/ltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/subproject.at:78: \$ACLOCAL -I sub/ltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I sub/ltdl/m4$macro_dir" "subproject.at:78"
( $at_check_trace; $ACLOCAL -I sub/ltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:78"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1




{ set +x
$as_echo "$at_srcdir/subproject.at:78: \$AUTOMAKE --add-missing --copy"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing --copy" "subproject.at:78"
( $at_check_trace; $AUTOMAKE --add-missing --copy
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:78"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/subproject.at:78: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "subproject.at:78"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/subproject.at:78"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/subproject.at:78: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "subproject.at:78"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:78"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/subproject.at:78: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "subproject.at:78"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:78"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all $tst_dist
do
  { set +x
$as_echo "$at_srcdir/subproject.at:78: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "subproject.at:78"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:78"
$at_failed && at_fn_log_failure
$at_traceon; }

done



{ set +x
$as_echo "$at_srcdir/subproject.at:81: test -f sub/ltdl/libltdlc.la"
at_fn_check_prepare_trace "subproject.at:81"
( $at_check_trace; test -f sub/ltdl/libltdlc.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:81"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_127
#AT_START_128
at_fn_group_banner 128 'subproject.at:90' \
  "installable libltdl" "                            " 14
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "128. $at_setup_line: testing $at_desc ..."
  $at_traceon


prefix=`pwd`/_inst

cat >configure.ac <<'_ATEOF'
AC_INIT([subproject-demo], 2.4.7, bug-libtool@gnu.org)
LT_CONFIG_LTDL_DIR([sub/ltdl])
AC_CONFIG_AUX_DIR([sub/ltdl/config])
AC_CONFIG_MACRO_DIRS([sub/ltdl/m4])
AM_INIT_AUTOMAKE([foreign])
LT_INIT
LT_WITH_LTDL
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I sub/ltdl/m4
AUTOMAKE_OPTIONS = 1.9
SUBDIRS = sub/ltdl
lib_LTLIBRARIES = foo.la
foo_la_LDFLAGS = -module -avoid-version -no-undefined
_ATEOF


echo 'int dummy = 0;' > foo.c


$LIBTOOLIZE --copy --ltdl


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I sub/ltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/subproject.at:96: \$ACLOCAL -I sub/ltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I sub/ltdl/m4$macro_dir" "subproject.at:96"
( $at_check_trace; $ACLOCAL -I sub/ltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:96"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1




{ set +x
$as_echo "$at_srcdir/subproject.at:96: \$AUTOMAKE --add-missing --copy"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing --copy" "subproject.at:96"
( $at_check_trace; $AUTOMAKE --add-missing --copy
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:96"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/subproject.at:96: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "subproject.at:96"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/subproject.at:96"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/subproject.at:96: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "subproject.at:96"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:96"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/subproject.at:96: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --enable-ltdl-install --prefix=\$prefix"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "subproject.at:96"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --enable-ltdl-install --prefix=$prefix
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:96"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all install $tst_dist
do
  { set +x
$as_echo "$at_srcdir/subproject.at:96: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "subproject.at:96"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:96"
$at_failed && at_fn_log_failure
$at_traceon; }

done



{ set +x
$as_echo "$at_srcdir/subproject.at:100: test -f \"\$prefix/lib/libltdl.la\""
at_fn_check_prepare_dynamic "test -f \"$prefix/lib/libltdl.la\"" "subproject.at:100"
( $at_check_trace; test -f "$prefix/lib/libltdl.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:100"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/subproject.at:101: test -f \"\$prefix/include/ltdl.h\""
at_fn_check_prepare_dynamic "test -f \"$prefix/include/ltdl.h\"" "subproject.at:101"
( $at_check_trace; test -f "$prefix/include/ltdl.h"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:101"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_128
#AT_START_129
at_fn_group_banner 129 'subproject.at:110' \
  "linking libltdl without autotools" "              " 14
at_xfail=no
(
  $as_echo "129. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >module.c <<'_ATEOF'
#ifdef __cplusplus
extern "C"
#endif
const char *
hello (void)
{
  return "Hello!";
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <stdio.h>
#include "ltdl.h"

int
main ()
{
  lt_dlhandle module;
  const char *(*func) (void) = 0;
  int status = 1;

  LTDL_SET_PRELOADED_SYMBOLS();
  if (lt_dlinit() != 0) {
    fprintf (stderr, "error during initialisation: %s\n", lt_dlerror());
    return 1;
  }

  module = lt_dlopen("./module.la");
  if (!module) {
    fprintf (stderr, "error dlopening ./module.la: %s\n", lt_dlerror());
    goto finish;
  }

  func = (const char *(*)(void)) lt_dlsym (module, "hello");
  if (!func) {
    fprintf (stderr, "error fetching func: %s\n", lt_dlerror());
    goto finish;
  }

  printf ("%s\n", (*func) ());
  status = 0;

finish:
  if (lt_dlexit() != 0) {
    fprintf (stderr, "error during finalisation: %s\n", lt_dlerror());
    status = 1;
  }

  return status;
}
_ATEOF



cat >Makefile <<'_ATEOF'
top_builddir	= .
LIBTOOL		= ./sub/ltdl/libtool
INCLUDES	= -I./sub/ltdl
MODFLAGS	= -module -avoid-version -no-undefined

LTCOMPILE = $(LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=compile \
        $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LTLINK    = $(LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=link \
        $(CC) $(CFLAGS) $(LDFLAGS)

TARGETS		= sub/ltdl/libltdlc.la module.la ltdldemo$(EXEEXT)

all: $(TARGETS)

sub/ltdl/libltdlc.la: $(LIBTOOL) sub/ltdl/Makefile
	MAKE='$(MAKE)'; test -n "$$MAKE" || MAKE=make; \
	cd sub/ltdl && $$MAKE CC="$(CC)" LIBTOOLFLAGS="$(LIBTOOLFLAGS)" \
	  CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
          CONFIGURE_OPTIONS="$(CONFIGURE_OPTIONS)"

$(LIBTOOL): sub/ltdl/Makefile

sub/ltdl/Makefile:
	cd sub/ltdl && CONFIG_SHELL="$(SHELL)" $(SHELL) ./configure $(CONFIGURE_OPTIONS)

ltdldemo$(EXEEXT): $(LIBTOOL) module.la sub/ltdl/libltdlc.la main.lo
	$(LTLINK) -o ltdldemo$(EXEEXT) main.lo -dlopen module.la ./sub/ltdl/libltdlc.la

main.lo: $(LIBTOOL) main.c
	$(LTCOMPILE) -c main.c

module.la: $(LIBTOOL) module.lo
	$(LTLINK) -o module.la module.lo $(MODFLAGS) -rpath /dev/null

module.lo: $(LIBTOOL) module.c
	$(LTCOMPILE) -c module.c
_ATEOF

cat >> Makefile <<EOF
SHELL = $SHELL
EOF



$LIBTOOLIZE --copy --ltdl=sub/ltdl


for target in all
do
  { set +x
$as_echo "$at_srcdir/subproject.at:114: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target CC=\"\$CC\" LIBTOOLFLAGS=\"\$LIBTOOLFLAGS\" CPPFLAGS=\"\$CPPFLAGS\"      CFLAGS=\"\$CFLAGS\" LDFLAGS=\"\$LDFLAGS\" SHELL=\"\$SHELL\" MAKE=\"\${MAKE-make}\"      CONFIGURE_OPTIONS=\"\$configure_options\""
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "subproject.at:114"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target CC="$CC" LIBTOOLFLAGS="$LIBTOOLFLAGS" CPPFLAGS="$CPPFLAGS"      CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" SHELL="$SHELL" MAKE="${MAKE-make}"      CONFIGURE_OPTIONS="$configure_options"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:114"
$at_failed && at_fn_log_failure
$at_traceon; }

done


lt_exe=./ltdldemo; if test -f "./ltdldemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/subproject.at:118: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "subproject.at:118"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/subproject.at:118"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_129
#AT_START_130
at_fn_group_banner 130 'nonrecursive.at:79' \
  "compiling softlinked libltdl" "                   " 15
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "130. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([subdirectory-demo], 2.4.7, bug-libtool@gnu.org)
LT_CONFIG_LTDL_DIR([ltdl])
AC_CONFIG_AUX_DIR([ltdl/config])
AC_CONFIG_MACRO_DIRS([ltdl/m4])
AC_CONFIG_LIBOBJ_DIR([ltdl])
AC_CONFIG_HEADERS([config.h:config.hin])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_PROG_CC
AM_PROG_CC_C_O
LT_INIT
LTDL_INIT([nonrecursive])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I ltdl/m4
AUTOMAKE_OPTIONS	= 1.9.6
BUILT_SOURCES		=

AM_CPPFLAGS		=
AM_LDFLAGS		=

include_HEADERS		=
noinst_LTLIBRARIES	=
lib_LTLIBRARIES		= foo.la
EXTRA_LTLIBRARIES	=

EXTRA_DIST		=

CLEANFILES		=
MOSTLYCLEANFILES	=

include ltdl/ltdl.mk

foo_la_LDFLAGS		= -module -avoid-version -no-undefined
foo_la_SOURCES		= foo.c
_ATEOF


echo 'int dummy = 0;' > foo.c


$LIBTOOLIZE --ltdl


{ set +x
$as_echo "$at_srcdir/nonrecursive.at:84: if test -f ltdl/configure.ac; then false; fi"
at_fn_check_prepare_trace "nonrecursive.at:84"
( $at_check_trace; if test -f ltdl/configure.ac; then false; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:84"
$at_failed && at_fn_log_failure
$at_traceon; }


# Support vanilla autoconf-2.59 & automake-1.9.6
for file in lt__argz.c lt__dirent.c lt__strl.c; do
  cp ltdl/$file $file
done


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I ltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/nonrecursive.at:91: \$ACLOCAL -I ltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I ltdl/m4$macro_dir" "nonrecursive.at:91"
( $at_check_trace; $ACLOCAL -I ltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:91"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/nonrecursive.at:91: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "nonrecursive.at:91"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:91"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/nonrecursive.at:91: \$AUTOMAKE --add-missing --copy"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing --copy" "nonrecursive.at:91"
( $at_check_trace; $AUTOMAKE --add-missing --copy
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:91"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/nonrecursive.at:91: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "nonrecursive.at:91"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/nonrecursive.at:91"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/nonrecursive.at:91: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "nonrecursive.at:91"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:91"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/nonrecursive.at:91: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "nonrecursive.at:91"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:91"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all $tst_dist
do
  { set +x
$as_echo "$at_srcdir/nonrecursive.at:91: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "nonrecursive.at:91"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:91"
$at_failed && at_fn_log_failure
$at_traceon; }

done



{ set +x
$as_echo "$at_srcdir/nonrecursive.at:94: test -f ltdl/libltdlc.la"
at_fn_check_prepare_trace "nonrecursive.at:94"
( $at_check_trace; test -f ltdl/libltdlc.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:94"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_130
#AT_START_131
at_fn_group_banner 131 'nonrecursive.at:103' \
  "compiling copied libltdl" "                       " 15
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "131. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([subdirectory-demo], 2.4.7, bug-libtool@gnu.org)
LT_CONFIG_LTDL_DIR([ltdl])
AC_CONFIG_AUX_DIR([ltdl/config])
AC_CONFIG_MACRO_DIRS([ltdl/m4])
AC_CONFIG_LIBOBJ_DIR([ltdl])
AC_CONFIG_HEADERS([config.h:config.hin])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_PROG_CC
AM_PROG_CC_C_O
LT_INIT
LTDL_INIT([nonrecursive])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I ltdl/m4
AUTOMAKE_OPTIONS	= 1.9.6
BUILT_SOURCES		=

AM_CPPFLAGS		=
AM_LDFLAGS		=

include_HEADERS		=
noinst_LTLIBRARIES	=
lib_LTLIBRARIES		= foo.la
EXTRA_LTLIBRARIES	=

EXTRA_DIST		=

CLEANFILES		=
MOSTLYCLEANFILES	=

include ltdl/ltdl.mk

foo_la_LDFLAGS		= -module -avoid-version -no-undefined
foo_la_SOURCES		= foo.c
_ATEOF


echo 'int dummy = 0;' > foo.c


$LIBTOOLIZE --copy --ltdl


{ set +x
$as_echo "$at_srcdir/nonrecursive.at:108: if test -f ltdl/configure.ac; then false; fi"
at_fn_check_prepare_trace "nonrecursive.at:108"
( $at_check_trace; if test -f ltdl/configure.ac; then false; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:108"
$at_failed && at_fn_log_failure
$at_traceon; }


# Support vanilla autoconf-2.59 & automake-1.9.6
for file in lt__argz.c lt__dirent.c lt__strl.c; do
  cp ltdl/$file $file
done


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I ltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/nonrecursive.at:115: \$ACLOCAL -I ltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I ltdl/m4$macro_dir" "nonrecursive.at:115"
( $at_check_trace; $ACLOCAL -I ltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:115"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/nonrecursive.at:115: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "nonrecursive.at:115"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:115"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/nonrecursive.at:115: \$AUTOMAKE --add-missing --copy"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing --copy" "nonrecursive.at:115"
( $at_check_trace; $AUTOMAKE --add-missing --copy
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:115"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/nonrecursive.at:115: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "nonrecursive.at:115"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/nonrecursive.at:115"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/nonrecursive.at:115: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "nonrecursive.at:115"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:115"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/nonrecursive.at:115: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "nonrecursive.at:115"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:115"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all $tst_dist
do
  { set +x
$as_echo "$at_srcdir/nonrecursive.at:115: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "nonrecursive.at:115"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:115"
$at_failed && at_fn_log_failure
$at_traceon; }

done



{ set +x
$as_echo "$at_srcdir/nonrecursive.at:118: test -f ltdl/libltdlc.la"
at_fn_check_prepare_trace "nonrecursive.at:118"
( $at_check_trace; test -f ltdl/libltdlc.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:118"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_131
#AT_START_132
at_fn_group_banner 132 'nonrecursive.at:127' \
  "installable libltdl" "                            " 15
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "132. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([subdirectory-demo], 2.4.7, bug-libtool@gnu.org)
LT_CONFIG_LTDL_DIR([ltdl])
AC_CONFIG_AUX_DIR([ltdl/config])
AC_CONFIG_MACRO_DIRS([ltdl/m4])
AC_CONFIG_LIBOBJ_DIR([ltdl])
AC_CONFIG_HEADERS([config.h:config.hin])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_PROG_CC
AM_PROG_CC_C_O
LT_INIT
LTDL_INIT([nonrecursive])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I ltdl/m4
AUTOMAKE_OPTIONS	= 1.9.6
BUILT_SOURCES		=

AM_CPPFLAGS		=
AM_LDFLAGS		=

include_HEADERS		=
noinst_LTLIBRARIES	=
lib_LTLIBRARIES		= foo.la
EXTRA_LTLIBRARIES	=

EXTRA_DIST		=

CLEANFILES		=
MOSTLYCLEANFILES	=

include ltdl/ltdl.mk

foo_la_LDFLAGS		= -module -avoid-version -no-undefined
foo_la_SOURCES		= foo.c
_ATEOF


echo 'int dummy = 0;' > foo.c


prefix=`pwd`/_inst

$LIBTOOLIZE --copy --ltdl


{ set +x
$as_echo "$at_srcdir/nonrecursive.at:134: if test -f ltdl/configure.ac; then false; fi"
at_fn_check_prepare_trace "nonrecursive.at:134"
( $at_check_trace; if test -f ltdl/configure.ac; then false; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:134"
$at_failed && at_fn_log_failure
$at_traceon; }


# Support vanilla autoconf-2.59 & automake-1.9.6
for file in lt__argz.c lt__dirent.c lt__strl.c; do
  cp ltdl/$file $file
done


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I ltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/nonrecursive.at:141: \$ACLOCAL -I ltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I ltdl/m4$macro_dir" "nonrecursive.at:141"
( $at_check_trace; $ACLOCAL -I ltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:141"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/nonrecursive.at:141: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "nonrecursive.at:141"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:141"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/nonrecursive.at:141: \$AUTOMAKE --add-missing --copy"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing --copy" "nonrecursive.at:141"
( $at_check_trace; $AUTOMAKE --add-missing --copy
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:141"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/nonrecursive.at:141: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "nonrecursive.at:141"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/nonrecursive.at:141"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/nonrecursive.at:141: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "nonrecursive.at:141"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:141"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/nonrecursive.at:141: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --enable-ltdl-install --prefix=\$prefix"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "nonrecursive.at:141"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --enable-ltdl-install --prefix=$prefix
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:141"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all install $tst_dist
do
  { set +x
$as_echo "$at_srcdir/nonrecursive.at:141: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "nonrecursive.at:141"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:141"
$at_failed && at_fn_log_failure
$at_traceon; }

done



{ set +x
$as_echo "$at_srcdir/nonrecursive.at:144: test -f \"\$prefix/lib/libltdl.la\""
at_fn_check_prepare_dynamic "test -f \"$prefix/lib/libltdl.la\"" "nonrecursive.at:144"
( $at_check_trace; test -f "$prefix/lib/libltdl.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:144"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/nonrecursive.at:145: test -f \"\$prefix/include/ltdl.h\""
at_fn_check_prepare_dynamic "test -f \"$prefix/include/ltdl.h\"" "nonrecursive.at:145"
( $at_check_trace; test -f "$prefix/include/ltdl.h"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/nonrecursive.at:145"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_132
#AT_START_133
at_fn_group_banner 133 'recursive.at:61' \
  "compiling softlinked libltdl" "                   " 16
at_xfail=no
      case ,$AUTORECONF,$AUTOCONF,$AUTOHEADER,$ACLOCAL,$AUTOMAKE, in *,no,*) :;; *) false;; esac && at_xfail=yes
(
  $as_echo "133. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([subdirectory-demo], 2.4.7, bug-libtool@gnu.org)
LT_CONFIG_LTDL_DIR([ltdl])
AC_CONFIG_AUX_DIR([ltdl/config])
AC_CONFIG_MACRO_DIRS([ltdl/m4])
AC_CONFIG_LIBOBJ_DIR([ltdl])
AC_CONFIG_HEADERS([config.h:config.hin])
AM_INIT_AUTOMAKE([foreign])
LT_INIT
LTDL_INIT([recursive])
AC_CONFIG_FILES([Makefile ltdl/Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I ltdl/m4
AUTOMAKE_OPTIONS = 1.7
SUBDIRS = ltdl
lib_LTLIBRARIES = foo.la
foo_la_LDFLAGS = -module -avoid-version -no-undefined
foo_la_SOURCES = foo.c
_ATEOF


echo 'int dummy = 0;' > foo.c


$LIBTOOLIZE --ltdl


{ set +x
$as_echo "$at_srcdir/recursive.at:66: if test -f ltdl/configure.ac; then false; fi"
at_fn_check_prepare_trace "recursive.at:66"
( $at_check_trace; if test -f ltdl/configure.ac; then false; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/recursive.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }


cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

{ set +x
$as_echo "$at_srcdir/recursive.at:68: \$AUTORECONF --force --verbose --install"
at_fn_check_prepare_dynamic "$AUTORECONF --force --verbose --install" "recursive.at:68"
( $at_check_trace; $AUTORECONF --force --verbose --install
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/recursive.at:68"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/recursive.at:68: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "recursive.at:68"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/recursive.at:68"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/recursive.at:69: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "recursive.at:69"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/recursive.at:69"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all $tst_dist
do
  { set +x
$as_echo "$at_srcdir/recursive.at:70: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "recursive.at:70"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/recursive.at:70"
$at_failed && at_fn_log_failure
$at_traceon; }

done


{ set +x
$as_echo "$at_srcdir/recursive.at:72: test -f ltdl/libltdlc.la"
at_fn_check_prepare_trace "recursive.at:72"
( $at_check_trace; test -f ltdl/libltdlc.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/recursive.at:72"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_133
#AT_START_134
at_fn_group_banner 134 'recursive.at:81' \
  "compiling copied libltdl" "                       " 16
at_xfail=no
      case ,$AUTORECONF,$AUTOCONF,$AUTOHEADER,$ACLOCAL,$AUTOMAKE, in *,no,*) :;; *) false;; esac && at_xfail=yes
(
  $as_echo "134. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([subdirectory-demo], 2.4.7, bug-libtool@gnu.org)
LT_CONFIG_LTDL_DIR([ltdl])
AC_CONFIG_AUX_DIR([ltdl/config])
AC_CONFIG_MACRO_DIRS([ltdl/m4])
AC_CONFIG_LIBOBJ_DIR([ltdl])
AC_CONFIG_HEADERS([config.h:config.hin])
AM_INIT_AUTOMAKE([foreign])
LT_INIT
LTDL_INIT([recursive])
AC_CONFIG_FILES([Makefile ltdl/Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I ltdl/m4
AUTOMAKE_OPTIONS = 1.7
SUBDIRS = ltdl
lib_LTLIBRARIES = foo.la
foo_la_LDFLAGS = -module -avoid-version -no-undefined
foo_la_SOURCES = foo.c
_ATEOF


echo 'int dummy = 0;' > foo.c


$LIBTOOLIZE --copy --ltdl


{ set +x
$as_echo "$at_srcdir/recursive.at:86: if test -f ltdl/configure.ac; then false; fi"
at_fn_check_prepare_trace "recursive.at:86"
( $at_check_trace; if test -f ltdl/configure.ac; then false; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/recursive.at:86"
$at_failed && at_fn_log_failure
$at_traceon; }


cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

{ set +x
$as_echo "$at_srcdir/recursive.at:88: \$AUTORECONF --force --verbose --install"
at_fn_check_prepare_dynamic "$AUTORECONF --force --verbose --install" "recursive.at:88"
( $at_check_trace; $AUTORECONF --force --verbose --install
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/recursive.at:88"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/recursive.at:88: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "recursive.at:88"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/recursive.at:88"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/recursive.at:89: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "recursive.at:89"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/recursive.at:89"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all $tst_dist
do
  { set +x
$as_echo "$at_srcdir/recursive.at:90: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "recursive.at:90"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/recursive.at:90"
$at_failed && at_fn_log_failure
$at_traceon; }

done


{ set +x
$as_echo "$at_srcdir/recursive.at:92: test -f ltdl/libltdlc.la"
at_fn_check_prepare_trace "recursive.at:92"
( $at_check_trace; test -f ltdl/libltdlc.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/recursive.at:92"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_134
#AT_START_135
at_fn_group_banner 135 'recursive.at:101' \
  "installable libltdl" "                            " 16
at_xfail=no
      case ,$AUTORECONF,$AUTOCONF,$AUTOHEADER,$ACLOCAL,$AUTOMAKE, in *,no,*) :;; *) false;; esac && at_xfail=yes
(
  $as_echo "135. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([subdirectory-demo], 2.4.7, bug-libtool@gnu.org)
LT_CONFIG_LTDL_DIR([ltdl])
AC_CONFIG_AUX_DIR([ltdl/config])
AC_CONFIG_MACRO_DIRS([ltdl/m4])
AC_CONFIG_LIBOBJ_DIR([ltdl])
AC_CONFIG_HEADERS([config.h:config.hin])
AM_INIT_AUTOMAKE([foreign])
LT_INIT
LTDL_INIT([recursive])
AC_CONFIG_FILES([Makefile ltdl/Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
ACLOCAL_AMFLAGS = -I ltdl/m4
AUTOMAKE_OPTIONS = 1.7
SUBDIRS = ltdl
lib_LTLIBRARIES = foo.la
foo_la_LDFLAGS = -module -avoid-version -no-undefined
foo_la_SOURCES = foo.c
_ATEOF


echo 'int dummy = 0;' > foo.c


prefix=`pwd`/_inst

$LIBTOOLIZE --copy --ltdl


{ set +x
$as_echo "$at_srcdir/recursive.at:108: if test -f ltdl/configure.ac; then false; fi"
at_fn_check_prepare_trace "recursive.at:108"
( $at_check_trace; if test -f ltdl/configure.ac; then false; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/recursive.at:108"
$at_failed && at_fn_log_failure
$at_traceon; }


cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

{ set +x
$as_echo "$at_srcdir/recursive.at:110: \$AUTORECONF --force --verbose --install"
at_fn_check_prepare_dynamic "$AUTORECONF --force --verbose --install" "recursive.at:110"
( $at_check_trace; $AUTORECONF --force --verbose --install
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/recursive.at:110"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/recursive.at:110: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "recursive.at:110"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/recursive.at:110"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/recursive.at:111: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --enable-ltdl-install --prefix=\$prefix"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "recursive.at:111"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --enable-ltdl-install --prefix=$prefix
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/recursive.at:111"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all install $tst_dist
do
  { set +x
$as_echo "$at_srcdir/recursive.at:112: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "recursive.at:112"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/recursive.at:112"
$at_failed && at_fn_log_failure
$at_traceon; }

done


{ set +x
$as_echo "$at_srcdir/recursive.at:114: test -f \"\$prefix/lib/libltdl.la\""
at_fn_check_prepare_dynamic "test -f \"$prefix/lib/libltdl.la\"" "recursive.at:114"
( $at_check_trace; test -f "$prefix/lib/libltdl.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/recursive.at:114"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/recursive.at:115: test -f \"\$prefix/include/ltdl.h\""
at_fn_check_prepare_dynamic "test -f \"$prefix/include/ltdl.h\"" "recursive.at:115"
( $at_check_trace; test -f "$prefix/include/ltdl.h"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/recursive.at:115"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_135
#AT_START_136
at_fn_group_banner 136 'tagdemo.at:339' \
  "static library" "                                 " 17
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "136. $at_setup_line: testing $at_desc ..."
  $at_traceon



{ set +x
$as_echo "$at_srcdir/tagdemo.at:341: { test -n \"\$CXX\" && test \"X\$CXX\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$CXX\" && test \"X$CXX\" != Xno; } || (exit 77)" "tagdemo.at:341"
( $at_check_trace; { test -n "$CXX" && test "X$CXX" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:341"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/tagdemo.at:341: test g++ != \"\$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)"
at_fn_check_prepare_dynamic "test g++ != \"$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)" "tagdemo.at:341"
( $at_check_trace; test g++ != "$CXX" || (g++ -v >/dev/null 2>&1) || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:341"
$at_failed && at_fn_log_failure
$at_traceon; }




cat >configure.ac <<'_ATEOF'
AC_INIT([tagdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_CXXCPP

# Check for namespace support and new-style headers
AC_LANG_PUSH([C++])
AC_MSG_CHECKING([whether the compiler implements namespaces])
AC_COMPILE_IFELSE(
    [AC_LANG_PROGRAM([[namespace A { namespace B { int i = 0; }}]],
		     [[using namespace A::B; return i;]])],
    [AC_MSG_RESULT([yes])
     AC_DEFINE([HAVE_NAMESPACES],[1],
	       [define if the compiler implements namespaces])],
    [AC_MSG_RESULT([no])])

AC_MSG_CHECKING([whether the compiler has ISO C++ iostream])
AC_COMPILE_IFELSE(
    [AC_LANG_PROGRAM([[#include <iostream>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif ]], [[cout << "bingo\n"; return 0;]])],
    [AC_MSG_RESULT([yes])
     AC_DEFINE([HAVE_IOSTREAM],[1],
	       [define if the compiler has ISO C++ iostream])],
    [AC_MSG_RESULT([no])])
AC_LANG_POP([C++])

AC_LANG([C++])
LT_INIT

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

noinst_LTLIBRARIES = libconv.la
lib_LTLIBRARIES = libfoo.la libbaz.la

libfoo_la_SOURCES = foo.cpp
libfoo_la_LDFLAGS = -no-undefined
libfoo_la_LIBADD = libconv.la $(LIBM)

# Test some of the ILD support when using tagged configurations.
libbaz_la_SOURCES = baz.cpp
libbaz_la_LDFLAGS = -no-undefined
libbaz_la_LIBADD = libfoo.la

# Test convenience libraries.
libconv_la_SOURCES = conv.cpp
libconv_la_LDFLAGS = -no-undefined

noinst_HEADERS = foo.h baz.h conv.h

bin_PROGRAMS = tagdemo

tagdemo_SOURCES = main.cpp
tagdemo_LDADD = libbaz.la libfoo.la

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck
_ATEOF


cat >main.cpp <<'_ATEOF'
#include <config.h>
#if HAVE_IOSTREAM
# include <iostream>
#else
# include <iostream.h>
#endif

#include "foo.h"
#include "baz.h"
#include "conv.h"

#if HAVE_NAMESPACES
namespace std { }
using namespace std;
#endif

int main (int, char *[])
{
  cout << "Welcome to GNU libtool tagdemo C++!" << endl;

  foobar_derived FB;
  // Instantiate the derived class.

  foobar *fb = &FB;
  // Have some fun with polymorphism.

  int value = fb->hello();

  cout << "foobar::hello returned: " << value << endl;
  if (value = HELLO_RET)
    cout << "foobar::hello is ok!" << endl;

  if (fb->foo() == FOO_RET)
    cout << "foobar::foo is ok!" << endl;

  // --------------

  barbaz_derived BB;
  // Instantiate the derived class.

  barbaz *bb = &BB;
  // Have some fun with polymorphism.

  // barbaz_derived::baz() should return FOO_RET since it calls
  // foobar_derived::foo(), which in turn calls ::foo().
  if (bb->baz() == FOO_RET)
    cout << "barbaz::baz is ok!" << endl;

  // --------------

  if (convenience())
    cout << "convenience is ok!" << endl;

  return 0;
}
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H
// Silly constants that the functions return.
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

// Our C test functions.
extern "C"
{
  int foo(void);
  int hello(void);
}

// Our test C++ base class.
class foobar
{
public:
  virtual int foo(void) = 0;
  virtual int hello(void) = 0;
  // Some dummy pure virtual functions.
};


// Our test C++ derived class.
class foobar_derived : public foobar
{
public:
  virtual int foo(void);
  virtual int hello(void);
  // Override the base class' pure virtual functions.
};

#endif
_ATEOF


cat >foo.cpp <<'_ATEOF'
#include <config.h>
#ifdef HAVE_IOSTREAM
# include <iostream>
#else
# include <iostream.h>
#endif

#ifdef HAVE_NAMESPACES
namespace std { }
using namespace std;
#endif

#include <math.h>

#include "foo.h"

// Our C functions.
int
foo(void)
{
  cout << "cos (0.0) = " << (double) cos ((double) 0.0) << endl;
  return FOO_RET;
}

int
hello(void)
{
  cout << "** This is libfoo (tagdemo) **" << endl;
  return HELLO_RET;
}


// --------------------------------------------------------------------
// Our C++ derived class methods.


int
foobar_derived::foo(void)
{
  return ::foo();
}

int
foobar_derived::hello(void)
{
  return ::hello();
}
_ATEOF


cat >baz.h <<'_ATEOF'
#ifndef BAZ_H
#define BAZ_H 1

// Our test C++ base class.
class barbaz
{
public:
  virtual int baz(void) = 0;
  // Some dummy pure virtual functions.
};

// Our test C++ derived class.
class barbaz_derived : public barbaz
{
public:
  virtual int baz(void);
  // Override the base class' pure virtual functions.
};

#endif
_ATEOF


cat >baz.cpp <<'_ATEOF'
#include <config.h>

#include "foo.h"
#include "baz.h"

// --------------------------------------------------------------------
// Our C++ derived class methods.


int
barbaz_derived::baz(void)
{
  foobar_derived FB;

  return FB.foo();
}
_ATEOF


cat >conv.h <<'_ATEOF'
#ifndef CONV_H
#define CONV_H

// Our C test functions.
extern "C"
{
  int convenience(void);
}

#endif
_ATEOF


cat >conv.cpp <<'_ATEOF'
#include <config.h>

#include "conv.h"

//Our C function.
int convenience (void) { return 1; }
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU libtool tagdemo C++!
** This is libfoo (tagdemo) **
foobar::hello returned: 57616
foobar::hello is ok!
cos (0.0) = 1
foobar::foo is ok!
cos (0.0) = 1
barbaz::baz is ok!
convenience is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/tagdemo.at:343: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "tagdemo.at:343"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:343"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/tagdemo.at:343: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "tagdemo.at:343"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:343"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/tagdemo.at:343: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "tagdemo.at:343"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:343"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/tagdemo.at:343: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "tagdemo.at:343"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/tagdemo.at:343"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/tagdemo.at:343: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "tagdemo.at:343"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:343"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/tagdemo.at:343: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-shared"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "tagdemo.at:343"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-shared
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:343"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/tagdemo.at:343: \$EGREP '^build_old_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=yes' libtool" "tagdemo.at:343"
( $at_check_trace; $EGREP '^build_old_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:343"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/tagdemo.at:343: \$EGREP '^build_libtool_libs=no' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=no' libtool" "tagdemo.at:343"
( $at_check_trace; $EGREP '^build_libtool_libs=no' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:343"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/tagdemo.at:345: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "tagdemo.at:345"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:345"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./tagdemo; if test -f "./tagdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/tagdemo.at:345: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "tagdemo.at:345"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:345"
$at_failed && at_fn_log_failure
$at_traceon; }






  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_136
#AT_START_137
at_fn_group_banner 137 'tagdemo.at:354' \
  "shared library" "                                 " 17
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "137. $at_setup_line: testing $at_desc ..."
  $at_traceon



{ set +x
$as_echo "$at_srcdir/tagdemo.at:356: { test -n \"\$CXX\" && test \"X\$CXX\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$CXX\" && test \"X$CXX\" != Xno; } || (exit 77)" "tagdemo.at:356"
( $at_check_trace; { test -n "$CXX" && test "X$CXX" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:356"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/tagdemo.at:356: test g++ != \"\$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)"
at_fn_check_prepare_dynamic "test g++ != \"$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)" "tagdemo.at:356"
( $at_check_trace; test g++ != "$CXX" || (g++ -v >/dev/null 2>&1) || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:356"
$at_failed && at_fn_log_failure
$at_traceon; }




cat >configure.ac <<'_ATEOF'
AC_INIT([tagdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_CXXCPP

# Check for namespace support and new-style headers
AC_LANG_PUSH([C++])
AC_MSG_CHECKING([whether the compiler implements namespaces])
AC_COMPILE_IFELSE(
    [AC_LANG_PROGRAM([[namespace A { namespace B { int i = 0; }}]],
		     [[using namespace A::B; return i;]])],
    [AC_MSG_RESULT([yes])
     AC_DEFINE([HAVE_NAMESPACES],[1],
	       [define if the compiler implements namespaces])],
    [AC_MSG_RESULT([no])])

AC_MSG_CHECKING([whether the compiler has ISO C++ iostream])
AC_COMPILE_IFELSE(
    [AC_LANG_PROGRAM([[#include <iostream>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif ]], [[cout << "bingo\n"; return 0;]])],
    [AC_MSG_RESULT([yes])
     AC_DEFINE([HAVE_IOSTREAM],[1],
	       [define if the compiler has ISO C++ iostream])],
    [AC_MSG_RESULT([no])])
AC_LANG_POP([C++])

AC_LANG([C++])
LT_INIT

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

noinst_LTLIBRARIES = libconv.la
lib_LTLIBRARIES = libfoo.la libbaz.la

libfoo_la_SOURCES = foo.cpp
libfoo_la_LDFLAGS = -no-undefined
libfoo_la_LIBADD = libconv.la $(LIBM)

# Test some of the ILD support when using tagged configurations.
libbaz_la_SOURCES = baz.cpp
libbaz_la_LDFLAGS = -no-undefined
libbaz_la_LIBADD = libfoo.la

# Test convenience libraries.
libconv_la_SOURCES = conv.cpp
libconv_la_LDFLAGS = -no-undefined

noinst_HEADERS = foo.h baz.h conv.h

bin_PROGRAMS = tagdemo

tagdemo_SOURCES = main.cpp
tagdemo_LDADD = libbaz.la libfoo.la

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck
_ATEOF


cat >main.cpp <<'_ATEOF'
#include <config.h>
#if HAVE_IOSTREAM
# include <iostream>
#else
# include <iostream.h>
#endif

#include "foo.h"
#include "baz.h"
#include "conv.h"

#if HAVE_NAMESPACES
namespace std { }
using namespace std;
#endif

int main (int, char *[])
{
  cout << "Welcome to GNU libtool tagdemo C++!" << endl;

  foobar_derived FB;
  // Instantiate the derived class.

  foobar *fb = &FB;
  // Have some fun with polymorphism.

  int value = fb->hello();

  cout << "foobar::hello returned: " << value << endl;
  if (value = HELLO_RET)
    cout << "foobar::hello is ok!" << endl;

  if (fb->foo() == FOO_RET)
    cout << "foobar::foo is ok!" << endl;

  // --------------

  barbaz_derived BB;
  // Instantiate the derived class.

  barbaz *bb = &BB;
  // Have some fun with polymorphism.

  // barbaz_derived::baz() should return FOO_RET since it calls
  // foobar_derived::foo(), which in turn calls ::foo().
  if (bb->baz() == FOO_RET)
    cout << "barbaz::baz is ok!" << endl;

  // --------------

  if (convenience())
    cout << "convenience is ok!" << endl;

  return 0;
}
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H
// Silly constants that the functions return.
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

// Our C test functions.
extern "C"
{
  int foo(void);
  int hello(void);
}

// Our test C++ base class.
class foobar
{
public:
  virtual int foo(void) = 0;
  virtual int hello(void) = 0;
  // Some dummy pure virtual functions.
};


// Our test C++ derived class.
class foobar_derived : public foobar
{
public:
  virtual int foo(void);
  virtual int hello(void);
  // Override the base class' pure virtual functions.
};

#endif
_ATEOF


cat >foo.cpp <<'_ATEOF'
#include <config.h>
#ifdef HAVE_IOSTREAM
# include <iostream>
#else
# include <iostream.h>
#endif

#ifdef HAVE_NAMESPACES
namespace std { }
using namespace std;
#endif

#include <math.h>

#include "foo.h"

// Our C functions.
int
foo(void)
{
  cout << "cos (0.0) = " << (double) cos ((double) 0.0) << endl;
  return FOO_RET;
}

int
hello(void)
{
  cout << "** This is libfoo (tagdemo) **" << endl;
  return HELLO_RET;
}


// --------------------------------------------------------------------
// Our C++ derived class methods.


int
foobar_derived::foo(void)
{
  return ::foo();
}

int
foobar_derived::hello(void)
{
  return ::hello();
}
_ATEOF


cat >baz.h <<'_ATEOF'
#ifndef BAZ_H
#define BAZ_H 1

// Our test C++ base class.
class barbaz
{
public:
  virtual int baz(void) = 0;
  // Some dummy pure virtual functions.
};

// Our test C++ derived class.
class barbaz_derived : public barbaz
{
public:
  virtual int baz(void);
  // Override the base class' pure virtual functions.
};

#endif
_ATEOF


cat >baz.cpp <<'_ATEOF'
#include <config.h>

#include "foo.h"
#include "baz.h"

// --------------------------------------------------------------------
// Our C++ derived class methods.


int
barbaz_derived::baz(void)
{
  foobar_derived FB;

  return FB.foo();
}
_ATEOF


cat >conv.h <<'_ATEOF'
#ifndef CONV_H
#define CONV_H

// Our C test functions.
extern "C"
{
  int convenience(void);
}

#endif
_ATEOF


cat >conv.cpp <<'_ATEOF'
#include <config.h>

#include "conv.h"

//Our C function.
int convenience (void) { return 1; }
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU libtool tagdemo C++!
** This is libfoo (tagdemo) **
foobar::hello returned: 57616
foobar::hello is ok!
cos (0.0) = 1
foobar::foo is ok!
cos (0.0) = 1
barbaz::baz is ok!
convenience is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/tagdemo.at:358: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "tagdemo.at:358"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:358"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/tagdemo.at:358: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "tagdemo.at:358"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:358"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/tagdemo.at:358: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "tagdemo.at:358"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:358"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/tagdemo.at:358: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "tagdemo.at:358"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/tagdemo.at:358"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/tagdemo.at:358: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "tagdemo.at:358"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:358"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/tagdemo.at:358: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-static"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "tagdemo.at:358"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-static
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:358"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/tagdemo.at:358: \$EGREP '^build_old_libs=no' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=no' libtool" "tagdemo.at:358"
( $at_check_trace; $EGREP '^build_old_libs=no' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:358"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/tagdemo.at:358: \$EGREP '^build_libtool_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=yes' libtool" "tagdemo.at:358"
( $at_check_trace; $EGREP '^build_libtool_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:358"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/tagdemo.at:360: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "tagdemo.at:360"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:360"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./tagdemo; if test -f "./tagdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/tagdemo.at:360: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "tagdemo.at:360"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:360"
$at_failed && at_fn_log_failure
$at_traceon; }






  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_137
#AT_START_138
at_fn_group_banner 138 'tagdemo.at:369' \
  "shared and static together" "                     " 17
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "138. $at_setup_line: testing $at_desc ..."
  $at_traceon



{ set +x
$as_echo "$at_srcdir/tagdemo.at:371: { test -n \"\$CXX\" && test \"X\$CXX\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$CXX\" && test \"X$CXX\" != Xno; } || (exit 77)" "tagdemo.at:371"
( $at_check_trace; { test -n "$CXX" && test "X$CXX" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:371"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/tagdemo.at:371: test g++ != \"\$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)"
at_fn_check_prepare_dynamic "test g++ != \"$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)" "tagdemo.at:371"
( $at_check_trace; test g++ != "$CXX" || (g++ -v >/dev/null 2>&1) || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:371"
$at_failed && at_fn_log_failure
$at_traceon; }




cat >configure.ac <<'_ATEOF'
AC_INIT([tagdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_CXXCPP

# Check for namespace support and new-style headers
AC_LANG_PUSH([C++])
AC_MSG_CHECKING([whether the compiler implements namespaces])
AC_COMPILE_IFELSE(
    [AC_LANG_PROGRAM([[namespace A { namespace B { int i = 0; }}]],
		     [[using namespace A::B; return i;]])],
    [AC_MSG_RESULT([yes])
     AC_DEFINE([HAVE_NAMESPACES],[1],
	       [define if the compiler implements namespaces])],
    [AC_MSG_RESULT([no])])

AC_MSG_CHECKING([whether the compiler has ISO C++ iostream])
AC_COMPILE_IFELSE(
    [AC_LANG_PROGRAM([[#include <iostream>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif ]], [[cout << "bingo\n"; return 0;]])],
    [AC_MSG_RESULT([yes])
     AC_DEFINE([HAVE_IOSTREAM],[1],
	       [define if the compiler has ISO C++ iostream])],
    [AC_MSG_RESULT([no])])
AC_LANG_POP([C++])

AC_LANG([C++])
LT_INIT

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

noinst_LTLIBRARIES = libconv.la
lib_LTLIBRARIES = libfoo.la libbaz.la

libfoo_la_SOURCES = foo.cpp
libfoo_la_LDFLAGS = -no-undefined
libfoo_la_LIBADD = libconv.la $(LIBM)

# Test some of the ILD support when using tagged configurations.
libbaz_la_SOURCES = baz.cpp
libbaz_la_LDFLAGS = -no-undefined
libbaz_la_LIBADD = libfoo.la

# Test convenience libraries.
libconv_la_SOURCES = conv.cpp
libconv_la_LDFLAGS = -no-undefined

noinst_HEADERS = foo.h baz.h conv.h

bin_PROGRAMS = tagdemo

tagdemo_SOURCES = main.cpp
tagdemo_LDADD = libbaz.la libfoo.la

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck
_ATEOF


cat >main.cpp <<'_ATEOF'
#include <config.h>
#if HAVE_IOSTREAM
# include <iostream>
#else
# include <iostream.h>
#endif

#include "foo.h"
#include "baz.h"
#include "conv.h"

#if HAVE_NAMESPACES
namespace std { }
using namespace std;
#endif

int main (int, char *[])
{
  cout << "Welcome to GNU libtool tagdemo C++!" << endl;

  foobar_derived FB;
  // Instantiate the derived class.

  foobar *fb = &FB;
  // Have some fun with polymorphism.

  int value = fb->hello();

  cout << "foobar::hello returned: " << value << endl;
  if (value = HELLO_RET)
    cout << "foobar::hello is ok!" << endl;

  if (fb->foo() == FOO_RET)
    cout << "foobar::foo is ok!" << endl;

  // --------------

  barbaz_derived BB;
  // Instantiate the derived class.

  barbaz *bb = &BB;
  // Have some fun with polymorphism.

  // barbaz_derived::baz() should return FOO_RET since it calls
  // foobar_derived::foo(), which in turn calls ::foo().
  if (bb->baz() == FOO_RET)
    cout << "barbaz::baz is ok!" << endl;

  // --------------

  if (convenience())
    cout << "convenience is ok!" << endl;

  return 0;
}
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H
// Silly constants that the functions return.
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

// Our C test functions.
extern "C"
{
  int foo(void);
  int hello(void);
}

// Our test C++ base class.
class foobar
{
public:
  virtual int foo(void) = 0;
  virtual int hello(void) = 0;
  // Some dummy pure virtual functions.
};


// Our test C++ derived class.
class foobar_derived : public foobar
{
public:
  virtual int foo(void);
  virtual int hello(void);
  // Override the base class' pure virtual functions.
};

#endif
_ATEOF


cat >foo.cpp <<'_ATEOF'
#include <config.h>
#ifdef HAVE_IOSTREAM
# include <iostream>
#else
# include <iostream.h>
#endif

#ifdef HAVE_NAMESPACES
namespace std { }
using namespace std;
#endif

#include <math.h>

#include "foo.h"

// Our C functions.
int
foo(void)
{
  cout << "cos (0.0) = " << (double) cos ((double) 0.0) << endl;
  return FOO_RET;
}

int
hello(void)
{
  cout << "** This is libfoo (tagdemo) **" << endl;
  return HELLO_RET;
}


// --------------------------------------------------------------------
// Our C++ derived class methods.


int
foobar_derived::foo(void)
{
  return ::foo();
}

int
foobar_derived::hello(void)
{
  return ::hello();
}
_ATEOF


cat >baz.h <<'_ATEOF'
#ifndef BAZ_H
#define BAZ_H 1

// Our test C++ base class.
class barbaz
{
public:
  virtual int baz(void) = 0;
  // Some dummy pure virtual functions.
};

// Our test C++ derived class.
class barbaz_derived : public barbaz
{
public:
  virtual int baz(void);
  // Override the base class' pure virtual functions.
};

#endif
_ATEOF


cat >baz.cpp <<'_ATEOF'
#include <config.h>

#include "foo.h"
#include "baz.h"

// --------------------------------------------------------------------
// Our C++ derived class methods.


int
barbaz_derived::baz(void)
{
  foobar_derived FB;

  return FB.foo();
}
_ATEOF


cat >conv.h <<'_ATEOF'
#ifndef CONV_H
#define CONV_H

// Our C test functions.
extern "C"
{
  int convenience(void);
}

#endif
_ATEOF


cat >conv.cpp <<'_ATEOF'
#include <config.h>

#include "conv.h"

//Our C function.
int convenience (void) { return 1; }
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU libtool tagdemo C++!
** This is libfoo (tagdemo) **
foobar::hello returned: 57616
foobar::hello is ok!
cos (0.0) = 1
foobar::foo is ok!
cos (0.0) = 1
barbaz::baz is ok!
convenience is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/tagdemo.at:373: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "tagdemo.at:373"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:373"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/tagdemo.at:373: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "tagdemo.at:373"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:373"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/tagdemo.at:373: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "tagdemo.at:373"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:373"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/tagdemo.at:373: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "tagdemo.at:373"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/tagdemo.at:373"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/tagdemo.at:373: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "tagdemo.at:373"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:373"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/tagdemo.at:373: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "tagdemo.at:373"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:373"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/tagdemo.at:373: \$EGREP '^build_old_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=yes' libtool" "tagdemo.at:373"
( $at_check_trace; $EGREP '^build_old_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:373"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/tagdemo.at:373: \$EGREP '^build_libtool_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=yes' libtool" "tagdemo.at:373"
( $at_check_trace; $EGREP '^build_libtool_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:373"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/tagdemo.at:375: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "tagdemo.at:375"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:375"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./tagdemo; if test -f "./tagdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/tagdemo.at:375: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "tagdemo.at:375"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:375"
$at_failed && at_fn_log_failure
$at_traceon; }






  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_138
#AT_START_139
at_fn_group_banner 139 'tagdemo.at:384' \
  "allow_undefined_flag" "                           " 17
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "139. $at_setup_line: testing $at_desc ..."
  $at_traceon



{ set +x
$as_echo "$at_srcdir/tagdemo.at:386: { test -n \"\$CXX\" && test \"X\$CXX\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$CXX\" && test \"X$CXX\" != Xno; } || (exit 77)" "tagdemo.at:386"
( $at_check_trace; { test -n "$CXX" && test "X$CXX" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:386"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/tagdemo.at:386: test g++ != \"\$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)"
at_fn_check_prepare_dynamic "test g++ != \"$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)" "tagdemo.at:386"
( $at_check_trace; test g++ != "$CXX" || (g++ -v >/dev/null 2>&1) || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:386"
$at_failed && at_fn_log_failure
$at_traceon; }




cat >configure.ac <<'_ATEOF'
AC_INIT([tagdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_CXXCPP

# Check for namespace support and new-style headers
AC_LANG_PUSH([C++])
AC_MSG_CHECKING([whether the compiler implements namespaces])
AC_COMPILE_IFELSE(
    [AC_LANG_PROGRAM([[namespace A { namespace B { int i = 0; }}]],
		     [[using namespace A::B; return i;]])],
    [AC_MSG_RESULT([yes])
     AC_DEFINE([HAVE_NAMESPACES],[1],
	       [define if the compiler implements namespaces])],
    [AC_MSG_RESULT([no])])

AC_MSG_CHECKING([whether the compiler has ISO C++ iostream])
AC_COMPILE_IFELSE(
    [AC_LANG_PROGRAM([[#include <iostream>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif ]], [[cout << "bingo\n"; return 0;]])],
    [AC_MSG_RESULT([yes])
     AC_DEFINE([HAVE_IOSTREAM],[1],
	       [define if the compiler has ISO C++ iostream])],
    [AC_MSG_RESULT([no])])
AC_LANG_POP([C++])

AC_LANG([C++])
LT_INIT

LT_LIB_M
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

noinst_LTLIBRARIES = libconv.la
lib_LTLIBRARIES = libfoo.la libbaz.la

libfoo_la_SOURCES = foo.cpp
libfoo_la_LDFLAGS = -no-undefined
libfoo_la_LIBADD = libconv.la $(LIBM)

# Test some of the ILD support when using tagged configurations.
libbaz_la_SOURCES = baz.cpp
libbaz_la_LDFLAGS = -no-undefined
libbaz_la_LIBADD = libfoo.la

# Test convenience libraries.
libconv_la_SOURCES = conv.cpp
libconv_la_LDFLAGS = -no-undefined

noinst_HEADERS = foo.h baz.h conv.h

bin_PROGRAMS = tagdemo

tagdemo_SOURCES = main.cpp
tagdemo_LDADD = libbaz.la libfoo.la

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck
_ATEOF


cat >main.cpp <<'_ATEOF'
#include <config.h>
#if HAVE_IOSTREAM
# include <iostream>
#else
# include <iostream.h>
#endif

#include "foo.h"
#include "baz.h"
#include "conv.h"

#if HAVE_NAMESPACES
namespace std { }
using namespace std;
#endif

int main (int, char *[])
{
  cout << "Welcome to GNU libtool tagdemo C++!" << endl;

  foobar_derived FB;
  // Instantiate the derived class.

  foobar *fb = &FB;
  // Have some fun with polymorphism.

  int value = fb->hello();

  cout << "foobar::hello returned: " << value << endl;
  if (value = HELLO_RET)
    cout << "foobar::hello is ok!" << endl;

  if (fb->foo() == FOO_RET)
    cout << "foobar::foo is ok!" << endl;

  // --------------

  barbaz_derived BB;
  // Instantiate the derived class.

  barbaz *bb = &BB;
  // Have some fun with polymorphism.

  // barbaz_derived::baz() should return FOO_RET since it calls
  // foobar_derived::foo(), which in turn calls ::foo().
  if (bb->baz() == FOO_RET)
    cout << "barbaz::baz is ok!" << endl;

  // --------------

  if (convenience())
    cout << "convenience is ok!" << endl;

  return 0;
}
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef FOO_H
#define FOO_H
// Silly constants that the functions return.
#define HELLO_RET 0xe110
#define FOO_RET 0xf00

// Our C test functions.
extern "C"
{
  int foo(void);
  int hello(void);
}

// Our test C++ base class.
class foobar
{
public:
  virtual int foo(void) = 0;
  virtual int hello(void) = 0;
  // Some dummy pure virtual functions.
};


// Our test C++ derived class.
class foobar_derived : public foobar
{
public:
  virtual int foo(void);
  virtual int hello(void);
  // Override the base class' pure virtual functions.
};

#endif
_ATEOF


cat >foo.cpp <<'_ATEOF'
#include <config.h>
#ifdef HAVE_IOSTREAM
# include <iostream>
#else
# include <iostream.h>
#endif

#ifdef HAVE_NAMESPACES
namespace std { }
using namespace std;
#endif

#include <math.h>

#include "foo.h"

// Our C functions.
int
foo(void)
{
  cout << "cos (0.0) = " << (double) cos ((double) 0.0) << endl;
  return FOO_RET;
}

int
hello(void)
{
  cout << "** This is libfoo (tagdemo) **" << endl;
  return HELLO_RET;
}


// --------------------------------------------------------------------
// Our C++ derived class methods.


int
foobar_derived::foo(void)
{
  return ::foo();
}

int
foobar_derived::hello(void)
{
  return ::hello();
}
_ATEOF


cat >baz.h <<'_ATEOF'
#ifndef BAZ_H
#define BAZ_H 1

// Our test C++ base class.
class barbaz
{
public:
  virtual int baz(void) = 0;
  // Some dummy pure virtual functions.
};

// Our test C++ derived class.
class barbaz_derived : public barbaz
{
public:
  virtual int baz(void);
  // Override the base class' pure virtual functions.
};

#endif
_ATEOF


cat >baz.cpp <<'_ATEOF'
#include <config.h>

#include "foo.h"
#include "baz.h"

// --------------------------------------------------------------------
// Our C++ derived class methods.


int
barbaz_derived::baz(void)
{
  foobar_derived FB;

  return FB.foo();
}
_ATEOF


cat >conv.h <<'_ATEOF'
#ifndef CONV_H
#define CONV_H

// Our C test functions.
extern "C"
{
  int convenience(void);
}

#endif
_ATEOF


cat >conv.cpp <<'_ATEOF'
#include <config.h>

#include "conv.h"

//Our C function.
int convenience (void) { return 1; }
_ATEOF


cat >expout <<'_ATEOF'
Welcome to GNU libtool tagdemo C++!
** This is libfoo (tagdemo) **
foobar::hello returned: 57616
foobar::hello is ok!
cos (0.0) = 1
foobar::foo is ok!
cos (0.0) = 1
barbaz::baz is ok!
convenience is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac

prefix=`pwd`/_inst


$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/tagdemo.at:388: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "tagdemo.at:388"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:388"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/tagdemo.at:388: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "tagdemo.at:388"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:388"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/tagdemo.at:388: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "tagdemo.at:388"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:388"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/tagdemo.at:388: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "tagdemo.at:388"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/tagdemo.at:388"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/tagdemo.at:388: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "tagdemo.at:388"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:388"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/tagdemo.at:388: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-static"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "tagdemo.at:388"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-static
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:388"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/tagdemo.at:390: \$GREP \"^allow_undefined_flag=.\\{0,1\\}unsupported.\\{0,1\\}\$\" libtool && (exit 77)"
at_fn_check_prepare_dynamic "$GREP \"^allow_undefined_flag=.\\{0,1\\}unsupported.\\{0,1\\}$\" libtool && (exit 77)" "tagdemo.at:390"
( $at_check_trace; $GREP "^allow_undefined_flag=.\{0,1\}unsupported.\{0,1\}$" libtool && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/tagdemo.at:390"
$at_failed && at_fn_log_failure
$at_traceon; }

$SED 's|allow_undefined=no|allow_undefined=yes|g' libtool > ltnew && mv -f ltnew libtool
for target in all
do
  { set +x
$as_echo "$at_srcdir/tagdemo.at:393: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "tagdemo.at:393"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:393"
$at_failed && at_fn_log_failure
$at_traceon; }

done

lt_exe=./tagdemo; if test -f "./tagdemo$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/tagdemo.at:393: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "tagdemo.at:393"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/tagdemo.at:393"
$at_failed && at_fn_log_failure
$at_traceon; }







  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_139
#AT_START_140
at_fn_group_banner 140 'template.at:28' \
  "simple template test" "                           " 18
at_xfail=no
(
  $as_echo "140. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/template.at:29: { test -n \"\$CXX\" && test \"X\$CXX\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$CXX\" && test \"X$CXX\" != Xno; } || (exit 77)" "template.at:29"
( $at_check_trace; { test -n "$CXX" && test "X$CXX" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/template.at:29"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/template.at:29: test g++ != \"\$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)"
at_fn_check_prepare_dynamic "test g++ != \"$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)" "template.at:29"
( $at_check_trace; test g++ != "$CXX" || (g++ -v >/dev/null 2>&1) || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/template.at:29"
$at_failed && at_fn_log_failure
$at_traceon; }




cat >aclib.h <<'_ATEOF'
int cf(int);
_ATEOF


cat >aclib.cpp <<'_ATEOF'
#include "aclib.h"
template<typename T>

T cq(T b)
{
  return b * 3;
}

int cf(int i)
{
  return cq(i);
}
_ATEOF


cat >alib.h <<'_ATEOF'
int f(int);
_ATEOF


cat >alib.cpp <<'_ATEOF'
#include "alib.h"

template<typename T>
T q(T b)
{
  return b * 2;
}

int f(int i)
{
  return q(i);
}
_ATEOF


cat >prog.cpp <<'_ATEOF'
#include "alib.h"
#include "aclib.h"

int main()
{
  return f(3) + 3 - cf(3) != 0;
}
_ATEOF


{ set +x
$as_echo "$at_srcdir/template.at:80: \$LIBTOOL --tag=CXX --mode=compile \$CXX -I. \$CPPFLAGS \$CXXFLAGS -c -o alib.lo alib.cpp"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=compile $CXX -I. $CPPFLAGS $CXXFLAGS -c -o alib.lo alib.cpp" "template.at:80"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=compile $CXX -I. $CPPFLAGS $CXXFLAGS -c -o alib.lo alib.cpp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:80"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/template.at:82: \$LIBTOOL --tag=CXX --mode=compile \$CXX -I. \$CPPFLAGS \$CXXFLAGS -c -o aclib.lo aclib.cpp"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=compile $CXX -I. $CPPFLAGS $CXXFLAGS -c -o aclib.lo aclib.cpp" "template.at:82"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=compile $CXX -I. $CPPFLAGS $CXXFLAGS -c -o aclib.lo aclib.cpp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:82"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/template.at:84: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o libaclib.la aclib.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o libaclib.la aclib.lo" "template.at:84"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o libaclib.la aclib.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:84"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/template.at:86: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o libalib.la -rpath /nonexistent alib.lo libaclib.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o libalib.la -rpath /nonexistent alib.lo libaclib.la" "template.at:86"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o libalib.la -rpath /nonexistent alib.lo libaclib.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:86"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/template.at:88: \$CXX -I. \$CPPFLAGS \$CXXFLAGS -c prog.cpp"
at_fn_check_prepare_dynamic "$CXX -I. $CPPFLAGS $CXXFLAGS -c prog.cpp" "template.at:88"
( $at_check_trace; $CXX -I. $CPPFLAGS $CXXFLAGS -c prog.cpp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:88"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/template.at:90: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o prog\$EXEEXT prog.\$OBJEXT libalib.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o prog$EXEEXT prog.$OBJEXT libalib.la" "template.at:90"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o prog$EXEEXT prog.$OBJEXT libalib.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:90"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./prog; if test -f "./prog$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/template.at:93: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "template.at:93"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:93"
$at_failed && at_fn_log_failure
$at_traceon; }







  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_140
#AT_START_141
at_fn_group_banner 141 'template.at:127' \
  "template test with subdirs" "                     " 18
at_xfail=no
(
  $as_echo "141. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/template.at:128: { test -n \"\$CXX\" && test \"X\$CXX\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$CXX\" && test \"X$CXX\" != Xno; } || (exit 77)" "template.at:128"
( $at_check_trace; { test -n "$CXX" && test "X$CXX" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/template.at:128"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/template.at:128: test g++ != \"\$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)"
at_fn_check_prepare_dynamic "test g++ != \"$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)" "template.at:128"
( $at_check_trace; test g++ != "$CXX" || (g++ -v >/dev/null 2>&1) || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/template.at:128"
$at_failed && at_fn_log_failure
$at_traceon; }




noskip=:
withundef=:
# Mac OS X.
# The linker has issues with this test.
case $host in
*-darwin*) noskip=false ;;
*-aix*) withundef=false ;;
esac


CPPFLAGS="$CPPFLAGS -I../src/lib -I../src/lib2"

mkdir src obj
( cd src; mkdir lib lib2 sub )
( cd obj; mkdir lib lib2 sub )

cat >src/lib/a.hh <<'_ATEOF'
template <class T>
unsigned int a(const T&);

template <class T>
unsigned int a(const T& t)
{
  return sizeof t;
}

extern int a2(char t);

inline int a3(const double* t)
{
  return a(t);
}
_ATEOF


cat >src/lib/a.cpp <<'_ATEOF'
#include "a.hh"

int a2(char t)
{
  return a(t);
}
_ATEOF


cat >src/lib2/b.hh <<'_ATEOF'
#include "a.hh"

template <class T>
unsigned int b(T& t)
{
  return a(t);
}
extern int b2(char* t);
struct bs { int bi; };
extern int b3(bs t);
_ATEOF


cat >src/lib2/b.cpp <<'_ATEOF'
#include "b.hh"

int b2(char* t)
{
  return a2(t[0]);
}

int b3(bs t)
{
  return b(t);
}
_ATEOF


cat >src/sub/main.cpp <<'_ATEOF'
#include "b.hh"

int main()
{
  double foo;
  const char s = ' ';
  char d;
  char *t = &d;
  return b(foo) + a3(&foo) + b2(t) - a(s)
         - (sizeof(double) + sizeof(double*));
}
_ATEOF


cd obj

# If the compiler supports -c -o, we want to use it:
# it may make a difference for templates
eval `$LIBTOOL --tag=CXX --config | $GREP ^compiler_c_o=`
case $compiler_c_o in
yes)
  main_o=sub/main.$OBJEXT
  { set +x
$as_echo "$at_srcdir/template.at:223: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o \$main_o ../src/sub/main.cpp"
at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o $main_o ../src/sub/main.cpp" "template.at:223"
( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o $main_o ../src/sub/main.cpp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:223"
$at_failed && at_fn_log_failure
$at_traceon; }

  ;;
*)
  main_o=main.$OBJEXT
  { set +x
$as_echo "$at_srcdir/template.at:228: \$CXX \$CPPFLAGS \$CXXFLAGS -c ../src/sub/main.cpp"
at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c ../src/sub/main.cpp" "template.at:228"
( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c ../src/sub/main.cpp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:228"
$at_failed && at_fn_log_failure
$at_traceon; }

  ;;
esac

{ set +x
$as_echo "$at_srcdir/template.at:233: \$LIBTOOL --tag=CXX --mode=compile \$CXX \$CPPFLAGS \$CXXFLAGS -c -o lib/a.lo ../src/lib/a.cpp"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS -c -o lib/a.lo ../src/lib/a.cpp" "template.at:233"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS -c -o lib/a.lo ../src/lib/a.cpp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:233"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/template.at:235: \$LIBTOOL --tag=CXX --mode=compile \$CXX \$CPPFLAGS \$CXXFLAGS -c -o lib2/b.lo ../src/lib2/b.cpp"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS -c -o lib2/b.lo ../src/lib2/b.cpp" "template.at:235"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS -c -o lib2/b.lo ../src/lib2/b.cpp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:235"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/template.at:237: \$CXX \$CPPFLAGS \$CXXFLAGS -c ../src/sub/main.cpp"
at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c ../src/sub/main.cpp" "template.at:237"
( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c ../src/sub/main.cpp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:237"
$at_failed && at_fn_log_failure
$at_traceon; }

# both convenience
{ set +x
$as_echo "$at_srcdir/template.at:240: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o lib/liba.la lib/a.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib/liba.la lib/a.lo" "template.at:240"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib/liba.la lib/a.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:240"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/template.at:242: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o lib2/libb.la lib2/b.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib2/libb.la lib2/b.lo" "template.at:242"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib2/libb.la lib2/b.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:242"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/template.at:244: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o sub/main\$EXEEXT \$main_o lib2/libb.la lib/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o sub/main$EXEEXT $main_o lib2/libb.la lib/liba.la" "template.at:244"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o sub/main$EXEEXT $main_o lib2/libb.la lib/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:244"
$at_failed && at_fn_log_failure
$at_traceon; }

lt_exe=./sub/main; if test -f "./sub/main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/template.at:246: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != ignore && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != ignore && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "template.at:246"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != ignore && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_skip $at_status "$at_srcdir/template.at:246"
$at_failed && at_fn_log_failure
$at_traceon; }


# lib convenience
if $noskip && $withundef; then
  { set +x
$as_echo "$at_srcdir/template.at:249: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o lib2/libb.la lib2/b.lo -rpath /foo"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib2/libb.la lib2/b.lo -rpath /foo" "template.at:249"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib2/libb.la lib2/b.lo -rpath /foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:249"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/template.at:251: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o sub/main\$EXEEXT \$main_o lib2/libb.la lib/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o sub/main$EXEEXT $main_o lib2/libb.la lib/liba.la" "template.at:251"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o sub/main$EXEEXT $main_o lib2/libb.la lib/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:251"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./sub/main; if test -f "./sub/main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/template.at:253: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "template.at:253"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/template.at:253"
$at_failed && at_fn_log_failure
$at_traceon; }


fi

# both installed
{ set +x
$as_echo "$at_srcdir/template.at:257: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o lib/liba.la lib/a.lo -rpath /foo"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib/liba.la lib/a.lo -rpath /foo" "template.at:257"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib/liba.la lib/a.lo -rpath /foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:257"
$at_failed && at_fn_log_failure
$at_traceon; }

if $withundef; then
  { set +x
$as_echo "$at_srcdir/template.at:260: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o lib2/libb.la lib2/b.lo -rpath /bar"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib2/libb.la lib2/b.lo -rpath /bar" "template.at:260"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib2/libb.la lib2/b.lo -rpath /bar
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:260"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/template.at:262: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o sub/main\$EXEEXT \$main_o lib2/libb.la lib/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o sub/main$EXEEXT $main_o lib2/libb.la lib/liba.la" "template.at:262"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o sub/main$EXEEXT $main_o lib2/libb.la lib/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:262"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./sub/main; if test -f "./sub/main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/template.at:264: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "template.at:264"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/template.at:264"
$at_failed && at_fn_log_failure
$at_traceon; }


fi

# both convenience, libb depending on liba
{ set +x
$as_echo "$at_srcdir/template.at:268: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o lib/liba.la lib/a.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib/liba.la lib/a.lo" "template.at:268"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib/liba.la lib/a.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:268"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/template.at:270: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o lib2/libb.la lib2/b.lo lib/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib2/libb.la lib2/b.lo lib/liba.la" "template.at:270"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib2/libb.la lib2/b.lo lib/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:270"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/template.at:272: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o sub/main\$EXEEXT \$main_o lib2/libb.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o sub/main$EXEEXT $main_o lib2/libb.la" "template.at:272"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o sub/main$EXEEXT $main_o lib2/libb.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:272"
$at_failed && at_fn_log_failure
$at_traceon; }

lt_exe=./sub/main; if test -f "./sub/main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/template.at:274: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "template.at:274"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/template.at:274"
$at_failed && at_fn_log_failure
$at_traceon; }


# lib convenience
if $noskip; then

  { set +x
$as_echo "$at_srcdir/template.at:278: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o lib2/libb.la lib2/b.lo lib/liba.la -rpath /foo"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib2/libb.la lib2/b.lo lib/liba.la -rpath /foo" "template.at:278"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib2/libb.la lib2/b.lo lib/liba.la -rpath /foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:278"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/template.at:280: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o sub/main\$EXEEXT \$main_o lib2/libb.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o sub/main$EXEEXT $main_o lib2/libb.la" "template.at:280"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o sub/main$EXEEXT $main_o lib2/libb.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:280"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./sub/main; if test -f "./sub/main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/template.at:282: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "template.at:282"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/template.at:282"
$at_failed && at_fn_log_failure
$at_traceon; }


fi
# both installed
if $noskip; then
  { set +x
$as_echo "$at_srcdir/template.at:286: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o lib2/libb.la lib2/b.lo lib/liba.la -rpath /bar"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib2/libb.la lib2/b.lo lib/liba.la -rpath /bar" "template.at:286"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o lib2/libb.la lib2/b.lo lib/liba.la -rpath /bar
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:286"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/template.at:288: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS -o sub/main\$EXEEXT \$main_o lib2/libb.la"
at_fn_check_prepare_dynamic "$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o sub/main$EXEEXT $main_o lib2/libb.la" "template.at:288"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o sub/main$EXEEXT $main_o lib2/libb.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/template.at:288"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./sub/main; if test -f "./sub/main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/template.at:290: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "template.at:290"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/template.at:290"
$at_failed && at_fn_log_failure
$at_traceon; }


fi

cd ..

{ set +x
$as_echo "$at_srcdir/template.at:295: \$noskip || (exit 77)"
at_fn_check_prepare_dynamic "$noskip || (exit 77)" "template.at:295"
( $at_check_trace; $noskip || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/template.at:295"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_141
#AT_START_142
at_fn_group_banner 142 'ctor.at:28' \
  "C++ static constructors" "                        " 19
at_xfail=no
(
  $as_echo "142. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/ctor.at:29: { test -n \"\$CXX\" && test \"X\$CXX\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$CXX\" && test \"X$CXX\" != Xno; } || (exit 77)" "ctor.at:29"
( $at_check_trace; { test -n "$CXX" && test "X$CXX" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ctor.at:29"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ctor.at:29: test g++ != \"\$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)"
at_fn_check_prepare_dynamic "test g++ != \"$CXX\" || (g++ -v >/dev/null 2>&1) || (exit 77)" "ctor.at:29"
( $at_check_trace; test g++ != "$CXX" || (g++ -v >/dev/null 2>&1) || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ctor.at:29"
$at_failed && at_fn_log_failure
$at_traceon; }




cat >class.h <<'_ATEOF'
#define magic 0xaabbccdd
class Foo {
public:
	Foo() { bar = magic; }
	unsigned bar;
};

extern Foo instance;
_ATEOF


cat >libctor.cpp <<'_ATEOF'
#include "class.h"
Foo instance;
_ATEOF


cat >main.cpp <<'_ATEOF'
#include "class.h"

int main(void)
{
  return instance.bar != magic;
}
_ATEOF


{ set +x
$as_echo "$at_srcdir/ctor.at:57: \$LIBTOOL --tag=CXX --mode=compile \$CXX \$CPPFLAGS \$CXXFLAGS \\
	  -c libctor.cpp -o libctor.lo"
at_fn_check_prepare_notrace 'an embedded newline' "ctor.at:57"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS \
	  -c libctor.cpp -o libctor.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ctor.at:57"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ctor.at:59: \$LIBTOOL --tag=CXX --mode=compile \$CXX \$CPPFLAGS \$CXXFLAGS \\
	  -c main.cpp -o main.lo"
at_fn_check_prepare_notrace 'an embedded newline' "ctor.at:59"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS \
	  -c main.cpp -o main.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ctor.at:59"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ctor.at:61: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS \\
	  libctor.lo -o libctor.la -rpath /none"
at_fn_check_prepare_notrace 'an embedded newline' "ctor.at:61"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS \
	  libctor.lo -o libctor.la -rpath /none
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ctor.at:61"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ctor.at:63: \$LIBTOOL --tag=CXX --mode=link \$CXX \$CXXFLAGS \$LDFLAGS \\
	  main.lo libctor.la -o main\$EXEEXT"
at_fn_check_prepare_notrace 'an embedded newline' "ctor.at:63"
( $at_check_trace; $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS \
	  main.lo libctor.la -o main$EXEEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ctor.at:63"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/ctor.at:66: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "ctor.at:66"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ctor.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_142
#AT_START_143
at_fn_group_banner 143 'exceptions.at:24' \
  "C++ exception handling" "                         " 19
at_xfail=no
(
  $as_echo "143. $at_setup_line: testing $at_desc ..."
  $at_traceon




: ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
: ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}

# Skip this test when called from:
#    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
{ set +x
$as_echo "$at_srcdir/exceptions.at:33: case \$LIBLTDL in #(
 */_inst/lib/*) test -f \"\$LIBLTDL\" || (exit 77) ;;
esac"
at_fn_check_prepare_notrace 'an embedded newline' "exceptions.at:33"
( $at_check_trace; case $LIBLTDL in #(
 */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
esac
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exceptions.at:33"
$at_failed && at_fn_log_failure
$at_traceon; }


CPPFLAGS="$LTDLINCL $CPPFLAGS"

# Win32 (and cygwin) notes
# ------------------------
# When using C++ and Win32 DLLs, data types used in the DLL's interface
# that are other-than-POD, must have vtables, typeinfo, and other
# elements resolved when the client is linked.  This includes exception
# classes.  Therefore, the exception class "modexc" thrown by the
# dynamically-loaded module must be defined in a separate DLL, to which
# both that module and main must be directly linked; hence, the 'common'
# library. Not using a 'common' library in this manner represents an
# ODR violation, unless the platform's runtime loader is capable of
# rationalizing vague linkage items such as vtables, typeinfo, and
# typename elements) at runtime.  The Win32 loader is not capable of
# this, but some ELF loaders appear to be.
#
# Similar treatment is not necessary for liba (e.g. the libexc
# exception class), because that library is not dynamically loaded. As a
# consequence, vague linkage items for the class libexc are resolved at
# link time using the vague linkage rules, for both Win32 and other
# (e.g. ELF) platforms.
#
# Also, when linking a C++ DLL with another C++ DLL, some versions of
# the GNU toolchain on Win32 (or cygwin) mistakenly re-export symbols
# that were imported from the other DLL, when the client DLL is linked
# using -export-all-symbols.  Similar issues MAY also arise with those
# versions of the GNU toolchain if using the libtool link flags
# -export-symbols LIST or -export-symbols-regex REGEX, if any symbols
# from the dependency, rather than client, library are listed (or match
# the regex).  However, in this test, none of these situations apply,
# so we don't directly address it.  Otherwise, the correct mechanism
# would be to avoid all of those flags, and instead explicitly decorate
# all symbols with appropriate __declspec (dllexport) or
# __declspec (dllimport) flags when building the DLLs and the clients.
#
# For more information, see these two threads:
#   http://lists.gnu.org/archive/html/bug-libtool/2010-06/msg00069.html
#   http://cygwin.com/ml/cygwin/2010-06/msg00392.html
# To sum up: C++ is complicated.
cat >common.h <<'_ATEOF'
#ifndef LIBTOOL_TEST_COMMON_HEADER
#define LIBTOOL_TEST_COMMON_HEADER

#include <exception>
#include <string>

#if defined __CYGWIN__ || defined _WIN32
# if defined DLL_EXPORT || defined USING_COMMON_DLL
#  if defined LIBTOOL_TEST_IN_COMMON
#   define COMMON_IMPEXP __declspec (dllexport)
#  else
#   define COMMON_IMPEXP __declspec (dllimport)
#  endif
# else
#  define COMMON_IMPEXP
# endif
#else
# define COMMON_IMPEXP
#endif

class COMMON_IMPEXP modexc : public std::exception {
public:
  modexc (std::string str) : message (str) { }
  ~modexc () throw () { }
  virtual const char *what () const throw ()
  {
    return message.c_str ();
  }
private:
  std::string message;
};

extern "C" int COMMON_IMPEXP common_dummy (void);
#endif
_ATEOF


cat >common.cpp <<'_ATEOF'
#define LIBTOOL_TEST_IN_COMMON
#include "common.h"

extern "C"
int common_dummy (void)
{
  return 0;
}
_ATEOF


cat >module.h <<'_ATEOF'
#include "common.h"

#if defined __CYGWIN__ || defined _WIN32
# if defined DLL_EXPORT || defined USING_MODULE_DLL
#  if defined LIBTOOL_TEST_IN_MODULE
#   define MODULE_IMPEXP __declspec (dllexport)
#  else
#   define MODULE_IMPEXP __declspec (dllimport)
#  endif
# else
#  define MODULE_IMPEXP
# endif
#else
# define MODULE_IMPEXP
#endif

extern "C" int MODULE_IMPEXP modfoo () throw (modexc);
_ATEOF


cat >module.cpp <<'_ATEOF'
#include <iostream>
#define LIBTOOL_TEST_IN_MODULE
#include "module.h"

int modbar (void) throw (modexc)
{
  throw modexc ("exception in module");
}

extern "C"
int modfoo (void) throw (modexc)
{
  try {
    modbar ();
  }
  catch (modexc e) {
    std::cerr << "caught inside module: " << e.what () << '\n';
    throw modexc ("exception from module");
  }
  return 0;
}
_ATEOF


cat >lib.h <<'_ATEOF'
#include <exception>
#include <string>


#if defined __CYGWIN__ || defined _WIN32
# if defined DLL_EXPORT || defined USING_LIB_DLL
#  if defined LIBTOOL_TEST_IN_LIB
#   define LIB_IMPEXP __declspec (dllexport)
#  else
#   define LIB_IMPEXP __declspec (dllimport)
#  endif
# else
#  define LIB_IMPEXP
# endif
#else
# define LIB_IMPEXP
#endif

class LIB_IMPEXP libexc : public std::exception {
public:
  libexc (std::string str) : message (str) { }
  ~libexc () throw () { }
  virtual const char *what () const throw ()
  {
    return message.c_str ();
  }
private:
  std::string message;
};
int LIB_IMPEXP libfoo () throw (libexc);
_ATEOF


cat >lib.cpp <<'_ATEOF'
#include <iostream>
#define LIBTOOL_TEST_IN_LIB
#include "lib.h"

int libbar (void) throw (libexc)
{
  throw libexc ("exception in library");
}

int libfoo (void) throw (libexc)
{
  try {
    libbar ();
  }
  catch (libexc e) {
    std::cerr << "caught inside lib: " << e.what () << '\n';
    throw libexc ("exception from library");
  }
  return 0;
}
_ATEOF


cat >main.cpp <<'_ATEOF'
#include <ltdl.h>
#include <cstdlib>
#include <iostream>
#include <exception>
#include <string>
#include "common.h"
#include "lib.h"
#include "module.h"

class exc : public std::exception {
public:
  exc (std::string str) : message (str) { }
  ~exc () throw () { }
  virtual const char *what () const throw ()
  {
    return message.c_str ();
  }
private:
  std::string message;
};

int foo (void) throw (exc)
{
  throw exc ("exception in program");
  return 0;
}

int exceptions_in_prog (void)
{
  std::cerr << "exceptions_in_prog\n";
  try {
    foo ();
  }
  catch (exc e) {
     std::cerr << "caught: " << e.what () << '\n';
    return 0;
  }
  return 1;
}

int exceptions_in_lib (void)
{
  std::cerr << "exceptions_in_lib\n";
  try {
    libfoo ();
  }
  catch (libexc e) {
     std::cerr << "caught: " << e.what () << '\n';
    return 0;
  }
  return 1;
}

int exceptions_in_module (void)
{
  std::cerr << "exceptions_in_module\n";

  if (lt_dlinit ())
    {
      std::cerr << "init error: " << lt_dlerror () << '\n';
      return 1;
    }

  // Some systems need RTLD_GLOBAL for exceptions to work in modules.
  lt_dladvise advise;
  if (lt_dladvise_init (&advise) || lt_dladvise_global (&advise))
    {
      std::cerr << "error setting advise global\n";
      return 1;
    }

  lt_dlhandle handle = lt_dlopenadvise ("module.la", advise);
  if (handle == NULL)
    {
      std::cerr << "dlopen failed: " << lt_dlerror () << '\n';
      return 1;
    }
  lt_dladvise_destroy (&advise);

  typedef int (*pfun) (void);
  pfun pf = (pfun) lt_dlsym (handle, "modfoo");
  if (pf == NULL)
    {
      std::cerr << "dlsym failed: " << lt_dlerror () << '\n';
      return 1;
    }

  bool exception_caught = false;
  try {
    (*pf) ();
  }
  catch (modexc e) {
    std::cerr << "caught: " << e.what () << '\n';
    exception_caught = true;
  }

  /* Only close the module after all of its objects have gone out of scope. */
  if (exception_caught)
  {
    if (lt_dlclose (handle))
      {
        std::cerr << "dlclose failed: " << lt_dlerror () << '\n';
	return 1;
      }
    if (lt_dlexit ())
      {
        std::cerr << "lt_dlexit failed: " << lt_dlerror () << '\n';
	return 1;
      }
    return 0;
  }
  return 1;
}

int main (void)
{

  LTDL_SET_PRELOADED_SYMBOLS();

  if (exceptions_in_prog ())
    return 1;
  if (exceptions_in_lib ())
    return 1;
  if (exceptions_in_module ())
    return 1;
  return 0;
}
_ATEOF


inst=`pwd`/inst
libdir=$inst/lib
bindir=$inst/bin
moddir=$inst/mod
mkdir l m $inst $libdir $bindir $moddir

# If the C++ compiler isn't capable, don't bother.
{ set +x
$as_echo "$at_srcdir/exceptions.at:361: \$CXX \$CPPFLAGS \$CXXFLAGS -DUSING_COMMON_DLL -DUSING_MODULE_DLL -DUSING_LIB_DLL -c main.cpp || exit 77"
at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -DUSING_COMMON_DLL -DUSING_MODULE_DLL -DUSING_LIB_DLL -c main.cpp || exit 77" "exceptions.at:361"
( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -DUSING_COMMON_DLL -DUSING_MODULE_DLL -DUSING_LIB_DLL -c main.cpp || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exceptions.at:361"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/exceptions.at:363: \$LIBTOOL --mode=compile --tag=CXX \$CXX \$CPPFLAGS \$CXXFLAGS -c common.cpp"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CXX $CXX $CPPFLAGS $CXXFLAGS -c common.cpp" "exceptions.at:363"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CXX $CXX $CPPFLAGS $CXXFLAGS -c common.cpp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exceptions.at:363"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/exceptions.at:365: \$LIBTOOL --mode=compile --tag=CXX \$CXX \$CPPFLAGS \$CXXFLAGS -c lib.cpp"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CXX $CXX $CPPFLAGS $CXXFLAGS -c lib.cpp" "exceptions.at:365"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CXX $CXX $CPPFLAGS $CXXFLAGS -c lib.cpp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exceptions.at:365"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/exceptions.at:367: \$LIBTOOL --mode=compile --tag=CXX \$CXX \$CPPFLAGS \$CXXFLAGS -DUSING_COMMON_DLL -c module.cpp"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CXX $CXX $CPPFLAGS $CXXFLAGS -DUSING_COMMON_DLL -c module.cpp" "exceptions.at:367"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CXX $CXX $CPPFLAGS $CXXFLAGS -DUSING_COMMON_DLL -c module.cpp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exceptions.at:367"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/exceptions.at:370: \$LIBTOOL --mode=link --tag=CXX \$CXX \$CXXFLAGS \$LDFLAGS -o l/libcommon.la 	 common.lo -no-undefined -version-info 1:0:0 -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CXX $CXX $CXXFLAGS $LDFLAGS -o l/libcommon.la 	 common.lo -no-undefined -version-info 1:0:0 -rpath $libdir" "exceptions.at:370"
( $at_check_trace; $LIBTOOL --mode=link --tag=CXX $CXX $CXXFLAGS $LDFLAGS -o l/libcommon.la 	 common.lo -no-undefined -version-info 1:0:0 -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exceptions.at:370"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/exceptions.at:373: \$LIBTOOL --mode=link --tag=CXX \$CXX \$CXXFLAGS \$LDFLAGS -o l/liba.la 	 lib.lo -no-undefined -version-info 1:0:0 -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CXX $CXX $CXXFLAGS $LDFLAGS -o l/liba.la 	 lib.lo -no-undefined -version-info 1:0:0 -rpath $libdir" "exceptions.at:373"
( $at_check_trace; $LIBTOOL --mode=link --tag=CXX $CXX $CXXFLAGS $LDFLAGS -o l/liba.la 	 lib.lo -no-undefined -version-info 1:0:0 -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exceptions.at:373"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/exceptions.at:376: \$LIBTOOL --mode=link --tag=CXX \$CXX \$CXXFLAGS \$LDFLAGS -o m/module.la 	 module.lo l/libcommon.la -module -avoid-version -no-undefined -rpath \$moddir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CXX $CXX $CXXFLAGS $LDFLAGS -o m/module.la 	 module.lo l/libcommon.la -module -avoid-version -no-undefined -rpath $moddir" "exceptions.at:376"
( $at_check_trace; $LIBTOOL --mode=link --tag=CXX $CXX $CXXFLAGS $LDFLAGS -o m/module.la 	 module.lo l/libcommon.la -module -avoid-version -no-undefined -rpath $moddir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exceptions.at:376"
$at_failed && at_fn_log_failure
$at_traceon; }


# We need -export-dynamic for the exception handling in modules to work.
{ set +x
$as_echo "$at_srcdir/exceptions.at:381: \$LIBTOOL --mode=link --tag=CXX \$CXX \$CXXFLAGS \$LDFLAGS -o main\$EXEEXT 	 main.\$OBJEXT l/liba.la l/libcommon.la -dlopen m/module.la \$LIBLTDL -export-dynamic"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CXX $CXX $CXXFLAGS $LDFLAGS -o main$EXEEXT 	 main.$OBJEXT l/liba.la l/libcommon.la -dlopen m/module.la $LIBLTDL -export-dynamic" "exceptions.at:381"
( $at_check_trace; $LIBTOOL --mode=link --tag=CXX $CXX $CXXFLAGS $LDFLAGS -o main$EXEEXT 	 main.$OBJEXT l/liba.la l/libcommon.la -dlopen m/module.la $LIBLTDL -export-dynamic
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exceptions.at:381"
$at_failed && at_fn_log_failure
$at_traceon; }


lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/exceptions.at:385: if \$LIBTOOL --mode=execute -dlopen m/module.la \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if $LIBTOOL --mode=execute -dlopen m/module.la \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "exceptions.at:385"
( $at_check_trace; if $LIBTOOL --mode=execute -dlopen m/module.la "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exceptions.at:385"
$at_failed && at_fn_log_failure
$at_traceon; }



{ set +x
$as_echo "$at_srcdir/exceptions.at:387: \$LIBTOOL --mode=install cp l/libcommon.la \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp l/libcommon.la $libdir" "exceptions.at:387"
( $at_check_trace; $LIBTOOL --mode=install cp l/libcommon.la $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exceptions.at:387"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/exceptions.at:389: \$LIBTOOL --mode=install cp l/liba.la \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp l/liba.la $libdir" "exceptions.at:389"
( $at_check_trace; $LIBTOOL --mode=install cp l/liba.la $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exceptions.at:389"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/exceptions.at:391: \$LIBTOOL --mode=install cp m/module.la \$moddir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp m/module.la $moddir" "exceptions.at:391"
( $at_check_trace; $LIBTOOL --mode=install cp m/module.la $moddir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exceptions.at:391"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/exceptions.at:393: \$LIBTOOL --mode=install cp main\$EXEEXT \$bindir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp main$EXEEXT $bindir" "exceptions.at:393"
( $at_check_trace; $LIBTOOL --mode=install cp main$EXEEXT $bindir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exceptions.at:393"
$at_failed && at_fn_log_failure
$at_traceon; }

rm -rf l m main$EXEEXT

LTDL_LIBRARY_PATH=$moddir
export LTDL_LIBRARY_PATH
lt_exe=$bindir/main; if test -f "$bindir/main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/exceptions.at:399: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "exceptions.at:399"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/exceptions.at:399"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_143
#AT_START_144
at_fn_group_banner 144 'early-libtool.at:33' \
  "config.status" "                                  " 20
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "144. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([libtool-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_MACRO_DIRS([m4])
LT_INIT
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.in <<'_ATEOF'
prefix = @prefix@
libdir = @libdir@
top_builddir = .
SHELL = @SHELL@
DEFAULT_INCLUDES = -I. -I@srcdir@
EXEEXT = @EXEEXT@
LIBTOOL = @LIBTOOL@
OBJEXT = @OBJEXT@

CPPFLAGS = @CPPFLAGS@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@

COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFAULT_INCLUDES)
LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFAULT_INCLUDES)
LINK = $(LIBTOOL) --mode=link --tag=CC $(CC) $(CFLAGS) $(LDFLAGS) -o $@

all: hell$(EXEEXT)

libhello.la: hello.lo
	$(LINK) -rpath $(libdir) hello.lo
hell$(EXEEXT): main.$(OBJEXT) libhello.la
	$(LINK) main.$(OBJEXT) libhello.la

.SUFFIXES:
.SUFFIXES: .c .$(OBJEXT) .lo

.c.$(OBJEXT):
	$(COMPILE) -c $<
.c.lo:
	$(LTCOMPILE) -c -o $@ $<
_ATEOF


cat >hello.c <<'_ATEOF'
#include <stdio.h>

void
hello (void)
{
  printf ("** This is not GNU Hello.  There is no built-in mail reader. **\n");
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <stdio.h>

extern void hello (void);

int
main (void)
{
  printf ("Welcome to GNU Hell!\n");

  hello ();

  return 0;
}
_ATEOF


cat > missing <<_EOF
#! /bin/sh
exit 0
_EOF
chmod a+x missing

$LIBTOOLIZE --copy --verbose --install


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/early-libtool.at:110: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "early-libtool.at:110"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/early-libtool.at:110"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/early-libtool.at:111: \$AUTOCONF --force"
at_fn_check_prepare_dynamic "$AUTOCONF --force" "early-libtool.at:111"
( $at_check_trace; $AUTOCONF --force
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/early-libtool.at:111"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/early-libtool.at:112: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "early-libtool.at:112"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/early-libtool.at:112"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/early-libtool.at:113: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "early-libtool.at:113"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/early-libtool.at:113"
$at_failed && at_fn_log_failure
$at_traceon; }

done


lt_exe=./hell; if test -f "./hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/early-libtool.at:115: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "early-libtool.at:115"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/early-libtool.at:115"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/early-libtool.at:116: \$GREP 'Welcome to GNU Hell' stdout"
at_fn_check_prepare_dynamic "$GREP 'Welcome to GNU Hell' stdout" "early-libtool.at:116"
( $at_check_trace; $GREP 'Welcome to GNU Hell' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/early-libtool.at:116"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/early-libtool.at:117: \$GREP 'This is not GNU Hello.' stdout"
at_fn_check_prepare_dynamic "$GREP 'This is not GNU Hello.' stdout" "early-libtool.at:117"
( $at_check_trace; $GREP 'This is not GNU Hello.' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/early-libtool.at:117"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_144
#AT_START_145
at_fn_group_banner 145 'early-libtool.at:127' \
  "config.lt" "                                      " 20
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "145. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([libtool-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_MACRO_DIRS([m4])
LT_INIT
LT_OUTPUT

cat >hello.c <<\_EOF
#include <stdio.h>

void
hello (void)
{
  printf ("** This is not GNU Hello.  There is no built-in mail reader. **\n");
}
_EOF

# Prove that we can run libtool from inside configure:
$SHELL ./libtool --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS \
    -I. -I$srcdir -c -o hello.lo hello.c  || exit 1
$SHELL ./libtool --mode=link --tag=CC $CC $CFLAGS $LDFLAGS \
    -o libhello.la -rpath /notexist hello.lo || exit 1

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.in <<'_ATEOF'
prefix = @prefix@
libdir = @libdir@
top_builddir = .
SHELL = @SHELL@
DEFAULT_INCLUDES = -I. -I@srcdir@
EXEEXT = @EXEEXT@
LIBTOOL = @LIBTOOL@
OBJEXT = @OBJEXT@

CPPFLAGS = @CPPFLAGS@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@

COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFAULT_INCLUDES)
LINK = $(LIBTOOL) --mode=link --tag=CC $(CC) $(CFLAGS) $(LDFLAGS) -o $@

all: hell$(EXEEXT)

hell$(EXEEXT): main.$(OBJEXT) libhello.la
	$(LINK) main.$(OBJEXT) libhello.la

.SUFFIXES:
.SUFFIXES: .c .$(OBJEXT)

.c.$(OBJEXT):
	$(COMPILE) -c $<
_ATEOF


cat >hello.c <<'_ATEOF'
#include <stdio.h>

void
hello (void)
{
  printf ("** This is not GNU Hello.  There is no built-in mail reader. **\n");
}
_ATEOF


cat >main.c <<'_ATEOF'
#include <stdio.h>

extern void hello (void);

int
main (int argc, char *argv[])
{
  printf ("Welcome to GNU Hell!\n");

  hello ();

  return 0;
}
_ATEOF


cat > missing <<_EOF
#! /bin/sh
exit 0
_EOF
chmod a+x missing

$LIBTOOLIZE --copy --verbose --install


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/early-libtool.at:217: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "early-libtool.at:217"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/early-libtool.at:217"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/early-libtool.at:218: \$AUTOCONF --force"
at_fn_check_prepare_dynamic "$AUTOCONF --force" "early-libtool.at:218"
( $at_check_trace; $AUTOCONF --force
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/early-libtool.at:218"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/early-libtool.at:219: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "early-libtool.at:219"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/early-libtool.at:219"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/early-libtool.at:220: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "early-libtool.at:220"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/early-libtool.at:220"
$at_failed && at_fn_log_failure
$at_traceon; }

done


lt_exe=./hell; if test -f "./hell$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/early-libtool.at:222: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "early-libtool.at:222"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/early-libtool.at:222"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/early-libtool.at:223: \$GREP 'Welcome to GNU Hell' stdout"
at_fn_check_prepare_dynamic "$GREP 'Welcome to GNU Hell' stdout" "early-libtool.at:223"
( $at_check_trace; $GREP 'Welcome to GNU Hell' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/early-libtool.at:223"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/early-libtool.at:224: \$GREP 'This is not GNU Hello.' stdout"
at_fn_check_prepare_dynamic "$GREP 'This is not GNU Hello.' stdout" "early-libtool.at:224"
( $at_check_trace; $GREP 'This is not GNU Hello.' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/early-libtool.at:224"
$at_failed && at_fn_log_failure
$at_traceon; }


# Make sure config.status --recheck updates the libtool script
rm libtool
{ set +x
$as_echo "$at_srcdir/early-libtool.at:228: \$SHELL ./config.status --recheck"
at_fn_check_prepare_dynamic "$SHELL ./config.status --recheck" "early-libtool.at:228"
( $at_check_trace; $SHELL ./config.status --recheck
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/early-libtool.at:228"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_145
#AT_START_146
at_fn_group_banner 146 'no-executables.at:26' \
  "AC_NO_EXECUTABLES" "                              " 21
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "146. $at_setup_line: testing $at_desc ..."
  $at_traceon


mkdir m4

cat >configure.ac <<'_ATEOF'
AC_INIT([no-exec], [1])
AC_CONFIG_MACRO_DIRS([m4])

# We punt a bit here, to get the results of AC_PROG_CC
# (and allow it to do link tests) but still error out on
# link tests within Libtool macros.
LDFLAGS=-lnosuchlibrary
AC_NO_EXECUTABLES
AC_PROG_CC
AC_PROG_CXX
AC_PROG_F77
AC_PROG_FC
AM_PROG_GCJ

# Consequently, we have to set cache variables for each link
# test we may need.  For the purposes of this test, it shouldn't
# matter much whether these values are actually wrong, the point
# is that the linker should never be invoked.

lt_cv_shlibpath_overrides_runpath=no
lt_cv_archive_cmds_need_lc=no
lt_cv_cc_needs_belf=no
lt_cv_ld_exported_symbols_list=no
lt_cv_prog_compiler_static_works=no
lt_cv_aix_libpath=/usr/lib:/lib
lt_cv_irix_exported_symbol=yes

# Deal with AC_LIBTOOL_DLOPEN in one of two possible ways:
# - do not execute it at all in the ac_no_link case
# - preset the individual Autoconf test variables

if ${test_ac_libtool_dlopen-false}; then
    ac_cv_func_shl_load=no
    ac_cv_lib_dld_shl_load=no
    ac_cv_func_dlopen=no
    ac_cv_lib_dl_dlopen=no
    ac_cv_lib_svld_dlopen=no
    ac_cv_lib_dld_dld_link=no
  AC_LIBTOOL_DLOPEN
fi
AC_PROG_LIBTOOL

AC_OUTPUT
_ATEOF


$LIBTOOLIZE --install


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/no-executables.at:76: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "no-executables.at:76"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/no-executables.at:76"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1





{ set +x
$as_echo "$at_srcdir/no-executables.at:76: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "no-executables.at:76"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/no-executables.at:76"
$at_failed && at_fn_log_failure
$at_traceon; }







{ set +x
$as_echo "$at_srcdir/no-executables.at:77: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "no-executables.at:77"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/no-executables.at:77"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/no-executables.at:78: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" test_ac_libtool_dlopen=:"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "no-executables.at:78"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" test_ac_libtool_dlopen=:
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/no-executables.at:78"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_146
#AT_START_147
at_fn_group_banner 147 'deplibs-ident.at:33' \
  "build tree relpaths" "                            " 22
at_xfail=no
          eval `$LIBTOOL --config | $EGREP '^hardcode_(direct|direct_absolute|action)='`
    case $hardcode_action,$hardcode_direct,$hardcode_direct_absolute in
      relink,yes,no) :;;
      *,no,*) :;;
      *) false;;
    esac && at_xfail=yes
(
  $as_echo "147. $at_setup_line: testing $at_desc ..."
  $at_traceon



mkdir a a/b c
echo 'int c() { return 0; }' > c/libcee.c
{ set +x
$as_echo "$at_srcdir/deplibs-ident.at:38: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c c/libcee.c -o c/libcee.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c c/libcee.c -o c/libcee.lo" "deplibs-ident.at:38"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c c/libcee.c -o c/libcee.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplibs-ident.at:38"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/deplibs-ident.at:40: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o c/libcee.la c/libcee.lo -rpath /nowhere"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o c/libcee.la c/libcee.lo -rpath /nowhere" "deplibs-ident.at:40"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o c/libcee.la c/libcee.lo -rpath /nowhere
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplibs-ident.at:40"
$at_failed && at_fn_log_failure
$at_traceon; }


depl_1=../c/libcee.la
depl_2=`pwd`/c/libcee.la
depl_3="-L../c -lcee"

(
  cd a
  for i in 1 2 3; do
    eval depend_on_c=\"\$depl_$i\"
    echo "extern int c(void); int a$i() { return c(); }" > liba$i.c
    { set +x
$as_echo "$at_srcdir/deplibs-ident.at:52: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c liba\$i.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c liba$i.c" "deplibs-ident.at:52"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c liba$i.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplibs-ident.at:52"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/deplibs-ident.at:54: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba\$i.la liba\$i.lo \$depend_on_c -rpath /nowhere"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba$i.la liba$i.lo $depend_on_c -rpath /nowhere" "deplibs-ident.at:54"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba$i.la liba$i.lo $depend_on_c -rpath /nowhere
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplibs-ident.at:54"
$at_failed && at_fn_log_failure
$at_traceon; }

  done
)

cat >a/b/b.c <<'_ATEOF'
extern int a1(void), a2(void), a3(void), c(void);
int main() { return a1() + a2() + a3() + c(); }
_ATEOF


(
  cd a/b
  { set +x
$as_echo "$at_srcdir/deplibs-ident.at:66: \$CC \$CFLAGS -c b.c"
at_fn_check_prepare_dynamic "$CC $CFLAGS -c b.c" "deplibs-ident.at:66"
( $at_check_trace; $CC $CFLAGS -c b.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplibs-ident.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/deplibs-ident.at:67: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o b\$EXEEXT b.\$OBJEXT ../liba1.la ../liba2.la ../liba3.la ../../c/libcee.la -rpath /nowhere"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o b$EXEEXT b.$OBJEXT ../liba1.la ../liba2.la ../liba3.la ../../c/libcee.la -rpath /nowhere" "deplibs-ident.at:67"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o b$EXEEXT b.$OBJEXT ../liba1.la ../liba2.la ../liba3.la ../../c/libcee.la -rpath /nowhere
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplibs-ident.at:67"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/deplibs-ident.at:69: \$EGREP 'cee.*cee' stdout"
at_fn_check_prepare_dynamic "$EGREP 'cee.*cee' stdout" "deplibs-ident.at:69"
( $at_check_trace; $EGREP 'cee.*cee' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/deplibs-ident.at:69"
$at_failed && at_fn_log_failure
$at_traceon; }


  )

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_147
#AT_START_148
at_fn_group_banner 148 'configure-iface.at:103' \
  "installable libltdl" "                            " 23
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "148. $at_setup_line: testing $at_desc ..."
  $at_traceon



cat >main.c <<'_ATEOF'
#include <ltdl.h>
#include <stdio.h>

typedef int funcp (void);

static int errors = 0;

int
main (void)
{
  lt_dlhandle handle;

  LTDL_SET_PRELOADED_SYMBOLS();

  if (lt_dlinit () != 0)
    {
      fprintf (stderr, "error during initialization: %s\n", lt_dlerror ());
      return 1;
    }

  handle = lt_dlopenext ("libmodule");
  if (!handle)
    {
      fprintf (stderr, "can't open libmodule: %s\n", lt_dlerror ());
      ++errors;
    }

  {
    funcp *f = (funcp *) lt_dlsym (handle, "f");

    if (f)
      {
        printf ("%d\n", f ());
      }
    else
      {
        fprintf (stderr, "function 'f' not found: %s\n", lt_dlerror ());
        ++errors;
      }
  }

  if (lt_dlexit () != 0)
    {
      fprintf (stderr, "error during exit: %s\n", lt_dlerror ());
      ++errors;
    }

  return (errors != 0);
}
_ATEOF


cat >libmodule.c <<'_ATEOF'
#ifdef __cplusplus
extern "C" {
#endif
int f (void) { return 5150; }
#ifdef __cplusplus
}
#endif
_ATEOF


cat >expout <<'_ATEOF'
5150
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac


cat >configure.ac <<'_ATEOF'
AC_INIT([installable-ltdl-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([libltdl/config])
AC_CONFIG_MACRO_DIRS([libltdl/m4])
AC_CONFIG_HEADERS([config.h:config.hin])
LT_CONFIG_LTDL_DIR([libltdl])
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC
AM_PROG_CC_C_O
LT_INIT([dlopen])
LTDL_INIT([installable])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS	= 1.7

SUBDIRS			= libltdl

AM_CPPFLAGS		= $(LTDLINCL)

lib_LTLIBRARIES		= libmodule.la
# Automake < 1.8 will use libmodule.la.c as default source,
# while newer will choose libmodule.c; so specify it here.
libmodule_la_SOURCES	= libmodule.c
libmodule_la_LDFLAGS	= -module

bin_PROGRAMS		= main
main_LDFLAGS		= -dlopen libmodule.la
main_LDADD		= $(LIBLTDL)
main_DEPENDENCIES	= $(LTDLDEPS) libmodule.la
_ATEOF


# Install everything!
prefix=`pwd`/_inst

$LIBTOOLIZE --ltdl


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I libltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/configure-iface.at:145: \$ACLOCAL -I libltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I libltdl/m4$macro_dir" "configure-iface.at:145"
( $at_check_trace; $ACLOCAL -I libltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:145"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/configure-iface.at:145: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "configure-iface.at:145"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:145"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/configure-iface.at:145: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "configure-iface.at:145"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:145"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/configure-iface.at:145: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "configure-iface.at:145"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/configure-iface.at:145"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/configure-iface.at:145: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "configure-iface.at:145"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:145"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/configure-iface.at:145: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --with-included-ltdl --prefix=\$prefix"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "configure-iface.at:145"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --with-included-ltdl --prefix=$prefix
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:145"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all install
do
  { set +x
$as_echo "$at_srcdir/configure-iface.at:145: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "configure-iface.at:145"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:145"
$at_failed && at_fn_log_failure
$at_traceon; }

done



# TODO: Check that the installed program 'main' is linked against our libltdl
{ set +x
$as_echo "$at_srcdir/configure-iface.at:149: test -f \"\$prefix/lib/libltdl.la\""
at_fn_check_prepare_dynamic "test -f \"$prefix/lib/libltdl.la\"" "configure-iface.at:149"
( $at_check_trace; test -f "$prefix/lib/libltdl.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:149"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/configure-iface.at:150: test -f \"\$prefix/include/ltdl.h\""
at_fn_check_prepare_dynamic "test -f \"$prefix/include/ltdl.h\"" "configure-iface.at:150"
( $at_check_trace; test -f "$prefix/include/ltdl.h"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:150"
$at_failed && at_fn_log_failure
$at_traceon; }


# Check that main is rebuilt if libltdl.la is newer
rm -f libltdl/libltdl.la
{ set +x
$as_echo "$at_srcdir/configure-iface.at:154: \$MAKE -q main\$EXEEXT || exit 1"
at_fn_check_prepare_dynamic "$MAKE -q main$EXEEXT || exit 1" "configure-iface.at:154"
( $at_check_trace; $MAKE -q main$EXEEXT || exit 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/configure-iface.at:154"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_148
#AT_START_149
at_fn_group_banner 149 'configure-iface.at:163' \
  "--with-ltdl-include/lib" "                        " 23
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "149. $at_setup_line: testing $at_desc ..."
  $at_traceon



# Install libltdl
prefix=`pwd`/_inst

$LIBTOOLIZE --copy --ltdl=ltdl



(cd ltdl
{ set +x
$as_echo "$at_srcdir/configure-iface.at:172: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --enable-ltdl-install --prefix=\$prefix"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "configure-iface.at:172"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --enable-ltdl-install --prefix=$prefix
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:172"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all install
do
  { set +x
$as_echo "$at_srcdir/configure-iface.at:173: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "configure-iface.at:173"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:173"
$at_failed && at_fn_log_failure
$at_traceon; }

done

)

# Remove build files
rm -rf ltdl/

{ set +x
$as_echo "$at_srcdir/configure-iface.at:179: test -f \"\$prefix/lib/libltdl.la\""
at_fn_check_prepare_dynamic "test -f \"$prefix/lib/libltdl.la\"" "configure-iface.at:179"
( $at_check_trace; test -f "$prefix/lib/libltdl.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:179"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/configure-iface.at:180: test -f \"\$prefix/include/ltdl.h\""
at_fn_check_prepare_dynamic "test -f \"$prefix/include/ltdl.h\"" "configure-iface.at:180"
( $at_check_trace; test -f "$prefix/include/ltdl.h"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:180"
$at_failed && at_fn_log_failure
$at_traceon; }


cat >main.c <<'_ATEOF'
#include <ltdl.h>
#include <stdio.h>

typedef int funcp (void);

static int errors = 0;

int
main (void)
{
  lt_dlhandle handle;

  LTDL_SET_PRELOADED_SYMBOLS();

  if (lt_dlinit () != 0)
    {
      fprintf (stderr, "error during initialization: %s\n", lt_dlerror ());
      return 1;
    }

  handle = lt_dlopenext ("libmodule");
  if (!handle)
    {
      fprintf (stderr, "can't open libmodule: %s\n", lt_dlerror ());
      ++errors;
    }

  {
    funcp *f = (funcp *) lt_dlsym (handle, "f");

    if (f)
      {
        printf ("%d\n", f ());
      }
    else
      {
        fprintf (stderr, "function 'f' not found: %s\n", lt_dlerror ());
        ++errors;
      }
  }

  if (lt_dlexit () != 0)
    {
      fprintf (stderr, "error during exit: %s\n", lt_dlerror ());
      ++errors;
    }

  return (errors != 0);
}
_ATEOF


cat >libmodule.c <<'_ATEOF'
#ifdef __cplusplus
extern "C" {
#endif
int f (void) { return 5150; }
#ifdef __cplusplus
}
#endif
_ATEOF


cat >expout <<'_ATEOF'
5150
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac


cat >configure.ac <<'_ATEOF'
AC_INIT([configure-iface-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_MACRO_DIRS([_inst/aclocal])
AC_CONFIG_HEADERS([config.h:config.hin])
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC
AM_PROG_CC_C_O
LT_INIT([dlopen])
LTDL_INIT
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS	= 1.7

AM_CPPFLAGS		= $(LTDLINCL)

lib_LTLIBRARIES		= libmodule.la
# Automake < 1.8 will use libmodule.la.c as default source,
# while newer will choose libmodule.c; so specify it here.
libmodule_la_SOURCES	= libmodule.c
libmodule_la_LDFLAGS	= -module

bin_PROGRAMS		= main
main_LDFLAGS		= -dlopen libmodule.la
main_LDADD		= $(LIBLTDL)
main_DEPENDENCIES	= $(LTDLDEPS) libmodule.la
_ATEOF


## Try to avoid linking against a previously installed libltdl found
## with an explicit -L/path.
save_LDFLAGS=$LDFLAGS
LDFLAGS=
for l in $save_LDFLAGS
do
  case $l in
  -L*) ;;
  *) LDFLAGS="$LDFLAGS $l" ;;
  esac
done

# We don't use 'libtoolize --ltdl', so that we get an error if the test
# tries to build and link against its own ltdl sources:
$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I _inst/aclocal$macro_dir"; { set +x
$as_echo "$at_srcdir/configure-iface.at:228: \$ACLOCAL -I _inst/aclocal\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I _inst/aclocal$macro_dir" "configure-iface.at:228"
( $at_check_trace; $ACLOCAL -I _inst/aclocal$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:228"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/configure-iface.at:228: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "configure-iface.at:228"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:228"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/configure-iface.at:228: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "configure-iface.at:228"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:228"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/configure-iface.at:228: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "configure-iface.at:228"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/configure-iface.at:228"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/configure-iface.at:228: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "configure-iface.at:228"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:228"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/configure-iface.at:228: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --with-ltdl-lib=\$prefix/lib --with-ltdl-include=\$prefix/include"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "configure-iface.at:228"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --with-ltdl-lib=$prefix/lib --with-ltdl-include=$prefix/include
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:228"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/configure-iface.at:228: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "configure-iface.at:228"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:228"
$at_failed && at_fn_log_failure
$at_traceon; }

done



## TODO: portable ldd check for correct libltdl
## Currently, this test doesn't fail if 'main' ends up linking against a
## previously installed system libltdl.
lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/configure-iface.at:235: if \$LIBTOOL --mode=execute -dlopen libmodule.la \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if $LIBTOOL --mode=execute -dlopen libmodule.la \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "configure-iface.at:235"
( $at_check_trace; if $LIBTOOL --mode=execute -dlopen libmodule.la "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:235"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_149
#AT_START_150
at_fn_group_banner 150 'configure-iface.at:244' \
  "--with-included-ltdl" "                           " 23
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "150. $at_setup_line: testing $at_desc ..."
  $at_traceon



cat >main.c <<'_ATEOF'
#include <ltdl.h>
#include <stdio.h>

typedef int funcp (void);

static int errors = 0;

int
main (void)
{
  lt_dlhandle handle;

  LTDL_SET_PRELOADED_SYMBOLS();

  if (lt_dlinit () != 0)
    {
      fprintf (stderr, "error during initialization: %s\n", lt_dlerror ());
      return 1;
    }

  handle = lt_dlopenext ("libmodule");
  if (!handle)
    {
      fprintf (stderr, "can't open libmodule: %s\n", lt_dlerror ());
      ++errors;
    }

  {
    funcp *f = (funcp *) lt_dlsym (handle, "f");

    if (f)
      {
        printf ("%d\n", f ());
      }
    else
      {
        fprintf (stderr, "function 'f' not found: %s\n", lt_dlerror ());
        ++errors;
      }
  }

  if (lt_dlexit () != 0)
    {
      fprintf (stderr, "error during exit: %s\n", lt_dlerror ());
      ++errors;
    }

  return (errors != 0);
}
_ATEOF


cat >libmodule.c <<'_ATEOF'
#ifdef __cplusplus
extern "C" {
#endif
int f (void) { return 5150; }
#ifdef __cplusplus
}
#endif
_ATEOF


cat >expout <<'_ATEOF'
5150
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac


cat >configure.ac <<'_ATEOF'
AC_INIT([configure-iface-demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([libltdl/config])
AC_CONFIG_MACRO_DIRS([libltdl/m4])
AC_CONFIG_HEADERS([config.h:config.hin])
LT_CONFIG_LTDL_DIR([libltdl])
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC
AM_PROG_CC_C_O
LT_INIT([dlopen])
LTDL_INIT
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS	= 1.7

SUBDIRS			= libltdl

AM_CPPFLAGS		= $(LTDLINCL)

lib_LTLIBRARIES		= libmodule.la
# Automake < 1.8 will use libmodule.la.c as default source,
# while newer will choose libmodule.c; so specify it here.
libmodule_la_SOURCES	= libmodule.c
libmodule_la_LDFLAGS	= -module

bin_PROGRAMS		= main
main_LDFLAGS		= -dlopen libmodule.la
main_LDADD		= $(LIBLTDL)
main_DEPENDENCIES	= $(LTDLDEPS) libmodule.la
_ATEOF


$LIBTOOLIZE --ltdl


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I libltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/configure-iface.at:283: \$ACLOCAL -I libltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I libltdl/m4$macro_dir" "configure-iface.at:283"
( $at_check_trace; $ACLOCAL -I libltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:283"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/configure-iface.at:283: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "configure-iface.at:283"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:283"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/configure-iface.at:283: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "configure-iface.at:283"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:283"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/configure-iface.at:283: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "configure-iface.at:283"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/configure-iface.at:283"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/configure-iface.at:283: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "configure-iface.at:283"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:283"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/configure-iface.at:283: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --with-included-ltdl"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "configure-iface.at:283"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --with-included-ltdl
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:283"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/configure-iface.at:283: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "configure-iface.at:283"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:283"
$at_failed && at_fn_log_failure
$at_traceon; }

done



# --with-included-ltdl should build a convenience lib by default
{ set +x
$as_echo "$at_srcdir/configure-iface.at:287: test -f libltdl/libltdlc.la"
at_fn_check_prepare_trace "configure-iface.at:287"
( $at_check_trace; test -f libltdl/libltdlc.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:287"
$at_failed && at_fn_log_failure
$at_traceon; }


## TODO: portable ldd check for correct libltdl
## Currently, this test doesn't fail if 'main' ends up linking against a
## previously installed system libltdl.
lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/configure-iface.at:292: if \$LIBTOOL --mode=execute -dlopen libmodule.la \"\$lt_exe\" ; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if $LIBTOOL --mode=execute -dlopen libmodule.la \"$lt_exe\" ; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "configure-iface.at:292"
( $at_check_trace; if $LIBTOOL --mode=execute -dlopen libmodule.la "$lt_exe" ; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:292"
$at_failed && at_fn_log_failure
$at_traceon; }



# Check that main is rebuilt if libltdlc.la is newer
rm -f libltdl/libltdlc.la
{ set +x
$as_echo "$at_srcdir/configure-iface.at:296: \$MAKE -q main\$EXEEXT || exit 1"
at_fn_check_prepare_dynamic "$MAKE -q main$EXEEXT || exit 1" "configure-iface.at:296"
( $at_check_trace; $MAKE -q main$EXEEXT || exit 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/configure-iface.at:296"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_150
#AT_START_151
at_fn_group_banner 151 'configure-iface.at:305' \
  "convenience libltdl" "                            " 23
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "151. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT
AC_CONFIG_AUX_DIR([libltdl/config])
AC_LIBLTDL_CONVENIENCE
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
AC_CONFIG_FILES(Makefile)
AC_OUTPUT
_ATEOF

cat >Makefile.in <<'_ATEOF'
LIBLTDL = @LIBLTDL@
print-ltdl:
	echo $(LIBLTDL)
_ATEOF


$LIBTOOLIZE --ltdl


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I libltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/configure-iface.at:322: \$ACLOCAL -I libltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I libltdl/m4$macro_dir" "configure-iface.at:322"
( $at_check_trace; $ACLOCAL -I libltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:322"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1





{ set +x
$as_echo "$at_srcdir/configure-iface.at:322: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "configure-iface.at:322"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:322"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/configure-iface.at:322: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "configure-iface.at:322"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:322"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/configure-iface.at:323: \$MAKE print-ltdl"
at_fn_check_prepare_dynamic "$MAKE print-ltdl" "configure-iface.at:323"
( $at_check_trace; $MAKE print-ltdl
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:323"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/configure-iface.at:324: \$GREP libltdl/libltdlc.la stdout"
at_fn_check_prepare_dynamic "$GREP libltdl/libltdlc.la stdout" "configure-iface.at:324"
( $at_check_trace; $GREP libltdl/libltdlc.la stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/configure-iface.at:324"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_151
#AT_START_152
at_fn_group_banner 152 'f77demo.at:296' \
  "static library" "                                 " 24
at_xfail=no
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "152. $at_setup_line: testing $at_desc ..."
  $at_traceon


# Executing the static fprogram might be interactive on MSYS.



{ set +x
$as_echo "$at_srcdir/f77demo.at:301: { test -n \"\$F77\" && test \"X\$F77\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$F77\" && test \"X$F77\" != Xno; } || (exit 77)" "f77demo.at:301"
( $at_check_trace; { test -n "$F77" && test "X$F77" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:301"
$at_failed && at_fn_log_failure
$at_traceon; }





cat >configure.ac <<'_ATEOF'
AC_INIT([f77demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE
AC_PROG_CC

AC_PROG_F77
dnl When configuring for 'make dist' purposes, skip checks that may yield fatal
dnl errors when there is no working F77 compiler.
if test -z "$with_dist"; then
  dnl Check the flags needed to link f77 programs with ld (i.e. cc)
  AC_F77_LIBRARY_LDFLAGS
  dnl Check for underscoring of external names
  AC_F77_WRAPPERS
fi
LT_INIT
AC_SUBST([LIBTOOL_DEPS])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

lib_LTLIBRARIES = libfoo.la libmix.la libfoo2.la libfoo3.la

libfoo_la_SOURCES = foof.f
libfoo_la_LIBADD = libfoo2.la
libfoo_la_LDFLAGS = -no-undefined

libfoo2_la_SOURCES = foof2.f
libfoo2_la_LDFLAGS = -no-undefined

libfoo3_la_SOURCES = foof3.f
libfoo3_la_LDFLAGS = -no-undefined

libmix_la_SOURCES = foof.f foof2.f fooc.c
libmix_la_LDFLAGS = -no-undefined

noinst_HEADERS = foo.h

bin_PROGRAMS = fprogram cprogram

fprogram_SOURCES = fprogram.f
fprogram_LDADD = libfoo.la libfoo3.la

cprogram_SOURCES = cprogram.c
cprogram_LDADD = libmix.la $(FLIBS)

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck
_ATEOF


cat >fprogram.f <<'_ATEOF'
      program fprogram
      implicit none
      integer*4 arg,res

      write(*,*) 'Welcome to GNU libtool Fortran demo!'
      write(*,*) 'Real programmers write in FORTRAN.'
      arg=2

      call fsub(arg,res)

      write(*,*) 'fsub returned, saying that 2 *',arg,' =',res

      if (res.eq.4) then
         write(*,*) 'fsub is ok!'
      endif

      call fsub3(arg,res)

      write(*,*) 'fsub3 returned, saying that 4 *',arg,' =',res

      if (res.eq.8) then
         write(*,*) 'fsub3 is ok!'
      endif

      stop
      end
_ATEOF


cat >cprogram.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int
main ()
{
  int arg,cres,fres;

  printf ("Welcome to GNU libtool mixed C/Fortran demo!\n");

  arg=2;

  cres=csub(arg);

  printf ("The C subroutine returned, claiming that 2*%d = %d\n",arg,cres);

  if(cres==2*arg)
    printf ("The C subroutine is ok!\n");

  printf("\nCalling the C wrapper routine...\n");
  fres=fwrapper(arg);

  printf ("The C wrapper to the fortran subroutine returned,\n"
	  "claiming that 2*%d = %d\n",arg,fres);

  if(fres==2*arg)
    printf ("The Fortran 77 subroutine is ok!\n");

  return 0;
}
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef _FOO_H_
#define _FOO_H_ 1

/* config.h is necessary for the fortran name mangling */
#include <config.h>

/* csub is an extremely useful subroutine that
 * returns the argument multiplied by two :-)
 */
extern int csub(int);

/* This routine performs the same action, but
 * calls the fortran subroutine fsub to do the
 * real work.
 */
extern int fwrapper(int);

/* fsub does the same thing as csub, i.e. res=arg*2.
 * Use autoconf macro for fortran function names.
 * Note that fortran passes args by reference, so
 * you need to provide pointers to your ints.
 */
extern
#ifdef __cplusplus
"C"
#endif
void F77_FUNC(fsub,FSUB)(int *arg, int *res);

#endif
_ATEOF


cat >fooc.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int csub(int arg)
{
  return (2*arg);
}


int fwrapper(int arg)
{
  int res;
  printf("Calling the Fortran 77 subroutine from the C wrapper...\n");
  F77_FUNC(fsub,FSUB)(&arg,&res);
  printf("Returned from the Fortran 77 subroutine...\n");
  return res;
}
_ATEOF


cat >foof.f <<'_ATEOF'
      subroutine fsub(arg,res)
      write(*,*) 'fsub called'
      call fsubf(arg,res)
      return
      end
_ATEOF


cat >foof2.f <<'_ATEOF'
      subroutine fsubf(arg,res)
      implicit none
      integer*4 arg,res
      write(*,*) 'fsubf called'
      res=arg*2
      return
      end
_ATEOF


cat >foof3.f <<'_ATEOF'
      subroutine fsub3(arg,res)
      implicit none
      integer*4 arg,res
      write(*,*) 'fsub3 called'
      res=arg*4
      return
      end
_ATEOF


{ set +x
$as_echo "$at_srcdir/f77demo.at:301: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "f77demo.at:301"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:301"
$at_failed && at_fn_log_failure
$at_traceon; }






$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/f77demo.at:303: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "f77demo.at:303"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:303"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/f77demo.at:303: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "f77demo.at:303"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:303"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/f77demo.at:303: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "f77demo.at:303"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:303"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/f77demo.at:303: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "f77demo.at:303"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/f77demo.at:303"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/f77demo.at:303: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "f77demo.at:303"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:303"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/f77demo.at:303: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-shared"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "f77demo.at:303"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-shared
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:303"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/f77demo.at:303: \$EGREP '^build_old_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=yes' libtool" "f77demo.at:303"
( $at_check_trace; $EGREP '^build_old_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:303"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/f77demo.at:303: \$EGREP '^build_libtool_libs=no' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=no' libtool" "f77demo.at:303"
( $at_check_trace; $EGREP '^build_libtool_libs=no' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:303"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/f77demo.at:305: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "f77demo.at:305"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:305"
$at_failed && at_fn_log_failure
$at_traceon; }

done


# Due to differences in line-endings between C stdout and Fortran
# stdout, as well as unpredictable output ordering between platforms
# and runtimes, we can't reliably check the output here... although
# it should be some variation of the following:
cat >expout <<'_ATEOF'
 Welcome to GNU libtool Fortran demo!
 Real programmers write in FORTRAN.
 fsub called
 fsubf called
 fsub returned, saying that 2 *           2  =           4
 fsub is ok!
 fsub3 called
 fsub3 returned, saying that 4 *           2  =           8
 fsub3 is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac
lt_exe=./fprogram; if test -f "./fprogram$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/f77demo.at:305: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "f77demo.at:305"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:305"
$at_failed && at_fn_log_failure
$at_traceon; }



# A weaker output content check that is agnostic to the issues above.
{ set +x
$as_echo "$at_srcdir/f77demo.at:305: \$GREP 'Welcome to GNU libtool Fortran demo!' stdout"
at_fn_check_prepare_dynamic "$GREP 'Welcome to GNU libtool Fortran demo!' stdout" "f77demo.at:305"
( $at_check_trace; $GREP 'Welcome to GNU libtool Fortran demo!' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:305"
$at_failed && at_fn_log_failure
$at_traceon; }


# Similarly, we can't reliably compare actual output with the following.
cat >expout <<'_ATEOF'
Welcome to GNU libtool mixed C/Fortran demo!
The C subroutine returned, claiming that 2*2 = 4
The C subroutine is ok!

Calling the C wrapper routine...
Calling the Fortran 77 subroutine from the C wrapper...
 fsub called
 fsubf called
Returned from the Fortran 77 subroutine...
The C wrapper to the fortran subroutine returned,
claiming that 2*2 = 4
The Fortran 77 subroutine is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac
lt_exe=./cprogram; if test -f "./cprogram$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/f77demo.at:305: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "f77demo.at:305"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:305"
$at_failed && at_fn_log_failure
$at_traceon; }



# A weaker output content check that is agnostic to the issues above.
{ set +x
$as_echo "$at_srcdir/f77demo.at:305: \$GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout"
at_fn_check_prepare_dynamic "$GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout" "f77demo.at:305"
( $at_check_trace; $GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:305"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_152
#AT_START_153
at_fn_group_banner 153 'f77demo.at:314' \
  "shared library" "                                 " 24
at_xfail=no
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "153. $at_setup_line: testing $at_desc ..."
  $at_traceon



{ set +x
$as_echo "$at_srcdir/f77demo.at:316: { test -n \"\$F77\" && test \"X\$F77\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$F77\" && test \"X$F77\" != Xno; } || (exit 77)" "f77demo.at:316"
( $at_check_trace; { test -n "$F77" && test "X$F77" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:316"
$at_failed && at_fn_log_failure
$at_traceon; }





cat >configure.ac <<'_ATEOF'
AC_INIT([f77demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE
AC_PROG_CC

AC_PROG_F77
dnl When configuring for 'make dist' purposes, skip checks that may yield fatal
dnl errors when there is no working F77 compiler.
if test -z "$with_dist"; then
  dnl Check the flags needed to link f77 programs with ld (i.e. cc)
  AC_F77_LIBRARY_LDFLAGS
  dnl Check for underscoring of external names
  AC_F77_WRAPPERS
fi
LT_INIT
AC_SUBST([LIBTOOL_DEPS])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

lib_LTLIBRARIES = libfoo.la libmix.la libfoo2.la libfoo3.la

libfoo_la_SOURCES = foof.f
libfoo_la_LIBADD = libfoo2.la
libfoo_la_LDFLAGS = -no-undefined

libfoo2_la_SOURCES = foof2.f
libfoo2_la_LDFLAGS = -no-undefined

libfoo3_la_SOURCES = foof3.f
libfoo3_la_LDFLAGS = -no-undefined

libmix_la_SOURCES = foof.f foof2.f fooc.c
libmix_la_LDFLAGS = -no-undefined

noinst_HEADERS = foo.h

bin_PROGRAMS = fprogram cprogram

fprogram_SOURCES = fprogram.f
fprogram_LDADD = libfoo.la libfoo3.la

cprogram_SOURCES = cprogram.c
cprogram_LDADD = libmix.la $(FLIBS)

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck
_ATEOF


cat >fprogram.f <<'_ATEOF'
      program fprogram
      implicit none
      integer*4 arg,res

      write(*,*) 'Welcome to GNU libtool Fortran demo!'
      write(*,*) 'Real programmers write in FORTRAN.'
      arg=2

      call fsub(arg,res)

      write(*,*) 'fsub returned, saying that 2 *',arg,' =',res

      if (res.eq.4) then
         write(*,*) 'fsub is ok!'
      endif

      call fsub3(arg,res)

      write(*,*) 'fsub3 returned, saying that 4 *',arg,' =',res

      if (res.eq.8) then
         write(*,*) 'fsub3 is ok!'
      endif

      stop
      end
_ATEOF


cat >cprogram.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int
main ()
{
  int arg,cres,fres;

  printf ("Welcome to GNU libtool mixed C/Fortran demo!\n");

  arg=2;

  cres=csub(arg);

  printf ("The C subroutine returned, claiming that 2*%d = %d\n",arg,cres);

  if(cres==2*arg)
    printf ("The C subroutine is ok!\n");

  printf("\nCalling the C wrapper routine...\n");
  fres=fwrapper(arg);

  printf ("The C wrapper to the fortran subroutine returned,\n"
	  "claiming that 2*%d = %d\n",arg,fres);

  if(fres==2*arg)
    printf ("The Fortran 77 subroutine is ok!\n");

  return 0;
}
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef _FOO_H_
#define _FOO_H_ 1

/* config.h is necessary for the fortran name mangling */
#include <config.h>

/* csub is an extremely useful subroutine that
 * returns the argument multiplied by two :-)
 */
extern int csub(int);

/* This routine performs the same action, but
 * calls the fortran subroutine fsub to do the
 * real work.
 */
extern int fwrapper(int);

/* fsub does the same thing as csub, i.e. res=arg*2.
 * Use autoconf macro for fortran function names.
 * Note that fortran passes args by reference, so
 * you need to provide pointers to your ints.
 */
extern
#ifdef __cplusplus
"C"
#endif
void F77_FUNC(fsub,FSUB)(int *arg, int *res);

#endif
_ATEOF


cat >fooc.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int csub(int arg)
{
  return (2*arg);
}


int fwrapper(int arg)
{
  int res;
  printf("Calling the Fortran 77 subroutine from the C wrapper...\n");
  F77_FUNC(fsub,FSUB)(&arg,&res);
  printf("Returned from the Fortran 77 subroutine...\n");
  return res;
}
_ATEOF


cat >foof.f <<'_ATEOF'
      subroutine fsub(arg,res)
      write(*,*) 'fsub called'
      call fsubf(arg,res)
      return
      end
_ATEOF


cat >foof2.f <<'_ATEOF'
      subroutine fsubf(arg,res)
      implicit none
      integer*4 arg,res
      write(*,*) 'fsubf called'
      res=arg*2
      return
      end
_ATEOF


cat >foof3.f <<'_ATEOF'
      subroutine fsub3(arg,res)
      implicit none
      integer*4 arg,res
      write(*,*) 'fsub3 called'
      res=arg*4
      return
      end
_ATEOF


{ set +x
$as_echo "$at_srcdir/f77demo.at:316: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "f77demo.at:316"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:316"
$at_failed && at_fn_log_failure
$at_traceon; }






$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/f77demo.at:318: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "f77demo.at:318"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/f77demo.at:318: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "f77demo.at:318"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/f77demo.at:318: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "f77demo.at:318"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:318"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/f77demo.at:318: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "f77demo.at:318"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/f77demo.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/f77demo.at:318: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "f77demo.at:318"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/f77demo.at:318: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-static"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "f77demo.at:318"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-static
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/f77demo.at:318: \$EGREP '^build_old_libs=no' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=no' libtool" "f77demo.at:318"
( $at_check_trace; $EGREP '^build_old_libs=no' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/f77demo.at:318: \$EGREP '^build_libtool_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=yes' libtool" "f77demo.at:318"
( $at_check_trace; $EGREP '^build_libtool_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/f77demo.at:320: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "f77demo.at:320"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:320"
$at_failed && at_fn_log_failure
$at_traceon; }

done


# Due to differences in line-endings between C stdout and Fortran
# stdout, as well as unpredictable output ordering between platforms
# and runtimes, we can't reliably check the output here... although
# it should be some variation of the following:
cat >expout <<'_ATEOF'
 Welcome to GNU libtool Fortran demo!
 Real programmers write in FORTRAN.
 fsub called
 fsubf called
 fsub returned, saying that 2 *           2  =           4
 fsub is ok!
 fsub3 called
 fsub3 returned, saying that 4 *           2  =           8
 fsub3 is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac
lt_exe=./fprogram; if test -f "./fprogram$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/f77demo.at:320: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "f77demo.at:320"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:320"
$at_failed && at_fn_log_failure
$at_traceon; }



# A weaker output content check that is agnostic to the issues above.
{ set +x
$as_echo "$at_srcdir/f77demo.at:320: \$GREP 'Welcome to GNU libtool Fortran demo!' stdout"
at_fn_check_prepare_dynamic "$GREP 'Welcome to GNU libtool Fortran demo!' stdout" "f77demo.at:320"
( $at_check_trace; $GREP 'Welcome to GNU libtool Fortran demo!' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:320"
$at_failed && at_fn_log_failure
$at_traceon; }


# Similarly, we can't reliably compare actual output with the following.
cat >expout <<'_ATEOF'
Welcome to GNU libtool mixed C/Fortran demo!
The C subroutine returned, claiming that 2*2 = 4
The C subroutine is ok!

Calling the C wrapper routine...
Calling the Fortran 77 subroutine from the C wrapper...
 fsub called
 fsubf called
Returned from the Fortran 77 subroutine...
The C wrapper to the fortran subroutine returned,
claiming that 2*2 = 4
The Fortran 77 subroutine is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac
lt_exe=./cprogram; if test -f "./cprogram$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/f77demo.at:320: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "f77demo.at:320"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:320"
$at_failed && at_fn_log_failure
$at_traceon; }



# A weaker output content check that is agnostic to the issues above.
{ set +x
$as_echo "$at_srcdir/f77demo.at:320: \$GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout"
at_fn_check_prepare_dynamic "$GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout" "f77demo.at:320"
( $at_check_trace; $GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:320"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_153
#AT_START_154
at_fn_group_banner 154 'f77demo.at:329' \
  "shared and static together" "                     " 24
at_xfail=no
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "154. $at_setup_line: testing $at_desc ..."
  $at_traceon



{ set +x
$as_echo "$at_srcdir/f77demo.at:331: { test -n \"\$F77\" && test \"X\$F77\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$F77\" && test \"X$F77\" != Xno; } || (exit 77)" "f77demo.at:331"
( $at_check_trace; { test -n "$F77" && test "X$F77" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:331"
$at_failed && at_fn_log_failure
$at_traceon; }





cat >configure.ac <<'_ATEOF'
AC_INIT([f77demo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE
AC_PROG_CC

AC_PROG_F77
dnl When configuring for 'make dist' purposes, skip checks that may yield fatal
dnl errors when there is no working F77 compiler.
if test -z "$with_dist"; then
  dnl Check the flags needed to link f77 programs with ld (i.e. cc)
  AC_F77_LIBRARY_LDFLAGS
  dnl Check for underscoring of external names
  AC_F77_WRAPPERS
fi
LT_INIT
AC_SUBST([LIBTOOL_DEPS])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

lib_LTLIBRARIES = libfoo.la libmix.la libfoo2.la libfoo3.la

libfoo_la_SOURCES = foof.f
libfoo_la_LIBADD = libfoo2.la
libfoo_la_LDFLAGS = -no-undefined

libfoo2_la_SOURCES = foof2.f
libfoo2_la_LDFLAGS = -no-undefined

libfoo3_la_SOURCES = foof3.f
libfoo3_la_LDFLAGS = -no-undefined

libmix_la_SOURCES = foof.f foof2.f fooc.c
libmix_la_LDFLAGS = -no-undefined

noinst_HEADERS = foo.h

bin_PROGRAMS = fprogram cprogram

fprogram_SOURCES = fprogram.f
fprogram_LDADD = libfoo.la libfoo3.la

cprogram_SOURCES = cprogram.c
cprogram_LDADD = libmix.la $(FLIBS)

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck
_ATEOF


cat >fprogram.f <<'_ATEOF'
      program fprogram
      implicit none
      integer*4 arg,res

      write(*,*) 'Welcome to GNU libtool Fortran demo!'
      write(*,*) 'Real programmers write in FORTRAN.'
      arg=2

      call fsub(arg,res)

      write(*,*) 'fsub returned, saying that 2 *',arg,' =',res

      if (res.eq.4) then
         write(*,*) 'fsub is ok!'
      endif

      call fsub3(arg,res)

      write(*,*) 'fsub3 returned, saying that 4 *',arg,' =',res

      if (res.eq.8) then
         write(*,*) 'fsub3 is ok!'
      endif

      stop
      end
_ATEOF


cat >cprogram.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int
main ()
{
  int arg,cres,fres;

  printf ("Welcome to GNU libtool mixed C/Fortran demo!\n");

  arg=2;

  cres=csub(arg);

  printf ("The C subroutine returned, claiming that 2*%d = %d\n",arg,cres);

  if(cres==2*arg)
    printf ("The C subroutine is ok!\n");

  printf("\nCalling the C wrapper routine...\n");
  fres=fwrapper(arg);

  printf ("The C wrapper to the fortran subroutine returned,\n"
	  "claiming that 2*%d = %d\n",arg,fres);

  if(fres==2*arg)
    printf ("The Fortran 77 subroutine is ok!\n");

  return 0;
}
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef _FOO_H_
#define _FOO_H_ 1

/* config.h is necessary for the fortran name mangling */
#include <config.h>

/* csub is an extremely useful subroutine that
 * returns the argument multiplied by two :-)
 */
extern int csub(int);

/* This routine performs the same action, but
 * calls the fortran subroutine fsub to do the
 * real work.
 */
extern int fwrapper(int);

/* fsub does the same thing as csub, i.e. res=arg*2.
 * Use autoconf macro for fortran function names.
 * Note that fortran passes args by reference, so
 * you need to provide pointers to your ints.
 */
extern
#ifdef __cplusplus
"C"
#endif
void F77_FUNC(fsub,FSUB)(int *arg, int *res);

#endif
_ATEOF


cat >fooc.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int csub(int arg)
{
  return (2*arg);
}


int fwrapper(int arg)
{
  int res;
  printf("Calling the Fortran 77 subroutine from the C wrapper...\n");
  F77_FUNC(fsub,FSUB)(&arg,&res);
  printf("Returned from the Fortran 77 subroutine...\n");
  return res;
}
_ATEOF


cat >foof.f <<'_ATEOF'
      subroutine fsub(arg,res)
      write(*,*) 'fsub called'
      call fsubf(arg,res)
      return
      end
_ATEOF


cat >foof2.f <<'_ATEOF'
      subroutine fsubf(arg,res)
      implicit none
      integer*4 arg,res
      write(*,*) 'fsubf called'
      res=arg*2
      return
      end
_ATEOF


cat >foof3.f <<'_ATEOF'
      subroutine fsub3(arg,res)
      implicit none
      integer*4 arg,res
      write(*,*) 'fsub3 called'
      res=arg*4
      return
      end
_ATEOF


{ set +x
$as_echo "$at_srcdir/f77demo.at:331: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "f77demo.at:331"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:331"
$at_failed && at_fn_log_failure
$at_traceon; }






$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/f77demo.at:333: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "f77demo.at:333"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:333"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/f77demo.at:333: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "f77demo.at:333"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:333"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/f77demo.at:333: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "f77demo.at:333"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:333"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/f77demo.at:333: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "f77demo.at:333"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/f77demo.at:333"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/f77demo.at:333: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "f77demo.at:333"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:333"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/f77demo.at:333: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "f77demo.at:333"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:333"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/f77demo.at:333: \$EGREP '^build_old_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=yes' libtool" "f77demo.at:333"
( $at_check_trace; $EGREP '^build_old_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:333"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/f77demo.at:333: \$EGREP '^build_libtool_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=yes' libtool" "f77demo.at:333"
( $at_check_trace; $EGREP '^build_libtool_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:333"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/f77demo.at:335: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "f77demo.at:335"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:335"
$at_failed && at_fn_log_failure
$at_traceon; }

done


# Due to differences in line-endings between C stdout and Fortran
# stdout, as well as unpredictable output ordering between platforms
# and runtimes, we can't reliably check the output here... although
# it should be some variation of the following:
cat >expout <<'_ATEOF'
 Welcome to GNU libtool Fortran demo!
 Real programmers write in FORTRAN.
 fsub called
 fsubf called
 fsub returned, saying that 2 *           2  =           4
 fsub is ok!
 fsub3 called
 fsub3 returned, saying that 4 *           2  =           8
 fsub3 is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac
lt_exe=./fprogram; if test -f "./fprogram$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/f77demo.at:335: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "f77demo.at:335"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:335"
$at_failed && at_fn_log_failure
$at_traceon; }



# A weaker output content check that is agnostic to the issues above.
{ set +x
$as_echo "$at_srcdir/f77demo.at:335: \$GREP 'Welcome to GNU libtool Fortran demo!' stdout"
at_fn_check_prepare_dynamic "$GREP 'Welcome to GNU libtool Fortran demo!' stdout" "f77demo.at:335"
( $at_check_trace; $GREP 'Welcome to GNU libtool Fortran demo!' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:335"
$at_failed && at_fn_log_failure
$at_traceon; }


# Similarly, we can't reliably compare actual output with the following.
cat >expout <<'_ATEOF'
Welcome to GNU libtool mixed C/Fortran demo!
The C subroutine returned, claiming that 2*2 = 4
The C subroutine is ok!

Calling the C wrapper routine...
Calling the Fortran 77 subroutine from the C wrapper...
 fsub called
 fsubf called
Returned from the Fortran 77 subroutine...
The C wrapper to the fortran subroutine returned,
claiming that 2*2 = 4
The Fortran 77 subroutine is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac
lt_exe=./cprogram; if test -f "./cprogram$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/f77demo.at:335: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "f77demo.at:335"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:335"
$at_failed && at_fn_log_failure
$at_traceon; }



# A weaker output content check that is agnostic to the issues above.
{ set +x
$as_echo "$at_srcdir/f77demo.at:335: \$GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout"
at_fn_check_prepare_dynamic "$GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout" "f77demo.at:335"
( $at_check_trace; $GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/f77demo.at:335"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_154
#AT_START_155
at_fn_group_banner 155 'fcdemo.at:310' \
  "static library" "                                 " 25
at_xfail=no
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "155. $at_setup_line: testing $at_desc ..."
  $at_traceon


# Executing the static fprogram might be interactive on MSYS.



{ set +x
$as_echo "$at_srcdir/fcdemo.at:315: { test -n \"\$FC\" && test \"X\$FC\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$FC\" && test \"X$FC\" != Xno; } || (exit 77)" "fcdemo.at:315"
( $at_check_trace; { test -n "$FC" && test "X$FC" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:315"
$at_failed && at_fn_log_failure
$at_traceon; }

# Autoconf will accept f77 or similar as a valid FC, but often f77
   # will not compile fortran90 code; in that case skip the FC checks.
   cat >fc_test.f90 <<'_ATEOF'
	program main

	end
_ATEOF

   { set +x
$as_echo "$at_srcdir/fcdemo.at:315: \$FC \$FCFLAGS fc_test.f90 || exit 77"
at_fn_check_prepare_dynamic "$FC $FCFLAGS fc_test.f90 || exit 77" "fcdemo.at:315"
( $at_check_trace; $FC $FCFLAGS fc_test.f90 || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:315"
$at_failed && at_fn_log_failure
$at_traceon; }




cat >configure.ac <<'_ATEOF'
AC_INIT([fcdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE
AC_PROG_CC

AC_LANG_PUSH([Fortran])
AC_PROG_FC
dnl Check the flags needed to link fc programs with ld (i.e. cc)
AC_FC_LIBRARY_LDFLAGS
dnl Check for underscoring of external names
AC_FC_WRAPPERS
dnl We need to use .f90 and not .f to enable Automake FC support
dnl Some Intel ifc/ifort do not understand .f95.  :-/
AC_FC_SRCEXT([f90])
dnl Yes, we want free-form Fortran!
AC_FC_FREEFORM
AC_LANG_POP

LT_INIT
AC_SUBST([LIBTOOL_DEPS])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

lib_LTLIBRARIES = libfoo.la libmix.la libfoo2.la libfoo3.la

libfoo_la_SOURCES = foof.f90
libfoo_la_LIBADD = libfoo2.la
libfoo_la_LDFLAGS = -no-undefined

libfoo2_la_SOURCES = foof2.f90
libfoo2_la_LDFLAGS = -no-undefined

libfoo3_la_SOURCES = foof3.f90
libfoo3_la_LDFLAGS = -no-undefined

libmix_la_SOURCES = foof.f90 foof2.f90 fooc.c
libmix_la_LDFLAGS = -no-undefined

noinst_HEADERS = foo.h

bin_PROGRAMS = fprogram cprogram

fprogram_SOURCES = fprogram.f90
fprogram_LDADD = libfoo.la libfoo3.la

cprogram_SOURCES = cprogram.c
cprogram_LDADD = libmix.la $(FCLIBS)

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

# Work around Automake bug, where FCFLAGS_f90 is not provided:
.f90.o:
	$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<

.f90.obj:
	$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'`

.f90.lo:
	$(LTFCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
_ATEOF


cat >fprogram.f90 <<'_ATEOF'
program fprogram
  implicit none
  integer arg,res

  write(*,*) 'Welcome to GNU libtool Fortran demo!'
  write(*,*) 'Real programmers write in FORTRAN.'
  arg=2

  call fsub(arg,res)

  write(*,*) 'fsub returned, saying that 2 *',arg,' =',res

  if (res.eq.4) then
     write(*,*) 'fsub is ok!'
  endif

  call fsub3(arg,res)

  write(*,*) 'fsub3 returned, saying that 4 *',arg,' =',res

  if (res.eq.8) then
     write(*,*) 'fsub3 is ok!'
  endif

  stop
end
_ATEOF


cat >cprogram.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int
main ()
{
  int arg,cres,fres;

  printf ("Welcome to GNU libtool mixed C/Fortran demo!\n");

  arg=2;

  cres=csub (arg);

  printf ("The C subroutine returned, claiming that 2*%d = %d\n",arg,cres);

  if (cres == 2*arg)
    printf ("The C subroutine is ok!\n");

  printf ("\nCalling the C wrapper routine...\n");
  fres = fwrapper (arg);

  printf ("The C wrapper to the fortran subroutine returned,\n"
	  "claiming that 2*%d = %d\n",arg,fres);

  if (fres == 2*arg)
    printf ("The Fortran subroutine is ok!\n");

  return 0;
}
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef _FOO_H_
#define _FOO_H_ 1

/* config.h is necessary for the fortran name mangling */
#include <config.h>

/* csub is an extremely useful subroutine that
 * returns the argument multiplied by two :-)
 */
extern int csub(int);

/* This routine performs the same action, but
 * calls the fortran subroutine fsub to do the
 * real work.
 */
extern int fwrapper(int);

/* fsub does the same thing as csub, i.e. res=arg*2.
 * Use autoconf macro for fortran function names.
 * Note that fortran passes args by reference, so
 * you need to provide pointers to your ints.
 */
extern
#ifdef __cplusplus
"C"
#endif
void FC_FUNC(fsub,FSUB)(int *arg, int *res);

#endif
_ATEOF


cat >fooc.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int csub(int arg)
{
  return (2*arg);
}


int fwrapper(int arg)
{
  int res;
  printf("Calling the Fortran subroutine from the C wrapper...\n");
  FC_FUNC(fsub,FSUB)(&arg,&res);
  printf("Returned from the Fortran subroutine...\n");
  return res;
}
_ATEOF


cat >foof.f90 <<'_ATEOF'
subroutine fsub(arg,res)
  write(*,*) 'fsub called'
  call fsubf(arg,res)
  return
end
_ATEOF


cat >foof2.f90 <<'_ATEOF'
subroutine fsubf(arg,res)
  implicit none
  integer arg,res
  write(*,*) 'fsubf called'
  res=arg*2
  return
end
_ATEOF


cat >foof3.f90 <<'_ATEOF'
subroutine fsub3(arg,res)
  implicit none
  integer arg,res
  write(*,*) 'fsub3 called'
  res=arg*4
  return
end
_ATEOF


{ set +x
$as_echo "$at_srcdir/fcdemo.at:315: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "fcdemo.at:315"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:315"
$at_failed && at_fn_log_failure
$at_traceon; }






$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/fcdemo.at:317: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "fcdemo.at:317"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:317"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/fcdemo.at:317: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "fcdemo.at:317"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:317"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/fcdemo.at:317: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "fcdemo.at:317"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:317"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/fcdemo.at:317: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "fcdemo.at:317"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/fcdemo.at:317"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/fcdemo.at:317: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "fcdemo.at:317"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:317"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/fcdemo.at:317: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-shared"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "fcdemo.at:317"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-shared
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:317"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/fcdemo.at:317: \$EGREP '^build_old_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=yes' libtool" "fcdemo.at:317"
( $at_check_trace; $EGREP '^build_old_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:317"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/fcdemo.at:317: \$EGREP '^build_libtool_libs=no' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=no' libtool" "fcdemo.at:317"
( $at_check_trace; $EGREP '^build_libtool_libs=no' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:317"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/fcdemo.at:319: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "fcdemo.at:319"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:319"
$at_failed && at_fn_log_failure
$at_traceon; }

done


# Due to differences in line-endings between C stdout and Fortran
# stdout, as well as unpredictable output ordering between platforms
# and runtimes, we can't reliably check the output here... although
# it should be some variation of the following:
cat >expout <<'_ATEOF'
 Welcome to GNU libtool Fortran demo!
 Real programmers write in FORTRAN.
 fsub called
 fsubf called
 fsub returned, saying that 2 *           2  =           4
 fsub is ok!
 fsub3 called
 fsub3 returned, saying that 4 *           2  =           8
 fsub3 is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac
lt_exe=./fprogram; if test -f "./fprogram$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/fcdemo.at:319: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "fcdemo.at:319"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:319"
$at_failed && at_fn_log_failure
$at_traceon; }



# A weaker output content check that is agnostic to the issues above.
{ set +x
$as_echo "$at_srcdir/fcdemo.at:319: \$GREP 'Welcome to GNU libtool Fortran demo!' stdout"
at_fn_check_prepare_dynamic "$GREP 'Welcome to GNU libtool Fortran demo!' stdout" "fcdemo.at:319"
( $at_check_trace; $GREP 'Welcome to GNU libtool Fortran demo!' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:319"
$at_failed && at_fn_log_failure
$at_traceon; }


# Similarly, we can't reliably compare actual output with the following.
cat >expout <<'_ATEOF'
Welcome to GNU libtool mixed C/Fortran demo!
The C subroutine returned, claiming that 2*2 = 4
The C subroutine is ok!

Calling the C wrapper routine...
Calling the Fortran subroutine from the C wrapper...
 fsub called
 fsubf called
Returned from the Fortran subroutine...
The C wrapper to the fortran subroutine returned,
claiming that 2*2 = 4
The Fortran subroutine is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac
lt_exe=./cprogram; if test -f "./cprogram$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/fcdemo.at:319: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "fcdemo.at:319"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:319"
$at_failed && at_fn_log_failure
$at_traceon; }



# A weaker output content check that is agnostic to the issues above.
{ set +x
$as_echo "$at_srcdir/fcdemo.at:319: \$GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout"
at_fn_check_prepare_dynamic "$GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout" "fcdemo.at:319"
( $at_check_trace; $GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:319"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_155
#AT_START_156
at_fn_group_banner 156 'fcdemo.at:328' \
  "shared library" "                                 " 25
at_xfail=no
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "156. $at_setup_line: testing $at_desc ..."
  $at_traceon



{ set +x
$as_echo "$at_srcdir/fcdemo.at:330: { test -n \"\$FC\" && test \"X\$FC\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$FC\" && test \"X$FC\" != Xno; } || (exit 77)" "fcdemo.at:330"
( $at_check_trace; { test -n "$FC" && test "X$FC" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:330"
$at_failed && at_fn_log_failure
$at_traceon; }

# Autoconf will accept f77 or similar as a valid FC, but often f77
   # will not compile fortran90 code; in that case skip the FC checks.
   cat >fc_test.f90 <<'_ATEOF'
	program main

	end
_ATEOF

   { set +x
$as_echo "$at_srcdir/fcdemo.at:330: \$FC \$FCFLAGS fc_test.f90 || exit 77"
at_fn_check_prepare_dynamic "$FC $FCFLAGS fc_test.f90 || exit 77" "fcdemo.at:330"
( $at_check_trace; $FC $FCFLAGS fc_test.f90 || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:330"
$at_failed && at_fn_log_failure
$at_traceon; }




cat >configure.ac <<'_ATEOF'
AC_INIT([fcdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE
AC_PROG_CC

AC_LANG_PUSH([Fortran])
AC_PROG_FC
dnl Check the flags needed to link fc programs with ld (i.e. cc)
AC_FC_LIBRARY_LDFLAGS
dnl Check for underscoring of external names
AC_FC_WRAPPERS
dnl We need to use .f90 and not .f to enable Automake FC support
dnl Some Intel ifc/ifort do not understand .f95.  :-/
AC_FC_SRCEXT([f90])
dnl Yes, we want free-form Fortran!
AC_FC_FREEFORM
AC_LANG_POP

LT_INIT
AC_SUBST([LIBTOOL_DEPS])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

lib_LTLIBRARIES = libfoo.la libmix.la libfoo2.la libfoo3.la

libfoo_la_SOURCES = foof.f90
libfoo_la_LIBADD = libfoo2.la
libfoo_la_LDFLAGS = -no-undefined

libfoo2_la_SOURCES = foof2.f90
libfoo2_la_LDFLAGS = -no-undefined

libfoo3_la_SOURCES = foof3.f90
libfoo3_la_LDFLAGS = -no-undefined

libmix_la_SOURCES = foof.f90 foof2.f90 fooc.c
libmix_la_LDFLAGS = -no-undefined

noinst_HEADERS = foo.h

bin_PROGRAMS = fprogram cprogram

fprogram_SOURCES = fprogram.f90
fprogram_LDADD = libfoo.la libfoo3.la

cprogram_SOURCES = cprogram.c
cprogram_LDADD = libmix.la $(FCLIBS)

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

# Work around Automake bug, where FCFLAGS_f90 is not provided:
.f90.o:
	$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<

.f90.obj:
	$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'`

.f90.lo:
	$(LTFCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
_ATEOF


cat >fprogram.f90 <<'_ATEOF'
program fprogram
  implicit none
  integer arg,res

  write(*,*) 'Welcome to GNU libtool Fortran demo!'
  write(*,*) 'Real programmers write in FORTRAN.'
  arg=2

  call fsub(arg,res)

  write(*,*) 'fsub returned, saying that 2 *',arg,' =',res

  if (res.eq.4) then
     write(*,*) 'fsub is ok!'
  endif

  call fsub3(arg,res)

  write(*,*) 'fsub3 returned, saying that 4 *',arg,' =',res

  if (res.eq.8) then
     write(*,*) 'fsub3 is ok!'
  endif

  stop
end
_ATEOF


cat >cprogram.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int
main ()
{
  int arg,cres,fres;

  printf ("Welcome to GNU libtool mixed C/Fortran demo!\n");

  arg=2;

  cres=csub (arg);

  printf ("The C subroutine returned, claiming that 2*%d = %d\n",arg,cres);

  if (cres == 2*arg)
    printf ("The C subroutine is ok!\n");

  printf ("\nCalling the C wrapper routine...\n");
  fres = fwrapper (arg);

  printf ("The C wrapper to the fortran subroutine returned,\n"
	  "claiming that 2*%d = %d\n",arg,fres);

  if (fres == 2*arg)
    printf ("The Fortran subroutine is ok!\n");

  return 0;
}
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef _FOO_H_
#define _FOO_H_ 1

/* config.h is necessary for the fortran name mangling */
#include <config.h>

/* csub is an extremely useful subroutine that
 * returns the argument multiplied by two :-)
 */
extern int csub(int);

/* This routine performs the same action, but
 * calls the fortran subroutine fsub to do the
 * real work.
 */
extern int fwrapper(int);

/* fsub does the same thing as csub, i.e. res=arg*2.
 * Use autoconf macro for fortran function names.
 * Note that fortran passes args by reference, so
 * you need to provide pointers to your ints.
 */
extern
#ifdef __cplusplus
"C"
#endif
void FC_FUNC(fsub,FSUB)(int *arg, int *res);

#endif
_ATEOF


cat >fooc.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int csub(int arg)
{
  return (2*arg);
}


int fwrapper(int arg)
{
  int res;
  printf("Calling the Fortran subroutine from the C wrapper...\n");
  FC_FUNC(fsub,FSUB)(&arg,&res);
  printf("Returned from the Fortran subroutine...\n");
  return res;
}
_ATEOF


cat >foof.f90 <<'_ATEOF'
subroutine fsub(arg,res)
  write(*,*) 'fsub called'
  call fsubf(arg,res)
  return
end
_ATEOF


cat >foof2.f90 <<'_ATEOF'
subroutine fsubf(arg,res)
  implicit none
  integer arg,res
  write(*,*) 'fsubf called'
  res=arg*2
  return
end
_ATEOF


cat >foof3.f90 <<'_ATEOF'
subroutine fsub3(arg,res)
  implicit none
  integer arg,res
  write(*,*) 'fsub3 called'
  res=arg*4
  return
end
_ATEOF


{ set +x
$as_echo "$at_srcdir/fcdemo.at:330: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "fcdemo.at:330"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:330"
$at_failed && at_fn_log_failure
$at_traceon; }






$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/fcdemo.at:332: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "fcdemo.at:332"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:332"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/fcdemo.at:332: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "fcdemo.at:332"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:332"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/fcdemo.at:332: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "fcdemo.at:332"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:332"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/fcdemo.at:332: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "fcdemo.at:332"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/fcdemo.at:332"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/fcdemo.at:332: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "fcdemo.at:332"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:332"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/fcdemo.at:332: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" --disable-static"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "fcdemo.at:332"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --disable-static
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:332"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/fcdemo.at:332: \$EGREP '^build_old_libs=no' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=no' libtool" "fcdemo.at:332"
( $at_check_trace; $EGREP '^build_old_libs=no' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:332"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/fcdemo.at:332: \$EGREP '^build_libtool_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=yes' libtool" "fcdemo.at:332"
( $at_check_trace; $EGREP '^build_libtool_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:332"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/fcdemo.at:334: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "fcdemo.at:334"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:334"
$at_failed && at_fn_log_failure
$at_traceon; }

done


# Due to differences in line-endings between C stdout and Fortran
# stdout, as well as unpredictable output ordering between platforms
# and runtimes, we can't reliably check the output here... although
# it should be some variation of the following:
cat >expout <<'_ATEOF'
 Welcome to GNU libtool Fortran demo!
 Real programmers write in FORTRAN.
 fsub called
 fsubf called
 fsub returned, saying that 2 *           2  =           4
 fsub is ok!
 fsub3 called
 fsub3 returned, saying that 4 *           2  =           8
 fsub3 is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac
lt_exe=./fprogram; if test -f "./fprogram$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/fcdemo.at:334: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "fcdemo.at:334"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:334"
$at_failed && at_fn_log_failure
$at_traceon; }



# A weaker output content check that is agnostic to the issues above.
{ set +x
$as_echo "$at_srcdir/fcdemo.at:334: \$GREP 'Welcome to GNU libtool Fortran demo!' stdout"
at_fn_check_prepare_dynamic "$GREP 'Welcome to GNU libtool Fortran demo!' stdout" "fcdemo.at:334"
( $at_check_trace; $GREP 'Welcome to GNU libtool Fortran demo!' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:334"
$at_failed && at_fn_log_failure
$at_traceon; }


# Similarly, we can't reliably compare actual output with the following.
cat >expout <<'_ATEOF'
Welcome to GNU libtool mixed C/Fortran demo!
The C subroutine returned, claiming that 2*2 = 4
The C subroutine is ok!

Calling the C wrapper routine...
Calling the Fortran subroutine from the C wrapper...
 fsub called
 fsubf called
Returned from the Fortran subroutine...
The C wrapper to the fortran subroutine returned,
claiming that 2*2 = 4
The Fortran subroutine is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac
lt_exe=./cprogram; if test -f "./cprogram$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/fcdemo.at:334: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "fcdemo.at:334"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:334"
$at_failed && at_fn_log_failure
$at_traceon; }



# A weaker output content check that is agnostic to the issues above.
{ set +x
$as_echo "$at_srcdir/fcdemo.at:334: \$GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout"
at_fn_check_prepare_dynamic "$GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout" "fcdemo.at:334"
( $at_check_trace; $GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:334"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_156
#AT_START_157
at_fn_group_banner 157 'fcdemo.at:343' \
  "shared and static together" "                     " 25
at_xfail=no
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOHEADER" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "157. $at_setup_line: testing $at_desc ..."
  $at_traceon



{ set +x
$as_echo "$at_srcdir/fcdemo.at:345: { test -n \"\$FC\" && test \"X\$FC\" != Xno; } || (exit 77)"
at_fn_check_prepare_dynamic "{ test -n \"$FC\" && test \"X$FC\" != Xno; } || (exit 77)" "fcdemo.at:345"
( $at_check_trace; { test -n "$FC" && test "X$FC" != Xno; } || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:345"
$at_failed && at_fn_log_failure
$at_traceon; }

# Autoconf will accept f77 or similar as a valid FC, but often f77
   # will not compile fortran90 code; in that case skip the FC checks.
   cat >fc_test.f90 <<'_ATEOF'
	program main

	end
_ATEOF

   { set +x
$as_echo "$at_srcdir/fcdemo.at:345: \$FC \$FCFLAGS fc_test.f90 || exit 77"
at_fn_check_prepare_dynamic "$FC $FCFLAGS fc_test.f90 || exit 77" "fcdemo.at:345"
( $at_check_trace; $FC $FCFLAGS fc_test.f90 || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:345"
$at_failed && at_fn_log_failure
$at_traceon; }




cat >configure.ac <<'_ATEOF'
AC_INIT([fcdemo], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE
AC_PROG_CC

AC_LANG_PUSH([Fortran])
AC_PROG_FC
dnl Check the flags needed to link fc programs with ld (i.e. cc)
AC_FC_LIBRARY_LDFLAGS
dnl Check for underscoring of external names
AC_FC_WRAPPERS
dnl We need to use .f90 and not .f to enable Automake FC support
dnl Some Intel ifc/ifort do not understand .f95.  :-/
AC_FC_SRCEXT([f90])
dnl Yes, we want free-form Fortran!
AC_FC_FREEFORM
AC_LANG_POP

LT_INIT
AC_SUBST([LIBTOOL_DEPS])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I m4

lib_LTLIBRARIES = libfoo.la libmix.la libfoo2.la libfoo3.la

libfoo_la_SOURCES = foof.f90
libfoo_la_LIBADD = libfoo2.la
libfoo_la_LDFLAGS = -no-undefined

libfoo2_la_SOURCES = foof2.f90
libfoo2_la_LDFLAGS = -no-undefined

libfoo3_la_SOURCES = foof3.f90
libfoo3_la_LDFLAGS = -no-undefined

libmix_la_SOURCES = foof.f90 foof2.f90 fooc.c
libmix_la_LDFLAGS = -no-undefined

noinst_HEADERS = foo.h

bin_PROGRAMS = fprogram cprogram

fprogram_SOURCES = fprogram.f90
fprogram_LDADD = libfoo.la libfoo3.la

cprogram_SOURCES = cprogram.c
cprogram_LDADD = libmix.la $(FCLIBS)

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

# Work around Automake bug, where FCFLAGS_f90 is not provided:
.f90.o:
	$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<

.f90.obj:
	$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'`

.f90.lo:
	$(LTFCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
_ATEOF


cat >fprogram.f90 <<'_ATEOF'
program fprogram
  implicit none
  integer arg,res

  write(*,*) 'Welcome to GNU libtool Fortran demo!'
  write(*,*) 'Real programmers write in FORTRAN.'
  arg=2

  call fsub(arg,res)

  write(*,*) 'fsub returned, saying that 2 *',arg,' =',res

  if (res.eq.4) then
     write(*,*) 'fsub is ok!'
  endif

  call fsub3(arg,res)

  write(*,*) 'fsub3 returned, saying that 4 *',arg,' =',res

  if (res.eq.8) then
     write(*,*) 'fsub3 is ok!'
  endif

  stop
end
_ATEOF


cat >cprogram.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int
main ()
{
  int arg,cres,fres;

  printf ("Welcome to GNU libtool mixed C/Fortran demo!\n");

  arg=2;

  cres=csub (arg);

  printf ("The C subroutine returned, claiming that 2*%d = %d\n",arg,cres);

  if (cres == 2*arg)
    printf ("The C subroutine is ok!\n");

  printf ("\nCalling the C wrapper routine...\n");
  fres = fwrapper (arg);

  printf ("The C wrapper to the fortran subroutine returned,\n"
	  "claiming that 2*%d = %d\n",arg,fres);

  if (fres == 2*arg)
    printf ("The Fortran subroutine is ok!\n");

  return 0;
}
_ATEOF


cat >foo.h <<'_ATEOF'
#ifndef _FOO_H_
#define _FOO_H_ 1

/* config.h is necessary for the fortran name mangling */
#include <config.h>

/* csub is an extremely useful subroutine that
 * returns the argument multiplied by two :-)
 */
extern int csub(int);

/* This routine performs the same action, but
 * calls the fortran subroutine fsub to do the
 * real work.
 */
extern int fwrapper(int);

/* fsub does the same thing as csub, i.e. res=arg*2.
 * Use autoconf macro for fortran function names.
 * Note that fortran passes args by reference, so
 * you need to provide pointers to your ints.
 */
extern
#ifdef __cplusplus
"C"
#endif
void FC_FUNC(fsub,FSUB)(int *arg, int *res);

#endif
_ATEOF


cat >fooc.c <<'_ATEOF'
#include <config.h>
#include <stdio.h>

#include "foo.h"

int csub(int arg)
{
  return (2*arg);
}


int fwrapper(int arg)
{
  int res;
  printf("Calling the Fortran subroutine from the C wrapper...\n");
  FC_FUNC(fsub,FSUB)(&arg,&res);
  printf("Returned from the Fortran subroutine...\n");
  return res;
}
_ATEOF


cat >foof.f90 <<'_ATEOF'
subroutine fsub(arg,res)
  write(*,*) 'fsub called'
  call fsubf(arg,res)
  return
end
_ATEOF


cat >foof2.f90 <<'_ATEOF'
subroutine fsubf(arg,res)
  implicit none
  integer arg,res
  write(*,*) 'fsubf called'
  res=arg*2
  return
end
_ATEOF


cat >foof3.f90 <<'_ATEOF'
subroutine fsub3(arg,res)
  implicit none
  integer arg,res
  write(*,*) 'fsub3 called'
  res=arg*4
  return
end
_ATEOF


{ set +x
$as_echo "$at_srcdir/fcdemo.at:345: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "fcdemo.at:345"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:345"
$at_failed && at_fn_log_failure
$at_traceon; }






$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I m4$macro_dir"; { set +x
$as_echo "$at_srcdir/fcdemo.at:347: \$ACLOCAL -I m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I m4$macro_dir" "fcdemo.at:347"
( $at_check_trace; $ACLOCAL -I m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:347"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1



{ set +x
$as_echo "$at_srcdir/fcdemo.at:347: \$AUTOHEADER "
at_fn_check_prepare_dynamic "$AUTOHEADER " "fcdemo.at:347"
( $at_check_trace; $AUTOHEADER
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:347"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/fcdemo.at:347: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "fcdemo.at:347"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:347"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/fcdemo.at:347: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "fcdemo.at:347"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/fcdemo.at:347"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/fcdemo.at:347: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "fcdemo.at:347"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:347"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/fcdemo.at:347: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "fcdemo.at:347"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:347"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/fcdemo.at:347: \$EGREP '^build_old_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_old_libs=yes' libtool" "fcdemo.at:347"
( $at_check_trace; $EGREP '^build_old_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:347"
$at_failed && at_fn_log_failure
$at_traceon; }

 { set +x
$as_echo "$at_srcdir/fcdemo.at:347: \$EGREP '^build_libtool_libs=yes' libtool"
at_fn_check_prepare_dynamic "$EGREP '^build_libtool_libs=yes' libtool" "fcdemo.at:347"
( $at_check_trace; $EGREP '^build_libtool_libs=yes' libtool
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:347"
$at_failed && at_fn_log_failure
$at_traceon; }





for target in all
do
  { set +x
$as_echo "$at_srcdir/fcdemo.at:349: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "fcdemo.at:349"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:349"
$at_failed && at_fn_log_failure
$at_traceon; }

done


# Due to differences in line-endings between C stdout and Fortran
# stdout, as well as unpredictable output ordering between platforms
# and runtimes, we can't reliably check the output here... although
# it should be some variation of the following:
cat >expout <<'_ATEOF'
 Welcome to GNU libtool Fortran demo!
 Real programmers write in FORTRAN.
 fsub called
 fsubf called
 fsub returned, saying that 2 *           2  =           4
 fsub is ok!
 fsub3 called
 fsub3 returned, saying that 4 *           2  =           8
 fsub3 is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac
lt_exe=./fprogram; if test -f "./fprogram$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/fcdemo.at:349: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "fcdemo.at:349"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:349"
$at_failed && at_fn_log_failure
$at_traceon; }



# A weaker output content check that is agnostic to the issues above.
{ set +x
$as_echo "$at_srcdir/fcdemo.at:349: \$GREP 'Welcome to GNU libtool Fortran demo!' stdout"
at_fn_check_prepare_dynamic "$GREP 'Welcome to GNU libtool Fortran demo!' stdout" "fcdemo.at:349"
( $at_check_trace; $GREP 'Welcome to GNU libtool Fortran demo!' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:349"
$at_failed && at_fn_log_failure
$at_traceon; }


# Similarly, we can't reliably compare actual output with the following.
cat >expout <<'_ATEOF'
Welcome to GNU libtool mixed C/Fortran demo!
The C subroutine returned, claiming that 2*2 = 4
The C subroutine is ok!

Calling the C wrapper routine...
Calling the Fortran subroutine from the C wrapper...
 fsub called
 fsubf called
Returned from the Fortran subroutine...
The C wrapper to the fortran subroutine returned,
claiming that 2*2 = 4
The Fortran subroutine is ok!
_ATEOF

case $host_os in mingw*)
  awk '{printf ("%s\r\n", $0);}' < expout > expout.t && mv -f expout.t expout ;;
esac
lt_exe=./cprogram; if test -f "./cprogram$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/fcdemo.at:349: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "fcdemo.at:349"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:349"
$at_failed && at_fn_log_failure
$at_traceon; }



# A weaker output content check that is agnostic to the issues above.
{ set +x
$as_echo "$at_srcdir/fcdemo.at:349: \$GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout"
at_fn_check_prepare_dynamic "$GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout" "fcdemo.at:349"
( $at_check_trace; $GREP 'Welcome to GNU libtool mixed C/Fortran demo!' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/fcdemo.at:349"
$at_failed && at_fn_log_failure
$at_traceon; }



  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_157
#AT_START_158
at_fn_group_banner 158 'darwin.at:27' \
  "darwin fat compile" "                             " 26
at_xfail=no
(
  $as_echo "158. $at_setup_line: testing $at_desc ..."
  $at_traceon

noskip=:
case $host_os in
darwin*) ;;
*) noskip=false ;;
esac

cat >simple.c  <<'_ATEOF'

int main() { return 0;}
_ATEOF


$noskip && {
$CC $CPPFLAGS $CFLAGS -arch x86_64 -arch i386 -o simple simple.c 2>&1 > /dev/null || noskip=false
rm -f simple
}

{ set +x
$as_echo "$at_srcdir/darwin.at:43: \$noskip || (exit 77)"
at_fn_check_prepare_dynamic "$noskip || (exit 77)" "darwin.at:43"
( $at_check_trace; $noskip || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:43"
$at_failed && at_fn_log_failure
$at_traceon; }


cat >foo.c <<'_ATEOF'

int x=0;
_ATEOF


cat >baz.c <<'_ATEOF'

int y=0;
_ATEOF


cat >bar.c <<'_ATEOF'

extern int x;
int bar(void);
int bar() { return x;}
_ATEOF


cat >main.c <<'_ATEOF'

extern int x;
extern int y;

int main() {
return x+y;
}
_ATEOF


mkdir bin
cat >bin/basename <<'_ATEOF'

#! /bin/sh

usage="usage: $0 argument"
if test $# != 1; then
                  echo $usage >&2
                  exit 1
fi

echo $1 | $SED "s|^.*/||"
_ATEOF


chmod +x bin/basename
save_PATH=$PATH
PATH=`pwd`/bin:$PATH
export PATH

{ set +x
$as_echo "$at_srcdir/darwin.at:86: \$LIBTOOL --mode=compile --tag=CC \$CC -c -o foo.lo \$CPPFLAGS \$CFLAGS -arch x86_64 -arch i386 foo.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CC $CC -c -o foo.lo $CPPFLAGS $CFLAGS -arch x86_64 -arch i386 foo.c" "darwin.at:86"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CC $CC -c -o foo.lo $CPPFLAGS $CFLAGS -arch x86_64 -arch i386 foo.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:86"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/darwin.at:88: \$LIBTOOL --mode=compile --tag=CC \$CC -c -o baz.lo \$CPPFLAGS \$CFLAGS -arch x86_64 -arch i386 baz.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CC $CC -c -o baz.lo $CPPFLAGS $CFLAGS -arch x86_64 -arch i386 baz.c" "darwin.at:88"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CC $CC -c -o baz.lo $CPPFLAGS $CFLAGS -arch x86_64 -arch i386 baz.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:88"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/darwin.at:90: \$LIBTOOL --mode=link --tag=CC \$CC -o libfoo.la \$CPPFLAGS \$CFLAGS \$LDFLAGS -arch x86_64 -arch i386 foo.lo baz.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC -o libfoo.la $CPPFLAGS $CFLAGS $LDFLAGS -arch x86_64 -arch i386 foo.lo baz.lo" "darwin.at:90"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC -o libfoo.la $CPPFLAGS $CFLAGS $LDFLAGS -arch x86_64 -arch i386 foo.lo baz.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:90"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/darwin.at:92: \$LIBTOOL --mode=compile --tag=CC \$CC -c -o bar.lo \$CPPFLAGS \$CFLAGS -arch x86_64 -arch i386 bar.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CC $CC -c -o bar.lo $CPPFLAGS $CFLAGS -arch x86_64 -arch i386 bar.c" "darwin.at:92"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CC $CC -c -o bar.lo $CPPFLAGS $CFLAGS -arch x86_64 -arch i386 bar.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:92"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/darwin.at:94: \$LIBTOOL --mode=link --tag=CC \$CC  -o libbar.la \$CPPFLAGS \$CFLAGS \$LDFLAGS -arch x86_64 -arch i386 bar.lo libfoo.la -rpath /nonexistent"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC  -o libbar.la $CPPFLAGS $CFLAGS $LDFLAGS -arch x86_64 -arch i386 bar.lo libfoo.la -rpath /nonexistent" "darwin.at:94"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC  -o libbar.la $CPPFLAGS $CFLAGS $LDFLAGS -arch x86_64 -arch i386 bar.lo libfoo.la -rpath /nonexistent
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:94"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/darwin.at:96: \$LIBTOOL --mode=compile --tag=CC \$CC -c -o main.lo \$CPPFLAGS \$CFLAGS -arch x86_64 -arch i386 main.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile --tag=CC $CC -c -o main.lo $CPPFLAGS $CFLAGS -arch x86_64 -arch i386 main.c" "darwin.at:96"
( $at_check_trace; $LIBTOOL --mode=compile --tag=CC $CC -c -o main.lo $CPPFLAGS $CFLAGS -arch x86_64 -arch i386 main.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:96"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/darwin.at:98: \$LIBTOOL --mode=link --tag=CC \$CC  -o main\$EXEEXT \$CPPFLAGS \$CFLAGS \$LDFLAGS -arch x86_64 -arch i386 main.lo libbar.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link --tag=CC $CC  -o main$EXEEXT $CPPFLAGS $CFLAGS $LDFLAGS -arch x86_64 -arch i386 main.lo libbar.la" "darwin.at:98"
( $at_check_trace; $LIBTOOL --mode=link --tag=CC $CC  -o main$EXEEXT $CPPFLAGS $CFLAGS $LDFLAGS -arch x86_64 -arch i386 main.lo libbar.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:98"
$at_failed && at_fn_log_failure
$at_traceon; }


PATH=$save_PATH
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_158
#AT_START_159
at_fn_group_banner 159 'darwin.at:104' \
  "darwin concurrent library extraction" "           " 26
at_xfail=no
(
  $as_echo "159. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >foo.c <<'_ATEOF'

int foo (void) { return 0; }
_ATEOF


cat >bar.c <<'_ATEOF'

extern int foo1 (void);
int bar (void) { return foo1 (); }
_ATEOF

cp bar.c baz.c

objects=
for obj in 1 2 3 4 5 6 7 8; do
  $SED "s/foo/foo$obj/" < foo.c > foo$obj.c
  { set +x
$as_echo "$at_srcdir/darwin.at:119: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c foo\$obj.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c foo$obj.c" "darwin.at:119"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c foo$obj.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:119"
$at_failed && at_fn_log_failure
$at_traceon; }

  objects="$objects foo$obj.lo"
done
{ set +x
$as_echo "$at_srcdir/darwin.at:123: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c bar.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c bar.c" "darwin.at:123"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c bar.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:123"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/darwin.at:125: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c baz.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c baz.c" "darwin.at:125"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c baz.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:125"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/darwin.at:127: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o libfoo.la \$objects"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libfoo.la $objects" "darwin.at:127"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libfoo.la $objects
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:127"
$at_failed && at_fn_log_failure
$at_traceon; }


# Hypothesis: concurrent convenience archive extraction works.
for i in 1 2 3 4 5; do
  rm -f libbar.la libbaz.la
  { set +x
$as_echo "$at_srcdir/darwin.at:133: (\$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS 	     -o libbar.la bar.lo -rpath /foo libfoo.la) & 	   (\$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS 	     -o libbaz.la baz.lo -rpath /foo libfoo.la) & 	   wait; test -f libbar.la && test -f libbaz.la"
at_fn_check_prepare_dynamic "($LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS 	     -o libbar.la bar.lo -rpath /foo libfoo.la) & 	   ($LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS 	     -o libbaz.la baz.lo -rpath /foo libfoo.la) & 	   wait; test -f libbar.la && test -f libbaz.la" "darwin.at:133"
( $at_check_trace; ($LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS 	     -o libbar.la bar.lo -rpath /foo libfoo.la) & 	   ($LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS 	     -o libbaz.la baz.lo -rpath /foo libfoo.la) & 	   wait; test -f libbar.la && test -f libbaz.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:133"
$at_failed && at_fn_log_failure
$at_traceon; }

done

# Hypothesis: the lock is not used in dry run mode.
eval "`$LIBTOOL --config | $EGREP '^(objdir)='`"
# Next line is internal detail.
lockfile=$objdir/libfoo.a.lock
echo stamp > $lockfile
{ set +x
$as_echo "$at_srcdir/darwin.at:146: \$LIBTOOL --dry-run --mode=link \$CC \$CFLAGS \$LDFLAGS 	  -o libbar.la bar.lo -rpath /foo libfoo.la"
at_fn_check_prepare_dynamic "$LIBTOOL --dry-run --mode=link $CC $CFLAGS $LDFLAGS 	  -o libbar.la bar.lo -rpath /foo libfoo.la" "darwin.at:146"
( $at_check_trace; $LIBTOOL --dry-run --mode=link $CC $CFLAGS $LDFLAGS 	  -o libbar.la bar.lo -rpath /foo libfoo.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:146"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/darwin.at:149: \$GREP stamp \$lockfile"
at_fn_check_prepare_dynamic "$GREP stamp $lockfile" "darwin.at:149"
( $at_check_trace; $GREP stamp $lockfile
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:149"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_159
#AT_START_160
at_fn_group_banner 160 'darwin.at:153' \
  "darwin gdb debug information" "                   " 26
at_xfail=no

eval "`$LIBTOOL --config | $EGREP '^(whole_archive_flag_spec)='`"
case $whole_archive_flag_spec:$host_os in
:darwin*) : ;;
*) false ;;
esac  && at_xfail=yes
(
  $as_echo "160. $at_setup_line: testing $at_desc ..."
  $at_traceon


{ set +x
$as_echo "$at_srcdir/darwin.at:155: gdb --version || (exit 77)"
at_fn_check_prepare_trace "darwin.at:155"
( $at_check_trace; gdb --version || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_skip $at_status "$at_srcdir/darwin.at:155"
$at_failed && at_fn_log_failure
$at_traceon; }


cat >foo.c <<'_ATEOF'

int foo (void) { return 0; }
_ATEOF


cat >bar.c <<'_ATEOF'

extern int foo (void);
int bar (void) { return foo (); }
_ATEOF


cat >main.c <<'_ATEOF'

extern int bar(void);

int main() { return bar();}
_ATEOF


{ set +x
$as_echo "$at_srcdir/darwin.at:172: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c bar.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c bar.c" "darwin.at:172"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c bar.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:172"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/darwin.at:174: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c foo.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c foo.c" "darwin.at:174"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c foo.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:174"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/darwin.at:176: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c main.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c main.c" "darwin.at:176"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c main.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:176"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/darwin.at:179: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o libfoo.la foo.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libfoo.la foo.lo" "darwin.at:179"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libfoo.la foo.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:179"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/darwin.at:182: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS 	   -o libbar.la bar.lo -rpath /foo libfoo.la "
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS 	   -o libbar.la bar.lo -rpath /foo libfoo.la " "darwin.at:182"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS 	   -o libbar.la bar.lo -rpath /foo libfoo.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:182"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/darwin.at:186: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS 	   -o main main.lo libbar.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS 	   -o main main.lo libbar.la" "darwin.at:186"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS 	   -o main main.lo libbar.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/darwin.at:188: echo quit | \$LIBTOOL --mode=execute gdb main"
at_fn_check_prepare_notrace 'a shell pipeline' "darwin.at:188"
( $at_check_trace; echo quit | $LIBTOOL --mode=execute gdb main
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_skip $at_status "$at_srcdir/darwin.at:188"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/darwin.at:191: \$GREP 'Could not find object file' stderr"
at_fn_check_prepare_dynamic "$GREP 'Could not find object file' stderr" "darwin.at:191"
( $at_check_trace; $GREP 'Could not find object file' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/darwin.at:191"
$at_failed && at_fn_log_failure
$at_traceon; }




# Remove any dSYM bundle
rm -rf .libs/*.dSYM

{ set +x
$as_echo "$at_srcdir/darwin.at:203: echo quit | \$LIBTOOL --mode=execute gdb main"
at_fn_check_prepare_notrace 'a shell pipeline' "darwin.at:203"
( $at_check_trace; echo quit | $LIBTOOL --mode=execute gdb main
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_skip $at_status "$at_srcdir/darwin.at:203"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/darwin.at:205: \$GREP 'Could not find object file' stderr"
at_fn_check_prepare_dynamic "$GREP 'Could not find object file' stderr" "darwin.at:205"
( $at_check_trace; $GREP 'Could not find object file' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/darwin.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_160
#AT_START_161
at_fn_group_banner 161 'darwin.at:209' \
  "darwin ld warnings changing configure results" "  " 26
at_xfail=no
      case ,$AUTORECONF,$AUTOCONF,$AUTOHEADER,$ACLOCAL,$AUTOMAKE, in *,no,*) :;; *) false;; esac && at_xfail=yes
(
  $as_echo "161. $at_setup_line: testing $at_desc ..."
  $at_traceon


cat >configure.ac <<'_ATEOF'
AC_INIT([ld-stderr], 2.4.7, bug-libtool@gnu.org)
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC
LT_INIT
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
_ATEOF


cat >Makefile.am <<'_ATEOF'

ACLOCAL_AMFLAGS = -I m4
_ATEOF

$LIBTOOLIZE --copy --force


cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

{ set +x
$as_echo "$at_srcdir/darwin.at:225: \$AUTORECONF --force --install"
at_fn_check_prepare_dynamic "$AUTORECONF --force --install" "darwin.at:225"
( $at_check_trace; $AUTORECONF --force --install
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:225"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/darwin.at:225: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "darwin.at:225"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/darwin.at:225"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/darwin.at:226: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "darwin.at:226"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:226"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/darwin.at:227: ./libtool --config"
at_fn_check_prepare_trace "darwin.at:227"
( $at_check_trace; ./libtool --config
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_skip $at_status "$at_srcdir/darwin.at:227"
$at_failed && at_fn_log_failure
$at_traceon; }

mv stdout expout
{ set +x
$as_echo "$at_srcdir/darwin.at:229: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" LDFLAGS=-L/there/is/no/dir/here"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "darwin.at:229"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" LDFLAGS=-L/there/is/no/dir/here
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:229"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/darwin.at:230: ./libtool --config"
at_fn_check_prepare_trace "darwin.at:230"
( $at_check_trace; ./libtool --config
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_skip $at_status "$at_srcdir/darwin.at:230"
$at_failed && at_fn_log_failure
$at_traceon; }

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_161
#AT_START_162
at_fn_group_banner 162 'darwin.at:233' \
  "darwin can lt_dlopen .dylib and .so files" "      " 26
at_xfail=no
(
  $as_echo "162. $at_setup_line: testing $at_desc ..."
  $at_traceon




# This test requires shared library support.
{ set +x
$as_echo "$at_srcdir/darwin.at:238: \$LIBTOOL --features | \$GREP 'enable shared libraries' || exit 77"
at_fn_check_prepare_notrace 'a shell pipeline' "darwin.at:238"
( $at_check_trace; $LIBTOOL --features | $GREP 'enable shared libraries' || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:238"
$at_failed && at_fn_log_failure
$at_traceon; }


eval `$LIBTOOL --config | $EGREP '^shrext_cmds='`

module=no
eval shared_ext=\"$shrext_cmds\"
module=yes
eval module_ext=\"$shrext_cmds\"

# Only bother with this test if module extension is different from
# shared extension
{ set +x
$as_echo "$at_srcdir/darwin.at:250: test \"\$shared_ext\" != \"\$module_ext\" || exit 77"
at_fn_check_prepare_dynamic "test \"$shared_ext\" != \"$module_ext\" || exit 77" "darwin.at:250"
( $at_check_trace; test "$shared_ext" != "$module_ext" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:250"
$at_failed && at_fn_log_failure
$at_traceon; }


# Skip this test when called from:
#    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
{ set +x
$as_echo "$at_srcdir/darwin.at:254: case \$LIBLTDL in #(
 */_inst/lib/*) test -f \"\$LIBLTDL\" || (exit 77) ;;
esac"
at_fn_check_prepare_notrace 'an embedded newline' "darwin.at:254"
( $at_check_trace; case $LIBLTDL in #(
 */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
esac
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:254"
$at_failed && at_fn_log_failure
$at_traceon; }


prefix=`pwd`/inst
libdir=$prefix/lib
bindir=$prefix/bin
mkdir $prefix $libdir $bindir

# This code is copied from the Autobook:
# <http://sources.redhat.com/autobook/autobook/autobook_169.html>
# so if it needs changes, be sure to notify the Autobook authors
# about them.

cat >simple-module.c <<'_ATEOF'

#include <stdio.h>

#ifdef __cplusplus
extern "C"
#endif
int
run (const char *argument)
{
  printf ("Hello, %s!\n", argument);
  return 0;
}
_ATEOF


cat >ltdl-loader.c <<'_ATEOF'

#include <stdio.h>
#include <stdlib.h>
#ifndef EXIT_FAILURE
#  define EXIT_FAILURE        1
#  define EXIT_SUCCESS        0
#endif

#include <limits.h>
#ifndef PATH_MAX
#  define PATH_MAX 255
#endif

#include <string.h>
#include <ltdl.h>

#ifndef MODULE_PATH_ENV
#  define MODULE_PATH_ENV        "MODULE_PATH"
#endif

typedef int entrypoint (const char *argument);

/* Save and return a copy of the dlerror() error  message,
   since the next API call may overwrite the original. */
static char *dlerrordup (char *errormsg);

int
main (int argc, const char *argv[])
{
  char *errormsg = NULL;
  lt_dlhandle module = NULL;
  entrypoint *run = NULL;
  int errors = 0;

  if (argc != 3)
    {
      fprintf (stderr, "USAGE: main MODULENAME ARGUMENT\n");
      exit (EXIT_FAILURE);
    }

  /* Initialise libltdl. */
  errors = lt_dlinit ();

  /* Set the module search path. */
  if (!errors)
    {
      const char *path = getenv (MODULE_PATH_ENV);

      if (path != NULL)
        errors = lt_dlsetsearchpath (path);
    }

  /* Load the module. */
  if (!errors)
    module = lt_dlopenext (argv[1]);

  /* Find the entry point. */
  if (module)
    {
      run = (entrypoint *) lt_dlsym (module, "run");

      /* In principle, run might legitimately be NULL, so
         I don't use run == NULL as an error indicator
         in general. */
      errormsg = dlerrordup (errormsg);
      if (errormsg != NULL)
        {
          errors = lt_dlclose (module);
          module = NULL;
        }
    }
  else
    errors = 1;

  /* Call the entry point function. */
  if (!errors)
    {
      int result = (*run) (argv[2]);
      if (result < 0)
        errormsg = strdup ("module entry point execution failed");
      else
        printf ("\t=> %d\n", result);
    }

  /* Unload the module, now that we are done with it. */
  if (!errors)
    errors = lt_dlclose (module);

  if (errors)
    {
      /* Diagnose the encountered error. */
      errormsg = dlerrordup (errormsg);

      if (!errormsg)
        {
          fprintf (stderr, "%s: dlerror() failed.\n", argv[0]);
          return EXIT_FAILURE;
        }
    }

  /* Finished with ltdl now. */
  if (!errors)
    if (lt_dlexit () != 0)
      errormsg = dlerrordup (errormsg);

  if (errormsg)
    {
      fprintf (stderr, "%s: %s.\n", argv[0], errormsg);
      free (errormsg);
      exit (EXIT_FAILURE);
    }

  return EXIT_SUCCESS;
}

/* Be careful to save a copy of the error message,
   since the  next API call may overwrite the original. */
static char *
dlerrordup (char *errormsg)
{
  char *error = (char *) lt_dlerror ();
  if (error && !errormsg)
    errormsg = strdup (error);
  return errormsg;
}
_ATEOF


: ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
: ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}

CPPFLAGS="$LTDLINCL $CPPFLAGS"
LDFLAGS="$LDFLAGS -no-undefined"

{ set +x
$as_echo "$at_srcdir/darwin.at:417: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c simple-module.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c simple-module.c" "darwin.at:417"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c simple-module.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:417"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/darwin.at:419: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o simple-module.la 	 simple-module.lo -rpath \$libdir -module -avoid-version"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o simple-module.la 	 simple-module.lo -rpath $libdir -module -avoid-version" "darwin.at:419"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o simple-module.la 	 simple-module.lo -rpath $libdir -module -avoid-version
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:419"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/darwin.at:422: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o libsimple-dylib.la 	 simple-module.lo -rpath \$libdir -avoid-version"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libsimple-dylib.la 	 simple-module.lo -rpath $libdir -avoid-version" "darwin.at:422"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libsimple-dylib.la 	 simple-module.lo -rpath $libdir -avoid-version
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/darwin.at:425: \$CC \$CPPFLAGS \$CFLAGS -c ltdl-loader.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c ltdl-loader.c" "darwin.at:425"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c ltdl-loader.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:425"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/darwin.at:427: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o ltdl-loader\$EXEEXT 	 ltdl-loader.\$OBJEXT -dlopen self \$LIBLTDL"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o ltdl-loader$EXEEXT 	 ltdl-loader.$OBJEXT -dlopen self $LIBLTDL" "darwin.at:427"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o ltdl-loader$EXEEXT 	 ltdl-loader.$OBJEXT -dlopen self $LIBLTDL
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:427"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/darwin.at:430: \$LIBTOOL --mode=install cp simple-module.la \$libdir/simple-module.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp simple-module.la $libdir/simple-module.la" "darwin.at:430"
( $at_check_trace; $LIBTOOL --mode=install cp simple-module.la $libdir/simple-module.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:430"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/darwin.at:431: \$LIBTOOL --mode=install cp libsimple-dylib.la \$libdir/libsimple-dylib.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp libsimple-dylib.la $libdir/libsimple-dylib.la" "darwin.at:431"
( $at_check_trace; $LIBTOOL --mode=install cp libsimple-dylib.la $libdir/libsimple-dylib.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:431"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/darwin.at:432: \$LIBTOOL --mode=clean rm -f simple-module.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=clean rm -f simple-module.la" "darwin.at:432"
( $at_check_trace; $LIBTOOL --mode=clean rm -f simple-module.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:432"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/darwin.at:433: \$LIBTOOL --mode=clean rm -f libsimple-dylib.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=clean rm -f libsimple-dylib.la" "darwin.at:433"
( $at_check_trace; $LIBTOOL --mode=clean rm -f libsimple-dylib.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:433"
$at_failed && at_fn_log_failure
$at_traceon; }


rm $libdir/simple-module.la
rm $libdir/libsimple-dylib.la

for dir in inst/lib "$libdir"; do
  lt_exe=./ltdl-loader; if test -f "./ltdl-loader$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/darwin.at:439: if \"\$lt_exe\" \$dir/simple-module World; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" $dir/simple-module World; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "darwin.at:439"
( $at_check_trace; if "$lt_exe" $dir/simple-module World; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:439"
$at_failed && at_fn_log_failure
$at_traceon; }


  { set +x
$as_echo "$at_srcdir/darwin.at:441: \$GREP \"Hello, World\" stdout"
at_fn_check_prepare_dynamic "$GREP \"Hello, World\" stdout" "darwin.at:441"
( $at_check_trace; $GREP "Hello, World" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:441"
$at_failed && at_fn_log_failure
$at_traceon; }

  lt_exe=./ltdl-loader; if test -f "./ltdl-loader$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/darwin.at:442: if \"\$lt_exe\" \$dir/libsimple-dylib World; then :; else lt_status=\$?; 	   	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" $dir/libsimple-dylib World; then :; else lt_status=$?; 	   	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "darwin.at:442"
( $at_check_trace; if "$lt_exe" $dir/libsimple-dylib World; then :; else lt_status=$?; 	   	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:442"
$at_failed && at_fn_log_failure
$at_traceon; }


  { set +x
$as_echo "$at_srcdir/darwin.at:444: \$GREP \"Hello, World\" stdout"
at_fn_check_prepare_dynamic "$GREP \"Hello, World\" stdout" "darwin.at:444"
( $at_check_trace; $GREP "Hello, World" stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/darwin.at:444"
$at_failed && at_fn_log_failure
$at_traceon; }

done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_162
#AT_START_163
at_fn_group_banner 163 'dumpbin-symbols.at:25' \
  "dumpbin -symbols section hiding" "                " 27
at_xfail=no
(
  $as_echo "163. $at_setup_line: testing $at_desc ..."
  $at_traceon


# I don't know of a stable way to create a pair of objects that
# exhibits the potential problem, so this test fakes it by
# testing with output from a case that do have the potential
# problem.

# First check if the global_symbol_pipe can handle the below
# test case at all, and skip if $NM is not MS dumpbin.

cat >variable.c <<'_ATEOF'

int some_variable = 0;
_ATEOF


{ set +x
$as_echo "$at_srcdir/dumpbin-symbols.at:40: \$CC \$CPPFLAGS \$CFLAGS -c variable.c"
at_fn_check_prepare_dynamic "$CC $CPPFLAGS $CFLAGS -c variable.c" "dumpbin-symbols.at:40"
( $at_check_trace; $CC $CPPFLAGS $CFLAGS -c variable.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/dumpbin-symbols.at:40"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/dumpbin-symbols.at:41: \$NM variable.\$OBJEXT"
at_fn_check_prepare_dynamic "$NM variable.$OBJEXT" "dumpbin-symbols.at:41"
( $at_check_trace; $NM variable.$OBJEXT
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/dumpbin-symbols.at:41"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/dumpbin-symbols.at:42: \$GREP 'External.*some_variable' stdout || exit 77"
at_fn_check_prepare_dynamic "$GREP 'External.*some_variable' stdout || exit 77" "dumpbin-symbols.at:42"
( $at_check_trace; $GREP 'External.*some_variable' stdout || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/dumpbin-symbols.at:42"
$at_failed && at_fn_log_failure
$at_traceon; }


eval `$LIBTOOL --config | $EGREP '^(global_symbol_pipe)='`

cat >dumpbin-output <<'_ATEOF'

Dump of file foo.obj

File Type: COFF OBJECT

COFF SYMBOL TABLE
000 00AB766F ABS    notype       Static       | @comp.id
001 00000001 ABS    notype       Static       | @feat.00
002 00000000 SECT1  notype       Static       | .drectve
    Section length   8F, #relocs    0, #linenums    0, checksum        0
004 00000000 SECT2  notype       Static       | .debug$S
    Section length 44B4, #relocs   1C, #linenums    0, checksum        0
006 00000000 SECT3  notype       Static       | .rdata
    Section length    1, #relocs    0, #linenums    0, checksum        0, selection    2 (pick any)
008 00000000 SECT3  notype       External     | ?value@?$integral_constant@_N$0A@@tr1@std@@2_NB (public: static bool const std::tr1::integral_constant<bool,0>::value)
009 00000000 SECT4  notype       Static       | .rdata
    Section length    1, #relocs    0, #linenums    0, checksum 77073096, selection    2 (pick any)
*snip lots of uninteresting crap*
12A 00000000 SECT5B notype       Static       | .text
    Section length   4B, #relocs    2, #linenums    0, checksum 22AE8362, selection    2 (pick any)
12C 00000000 SECT5C notype       Static       | .debug$S
    Section length  150, #relocs    B, #linenums    0, checksum        0, selection    5 (pick associative Section 0x5B)
12F 00000000 SECT5D notype       Static       | .debug$T
    Section length   5C, #relocs    0, #linenums    0, checksum        0

String Table Size = 0x15EF bytes


Dump of file conv.lib

File Type: LIBRARY

COFF SYMBOL TABLE
000 00AB766F ABS    notype       Static       | @comp.id
001 00000001 ABS    notype       Static       | @feat.00
002 00000000 SECT1  notype       Static       | .drectve
    Section length   2F, #relocs    0, #linenums    0, checksum        0
004 00000000 SECT2  notype       Static       | .debug$S
    Section length  70C, #relocs    5, #linenums    0, checksum        0
006 00000000 SECT3  notype       Static       | .text
    Section length    A, #relocs    0, #linenums    0, checksum BAFC81C1
008 00000000 SECT3  notype ()    External     | _convenience
009 00000000 SECT4  notype       Static       | .debug$T
    Section length   5C, #relocs    0, #linenums    0, checksum        0

String Table Size = 0x11 bytes

  Summary

        5B3C .debug$S
          B8 .debug$T
          BE .drectve
         129 .rdata
           C .sxdata
         613 .text
          6C .text$x
          B8 .xdata$x
_ATEOF


# Check if the _convenience symbol from section SECT3 in conv.lib is
# present even if section SECT3 in foo.obj is hidden.
{ set +x
$as_echo "$at_srcdir/dumpbin-symbols.at:108: < dumpbin-output eval \"\$global_symbol_pipe\""
at_fn_check_prepare_dynamic "< dumpbin-output eval \"$global_symbol_pipe\"" "dumpbin-symbols.at:108"
( $at_check_trace; < dumpbin-output eval "$global_symbol_pipe"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/dumpbin-symbols.at:108"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/dumpbin-symbols.at:109: \$GREP convenience stdout"
at_fn_check_prepare_dynamic "$GREP convenience stdout" "dumpbin-symbols.at:109"
( $at_check_trace; $GREP convenience stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/dumpbin-symbols.at:109"
$at_failed && at_fn_log_failure
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_163
#AT_START_164
at_fn_group_banner 164 'deplibs-mingw.at:27' \
  "deplibs without file command" "                   " 27
at_xfail=no
(
  $as_echo "164. $at_setup_line: testing $at_desc ..."
  $at_traceon



cwd=`pwd`
instdir=$cwd/inst
libdir=$instdir/lib
bindir=$instdir/bin
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -no-undefined"

mkdir inst inst/bin inst/lib

cat >a.c <<'_ATEOF'
int a () { return 0; }
_ATEOF

cat >b.c <<'_ATEOF'
extern int a ();
int b () { return a (); }
_ATEOF


for file in a.c b.c; do
  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file
done
{ set +x
$as_echo "$at_srcdir/deplibs-mingw.at:50: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o liba.la a.lo -rpath \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath $libdir" "deplibs-mingw.at:50"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplibs-mingw.at:50"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/deplibs-mingw.at:52: library_names= && . ./liba.la && if test -z \"\$library_names\"; then exit 77; fi "
at_fn_check_prepare_dynamic "library_names= && . ./liba.la && if test -z \"$library_names\"; then exit 77; fi " "deplibs-mingw.at:52"
( $at_check_trace; library_names= && . ./liba.la && if test -z "$library_names"; then exit 77; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplibs-mingw.at:52"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/deplibs-mingw.at:54: \$LIBTOOL --mode=install cp liba.la \$libdir"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=install cp liba.la $libdir" "deplibs-mingw.at:54"
( $at_check_trace; $LIBTOOL --mode=install cp liba.la $libdir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplibs-mingw.at:54"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/deplibs-mingw.at:55: \$LIBTOOL --mode=clean rm -f liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=clean rm -f liba.la" "deplibs-mingw.at:55"
( $at_check_trace; $LIBTOOL --mode=clean rm -f liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplibs-mingw.at:55"
$at_failed && at_fn_log_failure
$at_traceon; }

rm -f $libdir/liba.la

# check once with 'file' (if present) and once without, if on MinGW.
for try in with-file without-file; do
  { set +x
$as_echo "$at_srcdir/deplibs-mingw.at:60: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o libb.la b.lo -rpath \$libdir 	   -L\$libdir -la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la b.lo -rpath $libdir 	   -L$libdir -la" "deplibs-mingw.at:60"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la b.lo -rpath $libdir 	   -L$libdir -la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplibs-mingw.at:60"
$at_failed && at_fn_log_failure
$at_traceon; }

  { set +x
$as_echo "$at_srcdir/deplibs-mingw.at:63: library_names= && . ./libb.la && if test -z \"\$library_names\"; then exit 99; fi "
at_fn_check_prepare_dynamic "library_names= && . ./libb.la && if test -z \"$library_names\"; then exit 99; fi " "deplibs-mingw.at:63"
( $at_check_trace; library_names= && . ./libb.la && if test -z "$library_names"; then exit 99; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplibs-mingw.at:63"
$at_failed && at_fn_log_failure
$at_traceon; }


  case $host_os in
  mingw*)
    if file /; then
      mkdir bin new-libtool

      cat >bin/file <<\EOF
#! /bin/sh
exit 1
EOF
      chmod +x bin/file
      PATH=`pwd`/bin${PATH_SEPARATOR-:}$PATH
      cd new-libtool
      # configure might fail due to in-tree build of toplevel, or
      # missing configure flags and other reasons.
      LDFLAGS=$save_LDFLAGS
      { set +x
$as_echo "$at_srcdir/deplibs-mingw.at:81: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL \"\$abs_top_srcdir\"/configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" || exit 77"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "deplibs-mingw.at:81"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL "$abs_top_srcdir"/configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplibs-mingw.at:81"
$at_failed && at_fn_log_failure
$at_traceon; }


      LDFLAGS="$LDFLAGS -no-undefined"
      cd ..
      LIBTOOL=new-libtool/libtool
      export LIBTOOL
      # Check whether the generated script is usable; otherwise, skip.
      { set +x
$as_echo "$at_srcdir/deplibs-mingw.at:87: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o libunrelated.la a.lo -rpath \$libdir 	       || exit 77"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libunrelated.la a.lo -rpath $libdir 	       || exit 77" "deplibs-mingw.at:87"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libunrelated.la a.lo -rpath $libdir 	       || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/deplibs-mingw.at:87"
$at_failed && at_fn_log_failure
$at_traceon; }

    else
      break;
    fi;;
  *)
    break;;
  esac
done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_164
#AT_START_165
at_fn_group_banner 165 'sysroot.at:204' \
  "-L=.../lib -l" "                                  " 28
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "165. $at_setup_line: testing $at_desc ..."
  $at_traceon



gcc_sysroot=`$CC --print-sysroot 2> /dev/null`
if test $? != 0; then
  gcc_sysroot=
fi
{ set +x
$as_echo "$at_srcdir/sysroot.at:204: test -n \"\$gcc_sysroot\" || exit 77"
at_fn_check_prepare_dynamic "test -n \"$gcc_sysroot\" || exit 77" "sysroot.at:204"
( $at_check_trace; test -n "$gcc_sysroot" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }


# Detect installation prefix for the compiler
prefix=
for i in crt0.o crt1.o crt2.o crti.o; do
  j=`$CC --print-file-name $i 2> /dev/null`
  test $? = 0 || continue
  case $j in
    $gcc_sysroot*/lib/$i)
      prefix=`echo "$j" | $SED "s|^$gcc_sysroot\\(.*\\)/lib/$i\$|\\1|"`
      break ;;
  esac
done
{ set +x
$as_echo "$at_srcdir/sysroot.at:204: test -n \"\$prefix\" || exit 77"
at_fn_check_prepare_dynamic "test -n \"$prefix\" || exit 77" "sysroot.at:204"
( $at_check_trace; test -n "$prefix" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }


sysroot=`pwd`/sys-root

# difficult to use AS_DIRNAME inside the AT_CHECK macro, so
# encapsulate as a shell function.
local_dirname() {
  $as_dirname -- "$1" ||
$as_expr X"$1" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$1" : 'X\(//\)[^/]' \| \
	 X"$1" : 'X\(//\)$' \| \
	 X"$1" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$1" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)[^/].*/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\).*/{
	    s//\1/
	    q
	  }
	  s/.*/./; q'
}

{ set +x
$as_echo "$at_srcdir/sysroot.at:204:
(cd \"\$gcc_sysroot\" && find \".\$prefix/bin\" \".\$prefix/include\" \".\$prefix/lib\" \\! -type d) | \\
while read file; do
  dir=\`local_dirname \"\$sysroot/\$file\"\`
  test -d \"\$dir\" || mkdir -p \"\$dir\"
  rm -f \"\$sysroot/\$file\"
  ln -s \"\$gcc_sysroot/\$file\" \"\$sysroot/\$file\" || \\
    cp \"\$gcc_sysroot/\$file\" \"\$sysroot/\$file\"
done"
at_fn_check_prepare_notrace 'a `...` command substitution' "sysroot.at:204"
( $at_check_trace;
(cd "$gcc_sysroot" && find ".$prefix/bin" ".$prefix/include" ".$prefix/lib" \! -type d) | \
while read file; do
  dir=`local_dirname "$sysroot/$file"`
  test -d "$dir" || mkdir -p "$dir"
  rm -f "$sysroot/$file"
  ln -s "$gcc_sysroot/$file" "$sysroot/$file" || \
    cp "$gcc_sysroot/$file" "$sysroot/$file"
done
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }


LDFLAGS="$LDFLAGS --sysroot=$sysroot -no-undefined"
configure_options="$configure_options --with-sysroot=$sysroot --prefix=$prefix"

#???
if test PATH = "$shlibpath_var"; then
  configure_options="$configure_options --libdir=/$prefix/bin"
fi

{ set +x
$as_echo "$at_srcdir/sysroot.at:204: mkdir lib1 lib2 prog"
at_fn_check_prepare_trace "sysroot.at:204"
( $at_check_trace; mkdir lib1 lib2 prog
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }


# Build and install package 1.
cat >lib1/configure.ac <<'_ATEOF'
AC_INIT([lib1], [1.0])
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC
AC_CONFIG_SRCDIR([lib1.c])
LT_INIT
AC_OUTPUT(Makefile)
_ATEOF


cat >lib1/Makefile.am <<'_ATEOF'
lib_LTLIBRARIES = lib1.la
lib1_la_SOURCES = lib1.c
lib1_la_LDFLAGS = -rpath $(libdir)
_ATEOF


cat >lib1/lib1.c <<'_ATEOF'
#include <string.h>
#include <stdlib.h>
char *f(const char *s)
{
  return strdup (s);
}
_ATEOF


cd lib1
$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/sysroot.at:204: \$ACLOCAL -I \$abs_top_srcdir/libltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir" "sysroot.at:204"
( $at_check_trace; $ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1




{ set +x
$as_echo "$at_srcdir/sysroot.at:204: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "sysroot.at:204"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/sysroot.at:204: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "sysroot.at:204"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:204: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "sysroot.at:204"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:204: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "sysroot.at:204"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/sysroot.at:204: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "sysroot.at:204"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

done



{ set +x
$as_echo "$at_srcdir/sysroot.at:204: \$MAKE install DESTDIR=\$sysroot"
at_fn_check_prepare_dynamic "$MAKE install DESTDIR=$sysroot" "sysroot.at:204"
( $at_check_trace; $MAKE install DESTDIR=$sysroot
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:204: test -f \"\$sysroot/\$prefix/lib/lib1.la\""
at_fn_check_prepare_dynamic "test -f \"$sysroot/$prefix/lib/lib1.la\"" "sysroot.at:204"
( $at_check_trace; test -f "$sysroot/$prefix/lib/lib1.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:204: \$GREP -F \"\$sysroot\" \"\$sysroot/\$prefix/lib/lib1.la\""
at_fn_check_prepare_dynamic "$GREP -F \"$sysroot\" \"$sysroot/$prefix/lib/lib1.la\"" "sysroot.at:204"
( $at_check_trace; $GREP -F "$sysroot" "$sysroot/$prefix/lib/lib1.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

cd ..

# Build and install package 2.
cat >lib2/configure.ac <<'_ATEOF'
AC_INIT([lib2], [1.0])
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC
AC_CONFIG_SRCDIR([lib2.c])
LT_INIT
sysroot=$with_sysroot
AC_SUBST([sysroot])
AC_OUTPUT(Makefile)
_ATEOF


cat >lib2/Makefile.am <<'_ATEOF'
lib_LTLIBRARIES = lib2.la
lib2_la_SOURCES = lib2.c
lib2_la_LDFLAGS = -rpath $(libdir)
lib2_la_LIBADD = -L=$(libdir) -l1
_ATEOF


cat >lib2/lib2.c <<'_ATEOF'
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
extern char *f(const char *s);
char *g(const char *s)
{
  char *q = f(s);
  puts (q);
  return q;
}
_ATEOF


cd lib2
$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/sysroot.at:204: \$ACLOCAL -I \$abs_top_srcdir/libltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir" "sysroot.at:204"
( $at_check_trace; $ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1




{ set +x
$as_echo "$at_srcdir/sysroot.at:204: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "sysroot.at:204"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/sysroot.at:204: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "sysroot.at:204"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:204: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "sysroot.at:204"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:204: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "sysroot.at:204"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/sysroot.at:204: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "sysroot.at:204"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

done



{ set +x
$as_echo "$at_srcdir/sysroot.at:204: \$MAKE install DESTDIR=\$sysroot"
at_fn_check_prepare_dynamic "$MAKE install DESTDIR=$sysroot" "sysroot.at:204"
( $at_check_trace; $MAKE install DESTDIR=$sysroot
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:204: test -f \"\$sysroot/\$prefix/lib/lib2.la\""
at_fn_check_prepare_dynamic "test -f \"$sysroot/$prefix/lib/lib2.la\"" "sysroot.at:204"
( $at_check_trace; test -f "$sysroot/$prefix/lib/lib2.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:204: \$GREP -F \"\$sysroot\" \"\$sysroot/\$prefix/lib/lib2.la\""
at_fn_check_prepare_dynamic "$GREP -F \"$sysroot\" \"$sysroot/$prefix/lib/lib2.la\"" "sysroot.at:204"
( $at_check_trace; $GREP -F "$sysroot" "$sysroot/$prefix/lib/lib2.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

cd ..

# Build and install a program.
cat >prog/configure.ac <<'_ATEOF'
AC_INIT([prog], [1.0])
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC
AC_CONFIG_SRCDIR([prog.c])
LT_INIT
sysroot=$with_sysroot
AC_SUBST([sysroot])
AC_OUTPUT(Makefile)
_ATEOF


cat >prog/Makefile.am <<'_ATEOF'
bin_PROGRAMS = prog
prog_SOURCES = prog.c
prog_LDADD = -L=$(libdir) -l2
_ATEOF


cat >prog/prog.c <<'_ATEOF'
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
extern char *g(const char *s);
int main()
{
  char *q = g("hello world");
  free (q);
  return 0;
}
_ATEOF


cd prog
$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/sysroot.at:204: \$ACLOCAL -I \$abs_top_srcdir/libltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir" "sysroot.at:204"
( $at_check_trace; $ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1




{ set +x
$as_echo "$at_srcdir/sysroot.at:204: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "sysroot.at:204"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/sysroot.at:204: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "sysroot.at:204"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:204: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "sysroot.at:204"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:204: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "sysroot.at:204"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/sysroot.at:204: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "sysroot.at:204"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

done



{ set +x
$as_echo "$at_srcdir/sysroot.at:204: \$MAKE install DESTDIR=\$sysroot"
at_fn_check_prepare_dynamic "$MAKE install DESTDIR=$sysroot" "sysroot.at:204"
( $at_check_trace; $MAKE install DESTDIR=$sysroot
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:204: test -f \"\$sysroot/\$prefix/bin/prog\$EXEEXT\""
at_fn_check_prepare_dynamic "test -f \"$sysroot/$prefix/bin/prog$EXEEXT\"" "sysroot.at:204"
( $at_check_trace; test -f "$sysroot/$prefix/bin/prog$EXEEXT"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:204: \$GREP -F \"\$sysroot\" \"\$sysroot/\$prefix/bin/prog\$EXEEXT\""
at_fn_check_prepare_dynamic "$GREP -F \"$sysroot\" \"$sysroot/$prefix/bin/prog$EXEEXT\"" "sysroot.at:204"
( $at_check_trace; $GREP -F "$sysroot" "$sysroot/$prefix/bin/prog$EXEEXT"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:204: \$GREP \"'.*=\" \$sysroot/\$prefix/lib/lib2.la"
at_fn_check_prepare_dynamic "$GREP \"'.*=\" $sysroot/$prefix/lib/lib2.la" "sysroot.at:204"
( $at_check_trace; $GREP "'.*=" $sysroot/$prefix/lib/lib2.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:204: ./libtool --mode=finish \$sysroot/\$prefix/lib/lib[12].la"
at_fn_check_prepare_dynamic "./libtool --mode=finish $sysroot/$prefix/lib/lib[12].la" "sysroot.at:204"
( $at_check_trace; ./libtool --mode=finish $sysroot/$prefix/lib/lib[12].la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:204: \$GREP \"'.*=\" \$sysroot/\$prefix/lib/lib[12].la"
at_fn_check_prepare_dynamic "$GREP \"'.*=\" $sysroot/$prefix/lib/lib[12].la" "sysroot.at:204"
( $at_check_trace; $GREP "'.*=" $sysroot/$prefix/lib/lib[12].la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:204"
$at_failed && at_fn_log_failure
$at_traceon; }


# missing tests
# 1) pass absolute .la files
# 2) pass absolute -L
# 2) pass relative .la files

cd ..
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_165
#AT_START_166
at_fn_group_banner 166 'sysroot.at:205' \
  "-L SYSROOT/.../lib -l" "                          " 28
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "166. $at_setup_line: testing $at_desc ..."
  $at_traceon



gcc_sysroot=`$CC --print-sysroot 2> /dev/null`
if test $? != 0; then
  gcc_sysroot=
fi
{ set +x
$as_echo "$at_srcdir/sysroot.at:205: test -n \"\$gcc_sysroot\" || exit 77"
at_fn_check_prepare_dynamic "test -n \"$gcc_sysroot\" || exit 77" "sysroot.at:205"
( $at_check_trace; test -n "$gcc_sysroot" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }


# Detect installation prefix for the compiler
prefix=
for i in crt0.o crt1.o crt2.o crti.o; do
  j=`$CC --print-file-name $i 2> /dev/null`
  test $? = 0 || continue
  case $j in
    $gcc_sysroot*/lib/$i)
      prefix=`echo "$j" | $SED "s|^$gcc_sysroot\\(.*\\)/lib/$i\$|\\1|"`
      break ;;
  esac
done
{ set +x
$as_echo "$at_srcdir/sysroot.at:205: test -n \"\$prefix\" || exit 77"
at_fn_check_prepare_dynamic "test -n \"$prefix\" || exit 77" "sysroot.at:205"
( $at_check_trace; test -n "$prefix" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }


sysroot=`pwd`/sys-root

# difficult to use AS_DIRNAME inside the AT_CHECK macro, so
# encapsulate as a shell function.
local_dirname() {
  $as_dirname -- "$1" ||
$as_expr X"$1" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$1" : 'X\(//\)[^/]' \| \
	 X"$1" : 'X\(//\)$' \| \
	 X"$1" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$1" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)[^/].*/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\).*/{
	    s//\1/
	    q
	  }
	  s/.*/./; q'
}

{ set +x
$as_echo "$at_srcdir/sysroot.at:205:
(cd \"\$gcc_sysroot\" && find \".\$prefix/bin\" \".\$prefix/include\" \".\$prefix/lib\" \\! -type d) | \\
while read file; do
  dir=\`local_dirname \"\$sysroot/\$file\"\`
  test -d \"\$dir\" || mkdir -p \"\$dir\"
  rm -f \"\$sysroot/\$file\"
  ln -s \"\$gcc_sysroot/\$file\" \"\$sysroot/\$file\" || \\
    cp \"\$gcc_sysroot/\$file\" \"\$sysroot/\$file\"
done"
at_fn_check_prepare_notrace 'a `...` command substitution' "sysroot.at:205"
( $at_check_trace;
(cd "$gcc_sysroot" && find ".$prefix/bin" ".$prefix/include" ".$prefix/lib" \! -type d) | \
while read file; do
  dir=`local_dirname "$sysroot/$file"`
  test -d "$dir" || mkdir -p "$dir"
  rm -f "$sysroot/$file"
  ln -s "$gcc_sysroot/$file" "$sysroot/$file" || \
    cp "$gcc_sysroot/$file" "$sysroot/$file"
done
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }


LDFLAGS="$LDFLAGS --sysroot=$sysroot -no-undefined"
configure_options="$configure_options --with-sysroot=$sysroot --prefix=$prefix"

#???
if test PATH = "$shlibpath_var"; then
  configure_options="$configure_options --libdir=/$prefix/bin"
fi

{ set +x
$as_echo "$at_srcdir/sysroot.at:205: mkdir lib1 lib2 prog"
at_fn_check_prepare_trace "sysroot.at:205"
( $at_check_trace; mkdir lib1 lib2 prog
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }


# Build and install package 1.
cat >lib1/configure.ac <<'_ATEOF'
AC_INIT([lib1], [1.0])
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC
AC_CONFIG_SRCDIR([lib1.c])
LT_INIT
AC_OUTPUT(Makefile)
_ATEOF


cat >lib1/Makefile.am <<'_ATEOF'
lib_LTLIBRARIES = lib1.la
lib1_la_SOURCES = lib1.c
lib1_la_LDFLAGS = -rpath $(libdir)
_ATEOF


cat >lib1/lib1.c <<'_ATEOF'
#include <string.h>
#include <stdlib.h>
char *f(const char *s)
{
  return strdup (s);
}
_ATEOF


cd lib1
$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/sysroot.at:205: \$ACLOCAL -I \$abs_top_srcdir/libltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir" "sysroot.at:205"
( $at_check_trace; $ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1




{ set +x
$as_echo "$at_srcdir/sysroot.at:205: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "sysroot.at:205"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/sysroot.at:205: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "sysroot.at:205"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:205: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "sysroot.at:205"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:205: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "sysroot.at:205"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/sysroot.at:205: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "sysroot.at:205"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

done



{ set +x
$as_echo "$at_srcdir/sysroot.at:205: \$MAKE install DESTDIR=\$sysroot"
at_fn_check_prepare_dynamic "$MAKE install DESTDIR=$sysroot" "sysroot.at:205"
( $at_check_trace; $MAKE install DESTDIR=$sysroot
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:205: test -f \"\$sysroot/\$prefix/lib/lib1.la\""
at_fn_check_prepare_dynamic "test -f \"$sysroot/$prefix/lib/lib1.la\"" "sysroot.at:205"
( $at_check_trace; test -f "$sysroot/$prefix/lib/lib1.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:205: \$GREP -F \"\$sysroot\" \"\$sysroot/\$prefix/lib/lib1.la\""
at_fn_check_prepare_dynamic "$GREP -F \"$sysroot\" \"$sysroot/$prefix/lib/lib1.la\"" "sysroot.at:205"
( $at_check_trace; $GREP -F "$sysroot" "$sysroot/$prefix/lib/lib1.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

cd ..

# Build and install package 2.
cat >lib2/configure.ac <<'_ATEOF'
AC_INIT([lib2], [1.0])
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC
AC_CONFIG_SRCDIR([lib2.c])
LT_INIT
sysroot=$with_sysroot
AC_SUBST([sysroot])
AC_OUTPUT(Makefile)
_ATEOF


cat >lib2/Makefile.am <<'_ATEOF'
lib_LTLIBRARIES = lib2.la
lib2_la_SOURCES = lib2.c
lib2_la_LDFLAGS = -rpath $(libdir)
lib2_la_LIBADD = -L$(sysroot)$(libdir) -l1
_ATEOF


cat >lib2/lib2.c <<'_ATEOF'
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
extern char *f(const char *s);
char *g(const char *s)
{
  char *q = f(s);
  puts (q);
  return q;
}
_ATEOF


cd lib2
$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/sysroot.at:205: \$ACLOCAL -I \$abs_top_srcdir/libltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir" "sysroot.at:205"
( $at_check_trace; $ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1




{ set +x
$as_echo "$at_srcdir/sysroot.at:205: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "sysroot.at:205"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/sysroot.at:205: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "sysroot.at:205"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:205: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "sysroot.at:205"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:205: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "sysroot.at:205"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/sysroot.at:205: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "sysroot.at:205"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

done



{ set +x
$as_echo "$at_srcdir/sysroot.at:205: \$MAKE install DESTDIR=\$sysroot"
at_fn_check_prepare_dynamic "$MAKE install DESTDIR=$sysroot" "sysroot.at:205"
( $at_check_trace; $MAKE install DESTDIR=$sysroot
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:205: test -f \"\$sysroot/\$prefix/lib/lib2.la\""
at_fn_check_prepare_dynamic "test -f \"$sysroot/$prefix/lib/lib2.la\"" "sysroot.at:205"
( $at_check_trace; test -f "$sysroot/$prefix/lib/lib2.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:205: \$GREP -F \"\$sysroot\" \"\$sysroot/\$prefix/lib/lib2.la\""
at_fn_check_prepare_dynamic "$GREP -F \"$sysroot\" \"$sysroot/$prefix/lib/lib2.la\"" "sysroot.at:205"
( $at_check_trace; $GREP -F "$sysroot" "$sysroot/$prefix/lib/lib2.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

cd ..

# Build and install a program.
cat >prog/configure.ac <<'_ATEOF'
AC_INIT([prog], [1.0])
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC
AC_CONFIG_SRCDIR([prog.c])
LT_INIT
sysroot=$with_sysroot
AC_SUBST([sysroot])
AC_OUTPUT(Makefile)
_ATEOF


cat >prog/Makefile.am <<'_ATEOF'
bin_PROGRAMS = prog
prog_SOURCES = prog.c
prog_LDADD = -L$(sysroot)$(libdir) -l2
_ATEOF


cat >prog/prog.c <<'_ATEOF'
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
extern char *g(const char *s);
int main()
{
  char *q = g("hello world");
  free (q);
  return 0;
}
_ATEOF


cd prog
$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/sysroot.at:205: \$ACLOCAL -I \$abs_top_srcdir/libltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir" "sysroot.at:205"
( $at_check_trace; $ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1




{ set +x
$as_echo "$at_srcdir/sysroot.at:205: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "sysroot.at:205"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/sysroot.at:205: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "sysroot.at:205"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:205: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "sysroot.at:205"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:205: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "sysroot.at:205"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/sysroot.at:205: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "sysroot.at:205"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

done



{ set +x
$as_echo "$at_srcdir/sysroot.at:205: \$MAKE install DESTDIR=\$sysroot"
at_fn_check_prepare_dynamic "$MAKE install DESTDIR=$sysroot" "sysroot.at:205"
( $at_check_trace; $MAKE install DESTDIR=$sysroot
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:205: test -f \"\$sysroot/\$prefix/bin/prog\$EXEEXT\""
at_fn_check_prepare_dynamic "test -f \"$sysroot/$prefix/bin/prog$EXEEXT\"" "sysroot.at:205"
( $at_check_trace; test -f "$sysroot/$prefix/bin/prog$EXEEXT"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:205: \$GREP -F \"\$sysroot\" \"\$sysroot/\$prefix/bin/prog\$EXEEXT\""
at_fn_check_prepare_dynamic "$GREP -F \"$sysroot\" \"$sysroot/$prefix/bin/prog$EXEEXT\"" "sysroot.at:205"
( $at_check_trace; $GREP -F "$sysroot" "$sysroot/$prefix/bin/prog$EXEEXT"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:205: \$GREP \"'.*=\" \$sysroot/\$prefix/lib/lib2.la"
at_fn_check_prepare_dynamic "$GREP \"'.*=\" $sysroot/$prefix/lib/lib2.la" "sysroot.at:205"
( $at_check_trace; $GREP "'.*=" $sysroot/$prefix/lib/lib2.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:205: ./libtool --mode=finish \$sysroot/\$prefix/lib/lib[12].la"
at_fn_check_prepare_dynamic "./libtool --mode=finish $sysroot/$prefix/lib/lib[12].la" "sysroot.at:205"
( $at_check_trace; ./libtool --mode=finish $sysroot/$prefix/lib/lib[12].la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:205: \$GREP \"'.*=\" \$sysroot/\$prefix/lib/lib[12].la"
at_fn_check_prepare_dynamic "$GREP \"'.*=\" $sysroot/$prefix/lib/lib[12].la" "sysroot.at:205"
( $at_check_trace; $GREP "'.*=" $sysroot/$prefix/lib/lib[12].la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }


# missing tests
# 1) pass absolute .la files
# 2) pass absolute -L
# 2) pass relative .la files

cd ..
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_166
#AT_START_167
at_fn_group_banner 167 'sysroot.at:206' \
  "SYSROOT/.../*.la" "                               " 28
at_xfail=no
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
      test no = "$ACLOCAL" && at_xfail=yes
      test no = "$AUTOMAKE" && at_xfail=yes
      test no = "$AUTOCONF" && at_xfail=yes
(
  $as_echo "167. $at_setup_line: testing $at_desc ..."
  $at_traceon



gcc_sysroot=`$CC --print-sysroot 2> /dev/null`
if test $? != 0; then
  gcc_sysroot=
fi
{ set +x
$as_echo "$at_srcdir/sysroot.at:206: test -n \"\$gcc_sysroot\" || exit 77"
at_fn_check_prepare_dynamic "test -n \"$gcc_sysroot\" || exit 77" "sysroot.at:206"
( $at_check_trace; test -n "$gcc_sysroot" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }


# Detect installation prefix for the compiler
prefix=
for i in crt0.o crt1.o crt2.o crti.o; do
  j=`$CC --print-file-name $i 2> /dev/null`
  test $? = 0 || continue
  case $j in
    $gcc_sysroot*/lib/$i)
      prefix=`echo "$j" | $SED "s|^$gcc_sysroot\\(.*\\)/lib/$i\$|\\1|"`
      break ;;
  esac
done
{ set +x
$as_echo "$at_srcdir/sysroot.at:206: test -n \"\$prefix\" || exit 77"
at_fn_check_prepare_dynamic "test -n \"$prefix\" || exit 77" "sysroot.at:206"
( $at_check_trace; test -n "$prefix" || exit 77
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }


sysroot=`pwd`/sys-root

# difficult to use AS_DIRNAME inside the AT_CHECK macro, so
# encapsulate as a shell function.
local_dirname() {
  $as_dirname -- "$1" ||
$as_expr X"$1" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$1" : 'X\(//\)[^/]' \| \
	 X"$1" : 'X\(//\)$' \| \
	 X"$1" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$1" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)[^/].*/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\).*/{
	    s//\1/
	    q
	  }
	  s/.*/./; q'
}

{ set +x
$as_echo "$at_srcdir/sysroot.at:206:
(cd \"\$gcc_sysroot\" && find \".\$prefix/bin\" \".\$prefix/include\" \".\$prefix/lib\" \\! -type d) | \\
while read file; do
  dir=\`local_dirname \"\$sysroot/\$file\"\`
  test -d \"\$dir\" || mkdir -p \"\$dir\"
  rm -f \"\$sysroot/\$file\"
  ln -s \"\$gcc_sysroot/\$file\" \"\$sysroot/\$file\" || \\
    cp \"\$gcc_sysroot/\$file\" \"\$sysroot/\$file\"
done"
at_fn_check_prepare_notrace 'a `...` command substitution' "sysroot.at:206"
( $at_check_trace;
(cd "$gcc_sysroot" && find ".$prefix/bin" ".$prefix/include" ".$prefix/lib" \! -type d) | \
while read file; do
  dir=`local_dirname "$sysroot/$file"`
  test -d "$dir" || mkdir -p "$dir"
  rm -f "$sysroot/$file"
  ln -s "$gcc_sysroot/$file" "$sysroot/$file" || \
    cp "$gcc_sysroot/$file" "$sysroot/$file"
done
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }


LDFLAGS="$LDFLAGS --sysroot=$sysroot -no-undefined"
configure_options="$configure_options --with-sysroot=$sysroot --prefix=$prefix"

#???
if test PATH = "$shlibpath_var"; then
  configure_options="$configure_options --libdir=/$prefix/bin"
fi

{ set +x
$as_echo "$at_srcdir/sysroot.at:206: mkdir lib1 lib2 prog"
at_fn_check_prepare_trace "sysroot.at:206"
( $at_check_trace; mkdir lib1 lib2 prog
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }


# Build and install package 1.
cat >lib1/configure.ac <<'_ATEOF'
AC_INIT([lib1], [1.0])
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC
AC_CONFIG_SRCDIR([lib1.c])
LT_INIT
AC_OUTPUT(Makefile)
_ATEOF


cat >lib1/Makefile.am <<'_ATEOF'
lib_LTLIBRARIES = lib1.la
lib1_la_SOURCES = lib1.c
lib1_la_LDFLAGS = -rpath $(libdir)
_ATEOF


cat >lib1/lib1.c <<'_ATEOF'
#include <string.h>
#include <stdlib.h>
char *f(const char *s)
{
  return strdup (s);
}
_ATEOF


cd lib1
$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/sysroot.at:206: \$ACLOCAL -I \$abs_top_srcdir/libltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir" "sysroot.at:206"
( $at_check_trace; $ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1




{ set +x
$as_echo "$at_srcdir/sysroot.at:206: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "sysroot.at:206"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/sysroot.at:206: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "sysroot.at:206"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:206: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "sysroot.at:206"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:206: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "sysroot.at:206"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/sysroot.at:206: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "sysroot.at:206"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

done



{ set +x
$as_echo "$at_srcdir/sysroot.at:206: \$MAKE install DESTDIR=\$sysroot"
at_fn_check_prepare_dynamic "$MAKE install DESTDIR=$sysroot" "sysroot.at:206"
( $at_check_trace; $MAKE install DESTDIR=$sysroot
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:206: test -f \"\$sysroot/\$prefix/lib/lib1.la\""
at_fn_check_prepare_dynamic "test -f \"$sysroot/$prefix/lib/lib1.la\"" "sysroot.at:206"
( $at_check_trace; test -f "$sysroot/$prefix/lib/lib1.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:206: \$GREP -F \"\$sysroot\" \"\$sysroot/\$prefix/lib/lib1.la\""
at_fn_check_prepare_dynamic "$GREP -F \"$sysroot\" \"$sysroot/$prefix/lib/lib1.la\"" "sysroot.at:206"
( $at_check_trace; $GREP -F "$sysroot" "$sysroot/$prefix/lib/lib1.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

cd ..

# Build and install package 2.
cat >lib2/configure.ac <<'_ATEOF'
AC_INIT([lib2], [1.0])
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC
AC_CONFIG_SRCDIR([lib2.c])
LT_INIT
sysroot=$with_sysroot
AC_SUBST([sysroot])
AC_OUTPUT(Makefile)
_ATEOF


cat >lib2/Makefile.am <<'_ATEOF'
lib_LTLIBRARIES = lib2.la
lib2_la_SOURCES = lib2.c
lib2_la_LDFLAGS = -rpath $(libdir)
lib2_la_LIBADD = $(sysroot)$(libdir)/lib1.la
_ATEOF


cat >lib2/lib2.c <<'_ATEOF'
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
extern char *f(const char *s);
char *g(const char *s)
{
  char *q = f(s);
  puts (q);
  return q;
}
_ATEOF


cd lib2
$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/sysroot.at:206: \$ACLOCAL -I \$abs_top_srcdir/libltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir" "sysroot.at:206"
( $at_check_trace; $ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1




{ set +x
$as_echo "$at_srcdir/sysroot.at:206: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "sysroot.at:206"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/sysroot.at:206: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "sysroot.at:206"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:206: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "sysroot.at:206"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:206: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "sysroot.at:206"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/sysroot.at:206: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "sysroot.at:206"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

done



{ set +x
$as_echo "$at_srcdir/sysroot.at:206: \$MAKE install DESTDIR=\$sysroot"
at_fn_check_prepare_dynamic "$MAKE install DESTDIR=$sysroot" "sysroot.at:206"
( $at_check_trace; $MAKE install DESTDIR=$sysroot
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:206: test -f \"\$sysroot/\$prefix/lib/lib2.la\""
at_fn_check_prepare_dynamic "test -f \"$sysroot/$prefix/lib/lib2.la\"" "sysroot.at:206"
( $at_check_trace; test -f "$sysroot/$prefix/lib/lib2.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:206: \$GREP -F \"\$sysroot\" \"\$sysroot/\$prefix/lib/lib2.la\""
at_fn_check_prepare_dynamic "$GREP -F \"$sysroot\" \"$sysroot/$prefix/lib/lib2.la\"" "sysroot.at:206"
( $at_check_trace; $GREP -F "$sysroot" "$sysroot/$prefix/lib/lib2.la"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

cd ..

# Build and install a program.
cat >prog/configure.ac <<'_ATEOF'
AC_INIT([prog], [1.0])
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC
AC_CONFIG_SRCDIR([prog.c])
LT_INIT
sysroot=$with_sysroot
AC_SUBST([sysroot])
AC_OUTPUT(Makefile)
_ATEOF


cat >prog/Makefile.am <<'_ATEOF'
bin_PROGRAMS = prog
prog_SOURCES = prog.c
prog_LDADD = $(sysroot)$(libdir)/lib2.la
_ATEOF


cat >prog/prog.c <<'_ATEOF'
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
extern char *g(const char *s);
int main()
{
  char *q = g("hello world");
  free (q);
  return 0;
}
_ATEOF


cd prog
$LIBTOOLIZE


macro_dir=
func_extract_trace AC_CONFIG_MACRO_DIRS
test -n "$func_extract_trace_result" \
    || func_extract_trace AC_CONFIG_MACRO_DIR
test -n "$func_extract_trace_result" \
    && macro_dir=" -I $func_extract_trace_result"
cat >acinclude.m4 <<'_ATEOF'
m4_ifndef([AC_CONFIG_MACRO_DIRS],
	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
_ATEOF

echo "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir"; { set +x
$as_echo "$at_srcdir/sysroot.at:206: \$ACLOCAL -I \$abs_top_srcdir/libltdl/m4\$macro_dir"
at_fn_check_prepare_dynamic "$ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir" "sysroot.at:206"
( $at_check_trace; $ACLOCAL -I $abs_top_srcdir/libltdl/m4$macro_dir
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
# to have older timestamp than other autotools later-generated files (concretely
# for libtool case, we speak about config.h.in generated autoheader).
# Autoreconf does the same (after the first aclocal run).
sleep 1




{ set +x
$as_echo "$at_srcdir/sysroot.at:206: \$AUTOMAKE --add-missing"
at_fn_check_prepare_dynamic "$AUTOMAKE --add-missing" "sysroot.at:206"
( $at_check_trace; $AUTOMAKE --add-missing
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
if $at_failed; then :
  { set +x
$as_echo "$at_srcdir/sysroot.at:206: \$GREP 'require .*but have' stderr && (exit 77)"
at_fn_check_prepare_dynamic "$GREP 'require .*but have' stderr && (exit 77)" "sysroot.at:206"
( $at_check_trace; $GREP 'require .*but have' stderr && (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

fi
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:206: \$AUTOCONF "
at_fn_check_prepare_dynamic "$AUTOCONF " "sysroot.at:206"
( $at_check_trace; $AUTOCONF
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/sysroot.at:206: : \${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  \$CONFIG_SHELL ./configure \$configure_options           --prefix=\"\$prefix\" --exec-prefix=\"\$prefix\" --bindir=\"\$prefix/bin\" --libdir=\"\$prefix/lib\" "
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "sysroot.at:206"
( $at_check_trace; : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; 	  $CONFIG_SHELL ./configure $configure_options           --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }


for target in all
do
  { set +x
$as_echo "$at_srcdir/sysroot.at:206: \$as_unset LIBTOOL; \$as_unset LIBTOOLIZE; \$MAKE \$target "
at_fn_check_prepare_dynamic "$as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target " "sysroot.at:206"
( $at_check_trace; $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

done



{ set +x
$as_echo "$at_srcdir/sysroot.at:206: \$MAKE install DESTDIR=\$sysroot"
at_fn_check_prepare_dynamic "$MAKE install DESTDIR=$sysroot" "sysroot.at:206"
( $at_check_trace; $MAKE install DESTDIR=$sysroot
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:206: test -f \"\$sysroot/\$prefix/bin/prog\$EXEEXT\""
at_fn_check_prepare_dynamic "test -f \"$sysroot/$prefix/bin/prog$EXEEXT\"" "sysroot.at:206"
( $at_check_trace; test -f "$sysroot/$prefix/bin/prog$EXEEXT"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:206: \$GREP -F \"\$sysroot\" \"\$sysroot/\$prefix/bin/prog\$EXEEXT\""
at_fn_check_prepare_dynamic "$GREP -F \"$sysroot\" \"$sysroot/$prefix/bin/prog$EXEEXT\"" "sysroot.at:206"
( $at_check_trace; $GREP -F "$sysroot" "$sysroot/$prefix/bin/prog$EXEEXT"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:206: \$GREP \"'.*=\" \$sysroot/\$prefix/lib/lib2.la"
at_fn_check_prepare_dynamic "$GREP \"'.*=\" $sysroot/$prefix/lib/lib2.la" "sysroot.at:206"
( $at_check_trace; $GREP "'.*=" $sysroot/$prefix/lib/lib2.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:206: ./libtool --mode=finish \$sysroot/\$prefix/lib/lib[12].la"
at_fn_check_prepare_dynamic "./libtool --mode=finish $sysroot/$prefix/lib/lib[12].la" "sysroot.at:206"
( $at_check_trace; ./libtool --mode=finish $sysroot/$prefix/lib/lib[12].la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/sysroot.at:206: \$GREP \"'.*=\" \$sysroot/\$prefix/lib/lib[12].la"
at_fn_check_prepare_dynamic "$GREP \"'.*=\" $sysroot/$prefix/lib/lib[12].la" "sysroot.at:206"
( $at_check_trace; $GREP "'.*=" $sysroot/$prefix/lib/lib[12].la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/sysroot.at:206"
$at_failed && at_fn_log_failure
$at_traceon; }


# missing tests
# 1) pass absolute .la files
# 2) pass absolute -L
# 2) pass relative .la files

cd ..
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_167
#AT_START_168
at_fn_group_banner 168 'stresstest.at:32' \
  "Link option thorough search test" "               " 29
at_xfail=no
(
  $as_echo "168. $at_setup_line: testing $at_desc ..."
  $at_traceon


eval `$LIBTOOL --config | $EGREP '^(CC|objdir|allow_undefined_flag)='`

mkdir sub sub2 sub3 2>/dev/null

cat >a.c <<'_ATEOF'
/* all kinds of data items */
#ifdef __cplusplus
extern "C" {
#endif
int v1;
static int v2;
int v3 = 0;
int v4 = 1;
extern const int v5, v6;
extern const char *v7;
extern const char v8[];
extern int (*const v12) (void);
const int v5 = 0;
const int v6 = 1;
const char* v7 = "\01foo";
const char v8[] = "\01bar";
int v9(void) { return v2 + 1; }
int (*v10) (void);
int (*v11) (void) = v9;
int (*const v12) (void) = v9;

typedef struct { int arr[1000]; } large;
large v13;
large v14 = { { 0 } };
large v15 = { { 1 } };
#ifdef __cplusplus
}
#endif
_ATEOF


cat >asyms <<'_ATEOF'
v1
v3
v4
v5
v6
v7
v8
v9
v10
v11
v12
v13
v14
v15
_ATEOF


cat >b.c <<'_ATEOF'
int b = 42;
int b3 = 1;
int ab = 1;
_ATEOF


cat >main.c <<'_ATEOF'

#if defined LIBA_DLL_IMPORT
#  if defined _WIN32 || defined WIN32 || defined __CYGWIN__
#    define LIBA_SCOPE extern __declspec(dllimport)
#    if defined _MSC_VER
#      define LIBA_SCOPE_VAR LIBA_SCOPE
#    endif
#  endif
#endif
#if !defined LIBA_SCOPE
#  define LIBA_SCOPE extern
#endif
#if !defined LIBA_SCOPE_VAR
#  define LIBA_SCOPE_VAR extern
#endif
#ifdef __cplusplus
extern "C" {
#endif
LIBA_SCOPE_VAR int v1;
LIBA_SCOPE_VAR int v3, v4;
LIBA_SCOPE const int v5, v6;
LIBA_SCOPE_VAR const char* v7;
LIBA_SCOPE_VAR const char v8[];
extern int v9(void);
LIBA_SCOPE_VAR int (*v10) (void);
LIBA_SCOPE_VAR int (*v11) (void);
LIBA_SCOPE int (*const v12) (void);
#ifdef __cplusplus
}
#endif

typedef struct { int arr[1000]; } large;
LIBA_SCOPE_VAR large v13, v14, v15;

int main(void)
{
  char s = v7[0] + v8[0];
  return s + v1 + v3 + v4 + v5 + v6 + v9() + v11() + v12()
	   + v13.arr[0] + v14.arr[0] + v15.arr[0]
           - 8;
}
_ATEOF


cat >dlself.c <<'_ATEOF'

#if defined LIBA_DLL_IMPORT
#  if defined _WIN32 || defined WIN32 || defined __CYGWIN__
#    define LIBA_SCOPE extern __declspec(dllimport)
#    if defined _MSC_VER
#      define LIBA_SCOPE_VAR LIBA_SCOPE
#    endif
#  endif
#endif
#if !defined LIBA_SCOPE
#  define LIBA_SCOPE extern
#endif
#if !defined LIBA_SCOPE_VAR
#  define LIBA_SCOPE_VAR extern
#endif
#ifdef __cplusplus
extern "C" {
#endif
LIBA_SCOPE_VAR int v1;
LIBA_SCOPE_VAR int v3, v4;
LIBA_SCOPE const int v5, v6;
LIBA_SCOPE_VAR const char* v7;
LIBA_SCOPE_VAR const char v8[];
extern int v9(void);
LIBA_SCOPE_VAR int (*v10) (void);
LIBA_SCOPE_VAR int (*v11) (void);
LIBA_SCOPE int (*const v12) (void);

typedef struct { int arr[1000]; } large;
LIBA_SCOPE_VAR large v13, v14, v15;

extern int w1;
extern int w3, w4;
extern const int w5, w6;
extern const char* w7;
extern const char w8[];
extern int w9(void);
extern int (*w10) (void);
extern int (*w11) (void);
extern int (*const w12) (void);
extern large w13, w14, w15;
#ifdef __cplusplus
}
#endif

int main(void)
{
  char s = v7[0] + v8[0] + w7[0] + w8[0];
  return s + v1 + v3 + v4 + v5 + v6 + v9() + v11() + v12()
	   + v13.arr[0] + v14.arr[0] + v15.arr[0]
	   + w1 + w3 + w4 + w5 + w6 + w9() + w11() + w12()
	   + w13.arr[0] + w14.arr[0] + w15.arr[0]
           - 16;
}


#ifdef __cplusplus
extern "C" {
#endif
int w1;
static int w2;
int w3 = 0;
int w4 = 1;
const int w5 = 0;
const int w6 = 1;
const char* w7 = "\01foo";
const char w8[] = "\01bar";
int w9(void) { return w2 + 1; }
int (*w10) (void);
int (*w11) (void) = w9;
int (*const w12) (void) = w9;
large w13;
large w14 = { { 0 } };
large w15 = { { 1 } };
#ifdef __cplusplus
}
#endif
_ATEOF


cat >dlselfsyms <<'_ATEOF'
w1
w3
w4
w5
w6
w7
w8
w9
w10
w11
w12
w13
w14
w15
_ATEOF



{ set +x
$as_echo "$at_srcdir/stresstest.at:234: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c a.c -o sub/a.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c -o sub/a.lo" "stresstest.at:234"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c -o sub/a.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/stresstest.at:234"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/stresstest.at:236: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c b.c -o sub/b.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c b.c -o sub/b.lo" "stresstest.at:236"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c b.c -o sub/b.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/stresstest.at:236"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/stresstest.at:238: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS -DLIBA_DLL_IMPORT \$CFLAGS -c main.c"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS -DLIBA_DLL_IMPORT $CFLAGS -c main.c" "stresstest.at:238"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS -DLIBA_DLL_IMPORT $CFLAGS -c main.c
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/stresstest.at:238"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/stresstest.at:240: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c main.c -o main-static.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c main.c -o main-static.lo" "stresstest.at:240"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c main.c -o main-static.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/stresstest.at:240"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/stresstest.at:242: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS -DLIBA_DLL_IMPORT \$CFLAGS -c dlself.c -o sub3/dlself.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS -DLIBA_DLL_IMPORT $CFLAGS -c dlself.c -o sub3/dlself.lo" "stresstest.at:242"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS -DLIBA_DLL_IMPORT $CFLAGS -c dlself.c -o sub3/dlself.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/stresstest.at:242"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/stresstest.at:244: \$LIBTOOL --mode=compile \$CC \$CPPFLAGS \$CFLAGS -c dlself.c -o sub3/dlself-static.lo"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c dlself.c -o sub3/dlself-static.lo" "stresstest.at:244"
( $at_check_trace; $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c dlself.c -o sub3/dlself-static.lo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/stresstest.at:244"
$at_failed && at_fn_log_failure
$at_traceon; }


case $allow_undefined_flag in
  unsupported) undef_opts=-no-undefined ;;
  *)           undef_opts='"" -no-undefined' ;;
esac

# expose problems with the regex:
touch vfoo v.bar

for l1 in $undef_opts
do
  for l2 in '' '-export-symbols-regex "v.*"' '-export-symbols asyms'
  do
    for l3 in '' '-rpath /nonexistent'
    do
      linkargs="$l1 $l2 $l3"
      for rel in '' ./ `pwd`/
      do
	echo "eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o \"$rel\"sub2/liba.la \"$rel\"sub/a.lo' $linkargs"; { set +x
$as_echo "$at_srcdir/stresstest.at:264: eval '\$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS -o \"\$rel\"sub2/liba.la \"\$rel\"sub/a.lo' \$linkargs"
at_fn_check_prepare_dynamic "eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o \"$rel\"sub2/liba.la \"$rel\"sub/a.lo' $linkargs" "stresstest.at:264"
( $at_check_trace; eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o "$rel"sub2/liba.la "$rel"sub/a.lo' $linkargs
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/stresstest.at:264"
$at_failed && at_fn_log_failure
$at_traceon; }

	for st in '' '-static' '-no-install'
	do
	  # if '-static' is not passed, and the library is shared, then we have
	  # to use -DLIBA_DLL_IMPORT, thus main.lo (and not main-static.lo).
	  case $st,$l3 in
	  -static,*) mst=-static ;;
	  *,-rpath*) mst= ;;
	  *) mst=-static ;;
	  esac

	  echo "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $st -o \"$rel\"main$EXEEXT \"$rel\"main$mst.lo \"$rel\"sub2/liba.la"; { set +x
$as_echo "$at_srcdir/stresstest.at:276: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS \$st -o \"\$rel\"main\$EXEEXT \"\$rel\"main\$mst.lo \"\$rel\"sub2/liba.la"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $st -o \"$rel\"main$EXEEXT \"$rel\"main$mst.lo \"$rel\"sub2/liba.la" "stresstest.at:276"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $st -o "$rel"main$EXEEXT "$rel"main$mst.lo "$rel"sub2/liba.la
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/stresstest.at:276"
$at_failed && at_fn_log_failure
$at_traceon; }

	  lt_exe=./main; if test -f "./main$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/stresstest.at:278: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "stresstest.at:278"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/stresstest.at:278"
$at_failed && at_fn_log_failure
$at_traceon; }


	  for l10 in '' '-export-symbols dlselfsyms'
	  do
	    echo "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $st -o \"$rel\"sub3/dlself$EXEEXT \"$rel\"sub3/dlself$mst.lo \"$rel\"sub2/liba.la sub/b.lo -dlopen self $l10"; { set +x
$as_echo "$at_srcdir/stresstest.at:281: \$LIBTOOL --mode=link \$CC \$CFLAGS \$LDFLAGS \$st -o \"\$rel\"sub3/dlself\$EXEEXT \"\$rel\"sub3/dlself\$mst.lo \"\$rel\"sub2/liba.la sub/b.lo -dlopen self \$l10"
at_fn_check_prepare_dynamic "$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $st -o \"$rel\"sub3/dlself$EXEEXT \"$rel\"sub3/dlself$mst.lo \"$rel\"sub2/liba.la sub/b.lo -dlopen self $l10" "stresstest.at:281"
( $at_check_trace; $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $st -o "$rel"sub3/dlself$EXEEXT "$rel"sub3/dlself$mst.lo "$rel"sub2/liba.la sub/b.lo -dlopen self $l10
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/stresstest.at:281"
$at_failed && at_fn_log_failure
$at_traceon; }

	    lt_exe=./sub3/dlself; if test -f "./sub3/dlself$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
{ set +x
$as_echo "$at_srcdir/stresstest.at:283: if \"\$lt_exe\" ; then :; else lt_status=\$?; 	   test \"\$lt_status\" != 0 && 	   test \"X\$host\" != \"X\$build\" && test -x \"\$lt_exe\" && exit 77; 	   exit \$lt_status; fi"
at_fn_check_prepare_dynamic "if \"$lt_exe\" ; then :; else lt_status=$?; 	   test \"$lt_status\" != 0 && 	   test \"X$host\" != \"X$build\" && test -x \"$lt_exe\" && exit 77; 	   exit $lt_status; fi" "stresstest.at:283"
( $at_check_trace; if "$lt_exe" ; then :; else lt_status=$?; 	   test "$lt_status" != 0 && 	   test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; 	   exit $lt_status; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/stresstest.at:283"
$at_failed && at_fn_log_failure
$at_traceon; }


	  done
	done
      done
    done
  done
done

  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_168
#AT_START_169
at_fn_group_banner 169 'cmdline_wrap.at:29' \
  "Run tests with low max_cmd_len" "                 " 29
at_xfail=no
(
  $as_echo "169. $at_setup_line: testing $at_desc ..."
  $at_traceon


fail_list=`for f in ?/fail ??/fail ???/fail ????/fail; do test -f "$f" && echo "$f"; done`
echo "DEBUG: fail_list='$fail_list'"
{ set +x
$as_echo "$at_srcdir/cmdline_wrap.at:34: test -z \"\$fail_list\" || (exit 77)"
at_fn_check_prepare_dynamic "test -z \"$fail_list\" || (exit 77)" "cmdline_wrap.at:34"
( $at_check_trace; test -z "$fail_list" || (exit 77)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/cmdline_wrap.at:34"
$at_failed && at_fn_log_failure
$at_traceon; }



$SED 's|max_cmd_len=.*|max_cmd_len="24"|' < $LIBTOOL > libtool
chmod +x libtool
LIBTOOL=`pwd`/libtool
export LIBTOOL
# run the suite in a subdirectory, otherwise the two suites will compete
# for the output file 'testsuite.log'.
mkdir tests
cd tests
INNER_TESTSUITEFLAGS="$INNER_TESTSUITEFLAGS abs_top_srcdir=$abs_top_srcdir \
  abs_builddir=$abs_builddir"
{ set +x
$as_echo "$at_srcdir/cmdline_wrap.at:48: \$CONFIG_SHELL \$abs_srcdir/testsuite -k libtool\$INNER_TESTSUITEFLAGS"
at_fn_check_prepare_dynamic "$CONFIG_SHELL $abs_srcdir/testsuite -k libtool$INNER_TESTSUITEFLAGS" "cmdline_wrap.at:48"
( $at_check_trace; $CONFIG_SHELL $abs_srcdir/testsuite -k libtool$INNER_TESTSUITEFLAGS
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/cmdline_wrap.at:48"
$at_failed && at_fn_log_failure  \
"testsuite.log"
$at_traceon; }


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_169
