autoconf
[Top][All Lists]
Advanced

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

Re: combining tests


From: Sam Steingold
Subject: Re: combining tests
Date: Fri, 14 Mar 2008 11:41:52 -0400
User-agent: Thunderbird 2.0.0.0 (X11/20070326)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eric Blake wrote:
| According to Sam Steingold on 3/13/2008 1:57 PM:
| | checking whether libffcall is installed... checking how to link with
| | libavcall... -lavcall
|
| ...
|
| | checking for callback.h... no
| | no
| | ...
|
| Usually, this implies that you have done a cached check inside of another
| cached check.  Not only does this lead to poor output on a fresh configure
| run, it leads to bugs on a './configure -C' run, because the nested checks
| aren't even performed.
| http://www.gnu.org/software/autoconf/manual/autoconf.html#Caching-Results

I spent so much time looking at this (actually, at the corresponding
page in emacs info) that I think I know it by heart.

| Remember the rule of thumb: when using a cache variable, the
| commands-to-set-it must have no side effects except for setting the
| variable cache-id.

yeah, sure.

| | AC_CACHE_CHECK([whether libffcall is installed],[cl_cv_have_ffcall],
| | [cl_cv_have_ffcall=no
| | if test $cl_use_ffcall != no; then
| | AC_LIB_FROMPACKAGE(avcall,libffcall)
|
| AC_LIB_FROMPACKAGE must be a cached call (however, it is not an autoconf
| macro, so please consider renaming it to something that is namespace

AC_LIB_FROMPACKAGE comes from gnulib/m4/lib-link.m4.

| clean), but you are executing it inside of AC_CACHE_CHECK.  Instead, you
| should execute the cache check in isolation, then based on the setting of
| $cl_cv_have_ffcall, execute AC_LIB_FROMPACKAGE as needed.

the problem is no with AC_LIB_FROMPACKAGE but with AC_LIB_LINKFLAGS,
AC_CHECK_HEADERS, and AC_SEARCH_LIBS.

my problem is that cl_cv_have_ffcall is an amalgamation of other checked
variables.

are  you suggesting that what I need is

AC_DEFUN([CL_FFCALL],[dnl
AC_ARG_WITH([ffcall],
[AC_HELP_STRING([--with-ffcall],[use FFCALL (default is YES, if present)])],
[cl_use_ffcall=$withval],[cl_use_ffcall=default])
if test $cl_use_ffcall != no; then
AC_LIB_FROMPACKAGE(avcall,libffcall)
AC_LIB_FROMPACKAGE(callback,libffcall)
AC_LIB_LINKFLAGS([avcall])
AC_LIB_LINKFLAGS([callback])
AC_CHECK_HEADERS(avcall.h callback.h)
if test "$ac_cv_header_avcall_h" = yes \
~     -a "$ac_cv_header_callback_h" = yes
then
cl_save_LIBS="$LIBS"
AC_LIB_APPENDTOVAR([LIBS], [$LIBAVCALL])
AC_LIB_APPENDTOVAR([LIBS], [$LIBCALLBACK])
AC_SEARCH_LIBS(__builtin_avcall)
AC_SEARCH_LIBS(trampoline_r_data0)
if test "$ac_cv_search___builtin_avcall" = no \
~     -o "$ac_cv_search_trampoline_r_data0" = no
then LIBS=$cl_save_LIBS
fi
fi
AC_CACHE_CHECK([whether libffcall is installed],[cl_cv_have_ffcall],
[if test "$ac_cv_header_avcall_h" = yes \
~      -a "$ac_cv_header_callback_h" = yes \
~      -a "$ac_cv_search___builtin_avcall" != no \
~      -a "$ac_cv_search_trampoline_r_data0" != no
then cl_cv_have_ffcall=yes
else cl_cv_have_ffcall=no
fi])
if test $cl_use_ffcall = yes -a $cl_cv_have_ffcall = no; then
~  FFCALL=ffcall-1.8
~  AC_MSG_ERROR([despite --with-ffcall, FFCALL was not found
~ Either call configure without --with-ffcall or do
~  mkdir tools; cd tools; prefix=`pwd`/${ac_cv_host}
~  wget http://ftp.gnu.org/pub/gnu/ffcall/${FFCALL}.tar.gz
~  tar xfz ${FFCALL}.tar.gz
~  cd ${FFCALL}
~  ./configure --prefix=\${prefix} && make && make check && make install
~  cd ../..
~  ./configure --with-libffcall-prefix=\${prefix} [$]*])
fi
fi;])])

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH2otbPp1Qsf2qnMcRAnXEAJ4zN48kuTWfq2/lOr4GE5HlYSteVgCdE8Db
YLrgSj9QMhDuApx1CNfa1jc=
=7wQe
-----END PGP SIGNATURE-----




reply via email to

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