tcl.m4 130 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117
  1. # tcl.m4 --
  2. #
  3. # This file provides a set of autoconf macros to help TEA-enable
  4. # a Tcl extension.
  5. #
  6. # Copyright (c) 1999-2000 Ajuba Solutions.
  7. # Copyright (c) 2002-2005 ActiveState Corporation.
  8. #
  9. # See the file "license.terms" for information on usage and redistribution
  10. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  11. AC_PREREQ([2.69])
  12. # Possible values for key variables defined:
  13. #
  14. # TEA_WINDOWINGSYSTEM - win32 aqua x11 (mirrors 'tk windowingsystem')
  15. # TEA_PLATFORM - windows unix
  16. # TEA_TK_EXTENSION - True if this is a Tk extension
  17. #
  18. #------------------------------------------------------------------------
  19. # TEA_PATH_TCLCONFIG --
  20. #
  21. # Locate the tclConfig.sh file and perform a sanity check on
  22. # the Tcl compile flags
  23. #
  24. # Arguments:
  25. # none
  26. #
  27. # Results:
  28. #
  29. # Adds the following arguments to configure:
  30. # --with-tcl=...
  31. #
  32. # Defines the following vars:
  33. # TCL_BIN_DIR Full path to the directory containing
  34. # the tclConfig.sh file
  35. #------------------------------------------------------------------------
  36. AC_DEFUN([TEA_PATH_TCLCONFIG], [
  37. dnl TEA specific: Make sure we are initialized
  38. AC_REQUIRE([TEA_INIT])
  39. #
  40. # Ok, lets find the tcl configuration
  41. # First, look for one uninstalled.
  42. # the alternative search directory is invoked by --with-tcl
  43. #
  44. if test x"${no_tcl}" = x ; then
  45. # we reset no_tcl in case something fails here
  46. no_tcl=true
  47. AC_ARG_WITH(tcl,
  48. AS_HELP_STRING([--with-tcl],
  49. [directory containing tcl configuration (tclConfig.sh)]),
  50. [with_tclconfig="${withval}"])
  51. AC_ARG_WITH(tcl8,
  52. AS_HELP_STRING([--with-tcl8],
  53. [Compile for Tcl8 in Tcl9 environment]),
  54. [with_tcl8="${withval}"])
  55. AC_MSG_CHECKING([for Tcl configuration])
  56. AC_CACHE_VAL(ac_cv_c_tclconfig,[
  57. # First check to see if --with-tcl was specified.
  58. if test x"${with_tclconfig}" != x ; then
  59. case "${with_tclconfig}" in
  60. */tclConfig.sh )
  61. if test -f "${with_tclconfig}"; then
  62. AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
  63. with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
  64. fi ;;
  65. esac
  66. if test -f "${with_tclconfig}/tclConfig.sh" ; then
  67. ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
  68. else
  69. AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
  70. fi
  71. fi
  72. # then check for a private Tcl installation
  73. if test x"${ac_cv_c_tclconfig}" = x ; then
  74. for i in \
  75. ../tcl \
  76. `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  77. `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
  78. `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
  79. ../../tcl \
  80. `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  81. `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
  82. `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
  83. ../../../tcl \
  84. `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  85. `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
  86. `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
  87. if test "${TEA_PLATFORM}" = "windows" \
  88. -a -f "$i/win/tclConfig.sh" ; then
  89. ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
  90. break
  91. fi
  92. if test -f "$i/unix/tclConfig.sh" ; then
  93. ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
  94. break
  95. fi
  96. done
  97. fi
  98. # on Darwin, check in Framework installation locations
  99. if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
  100. for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
  101. `ls -d /Library/Frameworks 2>/dev/null` \
  102. `ls -d /Network/Library/Frameworks 2>/dev/null` \
  103. `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks/Tcl.framework 2>/dev/null` \
  104. `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Network/Library/Frameworks/Tcl.framework 2>/dev/null` \
  105. `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework 2>/dev/null` \
  106. ; do
  107. if test -f "$i/Tcl.framework/tclConfig.sh" ; then
  108. ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`"
  109. break
  110. fi
  111. done
  112. fi
  113. # TEA specific: on Windows, check in common installation locations
  114. if test "${TEA_PLATFORM}" = "windows" \
  115. -a x"${ac_cv_c_tclconfig}" = x ; then
  116. for i in `ls -d C:/Tcl/lib 2>/dev/null` \
  117. `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
  118. ; do
  119. if test -f "$i/tclConfig.sh" ; then
  120. ac_cv_c_tclconfig="`(cd $i; pwd)`"
  121. break
  122. fi
  123. done
  124. fi
  125. # check in a few common install locations
  126. if test x"${ac_cv_c_tclconfig}" = x ; then
  127. for i in `ls -d ${libdir} 2>/dev/null` \
  128. `ls -d ${exec_prefix}/lib 2>/dev/null` \
  129. `ls -d ${prefix}/lib 2>/dev/null` \
  130. `ls -d /usr/local/lib 2>/dev/null` \
  131. `ls -d /usr/contrib/lib 2>/dev/null` \
  132. `ls -d /usr/pkg/lib 2>/dev/null` \
  133. `ls -d /usr/lib 2>/dev/null` \
  134. `ls -d /usr/lib64 2>/dev/null` \
  135. `ls -d /usr/lib/tcl9.0 2>/dev/null` \
  136. `ls -d /usr/lib/tcl8.7 2>/dev/null` \
  137. `ls -d /usr/lib/tcl8.6 2>/dev/null` \
  138. `ls -d /usr/lib/tcl8.5 2>/dev/null` \
  139. `ls -d /usr/local/lib/tcl9.0 2>/dev/null` \
  140. `ls -d /usr/local/lib/tcl8.7 2>/dev/null` \
  141. `ls -d /usr/local/lib/tcl8.6 2>/dev/null` \
  142. `ls -d /usr/local/lib/tcl8.5 2>/dev/null` \
  143. `ls -d /usr/local/lib/tcl/tcl9.0 2>/dev/null` \
  144. `ls -d /usr/local/lib/tcl/tcl8.7 2>/dev/null` \
  145. `ls -d /usr/local/lib/tcl/tcl8.6 2>/dev/null` \
  146. `ls -d /usr/local/lib/tcl/tcl8.5 2>/dev/null` \
  147. ; do
  148. if test -f "$i/tclConfig.sh" ; then
  149. ac_cv_c_tclconfig="`(cd $i; pwd)`"
  150. break
  151. fi
  152. done
  153. fi
  154. # check in a few other private locations
  155. if test x"${ac_cv_c_tclconfig}" = x ; then
  156. for i in \
  157. ${srcdir}/../tcl \
  158. `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  159. `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
  160. `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
  161. if test "${TEA_PLATFORM}" = "windows" \
  162. -a -f "$i/win/tclConfig.sh" ; then
  163. ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
  164. break
  165. fi
  166. if test -f "$i/unix/tclConfig.sh" ; then
  167. ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
  168. break
  169. fi
  170. done
  171. fi
  172. ])
  173. if test x"${ac_cv_c_tclconfig}" = x ; then
  174. TCL_BIN_DIR="# no Tcl configs found"
  175. AC_MSG_ERROR([Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh])
  176. else
  177. no_tcl=
  178. TCL_BIN_DIR="${ac_cv_c_tclconfig}"
  179. AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
  180. fi
  181. fi
  182. ])
  183. #------------------------------------------------------------------------
  184. # TEA_PATH_TKCONFIG --
  185. #
  186. # Locate the tkConfig.sh file
  187. #
  188. # Arguments:
  189. # none
  190. #
  191. # Results:
  192. #
  193. # Adds the following arguments to configure:
  194. # --with-tk=...
  195. #
  196. # Defines the following vars:
  197. # TK_BIN_DIR Full path to the directory containing
  198. # the tkConfig.sh file
  199. #------------------------------------------------------------------------
  200. AC_DEFUN([TEA_PATH_TKCONFIG], [
  201. #
  202. # Ok, lets find the tk configuration
  203. # First, look for one uninstalled.
  204. # the alternative search directory is invoked by --with-tk
  205. #
  206. if test x"${no_tk}" = x ; then
  207. # we reset no_tk in case something fails here
  208. no_tk=true
  209. AC_ARG_WITH(tk,
  210. AS_HELP_STRING([--with-tk],
  211. [directory containing tk configuration (tkConfig.sh)]),
  212. [with_tkconfig="${withval}"])
  213. AC_ARG_WITH(tk8,
  214. AS_HELP_STRING([--with-tk8],
  215. [Compile for Tk8 in Tk9 environment]),
  216. [with_tk8="${withval}"])
  217. AC_MSG_CHECKING([for Tk configuration])
  218. AC_CACHE_VAL(ac_cv_c_tkconfig,[
  219. # First check to see if --with-tkconfig was specified.
  220. if test x"${with_tkconfig}" != x ; then
  221. case "${with_tkconfig}" in
  222. */tkConfig.sh )
  223. if test -f "${with_tkconfig}"; then
  224. AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself])
  225. with_tkconfig="`echo "${with_tkconfig}" | sed 's!/tkConfig\.sh$!!'`"
  226. fi ;;
  227. esac
  228. if test -f "${with_tkconfig}/tkConfig.sh" ; then
  229. ac_cv_c_tkconfig="`(cd "${with_tkconfig}"; pwd)`"
  230. else
  231. AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
  232. fi
  233. fi
  234. # then check for a private Tk library
  235. if test x"${ac_cv_c_tkconfig}" = x ; then
  236. for i in \
  237. ../tk \
  238. `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  239. `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
  240. `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
  241. ../../tk \
  242. `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  243. `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
  244. `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
  245. ../../../tk \
  246. `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  247. `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
  248. `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
  249. if test "${TEA_PLATFORM}" = "windows" \
  250. -a -f "$i/win/tkConfig.sh" ; then
  251. ac_cv_c_tkconfig="`(cd $i/win; pwd)`"
  252. break
  253. fi
  254. if test -f "$i/unix/tkConfig.sh" ; then
  255. ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
  256. break
  257. fi
  258. done
  259. fi
  260. # on Darwin, check in Framework installation locations
  261. if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
  262. for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
  263. `ls -d /Library/Frameworks 2>/dev/null` \
  264. `ls -d /Network/Library/Frameworks 2>/dev/null` \
  265. ; do
  266. if test -f "$i/Tk.framework/tkConfig.sh" ; then
  267. ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`"
  268. break
  269. fi
  270. done
  271. fi
  272. # check in a few common install locations
  273. if test x"${ac_cv_c_tkconfig}" = x ; then
  274. for i in `ls -d ${libdir} 2>/dev/null` \
  275. `ls -d ${exec_prefix}/lib 2>/dev/null` \
  276. `ls -d ${prefix}/lib 2>/dev/null` \
  277. `ls -d /usr/local/lib 2>/dev/null` \
  278. `ls -d /usr/contrib/lib 2>/dev/null` \
  279. `ls -d /usr/pkg/lib 2>/dev/null` \
  280. `ls -d /usr/lib/tk9.0 2>/dev/null` \
  281. `ls -d /usr/lib/tk8.7 2>/dev/null` \
  282. `ls -d /usr/lib/tk8.6 2>/dev/null` \
  283. `ls -d /usr/lib/tk8.5 2>/dev/null` \
  284. `ls -d /usr/lib 2>/dev/null` \
  285. `ls -d /usr/lib64 2>/dev/null` \
  286. `ls -d /usr/local/lib/tk9.0 2>/dev/null` \
  287. `ls -d /usr/local/lib/tk8.7 2>/dev/null` \
  288. `ls -d /usr/local/lib/tk8.6 2>/dev/null` \
  289. `ls -d /usr/local/lib/tk8.5 2>/dev/null` \
  290. `ls -d /usr/local/lib/tcl/tk9.0 2>/dev/null` \
  291. `ls -d /usr/local/lib/tcl/tk8.7 2>/dev/null` \
  292. `ls -d /usr/local/lib/tcl/tk8.6 2>/dev/null` \
  293. `ls -d /usr/local/lib/tcl/tk8.5 2>/dev/null` \
  294. ; do
  295. if test -f "$i/tkConfig.sh" ; then
  296. ac_cv_c_tkconfig="`(cd $i; pwd)`"
  297. break
  298. fi
  299. done
  300. fi
  301. # TEA specific: on Windows, check in common installation locations
  302. if test "${TEA_PLATFORM}" = "windows" \
  303. -a x"${ac_cv_c_tkconfig}" = x ; then
  304. for i in `ls -d C:/Tcl/lib 2>/dev/null` \
  305. `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
  306. ; do
  307. if test -f "$i/tkConfig.sh" ; then
  308. ac_cv_c_tkconfig="`(cd $i; pwd)`"
  309. break
  310. fi
  311. done
  312. fi
  313. # check in a few other private locations
  314. if test x"${ac_cv_c_tkconfig}" = x ; then
  315. for i in \
  316. ${srcdir}/../tk \
  317. `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  318. `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
  319. `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
  320. if test "${TEA_PLATFORM}" = "windows" \
  321. -a -f "$i/win/tkConfig.sh" ; then
  322. ac_cv_c_tkconfig="`(cd $i/win; pwd)`"
  323. break
  324. fi
  325. if test -f "$i/unix/tkConfig.sh" ; then
  326. ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
  327. break
  328. fi
  329. done
  330. fi
  331. ])
  332. if test x"${ac_cv_c_tkconfig}" = x ; then
  333. TK_BIN_DIR="# no Tk configs found"
  334. AC_MSG_ERROR([Can't find Tk configuration definitions. Use --with-tk to specify a directory containing tkConfig.sh])
  335. else
  336. no_tk=
  337. TK_BIN_DIR="${ac_cv_c_tkconfig}"
  338. AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
  339. fi
  340. fi
  341. ])
  342. #------------------------------------------------------------------------
  343. # TEA_LOAD_TCLCONFIG --
  344. #
  345. # Load the tclConfig.sh file
  346. #
  347. # Arguments:
  348. #
  349. # Requires the following vars to be set:
  350. # TCL_BIN_DIR
  351. #
  352. # Results:
  353. #
  354. # Substitutes the following vars:
  355. # TCL_BIN_DIR
  356. # TCL_SRC_DIR
  357. # TCL_LIB_FILE
  358. # TCL_ZIP_FILE
  359. # TCL_ZIPFS_SUPPORT
  360. #------------------------------------------------------------------------
  361. AC_DEFUN([TEA_LOAD_TCLCONFIG], [
  362. AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
  363. if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
  364. AC_MSG_RESULT([loading])
  365. . "${TCL_BIN_DIR}/tclConfig.sh"
  366. else
  367. AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
  368. fi
  369. # If the TCL_BIN_DIR is the build directory (not the install directory),
  370. # then set the common variable name to the value of the build variables.
  371. # For example, the variable TCL_LIB_SPEC will be set to the value
  372. # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
  373. # instead of TCL_BUILD_LIB_SPEC since it will work with both an
  374. # installed and uninstalled version of Tcl.
  375. if test -f "${TCL_BIN_DIR}/Makefile" ; then
  376. TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
  377. TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
  378. TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
  379. elif test "`uname -s`" = "Darwin"; then
  380. # If Tcl was built as a framework, attempt to use the libraries
  381. # from the framework at the given location so that linking works
  382. # against Tcl.framework installed in an arbitrary location.
  383. case ${TCL_DEFS} in
  384. *TCL_FRAMEWORK*)
  385. if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then
  386. for i in "`cd "${TCL_BIN_DIR}"; pwd`" \
  387. "`cd "${TCL_BIN_DIR}"/../..; pwd`"; do
  388. if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
  389. TCL_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TCL_LIB_FILE}"
  390. break
  391. fi
  392. done
  393. fi
  394. if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then
  395. TCL_STUB_LIB_SPEC="-L`echo "${TCL_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TCL_STUB_LIB_FLAG}"
  396. TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
  397. fi
  398. ;;
  399. esac
  400. fi
  401. AC_SUBST(TCL_VERSION)
  402. AC_SUBST(TCL_PATCH_LEVEL)
  403. AC_SUBST(TCL_BIN_DIR)
  404. AC_SUBST(TCL_SRC_DIR)
  405. AC_SUBST(TCL_LIB_FILE)
  406. AC_SUBST(TCL_LIB_FLAG)
  407. AC_SUBST(TCL_LIB_SPEC)
  408. AC_SUBST(TCL_STUB_LIB_FILE)
  409. AC_SUBST(TCL_STUB_LIB_FLAG)
  410. AC_SUBST(TCL_STUB_LIB_SPEC)
  411. AC_MSG_CHECKING([platform])
  412. hold_cc=$CC; CC="$TCL_CC"
  413. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
  414. #ifdef _WIN32
  415. #error win32
  416. #endif
  417. ]])],[
  418. # first test we've already retrieved platform (cross-compile), fallback to unix otherwise:
  419. TEA_PLATFORM="${TEA_PLATFORM-unix}"
  420. CYGPATH=echo
  421. ],[
  422. TEA_PLATFORM="windows"
  423. AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo)
  424. ])
  425. CC=$hold_cc
  426. AC_MSG_RESULT($TEA_PLATFORM)
  427. # The BUILD_$pkg is to define the correct extern storage class
  428. # handling when making this package
  429. AC_DEFINE_UNQUOTED(BUILD_${PACKAGE_NAME}, [],
  430. [Building extension source?])
  431. # Do this here as we have fully defined TEA_PLATFORM now
  432. if test "${TEA_PLATFORM}" = "windows" ; then
  433. EXEEXT=".exe"
  434. CLEANFILES="$CLEANFILES *.lib *.dll *.pdb *.exp"
  435. fi
  436. # TEA specific:
  437. AC_SUBST(CLEANFILES)
  438. AC_SUBST(TCL_LIBS)
  439. AC_SUBST(TCL_DEFS)
  440. AC_SUBST(TCL_EXTRA_CFLAGS)
  441. AC_SUBST(TCL_LD_FLAGS)
  442. AC_SUBST(TCL_SHLIB_LD_LIBS)
  443. ])
  444. #------------------------------------------------------------------------
  445. # TEA_LOAD_TKCONFIG --
  446. #
  447. # Load the tkConfig.sh file
  448. #
  449. # Arguments:
  450. #
  451. # Requires the following vars to be set:
  452. # TK_BIN_DIR
  453. #
  454. # Results:
  455. #
  456. # Sets the following vars that should be in tkConfig.sh:
  457. # TK_BIN_DIR
  458. #------------------------------------------------------------------------
  459. AC_DEFUN([TEA_LOAD_TKCONFIG], [
  460. AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
  461. if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
  462. AC_MSG_RESULT([loading])
  463. . "${TK_BIN_DIR}/tkConfig.sh"
  464. else
  465. AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
  466. fi
  467. # If the TK_BIN_DIR is the build directory (not the install directory),
  468. # then set the common variable name to the value of the build variables.
  469. # For example, the variable TK_LIB_SPEC will be set to the value
  470. # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
  471. # instead of TK_BUILD_LIB_SPEC since it will work with both an
  472. # installed and uninstalled version of Tcl.
  473. if test -f "${TK_BIN_DIR}/Makefile" ; then
  474. TK_LIB_SPEC="${TK_BUILD_LIB_SPEC}"
  475. TK_STUB_LIB_SPEC="${TK_BUILD_STUB_LIB_SPEC}"
  476. TK_STUB_LIB_PATH="${TK_BUILD_STUB_LIB_PATH}"
  477. elif test "`uname -s`" = "Darwin"; then
  478. # If Tk was built as a framework, attempt to use the libraries
  479. # from the framework at the given location so that linking works
  480. # against Tk.framework installed in an arbitrary location.
  481. case ${TK_DEFS} in
  482. *TK_FRAMEWORK*)
  483. if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then
  484. for i in "`cd "${TK_BIN_DIR}"; pwd`" \
  485. "`cd "${TK_BIN_DIR}"/../..; pwd`"; do
  486. if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
  487. TK_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TK_LIB_FILE}"
  488. break
  489. fi
  490. done
  491. fi
  492. if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then
  493. TK_STUB_LIB_SPEC="-L` echo "${TK_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}"
  494. TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
  495. fi
  496. ;;
  497. esac
  498. fi
  499. # TEA specific: Ensure windowingsystem is defined
  500. if test "${TEA_PLATFORM}" = "unix" ; then
  501. case ${TK_DEFS} in
  502. *MAC_OSX_TK*)
  503. AC_DEFINE(MAC_OSX_TK, 1, [Are we building against Mac OS X TkAqua?])
  504. TEA_WINDOWINGSYSTEM="aqua"
  505. ;;
  506. *)
  507. TEA_WINDOWINGSYSTEM="x11"
  508. ;;
  509. esac
  510. elif test "${TEA_PLATFORM}" = "windows" ; then
  511. TEA_WINDOWINGSYSTEM="win32"
  512. fi
  513. AC_SUBST(TK_VERSION)
  514. AC_SUBST(TK_BIN_DIR)
  515. AC_SUBST(TK_SRC_DIR)
  516. AC_SUBST(TK_LIB_FILE)
  517. AC_SUBST(TK_LIB_FLAG)
  518. AC_SUBST(TK_LIB_SPEC)
  519. AC_SUBST(TK_STUB_LIB_FILE)
  520. AC_SUBST(TK_STUB_LIB_FLAG)
  521. AC_SUBST(TK_STUB_LIB_SPEC)
  522. # TEA specific:
  523. AC_SUBST(TK_LIBS)
  524. AC_SUBST(TK_XINCLUDES)
  525. ])
  526. #------------------------------------------------------------------------
  527. # TEA_PROG_TCLSH
  528. # Determine the fully qualified path name of the tclsh executable
  529. # in the Tcl build directory or the tclsh installed in a bin
  530. # directory. This macro will correctly determine the name
  531. # of the tclsh executable even if tclsh has not yet been
  532. # built in the build directory. The tclsh found is always
  533. # associated with a tclConfig.sh file. This tclsh should be used
  534. # only for running extension test cases. It should never be
  535. # or generation of files (like pkgIndex.tcl) at build time.
  536. #
  537. # Arguments:
  538. # none
  539. #
  540. # Results:
  541. # Substitutes the following vars:
  542. # TCLSH_PROG
  543. #------------------------------------------------------------------------
  544. AC_DEFUN([TEA_PROG_TCLSH], [
  545. AC_MSG_CHECKING([for tclsh])
  546. if test -f "${TCL_BIN_DIR}/Makefile" ; then
  547. # tclConfig.sh is in Tcl build directory
  548. if test "${TEA_PLATFORM}" = "windows"; then
  549. if test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${EXEEXT}" ; then
  550. TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${EXEEXT}"
  551. elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}s${EXEEXT}" ; then
  552. TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}s${EXEEXT}"
  553. elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}t${EXEEXT}" ; then
  554. TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}t${EXEEXT}"
  555. elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}st${EXEEXT}" ; then
  556. TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}st${EXEEXT}"
  557. fi
  558. else
  559. TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
  560. fi
  561. else
  562. # tclConfig.sh is in install location
  563. if test "${TEA_PLATFORM}" = "windows"; then
  564. TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${EXEEXT}"
  565. else
  566. TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}"
  567. fi
  568. list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \
  569. `ls -d ${TCL_BIN_DIR}/.. 2>/dev/null` \
  570. `ls -d ${TCL_PREFIX}/bin 2>/dev/null`"
  571. for i in $list ; do
  572. if test -f "$i/${TCLSH_PROG}" ; then
  573. REAL_TCL_BIN_DIR="`cd "$i"; pwd`/"
  574. break
  575. fi
  576. done
  577. TCLSH_PROG="${REAL_TCL_BIN_DIR}${TCLSH_PROG}"
  578. fi
  579. AC_MSG_RESULT([${TCLSH_PROG}])
  580. AC_SUBST(TCLSH_PROG)
  581. ])
  582. #------------------------------------------------------------------------
  583. # TEA_PROG_WISH
  584. # Determine the fully qualified path name of the wish executable
  585. # in the Tk build directory or the wish installed in a bin
  586. # directory. This macro will correctly determine the name
  587. # of the wish executable even if wish has not yet been
  588. # built in the build directory. The wish found is always
  589. # associated with a tkConfig.sh file. This wish should be used
  590. # only for running extension test cases. It should never be
  591. # or generation of files (like pkgIndex.tcl) at build time.
  592. #
  593. # Arguments:
  594. # none
  595. #
  596. # Results:
  597. # Substitutes the following vars:
  598. # WISH_PROG
  599. #------------------------------------------------------------------------
  600. AC_DEFUN([TEA_PROG_WISH], [
  601. AC_MSG_CHECKING([for wish])
  602. if test -f "${TK_BIN_DIR}/Makefile" ; then
  603. # tkConfig.sh is in Tk build directory
  604. if test "${TEA_PLATFORM}" = "windows"; then
  605. if test -f "${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${EXEEXT}" ; then
  606. WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${EXEEXT}"
  607. elif test -f "${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}s${EXEEXT}" ; then
  608. WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}$s{EXEEXT}"
  609. elif test -f "${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}t${EXEEXT}" ; then
  610. WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}t${EXEEXT}"
  611. elif test -f "${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}st${EXEEXT}" ; then
  612. WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}st${EXEEXT}"
  613. fi
  614. else
  615. WISH_PROG="${TK_BIN_DIR}/wish"
  616. fi
  617. else
  618. # tkConfig.sh is in install location
  619. if test "${TEA_PLATFORM}" = "windows"; then
  620. WISH_PROG="wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${EXEEXT}"
  621. else
  622. WISH_PROG="wish${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}"
  623. fi
  624. list="`ls -d ${TK_BIN_DIR}/../bin 2>/dev/null` \
  625. `ls -d ${TK_BIN_DIR}/.. 2>/dev/null` \
  626. `ls -d ${TK_PREFIX}/bin 2>/dev/null`"
  627. for i in $list ; do
  628. if test -f "$i/${WISH_PROG}" ; then
  629. REAL_TK_BIN_DIR="`cd "$i"; pwd`/"
  630. break
  631. fi
  632. done
  633. WISH_PROG="${REAL_TK_BIN_DIR}${WISH_PROG}"
  634. fi
  635. AC_MSG_RESULT([${WISH_PROG}])
  636. AC_SUBST(WISH_PROG)
  637. ])
  638. #------------------------------------------------------------------------
  639. # TEA_ENABLE_SHARED --
  640. #
  641. # Allows the building of shared libraries
  642. #
  643. # Arguments:
  644. # none
  645. #
  646. # Results:
  647. #
  648. # Adds the following arguments to configure:
  649. # --enable-shared=yes|no
  650. # --enable-stubs=yes|no
  651. #
  652. # Defines the following vars:
  653. # STATIC_BUILD Used for building import/export libraries
  654. # on Windows.
  655. #
  656. # Sets the following vars:
  657. # SHARED_BUILD Value of 1 or 0
  658. # STUBS_BUILD Value if 1 or 0
  659. # USE_TCL_STUBS Value true: if SHARED_BUILD or --enable-stubs
  660. # USE_TCLOO_STUBS Value true: if SHARED_BUILD or --enable-stubs
  661. # USE_TK_STUBS Value true: if SHARED_BUILD or --enable-stubs
  662. # AND TEA_WINDOWING_SYSTEM != ""
  663. #------------------------------------------------------------------------
  664. AC_DEFUN([TEA_ENABLE_SHARED], [
  665. AC_MSG_CHECKING([how to build libraries])
  666. AC_ARG_ENABLE(shared,
  667. AS_HELP_STRING([--enable-shared],
  668. [build and link with shared libraries (default: on)]),
  669. [shared_ok=$enableval], [shared_ok=yes])
  670. if test "${enable_shared+set}" = set; then
  671. enableval="$enable_shared"
  672. shared_ok=$enableval
  673. else
  674. shared_ok=yes
  675. fi
  676. AC_ARG_ENABLE(stubs,
  677. AS_HELP_STRING([--enable-stubs],
  678. [build and link with stub libraries. Always true for shared builds (default: on)]),
  679. [stubs_ok=$enableval], [stubs_ok=yes])
  680. if test "${enable_stubs+set}" = set; then
  681. enableval="$enable_stubs"
  682. stubs_ok=$enableval
  683. else
  684. stubs_ok=yes
  685. fi
  686. # Stubs are always enabled for shared builds
  687. if test "$shared_ok" = "yes" ; then
  688. AC_MSG_RESULT([shared])
  689. SHARED_BUILD=1
  690. STUBS_BUILD=1
  691. else
  692. AC_MSG_RESULT([static])
  693. SHARED_BUILD=0
  694. AC_DEFINE(STATIC_BUILD, 1, [This a static build])
  695. if test "$stubs_ok" = "yes" ; then
  696. STUBS_BUILD=1
  697. else
  698. STUBS_BUILD=0
  699. fi
  700. fi
  701. if test "${STUBS_BUILD}" = "1" ; then
  702. AC_DEFINE(USE_TCL_STUBS, 1, [Use Tcl stubs])
  703. AC_DEFINE(USE_TCLOO_STUBS, 1, [Use TclOO stubs])
  704. if test "${TEA_WINDOWINGSYSTEM}" != ""; then
  705. AC_DEFINE(USE_TK_STUBS, 1, [Use Tk stubs])
  706. fi
  707. fi
  708. AC_SUBST(SHARED_BUILD)
  709. AC_SUBST(STUBS_BUILD)
  710. ])
  711. #------------------------------------------------------------------------
  712. # TEA_ENABLE_THREADS --
  713. #
  714. # Specify if thread support should be enabled. If "yes" is specified
  715. # as an arg (optional), threads are enabled by default, "no" means
  716. # threads are disabled. "yes" is the default.
  717. #
  718. # TCL_THREADS is checked so that if you are compiling an extension
  719. # against a threaded core, your extension must be compiled threaded
  720. # as well.
  721. #
  722. # Note that it is legal to have a thread enabled extension run in a
  723. # threaded or non-threaded Tcl core, but a non-threaded extension may
  724. # only run in a non-threaded Tcl core.
  725. #
  726. # Arguments:
  727. # none
  728. #
  729. # Results:
  730. #
  731. # Adds the following arguments to configure:
  732. # --enable-threads
  733. #
  734. # Sets the following vars:
  735. # THREADS_LIBS Thread library(s)
  736. #
  737. # Defines the following vars:
  738. # TCL_THREADS
  739. # _REENTRANT
  740. # _THREAD_SAFE
  741. #------------------------------------------------------------------------
  742. AC_DEFUN([TEA_ENABLE_THREADS], [
  743. AC_ARG_ENABLE(threads,
  744. AS_HELP_STRING([--enable-threads],
  745. [build with threads (default: on)]),
  746. [tcl_ok=$enableval], [tcl_ok=yes])
  747. if test "${enable_threads+set}" = set; then
  748. enableval="$enable_threads"
  749. tcl_ok=$enableval
  750. else
  751. tcl_ok=yes
  752. fi
  753. if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
  754. TCL_THREADS=1
  755. if test "${TEA_PLATFORM}" != "windows" ; then
  756. # We are always OK on Windows, so check what this platform wants:
  757. # USE_THREAD_ALLOC tells us to try the special thread-based
  758. # allocator that significantly reduces lock contention
  759. AC_DEFINE(USE_THREAD_ALLOC, 1,
  760. [Do we want to use the threaded memory allocator?])
  761. AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
  762. if test "`uname -s`" = "SunOS" ; then
  763. AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
  764. [Do we really want to follow the standard? Yes we do!])
  765. fi
  766. AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
  767. AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
  768. if test "$tcl_ok" = "no"; then
  769. # Check a little harder for __pthread_mutex_init in the same
  770. # library, as some systems hide it there until pthread.h is
  771. # defined. We could alternatively do an AC_TRY_COMPILE with
  772. # pthread.h, but that will work with libpthread really doesn't
  773. # exist, like AIX 4.2. [Bug: 4359]
  774. AC_CHECK_LIB(pthread, __pthread_mutex_init,
  775. tcl_ok=yes, tcl_ok=no)
  776. fi
  777. if test "$tcl_ok" = "yes"; then
  778. # The space is needed
  779. THREADS_LIBS=" -lpthread"
  780. else
  781. AC_CHECK_LIB(pthreads, pthread_mutex_init,
  782. tcl_ok=yes, tcl_ok=no)
  783. if test "$tcl_ok" = "yes"; then
  784. # The space is needed
  785. THREADS_LIBS=" -lpthreads"
  786. else
  787. AC_CHECK_LIB(c, pthread_mutex_init,
  788. tcl_ok=yes, tcl_ok=no)
  789. if test "$tcl_ok" = "no"; then
  790. AC_CHECK_LIB(c_r, pthread_mutex_init,
  791. tcl_ok=yes, tcl_ok=no)
  792. if test "$tcl_ok" = "yes"; then
  793. # The space is needed
  794. THREADS_LIBS=" -pthread"
  795. else
  796. TCL_THREADS=0
  797. AC_MSG_WARN([Do not know how to find pthread lib on your system - thread support disabled])
  798. fi
  799. fi
  800. fi
  801. fi
  802. fi
  803. else
  804. TCL_THREADS=0
  805. fi
  806. # Do checking message here to not mess up interleaved configure output
  807. AC_MSG_CHECKING([for building with threads])
  808. if test "${TCL_THREADS}" = 1; then
  809. AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
  810. AC_MSG_RESULT([yes (default)])
  811. else
  812. AC_MSG_RESULT([no])
  813. fi
  814. # TCL_THREADS sanity checking. See if our request for building with
  815. # threads is the same as the way Tcl was built. If not, warn the user.
  816. case ${TCL_DEFS} in
  817. *THREADS=1*)
  818. if test "${TCL_THREADS}" = "0"; then
  819. AC_MSG_WARN([
  820. Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
  821. that IS thread-enabled. It is recommended to use --enable-threads.])
  822. fi
  823. ;;
  824. esac
  825. AC_SUBST(TCL_THREADS)
  826. ])
  827. #------------------------------------------------------------------------
  828. # TEA_ENABLE_SYMBOLS --
  829. #
  830. # Specify if debugging symbols should be used.
  831. # Memory (TCL_MEM_DEBUG) debugging can also be enabled.
  832. #
  833. # Arguments:
  834. # none
  835. #
  836. # TEA varies from core Tcl in that C|LDFLAGS_DEFAULT receives
  837. # the value of C|LDFLAGS_OPTIMIZE|DEBUG already substituted.
  838. # Requires the following vars to be set in the Makefile:
  839. # CFLAGS_DEFAULT
  840. # LDFLAGS_DEFAULT
  841. #
  842. # Results:
  843. #
  844. # Adds the following arguments to configure:
  845. # --enable-symbols
  846. #
  847. # Defines the following vars:
  848. # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
  849. # Sets to "$(CFLAGS_OPTIMIZE) -DNDEBUG" if false
  850. # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
  851. # Sets to $(LDFLAGS_OPTIMIZE) if false
  852. #------------------------------------------------------------------------
  853. AC_DEFUN([TEA_ENABLE_SYMBOLS], [
  854. dnl TEA specific: Make sure we are initialized
  855. AC_REQUIRE([TEA_CONFIG_CFLAGS])
  856. AC_MSG_CHECKING([for build with symbols])
  857. AC_ARG_ENABLE(symbols,
  858. AS_HELP_STRING([--enable-symbols],
  859. [build with debugging symbols (default: off)]),
  860. [tcl_ok=$enableval], [tcl_ok=no])
  861. if test "$tcl_ok" = "no"; then
  862. CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE} -DNDEBUG"
  863. LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
  864. AC_MSG_RESULT([no])
  865. AC_DEFINE(TCL_CFG_OPTIMIZED, 1, [Is this an optimized build?])
  866. else
  867. CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
  868. LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
  869. if test "$tcl_ok" = "yes"; then
  870. AC_MSG_RESULT([yes (standard debugging)])
  871. fi
  872. fi
  873. AC_SUBST(CFLAGS_DEFAULT)
  874. AC_SUBST(LDFLAGS_DEFAULT)
  875. if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
  876. AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
  877. fi
  878. if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
  879. if test "$tcl_ok" = "all"; then
  880. AC_MSG_RESULT([enabled symbols mem debugging])
  881. else
  882. AC_MSG_RESULT([enabled $tcl_ok debugging])
  883. fi
  884. fi
  885. ])
  886. #------------------------------------------------------------------------
  887. # TEA_ENABLE_LANGINFO --
  888. #
  889. # Allows use of modern nl_langinfo check for better l10n.
  890. # This is only relevant for Unix.
  891. #
  892. # Arguments:
  893. # none
  894. #
  895. # Results:
  896. #
  897. # Adds the following arguments to configure:
  898. # --enable-langinfo=yes|no (default is yes)
  899. #
  900. # Defines the following vars:
  901. # HAVE_LANGINFO Triggers use of nl_langinfo if defined.
  902. #------------------------------------------------------------------------
  903. AC_DEFUN([TEA_ENABLE_LANGINFO], [
  904. AC_ARG_ENABLE(langinfo,
  905. AS_HELP_STRING([--enable-langinfo],
  906. [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
  907. [langinfo_ok=$enableval], [langinfo_ok=yes])
  908. HAVE_LANGINFO=0
  909. if test "$langinfo_ok" = "yes"; then
  910. AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
  911. fi
  912. AC_MSG_CHECKING([whether to use nl_langinfo])
  913. if test "$langinfo_ok" = "yes"; then
  914. AC_CACHE_VAL(tcl_cv_langinfo_h, [
  915. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[nl_langinfo(CODESET);]])],
  916. [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
  917. AC_MSG_RESULT([$tcl_cv_langinfo_h])
  918. if test $tcl_cv_langinfo_h = yes; then
  919. AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?])
  920. fi
  921. else
  922. AC_MSG_RESULT([$langinfo_ok])
  923. fi
  924. ])
  925. #--------------------------------------------------------------------
  926. # TEA_CONFIG_SYSTEM
  927. #
  928. # Determine what the system is (some things cannot be easily checked
  929. # on a feature-driven basis, alas). This can usually be done via the
  930. # "uname" command.
  931. #
  932. # Arguments:
  933. # none
  934. #
  935. # Results:
  936. # Defines the following var:
  937. #
  938. # system - System/platform/version identification code.
  939. #
  940. #--------------------------------------------------------------------
  941. AC_DEFUN([TEA_CONFIG_SYSTEM], [
  942. AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
  943. # TEA specific:
  944. if test "${TEA_PLATFORM}" = "windows" ; then
  945. tcl_cv_sys_version=windows
  946. else
  947. tcl_cv_sys_version=`uname -s`-`uname -r`
  948. if test "$?" -ne 0 ; then
  949. AC_MSG_WARN([can't find uname command])
  950. tcl_cv_sys_version=unknown
  951. else
  952. if test "`uname -s`" = "AIX" ; then
  953. tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
  954. fi
  955. if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then
  956. tcl_cv_sys_version=NetBSD-Debian
  957. fi
  958. fi
  959. fi
  960. ])
  961. system=$tcl_cv_sys_version
  962. ])
  963. #--------------------------------------------------------------------
  964. # TEA_CONFIG_CFLAGS
  965. #
  966. # Try to determine the proper flags to pass to the compiler
  967. # for building shared libraries and other such nonsense.
  968. #
  969. # Arguments:
  970. # none
  971. #
  972. # Results:
  973. #
  974. # Defines and substitutes the following vars:
  975. #
  976. # DL_OBJS, DL_LIBS - removed for TEA, only needed by core.
  977. # LDFLAGS - Flags to pass to the compiler when linking object
  978. # files into an executable application binary such
  979. # as tclsh.
  980. # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
  981. # that tell the run-time dynamic linker where to look
  982. # for shared libraries such as libtcl.so. Depends on
  983. # the variable LIB_RUNTIME_DIR in the Makefile. Could
  984. # be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
  985. # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
  986. # that tell the run-time dynamic linker where to look
  987. # for shared libraries such as libtcl.so. Depends on
  988. # the variable LIB_RUNTIME_DIR in the Makefile.
  989. # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
  990. # of a shared library (may request position-independent
  991. # code, among other things).
  992. # SHLIB_LD - Base command to use for combining object files
  993. # into a shared library.
  994. # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
  995. # creating shared libraries. This symbol typically
  996. # goes at the end of the "ld" commands that build
  997. # shared libraries. The value of the symbol defaults to
  998. # "${LIBS}" if all of the dependent libraries should
  999. # be specified when creating a shared library. If
  1000. # dependent libraries should not be specified (as on
  1001. # SunOS 4.x, where they cause the link to fail, or in
  1002. # general if Tcl and Tk aren't themselves shared
  1003. # libraries), then this symbol has an empty string
  1004. # as its value.
  1005. # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
  1006. # extensions. An empty string means we don't know how
  1007. # to use shared libraries on this platform.
  1008. # LIB_SUFFIX - Specifies everything that comes after the "libfoo"
  1009. # in a static or shared library name, using the $PACKAGE_VERSION variable
  1010. # to put the version in the right place. This is used
  1011. # by platforms that need non-standard library names.
  1012. # Examples: ${PACKAGE_VERSION}.so.1.1 on NetBSD, since it needs
  1013. # to have a version after the .so, and ${PACKAGE_VERSION}.a
  1014. # on AIX, since a shared library needs to have
  1015. # a .a extension whereas shared objects for loadable
  1016. # extensions have a .so extension. Defaults to
  1017. # ${PACKAGE_VERSION}${SHLIB_SUFFIX}.
  1018. # CFLAGS_DEBUG -
  1019. # Flags used when running the compiler in debug mode
  1020. # CFLAGS_OPTIMIZE -
  1021. # Flags used when running the compiler in optimize mode
  1022. # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
  1023. #--------------------------------------------------------------------
  1024. AC_DEFUN([TEA_CONFIG_CFLAGS], [
  1025. dnl TEA specific: Make sure we are initialized
  1026. AC_REQUIRE([TEA_INIT])
  1027. # Step 0.a: Enable 64 bit support?
  1028. AC_MSG_CHECKING([if 64bit support is requested])
  1029. AC_ARG_ENABLE(64bit,
  1030. AS_HELP_STRING([--enable-64bit],
  1031. [enable 64bit support (default: off)]),
  1032. [do64bit=$enableval], [do64bit=no])
  1033. AC_MSG_RESULT([$do64bit])
  1034. # Step 0.b: Enable Solaris 64 bit VIS support?
  1035. AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
  1036. AC_ARG_ENABLE(64bit-vis,
  1037. AS_HELP_STRING([--enable-64bit-vis],
  1038. [enable 64bit Sparc VIS support (default: off)]),
  1039. [do64bitVIS=$enableval], [do64bitVIS=no])
  1040. AC_MSG_RESULT([$do64bitVIS])
  1041. # Force 64bit on with VIS
  1042. AS_IF([test "$do64bitVIS" = "yes"], [do64bit=yes])
  1043. # Step 0.c: Check if visibility support is available. Do this here so
  1044. # that platform specific alternatives can be used below if this fails.
  1045. AC_CACHE_CHECK([if compiler supports visibility "hidden"],
  1046. tcl_cv_cc_visibility_hidden, [
  1047. hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
  1048. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  1049. extern __attribute__((__visibility__("hidden"))) void f(void);
  1050. void f(void) {}]], [[f();]])],[tcl_cv_cc_visibility_hidden=yes],
  1051. [tcl_cv_cc_visibility_hidden=no])
  1052. CFLAGS=$hold_cflags])
  1053. AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [
  1054. AC_DEFINE(MODULE_SCOPE,
  1055. [extern __attribute__((__visibility__("hidden")))],
  1056. [Compiler support for module scope symbols])
  1057. AC_DEFINE(HAVE_HIDDEN, [1], [Compiler support for module scope symbols])
  1058. ])
  1059. # Step 0.d: Disable -rpath support?
  1060. AC_MSG_CHECKING([if rpath support is requested])
  1061. AC_ARG_ENABLE(rpath,
  1062. AS_HELP_STRING([--disable-rpath],
  1063. [disable rpath support (default: on)]),
  1064. [doRpath=$enableval], [doRpath=yes])
  1065. AC_MSG_RESULT([$doRpath])
  1066. # Set the variable "system" to hold the name and version number
  1067. # for the system.
  1068. TEA_CONFIG_SYSTEM
  1069. # Require ranlib early so we can override it in special cases below.
  1070. AC_REQUIRE([AC_PROG_RANLIB])
  1071. # Set configuration options based on system name and version.
  1072. # This is similar to Tcl's unix/tcl.m4 except that we've added a
  1073. # "windows" case and removed some core-only vars.
  1074. do64bit_ok=no
  1075. # default to '{$LIBS}' and set to "" on per-platform necessary basis
  1076. SHLIB_LD_LIBS='${LIBS}'
  1077. # When ld needs options to work in 64-bit mode, put them in
  1078. # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
  1079. # is disabled by the user. [Bug 1016796]
  1080. LDFLAGS_ARCH=""
  1081. UNSHARED_LIB_SUFFIX=""
  1082. # TEA specific: use PACKAGE_VERSION instead of VERSION
  1083. TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`'
  1084. ECHO_VERSION='`echo ${PACKAGE_VERSION}`'
  1085. TCL_LIB_VERSIONS_OK=ok
  1086. CFLAGS_DEBUG=-g
  1087. AS_IF([test "$GCC" = yes], [
  1088. CFLAGS_OPTIMIZE=-O2
  1089. CFLAGS_WARNING="-Wall"
  1090. ], [
  1091. CFLAGS_OPTIMIZE=-O
  1092. CFLAGS_WARNING=""
  1093. ])
  1094. AC_CHECK_TOOL(AR, ar)
  1095. STLIB_LD='${AR} cr'
  1096. LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
  1097. AS_IF([test "x$SHLIB_VERSION" = x],[SHLIB_VERSION=""],[SHLIB_VERSION=".$SHLIB_VERSION"])
  1098. case $system in
  1099. # TEA specific:
  1100. windows)
  1101. MACHINE="X86"
  1102. if test "$do64bit" != "no" ; then
  1103. case "$do64bit" in
  1104. amd64|x64|yes)
  1105. MACHINE="AMD64" ; # default to AMD64 64-bit build
  1106. ;;
  1107. arm64|aarch64)
  1108. MACHINE="ARM64"
  1109. ;;
  1110. ia64)
  1111. MACHINE="IA64"
  1112. ;;
  1113. esac
  1114. fi
  1115. if test "$GCC" != "yes" ; then
  1116. if test "${SHARED_BUILD}" = "0" ; then
  1117. runtime=-MT
  1118. else
  1119. runtime=-MD
  1120. fi
  1121. case "x`echo \${VisualStudioVersion}`" in
  1122. x1[[4-9]]*)
  1123. lflags="${lflags} -nodefaultlib:libucrt.lib"
  1124. TEA_ADD_LIBS([ucrt.lib])
  1125. ;;
  1126. *)
  1127. ;;
  1128. esac
  1129. if test "$do64bit" != "no" ; then
  1130. CC="cl.exe"
  1131. RC="rc.exe"
  1132. lflags="${lflags} -nologo -MACHINE:${MACHINE} "
  1133. LINKBIN="link.exe"
  1134. CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
  1135. CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
  1136. # Avoid 'unresolved external symbol __security_cookie'
  1137. # errors, c.f. http://support.microsoft.com/?id=894573
  1138. TEA_ADD_LIBS([bufferoverflowU.lib])
  1139. else
  1140. RC="rc"
  1141. lflags="${lflags} -nologo"
  1142. LINKBIN="link"
  1143. CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
  1144. CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
  1145. fi
  1146. fi
  1147. if test "$GCC" = "yes"; then
  1148. # mingw gcc mode
  1149. AC_CHECK_TOOL(RC, windres)
  1150. CFLAGS_DEBUG="-g"
  1151. CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
  1152. SHLIB_LD='${CC} -shared'
  1153. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  1154. LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
  1155. LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"
  1156. AC_CACHE_CHECK(for cross-compile version of gcc,
  1157. ac_cv_cross,
  1158. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1159. #ifdef _WIN32
  1160. #error cross-compiler
  1161. #endif
  1162. ]], [[]])],
  1163. [ac_cv_cross=yes],
  1164. [ac_cv_cross=no])
  1165. )
  1166. if test "$ac_cv_cross" = "yes"; then
  1167. case "$do64bit" in
  1168. amd64|x64|yes)
  1169. CC="x86_64-w64-mingw32-${CC}"
  1170. LD="x86_64-w64-mingw32-ld"
  1171. AR="x86_64-w64-mingw32-ar"
  1172. RANLIB="x86_64-w64-mingw32-ranlib"
  1173. RC="x86_64-w64-mingw32-windres"
  1174. ;;
  1175. arm64|aarch64)
  1176. CC="aarch64-w64-mingw32-clang"
  1177. LD="aarch64-w64-mingw32-ld"
  1178. AR="aarch64-w64-mingw32-ar"
  1179. RANLIB="aarch64-w64-mingw32-ranlib"
  1180. RC="aarch64-w64-mingw32-windres"
  1181. ;;
  1182. *)
  1183. CC="i686-w64-mingw32-${CC}"
  1184. LD="i686-w64-mingw32-ld"
  1185. AR="i686-w64-mingw32-ar"
  1186. RANLIB="i686-w64-mingw32-ranlib"
  1187. RC="i686-w64-mingw32-windres"
  1188. ;;
  1189. esac
  1190. fi
  1191. else
  1192. SHLIB_LD="${LINKBIN} -dll ${lflags}"
  1193. # link -lib only works when -lib is the first arg
  1194. STLIB_LD="${LINKBIN} -lib ${lflags}"
  1195. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib'
  1196. PATHTYPE=-w
  1197. # For information on what debugtype is most useful, see:
  1198. # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp
  1199. # and also
  1200. # http://msdn2.microsoft.com/en-us/library/y0zzbyt4%28VS.80%29.aspx
  1201. # This essentially turns it all on.
  1202. LDFLAGS_DEBUG="-debug -debugtype:cv"
  1203. LDFLAGS_OPTIMIZE="-release"
  1204. LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
  1205. LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
  1206. fi
  1207. SHLIB_SUFFIX=".dll"
  1208. SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'
  1209. TCL_LIB_VERSIONS_OK=nodots
  1210. ;;
  1211. AIX-*)
  1212. AS_IF([test "$GCC" != "yes"], [
  1213. # AIX requires the _r compiler when gcc isn't being used
  1214. case "${CC}" in
  1215. *_r|*_r\ *)
  1216. # ok ...
  1217. ;;
  1218. *)
  1219. # Make sure only first arg gets _r
  1220. CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'`
  1221. ;;
  1222. esac
  1223. AC_MSG_RESULT([Using $CC for compiling with threads])
  1224. ])
  1225. LIBS="$LIBS -lc"
  1226. SHLIB_CFLAGS=""
  1227. SHLIB_SUFFIX=".so"
  1228. LD_LIBRARY_PATH_VAR="LIBPATH"
  1229. # Check to enable 64-bit flags for compiler/linker
  1230. AS_IF([test "$do64bit" = yes], [
  1231. AS_IF([test "$GCC" = yes], [
  1232. AC_MSG_WARN([64bit mode not supported with GCC on $system])
  1233. ], [
  1234. do64bit_ok=yes
  1235. CFLAGS="$CFLAGS -q64"
  1236. LDFLAGS_ARCH="-q64"
  1237. RANLIB="${RANLIB} -X64"
  1238. AR="${AR} -X64"
  1239. SHLIB_LD_FLAGS="-b64"
  1240. ])
  1241. ])
  1242. AS_IF([test "`uname -m`" = ia64], [
  1243. # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
  1244. SHLIB_LD="/usr/ccs/bin/ld -G -z text"
  1245. AS_IF([test "$GCC" = yes], [
  1246. CC_SEARCH_FLAGS='"-Wl,-R,${LIB_RUNTIME_DIR}"'
  1247. ], [
  1248. CC_SEARCH_FLAGS='"-R${LIB_RUNTIME_DIR}"'
  1249. ])
  1250. LD_SEARCH_FLAGS='-R "${LIB_RUNTIME_DIR}"'
  1251. ], [
  1252. AS_IF([test "$GCC" = yes], [
  1253. SHLIB_LD='${CC} -shared -Wl,-bexpall'
  1254. ], [
  1255. SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry"
  1256. LDFLAGS="$LDFLAGS -brtl"
  1257. ])
  1258. SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}"
  1259. CC_SEARCH_FLAGS='"-L${LIB_RUNTIME_DIR}"'
  1260. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1261. ])
  1262. ;;
  1263. BeOS*)
  1264. SHLIB_CFLAGS="-fPIC"
  1265. SHLIB_LD='${CC} -nostart'
  1266. SHLIB_SUFFIX=".so"
  1267. #-----------------------------------------------------------
  1268. # Check for inet_ntoa in -lbind, for BeOS (which also needs
  1269. # -lsocket, even if the network functions are in -lnet which
  1270. # is always linked to, for compatibility.
  1271. #-----------------------------------------------------------
  1272. AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
  1273. ;;
  1274. BSD/OS-2.1*|BSD/OS-3*)
  1275. SHLIB_CFLAGS=""
  1276. SHLIB_LD="shlicc -r"
  1277. SHLIB_SUFFIX=".so"
  1278. CC_SEARCH_FLAGS=""
  1279. LD_SEARCH_FLAGS=""
  1280. ;;
  1281. BSD/OS-4.*)
  1282. SHLIB_CFLAGS="-export-dynamic -fPIC"
  1283. SHLIB_LD='${CC} -shared'
  1284. SHLIB_SUFFIX=".so"
  1285. LDFLAGS="$LDFLAGS -export-dynamic"
  1286. CC_SEARCH_FLAGS=""
  1287. LD_SEARCH_FLAGS=""
  1288. ;;
  1289. CYGWIN_*)
  1290. SHLIB_CFLAGS=""
  1291. SHLIB_LD='${CC} -shared'
  1292. SHLIB_SUFFIX=".dll"
  1293. SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$[@].a"
  1294. EXEEXT=".exe"
  1295. do64bit_ok=yes
  1296. CC_SEARCH_FLAGS=""
  1297. LD_SEARCH_FLAGS=""
  1298. ;;
  1299. dgux*)
  1300. SHLIB_CFLAGS="-K PIC"
  1301. SHLIB_LD='${CC} -G'
  1302. SHLIB_LD_LIBS=""
  1303. SHLIB_SUFFIX=".so"
  1304. CC_SEARCH_FLAGS=""
  1305. LD_SEARCH_FLAGS=""
  1306. ;;
  1307. Haiku*)
  1308. LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
  1309. SHLIB_CFLAGS="-fPIC"
  1310. SHLIB_SUFFIX=".so"
  1311. SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared'
  1312. AC_CHECK_LIB(network, inet_ntoa, [LIBS="$LIBS -lnetwork"])
  1313. ;;
  1314. HP-UX-*.11.*)
  1315. # Use updated header definitions where possible
  1316. AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?])
  1317. # TEA specific: Needed by Tcl, but not most extensions
  1318. #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
  1319. #LIBS="$LIBS -lxnet" # Use the XOPEN network library
  1320. AS_IF([test "`uname -m`" = ia64], [
  1321. SHLIB_SUFFIX=".so"
  1322. ], [
  1323. SHLIB_SUFFIX=".sl"
  1324. ])
  1325. AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
  1326. AS_IF([test "$tcl_ok" = yes], [
  1327. SHLIB_CFLAGS="+z"
  1328. SHLIB_LD="ld -b"
  1329. LDFLAGS="$LDFLAGS -Wl,-E"
  1330. CC_SEARCH_FLAGS='"-Wl,+s,+b,${LIB_RUNTIME_DIR}:."'
  1331. LD_SEARCH_FLAGS='+s +b "${LIB_RUNTIME_DIR}:."'
  1332. LD_LIBRARY_PATH_VAR="SHLIB_PATH"
  1333. ])
  1334. AS_IF([test "$GCC" = yes], [
  1335. SHLIB_LD='${CC} -shared'
  1336. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1337. ], [
  1338. CFLAGS="$CFLAGS -z"
  1339. ])
  1340. # Check to enable 64-bit flags for compiler/linker
  1341. AS_IF([test "$do64bit" = "yes"], [
  1342. AS_IF([test "$GCC" = yes], [
  1343. case `${CC} -dumpmachine` in
  1344. hppa64*)
  1345. # 64-bit gcc in use. Fix flags for GNU ld.
  1346. do64bit_ok=yes
  1347. SHLIB_LD='${CC} -shared'
  1348. AS_IF([test $doRpath = yes], [
  1349. CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
  1350. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1351. ;;
  1352. *)
  1353. AC_MSG_WARN([64bit mode not supported with GCC on $system])
  1354. ;;
  1355. esac
  1356. ], [
  1357. do64bit_ok=yes
  1358. CFLAGS="$CFLAGS +DD64"
  1359. LDFLAGS_ARCH="+DD64"
  1360. ])
  1361. ]) ;;
  1362. HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
  1363. SHLIB_SUFFIX=".sl"
  1364. AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
  1365. AS_IF([test "$tcl_ok" = yes], [
  1366. SHLIB_CFLAGS="+z"
  1367. SHLIB_LD="ld -b"
  1368. SHLIB_LD_LIBS=""
  1369. LDFLAGS="$LDFLAGS -Wl,-E"
  1370. CC_SEARCH_FLAGS='"-Wl,+s,+b,${LIB_RUNTIME_DIR}:."'
  1371. LD_SEARCH_FLAGS='+s +b "${LIB_RUNTIME_DIR}:."'
  1372. LD_LIBRARY_PATH_VAR="SHLIB_PATH"
  1373. ]) ;;
  1374. IRIX-5.*)
  1375. SHLIB_CFLAGS=""
  1376. SHLIB_LD="ld -shared -rdata_shared"
  1377. SHLIB_SUFFIX=".so"
  1378. AC_LIBOBJ(mkstemp)
  1379. AS_IF([test $doRpath = yes], [
  1380. CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
  1381. LD_SEARCH_FLAGS='-rpath "${LIB_RUNTIME_DIR}"'])
  1382. ;;
  1383. IRIX-6.*)
  1384. SHLIB_CFLAGS=""
  1385. SHLIB_LD="ld -n32 -shared -rdata_shared"
  1386. SHLIB_SUFFIX=".so"
  1387. AS_IF([test $doRpath = yes], [
  1388. CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
  1389. LD_SEARCH_FLAGS='-rpath "${LIB_RUNTIME_DIR}"'])
  1390. AS_IF([test "$GCC" = yes], [
  1391. CFLAGS="$CFLAGS -mabi=n32"
  1392. LDFLAGS="$LDFLAGS -mabi=n32"
  1393. ], [
  1394. case $system in
  1395. IRIX-6.3)
  1396. # Use to build 6.2 compatible binaries on 6.3.
  1397. CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
  1398. ;;
  1399. *)
  1400. CFLAGS="$CFLAGS -n32"
  1401. ;;
  1402. esac
  1403. LDFLAGS="$LDFLAGS -n32"
  1404. ])
  1405. ;;
  1406. IRIX64-6.*)
  1407. SHLIB_CFLAGS=""
  1408. SHLIB_LD="ld -n32 -shared -rdata_shared"
  1409. SHLIB_SUFFIX=".so"
  1410. AS_IF([test $doRpath = yes], [
  1411. CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
  1412. LD_SEARCH_FLAGS='-rpath "${LIB_RUNTIME_DIR}"'])
  1413. # Check to enable 64-bit flags for compiler/linker
  1414. AS_IF([test "$do64bit" = yes], [
  1415. AS_IF([test "$GCC" = yes], [
  1416. AC_MSG_WARN([64bit mode not supported by gcc])
  1417. ], [
  1418. do64bit_ok=yes
  1419. SHLIB_LD="ld -64 -shared -rdata_shared"
  1420. CFLAGS="$CFLAGS -64"
  1421. LDFLAGS_ARCH="-64"
  1422. ])
  1423. ])
  1424. ;;
  1425. Linux*|GNU*|NetBSD-Debian|DragonFly-*|FreeBSD-*)
  1426. SHLIB_CFLAGS="-fPIC"
  1427. SHLIB_SUFFIX=".so"
  1428. # TEA specific:
  1429. CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
  1430. # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
  1431. SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS_DEFAULT} -shared'
  1432. LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
  1433. case $system in
  1434. DragonFly-*|FreeBSD-*)
  1435. AS_IF([test "${TCL_THREADS}" = "1"], [
  1436. # The -pthread needs to go in the LDFLAGS, not LIBS
  1437. LIBS=`echo $LIBS | sed s/-pthread//`
  1438. CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
  1439. LDFLAGS="$LDFLAGS $PTHREAD_LIBS"])
  1440. ;;
  1441. esac
  1442. AS_IF([test $doRpath = yes], [
  1443. CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
  1444. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1445. AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
  1446. AS_IF([test $do64bit = yes], [
  1447. AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
  1448. hold_cflags=$CFLAGS
  1449. CFLAGS="$CFLAGS -m64"
  1450. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  1451. [tcl_cv_cc_m64=yes],[tcl_cv_cc_m64=no])
  1452. CFLAGS=$hold_cflags])
  1453. AS_IF([test $tcl_cv_cc_m64 = yes], [
  1454. CFLAGS="$CFLAGS -m64"
  1455. do64bit_ok=yes
  1456. ])
  1457. ])
  1458. # The combo of gcc + glibc has a bug related to inlining of
  1459. # functions like strtod(). The -fno-builtin flag should address
  1460. # this problem but it does not work. The -fno-inline flag is kind
  1461. # of overkill but it works. Disable inlining only when one of the
  1462. # files in compat/*.c is being linked in.
  1463. AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"])
  1464. ;;
  1465. Lynx*)
  1466. SHLIB_CFLAGS="-fPIC"
  1467. SHLIB_SUFFIX=".so"
  1468. CFLAGS_OPTIMIZE=-02
  1469. SHLIB_LD='${CC} -shared'
  1470. LD_FLAGS="-Wl,--export-dynamic"
  1471. AS_IF([test $doRpath = yes], [
  1472. CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
  1473. LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
  1474. ;;
  1475. OpenBSD-*)
  1476. arch=`arch -s`
  1477. case "$arch" in
  1478. alpha|sparc64)
  1479. SHLIB_CFLAGS="-fPIC"
  1480. ;;
  1481. *)
  1482. SHLIB_CFLAGS="-fpic"
  1483. ;;
  1484. esac
  1485. SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared'
  1486. SHLIB_SUFFIX=".so"
  1487. AS_IF([test $doRpath = yes], [
  1488. CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
  1489. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1490. SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
  1491. LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
  1492. CFLAGS_OPTIMIZE="-O2"
  1493. # On OpenBSD: Compile with -pthread
  1494. # Don't link with -lpthread
  1495. LIBS=`echo $LIBS | sed s/-lpthread//`
  1496. CFLAGS="$CFLAGS -pthread"
  1497. # OpenBSD doesn't do version numbers with dots.
  1498. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  1499. TCL_LIB_VERSIONS_OK=nodots
  1500. ;;
  1501. NetBSD-*)
  1502. # NetBSD has ELF and can use 'cc -shared' to build shared libs
  1503. SHLIB_CFLAGS="-fPIC"
  1504. SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared'
  1505. SHLIB_SUFFIX=".so"
  1506. LDFLAGS="$LDFLAGS -export-dynamic"
  1507. AS_IF([test $doRpath = yes], [
  1508. CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
  1509. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1510. # The -pthread needs to go in the CFLAGS, not LIBS
  1511. LIBS=`echo $LIBS | sed s/-pthread//`
  1512. CFLAGS="$CFLAGS -pthread"
  1513. LDFLAGS="$LDFLAGS -pthread"
  1514. ;;
  1515. Darwin-*)
  1516. CFLAGS_OPTIMIZE="-Os"
  1517. SHLIB_CFLAGS="-fno-common"
  1518. # To avoid discrepancies between what headers configure sees during
  1519. # preprocessing tests and compiling tests, move any -isysroot and
  1520. # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
  1521. CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
  1522. awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
  1523. if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
  1524. CFLAGS="`echo " ${CFLAGS}" | \
  1525. awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
  1526. if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
  1527. AS_IF([test $do64bit = yes], [
  1528. case `arch` in
  1529. ppc)
  1530. AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
  1531. tcl_cv_cc_arch_ppc64, [
  1532. hold_cflags=$CFLAGS
  1533. CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
  1534. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  1535. [tcl_cv_cc_arch_ppc64=yes],[tcl_cv_cc_arch_ppc64=no])
  1536. CFLAGS=$hold_cflags])
  1537. AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
  1538. CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
  1539. do64bit_ok=yes
  1540. ]);;
  1541. i386)
  1542. AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
  1543. tcl_cv_cc_arch_x86_64, [
  1544. hold_cflags=$CFLAGS
  1545. CFLAGS="$CFLAGS -arch x86_64"
  1546. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  1547. [tcl_cv_cc_arch_x86_64=yes],[tcl_cv_cc_arch_x86_64=no])
  1548. CFLAGS=$hold_cflags])
  1549. AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
  1550. CFLAGS="$CFLAGS -arch x86_64"
  1551. do64bit_ok=yes
  1552. ]);;
  1553. *)
  1554. AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
  1555. esac
  1556. ], [
  1557. # Check for combined 32-bit and 64-bit fat build
  1558. AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
  1559. && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [
  1560. fat_32_64=yes])
  1561. ])
  1562. # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
  1563. SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
  1564. # TEA specific: link shlib with current and compatibility version flags
  1565. vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([[0-9]]\{1,5\}\)\(\(\.[[0-9]]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d`
  1566. SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}"
  1567. SHLIB_SUFFIX=".dylib"
  1568. LDFLAGS="$LDFLAGS -headerpad_max_install_names"
  1569. AC_CACHE_CHECK([if ld accepts -search_paths_first flag],
  1570. tcl_cv_ld_search_paths_first, [
  1571. hold_ldflags=$LDFLAGS
  1572. LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
  1573. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],
  1574. [tcl_cv_ld_search_paths_first=yes],[tcl_cv_ld_search_paths_first=no])
  1575. LDFLAGS=$hold_ldflags])
  1576. AS_IF([test $tcl_cv_ld_search_paths_first = yes], [
  1577. LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
  1578. ])
  1579. AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
  1580. AC_DEFINE(MODULE_SCOPE, [__private_extern__],
  1581. [Compiler support for module scope symbols])
  1582. tcl_cv_cc_visibility_hidden=yes
  1583. ])
  1584. CC_SEARCH_FLAGS=""
  1585. LD_SEARCH_FLAGS=""
  1586. LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
  1587. # TEA specific: for combined 32 & 64 bit fat builds of Tk
  1588. # extensions, verify that 64-bit build is possible.
  1589. AS_IF([test "$fat_32_64" = yes && test -n "${TK_BIN_DIR}"], [
  1590. AS_IF([test "${TEA_WINDOWINGSYSTEM}" = x11], [
  1591. AC_CACHE_CHECK([for 64-bit X11], tcl_cv_lib_x11_64, [
  1592. for v in CFLAGS CPPFLAGS LDFLAGS; do
  1593. eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
  1594. done
  1595. CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include"
  1596. LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
  1597. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[XrmInitialize();]])],
  1598. [tcl_cv_lib_x11_64=yes],[tcl_cv_lib_x11_64=no])
  1599. for v in CFLAGS CPPFLAGS LDFLAGS; do
  1600. eval $v'="$hold_'$v'"'
  1601. done])
  1602. ])
  1603. AS_IF([test "${TEA_WINDOWINGSYSTEM}" = aqua], [
  1604. AC_CACHE_CHECK([for 64-bit Tk], tcl_cv_lib_tk_64, [
  1605. for v in CFLAGS CPPFLAGS LDFLAGS; do
  1606. eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
  1607. done
  1608. CPPFLAGS="$CPPFLAGS -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 ${TCL_INCLUDES} ${TK_INCLUDES}"
  1609. LDFLAGS="$LDFLAGS ${TCL_STUB_LIB_SPEC} ${TK_STUB_LIB_SPEC}"
  1610. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <tk.h>]], [[Tk_InitStubs(NULL, "", 0);]])],
  1611. [tcl_cv_lib_tk_64=yes],[tcl_cv_lib_tk_64=no])
  1612. for v in CFLAGS CPPFLAGS LDFLAGS; do
  1613. eval $v'="$hold_'$v'"'
  1614. done])
  1615. ])
  1616. # remove 64-bit arch flags from CFLAGS et al. if configuration
  1617. # does not support 64-bit.
  1618. AS_IF([test "$tcl_cv_lib_tk_64" = no -o "$tcl_cv_lib_x11_64" = no], [
  1619. AC_MSG_NOTICE([Removing 64-bit architectures from compiler & linker flags])
  1620. for v in CFLAGS CPPFLAGS LDFLAGS; do
  1621. eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
  1622. done])
  1623. ])
  1624. ;;
  1625. OS/390-*)
  1626. CFLAGS_OPTIMIZE="" # Optimizer is buggy
  1627. AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h
  1628. [Should OS/390 do the right thing with sockets?])
  1629. ;;
  1630. OSF1-V*)
  1631. # Digital OSF/1
  1632. SHLIB_CFLAGS=""
  1633. AS_IF([test "$SHARED_BUILD" = 1], [
  1634. SHLIB_LD='ld -shared -expect_unresolved "*"'
  1635. ], [
  1636. SHLIB_LD='ld -non_shared -expect_unresolved "*"'
  1637. ])
  1638. SHLIB_SUFFIX=".so"
  1639. AS_IF([test $doRpath = yes], [
  1640. CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
  1641. LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
  1642. AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
  1643. CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
  1644. # see pthread_intro(3) for pthread support on osf1, k.furukawa
  1645. CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
  1646. CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
  1647. LIBS=`echo $LIBS | sed s/-lpthreads//`
  1648. AS_IF([test "$GCC" = yes], [
  1649. LIBS="$LIBS -lpthread -lmach -lexc"
  1650. ], [
  1651. CFLAGS="$CFLAGS -pthread"
  1652. LDFLAGS="$LDFLAGS -pthread"
  1653. ])
  1654. ;;
  1655. QNX-6*)
  1656. # QNX RTP
  1657. # This may work for all QNX, but it was only reported for v6.
  1658. SHLIB_CFLAGS="-fPIC"
  1659. SHLIB_LD="ld -Bshareable -x"
  1660. SHLIB_LD_LIBS=""
  1661. SHLIB_SUFFIX=".so"
  1662. CC_SEARCH_FLAGS=""
  1663. LD_SEARCH_FLAGS=""
  1664. ;;
  1665. SCO_SV-3.2*)
  1666. AS_IF([test "$GCC" = yes], [
  1667. SHLIB_CFLAGS="-fPIC -melf"
  1668. LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
  1669. ], [
  1670. SHLIB_CFLAGS="-Kpic -belf"
  1671. LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
  1672. ])
  1673. SHLIB_LD="ld -G"
  1674. SHLIB_LD_LIBS=""
  1675. SHLIB_SUFFIX=".so"
  1676. CC_SEARCH_FLAGS=""
  1677. LD_SEARCH_FLAGS=""
  1678. ;;
  1679. SunOS-5.[[0-6]])
  1680. # Careful to not let 5.10+ fall into this case
  1681. # Note: If _REENTRANT isn't defined, then Solaris
  1682. # won't define thread-safe library routines.
  1683. AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
  1684. AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
  1685. [Do we really want to follow the standard? Yes we do!])
  1686. SHLIB_CFLAGS="-KPIC"
  1687. SHLIB_SUFFIX=".so"
  1688. AS_IF([test "$GCC" = yes], [
  1689. SHLIB_LD='${CC} -shared'
  1690. CC_SEARCH_FLAGS='"-Wl,-R,${LIB_RUNTIME_DIR}"'
  1691. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1692. ], [
  1693. SHLIB_LD="/usr/ccs/bin/ld -G -z text"
  1694. CC_SEARCH_FLAGS='-R "${LIB_RUNTIME_DIR}"'
  1695. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1696. ])
  1697. ;;
  1698. SunOS-5*)
  1699. # Note: If _REENTRANT isn't defined, then Solaris
  1700. # won't define thread-safe library routines.
  1701. AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
  1702. AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
  1703. [Do we really want to follow the standard? Yes we do!])
  1704. SHLIB_CFLAGS="-KPIC"
  1705. # Check to enable 64-bit flags for compiler/linker
  1706. AS_IF([test "$do64bit" = yes], [
  1707. arch=`isainfo`
  1708. AS_IF([test "$arch" = "sparcv9 sparc"], [
  1709. AS_IF([test "$GCC" = yes], [
  1710. AS_IF([test "`${CC} -dumpversion | awk -F. '{print [$]1}'`" -lt 3], [
  1711. AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
  1712. ], [
  1713. do64bit_ok=yes
  1714. CFLAGS="$CFLAGS -m64 -mcpu=v9"
  1715. LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
  1716. SHLIB_CFLAGS="-fPIC"
  1717. ])
  1718. ], [
  1719. do64bit_ok=yes
  1720. AS_IF([test "$do64bitVIS" = yes], [
  1721. CFLAGS="$CFLAGS -xarch=v9a"
  1722. LDFLAGS_ARCH="-xarch=v9a"
  1723. ], [
  1724. CFLAGS="$CFLAGS -xarch=v9"
  1725. LDFLAGS_ARCH="-xarch=v9"
  1726. ])
  1727. # Solaris 64 uses this as well
  1728. #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
  1729. ])
  1730. ], [AS_IF([test "$arch" = "amd64 i386"], [
  1731. AS_IF([test "$GCC" = yes], [
  1732. case $system in
  1733. SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
  1734. do64bit_ok=yes
  1735. CFLAGS="$CFLAGS -m64"
  1736. LDFLAGS="$LDFLAGS -m64";;
  1737. *)
  1738. AC_MSG_WARN([64bit mode not supported with GCC on $system]);;
  1739. esac
  1740. ], [
  1741. do64bit_ok=yes
  1742. case $system in
  1743. SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
  1744. CFLAGS="$CFLAGS -m64"
  1745. LDFLAGS="$LDFLAGS -m64";;
  1746. *)
  1747. CFLAGS="$CFLAGS -xarch=amd64"
  1748. LDFLAGS="$LDFLAGS -xarch=amd64";;
  1749. esac
  1750. ])
  1751. ], [AC_MSG_WARN([64bit mode not supported for $arch])])])
  1752. ])
  1753. SHLIB_SUFFIX=".so"
  1754. AS_IF([test "$GCC" = yes], [
  1755. SHLIB_LD='${CC} -shared'
  1756. CC_SEARCH_FLAGS='"-Wl,-R,${LIB_RUNTIME_DIR}"'
  1757. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1758. AS_IF([test "$do64bit_ok" = yes], [
  1759. AS_IF([test "$arch" = "sparcv9 sparc"], [
  1760. # We need to specify -static-libgcc or we need to
  1761. # add the path to the sparv9 libgcc.
  1762. # JH: static-libgcc is necessary for core Tcl, but may
  1763. # not be necessary for extensions.
  1764. SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
  1765. # for finding sparcv9 libgcc, get the regular libgcc
  1766. # path, remove so name and append 'sparcv9'
  1767. #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
  1768. #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
  1769. ], [AS_IF([test "$arch" = "amd64 i386"], [
  1770. # JH: static-libgcc is necessary for core Tcl, but may
  1771. # not be necessary for extensions.
  1772. SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
  1773. ])])
  1774. ])
  1775. ], [
  1776. case $system in
  1777. SunOS-5.[[1-9]][[0-9]]*)
  1778. # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
  1779. SHLIB_LD='${CC} -G -z text ${LDFLAGS_DEFAULT}';;
  1780. *)
  1781. SHLIB_LD='/usr/ccs/bin/ld -G -z text';;
  1782. esac
  1783. CC_SEARCH_FLAGS='"-Wl,-R,${LIB_RUNTIME_DIR}"'
  1784. LD_SEARCH_FLAGS='-R "${LIB_RUNTIME_DIR}"'
  1785. ])
  1786. ;;
  1787. UNIX_SV* | UnixWare-5*)
  1788. SHLIB_CFLAGS="-KPIC"
  1789. SHLIB_LD='${CC} -G'
  1790. SHLIB_LD_LIBS=""
  1791. SHLIB_SUFFIX=".so"
  1792. # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
  1793. # that don't grok the -Bexport option. Test that it does.
  1794. AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
  1795. hold_ldflags=$LDFLAGS
  1796. LDFLAGS="$LDFLAGS -Wl,-Bexport"
  1797. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],
  1798. [tcl_cv_ld_Bexport=yes],[tcl_cv_ld_Bexport=no])
  1799. LDFLAGS=$hold_ldflags])
  1800. AS_IF([test $tcl_cv_ld_Bexport = yes], [
  1801. LDFLAGS="$LDFLAGS -Wl,-Bexport"
  1802. ])
  1803. CC_SEARCH_FLAGS=""
  1804. LD_SEARCH_FLAGS=""
  1805. ;;
  1806. esac
  1807. AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = no], [
  1808. AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
  1809. ])
  1810. dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
  1811. dnl # until the end of configure, as configure's compile and link tests use
  1812. dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
  1813. dnl # preprocessing tests use only CPPFLAGS.
  1814. AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
  1815. # Add in the arch flags late to ensure it wasn't removed.
  1816. # Not necessary in TEA, but this is aligned with core
  1817. LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
  1818. # If we're running gcc, then change the C flags for compiling shared
  1819. # libraries to the right flags for gcc, instead of those for the
  1820. # standard manufacturer compiler.
  1821. AS_IF([test "$GCC" = yes], [
  1822. case $system in
  1823. AIX-*) ;;
  1824. BSD/OS*) ;;
  1825. CYGWIN_*|MINGW32_*|MINGW64_*|MSYS_*) ;;
  1826. IRIX*) ;;
  1827. NetBSD-*|DragonFly-*|FreeBSD-*|OpenBSD-*) ;;
  1828. Darwin-*) ;;
  1829. SCO_SV-3.2*) ;;
  1830. windows) ;;
  1831. *) SHLIB_CFLAGS="-fPIC" ;;
  1832. esac])
  1833. AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
  1834. AC_DEFINE(MODULE_SCOPE, [extern],
  1835. [No Compiler support for module scope symbols])
  1836. ])
  1837. AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [
  1838. # TEA specific: use PACKAGE_VERSION instead of VERSION
  1839. SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'])
  1840. AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [
  1841. # TEA specific: use PACKAGE_VERSION instead of VERSION
  1842. UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'])
  1843. if test "${GCC}" = "yes" -a ${SHLIB_SUFFIX} = ".dll"; then
  1844. AC_CACHE_CHECK(for SEH support in compiler,
  1845. tcl_cv_seh,
  1846. AC_RUN_IFELSE([AC_LANG_SOURCE([[
  1847. #define WIN32_LEAN_AND_MEAN
  1848. #include <windows.h>
  1849. #undef WIN32_LEAN_AND_MEAN
  1850. int main(int argc, char** argv) {
  1851. int a, b = 0;
  1852. __try {
  1853. a = 666 / b;
  1854. }
  1855. __except (EXCEPTION_EXECUTE_HANDLER) {
  1856. return 0;
  1857. }
  1858. return 1;
  1859. }
  1860. ]])],
  1861. [tcl_cv_seh=yes],
  1862. [tcl_cv_seh=no],
  1863. [tcl_cv_seh=no])
  1864. )
  1865. if test "$tcl_cv_seh" = "no" ; then
  1866. AC_DEFINE(HAVE_NO_SEH, 1,
  1867. [Defined when mingw does not support SEH])
  1868. fi
  1869. #
  1870. # Check to see if the excpt.h include file provided contains the
  1871. # definition for EXCEPTION_DISPOSITION; if not, which is the case
  1872. # with Cygwin's version as of 2002-04-10, define it to be int,
  1873. # sufficient for getting the current code to work.
  1874. #
  1875. AC_CACHE_CHECK(for EXCEPTION_DISPOSITION support in include files,
  1876. tcl_cv_eh_disposition,
  1877. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1878. # define WIN32_LEAN_AND_MEAN
  1879. # include <windows.h>
  1880. # undef WIN32_LEAN_AND_MEAN
  1881. ]], [[
  1882. EXCEPTION_DISPOSITION x;
  1883. ]])],
  1884. [tcl_cv_eh_disposition=yes],
  1885. [tcl_cv_eh_disposition=no])
  1886. )
  1887. if test "$tcl_cv_eh_disposition" = "no" ; then
  1888. AC_DEFINE(EXCEPTION_DISPOSITION, int,
  1889. [Defined when cygwin/mingw does not support EXCEPTION DISPOSITION])
  1890. fi
  1891. # Check to see if winnt.h defines CHAR, SHORT, and LONG
  1892. # even if VOID has already been #defined. The win32api
  1893. # used by mingw and cygwin is known to do this.
  1894. AC_CACHE_CHECK(for winnt.h that ignores VOID define,
  1895. tcl_cv_winnt_ignore_void,
  1896. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1897. #define VOID void
  1898. #define WIN32_LEAN_AND_MEAN
  1899. #include <windows.h>
  1900. #undef WIN32_LEAN_AND_MEAN
  1901. ]], [[
  1902. CHAR c;
  1903. SHORT s;
  1904. LONG l;
  1905. ]])],
  1906. [tcl_cv_winnt_ignore_void=yes],
  1907. [tcl_cv_winnt_ignore_void=no])
  1908. )
  1909. if test "$tcl_cv_winnt_ignore_void" = "yes" ; then
  1910. AC_DEFINE(HAVE_WINNT_IGNORE_VOID, 1,
  1911. [Defined when cygwin/mingw ignores VOID define in winnt.h])
  1912. fi
  1913. fi
  1914. # See if the compiler supports casting to a union type.
  1915. # This is used to stop gcc from printing a compiler
  1916. # warning when initializing a union member.
  1917. AC_CACHE_CHECK(for cast to union support,
  1918. tcl_cv_cast_to_union,
  1919. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
  1920. union foo { int i; double d; };
  1921. union foo f = (union foo) (int) 0;
  1922. ]])],
  1923. [tcl_cv_cast_to_union=yes],
  1924. [tcl_cv_cast_to_union=no])
  1925. )
  1926. if test "$tcl_cv_cast_to_union" = "yes"; then
  1927. AC_DEFINE(HAVE_CAST_TO_UNION, 1,
  1928. [Defined when compiler supports casting to union type.])
  1929. fi
  1930. AC_CHECK_HEADER(stdbool.h, [AC_DEFINE(HAVE_STDBOOL_H, 1, [Do we have <stdbool.h>?])],)
  1931. AC_SUBST(CFLAGS_DEBUG)
  1932. AC_SUBST(CFLAGS_OPTIMIZE)
  1933. AC_SUBST(CFLAGS_WARNING)
  1934. AC_SUBST(LDFLAGS_DEBUG)
  1935. AC_SUBST(LDFLAGS_OPTIMIZE)
  1936. AC_SUBST(STLIB_LD)
  1937. AC_SUBST(SHLIB_LD)
  1938. AC_SUBST(SHLIB_LD_LIBS)
  1939. AC_SUBST(SHLIB_CFLAGS)
  1940. AC_SUBST(LD_LIBRARY_PATH_VAR)
  1941. # These must be called after we do the basic CFLAGS checks and
  1942. # verify any possible 64-bit or similar switches are necessary
  1943. TEA_TCL_EARLY_FLAGS
  1944. TEA_TCL_64BIT_FLAGS
  1945. ])
  1946. #--------------------------------------------------------------------
  1947. # TEA_SERIAL_PORT
  1948. #
  1949. # Determine which interface to use to talk to the serial port.
  1950. # Note that #include lines must begin in leftmost column for
  1951. # some compilers to recognize them as preprocessor directives,
  1952. # and some build environments have stdin not pointing at a
  1953. # pseudo-terminal (usually /dev/null instead.)
  1954. #
  1955. # Arguments:
  1956. # none
  1957. #
  1958. # Results:
  1959. #
  1960. # Defines only one of the following vars:
  1961. # HAVE_SYS_MODEM_H
  1962. # USE_TERMIOS
  1963. # USE_TERMIO
  1964. # USE_SGTTY
  1965. #--------------------------------------------------------------------
  1966. AC_DEFUN([TEA_SERIAL_PORT], [
  1967. AC_CHECK_HEADERS(sys/modem.h)
  1968. AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
  1969. AC_RUN_IFELSE([AC_LANG_SOURCE([[
  1970. #include <termios.h>
  1971. int main() {
  1972. struct termios t;
  1973. if (tcgetattr(0, &t) == 0) {
  1974. cfsetospeed(&t, 0);
  1975. t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
  1976. return 0;
  1977. }
  1978. return 1;
  1979. }]])],[tcl_cv_api_serial=termios],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
  1980. if test $tcl_cv_api_serial = no ; then
  1981. AC_RUN_IFELSE([AC_LANG_SOURCE([[
  1982. #include <termio.h>
  1983. int main() {
  1984. struct termio t;
  1985. if (ioctl(0, TCGETA, &t) == 0) {
  1986. t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
  1987. return 0;
  1988. }
  1989. return 1;
  1990. }]])],[tcl_cv_api_serial=termio],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
  1991. fi
  1992. if test $tcl_cv_api_serial = no ; then
  1993. AC_RUN_IFELSE([AC_LANG_SOURCE([[
  1994. #include <sgtty.h>
  1995. int main() {
  1996. struct sgttyb t;
  1997. if (ioctl(0, TIOCGETP, &t) == 0) {
  1998. t.sg_ospeed = 0;
  1999. t.sg_flags |= ODDP | EVENP | RAW;
  2000. return 0;
  2001. }
  2002. return 1;
  2003. }]])],[tcl_cv_api_serial=sgtty],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
  2004. fi
  2005. if test $tcl_cv_api_serial = no ; then
  2006. AC_RUN_IFELSE([AC_LANG_SOURCE([[
  2007. #include <termios.h>
  2008. #include <errno.h>
  2009. int main() {
  2010. struct termios t;
  2011. if (tcgetattr(0, &t) == 0
  2012. || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
  2013. cfsetospeed(&t, 0);
  2014. t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
  2015. return 0;
  2016. }
  2017. return 1;
  2018. }]])],[tcl_cv_api_serial=termios],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
  2019. fi
  2020. if test $tcl_cv_api_serial = no; then
  2021. AC_RUN_IFELSE([AC_LANG_SOURCE([[
  2022. #include <termio.h>
  2023. #include <errno.h>
  2024. int main() {
  2025. struct termio t;
  2026. if (ioctl(0, TCGETA, &t) == 0
  2027. || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
  2028. t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
  2029. return 0;
  2030. }
  2031. return 1;
  2032. }]])],[tcl_cv_api_serial=termio],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
  2033. fi
  2034. if test $tcl_cv_api_serial = no; then
  2035. AC_RUN_IFELSE([AC_LANG_SOURCE([[
  2036. #include <sgtty.h>
  2037. #include <errno.h>
  2038. int main() {
  2039. struct sgttyb t;
  2040. if (ioctl(0, TIOCGETP, &t) == 0
  2041. || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
  2042. t.sg_ospeed = 0;
  2043. t.sg_flags |= ODDP | EVENP | RAW;
  2044. return 0;
  2045. }
  2046. return 1;
  2047. }]])],[tcl_cv_api_serial=sgtty],[tcl_cv_api_serial=none],[tcl_cv_api_serial=none])
  2048. fi])
  2049. case $tcl_cv_api_serial in
  2050. termios) AC_DEFINE(USE_TERMIOS, 1, [Use the termios API for serial lines]);;
  2051. termio) AC_DEFINE(USE_TERMIO, 1, [Use the termio API for serial lines]);;
  2052. sgtty) AC_DEFINE(USE_SGTTY, 1, [Use the sgtty API for serial lines]);;
  2053. esac
  2054. ])
  2055. #--------------------------------------------------------------------
  2056. # TEA_PATH_X
  2057. #
  2058. # Locate the X11 header files and the X11 library archive. Try
  2059. # the ac_path_x macro first, but if it doesn't find the X stuff
  2060. # (e.g. because there's no xmkmf program) then check through
  2061. # a list of possible directories. Under some conditions the
  2062. # autoconf macro will return an include directory that contains
  2063. # no include files, so double-check its result just to be safe.
  2064. #
  2065. # This should be called after TEA_CONFIG_CFLAGS as setting the
  2066. # LIBS line can confuse some configure macro magic.
  2067. #
  2068. # Arguments:
  2069. # none
  2070. #
  2071. # Results:
  2072. #
  2073. # Sets the following vars:
  2074. # XINCLUDES
  2075. # XLIBSW
  2076. # PKG_LIBS (appends to)
  2077. #--------------------------------------------------------------------
  2078. AC_DEFUN([TEA_PATH_X], [
  2079. if test "${TEA_WINDOWINGSYSTEM}" = "x11" ; then
  2080. TEA_PATH_UNIX_X
  2081. fi
  2082. ])
  2083. AC_DEFUN([TEA_PATH_UNIX_X], [
  2084. AC_PATH_X
  2085. not_really_there=""
  2086. if test "$no_x" = ""; then
  2087. if test "$x_includes" = ""; then
  2088. AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <X11/Xlib.h>]])],[],[not_really_there="yes"])
  2089. else
  2090. if test ! -r $x_includes/X11/Xlib.h; then
  2091. not_really_there="yes"
  2092. fi
  2093. fi
  2094. fi
  2095. if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
  2096. AC_MSG_CHECKING([for X11 header files])
  2097. found_xincludes="no"
  2098. AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <X11/Xlib.h>]])],[found_xincludes="yes"],[found_xincludes="no"])
  2099. if test "$found_xincludes" = "no"; then
  2100. dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
  2101. for i in $dirs ; do
  2102. if test -r $i/X11/Xlib.h; then
  2103. AC_MSG_RESULT([$i])
  2104. XINCLUDES=" -I$i"
  2105. found_xincludes="yes"
  2106. break
  2107. fi
  2108. done
  2109. fi
  2110. else
  2111. if test "$x_includes" != ""; then
  2112. XINCLUDES="-I$x_includes"
  2113. found_xincludes="yes"
  2114. fi
  2115. fi
  2116. if test "$found_xincludes" = "no"; then
  2117. AC_MSG_RESULT([couldn't find any!])
  2118. fi
  2119. if test "$no_x" = yes; then
  2120. AC_MSG_CHECKING([for X11 libraries])
  2121. XLIBSW=nope
  2122. dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
  2123. for i in $dirs ; do
  2124. if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then
  2125. AC_MSG_RESULT([$i])
  2126. XLIBSW="-L$i -lX11"
  2127. x_libraries="$i"
  2128. break
  2129. fi
  2130. done
  2131. else
  2132. if test "$x_libraries" = ""; then
  2133. XLIBSW=-lX11
  2134. else
  2135. XLIBSW="-L$x_libraries -lX11"
  2136. fi
  2137. fi
  2138. if test "$XLIBSW" = nope ; then
  2139. AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
  2140. fi
  2141. if test "$XLIBSW" = nope ; then
  2142. AC_MSG_RESULT([could not find any! Using -lX11.])
  2143. XLIBSW=-lX11
  2144. fi
  2145. # TEA specific:
  2146. if test x"${XLIBSW}" != x ; then
  2147. PKG_LIBS="${PKG_LIBS} ${XLIBSW}"
  2148. fi
  2149. ])
  2150. #--------------------------------------------------------------------
  2151. # TEA_BLOCKING_STYLE
  2152. #
  2153. # The statements below check for systems where POSIX-style
  2154. # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
  2155. # On these systems (mostly older ones), use the old BSD-style
  2156. # FIONBIO approach instead.
  2157. #
  2158. # Arguments:
  2159. # none
  2160. #
  2161. # Results:
  2162. #
  2163. # Defines some of the following vars:
  2164. # HAVE_SYS_IOCTL_H
  2165. # HAVE_SYS_FILIO_H
  2166. # USE_FIONBIO
  2167. # O_NONBLOCK
  2168. #--------------------------------------------------------------------
  2169. AC_DEFUN([TEA_BLOCKING_STYLE], [
  2170. AC_CHECK_HEADERS(sys/ioctl.h)
  2171. AC_CHECK_HEADERS(sys/filio.h)
  2172. TEA_CONFIG_SYSTEM
  2173. AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
  2174. case $system in
  2175. OSF*)
  2176. AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
  2177. AC_MSG_RESULT([FIONBIO])
  2178. ;;
  2179. *)
  2180. AC_MSG_RESULT([O_NONBLOCK])
  2181. ;;
  2182. esac
  2183. ])
  2184. #--------------------------------------------------------------------
  2185. # TEA_TIME_HANDLER
  2186. #
  2187. # Checks how the system deals with time.h, what time structures
  2188. # are used on the system, and what fields the structures have.
  2189. #
  2190. # Arguments:
  2191. # none
  2192. #
  2193. # Results:
  2194. #
  2195. # Defines some of the following vars:
  2196. # USE_DELTA_FOR_TZ
  2197. # HAVE_TM_GMTOFF
  2198. # HAVE_TM_TZADJ
  2199. # HAVE_TIMEZONE_VAR
  2200. #
  2201. #--------------------------------------------------------------------
  2202. AC_DEFUN([TEA_TIME_HANDLER], [
  2203. AC_CHECK_HEADERS(sys/time.h)
  2204. AC_HEADER_TIME
  2205. AC_STRUCT_TIMEZONE
  2206. AC_CHECK_FUNCS(gmtime_r localtime_r mktime)
  2207. AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
  2208. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tm; (void)tm.tm_tzadj;]])],
  2209. [tcl_cv_member_tm_tzadj=yes],
  2210. [tcl_cv_member_tm_tzadj=no])])
  2211. if test $tcl_cv_member_tm_tzadj = yes ; then
  2212. AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?])
  2213. fi
  2214. AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
  2215. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tm; (void)tm.tm_gmtoff;]])],
  2216. [tcl_cv_member_tm_gmtoff=yes],
  2217. [tcl_cv_member_tm_gmtoff=no])])
  2218. if test $tcl_cv_member_tm_gmtoff = yes ; then
  2219. AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
  2220. fi
  2221. #
  2222. # Its important to include time.h in this check, as some systems
  2223. # (like convex) have timezone functions, etc.
  2224. #
  2225. AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
  2226. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>
  2227. #include <stdlib.h>]],
  2228. [[extern long timezone;
  2229. timezone += 1;
  2230. exit (0);]])],
  2231. [tcl_cv_timezone_long=yes], [tcl_cv_timezone_long=no])])
  2232. if test $tcl_cv_timezone_long = yes ; then
  2233. AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
  2234. else
  2235. #
  2236. # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
  2237. #
  2238. AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
  2239. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>
  2240. #include <stdlib.h>]],
  2241. [[extern time_t timezone;
  2242. timezone += 1;
  2243. exit (0);]])],
  2244. [tcl_cv_timezone_time=yes], [tcl_cv_timezone_time=no])])
  2245. if test $tcl_cv_timezone_time = yes ; then
  2246. AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
  2247. fi
  2248. fi
  2249. ])
  2250. #--------------------------------------------------------------------
  2251. # TEA_BUGGY_STRTOD
  2252. #
  2253. # Under Solaris 2.4, strtod returns the wrong value for the
  2254. # terminating character under some conditions. Check for this
  2255. # and if the problem exists use a substitute procedure
  2256. # "fixstrtod" (provided by Tcl) that corrects the error.
  2257. # Also, on Compaq's Tru64 Unix 5.0,
  2258. # strtod(" ") returns 0.0 instead of a failure to convert.
  2259. #
  2260. # Arguments:
  2261. # none
  2262. #
  2263. # Results:
  2264. #
  2265. # Might defines some of the following vars:
  2266. # strtod (=fixstrtod)
  2267. #--------------------------------------------------------------------
  2268. AC_DEFUN([TEA_BUGGY_STRTOD], [
  2269. AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
  2270. if test "$tcl_strtod" = 1; then
  2271. AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
  2272. AC_RUN_IFELSE([AC_LANG_SOURCE([[
  2273. #include <stdlib.h>
  2274. extern double strtod();
  2275. int main() {
  2276. char *infString="Inf", *nanString="NaN", *spaceString=" ";
  2277. char *term;
  2278. double value;
  2279. value = strtod(infString, &term);
  2280. if ((term != infString) && (term[-1] == 0)) {
  2281. exit(1);
  2282. }
  2283. value = strtod(nanString, &term);
  2284. if ((term != nanString) && (term[-1] == 0)) {
  2285. exit(1);
  2286. }
  2287. value = strtod(spaceString, &term);
  2288. if (term == (spaceString+1)) {
  2289. exit(1);
  2290. }
  2291. exit(0);
  2292. }]])], [tcl_cv_strtod_buggy=ok], [tcl_cv_strtod_buggy=buggy],
  2293. [tcl_cv_strtod_buggy=buggy])])
  2294. if test "$tcl_cv_strtod_buggy" = buggy; then
  2295. AC_LIBOBJ([fixstrtod])
  2296. USE_COMPAT=1
  2297. AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?])
  2298. fi
  2299. fi
  2300. ])
  2301. #--------------------------------------------------------------------
  2302. # TEA_TCL_LINK_LIBS
  2303. #
  2304. # Search for the libraries needed to link the Tcl shell.
  2305. # Things like the math library (-lm), socket stuff (-lsocket vs.
  2306. # -lnsl), zlib (-lz) and libtommath (-ltommath) are dealt with here.
  2307. #
  2308. # Arguments:
  2309. # None.
  2310. #
  2311. # Results:
  2312. #
  2313. # Might append to the following vars:
  2314. # LIBS
  2315. # MATH_LIBS
  2316. #
  2317. # Might define the following vars:
  2318. # HAVE_NET_ERRNO_H
  2319. #
  2320. #--------------------------------------------------------------------
  2321. AC_DEFUN([TEA_TCL_LINK_LIBS], [
  2322. #--------------------------------------------------------------------
  2323. # On a few very rare systems, all of the libm.a stuff is
  2324. # already in libc.a. Set compiler flags accordingly.
  2325. #--------------------------------------------------------------------
  2326. AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
  2327. #--------------------------------------------------------------------
  2328. # Interactive UNIX requires -linet instead of -lsocket, plus it
  2329. # needs net/errno.h to define the socket-related error codes.
  2330. #--------------------------------------------------------------------
  2331. AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
  2332. AC_CHECK_HEADER(net/errno.h, [
  2333. AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have <net/errno.h>?])])
  2334. #--------------------------------------------------------------------
  2335. # Check for the existence of the -lsocket and -lnsl libraries.
  2336. # The order here is important, so that they end up in the right
  2337. # order in the command line generated by make. Here are some
  2338. # special considerations:
  2339. # 1. Use "connect" and "accept" to check for -lsocket, and
  2340. # "gethostbyname" to check for -lnsl.
  2341. # 2. Use each function name only once: can't redo a check because
  2342. # autoconf caches the results of the last check and won't redo it.
  2343. # 3. Use -lnsl and -lsocket only if they supply procedures that
  2344. # aren't already present in the normal libraries. This is because
  2345. # IRIX 5.2 has libraries, but they aren't needed and they're
  2346. # bogus: they goof up name resolution if used.
  2347. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
  2348. # To get around this problem, check for both libraries together
  2349. # if -lsocket doesn't work by itself.
  2350. #--------------------------------------------------------------------
  2351. tcl_checkBoth=0
  2352. AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
  2353. if test "$tcl_checkSocket" = 1; then
  2354. AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
  2355. LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
  2356. fi
  2357. if test "$tcl_checkBoth" = 1; then
  2358. tk_oldLibs=$LIBS
  2359. LIBS="$LIBS -lsocket -lnsl"
  2360. AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
  2361. fi
  2362. AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
  2363. [LIBS="$LIBS -lnsl"])])
  2364. AC_CHECK_FUNC(mp_log_u32, , [AC_CHECK_LIB(tommath, mp_log_u32,
  2365. [LIBS="$LIBS -ltommath"])])
  2366. AC_CHECK_FUNC(deflateSetHeader, , [AC_CHECK_LIB(z, deflateSetHeader,
  2367. [LIBS="$LIBS -lz"])])
  2368. ])
  2369. #--------------------------------------------------------------------
  2370. # TEA_TCL_EARLY_FLAGS
  2371. #
  2372. # Check for what flags are needed to be passed so the correct OS
  2373. # features are available.
  2374. #
  2375. # Arguments:
  2376. # None
  2377. #
  2378. # Results:
  2379. #
  2380. # Might define the following vars:
  2381. # _ISOC99_SOURCE
  2382. # _FILE_OFFSET_BITS
  2383. #
  2384. #--------------------------------------------------------------------
  2385. AC_DEFUN([TEA_TCL_EARLY_FLAG],[
  2386. AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
  2387. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])],
  2388. [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[[#define ]$1[ ]m4_default([$4],[1])[
  2389. ]$2]], [[$3]])],
  2390. [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
  2391. [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)]))
  2392. if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
  2393. AC_DEFINE($1, m4_default([$4],[1]), [Add the ]$1[ flag when building])
  2394. tcl_flags="$tcl_flags $1"
  2395. fi
  2396. ])
  2397. AC_DEFUN([TEA_TCL_EARLY_FLAGS],[
  2398. AC_MSG_CHECKING([for required early compiler flags])
  2399. tcl_flags=""
  2400. TEA_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
  2401. [char *p = (char *)strtoll; char *q = (char *)strtoull;])
  2402. if test "${TCL_MAJOR_VERSION}" -ne 8 ; then
  2403. TEA_TCL_EARLY_FLAG(_FILE_OFFSET_BITS,[#include <sys/stat.h>],
  2404. [switch (0) { case 0: case (sizeof(off_t)==sizeof(long long)): ; }],64)
  2405. fi
  2406. if test "x${tcl_flags}" = "x" ; then
  2407. AC_MSG_RESULT([none])
  2408. else
  2409. AC_MSG_RESULT([${tcl_flags}])
  2410. fi
  2411. ])
  2412. #--------------------------------------------------------------------
  2413. # TEA_TCL_64BIT_FLAGS
  2414. #
  2415. # Check for what is defined in the way of 64-bit features.
  2416. #
  2417. # Arguments:
  2418. # None
  2419. #
  2420. # Results:
  2421. #
  2422. # Might define the following vars:
  2423. # TCL_WIDE_INT_IS_LONG
  2424. # TCL_WIDE_INT_TYPE
  2425. # HAVE_STRUCT_DIRENT64, HAVE_DIR64
  2426. # HAVE_STRUCT_STAT64
  2427. # HAVE_TYPE_OFF64_T
  2428. # _TIME_BITS
  2429. #
  2430. #--------------------------------------------------------------------
  2431. AC_DEFUN([TEA_TCL_64BIT_FLAGS], [
  2432. AC_MSG_CHECKING([for 64-bit integer type])
  2433. AC_CACHE_VAL(tcl_cv_type_64bit,[
  2434. tcl_cv_type_64bit=none
  2435. # See if the compiler knows natively about __int64
  2436. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__int64 value = (__int64) 0;]])],
  2437. [tcl_type_64bit=__int64],[tcl_type_64bit="long long"])
  2438. # See if we could use long anyway Note that we substitute in the
  2439. # type that is our current guess for a 64-bit type inside this check
  2440. # program, so it should be modified only carefully...
  2441. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[switch (0) {
  2442. case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ;
  2443. }]])],[tcl_cv_type_64bit=${tcl_type_64bit}],[])])
  2444. if test "${tcl_cv_type_64bit}" = none ; then
  2445. AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Do 'long' and 'long long' have the same size (64-bit)?])
  2446. AC_MSG_RESULT([yes])
  2447. elif test "${tcl_cv_type_64bit}" = "__int64" \
  2448. -a "${TEA_PLATFORM}" = "windows" ; then
  2449. # TEA specific: We actually want to use the default tcl.h checks in
  2450. # this case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER*
  2451. AC_MSG_RESULT([using Tcl header defaults])
  2452. else
  2453. AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
  2454. [What type should be used to define wide integers?])
  2455. AC_MSG_RESULT([${tcl_cv_type_64bit}])
  2456. # Now check for auxiliary declarations
  2457. if test "${TCL_MAJOR_VERSION}" -ne 8 ; then
  2458. AC_CACHE_CHECK([for 64-bit time_t], tcl_cv_time_t_64,[
  2459. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]],
  2460. [[switch (0) {case 0: case (sizeof(time_t)==sizeof(long long)): ;}]])],
  2461. [tcl_cv_time_t_64=yes],[tcl_cv_time_t_64=no])])
  2462. if test "x${tcl_cv_time_t_64}" = "xno" ; then
  2463. # Note that _TIME_BITS=64 requires _FILE_OFFSET_BITS=64
  2464. # which SC_TCL_EARLY_FLAGS has defined if necessary.
  2465. AC_CACHE_CHECK([if _TIME_BITS=64 enables 64-bit time_t], tcl_cv__time_bits,[
  2466. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _TIME_BITS 64
  2467. #include <sys/types.h>]],
  2468. [[switch (0) {case 0: case (sizeof(time_t)==sizeof(long long)): ;}]])],
  2469. [tcl_cv__time_bits=yes],[tcl_cv__time_bits=no])])
  2470. if test "x${tcl_cv__time_bits}" = "xyes" ; then
  2471. AC_DEFINE(_TIME_BITS, 64, [_TIME_BITS=64 enables 64-bit time_t.])
  2472. fi
  2473. fi
  2474. fi
  2475. AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
  2476. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
  2477. #include <dirent.h>]], [[struct dirent64 p;]])],
  2478. [tcl_cv_struct_dirent64=yes],[tcl_cv_struct_dirent64=no])])
  2479. if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
  2480. AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?])
  2481. fi
  2482. AC_CACHE_CHECK([for DIR64], tcl_cv_DIR64,[
  2483. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
  2484. #include <dirent.h>]], [[struct dirent64 *p; DIR64 d = opendir64(".");
  2485. p = readdir64(d); rewinddir64(d); closedir64(d);]])],
  2486. [tcl_cv_DIR64=yes], [tcl_cv_DIR64=no])])
  2487. if test "x${tcl_cv_DIR64}" = "xyes" ; then
  2488. AC_DEFINE(HAVE_DIR64, 1, [Is 'DIR64' in <sys/types.h>?])
  2489. fi
  2490. AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
  2491. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[struct stat64 p;
  2492. ]])],
  2493. [tcl_cv_struct_stat64=yes], [tcl_cv_struct_stat64=no])])
  2494. if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
  2495. AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?])
  2496. fi
  2497. AC_CHECK_FUNCS(open64 lseek64)
  2498. AC_MSG_CHECKING([for off64_t])
  2499. AC_CACHE_VAL(tcl_cv_type_off64_t,[
  2500. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], [[off64_t offset;
  2501. ]])],
  2502. [tcl_cv_type_off64_t=yes], [tcl_cv_type_off64_t=no])])
  2503. dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
  2504. dnl functions lseek64 and open64 are defined.
  2505. if test "x${tcl_cv_type_off64_t}" = "xyes" && \
  2506. test "x${ac_cv_func_lseek64}" = "xyes" && \
  2507. test "x${ac_cv_func_open64}" = "xyes" ; then
  2508. AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
  2509. AC_MSG_RESULT([yes])
  2510. else
  2511. AC_MSG_RESULT([no])
  2512. fi
  2513. fi
  2514. ])
  2515. ##
  2516. ## Here ends the standard Tcl configuration bits and starts the
  2517. ## TEA specific functions
  2518. ##
  2519. #------------------------------------------------------------------------
  2520. # TEA_INIT --
  2521. #
  2522. # Init various Tcl Extension Architecture (TEA) variables.
  2523. # This should be the first called TEA_* macro.
  2524. #
  2525. # Arguments:
  2526. # none
  2527. #
  2528. # Results:
  2529. #
  2530. # Defines and substs the following vars:
  2531. # CYGPATH
  2532. # EXEEXT
  2533. # Defines only:
  2534. # TEA_VERSION
  2535. # TEA_INITED
  2536. # TEA_PLATFORM (windows or unix)
  2537. #
  2538. # "cygpath" is used on windows to generate native path names for include
  2539. # files. These variables should only be used with the compiler and linker
  2540. # since they generate native path names.
  2541. #
  2542. # EXEEXT
  2543. # Select the executable extension based on the host type. This
  2544. # is a lightweight replacement for AC_EXEEXT that doesn't require
  2545. # a compiler.
  2546. #------------------------------------------------------------------------
  2547. AC_DEFUN([TEA_INIT], [
  2548. TEA_VERSION="3.13"
  2549. AC_MSG_CHECKING([TEA configuration])
  2550. if test x"${PACKAGE_NAME}" = x ; then
  2551. AC_MSG_ERROR([
  2552. The PACKAGE_NAME variable must be defined by your TEA configure.ac])
  2553. fi
  2554. AC_MSG_RESULT([ok (TEA ${TEA_VERSION})])
  2555. # If the user did not set CFLAGS, set it now to keep macros
  2556. # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2".
  2557. if test "${CFLAGS+set}" != "set" ; then
  2558. CFLAGS=""
  2559. fi
  2560. case "`uname -s`" in
  2561. *win32*|*WIN32*|*MINGW32_*|*MINGW64_*|*MSYS_*)
  2562. AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo)
  2563. EXEEXT=".exe"
  2564. TEA_PLATFORM="windows"
  2565. ;;
  2566. *CYGWIN_*)
  2567. EXEEXT=".exe"
  2568. # CYGPATH and TEA_PLATFORM are determined later in LOAD_TCLCONFIG
  2569. ;;
  2570. *)
  2571. CYGPATH=echo
  2572. # Maybe we are cross-compiling....
  2573. case ${host_alias} in
  2574. *mingw32*)
  2575. EXEEXT=".exe"
  2576. TEA_PLATFORM="windows"
  2577. ;;
  2578. *)
  2579. EXEEXT=""
  2580. TEA_PLATFORM="unix"
  2581. ;;
  2582. esac
  2583. ;;
  2584. esac
  2585. # Check if exec_prefix is set. If not use fall back to prefix.
  2586. # Note when adjusted, so that TEA_PREFIX can correct for this.
  2587. # This is needed for recursive configures, since autoconf propagates
  2588. # $prefix, but not $exec_prefix (doh!).
  2589. if test x$exec_prefix = xNONE ; then
  2590. exec_prefix_default=yes
  2591. exec_prefix=$prefix
  2592. fi
  2593. AC_MSG_NOTICE([configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}])
  2594. AC_SUBST(EXEEXT)
  2595. AC_SUBST(CYGPATH)
  2596. # This package name must be replaced statically for AC_SUBST to work
  2597. AC_SUBST(PKG_LIB_FILE)
  2598. AC_SUBST(PKG_LIB_FILE8)
  2599. AC_SUBST(PKG_LIB_FILE9)
  2600. # We AC_SUBST these here to ensure they are subst'ed,
  2601. # in case the user doesn't call TEA_ADD_...
  2602. AC_SUBST(PKG_STUB_SOURCES)
  2603. AC_SUBST(PKG_STUB_OBJECTS)
  2604. AC_SUBST(PKG_TCL_SOURCES)
  2605. AC_SUBST(PKG_HEADERS)
  2606. AC_SUBST(PKG_INCLUDES)
  2607. AC_SUBST(PKG_LIBS)
  2608. AC_SUBST(PKG_CFLAGS)
  2609. # Configure the installer.
  2610. TEA_INSTALLER
  2611. ])
  2612. #------------------------------------------------------------------------
  2613. # TEA_ADD_SOURCES --
  2614. #
  2615. # Specify one or more source files. Users should check for
  2616. # the right platform before adding to their list.
  2617. # It is not important to specify the directory, as long as it is
  2618. # in the generic, win or unix subdirectory of $(srcdir).
  2619. #
  2620. # Arguments:
  2621. # one or more file names
  2622. #
  2623. # Results:
  2624. #
  2625. # Defines and substs the following vars:
  2626. # PKG_SOURCES
  2627. # PKG_OBJECTS
  2628. #------------------------------------------------------------------------
  2629. AC_DEFUN([TEA_ADD_SOURCES], [
  2630. vars="$@"
  2631. for i in $vars; do
  2632. case $i in
  2633. [\$]*)
  2634. # allow $-var names
  2635. PKG_SOURCES="$PKG_SOURCES $i"
  2636. PKG_OBJECTS="$PKG_OBJECTS $i"
  2637. ;;
  2638. *)
  2639. # check for existence - allows for generic/win/unix VPATH
  2640. # To add more dirs here (like 'src'), you have to update VPATH
  2641. # in Makefile.in as well
  2642. if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
  2643. -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
  2644. -a ! -f "${srcdir}/macosx/$i" \
  2645. ; then
  2646. AC_MSG_ERROR([could not find source file '$i'])
  2647. fi
  2648. PKG_SOURCES="$PKG_SOURCES $i"
  2649. # this assumes it is in a VPATH dir
  2650. i=`basename $i`
  2651. # handle user calling this before or after TEA_SETUP_COMPILER
  2652. if test x"${OBJEXT}" != x ; then
  2653. j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
  2654. else
  2655. j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
  2656. fi
  2657. PKG_OBJECTS="$PKG_OBJECTS $j"
  2658. ;;
  2659. esac
  2660. done
  2661. AC_SUBST(PKG_SOURCES)
  2662. AC_SUBST(PKG_OBJECTS)
  2663. ])
  2664. #------------------------------------------------------------------------
  2665. # TEA_ADD_STUB_SOURCES --
  2666. #
  2667. # Specify one or more source files. Users should check for
  2668. # the right platform before adding to their list.
  2669. # It is not important to specify the directory, as long as it is
  2670. # in the generic, win or unix subdirectory of $(srcdir).
  2671. #
  2672. # Arguments:
  2673. # one or more file names
  2674. #
  2675. # Results:
  2676. #
  2677. # Defines and substs the following vars:
  2678. # PKG_STUB_SOURCES
  2679. # PKG_STUB_OBJECTS
  2680. #------------------------------------------------------------------------
  2681. AC_DEFUN([TEA_ADD_STUB_SOURCES], [
  2682. vars="$@"
  2683. for i in $vars; do
  2684. # check for existence - allows for generic/win/unix VPATH
  2685. if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
  2686. -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
  2687. -a ! -f "${srcdir}/macosx/$i" \
  2688. ; then
  2689. AC_MSG_ERROR([could not find stub source file '$i'])
  2690. fi
  2691. PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i"
  2692. # this assumes it is in a VPATH dir
  2693. i=`basename $i`
  2694. # handle user calling this before or after TEA_SETUP_COMPILER
  2695. if test x"${OBJEXT}" != x ; then
  2696. j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
  2697. else
  2698. j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
  2699. fi
  2700. PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j"
  2701. done
  2702. AC_SUBST(PKG_STUB_SOURCES)
  2703. AC_SUBST(PKG_STUB_OBJECTS)
  2704. ])
  2705. #------------------------------------------------------------------------
  2706. # TEA_ADD_TCL_SOURCES --
  2707. #
  2708. # Specify one or more Tcl source files. These should be platform
  2709. # independent runtime files.
  2710. #
  2711. # Arguments:
  2712. # one or more file names
  2713. #
  2714. # Results:
  2715. #
  2716. # Defines and substs the following vars:
  2717. # PKG_TCL_SOURCES
  2718. #------------------------------------------------------------------------
  2719. AC_DEFUN([TEA_ADD_TCL_SOURCES], [
  2720. vars="$@"
  2721. for i in $vars; do
  2722. # check for existence, be strict because it is installed
  2723. if test ! -f "${srcdir}/$i" ; then
  2724. AC_MSG_ERROR([could not find tcl source file '${srcdir}/$i'])
  2725. fi
  2726. PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i"
  2727. done
  2728. AC_SUBST(PKG_TCL_SOURCES)
  2729. ])
  2730. #------------------------------------------------------------------------
  2731. # TEA_ADD_HEADERS --
  2732. #
  2733. # Specify one or more source headers. Users should check for
  2734. # the right platform before adding to their list.
  2735. #
  2736. # Arguments:
  2737. # one or more file names
  2738. #
  2739. # Results:
  2740. #
  2741. # Defines and substs the following vars:
  2742. # PKG_HEADERS
  2743. #------------------------------------------------------------------------
  2744. AC_DEFUN([TEA_ADD_HEADERS], [
  2745. vars="$@"
  2746. for i in $vars; do
  2747. # check for existence, be strict because it is installed
  2748. if test ! -f "${srcdir}/$i" ; then
  2749. AC_MSG_ERROR([could not find header file '${srcdir}/$i'])
  2750. fi
  2751. PKG_HEADERS="$PKG_HEADERS $i"
  2752. done
  2753. AC_SUBST(PKG_HEADERS)
  2754. ])
  2755. #------------------------------------------------------------------------
  2756. # TEA_ADD_INCLUDES --
  2757. #
  2758. # Specify one or more include dirs. Users should check for
  2759. # the right platform before adding to their list.
  2760. #
  2761. # Arguments:
  2762. # one or more file names
  2763. #
  2764. # Results:
  2765. #
  2766. # Defines and substs the following vars:
  2767. # PKG_INCLUDES
  2768. #------------------------------------------------------------------------
  2769. AC_DEFUN([TEA_ADD_INCLUDES], [
  2770. vars="$@"
  2771. for i in $vars; do
  2772. PKG_INCLUDES="$PKG_INCLUDES $i"
  2773. done
  2774. AC_SUBST(PKG_INCLUDES)
  2775. ])
  2776. #------------------------------------------------------------------------
  2777. # TEA_ADD_LIBS --
  2778. #
  2779. # Specify one or more libraries. Users should check for
  2780. # the right platform before adding to their list. For Windows,
  2781. # libraries provided in "foo.lib" format will be converted to
  2782. # "-lfoo" when using GCC (mingw).
  2783. #
  2784. # Arguments:
  2785. # one or more file names
  2786. #
  2787. # Results:
  2788. #
  2789. # Defines and substs the following vars:
  2790. # PKG_LIBS
  2791. #------------------------------------------------------------------------
  2792. AC_DEFUN([TEA_ADD_LIBS], [
  2793. vars="$@"
  2794. for i in $vars; do
  2795. if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
  2796. # Convert foo.lib to -lfoo for GCC. No-op if not *.lib
  2797. i=`echo "$i" | sed -e 's/^\([[^-]].*\)\.[[lL]][[iI]][[bB]][$]/-l\1/'`
  2798. fi
  2799. PKG_LIBS="$PKG_LIBS $i"
  2800. done
  2801. AC_SUBST(PKG_LIBS)
  2802. ])
  2803. #------------------------------------------------------------------------
  2804. # TEA_ADD_CFLAGS --
  2805. #
  2806. # Specify one or more CFLAGS. Users should check for
  2807. # the right platform before adding to their list.
  2808. #
  2809. # Arguments:
  2810. # one or more file names
  2811. #
  2812. # Results:
  2813. #
  2814. # Defines and substs the following vars:
  2815. # PKG_CFLAGS
  2816. #------------------------------------------------------------------------
  2817. AC_DEFUN([TEA_ADD_CFLAGS], [
  2818. PKG_CFLAGS="$PKG_CFLAGS $@"
  2819. AC_SUBST(PKG_CFLAGS)
  2820. ])
  2821. #------------------------------------------------------------------------
  2822. # TEA_ADD_CLEANFILES --
  2823. #
  2824. # Specify one or more CLEANFILES.
  2825. #
  2826. # Arguments:
  2827. # one or more file names to clean target
  2828. #
  2829. # Results:
  2830. #
  2831. # Appends to CLEANFILES, already defined for subst in LOAD_TCLCONFIG
  2832. #------------------------------------------------------------------------
  2833. AC_DEFUN([TEA_ADD_CLEANFILES], [
  2834. CLEANFILES="$CLEANFILES $@"
  2835. ])
  2836. #------------------------------------------------------------------------
  2837. # TEA_PREFIX --
  2838. #
  2839. # Handle the --prefix=... option by defaulting to what Tcl gave
  2840. #
  2841. # Arguments:
  2842. # none
  2843. #
  2844. # Results:
  2845. #
  2846. # If --prefix or --exec-prefix was not specified, $prefix and
  2847. # $exec_prefix will be set to the values given to Tcl when it was
  2848. # configured.
  2849. #------------------------------------------------------------------------
  2850. AC_DEFUN([TEA_PREFIX], [
  2851. if test "${prefix}" = "NONE"; then
  2852. prefix_default=yes
  2853. if test x"${TCL_PREFIX}" != x; then
  2854. AC_MSG_NOTICE([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}])
  2855. prefix=${TCL_PREFIX}
  2856. else
  2857. AC_MSG_NOTICE([--prefix defaulting to /usr/local])
  2858. prefix=/usr/local
  2859. fi
  2860. fi
  2861. if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \
  2862. -o x"${exec_prefix_default}" = x"yes" ; then
  2863. if test x"${TCL_EXEC_PREFIX}" != x; then
  2864. AC_MSG_NOTICE([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}])
  2865. exec_prefix=${TCL_EXEC_PREFIX}
  2866. else
  2867. AC_MSG_NOTICE([--exec-prefix defaulting to ${prefix}])
  2868. exec_prefix=$prefix
  2869. fi
  2870. fi
  2871. ])
  2872. #------------------------------------------------------------------------
  2873. # TEA_SETUP_COMPILER_CC --
  2874. #
  2875. # Do compiler checks the way we want. This is just a replacement
  2876. # for AC_PROG_CC in TEA configure.ac files to make them cleaner.
  2877. #
  2878. # Arguments:
  2879. # none
  2880. #
  2881. # Results:
  2882. #
  2883. # Sets up CC var and other standard bits we need to make executables.
  2884. #------------------------------------------------------------------------
  2885. AC_DEFUN([TEA_SETUP_COMPILER_CC], [
  2886. # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE)
  2887. # in this macro, they need to go into TEA_SETUP_COMPILER instead.
  2888. AC_PROG_CC
  2889. AC_PROG_CPP
  2890. #--------------------------------------------------------------------
  2891. # Checks to see if the make program sets the $MAKE variable.
  2892. #--------------------------------------------------------------------
  2893. AC_PROG_MAKE_SET
  2894. #--------------------------------------------------------------------
  2895. # Find ranlib
  2896. #--------------------------------------------------------------------
  2897. AC_CHECK_TOOL(RANLIB, ranlib)
  2898. #--------------------------------------------------------------------
  2899. # Determines the correct binary file extension (.o, .obj, .exe etc.)
  2900. #--------------------------------------------------------------------
  2901. AC_OBJEXT
  2902. AC_EXEEXT
  2903. ])
  2904. #------------------------------------------------------------------------
  2905. # TEA_SETUP_COMPILER --
  2906. #
  2907. # Do compiler checks that use the compiler. This must go after
  2908. # TEA_SETUP_COMPILER_CC, which does the actual compiler check.
  2909. #
  2910. # Arguments:
  2911. # none
  2912. #
  2913. # Results:
  2914. #
  2915. # Sets up CC var and other standard bits we need to make executables.
  2916. #------------------------------------------------------------------------
  2917. AC_DEFUN([TEA_SETUP_COMPILER], [
  2918. # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here.
  2919. AC_REQUIRE([TEA_SETUP_COMPILER_CC])
  2920. #------------------------------------------------------------------------
  2921. # If we're using GCC, see if the compiler understands -pipe. If so, use it.
  2922. # It makes compiling go faster. (This is only a performance feature.)
  2923. #------------------------------------------------------------------------
  2924. if test -z "$no_pipe" -a -n "$GCC"; then
  2925. AC_CACHE_CHECK([if the compiler understands -pipe],
  2926. tcl_cv_cc_pipe, [
  2927. hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
  2928. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_pipe=yes],[tcl_cv_cc_pipe=no])
  2929. CFLAGS=$hold_cflags])
  2930. if test $tcl_cv_cc_pipe = yes; then
  2931. CFLAGS="$CFLAGS -pipe"
  2932. fi
  2933. fi
  2934. if test "${TCL_MAJOR_VERSION}" -lt 9 -a "${TCL_MINOR_VERSION}" -lt 7; then
  2935. AC_DEFINE(Tcl_Size, int, [Is 'Tcl_Size' in <tcl.h>?])
  2936. fi
  2937. #--------------------------------------------------------------------
  2938. # Common compiler flag setup
  2939. #--------------------------------------------------------------------
  2940. AC_C_BIGENDIAN(,,,[#])
  2941. ])
  2942. #------------------------------------------------------------------------
  2943. # TEA_MAKE_LIB --
  2944. #
  2945. # Generate a line that can be used to build a shared/unshared library
  2946. # in a platform independent manner.
  2947. #
  2948. # Arguments:
  2949. # none
  2950. #
  2951. # Requires:
  2952. #
  2953. # Results:
  2954. #
  2955. # Defines the following vars:
  2956. # CFLAGS - Done late here to note disturb other AC macros
  2957. # MAKE_LIB - Command to execute to build the Tcl library;
  2958. # differs depending on whether or not Tcl is being
  2959. # compiled as a shared library.
  2960. # MAKE_SHARED_LIB Makefile rule for building a shared library
  2961. # MAKE_STATIC_LIB Makefile rule for building a static library
  2962. # MAKE_STUB_LIB Makefile rule for building a stub library
  2963. # VC_MANIFEST_EMBED_DLL Makefile rule for embedded VC manifest in DLL
  2964. # VC_MANIFEST_EMBED_EXE Makefile rule for embedded VC manifest in EXE
  2965. #------------------------------------------------------------------------
  2966. AC_DEFUN([TEA_MAKE_LIB], [
  2967. if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
  2968. MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)"
  2969. MAKE_SHARED_LIB="\${SHLIB_LD} \${LDFLAGS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
  2970. AC_EGREP_CPP([manifest needed], [
  2971. #if defined(_MSC_VER) && _MSC_VER >= 1400
  2972. print("manifest needed")
  2973. #endif
  2974. ], [
  2975. # Could do a CHECK_PROG for mt, but should always be with MSVC8+
  2976. VC_MANIFEST_EMBED_DLL="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;2 ; fi"
  2977. VC_MANIFEST_EMBED_EXE="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;1 ; fi"
  2978. MAKE_SHARED_LIB="${MAKE_SHARED_LIB} ; ${VC_MANIFEST_EMBED_DLL}"
  2979. TEA_ADD_CLEANFILES([*.manifest])
  2980. ])
  2981. MAKE_STUB_LIB="\${STLIB_LD} -nodefaultlib -out:\[$]@ \$(PKG_STUB_OBJECTS)"
  2982. else
  2983. MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)"
  2984. MAKE_SHARED_LIB="\${SHLIB_LD} \${LDFLAGS} \${LDFLAGS_DEFAULT} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
  2985. MAKE_STUB_LIB="\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)"
  2986. fi
  2987. if test "${SHARED_BUILD}" = "1" ; then
  2988. MAKE_LIB="${MAKE_SHARED_LIB} "
  2989. else
  2990. MAKE_LIB="${MAKE_STATIC_LIB} "
  2991. fi
  2992. #--------------------------------------------------------------------
  2993. # Shared libraries and static libraries have different names.
  2994. # Use the double eval to make sure any variables in the suffix is
  2995. # substituted. (@@@ Might not be necessary anymore)
  2996. #--------------------------------------------------------------------
  2997. PACKAGE_LIB_PREFIX8="${PACKAGE_LIB_PREFIX}"
  2998. PACKAGE_LIB_PREFIX9="${PACKAGE_LIB_PREFIX}tcl9"
  2999. if test "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tcl8}" = x; then
  3000. PACKAGE_LIB_PREFIX="${PACKAGE_LIB_PREFIX9}"
  3001. else
  3002. PACKAGE_LIB_PREFIX="${PACKAGE_LIB_PREFIX8}"
  3003. AC_DEFINE(TCL_MAJOR_VERSION, 8, [Compile for Tcl8?])
  3004. fi
  3005. if test "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tk8}" != x; then
  3006. AC_DEFINE(TK_MAJOR_VERSION, 8, [Compile for Tk8?])
  3007. fi
  3008. if test "${TEA_PLATFORM}" = "windows" ; then
  3009. if test "${SHARED_BUILD}" = "1" ; then
  3010. # We force the unresolved linking of symbols that are really in
  3011. # the private libraries of Tcl and Tk.
  3012. if test x"${TK_BIN_DIR}" != x ; then
  3013. SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
  3014. fi
  3015. SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
  3016. if test "$GCC" = "yes"; then
  3017. SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -static-libgcc"
  3018. fi
  3019. eval eval "PKG_LIB_FILE8=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
  3020. eval eval "PKG_LIB_FILE9=${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
  3021. eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
  3022. else
  3023. if test "$GCC" = "yes"; then
  3024. PACKAGE_LIB_PREFIX=lib${PACKAGE_LIB_PREFIX}
  3025. fi
  3026. eval eval "PKG_LIB_FILE8=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
  3027. eval eval "PKG_LIB_FILE9=${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
  3028. eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
  3029. fi
  3030. # Some packages build their own stubs libraries
  3031. if test "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tcl8}" = x; then
  3032. eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}stub.a"
  3033. else
  3034. eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
  3035. fi
  3036. if test "$GCC" = "yes"; then
  3037. PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
  3038. fi
  3039. # These aren't needed on Windows (either MSVC or gcc)
  3040. RANLIB=:
  3041. RANLIB_STUB=:
  3042. else
  3043. RANLIB_STUB="${RANLIB}"
  3044. if test "${SHARED_BUILD}" = "1" ; then
  3045. SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
  3046. if test x"${TK_BIN_DIR}" != x ; then
  3047. SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
  3048. fi
  3049. eval eval "PKG_LIB_FILE8=lib${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
  3050. eval eval "PKG_LIB_FILE9=lib${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
  3051. eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
  3052. RANLIB=:
  3053. else
  3054. eval eval "PKG_LIB_FILE8=lib${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
  3055. eval eval "PKG_LIB_FILE9=lib${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
  3056. eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
  3057. fi
  3058. # Some packages build their own stubs libraries
  3059. if test "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tcl8}" = x; then
  3060. eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}stub.a"
  3061. else
  3062. eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
  3063. fi
  3064. fi
  3065. # These are escaped so that only CFLAGS is picked up at configure time.
  3066. # The other values will be substituted at make time.
  3067. CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
  3068. if test "${SHARED_BUILD}" = "1" ; then
  3069. CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
  3070. fi
  3071. AC_SUBST(MAKE_LIB)
  3072. AC_SUBST(MAKE_SHARED_LIB)
  3073. AC_SUBST(MAKE_STATIC_LIB)
  3074. AC_SUBST(MAKE_STUB_LIB)
  3075. # Substitute STUB_LIB_FILE in case package creates a stub library too.
  3076. AC_SUBST(PKG_STUB_LIB_FILE)
  3077. AC_SUBST(RANLIB_STUB)
  3078. AC_SUBST(VC_MANIFEST_EMBED_DLL)
  3079. AC_SUBST(VC_MANIFEST_EMBED_EXE)
  3080. ])
  3081. #------------------------------------------------------------------------
  3082. # TEA_LIB_SPEC --
  3083. #
  3084. # Compute the name of an existing object library located in libdir
  3085. # from the given base name and produce the appropriate linker flags.
  3086. #
  3087. # Arguments:
  3088. # basename The base name of the library without version
  3089. # numbers, extensions, or "lib" prefixes.
  3090. # extra_dir Extra directory in which to search for the
  3091. # library. This location is used first, then
  3092. # $prefix/$exec-prefix, then some defaults.
  3093. #
  3094. # Requires:
  3095. # TEA_INIT and TEA_PREFIX must be called first.
  3096. #
  3097. # Results:
  3098. #
  3099. # Defines the following vars:
  3100. # ${basename}_LIB_NAME The computed library name.
  3101. # ${basename}_LIB_SPEC The computed linker flags.
  3102. #------------------------------------------------------------------------
  3103. AC_DEFUN([TEA_LIB_SPEC], [
  3104. AC_MSG_CHECKING([for $1 library])
  3105. # Look in exec-prefix for the library (defined by TEA_PREFIX).
  3106. tea_lib_name_dir="${exec_prefix}/lib"
  3107. # Or in a user-specified location.
  3108. if test x"$2" != x ; then
  3109. tea_extra_lib_dir=$2
  3110. else
  3111. tea_extra_lib_dir=NONE
  3112. fi
  3113. for i in \
  3114. `ls -dr ${tea_extra_lib_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
  3115. `ls -dr ${tea_extra_lib_dir}/lib$1[[0-9]]* 2>/dev/null ` \
  3116. `ls -dr ${tea_lib_name_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
  3117. `ls -dr ${tea_lib_name_dir}/lib$1[[0-9]]* 2>/dev/null ` \
  3118. `ls -dr /usr/lib/$1[[0-9]]*.lib 2>/dev/null ` \
  3119. `ls -dr /usr/lib/lib$1[[0-9]]* 2>/dev/null ` \
  3120. `ls -dr /usr/lib64/$1[[0-9]]*.lib 2>/dev/null ` \
  3121. `ls -dr /usr/lib64/lib$1[[0-9]]* 2>/dev/null ` \
  3122. `ls -dr /usr/local/lib/$1[[0-9]]*.lib 2>/dev/null ` \
  3123. `ls -dr /usr/local/lib/lib$1[[0-9]]* 2>/dev/null ` ; do
  3124. if test -f "$i" ; then
  3125. tea_lib_name_dir=`dirname $i`
  3126. $1_LIB_NAME=`basename $i`
  3127. $1_LIB_PATH_NAME=$i
  3128. break
  3129. fi
  3130. done
  3131. if test "${TEA_PLATFORM}" = "windows"; then
  3132. $1_LIB_SPEC=\"`${CYGPATH} ${$1_LIB_PATH_NAME} 2>/dev/null`\"
  3133. else
  3134. # Strip off the leading "lib" and trailing ".a" or ".so"
  3135. tea_lib_name_lib=`echo ${$1_LIB_NAME}|sed -e 's/^lib//' -e 's/\.[[^.]]*$//' -e 's/\.so.*//'`
  3136. $1_LIB_SPEC="-L${tea_lib_name_dir} -l${tea_lib_name_lib}"
  3137. fi
  3138. if test "x${$1_LIB_NAME}" = x ; then
  3139. AC_MSG_ERROR([not found])
  3140. else
  3141. AC_MSG_RESULT([${$1_LIB_SPEC}])
  3142. fi
  3143. ])
  3144. #------------------------------------------------------------------------
  3145. # TEA_PRIVATE_TCL_HEADERS --
  3146. #
  3147. # Locate the private Tcl include files
  3148. #
  3149. # Arguments:
  3150. #
  3151. # Requires:
  3152. # TCL_SRC_DIR Assumes that TEA_LOAD_TCLCONFIG has
  3153. # already been called.
  3154. #
  3155. # Results:
  3156. #
  3157. # Substitutes the following vars:
  3158. # TCL_TOP_DIR_NATIVE
  3159. # TCL_INCLUDES
  3160. #------------------------------------------------------------------------
  3161. AC_DEFUN([TEA_PRIVATE_TCL_HEADERS], [
  3162. # Allow for --with-tclinclude to take effect and define ${ac_cv_c_tclh}
  3163. AC_REQUIRE([TEA_PUBLIC_TCL_HEADERS])
  3164. AC_MSG_CHECKING([for Tcl private include files])
  3165. TCL_SRC_DIR_NATIVE=`${CYGPATH} ${TCL_SRC_DIR}`
  3166. TCL_TOP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}\"
  3167. # Check to see if tcl<Plat>Port.h isn't already with the public headers
  3168. # Don't look for tclInt.h because that resides with tcl.h in the core
  3169. # sources, but the <plat>Port headers are in a different directory
  3170. if test "${TEA_PLATFORM}" = "windows" -a \
  3171. -f "${ac_cv_c_tclh}/tclWinPort.h"; then
  3172. result="private headers found with public headers"
  3173. elif test "${TEA_PLATFORM}" = "unix" -a \
  3174. -f "${ac_cv_c_tclh}/tclUnixPort.h"; then
  3175. result="private headers found with public headers"
  3176. else
  3177. TCL_GENERIC_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/generic\"
  3178. if test "${TEA_PLATFORM}" = "windows"; then
  3179. TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/win\"
  3180. else
  3181. TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/unix\"
  3182. fi
  3183. # Overwrite the previous TCL_INCLUDES as this should capture both
  3184. # public and private headers in the same set.
  3185. # We want to ensure these are substituted so as not to require
  3186. # any *_NATIVE vars be defined in the Makefile
  3187. TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}"
  3188. if test "`uname -s`" = "Darwin"; then
  3189. # If Tcl was built as a framework, attempt to use
  3190. # the framework's Headers and PrivateHeaders directories
  3191. case ${TCL_DEFS} in
  3192. *TCL_FRAMEWORK*)
  3193. if test -d "${TCL_BIN_DIR}/Headers" -a \
  3194. -d "${TCL_BIN_DIR}/PrivateHeaders"; then
  3195. TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"
  3196. else
  3197. TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
  3198. fi
  3199. ;;
  3200. esac
  3201. result="Using ${TCL_INCLUDES}"
  3202. else
  3203. if test ! -f "${TCL_SRC_DIR}/generic/tclInt.h" ; then
  3204. AC_MSG_ERROR([Cannot find private header tclInt.h in ${TCL_SRC_DIR}])
  3205. fi
  3206. result="Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}"
  3207. fi
  3208. fi
  3209. AC_SUBST(TCL_TOP_DIR_NATIVE)
  3210. AC_SUBST(TCL_INCLUDES)
  3211. AC_MSG_RESULT([${result}])
  3212. ])
  3213. #------------------------------------------------------------------------
  3214. # TEA_PUBLIC_TCL_HEADERS --
  3215. #
  3216. # Locate the installed public Tcl header files
  3217. #
  3218. # Arguments:
  3219. # None.
  3220. #
  3221. # Requires:
  3222. # CYGPATH must be set
  3223. #
  3224. # Results:
  3225. #
  3226. # Adds a --with-tclinclude switch to configure.
  3227. # Result is cached.
  3228. #
  3229. # Substitutes the following vars:
  3230. # TCL_INCLUDES
  3231. #------------------------------------------------------------------------
  3232. AC_DEFUN([TEA_PUBLIC_TCL_HEADERS], [
  3233. AC_MSG_CHECKING([for Tcl public headers])
  3234. AC_ARG_WITH(tclinclude, [ --with-tclinclude directory containing the public Tcl header files], with_tclinclude=${withval})
  3235. AC_CACHE_VAL(ac_cv_c_tclh, [
  3236. # Use the value from --with-tclinclude, if it was given
  3237. if test x"${with_tclinclude}" != x ; then
  3238. if test -f "${with_tclinclude}/tcl.h" ; then
  3239. ac_cv_c_tclh=${with_tclinclude}
  3240. else
  3241. AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h])
  3242. fi
  3243. else
  3244. list=""
  3245. if test "`uname -s`" = "Darwin"; then
  3246. # If Tcl was built as a framework, attempt to use
  3247. # the framework's Headers directory
  3248. case ${TCL_DEFS} in
  3249. *TCL_FRAMEWORK*)
  3250. list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`"
  3251. ;;
  3252. esac
  3253. fi
  3254. # Look in the source dir only if Tcl is not installed,
  3255. # and in that situation, look there before installed locations.
  3256. if test -f "${TCL_BIN_DIR}/Makefile" ; then
  3257. list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`"
  3258. fi
  3259. # Check order: pkg --prefix location, Tcl's --prefix location,
  3260. # relative to directory of tclConfig.sh.
  3261. eval "temp_includedir=${includedir}"
  3262. list="$list \
  3263. `ls -d ${temp_includedir} 2>/dev/null` \
  3264. `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
  3265. `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
  3266. if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
  3267. list="$list /usr/local/include /usr/include"
  3268. if test x"${TCL_INCLUDE_SPEC}" != x ; then
  3269. d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'`
  3270. list="$list `ls -d ${d} 2>/dev/null`"
  3271. fi
  3272. fi
  3273. for i in $list ; do
  3274. if test -f "$i/tcl.h" ; then
  3275. ac_cv_c_tclh=$i
  3276. break
  3277. fi
  3278. done
  3279. fi
  3280. ])
  3281. # Print a message based on how we determined the include path
  3282. if test x"${ac_cv_c_tclh}" = x ; then
  3283. AC_MSG_ERROR([tcl.h not found. Please specify its location with --with-tclinclude])
  3284. else
  3285. AC_MSG_RESULT([${ac_cv_c_tclh}])
  3286. fi
  3287. # Convert to a native path and substitute into the output files.
  3288. INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}`
  3289. TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
  3290. AC_SUBST(TCL_INCLUDES)
  3291. ])
  3292. #------------------------------------------------------------------------
  3293. # TEA_PRIVATE_TK_HEADERS --
  3294. #
  3295. # Locate the private Tk include files
  3296. #
  3297. # Arguments:
  3298. #
  3299. # Requires:
  3300. # TK_SRC_DIR Assumes that TEA_LOAD_TKCONFIG has
  3301. # already been called.
  3302. #
  3303. # Results:
  3304. #
  3305. # Substitutes the following vars:
  3306. # TK_INCLUDES
  3307. #------------------------------------------------------------------------
  3308. AC_DEFUN([TEA_PRIVATE_TK_HEADERS], [
  3309. # Allow for --with-tkinclude to take effect and define ${ac_cv_c_tkh}
  3310. AC_REQUIRE([TEA_PUBLIC_TK_HEADERS])
  3311. AC_MSG_CHECKING([for Tk private include files])
  3312. TK_SRC_DIR_NATIVE=`${CYGPATH} ${TK_SRC_DIR}`
  3313. TK_TOP_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}\"
  3314. # Check to see if tk<Plat>Port.h isn't already with the public headers
  3315. # Don't look for tkInt.h because that resides with tk.h in the core
  3316. # sources, but the <plat>Port headers are in a different directory
  3317. if test "${TEA_PLATFORM}" = "windows" -a \
  3318. -f "${ac_cv_c_tkh}/tkWinPort.h"; then
  3319. result="private headers found with public headers"
  3320. elif test "${TEA_PLATFORM}" = "unix" -a \
  3321. -f "${ac_cv_c_tkh}/tkUnixPort.h"; then
  3322. result="private headers found with public headers"
  3323. else
  3324. TK_GENERIC_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/generic\"
  3325. TK_XLIB_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/xlib\"
  3326. if test "${TEA_PLATFORM}" = "windows"; then
  3327. TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/win\"
  3328. else
  3329. TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/unix\"
  3330. fi
  3331. # Overwrite the previous TK_INCLUDES as this should capture both
  3332. # public and private headers in the same set.
  3333. # We want to ensure these are substituted so as not to require
  3334. # any *_NATIVE vars be defined in the Makefile
  3335. TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}"
  3336. # Detect and add ttk subdir
  3337. if test -d "${TK_SRC_DIR}/generic/ttk"; then
  3338. TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/generic/ttk\""
  3339. fi
  3340. if test "${TEA_WINDOWINGSYSTEM}" != "x11"; then
  3341. TK_INCLUDES="${TK_INCLUDES} -I\"${TK_XLIB_DIR_NATIVE}\""
  3342. fi
  3343. if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
  3344. TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/macosx\""
  3345. fi
  3346. if test "`uname -s`" = "Darwin"; then
  3347. # If Tk was built as a framework, attempt to use
  3348. # the framework's Headers and PrivateHeaders directories
  3349. case ${TK_DEFS} in
  3350. *TK_FRAMEWORK*)
  3351. if test -d "${TK_BIN_DIR}/Headers" -a \
  3352. -d "${TK_BIN_DIR}/PrivateHeaders"; then
  3353. TK_INCLUDES="-I\"${TK_BIN_DIR}/Headers\" -I\"${TK_BIN_DIR}/PrivateHeaders\" ${TK_INCLUDES}"
  3354. else
  3355. TK_INCLUDES="${TK_INCLUDES} ${TK_INCLUDE_SPEC} `echo "${TK_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
  3356. fi
  3357. ;;
  3358. esac
  3359. result="Using ${TK_INCLUDES}"
  3360. else
  3361. if test ! -f "${TK_SRC_DIR}/generic/tkInt.h" ; then
  3362. AC_MSG_ERROR([Cannot find private header tkInt.h in ${TK_SRC_DIR}])
  3363. fi
  3364. result="Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}"
  3365. fi
  3366. fi
  3367. AC_SUBST(TK_TOP_DIR_NATIVE)
  3368. AC_SUBST(TK_XLIB_DIR_NATIVE)
  3369. AC_SUBST(TK_INCLUDES)
  3370. AC_MSG_RESULT([${result}])
  3371. ])
  3372. #------------------------------------------------------------------------
  3373. # TEA_PUBLIC_TK_HEADERS --
  3374. #
  3375. # Locate the installed public Tk header files
  3376. #
  3377. # Arguments:
  3378. # None.
  3379. #
  3380. # Requires:
  3381. # CYGPATH must be set
  3382. #
  3383. # Results:
  3384. #
  3385. # Adds a --with-tkinclude switch to configure.
  3386. # Result is cached.
  3387. #
  3388. # Substitutes the following vars:
  3389. # TK_INCLUDES
  3390. #------------------------------------------------------------------------
  3391. AC_DEFUN([TEA_PUBLIC_TK_HEADERS], [
  3392. AC_MSG_CHECKING([for Tk public headers])
  3393. AC_ARG_WITH(tkinclude, [ --with-tkinclude directory containing the public Tk header files], with_tkinclude=${withval})
  3394. AC_CACHE_VAL(ac_cv_c_tkh, [
  3395. # Use the value from --with-tkinclude, if it was given
  3396. if test x"${with_tkinclude}" != x ; then
  3397. if test -f "${with_tkinclude}/tk.h" ; then
  3398. ac_cv_c_tkh=${with_tkinclude}
  3399. else
  3400. AC_MSG_ERROR([${with_tkinclude} directory does not contain tk.h])
  3401. fi
  3402. else
  3403. list=""
  3404. if test "`uname -s`" = "Darwin"; then
  3405. # If Tk was built as a framework, attempt to use
  3406. # the framework's Headers directory.
  3407. case ${TK_DEFS} in
  3408. *TK_FRAMEWORK*)
  3409. list="`ls -d ${TK_BIN_DIR}/Headers 2>/dev/null`"
  3410. ;;
  3411. esac
  3412. fi
  3413. # Look in the source dir only if Tk is not installed,
  3414. # and in that situation, look there before installed locations.
  3415. if test -f "${TK_BIN_DIR}/Makefile" ; then
  3416. list="$list `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`"
  3417. fi
  3418. # Check order: pkg --prefix location, Tk's --prefix location,
  3419. # relative to directory of tkConfig.sh, Tcl's --prefix location,
  3420. # relative to directory of tclConfig.sh.
  3421. eval "temp_includedir=${includedir}"
  3422. list="$list \
  3423. `ls -d ${temp_includedir} 2>/dev/null` \
  3424. `ls -d ${TK_PREFIX}/include 2>/dev/null` \
  3425. `ls -d ${TK_BIN_DIR}/../include 2>/dev/null` \
  3426. `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
  3427. `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
  3428. if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
  3429. list="$list /usr/local/include /usr/include"
  3430. if test x"${TK_INCLUDE_SPEC}" != x ; then
  3431. d=`echo "${TK_INCLUDE_SPEC}" | sed -e 's/^-I//'`
  3432. list="$list `ls -d ${d} 2>/dev/null`"
  3433. fi
  3434. fi
  3435. for i in $list ; do
  3436. if test -f "$i/tk.h" ; then
  3437. ac_cv_c_tkh=$i
  3438. break
  3439. fi
  3440. done
  3441. fi
  3442. ])
  3443. # Print a message based on how we determined the include path
  3444. if test x"${ac_cv_c_tkh}" = x ; then
  3445. AC_MSG_ERROR([tk.h not found. Please specify its location with --with-tkinclude])
  3446. else
  3447. AC_MSG_RESULT([${ac_cv_c_tkh}])
  3448. fi
  3449. # Convert to a native path and substitute into the output files.
  3450. INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}`
  3451. TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
  3452. AC_SUBST(TK_INCLUDES)
  3453. if test "${TEA_WINDOWINGSYSTEM}" != "x11"; then
  3454. # On Windows and Aqua, we need the X compat headers
  3455. AC_MSG_CHECKING([for X11 header files])
  3456. if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then
  3457. INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`"
  3458. TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
  3459. AC_SUBST(TK_XINCLUDES)
  3460. fi
  3461. AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}])
  3462. fi
  3463. ])
  3464. #------------------------------------------------------------------------
  3465. # TEA_PATH_CONFIG --
  3466. #
  3467. # Locate the ${1}Config.sh file and perform a sanity check on
  3468. # the ${1} compile flags. These are used by packages like
  3469. # [incr Tk] that load *Config.sh files from more than Tcl and Tk.
  3470. #
  3471. # Arguments:
  3472. # none
  3473. #
  3474. # Results:
  3475. #
  3476. # Adds the following arguments to configure:
  3477. # --with-$1=...
  3478. #
  3479. # Defines the following vars:
  3480. # $1_BIN_DIR Full path to the directory containing
  3481. # the $1Config.sh file
  3482. #------------------------------------------------------------------------
  3483. AC_DEFUN([TEA_PATH_CONFIG], [
  3484. #
  3485. # Ok, lets find the $1 configuration
  3486. # First, look for one uninstalled.
  3487. # the alternative search directory is invoked by --with-$1
  3488. #
  3489. if test x"${no_$1}" = x ; then
  3490. # we reset no_$1 in case something fails here
  3491. no_$1=true
  3492. AC_ARG_WITH($1, [ --with-$1 directory containing $1 configuration ($1Config.sh)], with_$1config=${withval})
  3493. AC_MSG_CHECKING([for $1 configuration])
  3494. AC_CACHE_VAL(ac_cv_c_$1config,[
  3495. # First check to see if --with-$1 was specified.
  3496. if test x"${with_$1config}" != x ; then
  3497. case ${with_$1config} in
  3498. */$1Config.sh )
  3499. if test -f ${with_$1config}; then
  3500. AC_MSG_WARN([--with-$1 argument should refer to directory containing $1Config.sh, not to $1Config.sh itself])
  3501. with_$1config=`echo ${with_$1config} | sed 's!/$1Config\.sh$!!'`
  3502. fi;;
  3503. esac
  3504. if test -f "${with_$1config}/$1Config.sh" ; then
  3505. ac_cv_c_$1config=`(cd ${with_$1config}; pwd)`
  3506. else
  3507. AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh])
  3508. fi
  3509. fi
  3510. # then check for a private $1 installation
  3511. if test x"${ac_cv_c_$1config}" = x ; then
  3512. for i in \
  3513. ../$1 \
  3514. `ls -dr ../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
  3515. `ls -dr ../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
  3516. `ls -dr ../$1*[[0-9]].[[0-9]] 2>/dev/null` \
  3517. `ls -dr ../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
  3518. ../../$1 \
  3519. `ls -dr ../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
  3520. `ls -dr ../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
  3521. `ls -dr ../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
  3522. `ls -dr ../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
  3523. ../../../$1 \
  3524. `ls -dr ../../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
  3525. `ls -dr ../../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
  3526. `ls -dr ../../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
  3527. `ls -dr ../../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
  3528. ${srcdir}/../$1 \
  3529. `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
  3530. `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
  3531. `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]] 2>/dev/null` \
  3532. `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
  3533. ; do
  3534. if test -f "$i/$1Config.sh" ; then
  3535. ac_cv_c_$1config=`(cd $i; pwd)`
  3536. break
  3537. fi
  3538. if test -f "$i/unix/$1Config.sh" ; then
  3539. ac_cv_c_$1config=`(cd $i/unix; pwd)`
  3540. break
  3541. fi
  3542. done
  3543. fi
  3544. # check in a few common install locations
  3545. if test x"${ac_cv_c_$1config}" = x ; then
  3546. for i in `ls -d ${libdir} 2>/dev/null` \
  3547. `ls -d ${exec_prefix}/lib 2>/dev/null` \
  3548. `ls -d ${prefix}/lib 2>/dev/null` \
  3549. `ls -d /usr/local/lib 2>/dev/null` \
  3550. `ls -d /usr/contrib/lib 2>/dev/null` \
  3551. `ls -d /usr/pkg/lib 2>/dev/null` \
  3552. `ls -d /usr/lib 2>/dev/null` \
  3553. `ls -d /usr/lib64 2>/dev/null` \
  3554. ; do
  3555. if test -f "$i/$1Config.sh" ; then
  3556. ac_cv_c_$1config=`(cd $i; pwd)`
  3557. break
  3558. fi
  3559. done
  3560. fi
  3561. ])
  3562. if test x"${ac_cv_c_$1config}" = x ; then
  3563. $1_BIN_DIR="# no $1 configs found"
  3564. AC_MSG_WARN([Cannot find $1 configuration definitions])
  3565. exit 0
  3566. else
  3567. no_$1=
  3568. $1_BIN_DIR=${ac_cv_c_$1config}
  3569. AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh])
  3570. fi
  3571. fi
  3572. ])
  3573. #------------------------------------------------------------------------
  3574. # TEA_LOAD_CONFIG --
  3575. #
  3576. # Load the $1Config.sh file
  3577. #
  3578. # Arguments:
  3579. #
  3580. # Requires the following vars to be set:
  3581. # $1_BIN_DIR
  3582. #
  3583. # Results:
  3584. #
  3585. # Substitutes the following vars:
  3586. # $1_SRC_DIR
  3587. # $1_LIB_FILE
  3588. # $1_LIB_SPEC
  3589. #------------------------------------------------------------------------
  3590. AC_DEFUN([TEA_LOAD_CONFIG], [
  3591. AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh])
  3592. if test -f "${$1_BIN_DIR}/$1Config.sh" ; then
  3593. AC_MSG_RESULT([loading])
  3594. . "${$1_BIN_DIR}/$1Config.sh"
  3595. else
  3596. AC_MSG_RESULT([file not found])
  3597. fi
  3598. #
  3599. # If the $1_BIN_DIR is the build directory (not the install directory),
  3600. # then set the common variable name to the value of the build variables.
  3601. # For example, the variable $1_LIB_SPEC will be set to the value
  3602. # of $1_BUILD_LIB_SPEC. An extension should make use of $1_LIB_SPEC
  3603. # instead of $1_BUILD_LIB_SPEC since it will work with both an
  3604. # installed and uninstalled version of Tcl.
  3605. #
  3606. if test -f "${$1_BIN_DIR}/Makefile" ; then
  3607. AC_MSG_WARN([Found Makefile - using build library specs for $1])
  3608. $1_LIB_SPEC=${$1_BUILD_LIB_SPEC}
  3609. $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC}
  3610. $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH}
  3611. $1_INCLUDE_SPEC=${$1_BUILD_INCLUDE_SPEC}
  3612. $1_LIBRARY_PATH=${$1_LIBRARY_PATH}
  3613. fi
  3614. AC_SUBST($1_VERSION)
  3615. AC_SUBST($1_BIN_DIR)
  3616. AC_SUBST($1_SRC_DIR)
  3617. AC_SUBST($1_LIB_FILE)
  3618. AC_SUBST($1_LIB_SPEC)
  3619. AC_SUBST($1_STUB_LIB_FILE)
  3620. AC_SUBST($1_STUB_LIB_SPEC)
  3621. AC_SUBST($1_STUB_LIB_PATH)
  3622. # Allow the caller to prevent this auto-check by specifying any 2nd arg
  3623. AS_IF([test "x$2" = x], [
  3624. # Check both upper and lower-case variants
  3625. # If a dev wanted non-stubs libs, this function could take an option
  3626. # to not use _STUB in the paths below
  3627. AS_IF([test "x${$1_STUB_LIB_SPEC}" = x],
  3628. [TEA_LOAD_CONFIG_LIB(translit($1,[a-z],[A-Z])_STUB)],
  3629. [TEA_LOAD_CONFIG_LIB($1_STUB)])
  3630. ])
  3631. ])
  3632. #------------------------------------------------------------------------
  3633. # TEA_LOAD_CONFIG_LIB --
  3634. #
  3635. # Helper function to load correct library from another extension's
  3636. # ${PACKAGE}Config.sh.
  3637. #
  3638. # Results:
  3639. # Adds to LIBS the appropriate extension library
  3640. #------------------------------------------------------------------------
  3641. AC_DEFUN([TEA_LOAD_CONFIG_LIB], [
  3642. AC_MSG_CHECKING([For $1 library for LIBS])
  3643. # This simplifies the use of stub libraries by automatically adding
  3644. # the stub lib to your path. Normally this would add to SHLIB_LD_LIBS,
  3645. # but this is called before CONFIG_CFLAGS. More importantly, this adds
  3646. # to PKG_LIBS, which becomes LIBS, and that is only used by SHLIB_LD.
  3647. if test "x${$1_LIB_SPEC}" != "x" ; then
  3648. if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes" ; then
  3649. TEA_ADD_LIBS([\"`${CYGPATH} ${$1_LIB_PATH}`\"])
  3650. AC_MSG_RESULT([using $1_LIB_PATH ${$1_LIB_PATH}])
  3651. else
  3652. TEA_ADD_LIBS([${$1_LIB_SPEC}])
  3653. AC_MSG_RESULT([using $1_LIB_SPEC ${$1_LIB_SPEC}])
  3654. fi
  3655. else
  3656. AC_MSG_RESULT([file not found])
  3657. fi
  3658. ])
  3659. #------------------------------------------------------------------------
  3660. # TEA_EXPORT_CONFIG --
  3661. #
  3662. # Define the data to insert into the ${PACKAGE}Config.sh file
  3663. #
  3664. # Arguments:
  3665. #
  3666. # Requires the following vars to be set:
  3667. # $1
  3668. #
  3669. # Results:
  3670. # Substitutes the following vars:
  3671. #------------------------------------------------------------------------
  3672. AC_DEFUN([TEA_EXPORT_CONFIG], [
  3673. #--------------------------------------------------------------------
  3674. # These are for $1Config.sh
  3675. #--------------------------------------------------------------------
  3676. # pkglibdir must be a fully qualified path and (not ${exec_prefix}/lib)
  3677. eval pkglibdir="[$]{libdir}/$1${PACKAGE_VERSION}"
  3678. if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
  3679. eval $1_LIB_FLAG="-l$1${PACKAGE_VERSION}"
  3680. eval $1_STUB_LIB_FLAG="-l$1stub${PACKAGE_VERSION}"
  3681. else
  3682. eval $1_LIB_FLAG="-l$1`echo ${PACKAGE_VERSION} | tr -d .`"
  3683. eval $1_STUB_LIB_FLAG="-l$1stub`echo ${PACKAGE_VERSION} | tr -d .`"
  3684. fi
  3685. if test "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tcl8}" = x; then
  3686. eval $1_STUB_LIB_FLAG="-l$1stub"
  3687. fi
  3688. $1_BUILD_LIB_SPEC="-L`$CYGPATH $(pwd)` ${$1_LIB_FLAG}"
  3689. $1_LIB_SPEC="-L`$CYGPATH ${pkglibdir}` ${$1_LIB_FLAG}"
  3690. $1_BUILD_STUB_LIB_SPEC="-L`$CYGPATH $(pwd)` [$]{$1_STUB_LIB_FLAG}"
  3691. $1_STUB_LIB_SPEC="-L`$CYGPATH ${pkglibdir}` [$]{$1_STUB_LIB_FLAG}"
  3692. $1_BUILD_STUB_LIB_PATH="`$CYGPATH $(pwd)`/[$]{PKG_STUB_LIB_FILE}"
  3693. $1_STUB_LIB_PATH="`$CYGPATH ${pkglibdir}`/[$]{PKG_STUB_LIB_FILE}"
  3694. AC_SUBST($1_BUILD_LIB_SPEC)
  3695. AC_SUBST($1_LIB_SPEC)
  3696. AC_SUBST($1_BUILD_STUB_LIB_SPEC)
  3697. AC_SUBST($1_STUB_LIB_SPEC)
  3698. AC_SUBST($1_BUILD_STUB_LIB_PATH)
  3699. AC_SUBST($1_STUB_LIB_PATH)
  3700. AC_SUBST(MAJOR_VERSION)
  3701. AC_SUBST(MINOR_VERSION)
  3702. AC_SUBST(PATCHLEVEL)
  3703. ])
  3704. #------------------------------------------------------------------------
  3705. # TEA_INSTALLER --
  3706. #
  3707. # Configure the installer.
  3708. #
  3709. # Arguments:
  3710. # none
  3711. #
  3712. # Results:
  3713. # Substitutes the following vars:
  3714. # INSTALL
  3715. # INSTALL_DATA_DIR
  3716. # INSTALL_DATA
  3717. # INSTALL_PROGRAM
  3718. # INSTALL_SCRIPT
  3719. # INSTALL_LIBRARY
  3720. #------------------------------------------------------------------------
  3721. AC_DEFUN([TEA_INSTALLER], [
  3722. INSTALL='$(SHELL) $(srcdir)/tclconfig/install-sh -c'
  3723. INSTALL_DATA_DIR='${INSTALL} -d -m 755'
  3724. INSTALL_DATA='${INSTALL} -m 644'
  3725. INSTALL_PROGRAM='${INSTALL} -m 755'
  3726. INSTALL_SCRIPT='${INSTALL} -m 755'
  3727. TEA_CONFIG_SYSTEM
  3728. case $system in
  3729. HP-UX-*) INSTALL_LIBRARY='${INSTALL} -m 755' ;;
  3730. *) INSTALL_LIBRARY='${INSTALL} -m 644' ;;
  3731. esac
  3732. AC_SUBST(INSTALL)
  3733. AC_SUBST(INSTALL_DATA_DIR)
  3734. AC_SUBST(INSTALL_DATA)
  3735. AC_SUBST(INSTALL_PROGRAM)
  3736. AC_SUBST(INSTALL_SCRIPT)
  3737. AC_SUBST(INSTALL_LIBRARY)
  3738. ])
  3739. ###
  3740. # Tip 430 - ZipFS Modifications
  3741. ###
  3742. #------------------------------------------------------------------------
  3743. # TEA_ZIPFS_SUPPORT
  3744. # Locate a zip encoder installed on the system path, or none.
  3745. #
  3746. # Arguments:
  3747. # none
  3748. #
  3749. # Results:
  3750. # Substitutes the following vars:
  3751. # MACHER_PROG
  3752. # ZIP_PROG
  3753. # ZIP_PROG_OPTIONS
  3754. # ZIP_PROG_VFSSEARCH
  3755. # ZIP_INSTALL_OBJS
  3756. #------------------------------------------------------------------------
  3757. AC_DEFUN([TEA_ZIPFS_SUPPORT], [
  3758. MACHER_PROG=""
  3759. ZIP_PROG=""
  3760. ZIP_PROG_OPTIONS=""
  3761. ZIP_PROG_VFSSEARCH=""
  3762. ZIP_INSTALL_OBJS=""
  3763. AC_MSG_CHECKING([for macher])
  3764. AC_CACHE_VAL(ac_cv_path_macher, [
  3765. search_path=`echo ${PATH} | sed -e 's/:/ /g'`
  3766. for dir in $search_path ; do
  3767. for j in `ls -r $dir/macher 2> /dev/null` \
  3768. `ls -r $dir/macher 2> /dev/null` ; do
  3769. if test x"$ac_cv_path_macher" = x ; then
  3770. if test -f "$j" ; then
  3771. ac_cv_path_macher=$j
  3772. break
  3773. fi
  3774. fi
  3775. done
  3776. done
  3777. ])
  3778. if test -f "$ac_cv_path_macher" ; then
  3779. MACHER_PROG="$ac_cv_path_macher"
  3780. AC_MSG_RESULT([$MACHER_PROG])
  3781. AC_MSG_RESULT([Found macher in environment])
  3782. fi
  3783. AC_MSG_CHECKING([for zip])
  3784. AC_CACHE_VAL(ac_cv_path_zip, [
  3785. search_path=`echo ${PATH} | sed -e 's/:/ /g'`
  3786. for dir in $search_path ; do
  3787. for j in `ls -r $dir/zip 2> /dev/null` \
  3788. `ls -r $dir/zip 2> /dev/null` ; do
  3789. if test x"$ac_cv_path_zip" = x ; then
  3790. if test -f "$j" ; then
  3791. ac_cv_path_zip=$j
  3792. break
  3793. fi
  3794. fi
  3795. done
  3796. done
  3797. ])
  3798. if test -f "$ac_cv_path_zip" ; then
  3799. ZIP_PROG="$ac_cv_path_zip"
  3800. AC_MSG_RESULT([$ZIP_PROG])
  3801. ZIP_PROG_OPTIONS="-rq"
  3802. ZIP_PROG_VFSSEARCH="*"
  3803. AC_MSG_RESULT([Found INFO Zip in environment])
  3804. # Use standard arguments for zip
  3805. else
  3806. # It is not an error if an installed version of Zip can't be located.
  3807. # We can use the locally distributed minizip instead
  3808. ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}"
  3809. ZIP_PROG_OPTIONS="-o -r"
  3810. ZIP_PROG_VFSSEARCH="*"
  3811. ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}"
  3812. AC_MSG_RESULT([No zip found on PATH. Building minizip])
  3813. fi
  3814. AC_SUBST(MACHER_PROG)
  3815. AC_SUBST(ZIP_PROG)
  3816. AC_SUBST(ZIP_PROG_OPTIONS)
  3817. AC_SUBST(ZIP_PROG_VFSSEARCH)
  3818. AC_SUBST(ZIP_INSTALL_OBJS)
  3819. ])
  3820. # Local Variables:
  3821. # mode: autoconf
  3822. # End: