cares-functions.m4 101 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755
  1. #***************************************************************************
  2. #
  3. # Copyright (C) 2008 - 2012 by Daniel Stenberg et al
  4. #
  5. # Permission to use, copy, modify, and distribute this software and its
  6. # documentation for any purpose and without fee is hereby granted, provided
  7. # that the above copyright notice appear in all copies and that both that
  8. # copyright notice and this permission notice appear in supporting
  9. # documentation, and that the name of M.I.T. not be used in advertising or
  10. # publicity pertaining to distribution of the software without specific,
  11. # written prior permission. M.I.T. makes no representations about the
  12. # suitability of this software for any purpose. It is provided "as is"
  13. # without express or implied warranty.
  14. #
  15. #***************************************************************************
  16. # File version for 'aclocal' use. Keep it a single number.
  17. # serial 46
  18. dnl CARES_INCLUDES_ARPA_INET
  19. dnl -------------------------------------------------
  20. dnl Set up variable with list of headers that must be
  21. dnl included when arpa/inet.h is to be included.
  22. AC_DEFUN([CARES_INCLUDES_ARPA_INET], [
  23. cares_includes_arpa_inet="\
  24. /* includes start */
  25. #ifdef HAVE_SYS_TYPES_H
  26. # include <sys/types.h>
  27. #endif
  28. #ifdef HAVE_SYS_SOCKET_H
  29. # include <sys/socket.h>
  30. #endif
  31. #ifdef HAVE_NETINET_IN_H
  32. # include <netinet/in.h>
  33. #endif
  34. #ifdef HAVE_ARPA_INET_H
  35. # include <arpa/inet.h>
  36. #endif
  37. /* includes end */"
  38. AC_CHECK_HEADERS(
  39. sys/types.h sys/socket.h netinet/in.h arpa/inet.h,
  40. [], [], [$cares_includes_arpa_inet])
  41. ])
  42. dnl CARES_INCLUDES_FCNTL
  43. dnl -------------------------------------------------
  44. dnl Set up variable with list of headers that must be
  45. dnl included when fcntl.h is to be included.
  46. AC_DEFUN([CARES_INCLUDES_FCNTL], [
  47. cares_includes_fcntl="\
  48. /* includes start */
  49. #ifdef HAVE_SYS_TYPES_H
  50. # include <sys/types.h>
  51. #endif
  52. #ifdef HAVE_UNISTD_H
  53. # include <unistd.h>
  54. #endif
  55. #ifdef HAVE_FCNTL_H
  56. # include <fcntl.h>
  57. #endif
  58. /* includes end */"
  59. AC_CHECK_HEADERS(
  60. sys/types.h unistd.h fcntl.h,
  61. [], [], [$cares_includes_fcntl])
  62. ])
  63. dnl CARES_INCLUDES_NETDB
  64. dnl -------------------------------------------------
  65. dnl Set up variable with list of headers that must be
  66. dnl included when netdb.h is to be included.
  67. AC_DEFUN([CARES_INCLUDES_NETDB], [
  68. cares_includes_netdb="\
  69. /* includes start */
  70. #ifdef HAVE_SYS_TYPES_H
  71. # include <sys/types.h>
  72. #endif
  73. #ifdef HAVE_NETDB_H
  74. # include <netdb.h>
  75. #endif
  76. /* includes end */"
  77. AC_CHECK_HEADERS(
  78. sys/types.h netdb.h,
  79. [], [], [$cares_includes_netdb])
  80. ])
  81. dnl CARES_INCLUDES_SOCKET
  82. dnl -------------------------------------------------
  83. dnl Set up variable with list of headers that must be
  84. dnl included when socket.h is to be included.
  85. AC_DEFUN([CARES_INCLUDES_SOCKET], [
  86. cares_includes_socket="\
  87. /* includes start */
  88. #ifdef HAVE_SYS_TYPES_H
  89. # include <sys/types.h>
  90. #endif
  91. #ifdef HAVE_SOCKET_H
  92. # include <socket.h>
  93. #endif
  94. /* includes end */"
  95. AC_CHECK_HEADERS(
  96. sys/types.h socket.h,
  97. [], [], [$cares_includes_socket])
  98. ])
  99. dnl CARES_INCLUDES_STDLIB
  100. dnl -------------------------------------------------
  101. dnl Set up variable with list of headers that must be
  102. dnl included when stdlib.h is to be included.
  103. AC_DEFUN([CARES_INCLUDES_STDLIB], [
  104. cares_includes_stdlib="\
  105. /* includes start */
  106. #ifdef HAVE_SYS_TYPES_H
  107. # include <sys/types.h>
  108. #endif
  109. #ifdef HAVE_STDLIB_H
  110. # include <stdlib.h>
  111. #endif
  112. /* includes end */"
  113. AC_CHECK_HEADERS(
  114. sys/types.h stdlib.h,
  115. [], [], [$cares_includes_stdlib])
  116. ])
  117. dnl CARES_INCLUDES_STRING
  118. dnl -------------------------------------------------
  119. dnl Set up variable with list of headers that must be
  120. dnl included when string(s).h is to be included.
  121. AC_DEFUN([CARES_INCLUDES_STRING], [
  122. cares_includes_string="\
  123. /* includes start */
  124. #ifdef HAVE_SYS_TYPES_H
  125. # include <sys/types.h>
  126. #endif
  127. #ifdef HAVE_STRING_H
  128. # include <string.h>
  129. #endif
  130. #ifdef HAVE_STRINGS_H
  131. # include <strings.h>
  132. #endif
  133. /* includes end */"
  134. AC_CHECK_HEADERS(
  135. sys/types.h string.h strings.h,
  136. [], [], [$cares_includes_string])
  137. ])
  138. dnl CARES_INCLUDES_STROPTS
  139. dnl -------------------------------------------------
  140. dnl Set up variable with list of headers that must be
  141. dnl included when stropts.h is to be included.
  142. AC_DEFUN([CARES_INCLUDES_STROPTS], [
  143. cares_includes_stropts="\
  144. /* includes start */
  145. #ifdef HAVE_SYS_TYPES_H
  146. # include <sys/types.h>
  147. #endif
  148. #ifdef HAVE_UNISTD_H
  149. # include <unistd.h>
  150. #endif
  151. #ifdef HAVE_SYS_SOCKET_H
  152. # include <sys/socket.h>
  153. #endif
  154. #ifdef HAVE_SYS_IOCTL_H
  155. # include <sys/ioctl.h>
  156. #endif
  157. #ifdef HAVE_STROPTS_H
  158. # include <stropts.h>
  159. #endif
  160. /* includes end */"
  161. AC_CHECK_HEADERS(
  162. sys/types.h unistd.h sys/socket.h sys/ioctl.h stropts.h,
  163. [], [], [$cares_includes_stropts])
  164. ])
  165. dnl CARES_INCLUDES_SYS_SOCKET
  166. dnl -------------------------------------------------
  167. dnl Set up variable with list of headers that must be
  168. dnl included when sys/socket.h is to be included.
  169. AC_DEFUN([CARES_INCLUDES_SYS_SOCKET], [
  170. cares_includes_sys_socket="\
  171. /* includes start */
  172. #ifdef HAVE_SYS_TYPES_H
  173. # include <sys/types.h>
  174. #endif
  175. #ifdef HAVE_SYS_SOCKET_H
  176. # include <sys/socket.h>
  177. #endif
  178. /* includes end */"
  179. AC_CHECK_HEADERS(
  180. sys/types.h sys/socket.h,
  181. [], [], [$cares_includes_sys_socket])
  182. ])
  183. dnl CARES_INCLUDES_SYS_TYPES
  184. dnl -------------------------------------------------
  185. dnl Set up variable with list of headers that must be
  186. dnl included when sys/types.h is to be included.
  187. AC_DEFUN([CARES_INCLUDES_SYS_TYPES], [
  188. cares_includes_sys_types="\
  189. /* includes start */
  190. #ifdef HAVE_SYS_TYPES_H
  191. # include <sys/types.h>
  192. #endif
  193. /* includes end */"
  194. AC_CHECK_HEADERS(
  195. sys/types.h,
  196. [], [], [$cares_includes_sys_types])
  197. ])
  198. dnl CARES_INCLUDES_SYS_UIO
  199. dnl -------------------------------------------------
  200. dnl Set up variable with list of headers that must be
  201. dnl included when sys/uio.h is to be included.
  202. AC_DEFUN([CARES_INCLUDES_SYS_UIO], [
  203. cares_includes_sys_uio="\
  204. /* includes start */
  205. #ifdef HAVE_SYS_TYPES_H
  206. # include <sys/types.h>
  207. #endif
  208. #ifdef HAVE_SYS_UIO_H
  209. # include <sys/uio.h>
  210. #endif
  211. /* includes end */"
  212. AC_CHECK_HEADERS(
  213. sys/types.h sys/uio.h,
  214. [], [], [$cares_includes_sys_uio])
  215. ])
  216. dnl CARES_INCLUDES_UNISTD
  217. dnl -------------------------------------------------
  218. dnl Set up variable with list of headers that must be
  219. dnl included when unistd.h is to be included.
  220. AC_DEFUN([CARES_INCLUDES_UNISTD], [
  221. cares_includes_unistd="\
  222. /* includes start */
  223. #ifdef HAVE_SYS_TYPES_H
  224. # include <sys/types.h>
  225. #endif
  226. #ifdef HAVE_UNISTD_H
  227. # include <unistd.h>
  228. #endif
  229. /* includes end */"
  230. AC_CHECK_HEADERS(
  231. sys/types.h unistd.h,
  232. [], [], [$cares_includes_unistd])
  233. ])
  234. dnl CARES_INCLUDES_WINSOCK2
  235. dnl -------------------------------------------------
  236. dnl Set up variable with list of headers that must be
  237. dnl included when winsock(2).h is to be included.
  238. AC_DEFUN([CARES_INCLUDES_WINSOCK2], [
  239. cares_includes_winsock2="\
  240. /* includes start */
  241. #ifdef HAVE_WINDOWS_H
  242. # ifndef WIN32_LEAN_AND_MEAN
  243. # define WIN32_LEAN_AND_MEAN
  244. # endif
  245. # include <windows.h>
  246. # ifdef HAVE_WINSOCK2_H
  247. # include <winsock2.h>
  248. # else
  249. # ifdef HAVE_WINSOCK_H
  250. # include <winsock.h>
  251. # endif
  252. # endif
  253. #endif
  254. /* includes end */"
  255. CURL_CHECK_HEADER_WINDOWS
  256. CURL_CHECK_HEADER_WINSOCK
  257. CURL_CHECK_HEADER_WINSOCK2
  258. ])
  259. dnl CARES_INCLUDES_WS2TCPIP
  260. dnl -------------------------------------------------
  261. dnl Set up variable with list of headers that must be
  262. dnl included when ws2tcpip.h is to be included.
  263. AC_DEFUN([CARES_INCLUDES_WS2TCPIP], [
  264. cares_includes_ws2tcpip="\
  265. /* includes start */
  266. #ifdef HAVE_WINDOWS_H
  267. # ifndef WIN32_LEAN_AND_MEAN
  268. # define WIN32_LEAN_AND_MEAN
  269. # endif
  270. # include <windows.h>
  271. # ifdef HAVE_WINSOCK2_H
  272. # include <winsock2.h>
  273. # ifdef HAVE_WS2TCPIP_H
  274. # include <ws2tcpip.h>
  275. # endif
  276. # endif
  277. #endif
  278. /* includes end */"
  279. CURL_CHECK_HEADER_WINDOWS
  280. CURL_CHECK_HEADER_WINSOCK2
  281. CURL_CHECK_HEADER_WS2TCPIP
  282. ])
  283. dnl CARES_PREPROCESS_CALLCONV
  284. dnl -------------------------------------------------
  285. dnl Set up variable with a preprocessor block which
  286. dnl defines function calling convention.
  287. AC_DEFUN([CARES_PREPROCESS_CALLCONV], [
  288. cares_preprocess_callconv="\
  289. /* preprocess start */
  290. #ifdef HAVE_WINDOWS_H
  291. # define FUNCALLCONV __stdcall
  292. #else
  293. # define FUNCALLCONV
  294. #endif
  295. /* preprocess end */"
  296. ])
  297. dnl CARES_CHECK_FUNC_CLOSESOCKET
  298. dnl -------------------------------------------------
  299. dnl Verify if closesocket is available, prototyped, and
  300. dnl can be compiled. If all of these are true, and
  301. dnl usage has not been previously disallowed with
  302. dnl shell variable cares_disallow_closesocket, then
  303. dnl HAVE_CLOSESOCKET will be defined.
  304. AC_DEFUN([CARES_CHECK_FUNC_CLOSESOCKET], [
  305. AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl
  306. AC_REQUIRE([CARES_INCLUDES_SOCKET])dnl
  307. #
  308. tst_links_closesocket="unknown"
  309. tst_proto_closesocket="unknown"
  310. tst_compi_closesocket="unknown"
  311. tst_allow_closesocket="unknown"
  312. #
  313. AC_MSG_CHECKING([if closesocket can be linked])
  314. AC_LINK_IFELSE([
  315. AC_LANG_PROGRAM([[
  316. $cares_includes_winsock2
  317. $cares_includes_socket
  318. ]],[[
  319. if(0 != closesocket(0))
  320. return 1;
  321. ]])
  322. ],[
  323. AC_MSG_RESULT([yes])
  324. tst_links_closesocket="yes"
  325. ],[
  326. AC_MSG_RESULT([no])
  327. tst_links_closesocket="no"
  328. ])
  329. #
  330. if test "$tst_links_closesocket" = "yes"; then
  331. AC_MSG_CHECKING([if closesocket is prototyped])
  332. AC_EGREP_CPP([closesocket],[
  333. $cares_includes_winsock2
  334. $cares_includes_socket
  335. ],[
  336. AC_MSG_RESULT([yes])
  337. tst_proto_closesocket="yes"
  338. ],[
  339. AC_MSG_RESULT([no])
  340. tst_proto_closesocket="no"
  341. ])
  342. fi
  343. #
  344. if test "$tst_proto_closesocket" = "yes"; then
  345. AC_MSG_CHECKING([if closesocket is compilable])
  346. AC_COMPILE_IFELSE([
  347. AC_LANG_PROGRAM([[
  348. $cares_includes_winsock2
  349. $cares_includes_socket
  350. ]],[[
  351. if(0 != closesocket(0))
  352. return 1;
  353. ]])
  354. ],[
  355. AC_MSG_RESULT([yes])
  356. tst_compi_closesocket="yes"
  357. ],[
  358. AC_MSG_RESULT([no])
  359. tst_compi_closesocket="no"
  360. ])
  361. fi
  362. #
  363. if test "$tst_compi_closesocket" = "yes"; then
  364. AC_MSG_CHECKING([if closesocket usage allowed])
  365. if test "x$cares_disallow_closesocket" != "xyes"; then
  366. AC_MSG_RESULT([yes])
  367. tst_allow_closesocket="yes"
  368. else
  369. AC_MSG_RESULT([no])
  370. tst_allow_closesocket="no"
  371. fi
  372. fi
  373. #
  374. AC_MSG_CHECKING([if closesocket might be used])
  375. if test "$tst_links_closesocket" = "yes" &&
  376. test "$tst_proto_closesocket" = "yes" &&
  377. test "$tst_compi_closesocket" = "yes" &&
  378. test "$tst_allow_closesocket" = "yes"; then
  379. AC_MSG_RESULT([yes])
  380. AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET, 1,
  381. [Define to 1 if you have the closesocket function.])
  382. ac_cv_func_closesocket="yes"
  383. else
  384. AC_MSG_RESULT([no])
  385. ac_cv_func_closesocket="no"
  386. fi
  387. ])
  388. dnl CARES_CHECK_FUNC_CLOSESOCKET_CAMEL
  389. dnl -------------------------------------------------
  390. dnl Verify if CloseSocket is available, prototyped, and
  391. dnl can be compiled. If all of these are true, and
  392. dnl usage has not been previously disallowed with
  393. dnl shell variable cares_disallow_closesocket_camel,
  394. dnl then HAVE_CLOSESOCKET_CAMEL will be defined.
  395. AC_DEFUN([CARES_CHECK_FUNC_CLOSESOCKET_CAMEL], [
  396. AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl
  397. #
  398. tst_links_closesocket_camel="unknown"
  399. tst_proto_closesocket_camel="unknown"
  400. tst_compi_closesocket_camel="unknown"
  401. tst_allow_closesocket_camel="unknown"
  402. #
  403. AC_MSG_CHECKING([if CloseSocket can be linked])
  404. AC_LINK_IFELSE([
  405. AC_LANG_PROGRAM([[
  406. $cares_includes_sys_socket
  407. ]],[[
  408. if(0 != CloseSocket(0))
  409. return 1;
  410. ]])
  411. ],[
  412. AC_MSG_RESULT([yes])
  413. tst_links_closesocket_camel="yes"
  414. ],[
  415. AC_MSG_RESULT([no])
  416. tst_links_closesocket_camel="no"
  417. ])
  418. #
  419. if test "$tst_links_closesocket_camel" = "yes"; then
  420. AC_MSG_CHECKING([if CloseSocket is prototyped])
  421. AC_EGREP_CPP([CloseSocket],[
  422. $cares_includes_sys_socket
  423. ],[
  424. AC_MSG_RESULT([yes])
  425. tst_proto_closesocket_camel="yes"
  426. ],[
  427. AC_MSG_RESULT([no])
  428. tst_proto_closesocket_camel="no"
  429. ])
  430. fi
  431. #
  432. if test "$tst_proto_closesocket_camel" = "yes"; then
  433. AC_MSG_CHECKING([if CloseSocket is compilable])
  434. AC_COMPILE_IFELSE([
  435. AC_LANG_PROGRAM([[
  436. $cares_includes_sys_socket
  437. ]],[[
  438. if(0 != CloseSocket(0))
  439. return 1;
  440. ]])
  441. ],[
  442. AC_MSG_RESULT([yes])
  443. tst_compi_closesocket_camel="yes"
  444. ],[
  445. AC_MSG_RESULT([no])
  446. tst_compi_closesocket_camel="no"
  447. ])
  448. fi
  449. #
  450. if test "$tst_compi_closesocket_camel" = "yes"; then
  451. AC_MSG_CHECKING([if CloseSocket usage allowed])
  452. if test "x$cares_disallow_closesocket_camel" != "xyes"; then
  453. AC_MSG_RESULT([yes])
  454. tst_allow_closesocket_camel="yes"
  455. else
  456. AC_MSG_RESULT([no])
  457. tst_allow_closesocket_camel="no"
  458. fi
  459. fi
  460. #
  461. AC_MSG_CHECKING([if CloseSocket might be used])
  462. if test "$tst_links_closesocket_camel" = "yes" &&
  463. test "$tst_proto_closesocket_camel" = "yes" &&
  464. test "$tst_compi_closesocket_camel" = "yes" &&
  465. test "$tst_allow_closesocket_camel" = "yes"; then
  466. AC_MSG_RESULT([yes])
  467. AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET_CAMEL, 1,
  468. [Define to 1 if you have the CloseSocket camel case function.])
  469. ac_cv_func_closesocket_camel="yes"
  470. else
  471. AC_MSG_RESULT([no])
  472. ac_cv_func_closesocket_camel="no"
  473. fi
  474. ])
  475. dnl CARES_CHECK_FUNC_CONNECT
  476. dnl -------------------------------------------------
  477. dnl Verify if connect is available, prototyped, and
  478. dnl can be compiled. If all of these are true, and
  479. dnl usage has not been previously disallowed with
  480. dnl shell variable cares_disallow_connect, then
  481. dnl HAVE_CONNECT will be defined.
  482. AC_DEFUN([CARES_CHECK_FUNC_CONNECT], [
  483. AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl
  484. AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl
  485. AC_REQUIRE([CARES_INCLUDES_SOCKET])dnl
  486. #
  487. tst_links_connect="unknown"
  488. tst_proto_connect="unknown"
  489. tst_compi_connect="unknown"
  490. tst_allow_connect="unknown"
  491. #
  492. AC_MSG_CHECKING([if connect can be linked])
  493. AC_LINK_IFELSE([
  494. AC_LANG_PROGRAM([[
  495. $cares_includes_winsock2
  496. $cares_includes_sys_socket
  497. $cares_includes_socket
  498. ]],[[
  499. if(0 != connect(0, 0, 0))
  500. return 1;
  501. ]])
  502. ],[
  503. AC_MSG_RESULT([yes])
  504. tst_links_connect="yes"
  505. ],[
  506. AC_MSG_RESULT([no])
  507. tst_links_connect="no"
  508. ])
  509. #
  510. if test "$tst_links_connect" = "yes"; then
  511. AC_MSG_CHECKING([if connect is prototyped])
  512. AC_EGREP_CPP([connect],[
  513. $cares_includes_winsock2
  514. $cares_includes_sys_socket
  515. $cares_includes_socket
  516. ],[
  517. AC_MSG_RESULT([yes])
  518. tst_proto_connect="yes"
  519. ],[
  520. AC_MSG_RESULT([no])
  521. tst_proto_connect="no"
  522. ])
  523. fi
  524. #
  525. if test "$tst_proto_connect" = "yes"; then
  526. AC_MSG_CHECKING([if connect is compilable])
  527. AC_COMPILE_IFELSE([
  528. AC_LANG_PROGRAM([[
  529. $cares_includes_winsock2
  530. $cares_includes_sys_socket
  531. $cares_includes_socket
  532. ]],[[
  533. if(0 != connect(0, 0, 0))
  534. return 1;
  535. ]])
  536. ],[
  537. AC_MSG_RESULT([yes])
  538. tst_compi_connect="yes"
  539. ],[
  540. AC_MSG_RESULT([no])
  541. tst_compi_connect="no"
  542. ])
  543. fi
  544. #
  545. if test "$tst_compi_connect" = "yes"; then
  546. AC_MSG_CHECKING([if connect usage allowed])
  547. if test "x$cares_disallow_connect" != "xyes"; then
  548. AC_MSG_RESULT([yes])
  549. tst_allow_connect="yes"
  550. else
  551. AC_MSG_RESULT([no])
  552. tst_allow_connect="no"
  553. fi
  554. fi
  555. #
  556. AC_MSG_CHECKING([if connect might be used])
  557. if test "$tst_links_connect" = "yes" &&
  558. test "$tst_proto_connect" = "yes" &&
  559. test "$tst_compi_connect" = "yes" &&
  560. test "$tst_allow_connect" = "yes"; then
  561. AC_MSG_RESULT([yes])
  562. AC_DEFINE_UNQUOTED(HAVE_CONNECT, 1,
  563. [Define to 1 if you have the connect function.])
  564. ac_cv_func_connect="yes"
  565. else
  566. AC_MSG_RESULT([no])
  567. ac_cv_func_connect="no"
  568. fi
  569. ])
  570. dnl CARES_CHECK_FUNC_FCNTL
  571. dnl -------------------------------------------------
  572. dnl Verify if fcntl is available, prototyped, and
  573. dnl can be compiled. If all of these are true, and
  574. dnl usage has not been previously disallowed with
  575. dnl shell variable cares_disallow_fcntl, then
  576. dnl HAVE_FCNTL will be defined.
  577. AC_DEFUN([CARES_CHECK_FUNC_FCNTL], [
  578. AC_REQUIRE([CARES_INCLUDES_FCNTL])dnl
  579. #
  580. tst_links_fcntl="unknown"
  581. tst_proto_fcntl="unknown"
  582. tst_compi_fcntl="unknown"
  583. tst_allow_fcntl="unknown"
  584. #
  585. AC_MSG_CHECKING([if fcntl can be linked])
  586. AC_LINK_IFELSE([
  587. AC_LANG_FUNC_LINK_TRY([fcntl])
  588. ],[
  589. AC_MSG_RESULT([yes])
  590. tst_links_fcntl="yes"
  591. ],[
  592. AC_MSG_RESULT([no])
  593. tst_links_fcntl="no"
  594. ])
  595. #
  596. if test "$tst_links_fcntl" = "yes"; then
  597. AC_MSG_CHECKING([if fcntl is prototyped])
  598. AC_EGREP_CPP([fcntl],[
  599. $cares_includes_fcntl
  600. ],[
  601. AC_MSG_RESULT([yes])
  602. tst_proto_fcntl="yes"
  603. ],[
  604. AC_MSG_RESULT([no])
  605. tst_proto_fcntl="no"
  606. ])
  607. fi
  608. #
  609. if test "$tst_proto_fcntl" = "yes"; then
  610. AC_MSG_CHECKING([if fcntl is compilable])
  611. AC_COMPILE_IFELSE([
  612. AC_LANG_PROGRAM([[
  613. $cares_includes_fcntl
  614. ]],[[
  615. if(0 != fcntl(0, 0, 0))
  616. return 1;
  617. ]])
  618. ],[
  619. AC_MSG_RESULT([yes])
  620. tst_compi_fcntl="yes"
  621. ],[
  622. AC_MSG_RESULT([no])
  623. tst_compi_fcntl="no"
  624. ])
  625. fi
  626. #
  627. if test "$tst_compi_fcntl" = "yes"; then
  628. AC_MSG_CHECKING([if fcntl usage allowed])
  629. if test "x$cares_disallow_fcntl" != "xyes"; then
  630. AC_MSG_RESULT([yes])
  631. tst_allow_fcntl="yes"
  632. else
  633. AC_MSG_RESULT([no])
  634. tst_allow_fcntl="no"
  635. fi
  636. fi
  637. #
  638. AC_MSG_CHECKING([if fcntl might be used])
  639. if test "$tst_links_fcntl" = "yes" &&
  640. test "$tst_proto_fcntl" = "yes" &&
  641. test "$tst_compi_fcntl" = "yes" &&
  642. test "$tst_allow_fcntl" = "yes"; then
  643. AC_MSG_RESULT([yes])
  644. AC_DEFINE_UNQUOTED(HAVE_FCNTL, 1,
  645. [Define to 1 if you have the fcntl function.])
  646. ac_cv_func_fcntl="yes"
  647. CARES_CHECK_FUNC_FCNTL_O_NONBLOCK
  648. else
  649. AC_MSG_RESULT([no])
  650. ac_cv_func_fcntl="no"
  651. fi
  652. ])
  653. dnl CARES_CHECK_FUNC_FCNTL_O_NONBLOCK
  654. dnl -------------------------------------------------
  655. dnl Verify if fcntl with status flag O_NONBLOCK is
  656. dnl available, can be compiled, and seems to work. If
  657. dnl all of these are true, then HAVE_FCNTL_O_NONBLOCK
  658. dnl will be defined.
  659. AC_DEFUN([CARES_CHECK_FUNC_FCNTL_O_NONBLOCK], [
  660. #
  661. tst_compi_fcntl_o_nonblock="unknown"
  662. tst_allow_fcntl_o_nonblock="unknown"
  663. #
  664. case $host_os in
  665. sunos4* | aix3* | beos*)
  666. dnl O_NONBLOCK does not work on these platforms
  667. cares_disallow_fcntl_o_nonblock="yes"
  668. ;;
  669. esac
  670. #
  671. if test "$ac_cv_func_fcntl" = "yes"; then
  672. AC_MSG_CHECKING([if fcntl O_NONBLOCK is compilable])
  673. AC_COMPILE_IFELSE([
  674. AC_LANG_PROGRAM([[
  675. $cares_includes_fcntl
  676. ]],[[
  677. int flags = 0;
  678. if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK))
  679. return 1;
  680. ]])
  681. ],[
  682. AC_MSG_RESULT([yes])
  683. tst_compi_fcntl_o_nonblock="yes"
  684. ],[
  685. AC_MSG_RESULT([no])
  686. tst_compi_fcntl_o_nonblock="no"
  687. ])
  688. fi
  689. #
  690. if test "$tst_compi_fcntl_o_nonblock" = "yes"; then
  691. AC_MSG_CHECKING([if fcntl O_NONBLOCK usage allowed])
  692. if test "x$cares_disallow_fcntl_o_nonblock" != "xyes"; then
  693. AC_MSG_RESULT([yes])
  694. tst_allow_fcntl_o_nonblock="yes"
  695. else
  696. AC_MSG_RESULT([no])
  697. tst_allow_fcntl_o_nonblock="no"
  698. fi
  699. fi
  700. #
  701. AC_MSG_CHECKING([if fcntl O_NONBLOCK might be used])
  702. if test "$tst_compi_fcntl_o_nonblock" = "yes" &&
  703. test "$tst_allow_fcntl_o_nonblock" = "yes"; then
  704. AC_MSG_RESULT([yes])
  705. AC_DEFINE_UNQUOTED(HAVE_FCNTL_O_NONBLOCK, 1,
  706. [Define to 1 if you have a working fcntl O_NONBLOCK function.])
  707. ac_cv_func_fcntl_o_nonblock="yes"
  708. else
  709. AC_MSG_RESULT([no])
  710. ac_cv_func_fcntl_o_nonblock="no"
  711. fi
  712. ])
  713. dnl CARES_CHECK_FUNC_FREEADDRINFO
  714. dnl -------------------------------------------------
  715. dnl Verify if freeaddrinfo is available, prototyped,
  716. dnl and can be compiled. If all of these are true,
  717. dnl and usage has not been previously disallowed with
  718. dnl shell variable cares_disallow_freeaddrinfo, then
  719. dnl HAVE_FREEADDRINFO will be defined.
  720. AC_DEFUN([CARES_CHECK_FUNC_FREEADDRINFO], [
  721. AC_REQUIRE([CARES_INCLUDES_WS2TCPIP])dnl
  722. AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl
  723. AC_REQUIRE([CARES_INCLUDES_NETDB])dnl
  724. #
  725. tst_links_freeaddrinfo="unknown"
  726. tst_proto_freeaddrinfo="unknown"
  727. tst_compi_freeaddrinfo="unknown"
  728. tst_allow_freeaddrinfo="unknown"
  729. #
  730. AC_MSG_CHECKING([if freeaddrinfo can be linked])
  731. AC_LINK_IFELSE([
  732. AC_LANG_PROGRAM([[
  733. $cares_includes_ws2tcpip
  734. $cares_includes_sys_socket
  735. $cares_includes_netdb
  736. ]],[[
  737. freeaddrinfo(0);
  738. ]])
  739. ],[
  740. AC_MSG_RESULT([yes])
  741. tst_links_freeaddrinfo="yes"
  742. ],[
  743. AC_MSG_RESULT([no])
  744. tst_links_freeaddrinfo="no"
  745. ])
  746. #
  747. if test "$tst_links_freeaddrinfo" = "yes"; then
  748. AC_MSG_CHECKING([if freeaddrinfo is prototyped])
  749. AC_EGREP_CPP([freeaddrinfo],[
  750. $cares_includes_ws2tcpip
  751. $cares_includes_sys_socket
  752. $cares_includes_netdb
  753. ],[
  754. AC_MSG_RESULT([yes])
  755. tst_proto_freeaddrinfo="yes"
  756. ],[
  757. AC_MSG_RESULT([no])
  758. tst_proto_freeaddrinfo="no"
  759. ])
  760. fi
  761. #
  762. if test "$tst_proto_freeaddrinfo" = "yes"; then
  763. AC_MSG_CHECKING([if freeaddrinfo is compilable])
  764. AC_COMPILE_IFELSE([
  765. AC_LANG_PROGRAM([[
  766. $cares_includes_ws2tcpip
  767. $cares_includes_sys_socket
  768. $cares_includes_netdb
  769. ]],[[
  770. freeaddrinfo(0);
  771. ]])
  772. ],[
  773. AC_MSG_RESULT([yes])
  774. tst_compi_freeaddrinfo="yes"
  775. ],[
  776. AC_MSG_RESULT([no])
  777. tst_compi_freeaddrinfo="no"
  778. ])
  779. fi
  780. #
  781. if test "$tst_compi_freeaddrinfo" = "yes"; then
  782. AC_MSG_CHECKING([if freeaddrinfo usage allowed])
  783. if test "x$cares_disallow_freeaddrinfo" != "xyes"; then
  784. AC_MSG_RESULT([yes])
  785. tst_allow_freeaddrinfo="yes"
  786. else
  787. AC_MSG_RESULT([no])
  788. tst_allow_freeaddrinfo="no"
  789. fi
  790. fi
  791. #
  792. AC_MSG_CHECKING([if freeaddrinfo might be used])
  793. if test "$tst_links_freeaddrinfo" = "yes" &&
  794. test "$tst_proto_freeaddrinfo" = "yes" &&
  795. test "$tst_compi_freeaddrinfo" = "yes" &&
  796. test "$tst_allow_freeaddrinfo" = "yes"; then
  797. AC_MSG_RESULT([yes])
  798. AC_DEFINE_UNQUOTED(HAVE_FREEADDRINFO, 1,
  799. [Define to 1 if you have the freeaddrinfo function.])
  800. ac_cv_func_freeaddrinfo="yes"
  801. else
  802. AC_MSG_RESULT([no])
  803. ac_cv_func_freeaddrinfo="no"
  804. fi
  805. ])
  806. dnl CARES_CHECK_FUNC_GETADDRINFO
  807. dnl -------------------------------------------------
  808. dnl Verify if getaddrinfo is available, prototyped, can
  809. dnl be compiled and seems to work. If all of these are
  810. dnl true, and usage has not been previously disallowed
  811. dnl with shell variable cares_disallow_getaddrinfo, then
  812. dnl HAVE_GETADDRINFO will be defined. Additionally when
  813. dnl HAVE_GETADDRINFO gets defined this will also attempt
  814. dnl to find out if getaddrinfo happens to be threadsafe,
  815. dnl defining HAVE_GETADDRINFO_THREADSAFE when true.
  816. AC_DEFUN([CARES_CHECK_FUNC_GETADDRINFO], [
  817. AC_REQUIRE([CARES_INCLUDES_WS2TCPIP])dnl
  818. AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl
  819. AC_REQUIRE([CARES_INCLUDES_STRING])dnl
  820. AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl
  821. AC_REQUIRE([CARES_INCLUDES_NETDB])dnl
  822. AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
  823. #
  824. tst_links_getaddrinfo="unknown"
  825. tst_proto_getaddrinfo="unknown"
  826. tst_compi_getaddrinfo="unknown"
  827. tst_works_getaddrinfo="unknown"
  828. tst_allow_getaddrinfo="unknown"
  829. tst_tsafe_getaddrinfo="unknown"
  830. #
  831. AC_MSG_CHECKING([if getaddrinfo can be linked])
  832. AC_LINK_IFELSE([
  833. AC_LANG_PROGRAM([[
  834. $cares_includes_ws2tcpip
  835. $cares_includes_sys_socket
  836. $cares_includes_netdb
  837. ]],[[
  838. if(0 != getaddrinfo(0, 0, 0, 0))
  839. return 1;
  840. ]])
  841. ],[
  842. AC_MSG_RESULT([yes])
  843. tst_links_getaddrinfo="yes"
  844. ],[
  845. AC_MSG_RESULT([no])
  846. tst_links_getaddrinfo="no"
  847. ])
  848. #
  849. if test "$tst_links_getaddrinfo" = "yes"; then
  850. AC_MSG_CHECKING([if getaddrinfo is prototyped])
  851. AC_EGREP_CPP([getaddrinfo],[
  852. $cares_includes_ws2tcpip
  853. $cares_includes_sys_socket
  854. $cares_includes_netdb
  855. ],[
  856. AC_MSG_RESULT([yes])
  857. tst_proto_getaddrinfo="yes"
  858. ],[
  859. AC_MSG_RESULT([no])
  860. tst_proto_getaddrinfo="no"
  861. ])
  862. fi
  863. #
  864. if test "$tst_proto_getaddrinfo" = "yes"; then
  865. AC_MSG_CHECKING([if getaddrinfo is compilable])
  866. AC_COMPILE_IFELSE([
  867. AC_LANG_PROGRAM([[
  868. $cares_includes_ws2tcpip
  869. $cares_includes_sys_socket
  870. $cares_includes_netdb
  871. ]],[[
  872. if(0 != getaddrinfo(0, 0, 0, 0))
  873. return 1;
  874. ]])
  875. ],[
  876. AC_MSG_RESULT([yes])
  877. tst_compi_getaddrinfo="yes"
  878. ],[
  879. AC_MSG_RESULT([no])
  880. tst_compi_getaddrinfo="no"
  881. ])
  882. fi
  883. #
  884. dnl only do runtime verification when not cross-compiling
  885. if test "x$cross_compiling" != "xyes" &&
  886. test "$tst_compi_getaddrinfo" = "yes"; then
  887. AC_MSG_CHECKING([if getaddrinfo seems to work])
  888. AC_RUN_IFELSE([
  889. AC_LANG_PROGRAM([[
  890. $cares_includes_ws2tcpip
  891. $cares_includes_stdlib
  892. $cares_includes_string
  893. $cares_includes_sys_socket
  894. $cares_includes_netdb
  895. ]],[[
  896. struct addrinfo hints;
  897. struct addrinfo *ai = 0;
  898. int error;
  899. memset(&hints, 0, sizeof(hints));
  900. hints.ai_flags = AI_NUMERICHOST;
  901. hints.ai_family = AF_UNSPEC;
  902. hints.ai_socktype = SOCK_STREAM;
  903. error = getaddrinfo("127.0.0.1", 0, &hints, &ai);
  904. if(error || !ai)
  905. exit(1); /* fail */
  906. else
  907. exit(0);
  908. ]])
  909. ],[
  910. AC_MSG_RESULT([yes])
  911. tst_works_getaddrinfo="yes"
  912. ],[
  913. AC_MSG_RESULT([no])
  914. tst_works_getaddrinfo="no"
  915. ])
  916. fi
  917. #
  918. if test "$tst_compi_getaddrinfo" = "yes" &&
  919. test "$tst_works_getaddrinfo" != "no"; then
  920. AC_MSG_CHECKING([if getaddrinfo usage allowed])
  921. if test "x$cares_disallow_getaddrinfo" != "xyes"; then
  922. AC_MSG_RESULT([yes])
  923. tst_allow_getaddrinfo="yes"
  924. else
  925. AC_MSG_RESULT([no])
  926. tst_allow_getaddrinfo="no"
  927. fi
  928. fi
  929. #
  930. AC_MSG_CHECKING([if getaddrinfo might be used])
  931. if test "$tst_links_getaddrinfo" = "yes" &&
  932. test "$tst_proto_getaddrinfo" = "yes" &&
  933. test "$tst_compi_getaddrinfo" = "yes" &&
  934. test "$tst_allow_getaddrinfo" = "yes" &&
  935. test "$tst_works_getaddrinfo" != "no"; then
  936. AC_MSG_RESULT([yes])
  937. AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO, 1,
  938. [Define to 1 if you have a working getaddrinfo function.])
  939. ac_cv_func_getaddrinfo="yes"
  940. else
  941. AC_MSG_RESULT([no])
  942. ac_cv_func_getaddrinfo="no"
  943. ac_cv_func_getaddrinfo_threadsafe="no"
  944. fi
  945. #
  946. if test "$ac_cv_func_getaddrinfo" = "yes"; then
  947. AC_MSG_CHECKING([if getaddrinfo is threadsafe])
  948. case $host_os in
  949. aix[[1234]].* | aix5.[[01]].*)
  950. dnl aix 5.1 and older
  951. tst_tsafe_getaddrinfo="no"
  952. ;;
  953. aix*)
  954. dnl aix 5.2 and newer
  955. tst_tsafe_getaddrinfo="yes"
  956. ;;
  957. darwin[[12345]].*)
  958. dnl darwin 5.0 and mac os x 10.1.X and older
  959. tst_tsafe_getaddrinfo="no"
  960. ;;
  961. darwin*)
  962. dnl darwin 6.0 and mac os x 10.2.X and newer
  963. tst_tsafe_getaddrinfo="yes"
  964. ;;
  965. freebsd[[1234]].* | freebsd5.[[1234]]*)
  966. dnl freebsd 5.4 and older
  967. tst_tsafe_getaddrinfo="no"
  968. ;;
  969. freebsd*)
  970. dnl freebsd 5.5 and newer
  971. tst_tsafe_getaddrinfo="yes"
  972. ;;
  973. hpux[[123456789]].* | hpux10.* | hpux11.0* | hpux11.10*)
  974. dnl hpux 11.10 and older
  975. tst_tsafe_getaddrinfo="no"
  976. ;;
  977. hpux*)
  978. dnl hpux 11.11 and newer
  979. tst_tsafe_getaddrinfo="yes"
  980. ;;
  981. netbsd[[123]].*)
  982. dnl netbsd 3.X and older
  983. tst_tsafe_getaddrinfo="no"
  984. ;;
  985. netbsd*)
  986. dnl netbsd 4.X and newer
  987. tst_tsafe_getaddrinfo="yes"
  988. ;;
  989. *bsd*)
  990. dnl All other bsd's
  991. tst_tsafe_getaddrinfo="no"
  992. ;;
  993. solaris2*)
  994. dnl solaris which have it
  995. tst_tsafe_getaddrinfo="yes"
  996. ;;
  997. esac
  998. if test "$tst_tsafe_getaddrinfo" = "unknown" &&
  999. test "$ac_cv_native_windows" = "yes"; then
  1000. tst_tsafe_getaddrinfo="yes"
  1001. fi
  1002. if test "$tst_tsafe_getaddrinfo" = "unknown"; then
  1003. CURL_CHECK_DEF_CC([h_errno], [
  1004. $cares_includes_sys_socket
  1005. $cares_includes_netdb
  1006. ], [silent])
  1007. if test "$curl_cv_have_def_h_errno" = "yes"; then
  1008. tst_h_errno_macro="yes"
  1009. else
  1010. tst_h_errno_macro="no"
  1011. fi
  1012. AC_COMPILE_IFELSE([
  1013. AC_LANG_PROGRAM([[
  1014. $cares_includes_sys_socket
  1015. $cares_includes_netdb
  1016. ]],[[
  1017. h_errno = 2;
  1018. if(0 != h_errno)
  1019. return 1;
  1020. ]])
  1021. ],[
  1022. tst_h_errno_modifiable_lvalue="yes"
  1023. ],[
  1024. tst_h_errno_modifiable_lvalue="no"
  1025. ])
  1026. AC_COMPILE_IFELSE([
  1027. AC_LANG_PROGRAM([[
  1028. ]],[[
  1029. #if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
  1030. return 0;
  1031. #elif defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 700)
  1032. return 0;
  1033. #else
  1034. force compilation error
  1035. #endif
  1036. ]])
  1037. ],[
  1038. tst_h_errno_sbs_issue_7="yes"
  1039. ],[
  1040. tst_h_errno_sbs_issue_7="no"
  1041. ])
  1042. if test "$tst_h_errno_macro" = "no" &&
  1043. test "$tst_h_errno_modifiable_lvalue" = "no" &&
  1044. test "$tst_h_errno_sbs_issue_7" = "no"; then
  1045. tst_tsafe_getaddrinfo="no"
  1046. else
  1047. tst_tsafe_getaddrinfo="yes"
  1048. fi
  1049. fi
  1050. AC_MSG_RESULT([$tst_tsafe_getaddrinfo])
  1051. if test "$tst_tsafe_getaddrinfo" = "yes"; then
  1052. AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO_THREADSAFE, 1,
  1053. [Define to 1 if the getaddrinfo function is threadsafe.])
  1054. ac_cv_func_getaddrinfo_threadsafe="yes"
  1055. else
  1056. ac_cv_func_getaddrinfo_threadsafe="no"
  1057. fi
  1058. fi
  1059. ])
  1060. dnl CARES_CHECK_FUNC_GETENV
  1061. dnl -------------------------------------------------
  1062. dnl Verify if getenv is available, prototyped, and
  1063. dnl can be compiled. If all of these are true, and
  1064. dnl usage has not been previously disallowed with
  1065. dnl shell variable cares_disallow_getenv, then
  1066. dnl HAVE_GETENV will be defined.
  1067. AC_DEFUN([CARES_CHECK_FUNC_GETENV], [
  1068. AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl
  1069. #
  1070. tst_links_getenv="unknown"
  1071. tst_proto_getenv="unknown"
  1072. tst_compi_getenv="unknown"
  1073. tst_allow_getenv="unknown"
  1074. #
  1075. AC_MSG_CHECKING([if getenv can be linked])
  1076. AC_LINK_IFELSE([
  1077. AC_LANG_FUNC_LINK_TRY([getenv])
  1078. ],[
  1079. AC_MSG_RESULT([yes])
  1080. tst_links_getenv="yes"
  1081. ],[
  1082. AC_MSG_RESULT([no])
  1083. tst_links_getenv="no"
  1084. ])
  1085. #
  1086. if test "$tst_links_getenv" = "yes"; then
  1087. AC_MSG_CHECKING([if getenv is prototyped])
  1088. AC_EGREP_CPP([getenv],[
  1089. $cares_includes_stdlib
  1090. ],[
  1091. AC_MSG_RESULT([yes])
  1092. tst_proto_getenv="yes"
  1093. ],[
  1094. AC_MSG_RESULT([no])
  1095. tst_proto_getenv="no"
  1096. ])
  1097. fi
  1098. #
  1099. if test "$tst_proto_getenv" = "yes"; then
  1100. AC_MSG_CHECKING([if getenv is compilable])
  1101. AC_COMPILE_IFELSE([
  1102. AC_LANG_PROGRAM([[
  1103. $cares_includes_stdlib
  1104. ]],[[
  1105. if(0 != getenv(0))
  1106. return 1;
  1107. ]])
  1108. ],[
  1109. AC_MSG_RESULT([yes])
  1110. tst_compi_getenv="yes"
  1111. ],[
  1112. AC_MSG_RESULT([no])
  1113. tst_compi_getenv="no"
  1114. ])
  1115. fi
  1116. #
  1117. if test "$tst_compi_getenv" = "yes"; then
  1118. AC_MSG_CHECKING([if getenv usage allowed])
  1119. if test "x$cares_disallow_getenv" != "xyes"; then
  1120. AC_MSG_RESULT([yes])
  1121. tst_allow_getenv="yes"
  1122. else
  1123. AC_MSG_RESULT([no])
  1124. tst_allow_getenv="no"
  1125. fi
  1126. fi
  1127. #
  1128. AC_MSG_CHECKING([if getenv might be used])
  1129. if test "$tst_links_getenv" = "yes" &&
  1130. test "$tst_proto_getenv" = "yes" &&
  1131. test "$tst_compi_getenv" = "yes" &&
  1132. test "$tst_allow_getenv" = "yes"; then
  1133. AC_MSG_RESULT([yes])
  1134. AC_DEFINE_UNQUOTED(HAVE_GETENV, 1,
  1135. [Define to 1 if you have the getenv function.])
  1136. ac_cv_func_getenv="yes"
  1137. else
  1138. AC_MSG_RESULT([no])
  1139. ac_cv_func_getenv="no"
  1140. fi
  1141. ])
  1142. dnl CARES_CHECK_FUNC_GETHOSTBYADDR
  1143. dnl -------------------------------------------------
  1144. dnl Verify if gethostbyaddr is available, prototyped,
  1145. dnl and can be compiled. If all of these are true,
  1146. dnl and usage has not been previously disallowed with
  1147. dnl shell variable cares_disallow_gethostbyaddr, then
  1148. dnl HAVE_GETHOSTBYADDR will be defined.
  1149. AC_DEFUN([CARES_CHECK_FUNC_GETHOSTBYADDR], [
  1150. AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl
  1151. AC_REQUIRE([CARES_INCLUDES_NETDB])dnl
  1152. #
  1153. tst_links_gethostbyaddr="unknown"
  1154. tst_proto_gethostbyaddr="unknown"
  1155. tst_compi_gethostbyaddr="unknown"
  1156. tst_allow_gethostbyaddr="unknown"
  1157. #
  1158. AC_MSG_CHECKING([if gethostbyaddr can be linked])
  1159. AC_LINK_IFELSE([
  1160. AC_LANG_PROGRAM([[
  1161. $cares_includes_winsock2
  1162. $cares_includes_netdb
  1163. ]],[[
  1164. if(0 != gethostbyaddr(0, 0, 0))
  1165. return 1;
  1166. ]])
  1167. ],[
  1168. AC_MSG_RESULT([yes])
  1169. tst_links_gethostbyaddr="yes"
  1170. ],[
  1171. AC_MSG_RESULT([no])
  1172. tst_links_gethostbyaddr="no"
  1173. ])
  1174. #
  1175. if test "$tst_links_gethostbyaddr" = "yes"; then
  1176. AC_MSG_CHECKING([if gethostbyaddr is prototyped])
  1177. AC_EGREP_CPP([gethostbyaddr],[
  1178. $cares_includes_winsock2
  1179. $cares_includes_netdb
  1180. ],[
  1181. AC_MSG_RESULT([yes])
  1182. tst_proto_gethostbyaddr="yes"
  1183. ],[
  1184. AC_MSG_RESULT([no])
  1185. tst_proto_gethostbyaddr="no"
  1186. ])
  1187. fi
  1188. #
  1189. if test "$tst_proto_gethostbyaddr" = "yes"; then
  1190. AC_MSG_CHECKING([if gethostbyaddr is compilable])
  1191. AC_COMPILE_IFELSE([
  1192. AC_LANG_PROGRAM([[
  1193. $cares_includes_winsock2
  1194. $cares_includes_netdb
  1195. ]],[[
  1196. if(0 != gethostbyaddr(0, 0, 0))
  1197. return 1;
  1198. ]])
  1199. ],[
  1200. AC_MSG_RESULT([yes])
  1201. tst_compi_gethostbyaddr="yes"
  1202. ],[
  1203. AC_MSG_RESULT([no])
  1204. tst_compi_gethostbyaddr="no"
  1205. ])
  1206. fi
  1207. #
  1208. if test "$tst_compi_gethostbyaddr" = "yes"; then
  1209. AC_MSG_CHECKING([if gethostbyaddr usage allowed])
  1210. if test "x$cares_disallow_gethostbyaddr" != "xyes"; then
  1211. AC_MSG_RESULT([yes])
  1212. tst_allow_gethostbyaddr="yes"
  1213. else
  1214. AC_MSG_RESULT([no])
  1215. tst_allow_gethostbyaddr="no"
  1216. fi
  1217. fi
  1218. #
  1219. AC_MSG_CHECKING([if gethostbyaddr might be used])
  1220. if test "$tst_links_gethostbyaddr" = "yes" &&
  1221. test "$tst_proto_gethostbyaddr" = "yes" &&
  1222. test "$tst_compi_gethostbyaddr" = "yes" &&
  1223. test "$tst_allow_gethostbyaddr" = "yes"; then
  1224. AC_MSG_RESULT([yes])
  1225. AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYADDR, 1,
  1226. [Define to 1 if you have the gethostbyaddr function.])
  1227. ac_cv_func_gethostbyaddr="yes"
  1228. else
  1229. AC_MSG_RESULT([no])
  1230. ac_cv_func_gethostbyaddr="no"
  1231. fi
  1232. ])
  1233. dnl CARES_CHECK_FUNC_GETHOSTBYNAME
  1234. dnl -------------------------------------------------
  1235. dnl Verify if gethostbyname is available, prototyped,
  1236. dnl and can be compiled. If all of these are true,
  1237. dnl and usage has not been previously disallowed with
  1238. dnl shell variable cares_disallow_gethostbyname, then
  1239. dnl HAVE_GETHOSTBYNAME will be defined.
  1240. AC_DEFUN([CARES_CHECK_FUNC_GETHOSTBYNAME], [
  1241. AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl
  1242. AC_REQUIRE([CARES_INCLUDES_NETDB])dnl
  1243. #
  1244. tst_links_gethostbyname="unknown"
  1245. tst_proto_gethostbyname="unknown"
  1246. tst_compi_gethostbyname="unknown"
  1247. tst_allow_gethostbyname="unknown"
  1248. #
  1249. AC_MSG_CHECKING([if gethostbyname can be linked])
  1250. AC_LINK_IFELSE([
  1251. AC_LANG_PROGRAM([[
  1252. $cares_includes_winsock2
  1253. $cares_includes_netdb
  1254. ]],[[
  1255. if(0 != gethostbyname(0))
  1256. return 1;
  1257. ]])
  1258. ],[
  1259. AC_MSG_RESULT([yes])
  1260. tst_links_gethostbyname="yes"
  1261. ],[
  1262. AC_MSG_RESULT([no])
  1263. tst_links_gethostbyname="no"
  1264. ])
  1265. #
  1266. if test "$tst_links_gethostbyname" = "yes"; then
  1267. AC_MSG_CHECKING([if gethostbyname is prototyped])
  1268. AC_EGREP_CPP([gethostbyname],[
  1269. $cares_includes_winsock2
  1270. $cares_includes_netdb
  1271. ],[
  1272. AC_MSG_RESULT([yes])
  1273. tst_proto_gethostbyname="yes"
  1274. ],[
  1275. AC_MSG_RESULT([no])
  1276. tst_proto_gethostbyname="no"
  1277. ])
  1278. fi
  1279. #
  1280. if test "$tst_proto_gethostbyname" = "yes"; then
  1281. AC_MSG_CHECKING([if gethostbyname is compilable])
  1282. AC_COMPILE_IFELSE([
  1283. AC_LANG_PROGRAM([[
  1284. $cares_includes_winsock2
  1285. $cares_includes_netdb
  1286. ]],[[
  1287. if(0 != gethostbyname(0))
  1288. return 1;
  1289. ]])
  1290. ],[
  1291. AC_MSG_RESULT([yes])
  1292. tst_compi_gethostbyname="yes"
  1293. ],[
  1294. AC_MSG_RESULT([no])
  1295. tst_compi_gethostbyname="no"
  1296. ])
  1297. fi
  1298. #
  1299. if test "$tst_compi_gethostbyname" = "yes"; then
  1300. AC_MSG_CHECKING([if gethostbyname usage allowed])
  1301. if test "x$cares_disallow_gethostbyname" != "xyes"; then
  1302. AC_MSG_RESULT([yes])
  1303. tst_allow_gethostbyname="yes"
  1304. else
  1305. AC_MSG_RESULT([no])
  1306. tst_allow_gethostbyname="no"
  1307. fi
  1308. fi
  1309. #
  1310. AC_MSG_CHECKING([if gethostbyname might be used])
  1311. if test "$tst_links_gethostbyname" = "yes" &&
  1312. test "$tst_proto_gethostbyname" = "yes" &&
  1313. test "$tst_compi_gethostbyname" = "yes" &&
  1314. test "$tst_allow_gethostbyname" = "yes"; then
  1315. AC_MSG_RESULT([yes])
  1316. AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME, 1,
  1317. [Define to 1 if you have the gethostbyname function.])
  1318. ac_cv_func_gethostbyname="yes"
  1319. else
  1320. AC_MSG_RESULT([no])
  1321. ac_cv_func_gethostbyname="no"
  1322. fi
  1323. ])
  1324. dnl CARES_CHECK_FUNC_GETHOSTNAME
  1325. dnl -------------------------------------------------
  1326. dnl Verify if gethostname is available, prototyped, and
  1327. dnl can be compiled. If all of these are true, and
  1328. dnl usage has not been previously disallowed with
  1329. dnl shell variable cares_disallow_gethostname, then
  1330. dnl HAVE_GETHOSTNAME will be defined.
  1331. AC_DEFUN([CARES_CHECK_FUNC_GETHOSTNAME], [
  1332. AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl
  1333. AC_REQUIRE([CARES_INCLUDES_UNISTD])dnl
  1334. AC_REQUIRE([CARES_PREPROCESS_CALLCONV])dnl
  1335. #
  1336. tst_links_gethostname="unknown"
  1337. tst_proto_gethostname="unknown"
  1338. tst_compi_gethostname="unknown"
  1339. tst_allow_gethostname="unknown"
  1340. #
  1341. AC_MSG_CHECKING([if gethostname can be linked])
  1342. AC_LINK_IFELSE([
  1343. AC_LANG_PROGRAM([[
  1344. $cares_includes_winsock2
  1345. $cares_includes_unistd
  1346. ]],[[
  1347. if(0 != gethostname(0, 0))
  1348. return 1;
  1349. ]])
  1350. ],[
  1351. AC_MSG_RESULT([yes])
  1352. tst_links_gethostname="yes"
  1353. ],[
  1354. AC_MSG_RESULT([no])
  1355. tst_links_gethostname="no"
  1356. ])
  1357. #
  1358. if test "$tst_links_gethostname" = "yes"; then
  1359. AC_MSG_CHECKING([if gethostname is prototyped])
  1360. AC_EGREP_CPP([gethostname],[
  1361. $cares_includes_winsock2
  1362. $cares_includes_unistd
  1363. ],[
  1364. AC_MSG_RESULT([yes])
  1365. tst_proto_gethostname="yes"
  1366. ],[
  1367. AC_MSG_RESULT([no])
  1368. tst_proto_gethostname="no"
  1369. ])
  1370. fi
  1371. #
  1372. if test "$tst_proto_gethostname" = "yes"; then
  1373. AC_MSG_CHECKING([if gethostname is compilable])
  1374. AC_COMPILE_IFELSE([
  1375. AC_LANG_PROGRAM([[
  1376. $cares_includes_winsock2
  1377. $cares_includes_unistd
  1378. ]],[[
  1379. if(0 != gethostname(0, 0))
  1380. return 1;
  1381. ]])
  1382. ],[
  1383. AC_MSG_RESULT([yes])
  1384. tst_compi_gethostname="yes"
  1385. ],[
  1386. AC_MSG_RESULT([no])
  1387. tst_compi_gethostname="no"
  1388. ])
  1389. fi
  1390. #
  1391. if test "$tst_compi_gethostname" = "yes"; then
  1392. AC_MSG_CHECKING([for gethostname arg 2 data type])
  1393. tst_gethostname_type_arg2="unknown"
  1394. for tst_arg1 in 'char *' 'unsigned char *' 'void *'; do
  1395. for tst_arg2 in 'int' 'unsigned int' 'size_t'; do
  1396. if test "$tst_gethostname_type_arg2" = "unknown"; then
  1397. AC_COMPILE_IFELSE([
  1398. AC_LANG_PROGRAM([[
  1399. $cares_includes_winsock2
  1400. $cares_includes_unistd
  1401. $cares_preprocess_callconv
  1402. extern int FUNCALLCONV gethostname($tst_arg1, $tst_arg2);
  1403. ]],[[
  1404. if(0 != gethostname(0, 0))
  1405. return 1;
  1406. ]])
  1407. ],[
  1408. tst_gethostname_type_arg2="$tst_arg2"
  1409. ])
  1410. fi
  1411. done
  1412. done
  1413. AC_MSG_RESULT([$tst_gethostname_type_arg2])
  1414. if test "$tst_gethostname_type_arg2" != "unknown"; then
  1415. AC_DEFINE_UNQUOTED(GETHOSTNAME_TYPE_ARG2, $tst_gethostname_type_arg2,
  1416. [Define to the type of arg 2 for gethostname.])
  1417. fi
  1418. fi
  1419. #
  1420. if test "$tst_compi_gethostname" = "yes"; then
  1421. AC_MSG_CHECKING([if gethostname usage allowed])
  1422. if test "x$cares_disallow_gethostname" != "xyes"; then
  1423. AC_MSG_RESULT([yes])
  1424. tst_allow_gethostname="yes"
  1425. else
  1426. AC_MSG_RESULT([no])
  1427. tst_allow_gethostname="no"
  1428. fi
  1429. fi
  1430. #
  1431. AC_MSG_CHECKING([if gethostname might be used])
  1432. if test "$tst_links_gethostname" = "yes" &&
  1433. test "$tst_proto_gethostname" = "yes" &&
  1434. test "$tst_compi_gethostname" = "yes" &&
  1435. test "$tst_allow_gethostname" = "yes"; then
  1436. AC_MSG_RESULT([yes])
  1437. AC_DEFINE_UNQUOTED(HAVE_GETHOSTNAME, 1,
  1438. [Define to 1 if you have the gethostname function.])
  1439. ac_cv_func_gethostname="yes"
  1440. else
  1441. AC_MSG_RESULT([no])
  1442. ac_cv_func_gethostname="no"
  1443. fi
  1444. ])
  1445. dnl CARES_CHECK_FUNC_GETSERVBYPORT_R
  1446. dnl -------------------------------------------------
  1447. dnl Verify if getservbyport_r is available, prototyped,
  1448. dnl and can be compiled. If all of these are true, and
  1449. dnl usage has not been previously disallowed with
  1450. dnl shell variable cares_disallow_getservbyport_r, then
  1451. dnl HAVE_GETSERVBYPORT_R will be defined.
  1452. AC_DEFUN([CARES_CHECK_FUNC_GETSERVBYPORT_R], [
  1453. AC_REQUIRE([CARES_INCLUDES_NETDB])dnl
  1454. #
  1455. tst_links_getservbyport_r="unknown"
  1456. tst_proto_getservbyport_r="unknown"
  1457. tst_compi_getservbyport_r="unknown"
  1458. tst_allow_getservbyport_r="unknown"
  1459. tst_nargs_getservbyport_r="unknown"
  1460. #
  1461. AC_MSG_CHECKING([if getservbyport_r can be linked])
  1462. AC_LINK_IFELSE([
  1463. AC_LANG_FUNC_LINK_TRY([getservbyport_r])
  1464. ],[
  1465. AC_MSG_RESULT([yes])
  1466. tst_links_getservbyport_r="yes"
  1467. ],[
  1468. AC_MSG_RESULT([no])
  1469. tst_links_getservbyport_r="no"
  1470. ])
  1471. #
  1472. if test "$tst_links_getservbyport_r" = "yes"; then
  1473. AC_MSG_CHECKING([if getservbyport_r is prototyped])
  1474. AC_EGREP_CPP([getservbyport_r],[
  1475. $cares_includes_netdb
  1476. ],[
  1477. AC_MSG_RESULT([yes])
  1478. tst_proto_getservbyport_r="yes"
  1479. ],[
  1480. AC_MSG_RESULT([no])
  1481. tst_proto_getservbyport_r="no"
  1482. ])
  1483. fi
  1484. #
  1485. if test "$tst_proto_getservbyport_r" = "yes"; then
  1486. if test "$tst_nargs_getservbyport_r" = "unknown"; then
  1487. AC_MSG_CHECKING([if getservbyport_r takes 4 args.])
  1488. AC_COMPILE_IFELSE([
  1489. AC_LANG_PROGRAM([[
  1490. $cares_includes_netdb
  1491. ]],[[
  1492. if(0 != getservbyport_r(0, 0, 0, 0))
  1493. return 1;
  1494. ]])
  1495. ],[
  1496. AC_MSG_RESULT([yes])
  1497. tst_compi_getservbyport_r="yes"
  1498. tst_nargs_getservbyport_r="4"
  1499. ],[
  1500. AC_MSG_RESULT([no])
  1501. tst_compi_getservbyport_r="no"
  1502. ])
  1503. fi
  1504. if test "$tst_nargs_getservbyport_r" = "unknown"; then
  1505. AC_MSG_CHECKING([if getservbyport_r takes 5 args.])
  1506. AC_COMPILE_IFELSE([
  1507. AC_LANG_PROGRAM([[
  1508. $cares_includes_netdb
  1509. ]],[[
  1510. if(0 != getservbyport_r(0, 0, 0, 0, 0))
  1511. return 1;
  1512. ]])
  1513. ],[
  1514. AC_MSG_RESULT([yes])
  1515. tst_compi_getservbyport_r="yes"
  1516. tst_nargs_getservbyport_r="5"
  1517. ],[
  1518. AC_MSG_RESULT([no])
  1519. tst_compi_getservbyport_r="no"
  1520. ])
  1521. fi
  1522. if test "$tst_nargs_getservbyport_r" = "unknown"; then
  1523. AC_MSG_CHECKING([if getservbyport_r takes 6 args.])
  1524. AC_COMPILE_IFELSE([
  1525. AC_LANG_PROGRAM([[
  1526. $cares_includes_netdb
  1527. ]],[[
  1528. if(0 != getservbyport_r(0, 0, 0, 0, 0, 0))
  1529. return 1;
  1530. ]])
  1531. ],[
  1532. AC_MSG_RESULT([yes])
  1533. tst_compi_getservbyport_r="yes"
  1534. tst_nargs_getservbyport_r="6"
  1535. ],[
  1536. AC_MSG_RESULT([no])
  1537. tst_compi_getservbyport_r="no"
  1538. ])
  1539. fi
  1540. AC_MSG_CHECKING([if getservbyport_r is compilable])
  1541. if test "$tst_compi_getservbyport_r" = "yes"; then
  1542. AC_MSG_RESULT([yes])
  1543. else
  1544. AC_MSG_RESULT([no])
  1545. fi
  1546. fi
  1547. #
  1548. if test "$tst_compi_getservbyport_r" = "yes"; then
  1549. AC_MSG_CHECKING([if getservbyport_r usage allowed])
  1550. if test "x$cares_disallow_getservbyport_r" != "xyes"; then
  1551. AC_MSG_RESULT([yes])
  1552. tst_allow_getservbyport_r="yes"
  1553. else
  1554. AC_MSG_RESULT([no])
  1555. tst_allow_getservbyport_r="no"
  1556. fi
  1557. fi
  1558. #
  1559. AC_MSG_CHECKING([if getservbyport_r might be used])
  1560. if test "$tst_links_getservbyport_r" = "yes" &&
  1561. test "$tst_proto_getservbyport_r" = "yes" &&
  1562. test "$tst_compi_getservbyport_r" = "yes" &&
  1563. test "$tst_allow_getservbyport_r" = "yes"; then
  1564. AC_MSG_RESULT([yes])
  1565. AC_DEFINE_UNQUOTED(HAVE_GETSERVBYPORT_R, 1,
  1566. [Define to 1 if you have the getservbyport_r function.])
  1567. AC_DEFINE_UNQUOTED(GETSERVBYPORT_R_ARGS, $tst_nargs_getservbyport_r,
  1568. [Specifies the number of arguments to getservbyport_r])
  1569. if test "$tst_nargs_getservbyport_r" -eq "4"; then
  1570. AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, sizeof(struct servent_data),
  1571. [Specifies the size of the buffer to pass to getservbyport_r])
  1572. else
  1573. AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, 4096,
  1574. [Specifies the size of the buffer to pass to getservbyport_r])
  1575. fi
  1576. ac_cv_func_getservbyport_r="yes"
  1577. else
  1578. AC_MSG_RESULT([no])
  1579. ac_cv_func_getservbyport_r="no"
  1580. fi
  1581. ])
  1582. dnl CARES_CHECK_FUNC_GETSERVBYNAME_R
  1583. dnl -------------------------------------------------
  1584. dnl Verify if getservbyname_r is available, prototyped,
  1585. dnl and can be compiled. If all of these are true, and
  1586. dnl usage has not been previously disallowed with
  1587. dnl shell variable cares_disallow_getservbyname_r, then
  1588. dnl HAVE_GETSERVBYNAME_R will be defined.
  1589. AC_DEFUN([CARES_CHECK_FUNC_GETSERVBYNAME_R], [
  1590. AC_REQUIRE([CARES_INCLUDES_NETDB])dnl
  1591. #
  1592. tst_links_getservbyname_r="unknown"
  1593. tst_proto_getservbyname_r="unknown"
  1594. tst_compi_getservbyname_r="unknown"
  1595. tst_allow_getservbyname_r="unknown"
  1596. tst_nargs_getservbyname_r="unknown"
  1597. #
  1598. AC_MSG_CHECKING([if getservbyname_r can be linked])
  1599. AC_LINK_IFELSE([
  1600. AC_LANG_FUNC_LINK_TRY([getservbyname_r])
  1601. ],[
  1602. AC_MSG_RESULT([yes])
  1603. tst_links_getservbyname_r="yes"
  1604. ],[
  1605. AC_MSG_RESULT([no])
  1606. tst_links_getservbyname_r="no"
  1607. ])
  1608. #
  1609. if test "$tst_links_getservbyname_r" = "yes"; then
  1610. AC_MSG_CHECKING([if getservbyname_r is prototyped])
  1611. AC_EGREP_CPP([getservbyname_r],[
  1612. $cares_includes_netdb
  1613. ],[
  1614. AC_MSG_RESULT([yes])
  1615. tst_proto_getservbyname_r="yes"
  1616. ],[
  1617. AC_MSG_RESULT([no])
  1618. tst_proto_getservbyname_r="no"
  1619. ])
  1620. fi
  1621. #
  1622. if test "$tst_proto_getservbyname_r" = "yes"; then
  1623. if test "$tst_nargs_getservbyname_r" = "unknown"; then
  1624. AC_MSG_CHECKING([if getservbyname_r takes 4 args.])
  1625. AC_COMPILE_IFELSE([
  1626. AC_LANG_PROGRAM([[
  1627. $cares_includes_netdb
  1628. ]],[[
  1629. if(0 != getservbyname_r(0, 0, 0, 0))
  1630. return 1;
  1631. ]])
  1632. ],[
  1633. AC_MSG_RESULT([yes])
  1634. tst_compi_getservbyname_r="yes"
  1635. tst_nargs_getservbyname_r="4"
  1636. ],[
  1637. AC_MSG_RESULT([no])
  1638. tst_compi_getservbyname_r="no"
  1639. ])
  1640. fi
  1641. if test "$tst_nargs_getservbyname_r" = "unknown"; then
  1642. AC_MSG_CHECKING([if getservbyname_r takes 5 args.])
  1643. AC_COMPILE_IFELSE([
  1644. AC_LANG_PROGRAM([[
  1645. $cares_includes_netdb
  1646. ]],[[
  1647. if(0 != getservbyname_r(0, 0, 0, 0, 0))
  1648. return 1;
  1649. ]])
  1650. ],[
  1651. AC_MSG_RESULT([yes])
  1652. tst_compi_getservbyname_r="yes"
  1653. tst_nargs_getservbyname_r="5"
  1654. ],[
  1655. AC_MSG_RESULT([no])
  1656. tst_compi_getservbyname_r="no"
  1657. ])
  1658. fi
  1659. if test "$tst_nargs_getservbyname_r" = "unknown"; then
  1660. AC_MSG_CHECKING([if getservbyname_r takes 6 args.])
  1661. AC_COMPILE_IFELSE([
  1662. AC_LANG_PROGRAM([[
  1663. $cares_includes_netdb
  1664. ]],[[
  1665. if(0 != getservbyname_r(0, 0, 0, 0, 0, 0))
  1666. return 1;
  1667. ]])
  1668. ],[
  1669. AC_MSG_RESULT([yes])
  1670. tst_compi_getservbyname_r="yes"
  1671. tst_nargs_getservbyname_r="6"
  1672. ],[
  1673. AC_MSG_RESULT([no])
  1674. tst_compi_getservbyname_r="no"
  1675. ])
  1676. fi
  1677. AC_MSG_CHECKING([if getservbyname_r is compilable])
  1678. if test "$tst_compi_getservbyname_r" = "yes"; then
  1679. AC_MSG_RESULT([yes])
  1680. else
  1681. AC_MSG_RESULT([no])
  1682. fi
  1683. fi
  1684. #
  1685. if test "$tst_compi_getservbyname_r" = "yes"; then
  1686. AC_MSG_CHECKING([if getservbyname_r usage allowed])
  1687. if test "x$cares_disallow_getservbyname_r" != "xyes"; then
  1688. AC_MSG_RESULT([yes])
  1689. tst_allow_getservbyname_r="yes"
  1690. else
  1691. AC_MSG_RESULT([no])
  1692. tst_allow_getservbyname_r="no"
  1693. fi
  1694. fi
  1695. #
  1696. AC_MSG_CHECKING([if getservbyname_r might be used])
  1697. if test "$tst_links_getservbyname_r" = "yes" &&
  1698. test "$tst_proto_getservbyname_r" = "yes" &&
  1699. test "$tst_compi_getservbyname_r" = "yes" &&
  1700. test "$tst_allow_getservbyname_r" = "yes"; then
  1701. AC_MSG_RESULT([yes])
  1702. AC_DEFINE_UNQUOTED(HAVE_GETSERVBYNAME_R, 1,
  1703. [Define to 1 if you have the getservbyname_r function.])
  1704. AC_DEFINE_UNQUOTED(GETSERVBYNAME_R_ARGS, $tst_nargs_getservbyname_r,
  1705. [Specifies the number of arguments to getservbyname_r])
  1706. if test "$tst_nargs_getservbyname_r" -eq "4"; then
  1707. AC_DEFINE(GETSERVBYNAME_R_BUFSIZE, sizeof(struct servent_data),
  1708. [Specifies the size of the buffer to pass to getservbyname_r])
  1709. else
  1710. AC_DEFINE(GETSERVBYNAME_R_BUFSIZE, 4096,
  1711. [Specifies the size of the buffer to pass to getservbyname_r])
  1712. fi
  1713. ac_cv_func_getservbyname_r="yes"
  1714. else
  1715. AC_MSG_RESULT([no])
  1716. ac_cv_func_getservbyname_r="no"
  1717. fi
  1718. ])
  1719. dnl CARES_CHECK_FUNC_INET_NET_PTON
  1720. dnl -------------------------------------------------
  1721. dnl Verify if inet_net_pton is available, prototyped, can
  1722. dnl be compiled and seems to work. If all of these are
  1723. dnl true, and usage has not been previously disallowed
  1724. dnl with shell variable cares_disallow_inet_net_pton, then
  1725. dnl HAVE_INET_NET_PTON will be defined.
  1726. AC_DEFUN([CARES_CHECK_FUNC_INET_NET_PTON], [
  1727. AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl
  1728. AC_REQUIRE([CARES_INCLUDES_ARPA_INET])dnl
  1729. AC_REQUIRE([CARES_INCLUDES_STRING])dnl
  1730. #
  1731. tst_links_inet_net_pton="unknown"
  1732. tst_proto_inet_net_pton="unknown"
  1733. tst_compi_inet_net_pton="unknown"
  1734. tst_works_inet_net_pton="unknown"
  1735. tst_allow_inet_net_pton="unknown"
  1736. #
  1737. AC_MSG_CHECKING([if inet_net_pton can be linked])
  1738. AC_LINK_IFELSE([
  1739. AC_LANG_FUNC_LINK_TRY([inet_net_pton])
  1740. ],[
  1741. AC_MSG_RESULT([yes])
  1742. tst_links_inet_net_pton="yes"
  1743. ],[
  1744. AC_MSG_RESULT([no])
  1745. tst_links_inet_net_pton="no"
  1746. ])
  1747. #
  1748. if test "$tst_links_inet_net_pton" = "yes"; then
  1749. AC_MSG_CHECKING([if inet_net_pton is prototyped])
  1750. AC_EGREP_CPP([inet_net_pton],[
  1751. $cares_includes_arpa_inet
  1752. ],[
  1753. AC_MSG_RESULT([yes])
  1754. tst_proto_inet_net_pton="yes"
  1755. ],[
  1756. AC_MSG_RESULT([no])
  1757. tst_proto_inet_net_pton="no"
  1758. ])
  1759. fi
  1760. #
  1761. if test "$tst_proto_inet_net_pton" = "yes"; then
  1762. AC_MSG_CHECKING([if inet_net_pton is compilable])
  1763. AC_COMPILE_IFELSE([
  1764. AC_LANG_PROGRAM([[
  1765. $cares_includes_arpa_inet
  1766. ]],[[
  1767. if(0 != inet_net_pton(0, 0, 0, 0))
  1768. return 1;
  1769. ]])
  1770. ],[
  1771. AC_MSG_RESULT([yes])
  1772. tst_compi_inet_net_pton="yes"
  1773. ],[
  1774. AC_MSG_RESULT([no])
  1775. tst_compi_inet_net_pton="no"
  1776. ])
  1777. fi
  1778. #
  1779. dnl only do runtime verification when not cross-compiling
  1780. if test "x$cross_compiling" != "xyes" &&
  1781. test "$tst_compi_inet_net_pton" = "yes"; then
  1782. AC_MSG_CHECKING([if inet_net_pton seems to work])
  1783. AC_RUN_IFELSE([
  1784. AC_LANG_PROGRAM([[
  1785. $cares_includes_stdlib
  1786. $cares_includes_arpa_inet
  1787. $cares_includes_string
  1788. ]],[[
  1789. unsigned char ipv6a[16+1];
  1790. unsigned char ipv4a[4+1];
  1791. const char *ipv6net1 = "fe80::214:4fff:fe0b:76c8";
  1792. const char *ipv6net2 = "::fffe:7f00:1";
  1793. const char *ipv6net3 = "7f20:1::/64";
  1794. const char *ipv6net4 = "7f20:1::/2147483649";
  1795. const char *ipv4net1 = "192.168.100.1";
  1796. const char *ipv4net2 = "192.168.100/32";
  1797. const char *ipv4net3 = "192.168.100.1/2147483649";
  1798. /* - */
  1799. memset(ipv4a, 1, sizeof(ipv4a));
  1800. if(32 != inet_net_pton(AF_INET, ipv4net1, ipv4a, 4))
  1801. exit(1); /* fail */
  1802. /* - */
  1803. if( (ipv4a[0x00] != 0xc0) ||
  1804. (ipv4a[0x01] != 0xa8) ||
  1805. (ipv4a[0x02] != 0x64) ||
  1806. (ipv4a[0x03] != 0x01) ||
  1807. (ipv4a[0x04] != 0x01) )
  1808. exit(1); /* fail */
  1809. /* - */
  1810. memset(ipv4a, 1, sizeof(ipv4a));
  1811. if(32 != inet_net_pton(AF_INET, ipv4net2, ipv4a, 4))
  1812. exit(1); /* fail */
  1813. /* - */
  1814. if( (ipv4a[0x00] != 0xc0) ||
  1815. (ipv4a[0x01] != 0xa8) ||
  1816. (ipv4a[0x02] != 0x64) ||
  1817. (ipv4a[0x03] != 0x00) ||
  1818. (ipv4a[0x04] != 0x01) )
  1819. exit(1); /* fail */
  1820. /* - */
  1821. memset(ipv4a, 1, sizeof(ipv4a));
  1822. if(-1 != inet_net_pton(AF_INET, ipv4net3, ipv4a, 4))
  1823. exit(1); /* fail */
  1824. /* - */
  1825. memset(ipv6a, 1, sizeof(ipv6a));
  1826. if(128 != inet_net_pton(AF_INET6, ipv6net1, ipv6a, 16))
  1827. exit(1); /* fail */
  1828. /* - */
  1829. if( (ipv6a[0x00] != 0xfe) ||
  1830. (ipv6a[0x01] != 0x80) ||
  1831. (ipv6a[0x08] != 0x02) ||
  1832. (ipv6a[0x09] != 0x14) ||
  1833. (ipv6a[0x0a] != 0x4f) ||
  1834. (ipv6a[0x0b] != 0xff) ||
  1835. (ipv6a[0x0c] != 0xfe) ||
  1836. (ipv6a[0x0d] != 0x0b) ||
  1837. (ipv6a[0x0e] != 0x76) ||
  1838. (ipv6a[0x0f] != 0xc8) ||
  1839. (ipv6a[0x10] != 0x01) )
  1840. exit(1); /* fail */
  1841. /* - */
  1842. if( (ipv6a[0x02] != 0x0) ||
  1843. (ipv6a[0x03] != 0x0) ||
  1844. (ipv6a[0x04] != 0x0) ||
  1845. (ipv6a[0x05] != 0x0) ||
  1846. (ipv6a[0x06] != 0x0) ||
  1847. (ipv6a[0x07] != 0x0) )
  1848. exit(1); /* fail */
  1849. /* - */
  1850. memset(ipv6a, 0, sizeof(ipv6a));
  1851. ipv6a[0x10] = 0x01;
  1852. if(128 != inet_net_pton(AF_INET6, ipv6net2, ipv6a, 16))
  1853. exit(1); /* fail */
  1854. /* - */
  1855. if( (ipv6a[0x0a] != 0xff) ||
  1856. (ipv6a[0x0b] != 0xfe) ||
  1857. (ipv6a[0x0c] != 0x7f) ||
  1858. (ipv6a[0x0f] != 0x01) ||
  1859. (ipv6a[0x10] != 0x01) )
  1860. exit(1); /* fail */
  1861. /* - */
  1862. if( (ipv6a[0x00] != 0x0) ||
  1863. (ipv6a[0x01] != 0x0) ||
  1864. (ipv6a[0x02] != 0x0) ||
  1865. (ipv6a[0x03] != 0x0) ||
  1866. (ipv6a[0x04] != 0x0) ||
  1867. (ipv6a[0x05] != 0x0) ||
  1868. (ipv6a[0x06] != 0x0) ||
  1869. (ipv6a[0x07] != 0x0) ||
  1870. (ipv6a[0x08] != 0x0) ||
  1871. (ipv6a[0x09] != 0x0) ||
  1872. (ipv6a[0x0d] != 0x0) ||
  1873. (ipv6a[0x0e] != 0x0) )
  1874. exit(1); /* fail */
  1875. /* - */
  1876. memset(ipv6a, 1, sizeof(ipv6a));
  1877. if(64 != inet_net_pton(AF_INET6, ipv6net3, ipv6a, 16))
  1878. exit(1); /* fail */
  1879. if( (ipv6a[0x00] != 0x7f) ||
  1880. (ipv6a[0x01] != 0x20) ||
  1881. (ipv6a[0x03] != 0x01) ||
  1882. (ipv6a[0x08] != 0x01) ||
  1883. (ipv6a[0x09] != 0x01) ||
  1884. (ipv6a[0x0a] != 0x01) ||
  1885. (ipv6a[0x0b] != 0x01) ||
  1886. (ipv6a[0x0c] != 0x01) ||
  1887. (ipv6a[0x0d] != 0x01) ||
  1888. (ipv6a[0x0e] != 0x01) ||
  1889. (ipv6a[0x0f] != 0x01) ||
  1890. (ipv6a[0x10] != 0x01) )
  1891. exit(1); /* fail */
  1892. if( (ipv6a[0x02] != 0x0) ||
  1893. (ipv6a[0x04] != 0x0) ||
  1894. (ipv6a[0x05] != 0x0) ||
  1895. (ipv6a[0x06] != 0x0) ||
  1896. (ipv6a[0x07] != 0x0) ||
  1897. (ipv6a[0x07] != 0x0) )
  1898. exit(1); /* fail */
  1899. /* - */
  1900. memset(ipv6a, 1, sizeof(ipv6a));
  1901. if(-1 != inet_net_pton(AF_INET6, ipv6net4, ipv6a, 16))
  1902. exit(1); /* fail */
  1903. /* - */
  1904. exit(0);
  1905. ]])
  1906. ],[
  1907. AC_MSG_RESULT([yes])
  1908. tst_works_inet_net_pton="yes"
  1909. ],[
  1910. AC_MSG_RESULT([no])
  1911. tst_works_inet_net_pton="no"
  1912. ])
  1913. fi
  1914. #
  1915. if test "$tst_compi_inet_net_pton" = "yes" &&
  1916. test "$tst_works_inet_net_pton" != "no"; then
  1917. AC_MSG_CHECKING([if inet_net_pton usage allowed])
  1918. if test "x$cares_disallow_inet_net_pton" != "xyes"; then
  1919. AC_MSG_RESULT([yes])
  1920. tst_allow_inet_net_pton="yes"
  1921. else
  1922. AC_MSG_RESULT([no])
  1923. tst_allow_inet_net_pton="no"
  1924. fi
  1925. fi
  1926. #
  1927. AC_MSG_CHECKING([if inet_net_pton might be used])
  1928. if test "$tst_links_inet_net_pton" = "yes" &&
  1929. test "$tst_proto_inet_net_pton" = "yes" &&
  1930. test "$tst_compi_inet_net_pton" = "yes" &&
  1931. test "$tst_allow_inet_net_pton" = "yes" &&
  1932. test "$tst_works_inet_net_pton" != "no"; then
  1933. AC_MSG_RESULT([yes])
  1934. AC_DEFINE_UNQUOTED(HAVE_INET_NET_PTON, 1,
  1935. [Define to 1 if you have a IPv6 capable working inet_net_pton function.])
  1936. ac_cv_func_inet_net_pton="yes"
  1937. else
  1938. AC_MSG_RESULT([no])
  1939. ac_cv_func_inet_net_pton="no"
  1940. fi
  1941. ])
  1942. dnl CARES_CHECK_FUNC_INET_NTOP
  1943. dnl -------------------------------------------------
  1944. dnl Verify if inet_ntop is available, prototyped, can
  1945. dnl be compiled and seems to work. If all of these are
  1946. dnl true, and usage has not been previously disallowed
  1947. dnl with shell variable cares_disallow_inet_ntop, then
  1948. dnl HAVE_INET_NTOP will be defined.
  1949. AC_DEFUN([CARES_CHECK_FUNC_INET_NTOP], [
  1950. AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl
  1951. AC_REQUIRE([CARES_INCLUDES_ARPA_INET])dnl
  1952. AC_REQUIRE([CARES_INCLUDES_STRING])dnl
  1953. #
  1954. tst_links_inet_ntop="unknown"
  1955. tst_proto_inet_ntop="unknown"
  1956. tst_compi_inet_ntop="unknown"
  1957. tst_works_inet_ntop="unknown"
  1958. tst_allow_inet_ntop="unknown"
  1959. #
  1960. AC_MSG_CHECKING([if inet_ntop can be linked])
  1961. AC_LINK_IFELSE([
  1962. AC_LANG_FUNC_LINK_TRY([inet_ntop])
  1963. ],[
  1964. AC_MSG_RESULT([yes])
  1965. tst_links_inet_ntop="yes"
  1966. ],[
  1967. AC_MSG_RESULT([no])
  1968. tst_links_inet_ntop="no"
  1969. ])
  1970. #
  1971. if test "$tst_links_inet_ntop" = "yes"; then
  1972. AC_MSG_CHECKING([if inet_ntop is prototyped])
  1973. AC_EGREP_CPP([inet_ntop],[
  1974. $cares_includes_arpa_inet
  1975. ],[
  1976. AC_MSG_RESULT([yes])
  1977. tst_proto_inet_ntop="yes"
  1978. ],[
  1979. AC_MSG_RESULT([no])
  1980. tst_proto_inet_ntop="no"
  1981. ])
  1982. fi
  1983. #
  1984. if test "$tst_proto_inet_ntop" = "yes"; then
  1985. AC_MSG_CHECKING([if inet_ntop is compilable])
  1986. AC_COMPILE_IFELSE([
  1987. AC_LANG_PROGRAM([[
  1988. $cares_includes_arpa_inet
  1989. ]],[[
  1990. if(0 != inet_ntop(0, 0, 0, 0))
  1991. return 1;
  1992. ]])
  1993. ],[
  1994. AC_MSG_RESULT([yes])
  1995. tst_compi_inet_ntop="yes"
  1996. ],[
  1997. AC_MSG_RESULT([no])
  1998. tst_compi_inet_ntop="no"
  1999. ])
  2000. fi
  2001. #
  2002. dnl only do runtime verification when not cross-compiling
  2003. if test "x$cross_compiling" != "xyes" &&
  2004. test "$tst_compi_inet_ntop" = "yes"; then
  2005. AC_MSG_CHECKING([if inet_ntop seems to work])
  2006. AC_RUN_IFELSE([
  2007. AC_LANG_PROGRAM([[
  2008. $cares_includes_stdlib
  2009. $cares_includes_arpa_inet
  2010. $cares_includes_string
  2011. ]],[[
  2012. char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
  2013. char ipv4res[sizeof "255.255.255.255"];
  2014. unsigned char ipv6a[26];
  2015. unsigned char ipv4a[5];
  2016. char *ipv6ptr = 0;
  2017. char *ipv4ptr = 0;
  2018. /* - */
  2019. ipv4res[0] = '\0';
  2020. ipv4a[0] = 0xc0;
  2021. ipv4a[1] = 0xa8;
  2022. ipv4a[2] = 0x64;
  2023. ipv4a[3] = 0x01;
  2024. ipv4a[4] = 0x01;
  2025. /* - */
  2026. ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res));
  2027. if(!ipv4ptr)
  2028. exit(1); /* fail */
  2029. if(ipv4ptr != ipv4res)
  2030. exit(1); /* fail */
  2031. if(!ipv4ptr[0])
  2032. exit(1); /* fail */
  2033. if(memcmp(ipv4res, "192.168.100.1", 13) != 0)
  2034. exit(1); /* fail */
  2035. /* - */
  2036. ipv6res[0] = '\0';
  2037. memset(ipv6a, 0, sizeof(ipv6a));
  2038. ipv6a[0] = 0xfe;
  2039. ipv6a[1] = 0x80;
  2040. ipv6a[8] = 0x02;
  2041. ipv6a[9] = 0x14;
  2042. ipv6a[10] = 0x4f;
  2043. ipv6a[11] = 0xff;
  2044. ipv6a[12] = 0xfe;
  2045. ipv6a[13] = 0x0b;
  2046. ipv6a[14] = 0x76;
  2047. ipv6a[15] = 0xc8;
  2048. ipv6a[25] = 0x01;
  2049. /* - */
  2050. ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res));
  2051. if(!ipv6ptr)
  2052. exit(1); /* fail */
  2053. if(ipv6ptr != ipv6res)
  2054. exit(1); /* fail */
  2055. if(!ipv6ptr[0])
  2056. exit(1); /* fail */
  2057. if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0)
  2058. exit(1); /* fail */
  2059. /* - */
  2060. exit(0);
  2061. ]])
  2062. ],[
  2063. AC_MSG_RESULT([yes])
  2064. tst_works_inet_ntop="yes"
  2065. ],[
  2066. AC_MSG_RESULT([no])
  2067. tst_works_inet_ntop="no"
  2068. ])
  2069. fi
  2070. #
  2071. if test "$tst_compi_inet_ntop" = "yes" &&
  2072. test "$tst_works_inet_ntop" != "no"; then
  2073. AC_MSG_CHECKING([if inet_ntop usage allowed])
  2074. if test "x$cares_disallow_inet_ntop" != "xyes"; then
  2075. AC_MSG_RESULT([yes])
  2076. tst_allow_inet_ntop="yes"
  2077. else
  2078. AC_MSG_RESULT([no])
  2079. tst_allow_inet_ntop="no"
  2080. fi
  2081. fi
  2082. #
  2083. AC_MSG_CHECKING([if inet_ntop might be used])
  2084. if test "$tst_links_inet_ntop" = "yes" &&
  2085. test "$tst_proto_inet_ntop" = "yes" &&
  2086. test "$tst_compi_inet_ntop" = "yes" &&
  2087. test "$tst_allow_inet_ntop" = "yes" &&
  2088. test "$tst_works_inet_ntop" != "no"; then
  2089. AC_MSG_RESULT([yes])
  2090. AC_DEFINE_UNQUOTED(HAVE_INET_NTOP, 1,
  2091. [Define to 1 if you have a IPv6 capable working inet_ntop function.])
  2092. ac_cv_func_inet_ntop="yes"
  2093. else
  2094. AC_MSG_RESULT([no])
  2095. ac_cv_func_inet_ntop="no"
  2096. fi
  2097. ])
  2098. dnl CARES_CHECK_FUNC_INET_PTON
  2099. dnl -------------------------------------------------
  2100. dnl Verify if inet_pton is available, prototyped, can
  2101. dnl be compiled and seems to work. If all of these are
  2102. dnl true, and usage has not been previously disallowed
  2103. dnl with shell variable cares_disallow_inet_pton, then
  2104. dnl HAVE_INET_PTON will be defined.
  2105. AC_DEFUN([CARES_CHECK_FUNC_INET_PTON], [
  2106. AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl
  2107. AC_REQUIRE([CARES_INCLUDES_ARPA_INET])dnl
  2108. AC_REQUIRE([CARES_INCLUDES_STRING])dnl
  2109. #
  2110. tst_links_inet_pton="unknown"
  2111. tst_proto_inet_pton="unknown"
  2112. tst_compi_inet_pton="unknown"
  2113. tst_works_inet_pton="unknown"
  2114. tst_allow_inet_pton="unknown"
  2115. #
  2116. AC_MSG_CHECKING([if inet_pton can be linked])
  2117. AC_LINK_IFELSE([
  2118. AC_LANG_FUNC_LINK_TRY([inet_pton])
  2119. ],[
  2120. AC_MSG_RESULT([yes])
  2121. tst_links_inet_pton="yes"
  2122. ],[
  2123. AC_MSG_RESULT([no])
  2124. tst_links_inet_pton="no"
  2125. ])
  2126. #
  2127. if test "$tst_links_inet_pton" = "yes"; then
  2128. AC_MSG_CHECKING([if inet_pton is prototyped])
  2129. AC_EGREP_CPP([inet_pton],[
  2130. $cares_includes_arpa_inet
  2131. ],[
  2132. AC_MSG_RESULT([yes])
  2133. tst_proto_inet_pton="yes"
  2134. ],[
  2135. AC_MSG_RESULT([no])
  2136. tst_proto_inet_pton="no"
  2137. ])
  2138. fi
  2139. #
  2140. if test "$tst_proto_inet_pton" = "yes"; then
  2141. AC_MSG_CHECKING([if inet_pton is compilable])
  2142. AC_COMPILE_IFELSE([
  2143. AC_LANG_PROGRAM([[
  2144. $cares_includes_arpa_inet
  2145. ]],[[
  2146. if(0 != inet_pton(0, 0, 0))
  2147. return 1;
  2148. ]])
  2149. ],[
  2150. AC_MSG_RESULT([yes])
  2151. tst_compi_inet_pton="yes"
  2152. ],[
  2153. AC_MSG_RESULT([no])
  2154. tst_compi_inet_pton="no"
  2155. ])
  2156. fi
  2157. #
  2158. dnl only do runtime verification when not cross-compiling
  2159. if test "x$cross_compiling" != "xyes" &&
  2160. test "$tst_compi_inet_pton" = "yes"; then
  2161. AC_MSG_CHECKING([if inet_pton seems to work])
  2162. AC_RUN_IFELSE([
  2163. AC_LANG_PROGRAM([[
  2164. $cares_includes_stdlib
  2165. $cares_includes_arpa_inet
  2166. $cares_includes_string
  2167. ]],[[
  2168. unsigned char ipv6a[16+1];
  2169. unsigned char ipv4a[4+1];
  2170. const char *ipv6src = "fe80::214:4fff:fe0b:76c8";
  2171. const char *ipv4src = "192.168.100.1";
  2172. /* - */
  2173. memset(ipv4a, 1, sizeof(ipv4a));
  2174. if(1 != inet_pton(AF_INET, ipv4src, ipv4a))
  2175. exit(1); /* fail */
  2176. /* - */
  2177. if( (ipv4a[0] != 0xc0) ||
  2178. (ipv4a[1] != 0xa8) ||
  2179. (ipv4a[2] != 0x64) ||
  2180. (ipv4a[3] != 0x01) ||
  2181. (ipv4a[4] != 0x01) )
  2182. exit(1); /* fail */
  2183. /* - */
  2184. memset(ipv6a, 1, sizeof(ipv6a));
  2185. if(1 != inet_pton(AF_INET6, ipv6src, ipv6a))
  2186. exit(1); /* fail */
  2187. /* - */
  2188. if( (ipv6a[0] != 0xfe) ||
  2189. (ipv6a[1] != 0x80) ||
  2190. (ipv6a[8] != 0x02) ||
  2191. (ipv6a[9] != 0x14) ||
  2192. (ipv6a[10] != 0x4f) ||
  2193. (ipv6a[11] != 0xff) ||
  2194. (ipv6a[12] != 0xfe) ||
  2195. (ipv6a[13] != 0x0b) ||
  2196. (ipv6a[14] != 0x76) ||
  2197. (ipv6a[15] != 0xc8) ||
  2198. (ipv6a[16] != 0x01) )
  2199. exit(1); /* fail */
  2200. /* - */
  2201. if( (ipv6a[2] != 0x0) ||
  2202. (ipv6a[3] != 0x0) ||
  2203. (ipv6a[4] != 0x0) ||
  2204. (ipv6a[5] != 0x0) ||
  2205. (ipv6a[6] != 0x0) ||
  2206. (ipv6a[7] != 0x0) )
  2207. exit(1); /* fail */
  2208. /* - */
  2209. exit(0);
  2210. ]])
  2211. ],[
  2212. AC_MSG_RESULT([yes])
  2213. tst_works_inet_pton="yes"
  2214. ],[
  2215. AC_MSG_RESULT([no])
  2216. tst_works_inet_pton="no"
  2217. ])
  2218. fi
  2219. #
  2220. if test "$tst_compi_inet_pton" = "yes" &&
  2221. test "$tst_works_inet_pton" != "no"; then
  2222. AC_MSG_CHECKING([if inet_pton usage allowed])
  2223. if test "x$cares_disallow_inet_pton" != "xyes"; then
  2224. AC_MSG_RESULT([yes])
  2225. tst_allow_inet_pton="yes"
  2226. else
  2227. AC_MSG_RESULT([no])
  2228. tst_allow_inet_pton="no"
  2229. fi
  2230. fi
  2231. #
  2232. AC_MSG_CHECKING([if inet_pton might be used])
  2233. if test "$tst_links_inet_pton" = "yes" &&
  2234. test "$tst_proto_inet_pton" = "yes" &&
  2235. test "$tst_compi_inet_pton" = "yes" &&
  2236. test "$tst_allow_inet_pton" = "yes" &&
  2237. test "$tst_works_inet_pton" != "no"; then
  2238. AC_MSG_RESULT([yes])
  2239. AC_DEFINE_UNQUOTED(HAVE_INET_PTON, 1,
  2240. [Define to 1 if you have a IPv6 capable working inet_pton function.])
  2241. ac_cv_func_inet_pton="yes"
  2242. else
  2243. AC_MSG_RESULT([no])
  2244. ac_cv_func_inet_pton="no"
  2245. fi
  2246. ])
  2247. dnl CARES_CHECK_FUNC_IOCTL
  2248. dnl -------------------------------------------------
  2249. dnl Verify if ioctl is available, prototyped, and
  2250. dnl can be compiled. If all of these are true, and
  2251. dnl usage has not been previously disallowed with
  2252. dnl shell variable cares_disallow_ioctl, then
  2253. dnl HAVE_IOCTL will be defined.
  2254. AC_DEFUN([CARES_CHECK_FUNC_IOCTL], [
  2255. AC_REQUIRE([CARES_INCLUDES_STROPTS])dnl
  2256. #
  2257. tst_links_ioctl="unknown"
  2258. tst_proto_ioctl="unknown"
  2259. tst_compi_ioctl="unknown"
  2260. tst_allow_ioctl="unknown"
  2261. #
  2262. AC_MSG_CHECKING([if ioctl can be linked])
  2263. AC_LINK_IFELSE([
  2264. AC_LANG_FUNC_LINK_TRY([ioctl])
  2265. ],[
  2266. AC_MSG_RESULT([yes])
  2267. tst_links_ioctl="yes"
  2268. ],[
  2269. AC_MSG_RESULT([no])
  2270. tst_links_ioctl="no"
  2271. ])
  2272. #
  2273. if test "$tst_links_ioctl" = "yes"; then
  2274. AC_MSG_CHECKING([if ioctl is prototyped])
  2275. AC_EGREP_CPP([ioctl],[
  2276. $cares_includes_stropts
  2277. ],[
  2278. AC_MSG_RESULT([yes])
  2279. tst_proto_ioctl="yes"
  2280. ],[
  2281. AC_MSG_RESULT([no])
  2282. tst_proto_ioctl="no"
  2283. ])
  2284. fi
  2285. #
  2286. if test "$tst_proto_ioctl" = "yes"; then
  2287. AC_MSG_CHECKING([if ioctl is compilable])
  2288. AC_COMPILE_IFELSE([
  2289. AC_LANG_PROGRAM([[
  2290. $cares_includes_stropts
  2291. ]],[[
  2292. if(0 != ioctl(0, 0, 0))
  2293. return 1;
  2294. ]])
  2295. ],[
  2296. AC_MSG_RESULT([yes])
  2297. tst_compi_ioctl="yes"
  2298. ],[
  2299. AC_MSG_RESULT([no])
  2300. tst_compi_ioctl="no"
  2301. ])
  2302. fi
  2303. #
  2304. if test "$tst_compi_ioctl" = "yes"; then
  2305. AC_MSG_CHECKING([if ioctl usage allowed])
  2306. if test "x$cares_disallow_ioctl" != "xyes"; then
  2307. AC_MSG_RESULT([yes])
  2308. tst_allow_ioctl="yes"
  2309. else
  2310. AC_MSG_RESULT([no])
  2311. tst_allow_ioctl="no"
  2312. fi
  2313. fi
  2314. #
  2315. AC_MSG_CHECKING([if ioctl might be used])
  2316. if test "$tst_links_ioctl" = "yes" &&
  2317. test "$tst_proto_ioctl" = "yes" &&
  2318. test "$tst_compi_ioctl" = "yes" &&
  2319. test "$tst_allow_ioctl" = "yes"; then
  2320. AC_MSG_RESULT([yes])
  2321. AC_DEFINE_UNQUOTED(HAVE_IOCTL, 1,
  2322. [Define to 1 if you have the ioctl function.])
  2323. ac_cv_func_ioctl="yes"
  2324. CARES_CHECK_FUNC_IOCTL_FIONBIO
  2325. CARES_CHECK_FUNC_IOCTL_SIOCGIFADDR
  2326. else
  2327. AC_MSG_RESULT([no])
  2328. ac_cv_func_ioctl="no"
  2329. fi
  2330. ])
  2331. dnl CARES_CHECK_FUNC_IOCTL_FIONBIO
  2332. dnl -------------------------------------------------
  2333. dnl Verify if ioctl with the FIONBIO command is
  2334. dnl available, can be compiled, and seems to work. If
  2335. dnl all of these are true, then HAVE_IOCTL_FIONBIO
  2336. dnl will be defined.
  2337. AC_DEFUN([CARES_CHECK_FUNC_IOCTL_FIONBIO], [
  2338. #
  2339. tst_compi_ioctl_fionbio="unknown"
  2340. tst_allow_ioctl_fionbio="unknown"
  2341. #
  2342. if test "$ac_cv_func_ioctl" = "yes"; then
  2343. AC_MSG_CHECKING([if ioctl FIONBIO is compilable])
  2344. AC_COMPILE_IFELSE([
  2345. AC_LANG_PROGRAM([[
  2346. $cares_includes_stropts
  2347. ]],[[
  2348. int flags = 0;
  2349. if(0 != ioctl(0, FIONBIO, &flags))
  2350. return 1;
  2351. ]])
  2352. ],[
  2353. AC_MSG_RESULT([yes])
  2354. tst_compi_ioctl_fionbio="yes"
  2355. ],[
  2356. AC_MSG_RESULT([no])
  2357. tst_compi_ioctl_fionbio="no"
  2358. ])
  2359. fi
  2360. #
  2361. if test "$tst_compi_ioctl_fionbio" = "yes"; then
  2362. AC_MSG_CHECKING([if ioctl FIONBIO usage allowed])
  2363. if test "x$cares_disallow_ioctl_fionbio" != "xyes"; then
  2364. AC_MSG_RESULT([yes])
  2365. tst_allow_ioctl_fionbio="yes"
  2366. else
  2367. AC_MSG_RESULT([no])
  2368. tst_allow_ioctl_fionbio="no"
  2369. fi
  2370. fi
  2371. #
  2372. AC_MSG_CHECKING([if ioctl FIONBIO might be used])
  2373. if test "$tst_compi_ioctl_fionbio" = "yes" &&
  2374. test "$tst_allow_ioctl_fionbio" = "yes"; then
  2375. AC_MSG_RESULT([yes])
  2376. AC_DEFINE_UNQUOTED(HAVE_IOCTL_FIONBIO, 1,
  2377. [Define to 1 if you have a working ioctl FIONBIO function.])
  2378. ac_cv_func_ioctl_fionbio="yes"
  2379. else
  2380. AC_MSG_RESULT([no])
  2381. ac_cv_func_ioctl_fionbio="no"
  2382. fi
  2383. ])
  2384. dnl CARES_CHECK_FUNC_IOCTL_SIOCGIFADDR
  2385. dnl -------------------------------------------------
  2386. dnl Verify if ioctl with the SIOCGIFADDR command is available,
  2387. dnl struct ifreq is defined, they can be compiled, and seem to
  2388. dnl work. If all of these are true, then HAVE_IOCTL_SIOCGIFADDR
  2389. dnl will be defined.
  2390. AC_DEFUN([CARES_CHECK_FUNC_IOCTL_SIOCGIFADDR], [
  2391. #
  2392. tst_compi_ioctl_siocgifaddr="unknown"
  2393. tst_allow_ioctl_siocgifaddr="unknown"
  2394. #
  2395. if test "$ac_cv_func_ioctl" = "yes"; then
  2396. AC_MSG_CHECKING([if ioctl SIOCGIFADDR is compilable])
  2397. AC_COMPILE_IFELSE([
  2398. AC_LANG_PROGRAM([[
  2399. $cares_includes_stropts
  2400. #include <net/if.h>
  2401. ]],[[
  2402. struct ifreq ifr;
  2403. if(0 != ioctl(0, SIOCGIFADDR, &ifr))
  2404. return 1;
  2405. ]])
  2406. ],[
  2407. AC_MSG_RESULT([yes])
  2408. tst_compi_ioctl_siocgifaddr="yes"
  2409. ],[
  2410. AC_MSG_RESULT([no])
  2411. tst_compi_ioctl_siocgifaddr="no"
  2412. ])
  2413. fi
  2414. #
  2415. if test "$tst_compi_ioctl_siocgifaddr" = "yes"; then
  2416. AC_MSG_CHECKING([if ioctl SIOCGIFADDR usage allowed])
  2417. if test "x$cares_disallow_ioctl_siocgifaddr" != "xyes"; then
  2418. AC_MSG_RESULT([yes])
  2419. tst_allow_ioctl_siocgifaddr="yes"
  2420. else
  2421. AC_MSG_RESULT([no])
  2422. tst_allow_ioctl_siocgifaddr="no"
  2423. fi
  2424. fi
  2425. #
  2426. AC_MSG_CHECKING([if ioctl SIOCGIFADDR might be used])
  2427. if test "$tst_compi_ioctl_siocgifaddr" = "yes" &&
  2428. test "$tst_allow_ioctl_siocgifaddr" = "yes"; then
  2429. AC_MSG_RESULT([yes])
  2430. AC_DEFINE_UNQUOTED(HAVE_IOCTL_SIOCGIFADDR, 1,
  2431. [Define to 1 if you have a working ioctl SIOCGIFADDR function.])
  2432. ac_cv_func_ioctl_siocgifaddr="yes"
  2433. else
  2434. AC_MSG_RESULT([no])
  2435. ac_cv_func_ioctl_siocgifaddr="no"
  2436. fi
  2437. ])
  2438. dnl CARES_CHECK_FUNC_IOCTLSOCKET
  2439. dnl -------------------------------------------------
  2440. dnl Verify if ioctlsocket is available, prototyped, and
  2441. dnl can be compiled. If all of these are true, and
  2442. dnl usage has not been previously disallowed with
  2443. dnl shell variable cares_disallow_ioctlsocket, then
  2444. dnl HAVE_IOCTLSOCKET will be defined.
  2445. AC_DEFUN([CARES_CHECK_FUNC_IOCTLSOCKET], [
  2446. AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl
  2447. #
  2448. tst_links_ioctlsocket="unknown"
  2449. tst_proto_ioctlsocket="unknown"
  2450. tst_compi_ioctlsocket="unknown"
  2451. tst_allow_ioctlsocket="unknown"
  2452. #
  2453. AC_MSG_CHECKING([if ioctlsocket can be linked])
  2454. AC_LINK_IFELSE([
  2455. AC_LANG_PROGRAM([[
  2456. $cares_includes_winsock2
  2457. ]],[[
  2458. if(0 != ioctlsocket(0, 0, 0))
  2459. return 1;
  2460. ]])
  2461. ],[
  2462. AC_MSG_RESULT([yes])
  2463. tst_links_ioctlsocket="yes"
  2464. ],[
  2465. AC_MSG_RESULT([no])
  2466. tst_links_ioctlsocket="no"
  2467. ])
  2468. #
  2469. if test "$tst_links_ioctlsocket" = "yes"; then
  2470. AC_MSG_CHECKING([if ioctlsocket is prototyped])
  2471. AC_EGREP_CPP([ioctlsocket],[
  2472. $cares_includes_winsock2
  2473. ],[
  2474. AC_MSG_RESULT([yes])
  2475. tst_proto_ioctlsocket="yes"
  2476. ],[
  2477. AC_MSG_RESULT([no])
  2478. tst_proto_ioctlsocket="no"
  2479. ])
  2480. fi
  2481. #
  2482. if test "$tst_proto_ioctlsocket" = "yes"; then
  2483. AC_MSG_CHECKING([if ioctlsocket is compilable])
  2484. AC_COMPILE_IFELSE([
  2485. AC_LANG_PROGRAM([[
  2486. $cares_includes_winsock2
  2487. ]],[[
  2488. if(0 != ioctlsocket(0, 0, 0))
  2489. return 1;
  2490. ]])
  2491. ],[
  2492. AC_MSG_RESULT([yes])
  2493. tst_compi_ioctlsocket="yes"
  2494. ],[
  2495. AC_MSG_RESULT([no])
  2496. tst_compi_ioctlsocket="no"
  2497. ])
  2498. fi
  2499. #
  2500. if test "$tst_compi_ioctlsocket" = "yes"; then
  2501. AC_MSG_CHECKING([if ioctlsocket usage allowed])
  2502. if test "x$cares_disallow_ioctlsocket" != "xyes"; then
  2503. AC_MSG_RESULT([yes])
  2504. tst_allow_ioctlsocket="yes"
  2505. else
  2506. AC_MSG_RESULT([no])
  2507. tst_allow_ioctlsocket="no"
  2508. fi
  2509. fi
  2510. #
  2511. AC_MSG_CHECKING([if ioctlsocket might be used])
  2512. if test "$tst_links_ioctlsocket" = "yes" &&
  2513. test "$tst_proto_ioctlsocket" = "yes" &&
  2514. test "$tst_compi_ioctlsocket" = "yes" &&
  2515. test "$tst_allow_ioctlsocket" = "yes"; then
  2516. AC_MSG_RESULT([yes])
  2517. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET, 1,
  2518. [Define to 1 if you have the ioctlsocket function.])
  2519. ac_cv_func_ioctlsocket="yes"
  2520. CARES_CHECK_FUNC_IOCTLSOCKET_FIONBIO
  2521. else
  2522. AC_MSG_RESULT([no])
  2523. ac_cv_func_ioctlsocket="no"
  2524. fi
  2525. ])
  2526. dnl CARES_CHECK_FUNC_IOCTLSOCKET_FIONBIO
  2527. dnl -------------------------------------------------
  2528. dnl Verify if ioctlsocket with the FIONBIO command is
  2529. dnl available, can be compiled, and seems to work. If
  2530. dnl all of these are true, then HAVE_IOCTLSOCKET_FIONBIO
  2531. dnl will be defined.
  2532. AC_DEFUN([CARES_CHECK_FUNC_IOCTLSOCKET_FIONBIO], [
  2533. #
  2534. tst_compi_ioctlsocket_fionbio="unknown"
  2535. tst_allow_ioctlsocket_fionbio="unknown"
  2536. #
  2537. if test "$ac_cv_func_ioctlsocket" = "yes"; then
  2538. AC_MSG_CHECKING([if ioctlsocket FIONBIO is compilable])
  2539. AC_COMPILE_IFELSE([
  2540. AC_LANG_PROGRAM([[
  2541. $cares_includes_winsock2
  2542. ]],[[
  2543. int flags = 0;
  2544. if(0 != ioctlsocket(0, FIONBIO, &flags))
  2545. return 1;
  2546. ]])
  2547. ],[
  2548. AC_MSG_RESULT([yes])
  2549. tst_compi_ioctlsocket_fionbio="yes"
  2550. ],[
  2551. AC_MSG_RESULT([no])
  2552. tst_compi_ioctlsocket_fionbio="no"
  2553. ])
  2554. fi
  2555. #
  2556. if test "$tst_compi_ioctlsocket_fionbio" = "yes"; then
  2557. AC_MSG_CHECKING([if ioctlsocket FIONBIO usage allowed])
  2558. if test "x$cares_disallow_ioctlsocket_fionbio" != "xyes"; then
  2559. AC_MSG_RESULT([yes])
  2560. tst_allow_ioctlsocket_fionbio="yes"
  2561. else
  2562. AC_MSG_RESULT([no])
  2563. tst_allow_ioctlsocket_fionbio="no"
  2564. fi
  2565. fi
  2566. #
  2567. AC_MSG_CHECKING([if ioctlsocket FIONBIO might be used])
  2568. if test "$tst_compi_ioctlsocket_fionbio" = "yes" &&
  2569. test "$tst_allow_ioctlsocket_fionbio" = "yes"; then
  2570. AC_MSG_RESULT([yes])
  2571. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_FIONBIO, 1,
  2572. [Define to 1 if you have a working ioctlsocket FIONBIO function.])
  2573. ac_cv_func_ioctlsocket_fionbio="yes"
  2574. else
  2575. AC_MSG_RESULT([no])
  2576. ac_cv_func_ioctlsocket_fionbio="no"
  2577. fi
  2578. ])
  2579. dnl CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL
  2580. dnl -------------------------------------------------
  2581. dnl Verify if IoctlSocket is available, prototyped, and
  2582. dnl can be compiled. If all of these are true, and
  2583. dnl usage has not been previously disallowed with
  2584. dnl shell variable cares_disallow_ioctlsocket_camel,
  2585. dnl then HAVE_IOCTLSOCKET_CAMEL will be defined.
  2586. AC_DEFUN([CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL], [
  2587. AC_REQUIRE([CARES_INCLUDES_STROPTS])dnl
  2588. #
  2589. tst_links_ioctlsocket_camel="unknown"
  2590. tst_proto_ioctlsocket_camel="unknown"
  2591. tst_compi_ioctlsocket_camel="unknown"
  2592. tst_allow_ioctlsocket_camel="unknown"
  2593. #
  2594. AC_MSG_CHECKING([if IoctlSocket can be linked])
  2595. AC_LINK_IFELSE([
  2596. AC_LANG_FUNC_LINK_TRY([IoctlSocket])
  2597. ],[
  2598. AC_MSG_RESULT([yes])
  2599. tst_links_ioctlsocket_camel="yes"
  2600. ],[
  2601. AC_MSG_RESULT([no])
  2602. tst_links_ioctlsocket_camel="no"
  2603. ])
  2604. #
  2605. if test "$tst_links_ioctlsocket_camel" = "yes"; then
  2606. AC_MSG_CHECKING([if IoctlSocket is prototyped])
  2607. AC_EGREP_CPP([IoctlSocket],[
  2608. $cares_includes_stropts
  2609. ],[
  2610. AC_MSG_RESULT([yes])
  2611. tst_proto_ioctlsocket_camel="yes"
  2612. ],[
  2613. AC_MSG_RESULT([no])
  2614. tst_proto_ioctlsocket_camel="no"
  2615. ])
  2616. fi
  2617. #
  2618. if test "$tst_proto_ioctlsocket_camel" = "yes"; then
  2619. AC_MSG_CHECKING([if IoctlSocket is compilable])
  2620. AC_COMPILE_IFELSE([
  2621. AC_LANG_PROGRAM([[
  2622. $cares_includes_stropts
  2623. ]],[[
  2624. if(0 != IoctlSocket(0, 0, 0))
  2625. return 1;
  2626. ]])
  2627. ],[
  2628. AC_MSG_RESULT([yes])
  2629. tst_compi_ioctlsocket_camel="yes"
  2630. ],[
  2631. AC_MSG_RESULT([no])
  2632. tst_compi_ioctlsocket_camel="no"
  2633. ])
  2634. fi
  2635. #
  2636. if test "$tst_compi_ioctlsocket_camel" = "yes"; then
  2637. AC_MSG_CHECKING([if IoctlSocket usage allowed])
  2638. if test "x$cares_disallow_ioctlsocket_camel" != "xyes"; then
  2639. AC_MSG_RESULT([yes])
  2640. tst_allow_ioctlsocket_camel="yes"
  2641. else
  2642. AC_MSG_RESULT([no])
  2643. tst_allow_ioctlsocket_camel="no"
  2644. fi
  2645. fi
  2646. #
  2647. AC_MSG_CHECKING([if IoctlSocket might be used])
  2648. if test "$tst_links_ioctlsocket_camel" = "yes" &&
  2649. test "$tst_proto_ioctlsocket_camel" = "yes" &&
  2650. test "$tst_compi_ioctlsocket_camel" = "yes" &&
  2651. test "$tst_allow_ioctlsocket_camel" = "yes"; then
  2652. AC_MSG_RESULT([yes])
  2653. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL, 1,
  2654. [Define to 1 if you have the IoctlSocket camel case function.])
  2655. ac_cv_func_ioctlsocket_camel="yes"
  2656. CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO
  2657. else
  2658. AC_MSG_RESULT([no])
  2659. ac_cv_func_ioctlsocket_camel="no"
  2660. fi
  2661. ])
  2662. dnl CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO
  2663. dnl -------------------------------------------------
  2664. dnl Verify if IoctlSocket with FIONBIO command is available,
  2665. dnl can be compiled, and seems to work. If all of these are
  2666. dnl true, then HAVE_IOCTLSOCKET_CAMEL_FIONBIO will be defined.
  2667. AC_DEFUN([CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO], [
  2668. #
  2669. tst_compi_ioctlsocket_camel_fionbio="unknown"
  2670. tst_allow_ioctlsocket_camel_fionbio="unknown"
  2671. #
  2672. if test "$ac_cv_func_ioctlsocket_camel" = "yes"; then
  2673. AC_MSG_CHECKING([if IoctlSocket FIONBIO is compilable])
  2674. AC_COMPILE_IFELSE([
  2675. AC_LANG_PROGRAM([[
  2676. $cares_includes_stropts
  2677. ]],[[
  2678. long flags = 0;
  2679. if(0 != ioctlsocket(0, FIONBIO, &flags))
  2680. return 1;
  2681. ]])
  2682. ],[
  2683. AC_MSG_RESULT([yes])
  2684. tst_compi_ioctlsocket_camel_fionbio="yes"
  2685. ],[
  2686. AC_MSG_RESULT([no])
  2687. tst_compi_ioctlsocket_camel_fionbio="no"
  2688. ])
  2689. fi
  2690. #
  2691. if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes"; then
  2692. AC_MSG_CHECKING([if IoctlSocket FIONBIO usage allowed])
  2693. if test "x$cares_disallow_ioctlsocket_camel_fionbio" != "xyes"; then
  2694. AC_MSG_RESULT([yes])
  2695. tst_allow_ioctlsocket_camel_fionbio="yes"
  2696. else
  2697. AC_MSG_RESULT([no])
  2698. tst_allow_ioctlsocket_camel_fionbio="no"
  2699. fi
  2700. fi
  2701. #
  2702. AC_MSG_CHECKING([if IoctlSocket FIONBIO might be used])
  2703. if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes" &&
  2704. test "$tst_allow_ioctlsocket_camel_fionbio" = "yes"; then
  2705. AC_MSG_RESULT([yes])
  2706. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL_FIONBIO, 1,
  2707. [Define to 1 if you have a working IoctlSocket camel case FIONBIO function.])
  2708. ac_cv_func_ioctlsocket_camel_fionbio="yes"
  2709. else
  2710. AC_MSG_RESULT([no])
  2711. ac_cv_func_ioctlsocket_camel_fionbio="no"
  2712. fi
  2713. ])
  2714. dnl CARES_CHECK_FUNC_SETSOCKOPT
  2715. dnl -------------------------------------------------
  2716. dnl Verify if setsockopt is available, prototyped, and
  2717. dnl can be compiled. If all of these are true, and
  2718. dnl usage has not been previously disallowed with
  2719. dnl shell variable cares_disallow_setsockopt, then
  2720. dnl HAVE_SETSOCKOPT will be defined.
  2721. AC_DEFUN([CARES_CHECK_FUNC_SETSOCKOPT], [
  2722. AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl
  2723. AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl
  2724. #
  2725. tst_links_setsockopt="unknown"
  2726. tst_proto_setsockopt="unknown"
  2727. tst_compi_setsockopt="unknown"
  2728. tst_allow_setsockopt="unknown"
  2729. #
  2730. AC_MSG_CHECKING([if setsockopt can be linked])
  2731. AC_LINK_IFELSE([
  2732. AC_LANG_PROGRAM([[
  2733. $cares_includes_winsock2
  2734. $cares_includes_sys_socket
  2735. ]],[[
  2736. if(0 != setsockopt(0, 0, 0, 0, 0))
  2737. return 1;
  2738. ]])
  2739. ],[
  2740. AC_MSG_RESULT([yes])
  2741. tst_links_setsockopt="yes"
  2742. ],[
  2743. AC_MSG_RESULT([no])
  2744. tst_links_setsockopt="no"
  2745. ])
  2746. #
  2747. if test "$tst_links_setsockopt" = "yes"; then
  2748. AC_MSG_CHECKING([if setsockopt is prototyped])
  2749. AC_EGREP_CPP([setsockopt],[
  2750. $cares_includes_winsock2
  2751. $cares_includes_sys_socket
  2752. ],[
  2753. AC_MSG_RESULT([yes])
  2754. tst_proto_setsockopt="yes"
  2755. ],[
  2756. AC_MSG_RESULT([no])
  2757. tst_proto_setsockopt="no"
  2758. ])
  2759. fi
  2760. #
  2761. if test "$tst_proto_setsockopt" = "yes"; then
  2762. AC_MSG_CHECKING([if setsockopt is compilable])
  2763. AC_COMPILE_IFELSE([
  2764. AC_LANG_PROGRAM([[
  2765. $cares_includes_winsock2
  2766. $cares_includes_sys_socket
  2767. ]],[[
  2768. if(0 != setsockopt(0, 0, 0, 0, 0))
  2769. return 1;
  2770. ]])
  2771. ],[
  2772. AC_MSG_RESULT([yes])
  2773. tst_compi_setsockopt="yes"
  2774. ],[
  2775. AC_MSG_RESULT([no])
  2776. tst_compi_setsockopt="no"
  2777. ])
  2778. fi
  2779. #
  2780. if test "$tst_compi_setsockopt" = "yes"; then
  2781. AC_MSG_CHECKING([if setsockopt usage allowed])
  2782. if test "x$cares_disallow_setsockopt" != "xyes"; then
  2783. AC_MSG_RESULT([yes])
  2784. tst_allow_setsockopt="yes"
  2785. else
  2786. AC_MSG_RESULT([no])
  2787. tst_allow_setsockopt="no"
  2788. fi
  2789. fi
  2790. #
  2791. AC_MSG_CHECKING([if setsockopt might be used])
  2792. if test "$tst_links_setsockopt" = "yes" &&
  2793. test "$tst_proto_setsockopt" = "yes" &&
  2794. test "$tst_compi_setsockopt" = "yes" &&
  2795. test "$tst_allow_setsockopt" = "yes"; then
  2796. AC_MSG_RESULT([yes])
  2797. AC_DEFINE_UNQUOTED(HAVE_SETSOCKOPT, 1,
  2798. [Define to 1 if you have the setsockopt function.])
  2799. ac_cv_func_setsockopt="yes"
  2800. CARES_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK
  2801. else
  2802. AC_MSG_RESULT([no])
  2803. ac_cv_func_setsockopt="no"
  2804. fi
  2805. ])
  2806. dnl CARES_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK
  2807. dnl -------------------------------------------------
  2808. dnl Verify if setsockopt with the SO_NONBLOCK command is
  2809. dnl available, can be compiled, and seems to work. If
  2810. dnl all of these are true, then HAVE_SETSOCKOPT_SO_NONBLOCK
  2811. dnl will be defined.
  2812. AC_DEFUN([CARES_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK], [
  2813. #
  2814. tst_compi_setsockopt_so_nonblock="unknown"
  2815. tst_allow_setsockopt_so_nonblock="unknown"
  2816. #
  2817. if test "$ac_cv_func_setsockopt" = "yes"; then
  2818. AC_MSG_CHECKING([if setsockopt SO_NONBLOCK is compilable])
  2819. AC_COMPILE_IFELSE([
  2820. AC_LANG_PROGRAM([[
  2821. $cares_includes_winsock2
  2822. $cares_includes_sys_socket
  2823. ]],[[
  2824. if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0))
  2825. return 1;
  2826. ]])
  2827. ],[
  2828. AC_MSG_RESULT([yes])
  2829. tst_compi_setsockopt_so_nonblock="yes"
  2830. ],[
  2831. AC_MSG_RESULT([no])
  2832. tst_compi_setsockopt_so_nonblock="no"
  2833. ])
  2834. fi
  2835. #
  2836. if test "$tst_compi_setsockopt_so_nonblock" = "yes"; then
  2837. AC_MSG_CHECKING([if setsockopt SO_NONBLOCK usage allowed])
  2838. if test "x$cares_disallow_setsockopt_so_nonblock" != "xyes"; then
  2839. AC_MSG_RESULT([yes])
  2840. tst_allow_setsockopt_so_nonblock="yes"
  2841. else
  2842. AC_MSG_RESULT([no])
  2843. tst_allow_setsockopt_so_nonblock="no"
  2844. fi
  2845. fi
  2846. #
  2847. AC_MSG_CHECKING([if setsockopt SO_NONBLOCK might be used])
  2848. if test "$tst_compi_setsockopt_so_nonblock" = "yes" &&
  2849. test "$tst_allow_setsockopt_so_nonblock" = "yes"; then
  2850. AC_MSG_RESULT([yes])
  2851. AC_DEFINE_UNQUOTED(HAVE_SETSOCKOPT_SO_NONBLOCK, 1,
  2852. [Define to 1 if you have a working setsockopt SO_NONBLOCK function.])
  2853. ac_cv_func_setsockopt_so_nonblock="yes"
  2854. else
  2855. AC_MSG_RESULT([no])
  2856. ac_cv_func_setsockopt_so_nonblock="no"
  2857. fi
  2858. ])
  2859. dnl CARES_CHECK_FUNC_SOCKET
  2860. dnl -------------------------------------------------
  2861. dnl Verify if socket is available, prototyped, and
  2862. dnl can be compiled. If all of these are true, and
  2863. dnl usage has not been previously disallowed with
  2864. dnl shell variable cares_disallow_socket, then
  2865. dnl HAVE_SOCKET will be defined.
  2866. AC_DEFUN([CARES_CHECK_FUNC_SOCKET], [
  2867. AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl
  2868. AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl
  2869. AC_REQUIRE([CARES_INCLUDES_SOCKET])dnl
  2870. #
  2871. tst_links_socket="unknown"
  2872. tst_proto_socket="unknown"
  2873. tst_compi_socket="unknown"
  2874. tst_allow_socket="unknown"
  2875. #
  2876. AC_MSG_CHECKING([if socket can be linked])
  2877. AC_LINK_IFELSE([
  2878. AC_LANG_PROGRAM([[
  2879. $cares_includes_winsock2
  2880. $cares_includes_sys_socket
  2881. $cares_includes_socket
  2882. ]],[[
  2883. if(0 != socket(0, 0, 0))
  2884. return 1;
  2885. ]])
  2886. ],[
  2887. AC_MSG_RESULT([yes])
  2888. tst_links_socket="yes"
  2889. ],[
  2890. AC_MSG_RESULT([no])
  2891. tst_links_socket="no"
  2892. ])
  2893. #
  2894. if test "$tst_links_socket" = "yes"; then
  2895. AC_MSG_CHECKING([if socket is prototyped])
  2896. AC_EGREP_CPP([socket],[
  2897. $cares_includes_winsock2
  2898. $cares_includes_sys_socket
  2899. $cares_includes_socket
  2900. ],[
  2901. AC_MSG_RESULT([yes])
  2902. tst_proto_socket="yes"
  2903. ],[
  2904. AC_MSG_RESULT([no])
  2905. tst_proto_socket="no"
  2906. ])
  2907. fi
  2908. #
  2909. if test "$tst_proto_socket" = "yes"; then
  2910. AC_MSG_CHECKING([if socket is compilable])
  2911. AC_COMPILE_IFELSE([
  2912. AC_LANG_PROGRAM([[
  2913. $cares_includes_winsock2
  2914. $cares_includes_sys_socket
  2915. $cares_includes_socket
  2916. ]],[[
  2917. if(0 != socket(0, 0, 0))
  2918. return 1;
  2919. ]])
  2920. ],[
  2921. AC_MSG_RESULT([yes])
  2922. tst_compi_socket="yes"
  2923. ],[
  2924. AC_MSG_RESULT([no])
  2925. tst_compi_socket="no"
  2926. ])
  2927. fi
  2928. #
  2929. if test "$tst_compi_socket" = "yes"; then
  2930. AC_MSG_CHECKING([if socket usage allowed])
  2931. if test "x$cares_disallow_socket" != "xyes"; then
  2932. AC_MSG_RESULT([yes])
  2933. tst_allow_socket="yes"
  2934. else
  2935. AC_MSG_RESULT([no])
  2936. tst_allow_socket="no"
  2937. fi
  2938. fi
  2939. #
  2940. AC_MSG_CHECKING([if socket might be used])
  2941. if test "$tst_links_socket" = "yes" &&
  2942. test "$tst_proto_socket" = "yes" &&
  2943. test "$tst_compi_socket" = "yes" &&
  2944. test "$tst_allow_socket" = "yes"; then
  2945. AC_MSG_RESULT([yes])
  2946. AC_DEFINE_UNQUOTED(HAVE_SOCKET, 1,
  2947. [Define to 1 if you have the socket function.])
  2948. ac_cv_func_socket="yes"
  2949. else
  2950. AC_MSG_RESULT([no])
  2951. ac_cv_func_socket="no"
  2952. fi
  2953. ])
  2954. dnl CARES_CHECK_FUNC_STRCASECMP
  2955. dnl -------------------------------------------------
  2956. dnl Verify if strcasecmp is available, prototyped, and
  2957. dnl can be compiled. If all of these are true, and
  2958. dnl usage has not been previously disallowed with
  2959. dnl shell variable cares_disallow_strcasecmp, then
  2960. dnl HAVE_STRCASECMP will be defined.
  2961. AC_DEFUN([CARES_CHECK_FUNC_STRCASECMP], [
  2962. AC_REQUIRE([CARES_INCLUDES_STRING])dnl
  2963. #
  2964. tst_links_strcasecmp="unknown"
  2965. tst_proto_strcasecmp="unknown"
  2966. tst_compi_strcasecmp="unknown"
  2967. tst_allow_strcasecmp="unknown"
  2968. #
  2969. AC_MSG_CHECKING([if strcasecmp can be linked])
  2970. AC_LINK_IFELSE([
  2971. AC_LANG_FUNC_LINK_TRY([strcasecmp])
  2972. ],[
  2973. AC_MSG_RESULT([yes])
  2974. tst_links_strcasecmp="yes"
  2975. ],[
  2976. AC_MSG_RESULT([no])
  2977. tst_links_strcasecmp="no"
  2978. ])
  2979. #
  2980. if test "$tst_links_strcasecmp" = "yes"; then
  2981. AC_MSG_CHECKING([if strcasecmp is prototyped])
  2982. AC_EGREP_CPP([strcasecmp],[
  2983. $cares_includes_string
  2984. ],[
  2985. AC_MSG_RESULT([yes])
  2986. tst_proto_strcasecmp="yes"
  2987. ],[
  2988. AC_MSG_RESULT([no])
  2989. tst_proto_strcasecmp="no"
  2990. ])
  2991. fi
  2992. #
  2993. if test "$tst_proto_strcasecmp" = "yes"; then
  2994. AC_MSG_CHECKING([if strcasecmp is compilable])
  2995. AC_COMPILE_IFELSE([
  2996. AC_LANG_PROGRAM([[
  2997. $cares_includes_string
  2998. ]],[[
  2999. if(0 != strcasecmp(0, 0))
  3000. return 1;
  3001. ]])
  3002. ],[
  3003. AC_MSG_RESULT([yes])
  3004. tst_compi_strcasecmp="yes"
  3005. ],[
  3006. AC_MSG_RESULT([no])
  3007. tst_compi_strcasecmp="no"
  3008. ])
  3009. fi
  3010. #
  3011. if test "$tst_compi_strcasecmp" = "yes"; then
  3012. AC_MSG_CHECKING([if strcasecmp usage allowed])
  3013. if test "x$cares_disallow_strcasecmp" != "xyes"; then
  3014. AC_MSG_RESULT([yes])
  3015. tst_allow_strcasecmp="yes"
  3016. else
  3017. AC_MSG_RESULT([no])
  3018. tst_allow_strcasecmp="no"
  3019. fi
  3020. fi
  3021. #
  3022. AC_MSG_CHECKING([if strcasecmp might be used])
  3023. if test "$tst_links_strcasecmp" = "yes" &&
  3024. test "$tst_proto_strcasecmp" = "yes" &&
  3025. test "$tst_compi_strcasecmp" = "yes" &&
  3026. test "$tst_allow_strcasecmp" = "yes"; then
  3027. AC_MSG_RESULT([yes])
  3028. AC_DEFINE_UNQUOTED(HAVE_STRCASECMP, 1,
  3029. [Define to 1 if you have the strcasecmp function.])
  3030. ac_cv_func_strcasecmp="yes"
  3031. else
  3032. AC_MSG_RESULT([no])
  3033. ac_cv_func_strcasecmp="no"
  3034. fi
  3035. ])
  3036. dnl CARES_CHECK_FUNC_STRCMPI
  3037. dnl -------------------------------------------------
  3038. dnl Verify if strcmpi is available, prototyped, and
  3039. dnl can be compiled. If all of these are true, and
  3040. dnl usage has not been previously disallowed with
  3041. dnl shell variable cares_disallow_strcmpi, then
  3042. dnl HAVE_STRCMPI will be defined.
  3043. AC_DEFUN([CARES_CHECK_FUNC_STRCMPI], [
  3044. AC_REQUIRE([CARES_INCLUDES_STRING])dnl
  3045. #
  3046. tst_links_strcmpi="unknown"
  3047. tst_proto_strcmpi="unknown"
  3048. tst_compi_strcmpi="unknown"
  3049. tst_allow_strcmpi="unknown"
  3050. #
  3051. AC_MSG_CHECKING([if strcmpi can be linked])
  3052. AC_LINK_IFELSE([
  3053. AC_LANG_FUNC_LINK_TRY([strcmpi])
  3054. ],[
  3055. AC_MSG_RESULT([yes])
  3056. tst_links_strcmpi="yes"
  3057. ],[
  3058. AC_MSG_RESULT([no])
  3059. tst_links_strcmpi="no"
  3060. ])
  3061. #
  3062. if test "$tst_links_strcmpi" = "yes"; then
  3063. AC_MSG_CHECKING([if strcmpi is prototyped])
  3064. AC_EGREP_CPP([strcmpi],[
  3065. $cares_includes_string
  3066. ],[
  3067. AC_MSG_RESULT([yes])
  3068. tst_proto_strcmpi="yes"
  3069. ],[
  3070. AC_MSG_RESULT([no])
  3071. tst_proto_strcmpi="no"
  3072. ])
  3073. fi
  3074. #
  3075. if test "$tst_proto_strcmpi" = "yes"; then
  3076. AC_MSG_CHECKING([if strcmpi is compilable])
  3077. AC_COMPILE_IFELSE([
  3078. AC_LANG_PROGRAM([[
  3079. $cares_includes_string
  3080. ]],[[
  3081. if(0 != strcmpi(0, 0))
  3082. return 1;
  3083. ]])
  3084. ],[
  3085. AC_MSG_RESULT([yes])
  3086. tst_compi_strcmpi="yes"
  3087. ],[
  3088. AC_MSG_RESULT([no])
  3089. tst_compi_strcmpi="no"
  3090. ])
  3091. fi
  3092. #
  3093. if test "$tst_compi_strcmpi" = "yes"; then
  3094. AC_MSG_CHECKING([if strcmpi usage allowed])
  3095. if test "x$cares_disallow_strcmpi" != "xyes"; then
  3096. AC_MSG_RESULT([yes])
  3097. tst_allow_strcmpi="yes"
  3098. else
  3099. AC_MSG_RESULT([no])
  3100. tst_allow_strcmpi="no"
  3101. fi
  3102. fi
  3103. #
  3104. AC_MSG_CHECKING([if strcmpi might be used])
  3105. if test "$tst_links_strcmpi" = "yes" &&
  3106. test "$tst_proto_strcmpi" = "yes" &&
  3107. test "$tst_compi_strcmpi" = "yes" &&
  3108. test "$tst_allow_strcmpi" = "yes"; then
  3109. AC_MSG_RESULT([yes])
  3110. AC_DEFINE_UNQUOTED(HAVE_STRCMPI, 1,
  3111. [Define to 1 if you have the strcmpi function.])
  3112. ac_cv_func_strcmpi="yes"
  3113. else
  3114. AC_MSG_RESULT([no])
  3115. ac_cv_func_strcmpi="no"
  3116. fi
  3117. ])
  3118. dnl CARES_CHECK_FUNC_STRDUP
  3119. dnl -------------------------------------------------
  3120. dnl Verify if strdup is available, prototyped, and
  3121. dnl can be compiled. If all of these are true, and
  3122. dnl usage has not been previously disallowed with
  3123. dnl shell variable cares_disallow_strdup, then
  3124. dnl HAVE_STRDUP will be defined.
  3125. AC_DEFUN([CARES_CHECK_FUNC_STRDUP], [
  3126. AC_REQUIRE([CARES_INCLUDES_STRING])dnl
  3127. #
  3128. tst_links_strdup="unknown"
  3129. tst_proto_strdup="unknown"
  3130. tst_compi_strdup="unknown"
  3131. tst_allow_strdup="unknown"
  3132. #
  3133. AC_MSG_CHECKING([if strdup can be linked])
  3134. AC_LINK_IFELSE([
  3135. AC_LANG_FUNC_LINK_TRY([strdup])
  3136. ],[
  3137. AC_MSG_RESULT([yes])
  3138. tst_links_strdup="yes"
  3139. ],[
  3140. AC_MSG_RESULT([no])
  3141. tst_links_strdup="no"
  3142. ])
  3143. #
  3144. if test "$tst_links_strdup" = "yes"; then
  3145. AC_MSG_CHECKING([if strdup is prototyped])
  3146. AC_EGREP_CPP([strdup],[
  3147. $cares_includes_string
  3148. ],[
  3149. AC_MSG_RESULT([yes])
  3150. tst_proto_strdup="yes"
  3151. ],[
  3152. AC_MSG_RESULT([no])
  3153. tst_proto_strdup="no"
  3154. ])
  3155. fi
  3156. #
  3157. if test "$tst_proto_strdup" = "yes"; then
  3158. AC_MSG_CHECKING([if strdup is compilable])
  3159. AC_COMPILE_IFELSE([
  3160. AC_LANG_PROGRAM([[
  3161. $cares_includes_string
  3162. ]],[[
  3163. if(0 != strdup(0))
  3164. return 1;
  3165. ]])
  3166. ],[
  3167. AC_MSG_RESULT([yes])
  3168. tst_compi_strdup="yes"
  3169. ],[
  3170. AC_MSG_RESULT([no])
  3171. tst_compi_strdup="no"
  3172. ])
  3173. fi
  3174. #
  3175. if test "$tst_compi_strdup" = "yes"; then
  3176. AC_MSG_CHECKING([if strdup usage allowed])
  3177. if test "x$cares_disallow_strdup" != "xyes"; then
  3178. AC_MSG_RESULT([yes])
  3179. tst_allow_strdup="yes"
  3180. else
  3181. AC_MSG_RESULT([no])
  3182. tst_allow_strdup="no"
  3183. fi
  3184. fi
  3185. #
  3186. AC_MSG_CHECKING([if strdup might be used])
  3187. if test "$tst_links_strdup" = "yes" &&
  3188. test "$tst_proto_strdup" = "yes" &&
  3189. test "$tst_compi_strdup" = "yes" &&
  3190. test "$tst_allow_strdup" = "yes"; then
  3191. AC_MSG_RESULT([yes])
  3192. AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1,
  3193. [Define to 1 if you have the strdup function.])
  3194. ac_cv_func_strdup="yes"
  3195. else
  3196. AC_MSG_RESULT([no])
  3197. ac_cv_func_strdup="no"
  3198. fi
  3199. ])
  3200. dnl CARES_CHECK_FUNC_STRICMP
  3201. dnl -------------------------------------------------
  3202. dnl Verify if stricmp is available, prototyped, and
  3203. dnl can be compiled. If all of these are true, and
  3204. dnl usage has not been previously disallowed with
  3205. dnl shell variable cares_disallow_stricmp, then
  3206. dnl HAVE_STRICMP will be defined.
  3207. AC_DEFUN([CARES_CHECK_FUNC_STRICMP], [
  3208. AC_REQUIRE([CARES_INCLUDES_STRING])dnl
  3209. #
  3210. tst_links_stricmp="unknown"
  3211. tst_proto_stricmp="unknown"
  3212. tst_compi_stricmp="unknown"
  3213. tst_allow_stricmp="unknown"
  3214. #
  3215. AC_MSG_CHECKING([if stricmp can be linked])
  3216. AC_LINK_IFELSE([
  3217. AC_LANG_FUNC_LINK_TRY([stricmp])
  3218. ],[
  3219. AC_MSG_RESULT([yes])
  3220. tst_links_stricmp="yes"
  3221. ],[
  3222. AC_MSG_RESULT([no])
  3223. tst_links_stricmp="no"
  3224. ])
  3225. #
  3226. if test "$tst_links_stricmp" = "yes"; then
  3227. AC_MSG_CHECKING([if stricmp is prototyped])
  3228. AC_EGREP_CPP([stricmp],[
  3229. $cares_includes_string
  3230. ],[
  3231. AC_MSG_RESULT([yes])
  3232. tst_proto_stricmp="yes"
  3233. ],[
  3234. AC_MSG_RESULT([no])
  3235. tst_proto_stricmp="no"
  3236. ])
  3237. fi
  3238. #
  3239. if test "$tst_proto_stricmp" = "yes"; then
  3240. AC_MSG_CHECKING([if stricmp is compilable])
  3241. AC_COMPILE_IFELSE([
  3242. AC_LANG_PROGRAM([[
  3243. $cares_includes_string
  3244. ]],[[
  3245. if(0 != stricmp(0, 0))
  3246. return 1;
  3247. ]])
  3248. ],[
  3249. AC_MSG_RESULT([yes])
  3250. tst_compi_stricmp="yes"
  3251. ],[
  3252. AC_MSG_RESULT([no])
  3253. tst_compi_stricmp="no"
  3254. ])
  3255. fi
  3256. #
  3257. if test "$tst_compi_stricmp" = "yes"; then
  3258. AC_MSG_CHECKING([if stricmp usage allowed])
  3259. if test "x$cares_disallow_stricmp" != "xyes"; then
  3260. AC_MSG_RESULT([yes])
  3261. tst_allow_stricmp="yes"
  3262. else
  3263. AC_MSG_RESULT([no])
  3264. tst_allow_stricmp="no"
  3265. fi
  3266. fi
  3267. #
  3268. AC_MSG_CHECKING([if stricmp might be used])
  3269. if test "$tst_links_stricmp" = "yes" &&
  3270. test "$tst_proto_stricmp" = "yes" &&
  3271. test "$tst_compi_stricmp" = "yes" &&
  3272. test "$tst_allow_stricmp" = "yes"; then
  3273. AC_MSG_RESULT([yes])
  3274. AC_DEFINE_UNQUOTED(HAVE_STRICMP, 1,
  3275. [Define to 1 if you have the stricmp function.])
  3276. ac_cv_func_stricmp="yes"
  3277. else
  3278. AC_MSG_RESULT([no])
  3279. ac_cv_func_stricmp="no"
  3280. fi
  3281. ])
  3282. dnl CARES_CHECK_FUNC_STRNCASECMP
  3283. dnl -------------------------------------------------
  3284. dnl Verify if strncasecmp is available, prototyped, and
  3285. dnl can be compiled. If all of these are true, and
  3286. dnl usage has not been previously disallowed with
  3287. dnl shell variable cares_disallow_strncasecmp, then
  3288. dnl HAVE_STRNCASECMP will be defined.
  3289. AC_DEFUN([CARES_CHECK_FUNC_STRNCASECMP], [
  3290. AC_REQUIRE([CARES_INCLUDES_STRING])dnl
  3291. #
  3292. tst_links_strncasecmp="unknown"
  3293. tst_proto_strncasecmp="unknown"
  3294. tst_compi_strncasecmp="unknown"
  3295. tst_allow_strncasecmp="unknown"
  3296. #
  3297. AC_MSG_CHECKING([if strncasecmp can be linked])
  3298. AC_LINK_IFELSE([
  3299. AC_LANG_FUNC_LINK_TRY([strncasecmp])
  3300. ],[
  3301. AC_MSG_RESULT([yes])
  3302. tst_links_strncasecmp="yes"
  3303. ],[
  3304. AC_MSG_RESULT([no])
  3305. tst_links_strncasecmp="no"
  3306. ])
  3307. #
  3308. if test "$tst_links_strncasecmp" = "yes"; then
  3309. AC_MSG_CHECKING([if strncasecmp is prototyped])
  3310. AC_EGREP_CPP([strncasecmp],[
  3311. $cares_includes_string
  3312. ],[
  3313. AC_MSG_RESULT([yes])
  3314. tst_proto_strncasecmp="yes"
  3315. ],[
  3316. AC_MSG_RESULT([no])
  3317. tst_proto_strncasecmp="no"
  3318. ])
  3319. fi
  3320. #
  3321. if test "$tst_proto_strncasecmp" = "yes"; then
  3322. AC_MSG_CHECKING([if strncasecmp is compilable])
  3323. AC_COMPILE_IFELSE([
  3324. AC_LANG_PROGRAM([[
  3325. $cares_includes_string
  3326. ]],[[
  3327. if(0 != strncasecmp(0, 0, 0))
  3328. return 1;
  3329. ]])
  3330. ],[
  3331. AC_MSG_RESULT([yes])
  3332. tst_compi_strncasecmp="yes"
  3333. ],[
  3334. AC_MSG_RESULT([no])
  3335. tst_compi_strncasecmp="no"
  3336. ])
  3337. fi
  3338. #
  3339. if test "$tst_compi_strncasecmp" = "yes"; then
  3340. AC_MSG_CHECKING([if strncasecmp usage allowed])
  3341. if test "x$cares_disallow_strncasecmp" != "xyes"; then
  3342. AC_MSG_RESULT([yes])
  3343. tst_allow_strncasecmp="yes"
  3344. else
  3345. AC_MSG_RESULT([no])
  3346. tst_allow_strncasecmp="no"
  3347. fi
  3348. fi
  3349. #
  3350. AC_MSG_CHECKING([if strncasecmp might be used])
  3351. if test "$tst_links_strncasecmp" = "yes" &&
  3352. test "$tst_proto_strncasecmp" = "yes" &&
  3353. test "$tst_compi_strncasecmp" = "yes" &&
  3354. test "$tst_allow_strncasecmp" = "yes"; then
  3355. AC_MSG_RESULT([yes])
  3356. AC_DEFINE_UNQUOTED(HAVE_STRNCASECMP, 1,
  3357. [Define to 1 if you have the strncasecmp function.])
  3358. ac_cv_func_strncasecmp="yes"
  3359. else
  3360. AC_MSG_RESULT([no])
  3361. ac_cv_func_strncasecmp="no"
  3362. fi
  3363. ])
  3364. dnl CARES_CHECK_FUNC_STRNCMPI
  3365. dnl -------------------------------------------------
  3366. dnl Verify if strncmpi is available, prototyped, and
  3367. dnl can be compiled. If all of these are true, and
  3368. dnl usage has not been previously disallowed with
  3369. dnl shell variable cares_disallow_strncmpi, then
  3370. dnl HAVE_STRNCMPI will be defined.
  3371. AC_DEFUN([CARES_CHECK_FUNC_STRNCMPI], [
  3372. AC_REQUIRE([CARES_INCLUDES_STRING])dnl
  3373. #
  3374. tst_links_strncmpi="unknown"
  3375. tst_proto_strncmpi="unknown"
  3376. tst_compi_strncmpi="unknown"
  3377. tst_allow_strncmpi="unknown"
  3378. #
  3379. AC_MSG_CHECKING([if strncmpi can be linked])
  3380. AC_LINK_IFELSE([
  3381. AC_LANG_FUNC_LINK_TRY([strncmpi])
  3382. ],[
  3383. AC_MSG_RESULT([yes])
  3384. tst_links_strncmpi="yes"
  3385. ],[
  3386. AC_MSG_RESULT([no])
  3387. tst_links_strncmpi="no"
  3388. ])
  3389. #
  3390. if test "$tst_links_strncmpi" = "yes"; then
  3391. AC_MSG_CHECKING([if strncmpi is prototyped])
  3392. AC_EGREP_CPP([strncmpi],[
  3393. $cares_includes_string
  3394. ],[
  3395. AC_MSG_RESULT([yes])
  3396. tst_proto_strncmpi="yes"
  3397. ],[
  3398. AC_MSG_RESULT([no])
  3399. tst_proto_strncmpi="no"
  3400. ])
  3401. fi
  3402. #
  3403. if test "$tst_proto_strncmpi" = "yes"; then
  3404. AC_MSG_CHECKING([if strncmpi is compilable])
  3405. AC_COMPILE_IFELSE([
  3406. AC_LANG_PROGRAM([[
  3407. $cares_includes_string
  3408. ]],[[
  3409. if(0 != strncmpi(0, 0))
  3410. return 1;
  3411. ]])
  3412. ],[
  3413. AC_MSG_RESULT([yes])
  3414. tst_compi_strncmpi="yes"
  3415. ],[
  3416. AC_MSG_RESULT([no])
  3417. tst_compi_strncmpi="no"
  3418. ])
  3419. fi
  3420. #
  3421. if test "$tst_compi_strncmpi" = "yes"; then
  3422. AC_MSG_CHECKING([if strncmpi usage allowed])
  3423. if test "x$cares_disallow_strncmpi" != "xyes"; then
  3424. AC_MSG_RESULT([yes])
  3425. tst_allow_strncmpi="yes"
  3426. else
  3427. AC_MSG_RESULT([no])
  3428. tst_allow_strncmpi="no"
  3429. fi
  3430. fi
  3431. #
  3432. AC_MSG_CHECKING([if strncmpi might be used])
  3433. if test "$tst_links_strncmpi" = "yes" &&
  3434. test "$tst_proto_strncmpi" = "yes" &&
  3435. test "$tst_compi_strncmpi" = "yes" &&
  3436. test "$tst_allow_strncmpi" = "yes"; then
  3437. AC_MSG_RESULT([yes])
  3438. AC_DEFINE_UNQUOTED(HAVE_STRNCMPI, 1,
  3439. [Define to 1 if you have the strncmpi function.])
  3440. ac_cv_func_strncmpi="yes"
  3441. else
  3442. AC_MSG_RESULT([no])
  3443. ac_cv_func_strncmpi="no"
  3444. fi
  3445. ])
  3446. dnl CARES_CHECK_FUNC_STRNICMP
  3447. dnl -------------------------------------------------
  3448. dnl Verify if strnicmp is available, prototyped, and
  3449. dnl can be compiled. If all of these are true, and
  3450. dnl usage has not been previously disallowed with
  3451. dnl shell variable cares_disallow_strnicmp, then
  3452. dnl HAVE_STRNICMP will be defined.
  3453. AC_DEFUN([CARES_CHECK_FUNC_STRNICMP], [
  3454. AC_REQUIRE([CARES_INCLUDES_STRING])dnl
  3455. #
  3456. tst_links_strnicmp="unknown"
  3457. tst_proto_strnicmp="unknown"
  3458. tst_compi_strnicmp="unknown"
  3459. tst_allow_strnicmp="unknown"
  3460. #
  3461. AC_MSG_CHECKING([if strnicmp can be linked])
  3462. AC_LINK_IFELSE([
  3463. AC_LANG_FUNC_LINK_TRY([strnicmp])
  3464. ],[
  3465. AC_MSG_RESULT([yes])
  3466. tst_links_strnicmp="yes"
  3467. ],[
  3468. AC_MSG_RESULT([no])
  3469. tst_links_strnicmp="no"
  3470. ])
  3471. #
  3472. if test "$tst_links_strnicmp" = "yes"; then
  3473. AC_MSG_CHECKING([if strnicmp is prototyped])
  3474. AC_EGREP_CPP([strnicmp],[
  3475. $cares_includes_string
  3476. ],[
  3477. AC_MSG_RESULT([yes])
  3478. tst_proto_strnicmp="yes"
  3479. ],[
  3480. AC_MSG_RESULT([no])
  3481. tst_proto_strnicmp="no"
  3482. ])
  3483. fi
  3484. #
  3485. if test "$tst_proto_strnicmp" = "yes"; then
  3486. AC_MSG_CHECKING([if strnicmp is compilable])
  3487. AC_COMPILE_IFELSE([
  3488. AC_LANG_PROGRAM([[
  3489. $cares_includes_string
  3490. ]],[[
  3491. if(0 != strnicmp(0, 0))
  3492. return 1;
  3493. ]])
  3494. ],[
  3495. AC_MSG_RESULT([yes])
  3496. tst_compi_strnicmp="yes"
  3497. ],[
  3498. AC_MSG_RESULT([no])
  3499. tst_compi_strnicmp="no"
  3500. ])
  3501. fi
  3502. #
  3503. if test "$tst_compi_strnicmp" = "yes"; then
  3504. AC_MSG_CHECKING([if strnicmp usage allowed])
  3505. if test "x$cares_disallow_strnicmp" != "xyes"; then
  3506. AC_MSG_RESULT([yes])
  3507. tst_allow_strnicmp="yes"
  3508. else
  3509. AC_MSG_RESULT([no])
  3510. tst_allow_strnicmp="no"
  3511. fi
  3512. fi
  3513. #
  3514. AC_MSG_CHECKING([if strnicmp might be used])
  3515. if test "$tst_links_strnicmp" = "yes" &&
  3516. test "$tst_proto_strnicmp" = "yes" &&
  3517. test "$tst_compi_strnicmp" = "yes" &&
  3518. test "$tst_allow_strnicmp" = "yes"; then
  3519. AC_MSG_RESULT([yes])
  3520. AC_DEFINE_UNQUOTED(HAVE_STRNICMP, 1,
  3521. [Define to 1 if you have the strnicmp function.])
  3522. ac_cv_func_strnicmp="yes"
  3523. else
  3524. AC_MSG_RESULT([no])
  3525. ac_cv_func_strnicmp="no"
  3526. fi
  3527. ])
  3528. dnl CARES_CHECK_FUNC_WRITEV
  3529. dnl -------------------------------------------------
  3530. dnl Verify if writev is available, prototyped, and
  3531. dnl can be compiled. If all of these are true, and
  3532. dnl usage has not been previously disallowed with
  3533. dnl shell variable cares_disallow_writev, then
  3534. dnl HAVE_WRITEV will be defined.
  3535. AC_DEFUN([CARES_CHECK_FUNC_WRITEV], [
  3536. AC_REQUIRE([CARES_INCLUDES_SYS_UIO])dnl
  3537. #
  3538. tst_links_writev="unknown"
  3539. tst_proto_writev="unknown"
  3540. tst_compi_writev="unknown"
  3541. tst_allow_writev="unknown"
  3542. #
  3543. AC_MSG_CHECKING([if writev can be linked])
  3544. AC_LINK_IFELSE([
  3545. AC_LANG_FUNC_LINK_TRY([writev])
  3546. ],[
  3547. AC_MSG_RESULT([yes])
  3548. tst_links_writev="yes"
  3549. ],[
  3550. AC_MSG_RESULT([no])
  3551. tst_links_writev="no"
  3552. ])
  3553. #
  3554. if test "$tst_links_writev" = "yes"; then
  3555. AC_MSG_CHECKING([if writev is prototyped])
  3556. AC_EGREP_CPP([writev],[
  3557. $cares_includes_sys_uio
  3558. ],[
  3559. AC_MSG_RESULT([yes])
  3560. tst_proto_writev="yes"
  3561. ],[
  3562. AC_MSG_RESULT([no])
  3563. tst_proto_writev="no"
  3564. ])
  3565. fi
  3566. #
  3567. if test "$tst_proto_writev" = "yes"; then
  3568. AC_MSG_CHECKING([if writev is compilable])
  3569. AC_COMPILE_IFELSE([
  3570. AC_LANG_PROGRAM([[
  3571. $cares_includes_sys_uio
  3572. ]],[[
  3573. if(0 != writev(0, 0, 0))
  3574. return 1;
  3575. ]])
  3576. ],[
  3577. AC_MSG_RESULT([yes])
  3578. tst_compi_writev="yes"
  3579. ],[
  3580. AC_MSG_RESULT([no])
  3581. tst_compi_writev="no"
  3582. ])
  3583. fi
  3584. #
  3585. if test "$tst_compi_writev" = "yes"; then
  3586. AC_MSG_CHECKING([if writev usage allowed])
  3587. if test "x$cares_disallow_writev" != "xyes"; then
  3588. AC_MSG_RESULT([yes])
  3589. tst_allow_writev="yes"
  3590. else
  3591. AC_MSG_RESULT([no])
  3592. tst_allow_writev="no"
  3593. fi
  3594. fi
  3595. #
  3596. AC_MSG_CHECKING([if writev might be used])
  3597. if test "$tst_links_writev" = "yes" &&
  3598. test "$tst_proto_writev" = "yes" &&
  3599. test "$tst_compi_writev" = "yes" &&
  3600. test "$tst_allow_writev" = "yes"; then
  3601. AC_MSG_RESULT([yes])
  3602. AC_DEFINE_UNQUOTED(HAVE_WRITEV, 1,
  3603. [Define to 1 if you have the writev function.])
  3604. ac_cv_func_writev="yes"
  3605. else
  3606. AC_MSG_RESULT([no])
  3607. ac_cv_func_writev="no"
  3608. fi
  3609. ])