Newer
Older
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
dnl CURL_CHECK_GETHOSTBYNAME_R
dnl -------------------------------------------------
dnl check number of arguments for gethostbyname_r, it
dnl might take either 3, 5, or 6 arguments.
AC_DEFUN([CURL_CHECK_GETHOSTBYNAME_R], [
#
AC_MSG_CHECKING([for gethostbyname_r])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([gethostbyname_r])
],[
AC_MSG_RESULT([yes])
tmp_cv_gethostbyname_r="yes"
],[
AC_MSG_RESULT([no])
tmp_cv_gethostbyname_r="no"
])
#
if test "$tmp_cv_gethostbyname_r" != "yes"; then
AC_MSG_CHECKING([deeper for gethostbyname_r])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
]],[[
gethostbyname_r();
]])
],[
AC_MSG_RESULT([yes])
tmp_cv_gethostbyname_r="yes"
],[
AC_MSG_RESULT([but still no])
tmp_cv_gethostbyname_r="no"
])
fi
#
if test "$tmp_cv_gethostbyname_r" = "yes"; then
ac_cv_gethostbyname_r_args="unknown"
AC_MSG_CHECKING([if gethostbyname_r takes 3 arguments])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef _REENTRANT
#include <string.h>
#include <sys/types.h>
#include <netdb.h>
#undef NULL
#define NULL (void *)0
int
gethostbyname_r(const char *, struct hostent *,
struct hostent_data *);
]],[[
struct hostent_data data;
gethostbyname_r(NULL, NULL, NULL);
]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args])
ac_cv_gethostbyname_r_args="3"
],[
AC_MSG_RESULT([no])
])
if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
AC_MSG_CHECKING([if gethostbyname_r with -D_REENTRANT takes 3 arguments])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef _REENTRANT
#define _REENTRANT
#include <string.h>
#include <sys/types.h>
#include <netdb.h>
#undef NULL
#define NULL (void *)0
int
gethostbyname_r(const char *, struct hostent *,
struct hostent_data *);
]],[[
struct hostent_data data;
gethostbyname_r(NULL, NULL, NULL);
]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args])
ac_cv_gethostbyname_r_args="3"
],[
AC_MSG_RESULT([no])
])
fi
if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
AC_MSG_CHECKING([if gethostbyname_r takes 5 arguments])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef _REENTRANT
#include <sys/types.h>
#include <netdb.h>
#undef NULL
#define NULL (void *)0
struct hostent *
gethostbyname_r(const char *, struct hostent *,
char *, int, int *);
]],[[
gethostbyname_r(NULL, NULL, NULL, 0, NULL);
]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args])
ac_cv_gethostbyname_r_args="5"
],[
AC_MSG_RESULT([no])
])
fi
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
AC_MSG_CHECKING([if gethostbyname_r with -D_REENTRANT takes 5 arguments])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef _REENTRANT
#define _REENTRANT
#include <sys/types.h>
#include <netdb.h>
#undef NULL
#define NULL (void *)0
struct hostent *
gethostbyname_r(const char *, struct hostent *,
char *, int, int *);
]],[[
gethostbyname_r(NULL, NULL, NULL, 0, NULL);
]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args])
ac_cv_gethostbyname_r_args="5"
],[
AC_MSG_RESULT([no])
])
fi
if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
AC_MSG_CHECKING([if gethostbyname_r takes 6 arguments])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
#undef _REENTRANT
#include <sys/types.h>
#include <netdb.h>
#undef NULL
#define NULL (void *)0
int
gethostbyname_r(const char *, struct hostent *,
char *, size_t, struct hostent **, int *);
]],[[
gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL);
]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args])
ac_cv_gethostbyname_r_args="6"
],[
AC_MSG_RESULT([no])
])
fi
if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
AC_MSG_CHECKING([if gethostbyname_r with -D_REENTRANT takes 6 arguments])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef _REENTRANT
#define _REENTRANT
#include <sys/types.h>
#include <netdb.h>
#undef NULL
#define NULL (void *)0
int
gethostbyname_r(const char *, struct hostent *,
char *, size_t, struct hostent **, int *);
]],[[
gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL);
]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args])
ac_cv_gethostbyname_r_args="6"
],[
AC_MSG_RESULT([no])
])
fi
if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
AC_MSG_WARN([Cannot find out how to use gethostbyname_r])
AC_MSG_WARN([HAVE_GETHOSTBYNAME_R will not be defined])
ac_cv_func_gethostbyname_r="no"
else
AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME_R, 1,
[Define to 1 if you have the gethostbyname_r function.])
ac_cv_func_gethostbyname_r="yes"
fi
else
ac_cv_func_gethostbyname_r="no"
Daniel Stenberg
committed
Daniel Stenberg
committed
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
dnl **********************************************************************
dnl CURL_DETECT_ICC ([ACTION-IF-YES])
dnl
dnl check if this is the Intel ICC compiler, and if so run the ACTION-IF-YES
dnl sets the $ICC variable to "yes" or "no"
dnl **********************************************************************
AC_DEFUN([CURL_DETECT_ICC],
[
ICC="no"
AC_MSG_CHECKING([for icc in use])
if test "$GCC" = "yes"; then
dnl check if this is icc acting as gcc in disguise
AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
dnl action if the text is found, this it has not been replaced by the
dnl cpp
ICC="no",
dnl the text was not found, it was replaced by the cpp
ICC="yes"
AC_MSG_RESULT([yes])
[$1]
)
fi
if test "$ICC" = "no"; then
# this is not ICC
AC_MSG_RESULT([no])
fi
])
Daniel Stenberg
committed
dnl We create a function for detecting which compiler we use and then set as
dnl pendantic compiler options as possible for that particular compiler. The
dnl options are only used for debug-builds.
AC_DEFUN([CURL_CC_DEBUG_OPTS],
[
Daniel Stenberg
committed
if test "z$ICC" = "z"; then
CURL_DETECT_ICC
fi
Daniel Stenberg
committed
if test "$GCC" = "yes"; then
dnl figure out gcc version!
AC_MSG_CHECKING([gcc version])
gccver=`$CC -dumpversion`
num1=`echo $gccver | cut -d . -f1`
num2=`echo $gccver | cut -d . -f2`
gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
AC_MSG_RESULT($gccver)
if test "$ICC" = "yes"; then
dnl this is icc, not gcc.
dnl ICC warnings we ignore:
dnl * 269 warns on our "%Od" printf formatters for curl_off_t output:
dnl "invalid format string conversion"
dnl * 279 warns on static conditions in while expressions
dnl * 981 warns on "operands are evaluated in unspecified order"
Daniel Stenberg
committed
dnl * 1418 "external definition with no prior declaration"
dnl * 1419 warns on "external declaration in primary source file"
dnl which we know and do on purpose.
if test "$gccnum" -gt "600"; then
dnl icc 6.0 and older doesn't have the -Wall flag
WARN="-Wall $WARN"
fi
Daniel Stenberg
committed
else dnl $ICC = yes
dnl this is a set of options we believe *ALL* gcc versions support:
WARN="-W -Wall -Wwrite-strings -pedantic -Wpointer-arith -Wnested-externs -Winline -Wmissing-prototypes"
Daniel Stenberg
committed
dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
if test "$gccnum" -ge "207"; then
dnl gcc 2.7 or later
WARN="$WARN -Wmissing-declarations"
fi
if test "$gccnum" -gt "295"; then
dnl only if the compiler is newer than 2.95 since we got lots of
dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
dnl gcc 2.95.4 on FreeBSD 4.9!
WARN="$WARN -Wundef -Wno-long-long -Wsign-compare -Wshadow -Wno-multichar"
fi
Daniel Stenberg
committed
if test "$gccnum" -ge "296"; then
dnl gcc 2.96 or later
WARN="$WARN -Wfloat-equal"
fi
if test "$gccnum" -gt "296"; then
dnl this option does not exist in 2.96
WARN="$WARN -Wno-format-nonliteral"
fi
Daniel Stenberg
committed
dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
dnl on i686-Linux as it gives us heaps with false positives.
dnl Also, on gcc 4.0.X it is totally unbearable and complains all
dnl over making it unusable for generic purposes. Let's not use it.
if test "$gccnum" -ge "303"; then
dnl gcc 3.3 and later
WARN="$WARN -Wendif-labels -Wstrict-prototypes"
Daniel Stenberg
committed
fi
Daniel Stenberg
committed
if test "$gccnum" -ge "304"; then
# try these on gcc 3.4
WARN="$WARN -Wdeclaration-after-statement"
Daniel Stenberg
committed
fi
Daniel Stenberg
committed
for flag in $CPPFLAGS; do
case "$flag" in
-I*)
dnl Include path, provide a -isystem option for the same dir
dnl to prevent warnings in those dirs. The -isystem was not very
dnl reliable on earlier gcc versions.
Daniel Stenberg
committed
add=`echo $flag | sed 's/^-I/-isystem /g'`
Daniel Stenberg
committed
;;
esac
done
fi dnl $ICC = no
CFLAGS="$CFLAGS $WARN"
AC_MSG_NOTICE([Added this set of compiler options: $WARN])
else dnl $GCC = yes
AC_MSG_NOTICE([Added no extra compiler options])
Daniel Stenberg
committed
fi dnl $GCC = yes
dnl strip off optimizer flags
NEWFLAGS=""
for flag in $CFLAGS; do
case "$flag" in
-O*)
dnl echo "cut off $flag"
;;
*)
NEWFLAGS="$NEWFLAGS $flag"
;;
esac
done
CFLAGS=$NEWFLAGS
]) # AC-DEFUN
Daniel Stenberg
committed
Daniel Stenberg
committed
# This is only a temporary fix. This macro is here to replace the broken one
# delivered by the automake project (including the 1.9.6 release). As soon as
# they ship a working version we SHOULD remove this work-around.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} \"$am_aux_dir/missing\""
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
fi
])
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
dnl CURL_VERIFY_RUNTIMELIBS
dnl -------------------------------------------------
dnl Verify that the shared libs found so far can be used when running
dnl programs, since otherwise the situation will create odd configure errors
dnl that are misleading people.
dnl
dnl Make sure this test is run BEFORE the first test in the script that
dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF
dnl macro. It must also run AFTER all lib-checking macros are complete.
AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
dnl this test is of course not sensible if we are cross-compiling!
if test "x$cross_compiling" != xyes; then
dnl just run a program to verify that the libs checked for previous to this
dnl point also is available run-time!
AC_MSG_CHECKING([run-time libs availability])
AC_TRY_RUN([
main()
{
return 0;
}
],
AC_MSG_RESULT([fine]),
AC_MSG_RESULT([failed])
AC_MSG_ERROR([one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS])
)
dnl if this test fails, configure has already stopped
fi
])
dnl CURL_CHECK_VARIADIC_MACROS
dnl -------------------------------------------------
dnl Check compiler support of variadic macros
AC_DEFUN([CURL_CHECK_VARIADIC_MACROS], [
AC_CACHE_CHECK([for compiler support of C99 variadic macro style],
[curl_cv_variadic_macros_c99], [
AC_COMPILE_IFELSE([
#define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__)
#define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__)
int fun3(int arg1, int arg2, int arg3);
int fun2(int arg1, int arg2);
int fun3(int arg1, int arg2, int arg3)
{ return arg1 + arg2 + arg3; }
int fun2(int arg1, int arg2)
{ return arg1 + arg2; }
int res3 = c99_vmacro3(1, 2, 3);
int res2 = c99_vmacro2(1, 2);
],[
curl_cv_variadic_macros_c99="yes"
],[
curl_cv_variadic_macros_c99="no"
])
])
case "$curl_cv_variadic_macros_c99" in
yes)
AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1,
[Define to 1 if compiler supports C99 variadic macro style.])
;;
esac
AC_CACHE_CHECK([for compiler support of old gcc variadic macro style],
[curl_cv_variadic_macros_gcc], [
AC_COMPILE_IFELSE([
#define gcc_vmacro3(first, args...) fun3(first, args)
#define gcc_vmacro2(first, args...) fun2(first, args)
int fun3(int arg1, int arg2, int arg3);
int fun2(int arg1, int arg2);
int fun3(int arg1, int arg2, int arg3)
{ return arg1 + arg2 + arg3; }
int fun2(int arg1, int arg2)
{ return arg1 + arg2; }
int res3 = gcc_vmacro3(1, 2, 3);
int res2 = gcc_vmacro2(1, 2);
],[
curl_cv_variadic_macros_gcc="yes"
],[
curl_cv_variadic_macros_gcc="no"
])
])
case "$curl_cv_variadic_macros_gcc" in
yes)
AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1,
[Define to 1 if compiler supports old gcc variadic macro style.])
;;
esac
])
Daniel Stenberg
committed
dnl CURL_CHECK_CA_BUNDLE
dnl -------------------------------------------------
dnl Check if a default ca-bundle should be used
dnl
dnl regarding the paths this will scan:
dnl /etc/ssl/certs/ca-certificates.crt Debian systems
dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
Michal Marek
committed
dnl /etc/ssl/certs/ (ca path) SUSE
Daniel Stenberg
committed
AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
Michal Marek
committed
AC_MSG_CHECKING([default CA cert bundle/path])
Daniel Stenberg
committed
AC_ARG_WITH(ca-bundle,
AC_HELP_STRING([--with-ca-bundle=FILE], [File name to use as CA bundle])
AC_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
[
Michal Marek
committed
want_ca="$withval"
if test "x$want_ca" = "xyes"; then
AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
Daniel Stenberg
committed
fi
Michal Marek
committed
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
],
[ want_ca="unset" ])
AC_ARG_WITH(ca-path,
AC_HELP_STRING([--with-ca-path=DIRECTORY], [Directory to use as CA path])
AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
[
want_capath="$withval"
if test "x$want_capath" = "xyes"; then
AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory])
fi
],
[ want_capath="unset"])
if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \
"x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
dnl both given
AC_MSG_ERROR([Can't specify both --with-ca-bundle and --with-ca-path.])
elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then
dnl --with-ca-bundle given
ca="$want_ca"
capath="no"
elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
dnl --with-ca-path given
if test "x$OPENSSL_ENABLED" != "x1"; then
AC_MSG_ERROR([--with-ca-path only works with openSSL])
fi
capath="$want_capath"
ca="no"
else
dnl neither of --with-ca-* given
dnl first try autodetecting a CA bundle , then a CA path
dnl both autodetections can be skipped by --without-ca-*
ca="no"
capath="no"
if test "x$want_ca" = "xunset"; then
dnl the path we previously would have installed the curl ca bundle
dnl to, and thus we now check for an already existing cert in that place
dnl in case we find no other
if test "x$prefix" != xNONE; then
cac="${prefix}/share/curl/curl-ca-bundle.crt"
else
cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
Daniel Stenberg
committed
fi
Michal Marek
committed
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
for a in /etc/ssl/certs/ca-certificates.crt \
/etc/pki/tls/certs/ca-bundle.crt \
/usr/share/ssl/certs/ca-bundle.crt \
"$cac"; do
if test -f "$a"; then
ca="$a"
break
fi
done
fi
if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \
"x$OPENSSL_ENABLED" = "x1"; then
for a in /etc/ssl/certs/; do
if test -d "$a" && ls "$a"/[[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]].0 >/dev/null 2>/dev/null; then
capath="$a"
break
fi
done
fi
fi
Daniel Stenberg
committed
if test "x$ca" != "xno"; then
CURL_CA_BUNDLE='"'$ca'"'
AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle])
AC_SUBST(CURL_CA_BUNDLE)
Michal Marek
committed
AC_MSG_RESULT([$ca])
elif test "x$capath" != "xno"; then
CURL_CA_PATH="\"$capath\""
AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path])
Michal Marek
committed
AC_MSG_RESULT([$capath (capath)])
else
AC_MSG_RESULT([no])
Daniel Stenberg
committed
fi
])
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
dnl CURL_DEFINE_UNQUOTED (VARIABLE, [VALUE])
dnl -------------------------------------------------
dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor
dnl symbol that can be further used in custom template configuration
dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third
dnl argument for the description. Symbol definitions done with this
dnl macro are intended to be exclusively used in handcrafted *.h.in
dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one
dnl prevents autoheader generation and insertion of symbol template
dnl stub and definition into the first configuration header file. Do
dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each
dnl one serves different functional needs.
AC_DEFUN([CURL_DEFINE_UNQUOTED], [
cat >>confdefs.h <<_EOF
[@%:@define] $1 ifelse($#, 2, [$2], 1)
_EOF
])
dnl CURL_INCLUDES_INTTYPES
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when inttypes.h is to be included.
AC_DEFUN([CURL_INCLUDES_INTTYPES], [
curl_includes_inttypes="\
/* includes start */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
/* includes end */"
AC_CHECK_HEADERS(
sys/types.h stdint.h inttypes.h,
[], [], [$curl_includes_inttypes])
])
dnl DO_CURL_OFF_T_CHECK (TYPE, SIZE)
dnl -------------------------------------------------
dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T
AC_DEFUN([DO_CURL_OFF_T_CHECK], [
AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
if test "$x_typeof" = "unknown" && test ! -z "$1"; then
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
tmp_includes=""
tmp_source=""
tmp_fmt=""
case AS_TR_SH([$1]) in
int64_t)
tmp_includes="$curl_includes_inttypes"
tmp_source="char f@<:@@:>@ = PRId64;"
tmp_fmt="PRId64"
;;
int32_t)
tmp_includes="$curl_includes_inttypes"
tmp_source="char f@<:@@:>@ = PRId32;"
tmp_fmt="PRId32"
;;
int16_t)
tmp_includes="$curl_includes_inttypes"
tmp_source="char f@<:@@:>@ = PRId16;"
tmp_fmt="PRId16"
;;
esac
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$tmp_includes
typedef $1 curl_off_t;
typedef char dummy_arr[sizeof(curl_off_t) == $2 ? 1 : -1];
]],[[
$tmp_source
curl_off_t dummy;
]])
],[
if test -z "$tmp_fmt"; then
x_typeof="$1"
x_sizeof="$2"
else
CURL_CHECK_DEF([$tmp_fmt], [$curl_includes_inttypes], [silent])
AS_VAR_PUSHDEF([tmp_HaveDef], [curl_cv_have_def_$tmp_fmt])dnl
AS_VAR_PUSHDEF([tmp_Def], [curl_cv_def_$tmp_fmt])dnl
if test AS_VAR_GET([tmp_HaveDef]) = "yes"; then
x_format=AS_VAR_GET([tmp_Def])
x_typeof="$1"
x_sizeof="$2"
fi
AS_VAR_POPDEF([tmp_Def])dnl
AS_VAR_POPDEF([tmp_HaveDef])dnl
fi
])
fi
])
dnl CURL_CONFIGURE_CURL_OFF_T
dnl -------------------------------------------------
dnl Find out suitable curl_off_t data type definition and associated
dnl items, and make the appropriate definitions used in template file
dnl include/curl/curlbuild.h.in to properly configure the library.
AC_DEFUN([CURL_CONFIGURE_CURL_OFF_T], [
AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
#
AC_BEFORE([$0],[AC_SYS_LARGEFILE])dnl
AC_BEFORE([$0],[CURL_CONFIGURE_REENTRANT])dnl
AC_BEFORE([$0],[CURL_CHECK_AIX_ALL_SOURCE])dnl
#
if test -z "$SED"; then
AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
fi
#
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(void*)
#
if test -z "$ac_cv_sizeof_long" ||
test "$ac_cv_sizeof_long" -eq "0"; then
AC_MSG_ERROR([cannot find out size of long.])
fi
if test -z "$ac_cv_sizeof_voidp" ||
test "$ac_cv_sizeof_voidp" -eq "0"; then
AC_MSG_ERROR([cannot find out size of void*.])
fi
#
x_LP64_long=""
x_LP32_long=""
x_LP16_long=""
#
if test "$ac_cv_sizeof_long" -eq "8" &&
test "$ac_cv_sizeof_voidp" -ge "8"; then
x_LP64_long="long"
elif test "$ac_cv_sizeof_long" -eq "4" &&
test "$ac_cv_sizeof_voidp" -ge "4"; then
x_LP32_long="long"
elif test "$ac_cv_sizeof_long" -eq "2" &&
test "$ac_cv_sizeof_voidp" -ge "2"; then
x_LP16_long="long"
fi
#
dnl DO_CURL_OFF_T_CHECK results are stored in next 3 vars
#
x_typeof="unknown"
x_sizeof="unknown"
x_format="unknown"
u_format="unknown"
#
if test "$x_typeof" = "unknown"; then
AC_MSG_CHECKING([for 64-bit curl_off_t data type])
for t8 in \
"$x_LP64_long" \
'signed __int64' \
'int64_t' \
'long long' \
'__longlong' \
'__longlong_t' ; do
DO_CURL_OFF_T_CHECK([$t8], [8])
done
AC_MSG_RESULT([$x_typeof])
fi
if test "$x_typeof" = "unknown"; then
AC_MSG_CHECKING([for 32-bit curl_off_t data type])
for t4 in \
"$x_LP32_long" \
'signed __int32' \
'int32_t' \
'int' ; do
DO_CURL_OFF_T_CHECK([$t4], [4])
done
AC_MSG_RESULT([$x_typeof])
fi
if test "$x_typeof" = "unknown"; then
AC_MSG_CHECKING([for 16-bit curl_off_t data type])
for t2 in \
"$x_LP16_long" \
'signed __int16' \
'int16_t' \
'int' ; do
DO_CURL_OFF_T_CHECK([$t2], [2])
done
AC_MSG_RESULT([$x_typeof])
fi
if test "$x_typeof" = "unknown"; then
AC_MSG_ERROR([cannot find data type for curl_off_t.])
fi
#
AC_MSG_CHECKING([size of curl_off_t])
AC_MSG_RESULT([$x_sizeof])
#
AC_MSG_CHECKING([formatting string directive for curl_off_t])
if test "$x_format" != "unknown"; then
x_pull_headers="yes"
x_format=`echo "$x_format" | "$SED" 's/[["]]//g'`
u_format=`echo "$x_format" | "$SED" 's/i$/u/'`
u_format=`echo "$u_format" | "$SED" 's/d$/u/'`
u_format=`echo "$u_format" | "$SED" 's/D$/U/'`
else
x_pull_headers="no"
case AS_TR_SH([$x_typeof]) in
long_long | __longlong | __longlong_t)
x_format="lld"
u_format="llu"
;;
long)
x_format="ld"
u_format="lu"
;;
int)
x_format="d"
u_format="u"
;;
signed___int64)
x_format="I64d"
u_format="I64u"
;;
signed___int32)
x_format="I32d"
u_format="I32u"
;;
signed___int16)
x_format="I16d"
u_format="I16u"
;;
*)
AC_MSG_ERROR([cannot find print format string for curl_off_t.])
;;
esac
fi
AC_MSG_RESULT(["$x_format"])
#
AC_MSG_CHECKING([formatting string directive for unsigned curl_off_t])
AC_MSG_RESULT(["$u_format"])
#
if test "$x_pull_headers" = "yes"; then
if test "x$ac_cv_header_sys_types_h" = "xyes"; then
CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
fi
if test "x$ac_cv_header_stdint_h" = "xyes"; then
CURL_DEFINE_UNQUOTED([CURL_PULL_STDINT_H])
fi
if test "x$ac_cv_header_inttypes_h" = "xyes"; then
CURL_DEFINE_UNQUOTED([CURL_PULL_INTTYPES_H])
fi
fi
#
CURL_DEFINE_UNQUOTED([CURL_OFF_T], [$x_typeof])
CURL_DEFINE_UNQUOTED([CURL_FMT_OFF_T], ["$x_format"])
CURL_DEFINE_UNQUOTED([CURL_FMT_OFF_TU], ["$u_format"])
CURL_DEFINE_UNQUOTED([CURL_FORMAT_OFF_T], ["%$x_format"])
CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_OFF_T], [$x_sizeof])
#
])