curl-functions.m4 123 KB

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