1- $NetBSD: patch-ab,v 1.26 2019/02/14 14:36:06 thorpej Exp $
1+ $NetBSD: patch-ab,v 1.27 2024/06/18 12:49:22 markd Exp $
2+
3+ Port the configure script to C99. Add missing header files, avoid
4+ calling the undeclared exit function, and add missing return types
5+ main. This improves compatibility with compilers which do not accept
6+ language features that were removed from C99.
27
38--- dist/configure.orig 2010-04-12 20:25:23.000000000 +0000
49+++ dist/configure
@@ -173,7 +178,188 @@ $NetBSD: patch-ab,v 1.26 2019/02/14 14:36:06 thorpej Exp $
173178 hp*) _JNI_INC_SUBDIRS="hp-ux";;
174179 linux*) _JNI_INC_SUBDIRS="linux genunix";;
175180 osf*) _JNI_INC_SUBDIRS="alpha";;
176- @@ -19567,6 +19609,31 @@ fi
181+ @@ -18755,6 +18797,7 @@ if test "$cross_compiling" = yes; then :
182+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
183+ /* end confdefs.h. */
184+
185+ +#include <stdlib.h>
186+ #include <pthread.h>
187+ int
188+ main ()
189+ @@ -18791,8 +18834,9 @@ else
190+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
191+ /* end confdefs.h. */
192+
193+ +#include <stdlib.h>
194+ #include <pthread.h>
195+ -main() {
196+ +int main() {
197+ pthread_cond_t cond;
198+ pthread_mutex_t mutex;
199+ pthread_condattr_t condattr;
200+ @@ -18827,6 +18871,7 @@ if test "$cross_compiling" = yes; then :
201+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
202+ /* end confdefs.h. */
203+
204+ +#include <stdlib.h>
205+ #include <pthread.h>
206+ int
207+ main ()
208+ @@ -18863,8 +18908,9 @@ else
209+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
210+ /* end confdefs.h. */
211+
212+ +#include <stdlib.h>
213+ #include <pthread.h>
214+ -main() {
215+ +int main() {
216+ pthread_cond_t cond;
217+ pthread_mutex_t mutex;
218+ pthread_condattr_t condattr;
219+ @@ -18898,6 +18944,7 @@ if test "$cross_compiling" = yes; then :
220+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
221+ /* end confdefs.h. */
222+
223+ +#include <stdlib.h>
224+ #include <pthread.h>
225+ int
226+ main ()
227+ @@ -18932,8 +18979,9 @@ else
228+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
229+ /* end confdefs.h. */
230+
231+ +#include <stdlib.h>
232+ #include <pthread.h>
233+ -main() {
234+ +int main() {
235+ pthread_cond_t cond;
236+ pthread_mutex_t mutex;
237+ pthread_condattr_t condattr;
238+ @@ -18966,6 +19014,7 @@ if test "$cross_compiling" = yes; then :
239+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
240+ /* end confdefs.h. */
241+
242+ +#include <stdlib.h>
243+ #include <pthread.h>
244+ int
245+ main ()
246+ @@ -19000,8 +19049,9 @@ else
247+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
248+ /* end confdefs.h. */
249+
250+ +#include <stdlib.h>
251+ #include <pthread.h>
252+ -main() {
253+ +int main() {
254+ pthread_cond_t cond;
255+ pthread_mutex_t mutex;
256+ pthread_condattr_t condattr;
257+ @@ -19037,6 +19087,7 @@ fi
258+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
259+ /* end confdefs.h. */
260+
261+ +#include <stdlib.h>
262+ #include <synch.h>
263+ int
264+ main ()
265+ @@ -19067,6 +19118,7 @@ rm -f core conftest.err conftest.$ac_obj
266+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
267+ /* end confdefs.h. */
268+
269+ +#include <stdlib.h>
270+ #include <thread.h>
271+ #include <synch.h>
272+ int
273+ @@ -19097,6 +19149,7 @@ rm -f core conftest.err conftest.$ac_obj
274+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
275+ /* end confdefs.h. */
276+
277+ +#include <stdlib.h>
278+ #include <thread.h>
279+ #include <synch.h>
280+ int
281+ @@ -19141,7 +19194,7 @@ main ()
282+ {
283+
284+ #if (defined(i386) || defined(__i386__)) && defined(__GNUC__)
285+ - exit(0);
286+ + return 0;
287+ #else
288+ FAIL TO COMPILE/LINK
289+ #endif
290+ @@ -19164,7 +19217,7 @@ main ()
291+ {
292+
293+ #if (defined(x86_64) || defined(__x86_64__)) && defined(__GNUC__)
294+ - exit(0);
295+ + return 0;
296+ #else
297+ FAIL TO COMPILE/LINK
298+ #endif
299+ @@ -19216,7 +19269,7 @@ main ()
300+
301+ #if defined(__sparc__) && defined(__GNUC__)
302+ asm volatile ("membar #StoreStore|#StoreLoad|#LoadStore");
303+ - exit(0);
304+ + return 0;
305+ #else
306+ FAIL TO COMPILE/LINK
307+ #endif
308+ @@ -19287,7 +19340,7 @@ main ()
309+ msem_init(&x, 0);
310+ msem_lock(&x, 0);
311+ msem_unlock(&x, 0);
312+ - exit(0);
313+ + return 0;
314+ #else
315+ FAIL TO COMPILE/LINK
316+ #endif
317+ @@ -19319,7 +19372,7 @@ main ()
318+ msem_init(&x, 0);
319+ msem_lock(&x, 0);
320+ msem_unlock(&x, 0);
321+ - exit(0);
322+ + return 0;
323+
324+ ;
325+ return 0;
326+ @@ -19371,7 +19424,7 @@ main ()
327+ {
328+
329+ #if defined(__USLC__)
330+ - exit(0);
331+ + return 0;
332+ #else
333+ FAIL TO COMPILE/LINK
334+ #endif
335+ @@ -19502,7 +19555,7 @@ main ()
336+ {
337+
338+ #if defined(__alpha) && defined(__DECC)
339+ - exit(0);
340+ + return 0;
341+ #else
342+ FAIL TO COMPILE/LINK
343+ #endif
344+ @@ -19527,7 +19580,7 @@ main ()
345+ {
346+
347+ #if defined(__alpha) && defined(__GNUC__)
348+ - exit(0);
349+ + return 0;
350+ #else
351+ FAIL TO COMPILE/LINK
352+ #endif
353+ @@ -19552,7 +19605,7 @@ main ()
354+ {
355+
356+ #if defined(__arm__) && defined(__GNUC__)
357+ - exit(0);
358+ + return 0;
359+ #else
360+ FAIL TO COMPILE/LINK
361+ #endif
362+ @@ -19567,6 +19620,31 @@ fi
177363 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
178364 fi
179365
@@ -187,7 +373,7 @@ $NetBSD: patch-ab,v 1.26 2019/02/14 14:36:06 thorpej Exp $
187373+{
188374+
189375+#if defined(__aarch64__) && defined(__GNUC__)
190- + exit(0) ;
376+ + return 0 ;
191377+#else
192378+ FAIL TO COMPILE/LINK
193379+#endif
@@ -205,7 +391,79 @@ $NetBSD: patch-ab,v 1.26 2019/02/14 14:36:06 thorpej Exp $
205391 # MIPS/gcc: Linux
206392 if test "$db_cv_mutex" = no; then
207393 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
208- @@ -19862,6 +19929,10 @@ ARM/gcc-assembly) ADDITIONAL_OBJS="mut_t
394+ @@ -19577,7 +19655,7 @@ main ()
395+ {
396+
397+ #if (defined(__mips) || defined(__mips__)) && defined(__GNUC__)
398+ - exit(0);
399+ + return 0;
400+ #else
401+ FAIL TO COMPILE/LINK
402+ #endif
403+ @@ -19602,7 +19680,7 @@ main ()
404+ {
405+
406+ #if (defined(__hppa) || defined(__hppa__)) && defined(__GNUC__)
407+ - exit(0);
408+ + return 0;
409+ #else
410+ FAIL TO COMPILE/LINK
411+ #endif
412+ @@ -19627,7 +19705,7 @@ main ()
413+ {
414+
415+ #if (defined(__powerpc__) || defined(__ppc__)) && defined(__GNUC__)
416+ - exit(0);
417+ + return 0;
418+ #else
419+ FAIL TO COMPILE/LINK
420+ #endif
421+ @@ -19652,7 +19730,7 @@ main ()
422+ {
423+
424+ #if (defined(mc68020) || defined(sun3)) && defined(__GNUC__)
425+ - exit(0);
426+ + return 0;
427+ #else
428+ FAIL TO COMPILE/LINK
429+ #endif
430+ @@ -19677,7 +19755,7 @@ main ()
431+ {
432+
433+ #if defined(__MVS__) && defined(__IBMC__)
434+ - exit(0);
435+ + return 0;
436+ #else
437+ FAIL TO COMPILE/LINK
438+ #endif
439+ @@ -19702,7 +19780,7 @@ main ()
440+ {
441+
442+ #if defined(__s390__) && defined(__GNUC__)
443+ - exit(0);
444+ + return 0;
445+ #else
446+ FAIL TO COMPILE/LINK
447+ #endif
448+ @@ -19727,7 +19805,7 @@ main ()
449+ {
450+
451+ #if defined(__ia64) && defined(__GNUC__)
452+ - exit(0);
453+ + return 0;
454+ #else
455+ FAIL TO COMPILE/LINK
456+ #endif
457+ @@ -19752,7 +19830,7 @@ main ()
458+ {
459+
460+ #if defined(_UTS)
461+ - exit(0);
462+ + return 0;
463+ #else
464+ FAIL TO COMPILE/LINK
465+ #endif
466+ @@ -19862,6 +19940,10 @@ ARM/gcc-assembly) ADDITIONAL_OBJS="mut_t
209467 $as_echo "#define HAVE_MUTEX_ARM_GCC_ASSEMBLY 1" >>confdefs.h
210468
211469 ;;
@@ -216,3 +474,53 @@ $NetBSD: patch-ab,v 1.26 2019/02/14 14:36:06 thorpej Exp $
216474 HP/msem_init) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
217475 $as_echo "#define HAVE_MUTEX_HPPA_MSEM_INIT 1" >>confdefs.h
218476
477+ @@ -20203,9 +20285,9 @@ main ()
478+ {
479+
480+ #if ((defined(i386) || defined(__i386__)) && defined(__GNUC__))
481+ - exit(0);
482+ + return 0;
483+ #elif ((defined(x86_64) || defined(__x86_64__)) && defined(__GNUC__))
484+ - exit(0);
485+ + return 0;
486+ #else
487+ FAIL TO COMPILE/LINK
488+ #endif
489+ @@ -20720,6 +20802,7 @@ if test "$cross_compiling" = yes; then :
490+ /* end confdefs.h. */
491+
492+ #include <sys/time.h>
493+ +#include <time.h>
494+ int
495+ main ()
496+ {
497+ @@ -20743,7 +20826,8 @@ else
498+ /* end confdefs.h. */
499+
500+ #include <sys/time.h>
501+ -main() {
502+ +#include <time.h>
503+ +int main() {
504+ struct timespec t;
505+ return (clock_gettime(CLOCK_MONOTONIC, &t) != 0);
506+ }
507+ @@ -21600,6 +21684,8 @@ $as_echo_n "checking for 64-bit integral
508+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
509+ /* end confdefs.h. */
510+
511+ +#include <stdio.h>
512+ +#include <string.h>
513+ int
514+ main ()
515+ {
516+ @@ -21634,7 +21720,9 @@ else
517+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
518+ /* end confdefs.h. */
519+
520+ - main() {
521+ + #include <stdio.h>
522+ + #include <string.h>
523+ + int main() {
524+ $db_cv_seq_type l;
525+ unsigned $db_cv_seq_type u;
526+ char buf[100];
0 commit comments