tcl.m4 126 KB

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