autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Appending to config.log


From: roth . gnu
Subject: Re: Appending to config.log
Date: 17 May 2002 09:55:57 -0700
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley)

==> "mdr" == Mark D Roth <address@hidden> writes:

    mdr> To address this problem, I'd like to see the following two
    mdr> macros added to autoconf:

    mdr> AC_LOG(TEXT) ------------ Append TEXT to config.log.

AC_DEFUN([AC_LOG],[dnl
echo "$1" 1>&5
])dnl

    mdr> AC_RUN_COMMAND(COMMAND) ----------------------- 1. Run
    mdr> COMMAND, saving stderr to a file.  2. Set a shell variable to
    mdr> the command's exit value so that macro caller can get it.
    mdr> 2. If exit value is non-zero, append stderr output to
    mdr> config.log.  3. Remove stderr output file.

dnl
dnl FUNCTION:
dnl AC_RUN_COMMAND(CMD)
dnl
dnl Run CMD in a sub-shell.
dnl Save the exit status in $status,
dnl and the stdout output in $result.
dnl

AC_DEFUN([AC_RUN_COMMAND],[dnl
_cmd="$1"

AC_LOG("+ $_cmd")

eval "$1" 1>config_command.out 2>&5
status=$?
result=`cat config_command.out`

if test $status -ne 0; then
  AC_LOG($result)
fi

AC_LOG("+ exit $status")

rm -f config_command.out

])

Peers on this list, of course, will check this for errors and typos.
I use a macro like the above for package-config scripts:

  my_package_config=${with_my_package_config-"my-package-config"}
  AC_RUN_COMMAND($my_package_config --cppflags)
  if test $status -ne 0; then
    AC_ERROR([failed command: $my_package_config])
  fi
  CPPFLAGS="$CPPFLAGS $result"

C




reply via email to

[Prev in Thread] Current Thread [Next in Thread]