Newer
Older
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# $Id$
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
# serial 8
dnl CURL_INCLUDES_SIGNAL
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when signal.h is to be included.
AC_DEFUN([CURL_INCLUDES_SIGNAL], [
curl_includes_signal="\
/* includes start */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SIGNAL_H
# include <signal.h>
#endif
/* includes end */"
AC_CHECK_HEADERS(
sys/types.h signal.h,
[], [], [$curl_includes_signal])
])
dnl CURL_INCLUDES_STDIO
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when stdio.h is to be included.
AC_DEFUN([CURL_INCLUDES_STDIO], [
curl_includes_stdio="\
/* includes start */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif
/* includes end */"
AC_CHECK_HEADERS(
sys/types.h stdio.h,
[], [], [$curl_includes_stdio])
])
dnl CURL_INCLUDES_STDLIB
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when stdlib.h is to be included.
AC_DEFUN([CURL_INCLUDES_STDLIB], [
curl_includes_stdlib="\
/* includes start */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
/* includes end */"
AC_CHECK_HEADERS(
sys/types.h stdlib.h,
[], [], [$curl_includes_stdlib])
])
dnl CURL_INCLUDES_STRING
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when string.h is to be included.
AC_DEFUN([CURL_INCLUDES_STRING], [
curl_includes_string="\
/* includes start */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
/* includes end */"
AC_CHECK_HEADERS(
sys/types.h string.h,
[], [], [$curl_includes_string])
])
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
dnl CURL_INCLUDES_TIME
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when time.h is to be included.
AC_DEFUN([CURL_INCLUDES_TIME], [
AC_REQUIRE([AC_HEADER_TIME])dnl
curl_includes_time="\
/* includes start */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
# ifdef TIME_WITH_SYS_TIME
# include <time.h>
# endif
#else
# ifdef HAVE_TIME_H
# include <time.h>
# endif
#endif
/* includes end */"
AC_CHECK_HEADERS(
sys/types.h sys/time.h time.h,
[], [], [$curl_includes_time])
])
dnl CURL_INCLUDES_UNISTD
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when unistd.h is to be included.
AC_DEFUN([CURL_INCLUDES_UNISTD], [
curl_includes_unistd="\
/* includes start */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
/* includes end */"
AC_CHECK_HEADERS(
sys/types.h unistd.h,
[], [], [$curl_includes_unistd])
])
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
dnl CURL_CHECK_FUNC_FDOPEN
dnl -------------------------------------------------
dnl Verify if fdopen is available, prototyped, and
dnl can be compiled. If all of these are true, and
dnl usage has not been previously disallowed with
dnl shell variable curl_disallow_fdopen, then
dnl HAVE_FDOPEN will be defined.
AC_DEFUN([CURL_CHECK_FUNC_FDOPEN], [
AC_REQUIRE([CURL_INCLUDES_STDIO])dnl
#
tst_links_fdopen="unknown"
tst_proto_fdopen="unknown"
tst_compi_fdopen="unknown"
tst_allow_fdopen="unknown"
#
AC_MSG_CHECKING([if fdopen can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([fdopen])
],[
AC_MSG_RESULT([yes])
tst_links_fdopen="yes"
],[
AC_MSG_RESULT([no])
tst_links_fdopen="no"
])
#
if test "$tst_links_fdopen" = "yes"; then
AC_MSG_CHECKING([if fdopen is prototyped])
AC_EGREP_CPP([fdopen],[
$curl_includes_stdio
],[
AC_MSG_RESULT([yes])
tst_proto_fdopen="yes"
],[
AC_MSG_RESULT([no])
tst_proto_fdopen="no"
])
fi
#
if test "$tst_proto_fdopen" = "yes"; then
AC_MSG_CHECKING([if fdopen is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_stdio
]],[[
if(0 != fdopen(0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_fdopen="yes"
],[
AC_MSG_RESULT([no])
tst_compi_fdopen="no"
dnl temporary debug tracing follows
echo " " >&6
sed 's/^/cc-fail> /' conftest.err >&6
echo " " >&6
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
])
fi
#
if test "$tst_compi_fdopen" = "yes"; then
AC_MSG_CHECKING([if fdopen usage allowed])
if test "x$curl_disallow_fdopen" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_fdopen="yes"
else
AC_MSG_RESULT([no])
tst_allow_fdopen="no"
fi
fi
#
AC_MSG_CHECKING([if fdopen might be used])
if test "$tst_links_fdopen" = "yes" &&
test "$tst_proto_fdopen" = "yes" &&
test "$tst_compi_fdopen" = "yes" &&
test "$tst_allow_fdopen" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_FDOPEN, 1,
[Define to 1 if you have the fdopen function.])
ac_cv_func_fdopen="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_fdopen="no"
fi
])
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
dnl CURL_CHECK_FUNC_FTRUNCATE
dnl -------------------------------------------------
dnl Verify if ftruncate is available, prototyped, and
dnl can be compiled. If all of these are true, and
dnl usage has not been previously disallowed with
dnl shell variable curl_disallow_ftruncate, then
dnl HAVE_FTRUNCATE will be defined.
AC_DEFUN([CURL_CHECK_FUNC_FTRUNCATE], [
AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
#
tst_links_ftruncate="unknown"
tst_proto_ftruncate="unknown"
tst_compi_ftruncate="unknown"
tst_allow_ftruncate="unknown"
#
AC_MSG_CHECKING([if ftruncate can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([ftruncate])
],[
AC_MSG_RESULT([yes])
tst_links_ftruncate="yes"
],[
AC_MSG_RESULT([no])
tst_links_ftruncate="no"
])
#
if test "$tst_links_ftruncate" = "yes"; then
AC_MSG_CHECKING([if ftruncate is prototyped])
AC_EGREP_CPP([ftruncate],[
$curl_includes_unistd
],[
AC_MSG_RESULT([yes])
tst_proto_ftruncate="yes"
],[
AC_MSG_RESULT([no])
tst_proto_ftruncate="no"
])
fi
#
if test "$tst_proto_ftruncate" = "yes"; then
AC_MSG_CHECKING([if ftruncate is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_unistd
]],[[
if(0 != ftruncate(0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_ftruncate="yes"
],[
AC_MSG_RESULT([no])
tst_compi_ftruncate="no"
])
fi
#
if test "$tst_compi_ftruncate" = "yes"; then
AC_MSG_CHECKING([if ftruncate usage allowed])
if test "x$curl_disallow_ftruncate" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_ftruncate="yes"
else
AC_MSG_RESULT([no])
tst_allow_ftruncate="no"
fi
fi
#
AC_MSG_CHECKING([if ftruncate might be used])
if test "$tst_links_ftruncate" = "yes" &&
test "$tst_proto_ftruncate" = "yes" &&
test "$tst_compi_ftruncate" = "yes" &&
test "$tst_allow_ftruncate" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_FTRUNCATE, 1,
[Define to 1 if you have the ftruncate function.])
ac_cv_func_ftruncate="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_ftruncate="no"
fi
])
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
dnl CURL_CHECK_FUNC_GMTIME_R
dnl -------------------------------------------------
dnl Verify if gmtime_r is available, prototyped, can
dnl be compiled and seems to work. If all of these are
dnl true, and usage has not been previously disallowed
dnl with shell variable curl_disallow_gmtime_r, then
dnl HAVE_GMTIME_R will be defined.
AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [
AC_REQUIRE([CURL_INCLUDES_TIME])dnl
#
tst_links_gmtime_r="unknown"
tst_proto_gmtime_r="unknown"
tst_compi_gmtime_r="unknown"
tst_works_gmtime_r="unknown"
tst_allow_gmtime_r="unknown"
#
AC_MSG_CHECKING([if gmtime_r can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([gmtime_r])
],[
AC_MSG_RESULT([yes])
tst_links_gmtime_r="yes"
],[
AC_MSG_RESULT([no])
tst_links_gmtime_r="no"
])
#
if test "$tst_links_gmtime_r" = "yes"; then
AC_MSG_CHECKING([if gmtime_r is prototyped])
AC_EGREP_CPP([gmtime_r],[
$curl_includes_time
],[
AC_MSG_RESULT([yes])
tst_proto_gmtime_r="yes"
],[
AC_MSG_RESULT([no])
tst_proto_gmtime_r="no"
])
fi
#
if test "$tst_proto_gmtime_r" = "yes"; then
AC_MSG_CHECKING([if gmtime_r is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_time
]],[[
if(0 != gmtime_r(0, 0))
return 1;
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
]])
],[
AC_MSG_RESULT([yes])
tst_compi_gmtime_r="yes"
],[
AC_MSG_RESULT([no])
tst_compi_gmtime_r="no"
])
fi
#
dnl only do runtime verification when not cross-compiling
if test "x$cross_compiling" != "xyes" &&
test "$tst_compi_gmtime_r" = "yes"; then
AC_MSG_CHECKING([if gmtime_r seems to work])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_time
]],[[
time_t local = 1170352587;
struct tm *gmt = 0;
struct tm result;
gmt = gmtime_r(&local, &result);
if(gmt)
exit(0);
else
exit(1);
]])
],[
AC_MSG_RESULT([yes])
tst_works_gmtime_r="yes"
],[
AC_MSG_RESULT([no])
tst_works_gmtime_r="no"
])
fi
#
if test "$tst_compi_gmtime_r" = "yes" &&
test "$tst_works_gmtime_r" != "no"; then
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
AC_MSG_CHECKING([if gmtime_r usage allowed])
if test "x$curl_disallow_gmtime_r" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_gmtime_r="yes"
else
AC_MSG_RESULT([no])
tst_allow_gmtime_r="no"
fi
fi
#
AC_MSG_CHECKING([if gmtime_r might be used])
if test "$tst_links_gmtime_r" = "yes" &&
test "$tst_proto_gmtime_r" = "yes" &&
test "$tst_compi_gmtime_r" = "yes" &&
test "$tst_allow_gmtime_r" = "yes" &&
test "$tst_works_gmtime_r" != "no"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_GMTIME_R, 1,
[Define to 1 if you have a working gmtime_r function.])
ac_cv_func_gmtime_r="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_gmtime_r="no"
fi
])
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
dnl CURL_CHECK_FUNC_SIGACTION
dnl -------------------------------------------------
dnl Verify if sigaction is available, prototyped, and
dnl can be compiled. If all of these are true, and
dnl usage has not been previously disallowed with
dnl shell variable curl_disallow_sigaction, then
dnl HAVE_SIGACTION will be defined.
AC_DEFUN([CURL_CHECK_FUNC_SIGACTION], [
AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
#
tst_links_sigaction="unknown"
tst_proto_sigaction="unknown"
tst_compi_sigaction="unknown"
tst_allow_sigaction="unknown"
#
AC_MSG_CHECKING([if sigaction can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([sigaction])
],[
AC_MSG_RESULT([yes])
tst_links_sigaction="yes"
],[
AC_MSG_RESULT([no])
tst_links_sigaction="no"
])
#
if test "$tst_links_sigaction" = "yes"; then
AC_MSG_CHECKING([if sigaction is prototyped])
AC_EGREP_CPP([sigaction],[
$curl_includes_signal
],[
AC_MSG_RESULT([yes])
tst_proto_sigaction="yes"
],[
AC_MSG_RESULT([no])
tst_proto_sigaction="no"
])
fi
#
if test "$tst_proto_sigaction" = "yes"; then
AC_MSG_CHECKING([if sigaction is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_signal
]],[[
if(0 != sigaction(0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_sigaction="yes"
],[
AC_MSG_RESULT([no])
tst_compi_sigaction="no"
])
fi
#
if test "$tst_compi_sigaction" = "yes"; then
AC_MSG_CHECKING([if sigaction usage allowed])
if test "x$curl_disallow_sigaction" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_sigaction="yes"
else
AC_MSG_RESULT([no])
tst_allow_sigaction="no"
fi
fi
#
AC_MSG_CHECKING([if sigaction might be used])
if test "$tst_links_sigaction" = "yes" &&
test "$tst_proto_sigaction" = "yes" &&
test "$tst_compi_sigaction" = "yes" &&
test "$tst_allow_sigaction" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_SIGACTION, 1,
[Define to 1 if you have the sigaction function.])
ac_cv_func_sigaction="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_sigaction="no"
fi
])
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
dnl CURL_CHECK_FUNC_STRDUP
dnl -------------------------------------------------
dnl Verify if strdup is available, prototyped, and
dnl can be compiled. If all of these are true, and
dnl usage has not been previously disallowed with
dnl shell variable curl_disallow_strdup, then
dnl HAVE_STRDUP will be defined.
AC_DEFUN([CURL_CHECK_FUNC_STRDUP], [
AC_REQUIRE([CURL_INCLUDES_STRING])dnl
#
tst_links_strdup="unknown"
tst_proto_strdup="unknown"
tst_compi_strdup="unknown"
tst_allow_strdup="unknown"
#
AC_MSG_CHECKING([if strdup can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([strdup])
],[
AC_MSG_RESULT([yes])
tst_links_strdup="yes"
],[
AC_MSG_RESULT([no])
tst_links_strdup="no"
])
#
if test "$tst_links_strdup" = "yes"; then
AC_MSG_CHECKING([if strdup is prototyped])
AC_EGREP_CPP([strdup],[
$curl_includes_string
],[
AC_MSG_RESULT([yes])
tst_proto_strdup="yes"
],[
AC_MSG_RESULT([no])
tst_proto_strdup="no"
])
fi
#
if test "$tst_proto_strdup" = "yes"; then
AC_MSG_CHECKING([if strdup is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_string
]],[[
if(0 != strdup(0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_strdup="yes"
],[
AC_MSG_RESULT([no])
tst_compi_strdup="no"
])
fi
#
if test "$tst_compi_strdup" = "yes"; then
AC_MSG_CHECKING([if strdup usage allowed])
if test "x$curl_disallow_strdup" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_strdup="yes"
else
AC_MSG_RESULT([no])
tst_allow_strdup="no"
fi
fi
#
AC_MSG_CHECKING([if strdup might be used])
if test "$tst_links_strdup" = "yes" &&
test "$tst_proto_strdup" = "yes" &&
test "$tst_compi_strdup" = "yes" &&
test "$tst_allow_strdup" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1,
[Define to 1 if you have the strdup function.])
ac_cv_func_strdup="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_strdup="no"
fi
])
dnl CURL_CHECK_FUNC_STRERROR_R
dnl -------------------------------------------------
dnl Verify if strerror_r is available, prototyped, can be compiled and
dnl seems to work. If all of these are true, and usage has not been
dnl previously disallowed with shell variable curl_disallow_strerror_r,
dnl then HAVE_STRERROR_R and STRERROR_R_TYPE_ARG3 will be defined, as
dnl well as one of HAVE_GLIBC_STRERROR_R or HAVE_POSIX_STRERROR_R.
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
dnl
dnl glibc-style strerror_r:
dnl
dnl char *strerror_r(int errnum, char *workbuf, size_t bufsize);
dnl
dnl glibc-style strerror_r returns a pointer to the the error string,
dnl and might use the provided workbuf as a scratch area if needed. A
dnl quick test on a few systems shows that it's usually not used at all.
dnl
dnl POSIX-style strerror_r:
dnl
dnl int strerror_r(int errnum, char *resultbuf, size_t bufsize);
dnl
dnl POSIX-style strerror_r returns 0 upon successful completion and the
dnl error string in the provided resultbuf.
dnl
AC_DEFUN([CURL_CHECK_FUNC_STRERROR_R], [
AC_REQUIRE([CURL_INCLUDES_STRING])dnl
#
tst_links_strerror_r="unknown"
tst_proto_strerror_r="unknown"
tst_compi_strerror_r="unknown"
tst_glibc_strerror_r="unknown"
tst_posix_strerror_r="unknown"
tst_allow_strerror_r="unknown"
tst_works_glibc_strerror_r="unknown"
tst_works_posix_strerror_r="unknown"
tst_glibc_strerror_r_type_arg3="unknown"
tst_posix_strerror_r_type_arg3="unknown"
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
#
AC_MSG_CHECKING([if strerror_r can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([strerror_r])
],[
AC_MSG_RESULT([yes])
tst_links_strerror_r="yes"
],[
AC_MSG_RESULT([no])
tst_links_strerror_r="no"
])
#
if test "$tst_links_strerror_r" = "yes"; then
AC_MSG_CHECKING([if strerror_r is prototyped])
AC_EGREP_CPP([strerror_r],[
$curl_includes_string
],[
AC_MSG_RESULT([yes])
tst_proto_strerror_r="yes"
],[
AC_MSG_RESULT([no])
tst_proto_strerror_r="no"
])
fi
#
if test "$tst_proto_strerror_r" = "yes"; then
AC_MSG_CHECKING([if strerror_r is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_string
]],[[
if(0 != strerror_r(0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_strerror_r="yes"
],[
AC_MSG_RESULT([no])
tst_compi_strerror_r="no"
])
fi
#
if test "$tst_compi_strerror_r" = "yes"; then
AC_MSG_CHECKING([if strerror_r is glibc like])
for arg3 in 'size_t' 'int' 'unsigned int'; do
if test "$tst_glibc_strerror_r_type_arg3" = "unknown"; then
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_string
]],[[
char *strerror_r(int errnum, char *workbuf, $arg3 bufsize);
if(0 != strerror_r(0, 0, 0))
return 1;
]])
],[
tst_glibc_strerror_r_type_arg3="$arg3"
])
fi
done
case "$tst_glibc_strerror_r_type_arg3" in
unknown)
AC_MSG_RESULT([no])
tst_glibc_strerror_r="no"
;;
*)
AC_MSG_RESULT([yes])
tst_glibc_strerror_r="yes"
;;
esac
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
fi
#
dnl only do runtime verification when not cross-compiling
if test "x$cross_compiling" != "xyes" &&
test "$tst_glibc_strerror_r" = "yes"; then
AC_MSG_CHECKING([if strerror_r seems to work])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_string
# include <errno.h>
]],[[
char buffer[1024];
char *string = 0;
buffer[0] = '\0';
string = strerror_r(EACCES, buffer, sizeof(buffer));
if(!string)
exit(1); /* fail */
if(!string[0])
exit(1); /* fail */
else
exit(0);
]])
],[
AC_MSG_RESULT([yes])
tst_works_glibc_strerror_r="yes"
],[
AC_MSG_RESULT([no])
tst_works_glibc_strerror_r="no"
])
fi
#
if test "$tst_compi_strerror_r" = "yes" &&
test "$tst_works_glibc_strerror_r" != "yes"; then
AC_MSG_CHECKING([if strerror_r is POSIX like])
for arg3 in 'size_t' 'int' 'unsigned int'; do
if test "$tst_posix_strerror_r_type_arg3" = "unknown"; then
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_string
]],[[
int strerror_r(int errnum, char *resultbuf, $arg3 bufsize);
if(0 != strerror_r(0, 0, 0))
return 1;
]])
],[
tst_posix_strerror_r_type_arg3="$arg3"
])
fi
done
case "$tst_posix_strerror_r_type_arg3" in
unknown)
AC_MSG_RESULT([no])
tst_posix_strerror_r="no"
;;
*)
AC_MSG_RESULT([yes])
tst_posix_strerror_r="yes"
;;
esac
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
fi
#
dnl only do runtime verification when not cross-compiling
if test "x$cross_compiling" != "xyes" &&
test "$tst_posix_strerror_r" = "yes"; then
AC_MSG_CHECKING([if strerror_r seems to work])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_string
# include <errno.h>
]],[[
char buffer[1024];
int error = 1;
buffer[0] = '\0';
error = strerror_r(EACCES, buffer, sizeof(buffer));
if(error)
exit(1); /* fail */
if(buffer[0] == '\0')
exit(1); /* fail */
else
exit(0);
]])
],[
AC_MSG_RESULT([yes])
tst_works_posix_strerror_r="yes"
],[
AC_MSG_RESULT([no])
tst_works_posix_strerror_r="no"
])
fi
#
if test "$tst_glibc_strerror_r" = "yes" &&
test "$tst_works_glibc_strerror_r" != "no" &&
test "$tst_posix_strerror_r" != "yes"; then
tst_allow_strerror_r="check"
fi
if test "$tst_posix_strerror_r" = "yes" &&
test "$tst_works_posix_strerror_r" != "no" &&
test "$tst_glibc_strerror_r" != "yes"; then
tst_allow_strerror_r="check"
fi
if test "$tst_allow_strerror_r" = "check"; then
AC_MSG_CHECKING([if strerror_r usage allowed])
if test "x$curl_disallow_strerror_r" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_strerror_r="yes"
else
AC_MSG_RESULT([no])
tst_allow_strerror_r="no"
fi
fi
#
AC_MSG_CHECKING([if strerror_r might be used])
if test "$tst_links_strerror_r" = "yes" &&
test "$tst_proto_strerror_r" = "yes" &&
test "$tst_compi_strerror_r" = "yes" &&
test "$tst_allow_strerror_r" = "yes"; then
AC_MSG_RESULT([yes])
if test "$tst_glibc_strerror_r" = "yes"; then
AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
[Define to 1 if you have the strerror_r function.])
AC_DEFINE_UNQUOTED(HAVE_GLIBC_STRERROR_R, 1,
[Define to 1 if you have a working glibc-style strerror_r function.])
AC_DEFINE_UNQUOTED(STRERROR_R_TYPE_ARG3, $tst_glibc_strerror_r_type_arg3,
[Define to the type of arg 3 for strerror_r.])
fi
if test "$tst_posix_strerror_r" = "yes"; then
AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
[Define to 1 if you have the strerror_r function.])
AC_DEFINE_UNQUOTED(HAVE_POSIX_STRERROR_R, 1,
[Define to 1 if you have a working POSIX-style strerror_r function.])
AC_DEFINE_UNQUOTED(STRERROR_R_TYPE_ARG3, $tst_posix_strerror_r_type_arg3,
[Define to the type of arg 3 for strerror_r.])
fi
ac_cv_func_strerror_r="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_strerror_r="no"
fi
#
if test "$tst_compi_strerror_r" = "yes" &&
test "$tst_allow_strerror_r" = "unknown"; then
AC_MSG_NOTICE([cannot determine strerror_r() style: edit lib/config.h manually.])
fi
#
])
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
dnl CURL_CHECK_FUNC_STRTOK_R
dnl -------------------------------------------------
dnl Verify if strtok_r is available, prototyped, and
dnl can be compiled. If all of these are true, and
dnl usage has not been previously disallowed with
dnl shell variable curl_disallow_strtok_r, then
dnl HAVE_STRTOK_R will be defined.
AC_DEFUN([CURL_CHECK_FUNC_STRTOK_R], [
AC_REQUIRE([CURL_INCLUDES_STRING])dnl
#
tst_links_strtok_r="unknown"
tst_proto_strtok_r="unknown"
tst_compi_strtok_r="unknown"
tst_allow_strtok_r="unknown"
#
AC_MSG_CHECKING([if strtok_r can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([strtok_r])
],[
AC_MSG_RESULT([yes])
tst_links_strtok_r="yes"
],[
AC_MSG_RESULT([no])
tst_links_strtok_r="no"
])
#
if test "$tst_links_strtok_r" = "yes"; then
AC_MSG_CHECKING([if strtok_r is prototyped])
AC_EGREP_CPP([strtok_r],[
$curl_includes_string
],[
AC_MSG_RESULT([yes])
tst_proto_strtok_r="yes"
],[
AC_MSG_RESULT([no])
tst_proto_strtok_r="no"
])
fi
#
if test "$tst_proto_strtok_r" = "yes"; then
AC_MSG_CHECKING([if strtok_r is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_string
]],[[
if(0 != strtok_r(0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_strtok_r="yes"
],[
AC_MSG_RESULT([no])
tst_compi_strtok_r="no"
dnl temporary debug tracing follows
echo " " >&6
sed 's/^/cc-fail> /' conftest.err >&6
echo " " >&6
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
])
fi
#
if test "$tst_compi_strtok_r" = "yes"; then
AC_MSG_CHECKING([if strtok_r usage allowed])
if test "x$curl_disallow_strtok_r" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_strtok_r="yes"
else
AC_MSG_RESULT([no])
tst_allow_strtok_r="no"
fi
fi
#
AC_MSG_CHECKING([if strtok_r might be used])
if test "$tst_links_strtok_r" = "yes" &&
test "$tst_proto_strtok_r" = "yes" &&
test "$tst_compi_strtok_r" = "yes" &&
test "$tst_allow_strtok_r" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_STRTOK_R, 1,
[Define to 1 if you have the strtok_r function.])
ac_cv_func_strtok_r="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_strtok_r="no"
fi
])
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl CURL_CHECK_FUNC_STRTOLL
dnl -------------------------------------------------
dnl Verify if strtoll is available, prototyped, and
dnl can be compiled. If all of these are true, and
dnl usage has not been previously disallowed with
dnl shell variable curl_disallow_strtoll, then
dnl HAVE_STRTOLL will be defined.
AC_DEFUN([CURL_CHECK_FUNC_STRTOLL], [
AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
#
tst_links_strtoll="unknown"
tst_proto_strtoll="unknown"
tst_compi_strtoll="unknown"
tst_allow_strtoll="unknown"
#
AC_MSG_CHECKING([if strtoll can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([strtoll])
],[
AC_MSG_RESULT([yes])
tst_links_strtoll="yes"
],[
AC_MSG_RESULT([no])
tst_links_strtoll="no"
])
#
if test "$tst_links_strtoll" = "yes"; then
AC_MSG_CHECKING([if strtoll is prototyped])
AC_EGREP_CPP([strtoll],[
$curl_includes_stdlib
],[
AC_MSG_RESULT([yes])
tst_proto_strtoll="yes"
],[
AC_MSG_RESULT([no])