configure.ac 102 KB

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