[Top][All Lists]

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

Probable m4 quoting problem

From: David Bruce
Subject: Probable m4 quoting problem
Date: Mon, 21 Jun 2010 23:37:12 -0500


Sorry if the answer to this is staring me in the face in the
documentation, but I'm pulling my hair out over this.

I'm trying to have my check for libs in a two-stage
process - first, using pkg-config's PKG_CHECK_MODULES, then if not
located by that method, a AC_CHECK_LIB as the "action-if-not-found".
The reason for this complicated approach is that I want to use
mingw-cross-env to make win32 crossbuilds for my linux-based programs,
and mingw-cross-env exclusively uses static linking.  AC_CHECK_LIB
alone does not pull in the indirect dependencies of the checked-for
libs, but PKG_CHECK_MODULES links everything properly.  So, for the
mingw-cross-env build, pkg-config is the way to go, AFAIK.  However,
some of the SDL libs don't have pkg-config support (at least in
Debian), so I want to fall back to AC_CHECK_LIB in that case, which is
sufficient for dynamic linking.

So, I have several stanzas that look like the following:

                                [AC_MSG_ERROR([SDL_mixer not found!])])])

AC_DEFINE([HAVE_LIBSDL_MIXER],[1],[Define to 1 if you have the
`SDL_mixer` library])

Problem is, I get errors on autoreconf -i such as:

address@hidden:/usr/local/src/git/tuxmath/build$ autoreconf -i .. error: possibly undefined macro: AC_CHECK_LIB
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

If I run autoreconf a second time, it succeeds, so perhaps this
"error" is actually a warning, but nevertheless I want to get rid of

AFAICT from a lot of time spent with Google and the manuals, this
sounds like a m4 quoting problem, but I can't see what I am doing

Also, this approach generates somewhat misleading ./configure output,
as it shows the unsuccessful pkg-config check, followed by the
successful AC_CHECK_LIB.  I've tried adding explanatory "echo"
statements but have encountered more quoting errors. Is AC_MSG_NOTICE
better, and if so, how do I group multiple macros within the
"action_if_not_found" of PKG_CHECK_MODULES.

Thanks for any suggestions,

David Bruce

reply via email to

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