5d7b53a25dbf8331ca44c76be04e9b4e938008c2
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / rpm / 0008-short-circuit-c99.patch
1 Buildroot specific
2 diff -ru rpm-5.1.9_vanilla/xz/configure rpm-5.1.9_short-circuit-c99/xz/configure
3 --- rpm-5.1.9_vanilla/xz/configure      2009-04-18 16:47:23.000000000 +0000
4 +++ rpm-5.1.9_short-circuit-c99/xz/configure    2009-08-04 08:25:59.000000000 +0000
5 @@ -4970,214 +4970,7 @@
6    am__fastdepCC_FALSE=
7  fi
8  
9 -
10 -   { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C99" >&5
11 -$as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
12 -if test "${ac_cv_prog_cc_c99+set}" = set; then
13 -  $as_echo_n "(cached) " >&6
14 -else
15 -  ac_cv_prog_cc_c99=no
16 -ac_save_CC=$CC
17 -cat >conftest.$ac_ext <<_ACEOF
18 -/* confdefs.h.  */
19 -_ACEOF
20 -cat confdefs.h >>conftest.$ac_ext
21 -cat >>conftest.$ac_ext <<_ACEOF
22 -/* end confdefs.h.  */
23 -#include <stdarg.h>
24 -#include <stdbool.h>
25 -#include <stdlib.h>
26 -#include <wchar.h>
27 -#include <stdio.h>
28 -
29 -// Check varargs macros.  These examples are taken from C99 6.10.3.5.
30 -#define debug(...) fprintf (stderr, __VA_ARGS__)
31 -#define showlist(...) puts (#__VA_ARGS__)
32 -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
33 -static void
34 -test_varargs_macros (void)
35 -{
36 -  int x = 1234;
37 -  int y = 5678;
38 -  debug ("Flag");
39 -  debug ("X = %d\n", x);
40 -  showlist (The first, second, and third items.);
41 -  report (x>y, "x is %d but y is %d", x, y);
42 -}
43 -
44 -// Check long long types.
45 -#define BIG64 18446744073709551615ull
46 -#define BIG32 4294967295ul
47 -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
48 -#if !BIG_OK
49 -  your preprocessor is broken;
50 -#endif
51 -#if BIG_OK
52 -#else
53 -  your preprocessor is broken;
54 -#endif
55 -static long long int bignum = -9223372036854775807LL;
56 -static unsigned long long int ubignum = BIG64;
57 -
58 -struct incomplete_array
59 -{
60 -  int datasize;
61 -  double data[];
62 -};
63 -
64 -struct named_init {
65 -  int number;
66 -  const wchar_t *name;
67 -  double average;
68 -};
69 -
70 -typedef const char *ccp;
71 -
72 -static inline int
73 -test_restrict (ccp restrict text)
74 -{
75 -  // See if C++-style comments work.
76 -  // Iterate through items via the restricted pointer.
77 -  // Also check for declarations in for loops.
78 -  for (unsigned int i = 0; *(text+i) != '\0'; ++i)
79 -    continue;
80 -  return 0;
81 -}
82 -
83 -// Check varargs and va_copy.
84 -static void
85 -test_varargs (const char *format, ...)
86 -{
87 -  va_list args;
88 -  va_start (args, format);
89 -  va_list args_copy;
90 -  va_copy (args_copy, args);
91 -
92 -  const char *str;
93 -  int number;
94 -  float fnumber;
95 -
96 -  while (*format)
97 -    {
98 -      switch (*format++)
99 -       {
100 -       case 's': // string
101 -         str = va_arg (args_copy, const char *);
102 -         break;
103 -       case 'd': // int
104 -         number = va_arg (args_copy, int);
105 -         break;
106 -       case 'f': // float
107 -         fnumber = va_arg (args_copy, double);
108 -         break;
109 -       default:
110 -         break;
111 -       }
112 -    }
113 -  va_end (args_copy);
114 -  va_end (args);
115 -}
116 -
117 -int
118 -main ()
119 -{
120 -
121 -  // Check bool.
122 -  _Bool success = false;
123 -
124 -  // Check restrict.
125 -  if (test_restrict ("String literal") == 0)
126 -    success = true;
127 -  char *restrict newvar = "Another string";
128 -
129 -  // Check varargs.
130 -  test_varargs ("s, d' f .", "string", 65, 34.234);
131 -  test_varargs_macros ();
132 -
133 -  // Check flexible array members.
134 -  struct incomplete_array *ia =
135 -    malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
136 -  ia->datasize = 10;
137 -  for (int i = 0; i < ia->datasize; ++i)
138 -    ia->data[i] = i * 1.234;
139 -
140 -  // Check named initializers.
141 -  struct named_init ni = {
142 -    .number = 34,
143 -    .name = L"Test wide string",
144 -    .average = 543.34343,
145 -  };
146 -
147 -  ni.number = 58;
148 -
149 -  int dynamic_array[ni.number];
150 -  dynamic_array[ni.number - 1] = 543;
151 -
152 -  // work around unused variable warnings
153 -  return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
154 -         || dynamic_array[ni.number - 1] != 543);
155 -
156 -  ;
157 -  return 0;
158 -}
159 -_ACEOF
160 -for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99
161 -do
162 -  CC="$ac_save_CC $ac_arg"
163 -  rm -f conftest.$ac_objext
164 -if { (ac_try="$ac_compile"
165 -case "(($ac_try" in
166 -  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
167 -  *) ac_try_echo=$ac_try;;
168 -esac
169 -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
170 -$as_echo "$ac_try_echo") >&5
171 -  (eval "$ac_compile") 2>conftest.er1
172 -  ac_status=$?
173 -  grep -v '^ *+' conftest.er1 >conftest.err
174 -  rm -f conftest.er1
175 -  cat conftest.err >&5
176 -  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
177 -  (exit $ac_status); } && {
178 -        test -z "$ac_c_werror_flag" ||
179 -        test ! -s conftest.err
180 -       } && test -s conftest.$ac_objext; then
181 -  ac_cv_prog_cc_c99=$ac_arg
182 -else
183 -  $as_echo "$as_me: failed program was:" >&5
184 -sed 's/^/| /' conftest.$ac_ext >&5
185 -
186 -
187 -fi
188 -
189 -rm -f core conftest.err conftest.$ac_objext
190 -  test "x$ac_cv_prog_cc_c99" != "xno" && break
191 -done
192 -rm -f conftest.$ac_ext
193 -CC=$ac_save_CC
194 -
195 -fi
196 -# AC_CACHE_VAL
197 -case "x$ac_cv_prog_cc_c99" in
198 -  x)
199 -    { $as_echo "$as_me:$LINENO: result: none needed" >&5
200 -$as_echo "none needed" >&6; } ;;
201 -  xno)
202 -    { $as_echo "$as_me:$LINENO: result: unsupported" >&5
203 -$as_echo "unsupported" >&6; } ;;
204 -  *)
205 -    CC="$CC $ac_cv_prog_cc_c99"
206 -    { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c99" >&5
207 -$as_echo "$ac_cv_prog_cc_c99" >&6; } ;;
208 -esac
209 -
210 -
211 -
212 -if test x$ac_cv_prog_cc_c99 = xno ; then
213 -       { { $as_echo "$as_me:$LINENO: error: No C99 compiler was found." >&5
214 -$as_echo "$as_me: error: No C99 compiler was found." >&2;}
215 -   { (exit 1); exit 1; }; }
216 -fi
217 +CC="$CC -std=c99"
218  
219  if test "x$CC" != xcc; then
220    { $as_echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5
221 diff -ru rpm-5.1.9_vanilla/xz/configure.ac rpm-5.1.9_short-circuit-c99/xz/configure.ac
222 --- rpm-5.1.9_vanilla/xz/configure.ac   2009-02-16 17:07:46.000000000 +0000
223 +++ rpm-5.1.9_short-circuit-c99/xz/configure.ac 2009-08-04 08:25:28.000000000 +0000
224 @@ -402,10 +402,7 @@
225  AM_INIT_AUTOMAKE([1.10 foreign tar-v7 filename-length-max=99])
226  AC_PROG_LN_S
227  
228 -AC_PROG_CC_C99
229 -if test x$ac_cv_prog_cc_c99 = xno ; then
230 -       AC_MSG_ERROR([No C99 compiler was found.])
231 -fi
232 +CC="$CC -std=c99"
233  
234  AM_PROG_CC_C_O
235  AM_PROG_AS