3768 am__fastdepCC_TRUE='#' |
3769 am__fastdepCC_TRUE='#' |
3769 am__fastdepCC_FALSE= |
3770 am__fastdepCC_FALSE= |
3770 fi |
3771 fi |
3771 |
3772 |
3772 |
3773 |
3773 |
3774 case $ac_cv_prog_cc_stdc in #( |
3774 # Checks for libraries. |
3775 no) : |
|
3776 ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #( |
|
3777 *) : |
|
3778 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 |
|
3779 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; } |
|
3780 if ${ac_cv_prog_cc_c99+:} false; then : |
|
3781 $as_echo_n "(cached) " >&6 |
|
3782 else |
|
3783 ac_cv_prog_cc_c99=no |
|
3784 ac_save_CC=$CC |
|
3785 cat confdefs.h - <<_ACEOF >conftest.$ac_ext |
|
3786 /* end confdefs.h. */ |
|
3787 #include <stdarg.h> |
|
3788 #include <stdbool.h> |
|
3789 #include <stdlib.h> |
|
3790 #include <wchar.h> |
|
3791 #include <stdio.h> |
|
3792 |
|
3793 // Check varargs macros. These examples are taken from C99 6.10.3.5. |
|
3794 #define debug(...) fprintf (stderr, __VA_ARGS__) |
|
3795 #define showlist(...) puts (#__VA_ARGS__) |
|
3796 #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) |
|
3797 static void |
|
3798 test_varargs_macros (void) |
|
3799 { |
|
3800 int x = 1234; |
|
3801 int y = 5678; |
|
3802 debug ("Flag"); |
|
3803 debug ("X = %d\n", x); |
|
3804 showlist (The first, second, and third items.); |
|
3805 report (x>y, "x is %d but y is %d", x, y); |
|
3806 } |
|
3807 |
|
3808 // Check long long types. |
|
3809 #define BIG64 18446744073709551615ull |
|
3810 #define BIG32 4294967295ul |
|
3811 #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) |
|
3812 #if !BIG_OK |
|
3813 your preprocessor is broken; |
|
3814 #endif |
|
3815 #if BIG_OK |
|
3816 #else |
|
3817 your preprocessor is broken; |
|
3818 #endif |
|
3819 static long long int bignum = -9223372036854775807LL; |
|
3820 static unsigned long long int ubignum = BIG64; |
|
3821 |
|
3822 struct incomplete_array |
|
3823 { |
|
3824 int datasize; |
|
3825 double data[]; |
|
3826 }; |
|
3827 |
|
3828 struct named_init { |
|
3829 int number; |
|
3830 const wchar_t *name; |
|
3831 double average; |
|
3832 }; |
|
3833 |
|
3834 typedef const char *ccp; |
|
3835 |
|
3836 static inline int |
|
3837 test_restrict (ccp restrict text) |
|
3838 { |
|
3839 // See if C++-style comments work. |
|
3840 // Iterate through items via the restricted pointer. |
|
3841 // Also check for declarations in for loops. |
|
3842 for (unsigned int i = 0; *(text+i) != '\0'; ++i) |
|
3843 continue; |
|
3844 return 0; |
|
3845 } |
|
3846 |
|
3847 // Check varargs and va_copy. |
|
3848 static void |
|
3849 test_varargs (const char *format, ...) |
|
3850 { |
|
3851 va_list args; |
|
3852 va_start (args, format); |
|
3853 va_list args_copy; |
|
3854 va_copy (args_copy, args); |
|
3855 |
|
3856 const char *str; |
|
3857 int number; |
|
3858 float fnumber; |
|
3859 |
|
3860 while (*format) |
|
3861 { |
|
3862 switch (*format++) |
|
3863 { |
|
3864 case 's': // string |
|
3865 str = va_arg (args_copy, const char *); |
|
3866 break; |
|
3867 case 'd': // int |
|
3868 number = va_arg (args_copy, int); |
|
3869 break; |
|
3870 case 'f': // float |
|
3871 fnumber = va_arg (args_copy, double); |
|
3872 break; |
|
3873 default: |
|
3874 break; |
|
3875 } |
|
3876 } |
|
3877 va_end (args_copy); |
|
3878 va_end (args); |
|
3879 } |
|
3880 |
|
3881 int |
|
3882 main () |
|
3883 { |
|
3884 |
|
3885 // Check bool. |
|
3886 _Bool success = false; |
|
3887 |
|
3888 // Check restrict. |
|
3889 if (test_restrict ("String literal") == 0) |
|
3890 success = true; |
|
3891 char *restrict newvar = "Another string"; |
|
3892 |
|
3893 // Check varargs. |
|
3894 test_varargs ("s, d' f .", "string", 65, 34.234); |
|
3895 test_varargs_macros (); |
|
3896 |
|
3897 // Check flexible array members. |
|
3898 struct incomplete_array *ia = |
|
3899 malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); |
|
3900 ia->datasize = 10; |
|
3901 for (int i = 0; i < ia->datasize; ++i) |
|
3902 ia->data[i] = i * 1.234; |
|
3903 |
|
3904 // Check named initializers. |
|
3905 struct named_init ni = { |
|
3906 .number = 34, |
|
3907 .name = L"Test wide string", |
|
3908 .average = 543.34343, |
|
3909 }; |
|
3910 |
|
3911 ni.number = 58; |
|
3912 |
|
3913 int dynamic_array[ni.number]; |
|
3914 dynamic_array[ni.number - 1] = 543; |
|
3915 |
|
3916 // work around unused variable warnings |
|
3917 return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' |
|
3918 || dynamic_array[ni.number - 1] != 543); |
|
3919 |
|
3920 ; |
|
3921 return 0; |
|
3922 } |
|
3923 _ACEOF |
|
3924 for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 |
|
3925 do |
|
3926 CC="$ac_save_CC $ac_arg" |
|
3927 if ac_fn_c_try_compile "$LINENO"; then : |
|
3928 ac_cv_prog_cc_c99=$ac_arg |
|
3929 fi |
|
3930 rm -f core conftest.err conftest.$ac_objext |
|
3931 test "x$ac_cv_prog_cc_c99" != "xno" && break |
|
3932 done |
|
3933 rm -f conftest.$ac_ext |
|
3934 CC=$ac_save_CC |
|
3935 |
|
3936 fi |
|
3937 # AC_CACHE_VAL |
|
3938 case "x$ac_cv_prog_cc_c99" in |
|
3939 x) |
|
3940 { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 |
|
3941 $as_echo "none needed" >&6; } ;; |
|
3942 xno) |
|
3943 { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 |
|
3944 $as_echo "unsupported" >&6; } ;; |
|
3945 *) |
|
3946 CC="$CC $ac_cv_prog_cc_c99" |
|
3947 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 |
|
3948 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;; |
|
3949 esac |
|
3950 if test "x$ac_cv_prog_cc_c99" != xno; then : |
|
3951 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 |
|
3952 else |
|
3953 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 |
|
3954 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } |
|
3955 if ${ac_cv_prog_cc_c89+:} false; then : |
|
3956 $as_echo_n "(cached) " >&6 |
|
3957 else |
|
3958 ac_cv_prog_cc_c89=no |
|
3959 ac_save_CC=$CC |
|
3960 cat confdefs.h - <<_ACEOF >conftest.$ac_ext |
|
3961 /* end confdefs.h. */ |
|
3962 #include <stdarg.h> |
|
3963 #include <stdio.h> |
|
3964 struct stat; |
|
3965 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ |
|
3966 struct buf { int x; }; |
|
3967 FILE * (*rcsopen) (struct buf *, struct stat *, int); |
|
3968 static char *e (p, i) |
|
3969 char **p; |
|
3970 int i; |
|
3971 { |
|
3972 return p[i]; |
|
3973 } |
|
3974 static char *f (char * (*g) (char **, int), char **p, ...) |
|
3975 { |
|
3976 char *s; |
|
3977 va_list v; |
|
3978 va_start (v,p); |
|
3979 s = g (p, va_arg (v,int)); |
|
3980 va_end (v); |
|
3981 return s; |
|
3982 } |
|
3983 |
|
3984 /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has |
|
3985 function prototypes and stuff, but not '\xHH' hex character constants. |
|
3986 These don't provoke an error unfortunately, instead are silently treated |
|
3987 as 'x'. The following induces an error, until -std is added to get |
|
3988 proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an |
|
3989 array size at least. It's necessary to write '\x00'==0 to get something |
|
3990 that's true only with -std. */ |
|
3991 int osf4_cc_array ['\x00' == 0 ? 1 : -1]; |
|
3992 |
|
3993 /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters |
|
3994 inside strings and character constants. */ |
|
3995 #define FOO(x) 'x' |
|
3996 int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; |
|
3997 |
|
3998 int test (int i, double x); |
|
3999 struct s1 {int (*f) (int a);}; |
|
4000 struct s2 {int (*f) (double a);}; |
|
4001 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); |
|
4002 int argc; |
|
4003 char **argv; |
|
4004 int |
|
4005 main () |
|
4006 { |
|
4007 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; |
|
4008 ; |
|
4009 return 0; |
|
4010 } |
|
4011 _ACEOF |
|
4012 for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ |
|
4013 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" |
|
4014 do |
|
4015 CC="$ac_save_CC $ac_arg" |
|
4016 if ac_fn_c_try_compile "$LINENO"; then : |
|
4017 ac_cv_prog_cc_c89=$ac_arg |
|
4018 fi |
|
4019 rm -f core conftest.err conftest.$ac_objext |
|
4020 test "x$ac_cv_prog_cc_c89" != "xno" && break |
|
4021 done |
|
4022 rm -f conftest.$ac_ext |
|
4023 CC=$ac_save_CC |
|
4024 |
|
4025 fi |
|
4026 # AC_CACHE_VAL |
|
4027 case "x$ac_cv_prog_cc_c89" in |
|
4028 x) |
|
4029 { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 |
|
4030 $as_echo "none needed" >&6; } ;; |
|
4031 xno) |
|
4032 { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 |
|
4033 $as_echo "unsupported" >&6; } ;; |
|
4034 *) |
|
4035 CC="$CC $ac_cv_prog_cc_c89" |
|
4036 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 |
|
4037 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; |
|
4038 esac |
|
4039 if test "x$ac_cv_prog_cc_c89" != xno; then : |
|
4040 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 |
|
4041 else |
|
4042 ac_cv_prog_cc_stdc=no |
|
4043 fi |
|
4044 |
|
4045 fi |
|
4046 ;; |
|
4047 esac |
|
4048 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5 |
|
4049 $as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; } |
|
4050 if ${ac_cv_prog_cc_stdc+:} false; then : |
|
4051 $as_echo_n "(cached) " >&6 |
|
4052 fi |
|
4053 |
|
4054 case $ac_cv_prog_cc_stdc in #( |
|
4055 no) : |
|
4056 { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 |
|
4057 $as_echo "unsupported" >&6; } ;; #( |
|
4058 '') : |
|
4059 { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 |
|
4060 $as_echo "none needed" >&6; } ;; #( |
|
4061 *) : |
|
4062 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5 |
|
4063 $as_echo "$ac_cv_prog_cc_stdc" >&6; } ;; |
|
4064 esac |
|
4065 |
3775 |
4066 |
3776 # Checks for header files. |
4067 # Checks for header files. |
3777 |
4068 |
3778 ac_ext=c |
4069 ac_ext=c |
3779 ac_cpp='$CPP $CPPFLAGS' |
4070 ac_cpp='$CPP $CPPFLAGS' |