Configure check for smbwrapper

Alexandre Oliva oliva at dcc.unicamp.br
Fri Nov 20 04:09:44 GMT 1998


On Nov 20, 1998, Tim Potter <tpot at acsys.anu.edu.au> wrote:


> OK, here's a bit of autoconf to do most of the check.  Unfortunately the
> AC_DEFINE(LD_PRELOAD) doesn't seem to do anything to include/config.h.

That's right, you must add `#undef LD_PRELOAD' (or HAVE_LD_PRELOAD,
according to your macro :-) to acconfig.h

> AC_TRY_COMMAND($CC $CFLAGS -c conf-preload.c)
> AC_TRY_COMMAND($CC $LDSHFLAGS $CFLAGS -o libconf-preload1.so conf-preload1.c)
> AC_TRY_COMMAND($CC $LDSHFLAGS $CFLAGS -o libconf-preload2.so conf-preload2.c)
> AC_TRY_COMMAND($CC $CFLAGS $CPPFLAGS -o conftest conf-preload.o ./libconf-preload1.so)

AC_TRY_COMMAND does not exist (or is not documented) in autoconf 2.12; 
is this a new extension?  Why don't you just run the commands one
after another? (>/dev/null 2>&1, of course :-)

> LD_PRELOAD=./libconf-preload2.so; export LD_PRELOAD
> AC_TRY_COMMAND(conftest > conf.out)

Never trust that `.' is in the PATH; better run ./conftest.  BTW, why
don't you just redirect the output to /dev/null?

> if test $? -eq 0; then 
> AC_MSG_RESULT(yes)
> AC_DEFINE(HAVE_LD_PRELOAD)
> else
> AC_MSG_RESULT(no)
> fi

Since you're within AC_CACHE_CHECK, don't print results yourself, and
don't do the final action within the cache block, otherwise it won't
take place if the value is cached already.  So, I'd suggest:

  if ./conftest > /dev/null 2>&1; then
    samba_cv_HAVE_LD_PRELOAD=yes
  else
    samba_cv_HAVE_LD_PRELOAD=no
  fi

Then, after the end of AC_CACHE_CHECK, run:

if test x"$samba_cv_HAVE_LD_PRELOAD" = x"yes"; then
  AC_DEFINE(HAVE_LD_PRELOAD)
fi

-- 
Alexandre Oliva  http://www.dcc.unicamp.br/~oliva  aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org.au}
Universidade Estadual de Campinas, SP, Brasil



More information about the samba-technical mailing list