Re: Question on AC_CHECK_HEADERS/AC_DEFINE interaction
On Thu, Jul 23, 2015 at 8:29 AM, Pádraig Brady p...@draigbrady.com 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?
Re: Question on AC_CHECK_HEADERS/AC_DEFINE interaction
On 24/07/15 17:40, Ben Pfaff wrote: 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 p...@draigbrady.com 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])]) Yes that makes more sense. Thanks to both of you. Pádraig.
Re: Question on AC_CHECK_HEADERS/AC_DEFINE interaction
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 p...@draigbrady.com 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])])