autoconf
[Top][All Lists]
Advanced

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

Re: Appending to config.log


From: Akim Demaille
Subject: Re: Appending to config.log
Date: 20 May 2002 12:04:30 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp)

| ==> "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

fd5 is an internal detail, do not rely on it.

| 
|     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"

If you intend to use one such macro, first of all just do not name it
AC_sth.  AC_ belongs to Autoconf.  And AC_RUN_COMMANDS is especially
dangerous a name to steal from Autoconf!

Also, result, status etc. are user name space variables.



reply via email to

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