configure.ac 74 KB

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