diff --git a/configure.ac b/configure.ac index ee8c097..2c8cd71 100644 --- a/configure.ac +++ b/configure.ac @@ -58,6 +58,22 @@ DX_INIT_DOXYGEN(libykpiv,lib/Doxyfile) gl_LD_VERSION_SCRIPT gl_VALGRIND_TESTS +# Check for clang +AC_CACHE_CHECK([for clang], + cv_clang,[ + AC_TRY_COMPILE([], [ + #ifdef __clang__ + #else + #error "NOT CLANG" + #endif + return 0; + ], + [cv_clang=yes], + [cv_clang=no], + []) +]) +AM_CONDITIONAL([COMPILER_CLANG], [test "$cv_clang" = yes]) + AC_ARG_WITH([backend], [AS_HELP_STRING([--with-backend=ARG], [use specific backend/linkage; 'pcsc', 'macscard' or 'winscard'])], diff --git a/lib/tests/Makefile.am b/lib/tests/Makefile.am index 479fbdc..858cf1f 100644 --- a/lib/tests/Makefile.am +++ b/lib/tests/Makefile.am @@ -1,18 +1,18 @@ # Copyright (c) 2014-2016 Yubico AB # All rights reserved. -# +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: -# +# # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. -# +# # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. -# +# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -28,7 +28,14 @@ AM_CFLAGS = $(WARN_CFLAGS) @CHECK_CFLAGS@ $(OPENSSL_CFLAGS) AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_builddir)/lib $(OPENSSL_CFLAGS) -AM_LDFLAGS = -no-install @CHECK_LIBS@ +AM_LDFLAGS = @CHECK_LIBS@ + +if COMPILER_CLANG +AM_LDFLAGS += -no-fast-install +else +AM_LDFLAGS += -no-install +endif + LDADD = ../libykpiv.la $(OPENSSL_LIBS) check_PROGRAMS = basic parse_key api diff --git a/tool/tests/Makefile.am b/tool/tests/Makefile.am index 1d76905..13dc665 100644 --- a/tool/tests/Makefile.am +++ b/tool/tests/Makefile.am @@ -1,18 +1,18 @@ # Copyright (c) 2014-2016 Yubico AB # All rights reserved. -# +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: -# +# # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. -# +# # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. -# +# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -34,7 +34,13 @@ AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_builddir)/lib AM_CPPFLAGS += -I$(top_srcdir)/tool -I$(top_builddir)/tool AM_CPPFLAGS += $(OPENSSL_CFLAGS) -AM_LDFLAGS = -no-install @CHECK_LIBS@ +AM_LDFLAGS = @CHECK_LIBS@ + +if COMPILER_CLANG +AM_LDFLAGS += -no-fast-install +else +AM_LDFLAGS += -no-install +endif parse_name_LDADD = ../libpiv_util.la $(OPENSSL_LIBS) test_inout_LDADD = ../libpiv_util.la diff --git a/ykcs11/tests/Makefile.am b/ykcs11/tests/Makefile.am index 3289626..4ab1182 100644 --- a/ykcs11/tests/Makefile.am +++ b/ykcs11/tests/Makefile.am @@ -1,6 +1,6 @@ # Copyright (c) 2015-2016 Yubico AB # All rights reserved. -# +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: @@ -34,7 +34,13 @@ AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_builddir)/lib AM_CPPFLAGS += -I$(top_srcdir)/ykcs11 -I$(top_builddir)/ykcs11 AM_CPPFLAGS += $(OPENSSL_CFLAGS) -AM_LDFLAGS = -no-install @CHECK_LIBS@ +AM_LDFLAGS = @CHECK_LIBS@ + +if COMPILER_CLANG +AM_LDFLAGS += -no-fast-install +else +AM_LDFLAGS += -no-install +endif ykcs11_tests_LDADD = ../libykcs11.la $(OPENSSL_LIBS) diff --git a/ykcs11/tests/ykcs11_tests.c b/ykcs11/tests/ykcs11_tests.c index b64c8db..0894e5a 100644 --- a/ykcs11/tests/ykcs11_tests.c +++ b/ykcs11/tests/ykcs11_tests.c @@ -39,6 +39,9 @@ #include #include +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpointer-sign" + void dump_hex(const unsigned char *buf, unsigned int len, FILE *output, int space) { unsigned int i; for (i = 0; i < len; i++) { @@ -662,3 +665,5 @@ int main(void) { return EXIT_SUCCESS; } + +#pragma clang diagnostic pop