[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question on AC_CHECK_HEADERS/AC_DEFINE interaction
From: |
Ben Pfaff |
Subject: |
Re: Question on AC_CHECK_HEADERS/AC_DEFINE interaction |
Date: |
Fri, 24 Jul 2015 09:40:41 -0700 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Fri, Jul 24, 2015 at 09:29:45AM -0700, Jim Meyering wrote:
> On Thu, Jul 23, 2015 at 8:29 AM, Pádraig Brady <address@hidden> wrote:
> > At line 40 we AC_DEFINE(HAVE_SELINUX_SELINUX_H,0)
> >
> > http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=m4/selinux-selinux-h.m4;h=fd09b299;hb=HEAD#l40
> > However that may already defined to 1 which is the case
> > when compiling in -m32 mode but with only the first of these installed:
> >
> > $ rpm -qf /usr/include/selinux/selinux.h
> > libselinux-devel-2.3-9.fc22.x86_64
> > libselinux-devel-2.3-9.fc22.i686
> >
> > In that edge case, -Werror will fail due to the redefinition,
> > thus causing -Werror to not be used in the build.
> >
> > Quite the edge case I know, but I'm not sure how best to avoid.
> > Perhaps we should not use AC_CHECK_HEADERS here,
> > instead going lower level with AC_PREPROC_IFELSE(.. AC_DEFINE ..) ?
>
> If you can find a clean way to avoid it, go ahead.
> However, isn't it easy just to refrain from using -Werror when running
> ./configure?
I agree.
If one wants to develop with -Werror, though, it can be a little
inconvenient to add -Werror after running configure. For my own
projects, I add a --enable-Werror configure option that automatically
adds -Werror only after doing all of the configuration tests:
AC_DEFUN([PSPP_ENABLE_WERROR],
[AC_ARG_ENABLE(
[Werror],
[AC_HELP_STRING([--enable-Werror], [Add -Werror to CFLAGS])],
[], [enable_Werror=no])
AC_CONFIG_COMMANDS_PRE(
[if test "X$enable_Werror" = Xyes; then
CFLAGS="$CFLAGS -Werror"
fi])])