[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Specifying AM_CPPFLAGS from within configure.ac
From: |
Stepan Kasal |
Subject: |
Re: Specifying AM_CPPFLAGS from within configure.ac |
Date: |
Fri, 3 Jun 2005 08:44:48 +0200 |
User-agent: |
Mutt/1.4.1i |
Hello Jirko,
some nit picking:
Regarding your macro MY_CXX_OPTION, if you want to be really portable,
things can get even more scary. See
http://lists.gnu.org/archive/html/autoconf/2005-05/msg00109.html
This will point you to latest sources in the 1.5.x branch of libtool.
(The thread continues at
http://lists.gnu.org/archive/html/autoconf/2005-06/msg00001.html )
On Thu, Jun 02, 2005 at 10:40:03PM +0200, Jirka Hanika wrote:
> MY_CXX_OPTION(warnings, [warnings], [-Wall -w -enable-warnings-or-whatever])
MY_CXX_OPTION([warnings], [warnings], ...)
all arguments have to be quoted. It's good rule to keep, at least when we
educate beginners on this list. ;-)
I think the definition of your macro can be improved.
Here is the new version:
AC_DEFUN([MY_CXX_OPTION],
[AC_CACHE_CHECK([for $2], [epos_cv_cxx_opt_$1],
[cat > conftest.cc <<EOF
#include <stdio.h>
int main(int argc, char **argv)
{
argc=argc; argv=argv; return 0;
}
EOF
epos_cv_cxx_opt_$1=unknown
for opt in $3; do
${CXX} ${opt} -o conftest conftest.cc 2>conftest2 1>&5 || continue
msg=`cat conftest2`
if test -z "$msg"; then
epos_cv_cxx_opt_$1=$opt
break
fi
done
rm -f conftest conftest2 conftest.cc])
if test "x${epos_cv_cxx_opt_$1}" = xunknown; then
$1=
else
$1=$epos_cv_cxx_opt_$1
fi])
Some of the changes are only my taste, but some are important:
AC_DEFUN([MY_CXX_OPTION],
-- quote the symbol, in case the definition is read twice.
cmd 2>conftest2 always creates conftest2
You forgot to rm conftest.cc.
test "x$epos_cv_cxx_opt_$1" = xunknown
You have to prepend the "x", for portability, see the Autoconf manual.
Have a nice day,
Stepan Kasal