]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
build: use the appropriate single file include option with xlc
authorPádraig Brady <P@draigBrady.com>
Fri, 4 Aug 2017 06:39:26 +0000 (23:39 -0700)
committerPádraig Brady <P@draigBrady.com>
Mon, 14 Aug 2017 04:33:01 +0000 (21:33 -0700)
* configure.ac: Set USE_XLC_INCLUDE when __xlc__ is defined.
* src/local.mk: Use it to select the appropriate include option.
Reported by Michael Felt.

configure.ac
src/local.mk

index 73e445d02ad072d9672d962a8757799998fcfabe..80bda2b6a90bfbd6a2797d9c949e5fdfd61683cb 100644 (file)
@@ -500,6 +500,18 @@ fi
 CFLAGS=$ac_save_CFLAGS
 LDFLAGS=$ac_save_LDFLAGS
 
+# Detect when using xlc to determine whether to use -qinclude=
+AC_CACHE_CHECK([whether the system supports xlc include], [utils_cv_xlc],
+  [AC_COMPILE_IFELSE(
+     [AC_LANG_PROGRAM([[
+          #ifndef __xlc__
+            #error "not xlc"
+          #endif
+        ]])],
+     [utils_cv_xlc=yes],
+     [utils_cv_xlc=no])])
+AM_CONDITIONAL([USE_XLC_INCLUDE], [test "$utils_cv_xlc" = yes])
+
 ############################################################################
 
 dnl Autogenerated by the 'gen-lists-of-programs.sh' auxiliary script.
index 9b2b172d264de43bcae36225c3cc1fa169c391a7..1cb685906cea98a3af29a838bd289ed27d46e714 100644 (file)
@@ -397,8 +397,14 @@ src_sha384sum_SOURCES = src/md5sum.c
 src_sha384sum_CPPFLAGS = -DHASH_ALGO_SHA384=1 $(AM_CPPFLAGS)
 src_sha512sum_SOURCES = src/md5sum.c
 src_sha512sum_CPPFLAGS = -DHASH_ALGO_SHA512=1 $(AM_CPPFLAGS)
-src_b2sum_CPPFLAGS = -include config.h -DHASH_ALGO_BLAKE2=1 \
-                    $(AM_CPPFLAGS)
+# Include the file on the command line to avoid modifying
+# the blake2 upstream source
+if USE_XLC_INCLUDE
+src_b2sum_CPPFLAGS = -qinclude=config.h
+else
+src_b2sum_CPPFLAGS = -include config.h
+endif
+src_b2sum_CPPFLAGS += -DHASH_ALGO_BLAKE2=1 $(AM_CPPFLAGS)
 src_b2sum_SOURCES = src/md5sum.c \
                    src/blake2/blake2.h src/blake2/blake2-impl.h \
                    src/blake2/blake2b-ref.c \