automake
[Top][All Lists]
Advanced

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

Re: Automatically using /usr/local/{include,lib}


From: Bob Friesenhahn
Subject: Re: Automatically using /usr/local/{include,lib}
Date: Mon, 6 Feb 2006 09:39:27 -0600 (CST)

On Mon, 6 Feb 2006, Guillaume Rousse wrote:

Default LDPATH and CPPFLAGS values are empty, making all AC_LIB_CHECK
and AC_HEADER_CHECK unable to detect libraries installed under
/usr/local. Whereas an knowledgeable user will export these variable
before running ./configure, many other will just be unable to build
software properly (and some maintainers may even workaround it by
introducing configure wrappers, I've seen it).

Modern configure also supports these as arguments on the command line and the INSTALL documentation file clearly describes how to use them.

Is there any disadvantage setting default values to thoses variables in
configure.ac, such as:
LDFLAGS=-L/usr/local/lib
CPPFLAGS=-I/usr/local/include

Yes, there are disadvantages and they are not immediately obvious. By encoding these defaults, the maintainer is assuming something about the user's build environment which may not be correct and may not be fixable without manually editing the configure script.

One trick that I use (as end user) is to add a config.site (/usr/local/share/config.site by default) to each of my systems which provides suitable defaults for that system. Then if I don't provide any overrides, a plain 'configure' just works. This method allows users to establish their own defaults.

Here is an example of a config.site which establishes useful defaults:

# config.site for configure
#

echo 'Applying settings for 32-bit build ...'

# Change some defaults.

test "$prefix" = NONE && prefix=/usr/local

CC_DEFAULT="gcc-4.0.1"
CXX_DEFAULT="c++-4.0.1"
CFLAGS_DEFAULT=-O2
CXXFLAGS_DEFAULT=-O
LDFLAGS_DEFAULT="-L/usr/local/lib -R/usr/local/lib"
LIBS_DEFAULT=

if test "${ac_env_CC_set}" != set
then
  CC="$CC_DEFAULT"
fi

if test "${ac_env_CXX_set}" != set
then
  CXX="$CXX_DEFAULT"
fi

if test "${ac_env_CFLAGS_set}" != set
then
  CFLAGS="$CFLAGS_DEFAULT"
fi

if test "${ac_env_CXXFLAGS_set}" != set
then
  CXXFLAGS="$CXXFLAGS_DEFAULT"
fi

if test "${ac_env_CPPFLAGS_set}" != set
then
  CPPFLAGS="$CPPFLAGS_DEFAULT"
fi

if test "${ac_env_LDFLAGS_set}" = set
then
  LDFLAGS="$LDFLAGS $LDFLAGS_DEFAULT"
else
  LDFLAGS="$LDFLAGS_DEFAULT"
fi

echo "CC       = \"$CC\""
echo "CXX      = \"$CXX\""
echo "CFLAGS   = \"$CFLAGS\""
echo "CXXFLAGS = \"$CXXFLAGS\""
echo "CPPFLAGS = \"$CPPFLAGS\""
echo "LDFLAGS  = \"$LDFLAGS\""

======================================
Bob Friesenhahn
address@hidden, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/




reply via email to

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