You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure.ac 116KB

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