diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-01-17 20:00:00 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-01-17 20:00:00 +0300 |
commit | 16cbf3c076a0aca6d47adaf3f719493674cf2363 (patch) | |
tree | e6530480020f62a2bdbf249988ec3e2a751d3927 /auto/clang | |
download | unit-16cbf3c076a0aca6d47adaf3f719493674cf2363.tar.gz unit-16cbf3c076a0aca6d47adaf3f719493674cf2363.tar.bz2 |
Initial version.
Diffstat (limited to 'auto/clang')
-rw-r--r-- | auto/clang | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/auto/clang b/auto/clang new file mode 100644 index 00000000..fc69bf6f --- /dev/null +++ b/auto/clang @@ -0,0 +1,135 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) NGINX, Inc. + + +# C language features. + + +nxt_feature="C99 variadic macro" +nxt_feature_name=NXT_HAVE_C99_VARIADIC_MACRO +nxt_feature_run=yes +nxt_feature_path= +nxt_feature_libs= +nxt_feature_test="#include <stdio.h> + #define set(dummy, ...) sprintf(__VA_ARGS__) + + int main() { + char buf[4]; + + buf[0] = '0'; + set(0, buf, \"%d\", 1); + + if (buf[0] == '1') + return 0; + return 1; + }" +. auto/feature + + +if [ $nxt_found = no ]; then + + nxt_feature="GCC variadic macro" + nxt_feature_name=NXT_HAVE_GCC_VARIADIC_MACRO + nxt_feature_run=yes + nxt_feature_path= + nxt_feature_libs= + nxt_feature_test="#include <stdio.h> + #define set(dummy, args...) sprintf(args) + + int main() { + char buf[4]; + + buf[0] = '0'; + set(0, buf, \"%d\", 1); + + if (buf[0] == '1') + return 0; + return 1; + }" + . auto/feature +fi + + +nxt_feature="GCC __builtin_expect()" +nxt_feature_name=NXT_HAVE_BUILTIN_EXPECT +nxt_feature_run=no +nxt_feature_incs= +nxt_feature_libs= +nxt_feature_test="int main(int argc, char *const *argv) { + if ((__typeof__(argc == 0)) + __builtin_expect((argc == 0), 0)) + return 0; + return 1; + }" +. auto/feature + + +nxt_feature="GCC __builtin_unreachable()" +nxt_feature_name=NXT_HAVE_BUILTIN_UNREACHABLE +nxt_feature_run=no +nxt_feature_incs= +nxt_feature_libs= +nxt_feature_test="int main() { + __builtin_unreachable(); + }" +. auto/feature + + +nxt_feature="GCC __builtin_prefetch()" +nxt_feature_name=NXT_HAVE_BUILTIN_PREFETCH +nxt_feature_run=no +nxt_feature_incs= +nxt_feature_libs= +nxt_feature_test="int main() { + __builtin_prefetch(0); + }" +. auto/feature + + +nxt_feature="GCC __attribute__ visibility" +nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_VISIBILITY +nxt_feature_run= +nxt_feature_path= +nxt_feature_libs= +nxt_feature_test="int n __attribute__ ((visibility(\"default\"))); + + int main() { + return 1; + }" +. auto/feature + + +nxt_feature="GCC __attribute__ aligned" +nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_ALIGNED +nxt_feature_run= +nxt_feature_path= +nxt_feature_libs= +nxt_feature_test="int n __attribute__ ((aligned(64))); + + int main() { + return 1; + }" +. auto/feature + + +nxt_feature="GCC __attribute__ malloc" +nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_MALLOC +nxt_feature_run= +nxt_feature_path= +nxt_feature_libs= +nxt_feature_test="#include <stdlib.h> + + void *f(void) __attribute__ ((__malloc__)); + + void *f(void) { + return malloc(1); + } + + int main() { + if (f() != NULL) { + return 1; + } + return 0; + }" +. auto/feature |