[Top][All Lists]

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

Re: Patches for implementing checking for valid CFLAGS, LDFLAGS, etc.

From: Peter Simons
Subject: Re: Patches for implementing checking for valid CFLAGS, LDFLAGS, etc.
Date: Thu, 30 Jun 2011 09:35:14 +0200

Hi Maarten,

 > Which distribution of macros over fieles would then be better?
 > ax_check_compile_flag.m4: AX_CHECK_COMPILE_FLAG, AX_APPEND_LINK_FLAGS
 > ax_check_link_flag.m4: AX_CHECK_LINK_FLAG
 > ax_append_flag.m4: AX_APPEND_FLAG

of the alternatives you suggested, this one above is my favorite.

The best possible solution, though would be to have one file per
macro, and to call each of those files exactly like the macro is
called. I realize there are plenty of macros in the Autoconf Archive
that don't follow this guideline, but that is mostly because of
historical reasons, i.e. we didn't understand the advantages of such
a high granularity at first.

 > Sorry to nitpick: AX_CFLAGS_GCC_OPTION is still in there. I'll
 > include that in the patch for the file splitting.

I am sorry, but now I am confused. I marked that macro obsolete,
referring users to AX_CHECK_COMPILE_FLAG instead. Was that a

 > Any suggestions on how to consolidate the
 > AX_CFLAGS_{AIX,GCC,HPUX,IRIX,SUN}_OPTION macros? It seems not
 > very useful that the use has to decide on a particular compiler
 > family upfront in, that should be autodetected.

I agree, having 5 virtually identical macros in the Archive is not a
good idea. A possible solution to provide a unified interface for
those macros would be to add a macro that determines some kind of
compiler id, say AX_CHECK_COMPILER_ID, which returns strings like
AIX, GCC, HPUX, IRIX, and SUN. Once that id is known, a general
purpose macro AX_CFLAGS_OPTION could dispatch the call to the
appropriate compiler-specific implementation.

 > May be the approach from AX_CFLAGS_WARN_ALL can be used to
 > autodetect the flags to return an error for an invalid flag? Has
 > anyone got any experience with this?

Unfortunately, I have never used any of those macros, so I don't
know much about their properties. In my projects, I was always able
to leave the choice of specific compiler flags to the users, i.e. I
simply expected CFLAGS and CPPFLAGS to be specified on the command
line to ./configure. So I don't have much experience in these

Take care,

reply via email to

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