@@ -44,13 +44,27 @@ m4_include([config/autogen_found_items.m4])
4444
4545AC_INIT([pmix],
4646 [m4_normalize(esyscmd([config/pmix_get_version.sh VERSION --tarball]))],
47- [http ://pmix. github.io/master ], [pmix])
47+ [https ://github.com/pmix/pmix/issues ], [pmix])
4848AC_PREREQ(2.69)
4949AC_CONFIG_AUX_DIR(./config)
5050# Note that this directory must *exactly* match what was specified via
5151# -I in ACLOCAL_AMFLAGS in the top-level Makefile.am.
5252AC_CONFIG_MACRO_DIR(./config)
5353
54+ # autotools expects to perform tests without interference
55+ # from user-provided CFLAGS, particularly -Werror flags.
56+ # Search for them here and cache any we find
57+ PMIX_CFLAGS_cache=
58+ PMIX_CFLAGS_pass=
59+ for val in $CFLAGS ; do
60+ if echo " $val " | grep -q -e " -W" ; then
61+ PMIX_CFLAGS_cache=" $PMIX_CFLAGS_cache $val " ;
62+ else
63+ PMIX_CFLAGS_pass=" $PMIX_CFLAGS_pass $val " ;
64+ fi
65+ done
66+ CFLAGS=$PMIX_CFLAGS_pass
67+
5468PMIX_CAPTURE_CONFIGURE_CLI([PMIX_CONFIGURE_CLI])
5569
5670# Get our platform support file. This has to be done very, very early
@@ -208,7 +222,17 @@ AS_IF([test -z "$CC_FOR_BUILD"],[
208222 AC_SUBST([CC_FOR_BUILD], [$CC ])
209223])
210224
225+ # restore any user-provided Werror flags
226+ AS_IF([test ! -z " $PMIX_CFLAGS_cache " ], [CFLAGS= " $CFLAGS $PMIX_CFLAGS_cache " ])
227+
228+ # Delay setting pickyness until here so we
229+ # don't break configure code tests
230+ # if test "$WANT_PICKY_COMPILER" = "1"; then
231+ # CFLAGS="$CFLAGS -Wall -Wextra -Werror"
232+ # fi
233+
211234# Cleanup duplicate flags
235+ PMIX_FLAGS_UNIQ(CFLAGS)
212236PMIX_FLAGS_UNIQ(CPPFLAGS)
213237PMIX_FLAGS_UNIQ(LDFLAGS)
214238PMIX_FLAGS_UNIQ(LIBS)
@@ -235,6 +259,17 @@ AC_MSG_RESULT([$LDFLAGS])
235259AC_MSG_CHECKING([final LIBS])
236260AC_MSG_RESULT([$LIBS ])
237261
262+ # ###################################################################
263+ # -Werror for CI scripts
264+ # ###################################################################
265+
266+ AC_ARG_ENABLE(werror,
267+ AC_HELP_STRING([--enable-werror],
268+ [Treat compiler warnings as errors]),
269+ [
270+ CFLAGS= " $CFLAGS -Werror"
271+ ])
272+
238273# ###################################################################
239274# Version information
240275# ###################################################################
0 commit comments