tcl.m4 131 KB

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