configure.ac 103 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2014, 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. #***************************************************************************
  22. dnl Process this file with autoconf to produce a configure script.
  23. AC_PREREQ(2.57)
  24. dnl We don't know the version number "statically" so we use a dash here
  25. AC_INIT([curl], [-], [a suitable curl mailing list: http://curl.haxx.se/mail/])
  26. XC_OVR_ZZ50
  27. XC_OVR_ZZ60
  28. CURL_OVERRIDE_AUTOCONF
  29. dnl configure script copyright
  30. AC_COPYRIGHT([Copyright (c) 1998 - 2014 Daniel Stenberg, <daniel@haxx.se>
  31. This configure script may be copied, distributed and modified under the
  32. terms of the curl license; see COPYING for more details])
  33. AC_CONFIG_SRCDIR([lib/urldata.h])
  34. AC_CONFIG_HEADERS(lib/curl_config.h include/curl/curlbuild.h)
  35. AC_CONFIG_MACRO_DIR([m4])
  36. AM_MAINTAINER_MODE
  37. CURL_CHECK_OPTION_DEBUG
  38. CURL_CHECK_OPTION_OPTIMIZE
  39. CURL_CHECK_OPTION_WARNINGS
  40. CURL_CHECK_OPTION_WERROR
  41. CURL_CHECK_OPTION_CURLDEBUG
  42. CURL_CHECK_OPTION_SYMBOL_HIDING
  43. CURL_CHECK_OPTION_ARES
  44. XC_CHECK_PATH_SEPARATOR
  45. #
  46. # save the configure arguments
  47. #
  48. CONFIGURE_OPTIONS="\"$ac_configure_args\""
  49. AC_SUBST(CONFIGURE_OPTIONS)
  50. CURL_CFLAG_EXTRAS=""
  51. if test X"$want_werror" = Xyes; then
  52. CURL_CFLAG_EXTRAS="-Werror"
  53. fi
  54. AC_SUBST(CURL_CFLAG_EXTRAS)
  55. dnl SED is mandatory for configure process and libtool.
  56. dnl Set it now, allowing it to be changed later.
  57. if test -z "$SED"; then
  58. dnl allow it to be overridden
  59. AC_PATH_PROG([SED], [sed], [not_found],
  60. [$PATH:/usr/bin:/usr/local/bin])
  61. if test -z "$SED" || test "$SED" = "not_found"; then
  62. AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
  63. fi
  64. fi
  65. AC_SUBST([SED])
  66. dnl GREP is mandatory for configure process and libtool.
  67. dnl Set it now, allowing it to be changed later.
  68. if test -z "$GREP"; then
  69. dnl allow it to be overridden
  70. AC_PATH_PROG([GREP], [grep], [not_found],
  71. [$PATH:/usr/bin:/usr/local/bin])
  72. if test -z "$GREP" || test "$GREP" = "not_found"; then
  73. AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
  74. fi
  75. fi
  76. AC_SUBST([GREP])
  77. dnl EGREP is mandatory for configure process and libtool.
  78. dnl Set it now, allowing it to be changed later.
  79. if test -z "$EGREP"; then
  80. dnl allow it to be overridden
  81. if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
  82. AC_MSG_CHECKING([for egrep])
  83. EGREP="$GREP -E"
  84. AC_MSG_RESULT([$EGREP])
  85. else
  86. AC_PATH_PROG([EGREP], [egrep], [not_found],
  87. [$PATH:/usr/bin:/usr/local/bin])
  88. fi
  89. fi
  90. if test -z "$EGREP" || test "$EGREP" = "not_found"; then
  91. AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
  92. fi
  93. AC_SUBST([EGREP])
  94. dnl AR is mandatory for configure process and libtool.
  95. dnl This is target dependent, so check it as a tool.
  96. if test -z "$AR"; then
  97. dnl allow it to be overridden
  98. AC_PATH_TOOL([AR], [ar], [not_found],
  99. [$PATH:/usr/bin:/usr/local/bin])
  100. if test -z "$AR" || test "$AR" = "not_found"; then
  101. AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
  102. fi
  103. fi
  104. AC_SUBST([AR])
  105. AC_SUBST(libext)
  106. dnl Remove non-configure distributed curlbuild.h
  107. if test -f ${srcdir}/include/curl/curlbuild.h; then
  108. rm -f ${srcdir}/include/curl/curlbuild.h
  109. fi
  110. dnl figure out the libcurl version
  111. CURLVERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h`
  112. XC_CHECK_PROG_CC
  113. XC_AUTOMAKE
  114. AC_MSG_CHECKING([curl version])
  115. AC_MSG_RESULT($CURLVERSION)
  116. AC_SUBST(CURLVERSION)
  117. dnl
  118. dnl we extract the numerical version for curl-config only
  119. VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curlver.h`
  120. AC_SUBST(VERSIONNUM)
  121. dnl Solaris pkgadd support definitions
  122. PKGADD_PKG="HAXXcurl"
  123. PKGADD_NAME="cURL - a client that groks URLs"
  124. PKGADD_VENDOR="curl.haxx.se"
  125. AC_SUBST(PKGADD_PKG)
  126. AC_SUBST(PKGADD_NAME)
  127. AC_SUBST(PKGADD_VENDOR)
  128. dnl
  129. dnl initialize all the info variables
  130. curl_ssl_msg="no (--with-{ssl,gnutls,nss,polarssl,cyassl,axtls,winssl,darwinssl} )"
  131. curl_ssh_msg="no (--with-libssh2)"
  132. curl_zlib_msg="no (--with-zlib)"
  133. curl_gss_msg="no (--with-gssapi)"
  134. curl_spnego_msg="no (--with-spnego)"
  135. curl_tls_srp_msg="no (--enable-tls-srp)"
  136. curl_res_msg="default (--enable-ares / --enable-threaded-resolver)"
  137. curl_ipv6_msg="no (--enable-ipv6)"
  138. curl_idn_msg="no (--with-{libidn,winidn})"
  139. curl_manual_msg="no (--enable-manual)"
  140. curl_libcurl_msg="enabled (--disable-libcurl-option)"
  141. curl_verbose_msg="enabled (--disable-verbose)"
  142. curl_sspi_msg="no (--enable-sspi)"
  143. curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
  144. curl_ldaps_msg="no (--enable-ldaps)"
  145. curl_rtsp_msg="no (--enable-rtsp)"
  146. curl_rtmp_msg="no (--with-librtmp)"
  147. curl_mtlnk_msg="no (--with-libmetalink)"
  148. init_ssl_msg=${curl_ssl_msg}
  149. dnl
  150. dnl Save some initial values the user might have provided
  151. dnl
  152. INITIAL_LDFLAGS=$LDFLAGS
  153. INITIAL_LIBS=$LIBS
  154. dnl
  155. dnl Detect the canonical host and target build environment
  156. dnl
  157. AC_CANONICAL_HOST
  158. dnl Get system canonical name
  159. AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
  160. dnl Checks for programs.
  161. dnl Our curl_off_t internal and external configure settings
  162. CURL_CONFIGURE_CURL_OFF_T
  163. dnl This defines _ALL_SOURCE for AIX
  164. CURL_CHECK_AIX_ALL_SOURCE
  165. dnl Our configure and build reentrant settings
  166. CURL_CONFIGURE_THREAD_SAFE
  167. CURL_CONFIGURE_REENTRANT
  168. dnl check for how to do large files
  169. AC_SYS_LARGEFILE
  170. XC_LIBTOOL
  171. #
  172. # Automake conditionals based on libtool related checks
  173. #
  174. AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSION_INFO],
  175. [test "x$xc_lt_shlib_use_version_info" = 'xyes'])
  176. AM_CONDITIONAL([CURL_LT_SHLIB_USE_NO_UNDEFINED],
  177. [test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
  178. AM_CONDITIONAL([CURL_LT_SHLIB_USE_MIMPURE_TEXT],
  179. [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
  180. #
  181. # Due to libtool and automake machinery limitations of not allowing
  182. # specifying separate CPPFLAGS or CFLAGS when compiling objects for
  183. # inclusion of these in shared or static libraries, we are forced to
  184. # build using separate configure runs for shared and static libraries
  185. # on systems where different CPPFLAGS or CFLAGS are mandatory in order
  186. # to compile objects for each kind of library. Notice that relying on
  187. # the '-DPIC' CFLAG that libtool provides is not valid given that the
  188. # user might for example choose to build static libraries with PIC.
  189. #
  190. #
  191. # Make our Makefile.am files use the staticlib CPPFLAG only when strictly
  192. # targeting a static library and not building its shared counterpart.
  193. #
  194. AM_CONDITIONAL([USE_CPPFLAG_CURL_STATICLIB],
  195. [test "x$xc_lt_build_static_only" = 'xyes'])
  196. #
  197. # Make staticlib CPPFLAG variable and its definition visible in output
  198. # files unconditionally, providing an empty definition unless strictly
  199. # targeting a static library and not building its shared counterpart.
  200. #
  201. CPPFLAG_CURL_STATICLIB=
  202. if test "x$xc_lt_build_static_only" = 'xyes'; then
  203. CPPFLAG_CURL_STATICLIB='-DCURL_STATICLIB'
  204. fi
  205. AC_SUBST([CPPFLAG_CURL_STATICLIB])
  206. # Determine whether all dependent libraries must be specified when linking
  207. if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
  208. then
  209. REQUIRE_LIB_DEPS=no
  210. else
  211. REQUIRE_LIB_DEPS=yes
  212. fi
  213. AC_SUBST(REQUIRE_LIB_DEPS)
  214. AM_CONDITIONAL(USE_EXPLICIT_LIB_DEPS, test x$REQUIRE_LIB_DEPS = xyes)
  215. dnl check if there's a way to force code inline
  216. AC_C_INLINE
  217. dnl **********************************************************************
  218. dnl platform/compiler/architecture specific checks/flags
  219. dnl **********************************************************************
  220. CURL_CHECK_COMPILER
  221. CURL_SET_COMPILER_BASIC_OPTS
  222. CURL_SET_COMPILER_DEBUG_OPTS
  223. CURL_SET_COMPILER_OPTIMIZE_OPTS
  224. CURL_SET_COMPILER_WARNING_OPTS
  225. if test "$compiler_id" = "INTEL_UNIX_C"; then
  226. #
  227. if test "$compiler_num" -ge "1000"; then
  228. dnl icc 10.X or later
  229. CFLAGS="$CFLAGS -shared-intel"
  230. elif test "$compiler_num" -ge "900"; then
  231. dnl icc 9.X specific
  232. CFLAGS="$CFLAGS -i-dynamic"
  233. fi
  234. #
  235. fi
  236. CURL_CHECK_COMPILER_HALT_ON_ERROR
  237. CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
  238. CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
  239. CURL_CHECK_COMPILER_SYMBOL_HIDING
  240. CURL_CHECK_CURLDEBUG
  241. AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
  242. supports_unittests=yes
  243. # cross-compilation of unit tests static library/programs fails when
  244. # libcurl shared library is built. This might be due to a libtool or
  245. # automake issue. In this case we disable unit tests.
  246. if test "x$cross_compiling" != "xno" &&
  247. test "x$enable_shared" != "xno"; then
  248. supports_unittests=no
  249. fi
  250. # IRIX 6.5.24 gcc 3.3 autobuilds fail unittests library compilation due to
  251. # a problem related with OpenSSL headers and library versions not matching.
  252. # Disable unit tests while time to further investigate this is found.
  253. case $host in
  254. mips-sgi-irix6.5)
  255. if test "$compiler_id" = "GNU_C"; then
  256. supports_unittests=no
  257. fi
  258. ;;
  259. esac
  260. # All AIX autobuilds fails unit tests linking against unittests library
  261. # due to unittests library being built with no symbols or members. Libtool ?
  262. # Disable unit tests while time to further investigate this is found.
  263. case $host_os in
  264. aix*)
  265. supports_unittests=no
  266. ;;
  267. esac
  268. dnl Build unit tests when option --enable-debug is given.
  269. if test "x$want_debug" = "xyes" &&
  270. test "x$supports_unittests" = "xyes"; then
  271. want_unittests=yes
  272. else
  273. want_unittests=no
  274. fi
  275. AM_CONDITIONAL(BUILD_UNITTESTS, test x$want_unittests = xyes)
  276. dnl **********************************************************************
  277. dnl Compilation based checks should not be done before this point.
  278. dnl **********************************************************************
  279. dnl **********************************************************************
  280. dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
  281. dnl and ws2tcpip.h take precedence over any other further checks which
  282. dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
  283. dnl this specific header files. And do them before its results are used.
  284. dnl **********************************************************************
  285. CURL_CHECK_HEADER_WINDOWS
  286. CURL_CHECK_NATIVE_WINDOWS
  287. case X-"$ac_cv_native_windows" in
  288. X-yes)
  289. CURL_CHECK_HEADER_WINSOCK
  290. CURL_CHECK_HEADER_WINSOCK2
  291. CURL_CHECK_HEADER_WS2TCPIP
  292. CURL_CHECK_HEADER_WINLDAP
  293. CURL_CHECK_HEADER_WINBER
  294. ;;
  295. *)
  296. ac_cv_header_winsock_h="no"
  297. ac_cv_header_winsock2_h="no"
  298. ac_cv_header_ws2tcpip_h="no"
  299. ac_cv_header_winldap_h="no"
  300. ac_cv_header_winber_h="no"
  301. ;;
  302. esac
  303. CURL_CHECK_WIN32_LARGEFILE
  304. dnl ************************************************************
  305. dnl switch off particular protocols
  306. dnl
  307. AC_MSG_CHECKING([whether to support http])
  308. AC_ARG_ENABLE(http,
  309. AC_HELP_STRING([--enable-http],[Enable HTTP support])
  310. AC_HELP_STRING([--disable-http],[Disable HTTP support]),
  311. [ case "$enableval" in
  312. no)
  313. AC_MSG_RESULT(no)
  314. AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
  315. AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP])
  316. AC_SUBST(CURL_DISABLE_HTTP, [1])
  317. AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
  318. AC_SUBST(CURL_DISABLE_RTSP, [1])
  319. ;;
  320. *) AC_MSG_RESULT(yes)
  321. ;;
  322. esac ],
  323. AC_MSG_RESULT(yes)
  324. )
  325. AC_MSG_CHECKING([whether to support ftp])
  326. AC_ARG_ENABLE(ftp,
  327. AC_HELP_STRING([--enable-ftp],[Enable FTP support])
  328. AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
  329. [ case "$enableval" in
  330. no)
  331. AC_MSG_RESULT(no)
  332. AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
  333. AC_SUBST(CURL_DISABLE_FTP, [1])
  334. ;;
  335. *) AC_MSG_RESULT(yes)
  336. ;;
  337. esac ],
  338. AC_MSG_RESULT(yes)
  339. )
  340. AC_MSG_CHECKING([whether to support file])
  341. AC_ARG_ENABLE(file,
  342. AC_HELP_STRING([--enable-file],[Enable FILE support])
  343. AC_HELP_STRING([--disable-file],[Disable FILE support]),
  344. [ case "$enableval" in
  345. no)
  346. AC_MSG_RESULT(no)
  347. AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
  348. AC_SUBST(CURL_DISABLE_FILE, [1])
  349. ;;
  350. *) AC_MSG_RESULT(yes)
  351. ;;
  352. esac ],
  353. AC_MSG_RESULT(yes)
  354. )
  355. AC_MSG_CHECKING([whether to support ldap])
  356. AC_ARG_ENABLE(ldap,
  357. AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
  358. AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
  359. [ case "$enableval" in
  360. no)
  361. AC_MSG_RESULT(no)
  362. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  363. AC_SUBST(CURL_DISABLE_LDAP, [1])
  364. ;;
  365. *)
  366. AC_MSG_RESULT(yes)
  367. ;;
  368. esac ],[
  369. AC_MSG_RESULT(yes) ]
  370. )
  371. AC_MSG_CHECKING([whether to support ldaps])
  372. AC_ARG_ENABLE(ldaps,
  373. AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
  374. AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
  375. [ case "$enableval" in
  376. no)
  377. AC_MSG_RESULT(no)
  378. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  379. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  380. ;;
  381. *) if test "x$CURL_DISABLE_LDAP" = "x1" ; then
  382. AC_MSG_RESULT(LDAP needs to be enabled to support LDAPS)
  383. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  384. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  385. else
  386. AC_MSG_RESULT(yes)
  387. AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
  388. AC_SUBST(HAVE_LDAP_SSL, [1])
  389. fi
  390. ;;
  391. esac ],[
  392. if test "x$CURL_DISABLE_LDAP" = "x1" ; then
  393. AC_MSG_RESULT(no)
  394. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  395. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  396. else
  397. AC_MSG_RESULT(yes)
  398. AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
  399. AC_SUBST(HAVE_LDAP_SSL, [1])
  400. fi ]
  401. )
  402. AC_MSG_CHECKING([whether to support rtsp])
  403. AC_ARG_ENABLE(rtsp,
  404. AC_HELP_STRING([--enable-rtsp],[Enable RTSP support])
  405. AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]),
  406. [ case "$enableval" in
  407. no)
  408. AC_MSG_RESULT(no)
  409. AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
  410. AC_SUBST(CURL_DISABLE_RTSP, [1])
  411. ;;
  412. *) if test x$CURL_DISABLE_HTTP = x1 ; then
  413. AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!)
  414. else
  415. AC_MSG_RESULT(yes)
  416. curl_rtsp_msg="enabled"
  417. fi
  418. ;;
  419. esac ],
  420. if test "x$CURL_DISABLE_HTTP" != "x1"; then
  421. AC_MSG_RESULT(yes)
  422. curl_rtsp_msg="enabled"
  423. else
  424. AC_MSG_RESULT(no)
  425. fi
  426. )
  427. AC_MSG_CHECKING([whether to support proxies])
  428. AC_ARG_ENABLE(proxy,
  429. AC_HELP_STRING([--enable-proxy],[Enable proxy support])
  430. AC_HELP_STRING([--disable-proxy],[Disable proxy support]),
  431. [ case "$enableval" in
  432. no)
  433. AC_MSG_RESULT(no)
  434. AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
  435. AC_SUBST(CURL_DISABLE_PROXY, [1])
  436. ;;
  437. *) AC_MSG_RESULT(yes)
  438. ;;
  439. esac ],
  440. AC_MSG_RESULT(yes)
  441. )
  442. AC_MSG_CHECKING([whether to support dict])
  443. AC_ARG_ENABLE(dict,
  444. AC_HELP_STRING([--enable-dict],[Enable DICT support])
  445. AC_HELP_STRING([--disable-dict],[Disable DICT support]),
  446. [ case "$enableval" in
  447. no)
  448. AC_MSG_RESULT(no)
  449. AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
  450. AC_SUBST(CURL_DISABLE_DICT, [1])
  451. ;;
  452. *) AC_MSG_RESULT(yes)
  453. ;;
  454. esac ],
  455. AC_MSG_RESULT(yes)
  456. )
  457. AC_MSG_CHECKING([whether to support telnet])
  458. AC_ARG_ENABLE(telnet,
  459. AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
  460. AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
  461. [ case "$enableval" in
  462. no)
  463. AC_MSG_RESULT(no)
  464. AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
  465. AC_SUBST(CURL_DISABLE_TELNET, [1])
  466. ;;
  467. *) AC_MSG_RESULT(yes)
  468. ;;
  469. esac ],
  470. AC_MSG_RESULT(yes)
  471. )
  472. AC_MSG_CHECKING([whether to support tftp])
  473. AC_ARG_ENABLE(tftp,
  474. AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
  475. AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
  476. [ case "$enableval" in
  477. no)
  478. AC_MSG_RESULT(no)
  479. AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
  480. AC_SUBST(CURL_DISABLE_TFTP, [1])
  481. ;;
  482. *) AC_MSG_RESULT(yes)
  483. ;;
  484. esac ],
  485. AC_MSG_RESULT(yes)
  486. )
  487. AC_MSG_CHECKING([whether to support pop3])
  488. AC_ARG_ENABLE(pop3,
  489. AC_HELP_STRING([--enable-pop3],[Enable POP3 support])
  490. AC_HELP_STRING([--disable-pop3],[Disable POP3 support]),
  491. [ case "$enableval" in
  492. no)
  493. AC_MSG_RESULT(no)
  494. AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3])
  495. AC_SUBST(CURL_DISABLE_POP3, [1])
  496. ;;
  497. *) AC_MSG_RESULT(yes)
  498. ;;
  499. esac ],
  500. AC_MSG_RESULT(yes)
  501. )
  502. AC_MSG_CHECKING([whether to support imap])
  503. AC_ARG_ENABLE(imap,
  504. AC_HELP_STRING([--enable-imap],[Enable IMAP support])
  505. AC_HELP_STRING([--disable-imap],[Disable IMAP support]),
  506. [ case "$enableval" in
  507. no)
  508. AC_MSG_RESULT(no)
  509. AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP])
  510. AC_SUBST(CURL_DISABLE_IMAP, [1])
  511. ;;
  512. *) AC_MSG_RESULT(yes)
  513. ;;
  514. esac ],
  515. AC_MSG_RESULT(yes)
  516. )
  517. AC_MSG_CHECKING([whether to support smtp])
  518. AC_ARG_ENABLE(smtp,
  519. AC_HELP_STRING([--enable-smtp],[Enable SMTP support])
  520. AC_HELP_STRING([--disable-smtp],[Disable SMTP support]),
  521. [ case "$enableval" in
  522. no)
  523. AC_MSG_RESULT(no)
  524. AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP])
  525. AC_SUBST(CURL_DISABLE_SMTP, [1])
  526. ;;
  527. *) AC_MSG_RESULT(yes)
  528. ;;
  529. esac ],
  530. AC_MSG_RESULT(yes)
  531. )
  532. AC_MSG_CHECKING([whether to support gopher])
  533. AC_ARG_ENABLE(gopher,
  534. AC_HELP_STRING([--enable-gopher],[Enable Gopher support])
  535. AC_HELP_STRING([--disable-gopher],[Disable Gopher support]),
  536. [ case "$enableval" in
  537. no)
  538. AC_MSG_RESULT(no)
  539. AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable Gopher])
  540. AC_SUBST(CURL_DISABLE_GOPHER, [1])
  541. ;;
  542. *) AC_MSG_RESULT(yes)
  543. ;;
  544. esac ],
  545. AC_MSG_RESULT(yes)
  546. )
  547. dnl **********************************************************************
  548. dnl Check for built-in manual
  549. dnl **********************************************************************
  550. AC_MSG_CHECKING([whether to provide built-in manual])
  551. AC_ARG_ENABLE(manual,
  552. AC_HELP_STRING([--enable-manual],[Enable built-in manual])
  553. AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
  554. [ case "$enableval" in
  555. no)
  556. AC_MSG_RESULT(no)
  557. ;;
  558. *) AC_MSG_RESULT(yes)
  559. USE_MANUAL="1"
  560. ;;
  561. esac ],
  562. AC_MSG_RESULT(yes)
  563. USE_MANUAL="1"
  564. )
  565. dnl The actual use of the USE_MANUAL variable is done much later in this
  566. dnl script to allow other actions to disable it as well.
  567. dnl ************************************************************
  568. dnl disable C code generation support
  569. dnl
  570. AC_MSG_CHECKING([whether to enable generation of C code])
  571. AC_ARG_ENABLE(libcurl_option,
  572. AC_HELP_STRING([--enable-libcurl-option],[Enable --libcurl C code generation support])
  573. AC_HELP_STRING([--disable-libcurl-option],[Disable --libcurl C code generation support]),
  574. [ case "$enableval" in
  575. no)
  576. AC_MSG_RESULT(no)
  577. AC_DEFINE(CURL_DISABLE_LIBCURL_OPTION, 1, [to disable --libcurl C code generation option])
  578. curl_libcurl_msg="no"
  579. ;;
  580. *) AC_MSG_RESULT(yes)
  581. ;;
  582. esac ],
  583. AC_MSG_RESULT(yes)
  584. )
  585. dnl **********************************************************************
  586. dnl Checks for libraries.
  587. dnl **********************************************************************
  588. AC_MSG_CHECKING([whether to use libgcc])
  589. AC_ARG_ENABLE(libgcc,
  590. AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
  591. [ case "$enableval" in
  592. yes)
  593. LIBS="-lgcc $LIBS"
  594. AC_MSG_RESULT(yes)
  595. ;;
  596. *) AC_MSG_RESULT(no)
  597. ;;
  598. esac ],
  599. AC_MSG_RESULT(no)
  600. )
  601. CURL_CHECK_LIB_XNET
  602. dnl gethostbyname without lib or in the nsl lib?
  603. AC_CHECK_FUNC(gethostbyname,
  604. [HAVE_GETHOSTBYNAME="1"
  605. ],
  606. [ AC_CHECK_LIB(nsl, gethostbyname,
  607. [HAVE_GETHOSTBYNAME="1"
  608. LIBS="-lnsl $LIBS"
  609. ])
  610. ])
  611. if test "$HAVE_GETHOSTBYNAME" != "1"
  612. then
  613. dnl gethostbyname in the socket lib?
  614. AC_CHECK_LIB(socket, gethostbyname,
  615. [HAVE_GETHOSTBYNAME="1"
  616. LIBS="-lsocket $LIBS"
  617. ])
  618. fi
  619. if test "$HAVE_GETHOSTBYNAME" != "1"
  620. then
  621. dnl gethostbyname in the watt lib?
  622. AC_CHECK_LIB(watt, gethostbyname,
  623. [HAVE_GETHOSTBYNAME="1"
  624. CPPFLAGS="-I/dev/env/WATT_ROOT/inc"
  625. LDFLAGS="-L/dev/env/WATT_ROOT/lib"
  626. LIBS="-lwatt $LIBS"
  627. ])
  628. fi
  629. dnl At least one system has been identified to require BOTH nsl and socket
  630. dnl libs at the same time to link properly.
  631. if test "$HAVE_GETHOSTBYNAME" != "1"
  632. then
  633. AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
  634. my_ac_save_LIBS=$LIBS
  635. LIBS="-lnsl -lsocket $LIBS"
  636. AC_LINK_IFELSE([
  637. AC_LANG_PROGRAM([[
  638. ]],[[
  639. gethostbyname();
  640. ]])
  641. ],[
  642. AC_MSG_RESULT([yes])
  643. HAVE_GETHOSTBYNAME="1"
  644. ],[
  645. AC_MSG_RESULT([no])
  646. LIBS=$my_ac_save_LIBS
  647. ])
  648. fi
  649. if test "$HAVE_GETHOSTBYNAME" != "1"
  650. then
  651. dnl This is for winsock systems
  652. if test "$ac_cv_header_windows_h" = "yes"; then
  653. if test "$ac_cv_header_winsock_h" = "yes"; then
  654. case $host in
  655. *-*-mingw32ce*)
  656. winsock_LIB="-lwinsock"
  657. ;;
  658. *)
  659. winsock_LIB="-lwsock32"
  660. ;;
  661. esac
  662. fi
  663. if test "$ac_cv_header_winsock2_h" = "yes"; then
  664. winsock_LIB="-lws2_32"
  665. fi
  666. if test ! -z "$winsock_LIB"; then
  667. my_ac_save_LIBS=$LIBS
  668. LIBS="$winsock_LIB $LIBS"
  669. AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
  670. AC_LINK_IFELSE([
  671. AC_LANG_PROGRAM([[
  672. #ifdef HAVE_WINDOWS_H
  673. #ifndef WIN32_LEAN_AND_MEAN
  674. #define WIN32_LEAN_AND_MEAN
  675. #endif
  676. #include <windows.h>
  677. #ifdef HAVE_WINSOCK2_H
  678. #include <winsock2.h>
  679. #else
  680. #ifdef HAVE_WINSOCK_H
  681. #include <winsock.h>
  682. #endif
  683. #endif
  684. #endif
  685. ]],[[
  686. gethostbyname("www.dummysite.com");
  687. ]])
  688. ],[
  689. AC_MSG_RESULT([yes])
  690. HAVE_GETHOSTBYNAME="1"
  691. ],[
  692. AC_MSG_RESULT([no])
  693. winsock_LIB=""
  694. LIBS=$my_ac_save_LIBS
  695. ])
  696. fi
  697. fi
  698. fi
  699. if test "$HAVE_GETHOSTBYNAME" != "1"
  700. then
  701. dnl This is for Minix 3.1
  702. AC_MSG_CHECKING([for gethostbyname for Minix 3])
  703. AC_LINK_IFELSE([
  704. AC_LANG_PROGRAM([[
  705. /* Older Minix versions may need <net/gen/netdb.h> here instead */
  706. #include <netdb.h>
  707. ]],[[
  708. gethostbyname("www.dummysite.com");
  709. ]])
  710. ],[
  711. AC_MSG_RESULT([yes])
  712. HAVE_GETHOSTBYNAME="1"
  713. ],[
  714. AC_MSG_RESULT([no])
  715. ])
  716. fi
  717. if test "$HAVE_GETHOSTBYNAME" != "1"
  718. then
  719. dnl This is for eCos with a stubbed DNS implementation
  720. AC_MSG_CHECKING([for gethostbyname for eCos])
  721. AC_LINK_IFELSE([
  722. AC_LANG_PROGRAM([[
  723. #include <stdio.h>
  724. #include <netdb.h>
  725. ]],[[
  726. gethostbyname("www.dummysite.com");
  727. ]])
  728. ],[
  729. AC_MSG_RESULT([yes])
  730. HAVE_GETHOSTBYNAME="1"
  731. ],[
  732. AC_MSG_RESULT([no])
  733. ])
  734. fi
  735. if test "$HAVE_GETHOSTBYNAME" != "1"
  736. then
  737. dnl gethostbyname in the network lib - for Haiku OS
  738. AC_CHECK_LIB(network, gethostbyname,
  739. [HAVE_GETHOSTBYNAME="1"
  740. LIBS="-lnetwork $LIBS"
  741. ])
  742. fi
  743. if test "$HAVE_GETHOSTBYNAME" != "1"
  744. then
  745. dnl gethostbyname in the net lib - for BeOS
  746. AC_CHECK_LIB(net, gethostbyname,
  747. [HAVE_GETHOSTBYNAME="1"
  748. LIBS="-lnet $LIBS"
  749. ])
  750. fi
  751. if test "$HAVE_GETHOSTBYNAME" != "1"; then
  752. AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
  753. fi
  754. dnl resolve lib?
  755. AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
  756. if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
  757. AC_CHECK_LIB(resolve, strcasecmp,
  758. [LIBS="-lresolve $LIBS"],
  759. ,
  760. -lnsl)
  761. fi
  762. ac_cv_func_strcasecmp="no"
  763. CURL_CHECK_LIBS_CONNECT
  764. CURL_NETWORK_LIBS=$LIBS
  765. dnl **********************************************************************
  766. dnl In case that function clock_gettime with monotonic timer is available,
  767. dnl check for additional required libraries.
  768. dnl **********************************************************************
  769. CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
  770. dnl **********************************************************************
  771. dnl The preceding library checks are all potentially useful for test
  772. dnl servers and libtest cases which require networking and clock_gettime
  773. dnl support. Save the list of required libraries at this point for use
  774. dnl while linking those test servers and programs.
  775. dnl **********************************************************************
  776. CURL_NETWORK_AND_TIME_LIBS=$LIBS
  777. dnl **********************************************************************
  778. dnl Check for the presence of ZLIB libraries and headers
  779. dnl **********************************************************************
  780. dnl Check for & handle argument to --with-zlib.
  781. clean_CPPFLAGS=$CPPFLAGS
  782. clean_LDFLAGS=$LDFLAGS
  783. clean_LIBS=$LIBS
  784. ZLIB_LIBS=""
  785. AC_ARG_WITH(zlib,
  786. AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
  787. AC_HELP_STRING([--without-zlib],[disable use of zlib]),
  788. [OPT_ZLIB="$withval"])
  789. if test "$OPT_ZLIB" = "no" ; then
  790. AC_MSG_WARN([zlib disabled])
  791. else
  792. if test "$OPT_ZLIB" = "yes" ; then
  793. OPT_ZLIB=""
  794. fi
  795. if test -z "$OPT_ZLIB" ; then
  796. dnl check for the lib first without setting any new path, since many
  797. dnl people have it in the default path
  798. AC_CHECK_LIB(z, inflateEnd,
  799. dnl libz found, set the variable
  800. [HAVE_LIBZ="1"
  801. LIBS="-lz $LIBS"],
  802. dnl if no lib found, try /usr/local
  803. [OPT_ZLIB="/usr/local"])
  804. fi
  805. dnl Add a nonempty path to the compiler flags
  806. if test -n "$OPT_ZLIB"; then
  807. CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
  808. LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
  809. fi
  810. AC_CHECK_HEADER(zlib.h,
  811. [
  812. dnl zlib.h was found
  813. HAVE_ZLIB_H="1"
  814. dnl if the lib wasn't found already, try again with the new paths
  815. if test "$HAVE_LIBZ" != "1"; then
  816. AC_CHECK_LIB(z, gzread,
  817. [
  818. dnl the lib was found!
  819. HAVE_LIBZ="1"
  820. LIBS="-lz $LIBS"
  821. ],
  822. [ CPPFLAGS=$clean_CPPFLAGS
  823. LDFLAGS=$clean_LDFLAGS])
  824. fi
  825. ],
  826. [
  827. dnl zlib.h was not found, restore the flags
  828. CPPFLAGS=$clean_CPPFLAGS
  829. LDFLAGS=$clean_LDFLAGS]
  830. )
  831. if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
  832. then
  833. AC_MSG_WARN([configure found only the libz lib, not the header file!])
  834. HAVE_LIBZ=""
  835. CPPFLAGS=$clean_CPPFLAGS
  836. LDFLAGS=$clean_LDFLAGS
  837. LIBS=$clean_LIBS
  838. elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
  839. then
  840. AC_MSG_WARN([configure found only the libz header file, not the lib!])
  841. CPPFLAGS=$clean_CPPFLAGS
  842. LDFLAGS=$clean_LDFLAGS
  843. LIBS=$clean_LIBS
  844. elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
  845. then
  846. dnl both header and lib were found!
  847. AC_SUBST(HAVE_LIBZ)
  848. AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
  849. AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
  850. ZLIB_LIBS="-lz"
  851. LIBS="-lz $clean_LIBS"
  852. dnl replace 'HAVE_LIBZ' in the automake makefile.ams
  853. AMFIXLIB="1"
  854. AC_MSG_NOTICE([found both libz and libz.h header])
  855. curl_zlib_msg="enabled"
  856. fi
  857. fi
  858. dnl set variable for use in automakefile(s)
  859. AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
  860. AC_SUBST(ZLIB_LIBS)
  861. dnl **********************************************************************
  862. dnl Check for LDAP
  863. dnl **********************************************************************
  864. LDAPLIBNAME=""
  865. AC_ARG_WITH(ldap-lib,
  866. AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
  867. [LDAPLIBNAME="$withval"])
  868. LBERLIBNAME=""
  869. AC_ARG_WITH(lber-lib,
  870. AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
  871. [LBERLIBNAME="$withval"])
  872. if test x$CURL_DISABLE_LDAP != x1 ; then
  873. CURL_CHECK_HEADER_LBER
  874. CURL_CHECK_HEADER_LDAP
  875. CURL_CHECK_HEADER_LDAPSSL
  876. CURL_CHECK_HEADER_LDAP_SSL
  877. if test -z "$LDAPLIBNAME" ; then
  878. if test "$ac_cv_native_windows" = "yes"; then
  879. dnl Windows uses a single and unique LDAP library name
  880. LDAPLIBNAME="wldap32"
  881. LBERLIBNAME="no"
  882. fi
  883. fi
  884. if test "$LDAPLIBNAME" ; then
  885. AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
  886. AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
  887. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  888. AC_SUBST(CURL_DISABLE_LDAP, [1])
  889. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  890. AC_SUBST(CURL_DISABLE_LDAPS, [1])])
  891. else
  892. dnl Try to find the right ldap libraries for this system
  893. CURL_CHECK_LIBS_LDAP
  894. case X-"$curl_cv_ldap_LIBS" in
  895. X-unknown)
  896. AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
  897. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  898. AC_SUBST(CURL_DISABLE_LDAP, [1])
  899. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  900. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  901. ;;
  902. esac
  903. fi
  904. fi
  905. if test x$CURL_DISABLE_LDAP != x1 ; then
  906. if test "$LBERLIBNAME" ; then
  907. dnl If name is "no" then don't define this library at all
  908. dnl (it's only needed if libldap.so's dependencies are broken).
  909. if test "$LBERLIBNAME" != "no" ; then
  910. AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
  911. AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
  912. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  913. AC_SUBST(CURL_DISABLE_LDAP, [1])
  914. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  915. AC_SUBST(CURL_DISABLE_LDAPS, [1])])
  916. fi
  917. fi
  918. fi
  919. if test x$CURL_DISABLE_LDAP != x1 ; then
  920. AC_CHECK_FUNCS([ldap_url_parse ldap_init_fd])
  921. if test "$LDAPLIBNAME" = "wldap32"; then
  922. curl_ldap_msg="enabled (winldap)"
  923. AC_DEFINE(CURL_LDAP_WIN, 1, [Use Windows LDAP implementation])
  924. else
  925. curl_ldap_msg="enabled (OpenLDAP)"
  926. if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then
  927. AC_DEFINE(USE_OPENLDAP, 1, [Use OpenLDAP-specific code])
  928. AC_SUBST(USE_OPENLDAP, [1])
  929. fi
  930. fi
  931. fi
  932. if test x$CURL_DISABLE_LDAPS != x1 ; then
  933. curl_ldaps_msg="enabled"
  934. fi
  935. dnl **********************************************************************
  936. dnl Checks for IPv6
  937. dnl **********************************************************************
  938. AC_MSG_CHECKING([whether to enable ipv6])
  939. AC_ARG_ENABLE(ipv6,
  940. AC_HELP_STRING([--enable-ipv6],[Enable ipv6 (with ipv4) support])
  941. AC_HELP_STRING([--disable-ipv6],[Disable ipv6 support]),
  942. [ case "$enableval" in
  943. no)
  944. AC_MSG_RESULT(no)
  945. ipv6=no
  946. ;;
  947. *) AC_MSG_RESULT(yes)
  948. ipv6=yes
  949. ;;
  950. esac ],
  951. AC_TRY_RUN([ /* is AF_INET6 available? */
  952. #include <sys/types.h>
  953. #include <sys/socket.h>
  954. #include <stdlib.h> /* for exit() */
  955. main()
  956. {
  957. if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
  958. exit(1);
  959. else
  960. exit(0);
  961. }
  962. ],
  963. AC_MSG_RESULT(yes)
  964. ipv6=yes,
  965. AC_MSG_RESULT(no)
  966. ipv6=no,
  967. AC_MSG_RESULT(no)
  968. ipv6=no
  969. ))
  970. if test "$ipv6" = "yes"; then
  971. curl_ipv6_msg="enabled"
  972. fi
  973. # Check if struct sockaddr_in6 have sin6_scope_id member
  974. if test "$ipv6" = yes; then
  975. AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
  976. AC_TRY_COMPILE([
  977. #include <sys/types.h>
  978. #include <netinet/in.h>] ,
  979. struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
  980. if test "$have_sin6_scope_id" = yes; then
  981. AC_MSG_RESULT([yes])
  982. AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member])
  983. else
  984. AC_MSG_RESULT([no])
  985. fi
  986. fi
  987. dnl **********************************************************************
  988. dnl Check if the operating system allows programs to write to their own argv[]
  989. dnl **********************************************************************
  990. AC_MSG_CHECKING([if argv can be written to])
  991. AC_RUN_IFELSE([
  992. AC_LANG_SOURCE([[
  993. int main(int argc, char ** argv) {
  994. argv[0][0] = ' ';
  995. return (argv[0][0] == ' ')?0:1;
  996. }
  997. ]])
  998. ],[
  999. curl_cv_writable_argv=yes
  1000. ],[
  1001. curl_cv_writable_argv=no
  1002. ],[
  1003. curl_cv_writable_argv=cross
  1004. ])
  1005. case $curl_cv_writable_argv in
  1006. yes)
  1007. AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
  1008. AC_MSG_RESULT(yes)
  1009. ;;
  1010. no)
  1011. AC_MSG_RESULT(no)
  1012. ;;
  1013. *)
  1014. AC_MSG_RESULT(no)
  1015. AC_MSG_WARN([the previous check could not be made default was used])
  1016. ;;
  1017. esac
  1018. dnl **********************************************************************
  1019. dnl Check for FBopenssl(SPNEGO) libraries
  1020. dnl **********************************************************************
  1021. AC_ARG_WITH(spnego,
  1022. AC_HELP_STRING([--with-spnego=DIR],
  1023. [Specify location of SPNEGO library fbopenssl]), [
  1024. SPNEGO_ROOT="$withval"
  1025. if test x"$SPNEGO_ROOT" != xno; then
  1026. want_spnego="yes"
  1027. fi
  1028. ])
  1029. AC_MSG_CHECKING([if SPNEGO support is requested])
  1030. if test x"$want_spnego" = xyes; then
  1031. if test X"$SPNEGO_ROOT" = Xyes; then
  1032. AC_MSG_ERROR([FBOpenSSL libs and/or directories were not found where specified!])
  1033. AC_MSG_RESULT(no)
  1034. else
  1035. if test -z "$SPNEGO_LIB_DIR"; then
  1036. LDFLAGS="$LDFLAGS -L$SPNEGO_ROOT -lfbopenssl"
  1037. else
  1038. LDFLAGS="$LDFLAGS $SPNEGO_LIB_DIR"
  1039. fi
  1040. AC_MSG_RESULT(yes)
  1041. AC_DEFINE(HAVE_SPNEGO, 1,
  1042. [Define this if you have the SPNEGO library fbopenssl])
  1043. curl_spnego_msg="enabled"
  1044. fi
  1045. else
  1046. AC_MSG_RESULT(no)
  1047. fi
  1048. dnl **********************************************************************
  1049. dnl Check for GSS-API libraries
  1050. dnl **********************************************************************
  1051. dnl check for GSS-API stuff in the /usr as default
  1052. GSSAPI_ROOT="/usr"
  1053. AC_ARG_WITH(gssapi-includes,
  1054. AC_HELP_STRING([--with-gssapi-includes=DIR],
  1055. [Specify location of GSS-API headers]),
  1056. [ GSSAPI_INCS="-I$withval"
  1057. want_gss="yes" ]
  1058. )
  1059. AC_ARG_WITH(gssapi-libs,
  1060. AC_HELP_STRING([--with-gssapi-libs=DIR],
  1061. [Specify location of GSS-API libs]),
  1062. [ GSSAPI_LIB_DIR="-L$withval"
  1063. want_gss="yes" ]
  1064. )
  1065. AC_ARG_WITH(gssapi,
  1066. AC_HELP_STRING([--with-gssapi=DIR],
  1067. [Where to look for GSS-API]), [
  1068. GSSAPI_ROOT="$withval"
  1069. if test x"$GSSAPI_ROOT" != xno; then
  1070. want_gss="yes"
  1071. if test x"$GSSAPI_ROOT" = xyes; then
  1072. dnl if yes, then use default root
  1073. GSSAPI_ROOT="/usr"
  1074. fi
  1075. fi
  1076. ])
  1077. save_CPPFLAGS="$CPPFLAGS"
  1078. AC_MSG_CHECKING([if GSS-API support is requested])
  1079. if test x"$want_gss" = xyes; then
  1080. AC_MSG_RESULT(yes)
  1081. if test -z "$GSSAPI_INCS"; then
  1082. if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
  1083. GSSAPI_INCS=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --cflags gssapi`
  1084. elif test -f "$GSSAPI_ROOT/bin/krb5-config"; then
  1085. GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
  1086. elif test "$GSSAPI_ROOT" != "yes"; then
  1087. GSSAPI_INCS="-I$GSSAPI_ROOT/include"
  1088. fi
  1089. fi
  1090. CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
  1091. AC_CHECK_HEADER(gss.h,
  1092. [
  1093. dnl found in the given dirs
  1094. AC_DEFINE(HAVE_GSSGNU, 1, [if you have GNU GSS])
  1095. gnu_gss=yes
  1096. ],
  1097. [
  1098. dnl not found, check Heimdal or MIT
  1099. AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
  1100. AC_CHECK_HEADERS(
  1101. [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
  1102. [],
  1103. [not_mit=1],
  1104. [
  1105. AC_INCLUDES_DEFAULT
  1106. #ifdef HAVE_GSSAPI_GSSAPI_H
  1107. #include <gssapi/gssapi.h>
  1108. #endif
  1109. ])
  1110. if test "x$not_mit" = "x1"; then
  1111. dnl MIT not found, check for Heimdal
  1112. AC_CHECK_HEADER(gssapi.h,
  1113. [
  1114. dnl found
  1115. AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have Heimdal])
  1116. ],
  1117. [
  1118. dnl no header found, disabling GSS
  1119. want_gss=no
  1120. AC_MSG_WARN(disabling GSS-API support since no header files were found)
  1121. ]
  1122. )
  1123. else
  1124. dnl MIT found
  1125. AC_DEFINE(HAVE_GSSMIT, 1, [if you have MIT Kerberos])
  1126. dnl check if we have a really old MIT Kerberos version (<= 1.2)
  1127. AC_MSG_CHECKING([if GSS-API headers declare GSS_C_NT_HOSTBASED_SERVICE])
  1128. AC_COMPILE_IFELSE([
  1129. AC_LANG_PROGRAM([[
  1130. #include <gssapi/gssapi.h>
  1131. #include <gssapi/gssapi_generic.h>
  1132. #include <gssapi/gssapi_krb5.h>
  1133. ]],[[
  1134. gss_import_name(
  1135. (OM_uint32 *)0,
  1136. (gss_buffer_t)0,
  1137. GSS_C_NT_HOSTBASED_SERVICE,
  1138. (gss_name_t *)0);
  1139. ]])
  1140. ],[
  1141. AC_MSG_RESULT([yes])
  1142. ],[
  1143. AC_MSG_RESULT([no])
  1144. AC_DEFINE(HAVE_OLD_GSSMIT, 1,
  1145. [if you have an old MIT Kerberos version, lacking GSS_C_NT_HOSTBASED_SERVICE])
  1146. ])
  1147. fi
  1148. ]
  1149. )
  1150. else
  1151. AC_MSG_RESULT(no)
  1152. fi
  1153. if test x"$want_gss" = xyes; then
  1154. AC_DEFINE(HAVE_GSSAPI, 1, [if you have GSS-API libraries])
  1155. curl_gss_msg="enabled (MIT Kerberos/Heimdal)"
  1156. if test -n "$gnu_gss"; then
  1157. curl_gss_msg="enabled (GNU GSS)"
  1158. LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
  1159. LIBS="-lgss $LIBS"
  1160. elif test -z "$GSSAPI_LIB_DIR"; then
  1161. case $host in
  1162. *-*-darwin*)
  1163. LIBS="-lgssapi_krb5 -lresolv $LIBS"
  1164. ;;
  1165. *-hp-hpux*)
  1166. if test "$GSSAPI_ROOT" != "yes"; then
  1167. LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
  1168. fi
  1169. LIBS="-lgss $LIBS"
  1170. ;;
  1171. *)
  1172. if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
  1173. dnl krb5-config doesn't have --libs-only-L or similar, put everything
  1174. dnl into LIBS
  1175. gss_libs=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --libs gssapi`
  1176. LIBS="$gss_libs $LIBS"
  1177. elif test -f "$GSSAPI_ROOT/bin/krb5-config"; then
  1178. dnl krb5-config doesn't have --libs-only-L or similar, put everything
  1179. dnl into LIBS
  1180. gss_libs=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
  1181. LIBS="$gss_libs $LIBS"
  1182. elif test "$GSSAPI_ROOT" != "yes"; then
  1183. LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
  1184. LIBS="-lgssapi $LIBS"
  1185. else
  1186. LIBS="-lgssapi $LIBS"
  1187. fi
  1188. ;;
  1189. esac
  1190. else
  1191. LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
  1192. case $host in
  1193. *-hp-hpux*)
  1194. LIBS="-lgss $LIBS"
  1195. ;;
  1196. *)
  1197. LIBS="-lgssapi $LIBS"
  1198. ;;
  1199. esac
  1200. fi
  1201. else
  1202. CPPFLAGS="$save_CPPFLAGS"
  1203. fi
  1204. dnl -------------------------------------------------
  1205. dnl check winssl option before other SSL libraries
  1206. dnl -------------------------------------------------
  1207. OPT_WINSSL=no
  1208. AC_ARG_WITH(winssl,dnl
  1209. AC_HELP_STRING([--with-winssl],[enable Windows native SSL/TLS])
  1210. AC_HELP_STRING([--without-winssl], [disable Windows native SSL/TLS]),
  1211. OPT_WINSSL=$withval)
  1212. AC_MSG_CHECKING([whether to enable Windows native SSL/TLS (Windows native builds only)])
  1213. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1214. if test "x$OPT_WINSSL" != "xno" &&
  1215. test "x$ac_cv_native_windows" = "xyes"; then
  1216. AC_MSG_RESULT(yes)
  1217. AC_DEFINE(USE_SCHANNEL, 1, [to enable Windows native SSL/TLS support])
  1218. AC_SUBST(USE_SCHANNEL, [1])
  1219. curl_ssl_msg="enabled (Windows-native)"
  1220. WINSSL_ENABLED=1
  1221. # --with-winssl implies --enable-sspi
  1222. AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
  1223. AC_SUBST(USE_WINDOWS_SSPI, [1])
  1224. curl_sspi_msg="enabled"
  1225. else
  1226. AC_MSG_RESULT(no)
  1227. fi
  1228. else
  1229. AC_MSG_RESULT(no)
  1230. fi
  1231. OPT_DARWINSSL=no
  1232. AC_ARG_WITH(darwinssl,dnl
  1233. AC_HELP_STRING([--with-darwinssl],[enable iOS/Mac OS X native SSL/TLS])
  1234. AC_HELP_STRING([--without-darwinssl], [disable iOS/Mac OS X native SSL/TLS]),
  1235. OPT_DARWINSSL=$withval)
  1236. AC_MSG_CHECKING([whether to enable iOS/Mac OS X native SSL/TLS])
  1237. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1238. if test "x$OPT_DARWINSSL" != "xno" &&
  1239. test -d "/System/Library/Frameworks/Security.framework"; then
  1240. AC_MSG_RESULT(yes)
  1241. AC_DEFINE(USE_DARWINSSL, 1, [to enable iOS/Mac OS X native SSL/TLS support])
  1242. AC_SUBST(USE_DARWINSSL, [1])
  1243. curl_ssl_msg="enabled (iOS/Mac OS X-native)"
  1244. DARWINSSL_ENABLED=1
  1245. LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
  1246. else
  1247. AC_MSG_RESULT(no)
  1248. fi
  1249. else
  1250. AC_MSG_RESULT(no)
  1251. fi
  1252. dnl **********************************************************************
  1253. dnl Check for the presence of SSL libraries and headers
  1254. dnl **********************************************************************
  1255. dnl Default to compiler & linker defaults for SSL files & libraries.
  1256. OPT_SSL=off
  1257. dnl Default to no CA bundle
  1258. ca="no"
  1259. AC_ARG_WITH(ssl,dnl
  1260. 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])
  1261. AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
  1262. OPT_SSL=$withval)
  1263. if test "$curl_ssl_msg" = "$init_ssl_msg" && test X"$OPT_SSL" != Xno; then
  1264. dnl backup the pre-ssl variables
  1265. CLEANLDFLAGS="$LDFLAGS"
  1266. CLEANCPPFLAGS="$CPPFLAGS"
  1267. CLEANLIBS="$LIBS"
  1268. case "$OPT_SSL" in
  1269. yes)
  1270. dnl --with-ssl (without path) used
  1271. if test x$cross_compiling != xyes; then
  1272. dnl only do pkg-config magic when not cross-compiling
  1273. PKGTEST="yes"
  1274. fi
  1275. PREFIX_OPENSSL=/usr/local/ssl
  1276. LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
  1277. ;;
  1278. off)
  1279. dnl no --with-ssl option given, just check default places
  1280. if test x$cross_compiling != xyes; then
  1281. dnl only do pkg-config magic when not cross-compiling
  1282. PKGTEST="yes"
  1283. fi
  1284. PREFIX_OPENSSL=
  1285. ;;
  1286. *)
  1287. dnl check the given --with-ssl spot
  1288. PKGTEST="no"
  1289. PREFIX_OPENSSL=$OPT_SSL
  1290. dnl Try pkg-config even when cross-compiling. Since we
  1291. dnl specify PKG_CONFIG_LIBDIR we're only looking where
  1292. dnl the user told us to look
  1293. OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig"
  1294. AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
  1295. if test -f "$OPENSSL_PCDIR/openssl.pc"; then
  1296. PKGTEST="yes"
  1297. fi
  1298. dnl in case pkg-config comes up empty, use what we got
  1299. dnl via --with-ssl
  1300. LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
  1301. if test "$PREFIX_OPENSSL" != "/usr" ; then
  1302. SSL_LDFLAGS="-L$LIB_OPENSSL"
  1303. SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include"
  1304. fi
  1305. SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl"
  1306. ;;
  1307. esac
  1308. if test "$PKGTEST" = "yes"; then
  1309. CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR])
  1310. if test "$PKGCONFIG" != "no" ; then
  1311. SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
  1312. $PKGCONFIG --libs-only-l openssl 2>/dev/null`
  1313. SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
  1314. $PKGCONFIG --libs-only-L openssl 2>/dev/null`
  1315. SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
  1316. $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
  1317. AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
  1318. AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
  1319. AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
  1320. LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
  1321. dnl use the values pkg-config reported. This is here
  1322. dnl instead of below with CPPFLAGS and LDFLAGS because we only
  1323. dnl learn about this via pkg-config. If we only have
  1324. dnl the argument to --with-ssl we don't know what
  1325. dnl additional libs may be necessary. Hope that we
  1326. dnl don't need any.
  1327. LIBS="$SSL_LIBS $LIBS"
  1328. fi
  1329. fi
  1330. dnl finally, set flags to use SSL
  1331. CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
  1332. LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
  1333. dnl This is for Msys/Mingw
  1334. case $host in
  1335. *-*-msys* | *-*-mingw*)
  1336. AC_MSG_CHECKING([for gdi32])
  1337. my_ac_save_LIBS=$LIBS
  1338. LIBS="-lgdi32 $LIBS"
  1339. AC_TRY_LINK([#include <windef.h>
  1340. #include <wingdi.h>],
  1341. [GdiFlush();],
  1342. [ dnl worked!
  1343. AC_MSG_RESULT([yes])],
  1344. [ dnl failed, restore LIBS
  1345. LIBS=$my_ac_save_LIBS
  1346. AC_MSG_RESULT(no)]
  1347. )
  1348. ;;
  1349. esac
  1350. AC_CHECK_LIB(crypto, CRYPTO_lock,[
  1351. HAVECRYPTO="yes"
  1352. LIBS="-lcrypto $LIBS"
  1353. ],[
  1354. LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
  1355. CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
  1356. AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
  1357. HAVECRYPTO="yes"
  1358. LIBS="-lcrypto $LIBS"], [
  1359. LDFLAGS="$CLEANLDFLAGS"
  1360. CPPFLAGS="$CLEANCPPFLAGS"
  1361. LIBS="$CLEANLIBS"
  1362. ])
  1363. ])
  1364. if test X"$HAVECRYPTO" = X"yes"; then
  1365. dnl This is only reasonable to do if crypto actually is there: check for
  1366. dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
  1367. AC_CHECK_LIB(ssl, SSL_connect)
  1368. if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
  1369. dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
  1370. AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
  1371. OLIBS=$LIBS
  1372. LIBS="-lRSAglue -lrsaref $LIBS"
  1373. AC_CHECK_LIB(ssl, SSL_connect)
  1374. if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
  1375. dnl still no SSL_connect
  1376. AC_MSG_RESULT(no)
  1377. LIBS=$OLIBS
  1378. else
  1379. AC_MSG_RESULT(yes)
  1380. fi
  1381. else
  1382. dnl Have the libraries--check for SSLeay/OpenSSL headers
  1383. AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
  1384. openssl/pem.h openssl/ssl.h openssl/err.h,
  1385. curl_ssl_msg="enabled (OpenSSL)"
  1386. OPENSSL_ENABLED=1
  1387. AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
  1388. if test $ac_cv_header_openssl_x509_h = no; then
  1389. dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
  1390. dnl since 'err.h' might in fact find a krb4 header with the same
  1391. dnl name
  1392. AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
  1393. if test $ac_cv_header_x509_h = yes &&
  1394. test $ac_cv_header_crypto_h = yes &&
  1395. test $ac_cv_header_ssl_h = yes; then
  1396. dnl three matches
  1397. curl_ssl_msg="enabled (OpenSSL)"
  1398. OPENSSL_ENABLED=1
  1399. fi
  1400. fi
  1401. fi
  1402. if test X"$OPENSSL_ENABLED" = X"1"; then
  1403. AC_DEFINE(USE_SSLEAY, 1, [if SSL is enabled])
  1404. dnl is there a pkcs12.h header present?
  1405. AC_CHECK_HEADERS(openssl/pkcs12.h)
  1406. else
  1407. LIBS="$CLEANLIBS"
  1408. fi
  1409. dnl USE_SSLEAY is the historical name for what configure calls
  1410. dnl OPENSSL_ENABLED; the names should really be unified
  1411. USE_SSLEAY="$OPENSSL_ENABLED"
  1412. AC_SUBST(USE_SSLEAY)
  1413. if test X"$OPT_SSL" != Xoff &&
  1414. test "$OPENSSL_ENABLED" != "1"; then
  1415. AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
  1416. fi
  1417. fi
  1418. if test X"$OPENSSL_ENABLED" = X"1"; then
  1419. dnl If the ENGINE library seems to be around, check for the OpenSSL engine
  1420. dnl stuff, it is kind of "separated" from the main SSL check
  1421. AC_CHECK_FUNC(ENGINE_init,
  1422. [
  1423. AC_CHECK_HEADERS(openssl/engine.h)
  1424. AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
  1425. ])
  1426. dnl these can only exist if openssl exists
  1427. dnl yassl doesn't have SSL_get_shutdown
  1428. AC_CHECK_FUNCS( RAND_status \
  1429. RAND_screen \
  1430. RAND_egd \
  1431. ENGINE_cleanup \
  1432. CRYPTO_cleanup_all_ex_data \
  1433. SSL_get_shutdown \
  1434. SSLv2_client_method \
  1435. SSL_CTX_set_next_proto_select_cb \
  1436. SSL_CTX_set_alpn_protos \
  1437. SSL_CTX_set_alpn_select_cb )
  1438. dnl Make an attempt to detect if this is actually yassl's headers and
  1439. dnl OpenSSL emulation layer. We still leave everything else believing
  1440. dnl and acting like OpenSSL.
  1441. AC_MSG_CHECKING([for yaSSL using OpenSSL compatibility mode])
  1442. AC_COMPILE_IFELSE([
  1443. AC_LANG_PROGRAM([[
  1444. #include <openssl/ssl.h>
  1445. ]],[[
  1446. #if defined(YASSL_VERSION) && defined(OPENSSL_VERSION_NUMBER)
  1447. int dummy = SSL_ERROR_NONE;
  1448. #else
  1449. Not the yaSSL OpenSSL compatibility header.
  1450. #endif
  1451. ]])
  1452. ],[
  1453. AC_MSG_RESULT([yes])
  1454. AC_DEFINE_UNQUOTED(USE_YASSLEMUL, 1,
  1455. [Define to 1 if using yaSSL in OpenSSL compatibility mode.])
  1456. curl_ssl_msg="enabled (OpenSSL emulation by yaSSL)"
  1457. ],[
  1458. AC_MSG_RESULT([no])
  1459. ])
  1460. fi
  1461. if test "$OPENSSL_ENABLED" = "1"; then
  1462. if test -n "$LIB_OPENSSL"; then
  1463. dnl when the ssl shared libs were found in a path that the run-time
  1464. dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
  1465. dnl to prevent further configure tests to fail due to this
  1466. if test "x$cross_compiling" != "xyes"; then
  1467. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
  1468. export LD_LIBRARY_PATH
  1469. AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
  1470. fi
  1471. fi
  1472. CURL_CHECK_OPENSSL_API
  1473. fi
  1474. fi
  1475. dnl **********************************************************************
  1476. dnl Check for the random seed preferences
  1477. dnl **********************************************************************
  1478. if test X"$OPENSSL_ENABLED" = X"1"; then
  1479. AC_ARG_WITH(egd-socket,
  1480. AC_HELP_STRING([--with-egd-socket=FILE],
  1481. [Entropy Gathering Daemon socket pathname]),
  1482. [ EGD_SOCKET="$withval" ]
  1483. )
  1484. if test -n "$EGD_SOCKET" ; then
  1485. AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
  1486. [your Entropy Gathering Daemon socket pathname] )
  1487. fi
  1488. dnl Check for user-specified random device
  1489. AC_ARG_WITH(random,
  1490. AC_HELP_STRING([--with-random=FILE],
  1491. [read randomness from FILE (default=/dev/urandom)]),
  1492. [ RANDOM_FILE="$withval" ],
  1493. [
  1494. if test x$cross_compiling != xyes; then
  1495. dnl Check for random device
  1496. AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
  1497. else
  1498. AC_MSG_WARN([skipped the /dev/urandom detection when cross-compiling])
  1499. fi
  1500. ]
  1501. )
  1502. if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
  1503. AC_SUBST(RANDOM_FILE)
  1504. AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
  1505. [a suitable file to read random data from])
  1506. fi
  1507. fi
  1508. dnl ---
  1509. dnl We require OpenSSL with SRP support.
  1510. dnl ---
  1511. if test "$OPENSSL_ENABLED" = "1"; then
  1512. AC_CHECK_LIB(crypto, SRP_Calc_client_key,
  1513. [
  1514. AC_DEFINE(HAVE_SSLEAY_SRP, 1, [if you have the function SRP_Calc_client_key])
  1515. AC_SUBST(HAVE_SSLEAY_SRP, [1])
  1516. ])
  1517. fi
  1518. dnl ----------------------------------------------------
  1519. dnl check for GnuTLS
  1520. dnl ----------------------------------------------------
  1521. dnl Default to compiler & linker defaults for GnuTLS files & libraries.
  1522. OPT_GNUTLS=no
  1523. AC_ARG_WITH(gnutls,dnl
  1524. AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root])
  1525. AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
  1526. OPT_GNUTLS=$withval)
  1527. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1528. if test X"$OPT_GNUTLS" != Xno; then
  1529. addld=""
  1530. addlib=""
  1531. gtlslib=""
  1532. version=""
  1533. addcflags=""
  1534. if test "x$OPT_GNUTLS" = "xyes"; then
  1535. dnl this is with no partiular path given
  1536. CURL_CHECK_PKGCONFIG(gnutls)
  1537. if test "$PKGCONFIG" != "no" ; then
  1538. addlib=`$PKGCONFIG --libs-only-l gnutls`
  1539. addld=`$PKGCONFIG --libs-only-L gnutls`
  1540. addcflags=`$PKGCONFIG --cflags-only-I gnutls`
  1541. version=`$PKGCONFIG --modversion gnutls`
  1542. gtlslib=`echo $addld | $SED -e 's/-L//'`
  1543. else
  1544. dnl without pkg-config, we try libgnutls-config as that was how it
  1545. dnl used to be done
  1546. check=`libgnutls-config --version 2>/dev/null`
  1547. if test -n "$check"; then
  1548. addlib=`libgnutls-config --libs`
  1549. addcflags=`libgnutls-config --cflags`
  1550. version=`libgnutls-config --version`
  1551. gtlslib=`libgnutls-config --prefix`/lib$libsuff
  1552. fi
  1553. fi
  1554. else
  1555. dnl this is with a given path, first check if there's a libgnutls-config
  1556. dnl there and if not, make an educated guess
  1557. cfg=$OPT_GNUTLS/bin/libgnutls-config
  1558. check=`$cfg --version 2>/dev/null`
  1559. if test -n "$check"; then
  1560. addlib=`$cfg --libs`
  1561. addcflags=`$cfg --cflags`
  1562. version=`$cfg --version`
  1563. gtlslib=`$cfg --prefix`/lib$libsuff
  1564. else
  1565. dnl without pkg-config and libgnutls-config, we guess a lot!
  1566. addlib=-lgnutls
  1567. addld=-L$OPT_GNUTLS/lib$libsuff
  1568. addcflags=-I$OPT_GNUTLS/include
  1569. version="" # we just don't know
  1570. gtlslib=$OPT_GNUTLS/lib$libsuff
  1571. fi
  1572. fi
  1573. if test -z "$version"; then
  1574. dnl lots of efforts, still no go
  1575. version="unknown"
  1576. fi
  1577. if test -n "$addlib"; then
  1578. CLEANLIBS="$LIBS"
  1579. CLEANCPPFLAGS="$CPPFLAGS"
  1580. CLEANLDFLAGS="$LDFLAGS"
  1581. LIBS="$addlib $LIBS"
  1582. LDFLAGS="$LDFLAGS $addld"
  1583. if test "$addcflags" != "-I/usr/include"; then
  1584. CPPFLAGS="$CPPFLAGS $addcflags"
  1585. fi
  1586. AC_CHECK_LIB(gnutls, gnutls_check_version,
  1587. [
  1588. AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
  1589. AC_SUBST(USE_GNUTLS, [1])
  1590. GNUTLS_ENABLED=1
  1591. USE_GNUTLS="yes"
  1592. curl_ssl_msg="enabled (GnuTLS)"
  1593. ],
  1594. [
  1595. LIBS="$CLEANLIBS"
  1596. CPPFLAGS="$CLEANCPPFLAGS"
  1597. ])
  1598. if test "x$USE_GNUTLS" = "xyes"; then
  1599. AC_MSG_NOTICE([detected GnuTLS version $version])
  1600. if test -n "$gtlslib"; then
  1601. dnl when shared libs were found in a path that the run-time
  1602. dnl linker doesn't search through, we need to add it to
  1603. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1604. dnl due to this
  1605. if test "x$cross_compiling" != "xyes"; then
  1606. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib"
  1607. export LD_LIBRARY_PATH
  1608. AC_MSG_NOTICE([Added $gtlslib to LD_LIBRARY_PATH])
  1609. fi
  1610. fi
  1611. fi
  1612. fi
  1613. fi dnl GNUTLS not disabled
  1614. fi
  1615. dnl ---
  1616. dnl Check which crypto backend GnuTLS uses
  1617. dnl ---
  1618. if test "$GNUTLS_ENABLED" = "1"; then
  1619. USE_GNUTLS_NETTLE=
  1620. # First check if we can detect either crypto library via transitive linking
  1621. AC_CHECK_LIB(gnutls, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
  1622. if test "$USE_GNUTLS_NETTLE" = ""; then
  1623. AC_CHECK_LIB(gnutls, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
  1624. fi
  1625. # If not, try linking directly to both of them to see if they are available
  1626. if test "$USE_GNUTLS_NETTLE" = ""; then
  1627. AC_CHECK_LIB(nettle, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
  1628. fi
  1629. if test "$USE_GNUTLS_NETTLE" = ""; then
  1630. AC_CHECK_LIB(gcrypt, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
  1631. fi
  1632. if test "$USE_GNUTLS_NETTLE" = ""; then
  1633. AC_MSG_ERROR([GnuTLS found, but neither gcrypt nor nettle found])
  1634. fi
  1635. if test "$USE_GNUTLS_NETTLE" = "1"; then
  1636. AC_DEFINE(USE_GNUTLS_NETTLE, 1, [if GnuTLS uses nettle as crypto backend])
  1637. AC_SUBST(USE_GNUTLS_NETTLE, [1])
  1638. LIBS="-lnettle $LIBS"
  1639. else
  1640. LIBS="-lgcrypt $LIBS"
  1641. fi
  1642. fi
  1643. dnl ---
  1644. dnl We require GnuTLS with SRP support.
  1645. dnl ---
  1646. if test "$GNUTLS_ENABLED" = "1"; then
  1647. AC_CHECK_LIB(gnutls, gnutls_srp_verifier,
  1648. [
  1649. AC_DEFINE(HAVE_GNUTLS_SRP, 1, [if you have the function gnutls_srp_verifier])
  1650. AC_SUBST(HAVE_GNUTLS_SRP, [1])
  1651. ])
  1652. fi
  1653. dnl ----------------------------------------------------
  1654. dnl check for PolarSSL
  1655. dnl ----------------------------------------------------
  1656. dnl Default to compiler & linker defaults for PolarSSL files & libraries.
  1657. OPT_POLARSSL=no
  1658. _cppflags=$CPPFLAGS
  1659. _ldflags=$LDFLAGS
  1660. AC_ARG_WITH(polarssl,dnl
  1661. AC_HELP_STRING([--with-polarssl=PATH],[where to look for PolarSSL, PATH points to the installation root])
  1662. AC_HELP_STRING([--without-polarssl], [disable PolarSSL detection]),
  1663. OPT_POLARSSL=$withval)
  1664. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1665. if test X"$OPT_POLARSSL" != Xno; then
  1666. if test "$OPT_POLARSSL" = "yes"; then
  1667. OPT_POLARSSL=""
  1668. fi
  1669. if test -z "$OPT_POLARSSL" ; then
  1670. dnl check for lib first without setting any new path
  1671. AC_CHECK_LIB(polarssl, havege_init,
  1672. dnl libpolarssl found, set the variable
  1673. [
  1674. AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
  1675. AC_SUBST(USE_POLARSSL, [1])
  1676. POLARSSL_ENABLED=1
  1677. USE_POLARSSL="yes"
  1678. curl_ssl_msg="enabled (PolarSSL)"
  1679. ])
  1680. fi
  1681. addld=""
  1682. addlib=""
  1683. addcflags=""
  1684. polarssllib=""
  1685. if test "x$USE_POLARSSL" != "xyes"; then
  1686. dnl add the path and test again
  1687. addld=-L$OPT_POLARSSL/lib$libsuff
  1688. addcflags=-I$OPT_POLARSSL/include
  1689. polarssllib=$OPT_POLARSSL/lib$libsuff
  1690. LDFLAGS="$LDFLAGS $addld"
  1691. if test "$addcflags" != "-I/usr/include"; then
  1692. CPPFLAGS="$CPPFLAGS $addcflags"
  1693. fi
  1694. AC_CHECK_LIB(polarssl, ssl_init,
  1695. [
  1696. AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
  1697. AC_SUBST(USE_POLARSSL, [1])
  1698. POLARSSL_ENABLED=1
  1699. USE_POLARSSL="yes"
  1700. curl_ssl_msg="enabled (PolarSSL)"
  1701. ],
  1702. [
  1703. CPPFLAGS=$_cppflags
  1704. LDFLAGS=$_ldflags
  1705. ])
  1706. fi
  1707. if test "x$USE_POLARSSL" = "xyes"; then
  1708. AC_MSG_NOTICE([detected PolarSSL])
  1709. LIBS="-lpolarssl $LIBS"
  1710. if test -n "$polarssllib"; then
  1711. dnl when shared libs were found in a path that the run-time
  1712. dnl linker doesn't search through, we need to add it to
  1713. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1714. dnl due to this
  1715. if test "x$cross_compiling" != "xyes"; then
  1716. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$polarssllib"
  1717. export LD_LIBRARY_PATH
  1718. AC_MSG_NOTICE([Added $polarssllib to LD_LIBRARY_PATH])
  1719. fi
  1720. fi
  1721. fi
  1722. fi dnl PolarSSL not disabled
  1723. fi
  1724. dnl ----------------------------------------------------
  1725. dnl check for CyaSSL
  1726. dnl ----------------------------------------------------
  1727. dnl Default to compiler & linker defaults for CyaSSL files & libraries.
  1728. OPT_CYASSL=no
  1729. _cppflags=$CPPFLAGS
  1730. _ldflags=$LDFLAGS
  1731. AC_ARG_WITH(cyassl,dnl
  1732. AC_HELP_STRING([--with-cyassl=PATH],[where to look for CyaSSL, PATH points to the installation root (default: system lib default)])
  1733. AC_HELP_STRING([--without-cyassl], [disable CyaSSL detection]),
  1734. OPT_CYASSL=$withval)
  1735. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1736. if test X"$OPT_CYASSL" != Xno; then
  1737. if test "$OPT_CYASSL" = "yes"; then
  1738. OPT_CYASSL=""
  1739. fi
  1740. if test -z "$OPT_CYASSL" ; then
  1741. dnl check for lib in system default first
  1742. AC_CHECK_LIB(cyassl, CyaSSL_Init,
  1743. dnl libcyassl found, set the variable
  1744. [
  1745. AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
  1746. AC_SUBST(USE_CYASSL, [1])
  1747. CYASSL_ENABLED=1
  1748. USE_CYASSL="yes"
  1749. curl_ssl_msg="enabled (CyaSSL)"
  1750. ])
  1751. fi
  1752. addld=""
  1753. addlib=""
  1754. addcflags=""
  1755. cyassllib=""
  1756. if test "x$USE_CYASSL" != "xyes"; then
  1757. dnl add the path and test again
  1758. addld=-L$OPT_CYASSL/lib$libsuff
  1759. addcflags=-I$OPT_CYASSL/include
  1760. cyassllib=$OPT_CYASSL/lib$libsuff
  1761. LDFLAGS="$LDFLAGS $addld"
  1762. if test "$addcflags" != "-I/usr/include"; then
  1763. CPPFLAGS="$CPPFLAGS $addcflags"
  1764. fi
  1765. AC_CHECK_LIB(cyassl, CyaSSL_Init,
  1766. [
  1767. AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
  1768. AC_SUBST(USE_CYASSL, [1])
  1769. CYASSL_ENABLED=1
  1770. USE_CYASSL="yes"
  1771. curl_ssl_msg="enabled (CyaSSL)"
  1772. ],
  1773. [
  1774. CPPFLAGS=$_cppflags
  1775. LDFLAGS=$_ldflags
  1776. ])
  1777. fi
  1778. if test "x$USE_CYASSL" = "xyes"; then
  1779. AC_MSG_NOTICE([detected CyaSSL])
  1780. dnl cyassl/ctaocrypt/types.h needs SIZEOF_LONG_LONG defined!
  1781. AC_CHECK_SIZEOF(long long)
  1782. dnl Versions since at least 2.9.4 renamed error.h to error-ssl.h
  1783. AC_CHECK_HEADERS(cyassl/error-ssl.h)
  1784. LIBS="-lcyassl -lm $LIBS"
  1785. if test -n "$cyassllib"; then
  1786. dnl when shared libs were found in a path that the run-time
  1787. dnl linker doesn't search through, we need to add it to
  1788. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1789. dnl due to this
  1790. if test "x$cross_compiling" != "xyes"; then
  1791. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$cyassllib"
  1792. export LD_LIBRARY_PATH
  1793. AC_MSG_NOTICE([Added $cyassllib to LD_LIBRARY_PATH])
  1794. fi
  1795. fi
  1796. fi
  1797. fi dnl CyaSSL not disabled
  1798. fi
  1799. dnl ----------------------------------------------------
  1800. dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
  1801. dnl ----------------------------------------------------
  1802. dnl Default to compiler & linker defaults for NSS files & libraries.
  1803. OPT_NSS=no
  1804. AC_ARG_WITH(nss,dnl
  1805. AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root])
  1806. AC_HELP_STRING([--without-nss], [disable NSS detection]),
  1807. OPT_NSS=$withval)
  1808. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1809. if test X"$OPT_NSS" != Xno; then
  1810. addld=""
  1811. addlib=""
  1812. addcflags=""
  1813. nssprefix=""
  1814. version=""
  1815. if test "x$OPT_NSS" = "xyes"; then
  1816. CURL_CHECK_PKGCONFIG(nss)
  1817. if test "$PKGCONFIG" != "no" ; then
  1818. addlib=`$PKGCONFIG --libs nss`
  1819. addcflags=`$PKGCONFIG --cflags nss`
  1820. version=`$PKGCONFIG --modversion nss`
  1821. nssprefix=`$PKGCONFIG --variable=prefix nss`
  1822. else
  1823. dnl Without pkg-config, we check for nss-config
  1824. check=`nss-config --version 2>/dev/null`
  1825. if test -n "$check"; then
  1826. addlib=`nss-config --libs`
  1827. addcflags=`nss-config --cflags`
  1828. version=`nss-config --version`
  1829. nssprefix=`nss-config --prefix`
  1830. else
  1831. addlib="-lnss3"
  1832. addcflags=""
  1833. version="unknown"
  1834. fi
  1835. fi
  1836. else
  1837. # Without pkg-config, we'll kludge in some defaults
  1838. addlib="-L$OPT_NSS/lib -lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
  1839. addcflags="-I$OPT_NSS/include"
  1840. version="unknown"
  1841. nssprefix=$OPT_NSS
  1842. fi
  1843. if test -n "$addlib"; then
  1844. CLEANLIBS="$LIBS"
  1845. CLEANCPPFLAGS="$CPPFLAGS"
  1846. LIBS="$addlib $LIBS"
  1847. if test "$addcflags" != "-I/usr/include"; then
  1848. CPPFLAGS="$CPPFLAGS $addcflags"
  1849. fi
  1850. dnl The function SSL_VersionRangeSet() is needed to enable TLS > 1.0
  1851. AC_CHECK_LIB(nss3, SSL_VersionRangeSet,
  1852. [
  1853. AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
  1854. AC_SUBST(USE_NSS, [1])
  1855. USE_NSS="yes"
  1856. NSS_ENABLED=1
  1857. curl_ssl_msg="enabled (NSS)"
  1858. ],
  1859. [
  1860. LIBS="$CLEANLIBS"
  1861. CPPFLAGS="$CLEANCPPFLAGS"
  1862. ])
  1863. if test "x$USE_NSS" = "xyes"; then
  1864. AC_MSG_NOTICE([detected NSS version $version])
  1865. dnl when shared libs were found in a path that the run-time
  1866. dnl linker doesn't search through, we need to add it to
  1867. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1868. dnl due to this
  1869. if test "x$cross_compiling" != "xyes"; then
  1870. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff"
  1871. export LD_LIBRARY_PATH
  1872. AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH])
  1873. fi
  1874. fi
  1875. fi
  1876. fi dnl NSS not disabled
  1877. fi dnl curl_ssl_msg = init_ssl_msg
  1878. OPT_AXTLS=off
  1879. AC_ARG_WITH(axtls,dnl
  1880. AC_HELP_STRING([--with-axtls=PATH],[Where to look for axTLS, PATH points to the axTLS installation prefix (default: /usr/local). Ignored if another SSL engine is selected.])
  1881. AC_HELP_STRING([--without-axtls], [disable axTLS]),
  1882. OPT_AXTLS=$withval)
  1883. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1884. if test X"$OPT_AXTLS" != Xno; then
  1885. dnl backup the pre-axtls variables
  1886. CLEANLDFLAGS="$LDFLAGS"
  1887. CLEANCPPFLAGS="$CPPFLAGS"
  1888. CLEANLIBS="$LIBS"
  1889. case "$OPT_AXTLS" in
  1890. yes)
  1891. dnl --with-axtls (without path) used
  1892. PREFIX_AXTLS=/usr/local
  1893. LIB_AXTLS="$PREFIX_AXTLS/lib"
  1894. LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
  1895. CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
  1896. ;;
  1897. off)
  1898. dnl no --with-axtls option given, just check default places
  1899. PREFIX_AXTLS=
  1900. ;;
  1901. *)
  1902. dnl check the given --with-axtls spot
  1903. PREFIX_AXTLS=$OPT_AXTLS
  1904. LIB_AXTLS="$PREFIX_AXTLS/lib"
  1905. LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
  1906. CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
  1907. ;;
  1908. esac
  1909. AC_CHECK_LIB(axtls, ssl_version,[
  1910. LIBS="-laxtls $LIBS"
  1911. AC_DEFINE(USE_AXTLS, 1, [if axTLS is enabled])
  1912. AC_SUBST(USE_AXTLS, [1])
  1913. AXTLS_ENABLED=1
  1914. USE_AXTLS="yes"
  1915. curl_ssl_msg="enabled (axTLS)"
  1916. if test "x$cross_compiling" != "xyes"; then
  1917. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_AXTLS"
  1918. export LD_LIBRARY_PATH
  1919. AC_MSG_NOTICE([Added $LIB_AXTLS to LD_LIBRARY_PATH])
  1920. fi
  1921. ],[
  1922. LDFLAGS="$CLEANLDFLAGS"
  1923. CPPFLAGS="$CLEANCPPFLAGS"
  1924. LIBS="$CLEANLIBS"
  1925. ])
  1926. fi
  1927. fi
  1928. if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED$AXTLS_ENABLED$CYASSL_ENABLED$WINSSL_ENABLED$DARWINSSL_ENABLED" = "x"; then
  1929. AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
  1930. AC_MSG_WARN([Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss, --with-axtls, --with-winssl, or --with-darwinssl to address this.])
  1931. else
  1932. # SSL is enabled, genericly
  1933. AC_SUBST(SSL_ENABLED)
  1934. SSL_ENABLED="1"
  1935. fi
  1936. dnl **********************************************************************
  1937. dnl Check for the CA bundle
  1938. dnl **********************************************************************
  1939. CURL_CHECK_CA_BUNDLE
  1940. dnl **********************************************************************
  1941. dnl Check for libmetalink
  1942. dnl **********************************************************************
  1943. OPT_LIBMETALINK=no
  1944. AC_ARG_WITH(libmetalink,dnl
  1945. AC_HELP_STRING([--with-libmetalink=PATH],[where to look for libmetalink, PATH points to the installation root])
  1946. AC_HELP_STRING([--without-libmetalink], [disable libmetalink detection]),
  1947. OPT_LIBMETALINK=$withval)
  1948. if test X"$OPT_LIBMETALINK" != Xno; then
  1949. addld=""
  1950. addlib=""
  1951. addcflags=""
  1952. version=""
  1953. libmetalinklib=""
  1954. PKGTEST="no"
  1955. if test "x$OPT_LIBMETALINK" = "xyes"; then
  1956. dnl this is with no partiular path given
  1957. PKGTEST="yes"
  1958. CURL_CHECK_PKGCONFIG(libmetalink)
  1959. else
  1960. dnl When particular path is given, set PKG_CONFIG_LIBDIR using the path.
  1961. LIBMETALINK_PCDIR="$OPT_LIBMETALINK/lib/pkgconfig"
  1962. AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$LIBMETALINK_PCDIR"])
  1963. if test -f "$LIBMETALINK_PCDIR/libmetalink.pc"; then
  1964. PKGTEST="yes"
  1965. fi
  1966. if test "$PKGTEST" = "yes"; then
  1967. CURL_CHECK_PKGCONFIG(libmetalink, [$LIBMETALINK_PCDIR])
  1968. fi
  1969. fi
  1970. if test "$PKGTEST" = "yes" && test "$PKGCONFIG" != "no"; then
  1971. addlib=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
  1972. $PKGCONFIG --libs-only-l libmetalink`
  1973. addld=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
  1974. $PKGCONFIG --libs-only-L libmetalink`
  1975. addcflags=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
  1976. $PKGCONFIG --cflags-only-I libmetalink`
  1977. version=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
  1978. $PKGCONFIG --modversion libmetalink`
  1979. libmetalinklib=`echo $addld | $SED -e 's/-L//'`
  1980. fi
  1981. if test -n "$addlib"; then
  1982. clean_CPPFLAGS="$CPPFLAGS"
  1983. clean_LDFLAGS="$LDFLAGS"
  1984. clean_LIBS="$LIBS"
  1985. CPPFLAGS="$addcflags $clean_CPPFLAGS"
  1986. LDFLAGS="$addld $clean_LDFLAGS"
  1987. LIBS="$addlib $clean_LIBS"
  1988. AC_MSG_CHECKING([if libmetalink is recent enough])
  1989. AC_LINK_IFELSE([
  1990. AC_LANG_PROGRAM([[
  1991. # include <metalink/metalink.h>
  1992. ]],[[
  1993. if(0 != metalink_strerror(0)) /* added in 0.1.0 */
  1994. return 1;
  1995. ]])
  1996. ],[
  1997. AC_MSG_RESULT([yes ($version)])
  1998. want_metalink="yes"
  1999. ],[
  2000. AC_MSG_RESULT([no ($version)])
  2001. AC_MSG_NOTICE([libmetalink library defective or too old])
  2002. want_metalink="no"
  2003. ])
  2004. CPPFLAGS="$clean_CPPFLAGS"
  2005. LDFLAGS="$clean_LDFLAGS"
  2006. LIBS="$clean_LIBS"
  2007. if test "$want_metalink" = "yes"; then
  2008. dnl finally libmetalink will be used
  2009. AC_DEFINE(USE_METALINK, 1, [Define to enable metalink support])
  2010. LIBMETALINK_LIBS=$addlib
  2011. LIBMETALINK_LDFLAGS=$addld
  2012. LIBMETALINK_CPPFLAGS=$addcflags
  2013. AC_SUBST([LIBMETALINK_LIBS])
  2014. AC_SUBST([LIBMETALINK_LDFLAGS])
  2015. AC_SUBST([LIBMETALINK_CPPFLAGS])
  2016. curl_mtlnk_msg="enabled"
  2017. fi
  2018. fi
  2019. fi
  2020. dnl **********************************************************************
  2021. dnl Check for the presence of LIBSSH2 libraries and headers
  2022. dnl **********************************************************************
  2023. dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
  2024. OPT_LIBSSH2=off
  2025. AC_ARG_WITH(libssh2,dnl
  2026. AC_HELP_STRING([--with-libssh2=PATH],[Where to look for libssh2, PATH points to the LIBSSH2 installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
  2027. AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]),
  2028. OPT_LIBSSH2=$withval)
  2029. if test X"$OPT_LIBSSH2" != Xno; then
  2030. dnl backup the pre-libssh2 variables
  2031. CLEANLDFLAGS="$LDFLAGS"
  2032. CLEANCPPFLAGS="$CPPFLAGS"
  2033. CLEANLIBS="$LIBS"
  2034. case "$OPT_LIBSSH2" in
  2035. yes)
  2036. dnl --with-libssh2 (without path) used
  2037. CURL_CHECK_PKGCONFIG(libssh2)
  2038. if test "$PKGCONFIG" != "no" ; then
  2039. LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2`
  2040. LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
  2041. CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
  2042. version=`$PKGCONFIG --modversion libssh2`
  2043. DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'`
  2044. fi
  2045. ;;
  2046. off)
  2047. dnl no --with-libssh2 option given, just check default places
  2048. ;;
  2049. *)
  2050. dnl use the given --with-libssh2 spot
  2051. PREFIX_SSH2=$OPT_LIBSSH2
  2052. ;;
  2053. esac
  2054. dnl if given with a prefix, we set -L and -I based on that
  2055. if test -n "$PREFIX_SSH2"; then
  2056. LIB_SSH2="-lssh2"
  2057. LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
  2058. CPP_SSH2=-I${PREFIX_SSH2}/include
  2059. DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
  2060. fi
  2061. LDFLAGS="$LDFLAGS $LD_SSH2"
  2062. CPPFLAGS="$CPPFLAGS $CPP_SSH2"
  2063. LIBS="$LIB_SSH2 $LIBS"
  2064. AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
  2065. AC_CHECK_HEADERS(libssh2.h,
  2066. curl_ssh_msg="enabled (libSSH2)"
  2067. LIBSSH2_ENABLED=1
  2068. AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
  2069. AC_SUBST(USE_LIBSSH2, [1])
  2070. )
  2071. if test X"$OPT_LIBSSH2" != Xoff &&
  2072. test "$LIBSSH2_ENABLED" != "1"; then
  2073. AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
  2074. fi
  2075. if test "$LIBSSH2_ENABLED" = "1"; then
  2076. if test -n "$DIR_SSH2"; then
  2077. dnl when the libssh2 shared libs were found in a path that the run-time
  2078. dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
  2079. dnl to prevent further configure tests to fail due to this
  2080. dnl libssh2_version is a post 1.0 addition
  2081. dnl libssh2_init and libssh2_exit were added in 1.2.5
  2082. dnl libssh2_scp_send64 was added in 1.2.6
  2083. dnl libssh2_session_handshake was added in 1.2.8
  2084. AC_CHECK_FUNCS( libssh2_version libssh2_init libssh2_exit \
  2085. libssh2_scp_send64 libssh2_session_handshake)
  2086. if test "x$cross_compiling" != "xyes"; then
  2087. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2"
  2088. export LD_LIBRARY_PATH
  2089. AC_MSG_NOTICE([Added $DIR_SSH2 to LD_LIBRARY_PATH])
  2090. fi
  2091. fi
  2092. else
  2093. dnl no libssh2, revert back to clean variables
  2094. LDFLAGS=$CLEANLDFLAGS
  2095. CPPFLAGS=$CLEANCPPFLAGS
  2096. LIBS=$CLEANLIBS
  2097. fi
  2098. fi
  2099. dnl **********************************************************************
  2100. dnl Check for the presence of LIBRTMP libraries and headers
  2101. dnl **********************************************************************
  2102. dnl Default to compiler & linker defaults for LIBRTMP files & libraries.
  2103. OPT_LIBRTMP=off
  2104. AC_ARG_WITH(librtmp,dnl
  2105. AC_HELP_STRING([--with-librtmp=PATH],[Where to look for librtmp, PATH points to the LIBRTMP installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
  2106. AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]),
  2107. OPT_LIBRTMP=$withval)
  2108. if test X"$OPT_LIBRTMP" != Xno; then
  2109. dnl backup the pre-librtmp variables
  2110. CLEANLDFLAGS="$LDFLAGS"
  2111. CLEANCPPFLAGS="$CPPFLAGS"
  2112. CLEANLIBS="$LIBS"
  2113. case "$OPT_LIBRTMP" in
  2114. yes)
  2115. dnl --with-librtmp (without path) used
  2116. CURL_CHECK_PKGCONFIG(librtmp)
  2117. if test "$PKGCONFIG" != "no" ; then
  2118. LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp`
  2119. LD_RTMP=`$PKGCONFIG --libs-only-L librtmp`
  2120. CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
  2121. version=`$PKGCONFIG --modversion librtmp`
  2122. DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'`
  2123. else
  2124. dnl To avoid link errors, we do not allow --librtmp without
  2125. dnl a pkgconfig file
  2126. AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
  2127. fi
  2128. ;;
  2129. off)
  2130. dnl no --with-librtmp option given, just check default places
  2131. LIB_RTMP="-lrtmp"
  2132. ;;
  2133. *)
  2134. dnl use the given --with-librtmp spot
  2135. PREFIX_RTMP=$OPT_LIBRTMP
  2136. ;;
  2137. esac
  2138. dnl if given with a prefix, we set -L and -I based on that
  2139. if test -n "$PREFIX_RTMP"; then
  2140. LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff
  2141. CPP_RTMP=-I${PREFIX_RTMP}/include
  2142. DIR_RTMP=${PREFIX_RTMP}/lib$libsuff
  2143. fi
  2144. LDFLAGS="$LDFLAGS $LD_RTMP"
  2145. CPPFLAGS="$CPPFLAGS $CPP_RTMP"
  2146. LIBS="$LIB_RTMP $LIBS"
  2147. AC_CHECK_LIB(rtmp, RTMP_Init,
  2148. [
  2149. AC_CHECK_HEADERS(librtmp/rtmp.h,
  2150. curl_rtmp_msg="enabled (librtmp)"
  2151. LIBRTMP_ENABLED=1
  2152. AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use])
  2153. AC_SUBST(USE_LIBRTMP, [1])
  2154. )
  2155. ],
  2156. dnl not found, revert back to clean variables
  2157. LDFLAGS=$CLEANLDFLAGS
  2158. CPPFLAGS=$CLEANCPPFLAGS
  2159. LIBS=$CLEANLIBS
  2160. )
  2161. if test X"$OPT_LIBRTMP" != Xoff &&
  2162. test "$LIBRTMP_ENABLED" != "1"; then
  2163. AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!])
  2164. fi
  2165. fi
  2166. dnl **********************************************************************
  2167. dnl Check for linker switch for versioned symbols
  2168. dnl **********************************************************************
  2169. versioned_symbols_flavour=
  2170. AC_MSG_CHECKING([whether versioned symbols are wanted])
  2171. AC_ARG_ENABLE(versioned-symbols,
  2172. AC_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library])
  2173. AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]),
  2174. [ case "$enableval" in
  2175. yes) AC_MSG_RESULT(yes)
  2176. AC_MSG_CHECKING([if libraries can be versioned])
  2177. GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
  2178. if test -z "$GLD"; then
  2179. AC_MSG_RESULT(no)
  2180. AC_MSG_WARN([You need an ld version supporting the --version-script option])
  2181. else
  2182. AC_MSG_RESULT(yes)
  2183. if test "x$OPENSSL_ENABLED" = "x1"; then
  2184. versioned_symbols_flavour="OPENSSL_"
  2185. elif test "x$GNUTLS_ENABLED" = "x1"; then
  2186. versioned_symbols_flavour="GNUTLS_"
  2187. elif test "x$NSS_ENABLED" = "x1"; then
  2188. versioned_symbols_flavour="NSS_"
  2189. elif test "x$POLARSSL_ENABLED" = "x1"; then
  2190. versioned_symbols_flavour="POLARSSL_"
  2191. elif test "x$CYASSL_ENABLED" = "x1"; then
  2192. versioned_symbols_flavour="CYASSL_"
  2193. elif test "x$AXTLS_ENABLED" = "x1"; then
  2194. versioned_symbols_flavour="AXTLS_"
  2195. elif test "x$WINSSL_ENABLED" = "x1"; then
  2196. versioned_symbols_flavour="WINSSL_"
  2197. elif test "x$DARWINSSL_ENABLED" = "x1"; then
  2198. versioned_symbols_flavour="DARWINSSL_"
  2199. else
  2200. versioned_symbols_flavour=""
  2201. fi
  2202. versioned_symbols="yes"
  2203. fi
  2204. ;;
  2205. *) AC_MSG_RESULT(no)
  2206. ;;
  2207. esac
  2208. ], [
  2209. AC_MSG_RESULT(no)
  2210. ]
  2211. )
  2212. AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR],
  2213. ["$versioned_symbols_flavour"])
  2214. AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
  2215. [test "x$versioned_symbols" = 'xyes'])
  2216. dnl -------------------------------------------------
  2217. dnl check winidn option before other IDN libraries
  2218. dnl -------------------------------------------------
  2219. AC_MSG_CHECKING([whether to enable Windows native IDN (Windows native builds only)])
  2220. OPT_WINIDN="default"
  2221. AC_ARG_WITH(winidn,
  2222. AC_HELP_STRING([--with-winidn=PATH],[enable Windows native IDN])
  2223. AC_HELP_STRING([--without-winidn], [disable Windows native IDN]),
  2224. OPT_WINIDN=$withval)
  2225. case "$OPT_WINIDN" in
  2226. no|default)
  2227. dnl --without-winidn option used or configure option not specified
  2228. want_winidn="no"
  2229. AC_MSG_RESULT([no])
  2230. ;;
  2231. yes)
  2232. dnl --with-winidn option used without path
  2233. want_winidn="yes"
  2234. want_winidn_path="default"
  2235. AC_MSG_RESULT([yes])
  2236. ;;
  2237. *)
  2238. dnl --with-winidn option used with path
  2239. want_winidn="yes"
  2240. want_winidn_path="$withval"
  2241. AC_MSG_RESULT([yes ($withval)])
  2242. ;;
  2243. esac
  2244. if test "$want_winidn" = "yes"; then
  2245. dnl winidn library support has been requested
  2246. clean_CPPFLAGS="$CPPFLAGS"
  2247. clean_LDFLAGS="$LDFLAGS"
  2248. clean_LIBS="$LIBS"
  2249. WINIDN_LIBS="-lnormaliz"
  2250. #
  2251. if test "$want_winidn_path" != "default"; then
  2252. dnl path has been specified
  2253. dnl pkg-config not available or provides no info
  2254. WINIDN_LDFLAGS="-L$want_winidn_path/lib$libsuff"
  2255. WINIDN_CPPFLAGS="-I$want_winidn_path/include"
  2256. WINIDN_DIR="$want_winidn_path/lib$libsuff"
  2257. fi
  2258. #
  2259. CPPFLAGS="$WINIDN_CPPFLAGS $CPPFLAGS"
  2260. LDFLAGS="$WINIDN_LDFLAGS $LDFLAGS"
  2261. LIBS="$WINIDN_LIBS $LIBS"
  2262. #
  2263. AC_MSG_CHECKING([if IdnToUnicode can be linked])
  2264. AC_LINK_IFELSE([
  2265. AC_LANG_FUNC_LINK_TRY([IdnToUnicode])
  2266. ],[
  2267. AC_MSG_RESULT([yes])
  2268. tst_links_winidn="yes"
  2269. ],[
  2270. AC_MSG_RESULT([no])
  2271. tst_links_winidn="no"
  2272. ])
  2273. #
  2274. if test "$tst_links_winidn" = "yes"; then
  2275. AC_DEFINE(USE_WIN32_IDN, 1, [Define to 1 if you have the `normaliz' (WinIDN) library (-lnormaliz).])
  2276. AC_DEFINE(WANT_IDN_PROTOTYPES, 1, [Define to 1 to provide own prototypes.])
  2277. AC_SUBST([IDN_ENABLED], [1])
  2278. curl_idn_msg="enabled (Windows-native)"
  2279. else
  2280. AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
  2281. CPPFLAGS="$clean_CPPFLAGS"
  2282. LDFLAGS="$clean_LDFLAGS"
  2283. LIBS="$clean_LIBS"
  2284. fi
  2285. fi
  2286. dnl **********************************************************************
  2287. dnl Check for the presence of IDN libraries and headers
  2288. dnl **********************************************************************
  2289. AC_MSG_CHECKING([whether to build with libidn])
  2290. OPT_IDN="default"
  2291. AC_ARG_WITH(libidn,
  2292. AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage])
  2293. AC_HELP_STRING([--without-libidn],[Disable libidn usage]),
  2294. [OPT_IDN=$withval])
  2295. case "$OPT_IDN" in
  2296. no)
  2297. dnl --without-libidn option used
  2298. want_idn="no"
  2299. AC_MSG_RESULT([no])
  2300. ;;
  2301. default)
  2302. dnl configure option not specified
  2303. want_idn="yes"
  2304. want_idn_path="default"
  2305. AC_MSG_RESULT([(assumed) yes])
  2306. ;;
  2307. yes)
  2308. dnl --with-libidn option used without path
  2309. want_idn="yes"
  2310. want_idn_path="default"
  2311. AC_MSG_RESULT([yes])
  2312. ;;
  2313. *)
  2314. dnl --with-libidn option used with path
  2315. want_idn="yes"
  2316. want_idn_path="$withval"
  2317. AC_MSG_RESULT([yes ($withval)])
  2318. ;;
  2319. esac
  2320. if test "$want_idn" = "yes"; then
  2321. dnl idn library support has been requested
  2322. clean_CPPFLAGS="$CPPFLAGS"
  2323. clean_LDFLAGS="$LDFLAGS"
  2324. clean_LIBS="$LIBS"
  2325. PKGCONFIG="no"
  2326. #
  2327. if test "$want_idn_path" != "default"; then
  2328. dnl path has been specified
  2329. IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig"
  2330. CURL_CHECK_PKGCONFIG(libidn, [$IDN_PCDIR])
  2331. if test "$PKGCONFIG" != "no"; then
  2332. IDN_LIBS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
  2333. $PKGCONFIG --libs-only-l libidn 2>/dev/null`
  2334. IDN_LDFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
  2335. $PKGCONFIG --libs-only-L libidn 2>/dev/null`
  2336. IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
  2337. $PKGCONFIG --cflags-only-I libidn 2>/dev/null`
  2338. IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
  2339. else
  2340. dnl pkg-config not available or provides no info
  2341. IDN_LIBS="-lidn"
  2342. IDN_LDFLAGS="-L$want_idn_path/lib$libsuff"
  2343. IDN_CPPFLAGS="-I$want_idn_path/include"
  2344. IDN_DIR="$want_idn_path/lib$libsuff"
  2345. fi
  2346. else
  2347. dnl path not specified
  2348. CURL_CHECK_PKGCONFIG(libidn)
  2349. if test "$PKGCONFIG" != "no"; then
  2350. IDN_LIBS=`$PKGCONFIG --libs-only-l libidn 2>/dev/null`
  2351. IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn 2>/dev/null`
  2352. IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn 2>/dev/null`
  2353. IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
  2354. else
  2355. dnl pkg-config not available or provides no info
  2356. IDN_LIBS="-lidn"
  2357. fi
  2358. fi
  2359. #
  2360. if test "$PKGCONFIG" != "no"; then
  2361. AC_MSG_NOTICE([pkg-config: IDN_LIBS: "$IDN_LIBS"])
  2362. AC_MSG_NOTICE([pkg-config: IDN_LDFLAGS: "$IDN_LDFLAGS"])
  2363. AC_MSG_NOTICE([pkg-config: IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
  2364. AC_MSG_NOTICE([pkg-config: IDN_DIR: "$IDN_DIR"])
  2365. else
  2366. AC_MSG_NOTICE([IDN_LIBS: "$IDN_LIBS"])
  2367. AC_MSG_NOTICE([IDN_LDFLAGS: "$IDN_LDFLAGS"])
  2368. AC_MSG_NOTICE([IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
  2369. AC_MSG_NOTICE([IDN_DIR: "$IDN_DIR"])
  2370. fi
  2371. #
  2372. CPPFLAGS="$IDN_CPPFLAGS $CPPFLAGS"
  2373. LDFLAGS="$IDN_LDFLAGS $LDFLAGS"
  2374. LIBS="$IDN_LIBS $LIBS"
  2375. #
  2376. AC_MSG_CHECKING([if idna_to_ascii_4i can be linked])
  2377. AC_LINK_IFELSE([
  2378. AC_LANG_FUNC_LINK_TRY([idna_to_ascii_4i])
  2379. ],[
  2380. AC_MSG_RESULT([yes])
  2381. tst_links_libidn="yes"
  2382. ],[
  2383. AC_MSG_RESULT([no])
  2384. tst_links_libidn="no"
  2385. ])
  2386. if test "$tst_links_libidn" = "no"; then
  2387. AC_MSG_CHECKING([if idna_to_ascii_lz can be linked])
  2388. AC_LINK_IFELSE([
  2389. AC_LANG_FUNC_LINK_TRY([idna_to_ascii_lz])
  2390. ],[
  2391. AC_MSG_RESULT([yes])
  2392. tst_links_libidn="yes"
  2393. ],[
  2394. AC_MSG_RESULT([no])
  2395. tst_links_libidn="no"
  2396. ])
  2397. fi
  2398. #
  2399. if test "$tst_links_libidn" = "yes"; then
  2400. AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you have the `idn' library (-lidn).])
  2401. dnl different versions of libidn have different setups of these:
  2402. AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror )
  2403. AC_CHECK_HEADERS( idn-free.h tld.h )
  2404. if test "x$ac_cv_header_tld_h" = "xyes"; then
  2405. AC_SUBST([IDN_ENABLED], [1])
  2406. curl_idn_msg="enabled"
  2407. if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then
  2408. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$IDN_DIR"
  2409. export LD_LIBRARY_PATH
  2410. AC_MSG_NOTICE([Added $IDN_DIR to LD_LIBRARY_PATH])
  2411. fi
  2412. else
  2413. AC_MSG_WARN([Libraries for IDN support too old: IDN disabled])
  2414. CPPFLAGS="$clean_CPPFLAGS"
  2415. LDFLAGS="$clean_LDFLAGS"
  2416. LIBS="$clean_LIBS"
  2417. fi
  2418. else
  2419. AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
  2420. CPPFLAGS="$clean_CPPFLAGS"
  2421. LDFLAGS="$clean_LDFLAGS"
  2422. LIBS="$clean_LIBS"
  2423. fi
  2424. fi
  2425. dnl Let's hope this split URL remains working:
  2426. dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
  2427. dnl genprogc/thread_quick_ref.htm
  2428. dnl **********************************************************************
  2429. dnl Check for nghttp2
  2430. dnl **********************************************************************
  2431. OPT_H2="yes"
  2432. AC_ARG_WITH(nghttp2,
  2433. AC_HELP_STRING([--with-nghttp2=PATH],[Enable nghttp2 usage])
  2434. AC_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]),
  2435. [OPT_H2=$withval])
  2436. case "$OPT_H2" in
  2437. no)
  2438. dnl --without-nghttp2 option used
  2439. want_h2="no"
  2440. ;;
  2441. yes)
  2442. dnl --with-nghttp2 option used without path
  2443. want_h2="default"
  2444. want_h2_path=""
  2445. ;;
  2446. *)
  2447. dnl --with-nghttp2 option used with path
  2448. want_h2="yes"
  2449. want_h2_path="$withval/lib/pkgconfig"
  2450. ;;
  2451. esac
  2452. curl_h2_msg="disabled (--with-nghttp2)"
  2453. if test X"$want_h2" != Xno; then
  2454. dnl backup the pre-nghttp2 variables
  2455. CLEANLDFLAGS="$LDFLAGS"
  2456. CLEANCPPFLAGS="$CPPFLAGS"
  2457. CLEANLIBS="$LIBS"
  2458. CURL_CHECK_PKGCONFIG(libnghttp2, $want_h2_path)
  2459. if test "$PKGCONFIG" != "no" ; then
  2460. LIB_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
  2461. $PKGCONFIG --libs-only-l libnghttp2`
  2462. AC_MSG_NOTICE([-l is $LIB_H2])
  2463. CPP_H2=`CURL_EXPORT_PCDIR([$want_h2_path]) dnl
  2464. $PKGCONFIG --cflags-only-I libnghttp2`
  2465. AC_MSG_NOTICE([-I is $CPP_H2])
  2466. LD_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
  2467. $PKGCONFIG --libs-only-L libnghttp2`
  2468. AC_MSG_NOTICE([-L is $LD_H2])
  2469. LDFLAGS="$LDFLAGS $LD_H2"
  2470. CPPFLAGS="$CPPFLAGS $CPP_H2"
  2471. LIBS="$LIB_H2 $LIBS"
  2472. AC_CHECK_LIB(nghttp2, nghttp2_session_client_new,
  2473. [
  2474. AC_CHECK_HEADERS(nghttp2/nghttp2.h,
  2475. curl_h2_msg="enabled (nghttp2)"
  2476. NGHTTP2_ENABLED=1
  2477. AC_DEFINE(USE_NGHTTP2, 1, [if nghttp2 is in use])
  2478. AC_SUBST(USE_NGHTTP2, [1])
  2479. )
  2480. ],
  2481. dnl not found, revert back to clean variables
  2482. LDFLAGS=$CLEANLDFLAGS
  2483. CPPFLAGS=$CLEANCPPFLAGS
  2484. LIBS=$CLEANLIBS
  2485. )
  2486. else
  2487. dnl no nghttp2 pkg-config found, deal with it
  2488. if test X"$want_h2" != Xdefault; then
  2489. dnl To avoid link errors, we do not allow --with-nghttp2 without
  2490. dnl a pkgconfig file
  2491. AC_MSG_ERROR([--with-nghttp2 was specified but could not find libnghttp2 pkg-config file.])
  2492. fi
  2493. fi
  2494. fi
  2495. dnl **********************************************************************
  2496. dnl Back to "normal" configuring
  2497. dnl **********************************************************************
  2498. dnl Checks for header files.
  2499. AC_HEADER_STDC
  2500. CURL_CHECK_HEADER_MALLOC
  2501. CURL_CHECK_HEADER_MEMORY
  2502. dnl Now check for the very most basic headers. Then we can use these
  2503. dnl ones as default-headers when checking for the rest!
  2504. AC_CHECK_HEADERS(
  2505. sys/types.h \
  2506. sys/time.h \
  2507. sys/select.h \
  2508. sys/socket.h \
  2509. sys/ioctl.h \
  2510. sys/uio.h \
  2511. assert.h \
  2512. unistd.h \
  2513. stdlib.h \
  2514. limits.h \
  2515. arpa/inet.h \
  2516. net/if.h \
  2517. netinet/in.h \
  2518. sys/un.h \
  2519. netinet/tcp.h \
  2520. netdb.h \
  2521. sys/sockio.h \
  2522. sys/stat.h \
  2523. sys/param.h \
  2524. termios.h \
  2525. termio.h \
  2526. sgtty.h \
  2527. fcntl.h \
  2528. alloca.h \
  2529. time.h \
  2530. io.h \
  2531. pwd.h \
  2532. utime.h \
  2533. sys/utime.h \
  2534. sys/poll.h \
  2535. poll.h \
  2536. socket.h \
  2537. sys/resource.h \
  2538. libgen.h \
  2539. locale.h \
  2540. errno.h \
  2541. stdbool.h \
  2542. arpa/tftp.h \
  2543. sys/filio.h \
  2544. sys/wait.h \
  2545. setjmp.h,
  2546. dnl to do if not found
  2547. [],
  2548. dnl to do if found
  2549. [],
  2550. dnl default includes
  2551. [
  2552. #ifdef HAVE_SYS_TYPES_H
  2553. #include <sys/types.h>
  2554. #endif
  2555. #ifdef HAVE_SYS_TIME_H
  2556. #include <sys/time.h>
  2557. #endif
  2558. #ifdef HAVE_SYS_SELECT_H
  2559. #include <sys/select.h>
  2560. #endif
  2561. #ifdef HAVE_SYS_SOCKET_H
  2562. #include <sys/socket.h>
  2563. #endif
  2564. #ifdef HAVE_NETINET_IN_H
  2565. #include <netinet/in.h>
  2566. #endif
  2567. #ifdef HAVE_SYS_UN_H
  2568. #include <sys/un.h>
  2569. #endif
  2570. ]
  2571. )
  2572. dnl Checks for typedefs, structures, and compiler characteristics.
  2573. AC_C_CONST
  2574. CURL_CHECK_VARIADIC_MACROS
  2575. AC_TYPE_SIZE_T
  2576. AC_HEADER_TIME
  2577. CURL_CHECK_STRUCT_TIMEVAL
  2578. CURL_VERIFY_RUNTIMELIBS
  2579. AC_CHECK_SIZEOF(size_t)
  2580. AC_CHECK_SIZEOF(long)
  2581. AC_CHECK_SIZEOF(int)
  2582. AC_CHECK_SIZEOF(short)
  2583. CURL_CONFIGURE_LONG
  2584. AC_CHECK_SIZEOF(time_t)
  2585. AC_CHECK_SIZEOF(off_t)
  2586. soname_bump=no
  2587. if test x"$ac_cv_native_windows" != "xyes" &&
  2588. test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then
  2589. AC_MSG_WARN([This libcurl built is probably not ABI compatible with previous])
  2590. AC_MSG_WARN([builds! You MUST read lib/README.curl_off_t to figure it out.])
  2591. soname_bump=yes
  2592. fi
  2593. AC_CHECK_TYPE(long long,
  2594. [AC_DEFINE(HAVE_LONGLONG, 1,
  2595. [Define to 1 if the compiler supports the 'long long' data type.])]
  2596. longlong="yes"
  2597. )
  2598. if test "xyes" = "x$longlong"; then
  2599. AC_MSG_CHECKING([if numberLL works])
  2600. AC_COMPILE_IFELSE([
  2601. AC_LANG_PROGRAM([[
  2602. ]],[[
  2603. long long val = 1000LL;
  2604. ]])
  2605. ],[
  2606. AC_MSG_RESULT([yes])
  2607. AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
  2608. ],[
  2609. AC_MSG_RESULT([no])
  2610. ])
  2611. fi
  2612. # check for ssize_t
  2613. AC_CHECK_TYPE(ssize_t, ,
  2614. AC_DEFINE(ssize_t, int, [the signed version of size_t]))
  2615. # check for bool type
  2616. AC_CHECK_TYPE([bool],[
  2617. AC_DEFINE(HAVE_BOOL_T, 1,
  2618. [Define to 1 if bool is an available type.])
  2619. ], ,[
  2620. #ifdef HAVE_SYS_TYPES_H
  2621. #include <sys/types.h>
  2622. #endif
  2623. #ifdef HAVE_STDBOOL_H
  2624. #include <stdbool.h>
  2625. #endif
  2626. ])
  2627. CURL_CONFIGURE_CURL_SOCKLEN_T
  2628. CURL_CONFIGURE_PULL_SYS_POLL
  2629. TYPE_IN_ADDR_T
  2630. TYPE_SOCKADDR_STORAGE
  2631. TYPE_SIG_ATOMIC_T
  2632. AC_TYPE_SIGNAL
  2633. CURL_CHECK_FUNC_SELECT
  2634. CURL_CHECK_FUNC_RECV
  2635. CURL_CHECK_FUNC_SEND
  2636. CURL_CHECK_MSG_NOSIGNAL
  2637. CURL_CHECK_FUNC_ALARM
  2638. CURL_CHECK_FUNC_BASENAME
  2639. CURL_CHECK_FUNC_CLOSESOCKET
  2640. CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
  2641. CURL_CHECK_FUNC_CONNECT
  2642. CURL_CHECK_FUNC_FCNTL
  2643. CURL_CHECK_FUNC_FDOPEN
  2644. CURL_CHECK_FUNC_FREEADDRINFO
  2645. CURL_CHECK_FUNC_FREEIFADDRS
  2646. CURL_CHECK_FUNC_FSETXATTR
  2647. CURL_CHECK_FUNC_FTRUNCATE
  2648. CURL_CHECK_FUNC_GETADDRINFO
  2649. CURL_CHECK_FUNC_GAI_STRERROR
  2650. CURL_CHECK_FUNC_GETHOSTBYADDR
  2651. CURL_CHECK_FUNC_GETHOSTBYADDR_R
  2652. CURL_CHECK_FUNC_GETHOSTBYNAME
  2653. CURL_CHECK_FUNC_GETHOSTBYNAME_R
  2654. CURL_CHECK_FUNC_GETHOSTNAME
  2655. CURL_CHECK_FUNC_GETIFADDRS
  2656. CURL_CHECK_FUNC_GETSERVBYPORT_R
  2657. CURL_CHECK_FUNC_GMTIME_R
  2658. CURL_CHECK_FUNC_INET_NTOA_R
  2659. CURL_CHECK_FUNC_INET_NTOP
  2660. CURL_CHECK_FUNC_INET_PTON
  2661. CURL_CHECK_FUNC_IOCTL
  2662. CURL_CHECK_FUNC_IOCTLSOCKET
  2663. CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
  2664. CURL_CHECK_FUNC_LOCALTIME_R
  2665. CURL_CHECK_FUNC_MEMRCHR
  2666. CURL_CHECK_FUNC_POLL
  2667. CURL_CHECK_FUNC_SETSOCKOPT
  2668. CURL_CHECK_FUNC_SIGACTION
  2669. CURL_CHECK_FUNC_SIGINTERRUPT
  2670. CURL_CHECK_FUNC_SIGNAL
  2671. CURL_CHECK_FUNC_SIGSETJMP
  2672. CURL_CHECK_FUNC_SOCKET
  2673. CURL_CHECK_FUNC_SOCKETPAIR
  2674. CURL_CHECK_FUNC_STRCASECMP
  2675. CURL_CHECK_FUNC_STRCMPI
  2676. CURL_CHECK_FUNC_STRDUP
  2677. CURL_CHECK_FUNC_STRERROR_R
  2678. CURL_CHECK_FUNC_STRICMP
  2679. CURL_CHECK_FUNC_STRNCASECMP
  2680. CURL_CHECK_FUNC_STRNCMPI
  2681. CURL_CHECK_FUNC_STRNICMP
  2682. CURL_CHECK_FUNC_STRSTR
  2683. CURL_CHECK_FUNC_STRTOK_R
  2684. CURL_CHECK_FUNC_STRTOLL
  2685. CURL_CHECK_FUNC_WRITEV
  2686. case $host in
  2687. *msdosdjgpp)
  2688. ac_cv_func_pipe=no
  2689. skipcheck_pipe=yes
  2690. AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
  2691. ;;
  2692. esac
  2693. AC_CHECK_FUNCS([fork \
  2694. geteuid \
  2695. getpass_r \
  2696. getppid \
  2697. getprotobyname \
  2698. getpwuid \
  2699. getpwuid_r \
  2700. getrlimit \
  2701. gettimeofday \
  2702. if_nametoindex \
  2703. inet_addr \
  2704. perror \
  2705. pipe \
  2706. setlocale \
  2707. setmode \
  2708. setrlimit \
  2709. uname \
  2710. utime
  2711. ],[
  2712. ],[
  2713. func="$ac_func"
  2714. eval skipcheck=\$skipcheck_$func
  2715. if test "x$skipcheck" != "xyes"; then
  2716. AC_MSG_CHECKING([deeper for $func])
  2717. AC_LINK_IFELSE([
  2718. AC_LANG_PROGRAM([[
  2719. ]],[[
  2720. $func ();
  2721. ]])
  2722. ],[
  2723. AC_MSG_RESULT([yes])
  2724. eval "ac_cv_func_$func=yes"
  2725. AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
  2726. [Define to 1 if you have the $func function.])
  2727. ],[
  2728. AC_MSG_RESULT([but still no])
  2729. ])
  2730. fi
  2731. ])
  2732. dnl Check if the getnameinfo function is available
  2733. dnl and get the types of five of its arguments.
  2734. CURL_CHECK_FUNC_GETNAMEINFO
  2735. if test "$ipv6" = "yes"; then
  2736. if test "$ac_cv_func_getaddrinfo" = "yes"; then
  2737. AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
  2738. IPV6_ENABLED=1
  2739. AC_SUBST(IPV6_ENABLED)
  2740. fi
  2741. CURL_CHECK_NI_WITHSCOPEID
  2742. fi
  2743. CURL_CHECK_NONBLOCKING_SOCKET
  2744. dnl ************************************************************
  2745. dnl nroff tool stuff
  2746. dnl
  2747. AC_PATH_PROG( PERL, perl, ,
  2748. $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
  2749. AC_SUBST(PERL)
  2750. AC_PATH_PROGS( NROFF, gnroff nroff, ,
  2751. $PATH:/usr/bin/:/usr/local/bin )
  2752. AC_SUBST(NROFF)
  2753. if test -n "$NROFF"; then
  2754. dnl only check for nroff options if an nroff command was found
  2755. AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
  2756. MANOPT="-man"
  2757. mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
  2758. if test -z "$mancheck"; then
  2759. MANOPT="-mandoc"
  2760. mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
  2761. if test -z "$mancheck"; then
  2762. MANOPT=""
  2763. AC_MSG_RESULT([failed])
  2764. AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
  2765. else
  2766. AC_MSG_RESULT([$MANOPT])
  2767. fi
  2768. else
  2769. AC_MSG_RESULT([$MANOPT])
  2770. fi
  2771. AC_SUBST(MANOPT)
  2772. fi
  2773. if test -z "$MANOPT"
  2774. then
  2775. dnl if no nroff tool was found, or no option that could convert man pages
  2776. dnl was found, then disable the built-in manual stuff
  2777. AC_MSG_WARN([disabling built-in manual])
  2778. USE_MANUAL="no";
  2779. fi
  2780. dnl *************************************************************************
  2781. dnl If the manual variable still is set, then we go with providing a built-in
  2782. dnl manual
  2783. if test "$USE_MANUAL" = "1"; then
  2784. AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
  2785. curl_manual_msg="enabled"
  2786. fi
  2787. dnl set variable for use in automakefile(s)
  2788. AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
  2789. CURL_CHECK_LIB_ARES
  2790. AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
  2791. if test "x$ac_cv_native_windows" != "xyes" &&
  2792. test "x$enable_shared" = "xyes"; then
  2793. build_libhostname=yes
  2794. else
  2795. build_libhostname=no
  2796. fi
  2797. AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
  2798. CURL_CHECK_OPTION_THREADED_RESOLVER
  2799. if test "x$want_thres" = xyes && test "x$want_ares" = xyes; then
  2800. AC_MSG_ERROR(
  2801. [Options --enable-threaded-resolver and --enable-ares are mutually exclusive])
  2802. fi
  2803. if test "$want_thres" = "yes"; then
  2804. AC_CHECK_HEADER(pthread.h,
  2805. [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
  2806. save_CFLAGS="$CFLAGS"
  2807. dnl first check for function without lib
  2808. AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
  2809. dnl if it wasn't found without lib, search for it in pthread lib
  2810. if test "$USE_THREADS_POSIX" != "1"
  2811. then
  2812. CFLAGS="$CFLAGS -pthread"
  2813. AC_CHECK_LIB(pthread, pthread_create,
  2814. [USE_THREADS_POSIX=1],
  2815. [ CFLAGS="$save_CFLAGS"])
  2816. fi
  2817. if test "x$USE_THREADS_POSIX" = "x1"
  2818. then
  2819. AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
  2820. curl_res_msg="POSIX threaded"
  2821. fi
  2822. ])
  2823. fi
  2824. dnl ************************************************************
  2825. dnl disable verbose text strings
  2826. dnl
  2827. AC_MSG_CHECKING([whether to enable verbose strings])
  2828. AC_ARG_ENABLE(verbose,
  2829. AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
  2830. AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
  2831. [ case "$enableval" in
  2832. no)
  2833. AC_MSG_RESULT(no)
  2834. AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
  2835. curl_verbose_msg="no"
  2836. ;;
  2837. *) AC_MSG_RESULT(yes)
  2838. ;;
  2839. esac ],
  2840. AC_MSG_RESULT(yes)
  2841. )
  2842. dnl ************************************************************
  2843. dnl enable SSPI support
  2844. dnl
  2845. AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
  2846. AC_ARG_ENABLE(sspi,
  2847. AC_HELP_STRING([--enable-sspi],[Enable SSPI])
  2848. AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
  2849. [ case "$enableval" in
  2850. yes)
  2851. if test "$ac_cv_native_windows" = "yes"; then
  2852. AC_MSG_RESULT(yes)
  2853. AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
  2854. AC_SUBST(USE_WINDOWS_SSPI, [1])
  2855. curl_sspi_msg="enabled"
  2856. else
  2857. AC_MSG_RESULT(no)
  2858. AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
  2859. fi
  2860. ;;
  2861. *)
  2862. if test "x$WINSSL_ENABLED" = "x1"; then
  2863. # --with-winssl implies --enable-sspi
  2864. AC_MSG_RESULT(yes)
  2865. else
  2866. AC_MSG_RESULT(no)
  2867. fi
  2868. ;;
  2869. esac ],
  2870. if test "x$WINSSL_ENABLED" = "x1"; then
  2871. # --with-winssl implies --enable-sspi
  2872. AC_MSG_RESULT(yes)
  2873. else
  2874. AC_MSG_RESULT(no)
  2875. fi
  2876. )
  2877. dnl ************************************************************
  2878. dnl disable cryptographic authentication
  2879. dnl
  2880. AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
  2881. AC_ARG_ENABLE(crypto-auth,
  2882. AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
  2883. AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
  2884. [ case "$enableval" in
  2885. no)
  2886. AC_MSG_RESULT(no)
  2887. AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
  2888. CURL_DISABLE_CRYPTO_AUTH=1
  2889. ;;
  2890. *) AC_MSG_RESULT(yes)
  2891. ;;
  2892. esac ],
  2893. AC_MSG_RESULT(yes)
  2894. )
  2895. CURL_CHECK_OPTION_NTLM_WB
  2896. CURL_CHECK_NTLM_WB
  2897. dnl ************************************************************
  2898. dnl disable TLS-SRP authentication
  2899. dnl
  2900. AC_MSG_CHECKING([whether to enable TLS-SRP authentication])
  2901. AC_ARG_ENABLE(tls-srp,
  2902. AC_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication])
  2903. AC_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]),
  2904. [ case "$enableval" in
  2905. no)
  2906. AC_MSG_RESULT(no)
  2907. AC_DEFINE(CURL_DISABLE_TLS_SRP, 1, [to disable TLS-SRP authentication])
  2908. want_tls_srp=no
  2909. ;;
  2910. *) AC_MSG_RESULT(yes)
  2911. want_tls_srp=yes
  2912. ;;
  2913. esac ],
  2914. AC_MSG_RESULT(yes)
  2915. want_tls_srp=yes
  2916. )
  2917. if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_SSLEAY_SRP" = "x1") ; then
  2918. AC_DEFINE(USE_TLS_SRP, 1, [Use TLS-SRP authentication])
  2919. USE_TLS_SRP=1
  2920. curl_tls_srp_msg="enabled"
  2921. fi
  2922. dnl ************************************************************
  2923. dnl disable cookies support
  2924. dnl
  2925. AC_MSG_CHECKING([whether to enable support for cookies])
  2926. AC_ARG_ENABLE(cookies,
  2927. AC_HELP_STRING([--enable-cookies],[Enable cookies support])
  2928. AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
  2929. [ case "$enableval" in
  2930. no)
  2931. AC_MSG_RESULT(no)
  2932. AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
  2933. ;;
  2934. *) AC_MSG_RESULT(yes)
  2935. ;;
  2936. esac ],
  2937. AC_MSG_RESULT(yes)
  2938. )
  2939. dnl ************************************************************
  2940. dnl hiding of library internal symbols
  2941. dnl
  2942. CURL_CONFIGURE_SYMBOL_HIDING
  2943. dnl ************************************************************
  2944. dnl enforce SONAME bump
  2945. dnl
  2946. AC_MSG_CHECKING([whether to enforce SONAME bump])
  2947. AC_ARG_ENABLE(soname-bump,
  2948. AC_HELP_STRING([--enable-soname-bump],[Enable enforced SONAME bump])
  2949. AC_HELP_STRING([--disable-soname-bump],[Disable enforced SONAME bump]),
  2950. [ case "$enableval" in
  2951. yes) AC_MSG_RESULT(yes)
  2952. soname_bump=yes
  2953. ;;
  2954. *)
  2955. AC_MSG_RESULT(no)
  2956. ;;
  2957. esac ],
  2958. AC_MSG_RESULT($soname_bump)
  2959. )
  2960. AM_CONDITIONAL(SONAME_BUMP, test x$soname_bump = xyes)
  2961. dnl
  2962. dnl All the library dependencies put into $LIB apply to libcurl only.
  2963. dnl
  2964. LIBCURL_LIBS=$LIBS
  2965. AC_SUBST(LIBCURL_LIBS)
  2966. AC_SUBST(CURL_NETWORK_LIBS)
  2967. AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
  2968. dnl BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
  2969. dnl LIBS variable used in generated makefile at makefile processing
  2970. dnl time. Doing this functionally prevents LIBS from being used for
  2971. dnl all link targets in given makefile.
  2972. BLANK_AT_MAKETIME=
  2973. AC_SUBST(BLANK_AT_MAKETIME)
  2974. AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
  2975. dnl yes or no
  2976. ENABLE_SHARED="$enable_shared"
  2977. AC_SUBST(ENABLE_SHARED)
  2978. dnl to let curl-config output the static libraries correctly
  2979. ENABLE_STATIC="$enable_static"
  2980. AC_SUBST(ENABLE_STATIC)
  2981. dnl
  2982. dnl For keeping supported features and protocols also in pkg-config file
  2983. dnl since it is more cross-compile friendly than curl-config
  2984. dnl
  2985. if test "x$USE_SSLEAY" = "x1"; then
  2986. SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
  2987. elif test -n "$SSL_ENABLED"; then
  2988. SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
  2989. fi
  2990. if test "x$IPV6_ENABLED" = "x1"; then
  2991. SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
  2992. fi
  2993. if test "x$HAVE_LIBZ" = "x1"; then
  2994. SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
  2995. fi
  2996. if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1"; then
  2997. SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
  2998. fi
  2999. if test "x$IDN_ENABLED" = "x1"; then
  3000. SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
  3001. fi
  3002. if test "x$USE_WINDOWS_SSPI" = "x1"; then
  3003. SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
  3004. fi
  3005. if test "x$CURL_DISABLE_HTTP" != "x1" -a \
  3006. "x$CURL_DISABLE_CRYPTO_AUTH" != "x1"; then
  3007. if test "x$USE_SSLEAY" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
  3008. -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1" \
  3009. -o "x$DARWINSSL_ENABLED" = "x1"; then
  3010. SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
  3011. if test "x$NTLM_WB_ENABLED" = "x1"; then
  3012. SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB"
  3013. fi
  3014. fi
  3015. fi
  3016. if test "x$USE_TLS_SRP" = "x1"; then
  3017. SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
  3018. fi
  3019. if test "x$USE_NGHTTP2" = "x1"; then
  3020. SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2"
  3021. fi
  3022. if test "x$curl_spnego_msg" = "xenabled"; then
  3023. SUPPORT_FEATURES="$SUPPORT_FEATURES SPNEGO"
  3024. fi
  3025. if test "x$want_gss" = "xyes"; then
  3026. SUPPORT_FEATURES="$SUPPORT_FEATURES GSS-API"
  3027. fi
  3028. AC_SUBST(SUPPORT_FEATURES)
  3029. dnl For supported protocols in pkg-config file
  3030. if test "x$CURL_DISABLE_HTTP" != "x1"; then
  3031. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
  3032. if test "x$SSL_ENABLED" = "x1"; then
  3033. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
  3034. fi
  3035. fi
  3036. if test "x$CURL_DISABLE_FTP" != "x1"; then
  3037. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
  3038. if test "x$SSL_ENABLED" = "x1"; then
  3039. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
  3040. fi
  3041. fi
  3042. if test "x$CURL_DISABLE_FILE" != "x1"; then
  3043. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
  3044. fi
  3045. if test "x$CURL_DISABLE_TELNET" != "x1"; then
  3046. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
  3047. fi
  3048. if test "x$CURL_DISABLE_LDAP" != "x1"; then
  3049. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
  3050. if test "x$CURL_DISABLE_LDAPS" != "x1"; then
  3051. if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
  3052. (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then
  3053. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
  3054. fi
  3055. fi
  3056. fi
  3057. if test "x$CURL_DISABLE_DICT" != "x1"; then
  3058. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
  3059. fi
  3060. if test "x$CURL_DISABLE_TFTP" != "x1"; then
  3061. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
  3062. fi
  3063. if test "x$CURL_DISABLE_GOPHER" != "x1"; then
  3064. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
  3065. fi
  3066. if test "x$CURL_DISABLE_POP3" != "x1"; then
  3067. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
  3068. if test "x$SSL_ENABLED" = "x1"; then
  3069. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
  3070. fi
  3071. fi
  3072. if test "x$CURL_DISABLE_IMAP" != "x1"; then
  3073. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
  3074. if test "x$SSL_ENABLED" = "x1"; then
  3075. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
  3076. fi
  3077. fi
  3078. if test "x$CURL_DISABLE_SMTP" != "x1"; then
  3079. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
  3080. if test "x$SSL_ENABLED" = "x1"; then
  3081. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
  3082. fi
  3083. fi
  3084. if test "x$USE_LIBSSH2" = "x1"; then
  3085. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
  3086. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
  3087. fi
  3088. if test "x$CURL_DISABLE_RTSP" != "x1"; then
  3089. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
  3090. fi
  3091. if test "x$USE_LIBRTMP" = "x1"; then
  3092. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
  3093. fi
  3094. dnl replace spaces with newlines
  3095. dnl sort the lines
  3096. dnl replace the newlines back to spaces
  3097. SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
  3098. AC_SUBST(SUPPORT_PROTOCOLS)
  3099. dnl squeeze whitespace out of some variables
  3100. squeeze CFLAGS
  3101. squeeze CPPFLAGS
  3102. squeeze DEFS
  3103. squeeze LDFLAGS
  3104. squeeze LIBS
  3105. squeeze LIBCURL_LIBS
  3106. squeeze CURL_NETWORK_LIBS
  3107. squeeze CURL_NETWORK_AND_TIME_LIBS
  3108. squeeze SUPPORT_FEATURES
  3109. squeeze SUPPORT_PROTOCOLS
  3110. XC_CHECK_BUILD_FLAGS
  3111. if test "x$want_curldebug_assumed" = "xyes" &&
  3112. test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
  3113. ac_configure_args="$ac_configure_args --enable-curldebug"
  3114. fi
  3115. AC_CONFIG_FILES([Makefile \
  3116. docs/Makefile \
  3117. docs/examples/Makefile \
  3118. docs/libcurl/Makefile \
  3119. docs/libcurl/opts/Makefile \
  3120. include/Makefile \
  3121. include/curl/Makefile \
  3122. src/Makefile \
  3123. lib/Makefile \
  3124. lib/libcurl.vers \
  3125. tests/Makefile \
  3126. tests/certs/Makefile \
  3127. tests/certs/scripts/Makefile \
  3128. tests/data/Makefile \
  3129. tests/server/Makefile \
  3130. tests/libtest/Makefile \
  3131. tests/unit/Makefile \
  3132. packages/Makefile \
  3133. packages/Win32/Makefile \
  3134. packages/Win32/cygwin/Makefile \
  3135. packages/Linux/Makefile \
  3136. packages/Linux/RPM/Makefile \
  3137. packages/Linux/RPM/curl.spec \
  3138. packages/Linux/RPM/curl-ssl.spec \
  3139. packages/Solaris/Makefile \
  3140. packages/EPM/curl.list \
  3141. packages/EPM/Makefile \
  3142. packages/vms/Makefile \
  3143. packages/AIX/Makefile \
  3144. packages/AIX/RPM/Makefile \
  3145. packages/AIX/RPM/curl.spec \
  3146. curl-config \
  3147. libcurl.pc
  3148. ])
  3149. AC_OUTPUT
  3150. CURL_GENERATE_CONFIGUREHELP_PM
  3151. XC_AMEND_DISTCLEAN([lib src tests/unit tests/server tests/libtest docs/examples])
  3152. AC_MSG_NOTICE([Configured to build curl/libcurl:
  3153. curl version: ${CURLVERSION}
  3154. Host setup: ${host}
  3155. Install prefix: ${prefix}
  3156. Compiler: ${CC}
  3157. SSL support: ${curl_ssl_msg}
  3158. SSH support: ${curl_ssh_msg}
  3159. zlib support: ${curl_zlib_msg}
  3160. GSS-API support: ${curl_gss_msg}
  3161. SPNEGO support: ${curl_spnego_msg}
  3162. TLS-SRP support: ${curl_tls_srp_msg}
  3163. resolver: ${curl_res_msg}
  3164. ipv6 support: ${curl_ipv6_msg}
  3165. IDN support: ${curl_idn_msg}
  3166. Build libcurl: Shared=${enable_shared}, Static=${enable_static}
  3167. Built-in manual: ${curl_manual_msg}
  3168. --libcurl option: ${curl_libcurl_msg}
  3169. Verbose errors: ${curl_verbose_msg}
  3170. SSPI support: ${curl_sspi_msg}
  3171. ca cert bundle: ${ca}
  3172. ca cert path: ${capath}
  3173. LDAP support: ${curl_ldap_msg}
  3174. LDAPS support: ${curl_ldaps_msg}
  3175. RTSP support: ${curl_rtsp_msg}
  3176. RTMP support: ${curl_rtmp_msg}
  3177. metalink support: ${curl_mtlnk_msg}
  3178. HTTP2 support: ${curl_h2_msg}
  3179. Protocols: ${SUPPORT_PROTOCOLS}
  3180. ])
  3181. if test "x$soname_bump" = "xyes"; then
  3182. cat <<EOM
  3183. SONAME bump: yes - WARNING: this library will be built with the SONAME
  3184. number bumped due to (a detected) ABI breakage.
  3185. See lib/README.curl_off_t for details on this.
  3186. EOM
  3187. fi