[elinks-users] Trouble with CPPFLAGS

Daniel E. Macks dmacks at netspace.org
Tue Nov 21 23:04:28 PST 2006

Building elinks-0.11.2 on my OS X machine, there are symtoms of some
flag mishandling. I set some -I and -L flags in CPPFLAGS and LDFLAGS
respectively, as per the standard meaning of those variables, which is
reflected in './configure --help':

  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
              headers in a nonstandard directory <include dir>

At the end of ./configure on my OS X machine, I see:

  Compiler options (CFLAGS) ....... -g -O2 -Wall -fno-strict-aliasing -I/sw/include -I/sw/include
  Linker options (LIBS) ........... -L/sw/lib -lssl -lcrypto -ldl  -lz -lbz2 -lidn -lexpat -liconv

That seems strange, because Makefile.config has:

  CFLAGS = -g -O2 -Wall -fno-strict-aliasing
  CPPFLAGS = -I/sw/include -I/sw/include
  LDFLAGS = -L/sw/lib -rdynamic
  LIBS = -L/sw/lib -lssl -lcrypto -ldl  -lz -lbz2 -lidn -lexpat -liconv

Which sounds correct. The bug is in how the data from configure is
labeled: configure.in emits CFLAGS+CPPFLAGS but calls it CFLAGS:

  EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])

Because CPPFLAGS and CFLAGS have different meanings and are used
differently internally (see below in this email and also see the
comments in configure.in), better to display each separately:

  EL_LOG_CONFIG(CPPFLAGS, [Compiler options (CPPFLAGS)], [])
  EL_LOG_CONFIG(CFLAGS, [Compiler options (CFLAGS)], [])

Then compiling also fails:

        [CC]   src/bookmarks/backend/xbel.o
  xbel.c:14:19: expat.h: No such file or directory

even though I have /sw/include/expat.h. Why isn't the -I flag in
CPPFLAGS being passed? It's a bug in Makefile.config.in:


CPPFLAGS, a set of flags specifically designed to be passed to the
compiler and lumped together with CFLAGS in configure.in, isn't being
passed to the compiler along with CFLAGS. A more standard automake
incantation would be:



Daniel Macks
dmacks at netspace.org

More information about the elinks-users mailing list