autoconf
[Top][All Lists]
Advanced

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

Re: Problem with macro inside inactive conditional changing autoconf beh


From: Dr. Douglas C. MacKenzie
Subject: Re: Problem with macro inside inactive conditional changing autoconf behavior
Date: Mon, 01 Feb 2010 14:54:08 -0500

I have simplified my script a  bit and here is the output from
configure.  I believe the critical line is:

   checking if libtool supports shared libraries... no

What I do not understand is why AC_LIBTOOL_WIN32_DLL inside this code
has any effect at all:

if test 0 = 1; then
   echo "---- In conditional block 1 ----"
   AC_LIBTOOL_WIN32_DLL
else
   echo "---- In conditional block 2 ----"
fi

Apparently, I don't understand how the "if/fi" construct works.  I
expected it would allow conditionally including AC macros, but that does
not seem to be true.

::::::::::::::
configure.ac   :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
AC_PREREQ(2.52)
AC_INIT([testing], [2.0], [testing], [testing])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([build_config_files.sh])

if test 0 = 1; then
   echo "---- In conditional block 1 ----"
   AC_LIBTOOL_WIN32_DLL
else
   echo "---- In conditional block 2 ----"
fi

AC_PROG_LIBTOOL
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

:::::::::::::: stdio output
of ./configure   :::::::::::::::::::::::::::::::::::::::::::::::::::::

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
---- In conditional block 2 ----
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... none
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1966080
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... unknown
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared
libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
config.status: executing libtool commands

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

I tried zip'ing the generated files and attaching them, but the mailer
rejected my message, so I imagine that attachments are not allowed.

Doug


-----Original Message-----
From: Ralf Wildenhues <address@hidden>
To: Dr. Douglas C. MacKenzie <address@hidden>
Cc: address@hidden
Subject: Re: Problem with macro inside inactive conditional changing
autoconf behavior
Date: Sun, 31 Jan 2010 15:54:36 +0100


Hello Douglas,

* Dr. Douglas C. MacKenzie wrote on Fri, Jan 29, 2010 at 09:29:31PM CET:
> I am having trouble with a configure.ac file after upgrading from
> libtool 1.5 to 2.2.6 as part of moving from Fedora 10 to Fedora 12.
[...]
> > AC_ARG_VAR(COMPILER, "Use COMPILER=MSC to compile for WIN32 using Microsoft 
> > C++ compiler.\nUse COMPILER=GCC to comnpile using GNU tools (default).\n")
> > if test "x$COMPILER" = "xMSC"; then
> >    echo "Compiling using Microsoft C++ compiler"
> > dnl    AC_LIBTOOL_WIN32_DLL
> >     AC_SUBST(BUILD_WINDOWS, true)
> > else
> >    echo "Compiling using GNU tools"
> >    AC_SUBST(AM_CXXFLAGS, "-Wall")
> > fi
[...]
> The commands:
>    autoreconf --force --install
>    ./configure
>    ./libtool --features
> 
> generate:
>    host: x86_64-unknown-linux-gnu
>    enable shared libraries 
>    enable static libraries
> 
> But, If I change the "dnl    AC_LIBTOOL_WIN32_DLL" line to   "
> AC_LIBTOOL_WIN32_DLL"
> 
> The commands:
>    autoreconf --force --install
>    ./configure
>    ./libtool --features
> 
> Now generate:
>    host: 
>    disable shared libraries
>    enable static libraries

That's weird.  Can you post the configure output in the second case?
This is a Libtool issue, not an Autoconf one.

That said, it should work to just move the AC_LIBTOOL_WIN32_DLL outside
of the if clause, so it is called unconditionally.  Another thing you
can try is
  AS_IF([CONDITION],
        [IF-TRUE],
        [IF-FALSE])

with Autoconf 2.60 or newer.

Another thing to note is that the AC_SUBST macro typically expands to no
shell code at all, and it anyway has unconditional effect, so
  if $foo; then
    AC_SUBST([bar])
  fi

will unconditionally substitute @bar@, and likely cause a shell syntax
error.

Cheers,
Ralf







reply via email to

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