Skip to Content.
Sympa Menu

freetds - Re: [freetds] Support for AIX 7.1

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: freetds AT lists.ibiblio.org
  • Subject: Re: [freetds] Support for AIX 7.1
  • Date: Fri, 4 May 2012 13:33:54 -0400

On Fri, 04 May 2012 17:06:37 +0200
Sebastien FLAESCH <sf AT 4js.com> wrote:

> export CFLAGS="-DSYSV -D_AIX -D_AIX53 -D_ALL_SOURCE -O2"
>
> and restarted the build with:
>
> make clean all
>
> and now I get:
>
> Making all in fisql
> /bin/sh ../../../libtool --tag=CC --mode=link gcc
> -D_THREAD_SAFE -g -O2 -Wdeclaration-after-statement -o fisql
> fisql.o terminal.o edit.o handlers.o
> interrupt.o ../../dblib/libsybdb.la ../../replacements/libreplacements.la
> -liconv -lpthreads

As I said, Seb,

> You will need to re-run the configure script for the modified CFLAGS
> to take effect

Note that although you exported CFLAGS, those switches aren't passed on
the command line quoted above. They won't be until you re-run
configure.

Let me unpack that a bit, because it once confused me, too.

There's nothing magical about CFLAGS; you'll note it's not mentioned on
the gcc man page. It's just a convention. The Makefile author can
construct the Makefile to use CFLAGS if defined, giving the user -- the
guy running make(1) -- a way to pass arbitrary options to the
compiler.

The configure script that generates the FreeTDS Makefiles was itself
generated by autoconf. The generated Makefiles sadly do not honor
CFLAGS. They instead *set* CFLAGS to the value that was in
CFLAGS at the time configure was run. See for yourself:

$ grep -n ^CFLAGS build/src/apps/Makefile
202:CFLAGS = -g -O0 -Wdeclaration-after-statement

(YMMV.)

I don't know why configure works that way. If you asked on the
autoconf mailing list, I imagine they'd say there's no way for make(1)
to determine if and when files need to be recompiled when CFLAGS
changes. (Reading CFLAGS at build-time runs the risk of having
different files compiled with different options, which could lead to no
problem or very weird problems.)

I favor sharp knives. To me, the point of the configure script is to
determine the target machine's characteristics; I would prefer to have
the generated Makefiles incorporate CFLAGS (and friends) from the
environment at compile time. But they don't.

Once burned and twice shy.

Regards,

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page