Newer
Older
ac_cv_gethostbyaddr_r_args="8"
],[
AC_MSG_RESULT([no])
])
fi
if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
AC_MSG_WARN([Cannot find out how to use gethostbyaddr_r])
AC_MSG_WARN([HAVE_GETHOSTBYADDR_R will not be defined])
ac_cv_func_gethostbyaddr_r="no"
else
AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYADDR_R, 1,
[Define to 1 if you have the gethostbyaddr_r function.])
ac_cv_func_gethostbyaddr_r="yes"
fi
else
ac_cv_func_gethostbyaddr_r="no"
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
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
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
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([[
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
#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
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
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
])
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
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
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
],
[ 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
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
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
])
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
])
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
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
dnl CURL_CONFIGURE_LONG
dnl -------------------------------------------------
dnl Find out the size of long as reported by sizeof() and define
dnl CURL_SIZEOF_LONG as appropriate to be used in template file
dnl include/curl/curlbuild.h.in to properly configure the library.
dnl The size of long is a build time characteristic and as such
dnl must be recorded in curlbuild.h
AC_DEFUN([CURL_CONFIGURE_LONG], [
if test ! -z "$ac_cv_sizeof_long"; then
AC_MSG_WARN([AC_CHECK_SIZEOF(long) was called before CURL_CONFIGURE_LONG])
fi
AC_MSG_CHECKING([size of long])
curl_sizeof_long="unknown"
for tmp_size in '16' '8' '4' '2' '1' ; do
if test "$curl_sizeof_long" = "unknown"; then
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
typedef char dummy_arr[sizeof(long) == $tmp_size ? 1 : -1];
]],[[
dummy_arr[1] = (long)1;
]])
],[
curl_sizeof_long="$tmp_size"
])
fi
done
if test "$curl_sizeof_long" = "unknown"; then
AC_MSG_ERROR([cannot find out size of long])
else
AC_MSG_RESULT([$curl_sizeof_long])
CURL_DEFINE_UNQUOTED([CURL_SIZEOF_LONG], [$curl_sizeof_long])
ac_cv_sizeof_long="$curl_sizeof_long"
fi
])
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
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
tmp_includes=""
tmp_source=""
tmp_intxx=""
tmp_fmt=""
case AS_TR_SH([$1]) in
int64_t)
tmp_includes="$curl_includes_inttypes"
tmp_source="char f@<:@@:>@ = PRId64;"
tmp_intxx="INT64_C"
tmp_fmt="PRId64"
;;
int32_t)
tmp_includes="$curl_includes_inttypes"
tmp_source="char f@<:@@:>@ = PRId32;"
tmp_intxx="INT32_C"
tmp_fmt="PRId32"
;;
int16_t)
tmp_includes="$curl_includes_inttypes"
tmp_source="char f@<:@@:>@ = PRId16;"
tmp_intxx="INT16_C"
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])
CURL_CHECK_DEF_INTXX_C([$tmp_intxx], [$curl_includes_inttypes])
AS_VAR_PUSHDEF([tmp_HaveFmtDef], [curl_cv_have_def_$tmp_fmt])dnl
AS_VAR_PUSHDEF([tmp_FmtDef], [curl_cv_def_$tmp_fmt])dnl
AS_VAR_PUSHDEF([tmp_HaveSufDef], [curl_cv_have_def_$tmp_intxx])dnl
AS_VAR_PUSHDEF([tmp_SufDef], [curl_cv_def_$tmp_intxx])dnl
if test AS_VAR_GET(tmp_HaveFmtDef) = "yes" &&
test AS_VAR_GET(tmp_HaveSufDef) = "yes"; then
x_format=AS_VAR_GET(tmp_FmtDef)
x_suffix=AS_VAR_GET(tmp_SufDef)
x_typeof="$1"
x_sizeof="$2"
fi
AS_VAR_POPDEF([tmp_SufDef])dnl
AS_VAR_POPDEF([tmp_HaveSufDef])dnl
AS_VAR_POPDEF([tmp_FmtDef])dnl
AS_VAR_POPDEF([tmp_HaveFmtDef])dnl
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
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
#
CURL_CONFIGURE_LONG
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
AC_CHECK_SIZEOF(void*)
#
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"
x_suffix="unknown"
u_suffix="unknown"
#
if test "$x_typeof" = "unknown"; then
AC_MSG_CHECKING([for 64-bit curl_off_t data type])
for t8 in \
"$x_LP64_long" \
'int64_t' \
'__int64' \
'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" \
'int32_t' \
'__int32' \
'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" \
'int16_t' \
'__int16' \
'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/'`
u_suffix=`echo "$x_suffix" | "$SED" 's/^/U/'`
else
x_pull_headers="no"
case AS_TR_SH([$x_typeof]) in
long_long | __longlong | __longlong_t)
x_format="lld"
u_format="llu"
x_suffix="LL"
u_suffix="ULL"
;;
long)
x_format="ld"
u_format="lu"
x_suffix="L"
u_suffix="UL"
;;
int)
x_format="d"
u_format="u"
x_suffix=""
u_suffix=""
x_format="I64d"
u_format="I64u"
x_suffix="i64"
u_suffix="ui64"
x_format="I32d"
u_format="I32u"
x_suffix="i32"
u_suffix="ui32"
x_format="I16d"
u_format="I16u"
x_suffix="i16"
u_suffix="ui16"
;;
*)
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"])
AC_MSG_CHECKING([constant suffix string for curl_off_t])
AC_MSG_RESULT([$x_suffix])
AC_MSG_CHECKING([constant suffix string for unsigned curl_off_t])
AC_MSG_RESULT([$u_suffix])
#
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])
CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_T], [$x_suffix])
CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_TU], [$u_suffix])