configure.ac 74 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. #
  10. # This software is licensed as described in the file COPYING, which
  11. # you should have received as part of this distribution. The terms
  12. # are also available at http://curl.haxx.se/docs/copyright.html.
  13. #
  14. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. # copies of the Software, and permit persons to whom the Software is
  16. # furnished to do so, under the terms of the COPYING file.
  17. #
  18. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. # KIND, either express or implied.
  20. #
  21. # $Id$
  22. #***************************************************************************
  23. dnl Process this file with autoconf to produce a configure script.
  24. AC_PREREQ(2.57)
  25. dnl We don't know the version number "statically" so we use a dash here
  26. AC_INIT([curl], [-], [a suitable curl mailing list => http://curl.haxx.se/mail/])
  27. CURL_OVERRIDE_AUTOCONF
  28. dnl configure script copyright
  29. AC_COPYRIGHT([Copyright (c) 1998 - 2009 Daniel Stenberg, <daniel@haxx.se>
  30. This configure script may be copied, distributed and modified under the
  31. terms of the curl license; see COPYING for more details])
  32. AC_CONFIG_SRCDIR([lib/urldata.h])
  33. AM_CONFIG_HEADER(lib/curl_config.h src/curl_config.h include/curl/curlbuild.h)
  34. AM_MAINTAINER_MODE
  35. CURL_CHECK_OPTION_DEBUG
  36. CURL_CHECK_OPTION_OPTIMIZE
  37. CURL_CHECK_OPTION_WARNINGS
  38. CURL_CHECK_OPTION_CURLDEBUG
  39. CURL_CHECK_OPTION_ARES
  40. CURL_CHECK_PATH_SEPARATOR_REQUIRED
  41. #
  42. # save the configure arguments
  43. #
  44. CONFIGURE_OPTIONS="\"$ac_configure_args\""
  45. AC_SUBST(CONFIGURE_OPTIONS)
  46. dnl SED is mandatory for configure process and libtool.
  47. dnl Set it now, allowing it to be changed later.
  48. AC_PATH_PROG([SED], [sed], [not_found],
  49. [$PATH:/usr/bin:/usr/local/bin])
  50. if test -z "$SED" || test "$SED" = "not_found"; then
  51. AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
  52. fi
  53. AC_SUBST([SED])
  54. dnl GREP is mandatory for configure process and libtool.
  55. dnl Set it now, allowing it to be changed later.
  56. AC_PATH_PROG([GREP], [grep], [not_found],
  57. [$PATH:/usr/bin:/usr/local/bin])
  58. if test -z "$GREP" || test "$GREP" = "not_found"; then
  59. AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
  60. fi
  61. AC_SUBST([GREP])
  62. dnl EGREP is mandatory for configure process and libtool.
  63. dnl Set it now, allowing it to be changed later.
  64. if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
  65. AC_MSG_CHECKING([for egrep])
  66. EGREP="$GREP -E"
  67. AC_MSG_RESULT([$EGREP])
  68. else
  69. AC_PATH_PROG([EGREP], [egrep], [not_found],
  70. [$PATH:/usr/bin:/usr/local/bin])
  71. fi
  72. if test -z "$EGREP" || test "$EGREP" = "not_found"; then
  73. AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
  74. fi
  75. AC_SUBST([EGREP])
  76. dnl AR is mandatory for configure process and libtool.
  77. dnl This is target dependent, so check it as a tool.
  78. AC_PATH_TOOL([AR], [ar], [not_found],
  79. [$PATH:/usr/bin:/usr/local/bin])
  80. if test -z "$AR" || test "$AR" = "not_found"; then
  81. AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
  82. fi
  83. AC_SUBST([AR])
  84. AC_SUBST(libext)
  85. dnl Remove non-configure distributed curlbuild.h
  86. if test -f ${srcdir}/include/curl/curlbuild.h; then
  87. rm -f ${srcdir}/include/curl/curlbuild.h
  88. fi
  89. dnl figure out the libcurl version
  90. VERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h`
  91. AM_INIT_AUTOMAKE(curl,$VERSION)
  92. AC_MSG_CHECKING([curl version])
  93. AC_MSG_RESULT($VERSION)
  94. dnl
  95. dnl we extract the numerical version for curl-config only
  96. VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curlver.h`
  97. AC_SUBST(VERSIONNUM)
  98. dnl Solaris pkgadd support definitions
  99. PKGADD_PKG="HAXXcurl"
  100. PKGADD_NAME="cURL - a client that groks URLs"
  101. PKGADD_VENDOR="curl.haxx.se"
  102. AC_SUBST(PKGADD_PKG)
  103. AC_SUBST(PKGADD_NAME)
  104. AC_SUBST(PKGADD_VENDOR)
  105. dnl
  106. dnl initialize all the info variables
  107. curl_ssl_msg="no (--with-ssl / --with-gnutls / --with-nss)"
  108. curl_ssh_msg="no (--with-libssh2)"
  109. curl_zlib_msg="no (--with-zlib)"
  110. curl_krb4_msg="no (--with-krb4*)"
  111. curl_gss_msg="no (--with-gssapi)"
  112. curl_spnego_msg="no (--with-spnego)"
  113. curl_ares_msg="no (--enable-ares)"
  114. curl_ipv6_msg="no (--enable-ipv6)"
  115. curl_idn_msg="no (--with-libidn)"
  116. curl_manual_msg="no (--enable-manual)"
  117. curl_verbose_msg="enabled (--disable-verbose)"
  118. curl_sspi_msg="no (--enable-sspi)"
  119. curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
  120. curl_ldaps_msg="no (--enable-ldaps)"
  121. curl_rtsp_msg="no (--enable-rtsp)"
  122. dnl
  123. dnl Save anything in $LIBS for later
  124. dnl
  125. ALL_LIBS=$LIBS
  126. dnl
  127. dnl Detect the canonical host and target build environment
  128. dnl
  129. AC_CANONICAL_HOST
  130. dnl Get system canonical name
  131. AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
  132. dnl Checks for programs.
  133. CURL_CHECK_PROG_CC
  134. dnl Our curl_off_t internal and external configure settings
  135. CURL_CONFIGURE_CURL_OFF_T
  136. dnl This defines _ALL_SOURCE for AIX
  137. CURL_CHECK_AIX_ALL_SOURCE
  138. dnl Our configure and build reentrant settings
  139. CURL_CONFIGURE_THREAD_SAFE
  140. CURL_CONFIGURE_REENTRANT
  141. dnl check for how to do large files
  142. AC_SYS_LARGEFILE
  143. dnl support building of Windows DLLs
  144. AC_LIBTOOL_WIN32_DLL
  145. dnl force libtool to build static libraries with PIC on AMD64-Linux & FreeBSD
  146. AC_MSG_CHECKING([if arch-OS host is AMD64-Linux/FreeBSD (to build static libraries with PIC)])
  147. case $host in
  148. x86_64*linux*|amd64*freebsd*|ia64*freebsd*)
  149. AC_MSG_RESULT([yes])
  150. with_pic=yes
  151. ;;
  152. *)
  153. AC_MSG_RESULT([no])
  154. ;;
  155. esac
  156. AC_MSG_CHECKING([if compiler is icc (to build with PIC)])
  157. case $CC in
  158. icc | */icc)
  159. AC_MSG_RESULT([yes])
  160. with_pic=yes
  161. ;;
  162. *)
  163. AC_MSG_RESULT([no])
  164. ;;
  165. esac
  166. dnl libtool setup
  167. AC_PROG_LIBTOOL
  168. AC_MSG_CHECKING([if we need -mimpure-text])
  169. mimpure=no
  170. case $host in
  171. *-*-solaris2*)
  172. if test "$GCC" = "yes"; then
  173. mimpure="yes"
  174. fi
  175. ;;
  176. *)
  177. ;;
  178. esac
  179. AC_MSG_RESULT($mimpure)
  180. AM_CONDITIONAL(MIMPURE, test x$mimpure = xyes)
  181. AM_CONDITIONAL(STATICLIB, false)
  182. AC_MSG_CHECKING([if we need BUILDING_LIBCURL])
  183. case $host in
  184. *-*-mingw*)
  185. AC_DEFINE(BUILDING_LIBCURL, 1, [when building libcurl itself])
  186. AC_MSG_RESULT(yes)
  187. AC_MSG_CHECKING([if we need CURL_STATICLIB])
  188. if test "X$enable_shared" = "Xno"
  189. then
  190. AC_DEFINE(CURL_STATICLIB, 1, [when not building a shared library])
  191. AC_MSG_RESULT(yes)
  192. AM_CONDITIONAL(STATICLIB, true)
  193. else
  194. AC_MSG_RESULT(no)
  195. fi
  196. ;;
  197. *)
  198. AC_MSG_RESULT(no)
  199. ;;
  200. esac
  201. # Determine whether all dependent libraries must be specified when linking
  202. if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
  203. then
  204. REQUIRE_LIB_DEPS=no
  205. else
  206. REQUIRE_LIB_DEPS=yes
  207. fi
  208. AC_SUBST(REQUIRE_LIB_DEPS)
  209. dnl The install stuff has already been taken care of by the automake stuff
  210. dnl AC_PROG_INSTALL
  211. AC_PROG_MAKE_SET
  212. dnl check if there's a way to force code inline
  213. AC_C_INLINE
  214. dnl **********************************************************************
  215. dnl platform/compiler/architecture specific checks/flags
  216. dnl **********************************************************************
  217. CURL_CHECK_COMPILER
  218. CURL_SET_COMPILER_BASIC_OPTS
  219. CURL_SET_COMPILER_DEBUG_OPTS
  220. CURL_SET_COMPILER_OPTIMIZE_OPTS
  221. CURL_SET_COMPILER_WARNING_OPTS
  222. if test "$compiler_id" = "INTEL_UNIX_C"; then
  223. #
  224. if test "$compiler_num" -ge "1000"; then
  225. dnl icc 10.X or later
  226. CFLAGS="$CFLAGS -shared-intel"
  227. elif test "$compiler_num" -ge "900"; then
  228. dnl icc 9.X specific
  229. CFLAGS="$CFLAGS -i-dynamic"
  230. fi
  231. #
  232. fi
  233. CURL_CHECK_COMPILER_HALT_ON_ERROR
  234. CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
  235. CURL_CHECK_NO_UNDEFINED
  236. AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
  237. CURL_CHECK_CURLDEBUG
  238. AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
  239. dnl **********************************************************************
  240. dnl Compilation based checks should not be done before this point.
  241. dnl **********************************************************************
  242. dnl **********************************************************************
  243. dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
  244. dnl and ws2tcpip.h take precedence over any other further checks which
  245. dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
  246. dnl this specific header files. And do them before its results are used.
  247. dnl **********************************************************************
  248. CURL_CHECK_HEADER_WINDOWS
  249. CURL_CHECK_NATIVE_WINDOWS
  250. case X-"$ac_cv_native_windows" in
  251. X-yes)
  252. CURL_CHECK_HEADER_WINSOCK
  253. CURL_CHECK_HEADER_WINSOCK2
  254. CURL_CHECK_HEADER_WS2TCPIP
  255. CURL_CHECK_HEADER_WINLDAP
  256. CURL_CHECK_HEADER_WINBER
  257. ;;
  258. *)
  259. ac_cv_header_winsock_h="no"
  260. ac_cv_header_winsock2_h="no"
  261. ac_cv_header_ws2tcpip_h="no"
  262. ac_cv_header_winldap_h="no"
  263. ac_cv_header_winber_h="no"
  264. ;;
  265. esac
  266. CURL_CHECK_WIN32_LARGEFILE
  267. dnl ************************************************************
  268. dnl switch off particular protocols
  269. dnl
  270. AC_MSG_CHECKING([whether to support http])
  271. AC_ARG_ENABLE(http,
  272. AC_HELP_STRING([--enable-http],[Enable HTTP support])
  273. AC_HELP_STRING([--disable-http],[Disable HTTP support]),
  274. [ case "$enableval" in
  275. no)
  276. AC_MSG_RESULT(no)
  277. AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
  278. AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP])
  279. AC_SUBST(CURL_DISABLE_HTTP, [1])
  280. AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
  281. AC_SUBST(CURL_DISABLE_RTSP, [1])
  282. ;;
  283. *) AC_MSG_RESULT(yes)
  284. ;;
  285. esac ],
  286. AC_MSG_RESULT(yes)
  287. )
  288. AC_MSG_CHECKING([whether to support ftp])
  289. AC_ARG_ENABLE(ftp,
  290. AC_HELP_STRING([--enable-ftp],[Enable FTP support])
  291. AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
  292. [ case "$enableval" in
  293. no)
  294. AC_MSG_RESULT(no)
  295. AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
  296. AC_SUBST(CURL_DISABLE_FTP, [1])
  297. ;;
  298. *) AC_MSG_RESULT(yes)
  299. ;;
  300. esac ],
  301. AC_MSG_RESULT(yes)
  302. )
  303. AC_MSG_CHECKING([whether to support file])
  304. AC_ARG_ENABLE(file,
  305. AC_HELP_STRING([--enable-file],[Enable FILE support])
  306. AC_HELP_STRING([--disable-file],[Disable FILE support]),
  307. [ case "$enableval" in
  308. no)
  309. AC_MSG_RESULT(no)
  310. AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
  311. AC_SUBST(CURL_DISABLE_FILE, [1])
  312. ;;
  313. *) AC_MSG_RESULT(yes)
  314. ;;
  315. esac ],
  316. AC_MSG_RESULT(yes)
  317. )
  318. AC_MSG_CHECKING([whether to support ldap])
  319. AC_ARG_ENABLE(ldap,
  320. AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
  321. AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
  322. [ case "$enableval" in
  323. no)
  324. AC_MSG_RESULT(no)
  325. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  326. AC_SUBST(CURL_DISABLE_LDAP, [1])
  327. ;;
  328. *)
  329. case $host in
  330. *-*-cygwin*)
  331. # Force no ldap. config/build process is broken for cygwin
  332. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  333. AC_SUBST(CURL_DISABLE_LDAP, [1])
  334. AC_MSG_RESULT(no)
  335. ;;
  336. *)
  337. AC_MSG_RESULT(yes)
  338. esac
  339. ;;
  340. esac ],[
  341. case $host in
  342. *-*-cygwin*)
  343. # Force no ldap. config/build process is broken for cygwin
  344. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  345. AC_SUBST(CURL_DISABLE_LDAP, [1])
  346. AC_MSG_RESULT(no)
  347. ;;
  348. *)
  349. AC_MSG_RESULT(yes)
  350. esac ]
  351. )
  352. AC_MSG_CHECKING([whether to support ldaps])
  353. AC_ARG_ENABLE(ldaps,
  354. AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
  355. AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
  356. [ case "$enableval" in
  357. no)
  358. AC_MSG_RESULT(no)
  359. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  360. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  361. ;;
  362. *) if test x$CURL_DISABLE_LDAP = x1 ; then
  363. AC_MSG_RESULT(LDAP support needs to be enabled in order to enable LDAPS support!)
  364. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  365. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  366. else
  367. AC_MSG_RESULT(yes)
  368. AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
  369. curl_ldaps_msg="enabled"
  370. fi
  371. ;;
  372. esac ],
  373. AC_MSG_RESULT(no)
  374. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  375. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  376. )
  377. AC_MSG_CHECKING([whether to support rtsp])
  378. AC_ARG_ENABLE(rtsp,
  379. AC_HELP_STRING([--enable-rtsp],[Enable RTSP support])
  380. AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]),
  381. [ case "$enableval" in
  382. no)
  383. AC_MSG_RESULT(no)
  384. AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
  385. AC_SUBST(CURL_DISABLE_RTSP, [1])
  386. ;;
  387. *) if test x$CURL_DISABLE_HTTP = x1 ; then
  388. AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!)
  389. else
  390. AC_MSG_RESULT(yes)
  391. curl_rtsp_msg="enabled"
  392. fi
  393. ;;
  394. esac ],
  395. if test "x$CURL_DISABLE_HTTP" != "x1"; then
  396. AC_MSG_RESULT(yes)
  397. curl_rtsp_msg="enabled"
  398. else
  399. AC_MSG_RESULT(no)
  400. fi
  401. )
  402. AC_MSG_CHECKING([whether to support proxies])
  403. AC_ARG_ENABLE(proxy,
  404. AC_HELP_STRING([--enable-proxy],[Enable proxy support])
  405. AC_HELP_STRING([--disable-proxy],[Disable proxy support]),
  406. [ case "$enableval" in
  407. no)
  408. AC_MSG_RESULT(no)
  409. AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
  410. AC_SUBST(CURL_DISABLE_PROXY, [1])
  411. ;;
  412. *) AC_MSG_RESULT(yes)
  413. ;;
  414. esac ],
  415. AC_MSG_RESULT(yes)
  416. )
  417. AC_MSG_CHECKING([whether to support dict])
  418. AC_ARG_ENABLE(dict,
  419. AC_HELP_STRING([--enable-dict],[Enable DICT support])
  420. AC_HELP_STRING([--disable-dict],[Disable DICT support]),
  421. [ case "$enableval" in
  422. no)
  423. AC_MSG_RESULT(no)
  424. AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
  425. AC_SUBST(CURL_DISABLE_DICT, [1])
  426. ;;
  427. *) AC_MSG_RESULT(yes)
  428. ;;
  429. esac ],
  430. AC_MSG_RESULT(yes)
  431. )
  432. AC_MSG_CHECKING([whether to support telnet])
  433. AC_ARG_ENABLE(telnet,
  434. AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
  435. AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
  436. [ case "$enableval" in
  437. no)
  438. AC_MSG_RESULT(no)
  439. AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
  440. AC_SUBST(CURL_DISABLE_TELNET, [1])
  441. ;;
  442. *) AC_MSG_RESULT(yes)
  443. ;;
  444. esac ],
  445. AC_MSG_RESULT(yes)
  446. )
  447. AC_MSG_CHECKING([whether to support tftp])
  448. AC_ARG_ENABLE(tftp,
  449. AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
  450. AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
  451. [ case "$enableval" in
  452. no)
  453. AC_MSG_RESULT(no)
  454. AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
  455. AC_SUBST(CURL_DISABLE_TFTP, [1])
  456. ;;
  457. *) AC_MSG_RESULT(yes)
  458. ;;
  459. esac ],
  460. AC_MSG_RESULT(yes)
  461. )
  462. AC_MSG_CHECKING([whether to support pop3])
  463. AC_ARG_ENABLE(pop3,
  464. AC_HELP_STRING([--enable-pop3],[Enable POP3 support])
  465. AC_HELP_STRING([--disable-pop3],[Disable POP3 support]),
  466. [ case "$enableval" in
  467. no)
  468. AC_MSG_RESULT(no)
  469. AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3])
  470. AC_SUBST(CURL_DISABLE_POP3, [1])
  471. ;;
  472. *) AC_MSG_RESULT(yes)
  473. ;;
  474. esac ],
  475. AC_MSG_RESULT(yes)
  476. )
  477. AC_MSG_CHECKING([whether to support imap])
  478. AC_ARG_ENABLE(imap,
  479. AC_HELP_STRING([--enable-imap],[Enable IMAP support])
  480. AC_HELP_STRING([--disable-imap],[Disable IMAP support]),
  481. [ case "$enableval" in
  482. no)
  483. AC_MSG_RESULT(no)
  484. AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP])
  485. AC_SUBST(CURL_DISABLE_IMAP, [1])
  486. ;;
  487. *) AC_MSG_RESULT(yes)
  488. ;;
  489. esac ],
  490. AC_MSG_RESULT(yes)
  491. )
  492. AC_MSG_CHECKING([whether to support smtp])
  493. AC_ARG_ENABLE(smtp,
  494. AC_HELP_STRING([--enable-smtp],[Enable SMTP support])
  495. AC_HELP_STRING([--disable-smtp],[Disable SMTP support]),
  496. [ case "$enableval" in
  497. no)
  498. AC_MSG_RESULT(no)
  499. AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP])
  500. AC_SUBST(CURL_DISABLE_SMTP, [1])
  501. ;;
  502. *) AC_MSG_RESULT(yes)
  503. ;;
  504. esac ],
  505. AC_MSG_RESULT(yes)
  506. )
  507. dnl **********************************************************************
  508. dnl Check for built-in manual
  509. dnl **********************************************************************
  510. AC_MSG_CHECKING([whether to provide built-in manual])
  511. AC_ARG_ENABLE(manual,
  512. AC_HELP_STRING([--enable-manual],[Enable built-in manual])
  513. AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
  514. [ case "$enableval" in
  515. no)
  516. AC_MSG_RESULT(no)
  517. ;;
  518. *) AC_MSG_RESULT(yes)
  519. USE_MANUAL="1"
  520. ;;
  521. esac ],
  522. AC_MSG_RESULT(yes)
  523. USE_MANUAL="1"
  524. )
  525. dnl The actual use of the USE_MANUAL variable is done much later in this
  526. dnl script to allow other actions to disable it as well.
  527. dnl **********************************************************************
  528. dnl Checks for libraries.
  529. dnl **********************************************************************
  530. CURL_CHECK_LIB_XNET
  531. dnl gethostbyname without lib or in the nsl lib?
  532. AC_CHECK_FUNC(gethostbyname,
  533. [HAVE_GETHOSTBYNAME="1"
  534. ],
  535. [ AC_CHECK_LIB(nsl, gethostbyname,
  536. [HAVE_GETHOSTBYNAME="1"
  537. LIBS="$LIBS -lnsl"
  538. ])
  539. ])
  540. if test "$HAVE_GETHOSTBYNAME" != "1"
  541. then
  542. dnl gethostbyname in the socket lib?
  543. AC_CHECK_LIB(socket, gethostbyname,
  544. [HAVE_GETHOSTBYNAME="1"
  545. LIBS="$LIBS -lsocket"
  546. ])
  547. fi
  548. dnl At least one system has been identified to require BOTH nsl and socket
  549. dnl libs at the same time to link properly.
  550. if test "$HAVE_GETHOSTBYNAME" != "1"
  551. then
  552. AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
  553. my_ac_save_LIBS=$LIBS
  554. LIBS="-lnsl -lsocket $LIBS"
  555. AC_LINK_IFELSE([
  556. AC_LANG_PROGRAM([[
  557. ]],[[
  558. gethostbyname();
  559. ]])
  560. ],[
  561. AC_MSG_RESULT([yes])
  562. HAVE_GETHOSTBYNAME="1"
  563. ],[
  564. AC_MSG_RESULT([no])
  565. LIBS=$my_ac_save_LIBS
  566. ])
  567. fi
  568. if test "$HAVE_GETHOSTBYNAME" != "1"
  569. then
  570. dnl This is for winsock systems
  571. if test "$ac_cv_header_windows_h" = "yes"; then
  572. if test "$ac_cv_header_winsock_h" = "yes"; then
  573. case $host in
  574. *-*-mingw32ce*)
  575. winsock_LIB="-lwinsock"
  576. ;;
  577. *)
  578. winsock_LIB="-lwsock32"
  579. ;;
  580. esac
  581. fi
  582. if test "$ac_cv_header_winsock2_h" = "yes"; then
  583. winsock_LIB="-lws2_32"
  584. fi
  585. if test ! -z "$winsock_LIB"; then
  586. my_ac_save_LIBS=$LIBS
  587. LIBS="$winsock_LIB $LIBS"
  588. AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
  589. AC_LINK_IFELSE([
  590. AC_LANG_PROGRAM([[
  591. #ifdef HAVE_WINDOWS_H
  592. #ifndef WIN32_LEAN_AND_MEAN
  593. #define WIN32_LEAN_AND_MEAN
  594. #endif
  595. #include <windows.h>
  596. #ifdef HAVE_WINSOCK2_H
  597. #include <winsock2.h>
  598. #else
  599. #ifdef HAVE_WINSOCK_H
  600. #include <winsock.h>
  601. #endif
  602. #endif
  603. #endif
  604. ]],[[
  605. gethostbyname("www.dummysite.com");
  606. ]])
  607. ],[
  608. AC_MSG_RESULT([yes])
  609. HAVE_GETHOSTBYNAME="1"
  610. ],[
  611. AC_MSG_RESULT([no])
  612. winsock_LIB=""
  613. LIBS=$my_ac_save_LIBS
  614. ])
  615. fi
  616. fi
  617. fi
  618. if test "$HAVE_GETHOSTBYNAME" != "1"
  619. then
  620. dnl This is for Minix 3.1
  621. AC_MSG_CHECKING([for gethostbyname for Minix 3])
  622. AC_LINK_IFELSE([
  623. AC_LANG_PROGRAM([[
  624. /* Older Minix versions may need <net/gen/netdb.h> here instead */
  625. #include <netdb.h>
  626. ]],[[
  627. gethostbyname("www.dummysite.com");
  628. ]])
  629. ],[
  630. AC_MSG_RESULT([yes])
  631. HAVE_GETHOSTBYNAME="1"
  632. ],[
  633. AC_MSG_RESULT([no])
  634. ])
  635. fi
  636. if test "$HAVE_GETHOSTBYNAME" != "1"
  637. then
  638. dnl This is for eCos with a stubbed DNS implementation
  639. AC_MSG_CHECKING([for gethostbyname for eCos])
  640. AC_LINK_IFELSE([
  641. AC_LANG_PROGRAM([[
  642. #include <stdio.h>
  643. #include <netdb.h>
  644. ]],[[
  645. gethostbyname("www.dummysite.com");
  646. ]])
  647. ],[
  648. AC_MSG_RESULT([yes])
  649. HAVE_GETHOSTBYNAME="1"
  650. ],[
  651. AC_MSG_RESULT([no])
  652. ])
  653. fi
  654. if test "$HAVE_GETHOSTBYNAME" != "1"
  655. then
  656. dnl gethostbyname in the network lib - for Haiku OS
  657. AC_CHECK_LIB(network, gethostbyname,
  658. [HAVE_GETHOSTBYNAME="1"
  659. LIBS="$LIBS -lnetwork"
  660. ])
  661. fi
  662. if test "$HAVE_GETHOSTBYNAME" != "1"
  663. then
  664. dnl gethostbyname in the net lib - for BeOS
  665. AC_CHECK_LIB(net, gethostbyname,
  666. [HAVE_GETHOSTBYNAME="1"
  667. LIBS="$LIBS -lnet"
  668. ])
  669. fi
  670. if test "$HAVE_GETHOSTBYNAME" != "1"; then
  671. AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
  672. fi
  673. dnl resolve lib?
  674. AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
  675. if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
  676. AC_CHECK_LIB(resolve, strcasecmp,
  677. [LIBS="-lresolve $LIBS"],
  678. ,
  679. -lnsl)
  680. fi
  681. ac_cv_func_strcasecmp="no"
  682. CURL_CHECK_LIBS_CONNECT
  683. dnl **********************************************************************
  684. dnl In case that function clock_gettime with monotonic timer is available,
  685. dnl check for additional required libraries.
  686. dnl **********************************************************************
  687. CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
  688. dnl **********************************************************************
  689. dnl The preceding library checks are all potentially useful for test
  690. dnl servers (for providing networking support). Save the list of required
  691. dnl libraries at this point for use while linking those test servers.
  692. dnl **********************************************************************
  693. TEST_SERVER_LIBS=$LIBS
  694. dnl **********************************************************************
  695. AC_MSG_CHECKING([whether to use libgcc])
  696. AC_ARG_ENABLE(libgcc,
  697. AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
  698. [ case "$enableval" in
  699. yes)
  700. ALL_LIBS="$ALL_LIBS -lgcc"
  701. AC_MSG_RESULT(yes)
  702. ;;
  703. *) AC_MSG_RESULT(no)
  704. ;;
  705. esac ],
  706. AC_MSG_RESULT(no)
  707. )
  708. dnl **********************************************************************
  709. dnl Check for LDAP
  710. dnl **********************************************************************
  711. LDAPLIBNAME=""
  712. AC_ARG_WITH(ldap-lib,
  713. AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
  714. [LDAPLIBNAME="$withval"])
  715. LBERLIBNAME=""
  716. AC_ARG_WITH(lber-lib,
  717. AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
  718. [LBERLIBNAME="$withval"])
  719. if test x$CURL_DISABLE_LDAP != x1 ; then
  720. CURL_CHECK_HEADER_LBER
  721. CURL_CHECK_HEADER_LDAP
  722. CURL_CHECK_HEADER_LDAPSSL
  723. CURL_CHECK_HEADER_LDAP_SSL
  724. if test -z "$LDAPLIBNAME" ; then
  725. case $host in
  726. *-*-cygwin* | *-*-mingw* | *-*-pw32*)
  727. dnl Windows uses a single and unique OpenLDAP DLL name
  728. LDAPLIBNAME="wldap32"
  729. LBERLIBNAME="no"
  730. ;;
  731. esac
  732. fi
  733. if test "$LDAPLIBNAME" ; then
  734. AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
  735. AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
  736. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  737. AC_SUBST(CURL_DISABLE_LDAP, [1])])
  738. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  739. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  740. else
  741. dnl Try to find the right ldap libraries for this system
  742. CURL_CHECK_LIBS_LDAP
  743. case X-"$curl_cv_ldap_LIBS" in
  744. X-unknown)
  745. AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
  746. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  747. AC_SUBST(CURL_DISABLE_LDAP, [1])
  748. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  749. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  750. ;;
  751. esac
  752. fi
  753. fi
  754. if test x$CURL_DISABLE_LDAP != x1 ; then
  755. if test "$LBERLIBNAME" ; then
  756. dnl If name is "no" then don't define this library at all
  757. dnl (it's only needed if libldap.so's dependencies are broken).
  758. if test "$LBERLIBNAME" != "no" ; then
  759. AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
  760. AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
  761. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  762. AC_SUBST(CURL_DISABLE_LDAP, [1])])
  763. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  764. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  765. fi
  766. fi
  767. fi
  768. if test x$CURL_DISABLE_LDAP != x1 ; then
  769. AC_CHECK_FUNCS([ldap_url_parse])
  770. if test "$LDAPLIBNAME" = "wldap32"; then
  771. curl_ldap_msg="enabled (winldap)"
  772. AC_DEFINE(CURL_LDAP_WIN, 1, [Use W$ LDAP implementation])
  773. case $host in
  774. *-*-cygwin* | *-*-pw32*)
  775. AC_DEFINE(CURL_LDAP_HYBRID, 1, [W$ LDAP with non-W$ compiler])
  776. ;;
  777. esac
  778. else
  779. curl_ldap_msg="enabled (OpenLDAP)"
  780. fi
  781. fi
  782. dnl **********************************************************************
  783. dnl Checks for IPv6
  784. dnl **********************************************************************
  785. AC_MSG_CHECKING([whether to enable ipv6])
  786. AC_ARG_ENABLE(ipv6,
  787. AC_HELP_STRING([--enable-ipv6],[Enable ipv6 (with ipv4) support])
  788. AC_HELP_STRING([--disable-ipv6],[Disable ipv6 support]),
  789. [ case "$enableval" in
  790. no)
  791. AC_MSG_RESULT(no)
  792. ipv6=no
  793. ;;
  794. *) AC_MSG_RESULT(yes)
  795. ipv6=yes
  796. ;;
  797. esac ],
  798. AC_TRY_RUN([ /* is AF_INET6 available? */
  799. #include <sys/types.h>
  800. #include <sys/socket.h>
  801. main()
  802. {
  803. if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
  804. exit(1);
  805. else
  806. exit(0);
  807. }
  808. ],
  809. AC_MSG_RESULT(yes)
  810. ipv6=yes,
  811. AC_MSG_RESULT(no)
  812. ipv6=no,
  813. AC_MSG_RESULT(no)
  814. ipv6=no
  815. ))
  816. if test "$ipv6" = "yes"; then
  817. curl_ipv6_msg="enabled"
  818. fi
  819. # Check if struct sockaddr_in6 have sin6_scope_id member
  820. if test "$ipv6" = yes; then
  821. AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
  822. AC_TRY_COMPILE([
  823. #include <sys/types.h>
  824. #include <netinet/in.h>] ,
  825. struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
  826. if test "$have_sin6_scope_id" = yes; then
  827. AC_MSG_RESULT([yes])
  828. AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member])
  829. else
  830. AC_MSG_RESULT([no])
  831. fi
  832. fi
  833. dnl **********************************************************************
  834. dnl Check if the operating system allows programs to write to their own argv[]
  835. dnl **********************************************************************
  836. AC_MSG_CHECKING([if argv can be written to])
  837. AC_CACHE_VAL(curl_cv_writable_argv, [
  838. AC_RUN_IFELSE([[
  839. int main(int argc, char ** argv) {
  840. argv[0][0] = ' ';
  841. return (argv[0][0] == ' ')?0:1;
  842. }
  843. ]],
  844. curl_cv_writable_argv=yes,
  845. curl_cv_writable_argv=no,
  846. curl_cv_writable_argv=cross)
  847. ])
  848. case $curl_cv_writable_argv in
  849. yes)
  850. AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
  851. AC_MSG_RESULT(yes)
  852. ;;
  853. no)
  854. AC_MSG_RESULT(no)
  855. ;;
  856. *)
  857. AC_MSG_RESULT(no)
  858. AC_MSG_WARN([the previous check could not be made default was used])
  859. ;;
  860. esac
  861. dnl **********************************************************************
  862. dnl Check for the presence of Kerberos4 libraries and headers
  863. dnl **********************************************************************
  864. AC_ARG_WITH(krb4-includes,
  865. AC_HELP_STRING([--with-krb4-includes=DIR],
  866. [Specify location of kerberos4 headers]),[
  867. CPPFLAGS="$CPPFLAGS -I$withval"
  868. KRB4INC="$withval"
  869. want_krb4=yes
  870. ])
  871. AC_ARG_WITH(krb4-libs,
  872. AC_HELP_STRING([--with-krb4-libs=DIR],[Specify location of kerberos4 libs]),[
  873. LDFLAGS="$LDFLAGS -L$withval"
  874. KRB4LIB="$withval"
  875. want_krb4=yes
  876. ])
  877. OPT_KRB4=off
  878. AC_ARG_WITH(krb4,dnl
  879. AC_HELP_STRING([--with-krb4=DIR],[where to look for Kerberos4]),[
  880. OPT_KRB4="$withval"
  881. if test X"$OPT_KRB4" != Xno; then
  882. want_krb4="yes"
  883. if test X"$OPT_KRB4" != Xyes; then
  884. LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib$libsuff"
  885. KRB4LIB="$OPT_KRB4/lib$libsuff"
  886. CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
  887. KRB4INC="$OPT_KRB4/include"
  888. fi
  889. fi
  890. ])
  891. AC_MSG_CHECKING([if Kerberos4 support is requested])
  892. if test "$want_krb4" = yes
  893. then
  894. if test "$ipv6" = "yes"; then
  895. echo krb4 is not compatible with IPv6
  896. exit 1
  897. fi
  898. AC_MSG_RESULT(yes)
  899. dnl Check for & handle argument to --with-krb4
  900. AC_MSG_CHECKING(where to look for Kerberos4)
  901. if test X"$OPT_KRB4" = Xyes
  902. then
  903. AC_MSG_RESULT([defaults])
  904. else
  905. AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC])
  906. fi
  907. dnl Check for DES library
  908. AC_CHECK_LIB(des, des_pcbc_encrypt,
  909. [
  910. AC_CHECK_HEADERS(des.h)
  911. dnl resolv lib?
  912. AC_CHECK_FUNC(res_search, , [AC_CHECK_LIB(resolv, res_search)])
  913. dnl Check for the Kerberos4 library
  914. AC_CHECK_LIB(krb, krb_net_read,
  915. [
  916. dnl Check for header files
  917. AC_CHECK_HEADERS(krb.h)
  918. dnl we found the required libraries, add to LIBS
  919. LIBS="-lkrb -lcom_err -ldes $LIBS"
  920. dnl Check for function krb_get_our_ip_for_realm
  921. dnl this is needed for NAT networks
  922. AC_CHECK_FUNCS(krb_get_our_ip_for_realm)
  923. dnl add define KRB4
  924. AC_DEFINE(HAVE_KRB4, 1,
  925. [if you have the Kerberos4 libraries (including -ldes)])
  926. dnl substitute it too!
  927. KRB4_ENABLED=1
  928. AC_SUBST(KRB4_ENABLED)
  929. curl_krb4_msg="enabled"
  930. dnl the krb4 stuff needs a strlcpy()
  931. AC_CHECK_FUNCS(strlcpy)
  932. ])
  933. ])
  934. else
  935. AC_MSG_RESULT(no)
  936. fi
  937. dnl **********************************************************************
  938. dnl Check for FBopenssl(SPNEGO) libraries
  939. dnl **********************************************************************
  940. AC_ARG_WITH(spnego,
  941. AC_HELP_STRING([--with-spnego=DIR],
  942. [Specify location of SPNEGO library fbopenssl]), [
  943. SPNEGO_ROOT="$withval"
  944. if test x"$SPNEGO_ROOT" != xno; then
  945. want_spnego="yes"
  946. fi
  947. ])
  948. AC_MSG_CHECKING([if SPNEGO support is requested])
  949. if test x"$want_spnego" = xyes; then
  950. if test X"$SPNEGO_ROOT" = Xyes; then
  951. AC_MSG_ERROR([FBOpenSSL libs and/or directories were not found where specified!])
  952. AC_MSG_RESULT(no)
  953. else
  954. if test -z "$SPNEGO_LIB_DIR"; then
  955. LDFLAGS="$LDFLAGS -L$SPNEGO_ROOT -lfbopenssl"
  956. else
  957. LDFLAGS="$LDFLAGS $SPNEGO_LIB_DIR"
  958. fi
  959. AC_MSG_RESULT(yes)
  960. AC_DEFINE(HAVE_SPNEGO, 1,
  961. [Define this if you have the SPNEGO library fbopenssl])
  962. curl_spnego_msg="enabled"
  963. fi
  964. else
  965. AC_MSG_RESULT(no)
  966. fi
  967. dnl **********************************************************************
  968. dnl Check for GSS-API libraries
  969. dnl **********************************************************************
  970. dnl check for gss stuff in the /usr as default
  971. GSSAPI_ROOT="/usr"
  972. AC_ARG_WITH(gssapi-includes,
  973. AC_HELP_STRING([--with-gssapi-includes=DIR],
  974. [Specify location of GSSAPI header]),
  975. [ GSSAPI_INCS="-I$withval"
  976. want_gss="yes" ]
  977. )
  978. AC_ARG_WITH(gssapi-libs,
  979. AC_HELP_STRING([--with-gssapi-libs=DIR],
  980. [Specify location of GSSAPI libs]),
  981. [ GSSAPI_LIB_DIR="-L$withval"
  982. want_gss="yes" ]
  983. )
  984. AC_ARG_WITH(gssapi,
  985. AC_HELP_STRING([--with-gssapi=DIR],
  986. [Where to look for GSSAPI]), [
  987. GSSAPI_ROOT="$withval"
  988. if test x"$GSSAPI_ROOT" != xno; then
  989. want_gss="yes"
  990. if test x"$GSSAPI_ROOT" = xyes; then
  991. dnl if yes, then use default root
  992. GSSAPI_ROOT="/usr"
  993. fi
  994. fi
  995. ])
  996. save_CPPFLAGS="$CPPFLAGS"
  997. AC_MSG_CHECKING([if GSSAPI support is requested])
  998. if test x"$want_gss" = xyes; then
  999. AC_MSG_RESULT(yes)
  1000. if test -z "$GSSAPI_INCS"; then
  1001. if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
  1002. GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
  1003. GSSAPI_LIBS=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
  1004. elif test "$GSSAPI_ROOT" != "yes"; then
  1005. GSSAPI_INCS="-I$GSSAPI_ROOT/include"
  1006. GSSAPI_LIBS="-lgssapi"
  1007. fi
  1008. fi
  1009. CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
  1010. LIBS="$LIBS $GSSAPI_LIBS"
  1011. AC_CHECK_HEADER(gss.h,
  1012. [
  1013. dnl found in the given dirs
  1014. AC_DEFINE(HAVE_GSSGNU, 1, [if you have the GNU gssapi libraries])
  1015. gnu_gss=yes
  1016. ],
  1017. [
  1018. dnl not found, check Heimdal or MIT
  1019. AC_CHECK_HEADERS(
  1020. [gssapi/gssapi.h gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
  1021. [],
  1022. [not_mit=1])
  1023. if test "x$not_mit" = "x1"; then
  1024. dnl MIT not found, check for Heimdal
  1025. AC_CHECK_HEADER(gssapi.h,
  1026. [
  1027. dnl found
  1028. AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have the Heimdal gssapi libraries])
  1029. ],
  1030. [
  1031. dnl no header found, disabling GSS
  1032. want_gss=no
  1033. AC_MSG_WARN(disabling GSSAPI since no header files was found)
  1034. ]
  1035. )
  1036. else
  1037. dnl MIT found
  1038. AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
  1039. dnl check if we have a really old MIT kerberos (<= 1.2)
  1040. AC_MSG_CHECKING([if gssapi headers declare GSS_C_NT_HOSTBASED_SERVICE])
  1041. AC_COMPILE_IFELSE([
  1042. AC_LANG_PROGRAM([[
  1043. #include <gssapi/gssapi.h>
  1044. #include <gssapi/gssapi_generic.h>
  1045. #include <gssapi/gssapi_krb5.h>
  1046. ]],[[
  1047. gss_import_name(
  1048. (OM_uint32 *)0,
  1049. (gss_buffer_t)0,
  1050. GSS_C_NT_HOSTBASED_SERVICE,
  1051. (gss_name_t *)0);
  1052. ]])
  1053. ],[
  1054. AC_MSG_RESULT([yes])
  1055. ],[
  1056. AC_MSG_RESULT([no])
  1057. AC_DEFINE(HAVE_OLD_GSSMIT, 1,
  1058. [if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE])
  1059. ])
  1060. fi
  1061. ]
  1062. )
  1063. else
  1064. AC_MSG_RESULT(no)
  1065. fi
  1066. if test x"$want_gss" = xyes; then
  1067. AC_DEFINE(HAVE_GSSAPI, 1, [if you have the gssapi libraries])
  1068. curl_gss_msg="enabled (MIT/Heimdal)"
  1069. if test -n "$gnu_gss"; then
  1070. curl_gss_msg="enabled (GNU GSS)"
  1071. LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
  1072. LIBS="$LIBS -lgss"
  1073. elif test -z "$GSSAPI_LIB_DIR"; then
  1074. if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
  1075. dnl krb5-config doesn't have --libs-only-L or similar, put everything
  1076. dnl into LIBS
  1077. gss_libs=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
  1078. LIBS="$LIBS $gss_libs"
  1079. elif test "$GSSAPI_ROOT" != "yes"; then
  1080. LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
  1081. LIBS="$LIBS -lgssapi"
  1082. else
  1083. LIBS="$LIBS -lgssapi"
  1084. fi
  1085. else
  1086. LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
  1087. LIBS="$LIBS -lgssapi"
  1088. fi
  1089. else
  1090. CPPFLAGS="$save_CPPFLAGS"
  1091. fi
  1092. dnl **********************************************************************
  1093. dnl Check for the presence of SSL libraries and headers
  1094. dnl **********************************************************************
  1095. dnl Default to compiler & linker defaults for SSL files & libraries.
  1096. OPT_SSL=off
  1097. dnl Default to no CA bundle
  1098. ca="no"
  1099. AC_ARG_WITH(ssl,dnl
  1100. AC_HELP_STRING([--with-ssl=PATH],[Where to look for OpenSSL, PATH points to the SSL installation (default: /usr/local/ssl); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
  1101. AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
  1102. OPT_SSL=$withval)
  1103. if test X"$OPT_SSL" != Xno; then
  1104. dnl backup the pre-ssl variables
  1105. CLEANLDFLAGS="$LDFLAGS"
  1106. CLEANCPPFLAGS="$CPPFLAGS"
  1107. CLEANLIBS="$LIBS"
  1108. case "$OPT_SSL" in
  1109. yes)
  1110. dnl --with-ssl (without path) used
  1111. if test x$cross_compiling != xyes; then
  1112. dnl only do pkg-config magic when not cross-compiling
  1113. PKGTEST="yes"
  1114. fi
  1115. PREFIX_OPENSSL=/usr/local/ssl
  1116. LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
  1117. ;;
  1118. off)
  1119. dnl no --with-ssl option given, just check default places
  1120. if test x$cross_compiling != xyes; then
  1121. dnl only do pkg-config magic when not cross-compiling
  1122. PKGTEST="yes"
  1123. fi
  1124. PREFIX_OPENSSL=
  1125. ;;
  1126. *)
  1127. dnl check the given --with-ssl spot
  1128. PKGTEST="no"
  1129. PREFIX_OPENSSL=$OPT_SSL
  1130. dnl Try pkg-config even when cross-compiling. Since we
  1131. dnl specify PKG_CONFIG_LIBDIR we're only looking where
  1132. dnl the user told us to look
  1133. OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig"
  1134. AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
  1135. if test -e "$OPENSSL_PCDIR/openssl.pc"; then
  1136. PKGTEST="yes"
  1137. fi
  1138. dnl in case pkg-config comes up empty, use what we got
  1139. dnl via --with-ssl
  1140. LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
  1141. if test "$PREFIX_OPENSSL" != "/usr" ; then
  1142. SSL_LDFLAGS="-L$LIB_OPENSSL"
  1143. SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include"
  1144. fi
  1145. SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl"
  1146. ;;
  1147. esac
  1148. if test "$PKGTEST" = "yes"; then
  1149. CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR])
  1150. if test "$PKGCONFIG" != "no" ; then
  1151. SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
  1152. $PKGCONFIG --libs-only-l openssl 2>/dev/null`
  1153. SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
  1154. $PKGCONFIG --libs-only-L openssl 2>/dev/null`
  1155. SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
  1156. $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
  1157. AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
  1158. AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
  1159. AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
  1160. LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
  1161. dnl use the values pkg-config reported. This is here
  1162. dnl instead of below with CPPFLAGS and LDFLAGS because we only
  1163. dnl learn about this via pkg-config. If we only have
  1164. dnl the argument to --with-ssl we don't know what
  1165. dnl additional libs may be necessary. Hope that we
  1166. dnl don't need any.
  1167. LIBS="$LIBS $SSL_LIBS"
  1168. fi
  1169. fi
  1170. dnl finally, set flags to use SSL
  1171. CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
  1172. LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
  1173. dnl This is for Msys/Mingw
  1174. case $host in
  1175. *-*-msys* | *-*-mingw*)
  1176. AC_MSG_CHECKING([for gdi32])
  1177. my_ac_save_LIBS=$LIBS
  1178. LIBS="-lgdi32 $LIBS"
  1179. AC_TRY_LINK([#include <windef.h>
  1180. #include <wingdi.h>],
  1181. [GdiFlush();],
  1182. [ dnl worked!
  1183. AC_MSG_RESULT([yes])],
  1184. [ dnl failed, restore LIBS
  1185. LIBS=$my_ac_save_LIBS
  1186. AC_MSG_RESULT(no)]
  1187. )
  1188. ;;
  1189. esac
  1190. AC_CHECK_LIB(crypto, CRYPTO_lock,[
  1191. HAVECRYPTO="yes"
  1192. LIBS="-lcrypto $LIBS"
  1193. ],[
  1194. LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
  1195. CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
  1196. AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
  1197. HAVECRYPTO="yes"
  1198. LIBS="-lcrypto $LIBS"], [
  1199. LDFLAGS="$CLEANLDFLAGS"
  1200. CPPFLAGS="$CLEANCPPFLAGS"
  1201. LIBS="$CLEANLIBS"
  1202. ])
  1203. ])
  1204. if test X"$HAVECRYPTO" = X"yes"; then
  1205. dnl This is only reasonable to do if crypto actually is there: check for
  1206. dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
  1207. AC_CHECK_LIB(ssl, SSL_connect)
  1208. if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
  1209. dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
  1210. AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
  1211. OLIBS=$LIBS
  1212. LIBS="$LIBS -lRSAglue -lrsaref"
  1213. AC_CHECK_LIB(ssl, SSL_connect)
  1214. if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
  1215. dnl still no SSL_connect
  1216. AC_MSG_RESULT(no)
  1217. LIBS=$OLIBS
  1218. else
  1219. AC_MSG_RESULT(yes)
  1220. fi
  1221. else
  1222. dnl Have the libraries--check for SSLeay/OpenSSL headers
  1223. AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
  1224. openssl/pem.h openssl/ssl.h openssl/err.h,
  1225. curl_ssl_msg="enabled (OpenSSL)"
  1226. OPENSSL_ENABLED=1
  1227. AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
  1228. if test $ac_cv_header_openssl_x509_h = no; then
  1229. dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
  1230. dnl since 'err.h' might in fact find a krb4 header with the same
  1231. dnl name
  1232. AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
  1233. if test $ac_cv_header_x509_h = yes &&
  1234. test $ac_cv_header_crypto_h = yes &&
  1235. test $ac_cv_header_ssl_h = yes; then
  1236. dnl three matches
  1237. curl_ssl_msg="enabled (OpenSSL)"
  1238. OPENSSL_ENABLED=1
  1239. fi
  1240. fi
  1241. fi
  1242. if test X"$OPENSSL_ENABLED" = X"1"; then
  1243. AC_DEFINE(USE_SSLEAY, 1, [if SSL is enabled])
  1244. dnl is there a pkcs12.h header present?
  1245. AC_CHECK_HEADERS(openssl/pkcs12.h)
  1246. else
  1247. LIBS="$CLEANLIBS"
  1248. fi
  1249. dnl USE_SSLEAY is the historical name for what configure calls
  1250. dnl OPENSSL_ENABLED; the names should really be unified
  1251. USE_SSLEAY="$OPENSSL_ENABLED"
  1252. AC_SUBST(USE_SSLEAY)
  1253. if test X"$OPT_SSL" != Xoff &&
  1254. test "$OPENSSL_ENABLED" != "1"; then
  1255. AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
  1256. fi
  1257. fi
  1258. if test X"$OPENSSL_ENABLED" = X"1"; then
  1259. dnl If the ENGINE library seems to be around, check for the OpenSSL engine
  1260. dnl stuff, it is kind of "separated" from the main SSL check
  1261. AC_CHECK_FUNC(ENGINE_init,
  1262. [
  1263. AC_CHECK_HEADERS(openssl/engine.h)
  1264. AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
  1265. ])
  1266. dnl these can only exist if openssl exists
  1267. dnl yassl doesn't have SSL_get_shutdown
  1268. AC_CHECK_FUNCS( RAND_status \
  1269. RAND_screen \
  1270. RAND_egd \
  1271. ENGINE_cleanup \
  1272. CRYPTO_cleanup_all_ex_data \
  1273. SSL_get_shutdown )
  1274. dnl Make an attempt to detect if this is actually yassl's headers and
  1275. dnl OpenSSL emulation layer. We still leave everything else believing
  1276. dnl and acting like OpenSSL.
  1277. AC_MSG_CHECKING([for yaSSL using OpenSSL compatibility mode])
  1278. AC_COMPILE_IFELSE([
  1279. AC_LANG_PROGRAM([[
  1280. #include <openssl/ssl.h>
  1281. ]],[[
  1282. #if defined(YASSL_VERSION) && defined(OPENSSL_VERSION_NUMBER)
  1283. int dummy = SSL_ERROR_NONE;
  1284. #else
  1285. Not the yaSSL OpenSSL compatibility header.
  1286. #endif
  1287. ]])
  1288. ],[
  1289. AC_MSG_RESULT([yes])
  1290. AC_DEFINE_UNQUOTED(USE_YASSLEMUL, 1,
  1291. [Define to 1 if using yaSSL in OpenSSL compatibility mode.])
  1292. curl_ssl_msg="enabled (OpenSSL emulation by yaSSL)"
  1293. ],[
  1294. AC_MSG_RESULT([no])
  1295. ])
  1296. fi
  1297. if test "$OPENSSL_ENABLED" = "1"; then
  1298. if test -n "$LIB_OPENSSL"; then
  1299. dnl when the ssl shared libs were found in a path that the run-time
  1300. dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
  1301. dnl to prevent further configure tests to fail due to this
  1302. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
  1303. export LD_LIBRARY_PATH
  1304. AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
  1305. fi
  1306. fi
  1307. fi
  1308. dnl **********************************************************************
  1309. dnl Check for the presence of ZLIB libraries and headers
  1310. dnl **********************************************************************
  1311. dnl Check for & handle argument to --with-zlib.
  1312. _cppflags=$CPPFLAGS
  1313. _ldflags=$LDFLAGS
  1314. AC_ARG_WITH(zlib,
  1315. AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
  1316. AC_HELP_STRING([--without-zlib],[disable use of zlib]),
  1317. [OPT_ZLIB="$withval"])
  1318. if test "$OPT_ZLIB" = "no" ; then
  1319. AC_MSG_WARN([zlib disabled])
  1320. else
  1321. if test "$OPT_ZLIB" = "yes" ; then
  1322. OPT_ZLIB=""
  1323. fi
  1324. if test -z "$OPT_ZLIB" ; then
  1325. dnl check for the lib first without setting any new path, since many
  1326. dnl people have it in the default path
  1327. AC_CHECK_LIB(z, inflateEnd,
  1328. dnl libz found, set the variable
  1329. [HAVE_LIBZ="1"],
  1330. dnl if no lib found, try /usr/local
  1331. [OPT_ZLIB="/usr/local"])
  1332. fi
  1333. dnl Add a nonempty path to the compiler flags
  1334. if test -n "$OPT_ZLIB"; then
  1335. CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
  1336. LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
  1337. fi
  1338. AC_CHECK_HEADER(zlib.h,
  1339. [
  1340. dnl zlib.h was found
  1341. HAVE_ZLIB_H="1"
  1342. dnl if the lib wasn't found already, try again with the new paths
  1343. if test "$HAVE_LIBZ" != "1"; then
  1344. AC_CHECK_LIB(z, gzread,
  1345. [
  1346. dnl the lib was found!
  1347. HAVE_LIBZ="1"
  1348. ],
  1349. [ CPPFLAGS=$_cppflags
  1350. LDFLAGS=$_ldflags])
  1351. fi
  1352. ],
  1353. [
  1354. dnl zlib.h was not found, restore the flags
  1355. CPPFLAGS=$_cppflags
  1356. LDFLAGS=$_ldflags]
  1357. )
  1358. if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
  1359. then
  1360. AC_MSG_WARN([configure found only the libz lib, not the header file!])
  1361. HAVE_LIBZ=""
  1362. elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
  1363. then
  1364. AC_MSG_WARN([configure found only the libz header file, not the lib!])
  1365. elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
  1366. then
  1367. dnl both header and lib were found!
  1368. AC_SUBST(HAVE_LIBZ)
  1369. AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
  1370. AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
  1371. CURL_LIBS="$CURL_LIBS -lz"
  1372. LIBS="$LIBS -lz"
  1373. dnl replace 'HAVE_LIBZ' in the automake makefile.ams
  1374. AMFIXLIB="1"
  1375. AC_MSG_NOTICE([found both libz and libz.h header])
  1376. curl_zlib_msg="enabled"
  1377. fi
  1378. fi
  1379. dnl set variable for use in automakefile(s)
  1380. AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
  1381. dnl **********************************************************************
  1382. dnl Check for the random seed preferences
  1383. dnl **********************************************************************
  1384. if test X"$OPENSSL_ENABLED" = X"1"; then
  1385. AC_ARG_WITH(egd-socket,
  1386. AC_HELP_STRING([--with-egd-socket=FILE],
  1387. [Entropy Gathering Daemon socket pathname]),
  1388. [ EGD_SOCKET="$withval" ]
  1389. )
  1390. if test -n "$EGD_SOCKET" ; then
  1391. AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
  1392. [your Entropy Gathering Daemon socket pathname] )
  1393. fi
  1394. dnl Check for user-specified random device
  1395. AC_ARG_WITH(random,
  1396. AC_HELP_STRING([--with-random=FILE],
  1397. [read randomness from FILE (default=/dev/urandom)]),
  1398. [ RANDOM_FILE="$withval" ],
  1399. [
  1400. dnl Check for random device
  1401. AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
  1402. ]
  1403. )
  1404. if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
  1405. AC_SUBST(RANDOM_FILE)
  1406. AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
  1407. [a suitable file to read random data from])
  1408. fi
  1409. fi
  1410. dnl ----------------------------------------------------
  1411. dnl check for GnuTLS
  1412. dnl ----------------------------------------------------
  1413. dnl Default to compiler & linker defaults for GnuTLS files & libraries.
  1414. OPT_GNUTLS=no
  1415. AC_ARG_WITH(gnutls,dnl
  1416. AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root (default: /usr/local/)])
  1417. AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
  1418. OPT_GNUTLS=$withval)
  1419. if test "$OPENSSL_ENABLED" != "1"; then
  1420. if test X"$OPT_GNUTLS" != Xno; then
  1421. addld=""
  1422. if test "x$OPT_GNUTLS" = "xyes"; then
  1423. dnl this is with no partiular path given
  1424. CURL_CHECK_PKGCONFIG(gnutls)
  1425. if test "$PKGCONFIG" != "no" ; then
  1426. addlib=`$PKGCONFIG --libs-only-l gnutls`
  1427. addld=`$PKGCONFIG --libs-only-L gnutls`
  1428. addcflags=`$PKGCONFIG --cflags-only-I gnutls`
  1429. version=`$PKGCONFIG --modversion gnutls`
  1430. gtlslib=`echo $addld | $SED -e 's/-L//'`
  1431. else
  1432. dnl without pkg-config, we try libgnutls-config as that was how it
  1433. dnl used to be done
  1434. check=`libgnutls-config --version 2>/dev/null`
  1435. if test -n "$check"; then
  1436. addlib=`libgnutls-config --libs`
  1437. addcflags=`libgnutls-config --cflags`
  1438. version=`libgnutls-config --version`
  1439. gtlslib=`libgnutls-config --prefix`/lib$libsuff
  1440. fi
  1441. fi
  1442. else
  1443. dnl this is with a given path, first check if there's a libgnutls-config
  1444. dnl there and if not, make an educated guess
  1445. cfg=$OPT_GNUTLS/bin/libgnutls-config
  1446. check=`$cfg --version 2>/dev/null`
  1447. if test -n "$check"; then
  1448. addlib=`$cfg --libs`
  1449. addcflags=`$cfg --cflags`
  1450. version=`$cfg --version`
  1451. gtlslib=`$cfg --prefix`/lib$libsuff
  1452. else
  1453. dnl without pkg-config and libgnutls-config, we guess a lot!
  1454. addlib=-lgnutls
  1455. addld=-L$OPT_GNUTLS/lib$libsuff
  1456. addcflags=-I$OPT_GNUTLS/include
  1457. version="" # we just don't know
  1458. gtlslib=$OPT_GNUTLS/lib$libsuff
  1459. fi
  1460. fi
  1461. if test -z "$version"; then
  1462. dnl lots of efforts, still no go
  1463. version="unknown"
  1464. fi
  1465. if test -n "$addlib"; then
  1466. CLEANLIBS="$LIBS"
  1467. CLEANCPPFLAGS="$CPPFLAGS"
  1468. CLEADLDFLAGS="$LDFLAGS"
  1469. LIBS="$LIBS $addlib"
  1470. LDFLAGS="$LDFLAGS $addld"
  1471. if test "$addcflags" != "-I/usr/include"; then
  1472. CPPFLAGS="$CPPFLAGS $addcflags"
  1473. fi
  1474. AC_CHECK_LIB(gnutls, gnutls_check_version,
  1475. [
  1476. AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
  1477. AC_SUBST(USE_GNUTLS, [1])
  1478. GNUTLS_ENABLED=1
  1479. USE_GNUTLS="yes"
  1480. curl_ssl_msg="enabled (GnuTLS)"
  1481. ],
  1482. [
  1483. LIBS="$CLEANLIBS"
  1484. CPPFLAGS="$CLEANCPPFLAGS"
  1485. ])
  1486. if test "x$USE_GNUTLS" = "xyes"; then
  1487. AC_MSG_NOTICE([detected GnuTLS version $version])
  1488. if test -n "$gtlslib"; then
  1489. dnl when shared libs were found in a path that the run-time
  1490. dnl linker doesn't search through, we need to add it to
  1491. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1492. dnl due to this
  1493. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib"
  1494. export LD_LIBRARY_PATH
  1495. AC_MSG_NOTICE([Added $gtlslib to LD_LIBRARY_PATH])
  1496. fi
  1497. fi
  1498. fi
  1499. fi dnl GNUTLS not disabled
  1500. fi dnl OPENSSL != 1
  1501. dnl ----------------------------------------------------
  1502. dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
  1503. dnl ----------------------------------------------------
  1504. dnl Default to compiler & linker defaults for NSS files & libraries.
  1505. OPT_NSS=no
  1506. AC_ARG_WITH(nss,dnl
  1507. AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root (default: /usr/local/)])
  1508. AC_HELP_STRING([--without-nss], [disable NSS detection]),
  1509. OPT_NSS=$withval)
  1510. if test "$OPENSSL_ENABLED" != "1" -a "$GNUTLS_ENABLED" != "1"; then
  1511. if test X"$OPT_NSS" != Xno; then
  1512. if test "x$OPT_NSS" = "xyes"; then
  1513. CURL_CHECK_PKGCONFIG(nss)
  1514. if test "$PKGCONFIG" != "no" ; then
  1515. addlib=`$PKGCONFIG --libs nss`
  1516. addcflags=`$PKGCONFIG --cflags nss`
  1517. version=`$PKGCONFIG --modversion nss`
  1518. nssprefix=`$PKGCONFIG --variable=prefix nss`
  1519. else
  1520. dnl Without pkg-config, we check for nss-config
  1521. check=`nss-config --version 2>/dev/null`
  1522. if test -n "$check"; then
  1523. addlib=`nss-config --libs`
  1524. addcflags=`nss-config --cflags`
  1525. version=`nss-config --version`
  1526. nssprefix=`nss-config --prefix`
  1527. else
  1528. addlib="-lnss3"
  1529. addcflags=""
  1530. version="unknown"
  1531. fi
  1532. fi
  1533. else
  1534. # Without pkg-config, we'll kludge in some defaults
  1535. addlib="-L$OPT_NSS/lib -lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
  1536. addcflags="-I$OPT_NSS/include"
  1537. version="unknown"
  1538. nssprefix=$OPT_NSS
  1539. fi
  1540. dnl Check for functionPK11_CreateGenericObject
  1541. dnl this is needed for using the PEM PKCS#11 module
  1542. AC_CHECK_LIB(nss3, PK11_CreateGenericObject,
  1543. [
  1544. AC_DEFINE(HAVE_PK11_CREATEGENERICOBJECT, 1, [if you have the function PK11_CreateGenericObject])
  1545. AC_SUBST(HAVE_PK11_CREATEGENERICOBJECT, [1])
  1546. ])
  1547. if test -n "$addlib"; then
  1548. CLEANLIBS="$LIBS"
  1549. CLEANCPPFLAGS="$CPPFLAGS"
  1550. LIBS="$LIBS $addlib"
  1551. if test "$addcflags" != "-I/usr/include"; then
  1552. CPPFLAGS="$CPPFLAGS $addcflags"
  1553. fi
  1554. AC_CHECK_LIB(nss3, NSS_Initialize,
  1555. [
  1556. AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
  1557. AC_SUBST(USE_NSS, [1])
  1558. USE_NSS="yes"
  1559. NSS_ENABLED=1
  1560. curl_ssl_msg="enabled (NSS)"
  1561. ],
  1562. [
  1563. LIBS="$CLEANLIBS"
  1564. CPPFLAGS="$CLEANCPPFLAGS"
  1565. ])
  1566. if test "x$USE_NSS" = "xyes"; then
  1567. AC_MSG_NOTICE([detected NSS version $version])
  1568. dnl when shared libs were found in a path that the run-time
  1569. dnl linker doesn't search through, we need to add it to
  1570. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1571. dnl due to this
  1572. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff"
  1573. export LD_LIBRARY_PATH
  1574. AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH])
  1575. fi
  1576. fi
  1577. fi dnl NSS not disabled
  1578. fi dnl OPENSSL != 1 -a GNUTLS_ENABLED != 1
  1579. if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED" = "x"; then
  1580. AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
  1581. AC_MSG_WARN([Use --with-ssl, --with-gnutls or --with-nss to address this.])
  1582. else
  1583. # SSL is enabled, genericly
  1584. AC_SUBST(SSL_ENABLED)
  1585. SSL_ENABLED="1"
  1586. fi
  1587. dnl **********************************************************************
  1588. dnl Check for the CA bundle
  1589. dnl **********************************************************************
  1590. CURL_CHECK_CA_BUNDLE
  1591. dnl **********************************************************************
  1592. dnl Check for the presence of LIBSSH2 libraries and headers
  1593. dnl **********************************************************************
  1594. dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
  1595. OPT_LIBSSH2=off
  1596. AC_ARG_WITH(libssh2,dnl
  1597. AC_HELP_STRING([--with-libssh2=PATH],[Where to look for libssh2, PATH points to the LIBSSH2 installation (default: /usr/local/lib); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
  1598. AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]),
  1599. OPT_LIBSSH2=$withval)
  1600. if test X"$OPT_LIBSSH2" != Xno; then
  1601. dnl backup the pre-libssh2 variables
  1602. CLEANLDFLAGS="$LDFLAGS"
  1603. CLEANCPPFLAGS="$CPPFLAGS"
  1604. CLEANLIBS="$LIBS"
  1605. case "$OPT_LIBSSH2" in
  1606. yes)
  1607. dnl --with-libssh2 (without path) used
  1608. CURL_CHECK_PKGCONFIG(libssh2)
  1609. if test "$PKGCONFIG" != "no" ; then
  1610. LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2`
  1611. LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
  1612. CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
  1613. version=`$PKGCONFIG --modversion libssh2`
  1614. DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'`
  1615. fi
  1616. ;;
  1617. off)
  1618. dnl no --with-libssh2 option given, just check default places
  1619. ;;
  1620. *)
  1621. dnl use the given --with-libssh2 spot
  1622. PREFIX_SSH2=$OPT_LIBSSH2
  1623. ;;
  1624. esac
  1625. dnl if given with a prefix, we set -L and -I based on that
  1626. if test -n "$PREFIX_SSH2"; then
  1627. LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
  1628. CPP_SSH2=-I${PREFIX_SSH2}/include
  1629. DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
  1630. fi
  1631. LDFLAGS="$LDFLAGS $LD_SSH2"
  1632. CPPFLAGS="$CPPFLAGS $CPP_SSH2"
  1633. LIBS="$LIBS $LIB_SSH2"
  1634. AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
  1635. AC_CHECK_HEADERS(libssh2.h,
  1636. curl_ssh_msg="enabled (libSSH2)"
  1637. LIBSSH2_ENABLED=1
  1638. AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
  1639. AC_SUBST(USE_LIBSSH2, [1])
  1640. )
  1641. if test X"$OPT_LIBSSH2" != Xoff &&
  1642. test "$LIBSSH2_ENABLED" != "1"; then
  1643. AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
  1644. fi
  1645. if test "$LIBSSH2_ENABLED" = "1"; then
  1646. if test -n "$DIR_SSH2"; then
  1647. dnl when the libssh2 shared libs were found in a path that the run-time
  1648. dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
  1649. dnl to prevent further configure tests to fail due to this
  1650. dnl libssh2_version is a post 1.0 addition
  1651. AC_CHECK_FUNCS( libssh2_version )
  1652. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2"
  1653. export LD_LIBRARY_PATH
  1654. AC_MSG_NOTICE([Added $DIR_SSH2 to LD_LIBRARY_PATH])
  1655. fi
  1656. else
  1657. dnl no libssh2, revert back to clean variables
  1658. LDFLAGS=$CLEANLDFLAGS
  1659. CPPFLAGS=$CLEANCPPFLAGS
  1660. LIBS=$CLEANLIBS
  1661. fi
  1662. fi
  1663. dnl **********************************************************************
  1664. dnl Check for the presence of IDN libraries and headers
  1665. dnl **********************************************************************
  1666. AC_MSG_CHECKING([whether to build with libidn])
  1667. AC_ARG_WITH(libidn,
  1668. AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage])
  1669. AC_HELP_STRING([--without-libidn],[Disable libidn usage]),
  1670. [LIBIDN="$withval"])
  1671. case "$LIBIDN" in
  1672. no)
  1673. AC_MSG_RESULT(no)
  1674. ;;
  1675. *) AC_MSG_RESULT(yes)
  1676. idn=""
  1677. dnl if there is a given path, check that FIRST
  1678. if test -n "$LIBIDN"; then
  1679. if test "x$LIBIDN" != "xyes"; then
  1680. oldLDFLAGS=$LDFLAGS
  1681. oldCPPFLAGS=$CPPFLAGS
  1682. LDFLAGS="$LDFLAGS -L$LIBIDN/lib"
  1683. CPPFLAGS="$CPPFLAGS -I$LIBIDN/include"
  1684. idn="yes"
  1685. AC_CHECK_LIB(idn, idna_to_ascii_4i, ,
  1686. idn=""
  1687. LDFLAGS=$oldLDFLAGS
  1688. CPPFLAGS=$oldCPPFLAGS)
  1689. fi
  1690. fi
  1691. if test "x$idn" != "xyes"; then
  1692. dnl check with default paths
  1693. idn="yes"
  1694. AC_CHECK_LIB(idn, idna_to_ascii_lz, ,
  1695. idn="")
  1696. fi
  1697. if test "x$idn" = "xyes"; then
  1698. curl_idn_msg="enabled"
  1699. AC_SUBST(IDN_ENABLED, [1])
  1700. dnl different versions of libidn have different setups of these:
  1701. AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror)
  1702. AC_CHECK_HEADERS( idn-free.h tld.h )
  1703. fi
  1704. ;;
  1705. esac
  1706. dnl Let's hope this split URL remains working:
  1707. dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
  1708. dnl genprogc/thread_quick_ref.htm
  1709. dnl **********************************************************************
  1710. dnl Back to "normal" configuring
  1711. dnl **********************************************************************
  1712. dnl Checks for header files.
  1713. AC_HEADER_STDC
  1714. CURL_CHECK_HEADER_MALLOC
  1715. CURL_CHECK_HEADER_MEMORY
  1716. dnl Now check for the very most basic headers. Then we can use these
  1717. dnl ones as default-headers when checking for the rest!
  1718. AC_CHECK_HEADERS(
  1719. sys/types.h \
  1720. sys/time.h \
  1721. sys/select.h \
  1722. sys/socket.h \
  1723. sys/ioctl.h \
  1724. sys/uio.h \
  1725. assert.h \
  1726. unistd.h \
  1727. stdlib.h \
  1728. limits.h \
  1729. arpa/inet.h \
  1730. net/if.h \
  1731. netinet/in.h \
  1732. sys/un.h \
  1733. netinet/tcp.h \
  1734. netdb.h \
  1735. sys/sockio.h \
  1736. sys/stat.h \
  1737. sys/param.h \
  1738. termios.h \
  1739. termio.h \
  1740. sgtty.h \
  1741. fcntl.h \
  1742. alloca.h \
  1743. time.h \
  1744. io.h \
  1745. pwd.h \
  1746. utime.h \
  1747. sys/utime.h \
  1748. sys/poll.h \
  1749. poll.h \
  1750. socket.h \
  1751. sys/resource.h \
  1752. libgen.h \
  1753. locale.h \
  1754. errno.h \
  1755. stdbool.h \
  1756. arpa/tftp.h \
  1757. sys/filio.h \
  1758. setjmp.h,
  1759. dnl to do if not found
  1760. [],
  1761. dnl to do if found
  1762. [],
  1763. dnl default includes
  1764. [
  1765. #ifdef HAVE_SYS_TYPES_H
  1766. #include <sys/types.h>
  1767. #endif
  1768. #ifdef HAVE_SYS_TIME_H
  1769. #include <sys/time.h>
  1770. #endif
  1771. #ifdef HAVE_SYS_SELECT_H
  1772. #include <sys/select.h>
  1773. #endif
  1774. #ifdef HAVE_SYS_SOCKET_H
  1775. #include <sys/socket.h>
  1776. #endif
  1777. #ifdef HAVE_NETINET_IN_H
  1778. #include <netinet/in.h>
  1779. #endif
  1780. #ifdef HAVE_SYS_UN_H
  1781. #include <sys/un.h>
  1782. #endif
  1783. ]
  1784. )
  1785. dnl Checks for typedefs, structures, and compiler characteristics.
  1786. AC_C_CONST
  1787. CURL_CHECK_VARIADIC_MACROS
  1788. AC_TYPE_SIZE_T
  1789. AC_HEADER_TIME
  1790. CURL_CHECK_STRUCT_TIMEVAL
  1791. CURL_VERIFY_RUNTIMELIBS
  1792. AC_CHECK_SIZEOF(size_t)
  1793. AC_CHECK_SIZEOF(int)
  1794. AC_CHECK_SIZEOF(long)
  1795. CURL_CONFIGURE_LONG
  1796. AC_CHECK_SIZEOF(time_t)
  1797. AC_CHECK_SIZEOF(off_t)
  1798. soname_bump=no
  1799. if test x"$ac_cv_native_windows" != "xyes" &&
  1800. test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then
  1801. AC_MSG_WARN([This libcurl built is probably not ABI compatible with previous])
  1802. AC_MSG_WARN([builds! You MUST read lib/README.curl_off_t to figure it out.])
  1803. soname_bump=yes
  1804. fi
  1805. AC_CHECK_TYPE(long long,
  1806. [AC_DEFINE(HAVE_LONGLONG, 1,
  1807. [Define to 1 if the compiler supports the 'long long' data type.])]
  1808. longlong="yes"
  1809. )
  1810. if test "xyes" = "x$longlong"; then
  1811. AC_MSG_CHECKING([if numberLL works])
  1812. AC_COMPILE_IFELSE([long long val = 1000LL;],
  1813. [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
  1814. AC_MSG_RESULT(yes),
  1815. AC_MSG_RESULT(no)
  1816. )
  1817. fi
  1818. # check for ssize_t
  1819. AC_CHECK_TYPE(ssize_t, ,
  1820. AC_DEFINE(ssize_t, int, [the signed version of size_t]))
  1821. # check for bool type
  1822. AC_CHECK_TYPE([bool],[
  1823. AC_DEFINE(HAVE_BOOL_T, 1,
  1824. [Define to 1 if bool is an available type.])
  1825. ], ,[
  1826. #ifdef HAVE_SYS_TYPES_H
  1827. #include <sys/types.h>
  1828. #endif
  1829. #ifdef HAVE_STDBOOL_H
  1830. #include <stdbool.h>
  1831. #endif
  1832. ])
  1833. CURL_CONFIGURE_CURL_SOCKLEN_T
  1834. TYPE_IN_ADDR_T
  1835. TYPE_SOCKADDR_STORAGE
  1836. TYPE_SIG_ATOMIC_T
  1837. AC_TYPE_SIGNAL
  1838. CURL_CHECK_FUNC_SELECT
  1839. CURL_CHECK_FUNC_RECV
  1840. CURL_CHECK_FUNC_RECVFROM
  1841. CURL_CHECK_FUNC_SEND
  1842. CURL_CHECK_MSG_NOSIGNAL
  1843. CURL_CHECK_FUNC_ALARM
  1844. CURL_CHECK_FUNC_BASENAME
  1845. CURL_CHECK_FUNC_CLOSESOCKET
  1846. CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
  1847. CURL_CHECK_FUNC_CONNECT
  1848. CURL_CHECK_FUNC_FCNTL
  1849. CURL_CHECK_FUNC_FDOPEN
  1850. CURL_CHECK_FUNC_FREEADDRINFO
  1851. CURL_CHECK_FUNC_FREEIFADDRS
  1852. CURL_CHECK_FUNC_FTRUNCATE
  1853. CURL_CHECK_FUNC_GETADDRINFO
  1854. CURL_CHECK_FUNC_GETHOSTBYADDR
  1855. CURL_CHECK_FUNC_GETHOSTBYADDR_R
  1856. CURL_CHECK_FUNC_GETHOSTBYNAME
  1857. CURL_CHECK_FUNC_GETHOSTBYNAME_R
  1858. CURL_CHECK_FUNC_GETHOSTNAME
  1859. CURL_CHECK_FUNC_GETIFADDRS
  1860. CURL_CHECK_FUNC_GETSERVBYPORT_R
  1861. CURL_CHECK_FUNC_GMTIME_R
  1862. CURL_CHECK_FUNC_INET_NTOA_R
  1863. CURL_CHECK_FUNC_INET_NTOP
  1864. CURL_CHECK_FUNC_INET_PTON
  1865. CURL_CHECK_FUNC_IOCTL
  1866. CURL_CHECK_FUNC_IOCTLSOCKET
  1867. CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
  1868. CURL_CHECK_FUNC_LOCALTIME_R
  1869. CURL_CHECK_FUNC_MEMRCHR
  1870. CURL_CHECK_FUNC_POLL
  1871. CURL_CHECK_FUNC_SETSOCKOPT
  1872. CURL_CHECK_FUNC_SIGACTION
  1873. CURL_CHECK_FUNC_SIGINTERRUPT
  1874. CURL_CHECK_FUNC_SIGNAL
  1875. CURL_CHECK_FUNC_SIGSETJMP
  1876. CURL_CHECK_FUNC_SOCKET
  1877. CURL_CHECK_FUNC_STRCASECMP
  1878. CURL_CHECK_FUNC_STRCASESTR
  1879. CURL_CHECK_FUNC_STRCMPI
  1880. CURL_CHECK_FUNC_STRDUP
  1881. CURL_CHECK_FUNC_STRERROR_R
  1882. CURL_CHECK_FUNC_STRICMP
  1883. CURL_CHECK_FUNC_STRLCAT
  1884. CURL_CHECK_FUNC_STRNCASECMP
  1885. CURL_CHECK_FUNC_STRNCMPI
  1886. CURL_CHECK_FUNC_STRNICMP
  1887. CURL_CHECK_FUNC_STRSTR
  1888. CURL_CHECK_FUNC_STRTOK_R
  1889. CURL_CHECK_FUNC_STRTOLL
  1890. CURL_CHECK_FUNC_WRITEV
  1891. dnl Checks for library functions.
  1892. dnl AC_PROG_GCC_TRADITIONAL
  1893. dnl AC_FUNC_VPRINTF
  1894. case $host in
  1895. *msdosdjgpp)
  1896. ac_cv_func_pipe=no
  1897. skipcheck_pipe=yes
  1898. AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
  1899. ;;
  1900. esac
  1901. AC_CHECK_FUNCS([fork \
  1902. geteuid \
  1903. getpass_r \
  1904. getppid \
  1905. getprotobyname \
  1906. getpwuid \
  1907. getrlimit \
  1908. gettimeofday \
  1909. inet_addr \
  1910. perror \
  1911. pipe \
  1912. setlocale \
  1913. setmode \
  1914. setrlimit \
  1915. uname \
  1916. utime
  1917. ],[
  1918. ],[
  1919. func="$ac_func"
  1920. eval skipcheck=\$skipcheck_$func
  1921. if test "x$skipcheck" != "xyes"; then
  1922. AC_MSG_CHECKING([deeper for $func])
  1923. AC_LINK_IFELSE([
  1924. AC_LANG_PROGRAM([[
  1925. ]],[[
  1926. $func ();
  1927. ]])
  1928. ],[
  1929. AC_MSG_RESULT([yes])
  1930. eval "ac_cv_func_$func=yes"
  1931. AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$func]), [1],
  1932. [Define to 1 if you have the $func function.])
  1933. ],[
  1934. AC_MSG_RESULT([but still no])
  1935. ])
  1936. fi
  1937. ])
  1938. dnl Check if the getnameinfo function is available
  1939. dnl and get the types of five of its arguments.
  1940. CURL_CHECK_FUNC_GETNAMEINFO
  1941. if test "$ipv6" = "yes"; then
  1942. if test "$ac_cv_func_getaddrinfo" = "yes"; then
  1943. AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
  1944. IPV6_ENABLED=1
  1945. AC_SUBST(IPV6_ENABLED)
  1946. fi
  1947. CURL_CHECK_NI_WITHSCOPEID
  1948. fi
  1949. dnl ************************************************************
  1950. dnl enable non-blocking communications
  1951. dnl
  1952. CURL_CHECK_OPTION_NONBLOCKING
  1953. CURL_CHECK_NONBLOCKING_SOCKET
  1954. dnl ************************************************************
  1955. dnl nroff tool stuff
  1956. dnl
  1957. AC_PATH_PROG( PERL, perl, ,
  1958. $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
  1959. AC_SUBST(PERL)
  1960. AC_PATH_PROGS( NROFF, gnroff nroff, ,
  1961. $PATH:/usr/bin/:/usr/local/bin )
  1962. AC_SUBST(NROFF)
  1963. if test -n "$NROFF"; then
  1964. dnl only check for nroff options if an nroff command was found
  1965. AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
  1966. MANOPT="-man"
  1967. mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
  1968. if test -z "$mancheck"; then
  1969. MANOPT="-mandoc"
  1970. mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
  1971. if test -z "$mancheck"; then
  1972. MANOPT=""
  1973. AC_MSG_RESULT([failed])
  1974. AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
  1975. else
  1976. AC_MSG_RESULT([$MANOPT])
  1977. fi
  1978. else
  1979. AC_MSG_RESULT([$MANOPT])
  1980. fi
  1981. AC_SUBST(MANOPT)
  1982. fi
  1983. if test -z "$MANOPT"
  1984. then
  1985. dnl if no nroff tool was found, or no option that could convert man pages
  1986. dnl was found, then disable the built-in manual stuff
  1987. AC_MSG_WARN([disabling built-in manual])
  1988. USE_MANUAL="no";
  1989. fi
  1990. dnl *************************************************************************
  1991. dnl If the manual variable still is set, then we go with providing a built-in
  1992. dnl manual
  1993. if test "$USE_MANUAL" = "1"; then
  1994. AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
  1995. curl_manual_msg="enabled"
  1996. fi
  1997. dnl set variable for use in automakefile(s)
  1998. AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
  1999. CURL_CHECK_LIB_ARES
  2000. AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
  2001. dnl ************************************************************
  2002. dnl disable verbose text strings
  2003. dnl
  2004. AC_MSG_CHECKING([whether to enable verbose strings])
  2005. AC_ARG_ENABLE(verbose,
  2006. AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
  2007. AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
  2008. [ case "$enableval" in
  2009. no)
  2010. AC_MSG_RESULT(no)
  2011. AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
  2012. curl_verbose_msg="no"
  2013. ;;
  2014. *) AC_MSG_RESULT(yes)
  2015. ;;
  2016. esac ],
  2017. AC_MSG_RESULT(yes)
  2018. )
  2019. dnl ************************************************************
  2020. dnl enable SSPI support
  2021. dnl
  2022. AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
  2023. AC_ARG_ENABLE(sspi,
  2024. AC_HELP_STRING([--enable-sspi],[Enable SSPI])
  2025. AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
  2026. [ case "$enableval" in
  2027. yes)
  2028. if test "$ac_cv_native_windows" = "yes"; then
  2029. AC_MSG_RESULT(yes)
  2030. AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
  2031. AC_SUBST(USE_WINDOWS_SSPI, [1])
  2032. curl_sspi_msg="enabled"
  2033. else
  2034. AC_MSG_RESULT(no)
  2035. AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
  2036. fi
  2037. ;;
  2038. *)
  2039. AC_MSG_RESULT(no)
  2040. ;;
  2041. esac ],
  2042. AC_MSG_RESULT(no)
  2043. )
  2044. dnl ************************************************************
  2045. dnl disable cryptographic authentication
  2046. dnl
  2047. AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
  2048. AC_ARG_ENABLE(crypto-auth,
  2049. AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
  2050. AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
  2051. [ case "$enableval" in
  2052. no)
  2053. AC_MSG_RESULT(no)
  2054. AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
  2055. ;;
  2056. *) AC_MSG_RESULT(yes)
  2057. ;;
  2058. esac ],
  2059. AC_MSG_RESULT(yes)
  2060. )
  2061. dnl ************************************************************
  2062. dnl disable cookies support
  2063. dnl
  2064. AC_MSG_CHECKING([whether to enable support for cookies])
  2065. AC_ARG_ENABLE(cookies,
  2066. AC_HELP_STRING([--enable-cookies],[Enable cookies support])
  2067. AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
  2068. [ case "$enableval" in
  2069. no)
  2070. AC_MSG_RESULT(no)
  2071. AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
  2072. ;;
  2073. *) AC_MSG_RESULT(yes)
  2074. ;;
  2075. esac ],
  2076. AC_MSG_RESULT(yes)
  2077. )
  2078. dnl ************************************************************
  2079. dnl Enable hiding of internal symbols in library to reduce its size and
  2080. dnl speed dynamic linking of applications. This currently is only supported
  2081. dnl on gcc >= 4.0 and SunPro C.
  2082. dnl
  2083. AC_MSG_CHECKING([whether to enable hidden symbols in the library])
  2084. AC_ARG_ENABLE(hidden-symbols,
  2085. AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
  2086. AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
  2087. [ case "$enableval" in
  2088. no)
  2089. AC_MSG_RESULT(no)
  2090. ;;
  2091. *)
  2092. AC_MSG_CHECKING([whether $CC supports it])
  2093. if test "$GCC" = yes ; then
  2094. if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
  2095. AC_MSG_RESULT(yes)
  2096. AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
  2097. AC_DEFINE(CURL_EXTERN_SYMBOL, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
  2098. CFLAGS="$CFLAGS -fvisibility=hidden"
  2099. else
  2100. AC_MSG_RESULT(no)
  2101. fi
  2102. else
  2103. dnl Test for SunPro cc
  2104. if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
  2105. AC_MSG_RESULT(yes)
  2106. AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
  2107. AC_DEFINE(CURL_EXTERN_SYMBOL, [__global], [to make a symbol visible])
  2108. CFLAGS="$CFLAGS -xldscope=hidden"
  2109. else
  2110. AC_MSG_RESULT(no)
  2111. fi
  2112. fi
  2113. ;;
  2114. esac ],
  2115. AC_MSG_RESULT(no)
  2116. )
  2117. dnl ************************************************************
  2118. dnl enforce SONAME bump
  2119. dnl
  2120. AC_MSG_CHECKING([whether to enforce SONAME bump])
  2121. AC_ARG_ENABLE(soname-bump,
  2122. AC_HELP_STRING([--enable-soname-bump],[Enable enforced SONAME bump])
  2123. AC_HELP_STRING([--disable-soname-bump],[Disable enforced SONAME bump]),
  2124. [ case "$enableval" in
  2125. yes) AC_MSG_RESULT(yes)
  2126. soname_bump=yes
  2127. ;;
  2128. *)
  2129. AC_MSG_RESULT(no)
  2130. ;;
  2131. esac ],
  2132. AC_MSG_RESULT($soname_bump)
  2133. )
  2134. AM_CONDITIONAL(SONAME_BUMP, test x$soname_bump = xyes)
  2135. dnl ************************************************************
  2136. if test ! -z "$winsock_LIB"; then
  2137. dnl If ws2_32 is wanted, make sure it is the _last_ lib in LIBS (makes
  2138. dnl things work when built with c-ares). But we can't just move it last
  2139. dnl since then other stuff (SSL) won't build. So we simply append it to the
  2140. dnl end.
  2141. LIBS="$LIBS $winsock_LIB"
  2142. TEST_SERVER_LIBS="$TEST_SERVER_LIBS $winsock_LIB"
  2143. fi
  2144. dnl
  2145. dnl All the library dependencies put into $LIB apply to libcurl only.
  2146. dnl Those in $CURL_LIBS apply to the curl command-line client only.
  2147. dnl Those in $TEST_SERVER_LIBS apply to test servers only.
  2148. dnl Those in $ALL_LIBS apply to all targets, including test targets.
  2149. dnl
  2150. LIBCURL_LIBS=$LIBS
  2151. AC_SUBST(LIBCURL_LIBS)
  2152. AC_SUBST(CURL_LIBS)
  2153. AC_SUBST(TEST_SERVER_LIBS)
  2154. LIBS=$ALL_LIBS dnl LIBS is a magic variable that's used for every link
  2155. AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
  2156. dnl
  2157. dnl For keeping supported features and protocols also in pkg-config file
  2158. dnl since it is more cross-compile frient than curl-config
  2159. dnl
  2160. if test "x$USE_SSLEAY" = "x1"; then
  2161. SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
  2162. elif test -n "$SSL_ENABLED"; then
  2163. SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
  2164. fi
  2165. if test "@KRB4_ENABLED@" = "x1"; then
  2166. SUPPORT_FEATURES="$SUPPORT_FEATURES KRB4"
  2167. fi
  2168. if test "x$IPV6_ENABLED" = "x1"; then
  2169. SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
  2170. fi
  2171. if test "x$HAVE_LIBZ" = "x1"; then
  2172. SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
  2173. fi
  2174. if test "x$USE_ARES" = "x1"; then
  2175. SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
  2176. fi
  2177. if test "x$IDN_ENABLED" = "x1"; then
  2178. SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
  2179. fi
  2180. if test "x$USE_WINDOWS_SSPI" = "x1"; then
  2181. SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
  2182. fi
  2183. if test "x$USE_SSLEAY" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" -o "x$GNUTLS_ENABLED" = "x1"; then
  2184. SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
  2185. fi
  2186. AC_SUBST(SUPPORT_FEATURES)
  2187. dnl For supported protocols in pkg-config file
  2188. if test "x$CURL_DISABLE_HTTP" != "x1"; then
  2189. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
  2190. if test "x$SSL_ENABLED" = "x1"; then
  2191. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
  2192. fi
  2193. fi
  2194. if test "x$CURL_DISABLE_FTP" != "x1"; then
  2195. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
  2196. if test "x$SSL_ENABLED" = "x1"; then
  2197. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
  2198. fi
  2199. fi
  2200. if test "x$CURL_DISABLE_FILE" != "x1"; then
  2201. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
  2202. fi
  2203. if test "x$CURL_DISABLE_TELNET" != "x1"; then
  2204. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
  2205. fi
  2206. if test "x$CURL_DISABLE_LDAP" != "x1"; then
  2207. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
  2208. fi
  2209. if test "x$CURL_DISABLE_LDAPS" != "x1"; then
  2210. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
  2211. fi
  2212. if test "x$CURL_DISABLE_DICT" != "x1"; then
  2213. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
  2214. fi
  2215. if test "x$CURL_DISABLE_TFTP" != "x1"; then
  2216. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
  2217. fi
  2218. if test "x$CURL_DISABLE_POP3" != "x1"; then
  2219. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
  2220. if test "x$SSL_ENABLED" = "x1"; then
  2221. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
  2222. fi
  2223. fi
  2224. if test "x$CURL_DISABLE_IMAP" != "x1"; then
  2225. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
  2226. if test "x$SSL_ENABLED" = "x1"; then
  2227. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
  2228. fi
  2229. fi
  2230. if test "x$CURL_DISABLE_SMTP" != "x1"; then
  2231. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
  2232. if test "x$SSL_ENABLED" = "x1"; then
  2233. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
  2234. fi
  2235. fi
  2236. if test "x$USE_LIBSSH2" = "x1"; then
  2237. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
  2238. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
  2239. fi
  2240. if test "x$CURL_DISABLE_RTSP" != "x1"; then
  2241. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
  2242. fi
  2243. dnl replace spaces with newlines
  2244. dnl sort the lines
  2245. dnl replace the newlines back to spaces
  2246. SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
  2247. AC_SUBST(SUPPORT_PROTOCOLS)
  2248. dnl squeeze whitespace out of some variables
  2249. squeeze CFLAGS
  2250. squeeze CPPFLAGS
  2251. squeeze DEFS
  2252. squeeze LDFLAGS
  2253. squeeze LIBS
  2254. squeeze CURL_LIBS
  2255. squeeze LIBCURL_LIBS
  2256. squeeze TEST_SERVER_LIBS
  2257. squeeze SUPPORT_FEATURES
  2258. squeeze SUPPORT_PROTOCOLS
  2259. if test "x$want_curldebug_assumed" = "xyes" &&
  2260. test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
  2261. ac_configure_args="$ac_configure_args --enable-curldebug"
  2262. fi
  2263. AC_CONFIG_FILES([Makefile \
  2264. docs/Makefile \
  2265. docs/examples/Makefile \
  2266. docs/libcurl/Makefile \
  2267. include/Makefile \
  2268. include/curl/Makefile \
  2269. src/Makefile \
  2270. lib/Makefile \
  2271. tests/Makefile \
  2272. tests/data/Makefile \
  2273. tests/server/Makefile \
  2274. tests/libtest/Makefile \
  2275. packages/Makefile \
  2276. packages/Win32/Makefile \
  2277. packages/Win32/cygwin/Makefile \
  2278. packages/Linux/Makefile \
  2279. packages/Linux/RPM/Makefile \
  2280. packages/Linux/RPM/curl.spec \
  2281. packages/Linux/RPM/curl-ssl.spec \
  2282. packages/Solaris/Makefile \
  2283. packages/EPM/curl.list \
  2284. packages/EPM/Makefile \
  2285. packages/vms/Makefile \
  2286. packages/AIX/Makefile \
  2287. packages/AIX/RPM/Makefile \
  2288. packages/AIX/RPM/curl.spec \
  2289. curl-config \
  2290. libcurl.pc
  2291. ])
  2292. AC_OUTPUT
  2293. AC_MSG_NOTICE([Configured to build curl/libcurl:
  2294. curl version: ${VERSION}
  2295. Host setup: ${host}
  2296. Install prefix: ${prefix}
  2297. Compiler: ${CC}
  2298. SSL support: ${curl_ssl_msg}
  2299. SSH support: ${curl_ssh_msg}
  2300. zlib support: ${curl_zlib_msg}
  2301. krb4 support: ${curl_krb4_msg}
  2302. GSSAPI support: ${curl_gss_msg}
  2303. SPNEGO support: ${curl_spnego_msg}
  2304. c-ares support: ${curl_ares_msg}
  2305. ipv6 support: ${curl_ipv6_msg}
  2306. IDN support: ${curl_idn_msg}
  2307. Build libcurl: Shared=${enable_shared}, Static=${enable_static}
  2308. Built-in manual: ${curl_manual_msg}
  2309. Verbose errors: ${curl_verbose_msg}
  2310. SSPI support: ${curl_sspi_msg}
  2311. ca cert bundle: ${ca}
  2312. ca cert path: ${capath}
  2313. LDAP support: ${curl_ldap_msg}
  2314. LDAPS support: ${curl_ldaps_msg}
  2315. RTSP support: ${curl_rtsp_msg}
  2316. Protocols: ${SUPPORT_PROTOCOLS}
  2317. ])
  2318. if test "x$soname_bump" = "xyes"; then
  2319. cat <<EOM
  2320. SONAME bump: yes - WARNING: this library will be built with the SONAME
  2321. number bumped due to (a detected) ABI breakage.
  2322. See lib/README.curl_off_t for details on this.
  2323. EOM
  2324. fi