curl-functions.m4 132 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. #
  10. # This software is licensed as described in the file COPYING, which
  11. # you should have received as part of this distribution. The terms
  12. # are also available at https://curl.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. # SPDX-License-Identifier: curl
  22. #
  23. #***************************************************************************
  24. # File version for 'aclocal' use. Keep it a single number.
  25. # serial 73
  26. dnl CURL_INCLUDES_ARPA_INET
  27. dnl -------------------------------------------------
  28. dnl Set up variable with list of headers that must be
  29. dnl included when arpa/inet.h is to be included.
  30. AC_DEFUN([CURL_INCLUDES_ARPA_INET], [
  31. curl_includes_arpa_inet="\
  32. /* includes start */
  33. #ifdef HAVE_SYS_TYPES_H
  34. # include <sys/types.h>
  35. #endif
  36. #ifdef HAVE_SYS_SOCKET_H
  37. # include <sys/socket.h>
  38. #endif
  39. #ifdef HAVE_NETINET_IN_H
  40. # include <netinet/in.h>
  41. #endif
  42. #ifdef HAVE_ARPA_INET_H
  43. # include <arpa/inet.h>
  44. #endif
  45. #ifdef _WIN32
  46. #include <winsock2.h>
  47. #include <ws2tcpip.h>
  48. #endif
  49. /* includes end */"
  50. AC_CHECK_HEADERS(
  51. sys/types.h sys/socket.h netinet/in.h arpa/inet.h,
  52. [], [], [$curl_includes_arpa_inet])
  53. ])
  54. dnl CURL_INCLUDES_FCNTL
  55. dnl -------------------------------------------------
  56. dnl Set up variable with list of headers that must be
  57. dnl included when fcntl.h is to be included.
  58. AC_DEFUN([CURL_INCLUDES_FCNTL], [
  59. curl_includes_fcntl="\
  60. /* includes start */
  61. #ifdef HAVE_SYS_TYPES_H
  62. # include <sys/types.h>
  63. #endif
  64. #ifdef HAVE_UNISTD_H
  65. # include <unistd.h>
  66. #endif
  67. #ifdef HAVE_FCNTL_H
  68. # include <fcntl.h>
  69. #endif
  70. /* includes end */"
  71. AC_CHECK_HEADERS(
  72. sys/types.h unistd.h fcntl.h,
  73. [], [], [$curl_includes_fcntl])
  74. ])
  75. dnl CURL_INCLUDES_IFADDRS
  76. dnl -------------------------------------------------
  77. dnl Set up variable with list of headers that must be
  78. dnl included when ifaddrs.h is to be included.
  79. AC_DEFUN([CURL_INCLUDES_IFADDRS], [
  80. curl_includes_ifaddrs="\
  81. /* includes start */
  82. #ifdef HAVE_SYS_TYPES_H
  83. # include <sys/types.h>
  84. #endif
  85. #ifdef HAVE_SYS_SOCKET_H
  86. # include <sys/socket.h>
  87. #endif
  88. #ifdef HAVE_NETINET_IN_H
  89. # include <netinet/in.h>
  90. #endif
  91. #ifdef HAVE_IFADDRS_H
  92. # include <ifaddrs.h>
  93. #endif
  94. /* includes end */"
  95. AC_CHECK_HEADERS(
  96. sys/types.h sys/socket.h netinet/in.h ifaddrs.h,
  97. [], [], [$curl_includes_ifaddrs])
  98. ])
  99. dnl CURL_INCLUDES_LIBGEN
  100. dnl -------------------------------------------------
  101. dnl Set up variable with list of headers that must be
  102. dnl included when libgen.h is to be included.
  103. AC_DEFUN([CURL_INCLUDES_LIBGEN], [
  104. curl_includes_libgen="\
  105. /* includes start */
  106. #ifdef HAVE_SYS_TYPES_H
  107. # include <sys/types.h>
  108. #endif
  109. #ifdef HAVE_LIBGEN_H
  110. # include <libgen.h>
  111. #endif
  112. /* includes end */"
  113. AC_CHECK_HEADERS(
  114. sys/types.h libgen.h,
  115. [], [], [$curl_includes_libgen])
  116. ])
  117. dnl CURL_INCLUDES_NETDB
  118. dnl -------------------------------------------------
  119. dnl Set up variable with list of headers that must be
  120. dnl included when netdb.h is to be included.
  121. AC_DEFUN([CURL_INCLUDES_NETDB], [
  122. curl_includes_netdb="\
  123. /* includes start */
  124. #ifdef HAVE_SYS_TYPES_H
  125. # include <sys/types.h>
  126. #endif
  127. #ifdef HAVE_NETDB_H
  128. # include <netdb.h>
  129. #endif
  130. /* includes end */"
  131. AC_CHECK_HEADERS(
  132. sys/types.h netdb.h,
  133. [], [], [$curl_includes_netdb])
  134. ])
  135. dnl CURL_INCLUDES_POLL
  136. dnl -------------------------------------------------
  137. dnl Set up variable with list of headers that must be
  138. dnl included when poll.h is to be included.
  139. AC_DEFUN([CURL_INCLUDES_POLL], [
  140. curl_includes_poll="\
  141. /* includes start */
  142. #ifdef HAVE_SYS_TYPES_H
  143. # include <sys/types.h>
  144. #endif
  145. #ifdef HAVE_POLL_H
  146. # include <poll.h>
  147. #endif
  148. #ifdef HAVE_SYS_POLL_H
  149. # include <sys/poll.h>
  150. #endif
  151. /* includes end */"
  152. AC_CHECK_HEADERS(
  153. sys/types.h poll.h sys/poll.h,
  154. [], [], [$curl_includes_poll])
  155. ])
  156. dnl CURL_INCLUDES_SETJMP
  157. dnl -------------------------------------------------
  158. dnl Set up variable with list of headers that must be
  159. dnl included when setjmp.h is to be included.
  160. AC_DEFUN([CURL_INCLUDES_SETJMP], [
  161. curl_includes_setjmp="\
  162. /* includes start */
  163. #ifdef HAVE_SYS_TYPES_H
  164. # include <sys/types.h>
  165. #endif
  166. #include <setjmp.h>
  167. /* includes end */"
  168. AC_CHECK_HEADERS(
  169. sys/types.h,
  170. [], [], [$curl_includes_setjmp])
  171. ])
  172. dnl CURL_INCLUDES_SIGNAL
  173. dnl -------------------------------------------------
  174. dnl Set up variable with list of headers that must be
  175. dnl included when signal.h is to be included.
  176. AC_DEFUN([CURL_INCLUDES_SIGNAL], [
  177. curl_includes_signal="\
  178. /* includes start */
  179. #ifdef HAVE_SYS_TYPES_H
  180. # include <sys/types.h>
  181. #endif
  182. #include <signal.h>
  183. /* includes end */"
  184. AC_CHECK_HEADERS(
  185. sys/types.h,
  186. [], [], [$curl_includes_signal])
  187. ])
  188. dnl CURL_INCLUDES_SOCKET
  189. dnl -------------------------------------------------
  190. dnl Set up variable with list of headers that must be
  191. dnl included when socket.h is to be included.
  192. AC_DEFUN([CURL_INCLUDES_SOCKET], [
  193. curl_includes_socket="\
  194. /* includes start */
  195. #ifdef HAVE_SYS_TYPES_H
  196. # include <sys/types.h>
  197. #endif
  198. #ifdef HAVE_SOCKET_H
  199. # include <socket.h>
  200. #endif
  201. /* includes end */"
  202. AC_CHECK_HEADERS(
  203. sys/types.h socket.h,
  204. [], [], [$curl_includes_socket])
  205. ])
  206. dnl CURL_INCLUDES_STDLIB
  207. dnl -------------------------------------------------
  208. dnl Set up variable with list of headers that must be
  209. dnl included when stdlib.h is to be included.
  210. AC_DEFUN([CURL_INCLUDES_STDLIB], [
  211. curl_includes_stdlib="\
  212. /* includes start */
  213. #ifdef HAVE_SYS_TYPES_H
  214. # include <sys/types.h>
  215. #endif
  216. #include <stdlib.h>
  217. /* includes end */"
  218. AC_CHECK_HEADERS(
  219. sys/types.h,
  220. [], [], [$curl_includes_stdlib])
  221. ])
  222. dnl CURL_INCLUDES_STRING
  223. dnl -------------------------------------------------
  224. dnl Set up variable with list of headers that must be
  225. dnl included when string(s).h is to be included.
  226. AC_DEFUN([CURL_INCLUDES_STRING], [
  227. curl_includes_string="\
  228. /* includes start */
  229. #ifdef HAVE_SYS_TYPES_H
  230. # include <sys/types.h>
  231. #endif
  232. #include <string.h>
  233. #ifdef HAVE_STRINGS_H
  234. # include <strings.h>
  235. #endif
  236. /* includes end */"
  237. AC_CHECK_HEADERS(
  238. sys/types.h strings.h,
  239. [], [], [$curl_includes_string])
  240. ])
  241. dnl CURL_INCLUDES_STROPTS
  242. dnl -------------------------------------------------
  243. dnl Set up variable with list of headers that must be
  244. dnl included when stropts.h is to be included.
  245. AC_DEFUN([CURL_INCLUDES_STROPTS], [
  246. curl_includes_stropts="\
  247. /* includes start */
  248. #ifdef HAVE_SYS_TYPES_H
  249. # include <sys/types.h>
  250. #endif
  251. #ifdef HAVE_UNISTD_H
  252. # include <unistd.h>
  253. #endif
  254. #ifdef HAVE_SYS_SOCKET_H
  255. # include <sys/socket.h>
  256. #endif
  257. #ifdef HAVE_SYS_IOCTL_H
  258. # include <sys/ioctl.h>
  259. #endif
  260. #ifdef HAVE_STROPTS_H
  261. # include <stropts.h>
  262. #endif
  263. /* includes end */"
  264. AC_CHECK_HEADERS(
  265. sys/types.h unistd.h sys/socket.h sys/ioctl.h stropts.h,
  266. [], [], [$curl_includes_stropts])
  267. ])
  268. dnl CURL_INCLUDES_SYS_SOCKET
  269. dnl -------------------------------------------------
  270. dnl Set up variable with list of headers that must be
  271. dnl included when sys/socket.h is to be included.
  272. AC_DEFUN([CURL_INCLUDES_SYS_SOCKET], [
  273. curl_includes_sys_socket="\
  274. /* includes start */
  275. #ifdef HAVE_SYS_TYPES_H
  276. # include <sys/types.h>
  277. #endif
  278. #ifdef HAVE_SYS_SOCKET_H
  279. # include <sys/socket.h>
  280. #endif
  281. /* includes end */"
  282. AC_CHECK_HEADERS(
  283. sys/types.h sys/socket.h,
  284. [], [], [$curl_includes_sys_socket])
  285. ])
  286. dnl CURL_INCLUDES_SYS_TYPES
  287. dnl -------------------------------------------------
  288. dnl Set up variable with list of headers that must be
  289. dnl included when sys/types.h is to be included.
  290. AC_DEFUN([CURL_INCLUDES_SYS_TYPES], [
  291. curl_includes_sys_types="\
  292. /* includes start */
  293. #ifdef HAVE_SYS_TYPES_H
  294. # include <sys/types.h>
  295. #endif
  296. /* includes end */"
  297. AC_CHECK_HEADERS(
  298. sys/types.h,
  299. [], [], [$curl_includes_sys_types])
  300. ])
  301. dnl CURL_INCLUDES_SYS_XATTR
  302. dnl -------------------------------------------------
  303. dnl Set up variable with list of headers that must be
  304. dnl included when sys/xattr.h is to be included.
  305. AC_DEFUN([CURL_INCLUDES_SYS_XATTR], [
  306. curl_includes_sys_xattr="\
  307. /* includes start */
  308. #ifdef HAVE_SYS_TYPES_H
  309. # include <sys/types.h>
  310. #endif
  311. #ifdef HAVE_SYS_XATTR_H
  312. # include <sys/xattr.h>
  313. #endif
  314. /* includes end */"
  315. AC_CHECK_HEADERS(
  316. sys/types.h sys/xattr.h,
  317. [], [], [$curl_includes_sys_xattr])
  318. ])
  319. dnl CURL_INCLUDES_TIME
  320. dnl -------------------------------------------------
  321. dnl Set up variable with list of headers that must be
  322. dnl included when time.h is to be included.
  323. AC_DEFUN([CURL_INCLUDES_TIME], [
  324. curl_includes_time="\
  325. /* includes start */
  326. #ifdef HAVE_SYS_TYPES_H
  327. # include <sys/types.h>
  328. #endif
  329. #ifdef HAVE_SYS_TIME_H
  330. # include <sys/time.h>
  331. #endif
  332. #include <time.h>
  333. /* includes end */"
  334. AC_CHECK_HEADERS(
  335. sys/types.h sys/time.h,
  336. [], [], [$curl_includes_time])
  337. ])
  338. dnl CURL_INCLUDES_UNISTD
  339. dnl -------------------------------------------------
  340. dnl Set up variable with list of headers that must be
  341. dnl included when unistd.h is to be included.
  342. AC_DEFUN([CURL_INCLUDES_UNISTD], [
  343. curl_includes_unistd="\
  344. /* includes start */
  345. #ifdef HAVE_SYS_TYPES_H
  346. # include <sys/types.h>
  347. #endif
  348. #ifdef HAVE_UNISTD_H
  349. # include <unistd.h>
  350. #endif
  351. /* includes end */"
  352. AC_CHECK_HEADERS(
  353. sys/types.h unistd.h,
  354. [], [], [$curl_includes_unistd])
  355. ])
  356. dnl CURL_INCLUDES_WINSOCK2
  357. dnl -------------------------------------------------
  358. dnl Set up variable with list of headers that must be
  359. dnl included when winsock2.h is to be included.
  360. AC_DEFUN([CURL_INCLUDES_WINSOCK2], [
  361. curl_includes_winsock2="\
  362. /* includes start */
  363. #ifdef _WIN32
  364. # ifndef WIN32_LEAN_AND_MEAN
  365. # define WIN32_LEAN_AND_MEAN
  366. # endif
  367. # include <winsock2.h>
  368. #endif
  369. /* includes end */"
  370. CURL_CHECK_NATIVE_WINDOWS
  371. ])
  372. dnl CURL_INCLUDES_WS2TCPIP
  373. dnl -------------------------------------------------
  374. dnl Set up variable with list of headers that must be
  375. dnl included when ws2tcpip.h is to be included.
  376. AC_DEFUN([CURL_INCLUDES_WS2TCPIP], [
  377. curl_includes_ws2tcpip="\
  378. /* includes start */
  379. #ifdef _WIN32
  380. # ifndef WIN32_LEAN_AND_MEAN
  381. # define WIN32_LEAN_AND_MEAN
  382. # endif
  383. # include <winsock2.h>
  384. # include <ws2tcpip.h>
  385. #endif
  386. /* includes end */"
  387. CURL_CHECK_NATIVE_WINDOWS
  388. ])
  389. dnl CURL_INCLUDES_BSDSOCKET
  390. dnl -------------------------------------------------
  391. dnl Set up variable with list of headers that must be
  392. dnl included when bsdsocket.h is to be included.
  393. AC_DEFUN([CURL_INCLUDES_BSDSOCKET], [
  394. curl_includes_bsdsocket="\
  395. /* includes start */
  396. #if defined(HAVE_PROTO_BSDSOCKET_H)
  397. # define __NO_NET_API
  398. # define __USE_INLINE__
  399. # include <proto/bsdsocket.h>
  400. # ifdef HAVE_SYS_IOCTL_H
  401. # include <sys/ioctl.h>
  402. # endif
  403. # ifdef __amigaos4__
  404. struct SocketIFace *ISocket = NULL;
  405. # else
  406. struct Library *SocketBase = NULL;
  407. # endif
  408. # define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
  409. #endif
  410. /* includes end */"
  411. AC_CHECK_HEADERS(
  412. proto/bsdsocket.h,
  413. [], [], [$curl_includes_bsdsocket])
  414. ])
  415. dnl CURL_INCLUDES_NETIF
  416. dnl -------------------------------------------------
  417. dnl Set up variable with list of headers that must be
  418. dnl included when net/if.h is to be included.
  419. AC_DEFUN([CURL_INCLUDES_NETIF], [
  420. curl_includes_netif="\
  421. /* includes start */
  422. #ifdef HAVE_NET_IF_H
  423. # include <net/if.h>
  424. #endif
  425. /* includes end */"
  426. AC_CHECK_HEADERS(
  427. net/if.h,
  428. [], [], [$curl_includes_netif])
  429. ])
  430. dnl CURL_PREPROCESS_CALLCONV
  431. dnl -------------------------------------------------
  432. dnl Set up variable with a preprocessor block which
  433. dnl defines function calling convention.
  434. AC_DEFUN([CURL_PREPROCESS_CALLCONV], [
  435. curl_preprocess_callconv="\
  436. /* preprocess start */
  437. #ifdef _WIN32
  438. # define FUNCALLCONV __stdcall
  439. #else
  440. # define FUNCALLCONV
  441. #endif
  442. /* preprocess end */"
  443. ])
  444. dnl CURL_CHECK_FUNC_ALARM
  445. dnl -------------------------------------------------
  446. dnl Verify if alarm is available, prototyped, and
  447. dnl can be compiled. If all of these are true, and
  448. dnl usage has not been previously disallowed with
  449. dnl shell variable curl_disallow_alarm, then
  450. dnl HAVE_ALARM will be defined.
  451. AC_DEFUN([CURL_CHECK_FUNC_ALARM], [
  452. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  453. #
  454. tst_links_alarm="unknown"
  455. tst_proto_alarm="unknown"
  456. tst_compi_alarm="unknown"
  457. tst_allow_alarm="unknown"
  458. #
  459. AC_MSG_CHECKING([if alarm can be linked])
  460. AC_LINK_IFELSE([
  461. AC_LANG_FUNC_LINK_TRY([alarm])
  462. ],[
  463. AC_MSG_RESULT([yes])
  464. tst_links_alarm="yes"
  465. ],[
  466. AC_MSG_RESULT([no])
  467. tst_links_alarm="no"
  468. ])
  469. #
  470. if test "$tst_links_alarm" = "yes"; then
  471. AC_MSG_CHECKING([if alarm is prototyped])
  472. AC_EGREP_CPP([alarm],[
  473. $curl_includes_unistd
  474. ],[
  475. AC_MSG_RESULT([yes])
  476. tst_proto_alarm="yes"
  477. ],[
  478. AC_MSG_RESULT([no])
  479. tst_proto_alarm="no"
  480. ])
  481. fi
  482. #
  483. if test "$tst_proto_alarm" = "yes"; then
  484. AC_MSG_CHECKING([if alarm is compilable])
  485. AC_COMPILE_IFELSE([
  486. AC_LANG_PROGRAM([[
  487. $curl_includes_unistd
  488. ]],[[
  489. if(0 != alarm(0))
  490. return 1;
  491. ]])
  492. ],[
  493. AC_MSG_RESULT([yes])
  494. tst_compi_alarm="yes"
  495. ],[
  496. AC_MSG_RESULT([no])
  497. tst_compi_alarm="no"
  498. ])
  499. fi
  500. #
  501. if test "$tst_compi_alarm" = "yes"; then
  502. AC_MSG_CHECKING([if alarm usage allowed])
  503. if test "x$curl_disallow_alarm" != "xyes"; then
  504. AC_MSG_RESULT([yes])
  505. tst_allow_alarm="yes"
  506. else
  507. AC_MSG_RESULT([no])
  508. tst_allow_alarm="no"
  509. fi
  510. fi
  511. #
  512. AC_MSG_CHECKING([if alarm might be used])
  513. if test "$tst_links_alarm" = "yes" &&
  514. test "$tst_proto_alarm" = "yes" &&
  515. test "$tst_compi_alarm" = "yes" &&
  516. test "$tst_allow_alarm" = "yes"; then
  517. AC_MSG_RESULT([yes])
  518. AC_DEFINE_UNQUOTED(HAVE_ALARM, 1,
  519. [Define to 1 if you have the alarm function.])
  520. curl_cv_func_alarm="yes"
  521. else
  522. AC_MSG_RESULT([no])
  523. curl_cv_func_alarm="no"
  524. fi
  525. ])
  526. dnl CURL_CHECK_FUNC_BASENAME
  527. dnl -------------------------------------------------
  528. dnl Verify if basename is available, prototyped, and
  529. dnl can be compiled. If all of these are true, and
  530. dnl usage has not been previously disallowed with
  531. dnl shell variable curl_disallow_basename, then
  532. dnl HAVE_BASENAME will be defined.
  533. AC_DEFUN([CURL_CHECK_FUNC_BASENAME], [
  534. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  535. AC_REQUIRE([CURL_INCLUDES_LIBGEN])dnl
  536. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  537. #
  538. tst_links_basename="unknown"
  539. tst_proto_basename="unknown"
  540. tst_compi_basename="unknown"
  541. tst_allow_basename="unknown"
  542. #
  543. AC_MSG_CHECKING([if basename can be linked])
  544. AC_LINK_IFELSE([
  545. AC_LANG_FUNC_LINK_TRY([basename])
  546. ],[
  547. AC_MSG_RESULT([yes])
  548. tst_links_basename="yes"
  549. ],[
  550. AC_MSG_RESULT([no])
  551. tst_links_basename="no"
  552. ])
  553. #
  554. if test "$tst_links_basename" = "yes"; then
  555. AC_MSG_CHECKING([if basename is prototyped])
  556. AC_EGREP_CPP([basename],[
  557. $curl_includes_string
  558. $curl_includes_libgen
  559. $curl_includes_unistd
  560. ],[
  561. AC_MSG_RESULT([yes])
  562. tst_proto_basename="yes"
  563. ],[
  564. AC_MSG_RESULT([no])
  565. tst_proto_basename="no"
  566. ])
  567. fi
  568. #
  569. if test "$tst_proto_basename" = "yes"; then
  570. AC_MSG_CHECKING([if basename is compilable])
  571. AC_COMPILE_IFELSE([
  572. AC_LANG_PROGRAM([[
  573. $curl_includes_string
  574. $curl_includes_libgen
  575. $curl_includes_unistd
  576. ]],[[
  577. if(0 != basename(0))
  578. return 1;
  579. ]])
  580. ],[
  581. AC_MSG_RESULT([yes])
  582. tst_compi_basename="yes"
  583. ],[
  584. AC_MSG_RESULT([no])
  585. tst_compi_basename="no"
  586. ])
  587. fi
  588. #
  589. if test "$tst_compi_basename" = "yes"; then
  590. AC_MSG_CHECKING([if basename usage allowed])
  591. if test "x$curl_disallow_basename" != "xyes"; then
  592. AC_MSG_RESULT([yes])
  593. tst_allow_basename="yes"
  594. else
  595. AC_MSG_RESULT([no])
  596. tst_allow_basename="no"
  597. fi
  598. fi
  599. #
  600. AC_MSG_CHECKING([if basename might be used])
  601. if test "$tst_links_basename" = "yes" &&
  602. test "$tst_proto_basename" = "yes" &&
  603. test "$tst_compi_basename" = "yes" &&
  604. test "$tst_allow_basename" = "yes"; then
  605. AC_MSG_RESULT([yes])
  606. AC_DEFINE_UNQUOTED(HAVE_BASENAME, 1,
  607. [Define to 1 if you have the basename function.])
  608. curl_cv_func_basename="yes"
  609. else
  610. AC_MSG_RESULT([no])
  611. curl_cv_func_basename="no"
  612. fi
  613. ])
  614. dnl CURL_CHECK_FUNC_CLOSESOCKET
  615. dnl -------------------------------------------------
  616. dnl Verify if closesocket is available, prototyped, and
  617. dnl can be compiled. If all of these are true, and
  618. dnl usage has not been previously disallowed with
  619. dnl shell variable curl_disallow_closesocket, then
  620. dnl HAVE_CLOSESOCKET will be defined.
  621. AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET], [
  622. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  623. AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
  624. #
  625. tst_links_closesocket="unknown"
  626. tst_proto_closesocket="unknown"
  627. tst_compi_closesocket="unknown"
  628. tst_allow_closesocket="unknown"
  629. #
  630. AC_MSG_CHECKING([if closesocket can be linked])
  631. AC_LINK_IFELSE([
  632. AC_LANG_PROGRAM([[
  633. $curl_includes_winsock2
  634. $curl_includes_socket
  635. ]],[[
  636. if(0 != closesocket(0))
  637. return 1;
  638. ]])
  639. ],[
  640. AC_MSG_RESULT([yes])
  641. tst_links_closesocket="yes"
  642. ],[
  643. AC_MSG_RESULT([no])
  644. tst_links_closesocket="no"
  645. ])
  646. #
  647. if test "$tst_links_closesocket" = "yes"; then
  648. AC_MSG_CHECKING([if closesocket is prototyped])
  649. AC_EGREP_CPP([closesocket],[
  650. $curl_includes_winsock2
  651. $curl_includes_socket
  652. ],[
  653. AC_MSG_RESULT([yes])
  654. tst_proto_closesocket="yes"
  655. ],[
  656. AC_MSG_RESULT([no])
  657. tst_proto_closesocket="no"
  658. ])
  659. fi
  660. #
  661. if test "$tst_proto_closesocket" = "yes"; then
  662. AC_MSG_CHECKING([if closesocket is compilable])
  663. AC_COMPILE_IFELSE([
  664. AC_LANG_PROGRAM([[
  665. $curl_includes_winsock2
  666. $curl_includes_socket
  667. ]],[[
  668. if(0 != closesocket(0))
  669. return 1;
  670. ]])
  671. ],[
  672. AC_MSG_RESULT([yes])
  673. tst_compi_closesocket="yes"
  674. ],[
  675. AC_MSG_RESULT([no])
  676. tst_compi_closesocket="no"
  677. ])
  678. fi
  679. #
  680. if test "$tst_compi_closesocket" = "yes"; then
  681. AC_MSG_CHECKING([if closesocket usage allowed])
  682. if test "x$curl_disallow_closesocket" != "xyes"; then
  683. AC_MSG_RESULT([yes])
  684. tst_allow_closesocket="yes"
  685. else
  686. AC_MSG_RESULT([no])
  687. tst_allow_closesocket="no"
  688. fi
  689. fi
  690. #
  691. AC_MSG_CHECKING([if closesocket might be used])
  692. if test "$tst_links_closesocket" = "yes" &&
  693. test "$tst_proto_closesocket" = "yes" &&
  694. test "$tst_compi_closesocket" = "yes" &&
  695. test "$tst_allow_closesocket" = "yes"; then
  696. AC_MSG_RESULT([yes])
  697. AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET, 1,
  698. [Define to 1 if you have the closesocket function.])
  699. curl_cv_func_closesocket="yes"
  700. else
  701. AC_MSG_RESULT([no])
  702. curl_cv_func_closesocket="no"
  703. fi
  704. ])
  705. dnl CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
  706. dnl -------------------------------------------------
  707. dnl Verify if CloseSocket is available, prototyped, and
  708. dnl can be compiled. If all of these are true, and
  709. dnl usage has not been previously disallowed with
  710. dnl shell variable curl_disallow_closesocket_camel,
  711. dnl then HAVE_CLOSESOCKET_CAMEL will be defined.
  712. AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET_CAMEL], [
  713. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  714. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  715. #
  716. tst_links_closesocket_camel="unknown"
  717. tst_proto_closesocket_camel="unknown"
  718. tst_compi_closesocket_camel="unknown"
  719. tst_allow_closesocket_camel="unknown"
  720. #
  721. AC_MSG_CHECKING([if CloseSocket can be linked])
  722. AC_LINK_IFELSE([
  723. AC_LANG_PROGRAM([[
  724. $curl_includes_bsdsocket
  725. $curl_includes_sys_socket
  726. ]],[[
  727. if(0 != CloseSocket(0))
  728. return 1;
  729. ]])
  730. ],[
  731. AC_MSG_RESULT([yes])
  732. tst_links_closesocket_camel="yes"
  733. ],[
  734. AC_MSG_RESULT([no])
  735. tst_links_closesocket_camel="no"
  736. ])
  737. #
  738. if test "$tst_links_closesocket_camel" = "yes"; then
  739. AC_MSG_CHECKING([if CloseSocket is prototyped])
  740. AC_EGREP_CPP([CloseSocket],[
  741. $curl_includes_bsdsocket
  742. $curl_includes_sys_socket
  743. ],[
  744. AC_MSG_RESULT([yes])
  745. tst_proto_closesocket_camel="yes"
  746. ],[
  747. AC_MSG_RESULT([no])
  748. tst_proto_closesocket_camel="no"
  749. ])
  750. fi
  751. #
  752. if test "$tst_proto_closesocket_camel" = "yes"; then
  753. AC_MSG_CHECKING([if CloseSocket is compilable])
  754. AC_COMPILE_IFELSE([
  755. AC_LANG_PROGRAM([[
  756. $curl_includes_bsdsocket
  757. $curl_includes_sys_socket
  758. ]],[[
  759. if(0 != CloseSocket(0))
  760. return 1;
  761. ]])
  762. ],[
  763. AC_MSG_RESULT([yes])
  764. tst_compi_closesocket_camel="yes"
  765. ],[
  766. AC_MSG_RESULT([no])
  767. tst_compi_closesocket_camel="no"
  768. ])
  769. fi
  770. #
  771. if test "$tst_compi_closesocket_camel" = "yes"; then
  772. AC_MSG_CHECKING([if CloseSocket usage allowed])
  773. if test "x$curl_disallow_closesocket_camel" != "xyes"; then
  774. AC_MSG_RESULT([yes])
  775. tst_allow_closesocket_camel="yes"
  776. else
  777. AC_MSG_RESULT([no])
  778. tst_allow_closesocket_camel="no"
  779. fi
  780. fi
  781. #
  782. AC_MSG_CHECKING([if CloseSocket might be used])
  783. if test "$tst_links_closesocket_camel" = "yes" &&
  784. test "$tst_proto_closesocket_camel" = "yes" &&
  785. test "$tst_compi_closesocket_camel" = "yes" &&
  786. test "$tst_allow_closesocket_camel" = "yes"; then
  787. AC_MSG_RESULT([yes])
  788. AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET_CAMEL, 1,
  789. [Define to 1 if you have the CloseSocket camel case function.])
  790. curl_cv_func_closesocket_camel="yes"
  791. else
  792. AC_MSG_RESULT([no])
  793. curl_cv_func_closesocket_camel="no"
  794. fi
  795. ])
  796. dnl CURL_CHECK_FUNC_FCNTL
  797. dnl -------------------------------------------------
  798. dnl Verify if fcntl is available, prototyped, and
  799. dnl can be compiled. If all of these are true, and
  800. dnl usage has not been previously disallowed with
  801. dnl shell variable curl_disallow_fcntl, then
  802. dnl HAVE_FCNTL will be defined.
  803. AC_DEFUN([CURL_CHECK_FUNC_FCNTL], [
  804. AC_REQUIRE([CURL_INCLUDES_FCNTL])dnl
  805. #
  806. tst_links_fcntl="unknown"
  807. tst_proto_fcntl="unknown"
  808. tst_compi_fcntl="unknown"
  809. tst_allow_fcntl="unknown"
  810. #
  811. AC_MSG_CHECKING([if fcntl can be linked])
  812. AC_LINK_IFELSE([
  813. AC_LANG_FUNC_LINK_TRY([fcntl])
  814. ],[
  815. AC_MSG_RESULT([yes])
  816. tst_links_fcntl="yes"
  817. ],[
  818. AC_MSG_RESULT([no])
  819. tst_links_fcntl="no"
  820. ])
  821. #
  822. if test "$tst_links_fcntl" = "yes"; then
  823. AC_MSG_CHECKING([if fcntl is prototyped])
  824. AC_EGREP_CPP([fcntl],[
  825. $curl_includes_fcntl
  826. ],[
  827. AC_MSG_RESULT([yes])
  828. tst_proto_fcntl="yes"
  829. ],[
  830. AC_MSG_RESULT([no])
  831. tst_proto_fcntl="no"
  832. ])
  833. fi
  834. #
  835. if test "$tst_proto_fcntl" = "yes"; then
  836. AC_MSG_CHECKING([if fcntl is compilable])
  837. AC_COMPILE_IFELSE([
  838. AC_LANG_PROGRAM([[
  839. $curl_includes_fcntl
  840. ]],[[
  841. if(0 != fcntl(0, 0, 0))
  842. return 1;
  843. ]])
  844. ],[
  845. AC_MSG_RESULT([yes])
  846. tst_compi_fcntl="yes"
  847. ],[
  848. AC_MSG_RESULT([no])
  849. tst_compi_fcntl="no"
  850. ])
  851. fi
  852. #
  853. if test "$tst_compi_fcntl" = "yes"; then
  854. AC_MSG_CHECKING([if fcntl usage allowed])
  855. if test "x$curl_disallow_fcntl" != "xyes"; then
  856. AC_MSG_RESULT([yes])
  857. tst_allow_fcntl="yes"
  858. else
  859. AC_MSG_RESULT([no])
  860. tst_allow_fcntl="no"
  861. fi
  862. fi
  863. #
  864. AC_MSG_CHECKING([if fcntl might be used])
  865. if test "$tst_links_fcntl" = "yes" &&
  866. test "$tst_proto_fcntl" = "yes" &&
  867. test "$tst_compi_fcntl" = "yes" &&
  868. test "$tst_allow_fcntl" = "yes"; then
  869. AC_MSG_RESULT([yes])
  870. AC_DEFINE_UNQUOTED(HAVE_FCNTL, 1,
  871. [Define to 1 if you have the fcntl function.])
  872. curl_cv_func_fcntl="yes"
  873. CURL_CHECK_FUNC_FCNTL_O_NONBLOCK
  874. else
  875. AC_MSG_RESULT([no])
  876. curl_cv_func_fcntl="no"
  877. fi
  878. ])
  879. dnl CURL_CHECK_FUNC_FCNTL_O_NONBLOCK
  880. dnl -------------------------------------------------
  881. dnl Verify if fcntl with status flag O_NONBLOCK is
  882. dnl available, can be compiled, and seems to work. If
  883. dnl all of these are true, then HAVE_FCNTL_O_NONBLOCK
  884. dnl will be defined.
  885. AC_DEFUN([CURL_CHECK_FUNC_FCNTL_O_NONBLOCK], [
  886. #
  887. tst_compi_fcntl_o_nonblock="unknown"
  888. tst_allow_fcntl_o_nonblock="unknown"
  889. #
  890. case $host_os in
  891. sunos4* | aix3*)
  892. dnl O_NONBLOCK does not work on these platforms
  893. curl_disallow_fcntl_o_nonblock="yes"
  894. ;;
  895. esac
  896. #
  897. if test "$curl_cv_func_fcntl" = "yes"; then
  898. AC_MSG_CHECKING([if fcntl O_NONBLOCK is compilable])
  899. AC_COMPILE_IFELSE([
  900. AC_LANG_PROGRAM([[
  901. $curl_includes_fcntl
  902. ]],[[
  903. int flags = 0;
  904. if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK))
  905. return 1;
  906. ]])
  907. ],[
  908. AC_MSG_RESULT([yes])
  909. tst_compi_fcntl_o_nonblock="yes"
  910. ],[
  911. AC_MSG_RESULT([no])
  912. tst_compi_fcntl_o_nonblock="no"
  913. ])
  914. fi
  915. #
  916. if test "$tst_compi_fcntl_o_nonblock" = "yes"; then
  917. AC_MSG_CHECKING([if fcntl O_NONBLOCK usage allowed])
  918. if test "x$curl_disallow_fcntl_o_nonblock" != "xyes"; then
  919. AC_MSG_RESULT([yes])
  920. tst_allow_fcntl_o_nonblock="yes"
  921. else
  922. AC_MSG_RESULT([no])
  923. tst_allow_fcntl_o_nonblock="no"
  924. fi
  925. fi
  926. #
  927. AC_MSG_CHECKING([if fcntl O_NONBLOCK might be used])
  928. if test "$tst_compi_fcntl_o_nonblock" = "yes" &&
  929. test "$tst_allow_fcntl_o_nonblock" = "yes"; then
  930. AC_MSG_RESULT([yes])
  931. AC_DEFINE_UNQUOTED(HAVE_FCNTL_O_NONBLOCK, 1,
  932. [Define to 1 if you have a working fcntl O_NONBLOCK function.])
  933. curl_cv_func_fcntl_o_nonblock="yes"
  934. else
  935. AC_MSG_RESULT([no])
  936. curl_cv_func_fcntl_o_nonblock="no"
  937. fi
  938. ])
  939. dnl CURL_CHECK_FUNC_FREEADDRINFO
  940. dnl -------------------------------------------------
  941. dnl Verify if freeaddrinfo is available, prototyped,
  942. dnl and can be compiled. If all of these are true,
  943. dnl and usage has not been previously disallowed with
  944. dnl shell variable curl_disallow_freeaddrinfo, then
  945. dnl HAVE_FREEADDRINFO will be defined.
  946. AC_DEFUN([CURL_CHECK_FUNC_FREEADDRINFO], [
  947. AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl
  948. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  949. AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
  950. #
  951. tst_links_freeaddrinfo="unknown"
  952. tst_proto_freeaddrinfo="unknown"
  953. tst_compi_freeaddrinfo="unknown"
  954. tst_allow_freeaddrinfo="unknown"
  955. #
  956. AC_MSG_CHECKING([if freeaddrinfo can be linked])
  957. AC_LINK_IFELSE([
  958. AC_LANG_PROGRAM([[
  959. $curl_includes_ws2tcpip
  960. $curl_includes_sys_socket
  961. $curl_includes_netdb
  962. ]],[[
  963. freeaddrinfo(0);
  964. ]])
  965. ],[
  966. AC_MSG_RESULT([yes])
  967. tst_links_freeaddrinfo="yes"
  968. ],[
  969. AC_MSG_RESULT([no])
  970. tst_links_freeaddrinfo="no"
  971. ])
  972. #
  973. if test "$tst_links_freeaddrinfo" = "yes"; then
  974. AC_MSG_CHECKING([if freeaddrinfo is prototyped])
  975. AC_EGREP_CPP([freeaddrinfo],[
  976. $curl_includes_ws2tcpip
  977. $curl_includes_sys_socket
  978. $curl_includes_netdb
  979. ],[
  980. AC_MSG_RESULT([yes])
  981. tst_proto_freeaddrinfo="yes"
  982. ],[
  983. AC_MSG_RESULT([no])
  984. tst_proto_freeaddrinfo="no"
  985. ])
  986. fi
  987. #
  988. if test "$tst_proto_freeaddrinfo" = "yes"; then
  989. AC_MSG_CHECKING([if freeaddrinfo is compilable])
  990. AC_COMPILE_IFELSE([
  991. AC_LANG_PROGRAM([[
  992. $curl_includes_ws2tcpip
  993. $curl_includes_sys_socket
  994. $curl_includes_netdb
  995. ]],[[
  996. freeaddrinfo(0);
  997. ]])
  998. ],[
  999. AC_MSG_RESULT([yes])
  1000. tst_compi_freeaddrinfo="yes"
  1001. ],[
  1002. AC_MSG_RESULT([no])
  1003. tst_compi_freeaddrinfo="no"
  1004. ])
  1005. fi
  1006. #
  1007. if test "$tst_compi_freeaddrinfo" = "yes"; then
  1008. AC_MSG_CHECKING([if freeaddrinfo usage allowed])
  1009. if test "x$curl_disallow_freeaddrinfo" != "xyes"; then
  1010. AC_MSG_RESULT([yes])
  1011. tst_allow_freeaddrinfo="yes"
  1012. else
  1013. AC_MSG_RESULT([no])
  1014. tst_allow_freeaddrinfo="no"
  1015. fi
  1016. fi
  1017. #
  1018. AC_MSG_CHECKING([if freeaddrinfo might be used])
  1019. if test "$tst_links_freeaddrinfo" = "yes" &&
  1020. test "$tst_proto_freeaddrinfo" = "yes" &&
  1021. test "$tst_compi_freeaddrinfo" = "yes" &&
  1022. test "$tst_allow_freeaddrinfo" = "yes"; then
  1023. AC_MSG_RESULT([yes])
  1024. AC_DEFINE_UNQUOTED(HAVE_FREEADDRINFO, 1,
  1025. [Define to 1 if you have the freeaddrinfo function.])
  1026. curl_cv_func_freeaddrinfo="yes"
  1027. else
  1028. AC_MSG_RESULT([no])
  1029. curl_cv_func_freeaddrinfo="no"
  1030. fi
  1031. ])
  1032. dnl CURL_CHECK_FUNC_FSETXATTR
  1033. dnl -------------------------------------------------
  1034. dnl Verify if fsetxattr is available, prototyped, and
  1035. dnl can be compiled. If all of these are true, and
  1036. dnl usage has not been previously disallowed with
  1037. dnl shell variable curl_disallow_fsetxattr, then
  1038. dnl HAVE_FSETXATTR will be defined.
  1039. AC_DEFUN([CURL_CHECK_FUNC_FSETXATTR], [
  1040. AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
  1041. #
  1042. tst_links_fsetxattr="unknown"
  1043. tst_proto_fsetxattr="unknown"
  1044. tst_compi_fsetxattr="unknown"
  1045. tst_allow_fsetxattr="unknown"
  1046. tst_nargs_fsetxattr="unknown"
  1047. #
  1048. AC_MSG_CHECKING([if fsetxattr can be linked])
  1049. AC_LINK_IFELSE([
  1050. AC_LANG_FUNC_LINK_TRY([fsetxattr])
  1051. ],[
  1052. AC_MSG_RESULT([yes])
  1053. tst_links_fsetxattr="yes"
  1054. ],[
  1055. AC_MSG_RESULT([no])
  1056. tst_links_fsetxattr="no"
  1057. ])
  1058. #
  1059. if test "$tst_links_fsetxattr" = "yes"; then
  1060. AC_MSG_CHECKING([if fsetxattr is prototyped])
  1061. AC_EGREP_CPP([fsetxattr],[
  1062. $curl_includes_sys_xattr
  1063. ],[
  1064. AC_MSG_RESULT([yes])
  1065. tst_proto_fsetxattr="yes"
  1066. ],[
  1067. AC_MSG_RESULT([no])
  1068. tst_proto_fsetxattr="no"
  1069. ])
  1070. fi
  1071. #
  1072. if test "$tst_proto_fsetxattr" = "yes"; then
  1073. if test "$tst_nargs_fsetxattr" = "unknown"; then
  1074. AC_MSG_CHECKING([if fsetxattr takes 5 args.])
  1075. AC_COMPILE_IFELSE([
  1076. AC_LANG_PROGRAM([[
  1077. $curl_includes_sys_xattr
  1078. ]],[[
  1079. if(0 != fsetxattr(0, 0, 0, 0, 0))
  1080. return 1;
  1081. ]])
  1082. ],[
  1083. AC_MSG_RESULT([yes])
  1084. tst_compi_fsetxattr="yes"
  1085. tst_nargs_fsetxattr="5"
  1086. ],[
  1087. AC_MSG_RESULT([no])
  1088. tst_compi_fsetxattr="no"
  1089. ])
  1090. fi
  1091. if test "$tst_nargs_fsetxattr" = "unknown"; then
  1092. AC_MSG_CHECKING([if fsetxattr takes 6 args.])
  1093. AC_COMPILE_IFELSE([
  1094. AC_LANG_PROGRAM([[
  1095. $curl_includes_sys_xattr
  1096. ]],[[
  1097. if(0 != fsetxattr(0, 0, 0, 0, 0, 0))
  1098. return 1;
  1099. ]])
  1100. ],[
  1101. AC_MSG_RESULT([yes])
  1102. tst_compi_fsetxattr="yes"
  1103. tst_nargs_fsetxattr="6"
  1104. ],[
  1105. AC_MSG_RESULT([no])
  1106. tst_compi_fsetxattr="no"
  1107. ])
  1108. fi
  1109. AC_MSG_CHECKING([if fsetxattr is compilable])
  1110. if test "$tst_compi_fsetxattr" = "yes"; then
  1111. AC_MSG_RESULT([yes])
  1112. else
  1113. AC_MSG_RESULT([no])
  1114. fi
  1115. fi
  1116. #
  1117. if test "$tst_compi_fsetxattr" = "yes"; then
  1118. AC_MSG_CHECKING([if fsetxattr usage allowed])
  1119. if test "x$curl_disallow_fsetxattr" != "xyes"; then
  1120. AC_MSG_RESULT([yes])
  1121. tst_allow_fsetxattr="yes"
  1122. else
  1123. AC_MSG_RESULT([no])
  1124. tst_allow_fsetxattr="no"
  1125. fi
  1126. fi
  1127. #
  1128. AC_MSG_CHECKING([if fsetxattr might be used])
  1129. if test "$tst_links_fsetxattr" = "yes" &&
  1130. test "$tst_proto_fsetxattr" = "yes" &&
  1131. test "$tst_compi_fsetxattr" = "yes" &&
  1132. test "$tst_allow_fsetxattr" = "yes"; then
  1133. AC_MSG_RESULT([yes])
  1134. AC_DEFINE_UNQUOTED(HAVE_FSETXATTR, 1,
  1135. [Define to 1 if you have the fsetxattr function.])
  1136. dnl AC_DEFINE_UNQUOTED(FSETXATTR_ARGS, $tst_nargs_fsetxattr,
  1137. dnl [Specifies the number of arguments to fsetxattr])
  1138. #
  1139. if test "$tst_nargs_fsetxattr" -eq "5"; then
  1140. AC_DEFINE(HAVE_FSETXATTR_5, 1, [fsetxattr() takes 5 args])
  1141. elif test "$tst_nargs_fsetxattr" -eq "6"; then
  1142. AC_DEFINE(HAVE_FSETXATTR_6, 1, [fsetxattr() takes 6 args])
  1143. fi
  1144. #
  1145. curl_cv_func_fsetxattr="yes"
  1146. else
  1147. AC_MSG_RESULT([no])
  1148. curl_cv_func_fsetxattr="no"
  1149. fi
  1150. ])
  1151. dnl CURL_CHECK_FUNC_FTRUNCATE
  1152. dnl -------------------------------------------------
  1153. dnl Verify if ftruncate is available, prototyped, and
  1154. dnl can be compiled. If all of these are true, and
  1155. dnl usage has not been previously disallowed with
  1156. dnl shell variable curl_disallow_ftruncate, then
  1157. dnl HAVE_FTRUNCATE will be defined.
  1158. AC_DEFUN([CURL_CHECK_FUNC_FTRUNCATE], [
  1159. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  1160. #
  1161. tst_links_ftruncate="unknown"
  1162. tst_proto_ftruncate="unknown"
  1163. tst_compi_ftruncate="unknown"
  1164. tst_allow_ftruncate="unknown"
  1165. #
  1166. AC_MSG_CHECKING([if ftruncate can be linked])
  1167. AC_LINK_IFELSE([
  1168. AC_LANG_FUNC_LINK_TRY([ftruncate])
  1169. ],[
  1170. AC_MSG_RESULT([yes])
  1171. tst_links_ftruncate="yes"
  1172. ],[
  1173. AC_MSG_RESULT([no])
  1174. tst_links_ftruncate="no"
  1175. ])
  1176. #
  1177. if test "$tst_links_ftruncate" = "yes"; then
  1178. AC_MSG_CHECKING([if ftruncate is prototyped])
  1179. AC_EGREP_CPP([ftruncate],[
  1180. $curl_includes_unistd
  1181. ],[
  1182. AC_MSG_RESULT([yes])
  1183. tst_proto_ftruncate="yes"
  1184. ],[
  1185. AC_MSG_RESULT([no])
  1186. tst_proto_ftruncate="no"
  1187. ])
  1188. fi
  1189. #
  1190. if test "$tst_proto_ftruncate" = "yes"; then
  1191. AC_MSG_CHECKING([if ftruncate is compilable])
  1192. AC_COMPILE_IFELSE([
  1193. AC_LANG_PROGRAM([[
  1194. $curl_includes_unistd
  1195. ]],[[
  1196. if(0 != ftruncate(0, 0))
  1197. return 1;
  1198. ]])
  1199. ],[
  1200. AC_MSG_RESULT([yes])
  1201. tst_compi_ftruncate="yes"
  1202. ],[
  1203. AC_MSG_RESULT([no])
  1204. tst_compi_ftruncate="no"
  1205. ])
  1206. fi
  1207. #
  1208. if test "$tst_compi_ftruncate" = "yes"; then
  1209. AC_MSG_CHECKING([if ftruncate usage allowed])
  1210. if test "x$curl_disallow_ftruncate" != "xyes"; then
  1211. AC_MSG_RESULT([yes])
  1212. tst_allow_ftruncate="yes"
  1213. else
  1214. AC_MSG_RESULT([no])
  1215. tst_allow_ftruncate="no"
  1216. fi
  1217. fi
  1218. #
  1219. AC_MSG_CHECKING([if ftruncate might be used])
  1220. if test "$tst_links_ftruncate" = "yes" &&
  1221. test "$tst_proto_ftruncate" = "yes" &&
  1222. test "$tst_compi_ftruncate" = "yes" &&
  1223. test "$tst_allow_ftruncate" = "yes"; then
  1224. AC_MSG_RESULT([yes])
  1225. AC_DEFINE_UNQUOTED(HAVE_FTRUNCATE, 1,
  1226. [Define to 1 if you have the ftruncate function.])
  1227. curl_cv_func_ftruncate="yes"
  1228. else
  1229. AC_MSG_RESULT([no])
  1230. curl_cv_func_ftruncate="no"
  1231. fi
  1232. ])
  1233. dnl CURL_CHECK_FUNC_GETADDRINFO
  1234. dnl -------------------------------------------------
  1235. dnl Verify if getaddrinfo is available, prototyped, can
  1236. dnl be compiled and seems to work. If all of these are
  1237. dnl true, and usage has not been previously disallowed
  1238. dnl with shell variable curl_disallow_getaddrinfo, then
  1239. dnl HAVE_GETADDRINFO will be defined. Additionally when
  1240. dnl HAVE_GETADDRINFO gets defined this will also attempt
  1241. dnl to find out if getaddrinfo happens to be threadsafe,
  1242. dnl defining HAVE_GETADDRINFO_THREADSAFE when true.
  1243. AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [
  1244. AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl
  1245. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  1246. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  1247. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  1248. AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
  1249. AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
  1250. #
  1251. tst_links_getaddrinfo="unknown"
  1252. tst_proto_getaddrinfo="unknown"
  1253. tst_compi_getaddrinfo="unknown"
  1254. tst_works_getaddrinfo="unknown"
  1255. tst_allow_getaddrinfo="unknown"
  1256. tst_tsafe_getaddrinfo="unknown"
  1257. #
  1258. AC_MSG_CHECKING([if getaddrinfo can be linked])
  1259. AC_LINK_IFELSE([
  1260. AC_LANG_PROGRAM([[
  1261. $curl_includes_ws2tcpip
  1262. $curl_includes_sys_socket
  1263. $curl_includes_netdb
  1264. ]],[[
  1265. if(0 != getaddrinfo(0, 0, 0, 0))
  1266. return 1;
  1267. ]])
  1268. ],[
  1269. AC_MSG_RESULT([yes])
  1270. tst_links_getaddrinfo="yes"
  1271. ],[
  1272. AC_MSG_RESULT([no])
  1273. tst_links_getaddrinfo="no"
  1274. ])
  1275. #
  1276. if test "$tst_links_getaddrinfo" = "yes"; then
  1277. AC_MSG_CHECKING([if getaddrinfo is prototyped])
  1278. AC_EGREP_CPP([getaddrinfo],[
  1279. $curl_includes_ws2tcpip
  1280. $curl_includes_sys_socket
  1281. $curl_includes_netdb
  1282. ],[
  1283. AC_MSG_RESULT([yes])
  1284. tst_proto_getaddrinfo="yes"
  1285. ],[
  1286. AC_MSG_RESULT([no])
  1287. tst_proto_getaddrinfo="no"
  1288. ])
  1289. fi
  1290. #
  1291. if test "$tst_proto_getaddrinfo" = "yes"; then
  1292. AC_MSG_CHECKING([if getaddrinfo is compilable])
  1293. AC_COMPILE_IFELSE([
  1294. AC_LANG_PROGRAM([[
  1295. $curl_includes_ws2tcpip
  1296. $curl_includes_sys_socket
  1297. $curl_includes_netdb
  1298. ]],[[
  1299. if(0 != getaddrinfo(0, 0, 0, 0))
  1300. return 1;
  1301. ]])
  1302. ],[
  1303. AC_MSG_RESULT([yes])
  1304. tst_compi_getaddrinfo="yes"
  1305. ],[
  1306. AC_MSG_RESULT([no])
  1307. tst_compi_getaddrinfo="no"
  1308. ])
  1309. fi
  1310. #
  1311. dnl only do runtime verification when not cross-compiling
  1312. if test "x$cross_compiling" != "xyes" &&
  1313. test "$tst_compi_getaddrinfo" = "yes"; then
  1314. AC_MSG_CHECKING([if getaddrinfo seems to work])
  1315. CURL_RUN_IFELSE([
  1316. AC_LANG_PROGRAM([[
  1317. $curl_includes_ws2tcpip
  1318. $curl_includes_stdlib
  1319. $curl_includes_string
  1320. $curl_includes_sys_socket
  1321. $curl_includes_netdb
  1322. ]],[[
  1323. struct addrinfo hints;
  1324. struct addrinfo *ai = 0;
  1325. int error;
  1326. #ifdef _WIN32
  1327. WSADATA wsa;
  1328. if(WSAStartup(MAKEWORD(2, 2), &wsa))
  1329. exit(2);
  1330. #endif
  1331. memset(&hints, 0, sizeof(hints));
  1332. hints.ai_flags = AI_NUMERICHOST;
  1333. hints.ai_family = AF_UNSPEC;
  1334. hints.ai_socktype = SOCK_STREAM;
  1335. error = getaddrinfo("127.0.0.1", 0, &hints, &ai);
  1336. if(error || !ai)
  1337. exit(1); /* fail */
  1338. else
  1339. exit(0);
  1340. ]])
  1341. ],[
  1342. AC_MSG_RESULT([yes])
  1343. tst_works_getaddrinfo="yes"
  1344. ],[
  1345. AC_MSG_RESULT([no])
  1346. tst_works_getaddrinfo="no"
  1347. ])
  1348. fi
  1349. #
  1350. if test "$tst_compi_getaddrinfo" = "yes" &&
  1351. test "$tst_works_getaddrinfo" != "no"; then
  1352. AC_MSG_CHECKING([if getaddrinfo usage allowed])
  1353. if test "x$curl_disallow_getaddrinfo" != "xyes"; then
  1354. AC_MSG_RESULT([yes])
  1355. tst_allow_getaddrinfo="yes"
  1356. else
  1357. AC_MSG_RESULT([no])
  1358. tst_allow_getaddrinfo="no"
  1359. fi
  1360. fi
  1361. #
  1362. AC_MSG_CHECKING([if getaddrinfo might be used])
  1363. if test "$tst_links_getaddrinfo" = "yes" &&
  1364. test "$tst_proto_getaddrinfo" = "yes" &&
  1365. test "$tst_compi_getaddrinfo" = "yes" &&
  1366. test "$tst_allow_getaddrinfo" = "yes" &&
  1367. test "$tst_works_getaddrinfo" != "no"; then
  1368. AC_MSG_RESULT([yes])
  1369. AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO, 1,
  1370. [Define to 1 if you have a working getaddrinfo function.])
  1371. curl_cv_func_getaddrinfo="yes"
  1372. else
  1373. AC_MSG_RESULT([no])
  1374. curl_cv_func_getaddrinfo="no"
  1375. curl_cv_func_getaddrinfo_threadsafe="no"
  1376. fi
  1377. #
  1378. if test "$curl_cv_func_getaddrinfo" = "yes"; then
  1379. AC_MSG_CHECKING([if getaddrinfo is threadsafe])
  1380. case $host_os in
  1381. aix[[1234]].* | aix5.[[01]].*)
  1382. dnl AIX 5.1 and older
  1383. tst_tsafe_getaddrinfo="no"
  1384. ;;
  1385. aix*)
  1386. dnl AIX 5.2 and newer
  1387. tst_tsafe_getaddrinfo="yes"
  1388. ;;
  1389. darwin[[12345]].*)
  1390. dnl Darwin 5.0 and macOS 10.1.X and older
  1391. tst_tsafe_getaddrinfo="no"
  1392. ;;
  1393. darwin*)
  1394. dnl Darwin 6.0 and macOS 10.2.X and newer
  1395. tst_tsafe_getaddrinfo="yes"
  1396. ;;
  1397. freebsd[[1234]].* | freebsd5.[[1234]]*)
  1398. dnl FreeBSD 5.4 and older
  1399. tst_tsafe_getaddrinfo="no"
  1400. ;;
  1401. freebsd*)
  1402. dnl FreeBSD 5.5 and newer
  1403. tst_tsafe_getaddrinfo="yes"
  1404. ;;
  1405. hpux[[123456789]].* | hpux10.* | hpux11.0* | hpux11.10*)
  1406. dnl HP-UX 11.10 and older
  1407. tst_tsafe_getaddrinfo="no"
  1408. ;;
  1409. hpux*)
  1410. dnl HP-UX 11.11 and newer
  1411. tst_tsafe_getaddrinfo="yes"
  1412. ;;
  1413. midnightbsd*)
  1414. dnl all MidnightBSD versions
  1415. tst_tsafe_getaddrinfo="yes"
  1416. ;;
  1417. netbsd[[123]].*)
  1418. dnl NetBSD 3.X and older
  1419. tst_tsafe_getaddrinfo="no"
  1420. ;;
  1421. netbsd*)
  1422. dnl NetBSD 4.X and newer
  1423. tst_tsafe_getaddrinfo="yes"
  1424. ;;
  1425. *bsd*)
  1426. dnl All other BSD's
  1427. tst_tsafe_getaddrinfo="no"
  1428. ;;
  1429. solaris2*)
  1430. dnl Solaris which have it
  1431. tst_tsafe_getaddrinfo="yes"
  1432. ;;
  1433. esac
  1434. if test "$tst_tsafe_getaddrinfo" = "unknown" &&
  1435. test "$curl_cv_native_windows" = "yes"; then
  1436. tst_tsafe_getaddrinfo="yes"
  1437. fi
  1438. if test "$tst_tsafe_getaddrinfo" = "unknown"; then
  1439. CURL_CHECK_DEF_CC([h_errno], [
  1440. $curl_includes_sys_socket
  1441. $curl_includes_netdb
  1442. ], [silent])
  1443. if test "$curl_cv_have_def_h_errno" = "yes"; then
  1444. tst_h_errno_macro="yes"
  1445. else
  1446. tst_h_errno_macro="no"
  1447. fi
  1448. AC_COMPILE_IFELSE([
  1449. AC_LANG_PROGRAM([[
  1450. $curl_includes_sys_socket
  1451. $curl_includes_netdb
  1452. ]],[[
  1453. h_errno = 2;
  1454. if(0 != h_errno)
  1455. return 1;
  1456. ]])
  1457. ],[
  1458. tst_h_errno_modifiable_lvalue="yes"
  1459. ],[
  1460. tst_h_errno_modifiable_lvalue="no"
  1461. ])
  1462. AC_COMPILE_IFELSE([
  1463. AC_LANG_PROGRAM([[
  1464. ]],[[
  1465. #if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
  1466. return 0;
  1467. #elif defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 700)
  1468. return 0;
  1469. #else
  1470. #error force compilation error
  1471. #endif
  1472. ]])
  1473. ],[
  1474. tst_h_errno_sbs_issue_7="yes"
  1475. ],[
  1476. tst_h_errno_sbs_issue_7="no"
  1477. ])
  1478. if test "$tst_h_errno_macro" = "no" &&
  1479. test "$tst_h_errno_modifiable_lvalue" = "no" &&
  1480. test "$tst_h_errno_sbs_issue_7" = "no"; then
  1481. tst_tsafe_getaddrinfo="no"
  1482. else
  1483. tst_tsafe_getaddrinfo="yes"
  1484. fi
  1485. fi
  1486. AC_MSG_RESULT([$tst_tsafe_getaddrinfo])
  1487. if test "$tst_tsafe_getaddrinfo" = "yes"; then
  1488. AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO_THREADSAFE, 1,
  1489. [Define to 1 if the getaddrinfo function is threadsafe.])
  1490. curl_cv_func_getaddrinfo_threadsafe="yes"
  1491. else
  1492. curl_cv_func_getaddrinfo_threadsafe="no"
  1493. fi
  1494. fi
  1495. ])
  1496. dnl CURL_CHECK_FUNC_GETHOSTBYNAME
  1497. dnl -------------------------------------------------
  1498. dnl Verify if gethostbyname is available, prototyped,
  1499. dnl and can be compiled. If all of these are true,
  1500. dnl and usage has not been previously disallowed with
  1501. dnl shell variable curl_disallow_gethostbyname, then
  1502. dnl HAVE_GETHOSTBYNAME will be defined.
  1503. AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME], [
  1504. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  1505. AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
  1506. #
  1507. tst_links_gethostbyname="unknown"
  1508. tst_proto_gethostbyname="unknown"
  1509. tst_compi_gethostbyname="unknown"
  1510. tst_allow_gethostbyname="unknown"
  1511. #
  1512. AC_MSG_CHECKING([if gethostbyname can be linked])
  1513. AC_LINK_IFELSE([
  1514. AC_LANG_PROGRAM([[
  1515. $curl_includes_winsock2
  1516. $curl_includes_bsdsocket
  1517. $curl_includes_netdb
  1518. ]],[[
  1519. if(0 != gethostbyname(0))
  1520. return 1;
  1521. ]])
  1522. ],[
  1523. AC_MSG_RESULT([yes])
  1524. tst_links_gethostbyname="yes"
  1525. ],[
  1526. AC_MSG_RESULT([no])
  1527. tst_links_gethostbyname="no"
  1528. ])
  1529. #
  1530. if test "$tst_links_gethostbyname" = "yes"; then
  1531. AC_MSG_CHECKING([if gethostbyname is prototyped])
  1532. AC_EGREP_CPP([gethostbyname],[
  1533. $curl_includes_winsock2
  1534. $curl_includes_bsdsocket
  1535. $curl_includes_netdb
  1536. ],[
  1537. AC_MSG_RESULT([yes])
  1538. tst_proto_gethostbyname="yes"
  1539. ],[
  1540. AC_MSG_RESULT([no])
  1541. tst_proto_gethostbyname="no"
  1542. ])
  1543. fi
  1544. #
  1545. if test "$tst_proto_gethostbyname" = "yes"; then
  1546. AC_MSG_CHECKING([if gethostbyname is compilable])
  1547. AC_COMPILE_IFELSE([
  1548. AC_LANG_PROGRAM([[
  1549. $curl_includes_winsock2
  1550. $curl_includes_bsdsocket
  1551. $curl_includes_netdb
  1552. ]],[[
  1553. if(0 != gethostbyname(0))
  1554. return 1;
  1555. ]])
  1556. ],[
  1557. AC_MSG_RESULT([yes])
  1558. tst_compi_gethostbyname="yes"
  1559. ],[
  1560. AC_MSG_RESULT([no])
  1561. tst_compi_gethostbyname="no"
  1562. ])
  1563. fi
  1564. #
  1565. if test "$tst_compi_gethostbyname" = "yes"; then
  1566. AC_MSG_CHECKING([if gethostbyname usage allowed])
  1567. if test "x$curl_disallow_gethostbyname" != "xyes"; then
  1568. AC_MSG_RESULT([yes])
  1569. tst_allow_gethostbyname="yes"
  1570. else
  1571. AC_MSG_RESULT([no])
  1572. tst_allow_gethostbyname="no"
  1573. fi
  1574. fi
  1575. #
  1576. AC_MSG_CHECKING([if gethostbyname might be used])
  1577. if test "$tst_links_gethostbyname" = "yes" &&
  1578. test "$tst_proto_gethostbyname" = "yes" &&
  1579. test "$tst_compi_gethostbyname" = "yes" &&
  1580. test "$tst_allow_gethostbyname" = "yes"; then
  1581. AC_MSG_RESULT([yes])
  1582. AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME, 1,
  1583. [Define to 1 if you have the gethostbyname function.])
  1584. curl_cv_func_gethostbyname="yes"
  1585. else
  1586. AC_MSG_RESULT([no])
  1587. curl_cv_func_gethostbyname="no"
  1588. fi
  1589. ])
  1590. dnl CURL_CHECK_FUNC_GETHOSTBYNAME_R
  1591. dnl -------------------------------------------------
  1592. dnl Verify if gethostbyname_r is available, prototyped,
  1593. dnl and can be compiled. If all of these are true, and
  1594. dnl usage has not been previously disallowed with
  1595. dnl shell variable curl_disallow_gethostbyname_r, then
  1596. dnl HAVE_GETHOSTBYNAME_R will be defined.
  1597. AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME_R], [
  1598. AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
  1599. #
  1600. tst_links_gethostbyname_r="unknown"
  1601. tst_proto_gethostbyname_r="unknown"
  1602. tst_compi_gethostbyname_r="unknown"
  1603. tst_allow_gethostbyname_r="unknown"
  1604. tst_nargs_gethostbyname_r="unknown"
  1605. #
  1606. AC_MSG_CHECKING([if gethostbyname_r can be linked])
  1607. AC_LINK_IFELSE([
  1608. AC_LANG_FUNC_LINK_TRY([gethostbyname_r])
  1609. ],[
  1610. AC_MSG_RESULT([yes])
  1611. tst_links_gethostbyname_r="yes"
  1612. ],[
  1613. AC_MSG_RESULT([no])
  1614. tst_links_gethostbyname_r="no"
  1615. ])
  1616. #
  1617. if test "$tst_links_gethostbyname_r" = "yes"; then
  1618. AC_MSG_CHECKING([if gethostbyname_r is prototyped])
  1619. AC_EGREP_CPP([gethostbyname_r],[
  1620. $curl_includes_netdb
  1621. ],[
  1622. AC_MSG_RESULT([yes])
  1623. tst_proto_gethostbyname_r="yes"
  1624. ],[
  1625. AC_MSG_RESULT([no])
  1626. tst_proto_gethostbyname_r="no"
  1627. ])
  1628. fi
  1629. #
  1630. if test "$tst_proto_gethostbyname_r" = "yes"; then
  1631. if test "$tst_nargs_gethostbyname_r" = "unknown"; then
  1632. AC_MSG_CHECKING([if gethostbyname_r takes 3 args.])
  1633. AC_COMPILE_IFELSE([
  1634. AC_LANG_PROGRAM([[
  1635. $curl_includes_netdb
  1636. $curl_includes_bsdsocket
  1637. ]],[[
  1638. if(0 != gethostbyname_r(0, 0, 0))
  1639. return 1;
  1640. ]])
  1641. ],[
  1642. AC_MSG_RESULT([yes])
  1643. tst_compi_gethostbyname_r="yes"
  1644. tst_nargs_gethostbyname_r="3"
  1645. ],[
  1646. AC_MSG_RESULT([no])
  1647. tst_compi_gethostbyname_r="no"
  1648. ])
  1649. fi
  1650. if test "$tst_nargs_gethostbyname_r" = "unknown"; then
  1651. AC_MSG_CHECKING([if gethostbyname_r takes 5 args.])
  1652. AC_COMPILE_IFELSE([
  1653. AC_LANG_PROGRAM([[
  1654. $curl_includes_netdb
  1655. $curl_includes_bsdsocket
  1656. ]],[[
  1657. if(0 != gethostbyname_r(0, 0, 0, 0, 0))
  1658. return 1;
  1659. ]])
  1660. ],[
  1661. AC_MSG_RESULT([yes])
  1662. tst_compi_gethostbyname_r="yes"
  1663. tst_nargs_gethostbyname_r="5"
  1664. ],[
  1665. AC_MSG_RESULT([no])
  1666. tst_compi_gethostbyname_r="no"
  1667. ])
  1668. fi
  1669. if test "$tst_nargs_gethostbyname_r" = "unknown"; then
  1670. AC_MSG_CHECKING([if gethostbyname_r takes 6 args.])
  1671. AC_COMPILE_IFELSE([
  1672. AC_LANG_PROGRAM([[
  1673. $curl_includes_netdb
  1674. $curl_includes_bsdsocket
  1675. ]],[[
  1676. if(0 != gethostbyname_r(0, 0, 0, 0, 0, 0))
  1677. return 1;
  1678. ]])
  1679. ],[
  1680. AC_MSG_RESULT([yes])
  1681. tst_compi_gethostbyname_r="yes"
  1682. tst_nargs_gethostbyname_r="6"
  1683. ],[
  1684. AC_MSG_RESULT([no])
  1685. tst_compi_gethostbyname_r="no"
  1686. ])
  1687. fi
  1688. AC_MSG_CHECKING([if gethostbyname_r is compilable])
  1689. if test "$tst_compi_gethostbyname_r" = "yes"; then
  1690. AC_MSG_RESULT([yes])
  1691. else
  1692. AC_MSG_RESULT([no])
  1693. fi
  1694. fi
  1695. #
  1696. if test "$tst_compi_gethostbyname_r" = "yes"; then
  1697. AC_MSG_CHECKING([if gethostbyname_r usage allowed])
  1698. if test "x$curl_disallow_gethostbyname_r" != "xyes"; then
  1699. AC_MSG_RESULT([yes])
  1700. tst_allow_gethostbyname_r="yes"
  1701. else
  1702. AC_MSG_RESULT([no])
  1703. tst_allow_gethostbyname_r="no"
  1704. fi
  1705. fi
  1706. #
  1707. AC_MSG_CHECKING([if gethostbyname_r might be used])
  1708. if test "$tst_links_gethostbyname_r" = "yes" &&
  1709. test "$tst_proto_gethostbyname_r" = "yes" &&
  1710. test "$tst_compi_gethostbyname_r" = "yes" &&
  1711. test "$tst_allow_gethostbyname_r" = "yes"; then
  1712. AC_MSG_RESULT([yes])
  1713. AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME_R, 1,
  1714. [Define to 1 if you have the gethostbyname_r function.])
  1715. dnl AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_ARGS, $tst_nargs_gethostbyname_r,
  1716. dnl [Specifies the number of arguments to gethostbyname_r])
  1717. #
  1718. if test "$tst_nargs_gethostbyname_r" -eq "3"; then
  1719. AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args])
  1720. elif test "$tst_nargs_gethostbyname_r" -eq "5"; then
  1721. AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args])
  1722. elif test "$tst_nargs_gethostbyname_r" -eq "6"; then
  1723. AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args])
  1724. fi
  1725. #
  1726. curl_cv_func_gethostbyname_r="yes"
  1727. else
  1728. AC_MSG_RESULT([no])
  1729. curl_cv_func_gethostbyname_r="no"
  1730. fi
  1731. ])
  1732. dnl CURL_CHECK_FUNC_GETHOSTNAME
  1733. dnl -------------------------------------------------
  1734. dnl Verify if gethostname is available, prototyped, and
  1735. dnl can be compiled. If all of these are true, and
  1736. dnl usage has not been previously disallowed with
  1737. dnl shell variable curl_disallow_gethostname, then
  1738. dnl HAVE_GETHOSTNAME will be defined.
  1739. AC_DEFUN([CURL_CHECK_FUNC_GETHOSTNAME], [
  1740. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  1741. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  1742. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  1743. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  1744. #
  1745. tst_links_gethostname="unknown"
  1746. tst_proto_gethostname="unknown"
  1747. tst_compi_gethostname="unknown"
  1748. tst_allow_gethostname="unknown"
  1749. #
  1750. AC_MSG_CHECKING([if gethostname can be linked])
  1751. AC_LINK_IFELSE([
  1752. AC_LANG_PROGRAM([[
  1753. $curl_includes_winsock2
  1754. $curl_includes_unistd
  1755. $curl_includes_bsdsocket
  1756. ]],[[
  1757. if(0 != gethostname(0, 0))
  1758. return 1;
  1759. ]])
  1760. ],[
  1761. AC_MSG_RESULT([yes])
  1762. tst_links_gethostname="yes"
  1763. ],[
  1764. AC_MSG_RESULT([no])
  1765. tst_links_gethostname="no"
  1766. ])
  1767. #
  1768. if test "$tst_links_gethostname" = "yes"; then
  1769. AC_MSG_CHECKING([if gethostname is prototyped])
  1770. AC_EGREP_CPP([gethostname],[
  1771. $curl_includes_winsock2
  1772. $curl_includes_unistd
  1773. $curl_includes_bsdsocket
  1774. ],[
  1775. AC_MSG_RESULT([yes])
  1776. tst_proto_gethostname="yes"
  1777. ],[
  1778. AC_MSG_RESULT([no])
  1779. tst_proto_gethostname="no"
  1780. ])
  1781. fi
  1782. #
  1783. if test "$tst_proto_gethostname" = "yes"; then
  1784. AC_MSG_CHECKING([if gethostname is compilable])
  1785. AC_COMPILE_IFELSE([
  1786. AC_LANG_PROGRAM([[
  1787. $curl_includes_winsock2
  1788. $curl_includes_unistd
  1789. $curl_includes_bsdsocket
  1790. ]],[[
  1791. if(0 != gethostname(0, 0))
  1792. return 1;
  1793. ]])
  1794. ],[
  1795. AC_MSG_RESULT([yes])
  1796. tst_compi_gethostname="yes"
  1797. ],[
  1798. AC_MSG_RESULT([no])
  1799. tst_compi_gethostname="no"
  1800. ])
  1801. fi
  1802. #
  1803. if test "$tst_compi_gethostname" = "yes"; then
  1804. AC_MSG_CHECKING([for gethostname arg 2 data type])
  1805. tst_gethostname_type_arg2="unknown"
  1806. for tst_arg1 in 'char *' 'unsigned char *' 'void *'; do
  1807. for tst_arg2 in 'int' 'unsigned int' 'size_t'; do
  1808. if test "$tst_gethostname_type_arg2" = "unknown"; then
  1809. AC_COMPILE_IFELSE([
  1810. AC_LANG_PROGRAM([[
  1811. $curl_includes_winsock2
  1812. $curl_includes_unistd
  1813. $curl_includes_bsdsocket
  1814. $curl_preprocess_callconv
  1815. extern int FUNCALLCONV gethostname($tst_arg1, $tst_arg2);
  1816. ]],[[
  1817. if(0 != gethostname(0, 0))
  1818. return 1;
  1819. ]])
  1820. ],[
  1821. tst_gethostname_type_arg2="$tst_arg2"
  1822. ])
  1823. fi
  1824. done
  1825. done
  1826. AC_MSG_RESULT([$tst_gethostname_type_arg2])
  1827. if test "$tst_gethostname_type_arg2" != "unknown"; then
  1828. AC_DEFINE_UNQUOTED(GETHOSTNAME_TYPE_ARG2, $tst_gethostname_type_arg2,
  1829. [Define to the type of arg 2 for gethostname.])
  1830. fi
  1831. fi
  1832. #
  1833. if test "$tst_compi_gethostname" = "yes"; then
  1834. AC_MSG_CHECKING([if gethostname usage allowed])
  1835. if test "x$curl_disallow_gethostname" != "xyes"; then
  1836. AC_MSG_RESULT([yes])
  1837. tst_allow_gethostname="yes"
  1838. else
  1839. AC_MSG_RESULT([no])
  1840. tst_allow_gethostname="no"
  1841. fi
  1842. fi
  1843. #
  1844. AC_MSG_CHECKING([if gethostname might be used])
  1845. if test "$tst_links_gethostname" = "yes" &&
  1846. test "$tst_proto_gethostname" = "yes" &&
  1847. test "$tst_compi_gethostname" = "yes" &&
  1848. test "$tst_allow_gethostname" = "yes"; then
  1849. AC_MSG_RESULT([yes])
  1850. AC_DEFINE_UNQUOTED(HAVE_GETHOSTNAME, 1,
  1851. [Define to 1 if you have the gethostname function.])
  1852. curl_cv_func_gethostname="yes"
  1853. else
  1854. AC_MSG_RESULT([no])
  1855. curl_cv_func_gethostname="no"
  1856. fi
  1857. ])
  1858. dnl CURL_CHECK_FUNC_GETPEERNAME
  1859. dnl -------------------------------------------------
  1860. dnl Verify if getpeername is available, prototyped, and
  1861. dnl can be compiled. If all of these are true, and
  1862. dnl usage has not been previously disallowed with
  1863. dnl shell variable curl_disallow_getpeername, then
  1864. dnl HAVE_GETPEERNAME will be defined.
  1865. AC_DEFUN([CURL_CHECK_FUNC_GETPEERNAME], [
  1866. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  1867. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  1868. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  1869. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  1870. #
  1871. tst_links_getpeername="unknown"
  1872. tst_proto_getpeername="unknown"
  1873. tst_compi_getpeername="unknown"
  1874. tst_allow_getpeername="unknown"
  1875. #
  1876. AC_MSG_CHECKING([if getpeername can be linked])
  1877. AC_LINK_IFELSE([
  1878. AC_LANG_PROGRAM([[
  1879. $curl_includes_winsock2
  1880. $curl_includes_bsdsocket
  1881. $curl_includes_sys_socket
  1882. ]],[[
  1883. if(0 != getpeername(0, (void *)0, (void *)0))
  1884. return 1;
  1885. ]])
  1886. ],[
  1887. AC_MSG_RESULT([yes])
  1888. tst_links_getpeername="yes"
  1889. ],[
  1890. AC_MSG_RESULT([no])
  1891. tst_links_getpeername="no"
  1892. ])
  1893. #
  1894. if test "$tst_links_getpeername" = "yes"; then
  1895. AC_MSG_CHECKING([if getpeername is prototyped])
  1896. AC_EGREP_CPP([getpeername],[
  1897. $curl_includes_winsock2
  1898. $curl_includes_bsdsocket
  1899. $curl_includes_sys_socket
  1900. ],[
  1901. AC_MSG_RESULT([yes])
  1902. tst_proto_getpeername="yes"
  1903. ],[
  1904. AC_MSG_RESULT([no])
  1905. tst_proto_getpeername="no"
  1906. ])
  1907. fi
  1908. #
  1909. if test "$tst_proto_getpeername" = "yes"; then
  1910. AC_MSG_CHECKING([if getpeername is compilable])
  1911. AC_COMPILE_IFELSE([
  1912. AC_LANG_PROGRAM([[
  1913. $curl_includes_winsock2
  1914. $curl_includes_bsdsocket
  1915. $curl_includes_sys_socket
  1916. ]],[[
  1917. if(0 != getpeername(0, (void *)0, (void *)0))
  1918. return 1;
  1919. ]])
  1920. ],[
  1921. AC_MSG_RESULT([yes])
  1922. tst_compi_getpeername="yes"
  1923. ],[
  1924. AC_MSG_RESULT([no])
  1925. tst_compi_getpeername="no"
  1926. ])
  1927. fi
  1928. #
  1929. if test "$tst_compi_getpeername" = "yes"; then
  1930. AC_MSG_CHECKING([if getpeername usage allowed])
  1931. if test "x$curl_disallow_getpeername" != "xyes"; then
  1932. AC_MSG_RESULT([yes])
  1933. tst_allow_getpeername="yes"
  1934. else
  1935. AC_MSG_RESULT([no])
  1936. tst_allow_getpeername="no"
  1937. fi
  1938. fi
  1939. #
  1940. AC_MSG_CHECKING([if getpeername might be used])
  1941. if test "$tst_links_getpeername" = "yes" &&
  1942. test "$tst_proto_getpeername" = "yes" &&
  1943. test "$tst_compi_getpeername" = "yes" &&
  1944. test "$tst_allow_getpeername" = "yes"; then
  1945. AC_MSG_RESULT([yes])
  1946. AC_DEFINE_UNQUOTED(HAVE_GETPEERNAME, 1,
  1947. [Define to 1 if you have the getpeername function.])
  1948. curl_cv_func_getpeername="yes"
  1949. else
  1950. AC_MSG_RESULT([no])
  1951. curl_cv_func_getpeername="no"
  1952. fi
  1953. ])
  1954. dnl CURL_CHECK_FUNC_GETSOCKNAME
  1955. dnl -------------------------------------------------
  1956. dnl Verify if getsockname is available, prototyped, and
  1957. dnl can be compiled. If all of these are true, and
  1958. dnl usage has not been previously disallowed with
  1959. dnl shell variable curl_disallow_getsockname, then
  1960. dnl HAVE_GETSOCKNAME will be defined.
  1961. AC_DEFUN([CURL_CHECK_FUNC_GETSOCKNAME], [
  1962. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  1963. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  1964. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  1965. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  1966. #
  1967. tst_links_getsockname="unknown"
  1968. tst_proto_getsockname="unknown"
  1969. tst_compi_getsockname="unknown"
  1970. tst_allow_getsockname="unknown"
  1971. #
  1972. AC_MSG_CHECKING([if getsockname can be linked])
  1973. AC_LINK_IFELSE([
  1974. AC_LANG_PROGRAM([[
  1975. $curl_includes_winsock2
  1976. $curl_includes_bsdsocket
  1977. $curl_includes_sys_socket
  1978. ]],[[
  1979. if(0 != getsockname(0, (void *)0, (void *)0))
  1980. return 1;
  1981. ]])
  1982. ],[
  1983. AC_MSG_RESULT([yes])
  1984. tst_links_getsockname="yes"
  1985. ],[
  1986. AC_MSG_RESULT([no])
  1987. tst_links_getsockname="no"
  1988. ])
  1989. #
  1990. if test "$tst_links_getsockname" = "yes"; then
  1991. AC_MSG_CHECKING([if getsockname is prototyped])
  1992. AC_EGREP_CPP([getsockname],[
  1993. $curl_includes_winsock2
  1994. $curl_includes_bsdsocket
  1995. $curl_includes_sys_socket
  1996. ],[
  1997. AC_MSG_RESULT([yes])
  1998. tst_proto_getsockname="yes"
  1999. ],[
  2000. AC_MSG_RESULT([no])
  2001. tst_proto_getsockname="no"
  2002. ])
  2003. fi
  2004. #
  2005. if test "$tst_proto_getsockname" = "yes"; then
  2006. AC_MSG_CHECKING([if getsockname is compilable])
  2007. AC_COMPILE_IFELSE([
  2008. AC_LANG_PROGRAM([[
  2009. $curl_includes_winsock2
  2010. $curl_includes_bsdsocket
  2011. $curl_includes_sys_socket
  2012. ]],[[
  2013. if(0 != getsockname(0, (void *)0, (void *)0))
  2014. return 1;
  2015. ]])
  2016. ],[
  2017. AC_MSG_RESULT([yes])
  2018. tst_compi_getsockname="yes"
  2019. ],[
  2020. AC_MSG_RESULT([no])
  2021. tst_compi_getsockname="no"
  2022. ])
  2023. fi
  2024. #
  2025. if test "$tst_compi_getsockname" = "yes"; then
  2026. AC_MSG_CHECKING([if getsockname usage allowed])
  2027. if test "x$curl_disallow_getsockname" != "xyes"; then
  2028. AC_MSG_RESULT([yes])
  2029. tst_allow_getsockname="yes"
  2030. else
  2031. AC_MSG_RESULT([no])
  2032. tst_allow_getsockname="no"
  2033. fi
  2034. fi
  2035. #
  2036. AC_MSG_CHECKING([if getsockname might be used])
  2037. if test "$tst_links_getsockname" = "yes" &&
  2038. test "$tst_proto_getsockname" = "yes" &&
  2039. test "$tst_compi_getsockname" = "yes" &&
  2040. test "$tst_allow_getsockname" = "yes"; then
  2041. AC_MSG_RESULT([yes])
  2042. AC_DEFINE_UNQUOTED(HAVE_GETSOCKNAME, 1,
  2043. [Define to 1 if you have the getsockname function.])
  2044. curl_cv_func_getsockname="yes"
  2045. else
  2046. AC_MSG_RESULT([no])
  2047. curl_cv_func_getsockname="no"
  2048. fi
  2049. ])
  2050. dnl CURL_CHECK_FUNC_IF_NAMETOINDEX
  2051. dnl -------------------------------------------------
  2052. dnl Verify if if_nametoindex is available, prototyped, and
  2053. dnl can be compiled. If all of these are true, and
  2054. dnl usage has not been previously disallowed with
  2055. dnl shell variable curl_disallow_if_nametoindex, then
  2056. dnl HAVE_IF_NAMETOINDEX will be defined.
  2057. AC_DEFUN([CURL_CHECK_FUNC_IF_NAMETOINDEX], [
  2058. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  2059. AC_REQUIRE([CURL_INCLUDES_NETIF])dnl
  2060. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  2061. #
  2062. tst_links_if_nametoindex="unknown"
  2063. tst_proto_if_nametoindex="unknown"
  2064. tst_compi_if_nametoindex="unknown"
  2065. tst_allow_if_nametoindex="unknown"
  2066. #
  2067. AC_MSG_CHECKING([if if_nametoindex can be linked])
  2068. AC_LINK_IFELSE([
  2069. AC_LANG_PROGRAM([[
  2070. $curl_includes_winsock2
  2071. $curl_includes_bsdsocket
  2072. #include <net/if.h>
  2073. ]],[[
  2074. if(0 != if_nametoindex(""))
  2075. return 1;
  2076. ]])
  2077. ],[
  2078. AC_MSG_RESULT([yes])
  2079. tst_links_if_nametoindex="yes"
  2080. ],[
  2081. AC_MSG_RESULT([no])
  2082. tst_links_if_nametoindex="no"
  2083. ])
  2084. #
  2085. if test "$tst_links_if_nametoindex" = "yes"; then
  2086. AC_MSG_CHECKING([if if_nametoindex is prototyped])
  2087. AC_EGREP_CPP([if_nametoindex],[
  2088. $curl_includes_winsock2
  2089. $curl_includes_netif
  2090. ],[
  2091. AC_MSG_RESULT([yes])
  2092. tst_proto_if_nametoindex="yes"
  2093. ],[
  2094. AC_MSG_RESULT([no])
  2095. tst_proto_if_nametoindex="no"
  2096. ])
  2097. fi
  2098. #
  2099. if test "$tst_proto_if_nametoindex" = "yes"; then
  2100. AC_MSG_CHECKING([if if_nametoindex is compilable])
  2101. AC_COMPILE_IFELSE([
  2102. AC_LANG_PROGRAM([[
  2103. $curl_includes_winsock2
  2104. $curl_includes_netif
  2105. ]],[[
  2106. if(0 != if_nametoindex(""))
  2107. return 1;
  2108. ]])
  2109. ],[
  2110. AC_MSG_RESULT([yes])
  2111. tst_compi_if_nametoindex="yes"
  2112. ],[
  2113. AC_MSG_RESULT([no])
  2114. tst_compi_if_nametoindex="no"
  2115. ])
  2116. fi
  2117. #
  2118. if test "$tst_compi_if_nametoindex" = "yes"; then
  2119. AC_MSG_CHECKING([if if_nametoindex usage allowed])
  2120. if test "x$curl_disallow_if_nametoindex" != "xyes"; then
  2121. AC_MSG_RESULT([yes])
  2122. tst_allow_if_nametoindex="yes"
  2123. else
  2124. AC_MSG_RESULT([no])
  2125. tst_allow_if_nametoindex="no"
  2126. fi
  2127. fi
  2128. #
  2129. AC_MSG_CHECKING([if if_nametoindex might be used])
  2130. if test "$tst_links_if_nametoindex" = "yes" &&
  2131. test "$tst_proto_if_nametoindex" = "yes" &&
  2132. test "$tst_compi_if_nametoindex" = "yes" &&
  2133. test "$tst_allow_if_nametoindex" = "yes"; then
  2134. AC_MSG_RESULT([yes])
  2135. AC_DEFINE_UNQUOTED(HAVE_IF_NAMETOINDEX, 1,
  2136. [Define to 1 if you have the if_nametoindex function.])
  2137. curl_cv_func_if_nametoindex="yes"
  2138. else
  2139. AC_MSG_RESULT([no])
  2140. curl_cv_func_if_nametoindex="no"
  2141. fi
  2142. ])
  2143. dnl CURL_CHECK_FUNC_GETIFADDRS
  2144. dnl -------------------------------------------------
  2145. dnl Verify if getifaddrs is available, prototyped, can
  2146. dnl be compiled and seems to work. If all of these are
  2147. dnl true, and usage has not been previously disallowed
  2148. dnl with shell variable curl_disallow_getifaddrs, then
  2149. dnl HAVE_GETIFADDRS will be defined.
  2150. AC_DEFUN([CURL_CHECK_FUNC_GETIFADDRS], [
  2151. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  2152. AC_REQUIRE([CURL_INCLUDES_IFADDRS])dnl
  2153. #
  2154. tst_links_getifaddrs="unknown"
  2155. tst_proto_getifaddrs="unknown"
  2156. tst_compi_getifaddrs="unknown"
  2157. tst_works_getifaddrs="unknown"
  2158. tst_allow_getifaddrs="unknown"
  2159. #
  2160. AC_MSG_CHECKING([if getifaddrs can be linked])
  2161. AC_LINK_IFELSE([
  2162. AC_LANG_FUNC_LINK_TRY([getifaddrs])
  2163. ],[
  2164. AC_MSG_RESULT([yes])
  2165. tst_links_getifaddrs="yes"
  2166. ],[
  2167. AC_MSG_RESULT([no])
  2168. tst_links_getifaddrs="no"
  2169. ])
  2170. #
  2171. if test "$tst_links_getifaddrs" = "yes"; then
  2172. AC_MSG_CHECKING([if getifaddrs is prototyped])
  2173. AC_EGREP_CPP([getifaddrs],[
  2174. $curl_includes_ifaddrs
  2175. ],[
  2176. AC_MSG_RESULT([yes])
  2177. tst_proto_getifaddrs="yes"
  2178. ],[
  2179. AC_MSG_RESULT([no])
  2180. tst_proto_getifaddrs="no"
  2181. ])
  2182. fi
  2183. #
  2184. if test "$tst_proto_getifaddrs" = "yes"; then
  2185. AC_MSG_CHECKING([if getifaddrs is compilable])
  2186. AC_COMPILE_IFELSE([
  2187. AC_LANG_PROGRAM([[
  2188. $curl_includes_ifaddrs
  2189. ]],[[
  2190. if(0 != getifaddrs(0))
  2191. return 1;
  2192. ]])
  2193. ],[
  2194. AC_MSG_RESULT([yes])
  2195. tst_compi_getifaddrs="yes"
  2196. ],[
  2197. AC_MSG_RESULT([no])
  2198. tst_compi_getifaddrs="no"
  2199. ])
  2200. fi
  2201. #
  2202. dnl only do runtime verification when not cross-compiling
  2203. if test "x$cross_compiling" != "xyes" &&
  2204. test "$tst_compi_getifaddrs" = "yes"; then
  2205. AC_MSG_CHECKING([if getifaddrs seems to work])
  2206. CURL_RUN_IFELSE([
  2207. AC_LANG_PROGRAM([[
  2208. $curl_includes_stdlib
  2209. $curl_includes_ifaddrs
  2210. ]],[[
  2211. struct ifaddrs *ifa = 0;
  2212. int error;
  2213. error = getifaddrs(&ifa);
  2214. if(error || !ifa)
  2215. exit(1); /* fail */
  2216. else
  2217. exit(0);
  2218. ]])
  2219. ],[
  2220. AC_MSG_RESULT([yes])
  2221. tst_works_getifaddrs="yes"
  2222. ],[
  2223. AC_MSG_RESULT([no])
  2224. tst_works_getifaddrs="no"
  2225. ])
  2226. fi
  2227. #
  2228. if test "$tst_compi_getifaddrs" = "yes" &&
  2229. test "$tst_works_getifaddrs" != "no"; then
  2230. AC_MSG_CHECKING([if getifaddrs usage allowed])
  2231. if test "x$curl_disallow_getifaddrs" != "xyes"; then
  2232. AC_MSG_RESULT([yes])
  2233. tst_allow_getifaddrs="yes"
  2234. else
  2235. AC_MSG_RESULT([no])
  2236. tst_allow_getifaddrs="no"
  2237. fi
  2238. fi
  2239. #
  2240. AC_MSG_CHECKING([if getifaddrs might be used])
  2241. if test "$tst_links_getifaddrs" = "yes" &&
  2242. test "$tst_proto_getifaddrs" = "yes" &&
  2243. test "$tst_compi_getifaddrs" = "yes" &&
  2244. test "$tst_allow_getifaddrs" = "yes" &&
  2245. test "$tst_works_getifaddrs" != "no"; then
  2246. AC_MSG_RESULT([yes])
  2247. AC_DEFINE_UNQUOTED(HAVE_GETIFADDRS, 1,
  2248. [Define to 1 if you have a working getifaddrs function.])
  2249. curl_cv_func_getifaddrs="yes"
  2250. else
  2251. AC_MSG_RESULT([no])
  2252. curl_cv_func_getifaddrs="no"
  2253. fi
  2254. ])
  2255. dnl CURL_CHECK_FUNC_GMTIME_R
  2256. dnl -------------------------------------------------
  2257. dnl Verify if gmtime_r is available, prototyped, can
  2258. dnl be compiled and seems to work. If all of these are
  2259. dnl true, and usage has not been previously disallowed
  2260. dnl with shell variable curl_disallow_gmtime_r, then
  2261. dnl HAVE_GMTIME_R will be defined.
  2262. AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [
  2263. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  2264. AC_REQUIRE([CURL_INCLUDES_TIME])dnl
  2265. #
  2266. tst_links_gmtime_r="unknown"
  2267. tst_proto_gmtime_r="unknown"
  2268. tst_compi_gmtime_r="unknown"
  2269. tst_works_gmtime_r="unknown"
  2270. tst_allow_gmtime_r="unknown"
  2271. #
  2272. AC_MSG_CHECKING([if gmtime_r can be linked])
  2273. AC_LINK_IFELSE([
  2274. AC_LANG_FUNC_LINK_TRY([gmtime_r])
  2275. ],[
  2276. AC_MSG_RESULT([yes])
  2277. tst_links_gmtime_r="yes"
  2278. ],[
  2279. AC_MSG_RESULT([no])
  2280. tst_links_gmtime_r="no"
  2281. ])
  2282. #
  2283. if test "$tst_links_gmtime_r" = "yes"; then
  2284. AC_MSG_CHECKING([if gmtime_r is prototyped])
  2285. AC_EGREP_CPP([gmtime_r],[
  2286. $curl_includes_time
  2287. ],[
  2288. AC_MSG_RESULT([yes])
  2289. tst_proto_gmtime_r="yes"
  2290. ],[
  2291. AC_MSG_RESULT([no])
  2292. tst_proto_gmtime_r="no"
  2293. ])
  2294. fi
  2295. #
  2296. if test "$tst_proto_gmtime_r" = "yes"; then
  2297. AC_MSG_CHECKING([if gmtime_r is compilable])
  2298. AC_COMPILE_IFELSE([
  2299. AC_LANG_PROGRAM([[
  2300. $curl_includes_time
  2301. ]],[[
  2302. if(0 != gmtime_r(0, 0))
  2303. return 1;
  2304. ]])
  2305. ],[
  2306. AC_MSG_RESULT([yes])
  2307. tst_compi_gmtime_r="yes"
  2308. ],[
  2309. AC_MSG_RESULT([no])
  2310. tst_compi_gmtime_r="no"
  2311. ])
  2312. fi
  2313. #
  2314. dnl only do runtime verification when not cross-compiling
  2315. if test "x$cross_compiling" != "xyes" &&
  2316. test "$tst_compi_gmtime_r" = "yes"; then
  2317. AC_MSG_CHECKING([if gmtime_r seems to work])
  2318. CURL_RUN_IFELSE([
  2319. AC_LANG_PROGRAM([[
  2320. $curl_includes_stdlib
  2321. $curl_includes_time
  2322. ]],[[
  2323. time_t local = 1170352587;
  2324. struct tm *gmt = 0;
  2325. struct tm result;
  2326. gmt = gmtime_r(&local, &result);
  2327. if(gmt)
  2328. exit(0);
  2329. else
  2330. exit(1);
  2331. ]])
  2332. ],[
  2333. AC_MSG_RESULT([yes])
  2334. tst_works_gmtime_r="yes"
  2335. ],[
  2336. AC_MSG_RESULT([no])
  2337. tst_works_gmtime_r="no"
  2338. ])
  2339. fi
  2340. #
  2341. if test "$tst_compi_gmtime_r" = "yes" &&
  2342. test "$tst_works_gmtime_r" != "no"; then
  2343. AC_MSG_CHECKING([if gmtime_r usage allowed])
  2344. if test "x$curl_disallow_gmtime_r" != "xyes"; then
  2345. AC_MSG_RESULT([yes])
  2346. tst_allow_gmtime_r="yes"
  2347. else
  2348. AC_MSG_RESULT([no])
  2349. tst_allow_gmtime_r="no"
  2350. fi
  2351. fi
  2352. #
  2353. AC_MSG_CHECKING([if gmtime_r might be used])
  2354. if test "$tst_links_gmtime_r" = "yes" &&
  2355. test "$tst_proto_gmtime_r" = "yes" &&
  2356. test "$tst_compi_gmtime_r" = "yes" &&
  2357. test "$tst_allow_gmtime_r" = "yes" &&
  2358. test "$tst_works_gmtime_r" != "no"; then
  2359. AC_MSG_RESULT([yes])
  2360. AC_DEFINE_UNQUOTED(HAVE_GMTIME_R, 1,
  2361. [Define to 1 if you have a working gmtime_r function.])
  2362. curl_cv_func_gmtime_r="yes"
  2363. else
  2364. AC_MSG_RESULT([no])
  2365. curl_cv_func_gmtime_r="no"
  2366. fi
  2367. ])
  2368. dnl CURL_CHECK_FUNC_INET_NTOP
  2369. dnl -------------------------------------------------
  2370. dnl Verify if inet_ntop is available, prototyped, can
  2371. dnl be compiled and seems to work. If all of these are
  2372. dnl true, and usage has not been previously disallowed
  2373. dnl with shell variable curl_disallow_inet_ntop, then
  2374. dnl HAVE_INET_NTOP will be defined.
  2375. AC_DEFUN([CURL_CHECK_FUNC_INET_NTOP], [
  2376. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  2377. AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl
  2378. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  2379. #
  2380. tst_links_inet_ntop="unknown"
  2381. tst_proto_inet_ntop="unknown"
  2382. tst_compi_inet_ntop="unknown"
  2383. tst_works_inet_ntop="unknown"
  2384. tst_allow_inet_ntop="unknown"
  2385. #
  2386. AC_MSG_CHECKING([if inet_ntop can be linked])
  2387. AC_LINK_IFELSE([
  2388. AC_LANG_FUNC_LINK_TRY([inet_ntop])
  2389. ],[
  2390. AC_MSG_RESULT([yes])
  2391. tst_links_inet_ntop="yes"
  2392. ],[
  2393. AC_MSG_RESULT([no])
  2394. tst_links_inet_ntop="no"
  2395. ])
  2396. #
  2397. if test "$tst_links_inet_ntop" = "yes"; then
  2398. AC_MSG_CHECKING([if inet_ntop is prototyped])
  2399. AC_EGREP_CPP([inet_ntop],[
  2400. $curl_includes_arpa_inet
  2401. ],[
  2402. AC_MSG_RESULT([yes])
  2403. tst_proto_inet_ntop="yes"
  2404. ],[
  2405. AC_MSG_RESULT([no])
  2406. tst_proto_inet_ntop="no"
  2407. ])
  2408. fi
  2409. #
  2410. if test "$tst_proto_inet_ntop" = "yes"; then
  2411. AC_MSG_CHECKING([if inet_ntop is compilable])
  2412. AC_COMPILE_IFELSE([
  2413. AC_LANG_PROGRAM([[
  2414. $curl_includes_arpa_inet
  2415. ]],[[
  2416. if(0 != inet_ntop(0, 0, 0, 0))
  2417. return 1;
  2418. ]])
  2419. ],[
  2420. AC_MSG_RESULT([yes])
  2421. tst_compi_inet_ntop="yes"
  2422. ],[
  2423. AC_MSG_RESULT([no])
  2424. tst_compi_inet_ntop="no"
  2425. ])
  2426. fi
  2427. #
  2428. dnl only do runtime verification when not cross-compiling
  2429. if test "x$cross_compiling" != "xyes" &&
  2430. test "$tst_compi_inet_ntop" = "yes"; then
  2431. AC_MSG_CHECKING([if inet_ntop seems to work])
  2432. CURL_RUN_IFELSE([
  2433. AC_LANG_PROGRAM([[
  2434. $curl_includes_stdlib
  2435. $curl_includes_arpa_inet
  2436. $curl_includes_string
  2437. ]],[[
  2438. char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
  2439. char ipv4res[sizeof "255.255.255.255"];
  2440. unsigned char ipv6a[26];
  2441. unsigned char ipv4a[5];
  2442. char *ipv6ptr = 0;
  2443. char *ipv4ptr = 0;
  2444. /* - */
  2445. ipv4res[0] = '\0';
  2446. ipv4a[0] = 0xc0;
  2447. ipv4a[1] = 0xa8;
  2448. ipv4a[2] = 0x64;
  2449. ipv4a[3] = 0x01;
  2450. ipv4a[4] = 0x01;
  2451. /* - */
  2452. ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res));
  2453. if(!ipv4ptr)
  2454. exit(1); /* fail */
  2455. if(ipv4ptr != ipv4res)
  2456. exit(1); /* fail */
  2457. if(!ipv4ptr[0])
  2458. exit(1); /* fail */
  2459. if(memcmp(ipv4res, "192.168.100.1", 13) != 0)
  2460. exit(1); /* fail */
  2461. /* - */
  2462. ipv6res[0] = '\0';
  2463. memset(ipv6a, 0, sizeof(ipv6a));
  2464. ipv6a[0] = 0xfe;
  2465. ipv6a[1] = 0x80;
  2466. ipv6a[8] = 0x02;
  2467. ipv6a[9] = 0x14;
  2468. ipv6a[10] = 0x4f;
  2469. ipv6a[11] = 0xff;
  2470. ipv6a[12] = 0xfe;
  2471. ipv6a[13] = 0x0b;
  2472. ipv6a[14] = 0x76;
  2473. ipv6a[15] = 0xc8;
  2474. ipv6a[25] = 0x01;
  2475. /* - */
  2476. ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res));
  2477. if(!ipv6ptr)
  2478. exit(1); /* fail */
  2479. if(ipv6ptr != ipv6res)
  2480. exit(1); /* fail */
  2481. if(!ipv6ptr[0])
  2482. exit(1); /* fail */
  2483. if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0)
  2484. exit(1); /* fail */
  2485. /* - */
  2486. exit(0);
  2487. ]])
  2488. ],[
  2489. AC_MSG_RESULT([yes])
  2490. tst_works_inet_ntop="yes"
  2491. ],[
  2492. AC_MSG_RESULT([no])
  2493. tst_works_inet_ntop="no"
  2494. ])
  2495. fi
  2496. #
  2497. if test "$tst_compi_inet_ntop" = "yes" &&
  2498. test "$tst_works_inet_ntop" != "no"; then
  2499. AC_MSG_CHECKING([if inet_ntop usage allowed])
  2500. if test "x$curl_disallow_inet_ntop" != "xyes"; then
  2501. AC_MSG_RESULT([yes])
  2502. tst_allow_inet_ntop="yes"
  2503. else
  2504. AC_MSG_RESULT([no])
  2505. tst_allow_inet_ntop="no"
  2506. fi
  2507. fi
  2508. #
  2509. AC_MSG_CHECKING([if inet_ntop might be used])
  2510. if test "$tst_links_inet_ntop" = "yes" &&
  2511. test "$tst_proto_inet_ntop" = "yes" &&
  2512. test "$tst_compi_inet_ntop" = "yes" &&
  2513. test "$tst_allow_inet_ntop" = "yes" &&
  2514. test "$tst_works_inet_ntop" != "no"; then
  2515. AC_MSG_RESULT([yes])
  2516. AC_DEFINE_UNQUOTED(HAVE_INET_NTOP, 1,
  2517. [Define to 1 if you have a IPv6 capable working inet_ntop function.])
  2518. curl_cv_func_inet_ntop="yes"
  2519. else
  2520. AC_MSG_RESULT([no])
  2521. curl_cv_func_inet_ntop="no"
  2522. fi
  2523. ])
  2524. dnl CURL_CHECK_FUNC_INET_PTON
  2525. dnl -------------------------------------------------
  2526. dnl Verify if inet_pton is available, prototyped, can
  2527. dnl be compiled and seems to work. If all of these are
  2528. dnl true, and usage has not been previously disallowed
  2529. dnl with shell variable curl_disallow_inet_pton, then
  2530. dnl HAVE_INET_PTON will be defined.
  2531. AC_DEFUN([CURL_CHECK_FUNC_INET_PTON], [
  2532. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  2533. AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl
  2534. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  2535. #
  2536. tst_links_inet_pton="unknown"
  2537. tst_proto_inet_pton="unknown"
  2538. tst_compi_inet_pton="unknown"
  2539. tst_works_inet_pton="unknown"
  2540. tst_allow_inet_pton="unknown"
  2541. #
  2542. AC_MSG_CHECKING([if inet_pton can be linked])
  2543. AC_LINK_IFELSE([
  2544. AC_LANG_FUNC_LINK_TRY([inet_pton])
  2545. ],[
  2546. AC_MSG_RESULT([yes])
  2547. tst_links_inet_pton="yes"
  2548. ],[
  2549. AC_MSG_RESULT([no])
  2550. tst_links_inet_pton="no"
  2551. ])
  2552. #
  2553. if test "$tst_links_inet_pton" = "yes"; then
  2554. AC_MSG_CHECKING([if inet_pton is prototyped])
  2555. AC_EGREP_CPP([inet_pton],[
  2556. $curl_includes_arpa_inet
  2557. ],[
  2558. AC_MSG_RESULT([yes])
  2559. tst_proto_inet_pton="yes"
  2560. ],[
  2561. AC_MSG_RESULT([no])
  2562. tst_proto_inet_pton="no"
  2563. ])
  2564. fi
  2565. #
  2566. if test "$tst_proto_inet_pton" = "yes"; then
  2567. AC_MSG_CHECKING([if inet_pton is compilable])
  2568. AC_COMPILE_IFELSE([
  2569. AC_LANG_PROGRAM([[
  2570. $curl_includes_arpa_inet
  2571. ]],[[
  2572. if(0 != inet_pton(0, 0, 0))
  2573. return 1;
  2574. ]])
  2575. ],[
  2576. AC_MSG_RESULT([yes])
  2577. tst_compi_inet_pton="yes"
  2578. ],[
  2579. AC_MSG_RESULT([no])
  2580. tst_compi_inet_pton="no"
  2581. ])
  2582. fi
  2583. #
  2584. dnl only do runtime verification when not cross-compiling
  2585. if test "x$cross_compiling" != "xyes" &&
  2586. test "$tst_compi_inet_pton" = "yes"; then
  2587. AC_MSG_CHECKING([if inet_pton seems to work])
  2588. CURL_RUN_IFELSE([
  2589. AC_LANG_PROGRAM([[
  2590. $curl_includes_stdlib
  2591. $curl_includes_arpa_inet
  2592. $curl_includes_string
  2593. ]],[[
  2594. unsigned char ipv6a[16+1];
  2595. unsigned char ipv4a[4+1];
  2596. const char *ipv6src = "fe80::214:4fff:fe0b:76c8";
  2597. const char *ipv4src = "192.168.100.1";
  2598. /* - */
  2599. memset(ipv4a, 1, sizeof(ipv4a));
  2600. if(1 != inet_pton(AF_INET, ipv4src, ipv4a))
  2601. exit(1); /* fail */
  2602. /* - */
  2603. if( (ipv4a[0] != 0xc0) ||
  2604. (ipv4a[1] != 0xa8) ||
  2605. (ipv4a[2] != 0x64) ||
  2606. (ipv4a[3] != 0x01) ||
  2607. (ipv4a[4] != 0x01) )
  2608. exit(1); /* fail */
  2609. /* - */
  2610. memset(ipv6a, 1, sizeof(ipv6a));
  2611. if(1 != inet_pton(AF_INET6, ipv6src, ipv6a))
  2612. exit(1); /* fail */
  2613. /* - */
  2614. if( (ipv6a[0] != 0xfe) ||
  2615. (ipv6a[1] != 0x80) ||
  2616. (ipv6a[8] != 0x02) ||
  2617. (ipv6a[9] != 0x14) ||
  2618. (ipv6a[10] != 0x4f) ||
  2619. (ipv6a[11] != 0xff) ||
  2620. (ipv6a[12] != 0xfe) ||
  2621. (ipv6a[13] != 0x0b) ||
  2622. (ipv6a[14] != 0x76) ||
  2623. (ipv6a[15] != 0xc8) ||
  2624. (ipv6a[16] != 0x01) )
  2625. exit(1); /* fail */
  2626. /* - */
  2627. if( (ipv6a[2] != 0x0) ||
  2628. (ipv6a[3] != 0x0) ||
  2629. (ipv6a[4] != 0x0) ||
  2630. (ipv6a[5] != 0x0) ||
  2631. (ipv6a[6] != 0x0) ||
  2632. (ipv6a[7] != 0x0) )
  2633. exit(1); /* fail */
  2634. /* - */
  2635. exit(0);
  2636. ]])
  2637. ],[
  2638. AC_MSG_RESULT([yes])
  2639. tst_works_inet_pton="yes"
  2640. ],[
  2641. AC_MSG_RESULT([no])
  2642. tst_works_inet_pton="no"
  2643. ])
  2644. fi
  2645. #
  2646. if test "$tst_compi_inet_pton" = "yes" &&
  2647. test "$tst_works_inet_pton" != "no"; then
  2648. AC_MSG_CHECKING([if inet_pton usage allowed])
  2649. if test "x$curl_disallow_inet_pton" != "xyes"; then
  2650. AC_MSG_RESULT([yes])
  2651. tst_allow_inet_pton="yes"
  2652. else
  2653. AC_MSG_RESULT([no])
  2654. tst_allow_inet_pton="no"
  2655. fi
  2656. fi
  2657. #
  2658. AC_MSG_CHECKING([if inet_pton might be used])
  2659. if test "$tst_links_inet_pton" = "yes" &&
  2660. test "$tst_proto_inet_pton" = "yes" &&
  2661. test "$tst_compi_inet_pton" = "yes" &&
  2662. test "$tst_allow_inet_pton" = "yes" &&
  2663. test "$tst_works_inet_pton" != "no"; then
  2664. AC_MSG_RESULT([yes])
  2665. AC_DEFINE_UNQUOTED(HAVE_INET_PTON, 1,
  2666. [Define to 1 if you have a IPv6 capable working inet_pton function.])
  2667. curl_cv_func_inet_pton="yes"
  2668. else
  2669. AC_MSG_RESULT([no])
  2670. curl_cv_func_inet_pton="no"
  2671. fi
  2672. ])
  2673. dnl CURL_CHECK_FUNC_IOCTL
  2674. dnl -------------------------------------------------
  2675. dnl Verify if ioctl is available, prototyped, and
  2676. dnl can be compiled. If all of these are true, and
  2677. dnl usage has not been previously disallowed with
  2678. dnl shell variable curl_disallow_ioctl, then
  2679. dnl HAVE_IOCTL will be defined.
  2680. AC_DEFUN([CURL_CHECK_FUNC_IOCTL], [
  2681. AC_REQUIRE([CURL_INCLUDES_STROPTS])dnl
  2682. #
  2683. tst_links_ioctl="unknown"
  2684. tst_proto_ioctl="unknown"
  2685. tst_compi_ioctl="unknown"
  2686. tst_allow_ioctl="unknown"
  2687. #
  2688. AC_MSG_CHECKING([if ioctl can be linked])
  2689. AC_LINK_IFELSE([
  2690. AC_LANG_FUNC_LINK_TRY([ioctl])
  2691. ],[
  2692. AC_MSG_RESULT([yes])
  2693. tst_links_ioctl="yes"
  2694. ],[
  2695. AC_MSG_RESULT([no])
  2696. tst_links_ioctl="no"
  2697. ])
  2698. #
  2699. if test "$tst_links_ioctl" = "yes"; then
  2700. AC_MSG_CHECKING([if ioctl is prototyped])
  2701. AC_EGREP_CPP([ioctl],[
  2702. $curl_includes_stropts
  2703. ],[
  2704. AC_MSG_RESULT([yes])
  2705. tst_proto_ioctl="yes"
  2706. ],[
  2707. AC_MSG_RESULT([no])
  2708. tst_proto_ioctl="no"
  2709. ])
  2710. fi
  2711. #
  2712. if test "$tst_proto_ioctl" = "yes"; then
  2713. AC_MSG_CHECKING([if ioctl is compilable])
  2714. AC_COMPILE_IFELSE([
  2715. AC_LANG_PROGRAM([[
  2716. $curl_includes_stropts
  2717. ]],[[
  2718. if(0 != ioctl(0, 0, 0))
  2719. return 1;
  2720. ]])
  2721. ],[
  2722. AC_MSG_RESULT([yes])
  2723. tst_compi_ioctl="yes"
  2724. ],[
  2725. AC_MSG_RESULT([no])
  2726. tst_compi_ioctl="no"
  2727. ])
  2728. fi
  2729. #
  2730. if test "$tst_compi_ioctl" = "yes"; then
  2731. AC_MSG_CHECKING([if ioctl usage allowed])
  2732. if test "x$curl_disallow_ioctl" != "xyes"; then
  2733. AC_MSG_RESULT([yes])
  2734. tst_allow_ioctl="yes"
  2735. else
  2736. AC_MSG_RESULT([no])
  2737. tst_allow_ioctl="no"
  2738. fi
  2739. fi
  2740. #
  2741. AC_MSG_CHECKING([if ioctl might be used])
  2742. if test "$tst_links_ioctl" = "yes" &&
  2743. test "$tst_proto_ioctl" = "yes" &&
  2744. test "$tst_compi_ioctl" = "yes" &&
  2745. test "$tst_allow_ioctl" = "yes"; then
  2746. AC_MSG_RESULT([yes])
  2747. AC_DEFINE_UNQUOTED(HAVE_IOCTL, 1,
  2748. [Define to 1 if you have the ioctl function.])
  2749. curl_cv_func_ioctl="yes"
  2750. CURL_CHECK_FUNC_IOCTL_FIONBIO
  2751. CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR
  2752. else
  2753. AC_MSG_RESULT([no])
  2754. curl_cv_func_ioctl="no"
  2755. fi
  2756. ])
  2757. dnl CURL_CHECK_FUNC_IOCTL_FIONBIO
  2758. dnl -------------------------------------------------
  2759. dnl Verify if ioctl with the FIONBIO command is
  2760. dnl available, can be compiled, and seems to work. If
  2761. dnl all of these are true, then HAVE_IOCTL_FIONBIO
  2762. dnl will be defined.
  2763. AC_DEFUN([CURL_CHECK_FUNC_IOCTL_FIONBIO], [
  2764. #
  2765. tst_compi_ioctl_fionbio="unknown"
  2766. tst_allow_ioctl_fionbio="unknown"
  2767. #
  2768. if test "$curl_cv_func_ioctl" = "yes"; then
  2769. AC_MSG_CHECKING([if ioctl FIONBIO is compilable])
  2770. AC_COMPILE_IFELSE([
  2771. AC_LANG_PROGRAM([[
  2772. $curl_includes_stropts
  2773. ]],[[
  2774. int flags = 0;
  2775. if(0 != ioctl(0, FIONBIO, &flags))
  2776. return 1;
  2777. ]])
  2778. ],[
  2779. AC_MSG_RESULT([yes])
  2780. tst_compi_ioctl_fionbio="yes"
  2781. ],[
  2782. AC_MSG_RESULT([no])
  2783. tst_compi_ioctl_fionbio="no"
  2784. ])
  2785. fi
  2786. #
  2787. if test "$tst_compi_ioctl_fionbio" = "yes"; then
  2788. AC_MSG_CHECKING([if ioctl FIONBIO usage allowed])
  2789. if test "x$curl_disallow_ioctl_fionbio" != "xyes"; then
  2790. AC_MSG_RESULT([yes])
  2791. tst_allow_ioctl_fionbio="yes"
  2792. else
  2793. AC_MSG_RESULT([no])
  2794. tst_allow_ioctl_fionbio="no"
  2795. fi
  2796. fi
  2797. #
  2798. AC_MSG_CHECKING([if ioctl FIONBIO might be used])
  2799. if test "$tst_compi_ioctl_fionbio" = "yes" &&
  2800. test "$tst_allow_ioctl_fionbio" = "yes"; then
  2801. AC_MSG_RESULT([yes])
  2802. AC_DEFINE_UNQUOTED(HAVE_IOCTL_FIONBIO, 1,
  2803. [Define to 1 if you have a working ioctl FIONBIO function.])
  2804. curl_cv_func_ioctl_fionbio="yes"
  2805. else
  2806. AC_MSG_RESULT([no])
  2807. curl_cv_func_ioctl_fionbio="no"
  2808. fi
  2809. ])
  2810. dnl CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR
  2811. dnl -------------------------------------------------
  2812. dnl Verify if ioctl with the SIOCGIFADDR command is available,
  2813. dnl struct ifreq is defined, they can be compiled, and seem to
  2814. dnl work. If all of these are true, then HAVE_IOCTL_SIOCGIFADDR
  2815. dnl will be defined.
  2816. AC_DEFUN([CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR], [
  2817. #
  2818. tst_compi_ioctl_siocgifaddr="unknown"
  2819. tst_allow_ioctl_siocgifaddr="unknown"
  2820. #
  2821. if test "$curl_cv_func_ioctl" = "yes"; then
  2822. AC_MSG_CHECKING([if ioctl SIOCGIFADDR is compilable])
  2823. AC_COMPILE_IFELSE([
  2824. AC_LANG_PROGRAM([[
  2825. $curl_includes_stropts
  2826. #include <net/if.h>
  2827. ]],[[
  2828. struct ifreq ifr;
  2829. if(0 != ioctl(0, SIOCGIFADDR, &ifr))
  2830. return 1;
  2831. ]])
  2832. ],[
  2833. AC_MSG_RESULT([yes])
  2834. tst_compi_ioctl_siocgifaddr="yes"
  2835. ],[
  2836. AC_MSG_RESULT([no])
  2837. tst_compi_ioctl_siocgifaddr="no"
  2838. ])
  2839. fi
  2840. #
  2841. if test "$tst_compi_ioctl_siocgifaddr" = "yes"; then
  2842. AC_MSG_CHECKING([if ioctl SIOCGIFADDR usage allowed])
  2843. if test "x$curl_disallow_ioctl_siocgifaddr" != "xyes"; then
  2844. AC_MSG_RESULT([yes])
  2845. tst_allow_ioctl_siocgifaddr="yes"
  2846. else
  2847. AC_MSG_RESULT([no])
  2848. tst_allow_ioctl_siocgifaddr="no"
  2849. fi
  2850. fi
  2851. #
  2852. AC_MSG_CHECKING([if ioctl SIOCGIFADDR might be used])
  2853. if test "$tst_compi_ioctl_siocgifaddr" = "yes" &&
  2854. test "$tst_allow_ioctl_siocgifaddr" = "yes"; then
  2855. AC_MSG_RESULT([yes])
  2856. AC_DEFINE_UNQUOTED(HAVE_IOCTL_SIOCGIFADDR, 1,
  2857. [Define to 1 if you have a working ioctl SIOCGIFADDR function.])
  2858. curl_cv_func_ioctl_siocgifaddr="yes"
  2859. else
  2860. AC_MSG_RESULT([no])
  2861. curl_cv_func_ioctl_siocgifaddr="no"
  2862. fi
  2863. ])
  2864. dnl CURL_CHECK_FUNC_IOCTLSOCKET
  2865. dnl -------------------------------------------------
  2866. dnl Verify if ioctlsocket is available, prototyped, and
  2867. dnl can be compiled. If all of these are true, and
  2868. dnl usage has not been previously disallowed with
  2869. dnl shell variable curl_disallow_ioctlsocket, then
  2870. dnl HAVE_IOCTLSOCKET will be defined.
  2871. AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET], [
  2872. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  2873. #
  2874. tst_links_ioctlsocket="unknown"
  2875. tst_proto_ioctlsocket="unknown"
  2876. tst_compi_ioctlsocket="unknown"
  2877. tst_allow_ioctlsocket="unknown"
  2878. #
  2879. AC_MSG_CHECKING([if ioctlsocket can be linked])
  2880. AC_LINK_IFELSE([
  2881. AC_LANG_PROGRAM([[
  2882. $curl_includes_winsock2
  2883. ]],[[
  2884. if(0 != ioctlsocket(0, 0, 0))
  2885. return 1;
  2886. ]])
  2887. ],[
  2888. AC_MSG_RESULT([yes])
  2889. tst_links_ioctlsocket="yes"
  2890. ],[
  2891. AC_MSG_RESULT([no])
  2892. tst_links_ioctlsocket="no"
  2893. ])
  2894. #
  2895. if test "$tst_links_ioctlsocket" = "yes"; then
  2896. AC_MSG_CHECKING([if ioctlsocket is prototyped])
  2897. AC_EGREP_CPP([ioctlsocket],[
  2898. $curl_includes_winsock2
  2899. ],[
  2900. AC_MSG_RESULT([yes])
  2901. tst_proto_ioctlsocket="yes"
  2902. ],[
  2903. AC_MSG_RESULT([no])
  2904. tst_proto_ioctlsocket="no"
  2905. ])
  2906. fi
  2907. #
  2908. if test "$tst_proto_ioctlsocket" = "yes"; then
  2909. AC_MSG_CHECKING([if ioctlsocket is compilable])
  2910. AC_COMPILE_IFELSE([
  2911. AC_LANG_PROGRAM([[
  2912. $curl_includes_winsock2
  2913. ]],[[
  2914. if(0 != ioctlsocket(0, 0, 0))
  2915. return 1;
  2916. ]])
  2917. ],[
  2918. AC_MSG_RESULT([yes])
  2919. tst_compi_ioctlsocket="yes"
  2920. ],[
  2921. AC_MSG_RESULT([no])
  2922. tst_compi_ioctlsocket="no"
  2923. ])
  2924. fi
  2925. #
  2926. if test "$tst_compi_ioctlsocket" = "yes"; then
  2927. AC_MSG_CHECKING([if ioctlsocket usage allowed])
  2928. if test "x$curl_disallow_ioctlsocket" != "xyes"; then
  2929. AC_MSG_RESULT([yes])
  2930. tst_allow_ioctlsocket="yes"
  2931. else
  2932. AC_MSG_RESULT([no])
  2933. tst_allow_ioctlsocket="no"
  2934. fi
  2935. fi
  2936. #
  2937. AC_MSG_CHECKING([if ioctlsocket might be used])
  2938. if test "$tst_links_ioctlsocket" = "yes" &&
  2939. test "$tst_proto_ioctlsocket" = "yes" &&
  2940. test "$tst_compi_ioctlsocket" = "yes" &&
  2941. test "$tst_allow_ioctlsocket" = "yes"; then
  2942. AC_MSG_RESULT([yes])
  2943. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET, 1,
  2944. [Define to 1 if you have the ioctlsocket function.])
  2945. curl_cv_func_ioctlsocket="yes"
  2946. CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO
  2947. else
  2948. AC_MSG_RESULT([no])
  2949. curl_cv_func_ioctlsocket="no"
  2950. fi
  2951. ])
  2952. dnl CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO
  2953. dnl -------------------------------------------------
  2954. dnl Verify if ioctlsocket with the FIONBIO command is
  2955. dnl available, can be compiled, and seems to work. If
  2956. dnl all of these are true, then HAVE_IOCTLSOCKET_FIONBIO
  2957. dnl will be defined.
  2958. AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO], [
  2959. #
  2960. tst_compi_ioctlsocket_fionbio="unknown"
  2961. tst_allow_ioctlsocket_fionbio="unknown"
  2962. #
  2963. if test "$curl_cv_func_ioctlsocket" = "yes"; then
  2964. AC_MSG_CHECKING([if ioctlsocket FIONBIO is compilable])
  2965. AC_COMPILE_IFELSE([
  2966. AC_LANG_PROGRAM([[
  2967. $curl_includes_winsock2
  2968. ]],[[
  2969. unsigned long flags = 0;
  2970. if(0 != ioctlsocket(0, FIONBIO, &flags))
  2971. return 1;
  2972. ]])
  2973. ],[
  2974. AC_MSG_RESULT([yes])
  2975. tst_compi_ioctlsocket_fionbio="yes"
  2976. ],[
  2977. AC_MSG_RESULT([no])
  2978. tst_compi_ioctlsocket_fionbio="no"
  2979. ])
  2980. fi
  2981. #
  2982. if test "$tst_compi_ioctlsocket_fionbio" = "yes"; then
  2983. AC_MSG_CHECKING([if ioctlsocket FIONBIO usage allowed])
  2984. if test "x$curl_disallow_ioctlsocket_fionbio" != "xyes"; then
  2985. AC_MSG_RESULT([yes])
  2986. tst_allow_ioctlsocket_fionbio="yes"
  2987. else
  2988. AC_MSG_RESULT([no])
  2989. tst_allow_ioctlsocket_fionbio="no"
  2990. fi
  2991. fi
  2992. #
  2993. AC_MSG_CHECKING([if ioctlsocket FIONBIO might be used])
  2994. if test "$tst_compi_ioctlsocket_fionbio" = "yes" &&
  2995. test "$tst_allow_ioctlsocket_fionbio" = "yes"; then
  2996. AC_MSG_RESULT([yes])
  2997. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_FIONBIO, 1,
  2998. [Define to 1 if you have a working ioctlsocket FIONBIO function.])
  2999. curl_cv_func_ioctlsocket_fionbio="yes"
  3000. else
  3001. AC_MSG_RESULT([no])
  3002. curl_cv_func_ioctlsocket_fionbio="no"
  3003. fi
  3004. ])
  3005. dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
  3006. dnl -------------------------------------------------
  3007. dnl Verify if IoctlSocket is available, prototyped, and
  3008. dnl can be compiled. If all of these are true, and
  3009. dnl usage has not been previously disallowed with
  3010. dnl shell variable curl_disallow_ioctlsocket_camel,
  3011. dnl then HAVE_IOCTLSOCKET_CAMEL will be defined.
  3012. AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL], [
  3013. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  3014. #
  3015. tst_links_ioctlsocket_camel="unknown"
  3016. tst_proto_ioctlsocket_camel="unknown"
  3017. tst_compi_ioctlsocket_camel="unknown"
  3018. tst_allow_ioctlsocket_camel="unknown"
  3019. #
  3020. AC_MSG_CHECKING([if IoctlSocket can be linked])
  3021. AC_LINK_IFELSE([
  3022. AC_LANG_PROGRAM([[
  3023. $curl_includes_bsdsocket
  3024. ]],[[
  3025. IoctlSocket(0, 0, 0);
  3026. ]])
  3027. ],[
  3028. AC_MSG_RESULT([yes])
  3029. tst_links_ioctlsocket_camel="yes"
  3030. ],[
  3031. AC_MSG_RESULT([no])
  3032. tst_links_ioctlsocket_camel="no"
  3033. ])
  3034. #
  3035. if test "$tst_links_ioctlsocket_camel" = "yes"; then
  3036. AC_MSG_CHECKING([if IoctlSocket is prototyped])
  3037. AC_EGREP_CPP([IoctlSocket],[
  3038. $curl_includes_bsdsocket
  3039. ],[
  3040. AC_MSG_RESULT([yes])
  3041. tst_proto_ioctlsocket_camel="yes"
  3042. ],[
  3043. AC_MSG_RESULT([no])
  3044. tst_proto_ioctlsocket_camel="no"
  3045. ])
  3046. fi
  3047. #
  3048. if test "$tst_proto_ioctlsocket_camel" = "yes"; then
  3049. AC_MSG_CHECKING([if IoctlSocket is compilable])
  3050. AC_COMPILE_IFELSE([
  3051. AC_LANG_PROGRAM([[
  3052. $curl_includes_bsdsocket
  3053. ]],[[
  3054. if(0 != IoctlSocket(0, 0, 0))
  3055. return 1;
  3056. ]])
  3057. ],[
  3058. AC_MSG_RESULT([yes])
  3059. tst_compi_ioctlsocket_camel="yes"
  3060. ],[
  3061. AC_MSG_RESULT([no])
  3062. tst_compi_ioctlsocket_camel="no"
  3063. ])
  3064. fi
  3065. #
  3066. if test "$tst_compi_ioctlsocket_camel" = "yes"; then
  3067. AC_MSG_CHECKING([if IoctlSocket usage allowed])
  3068. if test "x$curl_disallow_ioctlsocket_camel" != "xyes"; then
  3069. AC_MSG_RESULT([yes])
  3070. tst_allow_ioctlsocket_camel="yes"
  3071. else
  3072. AC_MSG_RESULT([no])
  3073. tst_allow_ioctlsocket_camel="no"
  3074. fi
  3075. fi
  3076. #
  3077. AC_MSG_CHECKING([if IoctlSocket might be used])
  3078. if test "$tst_links_ioctlsocket_camel" = "yes" &&
  3079. test "$tst_proto_ioctlsocket_camel" = "yes" &&
  3080. test "$tst_compi_ioctlsocket_camel" = "yes" &&
  3081. test "$tst_allow_ioctlsocket_camel" = "yes"; then
  3082. AC_MSG_RESULT([yes])
  3083. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL, 1,
  3084. [Define to 1 if you have the IoctlSocket camel case function.])
  3085. curl_cv_func_ioctlsocket_camel="yes"
  3086. CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO
  3087. else
  3088. AC_MSG_RESULT([no])
  3089. curl_cv_func_ioctlsocket_camel="no"
  3090. fi
  3091. ])
  3092. dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO
  3093. dnl -------------------------------------------------
  3094. dnl Verify if IoctlSocket with FIONBIO command is available,
  3095. dnl can be compiled, and seems to work. If all of these are
  3096. dnl true, then HAVE_IOCTLSOCKET_CAMEL_FIONBIO will be defined.
  3097. AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO], [
  3098. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  3099. #
  3100. tst_compi_ioctlsocket_camel_fionbio="unknown"
  3101. tst_allow_ioctlsocket_camel_fionbio="unknown"
  3102. #
  3103. if test "$curl_cv_func_ioctlsocket_camel" = "yes"; then
  3104. AC_MSG_CHECKING([if IoctlSocket FIONBIO is compilable])
  3105. AC_COMPILE_IFELSE([
  3106. AC_LANG_PROGRAM([[
  3107. $curl_includes_bsdsocket
  3108. ]],[[
  3109. long flags = 0;
  3110. if(0 != IoctlSocket(0, FIONBIO, &flags))
  3111. return 1;
  3112. ]])
  3113. ],[
  3114. AC_MSG_RESULT([yes])
  3115. tst_compi_ioctlsocket_camel_fionbio="yes"
  3116. ],[
  3117. AC_MSG_RESULT([no])
  3118. tst_compi_ioctlsocket_camel_fionbio="no"
  3119. ])
  3120. fi
  3121. #
  3122. if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes"; then
  3123. AC_MSG_CHECKING([if IoctlSocket FIONBIO usage allowed])
  3124. if test "x$curl_disallow_ioctlsocket_camel_fionbio" != "xyes"; then
  3125. AC_MSG_RESULT([yes])
  3126. tst_allow_ioctlsocket_camel_fionbio="yes"
  3127. else
  3128. AC_MSG_RESULT([no])
  3129. tst_allow_ioctlsocket_camel_fionbio="no"
  3130. fi
  3131. fi
  3132. #
  3133. AC_MSG_CHECKING([if IoctlSocket FIONBIO might be used])
  3134. if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes" &&
  3135. test "$tst_allow_ioctlsocket_camel_fionbio" = "yes"; then
  3136. AC_MSG_RESULT([yes])
  3137. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL_FIONBIO, 1,
  3138. [Define to 1 if you have a working IoctlSocket camel case FIONBIO function.])
  3139. curl_cv_func_ioctlsocket_camel_fionbio="yes"
  3140. else
  3141. AC_MSG_RESULT([no])
  3142. curl_cv_func_ioctlsocket_camel_fionbio="no"
  3143. fi
  3144. ])
  3145. dnl CURL_CHECK_FUNC_MEMRCHR
  3146. dnl -------------------------------------------------
  3147. dnl Verify if memrchr is available, prototyped, and
  3148. dnl can be compiled. If all of these are true, and
  3149. dnl usage has not been previously disallowed with
  3150. dnl shell variable curl_disallow_memrchr, then
  3151. dnl HAVE_MEMRCHR will be defined.
  3152. AC_DEFUN([CURL_CHECK_FUNC_MEMRCHR], [
  3153. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  3154. #
  3155. tst_links_memrchr="unknown"
  3156. tst_macro_memrchr="unknown"
  3157. tst_proto_memrchr="unknown"
  3158. tst_compi_memrchr="unknown"
  3159. tst_allow_memrchr="unknown"
  3160. #
  3161. AC_MSG_CHECKING([if memrchr can be linked])
  3162. AC_LINK_IFELSE([
  3163. AC_LANG_FUNC_LINK_TRY([memrchr])
  3164. ],[
  3165. AC_MSG_RESULT([yes])
  3166. tst_links_memrchr="yes"
  3167. ],[
  3168. AC_MSG_RESULT([no])
  3169. tst_links_memrchr="no"
  3170. ])
  3171. #
  3172. if test "$tst_links_memrchr" = "no"; then
  3173. AC_MSG_CHECKING([if memrchr seems a macro])
  3174. AC_LINK_IFELSE([
  3175. AC_LANG_PROGRAM([[
  3176. $curl_includes_string
  3177. ]],[[
  3178. if(0 != memrchr(0, 0, 0))
  3179. return 1;
  3180. ]])
  3181. ],[
  3182. AC_MSG_RESULT([yes])
  3183. tst_macro_memrchr="yes"
  3184. ],[
  3185. AC_MSG_RESULT([no])
  3186. tst_macro_memrchr="no"
  3187. ])
  3188. fi
  3189. #
  3190. if test "$tst_links_memrchr" = "yes"; then
  3191. AC_MSG_CHECKING([if memrchr is prototyped])
  3192. AC_EGREP_CPP([memrchr],[
  3193. $curl_includes_string
  3194. ],[
  3195. AC_MSG_RESULT([yes])
  3196. tst_proto_memrchr="yes"
  3197. ],[
  3198. AC_MSG_RESULT([no])
  3199. tst_proto_memrchr="no"
  3200. ])
  3201. fi
  3202. #
  3203. if test "$tst_proto_memrchr" = "yes" ||
  3204. test "$tst_macro_memrchr" = "yes"; then
  3205. AC_MSG_CHECKING([if memrchr is compilable])
  3206. AC_COMPILE_IFELSE([
  3207. AC_LANG_PROGRAM([[
  3208. $curl_includes_string
  3209. ]],[[
  3210. if(0 != memrchr(0, 0, 0))
  3211. return 1;
  3212. ]])
  3213. ],[
  3214. AC_MSG_RESULT([yes])
  3215. tst_compi_memrchr="yes"
  3216. ],[
  3217. AC_MSG_RESULT([no])
  3218. tst_compi_memrchr="no"
  3219. ])
  3220. fi
  3221. #
  3222. if test "$tst_compi_memrchr" = "yes"; then
  3223. AC_MSG_CHECKING([if memrchr usage allowed])
  3224. if test "x$curl_disallow_memrchr" != "xyes"; then
  3225. AC_MSG_RESULT([yes])
  3226. tst_allow_memrchr="yes"
  3227. else
  3228. AC_MSG_RESULT([no])
  3229. tst_allow_memrchr="no"
  3230. fi
  3231. fi
  3232. #
  3233. AC_MSG_CHECKING([if memrchr might be used])
  3234. if (test "$tst_proto_memrchr" = "yes" ||
  3235. test "$tst_macro_memrchr" = "yes") &&
  3236. test "$tst_compi_memrchr" = "yes" &&
  3237. test "$tst_allow_memrchr" = "yes"; then
  3238. AC_MSG_RESULT([yes])
  3239. AC_DEFINE_UNQUOTED(HAVE_MEMRCHR, 1,
  3240. [Define to 1 if you have the memrchr function or macro.])
  3241. curl_cv_func_memrchr="yes"
  3242. else
  3243. AC_MSG_RESULT([no])
  3244. curl_cv_func_memrchr="no"
  3245. fi
  3246. ])
  3247. dnl CURL_CHECK_FUNC_POLL
  3248. dnl -------------------------------------------------
  3249. dnl Verify if poll is available, prototyped, can
  3250. dnl be compiled and seems to work.
  3251. AC_DEFUN([CURL_CHECK_FUNC_POLL], [
  3252. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  3253. AC_REQUIRE([CURL_INCLUDES_POLL])dnl
  3254. #
  3255. tst_links_poll="unknown"
  3256. tst_proto_poll="unknown"
  3257. tst_compi_poll="unknown"
  3258. tst_works_poll="unknown"
  3259. tst_allow_poll="unknown"
  3260. #
  3261. case $host_os in
  3262. darwin*|interix*)
  3263. dnl poll() does not work on these platforms
  3264. dnl Interix: "does provide poll(), but the implementing developer must
  3265. dnl have been in a bad mood, because poll() only works on the /proc
  3266. dnl filesystem here"
  3267. dnl macOS: poll() first didn't exist, then was broken until fixed in 10.9
  3268. dnl only to break again in 10.12.
  3269. curl_disallow_poll="yes"
  3270. tst_compi_poll="no"
  3271. ;;
  3272. esac
  3273. #
  3274. AC_MSG_CHECKING([if poll can be linked])
  3275. AC_LINK_IFELSE([
  3276. AC_LANG_PROGRAM([[
  3277. $curl_includes_poll
  3278. ]],[[
  3279. if(0 != poll(0, 0, 0))
  3280. return 1;
  3281. ]])
  3282. ],[
  3283. AC_MSG_RESULT([yes])
  3284. tst_links_poll="yes"
  3285. ],[
  3286. AC_MSG_RESULT([no])
  3287. tst_links_poll="no"
  3288. ])
  3289. #
  3290. if test "$tst_links_poll" = "yes"; then
  3291. AC_MSG_CHECKING([if poll is prototyped])
  3292. AC_EGREP_CPP([poll],[
  3293. $curl_includes_poll
  3294. ],[
  3295. AC_MSG_RESULT([yes])
  3296. tst_proto_poll="yes"
  3297. ],[
  3298. AC_MSG_RESULT([no])
  3299. tst_proto_poll="no"
  3300. ])
  3301. fi
  3302. #
  3303. if test "$tst_proto_poll" = "yes"; then
  3304. AC_MSG_CHECKING([if poll is compilable])
  3305. AC_COMPILE_IFELSE([
  3306. AC_LANG_PROGRAM([[
  3307. $curl_includes_poll
  3308. ]],[[
  3309. if(0 != poll(0, 0, 0))
  3310. return 1;
  3311. ]])
  3312. ],[
  3313. AC_MSG_RESULT([yes])
  3314. tst_compi_poll="yes"
  3315. ],[
  3316. AC_MSG_RESULT([no])
  3317. tst_compi_poll="no"
  3318. ])
  3319. fi
  3320. #
  3321. dnl only do runtime verification when not cross-compiling
  3322. if test "$tst_compi_poll" = "yes"; then
  3323. if test "x$cross_compiling" != "xyes"; then
  3324. AC_MSG_CHECKING([if poll seems to work])
  3325. CURL_RUN_IFELSE([
  3326. AC_LANG_PROGRAM([[
  3327. $curl_includes_stdlib
  3328. $curl_includes_poll
  3329. ]],[[
  3330. /* detect the original poll() breakage */
  3331. if(0 != poll(0, 0, 10)) {
  3332. return 1; /* fail */
  3333. }
  3334. ]])
  3335. ],[
  3336. AC_MSG_RESULT([yes])
  3337. tst_works_poll="yes"
  3338. ],[
  3339. AC_MSG_RESULT([no])
  3340. tst_works_poll="no"
  3341. ])
  3342. else
  3343. AC_MSG_CHECKING([if native poll seems to be supported])
  3344. AC_COMPILE_IFELSE([
  3345. AC_LANG_PROGRAM([[
  3346. $curl_includes_stdlib
  3347. ]],[[
  3348. #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L
  3349. return 0;
  3350. #else
  3351. #error force compilation error
  3352. #endif
  3353. ]])
  3354. ],[
  3355. AC_MSG_RESULT([yes])
  3356. tst_works_poll="yes"
  3357. ],[
  3358. AC_MSG_RESULT([no])
  3359. tst_works_poll="no"
  3360. ])
  3361. fi
  3362. fi
  3363. #
  3364. if test "$tst_compi_poll" = "yes" &&
  3365. test "$tst_works_poll" != "no"; then
  3366. AC_MSG_CHECKING([if poll usage allowed])
  3367. if test "x$curl_disallow_poll" != "xyes"; then
  3368. AC_MSG_RESULT([yes])
  3369. tst_allow_poll="yes"
  3370. else
  3371. AC_MSG_RESULT([no])
  3372. tst_allow_poll="no"
  3373. fi
  3374. fi
  3375. #
  3376. AC_MSG_CHECKING([if poll might be used])
  3377. if test "$tst_links_poll" = "yes" &&
  3378. test "$tst_proto_poll" = "yes" &&
  3379. test "$tst_compi_poll" = "yes" &&
  3380. test "$tst_allow_poll" = "yes" &&
  3381. test "$tst_works_poll" != "no"; then
  3382. AC_MSG_RESULT([yes])
  3383. AC_DEFINE_UNQUOTED(HAVE_POLL_FINE, 1,
  3384. [If you have a fine poll])
  3385. curl_cv_func_poll="yes"
  3386. else
  3387. AC_MSG_RESULT([no])
  3388. curl_cv_func_poll="no"
  3389. fi
  3390. ])
  3391. fi
  3392. ])
  3393. dnl CURL_CHECK_FUNC_SIGACTION
  3394. dnl -------------------------------------------------
  3395. dnl Verify if sigaction is available, prototyped, and
  3396. dnl can be compiled. If all of these are true, and
  3397. dnl usage has not been previously disallowed with
  3398. dnl shell variable curl_disallow_sigaction, then
  3399. dnl HAVE_SIGACTION will be defined.
  3400. AC_DEFUN([CURL_CHECK_FUNC_SIGACTION], [
  3401. AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
  3402. #
  3403. tst_links_sigaction="unknown"
  3404. tst_proto_sigaction="unknown"
  3405. tst_compi_sigaction="unknown"
  3406. tst_allow_sigaction="unknown"
  3407. #
  3408. AC_MSG_CHECKING([if sigaction can be linked])
  3409. AC_LINK_IFELSE([
  3410. AC_LANG_FUNC_LINK_TRY([sigaction])
  3411. ],[
  3412. AC_MSG_RESULT([yes])
  3413. tst_links_sigaction="yes"
  3414. ],[
  3415. AC_MSG_RESULT([no])
  3416. tst_links_sigaction="no"
  3417. ])
  3418. #
  3419. if test "$tst_links_sigaction" = "yes"; then
  3420. AC_MSG_CHECKING([if sigaction is prototyped])
  3421. AC_EGREP_CPP([sigaction],[
  3422. $curl_includes_signal
  3423. ],[
  3424. AC_MSG_RESULT([yes])
  3425. tst_proto_sigaction="yes"
  3426. ],[
  3427. AC_MSG_RESULT([no])
  3428. tst_proto_sigaction="no"
  3429. ])
  3430. fi
  3431. #
  3432. if test "$tst_proto_sigaction" = "yes"; then
  3433. AC_MSG_CHECKING([if sigaction is compilable])
  3434. AC_COMPILE_IFELSE([
  3435. AC_LANG_PROGRAM([[
  3436. $curl_includes_signal
  3437. ]],[[
  3438. if(0 != sigaction(0, 0, 0))
  3439. return 1;
  3440. ]])
  3441. ],[
  3442. AC_MSG_RESULT([yes])
  3443. tst_compi_sigaction="yes"
  3444. ],[
  3445. AC_MSG_RESULT([no])
  3446. tst_compi_sigaction="no"
  3447. ])
  3448. fi
  3449. #
  3450. if test "$tst_compi_sigaction" = "yes"; then
  3451. AC_MSG_CHECKING([if sigaction usage allowed])
  3452. if test "x$curl_disallow_sigaction" != "xyes"; then
  3453. AC_MSG_RESULT([yes])
  3454. tst_allow_sigaction="yes"
  3455. else
  3456. AC_MSG_RESULT([no])
  3457. tst_allow_sigaction="no"
  3458. fi
  3459. fi
  3460. #
  3461. AC_MSG_CHECKING([if sigaction might be used])
  3462. if test "$tst_links_sigaction" = "yes" &&
  3463. test "$tst_proto_sigaction" = "yes" &&
  3464. test "$tst_compi_sigaction" = "yes" &&
  3465. test "$tst_allow_sigaction" = "yes"; then
  3466. AC_MSG_RESULT([yes])
  3467. AC_DEFINE_UNQUOTED(HAVE_SIGACTION, 1,
  3468. [Define to 1 if you have the sigaction function.])
  3469. curl_cv_func_sigaction="yes"
  3470. else
  3471. AC_MSG_RESULT([no])
  3472. curl_cv_func_sigaction="no"
  3473. fi
  3474. ])
  3475. dnl CURL_CHECK_FUNC_SIGINTERRUPT
  3476. dnl -------------------------------------------------
  3477. dnl Verify if siginterrupt is available, prototyped, and
  3478. dnl can be compiled. If all of these are true, and
  3479. dnl usage has not been previously disallowed with
  3480. dnl shell variable curl_disallow_siginterrupt, then
  3481. dnl HAVE_SIGINTERRUPT will be defined.
  3482. AC_DEFUN([CURL_CHECK_FUNC_SIGINTERRUPT], [
  3483. AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
  3484. #
  3485. tst_links_siginterrupt="unknown"
  3486. tst_proto_siginterrupt="unknown"
  3487. tst_compi_siginterrupt="unknown"
  3488. tst_allow_siginterrupt="unknown"
  3489. #
  3490. AC_MSG_CHECKING([if siginterrupt can be linked])
  3491. AC_LINK_IFELSE([
  3492. AC_LANG_FUNC_LINK_TRY([siginterrupt])
  3493. ],[
  3494. AC_MSG_RESULT([yes])
  3495. tst_links_siginterrupt="yes"
  3496. ],[
  3497. AC_MSG_RESULT([no])
  3498. tst_links_siginterrupt="no"
  3499. ])
  3500. #
  3501. if test "$tst_links_siginterrupt" = "yes"; then
  3502. AC_MSG_CHECKING([if siginterrupt is prototyped])
  3503. AC_EGREP_CPP([siginterrupt],[
  3504. $curl_includes_signal
  3505. ],[
  3506. AC_MSG_RESULT([yes])
  3507. tst_proto_siginterrupt="yes"
  3508. ],[
  3509. AC_MSG_RESULT([no])
  3510. tst_proto_siginterrupt="no"
  3511. ])
  3512. fi
  3513. #
  3514. if test "$tst_proto_siginterrupt" = "yes"; then
  3515. AC_MSG_CHECKING([if siginterrupt is compilable])
  3516. AC_COMPILE_IFELSE([
  3517. AC_LANG_PROGRAM([[
  3518. $curl_includes_signal
  3519. ]],[[
  3520. if(0 != siginterrupt(0, 0))
  3521. return 1;
  3522. ]])
  3523. ],[
  3524. AC_MSG_RESULT([yes])
  3525. tst_compi_siginterrupt="yes"
  3526. ],[
  3527. AC_MSG_RESULT([no])
  3528. tst_compi_siginterrupt="no"
  3529. ])
  3530. fi
  3531. #
  3532. if test "$tst_compi_siginterrupt" = "yes"; then
  3533. AC_MSG_CHECKING([if siginterrupt usage allowed])
  3534. if test "x$curl_disallow_siginterrupt" != "xyes"; then
  3535. AC_MSG_RESULT([yes])
  3536. tst_allow_siginterrupt="yes"
  3537. else
  3538. AC_MSG_RESULT([no])
  3539. tst_allow_siginterrupt="no"
  3540. fi
  3541. fi
  3542. #
  3543. AC_MSG_CHECKING([if siginterrupt might be used])
  3544. if test "$tst_links_siginterrupt" = "yes" &&
  3545. test "$tst_proto_siginterrupt" = "yes" &&
  3546. test "$tst_compi_siginterrupt" = "yes" &&
  3547. test "$tst_allow_siginterrupt" = "yes"; then
  3548. AC_MSG_RESULT([yes])
  3549. AC_DEFINE_UNQUOTED(HAVE_SIGINTERRUPT, 1,
  3550. [Define to 1 if you have the siginterrupt function.])
  3551. curl_cv_func_siginterrupt="yes"
  3552. else
  3553. AC_MSG_RESULT([no])
  3554. curl_cv_func_siginterrupt="no"
  3555. fi
  3556. ])
  3557. dnl CURL_CHECK_FUNC_SIGNAL
  3558. dnl -------------------------------------------------
  3559. dnl Verify if signal is available, prototyped, and
  3560. dnl can be compiled. If all of these are true, and
  3561. dnl usage has not been previously disallowed with
  3562. dnl shell variable curl_disallow_signal, then
  3563. dnl HAVE_SIGNAL will be defined.
  3564. AC_DEFUN([CURL_CHECK_FUNC_SIGNAL], [
  3565. AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
  3566. #
  3567. tst_links_signal="unknown"
  3568. tst_proto_signal="unknown"
  3569. tst_compi_signal="unknown"
  3570. tst_allow_signal="unknown"
  3571. #
  3572. AC_MSG_CHECKING([if signal can be linked])
  3573. AC_LINK_IFELSE([
  3574. AC_LANG_FUNC_LINK_TRY([signal])
  3575. ],[
  3576. AC_MSG_RESULT([yes])
  3577. tst_links_signal="yes"
  3578. ],[
  3579. AC_MSG_RESULT([no])
  3580. tst_links_signal="no"
  3581. ])
  3582. #
  3583. if test "$tst_links_signal" = "yes"; then
  3584. AC_MSG_CHECKING([if signal is prototyped])
  3585. AC_EGREP_CPP([signal],[
  3586. $curl_includes_signal
  3587. ],[
  3588. AC_MSG_RESULT([yes])
  3589. tst_proto_signal="yes"
  3590. ],[
  3591. AC_MSG_RESULT([no])
  3592. tst_proto_signal="no"
  3593. ])
  3594. fi
  3595. #
  3596. if test "$tst_proto_signal" = "yes"; then
  3597. AC_MSG_CHECKING([if signal is compilable])
  3598. AC_COMPILE_IFELSE([
  3599. AC_LANG_PROGRAM([[
  3600. $curl_includes_signal
  3601. ]],[[
  3602. if(0 != signal(0, 0))
  3603. return 1;
  3604. ]])
  3605. ],[
  3606. AC_MSG_RESULT([yes])
  3607. tst_compi_signal="yes"
  3608. ],[
  3609. AC_MSG_RESULT([no])
  3610. tst_compi_signal="no"
  3611. ])
  3612. fi
  3613. #
  3614. if test "$tst_compi_signal" = "yes"; then
  3615. AC_MSG_CHECKING([if signal usage allowed])
  3616. if test "x$curl_disallow_signal" != "xyes"; then
  3617. AC_MSG_RESULT([yes])
  3618. tst_allow_signal="yes"
  3619. else
  3620. AC_MSG_RESULT([no])
  3621. tst_allow_signal="no"
  3622. fi
  3623. fi
  3624. #
  3625. AC_MSG_CHECKING([if signal might be used])
  3626. if test "$tst_links_signal" = "yes" &&
  3627. test "$tst_proto_signal" = "yes" &&
  3628. test "$tst_compi_signal" = "yes" &&
  3629. test "$tst_allow_signal" = "yes"; then
  3630. AC_MSG_RESULT([yes])
  3631. AC_DEFINE_UNQUOTED(HAVE_SIGNAL, 1,
  3632. [Define to 1 if you have the signal function.])
  3633. curl_cv_func_signal="yes"
  3634. else
  3635. AC_MSG_RESULT([no])
  3636. curl_cv_func_signal="no"
  3637. fi
  3638. ])
  3639. dnl CURL_CHECK_FUNC_SIGSETJMP
  3640. dnl -------------------------------------------------
  3641. dnl Verify if sigsetjmp is available, prototyped, and
  3642. dnl can be compiled. If all of these are true, and
  3643. dnl usage has not been previously disallowed with
  3644. dnl shell variable curl_disallow_sigsetjmp, then
  3645. dnl HAVE_SIGSETJMP will be defined.
  3646. AC_DEFUN([CURL_CHECK_FUNC_SIGSETJMP], [
  3647. AC_REQUIRE([CURL_INCLUDES_SETJMP])dnl
  3648. #
  3649. tst_links_sigsetjmp="unknown"
  3650. tst_macro_sigsetjmp="unknown"
  3651. tst_proto_sigsetjmp="unknown"
  3652. tst_compi_sigsetjmp="unknown"
  3653. tst_allow_sigsetjmp="unknown"
  3654. #
  3655. AC_MSG_CHECKING([if sigsetjmp can be linked])
  3656. AC_LINK_IFELSE([
  3657. AC_LANG_FUNC_LINK_TRY([sigsetjmp])
  3658. ],[
  3659. AC_MSG_RESULT([yes])
  3660. tst_links_sigsetjmp="yes"
  3661. ],[
  3662. AC_MSG_RESULT([no])
  3663. tst_links_sigsetjmp="no"
  3664. ])
  3665. #
  3666. if test "$tst_links_sigsetjmp" = "no"; then
  3667. AC_MSG_CHECKING([if sigsetjmp seems a macro])
  3668. AC_LINK_IFELSE([
  3669. AC_LANG_PROGRAM([[
  3670. $curl_includes_setjmp
  3671. ]],[[
  3672. sigjmp_buf env;
  3673. if(0 != sigsetjmp(env, 0))
  3674. return 1;
  3675. ]])
  3676. ],[
  3677. AC_MSG_RESULT([yes])
  3678. tst_macro_sigsetjmp="yes"
  3679. ],[
  3680. AC_MSG_RESULT([no])
  3681. tst_macro_sigsetjmp="no"
  3682. ])
  3683. fi
  3684. #
  3685. if test "$tst_links_sigsetjmp" = "yes"; then
  3686. AC_MSG_CHECKING([if sigsetjmp is prototyped])
  3687. AC_EGREP_CPP([sigsetjmp],[
  3688. $curl_includes_setjmp
  3689. ],[
  3690. AC_MSG_RESULT([yes])
  3691. tst_proto_sigsetjmp="yes"
  3692. ],[
  3693. AC_MSG_RESULT([no])
  3694. tst_proto_sigsetjmp="no"
  3695. ])
  3696. fi
  3697. #
  3698. if test "$tst_proto_sigsetjmp" = "yes" ||
  3699. test "$tst_macro_sigsetjmp" = "yes"; then
  3700. AC_MSG_CHECKING([if sigsetjmp is compilable])
  3701. AC_COMPILE_IFELSE([
  3702. AC_LANG_PROGRAM([[
  3703. $curl_includes_setjmp
  3704. ]],[[
  3705. sigjmp_buf env;
  3706. if(0 != sigsetjmp(env, 0))
  3707. return 1;
  3708. ]])
  3709. ],[
  3710. AC_MSG_RESULT([yes])
  3711. tst_compi_sigsetjmp="yes"
  3712. ],[
  3713. AC_MSG_RESULT([no])
  3714. tst_compi_sigsetjmp="no"
  3715. ])
  3716. fi
  3717. #
  3718. if test "$tst_compi_sigsetjmp" = "yes"; then
  3719. AC_MSG_CHECKING([if sigsetjmp usage allowed])
  3720. if test "x$curl_disallow_sigsetjmp" != "xyes"; then
  3721. AC_MSG_RESULT([yes])
  3722. tst_allow_sigsetjmp="yes"
  3723. else
  3724. AC_MSG_RESULT([no])
  3725. tst_allow_sigsetjmp="no"
  3726. fi
  3727. fi
  3728. #
  3729. AC_MSG_CHECKING([if sigsetjmp might be used])
  3730. if (test "$tst_proto_sigsetjmp" = "yes" ||
  3731. test "$tst_macro_sigsetjmp" = "yes") &&
  3732. test "$tst_compi_sigsetjmp" = "yes" &&
  3733. test "$tst_allow_sigsetjmp" = "yes"; then
  3734. AC_MSG_RESULT([yes])
  3735. AC_DEFINE_UNQUOTED(HAVE_SIGSETJMP, 1,
  3736. [Define to 1 if you have the sigsetjmp function or macro.])
  3737. curl_cv_func_sigsetjmp="yes"
  3738. else
  3739. AC_MSG_RESULT([no])
  3740. curl_cv_func_sigsetjmp="no"
  3741. fi
  3742. ])
  3743. dnl CURL_CHECK_FUNC_SOCKET
  3744. dnl -------------------------------------------------
  3745. dnl Verify if socket is available, prototyped, and
  3746. dnl can be compiled. If all of these are true, and
  3747. dnl usage has not been previously disallowed with
  3748. dnl shell variable curl_disallow_socket, then
  3749. dnl HAVE_SOCKET will be defined.
  3750. AC_DEFUN([CURL_CHECK_FUNC_SOCKET], [
  3751. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  3752. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  3753. AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
  3754. #
  3755. tst_links_socket="unknown"
  3756. tst_proto_socket="unknown"
  3757. tst_compi_socket="unknown"
  3758. tst_allow_socket="unknown"
  3759. #
  3760. AC_MSG_CHECKING([if socket can be linked])
  3761. AC_LINK_IFELSE([
  3762. AC_LANG_PROGRAM([[
  3763. $curl_includes_winsock2
  3764. $curl_includes_bsdsocket
  3765. $curl_includes_sys_socket
  3766. $curl_includes_socket
  3767. ]],[[
  3768. if(0 != socket(0, 0, 0))
  3769. return 1;
  3770. ]])
  3771. ],[
  3772. AC_MSG_RESULT([yes])
  3773. tst_links_socket="yes"
  3774. ],[
  3775. AC_MSG_RESULT([no])
  3776. tst_links_socket="no"
  3777. ])
  3778. #
  3779. if test "$tst_links_socket" = "yes"; then
  3780. AC_MSG_CHECKING([if socket is prototyped])
  3781. AC_EGREP_CPP([socket],[
  3782. $curl_includes_winsock2
  3783. $curl_includes_bsdsocket
  3784. $curl_includes_sys_socket
  3785. $curl_includes_socket
  3786. ],[
  3787. AC_MSG_RESULT([yes])
  3788. tst_proto_socket="yes"
  3789. ],[
  3790. AC_MSG_RESULT([no])
  3791. tst_proto_socket="no"
  3792. ])
  3793. fi
  3794. #
  3795. if test "$tst_proto_socket" = "yes"; then
  3796. AC_MSG_CHECKING([if socket is compilable])
  3797. AC_COMPILE_IFELSE([
  3798. AC_LANG_PROGRAM([[
  3799. $curl_includes_winsock2
  3800. $curl_includes_bsdsocket
  3801. $curl_includes_sys_socket
  3802. $curl_includes_socket
  3803. ]],[[
  3804. if(0 != socket(0, 0, 0))
  3805. return 1;
  3806. ]])
  3807. ],[
  3808. AC_MSG_RESULT([yes])
  3809. tst_compi_socket="yes"
  3810. ],[
  3811. AC_MSG_RESULT([no])
  3812. tst_compi_socket="no"
  3813. ])
  3814. fi
  3815. #
  3816. if test "$tst_compi_socket" = "yes"; then
  3817. AC_MSG_CHECKING([if socket usage allowed])
  3818. if test "x$curl_disallow_socket" != "xyes"; then
  3819. AC_MSG_RESULT([yes])
  3820. tst_allow_socket="yes"
  3821. else
  3822. AC_MSG_RESULT([no])
  3823. tst_allow_socket="no"
  3824. fi
  3825. fi
  3826. #
  3827. AC_MSG_CHECKING([if socket might be used])
  3828. if test "$tst_links_socket" = "yes" &&
  3829. test "$tst_proto_socket" = "yes" &&
  3830. test "$tst_compi_socket" = "yes" &&
  3831. test "$tst_allow_socket" = "yes"; then
  3832. AC_MSG_RESULT([yes])
  3833. AC_DEFINE_UNQUOTED(HAVE_SOCKET, 1,
  3834. [Define to 1 if you have the socket function.])
  3835. curl_cv_func_socket="yes"
  3836. else
  3837. AC_MSG_RESULT([no])
  3838. curl_cv_func_socket="no"
  3839. fi
  3840. ])
  3841. dnl CURL_CHECK_FUNC_SOCKETPAIR
  3842. dnl -------------------------------------------------
  3843. dnl Verify if socketpair is available, prototyped, and
  3844. dnl can be compiled. If all of these are true, and
  3845. dnl usage has not been previously disallowed with
  3846. dnl shell variable curl_disallow_socketpair, then
  3847. dnl HAVE_SOCKETPAIR will be defined.
  3848. AC_DEFUN([CURL_CHECK_FUNC_SOCKETPAIR], [
  3849. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  3850. AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
  3851. #
  3852. tst_links_socketpair="unknown"
  3853. tst_proto_socketpair="unknown"
  3854. tst_compi_socketpair="unknown"
  3855. tst_allow_socketpair="unknown"
  3856. #
  3857. AC_MSG_CHECKING([if socketpair can be linked])
  3858. AC_LINK_IFELSE([
  3859. AC_LANG_FUNC_LINK_TRY([socketpair])
  3860. ],[
  3861. AC_MSG_RESULT([yes])
  3862. tst_links_socketpair="yes"
  3863. ],[
  3864. AC_MSG_RESULT([no])
  3865. tst_links_socketpair="no"
  3866. ])
  3867. #
  3868. if test "$tst_links_socketpair" = "yes"; then
  3869. AC_MSG_CHECKING([if socketpair is prototyped])
  3870. AC_EGREP_CPP([socketpair],[
  3871. $curl_includes_sys_socket
  3872. $curl_includes_socket
  3873. ],[
  3874. AC_MSG_RESULT([yes])
  3875. tst_proto_socketpair="yes"
  3876. ],[
  3877. AC_MSG_RESULT([no])
  3878. tst_proto_socketpair="no"
  3879. ])
  3880. fi
  3881. #
  3882. if test "$tst_proto_socketpair" = "yes"; then
  3883. AC_MSG_CHECKING([if socketpair is compilable])
  3884. AC_COMPILE_IFELSE([
  3885. AC_LANG_PROGRAM([[
  3886. $curl_includes_sys_socket
  3887. $curl_includes_socket
  3888. ]],[[
  3889. int sv[2];
  3890. if(0 != socketpair(0, 0, 0, sv))
  3891. return 1;
  3892. ]])
  3893. ],[
  3894. AC_MSG_RESULT([yes])
  3895. tst_compi_socketpair="yes"
  3896. ],[
  3897. AC_MSG_RESULT([no])
  3898. tst_compi_socketpair="no"
  3899. ])
  3900. fi
  3901. #
  3902. if test "$tst_compi_socketpair" = "yes"; then
  3903. AC_MSG_CHECKING([if socketpair usage allowed])
  3904. if test "x$curl_disallow_socketpair" != "xyes"; then
  3905. AC_MSG_RESULT([yes])
  3906. tst_allow_socketpair="yes"
  3907. else
  3908. AC_MSG_RESULT([no])
  3909. tst_allow_socketpair="no"
  3910. fi
  3911. fi
  3912. #
  3913. AC_MSG_CHECKING([if socketpair might be used])
  3914. if test "$tst_links_socketpair" = "yes" &&
  3915. test "$tst_proto_socketpair" = "yes" &&
  3916. test "$tst_compi_socketpair" = "yes" &&
  3917. test "$tst_allow_socketpair" = "yes"; then
  3918. AC_MSG_RESULT([yes])
  3919. AC_DEFINE_UNQUOTED(HAVE_SOCKETPAIR, 1,
  3920. [Define to 1 if you have the socketpair function.])
  3921. curl_cv_func_socketpair="yes"
  3922. else
  3923. AC_MSG_RESULT([no])
  3924. curl_cv_func_socketpair="no"
  3925. fi
  3926. ])
  3927. dnl CURL_CHECK_FUNC_STRCASECMP
  3928. dnl -------------------------------------------------
  3929. dnl Verify if strcasecmp is available, prototyped, and
  3930. dnl can be compiled. If all of these are true, and
  3931. dnl usage has not been previously disallowed with
  3932. dnl shell variable curl_disallow_strcasecmp, then
  3933. dnl HAVE_STRCASECMP will be defined.
  3934. AC_DEFUN([CURL_CHECK_FUNC_STRCASECMP], [
  3935. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  3936. #
  3937. tst_links_strcasecmp="unknown"
  3938. tst_proto_strcasecmp="unknown"
  3939. tst_compi_strcasecmp="unknown"
  3940. tst_allow_strcasecmp="unknown"
  3941. #
  3942. AC_MSG_CHECKING([if strcasecmp can be linked])
  3943. AC_LINK_IFELSE([
  3944. AC_LANG_FUNC_LINK_TRY([strcasecmp])
  3945. ],[
  3946. AC_MSG_RESULT([yes])
  3947. tst_links_strcasecmp="yes"
  3948. ],[
  3949. AC_MSG_RESULT([no])
  3950. tst_links_strcasecmp="no"
  3951. ])
  3952. #
  3953. if test "$tst_links_strcasecmp" = "yes"; then
  3954. AC_MSG_CHECKING([if strcasecmp is prototyped])
  3955. AC_EGREP_CPP([strcasecmp],[
  3956. $curl_includes_string
  3957. ],[
  3958. AC_MSG_RESULT([yes])
  3959. tst_proto_strcasecmp="yes"
  3960. ],[
  3961. AC_MSG_RESULT([no])
  3962. tst_proto_strcasecmp="no"
  3963. ])
  3964. fi
  3965. #
  3966. if test "$tst_proto_strcasecmp" = "yes"; then
  3967. AC_MSG_CHECKING([if strcasecmp is compilable])
  3968. AC_COMPILE_IFELSE([
  3969. AC_LANG_PROGRAM([[
  3970. $curl_includes_string
  3971. ]],[[
  3972. if(0 != strcasecmp(0, 0))
  3973. return 1;
  3974. ]])
  3975. ],[
  3976. AC_MSG_RESULT([yes])
  3977. tst_compi_strcasecmp="yes"
  3978. ],[
  3979. AC_MSG_RESULT([no])
  3980. tst_compi_strcasecmp="no"
  3981. ])
  3982. fi
  3983. #
  3984. if test "$tst_compi_strcasecmp" = "yes"; then
  3985. AC_MSG_CHECKING([if strcasecmp usage allowed])
  3986. if test "x$curl_disallow_strcasecmp" != "xyes"; then
  3987. AC_MSG_RESULT([yes])
  3988. tst_allow_strcasecmp="yes"
  3989. else
  3990. AC_MSG_RESULT([no])
  3991. tst_allow_strcasecmp="no"
  3992. fi
  3993. fi
  3994. #
  3995. AC_MSG_CHECKING([if strcasecmp might be used])
  3996. if test "$tst_links_strcasecmp" = "yes" &&
  3997. test "$tst_proto_strcasecmp" = "yes" &&
  3998. test "$tst_compi_strcasecmp" = "yes" &&
  3999. test "$tst_allow_strcasecmp" = "yes"; then
  4000. AC_MSG_RESULT([yes])
  4001. AC_DEFINE_UNQUOTED(HAVE_STRCASECMP, 1,
  4002. [Define to 1 if you have the strcasecmp function.])
  4003. curl_cv_func_strcasecmp="yes"
  4004. else
  4005. AC_MSG_RESULT([no])
  4006. curl_cv_func_strcasecmp="no"
  4007. fi
  4008. ])
  4009. dnl CURL_CHECK_FUNC_STRCMPI
  4010. dnl -------------------------------------------------
  4011. dnl Verify if strcmpi is available, prototyped, and
  4012. dnl can be compiled. If all of these are true, and
  4013. dnl usage has not been previously disallowed with
  4014. dnl shell variable curl_disallow_strcmpi, then
  4015. dnl HAVE_STRCMPI will be defined.
  4016. AC_DEFUN([CURL_CHECK_FUNC_STRCMPI], [
  4017. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4018. #
  4019. tst_links_strcmpi="unknown"
  4020. tst_proto_strcmpi="unknown"
  4021. tst_compi_strcmpi="unknown"
  4022. tst_allow_strcmpi="unknown"
  4023. #
  4024. AC_MSG_CHECKING([if strcmpi can be linked])
  4025. AC_LINK_IFELSE([
  4026. AC_LANG_FUNC_LINK_TRY([strcmpi])
  4027. ],[
  4028. AC_MSG_RESULT([yes])
  4029. tst_links_strcmpi="yes"
  4030. ],[
  4031. AC_MSG_RESULT([no])
  4032. tst_links_strcmpi="no"
  4033. ])
  4034. #
  4035. if test "$tst_links_strcmpi" = "yes"; then
  4036. AC_MSG_CHECKING([if strcmpi is prototyped])
  4037. AC_EGREP_CPP([strcmpi],[
  4038. $curl_includes_string
  4039. ],[
  4040. AC_MSG_RESULT([yes])
  4041. tst_proto_strcmpi="yes"
  4042. ],[
  4043. AC_MSG_RESULT([no])
  4044. tst_proto_strcmpi="no"
  4045. ])
  4046. fi
  4047. #
  4048. if test "$tst_proto_strcmpi" = "yes"; then
  4049. AC_MSG_CHECKING([if strcmpi is compilable])
  4050. AC_COMPILE_IFELSE([
  4051. AC_LANG_PROGRAM([[
  4052. $curl_includes_string
  4053. ]],[[
  4054. if(0 != strcmpi(0, 0))
  4055. return 1;
  4056. ]])
  4057. ],[
  4058. AC_MSG_RESULT([yes])
  4059. tst_compi_strcmpi="yes"
  4060. ],[
  4061. AC_MSG_RESULT([no])
  4062. tst_compi_strcmpi="no"
  4063. ])
  4064. fi
  4065. #
  4066. if test "$tst_compi_strcmpi" = "yes"; then
  4067. AC_MSG_CHECKING([if strcmpi usage allowed])
  4068. if test "x$curl_disallow_strcmpi" != "xyes"; then
  4069. AC_MSG_RESULT([yes])
  4070. tst_allow_strcmpi="yes"
  4071. else
  4072. AC_MSG_RESULT([no])
  4073. tst_allow_strcmpi="no"
  4074. fi
  4075. fi
  4076. #
  4077. AC_MSG_CHECKING([if strcmpi might be used])
  4078. if test "$tst_links_strcmpi" = "yes" &&
  4079. test "$tst_proto_strcmpi" = "yes" &&
  4080. test "$tst_compi_strcmpi" = "yes" &&
  4081. test "$tst_allow_strcmpi" = "yes"; then
  4082. AC_MSG_RESULT([yes])
  4083. AC_DEFINE_UNQUOTED(HAVE_STRCMPI, 1,
  4084. [Define to 1 if you have the strcmpi function.])
  4085. curl_cv_func_strcmpi="yes"
  4086. else
  4087. AC_MSG_RESULT([no])
  4088. curl_cv_func_strcmpi="no"
  4089. fi
  4090. ])
  4091. dnl CURL_CHECK_FUNC_STRDUP
  4092. dnl -------------------------------------------------
  4093. dnl Verify if strdup is available, prototyped, and
  4094. dnl can be compiled. If all of these are true, and
  4095. dnl usage has not been previously disallowed with
  4096. dnl shell variable curl_disallow_strdup, then
  4097. dnl HAVE_STRDUP will be defined.
  4098. AC_DEFUN([CURL_CHECK_FUNC_STRDUP], [
  4099. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4100. #
  4101. tst_links_strdup="unknown"
  4102. tst_proto_strdup="unknown"
  4103. tst_compi_strdup="unknown"
  4104. tst_allow_strdup="unknown"
  4105. #
  4106. AC_MSG_CHECKING([if strdup can be linked])
  4107. AC_LINK_IFELSE([
  4108. AC_LANG_FUNC_LINK_TRY([strdup])
  4109. ],[
  4110. AC_MSG_RESULT([yes])
  4111. tst_links_strdup="yes"
  4112. ],[
  4113. AC_MSG_RESULT([no])
  4114. tst_links_strdup="no"
  4115. ])
  4116. #
  4117. if test "$tst_links_strdup" = "yes"; then
  4118. AC_MSG_CHECKING([if strdup is prototyped])
  4119. AC_EGREP_CPP([strdup],[
  4120. $curl_includes_string
  4121. ],[
  4122. AC_MSG_RESULT([yes])
  4123. tst_proto_strdup="yes"
  4124. ],[
  4125. AC_MSG_RESULT([no])
  4126. tst_proto_strdup="no"
  4127. ])
  4128. fi
  4129. #
  4130. if test "$tst_proto_strdup" = "yes"; then
  4131. AC_MSG_CHECKING([if strdup is compilable])
  4132. AC_COMPILE_IFELSE([
  4133. AC_LANG_PROGRAM([[
  4134. $curl_includes_string
  4135. ]],[[
  4136. if(0 != strdup(0))
  4137. return 1;
  4138. ]])
  4139. ],[
  4140. AC_MSG_RESULT([yes])
  4141. tst_compi_strdup="yes"
  4142. ],[
  4143. AC_MSG_RESULT([no])
  4144. tst_compi_strdup="no"
  4145. ])
  4146. fi
  4147. #
  4148. if test "$tst_compi_strdup" = "yes"; then
  4149. AC_MSG_CHECKING([if strdup usage allowed])
  4150. if test "x$curl_disallow_strdup" != "xyes"; then
  4151. AC_MSG_RESULT([yes])
  4152. tst_allow_strdup="yes"
  4153. else
  4154. AC_MSG_RESULT([no])
  4155. tst_allow_strdup="no"
  4156. fi
  4157. fi
  4158. #
  4159. AC_MSG_CHECKING([if strdup might be used])
  4160. if test "$tst_links_strdup" = "yes" &&
  4161. test "$tst_proto_strdup" = "yes" &&
  4162. test "$tst_compi_strdup" = "yes" &&
  4163. test "$tst_allow_strdup" = "yes"; then
  4164. AC_MSG_RESULT([yes])
  4165. AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1,
  4166. [Define to 1 if you have the strdup function.])
  4167. curl_cv_func_strdup="yes"
  4168. else
  4169. AC_MSG_RESULT([no])
  4170. curl_cv_func_strdup="no"
  4171. fi
  4172. ])
  4173. dnl CURL_CHECK_FUNC_STRERROR_R
  4174. dnl -------------------------------------------------
  4175. dnl Verify if strerror_r is available, prototyped, can be compiled and
  4176. dnl seems to work. If all of these are true, and usage has not been
  4177. dnl previously disallowed with shell variable curl_disallow_strerror_r,
  4178. dnl then HAVE_STRERROR_R will be defined, as well as one of
  4179. dnl HAVE_GLIBC_STRERROR_R or HAVE_POSIX_STRERROR_R.
  4180. dnl
  4181. dnl glibc-style strerror_r:
  4182. dnl
  4183. dnl char *strerror_r(int errnum, char *workbuf, size_t bufsize);
  4184. dnl
  4185. dnl glibc-style strerror_r returns a pointer to the error string,
  4186. dnl and might use the provided workbuf as a scratch area if needed. A
  4187. dnl quick test on a few systems shows that it's usually not used at all.
  4188. dnl
  4189. dnl POSIX-style strerror_r:
  4190. dnl
  4191. dnl int strerror_r(int errnum, char *resultbuf, size_t bufsize);
  4192. dnl
  4193. dnl POSIX-style strerror_r returns 0 upon successful completion and the
  4194. dnl error string in the provided resultbuf.
  4195. dnl
  4196. AC_DEFUN([CURL_CHECK_FUNC_STRERROR_R], [
  4197. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  4198. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4199. #
  4200. tst_links_strerror_r="unknown"
  4201. tst_proto_strerror_r="unknown"
  4202. tst_compi_strerror_r="unknown"
  4203. tst_glibc_strerror_r="unknown"
  4204. tst_posix_strerror_r="unknown"
  4205. tst_allow_strerror_r="unknown"
  4206. tst_works_glibc_strerror_r="unknown"
  4207. tst_works_posix_strerror_r="unknown"
  4208. tst_glibc_strerror_r_type_arg3="unknown"
  4209. tst_posix_strerror_r_type_arg3="unknown"
  4210. #
  4211. AC_MSG_CHECKING([if strerror_r can be linked])
  4212. AC_LINK_IFELSE([
  4213. AC_LANG_FUNC_LINK_TRY([strerror_r])
  4214. ],[
  4215. AC_MSG_RESULT([yes])
  4216. tst_links_strerror_r="yes"
  4217. ],[
  4218. AC_MSG_RESULT([no])
  4219. tst_links_strerror_r="no"
  4220. ])
  4221. #
  4222. if test "$tst_links_strerror_r" = "yes"; then
  4223. AC_MSG_CHECKING([if strerror_r is prototyped])
  4224. AC_EGREP_CPP([strerror_r],[
  4225. $curl_includes_string
  4226. ],[
  4227. AC_MSG_RESULT([yes])
  4228. tst_proto_strerror_r="yes"
  4229. ],[
  4230. AC_MSG_RESULT([no])
  4231. tst_proto_strerror_r="no"
  4232. ])
  4233. fi
  4234. #
  4235. if test "$tst_proto_strerror_r" = "yes"; then
  4236. AC_MSG_CHECKING([if strerror_r is compilable])
  4237. AC_COMPILE_IFELSE([
  4238. AC_LANG_PROGRAM([[
  4239. $curl_includes_string
  4240. ]],[[
  4241. if(0 != strerror_r(0, 0, 0))
  4242. return 1;
  4243. ]])
  4244. ],[
  4245. AC_MSG_RESULT([yes])
  4246. tst_compi_strerror_r="yes"
  4247. ],[
  4248. AC_MSG_RESULT([no])
  4249. tst_compi_strerror_r="no"
  4250. ])
  4251. fi
  4252. #
  4253. if test "$tst_compi_strerror_r" = "yes"; then
  4254. AC_MSG_CHECKING([if strerror_r is glibc like])
  4255. tst_glibc_strerror_r_type_arg3="unknown"
  4256. for arg3 in 'size_t' 'int' 'unsigned int'; do
  4257. if test "$tst_glibc_strerror_r_type_arg3" = "unknown"; then
  4258. AC_COMPILE_IFELSE([
  4259. AC_LANG_PROGRAM([[
  4260. $curl_includes_string
  4261. char *strerror_r(int errnum, char *workbuf, $arg3 bufsize);
  4262. ]],[[
  4263. if(0 != strerror_r(0, 0, 0))
  4264. return 1;
  4265. ]])
  4266. ],[
  4267. tst_glibc_strerror_r_type_arg3="$arg3"
  4268. ])
  4269. fi
  4270. done
  4271. case "$tst_glibc_strerror_r_type_arg3" in
  4272. unknown)
  4273. AC_MSG_RESULT([no])
  4274. tst_glibc_strerror_r="no"
  4275. ;;
  4276. *)
  4277. AC_MSG_RESULT([yes])
  4278. tst_glibc_strerror_r="yes"
  4279. ;;
  4280. esac
  4281. fi
  4282. #
  4283. dnl only do runtime verification when not cross-compiling
  4284. if test "x$cross_compiling" != "xyes" &&
  4285. test "$tst_glibc_strerror_r" = "yes"; then
  4286. AC_MSG_CHECKING([if strerror_r seems to work])
  4287. CURL_RUN_IFELSE([
  4288. AC_LANG_PROGRAM([[
  4289. $curl_includes_stdlib
  4290. $curl_includes_string
  4291. # include <errno.h>
  4292. ]],[[
  4293. char buffer[1024];
  4294. char *string = 0;
  4295. buffer[0] = '\0';
  4296. string = strerror_r(EACCES, buffer, sizeof(buffer));
  4297. if(!string)
  4298. exit(1); /* fail */
  4299. if(!string[0])
  4300. exit(1); /* fail */
  4301. else
  4302. exit(0);
  4303. ]])
  4304. ],[
  4305. AC_MSG_RESULT([yes])
  4306. tst_works_glibc_strerror_r="yes"
  4307. ],[
  4308. AC_MSG_RESULT([no])
  4309. tst_works_glibc_strerror_r="no"
  4310. ])
  4311. fi
  4312. #
  4313. if test "$tst_compi_strerror_r" = "yes" &&
  4314. test "$tst_works_glibc_strerror_r" != "yes"; then
  4315. AC_MSG_CHECKING([if strerror_r is POSIX like])
  4316. tst_posix_strerror_r_type_arg3="unknown"
  4317. for arg3 in 'size_t' 'int' 'unsigned int'; do
  4318. if test "$tst_posix_strerror_r_type_arg3" = "unknown"; then
  4319. AC_COMPILE_IFELSE([
  4320. AC_LANG_PROGRAM([[
  4321. $curl_includes_string
  4322. int strerror_r(int errnum, char *resultbuf, $arg3 bufsize);
  4323. ]],[[
  4324. if(0 != strerror_r(0, 0, 0))
  4325. return 1;
  4326. ]])
  4327. ],[
  4328. tst_posix_strerror_r_type_arg3="$arg3"
  4329. ])
  4330. fi
  4331. done
  4332. case "$tst_posix_strerror_r_type_arg3" in
  4333. unknown)
  4334. AC_MSG_RESULT([no])
  4335. tst_posix_strerror_r="no"
  4336. ;;
  4337. *)
  4338. AC_MSG_RESULT([yes])
  4339. tst_posix_strerror_r="yes"
  4340. ;;
  4341. esac
  4342. fi
  4343. #
  4344. dnl only do runtime verification when not cross-compiling
  4345. if test "x$cross_compiling" != "xyes" &&
  4346. test "$tst_posix_strerror_r" = "yes"; then
  4347. AC_MSG_CHECKING([if strerror_r seems to work])
  4348. CURL_RUN_IFELSE([
  4349. AC_LANG_PROGRAM([[
  4350. $curl_includes_stdlib
  4351. $curl_includes_string
  4352. # include <errno.h>
  4353. ]],[[
  4354. char buffer[1024];
  4355. int error = 1;
  4356. buffer[0] = '\0';
  4357. error = strerror_r(EACCES, buffer, sizeof(buffer));
  4358. if(error)
  4359. exit(1); /* fail */
  4360. if(buffer[0] == '\0')
  4361. exit(1); /* fail */
  4362. else
  4363. exit(0);
  4364. ]])
  4365. ],[
  4366. AC_MSG_RESULT([yes])
  4367. tst_works_posix_strerror_r="yes"
  4368. ],[
  4369. AC_MSG_RESULT([no])
  4370. tst_works_posix_strerror_r="no"
  4371. ])
  4372. fi
  4373. #
  4374. if test "$tst_works_glibc_strerror_r" = "yes"; then
  4375. tst_posix_strerror_r="no"
  4376. fi
  4377. if test "$tst_works_posix_strerror_r" = "yes"; then
  4378. tst_glibc_strerror_r="no"
  4379. fi
  4380. if test "$tst_glibc_strerror_r" = "yes" &&
  4381. test "$tst_works_glibc_strerror_r" != "no" &&
  4382. test "$tst_posix_strerror_r" != "yes"; then
  4383. tst_allow_strerror_r="check"
  4384. fi
  4385. if test "$tst_posix_strerror_r" = "yes" &&
  4386. test "$tst_works_posix_strerror_r" != "no" &&
  4387. test "$tst_glibc_strerror_r" != "yes"; then
  4388. tst_allow_strerror_r="check"
  4389. fi
  4390. if test "$tst_allow_strerror_r" = "check"; then
  4391. AC_MSG_CHECKING([if strerror_r usage allowed])
  4392. if test "x$curl_disallow_strerror_r" != "xyes"; then
  4393. AC_MSG_RESULT([yes])
  4394. tst_allow_strerror_r="yes"
  4395. else
  4396. AC_MSG_RESULT([no])
  4397. tst_allow_strerror_r="no"
  4398. fi
  4399. fi
  4400. #
  4401. AC_MSG_CHECKING([if strerror_r might be used])
  4402. if test "$tst_links_strerror_r" = "yes" &&
  4403. test "$tst_proto_strerror_r" = "yes" &&
  4404. test "$tst_compi_strerror_r" = "yes" &&
  4405. test "$tst_allow_strerror_r" = "yes"; then
  4406. AC_MSG_RESULT([yes])
  4407. if test "$tst_glibc_strerror_r" = "yes"; then
  4408. AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
  4409. [Define to 1 if you have the strerror_r function.])
  4410. AC_DEFINE_UNQUOTED(HAVE_GLIBC_STRERROR_R, 1,
  4411. [Define to 1 if you have a working glibc-style strerror_r function.])
  4412. fi
  4413. if test "$tst_posix_strerror_r" = "yes"; then
  4414. AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
  4415. [Define to 1 if you have the strerror_r function.])
  4416. AC_DEFINE_UNQUOTED(HAVE_POSIX_STRERROR_R, 1,
  4417. [Define to 1 if you have a working POSIX-style strerror_r function.])
  4418. fi
  4419. curl_cv_func_strerror_r="yes"
  4420. else
  4421. AC_MSG_RESULT([no])
  4422. curl_cv_func_strerror_r="no"
  4423. fi
  4424. #
  4425. if test "$tst_compi_strerror_r" = "yes" &&
  4426. test "$tst_allow_strerror_r" = "unknown"; then
  4427. AC_MSG_WARN([cannot determine strerror_r() style: edit lib/curl_config.h manually.])
  4428. fi
  4429. #
  4430. ])
  4431. dnl CURL_CHECK_FUNC_STRICMP
  4432. dnl -------------------------------------------------
  4433. dnl Verify if stricmp is available, prototyped, and
  4434. dnl can be compiled. If all of these are true, and
  4435. dnl usage has not been previously disallowed with
  4436. dnl shell variable curl_disallow_stricmp, then
  4437. dnl HAVE_STRICMP will be defined.
  4438. AC_DEFUN([CURL_CHECK_FUNC_STRICMP], [
  4439. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4440. #
  4441. tst_links_stricmp="unknown"
  4442. tst_proto_stricmp="unknown"
  4443. tst_compi_stricmp="unknown"
  4444. tst_allow_stricmp="unknown"
  4445. #
  4446. AC_MSG_CHECKING([if stricmp can be linked])
  4447. AC_LINK_IFELSE([
  4448. AC_LANG_FUNC_LINK_TRY([stricmp])
  4449. ],[
  4450. AC_MSG_RESULT([yes])
  4451. tst_links_stricmp="yes"
  4452. ],[
  4453. AC_MSG_RESULT([no])
  4454. tst_links_stricmp="no"
  4455. ])
  4456. #
  4457. if test "$tst_links_stricmp" = "yes"; then
  4458. AC_MSG_CHECKING([if stricmp is prototyped])
  4459. AC_EGREP_CPP([stricmp],[
  4460. $curl_includes_string
  4461. ],[
  4462. AC_MSG_RESULT([yes])
  4463. tst_proto_stricmp="yes"
  4464. ],[
  4465. AC_MSG_RESULT([no])
  4466. tst_proto_stricmp="no"
  4467. ])
  4468. fi
  4469. #
  4470. if test "$tst_proto_stricmp" = "yes"; then
  4471. AC_MSG_CHECKING([if stricmp is compilable])
  4472. AC_COMPILE_IFELSE([
  4473. AC_LANG_PROGRAM([[
  4474. $curl_includes_string
  4475. ]],[[
  4476. if(0 != stricmp(0, 0))
  4477. return 1;
  4478. ]])
  4479. ],[
  4480. AC_MSG_RESULT([yes])
  4481. tst_compi_stricmp="yes"
  4482. ],[
  4483. AC_MSG_RESULT([no])
  4484. tst_compi_stricmp="no"
  4485. ])
  4486. fi
  4487. #
  4488. if test "$tst_compi_stricmp" = "yes"; then
  4489. AC_MSG_CHECKING([if stricmp usage allowed])
  4490. if test "x$curl_disallow_stricmp" != "xyes"; then
  4491. AC_MSG_RESULT([yes])
  4492. tst_allow_stricmp="yes"
  4493. else
  4494. AC_MSG_RESULT([no])
  4495. tst_allow_stricmp="no"
  4496. fi
  4497. fi
  4498. #
  4499. AC_MSG_CHECKING([if stricmp might be used])
  4500. if test "$tst_links_stricmp" = "yes" &&
  4501. test "$tst_proto_stricmp" = "yes" &&
  4502. test "$tst_compi_stricmp" = "yes" &&
  4503. test "$tst_allow_stricmp" = "yes"; then
  4504. AC_MSG_RESULT([yes])
  4505. AC_DEFINE_UNQUOTED(HAVE_STRICMP, 1,
  4506. [Define to 1 if you have the stricmp function.])
  4507. curl_cv_func_stricmp="yes"
  4508. else
  4509. AC_MSG_RESULT([no])
  4510. curl_cv_func_stricmp="no"
  4511. fi
  4512. ])
  4513. dnl CURL_CHECK_FUNC_STRTOK_R
  4514. dnl -------------------------------------------------
  4515. dnl Verify if strtok_r is available, prototyped, and
  4516. dnl can be compiled. If all of these are true, and
  4517. dnl usage has not been previously disallowed with
  4518. dnl shell variable curl_disallow_strtok_r, then
  4519. dnl HAVE_STRTOK_R will be defined.
  4520. AC_DEFUN([CURL_CHECK_FUNC_STRTOK_R], [
  4521. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4522. #
  4523. tst_links_strtok_r="unknown"
  4524. tst_proto_strtok_r="unknown"
  4525. tst_compi_strtok_r="unknown"
  4526. tst_allow_strtok_r="unknown"
  4527. #
  4528. AC_MSG_CHECKING([if strtok_r can be linked])
  4529. AC_LINK_IFELSE([
  4530. AC_LANG_FUNC_LINK_TRY([strtok_r])
  4531. ],[
  4532. AC_MSG_RESULT([yes])
  4533. tst_links_strtok_r="yes"
  4534. ],[
  4535. AC_MSG_RESULT([no])
  4536. tst_links_strtok_r="no"
  4537. ])
  4538. #
  4539. if test "$tst_links_strtok_r" = "yes"; then
  4540. AC_MSG_CHECKING([if strtok_r is prototyped])
  4541. AC_EGREP_CPP([strtok_r],[
  4542. $curl_includes_string
  4543. ],[
  4544. AC_MSG_RESULT([yes])
  4545. tst_proto_strtok_r="yes"
  4546. ],[
  4547. AC_MSG_RESULT([no])
  4548. tst_proto_strtok_r="no"
  4549. ])
  4550. fi
  4551. #
  4552. if test "$tst_proto_strtok_r" = "yes"; then
  4553. AC_MSG_CHECKING([if strtok_r is compilable])
  4554. AC_COMPILE_IFELSE([
  4555. AC_LANG_PROGRAM([[
  4556. $curl_includes_string
  4557. ]],[[
  4558. if(0 != strtok_r(0, 0, 0))
  4559. return 1;
  4560. ]])
  4561. ],[
  4562. AC_MSG_RESULT([yes])
  4563. tst_compi_strtok_r="yes"
  4564. ],[
  4565. AC_MSG_RESULT([no])
  4566. tst_compi_strtok_r="no"
  4567. ])
  4568. fi
  4569. #
  4570. if test "$tst_compi_strtok_r" = "yes"; then
  4571. AC_MSG_CHECKING([if strtok_r usage allowed])
  4572. if test "x$curl_disallow_strtok_r" != "xyes"; then
  4573. AC_MSG_RESULT([yes])
  4574. tst_allow_strtok_r="yes"
  4575. else
  4576. AC_MSG_RESULT([no])
  4577. tst_allow_strtok_r="no"
  4578. fi
  4579. fi
  4580. #
  4581. AC_MSG_CHECKING([if strtok_r might be used])
  4582. if test "$tst_links_strtok_r" = "yes" &&
  4583. test "$tst_proto_strtok_r" = "yes" &&
  4584. test "$tst_compi_strtok_r" = "yes" &&
  4585. test "$tst_allow_strtok_r" = "yes"; then
  4586. AC_MSG_RESULT([yes])
  4587. AC_DEFINE_UNQUOTED(HAVE_STRTOK_R, 1,
  4588. [Define to 1 if you have the strtok_r function.])
  4589. curl_cv_func_strtok_r="yes"
  4590. else
  4591. AC_MSG_RESULT([no])
  4592. curl_cv_func_strtok_r="no"
  4593. fi
  4594. ])
  4595. dnl CURL_CHECK_FUNC_STRTOLL
  4596. dnl -------------------------------------------------
  4597. dnl Verify if strtoll is available, prototyped, and
  4598. dnl can be compiled. If all of these are true, and
  4599. dnl usage has not been previously disallowed with
  4600. dnl shell variable curl_disallow_strtoll, then
  4601. dnl HAVE_STRTOLL will be defined.
  4602. AC_DEFUN([CURL_CHECK_FUNC_STRTOLL], [
  4603. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  4604. #
  4605. tst_links_strtoll="unknown"
  4606. tst_proto_strtoll="unknown"
  4607. tst_compi_strtoll="unknown"
  4608. tst_allow_strtoll="unknown"
  4609. #
  4610. AC_MSG_CHECKING([if strtoll can be linked])
  4611. AC_LINK_IFELSE([
  4612. AC_LANG_FUNC_LINK_TRY([strtoll])
  4613. ],[
  4614. AC_MSG_RESULT([yes])
  4615. tst_links_strtoll="yes"
  4616. ],[
  4617. AC_MSG_RESULT([no])
  4618. tst_links_strtoll="no"
  4619. ])
  4620. #
  4621. if test "$tst_links_strtoll" = "yes"; then
  4622. AC_MSG_CHECKING([if strtoll is prototyped])
  4623. AC_EGREP_CPP([strtoll],[
  4624. $curl_includes_stdlib
  4625. ],[
  4626. AC_MSG_RESULT([yes])
  4627. tst_proto_strtoll="yes"
  4628. ],[
  4629. AC_MSG_RESULT([no])
  4630. tst_proto_strtoll="no"
  4631. ])
  4632. fi
  4633. #
  4634. if test "$tst_proto_strtoll" = "yes"; then
  4635. AC_MSG_CHECKING([if strtoll is compilable])
  4636. AC_COMPILE_IFELSE([
  4637. AC_LANG_PROGRAM([[
  4638. $curl_includes_stdlib
  4639. ]],[[
  4640. if(0 != strtoll(0, 0, 0))
  4641. return 1;
  4642. ]])
  4643. ],[
  4644. AC_MSG_RESULT([yes])
  4645. tst_compi_strtoll="yes"
  4646. ],[
  4647. AC_MSG_RESULT([no])
  4648. tst_compi_strtoll="no"
  4649. ])
  4650. fi
  4651. #
  4652. if test "$tst_compi_strtoll" = "yes"; then
  4653. AC_MSG_CHECKING([if strtoll usage allowed])
  4654. if test "x$curl_disallow_strtoll" != "xyes"; then
  4655. AC_MSG_RESULT([yes])
  4656. tst_allow_strtoll="yes"
  4657. else
  4658. AC_MSG_RESULT([no])
  4659. tst_allow_strtoll="no"
  4660. fi
  4661. fi
  4662. #
  4663. AC_MSG_CHECKING([if strtoll might be used])
  4664. if test "$tst_links_strtoll" = "yes" &&
  4665. test "$tst_proto_strtoll" = "yes" &&
  4666. test "$tst_compi_strtoll" = "yes" &&
  4667. test "$tst_allow_strtoll" = "yes"; then
  4668. AC_MSG_RESULT([yes])
  4669. AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1,
  4670. [Define to 1 if you have the strtoll function.])
  4671. curl_cv_func_strtoll="yes"
  4672. else
  4673. AC_MSG_RESULT([no])
  4674. curl_cv_func_strtoll="no"
  4675. fi
  4676. ])
  4677. dnl CURL_RUN_IFELSE
  4678. dnl -------------------------------------------------
  4679. dnl Wrapper macro to use instead of AC_RUN_IFELSE. It
  4680. dnl sets LD_LIBRARY_PATH locally for this run only, from the
  4681. dnl CURL_LIBRARY_PATH variable. It keeps the LD_LIBRARY_PATH
  4682. dnl changes contained within this macro.
  4683. AC_DEFUN([CURL_RUN_IFELSE], [
  4684. case $host_os in
  4685. darwin*)
  4686. AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4)
  4687. ;;
  4688. *)
  4689. oldcc=$CC
  4690. old=$LD_LIBRARY_PATH
  4691. CC="sh ./run-compiler"
  4692. LD_LIBRARY_PATH=$CURL_LIBRARY_PATH:$old
  4693. export LD_LIBRARY_PATH
  4694. AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4)
  4695. LD_LIBRARY_PATH=$old # restore
  4696. CC=$oldcc
  4697. ;;
  4698. esac
  4699. ])
  4700. dnl CURL_COVERAGE
  4701. dnl --------------------------------------------------
  4702. dnl Switch on options and libs to build with gcc's code coverage.
  4703. dnl
  4704. AC_DEFUN([CURL_COVERAGE],[
  4705. AC_REQUIRE([AC_PROG_SED])
  4706. AC_REQUIRE([AC_ARG_ENABLE])
  4707. AC_MSG_CHECKING([for code coverage support])
  4708. coverage="no"
  4709. curl_coverage_msg="disabled"
  4710. dnl check if enabled by argument
  4711. AC_ARG_ENABLE(code-coverage,
  4712. AS_HELP_STRING([--enable-code-coverage], [Provide code coverage]),
  4713. coverage="$enableval")
  4714. dnl if not gcc switch off again
  4715. AS_IF([ test "$GCC" != "yes" ], coverage="no" )
  4716. AC_MSG_RESULT($coverage)
  4717. if test "x$coverage" = "xyes"; then
  4718. curl_coverage_msg="enabled"
  4719. AC_CHECK_TOOL([GCOV], [gcov], [gcov])
  4720. if test -z "$GCOV"; then
  4721. AC_MSG_ERROR([needs gcov for code coverage])
  4722. fi
  4723. AC_CHECK_PROG([LCOV], [lcov], [lcov])
  4724. if test -z "$LCOV"; then
  4725. AC_MSG_ERROR([needs lcov for code coverage])
  4726. fi
  4727. CPPFLAGS="$CPPFLAGS -DNDEBUG"
  4728. CFLAGS="$CFLAGS -O0 -g -fprofile-arcs -ftest-coverage"
  4729. LIBS="$LIBS -lgcov"
  4730. fi
  4731. ])
  4732. dnl CURL_ATOMIC
  4733. dnl -------------------------------------------------------------
  4734. dnl Check if _Atomic works. But only check if stdatomic.h exists.
  4735. dnl
  4736. AC_DEFUN([CURL_ATOMIC],[
  4737. AC_CHECK_HEADERS(stdatomic.h, [
  4738. AC_MSG_CHECKING([if _Atomic is available])
  4739. AC_LINK_IFELSE([
  4740. AC_LANG_PROGRAM([[
  4741. $curl_includes_unistd
  4742. ]],[[
  4743. _Atomic int i = 0;
  4744. i = 4; // Force an atomic-write operation.
  4745. ]])
  4746. ],[
  4747. AC_MSG_RESULT([yes])
  4748. AC_DEFINE_UNQUOTED(HAVE_ATOMIC, 1,
  4749. [Define to 1 if you have _Atomic support.])
  4750. tst_atomic="yes"
  4751. ],[
  4752. AC_MSG_RESULT([no])
  4753. tst_atomic="no"
  4754. ])
  4755. ])
  4756. ])
  4757. # Rewrite inspired by the functionality once provided by
  4758. # AX_COMPILE_CHECK_SIZEOF. Uses the switch() "trick" to find the size of the
  4759. # given type.
  4760. #
  4761. # This code fails to compile:
  4762. #
  4763. # switch() { case 0: case 0: }
  4764. #
  4765. # By making the second case number a boolean check, it fails to compile the
  4766. # test code when the boolean is false and thus creating a zero, making it a
  4767. # duplicated case label. If the boolean equals true, it becomes a one, the
  4768. # code compiles and we know it was a match.
  4769. #
  4770. # The check iterates over all possible sizes and stops as soon it compiles
  4771. # error-free.
  4772. #
  4773. # Usage:
  4774. #
  4775. # CURL_SIZEOF(TYPE, [HEADERS])
  4776. #
  4777. AC_DEFUN([CURL_SIZEOF], [
  4778. dnl The #define name to make autoheader put the name in curl_config.h.in
  4779. define(TYPE, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
  4780. AC_MSG_CHECKING(size of $1)
  4781. r=0
  4782. dnl Check the sizes in a reasonable order
  4783. for typesize in 8 4 2 16 1; do
  4784. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  4785. #include <sys/types.h>
  4786. $2
  4787. ]],
  4788. [switch(0) {
  4789. case 0:
  4790. case (sizeof($1) == $typesize):;
  4791. }
  4792. ]) ],
  4793. [
  4794. r=$typesize],
  4795. [
  4796. r=0])
  4797. dnl get out of the loop once matched
  4798. if test $r -gt 0; then
  4799. break;
  4800. fi
  4801. done
  4802. if test $r -eq 0; then
  4803. AC_MSG_ERROR([Failed to find size of $1])
  4804. fi
  4805. AC_MSG_RESULT($r)
  4806. dnl lowercase and underscore instead of space
  4807. tname=`echo "ac_cv_sizeof_$1" | tr A-Z a-z | tr " " "_"`
  4808. eval "$tname=$r"
  4809. AC_DEFINE_UNQUOTED(TYPE, [$r], [Size of $1 in number of bytes])
  4810. ])