2
0

autoconf.info 1.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690
  1. This is autoconf.info, produced by makeinfo version 4.13 from
  2. autoconf.texi.
  3. This manual (24 April 2012) is for GNU Autoconf (version 2.69), a
  4. package for creating scripts to configure source code packages using
  5. templates and an M4 macro package.
  6. Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
  7. Permission is granted to copy, distribute and/or modify this
  8. document under the terms of the GNU Free Documentation License,
  9. Version 1.3 or any later version published by the Free Software
  10. Foundation; with no Invariant Sections, no Front-Cover texts, and
  11. no Back-Cover Texts. A copy of the license is included in the
  12. section entitled "GNU Free Documentation License."
  13. INFO-DIR-SECTION Software development
  14. START-INFO-DIR-ENTRY
  15. * Autoconf: (autoconf). Create source code configuration scripts.
  16. END-INFO-DIR-ENTRY
  17. INFO-DIR-SECTION Individual utilities
  18. START-INFO-DIR-ENTRY
  19. * autoscan: (autoconf)autoscan Invocation.
  20. Semi-automatic `configure.ac' writing
  21. * ifnames: (autoconf)ifnames Invocation. Listing conditionals in source.
  22. * autoconf-invocation: (autoconf)autoconf Invocation.
  23. How to create configuration scripts
  24. * autoreconf: (autoconf)autoreconf Invocation.
  25. Remaking multiple `configure' scripts
  26. * autoheader: (autoconf)autoheader Invocation.
  27. How to create configuration templates
  28. * autom4te: (autoconf)autom4te Invocation.
  29. The Autoconf executables backbone
  30. * configure: (autoconf)configure Invocation. Configuring a package.
  31. * autoupdate: (autoconf)autoupdate Invocation.
  32. Automatic update of `configure.ac'
  33. * config.status: (autoconf)config.status Invocation. Recreating configurations.
  34. * testsuite: (autoconf)testsuite Invocation. Running an Autotest test suite.
  35. END-INFO-DIR-ENTRY
  36. 
  37. File: autoconf.info, Node: Top, Next: Introduction, Up: (dir)
  38. Autoconf
  39. ********
  40. This manual (24 April 2012) is for GNU Autoconf (version 2.69), a
  41. package for creating scripts to configure source code packages using
  42. templates and an M4 macro package.
  43. Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
  44. Permission is granted to copy, distribute and/or modify this
  45. document under the terms of the GNU Free Documentation License,
  46. Version 1.3 or any later version published by the Free Software
  47. Foundation; with no Invariant Sections, no Front-Cover texts, and
  48. no Back-Cover Texts. A copy of the license is included in the
  49. section entitled "GNU Free Documentation License."
  50. * Menu:
  51. * Introduction:: Autoconf's purpose, strengths, and weaknesses
  52. * The GNU Build System:: A set of tools for portable software packages
  53. * Making configure Scripts:: How to organize and produce Autoconf scripts
  54. * Setup:: Initialization and output
  55. * Existing Tests:: Macros that check for particular features
  56. * Writing Tests:: How to write new feature checks
  57. * Results:: What to do with results from feature checks
  58. * Programming in M4:: Layers on top of which Autoconf is written
  59. * Programming in M4sh:: Shell portability layer
  60. * Writing Autoconf Macros:: Adding new macros to Autoconf
  61. * Portable Shell:: Shell script portability pitfalls
  62. * Portable Make:: Makefile portability pitfalls
  63. * Portable C and C++:: C and C++ portability pitfalls
  64. * Manual Configuration:: Selecting features that can't be guessed
  65. * Site Configuration:: Local defaults for `configure'
  66. * Running configure Scripts:: How to use the Autoconf output
  67. * config.status Invocation:: Recreating a configuration
  68. * Obsolete Constructs:: Kept for backward compatibility
  69. * Using Autotest:: Creating portable test suites
  70. * FAQ:: Frequent Autoconf Questions, with answers
  71. * History:: History of Autoconf
  72. * GNU Free Documentation License:: License for copying this manual
  73. * Indices:: Indices of symbols, concepts, etc.
  74. --- The Detailed Node Listing ---
  75. The GNU Build System
  76. * Automake:: Escaping makefile hell
  77. * Gnulib:: The GNU portability library
  78. * Libtool:: Building libraries portably
  79. * Pointers:: More info on the GNU build system
  80. Making `configure' Scripts
  81. * Writing Autoconf Input:: What to put in an Autoconf input file
  82. * autoscan Invocation:: Semi-automatic `configure.ac' writing
  83. * ifnames Invocation:: Listing the conditionals in source code
  84. * autoconf Invocation:: How to create configuration scripts
  85. * autoreconf Invocation:: Remaking multiple `configure' scripts
  86. Writing `configure.ac'
  87. * Shell Script Compiler:: Autoconf as solution of a problem
  88. * Autoconf Language:: Programming in Autoconf
  89. * Autoconf Input Layout:: Standard organization of `configure.ac'
  90. Initialization and Output Files
  91. * Initializing configure:: Option processing etc.
  92. * Versioning:: Dealing with Autoconf versions
  93. * Notices:: Copyright, version numbers in `configure'
  94. * Input:: Where Autoconf should find files
  95. * Output:: Outputting results from the configuration
  96. * Configuration Actions:: Preparing the output based on results
  97. * Configuration Files:: Creating output files
  98. * Makefile Substitutions:: Using output variables in makefiles
  99. * Configuration Headers:: Creating a configuration header file
  100. * Configuration Commands:: Running arbitrary instantiation commands
  101. * Configuration Links:: Links depending on the configuration
  102. * Subdirectories:: Configuring independent packages together
  103. * Default Prefix:: Changing the default installation prefix
  104. Substitutions in Makefiles
  105. * Preset Output Variables:: Output variables that are always set
  106. * Installation Directory Variables:: Other preset output variables
  107. * Changed Directory Variables:: Warnings about `datarootdir'
  108. * Build Directories:: Supporting multiple concurrent compiles
  109. * Automatic Remaking:: Makefile rules for configuring
  110. Configuration Header Files
  111. * Header Templates:: Input for the configuration headers
  112. * autoheader Invocation:: How to create configuration templates
  113. * Autoheader Macros:: How to specify CPP templates
  114. Existing Tests
  115. * Common Behavior:: Macros' standard schemes
  116. * Alternative Programs:: Selecting between alternative programs
  117. * Files:: Checking for the existence of files
  118. * Libraries:: Library archives that might be missing
  119. * Library Functions:: C library functions that might be missing
  120. * Header Files:: Header files that might be missing
  121. * Declarations:: Declarations that may be missing
  122. * Structures:: Structures or members that might be missing
  123. * Types:: Types that might be missing
  124. * Compilers and Preprocessors:: Checking for compiling programs
  125. * System Services:: Operating system services
  126. * Posix Variants:: Special kludges for specific Posix variants
  127. * Erlang Libraries:: Checking for the existence of Erlang libraries
  128. Common Behavior
  129. * Standard Symbols:: Symbols defined by the macros
  130. * Default Includes:: Includes used by the generic macros
  131. Alternative Programs
  132. * Particular Programs:: Special handling to find certain programs
  133. * Generic Programs:: How to find other programs
  134. Library Functions
  135. * Function Portability:: Pitfalls with usual functions
  136. * Particular Functions:: Special handling to find certain functions
  137. * Generic Functions:: How to find other functions
  138. Header Files
  139. * Header Portability:: Collected knowledge on common headers
  140. * Particular Headers:: Special handling to find certain headers
  141. * Generic Headers:: How to find other headers
  142. Declarations
  143. * Particular Declarations:: Macros to check for certain declarations
  144. * Generic Declarations:: How to find other declarations
  145. Structures
  146. * Particular Structures:: Macros to check for certain structure members
  147. * Generic Structures:: How to find other structure members
  148. Types
  149. * Particular Types:: Special handling to find certain types
  150. * Generic Types:: How to find other types
  151. Compilers and Preprocessors
  152. * Specific Compiler Characteristics:: Some portability issues
  153. * Generic Compiler Characteristics:: Language independent tests and features
  154. * C Compiler:: Checking its characteristics
  155. * C++ Compiler:: Likewise
  156. * Objective C Compiler:: Likewise
  157. * Objective C++ Compiler:: Likewise
  158. * Erlang Compiler and Interpreter:: Likewise
  159. * Fortran Compiler:: Likewise
  160. * Go Compiler:: Likewise
  161. Writing Tests
  162. * Language Choice:: Selecting which language to use for testing
  163. * Writing Test Programs:: Forging source files for compilers
  164. * Running the Preprocessor:: Detecting preprocessor symbols
  165. * Running the Compiler:: Detecting language or header features
  166. * Running the Linker:: Detecting library features
  167. * Runtime:: Testing for runtime features
  168. * Systemology:: A zoology of operating systems
  169. * Multiple Cases:: Tests for several possible values
  170. Writing Test Programs
  171. * Guidelines:: General rules for writing test programs
  172. * Test Functions:: Avoiding pitfalls in test programs
  173. * Generating Sources:: Source program boilerplate
  174. Results of Tests
  175. * Defining Symbols:: Defining C preprocessor symbols
  176. * Setting Output Variables:: Replacing variables in output files
  177. * Special Chars in Variables:: Characters to beware of in variables
  178. * Caching Results:: Speeding up subsequent `configure' runs
  179. * Printing Messages:: Notifying `configure' users
  180. Caching Results
  181. * Cache Variable Names:: Shell variables used in caches
  182. * Cache Files:: Files `configure' uses for caching
  183. * Cache Checkpointing:: Loading and saving the cache file
  184. Programming in M4
  185. * M4 Quotation:: Protecting macros from unwanted expansion
  186. * Using autom4te:: The Autoconf executables backbone
  187. * Programming in M4sugar:: Convenient pure M4 macros
  188. * Debugging via autom4te:: Figuring out what M4 was doing
  189. M4 Quotation
  190. * Active Characters:: Characters that change the behavior of M4
  191. * One Macro Call:: Quotation and one macro call
  192. * Quoting and Parameters:: M4 vs. shell parameters
  193. * Quotation and Nested Macros:: Macros calling macros
  194. * Changequote is Evil:: Worse than INTERCAL: M4 + changequote
  195. * Quadrigraphs:: Another way to escape special characters
  196. * Balancing Parentheses:: Dealing with unbalanced parentheses
  197. * Quotation Rule Of Thumb:: One parenthesis, one quote
  198. Using `autom4te'
  199. * autom4te Invocation:: A GNU M4 wrapper
  200. * Customizing autom4te:: Customizing the Autoconf package
  201. Programming in M4sugar
  202. * Redefined M4 Macros:: M4 builtins changed in M4sugar
  203. * Diagnostic Macros:: Diagnostic messages from M4sugar
  204. * Diversion support:: Diversions in M4sugar
  205. * Conditional constructs:: Conditions in M4
  206. * Looping constructs:: Iteration in M4
  207. * Evaluation Macros:: More quotation and evaluation control
  208. * Text processing Macros:: String manipulation in M4
  209. * Number processing Macros:: Arithmetic computation in M4
  210. * Set manipulation Macros:: Set manipulation in M4
  211. * Forbidden Patterns:: Catching unexpanded macros
  212. Programming in M4sh
  213. * Common Shell Constructs:: Portability layer for common shell constructs
  214. * Polymorphic Variables:: Support for indirect variable names
  215. * Initialization Macros:: Macros to establish a sane shell environment
  216. * File Descriptor Macros:: File descriptor macros for input and output
  217. Writing Autoconf Macros
  218. * Macro Definitions:: Basic format of an Autoconf macro
  219. * Macro Names:: What to call your new macros
  220. * Reporting Messages:: Notifying `autoconf' users
  221. * Dependencies Between Macros:: What to do when macros depend on other macros
  222. * Obsoleting Macros:: Warning about old ways of doing things
  223. * Coding Style:: Writing Autoconf macros a` la Autoconf
  224. Dependencies Between Macros
  225. * Prerequisite Macros:: Ensuring required information
  226. * Suggested Ordering:: Warning about possible ordering problems
  227. * One-Shot Macros:: Ensuring a macro is called only once
  228. Portable Shell Programming
  229. * Shellology:: A zoology of shells
  230. * Invoking the Shell:: Invoking the shell as a command
  231. * Here-Documents:: Quirks and tricks
  232. * File Descriptors:: FDs and redirections
  233. * Signal Handling:: Shells, signals, and headaches
  234. * File System Conventions:: File names
  235. * Shell Pattern Matching:: Pattern matching
  236. * Shell Substitutions:: Variable and command expansions
  237. * Assignments:: Varying side effects of assignments
  238. * Parentheses:: Parentheses in shell scripts
  239. * Slashes:: Slashes in shell scripts
  240. * Special Shell Variables:: Variables you should not change
  241. * Shell Functions:: What to look out for if you use them
  242. * Limitations of Builtins:: Portable use of not so portable /bin/sh
  243. * Limitations of Usual Tools:: Portable use of portable tools
  244. Portable Make Programming
  245. * $< in Ordinary Make Rules:: $< in ordinary rules
  246. * Failure in Make Rules:: Failing portably in rules
  247. * Special Chars in Names:: Special Characters in Macro Names
  248. * Backslash-Newline-Empty:: Empty lines after backslash-newline
  249. * Backslash-Newline Comments:: Spanning comments across line boundaries
  250. * Long Lines in Makefiles:: Line length limitations
  251. * Macros and Submakes:: `make macro=value' and submakes
  252. * The Make Macro MAKEFLAGS:: `$(MAKEFLAGS)' portability issues
  253. * The Make Macro SHELL:: `$(SHELL)' portability issues
  254. * Parallel Make:: Parallel `make' quirks
  255. * Comments in Make Rules:: Other problems with Make comments
  256. * Newlines in Make Rules:: Using literal newlines in rules
  257. * Comments in Make Macros:: Other problems with Make comments in macros
  258. * Trailing whitespace in Make Macros:: Macro substitution problems
  259. * Command-line Macros and whitespace:: Whitespace trimming of values
  260. * obj/ and Make:: Don't name a subdirectory `obj'
  261. * make -k Status:: Exit status of `make -k'
  262. * VPATH and Make:: `VPATH' woes
  263. * Single Suffix Rules:: Single suffix rules and separated dependencies
  264. * Timestamps and Make:: Subsecond timestamp resolution
  265. `VPATH' and Make
  266. * Variables listed in VPATH:: `VPATH' must be literal on ancient hosts
  267. * VPATH and Double-colon:: Problems with `::' on ancient hosts
  268. * $< in Explicit Rules:: `$<' does not work in ordinary rules
  269. * Automatic Rule Rewriting:: `VPATH' goes wild on Solaris
  270. * Tru64 Directory Magic:: `mkdir' goes wild on Tru64
  271. * Make Target Lookup:: More details about `VPATH' lookup
  272. Portable C and C++ Programming
  273. * Varieties of Unportability:: How to make your programs unportable
  274. * Integer Overflow:: When integers get too large
  275. * Preprocessor Arithmetic:: `#if' expression problems
  276. * Null Pointers:: Properties of null pointers
  277. * Buffer Overruns:: Subscript errors and the like
  278. * Volatile Objects:: `volatile' and signals
  279. * Floating Point Portability:: Portable floating-point arithmetic
  280. * Exiting Portably:: Exiting and the exit status
  281. Integer Overflow
  282. * Integer Overflow Basics:: Why integer overflow is a problem
  283. * Signed Overflow Examples:: Examples of code assuming wraparound
  284. * Optimization and Wraparound:: Optimizations that break uses of wraparound
  285. * Signed Overflow Advice:: Practical advice for signed overflow issues
  286. * Signed Integer Division:: `INT_MIN / -1' and `INT_MIN % -1'
  287. Manual Configuration
  288. * Specifying Target Triplets:: Specifying target triplets
  289. * Canonicalizing:: Getting the canonical system type
  290. * Using System Type:: What to do with the system type
  291. Site Configuration
  292. * Help Formatting:: Customizing `configure --help'
  293. * External Software:: Working with other optional software
  294. * Package Options:: Selecting optional features
  295. * Pretty Help Strings:: Formatting help string
  296. * Option Checking:: Controlling checking of `configure' options
  297. * Site Details:: Configuring site details
  298. * Transforming Names:: Changing program names when installing
  299. * Site Defaults:: Giving `configure' local defaults
  300. Transforming Program Names When Installing
  301. * Transformation Options:: `configure' options to transform names
  302. * Transformation Examples:: Sample uses of transforming names
  303. * Transformation Rules:: Makefile uses of transforming names
  304. Running `configure' Scripts
  305. * Basic Installation:: Instructions for typical cases
  306. * Compilers and Options:: Selecting compilers and optimization
  307. * Multiple Architectures:: Compiling for multiple architectures at once
  308. * Installation Names:: Installing in different directories
  309. * Optional Features:: Selecting optional features
  310. * Particular Systems:: Particular systems
  311. * System Type:: Specifying the system type
  312. * Sharing Defaults:: Setting site-wide defaults for `configure'
  313. * Defining Variables:: Specifying the compiler etc.
  314. * configure Invocation:: Changing how `configure' runs
  315. Obsolete Constructs
  316. * Obsolete config.status Use:: Obsolete convention for `config.status'
  317. * acconfig Header:: Additional entries in `config.h.in'
  318. * autoupdate Invocation:: Automatic update of `configure.ac'
  319. * Obsolete Macros:: Backward compatibility macros
  320. * Autoconf 1:: Tips for upgrading your files
  321. * Autoconf 2.13:: Some fresher tips
  322. Upgrading From Version 1
  323. * Changed File Names:: Files you might rename
  324. * Changed Makefiles:: New things to put in `Makefile.in'
  325. * Changed Macros:: Macro calls you might replace
  326. * Changed Results:: Changes in how to check test results
  327. * Changed Macro Writing:: Better ways to write your own macros
  328. Upgrading From Version 2.13
  329. * Changed Quotation:: Broken code which used to work
  330. * New Macros:: Interaction with foreign macros
  331. * Hosts and Cross-Compilation:: Bugward compatibility kludges
  332. * AC_LIBOBJ vs LIBOBJS:: LIBOBJS is a forbidden token
  333. * AC_ACT_IFELSE vs AC_TRY_ACT:: A more generic scheme for testing sources
  334. Generating Test Suites with Autotest
  335. * Using an Autotest Test Suite:: Autotest and the user
  336. * Writing Testsuites:: Autotest macros
  337. * testsuite Invocation:: Running `testsuite' scripts
  338. * Making testsuite Scripts:: Using autom4te to create `testsuite'
  339. Using an Autotest Test Suite
  340. * testsuite Scripts:: The concepts of Autotest
  341. * Autotest Logs:: Their contents
  342. Frequent Autoconf Questions, with answers
  343. * Distributing:: Distributing `configure' scripts
  344. * Why GNU M4:: Why not use the standard M4?
  345. * Bootstrapping:: Autoconf and GNU M4 require each other?
  346. * Why Not Imake:: Why GNU uses `configure' instead of Imake
  347. * Defining Directories:: Passing `datadir' to program
  348. * Autom4te Cache:: What is it? Can I remove it?
  349. * Present But Cannot Be Compiled:: Compiler and Preprocessor Disagree
  350. * Expanded Before Required:: Expanded Before Required
  351. * Debugging:: Debugging `configure' scripts
  352. History of Autoconf
  353. * Genesis:: Prehistory and naming of `configure'
  354. * Exodus:: The plagues of M4 and Perl
  355. * Leviticus:: The priestly code of portability arrives
  356. * Numbers:: Growth and contributors
  357. * Deuteronomy:: Approaching the promises of easy configuration
  358. Indices
  359. * Environment Variable Index:: Index of environment variables used
  360. * Output Variable Index:: Index of variables set in output files
  361. * Preprocessor Symbol Index:: Index of C preprocessor symbols defined
  362. * Cache Variable Index:: Index of documented cache variables
  363. * Autoconf Macro Index:: Index of Autoconf macros
  364. * M4 Macro Index:: Index of M4, M4sugar, and M4sh macros
  365. * Autotest Macro Index:: Index of Autotest macros
  366. * Program & Function Index:: Index of those with portability problems
  367. * Concept Index:: General index
  368. 
  369. File: autoconf.info, Node: Introduction, Next: The GNU Build System, Prev: Top, Up: Top
  370. 1 Introduction
  371. **************
  372. A physicist, an engineer, and a computer scientist were discussing the
  373. nature of God. "Surely a Physicist," said the physicist, "because
  374. early in the Creation, God made Light; and you know, Maxwell's
  375. equations, the dual nature of electromagnetic waves, the relativistic
  376. consequences..." "An Engineer!," said the engineer, "because
  377. before making Light, God split the Chaos into Land and Water; it takes a
  378. hell of an engineer to handle that big amount of mud, and orderly
  379. separation of solids from liquids..." The computer scientist
  380. shouted: "And the Chaos, where do you think it was coming from, hmm?"
  381. --Anonymous
  382. Autoconf is a tool for producing shell scripts that automatically
  383. configure software source code packages to adapt to many kinds of
  384. Posix-like systems. The configuration scripts produced by Autoconf are
  385. independent of Autoconf when they are run, so their users do not need
  386. to have Autoconf.
  387. The configuration scripts produced by Autoconf require no manual user
  388. intervention when run; they do not normally even need an argument
  389. specifying the system type. Instead, they individually test for the
  390. presence of each feature that the software package they are for might
  391. need. (Before each check, they print a one-line message stating what
  392. they are checking for, so the user doesn't get too bored while waiting
  393. for the script to finish.) As a result, they deal well with systems
  394. that are hybrids or customized from the more common Posix variants.
  395. There is no need to maintain files that list the features supported by
  396. each release of each variant of Posix.
  397. For each software package that Autoconf is used with, it creates a
  398. configuration script from a template file that lists the system features
  399. that the package needs or can use. After the shell code to recognize
  400. and respond to a system feature has been written, Autoconf allows it to
  401. be shared by many software packages that can use (or need) that feature.
  402. If it later turns out that the shell code needs adjustment for some
  403. reason, it needs to be changed in only one place; all of the
  404. configuration scripts can be regenerated automatically to take advantage
  405. of the updated code.
  406. Those who do not understand Autoconf are condemned to reinvent it,
  407. poorly. The primary goal of Autoconf is making the _user's_ life
  408. easier; making the _maintainer's_ life easier is only a secondary goal.
  409. Put another way, the primary goal is not to make the generation of
  410. `configure' automatic for package maintainers (although patches along
  411. that front are welcome, since package maintainers form the user base of
  412. Autoconf); rather, the goal is to make `configure' painless, portable,
  413. and predictable for the end user of each "autoconfiscated" package.
  414. And to this degree, Autoconf is highly successful at its goal -- most
  415. complaints to the Autoconf list are about difficulties in writing
  416. Autoconf input, and not in the behavior of the resulting `configure'.
  417. Even packages that don't use Autoconf will generally provide a
  418. `configure' script, and the most common complaint about these
  419. alternative home-grown scripts is that they fail to meet one or more of
  420. the GNU Coding Standards (*note Configuration:
  421. (standards)Configuration.) that users have come to expect from
  422. Autoconf-generated `configure' scripts.
  423. The Metaconfig package is similar in purpose to Autoconf, but the
  424. scripts it produces require manual user intervention, which is quite
  425. inconvenient when configuring large source trees. Unlike Metaconfig
  426. scripts, Autoconf scripts can support cross-compiling, if some care is
  427. taken in writing them.
  428. Autoconf does not solve all problems related to making portable
  429. software packages--for a more complete solution, it should be used in
  430. concert with other GNU build tools like Automake and Libtool. These
  431. other tools take on jobs like the creation of a portable, recursive
  432. makefile with all of the standard targets, linking of shared libraries,
  433. and so on. *Note The GNU Build System::, for more information.
  434. Autoconf imposes some restrictions on the names of macros used with
  435. `#if' in C programs (*note Preprocessor Symbol Index::).
  436. Autoconf requires GNU M4 version 1.4.6 or later in order to generate
  437. the scripts. It uses features that some versions of M4, including GNU
  438. M4 1.3, do not have. Autoconf works better with GNU M4 version 1.4.14
  439. or later, though this is not required.
  440. *Note Autoconf 1::, for information about upgrading from version 1.
  441. *Note History::, for the story of Autoconf's development. *Note FAQ::,
  442. for answers to some common questions about Autoconf.
  443. See the Autoconf web page (http://www.gnu.org/software/autoconf/)
  444. for up-to-date information, details on the mailing lists, pointers to a
  445. list of known bugs, etc.
  446. Mail suggestions to the Autoconf mailing list <autoconf@gnu.org>.
  447. Past suggestions are archived
  448. (http://lists.gnu.org/archive/html/autoconf/).
  449. Mail bug reports to the Autoconf Bugs mailing list
  450. <bug-autoconf@gnu.org>. Past bug reports are archived
  451. (http://lists.gnu.org/archive/html/bug-autoconf/).
  452. If possible, first check that your bug is not already solved in
  453. current development versions, and that it has not been reported yet.
  454. Be sure to include all the needed information and a short
  455. `configure.ac' that demonstrates the problem.
  456. Autoconf's development tree is accessible via `git'; see the
  457. Autoconf Summary (http://savannah.gnu.org/projects/autoconf/) for
  458. details, or view the actual repository
  459. (http://git.sv.gnu.org/gitweb/?p=autoconf.git). Anonymous CVS access
  460. is also available, see `README' for more details. Patches relative to
  461. the current `git' version can be sent for review to the Autoconf
  462. Patches mailing list <autoconf-patches@gnu.org>, with discussion on
  463. prior patches archived
  464. (http://lists.gnu.org/archive/html/autoconf-patches/); and all commits
  465. are posted in the read-only Autoconf Commit mailing list
  466. <autoconf-commit@gnu.org>, which is also archived
  467. (http://lists.gnu.org/archive/html/autoconf-commit/).
  468. Because of its mission, the Autoconf package itself includes only a
  469. set of often-used macros that have already demonstrated their
  470. usefulness. Nevertheless, if you wish to share your macros, or find
  471. existing ones, see the Autoconf Macro Archive
  472. (http://www.gnu.org/software/autoconf-archive/), which is kindly run by
  473. Peter Simons <simons@cryp.to>.
  474. 
  475. File: autoconf.info, Node: The GNU Build System, Next: Making configure Scripts, Prev: Introduction, Up: Top
  476. 2 The GNU Build System
  477. **********************
  478. Autoconf solves an important problem--reliable discovery of
  479. system-specific build and runtime information--but this is only one
  480. piece of the puzzle for the development of portable software. To this
  481. end, the GNU project has developed a suite of integrated utilities to
  482. finish the job Autoconf started: the GNU build system, whose most
  483. important components are Autoconf, Automake, and Libtool. In this
  484. chapter, we introduce you to those tools, point you to sources of more
  485. information, and try to convince you to use the entire GNU build system
  486. for your software.
  487. * Menu:
  488. * Automake:: Escaping makefile hell
  489. * Gnulib:: The GNU portability library
  490. * Libtool:: Building libraries portably
  491. * Pointers:: More info on the GNU build system
  492. 
  493. File: autoconf.info, Node: Automake, Next: Gnulib, Up: The GNU Build System
  494. 2.1 Automake
  495. ============
  496. The ubiquity of `make' means that a makefile is almost the only viable
  497. way to distribute automatic build rules for software, but one quickly
  498. runs into its numerous limitations. Its lack of support for automatic
  499. dependency tracking, recursive builds in subdirectories, reliable
  500. timestamps (e.g., for network file systems), and so on, mean that
  501. developers must painfully (and often incorrectly) reinvent the wheel
  502. for each project. Portability is non-trivial, thanks to the quirks of
  503. `make' on many systems. On top of all this is the manual labor
  504. required to implement the many standard targets that users have come to
  505. expect (`make install', `make distclean', `make uninstall', etc.).
  506. Since you are, of course, using Autoconf, you also have to insert
  507. repetitive code in your `Makefile.in' to recognize `@CC@', `@CFLAGS@',
  508. and other substitutions provided by `configure'. Into this mess steps
  509. "Automake".
  510. Automake allows you to specify your build needs in a `Makefile.am'
  511. file with a vastly simpler and more powerful syntax than that of a plain
  512. makefile, and then generates a portable `Makefile.in' for use with
  513. Autoconf. For example, the `Makefile.am' to build and install a simple
  514. "Hello world" program might look like:
  515. bin_PROGRAMS = hello
  516. hello_SOURCES = hello.c
  517. The resulting `Makefile.in' (~400 lines) automatically supports all the
  518. standard targets, the substitutions provided by Autoconf, automatic
  519. dependency tracking, `VPATH' building, and so on. `make' builds the
  520. `hello' program, and `make install' installs it in `/usr/local/bin' (or
  521. whatever prefix was given to `configure', if not `/usr/local').
  522. The benefits of Automake increase for larger packages (especially
  523. ones with subdirectories), but even for small programs the added
  524. convenience and portability can be substantial. And that's not all...
  525. 
  526. File: autoconf.info, Node: Gnulib, Next: Libtool, Prev: Automake, Up: The GNU Build System
  527. 2.2 Gnulib
  528. ==========
  529. GNU software has a well-deserved reputation for running on many
  530. different types of systems. While our primary goal is to write
  531. software for the GNU system, many users and developers have been
  532. introduced to us through the systems that they were already using.
  533. Gnulib is a central location for common GNU code, intended to be
  534. shared among free software packages. Its components are typically
  535. shared at the source level, rather than being a library that gets built,
  536. installed, and linked against. The idea is to copy files from Gnulib
  537. into your own source tree. There is no distribution tarball; developers
  538. should just grab source modules from the repository. The source files
  539. are available online, under various licenses, mostly GNU GPL or GNU
  540. LGPL.
  541. Gnulib modules typically contain C source code along with Autoconf
  542. macros used to configure the source code. For example, the Gnulib
  543. `stdbool' module implements a `stdbool.h' header that nearly conforms
  544. to C99, even on old-fashioned hosts that lack `stdbool.h'. This module
  545. contains a source file for the replacement header, along with an
  546. Autoconf macro that arranges to use the replacement header on
  547. old-fashioned systems.
  548. 
  549. File: autoconf.info, Node: Libtool, Next: Pointers, Prev: Gnulib, Up: The GNU Build System
  550. 2.3 Libtool
  551. ===========
  552. Often, one wants to build not only programs, but libraries, so that
  553. other programs can benefit from the fruits of your labor. Ideally, one
  554. would like to produce _shared_ (dynamically linked) libraries, which
  555. can be used by multiple programs without duplication on disk or in
  556. memory and can be updated independently of the linked programs.
  557. Producing shared libraries portably, however, is the stuff of
  558. nightmares--each system has its own incompatible tools, compiler flags,
  559. and magic incantations. Fortunately, GNU provides a solution:
  560. "Libtool".
  561. Libtool handles all the requirements of building shared libraries for
  562. you, and at this time seems to be the _only_ way to do so with any
  563. portability. It also handles many other headaches, such as: the
  564. interaction of Make rules with the variable suffixes of shared
  565. libraries, linking reliably with shared libraries before they are
  566. installed by the superuser, and supplying a consistent versioning system
  567. (so that different versions of a library can be installed or upgraded
  568. without breaking binary compatibility). Although Libtool, like
  569. Autoconf, can be used without Automake, it is most simply utilized in
  570. conjunction with Automake--there, Libtool is used automatically
  571. whenever shared libraries are needed, and you need not know its syntax.
  572. 
  573. File: autoconf.info, Node: Pointers, Prev: Libtool, Up: The GNU Build System
  574. 2.4 Pointers
  575. ============
  576. Developers who are used to the simplicity of `make' for small projects
  577. on a single system might be daunted at the prospect of learning to use
  578. Automake and Autoconf. As your software is distributed to more and
  579. more users, however, you otherwise quickly find yourself putting lots
  580. of effort into reinventing the services that the GNU build tools
  581. provide, and making the same mistakes that they once made and overcame.
  582. (Besides, since you're already learning Autoconf, Automake is a piece
  583. of cake.)
  584. There are a number of places that you can go to for more information
  585. on the GNU build tools.
  586. - Web
  587. The project home pages for Autoconf
  588. (http://www.gnu.org/software/autoconf/), Automake
  589. (http://www.gnu.org/software/automake/), Gnulib
  590. (http://www.gnu.org/software/gnulib/), and Libtool
  591. (http://www.gnu.org/software/libtool/).
  592. - Automake Manual
  593. *Note Automake: (automake)Top, for more information on Automake.
  594. - Books
  595. The book `GNU Autoconf, Automake and Libtool'(1) describes the
  596. complete GNU build environment. You can also find the entire book
  597. on-line (http://sources.redhat.com/autobook/).
  598. ---------- Footnotes ----------
  599. (1) `GNU Autoconf, Automake and Libtool', by G. V. Vaughan, B.
  600. Elliston, T. Tromey, and I. L. Taylor. SAMS (originally New Riders),
  601. 2000, ISBN 1578701902.
  602. 
  603. File: autoconf.info, Node: Making configure Scripts, Next: Setup, Prev: The GNU Build System, Up: Top
  604. 3 Making `configure' Scripts
  605. ****************************
  606. The configuration scripts that Autoconf produces are by convention
  607. called `configure'. When run, `configure' creates several files,
  608. replacing configuration parameters in them with appropriate values.
  609. The files that `configure' creates are:
  610. - one or more `Makefile' files, usually one in each subdirectory of
  611. the package (*note Makefile Substitutions::);
  612. - optionally, a C header file, the name of which is configurable,
  613. containing `#define' directives (*note Configuration Headers::);
  614. - a shell script called `config.status' that, when run, recreates
  615. the files listed above (*note config.status Invocation::);
  616. - an optional shell script normally called `config.cache' (created
  617. when using `configure --config-cache') that saves the results of
  618. running many of the tests (*note Cache Files::);
  619. - a file called `config.log' containing any messages produced by
  620. compilers, to help debugging if `configure' makes a mistake.
  621. To create a `configure' script with Autoconf, you need to write an
  622. Autoconf input file `configure.ac' (or `configure.in') and run
  623. `autoconf' on it. If you write your own feature tests to supplement
  624. those that come with Autoconf, you might also write files called
  625. `aclocal.m4' and `acsite.m4'. If you use a C header file to contain
  626. `#define' directives, you might also run `autoheader', and you can
  627. distribute the generated file `config.h.in' with the package.
  628. Here is a diagram showing how the files that can be used in
  629. configuration are produced. Programs that are executed are suffixed by
  630. `*'. Optional files are enclosed in square brackets (`[]').
  631. `autoconf' and `autoheader' also read the installed Autoconf macro
  632. files (by reading `autoconf.m4').
  633. Files used in preparing a software package for distribution, when using
  634. just Autoconf:
  635. your source files --> [autoscan*] --> [configure.scan] --> configure.ac
  636. configure.ac --.
  637. | .------> autoconf* -----> configure
  638. [aclocal.m4] --+---+
  639. | `-----> [autoheader*] --> [config.h.in]
  640. [acsite.m4] ---'
  641. Makefile.in
  642. Additionally, if you use Automake, the following additional productions
  643. come into play:
  644. [acinclude.m4] --.
  645. |
  646. [local macros] --+--> aclocal* --> aclocal.m4
  647. |
  648. configure.ac ----'
  649. configure.ac --.
  650. +--> automake* --> Makefile.in
  651. Makefile.am ---'
  652. Files used in configuring a software package:
  653. .-------------> [config.cache]
  654. configure* ------------+-------------> config.log
  655. |
  656. [config.h.in] -. v .-> [config.h] -.
  657. +--> config.status* -+ +--> make*
  658. Makefile.in ---' `-> Makefile ---'
  659. * Menu:
  660. * Writing Autoconf Input:: What to put in an Autoconf input file
  661. * autoscan Invocation:: Semi-automatic `configure.ac' writing
  662. * ifnames Invocation:: Listing the conditionals in source code
  663. * autoconf Invocation:: How to create configuration scripts
  664. * autoreconf Invocation:: Remaking multiple `configure' scripts
  665. 
  666. File: autoconf.info, Node: Writing Autoconf Input, Next: autoscan Invocation, Up: Making configure Scripts
  667. 3.1 Writing `configure.ac'
  668. ==========================
  669. To produce a `configure' script for a software package, create a file
  670. called `configure.ac' that contains invocations of the Autoconf macros
  671. that test the system features your package needs or can use. Autoconf
  672. macros already exist to check for many features; see *note Existing
  673. Tests::, for their descriptions. For most other features, you can use
  674. Autoconf template macros to produce custom checks; see *note Writing
  675. Tests::, for information about them. For especially tricky or
  676. specialized features, `configure.ac' might need to contain some
  677. hand-crafted shell commands; see *note Portable Shell Programming:
  678. Portable Shell. The `autoscan' program can give you a good start in
  679. writing `configure.ac' (*note autoscan Invocation::, for more
  680. information).
  681. Previous versions of Autoconf promoted the name `configure.in',
  682. which is somewhat ambiguous (the tool needed to process this file is not
  683. described by its extension), and introduces a slight confusion with
  684. `config.h.in' and so on (for which `.in' means "to be processed by
  685. `configure'"). Using `configure.ac' is now preferred.
  686. * Menu:
  687. * Shell Script Compiler:: Autoconf as solution of a problem
  688. * Autoconf Language:: Programming in Autoconf
  689. * Autoconf Input Layout:: Standard organization of `configure.ac'
  690. 
  691. File: autoconf.info, Node: Shell Script Compiler, Next: Autoconf Language, Up: Writing Autoconf Input
  692. 3.1.1 A Shell Script Compiler
  693. -----------------------------
  694. Just as for any other computer language, in order to properly program
  695. `configure.ac' in Autoconf you must understand _what_ problem the
  696. language tries to address and _how_ it does so.
  697. The problem Autoconf addresses is that the world is a mess. After
  698. all, you are using Autoconf in order to have your package compile
  699. easily on all sorts of different systems, some of them being extremely
  700. hostile. Autoconf itself bears the price for these differences:
  701. `configure' must run on all those systems, and thus `configure' must
  702. limit itself to their lowest common denominator of features.
  703. Naturally, you might then think of shell scripts; who needs
  704. `autoconf'? A set of properly written shell functions is enough to
  705. make it easy to write `configure' scripts by hand. Sigh!
  706. Unfortunately, even in 2008, where shells without any function support
  707. are far and few between, there are pitfalls to avoid when making use of
  708. them. Also, finding a Bourne shell that accepts shell functions is not
  709. trivial, even though there is almost always one on interesting porting
  710. targets.
  711. So, what is really needed is some kind of compiler, `autoconf', that
  712. takes an Autoconf program, `configure.ac', and transforms it into a
  713. portable shell script, `configure'.
  714. How does `autoconf' perform this task?
  715. There are two obvious possibilities: creating a brand new language or
  716. extending an existing one. The former option is attractive: all sorts
  717. of optimizations could easily be implemented in the compiler and many
  718. rigorous checks could be performed on the Autoconf program (e.g.,
  719. rejecting any non-portable construct). Alternatively, you can extend
  720. an existing language, such as the `sh' (Bourne shell) language.
  721. Autoconf does the latter: it is a layer on top of `sh'. It was
  722. therefore most convenient to implement `autoconf' as a macro expander:
  723. a program that repeatedly performs "macro expansions" on text input,
  724. replacing macro calls with macro bodies and producing a pure `sh'
  725. script in the end. Instead of implementing a dedicated Autoconf macro
  726. expander, it is natural to use an existing general-purpose macro
  727. language, such as M4, and implement the extensions as a set of M4
  728. macros.
  729. 
  730. File: autoconf.info, Node: Autoconf Language, Next: Autoconf Input Layout, Prev: Shell Script Compiler, Up: Writing Autoconf Input
  731. 3.1.2 The Autoconf Language
  732. ---------------------------
  733. The Autoconf language differs from many other computer languages
  734. because it treats actual code the same as plain text. Whereas in C,
  735. for instance, data and instructions have different syntactic status, in
  736. Autoconf their status is rigorously the same. Therefore, we need a
  737. means to distinguish literal strings from text to be expanded:
  738. quotation.
  739. When calling macros that take arguments, there must not be any white
  740. space between the macro name and the open parenthesis.
  741. AC_INIT ([oops], [1.0]) # incorrect
  742. AC_INIT([hello], [1.0]) # good
  743. Arguments should be enclosed within the quote characters `[' and
  744. `]', and be separated by commas. Any leading blanks or newlines in
  745. arguments are ignored, unless they are quoted. You should always quote
  746. an argument that might contain a macro name, comma, parenthesis, or a
  747. leading blank or newline. This rule applies recursively for every macro
  748. call, including macros called from other macros. For more details on
  749. quoting rules, see *note Programming in M4::.
  750. For instance:
  751. AC_CHECK_HEADER([stdio.h],
  752. [AC_DEFINE([HAVE_STDIO_H], [1],
  753. [Define to 1 if you have <stdio.h>.])],
  754. [AC_MSG_ERROR([sorry, can't do anything for you])])
  755. is quoted properly. You may safely simplify its quotation to:
  756. AC_CHECK_HEADER([stdio.h],
  757. [AC_DEFINE([HAVE_STDIO_H], 1,
  758. [Define to 1 if you have <stdio.h>.])],
  759. [AC_MSG_ERROR([sorry, can't do anything for you])])
  760. because `1' cannot contain a macro call. Here, the argument of
  761. `AC_MSG_ERROR' must be quoted; otherwise, its comma would be
  762. interpreted as an argument separator. Also, the second and third
  763. arguments of `AC_CHECK_HEADER' must be quoted, since they contain macro
  764. calls. The three arguments `HAVE_STDIO_H', `stdio.h', and `Define to 1
  765. if you have <stdio.h>.' do not need quoting, but if you unwisely
  766. defined a macro with a name like `Define' or `stdio' then they would
  767. need quoting. Cautious Autoconf users would keep the quotes, but many
  768. Autoconf users find such precautions annoying, and would rewrite the
  769. example as follows:
  770. AC_CHECK_HEADER(stdio.h,
  771. [AC_DEFINE(HAVE_STDIO_H, 1,
  772. [Define to 1 if you have <stdio.h>.])],
  773. [AC_MSG_ERROR([sorry, can't do anything for you])])
  774. This is safe, so long as you adopt good naming conventions and do not
  775. define macros with names like `HAVE_STDIO_H', `stdio', or `h'. Though
  776. it is also safe here to omit the quotes around `Define to 1 if you have
  777. <stdio.h>.' this is not recommended, as message strings are more likely
  778. to inadvertently contain commas.
  779. The following example is wrong and dangerous, as it is underquoted:
  780. AC_CHECK_HEADER(stdio.h,
  781. AC_DEFINE(HAVE_STDIO_H, 1,
  782. Define to 1 if you have <stdio.h>.),
  783. AC_MSG_ERROR([sorry, can't do anything for you]))
  784. In other cases, you may have to use text that also resembles a macro
  785. call. You must quote that text even when it is not passed as a macro
  786. argument. For example, these two approaches in `configure.ac' (quoting
  787. just the potential problems, or quoting the entire line) will protect
  788. your script in case autoconf ever adds a macro `AC_DC':
  789. echo "Hard rock was here! --[AC_DC]"
  790. [echo "Hard rock was here! --AC_DC"]
  791. which results in this text in `configure':
  792. echo "Hard rock was here! --AC_DC"
  793. echo "Hard rock was here! --AC_DC"
  794. When you use the same text in a macro argument, you must therefore have
  795. an extra quotation level (since one is stripped away by the macro
  796. substitution). In general, then, it is a good idea to _use double
  797. quoting for all literal string arguments_, either around just the
  798. problematic portions, or over the entire argument:
  799. AC_MSG_WARN([[AC_DC] stinks --Iron Maiden])
  800. AC_MSG_WARN([[AC_DC stinks --Iron Maiden]])
  801. However, the above example triggers a warning about a possibly
  802. unexpanded macro when running `autoconf', because it collides with the
  803. namespace of macros reserved for the Autoconf language. To be really
  804. safe, you can use additional escaping (either a quadrigraph, or
  805. creative shell constructs) to silence that particular warning:
  806. echo "Hard rock was here! --AC""_DC"
  807. AC_MSG_WARN([[AC@&t@_DC stinks --Iron Maiden]])
  808. You are now able to understand one of the constructs of Autoconf that
  809. has been continually misunderstood... The rule of thumb is that
  810. _whenever you expect macro expansion, expect quote expansion_; i.e.,
  811. expect one level of quotes to be lost. For instance:
  812. AC_COMPILE_IFELSE(AC_LANG_SOURCE([char b[10];]), [],
  813. [AC_MSG_ERROR([you lose])])
  814. is incorrect: here, the first argument of `AC_LANG_SOURCE' is `char
  815. b[10];' and is expanded once, which results in `char b10;'; and the
  816. `AC_LANG_SOURCE' is also expanded prior to being passed to
  817. `AC_COMPILE_IFELSE'. (There was an idiom common in Autoconf's past to
  818. address this issue via the M4 `changequote' primitive, but do not use
  819. it!) Let's take a closer look: the author meant the first argument to
  820. be understood as a literal, and therefore it must be quoted twice;
  821. likewise, the intermediate `AC_LANG_SOURCE' macro should be quoted once
  822. so that it is only expanded after the rest of the body of
  823. `AC_COMPILE_IFELSE' is in place:
  824. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char b[10];]])], [],
  825. [AC_MSG_ERROR([you lose])])
  826. Voila`, you actually produce `char b[10];' this time!
  827. On the other hand, descriptions (e.g., the last parameter of
  828. `AC_DEFINE' or `AS_HELP_STRING') are not literals--they are subject to
  829. line breaking, for example--and should not be double quoted. Even if
  830. these descriptions are short and are not actually broken, double
  831. quoting them yields weird results.
  832. Some macros take optional arguments, which this documentation
  833. represents as [ARG] (not to be confused with the quote characters).
  834. You may just leave them empty, or use `[]' to make the emptiness of the
  835. argument explicit, or you may simply omit the trailing commas. The
  836. three lines below are equivalent:
  837. AC_CHECK_HEADERS([stdio.h], [], [], [])
  838. AC_CHECK_HEADERS([stdio.h],,,)
  839. AC_CHECK_HEADERS([stdio.h])
  840. It is best to put each macro call on its own line in `configure.ac'.
  841. Most of the macros don't add extra newlines; they rely on the newline
  842. after the macro call to terminate the commands. This approach makes
  843. the generated `configure' script a little easier to read by not
  844. inserting lots of blank lines. It is generally safe to set shell
  845. variables on the same line as a macro call, because the shell allows
  846. assignments without intervening newlines.
  847. You can include comments in `configure.ac' files by starting them
  848. with the `#'. For example, it is helpful to begin `configure.ac' files
  849. with a line like this:
  850. # Process this file with autoconf to produce a configure script.
  851. 
  852. File: autoconf.info, Node: Autoconf Input Layout, Prev: Autoconf Language, Up: Writing Autoconf Input
  853. 3.1.3 Standard `configure.ac' Layout
  854. ------------------------------------
  855. The order in which `configure.ac' calls the Autoconf macros is not
  856. important, with a few exceptions. Every `configure.ac' must contain a
  857. call to `AC_INIT' before the checks, and a call to `AC_OUTPUT' at the
  858. end (*note Output::). Additionally, some macros rely on other macros
  859. having been called first, because they check previously set values of
  860. some variables to decide what to do. These macros are noted in the
  861. individual descriptions (*note Existing Tests::), and they also warn
  862. you when `configure' is created if they are called out of order.
  863. To encourage consistency, here is a suggested order for calling the
  864. Autoconf macros. Generally speaking, the things near the end of this
  865. list are those that could depend on things earlier in it. For example,
  866. library functions could be affected by types and libraries.
  867. Autoconf requirements
  868. `AC_INIT(PACKAGE, VERSION, BUG-REPORT-ADDRESS)'
  869. information on the package
  870. checks for programs
  871. checks for libraries
  872. checks for header files
  873. checks for types
  874. checks for structures
  875. checks for compiler characteristics
  876. checks for library functions
  877. checks for system services
  878. `AC_CONFIG_FILES([FILE...])'
  879. `AC_OUTPUT'
  880. 
  881. File: autoconf.info, Node: autoscan Invocation, Next: ifnames Invocation, Prev: Writing Autoconf Input, Up: Making configure Scripts
  882. 3.2 Using `autoscan' to Create `configure.ac'
  883. =============================================
  884. The `autoscan' program can help you create and/or maintain a
  885. `configure.ac' file for a software package. `autoscan' examines source
  886. files in the directory tree rooted at a directory given as a command
  887. line argument, or the current directory if none is given. It searches
  888. the source files for common portability problems and creates a file
  889. `configure.scan' which is a preliminary `configure.ac' for that
  890. package, and checks a possibly existing `configure.ac' for completeness.
  891. When using `autoscan' to create a `configure.ac', you should
  892. manually examine `configure.scan' before renaming it to `configure.ac';
  893. it probably needs some adjustments. Occasionally, `autoscan' outputs a
  894. macro in the wrong order relative to another macro, so that `autoconf'
  895. produces a warning; you need to move such macros manually. Also, if
  896. you want the package to use a configuration header file, you must add a
  897. call to `AC_CONFIG_HEADERS' (*note Configuration Headers::). You might
  898. also have to change or add some `#if' directives to your program in
  899. order to make it work with Autoconf (*note ifnames Invocation::, for
  900. information about a program that can help with that job).
  901. When using `autoscan' to maintain a `configure.ac', simply consider
  902. adding its suggestions. The file `autoscan.log' contains detailed
  903. information on why a macro is requested.
  904. `autoscan' uses several data files (installed along with Autoconf)
  905. to determine which macros to output when it finds particular symbols in
  906. a package's source files. These data files all have the same format:
  907. each line consists of a symbol, one or more blanks, and the Autoconf
  908. macro to output if that symbol is encountered. Lines starting with `#'
  909. are comments.
  910. `autoscan' accepts the following options:
  911. `--help'
  912. `-h'
  913. Print a summary of the command line options and exit.
  914. `--version'
  915. `-V'
  916. Print the version number of Autoconf and exit.
  917. `--verbose'
  918. `-v'
  919. Print the names of the files it examines and the potentially
  920. interesting symbols it finds in them. This output can be
  921. voluminous.
  922. `--debug'
  923. `-d'
  924. Don't remove temporary files.
  925. `--include=DIR'
  926. `-I DIR'
  927. Append DIR to the include path. Multiple invocations accumulate.
  928. `--prepend-include=DIR'
  929. `-B DIR'
  930. Prepend DIR to the include path. Multiple invocations accumulate.
  931. 
  932. File: autoconf.info, Node: ifnames Invocation, Next: autoconf Invocation, Prev: autoscan Invocation, Up: Making configure Scripts
  933. 3.3 Using `ifnames' to List Conditionals
  934. ========================================
  935. `ifnames' can help you write `configure.ac' for a software package. It
  936. prints the identifiers that the package already uses in C preprocessor
  937. conditionals. If a package has already been set up to have some
  938. portability, `ifnames' can thus help you figure out what its
  939. `configure' needs to check for. It may help fill in some gaps in a
  940. `configure.ac' generated by `autoscan' (*note autoscan Invocation::).
  941. `ifnames' scans all of the C source files named on the command line
  942. (or the standard input, if none are given) and writes to the standard
  943. output a sorted list of all the identifiers that appear in those files
  944. in `#if', `#elif', `#ifdef', or `#ifndef' directives. It prints each
  945. identifier on a line, followed by a space-separated list of the files
  946. in which that identifier occurs.
  947. `ifnames' accepts the following options:
  948. `--help'
  949. `-h'
  950. Print a summary of the command line options and exit.
  951. `--version'
  952. `-V'
  953. Print the version number of Autoconf and exit.
  954. 
  955. File: autoconf.info, Node: autoconf Invocation, Next: autoreconf Invocation, Prev: ifnames Invocation, Up: Making configure Scripts
  956. 3.4 Using `autoconf' to Create `configure'
  957. ==========================================
  958. To create `configure' from `configure.ac', run the `autoconf' program
  959. with no arguments. `autoconf' processes `configure.ac' with the M4
  960. macro processor, using the Autoconf macros. If you give `autoconf' an
  961. argument, it reads that file instead of `configure.ac' and writes the
  962. configuration script to the standard output instead of to `configure'.
  963. If you give `autoconf' the argument `-', it reads from the standard
  964. input instead of `configure.ac' and writes the configuration script to
  965. the standard output.
  966. The Autoconf macros are defined in several files. Some of the files
  967. are distributed with Autoconf; `autoconf' reads them first. Then it
  968. looks for the optional file `acsite.m4' in the directory that contains
  969. the distributed Autoconf macro files, and for the optional file
  970. `aclocal.m4' in the current directory. Those files can contain your
  971. site's or the package's own Autoconf macro definitions (*note Writing
  972. Autoconf Macros::, for more information). If a macro is defined in
  973. more than one of the files that `autoconf' reads, the last definition
  974. it reads overrides the earlier ones.
  975. `autoconf' accepts the following options:
  976. `--help'
  977. `-h'
  978. Print a summary of the command line options and exit.
  979. `--version'
  980. `-V'
  981. Print the version number of Autoconf and exit.
  982. `--verbose'
  983. `-v'
  984. Report processing steps.
  985. `--debug'
  986. `-d'
  987. Don't remove the temporary files.
  988. `--force'
  989. `-f'
  990. Remake `configure' even if newer than its input files.
  991. `--include=DIR'
  992. `-I DIR'
  993. Append DIR to the include path. Multiple invocations accumulate.
  994. `--prepend-include=DIR'
  995. `-B DIR'
  996. Prepend DIR to the include path. Multiple invocations accumulate.
  997. `--output=FILE'
  998. `-o FILE'
  999. Save output (script or trace) to FILE. The file `-' stands for
  1000. the standard output.
  1001. `--warnings=CATEGORY'
  1002. `-W CATEGORY'
  1003. Report the warnings related to CATEGORY (which can actually be a
  1004. comma separated list). *Note Reporting Messages::, macro
  1005. `AC_DIAGNOSE', for a comprehensive list of categories. Special
  1006. values include:
  1007. `all'
  1008. report all the warnings
  1009. `none'
  1010. report none
  1011. `error'
  1012. treats warnings as errors
  1013. `no-CATEGORY'
  1014. disable warnings falling into CATEGORY
  1015. Warnings about `syntax' are enabled by default, and the environment
  1016. variable `WARNINGS', a comma separated list of categories, is
  1017. honored as well. Passing `-W CATEGORY' actually behaves as if you
  1018. had passed `--warnings syntax,$WARNINGS,CATEGORY'. To disable the
  1019. defaults and `WARNINGS', and then enable warnings about obsolete
  1020. constructs, use `-W none,obsolete'.
  1021. Because `autoconf' uses `autom4te' behind the scenes, it displays
  1022. a back trace for errors, but not for warnings; if you want them,
  1023. just pass `-W error'. *Note autom4te Invocation::, for some
  1024. examples.
  1025. `--trace=MACRO[:FORMAT]'
  1026. `-t MACRO[:FORMAT]'
  1027. Do not create the `configure' script, but list the calls to MACRO
  1028. according to the FORMAT. Multiple `--trace' arguments can be used
  1029. to list several macros. Multiple `--trace' arguments for a single
  1030. macro are not cumulative; instead, you should just make FORMAT as
  1031. long as needed.
  1032. The FORMAT is a regular string, with newlines if desired, and
  1033. several special escape codes. It defaults to `$f:$l:$n:$%'; see
  1034. *note autom4te Invocation::, for details on the FORMAT.
  1035. `--initialization'
  1036. `-i'
  1037. By default, `--trace' does not trace the initialization of the
  1038. Autoconf macros (typically the `AC_DEFUN' definitions). This
  1039. results in a noticeable speedup, but can be disabled by this
  1040. option.
  1041. It is often necessary to check the content of a `configure.ac' file,
  1042. but parsing it yourself is extremely fragile and error-prone. It is
  1043. suggested that you rely upon `--trace' to scan `configure.ac'. For
  1044. instance, to find the list of variables that are substituted, use:
  1045. $ autoconf -t AC_SUBST
  1046. configure.ac:2:AC_SUBST:ECHO_C
  1047. configure.ac:2:AC_SUBST:ECHO_N
  1048. configure.ac:2:AC_SUBST:ECHO_T
  1049. More traces deleted
  1050. The example below highlights the difference between `$@', `$*', and
  1051. `$%'.
  1052. $ cat configure.ac
  1053. AC_DEFINE(This, is, [an
  1054. [example]])
  1055. $ autoconf -t 'AC_DEFINE:@: $@
  1056. *: $*
  1057. %: $%'
  1058. @: [This],[is],[an
  1059. [example]]
  1060. *: This,is,an
  1061. [example]
  1062. %: This:is:an [example]
  1063. The FORMAT gives you a lot of freedom:
  1064. $ autoconf -t 'AC_SUBST:$$ac_subst{"$1"} = "$f:$l";'
  1065. $ac_subst{"ECHO_C"} = "configure.ac:2";
  1066. $ac_subst{"ECHO_N"} = "configure.ac:2";
  1067. $ac_subst{"ECHO_T"} = "configure.ac:2";
  1068. More traces deleted
  1069. A long SEPARATOR can be used to improve the readability of complex
  1070. structures, and to ease their parsing (for instance when no single
  1071. character is suitable as a separator):
  1072. $ autoconf -t 'AM_MISSING_PROG:${|:::::|}*'
  1073. ACLOCAL|:::::|aclocal|:::::|$missing_dir
  1074. AUTOCONF|:::::|autoconf|:::::|$missing_dir
  1075. AUTOMAKE|:::::|automake|:::::|$missing_dir
  1076. More traces deleted
  1077. 
  1078. File: autoconf.info, Node: autoreconf Invocation, Prev: autoconf Invocation, Up: Making configure Scripts
  1079. 3.5 Using `autoreconf' to Update `configure' Scripts
  1080. ====================================================
  1081. Installing the various components of the GNU Build System can be
  1082. tedious: running `autopoint' for Gettext, `automake' for `Makefile.in'
  1083. etc. in each directory. It may be needed either because some tools
  1084. such as `automake' have been updated on your system, or because some of
  1085. the sources such as `configure.ac' have been updated, or finally,
  1086. simply in order to install the GNU Build System in a fresh tree.
  1087. `autoreconf' runs `autoconf', `autoheader', `aclocal', `automake',
  1088. `libtoolize', and `autopoint' (when appropriate) repeatedly to update
  1089. the GNU Build System in the specified directories and their
  1090. subdirectories (*note Subdirectories::). By default, it only remakes
  1091. those files that are older than their sources. The environment
  1092. variables `AUTOM4TE', `AUTOCONF', `AUTOHEADER', `AUTOMAKE', `ACLOCAL',
  1093. `AUTOPOINT', `LIBTOOLIZE', `M4', and `MAKE' may be used to override the
  1094. invocation of the respective tools.
  1095. If you install a new version of some tool, you can make `autoreconf'
  1096. remake _all_ of the files by giving it the `--force' option.
  1097. *Note Automatic Remaking::, for Make rules to automatically rebuild
  1098. `configure' scripts when their source files change. That method
  1099. handles the timestamps of configuration header templates properly, but
  1100. does not pass `--autoconf-dir=DIR' or `--localdir=DIR'.
  1101. Gettext supplies the `autopoint' command to add translation
  1102. infrastructure to a source package. If you use `autopoint', your
  1103. `configure.ac' should invoke both `AM_GNU_GETTEXT' and
  1104. `AM_GNU_GETTEXT_VERSION(GETTEXT-VERSION)'. *Note Invoking the
  1105. `autopoint' Program: (gettext)autopoint Invocation, for further details.
  1106. `autoreconf' accepts the following options:
  1107. `--help'
  1108. `-h'
  1109. Print a summary of the command line options and exit.
  1110. `--version'
  1111. `-V'
  1112. Print the version number of Autoconf and exit.
  1113. `--verbose'
  1114. `-v'
  1115. Print the name of each directory `autoreconf' examines and the
  1116. commands it runs. If given two or more times, pass `--verbose' to
  1117. subordinate tools that support it.
  1118. `--debug'
  1119. `-d'
  1120. Don't remove the temporary files.
  1121. `--force'
  1122. `-f'
  1123. Remake even `configure' scripts and configuration headers that are
  1124. newer than their input files (`configure.ac' and, if present,
  1125. `aclocal.m4').
  1126. `--install'
  1127. `-i'
  1128. Install the missing auxiliary files in the package. By default,
  1129. files are copied; this can be changed with `--symlink'.
  1130. If deemed appropriate, this option triggers calls to `automake
  1131. --add-missing', `libtoolize', `autopoint', etc.
  1132. `--no-recursive'
  1133. Do not rebuild files in subdirectories to configure (see *note
  1134. Subdirectories::, macro `AC_CONFIG_SUBDIRS').
  1135. `--symlink'
  1136. `-s'
  1137. When used with `--install', install symbolic links to the missing
  1138. auxiliary files instead of copying them.
  1139. `--make'
  1140. `-m'
  1141. When the directories were configured, update the configuration by
  1142. running `./config.status --recheck && ./config.status', and then
  1143. run `make'.
  1144. `--include=DIR'
  1145. `-I DIR'
  1146. Append DIR to the include path. Multiple invocations accumulate.
  1147. Passed on to `aclocal', `autoconf' and `autoheader' internally.
  1148. `--prepend-include=DIR'
  1149. `-B DIR'
  1150. Prepend DIR to the include path. Multiple invocations accumulate.
  1151. Passed on to `autoconf' and `autoheader' internally.
  1152. `--warnings=CATEGORY'
  1153. `-W CATEGORY'
  1154. Report the warnings related to CATEGORY (which can actually be a
  1155. comma separated list).
  1156. `cross'
  1157. related to cross compilation issues.
  1158. `obsolete'
  1159. report the uses of obsolete constructs.
  1160. `portability'
  1161. portability issues
  1162. `syntax'
  1163. dubious syntactic constructs.
  1164. `all'
  1165. report all the warnings
  1166. `none'
  1167. report none
  1168. `error'
  1169. treats warnings as errors
  1170. `no-CATEGORY'
  1171. disable warnings falling into CATEGORY
  1172. Warnings about `syntax' are enabled by default, and the environment
  1173. variable `WARNINGS', a comma separated list of categories, is
  1174. honored as well. Passing `-W CATEGORY' actually behaves as if you
  1175. had passed `--warnings syntax,$WARNINGS,CATEGORY'. To disable the
  1176. defaults and `WARNINGS', and then enable warnings about obsolete
  1177. constructs, use `-W none,obsolete'.
  1178. If you want `autoreconf' to pass flags that are not listed here on
  1179. to `aclocal', set `ACLOCAL_AMFLAGS' in your `Makefile.am'. Due to a
  1180. limitation in the Autoconf implementation these flags currently must be
  1181. set on a single line in `Makefile.am', without any backslash-newlines.
  1182. 
  1183. File: autoconf.info, Node: Setup, Next: Existing Tests, Prev: Making configure Scripts, Up: Top
  1184. 4 Initialization and Output Files
  1185. *********************************
  1186. Autoconf-generated `configure' scripts need some information about how
  1187. to initialize, such as how to find the package's source files and about
  1188. the output files to produce. The following sections describe the
  1189. initialization and the creation of output files.
  1190. * Menu:
  1191. * Initializing configure:: Option processing etc.
  1192. * Versioning:: Dealing with Autoconf versions
  1193. * Notices:: Copyright, version numbers in `configure'
  1194. * Input:: Where Autoconf should find files
  1195. * Output:: Outputting results from the configuration
  1196. * Configuration Actions:: Preparing the output based on results
  1197. * Configuration Files:: Creating output files
  1198. * Makefile Substitutions:: Using output variables in makefiles
  1199. * Configuration Headers:: Creating a configuration header file
  1200. * Configuration Commands:: Running arbitrary instantiation commands
  1201. * Configuration Links:: Links depending on the configuration
  1202. * Subdirectories:: Configuring independent packages together
  1203. * Default Prefix:: Changing the default installation prefix
  1204. 
  1205. File: autoconf.info, Node: Initializing configure, Next: Versioning, Up: Setup
  1206. 4.1 Initializing `configure'
  1207. ============================
  1208. Every `configure' script must call `AC_INIT' before doing anything else
  1209. that produces output. Calls to silent macros, such as `AC_DEFUN', may
  1210. also occur prior to `AC_INIT', although these are generally used via
  1211. `aclocal.m4', since that is implicitly included before the start of
  1212. `configure.ac'. The only other required macro is `AC_OUTPUT' (*note
  1213. Output::).
  1214. -- Macro: AC_INIT (PACKAGE, VERSION, [BUG-REPORT], [TARNAME], [URL])
  1215. Process any command-line arguments and perform initialization and
  1216. verification.
  1217. Set the name of the PACKAGE and its VERSION. These are typically
  1218. used in `--version' support, including that of `configure'. The
  1219. optional argument BUG-REPORT should be the email to which users
  1220. should send bug reports. The package TARNAME differs from
  1221. PACKAGE: the latter designates the full package name (e.g., `GNU
  1222. Autoconf'), while the former is meant for distribution tar ball
  1223. names (e.g., `autoconf'). It defaults to PACKAGE with `GNU '
  1224. stripped, lower-cased, and all characters other than alphanumerics
  1225. and underscores are changed to `-'. If provided, URL should be
  1226. the home page for the package.
  1227. The arguments of `AC_INIT' must be static, i.e., there should not
  1228. be any shell computation, quotes, or newlines, but they can be
  1229. computed by M4. This is because the package information strings
  1230. are expanded at M4 time into several contexts, and must give the
  1231. same text at shell time whether used in single-quoted strings,
  1232. double-quoted strings, quoted here-documents, or unquoted
  1233. here-documents. It is permissible to use `m4_esyscmd' or
  1234. `m4_esyscmd_s' for computing a version string that changes with
  1235. every commit to a version control system (in fact, Autoconf does
  1236. just that, for all builds of the development tree made between
  1237. releases).
  1238. The following M4 macros (e.g., `AC_PACKAGE_NAME'), output variables
  1239. (e.g., `PACKAGE_NAME'), and preprocessor symbols (e.g.,
  1240. `PACKAGE_NAME'), are defined by `AC_INIT':
  1241. `AC_PACKAGE_NAME', `PACKAGE_NAME'
  1242. Exactly PACKAGE.
  1243. `AC_PACKAGE_TARNAME', `PACKAGE_TARNAME'
  1244. Exactly TARNAME, possibly generated from PACKAGE.
  1245. `AC_PACKAGE_VERSION', `PACKAGE_VERSION'
  1246. Exactly VERSION.
  1247. `AC_PACKAGE_STRING', `PACKAGE_STRING'
  1248. Exactly `PACKAGE VERSION'.
  1249. `AC_PACKAGE_BUGREPORT', `PACKAGE_BUGREPORT'
  1250. Exactly BUG-REPORT, if one was provided. Typically an email
  1251. address, or URL to a bug management web page.
  1252. `AC_PACKAGE_URL', `PACKAGE_URL'
  1253. Exactly URL, if one was provided. If URL was empty, but
  1254. PACKAGE begins with `GNU ', then this defaults to
  1255. `http://www.gnu.org/software/TARNAME/', otherwise, no URL is
  1256. assumed.
  1257. If your `configure' script does its own option processing, it should
  1258. inspect `$@' or `$*' immediately after calling `AC_INIT', because other
  1259. Autoconf macros liberally use the `set' command to process strings, and
  1260. this has the side effect of updating `$@' and `$*'. However, we
  1261. suggest that you use standard macros like `AC_ARG_ENABLE' instead of
  1262. attempting to implement your own option processing. *Note Site
  1263. Configuration::.
  1264. 
  1265. File: autoconf.info, Node: Versioning, Next: Notices, Prev: Initializing configure, Up: Setup
  1266. 4.2 Dealing with Autoconf versions
  1267. ==================================
  1268. The following optional macros can be used to help choose the minimum
  1269. version of Autoconf that can successfully compile a given
  1270. `configure.ac'.
  1271. -- Macro: AC_PREREQ (VERSION)
  1272. Ensure that a recent enough version of Autoconf is being used. If
  1273. the version of Autoconf being used to create `configure' is
  1274. earlier than VERSION, print an error message to the standard error
  1275. output and exit with failure (exit status is 63). For example:
  1276. AC_PREREQ([2.69])
  1277. This macro may be used before `AC_INIT'.
  1278. -- Macro: AC_AUTOCONF_VERSION
  1279. This macro was introduced in Autoconf 2.62. It identifies the
  1280. version of Autoconf that is currently parsing the input file, in a
  1281. format suitable for `m4_version_compare' (*note
  1282. m4_version_compare::); in other words, for this release of
  1283. Autoconf, its value is `2.69'. One potential use of this macro is
  1284. for writing conditional fallbacks based on when a feature was
  1285. added to Autoconf, rather than using `AC_PREREQ' to require the
  1286. newer version of Autoconf. However, remember that the Autoconf
  1287. philosophy favors feature checks over version checks.
  1288. You should not expand this macro directly; use
  1289. `m4_defn([AC_AUTOCONF_VERSION])' instead. This is because some
  1290. users might have a beta version of Autoconf installed, with
  1291. arbitrary letters included in its version string. This means it
  1292. is possible for the version string to contain the name of a
  1293. defined macro, such that expanding `AC_AUTOCONF_VERSION' would
  1294. trigger the expansion of that macro during rescanning, and change
  1295. the version string to be different than what you intended to check.
  1296. 
  1297. File: autoconf.info, Node: Notices, Next: Input, Prev: Versioning, Up: Setup
  1298. 4.3 Notices in `configure'
  1299. ==========================
  1300. The following macros manage version numbers for `configure' scripts.
  1301. Using them is optional.
  1302. -- Macro: AC_COPYRIGHT (COPYRIGHT-NOTICE)
  1303. State that, in addition to the Free Software Foundation's
  1304. copyright on the Autoconf macros, parts of your `configure' are
  1305. covered by the COPYRIGHT-NOTICE.
  1306. The COPYRIGHT-NOTICE shows up in both the head of `configure' and
  1307. in `configure --version'.
  1308. -- Macro: AC_REVISION (REVISION-INFO)
  1309. Copy revision stamp REVISION-INFO into the `configure' script,
  1310. with any dollar signs or double-quotes removed. This macro lets
  1311. you put a revision stamp from `configure.ac' into `configure'
  1312. without RCS or CVS changing it when you check in `configure'.
  1313. That way, you can determine easily which revision of
  1314. `configure.ac' a particular `configure' corresponds to.
  1315. For example, this line in `configure.ac':
  1316. AC_REVISION([$Revision: 1.30 $])
  1317. produces this in `configure':
  1318. #!/bin/sh
  1319. # From configure.ac Revision: 1.30
  1320. 
  1321. File: autoconf.info, Node: Input, Next: Output, Prev: Notices, Up: Setup
  1322. 4.4 Finding `configure' Input
  1323. =============================
  1324. -- Macro: AC_CONFIG_SRCDIR (UNIQUE-FILE-IN-SOURCE-DIR)
  1325. UNIQUE-FILE-IN-SOURCE-DIR is some file that is in the package's
  1326. source directory; `configure' checks for this file's existence to
  1327. make sure that the directory that it is told contains the source
  1328. code in fact does. Occasionally people accidentally specify the
  1329. wrong directory with `--srcdir'; this is a safety check. *Note
  1330. configure Invocation::, for more information.
  1331. Packages that do manual configuration or use the `install' program
  1332. might need to tell `configure' where to find some other shell scripts
  1333. by calling `AC_CONFIG_AUX_DIR', though the default places it looks are
  1334. correct for most cases.
  1335. -- Macro: AC_CONFIG_AUX_DIR (DIR)
  1336. Use the auxiliary build tools (e.g., `install-sh', `config.sub',
  1337. `config.guess', Cygnus `configure', Automake and Libtool scripts,
  1338. etc.) that are in directory DIR. These are auxiliary files used
  1339. in configuration. DIR can be either absolute or relative to
  1340. `SRCDIR'. The default is `SRCDIR' or `SRCDIR/..' or
  1341. `SRCDIR/../..', whichever is the first that contains `install-sh'.
  1342. The other files are not checked for, so that using
  1343. `AC_PROG_INSTALL' does not automatically require distributing the
  1344. other auxiliary files. It checks for `install.sh' also, but that
  1345. name is obsolete because some `make' have a rule that creates
  1346. `install' from it if there is no makefile.
  1347. The auxiliary directory is commonly named `build-aux'. If you
  1348. need portability to DOS variants, do not name the auxiliary
  1349. directory `aux'. *Note File System Conventions::.
  1350. -- Macro: AC_REQUIRE_AUX_FILE (FILE)
  1351. Declares that FILE is expected in the directory defined above. In
  1352. Autoconf proper, this macro does nothing: its sole purpose is to be
  1353. traced by third-party tools to produce a list of expected auxiliary
  1354. files. For instance it is called by macros like `AC_PROG_INSTALL'
  1355. (*note Particular Programs::) or `AC_CANONICAL_BUILD' (*note
  1356. Canonicalizing::) to register the auxiliary files they need.
  1357. Similarly, packages that use `aclocal' should declare where local
  1358. macros can be found using `AC_CONFIG_MACRO_DIR'.
  1359. -- Macro: AC_CONFIG_MACRO_DIR (DIR)
  1360. Specify DIR as the location of additional local Autoconf macros.
  1361. This macro is intended for use by future versions of commands like
  1362. `autoreconf' that trace macro calls. It should be called directly
  1363. from `configure.ac' so that tools that install macros for
  1364. `aclocal' can find the macros' declarations.
  1365. Note that if you use `aclocal' from Automake to generate
  1366. `aclocal.m4', you must also set `ACLOCAL_AMFLAGS = -I DIR' in your
  1367. top-level `Makefile.am'. Due to a limitation in the Autoconf
  1368. implementation of `autoreconf', these include directives currently
  1369. must be set on a single line in `Makefile.am', without any
  1370. backslash-newlines.
  1371. 
  1372. File: autoconf.info, Node: Output, Next: Configuration Actions, Prev: Input, Up: Setup
  1373. 4.5 Outputting Files
  1374. ====================
  1375. Every Autoconf script, e.g., `configure.ac', should finish by calling
  1376. `AC_OUTPUT'. That is the macro that generates and runs
  1377. `config.status', which in turn creates the makefiles and any other
  1378. files resulting from configuration. This is the only required macro
  1379. besides `AC_INIT' (*note Input::).
  1380. -- Macro: AC_OUTPUT
  1381. Generate `config.status' and launch it. Call this macro once, at
  1382. the end of `configure.ac'.
  1383. `config.status' performs all the configuration actions: all the
  1384. output files (see *note Configuration Files::, macro
  1385. `AC_CONFIG_FILES'), header files (see *note Configuration
  1386. Headers::, macro `AC_CONFIG_HEADERS'), commands (see *note
  1387. Configuration Commands::, macro `AC_CONFIG_COMMANDS'), links (see
  1388. *note Configuration Links::, macro `AC_CONFIG_LINKS'),
  1389. subdirectories to configure (see *note Subdirectories::, macro
  1390. `AC_CONFIG_SUBDIRS') are honored.
  1391. The location of your `AC_OUTPUT' invocation is the exact point
  1392. where configuration actions are taken: any code afterwards is
  1393. executed by `configure' once `config.status' was run. If you want
  1394. to bind actions to `config.status' itself (independently of
  1395. whether `configure' is being run), see *note Running Arbitrary
  1396. Configuration Commands: Configuration Commands.
  1397. Historically, the usage of `AC_OUTPUT' was somewhat different.
  1398. *Note Obsolete Macros::, for a description of the arguments that
  1399. `AC_OUTPUT' used to support.
  1400. If you run `make' in subdirectories, you should run it using the
  1401. `make' variable `MAKE'. Most versions of `make' set `MAKE' to the name
  1402. of the `make' program plus any options it was given. (But many do not
  1403. include in it the values of any variables set on the command line, so
  1404. those are not passed on automatically.) Some old versions of `make' do
  1405. not set this variable. The following macro allows you to use it even
  1406. with those versions.
  1407. -- Macro: AC_PROG_MAKE_SET
  1408. If the Make command, `$MAKE' if set or else `make', predefines
  1409. `$(MAKE)', define output variable `SET_MAKE' to be empty.
  1410. Otherwise, define `SET_MAKE' to a macro definition that sets
  1411. `$(MAKE)', such as `MAKE=make'. Calls `AC_SUBST' for `SET_MAKE'.
  1412. If you use this macro, place a line like this in each `Makefile.in'
  1413. that runs `MAKE' on other directories:
  1414. @SET_MAKE@
  1415. 
  1416. File: autoconf.info, Node: Configuration Actions, Next: Configuration Files, Prev: Output, Up: Setup
  1417. 4.6 Performing Configuration Actions
  1418. ====================================
  1419. `configure' is designed so that it appears to do everything itself, but
  1420. there is actually a hidden slave: `config.status'. `configure' is in
  1421. charge of examining your system, but it is `config.status' that
  1422. actually takes the proper actions based on the results of `configure'.
  1423. The most typical task of `config.status' is to _instantiate_ files.
  1424. This section describes the common behavior of the four standard
  1425. instantiating macros: `AC_CONFIG_FILES', `AC_CONFIG_HEADERS',
  1426. `AC_CONFIG_COMMANDS' and `AC_CONFIG_LINKS'. They all have this
  1427. prototype:
  1428. AC_CONFIG_ITEMS(TAG..., [COMMANDS], [INIT-CMDS])
  1429. where the arguments are:
  1430. TAG...
  1431. A blank-or-newline-separated list of tags, which are typically the
  1432. names of the files to instantiate.
  1433. You are encouraged to use literals as TAGS. In particular, you
  1434. should avoid
  1435. ... && my_foos="$my_foos fooo"
  1436. ... && my_foos="$my_foos foooo"
  1437. AC_CONFIG_ITEMS([$my_foos])
  1438. and use this instead:
  1439. ... && AC_CONFIG_ITEMS([fooo])
  1440. ... && AC_CONFIG_ITEMS([foooo])
  1441. The macros `AC_CONFIG_FILES' and `AC_CONFIG_HEADERS' use special
  1442. TAG values: they may have the form `OUTPUT' or `OUTPUT:INPUTS'.
  1443. The file OUTPUT is instantiated from its templates, INPUTS
  1444. (defaulting to `OUTPUT.in').
  1445. `AC_CONFIG_FILES([Makefile:boiler/top.mk:boiler/bot.mk])', for
  1446. example, asks for the creation of the file `Makefile' that
  1447. contains the expansion of the output variables in the
  1448. concatenation of `boiler/top.mk' and `boiler/bot.mk'.
  1449. The special value `-' might be used to denote the standard output
  1450. when used in OUTPUT, or the standard input when used in the
  1451. INPUTS. You most probably don't need to use this in
  1452. `configure.ac', but it is convenient when using the command line
  1453. interface of `./config.status', see *note config.status
  1454. Invocation::, for more details.
  1455. The INPUTS may be absolute or relative file names. In the latter
  1456. case they are first looked for in the build tree, and then in the
  1457. source tree. Input files should be text files, and a line length
  1458. below 2000 bytes should be safe.
  1459. COMMANDS
  1460. Shell commands output literally into `config.status', and
  1461. associated with a tag that the user can use to tell `config.status'
  1462. which commands to run. The commands are run each time a TAG
  1463. request is given to `config.status', typically each time the file
  1464. `TAG' is created.
  1465. The variables set during the execution of `configure' are _not_
  1466. available here: you first need to set them via the INIT-CMDS.
  1467. Nonetheless the following variables are precomputed:
  1468. `srcdir'
  1469. The name of the top source directory, assuming that the
  1470. working directory is the top build directory. This is what
  1471. the `configure' option `--srcdir' sets.
  1472. `ac_top_srcdir'
  1473. The name of the top source directory, assuming that the
  1474. working directory is the current build directory.
  1475. `ac_top_build_prefix'
  1476. The name of the top build directory, assuming that the working
  1477. directory is the current build directory. It can be empty,
  1478. or else ends with a slash, so that you may concatenate it.
  1479. `ac_srcdir'
  1480. The name of the corresponding source directory, assuming that
  1481. the working directory is the current build directory.
  1482. `tmp'
  1483. The name of a temporary directory within the build tree,
  1484. which you can use if you need to create additional temporary
  1485. files. The directory is cleaned up when `config.status' is
  1486. done or interrupted. Please use package-specific file name
  1487. prefixes to avoid clashing with files that `config.status'
  1488. may use internally.
  1489. The "current" directory refers to the directory (or
  1490. pseudo-directory) containing the input part of TAGS. For
  1491. instance, running
  1492. AC_CONFIG_COMMANDS([deep/dir/out:in/in.in], [...], [...])
  1493. with `--srcdir=../package' produces the following values:
  1494. # Argument of --srcdir
  1495. srcdir='../package'
  1496. # Reversing deep/dir
  1497. ac_top_build_prefix='../../'
  1498. # Concatenation of $ac_top_build_prefix and srcdir
  1499. ac_top_srcdir='../../../package'
  1500. # Concatenation of $ac_top_srcdir and deep/dir
  1501. ac_srcdir='../../../package/deep/dir'
  1502. independently of `in/in.in'.
  1503. INIT-CMDS
  1504. Shell commands output _unquoted_ near the beginning of
  1505. `config.status', and executed each time `config.status' runs
  1506. (regardless of the tag). Because they are unquoted, for example,
  1507. `$var' is output as the value of `var'. INIT-CMDS is typically
  1508. used by `configure' to give `config.status' some variables it
  1509. needs to run the COMMANDS.
  1510. You should be extremely cautious in your variable names: all the
  1511. INIT-CMDS share the same name space and may overwrite each other
  1512. in unpredictable ways. Sorry...
  1513. All these macros can be called multiple times, with different TAG
  1514. values, of course!
  1515. 
  1516. File: autoconf.info, Node: Configuration Files, Next: Makefile Substitutions, Prev: Configuration Actions, Up: Setup
  1517. 4.7 Creating Configuration Files
  1518. ================================
  1519. Be sure to read the previous section, *note Configuration Actions::.
  1520. -- Macro: AC_CONFIG_FILES (FILE..., [CMDS], [INIT-CMDS])
  1521. Make `AC_OUTPUT' create each `FILE' by copying an input file (by
  1522. default `FILE.in'), substituting the output variable values. This
  1523. macro is one of the instantiating macros; see *note Configuration
  1524. Actions::. *Note Makefile Substitutions::, for more information
  1525. on using output variables. *Note Setting Output Variables::, for
  1526. more information on creating them. This macro creates the
  1527. directory that the file is in if it doesn't exist. Usually,
  1528. makefiles are created this way, but other files, such as
  1529. `.gdbinit', can be specified as well.
  1530. Typical calls to `AC_CONFIG_FILES' look like this:
  1531. AC_CONFIG_FILES([Makefile src/Makefile man/Makefile X/Imakefile])
  1532. AC_CONFIG_FILES([autoconf], [chmod +x autoconf])
  1533. You can override an input file name by appending to FILE a
  1534. colon-separated list of input files. Examples:
  1535. AC_CONFIG_FILES([Makefile:boiler/top.mk:boiler/bot.mk]
  1536. [lib/Makefile:boiler/lib.mk])
  1537. Doing this allows you to keep your file names acceptable to DOS
  1538. variants, or to prepend and/or append boilerplate to the file.
  1539. 
  1540. File: autoconf.info, Node: Makefile Substitutions, Next: Configuration Headers, Prev: Configuration Files, Up: Setup
  1541. 4.8 Substitutions in Makefiles
  1542. ==============================
  1543. Each subdirectory in a distribution that contains something to be
  1544. compiled or installed should come with a file `Makefile.in', from which
  1545. `configure' creates a file `Makefile' in that directory. To create
  1546. `Makefile', `configure' performs a simple variable substitution,
  1547. replacing occurrences of `@VARIABLE@' in `Makefile.in' with the value
  1548. that `configure' has determined for that variable. Variables that are
  1549. substituted into output files in this way are called "output
  1550. variables". They are ordinary shell variables that are set in
  1551. `configure'. To make `configure' substitute a particular variable into
  1552. the output files, the macro `AC_SUBST' must be called with that
  1553. variable name as an argument. Any occurrences of `@VARIABLE@' for
  1554. other variables are left unchanged. *Note Setting Output Variables::,
  1555. for more information on creating output variables with `AC_SUBST'.
  1556. A software package that uses a `configure' script should be
  1557. distributed with a file `Makefile.in', but no makefile; that way, the
  1558. user has to properly configure the package for the local system before
  1559. compiling it.
  1560. *Note Makefile Conventions: (standards)Makefile Conventions, for
  1561. more information on what to put in makefiles.
  1562. * Menu:
  1563. * Preset Output Variables:: Output variables that are always set
  1564. * Installation Directory Variables:: Other preset output variables
  1565. * Changed Directory Variables:: Warnings about `datarootdir'
  1566. * Build Directories:: Supporting multiple concurrent compiles
  1567. * Automatic Remaking:: Makefile rules for configuring
  1568. 
  1569. File: autoconf.info, Node: Preset Output Variables, Next: Installation Directory Variables, Up: Makefile Substitutions
  1570. 4.8.1 Preset Output Variables
  1571. -----------------------------
  1572. Some output variables are preset by the Autoconf macros. Some of the
  1573. Autoconf macros set additional output variables, which are mentioned in
  1574. the descriptions for those macros. *Note Output Variable Index::, for a
  1575. complete list of output variables. *Note Installation Directory
  1576. Variables::, for the list of the preset ones related to installation
  1577. directories. Below are listed the other preset ones, many of which are
  1578. precious variables (*note Setting Output Variables::, `AC_ARG_VAR').
  1579. The preset variables which are available during `config.status'
  1580. (*note Configuration Actions::) may also be used during `configure'
  1581. tests. For example, it is permissible to reference `$srcdir' when
  1582. constructing a list of directories to pass via option `-I' during a
  1583. compiler feature check. When used in this manner, coupled with the
  1584. fact that `configure' is always run from the top build directory, it is
  1585. sufficient to use just `$srcdir' instead of `$top_srcdir'.
  1586. -- Variable: CFLAGS
  1587. Debugging and optimization options for the C compiler. If it is
  1588. not set in the environment when `configure' runs, the default
  1589. value is set when you call `AC_PROG_CC' (or empty if you don't).
  1590. `configure' uses this variable when compiling or linking programs
  1591. to test for C features.
  1592. If a compiler option affects only the behavior of the preprocessor
  1593. (e.g., `-DNAME'), it should be put into `CPPFLAGS' instead. If it
  1594. affects only the linker (e.g., `-LDIRECTORY'), it should be put
  1595. into `LDFLAGS' instead. If it affects only the compiler proper,
  1596. `CFLAGS' is the natural home for it. If an option affects
  1597. multiple phases of the compiler, though, matters get tricky. One
  1598. approach to put such options directly into `CC', e.g., `CC='gcc
  1599. -m64''. Another is to put them into both `CPPFLAGS' and
  1600. `LDFLAGS', but not into `CFLAGS'.
  1601. However, remember that some `Makefile' variables are reserved by
  1602. the GNU Coding Standards for the use of the "user"--the person
  1603. building the package. For instance, `CFLAGS' is one such variable.
  1604. Sometimes package developers are tempted to set user variables
  1605. such as `CFLAGS' because it appears to make their job easier.
  1606. However, the package itself should never set a user variable,
  1607. particularly not to include switches that are required for proper
  1608. compilation of the package. Since these variables are documented
  1609. as being for the package builder, that person rightfully expects
  1610. to be able to override any of these variables at build time. If
  1611. the package developer needs to add switches without interfering
  1612. with the user, the proper way to do that is to introduce an
  1613. additional variable. Automake makes this easy by introducing
  1614. `AM_CFLAGS' (*note Flag Variables Ordering: (automake)Flag
  1615. Variables Ordering.), but the concept is the same even if Automake
  1616. is not used.
  1617. -- Variable: configure_input
  1618. A comment saying that the file was generated automatically by
  1619. `configure' and giving the name of the input file. `AC_OUTPUT'
  1620. adds a comment line containing this variable to the top of every
  1621. makefile it creates. For other files, you should reference this
  1622. variable in a comment at the top of each input file. For example,
  1623. an input shell script should begin like this:
  1624. #!/bin/sh
  1625. # @configure_input@
  1626. The presence of that line also reminds people editing the file
  1627. that it needs to be processed by `configure' in order to be used.
  1628. -- Variable: CPPFLAGS
  1629. Preprocessor options for the C, C++, Objective C, and Objective C++
  1630. preprocessors and compilers. If it is not set in the environment
  1631. when `configure' runs, the default value is empty. `configure'
  1632. uses this variable when preprocessing or compiling programs to
  1633. test for C, C++, Objective C, and Objective C++ features.
  1634. This variable's contents should contain options like `-I', `-D',
  1635. and `-U' that affect only the behavior of the preprocessor.
  1636. Please see the explanation of `CFLAGS' for what you can do if an
  1637. option affects other phases of the compiler as well.
  1638. Currently, `configure' always links as part of a single invocation
  1639. of the compiler that also preprocesses and compiles, so it uses
  1640. this variable also when linking programs. However, it is unwise to
  1641. depend on this behavior because the GNU Coding Standards do not
  1642. require it and many packages do not use `CPPFLAGS' when linking
  1643. programs.
  1644. *Note Special Chars in Variables::, for limitations that `CPPFLAGS'
  1645. might run into.
  1646. -- Variable: CXXFLAGS
  1647. Debugging and optimization options for the C++ compiler. It acts
  1648. like `CFLAGS', but for C++ instead of C.
  1649. -- Variable: DEFS
  1650. `-D' options to pass to the C compiler. If `AC_CONFIG_HEADERS' is
  1651. called, `configure' replaces `@DEFS@' with `-DHAVE_CONFIG_H'
  1652. instead (*note Configuration Headers::). This variable is not
  1653. defined while `configure' is performing its tests, only when
  1654. creating the output files. *Note Setting Output Variables::, for
  1655. how to check the results of previous tests.
  1656. -- Variable: ECHO_C
  1657. -- Variable: ECHO_N
  1658. -- Variable: ECHO_T
  1659. How does one suppress the trailing newline from `echo' for
  1660. question-answer message pairs? These variables provide a way:
  1661. echo $ECHO_N "And the winner is... $ECHO_C"
  1662. sleep 100000000000
  1663. echo "${ECHO_T}dead."
  1664. Some old and uncommon `echo' implementations offer no means to
  1665. achieve this, in which case `ECHO_T' is set to tab. You might not
  1666. want to use it.
  1667. -- Variable: ERLCFLAGS
  1668. Debugging and optimization options for the Erlang compiler. If it
  1669. is not set in the environment when `configure' runs, the default
  1670. value is empty. `configure' uses this variable when compiling
  1671. programs to test for Erlang features.
  1672. -- Variable: FCFLAGS
  1673. Debugging and optimization options for the Fortran compiler. If it
  1674. is not set in the environment when `configure' runs, the default
  1675. value is set when you call `AC_PROG_FC' (or empty if you don't).
  1676. `configure' uses this variable when compiling or linking programs
  1677. to test for Fortran features.
  1678. -- Variable: FFLAGS
  1679. Debugging and optimization options for the Fortran 77 compiler.
  1680. If it is not set in the environment when `configure' runs, the
  1681. default value is set when you call `AC_PROG_F77' (or empty if you
  1682. don't). `configure' uses this variable when compiling or linking
  1683. programs to test for Fortran 77 features.
  1684. -- Variable: LDFLAGS
  1685. Options for the linker. If it is not set in the environment when
  1686. `configure' runs, the default value is empty. `configure' uses
  1687. this variable when linking programs to test for C, C++, Objective
  1688. C, Objective C++, Fortran, and Go features.
  1689. This variable's contents should contain options like `-s' and `-L'
  1690. that affect only the behavior of the linker. Please see the
  1691. explanation of `CFLAGS' for what you can do if an option also
  1692. affects other phases of the compiler.
  1693. Don't use this variable to pass library names (`-l') to the
  1694. linker; use `LIBS' instead.
  1695. -- Variable: LIBS
  1696. `-l' options to pass to the linker. The default value is empty,
  1697. but some Autoconf macros may prepend extra libraries to this
  1698. variable if those libraries are found and provide necessary
  1699. functions, see *note Libraries::. `configure' uses this variable
  1700. when linking programs to test for C, C++, Objective C, Objective
  1701. C++, Fortran, and Go features.
  1702. -- Variable: OBJCFLAGS
  1703. Debugging and optimization options for the Objective C compiler.
  1704. It acts like `CFLAGS', but for Objective C instead of C.
  1705. -- Variable: OBJCXXFLAGS
  1706. Debugging and optimization options for the Objective C++ compiler.
  1707. It acts like `CXXFLAGS', but for Objective C++ instead of C++.
  1708. -- Variable: GOFLAGS
  1709. Debugging and optimization options for the Go compiler. It acts
  1710. like `CFLAGS', but for Go instead of C.
  1711. -- Variable: builddir
  1712. Rigorously equal to `.'. Added for symmetry only.
  1713. -- Variable: abs_builddir
  1714. Absolute name of `builddir'.
  1715. -- Variable: top_builddir
  1716. The relative name of the top level of the current build tree. In
  1717. the top-level directory, this is the same as `builddir'.
  1718. -- Variable: top_build_prefix
  1719. The relative name of the top level of the current build tree with
  1720. final slash if nonempty. This is the same as `top_builddir',
  1721. except that it contains zero or more runs of `../', so it should
  1722. not be appended with a slash for concatenation. This helps for
  1723. `make' implementations that otherwise do not treat `./file' and
  1724. `file' as equal in the toplevel build directory.
  1725. -- Variable: abs_top_builddir
  1726. Absolute name of `top_builddir'.
  1727. -- Variable: srcdir
  1728. The name of the directory that contains the source code for that
  1729. makefile.
  1730. -- Variable: abs_srcdir
  1731. Absolute name of `srcdir'.
  1732. -- Variable: top_srcdir
  1733. The name of the top-level source code directory for the package.
  1734. In the top-level directory, this is the same as `srcdir'.
  1735. -- Variable: abs_top_srcdir
  1736. Absolute name of `top_srcdir'.
  1737. 
  1738. File: autoconf.info, Node: Installation Directory Variables, Next: Changed Directory Variables, Prev: Preset Output Variables, Up: Makefile Substitutions
  1739. 4.8.2 Installation Directory Variables
  1740. --------------------------------------
  1741. The following variables specify the directories for package
  1742. installation, see *note Variables for Installation Directories:
  1743. (standards)Directory Variables, for more information. Each variable
  1744. corresponds to an argument of `configure'; trailing slashes are
  1745. stripped so that expressions such as `${prefix}/lib' expand with only
  1746. one slash between directory names. See the end of this section for
  1747. details on when and how to use these variables.
  1748. -- Variable: bindir
  1749. The directory for installing executables that users run.
  1750. -- Variable: datadir
  1751. The directory for installing idiosyncratic read-only
  1752. architecture-independent data.
  1753. -- Variable: datarootdir
  1754. The root of the directory tree for read-only
  1755. architecture-independent data files.
  1756. -- Variable: docdir
  1757. The directory for installing documentation files (other than Info
  1758. and man).
  1759. -- Variable: dvidir
  1760. The directory for installing documentation files in DVI format.
  1761. -- Variable: exec_prefix
  1762. The installation prefix for architecture-dependent files. By
  1763. default it's the same as `prefix'. You should avoid installing
  1764. anything directly to `exec_prefix'. However, the default value for
  1765. directories containing architecture-dependent files should be
  1766. relative to `exec_prefix'.
  1767. -- Variable: htmldir
  1768. The directory for installing HTML documentation.
  1769. -- Variable: includedir
  1770. The directory for installing C header files.
  1771. -- Variable: infodir
  1772. The directory for installing documentation in Info format.
  1773. -- Variable: libdir
  1774. The directory for installing object code libraries.
  1775. -- Variable: libexecdir
  1776. The directory for installing executables that other programs run.
  1777. -- Variable: localedir
  1778. The directory for installing locale-dependent but
  1779. architecture-independent data, such as message catalogs. This
  1780. directory usually has a subdirectory per locale.
  1781. -- Variable: localstatedir
  1782. The directory for installing modifiable single-machine data.
  1783. -- Variable: mandir
  1784. The top-level directory for installing documentation in man format.
  1785. -- Variable: oldincludedir
  1786. The directory for installing C header files for non-GCC compilers.
  1787. -- Variable: pdfdir
  1788. The directory for installing PDF documentation.
  1789. -- Variable: prefix
  1790. The common installation prefix for all files. If `exec_prefix' is
  1791. defined to a different value, `prefix' is used only for
  1792. architecture-independent files.
  1793. -- Variable: psdir
  1794. The directory for installing PostScript documentation.
  1795. -- Variable: sbindir
  1796. The directory for installing executables that system
  1797. administrators run.
  1798. -- Variable: sharedstatedir
  1799. The directory for installing modifiable architecture-independent
  1800. data.
  1801. -- Variable: sysconfdir
  1802. The directory for installing read-only single-machine data.
  1803. Most of these variables have values that rely on `prefix' or
  1804. `exec_prefix'. It is deliberate that the directory output variables
  1805. keep them unexpanded: typically `@datarootdir@' is replaced by
  1806. `${prefix}/share', not `/usr/local/share', and `@datadir@' is replaced
  1807. by `${datarootdir}'.
  1808. This behavior is mandated by the GNU Coding Standards, so that when
  1809. the user runs:
  1810. `make'
  1811. she can still specify a different prefix from the one specified to
  1812. `configure', in which case, if needed, the package should hard
  1813. code dependencies corresponding to the make-specified prefix.
  1814. `make install'
  1815. she can specify a different installation location, in which case
  1816. the package _must_ still depend on the location which was compiled
  1817. in (i.e., never recompile when `make install' is run). This is an
  1818. extremely important feature, as many people may decide to install
  1819. all the files of a package grouped together, and then install
  1820. links from the final locations to there.
  1821. In order to support these features, it is essential that
  1822. `datarootdir' remains defined as `${prefix}/share', so that its value
  1823. can be expanded based on the current value of `prefix'.
  1824. A corollary is that you should not use these variables except in
  1825. makefiles. For instance, instead of trying to evaluate `datadir' in
  1826. `configure' and hard-coding it in makefiles using e.g.,
  1827. `AC_DEFINE_UNQUOTED([DATADIR], ["$datadir"], [Data directory.])', you
  1828. should add `-DDATADIR='$(datadir)'' to your makefile's definition of
  1829. `CPPFLAGS' (`AM_CPPFLAGS' if you are also using Automake).
  1830. Similarly, you should not rely on `AC_CONFIG_FILES' to replace
  1831. `bindir' and friends in your shell scripts and other files; instead,
  1832. let `make' manage their replacement. For instance Autoconf ships
  1833. templates of its shell scripts ending with `.in', and uses a makefile
  1834. snippet similar to the following to build scripts like `autoheader' and
  1835. `autom4te':
  1836. edit = sed \
  1837. -e 's|@bindir[@]|$(bindir)|g' \
  1838. -e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \
  1839. -e 's|@prefix[@]|$(prefix)|g'
  1840. autoheader autom4te: Makefile
  1841. rm -f $@ $@.tmp
  1842. srcdir=''; \
  1843. test -f ./$@.in || srcdir=$(srcdir)/; \
  1844. $(edit) $${srcdir}$@.in >$@.tmp
  1845. chmod +x $@.tmp
  1846. chmod a-w $@.tmp
  1847. mv $@.tmp $@
  1848. autoheader: $(srcdir)/autoheader.in
  1849. autom4te: $(srcdir)/autom4te.in
  1850. Some details are noteworthy:
  1851. `@bindir[@]'
  1852. The brackets prevent `configure' from replacing `@bindir@' in the
  1853. Sed expression itself. Brackets are preferable to a backslash
  1854. here, since Posix says `\@' is not portable.
  1855. `$(bindir)'
  1856. Don't use `@bindir@'! Use the matching makefile variable instead.
  1857. `$(pkgdatadir)'
  1858. The example takes advantage of the variable `$(pkgdatadir)'
  1859. provided by Automake; it is equivalent to `$(datadir)/$(PACKAGE)'.
  1860. `/'
  1861. Don't use `/' in the Sed expressions that replace file names since
  1862. most likely the variables you use, such as `$(bindir)', contain
  1863. `/'. Use a shell metacharacter instead, such as `|'.
  1864. special characters
  1865. File names, file name components, and the value of `VPATH' should
  1866. not contain shell metacharacters or white space. *Note Special
  1867. Chars in Variables::.
  1868. dependency on `Makefile'
  1869. Since `edit' uses values that depend on the configuration specific
  1870. values (`prefix', etc.) and not only on `VERSION' and so forth,
  1871. the output depends on `Makefile', not `configure.ac'.
  1872. `$@'
  1873. The main rule is generic, and uses `$@' extensively to avoid the
  1874. need for multiple copies of the rule.
  1875. Separated dependencies and single suffix rules
  1876. You can't use them! The above snippet cannot be (portably)
  1877. rewritten as:
  1878. autoconf autoheader: Makefile
  1879. .in:
  1880. rm -f $@ $@.tmp
  1881. $(edit) $< >$@.tmp
  1882. chmod +x $@.tmp
  1883. mv $@.tmp $@
  1884. *Note Single Suffix Rules::, for details.
  1885. `$(srcdir)'
  1886. Be sure to specify the name of the source directory, otherwise the
  1887. package won't support separated builds.
  1888. For the more specific installation of Erlang libraries, the
  1889. following variables are defined:
  1890. -- Variable: ERLANG_INSTALL_LIB_DIR
  1891. The common parent directory of Erlang library installation
  1892. directories. This variable is set by calling the
  1893. `AC_ERLANG_SUBST_INSTALL_LIB_DIR' macro in `configure.ac'.
  1894. -- Variable: ERLANG_INSTALL_LIB_DIR_LIBRARY
  1895. The installation directory for Erlang library LIBRARY. This
  1896. variable is set by using the `AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR'
  1897. macro in `configure.ac'.
  1898. *Note Erlang Libraries::, for details.
  1899. 
  1900. File: autoconf.info, Node: Changed Directory Variables, Next: Build Directories, Prev: Installation Directory Variables, Up: Makefile Substitutions
  1901. 4.8.3 Changed Directory Variables
  1902. ---------------------------------
  1903. In Autoconf 2.60, the set of directory variables has changed, and the
  1904. defaults of some variables have been adjusted (*note Installation
  1905. Directory Variables::) to changes in the GNU Coding Standards.
  1906. Notably, `datadir', `infodir', and `mandir' are now expressed in terms
  1907. of `datarootdir'. If you are upgrading from an earlier Autoconf
  1908. version, you may need to adjust your files to ensure that the directory
  1909. variables are substituted correctly (*note Defining Directories::), and
  1910. that a definition of `datarootdir' is in place. For example, in a
  1911. `Makefile.in', adding
  1912. datarootdir = @datarootdir@
  1913. is usually sufficient. If you use Automake to create `Makefile.in', it
  1914. will add this for you.
  1915. To help with the transition, Autoconf warns about files that seem to
  1916. use `datarootdir' without defining it. In some cases, it then expands
  1917. the value of `$datarootdir' in substitutions of the directory
  1918. variables. The following example shows such a warning:
  1919. $ cat configure.ac
  1920. AC_INIT
  1921. AC_CONFIG_FILES([Makefile])
  1922. AC_OUTPUT
  1923. $ cat Makefile.in
  1924. prefix = @prefix@
  1925. datadir = @datadir@
  1926. $ autoconf
  1927. $ configure
  1928. configure: creating ./config.status
  1929. config.status: creating Makefile
  1930. config.status: WARNING:
  1931. Makefile.in seems to ignore the --datarootdir setting
  1932. $ cat Makefile
  1933. prefix = /usr/local
  1934. datadir = ${prefix}/share
  1935. Usually one can easily change the file to accommodate both older and
  1936. newer Autoconf releases:
  1937. $ cat Makefile.in
  1938. prefix = @prefix@
  1939. datarootdir = @datarootdir@
  1940. datadir = @datadir@
  1941. $ configure
  1942. configure: creating ./config.status
  1943. config.status: creating Makefile
  1944. $ cat Makefile
  1945. prefix = /usr/local
  1946. datarootdir = ${prefix}/share
  1947. datadir = ${datarootdir}
  1948. In some cases, however, the checks may not be able to detect that a
  1949. suitable initialization of `datarootdir' is in place, or they may fail
  1950. to detect that such an initialization is necessary in the output file.
  1951. If, after auditing your package, there are still spurious `configure'
  1952. warnings about `datarootdir', you may add the line
  1953. AC_DEFUN([AC_DATAROOTDIR_CHECKED])
  1954. to your `configure.ac' to disable the warnings. This is an exception
  1955. to the usual rule that you should not define a macro whose name begins
  1956. with `AC_' (*note Macro Names::).
  1957. 
  1958. File: autoconf.info, Node: Build Directories, Next: Automatic Remaking, Prev: Changed Directory Variables, Up: Makefile Substitutions
  1959. 4.8.4 Build Directories
  1960. -----------------------
  1961. You can support compiling a software package for several architectures
  1962. simultaneously from the same copy of the source code. The object files
  1963. for each architecture are kept in their own directory.
  1964. To support doing this, `make' uses the `VPATH' variable to find the
  1965. files that are in the source directory. GNU Make can do this. Most
  1966. other recent `make' programs can do this as well, though they may have
  1967. difficulties and it is often simpler to recommend GNU `make' (*note
  1968. VPATH and Make::). Older `make' programs do not support `VPATH'; when
  1969. using them, the source code must be in the same directory as the object
  1970. files.
  1971. If you are using GNU Automake, the remaining details in this section
  1972. are already covered for you, based on the contents of your
  1973. `Makefile.am'. But if you are using Autoconf in isolation, then
  1974. supporting `VPATH' requires the following in your `Makefile.in':
  1975. srcdir = @srcdir@
  1976. VPATH = @srcdir@
  1977. Do not set `VPATH' to the value of another variable (*note Variables
  1978. listed in VPATH::.
  1979. `configure' substitutes the correct value for `srcdir' when it
  1980. produces `Makefile'.
  1981. Do not use the `make' variable `$<', which expands to the file name
  1982. of the file in the source directory (found with `VPATH'), except in
  1983. implicit rules. (An implicit rule is one such as `.c.o', which tells
  1984. how to create a `.o' file from a `.c' file.) Some versions of `make'
  1985. do not set `$<' in explicit rules; they expand it to an empty value.
  1986. Instead, Make command lines should always refer to source files by
  1987. prefixing them with `$(srcdir)/'. For example:
  1988. time.info: time.texinfo
  1989. $(MAKEINFO) '$(srcdir)/time.texinfo'
  1990. 
  1991. File: autoconf.info, Node: Automatic Remaking, Prev: Build Directories, Up: Makefile Substitutions
  1992. 4.8.5 Automatic Remaking
  1993. ------------------------
  1994. You can put rules like the following in the top-level `Makefile.in' for
  1995. a package to automatically update the configuration information when
  1996. you change the configuration files. This example includes all of the
  1997. optional files, such as `aclocal.m4' and those related to configuration
  1998. header files. Omit from the `Makefile.in' rules for any of these files
  1999. that your package does not use.
  2000. The `$(srcdir)/' prefix is included because of limitations in the
  2001. `VPATH' mechanism.
  2002. The `stamp-' files are necessary because the timestamps of
  2003. `config.h.in' and `config.h' are not changed if remaking them does not
  2004. change their contents. This feature avoids unnecessary recompilation.
  2005. You should include the file `stamp-h.in' in your package's
  2006. distribution, so that `make' considers `config.h.in' up to date. Don't
  2007. use `touch' (*note Limitations of Usual Tools: touch.); instead, use
  2008. `echo' (using `date' would cause needless differences, hence CVS
  2009. conflicts, etc.).
  2010. $(srcdir)/configure: configure.ac aclocal.m4
  2011. cd '$(srcdir)' && autoconf
  2012. # autoheader might not change config.h.in, so touch a stamp file.
  2013. $(srcdir)/config.h.in: stamp-h.in
  2014. $(srcdir)/stamp-h.in: configure.ac aclocal.m4
  2015. cd '$(srcdir)' && autoheader
  2016. echo timestamp > '$(srcdir)/stamp-h.in'
  2017. config.h: stamp-h
  2018. stamp-h: config.h.in config.status
  2019. ./config.status
  2020. Makefile: Makefile.in config.status
  2021. ./config.status
  2022. config.status: configure
  2023. ./config.status --recheck
  2024. (Be careful if you copy these lines directly into your makefile, as you
  2025. need to convert the indented lines to start with the tab character.)
  2026. In addition, you should use
  2027. AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
  2028. so `config.status' ensures that `config.h' is considered up to date.
  2029. *Note Output::, for more information about `AC_OUTPUT'.
  2030. *Note config.status Invocation::, for more examples of handling
  2031. configuration-related dependencies.
  2032. 
  2033. File: autoconf.info, Node: Configuration Headers, Next: Configuration Commands, Prev: Makefile Substitutions, Up: Setup
  2034. 4.9 Configuration Header Files
  2035. ==============================
  2036. When a package contains more than a few tests that define C preprocessor
  2037. symbols, the command lines to pass `-D' options to the compiler can get
  2038. quite long. This causes two problems. One is that the `make' output
  2039. is hard to visually scan for errors. More seriously, the command lines
  2040. can exceed the length limits of some operating systems. As an
  2041. alternative to passing `-D' options to the compiler, `configure'
  2042. scripts can create a C header file containing `#define' directives.
  2043. The `AC_CONFIG_HEADERS' macro selects this kind of output. Though it
  2044. can be called anywhere between `AC_INIT' and `AC_OUTPUT', it is
  2045. customary to call it right after `AC_INIT'.
  2046. The package should `#include' the configuration header file before
  2047. any other header files, to prevent inconsistencies in declarations (for
  2048. example, if it redefines `const').
  2049. To provide for VPATH builds, remember to pass the C compiler a `-I.'
  2050. option (or `-I..'; whichever directory contains `config.h'). Even if
  2051. you use `#include "config.h"', the preprocessor searches only the
  2052. directory of the currently read file, i.e., the source directory, not
  2053. the build directory.
  2054. With the appropriate `-I' option, you can use `#include <config.h>'.
  2055. Actually, it's a good habit to use it, because in the rare case when
  2056. the source directory contains another `config.h', the build directory
  2057. should be searched first.
  2058. -- Macro: AC_CONFIG_HEADERS (HEADER ..., [CMDS], [INIT-CMDS])
  2059. This macro is one of the instantiating macros; see *note
  2060. Configuration Actions::. Make `AC_OUTPUT' create the file(s) in
  2061. the blank-or-newline-separated list HEADER containing C
  2062. preprocessor `#define' statements, and replace `@DEFS@' in
  2063. generated files with `-DHAVE_CONFIG_H' instead of the value of
  2064. `DEFS'. The usual name for HEADER is `config.h'.
  2065. If HEADER already exists and its contents are identical to what
  2066. `AC_OUTPUT' would put in it, it is left alone. Doing this allows
  2067. making some changes in the configuration without needlessly causing
  2068. object files that depend on the header file to be recompiled.
  2069. Usually the input file is named `HEADER.in'; however, you can
  2070. override the input file name by appending to HEADER a
  2071. colon-separated list of input files. For example, you might need
  2072. to make the input file name acceptable to DOS variants:
  2073. AC_CONFIG_HEADERS([config.h:config.hin])
  2074. -- Macro: AH_HEADER
  2075. This macro is defined as the name of the first declared config
  2076. header and undefined if no config headers have been declared up to
  2077. this point. A third-party macro may, for example, require use of
  2078. a config header without invoking AC_CONFIG_HEADERS twice, like
  2079. this:
  2080. AC_CONFIG_COMMANDS_PRE(
  2081. [m4_ifndef([AH_HEADER], [AC_CONFIG_HEADERS([config.h])])])
  2082. *Note Configuration Actions::, for more details on HEADER.
  2083. * Menu:
  2084. * Header Templates:: Input for the configuration headers
  2085. * autoheader Invocation:: How to create configuration templates
  2086. * Autoheader Macros:: How to specify CPP templates
  2087. 
  2088. File: autoconf.info, Node: Header Templates, Next: autoheader Invocation, Up: Configuration Headers
  2089. 4.9.1 Configuration Header Templates
  2090. ------------------------------------
  2091. Your distribution should contain a template file that looks as you want
  2092. the final header file to look, including comments, with `#undef'
  2093. statements which are used as hooks. For example, suppose your
  2094. `configure.ac' makes these calls:
  2095. AC_CONFIG_HEADERS([conf.h])
  2096. AC_CHECK_HEADERS([unistd.h])
  2097. Then you could have code like the following in `conf.h.in'. The
  2098. `conf.h' created by `configure' defines `HAVE_UNISTD_H' to 1, if and
  2099. only if the system has `unistd.h'.
  2100. /* Define as 1 if you have unistd.h. */
  2101. #undef HAVE_UNISTD_H
  2102. The format of the template file is stricter than what the C
  2103. preprocessor is required to accept. A directive line should contain
  2104. only whitespace, `#undef', and `HAVE_UNISTD_H'. The use of `#define'
  2105. instead of `#undef', or of comments on the same line as `#undef', is
  2106. strongly discouraged. Each hook should only be listed once. Other
  2107. preprocessor lines, such as `#ifdef' or `#include', are copied verbatim
  2108. from the template into the generated header.
  2109. Since it is a tedious task to keep a template header up to date, you
  2110. may use `autoheader' to generate it, see *note autoheader Invocation::.
  2111. During the instantiation of the header, each `#undef' line in the
  2112. template file for each symbol defined by `AC_DEFINE' is changed to an
  2113. appropriate `#define'. If the corresponding `AC_DEFINE' has not been
  2114. executed during the `configure' run, the `#undef' line is commented
  2115. out. (This is important, e.g., for `_POSIX_SOURCE': on many systems,
  2116. it can be implicitly defined by the compiler, and undefining it in the
  2117. header would then break compilation of subsequent headers.)
  2118. Currently, _all_ remaining `#undef' lines in the header template are
  2119. commented out, whether or not there was a corresponding `AC_DEFINE' for
  2120. the macro name; but this behavior is not guaranteed for future releases
  2121. of Autoconf.
  2122. Generally speaking, since you should not use `#define', and you
  2123. cannot guarantee whether a `#undef' directive in the header template
  2124. will be converted to a `#define' or commented out in the generated
  2125. header file, the template file cannot be used for conditional
  2126. definition effects. Consequently, if you need to use the construct
  2127. #ifdef THIS
  2128. # define THAT
  2129. #endif
  2130. you must place it outside of the template. If you absolutely need to
  2131. hook it to the config header itself, please put the directives to a
  2132. separate file, and `#include' that file from the config header
  2133. template. If you are using `autoheader', you would probably use
  2134. `AH_BOTTOM' to append the `#include' directive.
  2135. 
  2136. File: autoconf.info, Node: autoheader Invocation, Next: Autoheader Macros, Prev: Header Templates, Up: Configuration Headers
  2137. 4.9.2 Using `autoheader' to Create `config.h.in'
  2138. ------------------------------------------------
  2139. The `autoheader' program can create a template file of C `#define'
  2140. statements for `configure' to use. It searches for the first
  2141. invocation of `AC_CONFIG_HEADERS' in `configure' sources to determine
  2142. the name of the template. (If the first call of `AC_CONFIG_HEADERS'
  2143. specifies more than one input file name, `autoheader' uses the first
  2144. one.)
  2145. It is recommended that only one input file is used. If you want to
  2146. append a boilerplate code, it is preferable to use `AH_BOTTOM([#include
  2147. <conf_post.h>])'. File `conf_post.h' is not processed during the
  2148. configuration then, which make things clearer. Analogically, `AH_TOP'
  2149. can be used to prepend a boilerplate code.
  2150. In order to do its job, `autoheader' needs you to document all of
  2151. the symbols that you might use. Typically this is done via an
  2152. `AC_DEFINE' or `AC_DEFINE_UNQUOTED' call whose first argument is a
  2153. literal symbol and whose third argument describes the symbol (*note
  2154. Defining Symbols::). Alternatively, you can use `AH_TEMPLATE' (*note
  2155. Autoheader Macros::), or you can supply a suitable input file for a
  2156. subsequent configuration header file. Symbols defined by Autoconf's
  2157. builtin tests are already documented properly; you need to document
  2158. only those that you define yourself.
  2159. You might wonder why `autoheader' is needed: after all, why would
  2160. `configure' need to "patch" a `config.h.in' to produce a `config.h'
  2161. instead of just creating `config.h' from scratch? Well, when
  2162. everything rocks, the answer is just that we are wasting our time
  2163. maintaining `autoheader': generating `config.h' directly is all that is
  2164. needed. When things go wrong, however, you'll be thankful for the
  2165. existence of `autoheader'.
  2166. The fact that the symbols are documented is important in order to
  2167. _check_ that `config.h' makes sense. The fact that there is a
  2168. well-defined list of symbols that should be defined (or not) is also
  2169. important for people who are porting packages to environments where
  2170. `configure' cannot be run: they just have to _fill in the blanks_.
  2171. But let's come back to the point: the invocation of `autoheader'...
  2172. If you give `autoheader' an argument, it uses that file instead of
  2173. `configure.ac' and writes the header file to the standard output
  2174. instead of to `config.h.in'. If you give `autoheader' an argument of
  2175. `-', it reads the standard input instead of `configure.ac' and writes
  2176. the header file to the standard output.
  2177. `autoheader' accepts the following options:
  2178. `--help'
  2179. `-h'
  2180. Print a summary of the command line options and exit.
  2181. `--version'
  2182. `-V'
  2183. Print the version number of Autoconf and exit.
  2184. `--verbose'
  2185. `-v'
  2186. Report processing steps.
  2187. `--debug'
  2188. `-d'
  2189. Don't remove the temporary files.
  2190. `--force'
  2191. `-f'
  2192. Remake the template file even if newer than its input files.
  2193. `--include=DIR'
  2194. `-I DIR'
  2195. Append DIR to the include path. Multiple invocations accumulate.
  2196. `--prepend-include=DIR'
  2197. `-B DIR'
  2198. Prepend DIR to the include path. Multiple invocations accumulate.
  2199. `--warnings=CATEGORY'
  2200. `-W CATEGORY'
  2201. Report the warnings related to CATEGORY (which can actually be a
  2202. comma separated list). Current categories include:
  2203. `obsolete'
  2204. report the uses of obsolete constructs
  2205. `all'
  2206. report all the warnings
  2207. `none'
  2208. report none
  2209. `error'
  2210. treats warnings as errors
  2211. `no-CATEGORY'
  2212. disable warnings falling into CATEGORY
  2213. 
  2214. File: autoconf.info, Node: Autoheader Macros, Prev: autoheader Invocation, Up: Configuration Headers
  2215. 4.9.3 Autoheader Macros
  2216. -----------------------
  2217. `autoheader' scans `configure.ac' and figures out which C preprocessor
  2218. symbols it might define. It knows how to generate templates for
  2219. symbols defined by `AC_CHECK_HEADERS', `AC_CHECK_FUNCS' etc., but if
  2220. you `AC_DEFINE' any additional symbol, you must define a template for
  2221. it. If there are missing templates, `autoheader' fails with an error
  2222. message.
  2223. The template for a SYMBOL is created by `autoheader' from the
  2224. DESCRIPTION argument to an `AC_DEFINE'; see *note Defining Symbols::.
  2225. For special needs, you can use the following macros.
  2226. -- Macro: AH_TEMPLATE (KEY, DESCRIPTION)
  2227. Tell `autoheader' to generate a template for KEY. This macro
  2228. generates standard templates just like `AC_DEFINE' when a
  2229. DESCRIPTION is given.
  2230. For example:
  2231. AH_TEMPLATE([CRAY_STACKSEG_END],
  2232. [Define to one of _getb67, GETB67, getb67
  2233. for Cray-2 and Cray-YMP systems. This
  2234. function is required for alloca.c support
  2235. on those systems.])
  2236. generates the following template, with the description properly
  2237. justified.
  2238. /* Define to one of _getb67, GETB67, getb67 for Cray-2 and
  2239. Cray-YMP systems. This function is required for alloca.c
  2240. support on those systems. */
  2241. #undef CRAY_STACKSEG_END
  2242. -- Macro: AH_VERBATIM (KEY, TEMPLATE)
  2243. Tell `autoheader' to include the TEMPLATE as-is in the header
  2244. template file. This TEMPLATE is associated with the KEY, which is
  2245. used to sort all the different templates and guarantee their
  2246. uniqueness. It should be a symbol that can be defined via
  2247. `AC_DEFINE'.
  2248. -- Macro: AH_TOP (TEXT)
  2249. Include TEXT at the top of the header template file.
  2250. -- Macro: AH_BOTTOM (TEXT)
  2251. Include TEXT at the bottom of the header template file.
  2252. Please note that TEXT gets included "verbatim" to the template file,
  2253. not to the resulting config header, so it can easily get mangled when
  2254. the template is processed. There is rarely a need for something other
  2255. than
  2256. AH_BOTTOM([#include <custom.h>])
  2257. 
  2258. File: autoconf.info, Node: Configuration Commands, Next: Configuration Links, Prev: Configuration Headers, Up: Setup
  2259. 4.10 Running Arbitrary Configuration Commands
  2260. =============================================
  2261. You can execute arbitrary commands before, during, and after
  2262. `config.status' is run. The three following macros accumulate the
  2263. commands to run when they are called multiple times.
  2264. `AC_CONFIG_COMMANDS' replaces the obsolete macro `AC_OUTPUT_COMMANDS';
  2265. see *note Obsolete Macros::, for details.
  2266. -- Macro: AC_CONFIG_COMMANDS (TAG..., [CMDS], [INIT-CMDS])
  2267. Specify additional shell commands to run at the end of
  2268. `config.status', and shell commands to initialize any variables
  2269. from `configure'. Associate the commands with TAG. Since
  2270. typically the CMDS create a file, TAG should naturally be the name
  2271. of that file. If needed, the directory hosting TAG is created.
  2272. This macro is one of the instantiating macros; see *note
  2273. Configuration Actions::.
  2274. Here is an unrealistic example:
  2275. fubar=42
  2276. AC_CONFIG_COMMANDS([fubar],
  2277. [echo this is extra $fubar, and so on.],
  2278. [fubar=$fubar])
  2279. Here is a better one:
  2280. AC_CONFIG_COMMANDS([timestamp], [date >timestamp])
  2281. The following two macros look similar, but in fact they are not of
  2282. the same breed: they are executed directly by `configure', so you
  2283. cannot use `config.status' to rerun them.
  2284. -- Macro: AC_CONFIG_COMMANDS_PRE (CMDS)
  2285. Execute the CMDS right before creating `config.status'.
  2286. This macro presents the last opportunity to call `AC_SUBST',
  2287. `AC_DEFINE', or `AC_CONFIG_ITEMS' macros.
  2288. -- Macro: AC_CONFIG_COMMANDS_POST (CMDS)
  2289. Execute the CMDS right after creating `config.status'.
  2290. 
  2291. File: autoconf.info, Node: Configuration Links, Next: Subdirectories, Prev: Configuration Commands, Up: Setup
  2292. 4.11 Creating Configuration Links
  2293. =================================
  2294. You may find it convenient to create links whose destinations depend
  2295. upon results of tests. One can use `AC_CONFIG_COMMANDS' but the
  2296. creation of relative symbolic links can be delicate when the package is
  2297. built in a directory different from the source directory.
  2298. -- Macro: AC_CONFIG_LINKS (DEST:SOURCE..., [CMDS], [INIT-CMDS])
  2299. Make `AC_OUTPUT' link each of the existing files SOURCE to the
  2300. corresponding link name DEST. Makes a symbolic link if possible,
  2301. otherwise a hard link if possible, otherwise a copy. The DEST and
  2302. SOURCE names should be relative to the top level source or build
  2303. directory. This macro is one of the instantiating macros; see
  2304. *note Configuration Actions::.
  2305. For example, this call:
  2306. AC_CONFIG_LINKS([host.h:config/$machine.h
  2307. object.h:config/$obj_format.h])
  2308. creates in the current directory `host.h' as a link to
  2309. `SRCDIR/config/$machine.h', and `object.h' as a link to
  2310. `SRCDIR/config/$obj_format.h'.
  2311. The tempting value `.' for DEST is invalid: it makes it impossible
  2312. for `config.status' to guess the links to establish.
  2313. One can then run:
  2314. ./config.status host.h object.h
  2315. to create the links.
  2316. 
  2317. File: autoconf.info, Node: Subdirectories, Next: Default Prefix, Prev: Configuration Links, Up: Setup
  2318. 4.12 Configuring Other Packages in Subdirectories
  2319. =================================================
  2320. In most situations, calling `AC_OUTPUT' is sufficient to produce
  2321. makefiles in subdirectories. However, `configure' scripts that control
  2322. more than one independent package can use `AC_CONFIG_SUBDIRS' to run
  2323. `configure' scripts for other packages in subdirectories.
  2324. -- Macro: AC_CONFIG_SUBDIRS (DIR ...)
  2325. Make `AC_OUTPUT' run `configure' in each subdirectory DIR in the
  2326. given blank-or-newline-separated list. Each DIR should be a
  2327. literal, i.e., please do not use:
  2328. if test "x$package_foo_enabled" = xyes; then
  2329. my_subdirs="$my_subdirs foo"
  2330. fi
  2331. AC_CONFIG_SUBDIRS([$my_subdirs])
  2332. because this prevents `./configure --help=recursive' from
  2333. displaying the options of the package `foo'. Instead, you should
  2334. write:
  2335. if test "x$package_foo_enabled" = xyes; then
  2336. AC_CONFIG_SUBDIRS([foo])
  2337. fi
  2338. If a given DIR is not found at `configure' run time, a warning is
  2339. reported; if the subdirectory is optional, write:
  2340. if test -d "$srcdir/foo"; then
  2341. AC_CONFIG_SUBDIRS([foo])
  2342. fi
  2343. If a given DIR contains `configure.gnu', it is run instead of
  2344. `configure'. This is for packages that might use a non-Autoconf
  2345. script `Configure', which can't be called through a wrapper
  2346. `configure' since it would be the same file on case-insensitive
  2347. file systems. Likewise, if a DIR contains `configure.in' but no
  2348. `configure', the Cygnus `configure' script found by
  2349. `AC_CONFIG_AUX_DIR' is used.
  2350. The subdirectory `configure' scripts are given the same command
  2351. line options that were given to this `configure' script, with minor
  2352. changes if needed, which include:
  2353. - adjusting a relative name for the cache file;
  2354. - adjusting a relative name for the source directory;
  2355. - propagating the current value of `$prefix', including if it
  2356. was defaulted, and if the default values of the top level and
  2357. of the subdirectory `configure' differ.
  2358. This macro also sets the output variable `subdirs' to the list of
  2359. directories `DIR ...'. Make rules can use this variable to
  2360. determine which subdirectories to recurse into.
  2361. This macro may be called multiple times.
  2362. 
  2363. File: autoconf.info, Node: Default Prefix, Prev: Subdirectories, Up: Setup
  2364. 4.13 Default Prefix
  2365. ===================
  2366. By default, `configure' sets the prefix for files it installs to
  2367. `/usr/local'. The user of `configure' can select a different prefix
  2368. using the `--prefix' and `--exec-prefix' options. There are two ways
  2369. to change the default: when creating `configure', and when running it.
  2370. Some software packages might want to install in a directory other
  2371. than `/usr/local' by default. To accomplish that, use the
  2372. `AC_PREFIX_DEFAULT' macro.
  2373. -- Macro: AC_PREFIX_DEFAULT (PREFIX)
  2374. Set the default installation prefix to PREFIX instead of
  2375. `/usr/local'.
  2376. It may be convenient for users to have `configure' guess the
  2377. installation prefix from the location of a related program that they
  2378. have already installed. If you wish to do that, you can call
  2379. `AC_PREFIX_PROGRAM'.
  2380. -- Macro: AC_PREFIX_PROGRAM (PROGRAM)
  2381. If the user did not specify an installation prefix (using the
  2382. `--prefix' option), guess a value for it by looking for PROGRAM in
  2383. `PATH', the way the shell does. If PROGRAM is found, set the
  2384. prefix to the parent of the directory containing PROGRAM, else
  2385. default the prefix as described above (`/usr/local' or
  2386. `AC_PREFIX_DEFAULT'). For example, if PROGRAM is `gcc' and the
  2387. `PATH' contains `/usr/local/gnu/bin/gcc', set the prefix to
  2388. `/usr/local/gnu'.
  2389. 
  2390. File: autoconf.info, Node: Existing Tests, Next: Writing Tests, Prev: Setup, Up: Top
  2391. 5 Existing Tests
  2392. ****************
  2393. These macros test for particular system features that packages might
  2394. need or want to use. If you need to test for a kind of feature that
  2395. none of these macros check for, you can probably do it by calling
  2396. primitive test macros with appropriate arguments (*note Writing
  2397. Tests::).
  2398. These tests print messages telling the user which feature they're
  2399. checking for, and what they find. They cache their results for future
  2400. `configure' runs (*note Caching Results::).
  2401. Some of these macros set output variables. *Note Makefile
  2402. Substitutions::, for how to get their values. The phrase "define NAME"
  2403. is used below as a shorthand to mean "define the C preprocessor symbol
  2404. NAME to the value 1". *Note Defining Symbols::, for how to get those
  2405. symbol definitions into your program.
  2406. * Menu:
  2407. * Common Behavior:: Macros' standard schemes
  2408. * Alternative Programs:: Selecting between alternative programs
  2409. * Files:: Checking for the existence of files
  2410. * Libraries:: Library archives that might be missing
  2411. * Library Functions:: C library functions that might be missing
  2412. * Header Files:: Header files that might be missing
  2413. * Declarations:: Declarations that may be missing
  2414. * Structures:: Structures or members that might be missing
  2415. * Types:: Types that might be missing
  2416. * Compilers and Preprocessors:: Checking for compiling programs
  2417. * System Services:: Operating system services
  2418. * Posix Variants:: Special kludges for specific Posix variants
  2419. * Erlang Libraries:: Checking for the existence of Erlang libraries
  2420. 
  2421. File: autoconf.info, Node: Common Behavior, Next: Alternative Programs, Up: Existing Tests
  2422. 5.1 Common Behavior
  2423. ===================
  2424. Much effort has been expended to make Autoconf easy to learn. The most
  2425. obvious way to reach this goal is simply to enforce standard interfaces
  2426. and behaviors, avoiding exceptions as much as possible. Because of
  2427. history and inertia, unfortunately, there are still too many exceptions
  2428. in Autoconf; nevertheless, this section describes some of the common
  2429. rules.
  2430. * Menu:
  2431. * Standard Symbols:: Symbols defined by the macros
  2432. * Default Includes:: Includes used by the generic macros
  2433. 
  2434. File: autoconf.info, Node: Standard Symbols, Next: Default Includes, Up: Common Behavior
  2435. 5.1.1 Standard Symbols
  2436. ----------------------
  2437. All the generic macros that `AC_DEFINE' a symbol as a result of their
  2438. test transform their ARGUMENT values to a standard alphabet. First,
  2439. ARGUMENT is converted to upper case and any asterisks (`*') are each
  2440. converted to `P'. Any remaining characters that are not alphanumeric
  2441. are converted to underscores.
  2442. For instance,
  2443. AC_CHECK_TYPES([struct $Expensive*])
  2444. defines the symbol `HAVE_STRUCT__EXPENSIVEP' if the check succeeds.
  2445. 
  2446. File: autoconf.info, Node: Default Includes, Prev: Standard Symbols, Up: Common Behavior
  2447. 5.1.2 Default Includes
  2448. ----------------------
  2449. Several tests depend upon a set of header files. Since these headers
  2450. are not universally available, tests actually have to provide a set of
  2451. protected includes, such as:
  2452. #ifdef TIME_WITH_SYS_TIME
  2453. # include <sys/time.h>
  2454. # include <time.h>
  2455. #else
  2456. # ifdef HAVE_SYS_TIME_H
  2457. # include <sys/time.h>
  2458. # else
  2459. # include <time.h>
  2460. # endif
  2461. #endif
  2462. Unless you know exactly what you are doing, you should avoid using
  2463. unconditional includes, and check the existence of the headers you
  2464. include beforehand (*note Header Files::).
  2465. Most generic macros use the following macro to provide the default
  2466. set of includes:
  2467. -- Macro: AC_INCLUDES_DEFAULT ([INCLUDE-DIRECTIVES])
  2468. Expand to INCLUDE-DIRECTIVES if defined, otherwise to:
  2469. #include <stdio.h>
  2470. #ifdef HAVE_SYS_TYPES_H
  2471. # include <sys/types.h>
  2472. #endif
  2473. #ifdef HAVE_SYS_STAT_H
  2474. # include <sys/stat.h>
  2475. #endif
  2476. #ifdef STDC_HEADERS
  2477. # include <stdlib.h>
  2478. # include <stddef.h>
  2479. #else
  2480. # ifdef HAVE_STDLIB_H
  2481. # include <stdlib.h>
  2482. # endif
  2483. #endif
  2484. #ifdef HAVE_STRING_H
  2485. # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
  2486. # include <memory.h>
  2487. # endif
  2488. # include <string.h>
  2489. #endif
  2490. #ifdef HAVE_STRINGS_H
  2491. # include <strings.h>
  2492. #endif
  2493. #ifdef HAVE_INTTYPES_H
  2494. # include <inttypes.h>
  2495. #endif
  2496. #ifdef HAVE_STDINT_H
  2497. # include <stdint.h>
  2498. #endif
  2499. #ifdef HAVE_UNISTD_H
  2500. # include <unistd.h>
  2501. #endif
  2502. If the default includes are used, then check for the presence of
  2503. these headers and their compatibility, i.e., you don't need to run
  2504. `AC_HEADER_STDC', nor check for `stdlib.h' etc.
  2505. These headers are checked for in the same order as they are
  2506. included. For instance, on some systems `string.h' and
  2507. `strings.h' both exist, but conflict. Then `HAVE_STRING_H' is
  2508. defined, not `HAVE_STRINGS_H'.
  2509. 
  2510. File: autoconf.info, Node: Alternative Programs, Next: Files, Prev: Common Behavior, Up: Existing Tests
  2511. 5.2 Alternative Programs
  2512. ========================
  2513. These macros check for the presence or behavior of particular programs.
  2514. They are used to choose between several alternative programs and to
  2515. decide what to do once one has been chosen. If there is no macro
  2516. specifically defined to check for a program you need, and you don't need
  2517. to check for any special properties of it, then you can use one of the
  2518. general program-check macros.
  2519. * Menu:
  2520. * Particular Programs:: Special handling to find certain programs
  2521. * Generic Programs:: How to find other programs
  2522. 
  2523. File: autoconf.info, Node: Particular Programs, Next: Generic Programs, Up: Alternative Programs
  2524. 5.2.1 Particular Program Checks
  2525. -------------------------------
  2526. These macros check for particular programs--whether they exist, and in
  2527. some cases whether they support certain features.
  2528. -- Macro: AC_PROG_AWK
  2529. Check for `gawk', `mawk', `nawk', and `awk', in that order, and
  2530. set output variable `AWK' to the first one that is found. It
  2531. tries `gawk' first because that is reported to be the best
  2532. implementation. The result can be overridden by setting the
  2533. variable `AWK' or the cache variable `ac_cv_prog_AWK'.
  2534. Using this macro is sufficient to avoid the pitfalls of traditional
  2535. `awk' (*note Limitations of Usual Tools: awk.).
  2536. -- Macro: AC_PROG_GREP
  2537. Look for the best available `grep' or `ggrep' that accepts the
  2538. longest input lines possible, and that supports multiple `-e'
  2539. options. Set the output variable `GREP' to whatever is chosen.
  2540. *Note Limitations of Usual Tools: grep, for more information about
  2541. portability problems with the `grep' command family. The result
  2542. can be overridden by setting the `GREP' variable and is cached in
  2543. the `ac_cv_path_GREP' variable.
  2544. -- Macro: AC_PROG_EGREP
  2545. Check whether `$GREP -E' works, or else look for the best available
  2546. `egrep' or `gegrep' that accepts the longest input lines possible.
  2547. Set the output variable `EGREP' to whatever is chosen. The result
  2548. can be overridden by setting the `EGREP' variable and is cached in
  2549. the `ac_cv_path_EGREP' variable.
  2550. -- Macro: AC_PROG_FGREP
  2551. Check whether `$GREP -F' works, or else look for the best available
  2552. `fgrep' or `gfgrep' that accepts the longest input lines possible.
  2553. Set the output variable `FGREP' to whatever is chosen. The result
  2554. can be overridden by setting the `FGREP' variable and is cached in
  2555. the `ac_cv_path_FGREP' variable.
  2556. -- Macro: AC_PROG_INSTALL
  2557. Set output variable `INSTALL' to the name of a BSD-compatible
  2558. `install' program, if one is found in the current `PATH'.
  2559. Otherwise, set `INSTALL' to `DIR/install-sh -c', checking the
  2560. directories specified to `AC_CONFIG_AUX_DIR' (or its default
  2561. directories) to determine DIR (*note Output::). Also set the
  2562. variables `INSTALL_PROGRAM' and `INSTALL_SCRIPT' to `${INSTALL}'
  2563. and `INSTALL_DATA' to `${INSTALL} -m 644'.
  2564. `@INSTALL@' is special, as its value may vary for different
  2565. configuration files.
  2566. This macro screens out various instances of `install' known not to
  2567. work. It prefers to find a C program rather than a shell script,
  2568. for speed. Instead of `install-sh', it can also use `install.sh',
  2569. but that name is obsolete because some `make' programs have a rule
  2570. that creates `install' from it if there is no makefile. Further,
  2571. this macro requires `install' to be able to install multiple files
  2572. into a target directory in a single invocation.
  2573. Autoconf comes with a copy of `install-sh' that you can use. If
  2574. you use `AC_PROG_INSTALL', you must include either `install-sh' or
  2575. `install.sh' in your distribution; otherwise `configure' produces
  2576. an error message saying it can't find them--even if the system
  2577. you're on has a good `install' program. This check is a safety
  2578. measure to prevent you from accidentally leaving that file out,
  2579. which would prevent your package from installing on systems that
  2580. don't have a BSD-compatible `install' program.
  2581. If you need to use your own installation program because it has
  2582. features not found in standard `install' programs, there is no
  2583. reason to use `AC_PROG_INSTALL'; just put the file name of your
  2584. program into your `Makefile.in' files.
  2585. The result of the test can be overridden by setting the variable
  2586. `INSTALL' or the cache variable `ac_cv_path_install'.
  2587. -- Macro: AC_PROG_MKDIR_P
  2588. Set output variable `MKDIR_P' to a program that ensures that for
  2589. each argument, a directory named by this argument exists, creating
  2590. it and its parent directories if needed, and without race
  2591. conditions when two instances of the program attempt to make the
  2592. same directory at nearly the same time.
  2593. This macro uses the `mkdir -p' command if possible. Otherwise, it
  2594. falls back on invoking `install-sh' with the `-d' option, so your
  2595. package should contain `install-sh' as described under
  2596. `AC_PROG_INSTALL'. An `install-sh' file that predates Autoconf
  2597. 2.60 or Automake 1.10 is vulnerable to race conditions, so if you
  2598. want to support parallel installs from different packages into the
  2599. same directory you need to make sure you have an up-to-date
  2600. `install-sh'. In particular, be careful about using `autoreconf
  2601. -if' if your Automake predates Automake 1.10.
  2602. This macro is related to the `AS_MKDIR_P' macro (*note Programming
  2603. in M4sh::), but it sets an output variable intended for use in
  2604. other files, whereas `AS_MKDIR_P' is intended for use in scripts
  2605. like `configure'. Also, `AS_MKDIR_P' does not accept options, but
  2606. `MKDIR_P' supports the `-m' option, e.g., a makefile might invoke
  2607. `$(MKDIR_P) -m 0 dir' to create an inaccessible directory, and
  2608. conversely a makefile should use `$(MKDIR_P) -- $(FOO)' if FOO
  2609. might yield a value that begins with `-'. Finally, `AS_MKDIR_P'
  2610. does not check for race condition vulnerability, whereas
  2611. `AC_PROG_MKDIR_P' does.
  2612. `@MKDIR_P@' is special, as its value may vary for different
  2613. configuration files.
  2614. The result of the test can be overridden by setting the variable
  2615. `MKDIR_P' or the cache variable `ac_cv_path_mkdir'.
  2616. -- Macro: AC_PROG_LEX
  2617. If `flex' is found, set output variable `LEX' to `flex' and
  2618. `LEXLIB' to `-lfl', if that library is in a standard place.
  2619. Otherwise set `LEX' to `lex' and `LEXLIB' to `-ll', if found. If
  2620. neither variant is available, set `LEX' to `:'; for packages that
  2621. ship the generated `file.yy.c' alongside the source `file.l', this
  2622. default allows users without a lexer generator to still build the
  2623. package even if the timestamp for `file.l' is inadvertently
  2624. changed.
  2625. Define `YYTEXT_POINTER' if `yytext' defaults to `char *' instead
  2626. of to `char []'. Also set output variable `LEX_OUTPUT_ROOT' to
  2627. the base of the file name that the lexer generates; usually
  2628. `lex.yy', but sometimes something else. These results vary
  2629. according to whether `lex' or `flex' is being used.
  2630. You are encouraged to use Flex in your sources, since it is both
  2631. more pleasant to use than plain Lex and the C source it produces
  2632. is portable. In order to ensure portability, however, you must
  2633. either provide a function `yywrap' or, if you don't use it (e.g.,
  2634. your scanner has no `#include'-like feature), simply include a
  2635. `%noyywrap' statement in the scanner's source. Once this done,
  2636. the scanner is portable (unless _you_ felt free to use nonportable
  2637. constructs) and does not depend on any library. In this case, and
  2638. in this case only, it is suggested that you use this Autoconf
  2639. snippet:
  2640. AC_PROG_LEX
  2641. if test "x$LEX" != xflex; then
  2642. LEX="$SHELL $missing_dir/missing flex"
  2643. AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
  2644. AC_SUBST([LEXLIB], [''])
  2645. fi
  2646. The shell script `missing' can be found in the Automake
  2647. distribution.
  2648. Remember that the user may have supplied an alternate location in
  2649. `LEX', so if Flex is required, it is better to check that the user
  2650. provided something sufficient by parsing the output of `$LEX
  2651. --version' than by simply relying on `test "x$LEX" = xflex'.
  2652. To ensure backward compatibility, Automake's `AM_PROG_LEX' invokes
  2653. (indirectly) this macro twice, which causes an annoying but benign
  2654. "`AC_PROG_LEX' invoked multiple times" warning. Future versions
  2655. of Automake will fix this issue; meanwhile, just ignore this
  2656. message.
  2657. As part of running the test, this macro may delete any file in the
  2658. configuration directory named `lex.yy.c' or `lexyy.c'.
  2659. The result of this test can be influenced by setting the variable
  2660. `LEX' or the cache variable `ac_cv_prog_LEX'.
  2661. -- Macro: AC_PROG_LN_S
  2662. If `ln -s' works on the current file system (the operating system
  2663. and file system support symbolic links), set the output variable
  2664. `LN_S' to `ln -s'; otherwise, if `ln' works, set `LN_S' to `ln',
  2665. and otherwise set it to `cp -pR'.
  2666. If you make a link in a directory other than the current
  2667. directory, its meaning depends on whether `ln' or `ln -s' is used.
  2668. To safely create links using `$(LN_S)', either find out which form
  2669. is used and adjust the arguments, or always invoke `ln' in the
  2670. directory where the link is to be created.
  2671. In other words, it does not work to do:
  2672. $(LN_S) foo /x/bar
  2673. Instead, do:
  2674. (cd /x && $(LN_S) foo bar)
  2675. -- Macro: AC_PROG_RANLIB
  2676. Set output variable `RANLIB' to `ranlib' if `ranlib' is found, and
  2677. otherwise to `:' (do nothing).
  2678. -- Macro: AC_PROG_SED
  2679. Set output variable `SED' to a Sed implementation that conforms to
  2680. Posix and does not have arbitrary length limits. Report an error
  2681. if no acceptable Sed is found. *Note Limitations of Usual Tools:
  2682. sed, for more information about portability problems with Sed.
  2683. The result of this test can be overridden by setting the `SED'
  2684. variable and is cached in the `ac_cv_path_SED' variable.
  2685. -- Macro: AC_PROG_YACC
  2686. If `bison' is found, set output variable `YACC' to `bison -y'.
  2687. Otherwise, if `byacc' is found, set `YACC' to `byacc'. Otherwise
  2688. set `YACC' to `yacc'. The result of this test can be influenced
  2689. by setting the variable `YACC' or the cache variable
  2690. `ac_cv_prog_YACC'.
  2691. 
  2692. File: autoconf.info, Node: Generic Programs, Prev: Particular Programs, Up: Alternative Programs
  2693. 5.2.2 Generic Program and File Checks
  2694. -------------------------------------
  2695. These macros are used to find programs not covered by the "particular"
  2696. test macros. If you need to check the behavior of a program as well as
  2697. find out whether it is present, you have to write your own test for it
  2698. (*note Writing Tests::). By default, these macros use the environment
  2699. variable `PATH'. If you need to check for a program that might not be
  2700. in the user's `PATH', you can pass a modified path to use instead, like
  2701. this:
  2702. AC_PATH_PROG([INETD], [inetd], [/usr/libexec/inetd],
  2703. [$PATH$PATH_SEPARATOR/usr/libexec$PATH_SEPARATOR]dnl
  2704. [/usr/sbin$PATH_SEPARATOR/usr/etc$PATH_SEPARATOR/etc])
  2705. You are strongly encouraged to declare the VARIABLE passed to
  2706. `AC_CHECK_PROG' etc. as precious. *Note Setting Output Variables::,
  2707. `AC_ARG_VAR', for more details.
  2708. -- Macro: AC_CHECK_PROG (VARIABLE, PROG-TO-CHECK-FOR, VALUE-IF-FOUND,
  2709. [VALUE-IF-NOT-FOUND], [PATH = `$PATH'], [REJECT])
  2710. Check whether program PROG-TO-CHECK-FOR exists in PATH. If it is
  2711. found, set VARIABLE to VALUE-IF-FOUND, otherwise to
  2712. VALUE-IF-NOT-FOUND, if given. Always pass over REJECT (an
  2713. absolute file name) even if it is the first found in the search
  2714. path; in that case, set VARIABLE using the absolute file name of
  2715. the PROG-TO-CHECK-FOR found that is not REJECT. If VARIABLE was
  2716. already set, do nothing. Calls `AC_SUBST' for VARIABLE. The
  2717. result of this test can be overridden by setting the VARIABLE
  2718. variable or the cache variable `ac_cv_prog_VARIABLE'.
  2719. -- Macro: AC_CHECK_PROGS (VARIABLE, PROGS-TO-CHECK-FOR,
  2720. [VALUE-IF-NOT-FOUND], [PATH = `$PATH'])
  2721. Check for each program in the blank-separated list
  2722. PROGS-TO-CHECK-FOR existing in the PATH. If one is found, set
  2723. VARIABLE to the name of that program. Otherwise, continue
  2724. checking the next program in the list. If none of the programs in
  2725. the list are found, set VARIABLE to VALUE-IF-NOT-FOUND; if
  2726. VALUE-IF-NOT-FOUND is not specified, the value of VARIABLE is not
  2727. changed. Calls `AC_SUBST' for VARIABLE. The result of this test
  2728. can be overridden by setting the VARIABLE variable or the cache
  2729. variable `ac_cv_prog_VARIABLE'.
  2730. -- Macro: AC_CHECK_TARGET_TOOL (VARIABLE, PROG-TO-CHECK-FOR,
  2731. [VALUE-IF-NOT-FOUND], [PATH = `$PATH'])
  2732. Like `AC_CHECK_PROG', but first looks for PROG-TO-CHECK-FOR with a
  2733. prefix of the target type as determined by `AC_CANONICAL_TARGET',
  2734. followed by a dash (*note Canonicalizing::). If the tool cannot
  2735. be found with a prefix, and if the build and target types are
  2736. equal, then it is also searched for without a prefix.
  2737. As noted in *note Specifying Target Triplets::, the target is
  2738. rarely specified, because most of the time it is the same as the
  2739. host: it is the type of system for which any compiler tool in the
  2740. package produces code. What this macro looks for is, for example,
  2741. _a tool (assembler, linker, etc.) that the compiler driver (`gcc'
  2742. for the GNU C Compiler) uses to produce objects, archives or
  2743. executables_.
  2744. -- Macro: AC_CHECK_TOOL (VARIABLE, PROG-TO-CHECK-FOR,
  2745. [VALUE-IF-NOT-FOUND], [PATH = `$PATH'])
  2746. Like `AC_CHECK_PROG', but first looks for PROG-TO-CHECK-FOR with a
  2747. prefix of the host type as specified by `--host', followed by a
  2748. dash. For example, if the user runs `configure --build=x86_64-gnu
  2749. --host=i386-gnu', then this call:
  2750. AC_CHECK_TOOL([RANLIB], [ranlib], [:])
  2751. sets `RANLIB' to `i386-gnu-ranlib' if that program exists in PATH,
  2752. or otherwise to `ranlib' if that program exists in PATH, or to `:'
  2753. if neither program exists.
  2754. When cross-compiling, this macro will issue a warning if no program
  2755. prefixed with the host type could be found. For more information,
  2756. see *note Specifying Target Triplets::.
  2757. -- Macro: AC_CHECK_TARGET_TOOLS (VARIABLE, PROGS-TO-CHECK-FOR,
  2758. [VALUE-IF-NOT-FOUND], [PATH = `$PATH'])
  2759. Like `AC_CHECK_TARGET_TOOL', each of the tools in the list
  2760. PROGS-TO-CHECK-FOR are checked with a prefix of the target type as
  2761. determined by `AC_CANONICAL_TARGET', followed by a dash (*note
  2762. Canonicalizing::). If none of the tools can be found with a
  2763. prefix, and if the build and target types are equal, then the
  2764. first one without a prefix is used. If a tool is found, set
  2765. VARIABLE to the name of that program. If none of the tools in the
  2766. list are found, set VARIABLE to VALUE-IF-NOT-FOUND; if
  2767. VALUE-IF-NOT-FOUND is not specified, the value of VARIABLE is not
  2768. changed. Calls `AC_SUBST' for VARIABLE.
  2769. -- Macro: AC_CHECK_TOOLS (VARIABLE, PROGS-TO-CHECK-FOR,
  2770. [VALUE-IF-NOT-FOUND], [PATH = `$PATH'])
  2771. Like `AC_CHECK_TOOL', each of the tools in the list
  2772. PROGS-TO-CHECK-FOR are checked with a prefix of the host type as
  2773. determined by `AC_CANONICAL_HOST', followed by a dash (*note
  2774. Canonicalizing::). If none of the tools can be found with a
  2775. prefix, then the first one without a prefix is used. If a tool is
  2776. found, set VARIABLE to the name of that program. If none of the
  2777. tools in the list are found, set VARIABLE to VALUE-IF-NOT-FOUND; if
  2778. VALUE-IF-NOT-FOUND is not specified, the value of VARIABLE is not
  2779. changed. Calls `AC_SUBST' for VARIABLE.
  2780. When cross-compiling, this macro will issue a warning if no program
  2781. prefixed with the host type could be found. For more information,
  2782. see *note Specifying Target Triplets::.
  2783. -- Macro: AC_PATH_PROG (VARIABLE, PROG-TO-CHECK-FOR,
  2784. [VALUE-IF-NOT-FOUND], [PATH = `$PATH'])
  2785. Like `AC_CHECK_PROG', but set VARIABLE to the absolute name of
  2786. PROG-TO-CHECK-FOR if found. The result of this test can be
  2787. overridden by setting the VARIABLE variable. A positive result of
  2788. this test is cached in the `ac_cv_path_VARIABLE' variable.
  2789. -- Macro: AC_PATH_PROGS (VARIABLE, PROGS-TO-CHECK-FOR,
  2790. [VALUE-IF-NOT-FOUND], [PATH = `$PATH'])
  2791. Like `AC_CHECK_PROGS', but if any of PROGS-TO-CHECK-FOR are found,
  2792. set VARIABLE to the absolute name of the program found. The
  2793. result of this test can be overridden by setting the VARIABLE
  2794. variable. A positive result of this test is cached in the
  2795. `ac_cv_path_VARIABLE' variable.
  2796. -- Macro: AC_PATH_PROGS_FEATURE_CHECK (VARIABLE, PROGS-TO-CHECK-FOR,
  2797. FEATURE-TEST, [ACTION-IF-NOT-FOUND], [PATH = `$PATH'])
  2798. This macro was introduced in Autoconf 2.62. If VARIABLE is not
  2799. empty, then set the cache variable `ac_cv_path_VARIABLE' to its
  2800. value. Otherwise, check for each program in the blank-separated
  2801. list PROGS-TO-CHECK-FOR existing in PATH. For each program found,
  2802. execute FEATURE-TEST with `ac_path_VARIABLE' set to the absolute
  2803. name of the candidate program. If no invocation of FEATURE-TEST
  2804. sets the shell variable `ac_cv_path_VARIABLE', then
  2805. ACTION-IF-NOT-FOUND is executed. FEATURE-TEST will be run even
  2806. when `ac_cv_path_VARIABLE' is set, to provide the ability to
  2807. choose a better candidate found later in PATH; to accept the
  2808. current setting and bypass all further checks, FEATURE-TEST can
  2809. execute `ac_path_VARIABLE_found=:'.
  2810. Note that this macro has some subtle differences from
  2811. `AC_CHECK_PROGS'. It is designed to be run inside `AC_CACHE_VAL',
  2812. therefore, it should have no side effects. In particular,
  2813. VARIABLE is not set to the final value of `ac_cv_path_VARIABLE',
  2814. nor is `AC_SUBST' automatically run. Also, on failure, any action
  2815. can be performed, whereas `AC_CHECK_PROGS' only performs
  2816. `VARIABLE=VALUE-IF-NOT-FOUND'.
  2817. Here is an example, similar to what Autoconf uses in its own
  2818. configure script. It will search for an implementation of `m4'
  2819. that supports the `indir' builtin, even if it goes by the name
  2820. `gm4' or is not the first implementation on `PATH'.
  2821. AC_CACHE_CHECK([for m4 that supports indir], [ac_cv_path_M4],
  2822. [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
  2823. [[m4out=`echo 'changequote([,])indir([divnum])' | $ac_path_M4`
  2824. test "x$m4out" = x0 \
  2825. && ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
  2826. [AC_MSG_ERROR([could not find m4 that supports indir])])])
  2827. AC_SUBST([M4], [$ac_cv_path_M4])
  2828. -- Macro: AC_PATH_TARGET_TOOL (VARIABLE, PROG-TO-CHECK-FOR,
  2829. [VALUE-IF-NOT-FOUND], [PATH = `$PATH'])
  2830. Like `AC_CHECK_TARGET_TOOL', but set VARIABLE to the absolute name
  2831. of the program if it is found.
  2832. -- Macro: AC_PATH_TOOL (VARIABLE, PROG-TO-CHECK-FOR,
  2833. [VALUE-IF-NOT-FOUND], [PATH = `$PATH'])
  2834. Like `AC_CHECK_TOOL', but set VARIABLE to the absolute name of the
  2835. program if it is found.
  2836. When cross-compiling, this macro will issue a warning if no program
  2837. prefixed with the host type could be found. For more information,
  2838. see *note Specifying Target Triplets::.
  2839. 
  2840. File: autoconf.info, Node: Files, Next: Libraries, Prev: Alternative Programs, Up: Existing Tests
  2841. 5.3 Files
  2842. =========
  2843. You might also need to check for the existence of files. Before using
  2844. these macros, ask yourself whether a runtime test might not be a better
  2845. solution. Be aware that, like most Autoconf macros, they test a feature
  2846. of the host machine, and therefore, they die when cross-compiling.
  2847. -- Macro: AC_CHECK_FILE (FILE, [ACTION-IF-FOUND],
  2848. [ACTION-IF-NOT-FOUND])
  2849. Check whether file FILE exists on the native system. If it is
  2850. found, execute ACTION-IF-FOUND, otherwise do ACTION-IF-NOT-FOUND,
  2851. if given. The result of this test is cached in the
  2852. `ac_cv_file_FILE' variable, with characters not suitable for a
  2853. variable name mapped to underscores.
  2854. -- Macro: AC_CHECK_FILES (FILES, [ACTION-IF-FOUND],
  2855. [ACTION-IF-NOT-FOUND])
  2856. Executes `AC_CHECK_FILE' once for each file listed in FILES.
  2857. Additionally, defines `HAVE_FILE' (*note Standard Symbols::) for
  2858. each file found. The results of each test are cached in the
  2859. `ac_cv_file_FILE' variable, with characters not suitable for a
  2860. variable name mapped to underscores.
  2861. 
  2862. File: autoconf.info, Node: Libraries, Next: Library Functions, Prev: Files, Up: Existing Tests
  2863. 5.4 Library Files
  2864. =================
  2865. The following macros check for the presence of certain C, C++, Fortran,
  2866. or Go library archive files.
  2867. -- Macro: AC_CHECK_LIB (LIBRARY, FUNCTION, [ACTION-IF-FOUND],
  2868. [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES])
  2869. Test whether the library LIBRARY is available by trying to link a
  2870. test program that calls function FUNCTION with the library.
  2871. FUNCTION should be a function provided by the library. Use the
  2872. base name of the library; e.g., to check for `-lmp', use `mp' as
  2873. the LIBRARY argument.
  2874. ACTION-IF-FOUND is a list of shell commands to run if the link
  2875. with the library succeeds; ACTION-IF-NOT-FOUND is a list of shell
  2876. commands to run if the link fails. If ACTION-IF-FOUND is not
  2877. specified, the default action prepends `-lLIBRARY' to `LIBS' and
  2878. defines `HAVE_LIBLIBRARY' (in all capitals). This macro is
  2879. intended to support building `LIBS' in a right-to-left
  2880. (least-dependent to most-dependent) fashion such that library
  2881. dependencies are satisfied as a natural side effect of consecutive
  2882. tests. Linkers are sensitive to library ordering so the order in
  2883. which `LIBS' is generated is important to reliable detection of
  2884. libraries.
  2885. If linking with LIBRARY results in unresolved symbols that would
  2886. be resolved by linking with additional libraries, give those
  2887. libraries as the OTHER-LIBRARIES argument, separated by spaces:
  2888. e.g., `-lXt -lX11'. Otherwise, this macro may fail to detect that
  2889. LIBRARY is present, because linking the test program can fail with
  2890. unresolved symbols. The OTHER-LIBRARIES argument should be
  2891. limited to cases where it is desirable to test for one library in
  2892. the presence of another that is not already in `LIBS'.
  2893. `AC_CHECK_LIB' requires some care in usage, and should be avoided
  2894. in some common cases. Many standard functions like `gethostbyname'
  2895. appear in the standard C library on some hosts, and in special
  2896. libraries like `nsl' on other hosts. On some hosts the special
  2897. libraries contain variant implementations that you may not want to
  2898. use. These days it is normally better to use
  2899. `AC_SEARCH_LIBS([gethostbyname], [nsl])' instead of
  2900. `AC_CHECK_LIB([nsl], [gethostbyname])'.
  2901. The result of this test is cached in the
  2902. `ac_cv_lib_LIBRARY_FUNCTION' variable.
  2903. -- Macro: AC_SEARCH_LIBS (FUNCTION, SEARCH-LIBS, [ACTION-IF-FOUND],
  2904. [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES])
  2905. Search for a library defining FUNCTION if it's not already
  2906. available. This equates to calling
  2907. `AC_LINK_IFELSE([AC_LANG_CALL([], [FUNCTION])])' first with no
  2908. libraries, then for each library listed in SEARCH-LIBS.
  2909. Prepend `-lLIBRARY' to `LIBS' for the first library found to
  2910. contain FUNCTION, and run ACTION-IF-FOUND. If the function is not
  2911. found, run ACTION-IF-NOT-FOUND.
  2912. If linking with LIBRARY results in unresolved symbols that would
  2913. be resolved by linking with additional libraries, give those
  2914. libraries as the OTHER-LIBRARIES argument, separated by spaces:
  2915. e.g., `-lXt -lX11'. Otherwise, this macro fails to detect that
  2916. FUNCTION is present, because linking the test program always fails
  2917. with unresolved symbols.
  2918. The result of this test is cached in the `ac_cv_search_FUNCTION'
  2919. variable as `none required' if FUNCTION is already available, as
  2920. `no' if no library containing FUNCTION was found, otherwise as the
  2921. `-lLIBRARY' option that needs to be prepended to `LIBS'.
  2922. 
  2923. File: autoconf.info, Node: Library Functions, Next: Header Files, Prev: Libraries, Up: Existing Tests
  2924. 5.5 Library Functions
  2925. =====================
  2926. The following macros check for particular C library functions. If
  2927. there is no macro specifically defined to check for a function you need,
  2928. and you don't need to check for any special properties of it, then you
  2929. can use one of the general function-check macros.
  2930. * Menu:
  2931. * Function Portability:: Pitfalls with usual functions
  2932. * Particular Functions:: Special handling to find certain functions
  2933. * Generic Functions:: How to find other functions
  2934. 
  2935. File: autoconf.info, Node: Function Portability, Next: Particular Functions, Up: Library Functions
  2936. 5.5.1 Portability of C Functions
  2937. --------------------------------
  2938. Most usual functions can either be missing, or be buggy, or be limited
  2939. on some architectures. This section tries to make an inventory of these
  2940. portability issues. By definition, this list always requires
  2941. additions. A much more complete list is maintained by the Gnulib
  2942. project (*note Gnulib::), covering *note Current Posix Functions:
  2943. (gnulib)Function Substitutes, *note Legacy Functions: (gnulib)Legacy
  2944. Function Substitutes, and *note Glibc Functions: (gnulib)Glibc Function
  2945. Substitutes. Please help us keep the gnulib list as complete as
  2946. possible.
  2947. `exit'
  2948. On ancient hosts, `exit' returned `int'. This is because `exit'
  2949. predates `void', and there was a long tradition of it returning
  2950. `int'.
  2951. On current hosts, the problem more likely is that `exit' is not
  2952. declared, due to C++ problems of some sort or another. For this
  2953. reason we suggest that test programs not invoke `exit', but return
  2954. from `main' instead.
  2955. `free'
  2956. The C standard says a call `free (NULL)' does nothing, but some
  2957. old systems don't support this (e.g., NextStep).
  2958. `isinf'
  2959. `isnan'
  2960. The C99 standard says that `isinf' and `isnan' are macros. On
  2961. some systems just macros are available (e.g., HP-UX and Solaris
  2962. 10), on some systems both macros and functions (e.g., glibc
  2963. 2.3.2), and on some systems only functions (e.g., IRIX 6 and
  2964. Solaris 9). In some cases these functions are declared in
  2965. nonstandard headers like `<sunmath.h>' and defined in non-default
  2966. libraries like `-lm' or `-lsunmath'.
  2967. The C99 `isinf' and `isnan' macros work correctly with `long
  2968. double' arguments, but pre-C99 systems that use functions
  2969. typically assume `double' arguments. On such a system, `isinf'
  2970. incorrectly returns true for a finite `long double' argument that
  2971. is outside the range of `double'.
  2972. The best workaround for these issues is to use gnulib modules
  2973. `isinf' and `isnan' (*note Gnulib::). But a lighter weight
  2974. solution involves code like the following.
  2975. #include <math.h>
  2976. #ifndef isnan
  2977. # define isnan(x) \
  2978. (sizeof (x) == sizeof (long double) ? isnan_ld (x) \
  2979. : sizeof (x) == sizeof (double) ? isnan_d (x) \
  2980. : isnan_f (x))
  2981. static inline int isnan_f (float x) { return x != x; }
  2982. static inline int isnan_d (double x) { return x != x; }
  2983. static inline int isnan_ld (long double x) { return x != x; }
  2984. #endif
  2985. #ifndef isinf
  2986. # define isinf(x) \
  2987. (sizeof (x) == sizeof (long double) ? isinf_ld (x) \
  2988. : sizeof (x) == sizeof (double) ? isinf_d (x) \
  2989. : isinf_f (x))
  2990. static inline int isinf_f (float x)
  2991. { return !isnan (x) && isnan (x - x); }
  2992. static inline int isinf_d (double x)
  2993. { return !isnan (x) && isnan (x - x); }
  2994. static inline int isinf_ld (long double x)
  2995. { return !isnan (x) && isnan (x - x); }
  2996. #endif
  2997. Use `AC_C_INLINE' (*note C Compiler::) so that this code works on
  2998. compilers that lack the `inline' keyword. Some optimizing
  2999. compilers mishandle these definitions, but systems with that bug
  3000. typically have many other floating point corner-case compliance
  3001. problems anyway, so it's probably not worth worrying about.
  3002. `malloc'
  3003. The C standard says a call `malloc (0)' is implementation
  3004. dependent. It can return either `NULL' or a new non-null pointer.
  3005. The latter is more common (e.g., the GNU C Library) but is by no
  3006. means universal. `AC_FUNC_MALLOC' can be used to insist on
  3007. non-`NULL' (*note Particular Functions::).
  3008. `putenv'
  3009. Posix prefers `setenv' to `putenv'; among other things, `putenv'
  3010. is not required of all Posix implementations, but `setenv' is.
  3011. Posix specifies that `putenv' puts the given string directly in
  3012. `environ', but some systems make a copy of it instead (e.g., glibc
  3013. 2.0, or BSD). And when a copy is made, `unsetenv' might not free
  3014. it, causing a memory leak (e.g., FreeBSD 4).
  3015. On some systems `putenv ("FOO")' removes `FOO' from the
  3016. environment, but this is not standard usage and it dumps core on
  3017. some systems (e.g., AIX).
  3018. On MinGW, a call `putenv ("FOO=")' removes `FOO' from the
  3019. environment, rather than inserting it with an empty value.
  3020. `realloc'
  3021. The C standard says a call `realloc (NULL, size)' is equivalent to
  3022. `malloc (size)', but some old systems don't support this (e.g.,
  3023. NextStep).
  3024. `signal' handler
  3025. Normally `signal' takes a handler function with a return type of
  3026. `void', but some old systems required `int' instead. Any actual
  3027. `int' value returned is not used; this is only a difference in the
  3028. function prototype demanded.
  3029. All systems we know of in current use return `void'. The `int'
  3030. was to support K&R C, where of course `void' is not available.
  3031. The obsolete macro `AC_TYPE_SIGNAL' (*note AC_TYPE_SIGNAL::) can
  3032. be used to establish the correct type in all cases.
  3033. In most cases, it is more robust to use `sigaction' when it is
  3034. available, rather than `signal'.
  3035. `snprintf'
  3036. The C99 standard says that if the output array isn't big enough
  3037. and if no other errors occur, `snprintf' and `vsnprintf' truncate
  3038. the output and return the number of bytes that ought to have been
  3039. produced. Some older systems return the truncated length (e.g.,
  3040. GNU C Library 2.0.x or IRIX 6.5), some a negative value (e.g.,
  3041. earlier GNU C Library versions), and some the buffer length
  3042. without truncation (e.g., 32-bit Solaris 7). Also, some buggy
  3043. older systems ignore the length and overrun the buffer (e.g.,
  3044. 64-bit Solaris 7).
  3045. `sprintf'
  3046. The C standard says `sprintf' and `vsprintf' return the number of
  3047. bytes written. On some ancient systems (SunOS 4 for instance)
  3048. they return the buffer pointer instead, but these no longer need
  3049. to be worried about.
  3050. `sscanf'
  3051. On various old systems, e.g., HP-UX 9, `sscanf' requires that its
  3052. input string be writable (though it doesn't actually change it).
  3053. This can be a problem when using `gcc' since it normally puts
  3054. constant strings in read-only memory (*note Incompatibilities of
  3055. GCC: (gcc)Incompatibilities.). Apparently in some cases even
  3056. having format strings read-only can be a problem.
  3057. `strerror_r'
  3058. Posix specifies that `strerror_r' returns an `int', but many
  3059. systems (e.g., GNU C Library version 2.2.4) provide a different
  3060. version returning a `char *'. `AC_FUNC_STRERROR_R' can detect
  3061. which is in use (*note Particular Functions::).
  3062. `strnlen'
  3063. AIX 4.3 provides a broken version which produces the following
  3064. results:
  3065. strnlen ("foobar", 0) = 0
  3066. strnlen ("foobar", 1) = 3
  3067. strnlen ("foobar", 2) = 2
  3068. strnlen ("foobar", 3) = 1
  3069. strnlen ("foobar", 4) = 0
  3070. strnlen ("foobar", 5) = 6
  3071. strnlen ("foobar", 6) = 6
  3072. strnlen ("foobar", 7) = 6
  3073. strnlen ("foobar", 8) = 6
  3074. strnlen ("foobar", 9) = 6
  3075. `sysconf'
  3076. `_SC_PAGESIZE' is standard, but some older systems (e.g., HP-UX 9)
  3077. have `_SC_PAGE_SIZE' instead. This can be tested with `#ifdef'.
  3078. `unlink'
  3079. The Posix spec says that `unlink' causes the given file to be
  3080. removed only after there are no more open file handles for it.
  3081. Some non-Posix hosts have trouble with this requirement, though,
  3082. and some DOS variants even corrupt the file system.
  3083. `unsetenv'
  3084. On MinGW, `unsetenv' is not available, but a variable `FOO' can be
  3085. removed with a call `putenv ("FOO=")', as described under `putenv'
  3086. above.
  3087. `va_copy'
  3088. The C99 standard provides `va_copy' for copying `va_list'
  3089. variables. It may be available in older environments too, though
  3090. possibly as `__va_copy' (e.g., `gcc' in strict pre-C99 mode).
  3091. These can be tested with `#ifdef'. A fallback to `memcpy (&dst,
  3092. &src, sizeof (va_list))' gives maximum portability.
  3093. `va_list'
  3094. `va_list' is not necessarily just a pointer. It can be a `struct'
  3095. (e.g., `gcc' on Alpha), which means `NULL' is not portable. Or it
  3096. can be an array (e.g., `gcc' in some PowerPC configurations),
  3097. which means as a function parameter it can be effectively
  3098. call-by-reference and library routines might modify the value back
  3099. in the caller (e.g., `vsnprintf' in the GNU C Library 2.1).
  3100. Signed `>>'
  3101. Normally the C `>>' right shift of a signed type replicates the
  3102. high bit, giving a so-called "arithmetic" shift. But care should
  3103. be taken since Standard C doesn't require that behavior. On those
  3104. few processors without a native arithmetic shift (for instance Cray
  3105. vector systems) zero bits may be shifted in, the same as a shift
  3106. of an unsigned type.
  3107. Integer `/'
  3108. C divides signed integers by truncating their quotient toward zero,
  3109. yielding the same result as Fortran. However, before C99 the
  3110. standard allowed C implementations to take the floor or ceiling of
  3111. the quotient in some cases. Hardly any implementations took
  3112. advantage of this freedom, though, and it's probably not worth
  3113. worrying about this issue nowadays.
  3114. 
  3115. File: autoconf.info, Node: Particular Functions, Next: Generic Functions, Prev: Function Portability, Up: Library Functions
  3116. 5.5.2 Particular Function Checks
  3117. --------------------------------
  3118. These macros check for particular C functions--whether they exist, and
  3119. in some cases how they respond when given certain arguments.
  3120. -- Macro: AC_FUNC_ALLOCA
  3121. Check how to get `alloca'. Tries to get a builtin version by
  3122. checking for `alloca.h' or the predefined C preprocessor macros
  3123. `__GNUC__' and `_AIX'. If this macro finds `alloca.h', it defines
  3124. `HAVE_ALLOCA_H'.
  3125. If those attempts fail, it looks for the function in the standard C
  3126. library. If any of those methods succeed, it defines
  3127. `HAVE_ALLOCA'. Otherwise, it sets the output variable `ALLOCA' to
  3128. `${LIBOBJDIR}alloca.o' and defines `C_ALLOCA' (so programs can
  3129. periodically call `alloca (0)' to garbage collect). This variable
  3130. is separate from `LIBOBJS' so multiple programs can share the
  3131. value of `ALLOCA' without needing to create an actual library, in
  3132. case only some of them use the code in `LIBOBJS'. The
  3133. `${LIBOBJDIR}' prefix serves the same purpose as in `LIBOBJS'
  3134. (*note AC_LIBOBJ vs LIBOBJS::).
  3135. This macro does not try to get `alloca' from the System V R3
  3136. `libPW' or the System V R4 `libucb' because those libraries
  3137. contain some incompatible functions that cause trouble. Some
  3138. versions do not even contain `alloca' or contain a buggy version.
  3139. If you still want to use their `alloca', use `ar' to extract
  3140. `alloca.o' from them instead of compiling `alloca.c'.
  3141. Source files that use `alloca' should start with a piece of code
  3142. like the following, to declare it properly.
  3143. #ifdef STDC_HEADERS
  3144. # include <stdlib.h>
  3145. # include <stddef.h>
  3146. #else
  3147. # ifdef HAVE_STDLIB_H
  3148. # include <stdlib.h>
  3149. # endif
  3150. #endif
  3151. #ifdef HAVE_ALLOCA_H
  3152. # include <alloca.h>
  3153. #elif !defined alloca
  3154. # ifdef __GNUC__
  3155. # define alloca __builtin_alloca
  3156. # elif defined _AIX
  3157. # define alloca __alloca
  3158. # elif defined _MSC_VER
  3159. # include <malloc.h>
  3160. # define alloca _alloca
  3161. # elif !defined HAVE_ALLOCA
  3162. # ifdef __cplusplus
  3163. extern "C"
  3164. # endif
  3165. void *alloca (size_t);
  3166. # endif
  3167. #endif
  3168. -- Macro: AC_FUNC_CHOWN
  3169. If the `chown' function is available and works (in particular, it
  3170. should accept `-1' for `uid' and `gid'), define `HAVE_CHOWN'. The
  3171. result of this macro is cached in the `ac_cv_func_chown_works'
  3172. variable.
  3173. -- Macro: AC_FUNC_CLOSEDIR_VOID
  3174. If the `closedir' function does not return a meaningful value,
  3175. define `CLOSEDIR_VOID'. Otherwise, callers ought to check its
  3176. return value for an error indicator.
  3177. Currently this test is implemented by running a test program. When
  3178. cross compiling the pessimistic assumption that `closedir' does not
  3179. return a meaningful value is made.
  3180. The result of this macro is cached in the
  3181. `ac_cv_func_closedir_void' variable.
  3182. This macro is obsolescent, as `closedir' returns a meaningful value
  3183. on current systems. New programs need not use this macro.
  3184. -- Macro: AC_FUNC_ERROR_AT_LINE
  3185. If the `error_at_line' function is not found, require an
  3186. `AC_LIBOBJ' replacement of `error'.
  3187. The result of this macro is cached in the `ac_cv_lib_error_at_line'
  3188. variable.
  3189. The `AC_FUNC_ERROR_AT_LINE' macro is obsolescent. New programs
  3190. should use Gnulib's `error' module. *Note Gnulib::.
  3191. -- Macro: AC_FUNC_FNMATCH
  3192. If the `fnmatch' function conforms to Posix, define
  3193. `HAVE_FNMATCH'. Detect common implementation bugs, for example,
  3194. the bugs in Solaris 2.4.
  3195. Unlike the other specific `AC_FUNC' macros, `AC_FUNC_FNMATCH' does
  3196. not replace a broken/missing `fnmatch'. This is for historical
  3197. reasons. See `AC_REPLACE_FNMATCH' below.
  3198. The result of this macro is cached in the
  3199. `ac_cv_func_fnmatch_works' variable.
  3200. This macro is obsolescent. New programs should use Gnulib's
  3201. `fnmatch-posix' module. *Note Gnulib::.
  3202. -- Macro: AC_FUNC_FNMATCH_GNU
  3203. Behave like `AC_REPLACE_FNMATCH' (_replace_) but also test whether
  3204. `fnmatch' supports GNU extensions. Detect common implementation
  3205. bugs, for example, the bugs in the GNU C Library 2.1.
  3206. The result of this macro is cached in the `ac_cv_func_fnmatch_gnu'
  3207. variable.
  3208. This macro is obsolescent. New programs should use Gnulib's
  3209. `fnmatch-gnu' module. *Note Gnulib::.
  3210. -- Macro: AC_FUNC_FORK
  3211. This macro checks for the `fork' and `vfork' functions. If a
  3212. working `fork' is found, define `HAVE_WORKING_FORK'. This macro
  3213. checks whether `fork' is just a stub by trying to run it.
  3214. If `vfork.h' is found, define `HAVE_VFORK_H'. If a working
  3215. `vfork' is found, define `HAVE_WORKING_VFORK'. Otherwise, define
  3216. `vfork' to be `fork' for backward compatibility with previous
  3217. versions of `autoconf'. This macro checks for several known
  3218. errors in implementations of `vfork' and considers the system to
  3219. not have a working `vfork' if it detects any of them. It is not
  3220. considered to be an implementation error if a child's invocation
  3221. of `signal' modifies the parent's signal handler, since child
  3222. processes rarely change their signal handlers.
  3223. Since this macro defines `vfork' only for backward compatibility
  3224. with previous versions of `autoconf' you're encouraged to define it
  3225. yourself in new code:
  3226. #ifndef HAVE_WORKING_VFORK
  3227. # define vfork fork
  3228. #endif
  3229. The results of this macro are cached in the `ac_cv_func_fork_works'
  3230. and `ac_cv_func_vfork_works' variables. In order to override the
  3231. test, you also need to set the `ac_cv_func_fork' and
  3232. `ac_cv_func_vfork' variables.
  3233. -- Macro: AC_FUNC_FSEEKO
  3234. If the `fseeko' function is available, define `HAVE_FSEEKO'.
  3235. Define `_LARGEFILE_SOURCE' if necessary to make the prototype
  3236. visible on some systems (e.g., glibc 2.2). Otherwise linkage
  3237. problems may occur when compiling with `AC_SYS_LARGEFILE' on
  3238. largefile-sensitive systems where `off_t' does not default to a
  3239. 64bit entity. All systems with `fseeko' also supply `ftello'.
  3240. -- Macro: AC_FUNC_GETGROUPS
  3241. If the `getgroups' function is available and works (unlike on
  3242. Ultrix 4.3, where `getgroups (0, 0)' always fails), define
  3243. `HAVE_GETGROUPS'. Set `GETGROUPS_LIBS' to any libraries needed to
  3244. get that function. This macro runs `AC_TYPE_GETGROUPS'.
  3245. -- Macro: AC_FUNC_GETLOADAVG
  3246. Check how to get the system load averages. To perform its tests
  3247. properly, this macro needs the file `getloadavg.c'; therefore, be
  3248. sure to set the `AC_LIBOBJ' replacement directory properly (see
  3249. *note Generic Functions::, `AC_CONFIG_LIBOBJ_DIR').
  3250. If the system has the `getloadavg' function, define
  3251. `HAVE_GETLOADAVG', and set `GETLOADAVG_LIBS' to any libraries
  3252. necessary to get that function. Also add `GETLOADAVG_LIBS' to
  3253. `LIBS'. Otherwise, require an `AC_LIBOBJ' replacement for
  3254. `getloadavg' with source code in `DIR/getloadavg.c', and possibly
  3255. define several other C preprocessor macros and output variables:
  3256. 1. Define `C_GETLOADAVG'.
  3257. 2. Define `SVR4', `DGUX', `UMAX', or `UMAX4_3' if on those
  3258. systems.
  3259. 3. If `nlist.h' is found, define `HAVE_NLIST_H'.
  3260. 4. If `struct nlist' has an `n_un.n_name' member, define
  3261. `HAVE_STRUCT_NLIST_N_UN_N_NAME'. The obsolete symbol
  3262. `NLIST_NAME_UNION' is still defined, but do not depend upon
  3263. it.
  3264. 5. Programs may need to be installed set-group-ID (or
  3265. set-user-ID) for `getloadavg' to work. In this case, define
  3266. `GETLOADAVG_PRIVILEGED', set the output variable `NEED_SETGID'
  3267. to `true' (and otherwise to `false'), and set `KMEM_GROUP' to
  3268. the name of the group that should own the installed program.
  3269. The `AC_FUNC_GETLOADAVG' macro is obsolescent. New programs should
  3270. use Gnulib's `getloadavg' module. *Note Gnulib::.
  3271. -- Macro: AC_FUNC_GETMNTENT
  3272. Check for `getmntent' in the standard C library, and then in the
  3273. `sun', `seq', and `gen' libraries, for UNICOS, IRIX 4, PTX, and
  3274. UnixWare, respectively. Then, if `getmntent' is available, define
  3275. `HAVE_GETMNTENT' and set `ac_cv_func_getmntent' to `yes'.
  3276. Otherwise set `ac_cv_func_getmntent' to `no'.
  3277. The result of this macro can be overridden by setting the cache
  3278. variable `ac_cv_search_getmntent'.
  3279. -- Macro: AC_FUNC_GETPGRP
  3280. Define `GETPGRP_VOID' if it is an error to pass 0 to `getpgrp';
  3281. this is the Posix behavior. On older BSD systems, you must pass 0
  3282. to `getpgrp', as it takes an argument and behaves like Posix's
  3283. `getpgid'.
  3284. #ifdef GETPGRP_VOID
  3285. pid = getpgrp ();
  3286. #else
  3287. pid = getpgrp (0);
  3288. #endif
  3289. This macro does not check whether `getpgrp' exists at all; if you
  3290. need to work in that situation, first call `AC_CHECK_FUNC' for
  3291. `getpgrp'.
  3292. The result of this macro is cached in the `ac_cv_func_getpgrp_void'
  3293. variable.
  3294. This macro is obsolescent, as current systems have a `getpgrp'
  3295. whose signature conforms to Posix. New programs need not use this
  3296. macro.
  3297. -- Macro: AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
  3298. If `link' is a symbolic link, then `lstat' should treat `link/'
  3299. the same as `link/.'. However, many older `lstat' implementations
  3300. incorrectly ignore trailing slashes.
  3301. It is safe to assume that if `lstat' incorrectly ignores trailing
  3302. slashes, then other symbolic-link-aware functions like `unlink'
  3303. also incorrectly ignore trailing slashes.
  3304. If `lstat' behaves properly, define
  3305. `LSTAT_FOLLOWS_SLASHED_SYMLINK', otherwise require an `AC_LIBOBJ'
  3306. replacement of `lstat'.
  3307. The result of this macro is cached in the
  3308. `ac_cv_func_lstat_dereferences_slashed_symlink' variable.
  3309. The `AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' macro is obsolescent.
  3310. New programs should use Gnulib's `lstat' module. *Note Gnulib::.
  3311. -- Macro: AC_FUNC_MALLOC
  3312. If the `malloc' function is compatible with the GNU C library
  3313. `malloc' (i.e., `malloc (0)' returns a valid pointer), define
  3314. `HAVE_MALLOC' to 1. Otherwise define `HAVE_MALLOC' to 0, ask for
  3315. an `AC_LIBOBJ' replacement for `malloc', and define `malloc' to
  3316. `rpl_malloc' so that the native `malloc' is not used in the main
  3317. project.
  3318. Typically, the replacement file `malloc.c' should look like (note
  3319. the `#undef malloc'):
  3320. #include <config.h>
  3321. #undef malloc
  3322. #include <sys/types.h>
  3323. void *malloc ();
  3324. /* Allocate an N-byte block of memory from the heap.
  3325. If N is zero, allocate a 1-byte block. */
  3326. void *
  3327. rpl_malloc (size_t n)
  3328. {
  3329. if (n == 0)
  3330. n = 1;
  3331. return malloc (n);
  3332. }
  3333. The result of this macro is cached in the
  3334. `ac_cv_func_malloc_0_nonnull' variable.
  3335. -- Macro: AC_FUNC_MBRTOWC
  3336. Define `HAVE_MBRTOWC' to 1 if the function `mbrtowc' and the type
  3337. `mbstate_t' are properly declared.
  3338. The result of this macro is cached in the `ac_cv_func_mbrtowc'
  3339. variable.
  3340. -- Macro: AC_FUNC_MEMCMP
  3341. If the `memcmp' function is not available, or does not work on
  3342. 8-bit data (like the one on SunOS 4.1.3), or fails when comparing
  3343. 16 bytes or more and with at least one buffer not starting on a
  3344. 4-byte boundary (such as the one on NeXT x86 OpenStep), require an
  3345. `AC_LIBOBJ' replacement for `memcmp'.
  3346. The result of this macro is cached in the
  3347. `ac_cv_func_memcmp_working' variable.
  3348. This macro is obsolescent, as current systems have a working
  3349. `memcmp'. New programs need not use this macro.
  3350. -- Macro: AC_FUNC_MKTIME
  3351. If the `mktime' function is not available, or does not work
  3352. correctly, require an `AC_LIBOBJ' replacement for `mktime'. For
  3353. the purposes of this test, `mktime' should conform to the Posix
  3354. standard and should be the inverse of `localtime'.
  3355. The result of this macro is cached in the
  3356. `ac_cv_func_working_mktime' variable.
  3357. The `AC_FUNC_MKTIME' macro is obsolescent. New programs should
  3358. use Gnulib's `mktime' module. *Note Gnulib::.
  3359. -- Macro: AC_FUNC_MMAP
  3360. If the `mmap' function exists and works correctly, define
  3361. `HAVE_MMAP'. This checks only private fixed mapping of
  3362. already-mapped memory.
  3363. The result of this macro is cached in the
  3364. `ac_cv_func_mmap_fixed_mapped' variable.
  3365. -- Macro: AC_FUNC_OBSTACK
  3366. If the obstacks are found, define `HAVE_OBSTACK', else require an
  3367. `AC_LIBOBJ' replacement for `obstack'.
  3368. The result of this macro is cached in the `ac_cv_func_obstack'
  3369. variable.
  3370. -- Macro: AC_FUNC_REALLOC
  3371. If the `realloc' function is compatible with the GNU C library
  3372. `realloc' (i.e., `realloc (NULL, 0)' returns a valid pointer),
  3373. define `HAVE_REALLOC' to 1. Otherwise define `HAVE_REALLOC' to 0,
  3374. ask for an `AC_LIBOBJ' replacement for `realloc', and define
  3375. `realloc' to `rpl_realloc' so that the native `realloc' is not
  3376. used in the main project. See `AC_FUNC_MALLOC' for details.
  3377. The result of this macro is cached in the
  3378. `ac_cv_func_realloc_0_nonnull' variable.
  3379. -- Macro: AC_FUNC_SELECT_ARGTYPES
  3380. Determines the correct type to be passed for each of the `select'
  3381. function's arguments, and defines those types in
  3382. `SELECT_TYPE_ARG1', `SELECT_TYPE_ARG234', and `SELECT_TYPE_ARG5'
  3383. respectively. `SELECT_TYPE_ARG1' defaults to `int',
  3384. `SELECT_TYPE_ARG234' defaults to `int *', and `SELECT_TYPE_ARG5'
  3385. defaults to `struct timeval *'.
  3386. This macro is obsolescent, as current systems have a `select' whose
  3387. signature conforms to Posix. New programs need not use this macro.
  3388. -- Macro: AC_FUNC_SETPGRP
  3389. If `setpgrp' takes no argument (the Posix version), define
  3390. `SETPGRP_VOID'. Otherwise, it is the BSD version, which takes two
  3391. process IDs as arguments. This macro does not check whether
  3392. `setpgrp' exists at all; if you need to work in that situation,
  3393. first call `AC_CHECK_FUNC' for `setpgrp'.
  3394. The result of this macro is cached in the `ac_cv_func_setpgrp_void'
  3395. variable.
  3396. This macro is obsolescent, as current systems have a `setpgrp'
  3397. whose signature conforms to Posix. New programs need not use this
  3398. macro.
  3399. -- Macro: AC_FUNC_STAT
  3400. -- Macro: AC_FUNC_LSTAT
  3401. Determine whether `stat' or `lstat' have the bug that it succeeds
  3402. when given the zero-length file name as argument. The `stat' and
  3403. `lstat' from SunOS 4.1.4 and the Hurd (as of 1998-11-01) do this.
  3404. If it does, then define `HAVE_STAT_EMPTY_STRING_BUG' (or
  3405. `HAVE_LSTAT_EMPTY_STRING_BUG') and ask for an `AC_LIBOBJ'
  3406. replacement of it.
  3407. The results of these macros are cached in the
  3408. `ac_cv_func_stat_empty_string_bug' and the
  3409. `ac_cv_func_lstat_empty_string_bug' variables, respectively.
  3410. These macros are obsolescent, as no current systems have the bug.
  3411. New programs need not use these macros.
  3412. -- Macro: AC_FUNC_STRCOLL
  3413. If the `strcoll' function exists and works correctly, define
  3414. `HAVE_STRCOLL'. This does a bit more than
  3415. `AC_CHECK_FUNCS(strcoll)', because some systems have incorrect
  3416. definitions of `strcoll' that should not be used.
  3417. The result of this macro is cached in the
  3418. `ac_cv_func_strcoll_works' variable.
  3419. -- Macro: AC_FUNC_STRERROR_R
  3420. If `strerror_r' is available, define `HAVE_STRERROR_R', and if it
  3421. is declared, define `HAVE_DECL_STRERROR_R'. If it returns a `char
  3422. *' message, define `STRERROR_R_CHAR_P'; otherwise it returns an
  3423. `int' error number. The Thread-Safe Functions option of Posix
  3424. requires `strerror_r' to return `int', but many systems
  3425. (including, for example, version 2.2.4 of the GNU C Library)
  3426. return a `char *' value that is not necessarily equal to the
  3427. buffer argument.
  3428. The result of this macro is cached in the
  3429. `ac_cv_func_strerror_r_char_p' variable.
  3430. -- Macro: AC_FUNC_STRFTIME
  3431. Check for `strftime' in the `intl' library, for SCO Unix. Then,
  3432. if `strftime' is available, define `HAVE_STRFTIME'.
  3433. This macro is obsolescent, as no current systems require the `intl'
  3434. library for `strftime'. New programs need not use this macro.
  3435. -- Macro: AC_FUNC_STRTOD
  3436. If the `strtod' function does not exist or doesn't work correctly,
  3437. ask for an `AC_LIBOBJ' replacement of `strtod'. In this case,
  3438. because `strtod.c' is likely to need `pow', set the output
  3439. variable `POW_LIB' to the extra library needed.
  3440. This macro caches its result in the `ac_cv_func_strtod' variable
  3441. and depends upon the result in the `ac_cv_func_pow' variable.
  3442. The `AC_FUNC_STRTOD' macro is obsolescent. New programs should
  3443. use Gnulib's `strtod' module. *Note Gnulib::.
  3444. -- Macro: AC_FUNC_STRTOLD
  3445. If the `strtold' function exists and conforms to C99, define
  3446. `HAVE_STRTOLD'.
  3447. This macro caches its result in the `ac_cv_func_strtold' variable.
  3448. -- Macro: AC_FUNC_STRNLEN
  3449. If the `strnlen' function is not available, or is buggy (like the
  3450. one from AIX 4.3), require an `AC_LIBOBJ' replacement for it.
  3451. This macro caches its result in the `ac_cv_func_strnlen_working'
  3452. variable.
  3453. -- Macro: AC_FUNC_UTIME_NULL
  3454. If `utime (FILE, NULL)' sets FILE's timestamp to the present,
  3455. define `HAVE_UTIME_NULL'.
  3456. This macro caches its result in the `ac_cv_func_utime_null'
  3457. variable.
  3458. This macro is obsolescent, as all current systems have a `utime'
  3459. that behaves this way. New programs need not use this macro.
  3460. -- Macro: AC_FUNC_VPRINTF
  3461. If `vprintf' is found, define `HAVE_VPRINTF'. Otherwise, if
  3462. `_doprnt' is found, define `HAVE_DOPRNT'. (If `vprintf' is
  3463. available, you may assume that `vfprintf' and `vsprintf' are also
  3464. available.)
  3465. This macro is obsolescent, as all current systems have `vprintf'.
  3466. New programs need not use this macro.
  3467. -- Macro: AC_REPLACE_FNMATCH
  3468. If the `fnmatch' function does not conform to Posix (see
  3469. `AC_FUNC_FNMATCH'), ask for its `AC_LIBOBJ' replacement.
  3470. The files `fnmatch.c', `fnmatch_loop.c', and `fnmatch_.h' in the
  3471. `AC_LIBOBJ' replacement directory are assumed to contain a copy of
  3472. the source code of GNU `fnmatch'. If necessary, this source code
  3473. is compiled as an `AC_LIBOBJ' replacement, and the `fnmatch_.h'
  3474. file is linked to `fnmatch.h' so that it can be included in place
  3475. of the system `<fnmatch.h>'.
  3476. This macro caches its result in the `ac_cv_func_fnmatch_works'
  3477. variable.
  3478. This macro is obsolescent, as it assumes the use of particular
  3479. source files. New programs should use Gnulib's `fnmatch-posix'
  3480. module, which provides this macro along with the source files.
  3481. *Note Gnulib::.
  3482. 
  3483. File: autoconf.info, Node: Generic Functions, Prev: Particular Functions, Up: Library Functions
  3484. 5.5.3 Generic Function Checks
  3485. -----------------------------
  3486. These macros are used to find functions not covered by the "particular"
  3487. test macros. If the functions might be in libraries other than the
  3488. default C library, first call `AC_CHECK_LIB' for those libraries. If
  3489. you need to check the behavior of a function as well as find out
  3490. whether it is present, you have to write your own test for it (*note
  3491. Writing Tests::).
  3492. -- Macro: AC_CHECK_FUNC (FUNCTION, [ACTION-IF-FOUND],
  3493. [ACTION-IF-NOT-FOUND])
  3494. If C function FUNCTION is available, run shell commands
  3495. ACTION-IF-FOUND, otherwise ACTION-IF-NOT-FOUND. If you just want
  3496. to define a symbol if the function is available, consider using
  3497. `AC_CHECK_FUNCS' instead. This macro checks for functions with C
  3498. linkage even when `AC_LANG(C++)' has been called, since C is more
  3499. standardized than C++. (*note Language Choice::, for more
  3500. information about selecting the language for checks.)
  3501. This macro caches its result in the `ac_cv_func_FUNCTION' variable.
  3502. -- Macro: AC_CHECK_FUNCS (FUNCTION..., [ACTION-IF-FOUND],
  3503. [ACTION-IF-NOT-FOUND])
  3504. For each FUNCTION enumerated in the blank-or-newline-separated
  3505. argument list, define `HAVE_FUNCTION' (in all capitals) if it is
  3506. available. If ACTION-IF-FOUND is given, it is additional shell
  3507. code to execute when one of the functions is found. You can give
  3508. it a value of `break' to break out of the loop on the first match.
  3509. If ACTION-IF-NOT-FOUND is given, it is executed when one of the
  3510. functions is not found.
  3511. Results are cached for each FUNCTION as in `AC_CHECK_FUNC'.
  3512. -- Macro: AC_CHECK_FUNCS_ONCE (FUNCTION...)
  3513. For each FUNCTION enumerated in the blank-or-newline-separated
  3514. argument list, define `HAVE_FUNCTION' (in all capitals) if it is
  3515. available. This is a once-only variant of `AC_CHECK_FUNCS'. It
  3516. generates the checking code at most once, so that `configure' is
  3517. smaller and faster; but the checks cannot be conditionalized and
  3518. are always done once, early during the `configure' run.
  3519. Autoconf follows a philosophy that was formed over the years by those
  3520. who have struggled for portability: isolate the portability issues in
  3521. specific files, and then program as if you were in a Posix environment.
  3522. Some functions may be missing or unfixable, and your package must be
  3523. ready to replace them.
  3524. Suitable replacements for many such problem functions are available
  3525. from Gnulib (*note Gnulib::).
  3526. -- Macro: AC_LIBOBJ (FUNCTION)
  3527. Specify that `FUNCTION.c' must be included in the executables to
  3528. replace a missing or broken implementation of FUNCTION.
  3529. Technically, it adds `FUNCTION.$ac_objext' to the output variable
  3530. `LIBOBJS' if it is not already in, and calls `AC_LIBSOURCE' for
  3531. `FUNCTION.c'. You should not directly change `LIBOBJS', since
  3532. this is not traceable.
  3533. -- Macro: AC_LIBSOURCE (FILE)
  3534. Specify that FILE might be needed to compile the project. If you
  3535. need to know what files might be needed by a `configure.ac', you
  3536. should trace `AC_LIBSOURCE'. FILE must be a literal.
  3537. This macro is called automatically from `AC_LIBOBJ', but you must
  3538. call it explicitly if you pass a shell variable to `AC_LIBOBJ'. In
  3539. that case, since shell variables cannot be traced statically, you
  3540. must pass to `AC_LIBSOURCE' any possible files that the shell
  3541. variable might cause `AC_LIBOBJ' to need. For example, if you
  3542. want to pass a variable `$foo_or_bar' to `AC_LIBOBJ' that holds
  3543. either `"foo"' or `"bar"', you should do:
  3544. AC_LIBSOURCE([foo.c])
  3545. AC_LIBSOURCE([bar.c])
  3546. AC_LIBOBJ([$foo_or_bar])
  3547. There is usually a way to avoid this, however, and you are
  3548. encouraged to simply call `AC_LIBOBJ' with literal arguments.
  3549. Note that this macro replaces the obsolete `AC_LIBOBJ_DECL', with
  3550. slightly different semantics: the old macro took the function name,
  3551. e.g., `foo', as its argument rather than the file name.
  3552. -- Macro: AC_LIBSOURCES (FILES)
  3553. Like `AC_LIBSOURCE', but accepts one or more FILES in a
  3554. comma-separated M4 list. Thus, the above example might be
  3555. rewritten:
  3556. AC_LIBSOURCES([foo.c, bar.c])
  3557. AC_LIBOBJ([$foo_or_bar])
  3558. -- Macro: AC_CONFIG_LIBOBJ_DIR (DIRECTORY)
  3559. Specify that `AC_LIBOBJ' replacement files are to be found in
  3560. DIRECTORY, a name relative to the top level of the source tree.
  3561. The replacement directory defaults to `.', the top level
  3562. directory, and the most typical value is `lib', corresponding to
  3563. `AC_CONFIG_LIBOBJ_DIR([lib])'.
  3564. `configure' might need to know the replacement directory for the
  3565. following reasons: (i) some checks use the replacement files, (ii)
  3566. some macros bypass broken system headers by installing links to the
  3567. replacement headers (iii) when used in conjunction with Automake,
  3568. within each makefile, DIRECTORY is used as a relative path from
  3569. `$(top_srcdir)' to each object named in `LIBOBJS' and `LTLIBOBJS',
  3570. etc.
  3571. It is common to merely check for the existence of a function, and ask
  3572. for its `AC_LIBOBJ' replacement if missing. The following macro is a
  3573. convenient shorthand.
  3574. -- Macro: AC_REPLACE_FUNCS (FUNCTION...)
  3575. Like `AC_CHECK_FUNCS', but uses `AC_LIBOBJ(FUNCTION)' as
  3576. ACTION-IF-NOT-FOUND. You can declare your replacement function by
  3577. enclosing the prototype in `#ifndef HAVE_FUNCTION'. If the system
  3578. has the function, it probably declares it in a header file you
  3579. should be including, so you shouldn't redeclare it lest your
  3580. declaration conflict.
  3581. 
  3582. File: autoconf.info, Node: Header Files, Next: Declarations, Prev: Library Functions, Up: Existing Tests
  3583. 5.6 Header Files
  3584. ================
  3585. The following macros check for the presence of certain C header files.
  3586. If there is no macro specifically defined to check for a header file
  3587. you need, and you don't need to check for any special properties of it,
  3588. then you can use one of the general header-file check macros.
  3589. * Menu:
  3590. * Header Portability:: Collected knowledge on common headers
  3591. * Particular Headers:: Special handling to find certain headers
  3592. * Generic Headers:: How to find other headers
  3593. 
  3594. File: autoconf.info, Node: Header Portability, Next: Particular Headers, Up: Header Files
  3595. 5.6.1 Portability of Headers
  3596. ----------------------------
  3597. This section documents some collected knowledge about common headers,
  3598. and the problems they cause. By definition, this list always requires
  3599. additions. A much more complete list is maintained by the Gnulib
  3600. project (*note Gnulib::), covering *note Posix Headers: (gnulib)Header
  3601. File Substitutes. and *note Glibc Headers: (gnulib)Glibc Header File
  3602. Substitutes. Please help us keep the gnulib list as complete as
  3603. possible.
  3604. `limits.h'
  3605. C99 says that `limits.h' defines `LLONG_MIN', `LLONG_MAX', and
  3606. `ULLONG_MAX', but many almost-C99 environments (e.g., default GCC
  3607. 4.0.2 + glibc 2.4) do not define them.
  3608. `inttypes.h' vs. `stdint.h'
  3609. The C99 standard says that `inttypes.h' includes `stdint.h', so
  3610. there's no need to include `stdint.h' separately in a standard
  3611. environment. Some implementations have `inttypes.h' but not
  3612. `stdint.h' (e.g., Solaris 7), but we don't know of any
  3613. implementation that has `stdint.h' but not `inttypes.h'.
  3614. `linux/irda.h'
  3615. It requires `linux/types.h' and `sys/socket.h'.
  3616. `linux/random.h'
  3617. It requires `linux/types.h'.
  3618. `net/if.h'
  3619. On Darwin, this file requires that `sys/socket.h' be included
  3620. beforehand. One should run:
  3621. AC_CHECK_HEADERS([sys/socket.h])
  3622. AC_CHECK_HEADERS([net/if.h], [], [],
  3623. [#include <stdio.h>
  3624. #ifdef STDC_HEADERS
  3625. # include <stdlib.h>
  3626. # include <stddef.h>
  3627. #else
  3628. # ifdef HAVE_STDLIB_H
  3629. # include <stdlib.h>
  3630. # endif
  3631. #endif
  3632. #ifdef HAVE_SYS_SOCKET_H
  3633. # include <sys/socket.h>
  3634. #endif
  3635. ])
  3636. `netinet/if_ether.h'
  3637. On Darwin, this file requires that `stdio.h' and `sys/socket.h' be
  3638. included beforehand. One should run:
  3639. AC_CHECK_HEADERS([sys/socket.h])
  3640. AC_CHECK_HEADERS([netinet/if_ether.h], [], [],
  3641. [#include <stdio.h>
  3642. #ifdef STDC_HEADERS
  3643. # include <stdlib.h>
  3644. # include <stddef.h>
  3645. #else
  3646. # ifdef HAVE_STDLIB_H
  3647. # include <stdlib.h>
  3648. # endif
  3649. #endif
  3650. #ifdef HAVE_SYS_SOCKET_H
  3651. # include <sys/socket.h>
  3652. #endif
  3653. ])
  3654. `stdint.h'
  3655. See above, item `inttypes.h' vs. `stdint.h'.
  3656. `stdlib.h'
  3657. On many systems (e.g., Darwin), `stdio.h' is a prerequisite.
  3658. `sys/mount.h'
  3659. On FreeBSD 4.8 on ia32 and using gcc version 2.95.4,
  3660. `sys/params.h' is a prerequisite.
  3661. `sys/ptem.h'
  3662. On Solaris 8, `sys/stream.h' is a prerequisite.
  3663. `sys/socket.h'
  3664. On Darwin, `stdlib.h' is a prerequisite.
  3665. `sys/ucred.h'
  3666. On Tru64 5.1, `sys/types.h' is a prerequisite.
  3667. `X11/extensions/scrnsaver.h'
  3668. Using XFree86, this header requires `X11/Xlib.h', which is probably
  3669. so required that you might not even consider looking for it.
  3670. AC_CHECK_HEADERS([X11/extensions/scrnsaver.h], [], [],
  3671. [[#include <X11/Xlib.h>
  3672. ]])
  3673. 
  3674. File: autoconf.info, Node: Particular Headers, Next: Generic Headers, Prev: Header Portability, Up: Header Files
  3675. 5.6.2 Particular Header Checks
  3676. ------------------------------
  3677. These macros check for particular system header files--whether they
  3678. exist, and in some cases whether they declare certain symbols.
  3679. -- Macro: AC_CHECK_HEADER_STDBOOL
  3680. Check whether `stdbool.h' exists and conforms to C99, and cache the
  3681. result in the `ac_cv_header_stdbool_h' variable. If the type
  3682. `_Bool' is defined, define `HAVE__BOOL' to 1.
  3683. This macro is intended for use by Gnulib (*note Gnulib::) and other
  3684. packages that supply a substitute `stdbool.h' on platforms lacking
  3685. a conforming one. The `AC_HEADER_STDBOOL' macro is better for code
  3686. that explicitly checks for `stdbool.h'.
  3687. -- Macro: AC_HEADER_ASSERT
  3688. Check whether to enable assertions in the style of `assert.h'.
  3689. Assertions are enabled by default, but the user can override this
  3690. by invoking `configure' with the `--disable-assert' option.
  3691. -- Macro: AC_HEADER_DIRENT
  3692. Check for the following header files. For the first one that is
  3693. found and defines `DIR', define the listed C preprocessor macro:
  3694. `dirent.h' `HAVE_DIRENT_H'
  3695. `sys/ndir.h' `HAVE_SYS_NDIR_H'
  3696. `sys/dir.h' `HAVE_SYS_DIR_H'
  3697. `ndir.h' `HAVE_NDIR_H'
  3698. The directory-library declarations in your source code should look
  3699. something like the following:
  3700. #include <sys/types.h>
  3701. #ifdef HAVE_DIRENT_H
  3702. # include <dirent.h>
  3703. # define NAMLEN(dirent) strlen ((dirent)->d_name)
  3704. #else
  3705. # define dirent direct
  3706. # define NAMLEN(dirent) ((dirent)->d_namlen)
  3707. # ifdef HAVE_SYS_NDIR_H
  3708. # include <sys/ndir.h>
  3709. # endif
  3710. # ifdef HAVE_SYS_DIR_H
  3711. # include <sys/dir.h>
  3712. # endif
  3713. # ifdef HAVE_NDIR_H
  3714. # include <ndir.h>
  3715. # endif
  3716. #endif
  3717. Using the above declarations, the program would declare variables
  3718. to be of type `struct dirent', not `struct direct', and would
  3719. access the length of a directory entry name by passing a pointer
  3720. to a `struct dirent' to the `NAMLEN' macro.
  3721. This macro also checks for the SCO Xenix `dir' and `x' libraries.
  3722. This macro is obsolescent, as all current systems with directory
  3723. libraries have `<dirent.h>'. New programs need not use this macro.
  3724. Also see `AC_STRUCT_DIRENT_D_INO' and `AC_STRUCT_DIRENT_D_TYPE'
  3725. (*note Particular Structures::).
  3726. -- Macro: AC_HEADER_MAJOR
  3727. If `sys/types.h' does not define `major', `minor', and `makedev',
  3728. but `sys/mkdev.h' does, define `MAJOR_IN_MKDEV'; otherwise, if
  3729. `sys/sysmacros.h' does, define `MAJOR_IN_SYSMACROS'.
  3730. -- Macro: AC_HEADER_RESOLV
  3731. Checks for header `resolv.h', checking for prerequisites first.
  3732. To properly use `resolv.h', your code should contain something like
  3733. the following:
  3734. #ifdef HAVE_SYS_TYPES_H
  3735. # include <sys/types.h>
  3736. #endif
  3737. #ifdef HAVE_NETINET_IN_H
  3738. # include <netinet/in.h> /* inet_ functions / structs */
  3739. #endif
  3740. #ifdef HAVE_ARPA_NAMESER_H
  3741. # include <arpa/nameser.h> /* DNS HEADER struct */
  3742. #endif
  3743. #ifdef HAVE_NETDB_H
  3744. # include <netdb.h>
  3745. #endif
  3746. #include <resolv.h>
  3747. -- Macro: AC_HEADER_STAT
  3748. If the macros `S_ISDIR', `S_ISREG', etc. defined in `sys/stat.h'
  3749. do not work properly (returning false positives), define
  3750. `STAT_MACROS_BROKEN'. This is the case on Tektronix UTekV, Amdahl
  3751. UTS and Motorola System V/88.
  3752. This macro is obsolescent, as no current systems have the bug.
  3753. New programs need not use this macro.
  3754. -- Macro: AC_HEADER_STDBOOL
  3755. If `stdbool.h' exists and conforms to C99, define `HAVE_STDBOOL_H'
  3756. to 1; if the type `_Bool' is defined, define `HAVE__BOOL' to 1.
  3757. To fulfill the C99 requirements, your program could contain the
  3758. following code:
  3759. #ifdef HAVE_STDBOOL_H
  3760. # include <stdbool.h>
  3761. #else
  3762. # ifndef HAVE__BOOL
  3763. # ifdef __cplusplus
  3764. typedef bool _Bool;
  3765. # else
  3766. # define _Bool signed char
  3767. # endif
  3768. # endif
  3769. # define bool _Bool
  3770. # define false 0
  3771. # define true 1
  3772. # define __bool_true_false_are_defined 1
  3773. #endif
  3774. Alternatively you can use the `stdbool' package of Gnulib (*note
  3775. Gnulib::). It simplifies your code so that it can say just
  3776. `#include <stdbool.h>', and it adds support for less-common
  3777. platforms.
  3778. This macro caches its result in the `ac_cv_header_stdbool_h'
  3779. variable.
  3780. This macro differs from `AC_CHECK_HEADER_STDBOOL' only in that it
  3781. defines `HAVE_STDBOOL_H' whereas `AC_CHECK_HEADER_STDBOOL' does
  3782. not.
  3783. -- Macro: AC_HEADER_STDC
  3784. Define `STDC_HEADERS' if the system has C header files conforming
  3785. to ANSI C89 (ISO C90). Specifically, this macro checks for
  3786. `stdlib.h', `stdarg.h', `string.h', and `float.h'; if the system
  3787. has those, it probably has the rest of the C89 header files. This
  3788. macro also checks whether `string.h' declares `memchr' (and thus
  3789. presumably the other `mem' functions), whether `stdlib.h' declare
  3790. `free' (and thus presumably `malloc' and other related functions),
  3791. and whether the `ctype.h' macros work on characters with the high
  3792. bit set, as the C standard requires.
  3793. If you use this macro, your code can refer to `STDC_HEADERS' to
  3794. determine whether the system has conforming header files (and
  3795. probably C library functions).
  3796. This macro caches its result in the `ac_cv_header_stdc' variable.
  3797. This macro is obsolescent, as current systems have conforming
  3798. header files. New programs need not use this macro.
  3799. Nowadays `string.h' is part of the C standard and declares
  3800. functions like `strcpy', and `strings.h' is standardized by Posix
  3801. and declares BSD functions like `bcopy'; but historically, string
  3802. functions were a major sticking point in this area. If you still
  3803. want to worry about portability to ancient systems without
  3804. standard headers, there is so much variation that it is probably
  3805. easier to declare the functions you use than to figure out exactly
  3806. what the system header files declare. Some ancient systems
  3807. contained a mix of functions from the C standard and from BSD;
  3808. some were mostly standard but lacked `memmove'; some defined the
  3809. BSD functions as macros in `string.h' or `strings.h'; some had
  3810. only the BSD functions but `string.h'; some declared the memory
  3811. functions in `memory.h', some in `string.h'; etc. It is probably
  3812. sufficient to check for one string function and one memory
  3813. function; if the library had the standard versions of those then
  3814. it probably had most of the others. If you put the following in
  3815. `configure.ac':
  3816. # This example is obsolescent.
  3817. # Nowadays you can omit these macro calls.
  3818. AC_HEADER_STDC
  3819. AC_CHECK_FUNCS([strchr memcpy])
  3820. then, in your code, you can use declarations like this:
  3821. /* This example is obsolescent.
  3822. Nowadays you can just #include <string.h>. */
  3823. #ifdef STDC_HEADERS
  3824. # include <string.h>
  3825. #else
  3826. # ifndef HAVE_STRCHR
  3827. # define strchr index
  3828. # define strrchr rindex
  3829. # endif
  3830. char *strchr (), *strrchr ();
  3831. # ifndef HAVE_MEMCPY
  3832. # define memcpy(d, s, n) bcopy ((s), (d), (n))
  3833. # define memmove(d, s, n) bcopy ((s), (d), (n))
  3834. # endif
  3835. #endif
  3836. If you use a function like `memchr', `memset', `strtok', or
  3837. `strspn', which have no BSD equivalent, then macros don't suffice
  3838. to port to ancient hosts; you must provide an implementation of
  3839. each function. An easy way to incorporate your implementations
  3840. only when needed (since the ones in system C libraries may be hand
  3841. optimized) is to, taking `memchr' for example, put it in
  3842. `memchr.c' and use `AC_REPLACE_FUNCS([memchr])'.
  3843. -- Macro: AC_HEADER_SYS_WAIT
  3844. If `sys/wait.h' exists and is compatible with Posix, define
  3845. `HAVE_SYS_WAIT_H'. Incompatibility can occur if `sys/wait.h' does
  3846. not exist, or if it uses the old BSD `union wait' instead of `int'
  3847. to store a status value. If `sys/wait.h' is not Posix compatible,
  3848. then instead of including it, define the Posix macros with their
  3849. usual interpretations. Here is an example:
  3850. #include <sys/types.h>
  3851. #ifdef HAVE_SYS_WAIT_H
  3852. # include <sys/wait.h>
  3853. #endif
  3854. #ifndef WEXITSTATUS
  3855. # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
  3856. #endif
  3857. #ifndef WIFEXITED
  3858. # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
  3859. #endif
  3860. This macro caches its result in the `ac_cv_header_sys_wait_h'
  3861. variable.
  3862. This macro is obsolescent, as current systems are compatible with
  3863. Posix. New programs need not use this macro.
  3864. `_POSIX_VERSION' is defined when `unistd.h' is included on Posix
  3865. systems. If there is no `unistd.h', it is definitely not a Posix
  3866. system. However, some non-Posix systems do have `unistd.h'.
  3867. The way to check whether the system supports Posix is:
  3868. #ifdef HAVE_UNISTD_H
  3869. # include <sys/types.h>
  3870. # include <unistd.h>
  3871. #endif
  3872. #ifdef _POSIX_VERSION
  3873. /* Code for Posix systems. */
  3874. #endif
  3875. -- Macro: AC_HEADER_TIME
  3876. If a program may include both `time.h' and `sys/time.h', define
  3877. `TIME_WITH_SYS_TIME'. On some ancient systems, `sys/time.h'
  3878. included `time.h', but `time.h' was not protected against multiple
  3879. inclusion, so programs could not explicitly include both files.
  3880. This macro is useful in programs that use, for example, `struct
  3881. timeval' as well as `struct tm'. It is best used in conjunction
  3882. with `HAVE_SYS_TIME_H', which can be checked for using
  3883. `AC_CHECK_HEADERS([sys/time.h])'.
  3884. #ifdef TIME_WITH_SYS_TIME
  3885. # include <sys/time.h>
  3886. # include <time.h>
  3887. #else
  3888. # ifdef HAVE_SYS_TIME_H
  3889. # include <sys/time.h>
  3890. # else
  3891. # include <time.h>
  3892. # endif
  3893. #endif
  3894. This macro caches its result in the `ac_cv_header_time' variable.
  3895. This macro is obsolescent, as current systems can include both
  3896. files when they exist. New programs need not use this macro.
  3897. -- Macro: AC_HEADER_TIOCGWINSZ
  3898. If the use of `TIOCGWINSZ' requires `<sys/ioctl.h>', then define
  3899. `GWINSZ_IN_SYS_IOCTL'. Otherwise `TIOCGWINSZ' can be found in
  3900. `<termios.h>'.
  3901. Use:
  3902. #ifdef HAVE_TERMIOS_H
  3903. # include <termios.h>
  3904. #endif
  3905. #ifdef GWINSZ_IN_SYS_IOCTL
  3906. # include <sys/ioctl.h>
  3907. #endif
  3908. 
  3909. File: autoconf.info, Node: Generic Headers, Prev: Particular Headers, Up: Header Files
  3910. 5.6.3 Generic Header Checks
  3911. ---------------------------
  3912. These macros are used to find system header files not covered by the
  3913. "particular" test macros. If you need to check the contents of a header
  3914. as well as find out whether it is present, you have to write your own
  3915. test for it (*note Writing Tests::).
  3916. -- Macro: AC_CHECK_HEADER (HEADER-FILE, [ACTION-IF-FOUND],
  3917. [ACTION-IF-NOT-FOUND], [INCLUDES])
  3918. If the system header file HEADER-FILE is compilable, execute shell
  3919. commands ACTION-IF-FOUND, otherwise execute ACTION-IF-NOT-FOUND.
  3920. If you just want to define a symbol if the header file is
  3921. available, consider using `AC_CHECK_HEADERS' instead.
  3922. INCLUDES is decoded to determine the appropriate include
  3923. directives. If omitted or empty, `configure' will check for both
  3924. header existence (with the preprocessor) and usability (with the
  3925. compiler), using `AC_INCLUDES_DEFAULT' for the compile test. If
  3926. there is a discrepancy between the results, a warning is issued to
  3927. the user, and the compiler results are favored (*note Present But
  3928. Cannot Be Compiled::). In general, favoring the compiler results
  3929. means that a header will be treated as not found even though the
  3930. file exists, because you did not provide enough prerequisites.
  3931. Providing a non-empty INCLUDES argument allows the code to provide
  3932. any prerequisites prior to including the header under test; it is
  3933. common to use the argument `AC_INCLUDES_DEFAULT' (*note Default
  3934. Includes::). With an explicit fourth argument, no preprocessor
  3935. test is needed. As a special case, an INCLUDES of exactly `-'
  3936. triggers the older preprocessor check, which merely determines
  3937. existence of the file in the preprocessor search path; this should
  3938. only be used as a last resort (it is safer to determine the actual
  3939. prerequisites and perform a compiler check, or else use
  3940. `AC_PREPROC_IFELSE' to make it obvious that only a preprocessor
  3941. check is desired).
  3942. This macro caches its result in the `ac_cv_header_HEADER-FILE'
  3943. variable, with characters not suitable for a variable name mapped
  3944. to underscores.
  3945. -- Macro: AC_CHECK_HEADERS (HEADER-FILE..., [ACTION-IF-FOUND],
  3946. [ACTION-IF-NOT-FOUND], [INCLUDES])
  3947. For each given system header file HEADER-FILE in the
  3948. blank-separated argument list that exists, define
  3949. `HAVE_HEADER-FILE' (in all capitals). If ACTION-IF-FOUND is
  3950. given, it is additional shell code to execute when one of the
  3951. header files is found. You can give it a value of `break' to
  3952. break out of the loop on the first match. If ACTION-IF-NOT-FOUND
  3953. is given, it is executed when one of the header files is not found.
  3954. INCLUDES is interpreted as in `AC_CHECK_HEADER', in order to
  3955. choose the set of preprocessor directives supplied before the
  3956. header under test.
  3957. This macro caches its result in the `ac_cv_header_HEADER-FILE'
  3958. variable, with characters not suitable for a variable name mapped
  3959. to underscores.
  3960. Previous versions of Autoconf merely checked whether the header was
  3961. accepted by the preprocessor. This was changed because the old test was
  3962. inappropriate for typical uses. Headers are typically used to compile,
  3963. not merely to preprocess, and the old behavior sometimes accepted
  3964. headers that clashed at compile-time (*note Present But Cannot Be
  3965. Compiled::). If you need to check whether a header is preprocessable,
  3966. you can use `AC_PREPROC_IFELSE' (*note Running the Preprocessor::).
  3967. Actually requiring a header to compile improves the robustness of the
  3968. test, but it also requires that you make sure that headers that must be
  3969. included before the HEADER-FILE be part of the INCLUDES, (*note Default
  3970. Includes::). If looking for `bar.h', which requires that `foo.h' be
  3971. included before if it exists, we suggest the following scheme:
  3972. AC_CHECK_HEADERS([foo.h])
  3973. AC_CHECK_HEADERS([bar.h], [], [],
  3974. [#ifdef HAVE_FOO_H
  3975. # include <foo.h>
  3976. #endif
  3977. ])
  3978. The following variant generates smaller, faster `configure' files if
  3979. you do not need the full power of `AC_CHECK_HEADERS'.
  3980. -- Macro: AC_CHECK_HEADERS_ONCE (HEADER-FILE...)
  3981. For each given system header file HEADER-FILE in the
  3982. blank-separated argument list that exists, define
  3983. `HAVE_HEADER-FILE' (in all capitals). This is a once-only variant
  3984. of `AC_CHECK_HEADERS'. It generates the checking code at most
  3985. once, so that `configure' is smaller and faster; but the checks
  3986. cannot be conditionalized and are always done once, early during
  3987. the `configure' run. Thus, this macro is only safe for checking
  3988. headers that do not have prerequisites beyond what
  3989. `AC_INCLUDES_DEFAULT' provides.
  3990. 
  3991. File: autoconf.info, Node: Declarations, Next: Structures, Prev: Header Files, Up: Existing Tests
  3992. 5.7 Declarations
  3993. ================
  3994. The following macros check for the declaration of variables and
  3995. functions. If there is no macro specifically defined to check for a
  3996. symbol you need, then you can use the general macros (*note Generic
  3997. Declarations::) or, for more complex tests, you may use
  3998. `AC_COMPILE_IFELSE' (*note Running the Compiler::).
  3999. * Menu:
  4000. * Particular Declarations:: Macros to check for certain declarations
  4001. * Generic Declarations:: How to find other declarations
  4002. 
  4003. File: autoconf.info, Node: Particular Declarations, Next: Generic Declarations, Up: Declarations
  4004. 5.7.1 Particular Declaration Checks
  4005. -----------------------------------
  4006. There are no specific macros for declarations.
  4007. 
  4008. File: autoconf.info, Node: Generic Declarations, Prev: Particular Declarations, Up: Declarations
  4009. 5.7.2 Generic Declaration Checks
  4010. --------------------------------
  4011. These macros are used to find declarations not covered by the
  4012. "particular" test macros.
  4013. -- Macro: AC_CHECK_DECL (SYMBOL, [ACTION-IF-FOUND],
  4014. [ACTION-IF-NOT-FOUND], [INCLUDES = `AC_INCLUDES_DEFAULT'])
  4015. If SYMBOL (a function, variable, or constant) is not declared in
  4016. INCLUDES and a declaration is needed, run the shell commands
  4017. ACTION-IF-NOT-FOUND, otherwise ACTION-IF-FOUND. INCLUDES is a
  4018. series of include directives, defaulting to `AC_INCLUDES_DEFAULT'
  4019. (*note Default Includes::), which are used prior to the
  4020. declaration under test.
  4021. This macro actually tests whether SYMBOL is defined as a macro or
  4022. can be used as an r-value, not whether it is really declared,
  4023. because it is much safer to avoid introducing extra declarations
  4024. when they are not needed. In order to facilitate use of C++ and
  4025. overloaded function declarations, it is possible to specify
  4026. function argument types in parentheses for types which can be
  4027. zero-initialized:
  4028. AC_CHECK_DECL([basename(char *)])
  4029. This macro caches its result in the `ac_cv_have_decl_SYMBOL'
  4030. variable, with characters not suitable for a variable name mapped
  4031. to underscores.
  4032. -- Macro: AC_CHECK_DECLS (SYMBOLS, [ACTION-IF-FOUND],
  4033. [ACTION-IF-NOT-FOUND], [INCLUDES = `AC_INCLUDES_DEFAULT'])
  4034. For each of the SYMBOLS (_comma_-separated list with optional
  4035. function argument types for C++ overloads), define
  4036. `HAVE_DECL_SYMBOL' (in all capitals) to `1' if SYMBOL is declared,
  4037. otherwise to `0'. If ACTION-IF-NOT-FOUND is given, it is
  4038. additional shell code to execute when one of the function
  4039. declarations is needed, otherwise ACTION-IF-FOUND is executed.
  4040. INCLUDES is a series of include directives, defaulting to
  4041. `AC_INCLUDES_DEFAULT' (*note Default Includes::), which are used
  4042. prior to the declarations under test.
  4043. This macro uses an M4 list as first argument:
  4044. AC_CHECK_DECLS([strdup])
  4045. AC_CHECK_DECLS([strlen])
  4046. AC_CHECK_DECLS([malloc, realloc, calloc, free])
  4047. AC_CHECK_DECLS([j0], [], [], [[#include <math.h>]])
  4048. AC_CHECK_DECLS([[basename(char *)], [dirname(char *)]])
  4049. Unlike the other `AC_CHECK_*S' macros, when a SYMBOL is not
  4050. declared, `HAVE_DECL_SYMBOL' is defined to `0' instead of leaving
  4051. `HAVE_DECL_SYMBOL' undeclared. When you are _sure_ that the check
  4052. was performed, use `HAVE_DECL_SYMBOL' in `#if':
  4053. #if !HAVE_DECL_SYMBOL
  4054. extern char *symbol;
  4055. #endif
  4056. If the test may have not been performed, however, because it is
  4057. safer _not_ to declare a symbol than to use a declaration that
  4058. conflicts with the system's one, you should use:
  4059. #if defined HAVE_DECL_MALLOC && !HAVE_DECL_MALLOC
  4060. void *malloc (size_t *s);
  4061. #endif
  4062. You fall into the second category only in extreme situations:
  4063. either your files may be used without being configured, or they
  4064. are used during the configuration. In most cases the traditional
  4065. approach is enough.
  4066. This macro caches its results in `ac_cv_have_decl_SYMBOL'
  4067. variables, with characters not suitable for a variable name mapped
  4068. to underscores.
  4069. -- Macro: AC_CHECK_DECLS_ONCE (SYMBOLS)
  4070. For each of the SYMBOLS (_comma_-separated list), define
  4071. `HAVE_DECL_SYMBOL' (in all capitals) to `1' if SYMBOL is declared
  4072. in the default include files, otherwise to `0'. This is a
  4073. once-only variant of `AC_CHECK_DECLS'. It generates the checking
  4074. code at most once, so that `configure' is smaller and faster; but
  4075. the checks cannot be conditionalized and are always done once,
  4076. early during the `configure' run.
  4077. 
  4078. File: autoconf.info, Node: Structures, Next: Types, Prev: Declarations, Up: Existing Tests
  4079. 5.8 Structures
  4080. ==============
  4081. The following macros check for the presence of certain members in C
  4082. structures. If there is no macro specifically defined to check for a
  4083. member you need, then you can use the general structure-member macros
  4084. (*note Generic Structures::) or, for more complex tests, you may use
  4085. `AC_COMPILE_IFELSE' (*note Running the Compiler::).
  4086. * Menu:
  4087. * Particular Structures:: Macros to check for certain structure members
  4088. * Generic Structures:: How to find other structure members
  4089. 
  4090. File: autoconf.info, Node: Particular Structures, Next: Generic Structures, Up: Structures
  4091. 5.8.1 Particular Structure Checks
  4092. ---------------------------------
  4093. The following macros check for certain structures or structure members.
  4094. -- Macro: AC_STRUCT_DIRENT_D_INO
  4095. Perform all the actions of `AC_HEADER_DIRENT' (*note Particular
  4096. Headers::). Then, if `struct dirent' contains a `d_ino' member,
  4097. define `HAVE_STRUCT_DIRENT_D_INO'.
  4098. `HAVE_STRUCT_DIRENT_D_INO' indicates only the presence of `d_ino',
  4099. not whether its contents are always reliable. Traditionally, a
  4100. zero `d_ino' indicated a deleted directory entry, though current
  4101. systems hide this detail from the user and never return zero
  4102. `d_ino' values. Many current systems report an incorrect `d_ino'
  4103. for a directory entry that is a mount point.
  4104. -- Macro: AC_STRUCT_DIRENT_D_TYPE
  4105. Perform all the actions of `AC_HEADER_DIRENT' (*note Particular
  4106. Headers::). Then, if `struct dirent' contains a `d_type' member,
  4107. define `HAVE_STRUCT_DIRENT_D_TYPE'.
  4108. -- Macro: AC_STRUCT_ST_BLOCKS
  4109. If `struct stat' contains an `st_blocks' member, define
  4110. `HAVE_STRUCT_STAT_ST_BLOCKS'. Otherwise, require an `AC_LIBOBJ'
  4111. replacement of `fileblocks'. The former name, `HAVE_ST_BLOCKS' is
  4112. to be avoided, as its support will cease in the future.
  4113. This macro caches its result in the
  4114. `ac_cv_member_struct_stat_st_blocks' variable.
  4115. -- Macro: AC_STRUCT_TM
  4116. If `time.h' does not define `struct tm', define `TM_IN_SYS_TIME',
  4117. which means that including `sys/time.h' had better define `struct
  4118. tm'.
  4119. This macro is obsolescent, as `time.h' defines `struct tm' in
  4120. current systems. New programs need not use this macro.
  4121. -- Macro: AC_STRUCT_TIMEZONE
  4122. Figure out how to get the current timezone. If `struct tm' has a
  4123. `tm_zone' member, define `HAVE_STRUCT_TM_TM_ZONE' (and the
  4124. obsoleted `HAVE_TM_ZONE'). Otherwise, if the external array
  4125. `tzname' is found, define `HAVE_TZNAME'; if it is declared, define
  4126. `HAVE_DECL_TZNAME'.
  4127. 
  4128. File: autoconf.info, Node: Generic Structures, Prev: Particular Structures, Up: Structures
  4129. 5.8.2 Generic Structure Checks
  4130. ------------------------------
  4131. These macros are used to find structure members not covered by the
  4132. "particular" test macros.
  4133. -- Macro: AC_CHECK_MEMBER (AGGREGATE.MEMBER, [ACTION-IF-FOUND],
  4134. [ACTION-IF-NOT-FOUND], [INCLUDES = `AC_INCLUDES_DEFAULT'])
  4135. Check whether MEMBER is a member of the aggregate AGGREGATE. If
  4136. no INCLUDES are specified, the default includes are used (*note
  4137. Default Includes::).
  4138. AC_CHECK_MEMBER([struct passwd.pw_gecos], [],
  4139. [AC_MSG_ERROR([we need `passwd.pw_gecos'])],
  4140. [[#include <pwd.h>]])
  4141. You can use this macro for submembers:
  4142. AC_CHECK_MEMBER(struct top.middle.bot)
  4143. This macro caches its result in the
  4144. `ac_cv_member_AGGREGATE_MEMBER' variable, with characters not
  4145. suitable for a variable name mapped to underscores.
  4146. -- Macro: AC_CHECK_MEMBERS (MEMBERS, [ACTION-IF-FOUND],
  4147. [ACTION-IF-NOT-FOUND], [INCLUDES = `AC_INCLUDES_DEFAULT'])
  4148. Check for the existence of each `AGGREGATE.MEMBER' of MEMBERS
  4149. using the previous macro. When MEMBER belongs to AGGREGATE,
  4150. define `HAVE_AGGREGATE_MEMBER' (in all capitals, with spaces and
  4151. dots replaced by underscores). If ACTION-IF-FOUND is given, it is
  4152. executed for each of the found members. If ACTION-IF-NOT-FOUND is
  4153. given, it is executed for each of the members that could not be
  4154. found.
  4155. INCLUDES is a series of include directives, defaulting to
  4156. `AC_INCLUDES_DEFAULT' (*note Default Includes::), which are used
  4157. prior to the members under test.
  4158. This macro uses M4 lists:
  4159. AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blksize])
  4160. 
  4161. File: autoconf.info, Node: Types, Next: Compilers and Preprocessors, Prev: Structures, Up: Existing Tests
  4162. 5.9 Types
  4163. =========
  4164. The following macros check for C types, either builtin or typedefs. If
  4165. there is no macro specifically defined to check for a type you need, and
  4166. you don't need to check for any special properties of it, then you can
  4167. use a general type-check macro.
  4168. * Menu:
  4169. * Particular Types:: Special handling to find certain types
  4170. * Generic Types:: How to find other types
  4171. 
  4172. File: autoconf.info, Node: Particular Types, Next: Generic Types, Up: Types
  4173. 5.9.1 Particular Type Checks
  4174. ----------------------------
  4175. These macros check for particular C types in `sys/types.h', `stdlib.h',
  4176. `stdint.h', `inttypes.h' and others, if they exist.
  4177. The Gnulib `stdint' module is an alternate way to define many of
  4178. these symbols; it is useful if you prefer your code to assume a
  4179. C99-or-better environment. *Note Gnulib::.
  4180. -- Macro: AC_TYPE_GETGROUPS
  4181. Define `GETGROUPS_T' to be whichever of `gid_t' or `int' is the
  4182. base type of the array argument to `getgroups'.
  4183. This macro caches the base type in the `ac_cv_type_getgroups'
  4184. variable.
  4185. -- Macro: AC_TYPE_INT8_T
  4186. If `stdint.h' or `inttypes.h' does not define the type `int8_t',
  4187. define `int8_t' to a signed integer type that is exactly 8 bits
  4188. wide and that uses two's complement representation, if such a type
  4189. exists. If you are worried about porting to hosts that lack such
  4190. a type, you can use the results of this macro in C89-or-later code
  4191. as follows:
  4192. #if HAVE_STDINT_H
  4193. # include <stdint.h>
  4194. #endif
  4195. #if defined INT8_MAX || defined int8_t
  4196. _code using int8_t_
  4197. #else
  4198. _complicated alternative using >8-bit 'signed char'_
  4199. #endif
  4200. This macro caches the type in the `ac_cv_c_int8_t' variable.
  4201. -- Macro: AC_TYPE_INT16_T
  4202. This is like `AC_TYPE_INT8_T', except for 16-bit integers.
  4203. -- Macro: AC_TYPE_INT32_T
  4204. This is like `AC_TYPE_INT8_T', except for 32-bit integers.
  4205. -- Macro: AC_TYPE_INT64_T
  4206. This is like `AC_TYPE_INT8_T', except for 64-bit integers.
  4207. -- Macro: AC_TYPE_INTMAX_T
  4208. If `stdint.h' or `inttypes.h' defines the type `intmax_t', define
  4209. `HAVE_INTMAX_T'. Otherwise, define `intmax_t' to the widest
  4210. signed integer type.
  4211. -- Macro: AC_TYPE_INTPTR_T
  4212. If `stdint.h' or `inttypes.h' defines the type `intptr_t', define
  4213. `HAVE_INTPTR_T'. Otherwise, define `intptr_t' to a signed integer
  4214. type wide enough to hold a pointer, if such a type exists.
  4215. -- Macro: AC_TYPE_LONG_DOUBLE
  4216. If the C compiler supports a working `long double' type, define
  4217. `HAVE_LONG_DOUBLE'. The `long double' type might have the same
  4218. range and precision as `double'.
  4219. This macro caches its result in the `ac_cv_type_long_double'
  4220. variable.
  4221. This macro is obsolescent, as current C compilers support `long
  4222. double'. New programs need not use this macro.
  4223. -- Macro: AC_TYPE_LONG_DOUBLE_WIDER
  4224. If the C compiler supports a working `long double' type with more
  4225. range or precision than the `double' type, define
  4226. `HAVE_LONG_DOUBLE_WIDER'.
  4227. This macro caches its result in the `ac_cv_type_long_double_wider'
  4228. variable.
  4229. -- Macro: AC_TYPE_LONG_LONG_INT
  4230. If the C compiler supports a working `long long int' type, define
  4231. `HAVE_LONG_LONG_INT'. However, this test does not test `long long
  4232. int' values in preprocessor `#if' expressions, because too many
  4233. compilers mishandle such expressions. *Note Preprocessor
  4234. Arithmetic::.
  4235. This macro caches its result in the `ac_cv_type_long_long_int'
  4236. variable.
  4237. -- Macro: AC_TYPE_MBSTATE_T
  4238. Define `HAVE_MBSTATE_T' if `<wchar.h>' declares the `mbstate_t'
  4239. type. Also, define `mbstate_t' to be a type if `<wchar.h>' does
  4240. not declare it.
  4241. This macro caches its result in the `ac_cv_type_mbstate_t'
  4242. variable.
  4243. -- Macro: AC_TYPE_MODE_T
  4244. Define `mode_t' to a suitable type, if standard headers do not
  4245. define it.
  4246. This macro caches its result in the `ac_cv_type_mode_t' variable.
  4247. -- Macro: AC_TYPE_OFF_T
  4248. Define `off_t' to a suitable type, if standard headers do not
  4249. define it.
  4250. This macro caches its result in the `ac_cv_type_off_t' variable.
  4251. -- Macro: AC_TYPE_PID_T
  4252. Define `pid_t' to a suitable type, if standard headers do not
  4253. define it.
  4254. This macro caches its result in the `ac_cv_type_pid_t' variable.
  4255. -- Macro: AC_TYPE_SIZE_T
  4256. Define `size_t' to a suitable type, if standard headers do not
  4257. define it.
  4258. This macro caches its result in the `ac_cv_type_size_t' variable.
  4259. -- Macro: AC_TYPE_SSIZE_T
  4260. Define `ssize_t' to a suitable type, if standard headers do not
  4261. define it.
  4262. This macro caches its result in the `ac_cv_type_ssize_t' variable.
  4263. -- Macro: AC_TYPE_UID_T
  4264. Define `uid_t' and `gid_t' to suitable types, if standard headers
  4265. do not define them.
  4266. This macro caches its result in the `ac_cv_type_uid_t' variable.
  4267. -- Macro: AC_TYPE_UINT8_T
  4268. If `stdint.h' or `inttypes.h' does not define the type `uint8_t',
  4269. define `uint8_t' to an unsigned integer type that is exactly 8
  4270. bits wide, if such a type exists. This is like `AC_TYPE_INT8_T',
  4271. except for unsigned integers.
  4272. -- Macro: AC_TYPE_UINT16_T
  4273. This is like `AC_TYPE_UINT8_T', except for 16-bit integers.
  4274. -- Macro: AC_TYPE_UINT32_T
  4275. This is like `AC_TYPE_UINT8_T', except for 32-bit integers.
  4276. -- Macro: AC_TYPE_UINT64_T
  4277. This is like `AC_TYPE_UINT8_T', except for 64-bit integers.
  4278. -- Macro: AC_TYPE_UINTMAX_T
  4279. If `stdint.h' or `inttypes.h' defines the type `uintmax_t', define
  4280. `HAVE_UINTMAX_T'. Otherwise, define `uintmax_t' to the widest
  4281. unsigned integer type.
  4282. -- Macro: AC_TYPE_UINTPTR_T
  4283. If `stdint.h' or `inttypes.h' defines the type `uintptr_t', define
  4284. `HAVE_UINTPTR_T'. Otherwise, define `uintptr_t' to an unsigned
  4285. integer type wide enough to hold a pointer, if such a type exists.
  4286. -- Macro: AC_TYPE_UNSIGNED_LONG_LONG_INT
  4287. If the C compiler supports a working `unsigned long long int' type,
  4288. define `HAVE_UNSIGNED_LONG_LONG_INT'. However, this test does not
  4289. test `unsigned long long int' values in preprocessor `#if'
  4290. expressions, because too many compilers mishandle such expressions.
  4291. *Note Preprocessor Arithmetic::.
  4292. This macro caches its result in the
  4293. `ac_cv_type_unsigned_long_long_int' variable.
  4294. 
  4295. File: autoconf.info, Node: Generic Types, Prev: Particular Types, Up: Types
  4296. 5.9.2 Generic Type Checks
  4297. -------------------------
  4298. These macros are used to check for types not covered by the "particular"
  4299. test macros.
  4300. -- Macro: AC_CHECK_TYPE (TYPE, [ACTION-IF-FOUND],
  4301. [ACTION-IF-NOT-FOUND], [INCLUDES = `AC_INCLUDES_DEFAULT'])
  4302. Check whether TYPE is defined. It may be a compiler builtin type
  4303. or defined by the INCLUDES. INCLUDES is a series of include
  4304. directives, defaulting to `AC_INCLUDES_DEFAULT' (*note Default
  4305. Includes::), which are used prior to the type under test.
  4306. In C, TYPE must be a type-name, so that the expression `sizeof
  4307. (TYPE)' is valid (but `sizeof ((TYPE))' is not). The same test is
  4308. applied when compiling for C++, which means that in C++ TYPE
  4309. should be a type-id and should not be an anonymous `struct' or
  4310. `union'.
  4311. This macro caches its result in the `ac_cv_type_TYPE' variable,
  4312. with `*' mapped to `p' and other characters not suitable for a
  4313. variable name mapped to underscores.
  4314. -- Macro: AC_CHECK_TYPES (TYPES, [ACTION-IF-FOUND],
  4315. [ACTION-IF-NOT-FOUND], [INCLUDES = `AC_INCLUDES_DEFAULT'])
  4316. For each TYPE of the TYPES that is defined, define `HAVE_TYPE' (in
  4317. all capitals). Each TYPE must follow the rules of
  4318. `AC_CHECK_TYPE'. If no INCLUDES are specified, the default
  4319. includes are used (*note Default Includes::). If ACTION-IF-FOUND
  4320. is given, it is additional shell code to execute when one of the
  4321. types is found. If ACTION-IF-NOT-FOUND is given, it is executed
  4322. when one of the types is not found.
  4323. This macro uses M4 lists:
  4324. AC_CHECK_TYPES([ptrdiff_t])
  4325. AC_CHECK_TYPES([unsigned long long int, uintmax_t])
  4326. AC_CHECK_TYPES([float_t], [], [], [[#include <math.h>]])
  4327. Autoconf, up to 2.13, used to provide to another version of
  4328. `AC_CHECK_TYPE', broken by design. In order to keep backward
  4329. compatibility, a simple heuristic, quite safe but not totally, is
  4330. implemented. In case of doubt, read the documentation of the former
  4331. `AC_CHECK_TYPE', see *note Obsolete Macros::.
  4332. 
  4333. File: autoconf.info, Node: Compilers and Preprocessors, Next: System Services, Prev: Types, Up: Existing Tests
  4334. 5.10 Compilers and Preprocessors
  4335. ================================
  4336. All the tests for compilers (`AC_PROG_CC', `AC_PROG_CXX',
  4337. `AC_PROG_F77') define the output variable `EXEEXT' based on the output
  4338. of the compiler, typically to the empty string if Posix and `.exe' if a
  4339. DOS variant.
  4340. They also define the output variable `OBJEXT' based on the output of
  4341. the compiler, after `.c' files have been excluded, typically to `o' if
  4342. Posix, `obj' if a DOS variant.
  4343. If the compiler being used does not produce executables, the tests
  4344. fail. If the executables can't be run, and cross-compilation is not
  4345. enabled, they fail too. *Note Manual Configuration::, for more on
  4346. support for cross compiling.
  4347. * Menu:
  4348. * Specific Compiler Characteristics:: Some portability issues
  4349. * Generic Compiler Characteristics:: Language independent tests and features
  4350. * C Compiler:: Checking its characteristics
  4351. * C++ Compiler:: Likewise
  4352. * Objective C Compiler:: Likewise
  4353. * Objective C++ Compiler:: Likewise
  4354. * Erlang Compiler and Interpreter:: Likewise
  4355. * Fortran Compiler:: Likewise
  4356. * Go Compiler:: Likewise
  4357. 
  4358. File: autoconf.info, Node: Specific Compiler Characteristics, Next: Generic Compiler Characteristics, Up: Compilers and Preprocessors
  4359. 5.10.1 Specific Compiler Characteristics
  4360. ----------------------------------------
  4361. Some compilers exhibit different behaviors.
  4362. Static/Dynamic Expressions
  4363. Autoconf relies on a trick to extract one bit of information from
  4364. the C compiler: using negative array sizes. For instance the
  4365. following excerpt of a C source demonstrates how to test whether
  4366. `int' objects are 4 bytes wide:
  4367. static int test_array[sizeof (int) == 4 ? 1 : -1];
  4368. To our knowledge, there is a single compiler that does not support
  4369. this trick: the HP C compilers (the real ones, not only the
  4370. "bundled") on HP-UX 11.00. They incorrectly reject the above
  4371. program with the diagnostic "Variable-length arrays cannot have
  4372. static storage." This bug comes from HP compilers' mishandling of
  4373. `sizeof (int)', not from the `? 1 : -1', and Autoconf works around
  4374. this problem by casting `sizeof (int)' to `long int' before
  4375. comparing it.
  4376. 
  4377. File: autoconf.info, Node: Generic Compiler Characteristics, Next: C Compiler, Prev: Specific Compiler Characteristics, Up: Compilers and Preprocessors
  4378. 5.10.2 Generic Compiler Characteristics
  4379. ---------------------------------------
  4380. -- Macro: AC_CHECK_SIZEOF (TYPE-OR-EXPR, [UNUSED], [INCLUDES =
  4381. `AC_INCLUDES_DEFAULT'])
  4382. Define `SIZEOF_TYPE-OR-EXPR' (*note Standard Symbols::) to be the
  4383. size in bytes of TYPE-OR-EXPR, which may be either a type or an
  4384. expression returning a value that has a size. If the expression
  4385. `sizeof (TYPE-OR-EXPR)' is invalid, the result is 0. INCLUDES is
  4386. a series of include directives, defaulting to
  4387. `AC_INCLUDES_DEFAULT' (*note Default Includes::), which are used
  4388. prior to the expression under test.
  4389. This macro now works even when cross-compiling. The UNUSED
  4390. argument was used when cross-compiling.
  4391. For example, the call
  4392. AC_CHECK_SIZEOF([int *])
  4393. defines `SIZEOF_INT_P' to be 8 on DEC Alpha AXP systems.
  4394. This macro caches its result in the `ac_cv_sizeof_TYPE-OR-EXPR'
  4395. variable, with `*' mapped to `p' and other characters not suitable
  4396. for a variable name mapped to underscores.
  4397. -- Macro: AC_CHECK_ALIGNOF (TYPE, [INCLUDES = `AC_INCLUDES_DEFAULT'])
  4398. Define `ALIGNOF_TYPE' (*note Standard Symbols::) to be the
  4399. alignment in bytes of TYPE. `TYPE y;' must be valid as a
  4400. structure member declaration. If `type' is unknown, the result is
  4401. 0. If no INCLUDES are specified, the default includes are used
  4402. (*note Default Includes::).
  4403. This macro caches its result in the `ac_cv_alignof_TYPE-OR-EXPR'
  4404. variable, with `*' mapped to `p' and other characters not suitable
  4405. for a variable name mapped to underscores.
  4406. -- Macro: AC_COMPUTE_INT (VAR, EXPRESSION, [INCLUDES =
  4407. `AC_INCLUDES_DEFAULT'], [ACTION-IF-FAILS])
  4408. Store into the shell variable VAR the value of the integer
  4409. EXPRESSION. The value should fit in an initializer in a C
  4410. variable of type `signed long'. To support cross compilation (in
  4411. which case, the macro only works on hosts that use twos-complement
  4412. arithmetic), it should be possible to evaluate the expression at
  4413. compile-time. If no INCLUDES are specified, the default includes
  4414. are used (*note Default Includes::).
  4415. Execute ACTION-IF-FAILS if the value cannot be determined
  4416. correctly.
  4417. -- Macro: AC_LANG_WERROR
  4418. Normally Autoconf ignores warnings generated by the compiler,
  4419. linker, and preprocessor. If this macro is used, warnings count
  4420. as fatal errors for the current language. This macro is useful
  4421. when the results of configuration are used where warnings are
  4422. unacceptable; for instance, if parts of a program are built with
  4423. the GCC `-Werror' option. If the whole program is built using
  4424. `-Werror' it is often simpler to put `-Werror' in the compiler
  4425. flags (`CFLAGS', etc.).
  4426. -- Macro: AC_OPENMP
  4427. OpenMP (http://www.openmp.org/) specifies extensions of C, C++,
  4428. and Fortran that simplify optimization of shared memory
  4429. parallelism, which is a common problem on multicore CPUs.
  4430. If the current language is C, the macro `AC_OPENMP' sets the
  4431. variable `OPENMP_CFLAGS' to the C compiler flags needed for
  4432. supporting OpenMP. `OPENMP_CFLAGS' is set to empty if the
  4433. compiler already supports OpenMP, if it has no way to activate
  4434. OpenMP support, or if the user rejects OpenMP support by invoking
  4435. `configure' with the `--disable-openmp' option.
  4436. `OPENMP_CFLAGS' needs to be used when compiling programs, when
  4437. preprocessing program source, and when linking programs.
  4438. Therefore you need to add `$(OPENMP_CFLAGS)' to the `CFLAGS' of C
  4439. programs that use OpenMP. If you preprocess OpenMP-specific C
  4440. code, you also need to add `$(OPENMP_CFLAGS)' to `CPPFLAGS'. The
  4441. presence of OpenMP support is revealed at compile time by the
  4442. preprocessor macro `_OPENMP'.
  4443. Linking a program with `OPENMP_CFLAGS' typically adds one more
  4444. shared library to the program's dependencies, so its use is
  4445. recommended only on programs that actually require OpenMP.
  4446. If the current language is C++, `AC_OPENMP' sets the variable
  4447. `OPENMP_CXXFLAGS', suitably for the C++ compiler. The same remarks
  4448. hold as for C.
  4449. If the current language is Fortran 77 or Fortran, `AC_OPENMP' sets
  4450. the variable `OPENMP_FFLAGS' or `OPENMP_FCFLAGS', respectively.
  4451. Similar remarks as for C hold, except that `CPPFLAGS' is not used
  4452. for Fortran, and no preprocessor macro signals OpenMP support.
  4453. For portability, it is best to avoid spaces between `#' and
  4454. `pragma omp'. That is, write `#pragma omp', not `# pragma omp'.
  4455. The Sun WorkShop 6.2 C compiler chokes on the latter.
  4456. This macro caches its result in the `ac_cv_prog_c_openmp',
  4457. `ac_cv_prog_cxx_openmp', `ac_cv_prog_f77_openmp', or
  4458. `ac_cv_prog_fc_openmp' variable, depending on the current language.
  4459. 
  4460. File: autoconf.info, Node: C Compiler, Next: C++ Compiler, Prev: Generic Compiler Characteristics, Up: Compilers and Preprocessors
  4461. 5.10.3 C Compiler Characteristics
  4462. ---------------------------------
  4463. The following macros provide ways to find and exercise a C Compiler.
  4464. There are a few constructs that ought to be avoided, but do not deserve
  4465. being checked for, since they can easily be worked around.
  4466. Don't use lines containing solitary backslashes
  4467. They tickle a bug in the HP-UX C compiler (checked on HP-UX 10.20,
  4468. 11.00, and 11i). When given the following source:
  4469. #ifdef __STDC__
  4470. /\
  4471. * A comment with backslash-newlines in it. %{ %} *\
  4472. \
  4473. /
  4474. char str[] = "\\
  4475. " A string with backslash-newlines in it %{ %} \\
  4476. "";
  4477. char apostrophe = '\\
  4478. \
  4479. '\
  4480. ';
  4481. #endif
  4482. the compiler incorrectly fails with the diagnostics
  4483. "Non-terminating comment at end of file" and "Missing `#endif' at
  4484. end of file." Removing the lines with solitary backslashes solves
  4485. the problem.
  4486. Don't compile several files at once if output matters to you
  4487. Some compilers, such as HP's, report names of files being compiled
  4488. when given more than one file operand. For instance:
  4489. $ cc a.c b.c
  4490. a.c:
  4491. b.c:
  4492. This can cause problems if you observe the output of the compiler
  4493. to detect failures. Invoking `cc -c a.c && cc -c b.c && cc -o c
  4494. a.o b.o' solves the issue.
  4495. Don't rely on `#error' failing
  4496. The IRIX C compiler does not fail when #error is preprocessed; it
  4497. simply emits a diagnostic and continues, exiting successfully. So,
  4498. instead of an error directive like `#error "Unsupported word size"'
  4499. it is more portable to use an invalid directive like `#Unsupported
  4500. word size' in Autoconf tests. In ordinary source code, `#error' is
  4501. OK, since installers with inadequate compilers like IRIX can simply
  4502. examine these compilers' diagnostic output.
  4503. Don't rely on correct `#line' support
  4504. On Solaris, `c89' (at least Sun C 5.3 through 5.8) diagnoses
  4505. `#line' directives whose line numbers are greater than 32767.
  4506. Nothing in Posix makes this invalid. That is why Autoconf stopped
  4507. issuing `#line' directives.
  4508. -- Macro: AC_PROG_CC ([COMPILER-SEARCH-LIST])
  4509. Determine a C compiler to use. If `CC' is not already set in the
  4510. environment, check for `gcc' and `cc', then for other C compilers.
  4511. Set output variable `CC' to the name of the compiler found.
  4512. This macro may, however, be invoked with an optional first argument
  4513. which, if specified, must be a blank-separated list of C compilers
  4514. to search for. This just gives the user an opportunity to specify
  4515. an alternative search list for the C compiler. For example, if
  4516. you didn't like the default order, then you could invoke
  4517. `AC_PROG_CC' like this:
  4518. AC_PROG_CC([gcc cl cc])
  4519. If the C compiler does not handle function prototypes correctly by
  4520. default, try to add an option to output variable `CC' to make it
  4521. so. This macro tries various options that select
  4522. standard-conformance modes on various systems.
  4523. After calling this macro you can check whether the C compiler has
  4524. been set to accept ANSI C89 (ISO C90); if not, the shell variable
  4525. `ac_cv_prog_cc_c89' is set to `no'. See also `AC_C_PROTOTYPES'
  4526. below.
  4527. If using the GNU C compiler, set shell variable `GCC' to `yes'.
  4528. If output variable `CFLAGS' was not already set, set it to `-g
  4529. -O2' for the GNU C compiler (`-O2' on systems where GCC does not
  4530. accept `-g'), or `-g' for other compilers. If your package does
  4531. not like this default, then it is acceptable to insert the line `:
  4532. ${CFLAGS=""}' after `AC_INIT' and before `AC_PROG_CC' to select an
  4533. empty default instead.
  4534. Many Autoconf macros use a compiler, and thus call
  4535. `AC_REQUIRE([AC_PROG_CC])' to ensure that the compiler has been
  4536. determined before the body of the outermost `AC_DEFUN' macro.
  4537. Although `AC_PROG_CC' is safe to directly expand multiple times, it
  4538. performs certain checks (such as the proper value of `EXEEXT') only
  4539. on the first invocation. Therefore, care must be used when
  4540. invoking this macro from within another macro rather than at the
  4541. top level (*note Expanded Before Required::).
  4542. -- Macro: AC_PROG_CC_C_O
  4543. If the C compiler does not accept the `-c' and `-o' options
  4544. simultaneously, define `NO_MINUS_C_MINUS_O'. This macro actually
  4545. tests both the compiler found by `AC_PROG_CC', and, if different,
  4546. the first `cc' in the path. The test fails if one fails. This
  4547. macro was created for GNU Make to choose the default C compilation
  4548. rule.
  4549. For the compiler COMPILER, this macro caches its result in the
  4550. `ac_cv_prog_cc_COMPILER_c_o' variable.
  4551. -- Macro: AC_PROG_CPP
  4552. Set output variable `CPP' to a command that runs the C
  4553. preprocessor. If `$CC -E' doesn't work, `/lib/cpp' is used. It
  4554. is only portable to run `CPP' on files with a `.c' extension.
  4555. Some preprocessors don't indicate missing include files by the
  4556. error status. For such preprocessors an internal variable is set
  4557. that causes other macros to check the standard error from the
  4558. preprocessor and consider the test failed if any warnings have
  4559. been reported. For most preprocessors, though, warnings do not
  4560. cause include-file tests to fail unless `AC_PROG_CPP_WERROR' is
  4561. also specified.
  4562. -- Macro: AC_PROG_CPP_WERROR
  4563. This acts like `AC_PROG_CPP', except it treats warnings from the
  4564. preprocessor as errors even if the preprocessor exit status
  4565. indicates success. This is useful for avoiding headers that
  4566. generate mandatory warnings, such as deprecation notices.
  4567. The following macros check for C compiler or machine architecture
  4568. features. To check for characteristics not listed here, use
  4569. `AC_COMPILE_IFELSE' (*note Running the Compiler::) or `AC_RUN_IFELSE'
  4570. (*note Runtime::).
  4571. -- Macro: AC_PROG_CC_STDC
  4572. If the C compiler cannot compile ISO Standard C (currently C99),
  4573. try to add an option to output variable `CC' to make it work. If
  4574. the compiler does not support C99, fall back to supporting ANSI
  4575. C89 (ISO C90).
  4576. After calling this macro you can check whether the C compiler has
  4577. been set to accept Standard C; if not, the shell variable
  4578. `ac_cv_prog_cc_stdc' is set to `no'.
  4579. -- Macro: AC_PROG_CC_C89
  4580. If the C compiler is not in ANSI C89 (ISO C90) mode by default,
  4581. try to add an option to output variable `CC' to make it so. This
  4582. macro tries various options that select ANSI C89 on some system or
  4583. another, preferring extended functionality modes over strict
  4584. conformance modes. It considers the compiler to be in ANSI C89
  4585. mode if it handles function prototypes correctly.
  4586. After calling this macro you can check whether the C compiler has
  4587. been set to accept ANSI C89; if not, the shell variable
  4588. `ac_cv_prog_cc_c89' is set to `no'.
  4589. This macro is called automatically by `AC_PROG_CC'.
  4590. -- Macro: AC_PROG_CC_C99
  4591. If the C compiler is not in C99 mode by default, try to add an
  4592. option to output variable `CC' to make it so. This macro tries
  4593. various options that select C99 on some system or another,
  4594. preferring extended functionality modes over strict conformance
  4595. modes. It considers the compiler to be in C99 mode if it handles
  4596. `_Bool', `//' comments, flexible array members, `inline', signed
  4597. and unsigned `long long int', mixed code and declarations, named
  4598. initialization of structs, `restrict', `va_copy', varargs macros,
  4599. variable declarations in `for' loops, and variable length arrays.
  4600. After calling this macro you can check whether the C compiler has
  4601. been set to accept C99; if not, the shell variable
  4602. `ac_cv_prog_cc_c99' is set to `no'.
  4603. -- Macro: AC_C_BACKSLASH_A
  4604. Define `HAVE_C_BACKSLASH_A' to 1 if the C compiler understands
  4605. `\a'.
  4606. This macro is obsolescent, as current C compilers understand `\a'.
  4607. New programs need not use this macro.
  4608. -- Macro: AC_C_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE],
  4609. [ACTION-IF-UNKNOWN], [ACTION-IF-UNIVERSAL])
  4610. If words are stored with the most significant byte first (like
  4611. Motorola and SPARC CPUs), execute ACTION-IF-TRUE. If words are
  4612. stored with the least significant byte first (like Intel and VAX
  4613. CPUs), execute ACTION-IF-FALSE.
  4614. This macro runs a test-case if endianness cannot be determined
  4615. from the system header files. When cross-compiling, the test-case
  4616. is not run but grep'ed for some magic values. ACTION-IF-UNKNOWN
  4617. is executed if the latter case fails to determine the byte sex of
  4618. the host system.
  4619. In some cases a single run of a compiler can generate code for
  4620. multiple architectures. This can happen, for example, when
  4621. generating Mac OS X universal binary files, which work on both
  4622. PowerPC and Intel architectures. In this case, the different
  4623. variants might be for different architectures whose endiannesses
  4624. differ. If `configure' detects this, it executes
  4625. ACTION-IF-UNIVERSAL instead of ACTION-IF-UNKNOWN.
  4626. The default for ACTION-IF-TRUE is to define `WORDS_BIGENDIAN'.
  4627. The default for ACTION-IF-FALSE is to do nothing. The default for
  4628. ACTION-IF-UNKNOWN is to abort configure and tell the installer how
  4629. to bypass this test. And finally, the default for
  4630. ACTION-IF-UNIVERSAL is to ensure that `WORDS_BIGENDIAN' is defined
  4631. if and only if a universal build is detected and the current code
  4632. is big-endian; this default works only if `autoheader' is used
  4633. (*note autoheader Invocation::).
  4634. If you use this macro without specifying ACTION-IF-UNIVERSAL, you
  4635. should also use `AC_CONFIG_HEADERS'; otherwise `WORDS_BIGENDIAN'
  4636. may be set incorrectly for Mac OS X universal binary files.
  4637. -- Macro: AC_C_CONST
  4638. If the C compiler does not fully support the `const' keyword,
  4639. define `const' to be empty. Some C compilers that do not define
  4640. `__STDC__' do support `const'; some compilers that define
  4641. `__STDC__' do not completely support `const'. Programs can simply
  4642. use `const' as if every C compiler supported it; for those that
  4643. don't, the makefile or configuration header file defines it as
  4644. empty.
  4645. Occasionally installers use a C++ compiler to compile C code,
  4646. typically because they lack a C compiler. This causes problems
  4647. with `const', because C and C++ treat `const' differently. For
  4648. example:
  4649. const int foo;
  4650. is valid in C but not in C++. These differences unfortunately
  4651. cannot be papered over by defining `const' to be empty.
  4652. If `autoconf' detects this situation, it leaves `const' alone, as
  4653. this generally yields better results in practice. However, using a
  4654. C++ compiler to compile C code is not recommended or supported, and
  4655. installers who run into trouble in this area should get a C
  4656. compiler like GCC to compile their C code.
  4657. This macro caches its result in the `ac_cv_c_const' variable.
  4658. This macro is obsolescent, as current C compilers support `const'.
  4659. New programs need not use this macro.
  4660. -- Macro: AC_C_RESTRICT
  4661. If the C compiler recognizes a variant spelling for the `restrict'
  4662. keyword (`__restrict', `__restrict__', or `_Restrict'), then
  4663. define `restrict' to that; this is more likely to do the right
  4664. thing with compilers that support language variants where plain
  4665. `restrict' is not a keyword. Otherwise, if the C compiler
  4666. recognizes the `restrict' keyword, don't do anything. Otherwise,
  4667. define `restrict' to be empty. Thus, programs may simply use
  4668. `restrict' as if every C compiler supported it; for those that do
  4669. not, the makefile or configuration header defines it away.
  4670. Although support in C++ for the `restrict' keyword is not
  4671. required, several C++ compilers do accept the keyword. This macro
  4672. works for them, too.
  4673. This macro caches `no' in the `ac_cv_c_restrict' variable if
  4674. `restrict' is not supported, and a supported spelling otherwise.
  4675. -- Macro: AC_C_VOLATILE
  4676. If the C compiler does not understand the keyword `volatile',
  4677. define `volatile' to be empty. Programs can simply use `volatile'
  4678. as if every C compiler supported it; for those that do not, the
  4679. makefile or configuration header defines it as empty.
  4680. If the correctness of your program depends on the semantics of
  4681. `volatile', simply defining it to be empty does, in a sense, break
  4682. your code. However, given that the compiler does not support
  4683. `volatile', you are at its mercy anyway. At least your program
  4684. compiles, when it wouldn't before. *Note Volatile Objects::, for
  4685. more about `volatile'.
  4686. In general, the `volatile' keyword is a standard C feature, so you
  4687. might expect that `volatile' is available only when `__STDC__' is
  4688. defined. However, Ultrix 4.3's native compiler does support
  4689. volatile, but does not define `__STDC__'.
  4690. This macro is obsolescent, as current C compilers support
  4691. `volatile'. New programs need not use this macro.
  4692. -- Macro: AC_C_INLINE
  4693. If the C compiler supports the keyword `inline', do nothing.
  4694. Otherwise define `inline' to `__inline__' or `__inline' if it
  4695. accepts one of those, otherwise define `inline' to be empty.
  4696. -- Macro: AC_C_CHAR_UNSIGNED
  4697. If the C type `char' is unsigned, define `__CHAR_UNSIGNED__',
  4698. unless the C compiler predefines it.
  4699. These days, using this macro is not necessary. The same
  4700. information can be determined by this portable alternative, thus
  4701. avoiding the use of preprocessor macros in the namespace reserved
  4702. for the implementation.
  4703. #include <limits.h>
  4704. #if CHAR_MIN == 0
  4705. # define CHAR_UNSIGNED 1
  4706. #endif
  4707. -- Macro: AC_C_STRINGIZE
  4708. If the C preprocessor supports the stringizing operator, define
  4709. `HAVE_STRINGIZE'. The stringizing operator is `#' and is found in
  4710. macros such as this:
  4711. #define x(y) #y
  4712. This macro is obsolescent, as current C compilers support the
  4713. stringizing operator. New programs need not use this macro.
  4714. -- Macro: AC_C_FLEXIBLE_ARRAY_MEMBER
  4715. If the C compiler supports flexible array members, define
  4716. `FLEXIBLE_ARRAY_MEMBER' to nothing; otherwise define it to 1.
  4717. That way, a declaration like this:
  4718. struct s
  4719. {
  4720. size_t n_vals;
  4721. double val[FLEXIBLE_ARRAY_MEMBER];
  4722. };
  4723. will let applications use the "struct hack" even with compilers
  4724. that do not support flexible array members. To allocate and use
  4725. such an object, you can use code like this:
  4726. size_t i;
  4727. size_t n = compute_value_count ();
  4728. struct s *p =
  4729. malloc (offsetof (struct s, val)
  4730. + n * sizeof (double));
  4731. p->n_vals = n;
  4732. for (i = 0; i < n; i++)
  4733. p->val[i] = compute_value (i);
  4734. -- Macro: AC_C_VARARRAYS
  4735. If the C compiler supports variable-length arrays, define
  4736. `HAVE_C_VARARRAYS'. A variable-length array is an array of
  4737. automatic storage duration whose length is determined at run time,
  4738. when the array is declared.
  4739. -- Macro: AC_C_TYPEOF
  4740. If the C compiler supports GCC's `typeof' syntax either directly or
  4741. through a different spelling of the keyword (e.g., `__typeof__'),
  4742. define `HAVE_TYPEOF'. If the support is available only through a
  4743. different spelling, define `typeof' to that spelling.
  4744. -- Macro: AC_C_PROTOTYPES
  4745. If function prototypes are understood by the compiler (as
  4746. determined by `AC_PROG_CC'), define `PROTOTYPES' and
  4747. `__PROTOTYPES'. Defining `__PROTOTYPES' is for the benefit of
  4748. header files that cannot use macros that infringe on user name
  4749. space.
  4750. This macro is obsolescent, as current C compilers support
  4751. prototypes. New programs need not use this macro.
  4752. -- Macro: AC_PROG_GCC_TRADITIONAL
  4753. Add `-traditional' to output variable `CC' if using the GNU C
  4754. compiler and `ioctl' does not work properly without
  4755. `-traditional'. That usually happens when the fixed header files
  4756. have not been installed on an old system.
  4757. This macro is obsolescent, since current versions of the GNU C
  4758. compiler fix the header files automatically when installed.
  4759. 
  4760. File: autoconf.info, Node: C++ Compiler, Next: Objective C Compiler, Prev: C Compiler, Up: Compilers and Preprocessors
  4761. 5.10.4 C++ Compiler Characteristics
  4762. -----------------------------------
  4763. -- Macro: AC_PROG_CXX ([COMPILER-SEARCH-LIST])
  4764. Determine a C++ compiler to use. Check whether the environment
  4765. variable `CXX' or `CCC' (in that order) is set; if so, then set
  4766. output variable `CXX' to its value.
  4767. Otherwise, if the macro is invoked without an argument, then
  4768. search for a C++ compiler under the likely names (first `g++' and
  4769. `c++' then other names). If none of those checks succeed, then as
  4770. a last resort set `CXX' to `g++'.
  4771. This macro may, however, be invoked with an optional first argument
  4772. which, if specified, must be a blank-separated list of C++
  4773. compilers to search for. This just gives the user an opportunity
  4774. to specify an alternative search list for the C++ compiler. For
  4775. example, if you didn't like the default order, then you could
  4776. invoke `AC_PROG_CXX' like this:
  4777. AC_PROG_CXX([gcc cl KCC CC cxx cc++ xlC aCC c++ g++])
  4778. If using the GNU C++ compiler, set shell variable `GXX' to `yes'.
  4779. If output variable `CXXFLAGS' was not already set, set it to `-g
  4780. -O2' for the GNU C++ compiler (`-O2' on systems where G++ does not
  4781. accept `-g'), or `-g' for other compilers. If your package does
  4782. not like this default, then it is acceptable to insert the line `:
  4783. ${CXXFLAGS=""}' after `AC_INIT' and before `AC_PROG_CXX' to select
  4784. an empty default instead.
  4785. -- Macro: AC_PROG_CXXCPP
  4786. Set output variable `CXXCPP' to a command that runs the C++
  4787. preprocessor. If `$CXX -E' doesn't work, `/lib/cpp' is used. It
  4788. is portable to run `CXXCPP' only on files with a `.c', `.C',
  4789. `.cc', or `.cpp' extension.
  4790. Some preprocessors don't indicate missing include files by the
  4791. error status. For such preprocessors an internal variable is set
  4792. that causes other macros to check the standard error from the
  4793. preprocessor and consider the test failed if any warnings have
  4794. been reported. However, it is not known whether such broken
  4795. preprocessors exist for C++.
  4796. -- Macro: AC_PROG_CXX_C_O
  4797. Test whether the C++ compiler accepts the options `-c' and `-o'
  4798. simultaneously, and define `CXX_NO_MINUS_C_MINUS_O', if it does
  4799. not.
  4800. 
  4801. File: autoconf.info, Node: Objective C Compiler, Next: Objective C++ Compiler, Prev: C++ Compiler, Up: Compilers and Preprocessors
  4802. 5.10.5 Objective C Compiler Characteristics
  4803. -------------------------------------------
  4804. -- Macro: AC_PROG_OBJC ([COMPILER-SEARCH-LIST])
  4805. Determine an Objective C compiler to use. If `OBJC' is not already
  4806. set in the environment, check for Objective C compilers. Set
  4807. output variable `OBJC' to the name of the compiler found.
  4808. This macro may, however, be invoked with an optional first argument
  4809. which, if specified, must be a blank-separated list of Objective C
  4810. compilers to search for. This just gives the user an opportunity
  4811. to specify an alternative search list for the Objective C
  4812. compiler. For example, if you didn't like the default order, then
  4813. you could invoke `AC_PROG_OBJC' like this:
  4814. AC_PROG_OBJC([gcc objcc objc])
  4815. If using the GNU Objective C compiler, set shell variable `GOBJC'
  4816. to `yes'. If output variable `OBJCFLAGS' was not already set, set
  4817. it to `-g -O2' for the GNU Objective C compiler (`-O2' on systems
  4818. where `gcc' does not accept `-g'), or `-g' for other compilers.
  4819. -- Macro: AC_PROG_OBJCPP
  4820. Set output variable `OBJCPP' to a command that runs the Objective C
  4821. preprocessor. If `$OBJC -E' doesn't work, `/lib/cpp' is used.
  4822. 
  4823. File: autoconf.info, Node: Objective C++ Compiler, Next: Erlang Compiler and Interpreter, Prev: Objective C Compiler, Up: Compilers and Preprocessors
  4824. 5.10.6 Objective C++ Compiler Characteristics
  4825. ---------------------------------------------
  4826. -- Macro: AC_PROG_OBJCXX ([COMPILER-SEARCH-LIST])
  4827. Determine an Objective C++ compiler to use. If `OBJCXX' is not
  4828. already set in the environment, check for Objective C++ compilers.
  4829. Set output variable `OBJCXX' to the name of the compiler found.
  4830. This macro may, however, be invoked with an optional first argument
  4831. which, if specified, must be a blank-separated list of Objective
  4832. C++ compilers to search for. This just gives the user an
  4833. opportunity to specify an alternative search list for the
  4834. Objective C++ compiler. For example, if you didn't like the
  4835. default order, then you could invoke `AC_PROG_OBJCXX' like this:
  4836. AC_PROG_OBJCXX([gcc g++ objcc++ objcxx])
  4837. If using the GNU Objective C++ compiler, set shell variable
  4838. `GOBJCXX' to `yes'. If output variable `OBJCXXFLAGS' was not
  4839. already set, set it to `-g -O2' for the GNU Objective C++ compiler
  4840. (`-O2' on systems where `gcc' does not accept `-g'), or `-g' for
  4841. other compilers.
  4842. -- Macro: AC_PROG_OBJCXXCPP
  4843. Set output variable `OBJCXXCPP' to a command that runs the
  4844. Objective C++ preprocessor. If `$OBJCXX -E' doesn't work,
  4845. `/lib/cpp' is used.
  4846. 
  4847. File: autoconf.info, Node: Erlang Compiler and Interpreter, Next: Fortran Compiler, Prev: Objective C++ Compiler, Up: Compilers and Preprocessors
  4848. 5.10.7 Erlang Compiler and Interpreter Characteristics
  4849. ------------------------------------------------------
  4850. Autoconf defines the following macros for determining paths to the
  4851. essential Erlang/OTP programs:
  4852. -- Macro: AC_ERLANG_PATH_ERLC ([VALUE-IF-NOT-FOUND], [PATH = `$PATH'])
  4853. Determine an Erlang compiler to use. If `ERLC' is not already set
  4854. in the environment, check for `erlc'. Set output variable `ERLC'
  4855. to the complete path of the compiler command found. In addition,
  4856. if `ERLCFLAGS' is not set in the environment, set it to an empty
  4857. value.
  4858. The two optional arguments have the same meaning as the two last
  4859. arguments of macro `AC_PATH_PROG' for looking for the `erlc'
  4860. program. For example, to look for `erlc' only in the
  4861. `/usr/lib/erlang/bin' directory:
  4862. AC_ERLANG_PATH_ERLC([not found], [/usr/lib/erlang/bin])
  4863. -- Macro: AC_ERLANG_NEED_ERLC ([PATH = `$PATH'])
  4864. A simplified variant of the `AC_ERLANG_PATH_ERLC' macro, that
  4865. prints an error message and exits the `configure' script if the
  4866. `erlc' program is not found.
  4867. -- Macro: AC_ERLANG_PATH_ERL ([VALUE-IF-NOT-FOUND], [PATH = `$PATH'])
  4868. Determine an Erlang interpreter to use. If `ERL' is not already
  4869. set in the environment, check for `erl'. Set output variable
  4870. `ERL' to the complete path of the interpreter command found.
  4871. The two optional arguments have the same meaning as the two last
  4872. arguments of macro `AC_PATH_PROG' for looking for the `erl'
  4873. program. For example, to look for `erl' only in the
  4874. `/usr/lib/erlang/bin' directory:
  4875. AC_ERLANG_PATH_ERL([not found], [/usr/lib/erlang/bin])
  4876. -- Macro: AC_ERLANG_NEED_ERL ([PATH = `$PATH'])
  4877. A simplified variant of the `AC_ERLANG_PATH_ERL' macro, that
  4878. prints an error message and exits the `configure' script if the
  4879. `erl' program is not found.
  4880. 
  4881. File: autoconf.info, Node: Fortran Compiler, Next: Go Compiler, Prev: Erlang Compiler and Interpreter, Up: Compilers and Preprocessors
  4882. 5.10.8 Fortran Compiler Characteristics
  4883. ---------------------------------------
  4884. The Autoconf Fortran support is divided into two categories: legacy
  4885. Fortran 77 macros (`F77'), and modern Fortran macros (`FC'). The
  4886. former are intended for traditional Fortran 77 code, and have output
  4887. variables like `F77', `FFLAGS', and `FLIBS'. The latter are for newer
  4888. programs that can (or must) compile under the newer Fortran standards,
  4889. and have output variables like `FC', `FCFLAGS', and `FCLIBS'.
  4890. Except for the macros `AC_FC_SRCEXT', `AC_FC_FREEFORM',
  4891. `AC_FC_FIXEDFORM', and `AC_FC_LINE_LENGTH' (see below), the `FC' and
  4892. `F77' macros behave almost identically, and so they are documented
  4893. together in this section.
  4894. -- Macro: AC_PROG_F77 ([COMPILER-SEARCH-LIST])
  4895. Determine a Fortran 77 compiler to use. If `F77' is not already
  4896. set in the environment, then check for `g77' and `f77', and then
  4897. some other names. Set the output variable `F77' to the name of
  4898. the compiler found.
  4899. This macro may, however, be invoked with an optional first argument
  4900. which, if specified, must be a blank-separated list of Fortran 77
  4901. compilers to search for. This just gives the user an opportunity
  4902. to specify an alternative search list for the Fortran 77 compiler.
  4903. For example, if you didn't like the default order, then you could
  4904. invoke `AC_PROG_F77' like this:
  4905. AC_PROG_F77([fl32 f77 fort77 xlf g77 f90 xlf90])
  4906. If using `g77' (the GNU Fortran 77 compiler), then set the shell
  4907. variable `G77' to `yes'. If the output variable `FFLAGS' was not
  4908. already set in the environment, then set it to `-g -02' for `g77'
  4909. (or `-O2' where `g77' does not accept `-g'). Otherwise, set
  4910. `FFLAGS' to `-g' for all other Fortran 77 compilers.
  4911. The result of the GNU test is cached in the
  4912. `ac_cv_f77_compiler_gnu' variable, acceptance of `-g' in the
  4913. `ac_cv_prog_f77_g' variable.
  4914. -- Macro: AC_PROG_FC ([COMPILER-SEARCH-LIST], [DIALECT])
  4915. Determine a Fortran compiler to use. If `FC' is not already set in
  4916. the environment, then `dialect' is a hint to indicate what Fortran
  4917. dialect to search for; the default is to search for the newest
  4918. available dialect. Set the output variable `FC' to the name of
  4919. the compiler found.
  4920. By default, newer dialects are preferred over older dialects, but
  4921. if `dialect' is specified then older dialects are preferred
  4922. starting with the specified dialect. `dialect' can currently be
  4923. one of Fortran 77, Fortran 90, or Fortran 95. However, this is
  4924. only a hint of which compiler _name_ to prefer (e.g., `f90' or
  4925. `f95'), and no attempt is made to guarantee that a particular
  4926. language standard is actually supported. Thus, it is preferable
  4927. that you avoid the `dialect' option, and use AC_PROG_FC only for
  4928. code compatible with the latest Fortran standard.
  4929. This macro may, alternatively, be invoked with an optional first
  4930. argument which, if specified, must be a blank-separated list of
  4931. Fortran compilers to search for, just as in `AC_PROG_F77'.
  4932. If using `gfortran' or `g77' (the GNU Fortran compilers), then set
  4933. the shell variable `GFC' to `yes'. If the output variable
  4934. `FCFLAGS' was not already set in the environment, then set it to
  4935. `-g -02' for GNU `g77' (or `-O2' where `g77' does not accept
  4936. `-g'). Otherwise, set `FCFLAGS' to `-g' for all other Fortran
  4937. compilers.
  4938. The result of the GNU test is cached in the `ac_cv_fc_compiler_gnu'
  4939. variable, acceptance of `-g' in the `ac_cv_prog_fc_g' variable.
  4940. -- Macro: AC_PROG_F77_C_O
  4941. -- Macro: AC_PROG_FC_C_O
  4942. Test whether the Fortran compiler accepts the options `-c' and
  4943. `-o' simultaneously, and define `F77_NO_MINUS_C_MINUS_O' or
  4944. `FC_NO_MINUS_C_MINUS_O', respectively, if it does not.
  4945. The result of the test is cached in the `ac_cv_prog_f77_c_o' or
  4946. `ac_cv_prog_fc_c_o' variable, respectively.
  4947. The following macros check for Fortran compiler characteristics. To
  4948. check for characteristics not listed here, use `AC_COMPILE_IFELSE'
  4949. (*note Running the Compiler::) or `AC_RUN_IFELSE' (*note Runtime::),
  4950. making sure to first set the current language to Fortran 77 or Fortran
  4951. via `AC_LANG([Fortran 77])' or `AC_LANG(Fortran)' (*note Language
  4952. Choice::).
  4953. -- Macro: AC_F77_LIBRARY_LDFLAGS
  4954. -- Macro: AC_FC_LIBRARY_LDFLAGS
  4955. Determine the linker flags (e.g., `-L' and `-l') for the "Fortran
  4956. intrinsic and runtime libraries" that are required to successfully
  4957. link a Fortran program or shared library. The output variable
  4958. `FLIBS' or `FCLIBS' is set to these flags (which should be
  4959. included after `LIBS' when linking).
  4960. This macro is intended to be used in those situations when it is
  4961. necessary to mix, e.g., C++ and Fortran source code in a single
  4962. program or shared library (*note Mixing Fortran 77 With C and C++:
  4963. (automake)Mixing Fortran 77 With C and C++.).
  4964. For example, if object files from a C++ and Fortran compiler must
  4965. be linked together, then the C++ compiler/linker must be used for
  4966. linking (since special C++-ish things need to happen at link time
  4967. like calling global constructors, instantiating templates,
  4968. enabling exception support, etc.).
  4969. However, the Fortran intrinsic and runtime libraries must be
  4970. linked in as well, but the C++ compiler/linker doesn't know by
  4971. default how to add these Fortran 77 libraries. Hence, this macro
  4972. was created to determine these Fortran libraries.
  4973. The macros `AC_F77_DUMMY_MAIN' and `AC_FC_DUMMY_MAIN' or
  4974. `AC_F77_MAIN' and `AC_FC_MAIN' are probably also necessary to link
  4975. C/C++ with Fortran; see below. Further, it is highly recommended
  4976. that you use `AC_CONFIG_HEADERS' (*note Configuration Headers::)
  4977. because the complex defines that the function wrapper macros create
  4978. may not work with C/C++ compiler drivers.
  4979. These macros internally compute the flag needed to verbose linking
  4980. output and cache it in `ac_cv_prog_f77_v' or `ac_cv_prog_fc_v'
  4981. variables, respectively. The computed linker flags are cached in
  4982. `ac_cv_f77_libs' or `ac_cv_fc_libs', respectively.
  4983. -- Macro: AC_F77_DUMMY_MAIN ([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND =
  4984. `AC_MSG_FAILURE'])
  4985. -- Macro: AC_FC_DUMMY_MAIN ([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND =
  4986. `AC_MSG_FAILURE'])
  4987. With many compilers, the Fortran libraries detected by
  4988. `AC_F77_LIBRARY_LDFLAGS' or `AC_FC_LIBRARY_LDFLAGS' provide their
  4989. own `main' entry function that initializes things like Fortran
  4990. I/O, and which then calls a user-provided entry function named
  4991. (say) `MAIN__' to run the user's program. The `AC_F77_DUMMY_MAIN'
  4992. and `AC_FC_DUMMY_MAIN' or `AC_F77_MAIN' and `AC_FC_MAIN' macros
  4993. figure out how to deal with this interaction.
  4994. When using Fortran for purely numerical functions (no I/O, etc.)
  4995. often one prefers to provide one's own `main' and skip the Fortran
  4996. library initializations. In this case, however, one may still
  4997. need to provide a dummy `MAIN__' routine in order to prevent
  4998. linking errors on some systems. `AC_F77_DUMMY_MAIN' or
  4999. `AC_FC_DUMMY_MAIN' detects whether any such routine is _required_
  5000. for linking, and what its name is; the shell variable
  5001. `F77_DUMMY_MAIN' or `FC_DUMMY_MAIN' holds this name, `unknown'
  5002. when no solution was found, and `none' when no such dummy main is
  5003. needed.
  5004. By default, ACTION-IF-FOUND defines `F77_DUMMY_MAIN' or
  5005. `FC_DUMMY_MAIN' to the name of this routine (e.g., `MAIN__') _if_
  5006. it is required. ACTION-IF-NOT-FOUND defaults to exiting with an
  5007. error.
  5008. In order to link with Fortran routines, the user's C/C++ program
  5009. should then include the following code to define the dummy main if
  5010. it is needed:
  5011. #ifdef F77_DUMMY_MAIN
  5012. # ifdef __cplusplus
  5013. extern "C"
  5014. # endif
  5015. int F77_DUMMY_MAIN () { return 1; }
  5016. #endif
  5017. (Replace `F77' with `FC' for Fortran instead of Fortran 77.)
  5018. Note that this macro is called automatically from `AC_F77_WRAPPERS'
  5019. or `AC_FC_WRAPPERS'; there is generally no need to call it
  5020. explicitly unless one wants to change the default actions.
  5021. The result of this macro is cached in the `ac_cv_f77_dummy_main' or
  5022. `ac_cv_fc_dummy_main' variable, respectively.
  5023. -- Macro: AC_F77_MAIN
  5024. -- Macro: AC_FC_MAIN
  5025. As discussed above, many Fortran libraries allow you to provide an
  5026. entry point called (say) `MAIN__' instead of the usual `main',
  5027. which is then called by a `main' function in the Fortran libraries
  5028. that initializes things like Fortran I/O. The `AC_F77_MAIN' and
  5029. `AC_FC_MAIN' macros detect whether it is _possible_ to utilize
  5030. such an alternate main function, and defines `F77_MAIN' and
  5031. `FC_MAIN' to the name of the function. (If no alternate main
  5032. function name is found, `F77_MAIN' and `FC_MAIN' are simply
  5033. defined to `main'.)
  5034. Thus, when calling Fortran routines from C that perform things
  5035. like I/O, one should use this macro and declare the "main"
  5036. function like so:
  5037. #ifdef __cplusplus
  5038. extern "C"
  5039. #endif
  5040. int F77_MAIN (int argc, char *argv[]);
  5041. (Again, replace `F77' with `FC' for Fortran instead of Fortran 77.)
  5042. The result of this macro is cached in the `ac_cv_f77_main' or
  5043. `ac_cv_fc_main' variable, respectively.
  5044. -- Macro: AC_F77_WRAPPERS
  5045. -- Macro: AC_FC_WRAPPERS
  5046. Defines C macros `F77_FUNC (name, NAME)', `FC_FUNC (name, NAME)',
  5047. `F77_FUNC_(name, NAME)', and `FC_FUNC_(name, NAME)' to properly
  5048. mangle the names of C/C++ identifiers, and identifiers with
  5049. underscores, respectively, so that they match the name-mangling
  5050. scheme used by the Fortran compiler.
  5051. Fortran is case-insensitive, and in order to achieve this the
  5052. Fortran compiler converts all identifiers into a canonical case
  5053. and format. To call a Fortran subroutine from C or to write a C
  5054. function that is callable from Fortran, the C program must
  5055. explicitly use identifiers in the format expected by the Fortran
  5056. compiler. In order to do this, one simply wraps all C identifiers
  5057. in one of the macros provided by `AC_F77_WRAPPERS' or
  5058. `AC_FC_WRAPPERS'. For example, suppose you have the following
  5059. Fortran 77 subroutine:
  5060. subroutine foobar (x, y)
  5061. double precision x, y
  5062. y = 3.14159 * x
  5063. return
  5064. end
  5065. You would then declare its prototype in C or C++ as:
  5066. #define FOOBAR_F77 F77_FUNC (foobar, FOOBAR)
  5067. #ifdef __cplusplus
  5068. extern "C" /* prevent C++ name mangling */
  5069. #endif
  5070. void FOOBAR_F77 (double *x, double *y);
  5071. Note that we pass both the lowercase and uppercase versions of the
  5072. function name to `F77_FUNC' so that it can select the right one.
  5073. Note also that all parameters to Fortran 77 routines are passed as
  5074. pointers (*note Mixing Fortran 77 With C and C++: (automake)Mixing
  5075. Fortran 77 With C and C++.).
  5076. (Replace `F77' with `FC' for Fortran instead of Fortran 77.)
  5077. Although Autoconf tries to be intelligent about detecting the
  5078. name-mangling scheme of the Fortran compiler, there may be Fortran
  5079. compilers that it doesn't support yet. In this case, the above
  5080. code generates a compile-time error, but some other behavior
  5081. (e.g., disabling Fortran-related features) can be induced by
  5082. checking whether `F77_FUNC' or `FC_FUNC' is defined.
  5083. Now, to call that routine from a C program, we would do something
  5084. like:
  5085. {
  5086. double x = 2.7183, y;
  5087. FOOBAR_F77 (&x, &y);
  5088. }
  5089. If the Fortran identifier contains an underscore (e.g., `foo_bar'),
  5090. you should use `F77_FUNC_' or `FC_FUNC_' instead of `F77_FUNC' or
  5091. `FC_FUNC' (with the same arguments). This is because some Fortran
  5092. compilers mangle names differently if they contain an underscore.
  5093. The name mangling scheme is encoded in the `ac_cv_f77_mangling' or
  5094. `ac_cv_fc_mangling' cache variable, respectively, and also used for
  5095. the `AC_F77_FUNC' and `AC_FC_FUNC' macros described below.
  5096. -- Macro: AC_F77_FUNC (NAME, [SHELLVAR])
  5097. -- Macro: AC_FC_FUNC (NAME, [SHELLVAR])
  5098. Given an identifier NAME, set the shell variable SHELLVAR to hold
  5099. the mangled version NAME according to the rules of the Fortran
  5100. linker (see also `AC_F77_WRAPPERS' or `AC_FC_WRAPPERS'). SHELLVAR
  5101. is optional; if it is not supplied, the shell variable is simply
  5102. NAME. The purpose of this macro is to give the caller a way to
  5103. access the name-mangling information other than through the C
  5104. preprocessor as above, for example, to call Fortran routines from
  5105. some language other than C/C++.
  5106. -- Macro: AC_FC_SRCEXT (EXT, [ACTION-IF-SUCCESS], [ACTION-IF-FAILURE =
  5107. `AC_MSG_FAILURE'])
  5108. -- Macro: AC_FC_PP_SRCEXT (EXT, [ACTION-IF-SUCCESS],
  5109. [ACTION-IF-FAILURE = `AC_MSG_FAILURE'])
  5110. By default, the `FC' macros perform their tests using a `.f'
  5111. extension for source-code files. Some compilers, however, only
  5112. enable newer language features for appropriately named files,
  5113. e.g., Fortran 90 features only for `.f90' files, or preprocessing
  5114. only with `.F' files or maybe other upper-case extensions. On the
  5115. other hand, some other compilers expect all source files to end in
  5116. `.f' and require special flags to support other file name
  5117. extensions. The `AC_FC_SRCEXT' and `AC_FC_PP_SRCEXT' macros deal
  5118. with these issues.
  5119. The `AC_FC_SRCEXT' macro tries to get the `FC' compiler to accept
  5120. files ending with the extension `.EXT' (i.e., EXT does _not_
  5121. contain the dot). If any special compiler flags are needed for
  5122. this, it stores them in the output variable `FCFLAGS_EXT'. This
  5123. extension and these flags are then used for all subsequent `FC'
  5124. tests (until `AC_FC_SRCEXT' or `AC_FC_PP_SRCEXT' is called another
  5125. time).
  5126. For example, you would use `AC_FC_SRCEXT(f90)' to employ the
  5127. `.f90' extension in future tests, and it would set the
  5128. `FCFLAGS_f90' output variable with any extra flags that are needed
  5129. to compile such files.
  5130. Similarly, the `AC_FC_PP_SRCEXT' macro tries to get the `FC'
  5131. compiler to preprocess and compile files with the extension
  5132. `.EXT'. When both `fpp' and `cpp' style preprocessing are
  5133. provided, the former is preferred, as the latter may treat
  5134. continuation lines, `//' tokens, and white space differently from
  5135. what some Fortran dialects expect. Conversely, if you do not want
  5136. files to be preprocessed, use only lower-case characters in the
  5137. file name extension. Like with `AC_FC_SRCEXT(f90)', any needed
  5138. flags are stored in the `FCFLAGS_EXT' variable.
  5139. The `FCFLAGS_EXT' flags can _not_ be simply absorbed into
  5140. `FCFLAGS', for two reasons based on the limitations of some
  5141. compilers. First, only one `FCFLAGS_EXT' can be used at a time,
  5142. so files with different extensions must be compiled separately.
  5143. Second, `FCFLAGS_EXT' must appear _immediately_ before the
  5144. source-code file name when compiling. So, continuing the example
  5145. above, you might compile a `foo.f90' file in your makefile with the
  5146. command:
  5147. foo.o: foo.f90
  5148. $(FC) -c $(FCFLAGS) $(FCFLAGS_f90) '$(srcdir)/foo.f90'
  5149. If `AC_FC_SRCEXT' or `AC_FC_PP_SRCEXT' succeeds in compiling files
  5150. with the EXT extension, it calls ACTION-IF-SUCCESS (defaults to
  5151. nothing). If it fails, and cannot find a way to make the `FC'
  5152. compiler accept such files, it calls ACTION-IF-FAILURE (defaults
  5153. to exiting with an error message).
  5154. The `AC_FC_SRCEXT' and `AC_FC_PP_SRCEXT' macros cache their
  5155. results in `ac_cv_fc_srcext_EXT' and `ac_cv_fc_pp_srcext_EXT'
  5156. variables, respectively.
  5157. -- Macro: AC_FC_PP_DEFINE ([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE =
  5158. `AC_MSG_FAILURE'])
  5159. Find a flag to specify defines for preprocessed Fortran. Not all
  5160. Fortran compilers use `-D'. Substitute `FC_DEFINE' with the
  5161. result and call ACTION-IF-SUCCESS (defaults to nothing) if
  5162. successful, and ACTION-IF-FAILURE (defaults to failing with an
  5163. error message) if not.
  5164. This macro calls `AC_FC_PP_SRCEXT([F])' in order to learn how to
  5165. preprocess a `conftest.F' file, but restores a previously used
  5166. Fortran source file extension afterwards again.
  5167. The result of this test is cached in the `ac_cv_fc_pp_define'
  5168. variable.
  5169. -- Macro: AC_FC_FREEFORM ([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE =
  5170. `AC_MSG_FAILURE'])
  5171. Try to ensure that the Fortran compiler (`$FC') allows free-format
  5172. source code (as opposed to the older fixed-format style from
  5173. Fortran 77). If necessary, it may add some additional flags to
  5174. `FCFLAGS'.
  5175. This macro is most important if you are using the default `.f'
  5176. extension, since many compilers interpret this extension as
  5177. indicating fixed-format source unless an additional flag is
  5178. supplied. If you specify a different extension with
  5179. `AC_FC_SRCEXT', such as `.f90', then `AC_FC_FREEFORM' ordinarily
  5180. succeeds without modifying `FCFLAGS'. For extensions which the
  5181. compiler does not know about, the flag set by the `AC_FC_SRCEXT'
  5182. macro might let the compiler assume Fortran 77 by default, however.
  5183. If `AC_FC_FREEFORM' succeeds in compiling free-form source, it
  5184. calls ACTION-IF-SUCCESS (defaults to nothing). If it fails, it
  5185. calls ACTION-IF-FAILURE (defaults to exiting with an error
  5186. message).
  5187. The result of this test, or `none' or `unknown', is cached in the
  5188. `ac_cv_fc_freeform' variable.
  5189. -- Macro: AC_FC_FIXEDFORM ([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE =
  5190. `AC_MSG_FAILURE'])
  5191. Try to ensure that the Fortran compiler (`$FC') allows the old
  5192. fixed-format source code (as opposed to free-format style). If
  5193. necessary, it may add some additional flags to `FCFLAGS'.
  5194. This macro is needed for some compilers alias names like `xlf95'
  5195. which assume free-form source code by default, and in case you
  5196. want to use fixed-form source with an extension like `.f90' which
  5197. many compilers interpret as free-form by default. If you specify
  5198. a different extension with `AC_FC_SRCEXT', such as `.f', then
  5199. `AC_FC_FIXEDFORM' ordinarily succeeds without modifying `FCFLAGS'.
  5200. If `AC_FC_FIXEDFORM' succeeds in compiling fixed-form source, it
  5201. calls ACTION-IF-SUCCESS (defaults to nothing). If it fails, it
  5202. calls ACTION-IF-FAILURE (defaults to exiting with an error
  5203. message).
  5204. The result of this test, or `none' or `unknown', is cached in the
  5205. `ac_cv_fc_fixedform' variable.
  5206. -- Macro: AC_FC_LINE_LENGTH ([LENGTH], [ACTION-IF-SUCCESS],
  5207. [ACTION-IF-FAILURE = `AC_MSG_FAILURE'])
  5208. Try to ensure that the Fortran compiler (`$FC') accepts long source
  5209. code lines. The LENGTH argument may be given as 80, 132, or
  5210. unlimited, and defaults to 132. Note that line lengths above 254
  5211. columns are not portable, and some compilers do not accept more
  5212. than 132 columns at least for fixed format source. If necessary,
  5213. it may add some additional flags to `FCFLAGS'.
  5214. If `AC_FC_LINE_LENGTH' succeeds in compiling fixed-form source, it
  5215. calls ACTION-IF-SUCCESS (defaults to nothing). If it fails, it
  5216. calls ACTION-IF-FAILURE (defaults to exiting with an error
  5217. message).
  5218. The result of this test, or `none' or `unknown', is cached in the
  5219. `ac_cv_fc_line_length' variable.
  5220. -- Macro: AC_FC_CHECK_BOUNDS ([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE
  5221. = `AC_MSG_FAILURE'])
  5222. The `AC_FC_CHECK_BOUNDS' macro tries to enable array bounds
  5223. checking in the Fortran compiler. If successful, the
  5224. ACTION-IF-SUCCESS is called and any needed flags are added to
  5225. `FCFLAGS'. Otherwise, ACTION-IF-FAILURE is called, which defaults
  5226. to failing with an error message. The macro currently requires
  5227. Fortran 90 or a newer dialect.
  5228. The result of the macro is cached in the `ac_cv_fc_check_bounds'
  5229. variable.
  5230. -- Macro: AC_F77_IMPLICIT_NONE ([ACTION-IF-SUCCESS],
  5231. [ACTION-IF-FAILURE = `AC_MSG_FAILURE'])
  5232. -- Macro: AC_FC_IMPLICIT_NONE ([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE
  5233. = `AC_MSG_FAILURE'])
  5234. Try to disallow implicit declarations in the Fortran compiler. If
  5235. successful, ACTION-IF-SUCCESS is called and any needed flags are
  5236. added to `FFLAGS' or `FCFLAGS', respectively. Otherwise,
  5237. ACTION-IF-FAILURE is called, which defaults to failing with an
  5238. error message.
  5239. The result of these macros are cached in the
  5240. `ac_cv_f77_implicit_none' and `ac_cv_fc_implicit_none' variables,
  5241. respectively.
  5242. -- Macro: AC_FC_MODULE_EXTENSION
  5243. Find the Fortran 90 module file name extension. Most Fortran 90
  5244. compilers store module information in files separate from the
  5245. object files. The module files are usually named after the name
  5246. of the module rather than the source file name, with characters
  5247. possibly turned to upper case, plus an extension, often `.mod'.
  5248. Not all compilers use module files at all, or by default. The Cray
  5249. Fortran compiler requires `-e m' in order to store and search
  5250. module information in `.mod' files rather than in object files.
  5251. Likewise, the Fujitsu Fortran compilers uses the `-Am' option to
  5252. indicate how module information is stored.
  5253. The `AC_FC_MODULE_EXTENSION' macro computes the module extension
  5254. without the leading dot, and stores that in the `FC_MODEXT'
  5255. variable. If the compiler does not produce module files, or the
  5256. extension cannot be determined, `FC_MODEXT' is empty. Typically,
  5257. the result of this macro may be used in cleanup `make' rules as
  5258. follows:
  5259. clean-modules:
  5260. -test -z "$(FC_MODEXT)" || rm -f *.$(FC_MODEXT)
  5261. The extension, or `unknown', is cached in the
  5262. `ac_cv_fc_module_ext' variable.
  5263. -- Macro: AC_FC_MODULE_FLAG ([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE =
  5264. `AC_MSG_FAILURE'])
  5265. Find the compiler flag to include Fortran 90 module information
  5266. from another directory, and store that in the `FC_MODINC' variable.
  5267. Call ACTION-IF-SUCCESS (defaults to nothing) if successful, and
  5268. set `FC_MODINC' to empty and call ACTION-IF-FAILURE (defaults to
  5269. exiting with an error message) if not.
  5270. Most Fortran 90 compilers provide a way to specify module
  5271. directories. Some have separate flags for the directory to write
  5272. module files to, and directories to search them in, whereas others
  5273. only allow writing to the current directory or to the first
  5274. directory specified in the include path. Further, with some
  5275. compilers, the module search path and the preprocessor search path
  5276. can only be modified with the same flag. Thus, for portability,
  5277. write module files to the current directory only and list that as
  5278. first directory in the search path.
  5279. There may be no whitespace between `FC_MODINC' and the following
  5280. directory name, but `FC_MODINC' may contain trailing white space.
  5281. For example, if you use Automake and would like to search `../lib'
  5282. for module files, you can use the following:
  5283. AM_FCFLAGS = $(FC_MODINC). $(FC_MODINC)../lib
  5284. Inside `configure' tests, you can use:
  5285. if test -n "$FC_MODINC"; then
  5286. FCFLAGS="$FCFLAGS $FC_MODINC. $FC_MODINC../lib"
  5287. fi
  5288. The flag is cached in the `ac_cv_fc_module_flag' variable. The
  5289. substituted value of `FC_MODINC' may refer to the `ac_empty' dummy
  5290. placeholder empty variable, to avoid losing the significant
  5291. trailing whitespace in a `Makefile'.
  5292. -- Macro: AC_FC_MODULE_OUTPUT_FLAG ([ACTION-IF-SUCCESS],
  5293. [ACTION-IF-FAILURE = `AC_MSG_FAILURE'])
  5294. Find the compiler flag to write Fortran 90 module information to
  5295. another directory, and store that in the `FC_MODOUT' variable.
  5296. Call ACTION-IF-SUCCESS (defaults to nothing) if successful, and
  5297. set `FC_MODOUT' to empty and call ACTION-IF-FAILURE (defaults to
  5298. exiting with an error message) if not.
  5299. Not all Fortran 90 compilers write module files, and of those that
  5300. do, not all allow writing to a directory other than the current
  5301. one, nor do all have separate flags for writing and reading; see
  5302. the description of `AC_FC_MODULE_FLAG' above. If you need to be
  5303. able to write to another directory, for maximum portability use
  5304. `FC_MODOUT' before any `FC_MODINC' and include both the current
  5305. directory and the one you write to in the search path:
  5306. AM_FCFLAGS = $(FC_MODOUT)../mod $(FC_MODINC)../mod $(FC_MODINC). ...
  5307. The flag is cached in the `ac_cv_fc_module_output_flag' variable.
  5308. The substituted value of `FC_MODOUT' may refer to the `ac_empty'
  5309. dummy placeholder empty variable, to avoid losing the significant
  5310. trailing whitespace in a `Makefile'.
  5311. 
  5312. File: autoconf.info, Node: Go Compiler, Prev: Fortran Compiler, Up: Compilers and Preprocessors
  5313. 5.10.9 Go Compiler Characteristics
  5314. ----------------------------------
  5315. Autoconf provides basic support for the Go programming language when
  5316. using the `gccgo' compiler (there is currently no support for the `6g'
  5317. and `8g' compilers).
  5318. -- Macro: AC_PROG_GO ([COMPILER-SEARCH-LIST])
  5319. Find the Go compiler to use. Check whether the environment
  5320. variable `GOC' is set; if so, then set output variable `GOC' to its
  5321. value.
  5322. Otherwise, if the macro is invoked without an argument, then
  5323. search for a Go compiler named `gccgo'. If it is not found, then
  5324. as a last resort set `GOC' to `gccgo'.
  5325. This macro may be invoked with an optional first argument which, if
  5326. specified, must be a blank-separated list of Go compilers to
  5327. search for.
  5328. If output variable `GOFLAGS' was not already set, set it to `-g
  5329. -O2'. If your package does not like this default, `GOFLAGS' may
  5330. be set before `AC_PROG_GO'.
  5331. 
  5332. File: autoconf.info, Node: System Services, Next: Posix Variants, Prev: Compilers and Preprocessors, Up: Existing Tests
  5333. 5.11 System Services
  5334. ====================
  5335. The following macros check for operating system services or
  5336. capabilities.
  5337. -- Macro: AC_PATH_X
  5338. Try to locate the X Window System include files and libraries. If
  5339. the user gave the command line options `--x-includes=DIR' and
  5340. `--x-libraries=DIR', use those directories.
  5341. If either or both were not given, get the missing values by running
  5342. `xmkmf' (or an executable pointed to by the `XMKMF' environment
  5343. variable) on a trivial `Imakefile' and examining the makefile that
  5344. it produces. Setting `XMKMF' to `false' disables this method.
  5345. If this method fails to find the X Window System, `configure'
  5346. looks for the files in several directories where they often reside.
  5347. If either method is successful, set the shell variables
  5348. `x_includes' and `x_libraries' to their locations, unless they are
  5349. in directories the compiler searches by default.
  5350. If both methods fail, or the user gave the command line option
  5351. `--without-x', set the shell variable `no_x' to `yes'; otherwise
  5352. set it to the empty string.
  5353. -- Macro: AC_PATH_XTRA
  5354. An enhanced version of `AC_PATH_X'. It adds the C compiler flags
  5355. that X needs to output variable `X_CFLAGS', and the X linker flags
  5356. to `X_LIBS'. Define `X_DISPLAY_MISSING' if X is not available.
  5357. This macro also checks for special libraries that some systems
  5358. need in order to compile X programs. It adds any that the system
  5359. needs to output variable `X_EXTRA_LIBS'. And it checks for
  5360. special X11R6 libraries that need to be linked with before
  5361. `-lX11', and adds any found to the output variable `X_PRE_LIBS'.
  5362. -- Macro: AC_SYS_INTERPRETER
  5363. Check whether the system supports starting scripts with a line of
  5364. the form `#!/bin/sh' to select the interpreter to use for the
  5365. script. After running this macro, shell code in `configure.ac'
  5366. can check the shell variable `interpval'; it is set to `yes' if
  5367. the system supports `#!', `no' if not.
  5368. -- Macro: AC_SYS_LARGEFILE
  5369. Arrange for 64-bit file offsets, known as large-file support
  5370. (http://www.unix-systems.org/version2/whatsnew/lfs20mar.html). On
  5371. some hosts, one must use special compiler options to build
  5372. programs that can access large files. Append any such options to
  5373. the output variable `CC'. Define `_FILE_OFFSET_BITS' and
  5374. `_LARGE_FILES' if necessary.
  5375. Large-file support can be disabled by configuring with the
  5376. `--disable-largefile' option.
  5377. If you use this macro, check that your program works even when
  5378. `off_t' is wider than `long int', since this is common when
  5379. large-file support is enabled. For example, it is not correct to
  5380. print an arbitrary `off_t' value `X' with `printf ("%ld", (long
  5381. int) X)'.
  5382. The LFS introduced the `fseeko' and `ftello' functions to replace
  5383. their C counterparts `fseek' and `ftell' that do not use `off_t'.
  5384. Take care to use `AC_FUNC_FSEEKO' to make their prototypes
  5385. available when using them and large-file support is enabled.
  5386. -- Macro: AC_SYS_LONG_FILE_NAMES
  5387. If the system supports file names longer than 14 characters, define
  5388. `HAVE_LONG_FILE_NAMES'.
  5389. -- Macro: AC_SYS_POSIX_TERMIOS
  5390. Check to see if the Posix termios headers and functions are
  5391. available on the system. If so, set the shell variable
  5392. `ac_cv_sys_posix_termios' to `yes'. If not, set the variable to
  5393. `no'.
  5394. 
  5395. File: autoconf.info, Node: Posix Variants, Next: Erlang Libraries, Prev: System Services, Up: Existing Tests
  5396. 5.12 Posix Variants
  5397. ===================
  5398. The following macro makes it possible to use features of Posix that are
  5399. extensions to C, as well as platform extensions not defined by Posix.
  5400. -- Macro: AC_USE_SYSTEM_EXTENSIONS
  5401. This macro was introduced in Autoconf 2.60. If possible, enable
  5402. extensions to C or Posix on hosts that normally disable the
  5403. extensions, typically due to standards-conformance namespace
  5404. issues. This should be called before any macros that run the C
  5405. compiler. The following preprocessor macros are defined where
  5406. appropriate:
  5407. `_GNU_SOURCE'
  5408. Enable extensions on GNU/Linux.
  5409. `__EXTENSIONS__'
  5410. Enable general extensions on Solaris.
  5411. `_POSIX_PTHREAD_SEMANTICS'
  5412. Enable threading extensions on Solaris.
  5413. `_TANDEM_SOURCE'
  5414. Enable extensions for the HP NonStop platform.
  5415. `_ALL_SOURCE'
  5416. Enable extensions for AIX 3, and for Interix.
  5417. `_POSIX_SOURCE'
  5418. Enable Posix functions for Minix.
  5419. `_POSIX_1_SOURCE'
  5420. Enable additional Posix functions for Minix.
  5421. `_MINIX'
  5422. Identify Minix platform. This particular preprocessor macro
  5423. is obsolescent, and may be removed in a future release of
  5424. Autoconf.
  5425. 
  5426. File: autoconf.info, Node: Erlang Libraries, Prev: Posix Variants, Up: Existing Tests
  5427. 5.13 Erlang Libraries
  5428. =====================
  5429. The following macros check for an installation of Erlang/OTP, and for
  5430. the presence of certain Erlang libraries. All those macros require the
  5431. configuration of an Erlang interpreter and an Erlang compiler (*note
  5432. Erlang Compiler and Interpreter::).
  5433. -- Macro: AC_ERLANG_SUBST_ERTS_VER
  5434. Set the output variable `ERLANG_ERTS_VER' to the version of the
  5435. Erlang runtime system (as returned by Erlang's
  5436. `erlang:system_info(version)' function). The result of this test
  5437. is cached if caching is enabled when running `configure'. The
  5438. `ERLANG_ERTS_VER' variable is not intended to be used for testing
  5439. for features of specific ERTS versions, but to be used for
  5440. substituting the ERTS version in Erlang/OTP release resource files
  5441. (`.rel' files), as shown below.
  5442. -- Macro: AC_ERLANG_SUBST_ROOT_DIR
  5443. Set the output variable `ERLANG_ROOT_DIR' to the path to the base
  5444. directory in which Erlang/OTP is installed (as returned by Erlang's
  5445. `code:root_dir/0' function). The result of this test is cached if
  5446. caching is enabled when running `configure'.
  5447. -- Macro: AC_ERLANG_SUBST_LIB_DIR
  5448. Set the output variable `ERLANG_LIB_DIR' to the path of the library
  5449. directory of Erlang/OTP (as returned by Erlang's `code:lib_dir/0'
  5450. function), which subdirectories each contain an installed
  5451. Erlang/OTP library. The result of this test is cached if caching
  5452. is enabled when running `configure'.
  5453. -- Macro: AC_ERLANG_CHECK_LIB (LIBRARY, [ACTION-IF-FOUND],
  5454. [ACTION-IF-NOT-FOUND])
  5455. Test whether the Erlang/OTP library LIBRARY is installed by
  5456. calling Erlang's `code:lib_dir/1' function. The result of this
  5457. test is cached if caching is enabled when running `configure'.
  5458. ACTION-IF-FOUND is a list of shell commands to run if the library
  5459. is installed; ACTION-IF-NOT-FOUND is a list of shell commands to
  5460. run if it is not. Additionally, if the library is installed, the
  5461. output variable `ERLANG_LIB_DIR_LIBRARY' is set to the path to the
  5462. library installation directory, and the output variable
  5463. `ERLANG_LIB_VER_LIBRARY' is set to the version number that is part
  5464. of the subdirectory name, if it is in the standard form
  5465. (`LIBRARY-VERSION'). If the directory name does not have a
  5466. version part, `ERLANG_LIB_VER_LIBRARY' is set to the empty string.
  5467. If the library is not installed, `ERLANG_LIB_DIR_LIBRARY' and
  5468. `ERLANG_LIB_VER_LIBRARY' are set to `"not found"'. For example,
  5469. to check if library `stdlib' is installed:
  5470. AC_ERLANG_CHECK_LIB([stdlib],
  5471. [echo "stdlib version \"$ERLANG_LIB_VER_stdlib\""
  5472. echo "is installed in \"$ERLANG_LIB_DIR_stdlib\""],
  5473. [AC_MSG_ERROR([stdlib was not found!])])
  5474. The `ERLANG_LIB_VER_LIBRARY' variables (set by
  5475. `AC_ERLANG_CHECK_LIB') and the `ERLANG_ERTS_VER' variable (set by
  5476. `AC_ERLANG_SUBST_ERTS_VER') are not intended to be used for
  5477. testing for features of specific versions of libraries or of the
  5478. Erlang runtime system. Those variables are intended to be
  5479. substituted in Erlang release resource files (`.rel' files). For
  5480. instance, to generate a `example.rel' file for an application
  5481. depending on the `stdlib' library, `configure.ac' could contain:
  5482. AC_ERLANG_SUBST_ERTS_VER
  5483. AC_ERLANG_CHECK_LIB([stdlib],
  5484. [],
  5485. [AC_MSG_ERROR([stdlib was not found!])])
  5486. AC_CONFIG_FILES([example.rel])
  5487. The `example.rel.in' file used to generate `example.rel' should
  5488. contain:
  5489. {release,
  5490. {"@PACKAGE@", "@VERSION@"},
  5491. {erts, "@ERLANG_ERTS_VER@"},
  5492. [{stdlib, "@ERLANG_LIB_VER_stdlib@"},
  5493. {@PACKAGE@, "@VERSION@"}]}.
  5494. In addition to the above macros, which test installed Erlang
  5495. libraries, the following macros determine the paths to the directories
  5496. into which newly built Erlang libraries are to be installed:
  5497. -- Macro: AC_ERLANG_SUBST_INSTALL_LIB_DIR
  5498. Set the `ERLANG_INSTALL_LIB_DIR' output variable to the directory
  5499. into which every built Erlang library should be installed in a
  5500. separate subdirectory. If this variable is not set in the
  5501. environment when `configure' runs, its default value is
  5502. `${libdir}/erlang/lib'.
  5503. -- Macro: AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR (LIBRARY, VERSION)
  5504. Set the `ERLANG_INSTALL_LIB_DIR_LIBRARY' output variable to the
  5505. directory into which the built Erlang library LIBRARY version
  5506. VERSION should be installed. If this variable is not set in the
  5507. environment when `configure' runs, its default value is
  5508. `$ERLANG_INSTALL_LIB_DIR/LIBRARY-VERSION', the value of the
  5509. `ERLANG_INSTALL_LIB_DIR' variable being set by the
  5510. `AC_ERLANG_SUBST_INSTALL_LIB_DIR' macro.
  5511. 
  5512. File: autoconf.info, Node: Writing Tests, Next: Results, Prev: Existing Tests, Up: Top
  5513. 6 Writing Tests
  5514. ***************
  5515. If the existing feature tests don't do something you need, you have to
  5516. write new ones. These macros are the building blocks. They provide
  5517. ways for other macros to check whether various kinds of features are
  5518. available and report the results.
  5519. This chapter contains some suggestions and some of the reasons why
  5520. the existing tests are written the way they are. You can also learn a
  5521. lot about how to write Autoconf tests by looking at the existing ones.
  5522. If something goes wrong in one or more of the Autoconf tests, this
  5523. information can help you understand the assumptions behind them, which
  5524. might help you figure out how to best solve the problem.
  5525. These macros check the output of the compiler system of the current
  5526. language (*note Language Choice::). They do not cache the results of
  5527. their tests for future use (*note Caching Results::), because they don't
  5528. know enough about the information they are checking for to generate a
  5529. cache variable name. They also do not print any messages, for the same
  5530. reason. The checks for particular kinds of features call these macros
  5531. and do cache their results and print messages about what they're
  5532. checking for.
  5533. When you write a feature test that could be applicable to more than
  5534. one software package, the best thing to do is encapsulate it in a new
  5535. macro. *Note Writing Autoconf Macros::, for how to do that.
  5536. * Menu:
  5537. * Language Choice:: Selecting which language to use for testing
  5538. * Writing Test Programs:: Forging source files for compilers
  5539. * Running the Preprocessor:: Detecting preprocessor symbols
  5540. * Running the Compiler:: Detecting language or header features
  5541. * Running the Linker:: Detecting library features
  5542. * Runtime:: Testing for runtime features
  5543. * Systemology:: A zoology of operating systems
  5544. * Multiple Cases:: Tests for several possible values
  5545. 
  5546. File: autoconf.info, Node: Language Choice, Next: Writing Test Programs, Up: Writing Tests
  5547. 6.1 Language Choice
  5548. ===================
  5549. Autoconf-generated `configure' scripts check for the C compiler and its
  5550. features by default. Packages that use other programming languages
  5551. (maybe more than one, e.g., C and C++) need to test features of the
  5552. compilers for the respective languages. The following macros determine
  5553. which programming language is used in the subsequent tests in
  5554. `configure.ac'.
  5555. -- Macro: AC_LANG (LANGUAGE)
  5556. Do compilation tests using the compiler, preprocessor, and file
  5557. extensions for the specified LANGUAGE.
  5558. Supported languages are:
  5559. `C'
  5560. Do compilation tests using `CC' and `CPP' and use extension
  5561. `.c' for test programs. Use compilation flags: `CPPFLAGS'
  5562. with `CPP', and both `CPPFLAGS' and `CFLAGS' with `CC'.
  5563. `C++'
  5564. Do compilation tests using `CXX' and `CXXCPP' and use
  5565. extension `.C' for test programs. Use compilation flags:
  5566. `CPPFLAGS' with `CXXCPP', and both `CPPFLAGS' and `CXXFLAGS'
  5567. with `CXX'.
  5568. `Fortran 77'
  5569. Do compilation tests using `F77' and use extension `.f' for
  5570. test programs. Use compilation flags: `FFLAGS'.
  5571. `Fortran'
  5572. Do compilation tests using `FC' and use extension `.f' (or
  5573. whatever has been set by `AC_FC_SRCEXT') for test programs.
  5574. Use compilation flags: `FCFLAGS'.
  5575. `Erlang'
  5576. Compile and execute tests using `ERLC' and `ERL' and use
  5577. extension `.erl' for test Erlang modules. Use compilation
  5578. flags: `ERLCFLAGS'.
  5579. `Objective C'
  5580. Do compilation tests using `OBJC' and `OBJCPP' and use
  5581. extension `.m' for test programs. Use compilation flags:
  5582. `CPPFLAGS' with `OBJCPP', and both `CPPFLAGS' and `OBJCFLAGS'
  5583. with `OBJC'.
  5584. `Objective C++'
  5585. Do compilation tests using `OBJCXX' and `OBJCXXCPP' and use
  5586. extension `.mm' for test programs. Use compilation flags:
  5587. `CPPFLAGS' with `OBJCXXCPP', and both `CPPFLAGS' and
  5588. `OBJCXXFLAGS' with `OBJCXX'.
  5589. `Go'
  5590. Do compilation tests using `GOC' and use extension `.go' for
  5591. test programs. Use compilation flags `GOFLAGS'.
  5592. -- Macro: AC_LANG_PUSH (LANGUAGE)
  5593. Remember the current language (as set by `AC_LANG') on a stack, and
  5594. then select the LANGUAGE. Use this macro and `AC_LANG_POP' in
  5595. macros that need to temporarily switch to a particular language.
  5596. -- Macro: AC_LANG_POP ([LANGUAGE])
  5597. Select the language that is saved on the top of the stack, as set
  5598. by `AC_LANG_PUSH', and remove it from the stack.
  5599. If given, LANGUAGE specifies the language we just _quit_. It is a
  5600. good idea to specify it when it's known (which should be the
  5601. case...), since Autoconf detects inconsistencies.
  5602. AC_LANG_PUSH([Fortran 77])
  5603. # Perform some tests on Fortran 77.
  5604. # ...
  5605. AC_LANG_POP([Fortran 77])
  5606. -- Macro: AC_LANG_ASSERT (LANGUAGE)
  5607. Check statically that the current language is LANGUAGE. You
  5608. should use this in your language specific macros to avoid that
  5609. they be called with an inappropriate language.
  5610. This macro runs only at `autoconf' time, and incurs no cost at
  5611. `configure' time. Sadly enough and because Autoconf is a two
  5612. layer language (1), the macros `AC_LANG_PUSH' and `AC_LANG_POP'
  5613. cannot be "optimizing", therefore as much as possible you ought to
  5614. avoid using them to wrap your code, rather, require from the user
  5615. to run the macro with a correct current language, and check it
  5616. with `AC_LANG_ASSERT'. And anyway, that may help the user
  5617. understand she is running a Fortran macro while expecting a result
  5618. about her Fortran 77 compiler...
  5619. -- Macro: AC_REQUIRE_CPP
  5620. Ensure that whichever preprocessor would currently be used for
  5621. tests has been found. Calls `AC_REQUIRE' (*note Prerequisite
  5622. Macros::) with an argument of either `AC_PROG_CPP' or
  5623. `AC_PROG_CXXCPP', depending on which language is current.
  5624. ---------- Footnotes ----------
  5625. (1) Because M4 is not aware of Sh code, especially conditionals,
  5626. some optimizations that look nice statically may produce incorrect
  5627. results at runtime.
  5628. 
  5629. File: autoconf.info, Node: Writing Test Programs, Next: Running the Preprocessor, Prev: Language Choice, Up: Writing Tests
  5630. 6.2 Writing Test Programs
  5631. =========================
  5632. Autoconf tests follow a common scheme: feed some program with some
  5633. input, and most of the time, feed a compiler with some source file.
  5634. This section is dedicated to these source samples.
  5635. * Menu:
  5636. * Guidelines:: General rules for writing test programs
  5637. * Test Functions:: Avoiding pitfalls in test programs
  5638. * Generating Sources:: Source program boilerplate
  5639. 
  5640. File: autoconf.info, Node: Guidelines, Next: Test Functions, Up: Writing Test Programs
  5641. 6.2.1 Guidelines for Test Programs
  5642. ----------------------------------
  5643. The most important rule to follow when writing testing samples is:
  5644. _Look for realism._
  5645. This motto means that testing samples must be written with the same
  5646. strictness as real programs are written. In particular, you should
  5647. avoid "shortcuts" and simplifications.
  5648. Don't just play with the preprocessor if you want to prepare a
  5649. compilation. For instance, using `cpp' to check whether a header is
  5650. functional might let your `configure' accept a header which causes some
  5651. _compiler_ error. Do not hesitate to check a header with other headers
  5652. included before, especially required headers.
  5653. Make sure the symbols you use are properly defined, i.e., refrain
  5654. from simply declaring a function yourself instead of including the
  5655. proper header.
  5656. Test programs should not write to standard output. They should exit
  5657. with status 0 if the test succeeds, and with status 1 otherwise, so
  5658. that success can be distinguished easily from a core dump or other
  5659. failure; segmentation violations and other failures produce a nonzero
  5660. exit status. Unless you arrange for `exit' to be declared, test
  5661. programs should `return', not `exit', from `main', because on many
  5662. systems `exit' is not declared by default.
  5663. Test programs can use `#if' or `#ifdef' to check the values of
  5664. preprocessor macros defined by tests that have already run. For
  5665. example, if you call `AC_HEADER_STDBOOL', then later on in
  5666. `configure.ac' you can have a test program that includes `stdbool.h'
  5667. conditionally:
  5668. #ifdef HAVE_STDBOOL_H
  5669. # include <stdbool.h>
  5670. #endif
  5671. Both `#if HAVE_STDBOOL_H' and `#ifdef HAVE_STDBOOL_H' will work with
  5672. any standard C compiler. Some developers prefer `#if' because it is
  5673. easier to read, while others prefer `#ifdef' because it avoids
  5674. diagnostics with picky compilers like GCC with the `-Wundef' option.
  5675. If a test program needs to use or create a data file, give it a name
  5676. that starts with `conftest', such as `conftest.data'. The `configure'
  5677. script cleans up by running `rm -f -r conftest*' after running test
  5678. programs and if the script is interrupted.
  5679. 
  5680. File: autoconf.info, Node: Test Functions, Next: Generating Sources, Prev: Guidelines, Up: Writing Test Programs
  5681. 6.2.2 Test Functions
  5682. --------------------
  5683. These days it's safe to assume support for function prototypes
  5684. (introduced in C89).
  5685. Functions that test programs declare should also be conditionalized
  5686. for C++, which requires `extern "C"' prototypes. Make sure to not
  5687. include any header files containing clashing prototypes.
  5688. #ifdef __cplusplus
  5689. extern "C"
  5690. #endif
  5691. void *valloc (size_t);
  5692. If a test program calls a function with invalid parameters (just to
  5693. see whether it exists), organize the program to ensure that it never
  5694. invokes that function. You can do this by calling it in another
  5695. function that is never invoked. You can't do it by putting it after a
  5696. call to `exit', because GCC version 2 knows that `exit' never returns
  5697. and optimizes out any code that follows it in the same block.
  5698. If you include any header files, be sure to call the functions
  5699. relevant to them with the correct number of arguments, even if they are
  5700. just 0, to avoid compilation errors due to prototypes. GCC version 2
  5701. has internal prototypes for several functions that it automatically
  5702. inlines; for example, `memcpy'. To avoid errors when checking for
  5703. them, either pass them the correct number of arguments or redeclare them
  5704. with a different return type (such as `char').
  5705. 
  5706. File: autoconf.info, Node: Generating Sources, Prev: Test Functions, Up: Writing Test Programs
  5707. 6.2.3 Generating Sources
  5708. ------------------------
  5709. Autoconf provides a set of macros that can be used to generate test
  5710. source files. They are written to be language generic, i.e., they
  5711. actually depend on the current language (*note Language Choice::) to
  5712. "format" the output properly.
  5713. -- Macro: AC_LANG_CONFTEST (SOURCE)
  5714. Save the SOURCE text in the current test source file:
  5715. `conftest.EXTENSION' where the EXTENSION depends on the current
  5716. language. As of Autoconf 2.63b, the source file also contains the
  5717. results of all of the `AC_DEFINE' performed so far.
  5718. Note that the SOURCE is evaluated exactly once, like regular
  5719. Autoconf macro arguments, and therefore (i) you may pass a macro
  5720. invocation, (ii) if not, be sure to double quote if needed.
  5721. This macro issues a warning during `autoconf' processing if SOURCE
  5722. does not include an expansion of the macro
  5723. `AC_LANG_DEFINES_PROVIDED' (note that both `AC_LANG_SOURCE' and
  5724. `AC_LANG_PROGRAM' call this macro, and thus avoid the warning).
  5725. This macro is seldom called directly, but is used under the hood
  5726. by more common macros such as `AC_COMPILE_IFELSE' and
  5727. `AC_RUN_IFELSE'.
  5728. -- Macro: AC_LANG_DEFINES_PROVIDED
  5729. This macro is called as a witness that the file
  5730. `conftest.EXTENSION' appropriate for the current language is
  5731. complete, including all previously determined results from
  5732. `AC_DEFINE'. This macro is seldom called directly, but exists if
  5733. you have a compelling reason to write a conftest file without using
  5734. `AC_LANG_SOURCE', yet still want to avoid a syntax warning from
  5735. `AC_LANG_CONFTEST'.
  5736. -- Macro: AC_LANG_SOURCE (SOURCE)
  5737. Expands into the SOURCE, with the definition of all the
  5738. `AC_DEFINE' performed so far. This macro includes an expansion of
  5739. `AC_LANG_DEFINES_PROVIDED'.
  5740. In many cases, you may find it more convenient to use the wrapper
  5741. `AC_LANG_PROGRAM'.
  5742. For instance, executing (observe the double quotation!):
  5743. AC_INIT([Hello], [1.0], [bug-hello@example.org], [],
  5744. [http://www.example.org/])
  5745. AC_DEFINE([HELLO_WORLD], ["Hello, World\n"],
  5746. [Greetings string.])
  5747. AC_LANG([C])
  5748. AC_LANG_CONFTEST(
  5749. [AC_LANG_SOURCE([[const char hw[] = "Hello, World\n";]])])
  5750. gcc -E -dD conftest.c
  5751. on a system with `gcc' installed, results in:
  5752. ...
  5753. # 1 "conftest.c"
  5754. #define PACKAGE_NAME "Hello"
  5755. #define PACKAGE_TARNAME "hello"
  5756. #define PACKAGE_VERSION "1.0"
  5757. #define PACKAGE_STRING "Hello 1.0"
  5758. #define PACKAGE_BUGREPORT "bug-hello@example.org"
  5759. #define PACKAGE_URL "http://www.example.org/"
  5760. #define HELLO_WORLD "Hello, World\n"
  5761. const char hw[] = "Hello, World\n";
  5762. When the test language is Fortran, Erlang, or Go, the `AC_DEFINE'
  5763. definitions are not automatically translated into constants in the
  5764. source code by this macro.
  5765. -- Macro: AC_LANG_PROGRAM (PROLOGUE, BODY)
  5766. Expands into a source file which consists of the PROLOGUE, and
  5767. then BODY as body of the main function (e.g., `main' in C). Since
  5768. it uses `AC_LANG_SOURCE', the features of the latter are available.
  5769. For instance:
  5770. AC_INIT([Hello], [1.0], [bug-hello@example.org], [],
  5771. [http://www.example.org/])
  5772. AC_DEFINE([HELLO_WORLD], ["Hello, World\n"],
  5773. [Greetings string.])
  5774. AC_LANG_CONFTEST(
  5775. [AC_LANG_PROGRAM([[const char hw[] = "Hello, World\n";]],
  5776. [[fputs (hw, stdout);]])])
  5777. gcc -E -dD conftest.c
  5778. on a system with `gcc' installed, results in:
  5779. ...
  5780. # 1 "conftest.c"
  5781. #define PACKAGE_NAME "Hello"
  5782. #define PACKAGE_TARNAME "hello"
  5783. #define PACKAGE_VERSION "1.0"
  5784. #define PACKAGE_STRING "Hello 1.0"
  5785. #define PACKAGE_BUGREPORT "bug-hello@example.org"
  5786. #define PACKAGE_URL "http://www.example.org/"
  5787. #define HELLO_WORLD "Hello, World\n"
  5788. const char hw[] = "Hello, World\n";
  5789. int
  5790. main ()
  5791. {
  5792. fputs (hw, stdout);
  5793. ;
  5794. return 0;
  5795. }
  5796. In Erlang tests, the created source file is that of an Erlang module
  5797. called `conftest' (`conftest.erl'). This module defines and exports at
  5798. least one `start/0' function, which is called to perform the test. The
  5799. PROLOGUE is optional code that is inserted between the module header and
  5800. the `start/0' function definition. BODY is the body of the `start/0'
  5801. function without the final period (*note Runtime::, about constraints
  5802. on this function's behavior).
  5803. For instance:
  5804. AC_INIT([Hello], [1.0], [bug-hello@example.org])
  5805. AC_LANG(Erlang)
  5806. AC_LANG_CONFTEST(
  5807. [AC_LANG_PROGRAM([[-define(HELLO_WORLD, "Hello, world!").]],
  5808. [[io:format("~s~n", [?HELLO_WORLD])]])])
  5809. cat conftest.erl
  5810. results in:
  5811. -module(conftest).
  5812. -export([start/0]).
  5813. -define(HELLO_WORLD, "Hello, world!").
  5814. start() ->
  5815. io:format("~s~n", [?HELLO_WORLD])
  5816. .
  5817. -- Macro: AC_LANG_CALL (PROLOGUE, FUNCTION)
  5818. Expands into a source file which consists of the PROLOGUE, and
  5819. then a call to the FUNCTION as body of the main function (e.g.,
  5820. `main' in C). Since it uses `AC_LANG_PROGRAM', the feature of the
  5821. latter are available.
  5822. This function will probably be replaced in the future by a version
  5823. which would enable specifying the arguments. The use of this
  5824. macro is not encouraged, as it violates strongly the typing system.
  5825. This macro cannot be used for Erlang tests.
  5826. -- Macro: AC_LANG_FUNC_LINK_TRY (FUNCTION)
  5827. Expands into a source file which uses the FUNCTION in the body of
  5828. the main function (e.g., `main' in C). Since it uses
  5829. `AC_LANG_PROGRAM', the features of the latter are available.
  5830. As `AC_LANG_CALL', this macro is documented only for completeness.
  5831. It is considered to be severely broken, and in the future will be
  5832. removed in favor of actual function calls (with properly typed
  5833. arguments).
  5834. This macro cannot be used for Erlang tests.
  5835. 
  5836. File: autoconf.info, Node: Running the Preprocessor, Next: Running the Compiler, Prev: Writing Test Programs, Up: Writing Tests
  5837. 6.3 Running the Preprocessor
  5838. ============================
  5839. Sometimes one might need to run the preprocessor on some source file.
  5840. _Usually it is a bad idea_, as you typically need to _compile_ your
  5841. project, not merely run the preprocessor on it; therefore you certainly
  5842. want to run the compiler, not the preprocessor. Resist the temptation
  5843. of following the easiest path.
  5844. Nevertheless, if you need to run the preprocessor, then use
  5845. `AC_PREPROC_IFELSE'.
  5846. The macros described in this section cannot be used for tests in
  5847. Erlang, Fortran, or Go, since those languages require no preprocessor.
  5848. -- Macro: AC_PREPROC_IFELSE (INPUT, [ACTION-IF-TRUE],
  5849. [ACTION-IF-FALSE])
  5850. Run the preprocessor of the current language (*note Language
  5851. Choice::) on the INPUT, run the shell commands ACTION-IF-TRUE on
  5852. success, ACTION-IF-FALSE otherwise. The INPUT can be made by
  5853. `AC_LANG_PROGRAM' and friends.
  5854. This macro uses `CPPFLAGS', but not `CFLAGS', because `-g', `-O',
  5855. etc. are not valid options to many C preprocessors.
  5856. It is customary to report unexpected failures with
  5857. `AC_MSG_FAILURE'. If needed, ACTION-IF-TRUE can further access
  5858. the preprocessed output in the file `conftest.i'.
  5859. For instance:
  5860. AC_INIT([Hello], [1.0], [bug-hello@example.org])
  5861. AC_DEFINE([HELLO_WORLD], ["Hello, World\n"],
  5862. [Greetings string.])
  5863. AC_PREPROC_IFELSE(
  5864. [AC_LANG_PROGRAM([[const char hw[] = "Hello, World\n";]],
  5865. [[fputs (hw, stdout);]])],
  5866. [AC_MSG_RESULT([OK])],
  5867. [AC_MSG_FAILURE([unexpected preprocessor failure])])
  5868. results in:
  5869. checking for gcc... gcc
  5870. checking for C compiler default output file name... a.out
  5871. checking whether the C compiler works... yes
  5872. checking whether we are cross compiling... no
  5873. checking for suffix of executables...
  5874. checking for suffix of object files... o
  5875. checking whether we are using the GNU C compiler... yes
  5876. checking whether gcc accepts -g... yes
  5877. checking for gcc option to accept ISO C89... none needed
  5878. checking how to run the C preprocessor... gcc -E
  5879. OK
  5880. The macro `AC_TRY_CPP' (*note Obsolete Macros::) used to play the
  5881. role of `AC_PREPROC_IFELSE', but double quotes its argument, making it
  5882. impossible to use it to elaborate sources. You are encouraged to get
  5883. rid of your old use of the macro `AC_TRY_CPP' in favor of
  5884. `AC_PREPROC_IFELSE', but, in the first place, are you sure you need to
  5885. run the _preprocessor_ and not the compiler?
  5886. -- Macro: AC_EGREP_HEADER (PATTERN, HEADER-FILE, ACTION-IF-FOUND,
  5887. [ACTION-IF-NOT-FOUND])
  5888. If the output of running the preprocessor on the system header file
  5889. HEADER-FILE matches the extended regular expression PATTERN,
  5890. execute shell commands ACTION-IF-FOUND, otherwise execute
  5891. ACTION-IF-NOT-FOUND.
  5892. -- Macro: AC_EGREP_CPP (PATTERN, PROGRAM, [ACTION-IF-FOUND],
  5893. [ACTION-IF-NOT-FOUND])
  5894. PROGRAM is the text of a C or C++ program, on which shell
  5895. variable, back quote, and backslash substitutions are performed.
  5896. If the output of running the preprocessor on PROGRAM matches the
  5897. extended regular expression PATTERN, execute shell commands
  5898. ACTION-IF-FOUND, otherwise execute ACTION-IF-NOT-FOUND.
  5899. 
  5900. File: autoconf.info, Node: Running the Compiler, Next: Running the Linker, Prev: Running the Preprocessor, Up: Writing Tests
  5901. 6.4 Running the Compiler
  5902. ========================
  5903. To check for a syntax feature of the current language's (*note Language
  5904. Choice::) compiler, such as whether it recognizes a certain keyword, or
  5905. simply to try some library feature, use `AC_COMPILE_IFELSE' to try to
  5906. compile a small program that uses that feature.
  5907. -- Macro: AC_COMPILE_IFELSE (INPUT, [ACTION-IF-TRUE],
  5908. [ACTION-IF-FALSE])
  5909. Run the compiler and compilation flags of the current language
  5910. (*note Language Choice::) on the INPUT, run the shell commands
  5911. ACTION-IF-TRUE on success, ACTION-IF-FALSE otherwise. The INPUT
  5912. can be made by `AC_LANG_PROGRAM' and friends.
  5913. It is customary to report unexpected failures with
  5914. `AC_MSG_FAILURE'. This macro does not try to link; use
  5915. `AC_LINK_IFELSE' if you need to do that (*note Running the
  5916. Linker::). If needed, ACTION-IF-TRUE can further access the
  5917. just-compiled object file `conftest.$OBJEXT'.
  5918. This macro uses `AC_REQUIRE' for the compiler associated with the
  5919. current language, which means that if the compiler has not yet been
  5920. determined, the compiler determination will be made prior to the
  5921. body of the outermost `AC_DEFUN' macro that triggered this macro to
  5922. expand (*note Expanded Before Required::).
  5923. For tests in Erlang, the INPUT must be the source code of a module
  5924. named `conftest'. `AC_COMPILE_IFELSE' generates a `conftest.beam' file
  5925. that can be interpreted by the Erlang virtual machine (`ERL'). It is
  5926. recommended to use `AC_LANG_PROGRAM' to specify the test program, to
  5927. ensure that the Erlang module has the right name.
  5928. 
  5929. File: autoconf.info, Node: Running the Linker, Next: Runtime, Prev: Running the Compiler, Up: Writing Tests
  5930. 6.5 Running the Linker
  5931. ======================
  5932. To check for a library, a function, or a global variable, Autoconf
  5933. `configure' scripts try to compile and link a small program that uses
  5934. it. This is unlike Metaconfig, which by default uses `nm' or `ar' on
  5935. the C library to try to figure out which functions are available.
  5936. Trying to link with the function is usually a more reliable approach
  5937. because it avoids dealing with the variations in the options and output
  5938. formats of `nm' and `ar' and in the location of the standard libraries.
  5939. It also allows configuring for cross-compilation or checking a
  5940. function's runtime behavior if needed. On the other hand, it can be
  5941. slower than scanning the libraries once, but accuracy is more important
  5942. than speed.
  5943. `AC_LINK_IFELSE' is used to compile test programs to test for
  5944. functions and global variables. It is also used by `AC_CHECK_LIB' to
  5945. check for libraries (*note Libraries::), by adding the library being
  5946. checked for to `LIBS' temporarily and trying to link a small program.
  5947. -- Macro: AC_LINK_IFELSE (INPUT, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
  5948. Run the compiler (and compilation flags) and the linker of the
  5949. current language (*note Language Choice::) on the INPUT, run the
  5950. shell commands ACTION-IF-TRUE on success, ACTION-IF-FALSE
  5951. otherwise. The INPUT can be made by `AC_LANG_PROGRAM' and
  5952. friends. If needed, ACTION-IF-TRUE can further access the
  5953. just-linked program file `conftest$EXEEXT'.
  5954. `LDFLAGS' and `LIBS' are used for linking, in addition to the
  5955. current compilation flags.
  5956. It is customary to report unexpected failures with
  5957. `AC_MSG_FAILURE'. This macro does not try to execute the program;
  5958. use `AC_RUN_IFELSE' if you need to do that (*note Runtime::).
  5959. The `AC_LINK_IFELSE' macro cannot be used for Erlang tests, since
  5960. Erlang programs are interpreted and do not require linking.
  5961. 
  5962. File: autoconf.info, Node: Runtime, Next: Systemology, Prev: Running the Linker, Up: Writing Tests
  5963. 6.6 Checking Runtime Behavior
  5964. =============================
  5965. Sometimes you need to find out how a system performs at runtime, such
  5966. as whether a given function has a certain capability or bug. If you
  5967. can, make such checks when your program runs instead of when it is
  5968. configured. You can check for things like the machine's endianness when
  5969. your program initializes itself.
  5970. If you really need to test for a runtime behavior while configuring,
  5971. you can write a test program to determine the result, and compile and
  5972. run it using `AC_RUN_IFELSE'. Avoid running test programs if possible,
  5973. because this prevents people from configuring your package for
  5974. cross-compiling.
  5975. -- Macro: AC_RUN_IFELSE (INPUT, [ACTION-IF-TRUE], [ACTION-IF-FALSE],
  5976. [ACTION-IF-CROSS-COMPILING = `AC_MSG_FAILURE'])
  5977. Run the compiler (and compilation flags) and the linker of the
  5978. current language (*note Language Choice::) on the INPUT, then
  5979. execute the resulting program. If the program returns an exit
  5980. status of 0 when executed, run shell commands ACTION-IF-TRUE.
  5981. Otherwise, run shell commands ACTION-IF-FALSE.
  5982. The INPUT can be made by `AC_LANG_PROGRAM' and friends. `LDFLAGS'
  5983. and `LIBS' are used for linking, in addition to the compilation
  5984. flags of the current language (*note Language Choice::).
  5985. Additionally, ACTION-IF-TRUE can run `./conftest$EXEEXT' for
  5986. further testing.
  5987. In the ACTION-IF-FALSE section, the failing exit status is
  5988. available in the shell variable `$?'. This exit status might be
  5989. that of a failed compilation, or it might be that of a failed
  5990. program execution.
  5991. If cross-compilation mode is enabled (this is the case if either
  5992. the compiler being used does not produce executables that run on
  5993. the system where `configure' is being run, or if the options
  5994. `--build' and `--host' were both specified and their values are
  5995. different), then the test program is not run. If the optional
  5996. shell commands ACTION-IF-CROSS-COMPILING are given, those commands
  5997. are run instead; typically these commands provide pessimistic
  5998. defaults that allow cross-compilation to work even if the guess
  5999. was wrong. If the fourth argument is empty or omitted, but
  6000. cross-compilation is detected, then `configure' prints an error
  6001. message and exits. If you want your package to be useful in a
  6002. cross-compilation scenario, you _should_ provide a non-empty
  6003. ACTION-IF-CROSS-COMPILING clause, as well as wrap the
  6004. `AC_RUN_IFELSE' compilation inside an `AC_CACHE_CHECK' (*note
  6005. Caching Results::) which allows the user to override the
  6006. pessimistic default if needed.
  6007. It is customary to report unexpected failures with
  6008. `AC_MSG_FAILURE'.
  6009. `autoconf' prints a warning message when creating `configure' each
  6010. time it encounters a call to `AC_RUN_IFELSE' with no
  6011. ACTION-IF-CROSS-COMPILING argument given. If you are not concerned
  6012. about users configuring your package for cross-compilation, you may
  6013. ignore the warning. A few of the macros distributed with Autoconf
  6014. produce this warning message; but if this is a problem for you, please
  6015. report it as a bug, along with an appropriate pessimistic guess to use
  6016. instead.
  6017. To configure for cross-compiling you can also choose a value for
  6018. those parameters based on the canonical system name (*note Manual
  6019. Configuration::). Alternatively, set up a test results cache file with
  6020. the correct values for the host system (*note Caching Results::).
  6021. To provide a default for calls of `AC_RUN_IFELSE' that are embedded
  6022. in other macros, including a few of the ones that come with Autoconf,
  6023. you can test whether the shell variable `cross_compiling' is set to
  6024. `yes', and then use an alternate method to get the results instead of
  6025. calling the macros.
  6026. It is also permissible to temporarily assign to `cross_compiling' in
  6027. order to force tests to behave as though they are in a
  6028. cross-compilation environment, particularly since this provides a way to
  6029. test your ACTION-IF-CROSS-COMPILING even when you are not using a
  6030. cross-compiler.
  6031. # We temporarily set cross-compile mode to force AC_COMPUTE_INT
  6032. # to use the slow link-only method
  6033. save_cross_compiling=$cross_compiling
  6034. cross_compiling=yes
  6035. AC_COMPUTE_INT([...])
  6036. cross_compiling=$save_cross_compiling
  6037. A C or C++ runtime test should be portable. *Note Portable C and
  6038. C++::.
  6039. Erlang tests must exit themselves the Erlang VM by calling the
  6040. `halt/1' function: the given status code is used to determine the
  6041. success of the test (status is `0') or its failure (status is different
  6042. than `0'), as explained above. It must be noted that data output
  6043. through the standard output (e.g., using `io:format/2') may be
  6044. truncated when halting the VM. Therefore, if a test must output
  6045. configuration information, it is recommended to create and to output
  6046. data into the temporary file named `conftest.out', using the functions
  6047. of module `file'. The `conftest.out' file is automatically deleted by
  6048. the `AC_RUN_IFELSE' macro. For instance, a simplified implementation
  6049. of Autoconf's `AC_ERLANG_SUBST_LIB_DIR' macro is:
  6050. AC_INIT([LibdirTest], [1.0], [bug-libdirtest@example.org])
  6051. AC_ERLANG_NEED_ERL
  6052. AC_LANG(Erlang)
  6053. AC_RUN_IFELSE(
  6054. [AC_LANG_PROGRAM([], [dnl
  6055. file:write_file("conftest.out", code:lib_dir()),
  6056. halt(0)])],
  6057. [echo "code:lib_dir() returned: `cat conftest.out`"],
  6058. [AC_MSG_FAILURE([test Erlang program execution failed])])
  6059. 
  6060. File: autoconf.info, Node: Systemology, Next: Multiple Cases, Prev: Runtime, Up: Writing Tests
  6061. 6.7 Systemology
  6062. ===============
  6063. This section aims at presenting some systems and pointers to
  6064. documentation. It may help you addressing particular problems reported
  6065. by users.
  6066. Posix-conforming systems (http://www.opengroup.org/susv3) are
  6067. derived from the Unix operating system
  6068. (http://www.bell-labs.com/history/unix/).
  6069. The Rosetta Stone for Unix (http://bhami.com/rosetta.html) contains
  6070. a table correlating the features of various Posix-conforming systems.
  6071. Unix History (http://www.levenez.com/unix/) is a simplified diagram of
  6072. how many Unix systems were derived from each other.
  6073. The Heirloom Project (http://heirloom.sourceforge.net/) provides
  6074. some variants of traditional implementations of Unix utilities.
  6075. Darwin
  6076. Darwin is also known as Mac OS X. Beware that the file system
  6077. _can_ be case-preserving, but case insensitive. This can cause
  6078. nasty problems, since for instance the installation attempt for a
  6079. package having an `INSTALL' file can result in `make install'
  6080. report that nothing was to be done!
  6081. That's all dependent on whether the file system is a UFS (case
  6082. sensitive) or HFS+ (case preserving). By default Apple wants you
  6083. to install the OS on HFS+. Unfortunately, there are some pieces of
  6084. software which really need to be built on UFS. We may want to
  6085. rebuild Darwin to have both UFS and HFS+ available (and put the
  6086. /local/build tree on the UFS).
  6087. QNX 4.25
  6088. QNX is a realtime operating system running on Intel architecture
  6089. meant to be scalable from the small embedded systems to the hundred
  6090. processor super-computer. It claims to be Posix certified. More
  6091. information is available on the QNX home page
  6092. (http://www.qnx.com/).
  6093. Tru64
  6094. Documentation of several versions of Tru64
  6095. (http://h30097.www3.hp.com/docs/) is available in different
  6096. formats.
  6097. Unix version 7
  6098. Officially this was called the "Seventh Edition" of "the UNIX
  6099. time-sharing system" but we use the more-common name "Unix version
  6100. 7". Documentation is available in the Unix Seventh Edition Manual
  6101. (http://plan9.bell-labs.com/7thEdMan/). Previous versions of Unix
  6102. are called "Unix version 6", etc., but they were not as widely
  6103. used.
  6104. 
  6105. File: autoconf.info, Node: Multiple Cases, Prev: Systemology, Up: Writing Tests
  6106. 6.8 Multiple Cases
  6107. ==================
  6108. Some operations are accomplished in several possible ways, depending on
  6109. the OS variant. Checking for them essentially requires a "case
  6110. statement". Autoconf does not directly provide one; however, it is
  6111. easy to simulate by using a shell variable to keep track of whether a
  6112. way to perform the operation has been found yet.
  6113. Here is an example that uses the shell variable `fstype' to keep
  6114. track of whether the remaining cases need to be checked. Note that
  6115. since the value of `fstype' is under our control, we don't have to use
  6116. the longer `test "x$fstype" = xno'.
  6117. AC_MSG_CHECKING([how to get file system type])
  6118. fstype=no
  6119. # The order of these tests is important.
  6120. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/statvfs.h>
  6121. #include <sys/fstyp.h>]])],
  6122. [AC_DEFINE([FSTYPE_STATVFS], [1],
  6123. [Define if statvfs exists.])
  6124. fstype=SVR4])
  6125. if test $fstype = no; then
  6126. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/statfs.h>
  6127. #include <sys/fstyp.h>]])],
  6128. [AC_DEFINE([FSTYPE_USG_STATFS], [1],
  6129. [Define if USG statfs.])
  6130. fstype=SVR3])
  6131. fi
  6132. if test $fstype = no; then
  6133. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/statfs.h>
  6134. #include <sys/vmount.h>]])]),
  6135. [AC_DEFINE([FSTYPE_AIX_STATFS], [1],
  6136. [Define if AIX statfs.])
  6137. fstype=AIX])
  6138. fi
  6139. # (more cases omitted here)
  6140. AC_MSG_RESULT([$fstype])
  6141. 
  6142. File: autoconf.info, Node: Results, Next: Programming in M4, Prev: Writing Tests, Up: Top
  6143. 7 Results of Tests
  6144. ******************
  6145. Once `configure' has determined whether a feature exists, what can it
  6146. do to record that information? There are four sorts of things it can
  6147. do: define a C preprocessor symbol, set a variable in the output files,
  6148. save the result in a cache file for future `configure' runs, and print
  6149. a message letting the user know the result of the test.
  6150. * Menu:
  6151. * Defining Symbols:: Defining C preprocessor symbols
  6152. * Setting Output Variables:: Replacing variables in output files
  6153. * Special Chars in Variables:: Characters to beware of in variables
  6154. * Caching Results:: Speeding up subsequent `configure' runs
  6155. * Printing Messages:: Notifying `configure' users
  6156. 
  6157. File: autoconf.info, Node: Defining Symbols, Next: Setting Output Variables, Up: Results
  6158. 7.1 Defining C Preprocessor Symbols
  6159. ===================================
  6160. A common action to take in response to a feature test is to define a C
  6161. preprocessor symbol indicating the results of the test. That is done by
  6162. calling `AC_DEFINE' or `AC_DEFINE_UNQUOTED'.
  6163. By default, `AC_OUTPUT' places the symbols defined by these macros
  6164. into the output variable `DEFS', which contains an option
  6165. `-DSYMBOL=VALUE' for each symbol defined. Unlike in Autoconf version
  6166. 1, there is no variable `DEFS' defined while `configure' is running.
  6167. To check whether Autoconf macros have already defined a certain C
  6168. preprocessor symbol, test the value of the appropriate cache variable,
  6169. as in this example:
  6170. AC_CHECK_FUNC([vprintf], [AC_DEFINE([HAVE_VPRINTF], [1],
  6171. [Define if vprintf exists.])])
  6172. if test "x$ac_cv_func_vprintf" != xyes; then
  6173. AC_CHECK_FUNC([_doprnt], [AC_DEFINE([HAVE_DOPRNT], [1],
  6174. [Define if _doprnt exists.])])
  6175. fi
  6176. If `AC_CONFIG_HEADERS' has been called, then instead of creating
  6177. `DEFS', `AC_OUTPUT' creates a header file by substituting the correct
  6178. values into `#define' statements in a template file. *Note
  6179. Configuration Headers::, for more information about this kind of output.
  6180. -- Macro: AC_DEFINE (VARIABLE, VALUE, [DESCRIPTION])
  6181. -- Macro: AC_DEFINE (VARIABLE)
  6182. Define VARIABLE to VALUE (verbatim), by defining a C preprocessor
  6183. macro for VARIABLE. VARIABLE should be a C identifier, optionally
  6184. suffixed by a parenthesized argument list to define a C
  6185. preprocessor macro with arguments. The macro argument list, if
  6186. present, should be a comma-separated list of C identifiers,
  6187. possibly terminated by an ellipsis `...' if C99 syntax is employed.
  6188. VARIABLE should not contain comments, white space, trigraphs,
  6189. backslash-newlines, universal character names, or non-ASCII
  6190. characters.
  6191. VALUE may contain backslash-escaped newlines, which will be
  6192. preserved if you use `AC_CONFIG_HEADERS' but flattened if passed
  6193. via `@DEFS@' (with no effect on the compilation, since the
  6194. preprocessor sees only one line in the first place). VALUE should
  6195. not contain raw newlines. If you are not using
  6196. `AC_CONFIG_HEADERS', VALUE should not contain any `#' characters,
  6197. as `make' tends to eat them. To use a shell variable, use
  6198. `AC_DEFINE_UNQUOTED' instead.
  6199. DESCRIPTION is only useful if you are using `AC_CONFIG_HEADERS'.
  6200. In this case, DESCRIPTION is put into the generated `config.h.in'
  6201. as the comment before the macro define. The following example
  6202. defines the C preprocessor variable `EQUATION' to be the string
  6203. constant `"$a > $b"':
  6204. AC_DEFINE([EQUATION], ["$a > $b"],
  6205. [Equation string.])
  6206. If neither VALUE nor DESCRIPTION are given, then VALUE defaults to
  6207. 1 instead of to the empty string. This is for backwards
  6208. compatibility with older versions of Autoconf, but this usage is
  6209. obsolescent and may be withdrawn in future versions of Autoconf.
  6210. If the VARIABLE is a literal string, it is passed to
  6211. `m4_pattern_allow' (*note Forbidden Patterns::).
  6212. If multiple `AC_DEFINE' statements are executed for the same
  6213. VARIABLE name (not counting any parenthesized argument list), the
  6214. last one wins.
  6215. -- Macro: AC_DEFINE_UNQUOTED (VARIABLE, VALUE, [DESCRIPTION])
  6216. -- Macro: AC_DEFINE_UNQUOTED (VARIABLE)
  6217. Like `AC_DEFINE', but three shell expansions are
  6218. performed--once--on VARIABLE and VALUE: variable expansion (`$'),
  6219. command substitution (``'), and backslash escaping (`\'), as if in
  6220. an unquoted here-document. Single and double quote characters in
  6221. the value have no special meaning. Use this macro instead of
  6222. `AC_DEFINE' when VARIABLE or VALUE is a shell variable. Examples:
  6223. AC_DEFINE_UNQUOTED([config_machfile], ["$machfile"],
  6224. [Configuration machine file.])
  6225. AC_DEFINE_UNQUOTED([GETGROUPS_T], [$ac_cv_type_getgroups],
  6226. [getgroups return type.])
  6227. AC_DEFINE_UNQUOTED([$ac_tr_hdr], [1],
  6228. [Translated header name.])
  6229. Due to a syntactical bizarreness of the Bourne shell, do not use
  6230. semicolons to separate `AC_DEFINE' or `AC_DEFINE_UNQUOTED' calls from
  6231. other macro calls or shell code; that can cause syntax errors in the
  6232. resulting `configure' script. Use either blanks or newlines. That is,
  6233. do this:
  6234. AC_CHECK_HEADER([elf.h],
  6235. [AC_DEFINE([SVR4], [1], [System V Release 4]) LIBS="-lelf $LIBS"])
  6236. or this:
  6237. AC_CHECK_HEADER([elf.h],
  6238. [AC_DEFINE([SVR4], [1], [System V Release 4])
  6239. LIBS="-lelf $LIBS"])
  6240. instead of this:
  6241. AC_CHECK_HEADER([elf.h],
  6242. [AC_DEFINE([SVR4], [1], [System V Release 4]); LIBS="-lelf $LIBS"])
  6243. 
  6244. File: autoconf.info, Node: Setting Output Variables, Next: Special Chars in Variables, Prev: Defining Symbols, Up: Results
  6245. 7.2 Setting Output Variables
  6246. ============================
  6247. Another way to record the results of tests is to set "output
  6248. variables", which are shell variables whose values are substituted into
  6249. files that `configure' outputs. The two macros below create new output
  6250. variables. *Note Preset Output Variables::, for a list of output
  6251. variables that are always available.
  6252. -- Macro: AC_SUBST (VARIABLE, [VALUE])
  6253. Create an output variable from a shell variable. Make `AC_OUTPUT'
  6254. substitute the variable VARIABLE into output files (typically one
  6255. or more makefiles). This means that `AC_OUTPUT' replaces
  6256. instances of `@VARIABLE@' in input files with the value that the
  6257. shell variable VARIABLE has when `AC_OUTPUT' is called. The value
  6258. can contain any non-`NUL' character, including newline. If you
  6259. are using Automake 1.11 or newer, for newlines in values you might
  6260. want to consider using `AM_SUBST_NOTMAKE' to prevent `automake'
  6261. from adding a line `VARIABLE = @VARIABLE@' to the `Makefile.in'
  6262. files (*note Automake: (automake)Optional.).
  6263. Variable occurrences should not overlap: e.g., an input file should
  6264. not contain `@VAR1@VAR2@' if VAR1 and VAR2 are variable names.
  6265. The substituted value is not rescanned for more output variables;
  6266. occurrences of `@VARIABLE@' in the value are inserted literally
  6267. into the output file. (The algorithm uses the special marker
  6268. `|#_!!_#|' internally, so neither the substituted value nor the
  6269. output file may contain `|#_!!_#|'.)
  6270. If VALUE is given, in addition assign it to VARIABLE.
  6271. The string VARIABLE is passed to `m4_pattern_allow' (*note
  6272. Forbidden Patterns::).
  6273. -- Macro: AC_SUBST_FILE (VARIABLE)
  6274. Another way to create an output variable from a shell variable.
  6275. Make `AC_OUTPUT' insert (without substitutions) the contents of
  6276. the file named by shell variable VARIABLE into output files. This
  6277. means that `AC_OUTPUT' replaces instances of `@VARIABLE@' in
  6278. output files (such as `Makefile.in') with the contents of the file
  6279. that the shell variable VARIABLE names when `AC_OUTPUT' is called.
  6280. Set the variable to `/dev/null' for cases that do not have a file
  6281. to insert. This substitution occurs only when the `@VARIABLE@' is
  6282. on a line by itself, optionally surrounded by spaces and tabs. The
  6283. substitution replaces the whole line, including the spaces, tabs,
  6284. and the terminating newline.
  6285. This macro is useful for inserting makefile fragments containing
  6286. special dependencies or other `make' directives for particular host
  6287. or target types into makefiles. For example, `configure.ac' could
  6288. contain:
  6289. AC_SUBST_FILE([host_frag])
  6290. host_frag=$srcdir/conf/sun4.mh
  6291. and then a `Makefile.in' could contain:
  6292. @host_frag@
  6293. The string VARIABLE is passed to `m4_pattern_allow' (*note
  6294. Forbidden Patterns::).
  6295. Running `configure' in varying environments can be extremely
  6296. dangerous. If for instance the user runs `CC=bizarre-cc ./configure',
  6297. then the cache, `config.h', and many other output files depend upon
  6298. `bizarre-cc' being the C compiler. If for some reason the user runs
  6299. `./configure' again, or if it is run via `./config.status --recheck',
  6300. (*Note Automatic Remaking::, and *note config.status Invocation::),
  6301. then the configuration can be inconsistent, composed of results
  6302. depending upon two different compilers.
  6303. Environment variables that affect this situation, such as `CC'
  6304. above, are called "precious variables", and can be declared as such by
  6305. `AC_ARG_VAR'.
  6306. -- Macro: AC_ARG_VAR (VARIABLE, DESCRIPTION)
  6307. Declare VARIABLE is a precious variable, and include its
  6308. DESCRIPTION in the variable section of `./configure --help'.
  6309. Being precious means that
  6310. - VARIABLE is substituted via `AC_SUBST'.
  6311. - The value of VARIABLE when `configure' was launched is saved
  6312. in the cache, including if it was not specified on the command
  6313. line but via the environment. Indeed, while `configure' can
  6314. notice the definition of `CC' in `./configure CC=bizarre-cc',
  6315. it is impossible to notice it in `CC=bizarre-cc ./configure',
  6316. which, unfortunately, is what most users do.
  6317. We emphasize that it is the _initial_ value of VARIABLE which
  6318. is saved, not that found during the execution of `configure'.
  6319. Indeed, specifying `./configure FOO=foo' and letting
  6320. `./configure' guess that `FOO' is `foo' can be two different
  6321. things.
  6322. - VARIABLE is checked for consistency between two `configure'
  6323. runs. For instance:
  6324. $ ./configure --silent --config-cache
  6325. $ CC=cc ./configure --silent --config-cache
  6326. configure: error: `CC' was not set in the previous run
  6327. configure: error: changes in the environment can compromise \
  6328. the build
  6329. configure: error: run `make distclean' and/or \
  6330. `rm config.cache' and start over
  6331. and similarly if the variable is unset, or if its content is
  6332. changed. If the content has white space changes only, then
  6333. the error is degraded to a warning only, but the old value is
  6334. reused.
  6335. - VARIABLE is kept during automatic reconfiguration (*note
  6336. config.status Invocation::) as if it had been passed as a
  6337. command line argument, including when no cache is used:
  6338. $ CC=/usr/bin/cc ./configure var=raboof --silent
  6339. $ ./config.status --recheck
  6340. running CONFIG_SHELL=/bin/sh /bin/sh ./configure var=raboof \
  6341. CC=/usr/bin/cc --no-create --no-recursion
  6342. 
  6343. File: autoconf.info, Node: Special Chars in Variables, Next: Caching Results, Prev: Setting Output Variables, Up: Results
  6344. 7.3 Special Characters in Output Variables
  6345. ==========================================
  6346. Many output variables are intended to be evaluated both by `make' and
  6347. by the shell. Some characters are expanded differently in these two
  6348. contexts, so to avoid confusion these variables' values should not
  6349. contain any of the following characters:
  6350. " # $ & ' ( ) * ; < > ? [ \ ^ ` |
  6351. Also, these variables' values should neither contain newlines, nor
  6352. start with `~', nor contain white space or `:' immediately followed by
  6353. `~'. The values can contain nonempty sequences of white space
  6354. characters like tabs and spaces, but each such sequence might
  6355. arbitrarily be replaced by a single space during substitution.
  6356. These restrictions apply both to the values that `configure'
  6357. computes, and to the values set directly by the user. For example, the
  6358. following invocations of `configure' are problematic, since they
  6359. attempt to use special characters within `CPPFLAGS' and white space
  6360. within `$(srcdir)':
  6361. CPPFLAGS='-DOUCH="&\"#$*?"' '../My Source/ouch-1.0/configure'
  6362. '../My Source/ouch-1.0/configure' CPPFLAGS='-DOUCH="&\"#$*?"'
  6363. 
  6364. File: autoconf.info, Node: Caching Results, Next: Printing Messages, Prev: Special Chars in Variables, Up: Results
  6365. 7.4 Caching Results
  6366. ===================
  6367. To avoid checking for the same features repeatedly in various
  6368. `configure' scripts (or in repeated runs of one script), `configure'
  6369. can optionally save the results of many checks in a "cache file" (*note
  6370. Cache Files::). If a `configure' script runs with caching enabled and
  6371. finds a cache file, it reads the results of previous runs from the
  6372. cache and avoids rerunning those checks. As a result, `configure' can
  6373. then run much faster than if it had to perform all of the checks every
  6374. time.
  6375. -- Macro: AC_CACHE_VAL (CACHE-ID, COMMANDS-TO-SET-IT)
  6376. Ensure that the results of the check identified by CACHE-ID are
  6377. available. If the results of the check were in the cache file
  6378. that was read, and `configure' was not given the `--quiet' or
  6379. `--silent' option, print a message saying that the result was
  6380. cached; otherwise, run the shell commands COMMANDS-TO-SET-IT. If
  6381. the shell commands are run to determine the value, the value is
  6382. saved in the cache file just before `configure' creates its output
  6383. files. *Note Cache Variable Names::, for how to choose the name
  6384. of the CACHE-ID variable.
  6385. The COMMANDS-TO-SET-IT _must have no side effects_ except for
  6386. setting the variable CACHE-ID, see below.
  6387. -- Macro: AC_CACHE_CHECK (MESSAGE, CACHE-ID, COMMANDS-TO-SET-IT)
  6388. A wrapper for `AC_CACHE_VAL' that takes care of printing the
  6389. messages. This macro provides a convenient shorthand for the most
  6390. common way to use these macros. It calls `AC_MSG_CHECKING' for
  6391. MESSAGE, then `AC_CACHE_VAL' with the CACHE-ID and COMMANDS
  6392. arguments, and `AC_MSG_RESULT' with CACHE-ID.
  6393. The COMMANDS-TO-SET-IT _must have no side effects_ except for
  6394. setting the variable CACHE-ID, see below.
  6395. It is common to find buggy macros using `AC_CACHE_VAL' or
  6396. `AC_CACHE_CHECK', because people are tempted to call `AC_DEFINE' in the
  6397. COMMANDS-TO-SET-IT. Instead, the code that _follows_ the call to
  6398. `AC_CACHE_VAL' should call `AC_DEFINE', by examining the value of the
  6399. cache variable. For instance, the following macro is broken:
  6400. AC_DEFUN([AC_SHELL_TRUE],
  6401. [AC_CACHE_CHECK([whether true(1) works], [my_cv_shell_true_works],
  6402. [my_cv_shell_true_works=no
  6403. (true) 2>/dev/null && my_cv_shell_true_works=yes
  6404. if test "x$my_cv_shell_true_works" = xyes; then
  6405. AC_DEFINE([TRUE_WORKS], [1],
  6406. [Define if `true(1)' works properly.])
  6407. fi])
  6408. ])
  6409. This fails if the cache is enabled: the second time this macro is run,
  6410. `TRUE_WORKS' _will not be defined_. The proper implementation is:
  6411. AC_DEFUN([AC_SHELL_TRUE],
  6412. [AC_CACHE_CHECK([whether true(1) works], [my_cv_shell_true_works],
  6413. [my_cv_shell_true_works=no
  6414. (true) 2>/dev/null && my_cv_shell_true_works=yes])
  6415. if test "x$my_cv_shell_true_works" = xyes; then
  6416. AC_DEFINE([TRUE_WORKS], [1],
  6417. [Define if `true(1)' works properly.])
  6418. fi
  6419. ])
  6420. Also, COMMANDS-TO-SET-IT should not print any messages, for example
  6421. with `AC_MSG_CHECKING'; do that before calling `AC_CACHE_VAL', so the
  6422. messages are printed regardless of whether the results of the check are
  6423. retrieved from the cache or determined by running the shell commands.
  6424. * Menu:
  6425. * Cache Variable Names:: Shell variables used in caches
  6426. * Cache Files:: Files `configure' uses for caching
  6427. * Cache Checkpointing:: Loading and saving the cache file
  6428. 
  6429. File: autoconf.info, Node: Cache Variable Names, Next: Cache Files, Up: Caching Results
  6430. 7.4.1 Cache Variable Names
  6431. --------------------------
  6432. The names of cache variables should have the following format:
  6433. PACKAGE-PREFIX_cv_VALUE-TYPE_SPECIFIC-VALUE_[ADDITIONAL-OPTIONS]
  6434. for example, `ac_cv_header_stat_broken' or
  6435. `ac_cv_prog_gcc_traditional'. The parts of the variable name are:
  6436. PACKAGE-PREFIX
  6437. An abbreviation for your package or organization; the same prefix
  6438. you begin local Autoconf macros with, except lowercase by
  6439. convention. For cache values used by the distributed Autoconf
  6440. macros, this value is `ac'.
  6441. `_cv_'
  6442. Indicates that this shell variable is a cache value. This string
  6443. _must_ be present in the variable name, including the leading
  6444. underscore.
  6445. VALUE-TYPE
  6446. A convention for classifying cache values, to produce a rational
  6447. naming system. The values used in Autoconf are listed in *note
  6448. Macro Names::.
  6449. SPECIFIC-VALUE
  6450. Which member of the class of cache values this test applies to.
  6451. For example, which function (`alloca'), program (`gcc'), or output
  6452. variable (`INSTALL').
  6453. ADDITIONAL-OPTIONS
  6454. Any particular behavior of the specific member that this test
  6455. applies to. For example, `broken' or `set'. This part of the
  6456. name may be omitted if it does not apply.
  6457. The values assigned to cache variables may not contain newlines.
  6458. Usually, their values are Boolean (`yes' or `no') or the names of files
  6459. or functions; so this is not an important restriction. *note Cache
  6460. Variable Index:: for an index of cache variables with documented
  6461. semantics.
  6462. 
  6463. File: autoconf.info, Node: Cache Files, Next: Cache Checkpointing, Prev: Cache Variable Names, Up: Caching Results
  6464. 7.4.2 Cache Files
  6465. -----------------
  6466. A cache file is a shell script that caches the results of configure
  6467. tests run on one system so they can be shared between configure scripts
  6468. and configure runs. It is not useful on other systems. If its contents
  6469. are invalid for some reason, the user may delete or edit it, or override
  6470. documented cache variables on the `configure' command line.
  6471. By default, `configure' uses no cache file, to avoid problems caused
  6472. by accidental use of stale cache files.
  6473. To enable caching, `configure' accepts `--config-cache' (or `-C') to
  6474. cache results in the file `config.cache'. Alternatively,
  6475. `--cache-file=FILE' specifies that FILE be the cache file. The cache
  6476. file is created if it does not exist already. When `configure' calls
  6477. `configure' scripts in subdirectories, it uses the `--cache-file'
  6478. argument so that they share the same cache. *Note Subdirectories::,
  6479. for information on configuring subdirectories with the
  6480. `AC_CONFIG_SUBDIRS' macro.
  6481. `config.status' only pays attention to the cache file if it is given
  6482. the `--recheck' option, which makes it rerun `configure'.
  6483. It is wrong to try to distribute cache files for particular system
  6484. types. There is too much room for error in doing that, and too much
  6485. administrative overhead in maintaining them. For any features that
  6486. can't be guessed automatically, use the standard method of the canonical
  6487. system type and linking files (*note Manual Configuration::).
  6488. The site initialization script can specify a site-wide cache file to
  6489. use, instead of the usual per-program cache. In this case, the cache
  6490. file gradually accumulates information whenever someone runs a new
  6491. `configure' script. (Running `configure' merges the new cache results
  6492. with the existing cache file.) This may cause problems, however, if
  6493. the system configuration (e.g., the installed libraries or compilers)
  6494. changes and the stale cache file is not deleted.
  6495. If `configure' is interrupted at the right time when it updates a
  6496. cache file outside of the build directory where the `configure' script
  6497. is run, it may leave behind a temporary file named after the cache file
  6498. with digits following it. You may safely delete such a file.
  6499. 
  6500. File: autoconf.info, Node: Cache Checkpointing, Prev: Cache Files, Up: Caching Results
  6501. 7.4.3 Cache Checkpointing
  6502. -------------------------
  6503. If your configure script, or a macro called from `configure.ac', happens
  6504. to abort the configure process, it may be useful to checkpoint the cache
  6505. a few times at key points using `AC_CACHE_SAVE'. Doing so reduces the
  6506. amount of time it takes to rerun the configure script with (hopefully)
  6507. the error that caused the previous abort corrected.
  6508. -- Macro: AC_CACHE_LOAD
  6509. Loads values from existing cache file, or creates a new cache file
  6510. if a cache file is not found. Called automatically from `AC_INIT'.
  6511. -- Macro: AC_CACHE_SAVE
  6512. Flushes all cached values to the cache file. Called automatically
  6513. from `AC_OUTPUT', but it can be quite useful to call
  6514. `AC_CACHE_SAVE' at key points in `configure.ac'.
  6515. For instance:
  6516. ... AC_INIT, etc. ...
  6517. # Checks for programs.
  6518. AC_PROG_CC
  6519. AC_PROG_AWK
  6520. ... more program checks ...
  6521. AC_CACHE_SAVE
  6522. # Checks for libraries.
  6523. AC_CHECK_LIB([nsl], [gethostbyname])
  6524. AC_CHECK_LIB([socket], [connect])
  6525. ... more lib checks ...
  6526. AC_CACHE_SAVE
  6527. # Might abort...
  6528. AM_PATH_GTK([1.0.2], [], [AC_MSG_ERROR([GTK not in path])])
  6529. AM_PATH_GTKMM([0.9.5], [], [AC_MSG_ERROR([GTK not in path])])
  6530. ... AC_OUTPUT, etc. ...
  6531. 
  6532. File: autoconf.info, Node: Printing Messages, Prev: Caching Results, Up: Results
  6533. 7.5 Printing Messages
  6534. =====================
  6535. `configure' scripts need to give users running them several kinds of
  6536. information. The following macros print messages in ways appropriate
  6537. for each kind. The arguments to all of them get enclosed in shell
  6538. double quotes, so the shell performs variable and back-quote
  6539. substitution on them.
  6540. These macros are all wrappers around the `echo' shell command. They
  6541. direct output to the appropriate file descriptor (*note File Descriptor
  6542. Macros::). `configure' scripts should rarely need to run `echo'
  6543. directly to print messages for the user. Using these macros makes it
  6544. easy to change how and when each kind of message is printed; such
  6545. changes need only be made to the macro definitions and all the callers
  6546. change automatically.
  6547. To diagnose static issues, i.e., when `autoconf' is run, see *note
  6548. Diagnostic Macros::.
  6549. -- Macro: AC_MSG_CHECKING (FEATURE-DESCRIPTION)
  6550. Notify the user that `configure' is checking for a particular
  6551. feature. This macro prints a message that starts with `checking '
  6552. and ends with `...' and no newline. It must be followed by a call
  6553. to `AC_MSG_RESULT' to print the result of the check and the
  6554. newline. The FEATURE-DESCRIPTION should be something like
  6555. `whether the Fortran compiler accepts C++ comments' or `for c89'.
  6556. This macro prints nothing if `configure' is run with the `--quiet'
  6557. or `--silent' option.
  6558. -- Macro: AC_MSG_RESULT (RESULT-DESCRIPTION)
  6559. Notify the user of the results of a check. RESULT-DESCRIPTION is
  6560. almost always the value of the cache variable for the check,
  6561. typically `yes', `no', or a file name. This macro should follow a
  6562. call to `AC_MSG_CHECKING', and the RESULT-DESCRIPTION should be
  6563. the completion of the message printed by the call to
  6564. `AC_MSG_CHECKING'.
  6565. This macro prints nothing if `configure' is run with the `--quiet'
  6566. or `--silent' option.
  6567. -- Macro: AC_MSG_NOTICE (MESSAGE)
  6568. Deliver the MESSAGE to the user. It is useful mainly to print a
  6569. general description of the overall purpose of a group of feature
  6570. checks, e.g.,
  6571. AC_MSG_NOTICE([checking if stack overflow is detectable])
  6572. This macro prints nothing if `configure' is run with the `--quiet'
  6573. or `--silent' option.
  6574. -- Macro: AC_MSG_ERROR (ERROR-DESCRIPTION, [EXIT-STATUS = `$?/1'])
  6575. Notify the user of an error that prevents `configure' from
  6576. completing. This macro prints an error message to the standard
  6577. error output and exits `configure' with EXIT-STATUS (`$?' by
  6578. default, except that `0' is converted to `1'). ERROR-DESCRIPTION
  6579. should be something like `invalid value $HOME for \$HOME'.
  6580. The ERROR-DESCRIPTION should start with a lower-case letter, and
  6581. "cannot" is preferred to "can't".
  6582. -- Macro: AC_MSG_FAILURE (ERROR-DESCRIPTION, [EXIT-STATUS])
  6583. This `AC_MSG_ERROR' wrapper notifies the user of an error that
  6584. prevents `configure' from completing _and_ that additional details
  6585. are provided in `config.log'. This is typically used when
  6586. abnormal results are found during a compilation.
  6587. -- Macro: AC_MSG_WARN (PROBLEM-DESCRIPTION)
  6588. Notify the `configure' user of a possible problem. This macro
  6589. prints the message to the standard error output; `configure'
  6590. continues running afterward, so macros that call `AC_MSG_WARN'
  6591. should provide a default (back-up) behavior for the situations
  6592. they warn about. PROBLEM-DESCRIPTION should be something like `ln
  6593. -s seems to make hard links'.
  6594. 
  6595. File: autoconf.info, Node: Programming in M4, Next: Programming in M4sh, Prev: Results, Up: Top
  6596. 8 Programming in M4
  6597. *******************
  6598. Autoconf is written on top of two layers: "M4sugar", which provides
  6599. convenient macros for pure M4 programming, and "M4sh", which provides
  6600. macros dedicated to shell script generation.
  6601. As of this version of Autoconf, these two layers still contain
  6602. experimental macros, whose interface might change in the future. As a
  6603. matter of fact, _anything that is not documented must not be used_.
  6604. * Menu:
  6605. * M4 Quotation:: Protecting macros from unwanted expansion
  6606. * Using autom4te:: The Autoconf executables backbone
  6607. * Programming in M4sugar:: Convenient pure M4 macros
  6608. * Debugging via autom4te:: Figuring out what M4 was doing
  6609. 
  6610. File: autoconf.info, Node: M4 Quotation, Next: Using autom4te, Up: Programming in M4
  6611. 8.1 M4 Quotation
  6612. ================
  6613. The most common problem with existing macros is an improper quotation.
  6614. This section, which users of Autoconf can skip, but which macro writers
  6615. _must_ read, first justifies the quotation scheme that was chosen for
  6616. Autoconf and then ends with a rule of thumb. Understanding the former
  6617. helps one to follow the latter.
  6618. * Menu:
  6619. * Active Characters:: Characters that change the behavior of M4
  6620. * One Macro Call:: Quotation and one macro call
  6621. * Quoting and Parameters:: M4 vs. shell parameters
  6622. * Quotation and Nested Macros:: Macros calling macros
  6623. * Changequote is Evil:: Worse than INTERCAL: M4 + changequote
  6624. * Quadrigraphs:: Another way to escape special characters
  6625. * Balancing Parentheses:: Dealing with unbalanced parentheses
  6626. * Quotation Rule Of Thumb:: One parenthesis, one quote
  6627. 
  6628. File: autoconf.info, Node: Active Characters, Next: One Macro Call, Up: M4 Quotation
  6629. 8.1.1 Active Characters
  6630. -----------------------
  6631. To fully understand where proper quotation is important, you first need
  6632. to know what the special characters are in Autoconf: `#' introduces a
  6633. comment inside which no macro expansion is performed, `,' separates
  6634. arguments, `[' and `]' are the quotes themselves(1), `(' and `)' (which
  6635. M4 tries to match by pairs), and finally `$' inside a macro definition.
  6636. In order to understand the delicate case of macro calls, we first
  6637. have to present some obvious failures. Below they are "obvious-ified",
  6638. but when you find them in real life, they are usually in disguise.
  6639. Comments, introduced by a hash and running up to the newline, are
  6640. opaque tokens to the top level: active characters are turned off, and
  6641. there is no macro expansion:
  6642. # define([def], ine)
  6643. =># define([def], ine)
  6644. Each time there can be a macro expansion, there is a quotation
  6645. expansion, i.e., one level of quotes is stripped:
  6646. int tab[10];
  6647. =>int tab10;
  6648. [int tab[10];]
  6649. =>int tab[10];
  6650. Without this in mind, the reader might try hopelessly to use her
  6651. macro `array':
  6652. define([array], [int tab[10];])
  6653. array
  6654. =>int tab10;
  6655. [array]
  6656. =>array
  6657. How can you correctly output the intended results(2)?
  6658. ---------- Footnotes ----------
  6659. (1) By itself, M4 uses ``' and `''; it is the M4sugar layer that
  6660. sets up the preferred quotes of `[' and `]'.
  6661. (2) Using `defn'.
  6662. 
  6663. File: autoconf.info, Node: One Macro Call, Next: Quoting and Parameters, Prev: Active Characters, Up: M4 Quotation
  6664. 8.1.2 One Macro Call
  6665. --------------------
  6666. Let's proceed on the interaction between active characters and macros
  6667. with this small macro, which just returns its first argument:
  6668. define([car], [$1])
  6669. The two pairs of quotes above are not part of the arguments of
  6670. `define'; rather, they are understood by the top level when it tries to
  6671. find the arguments of `define'. Therefore, assuming `car' is not
  6672. already defined, it is equivalent to write:
  6673. define(car, $1)
  6674. But, while it is acceptable for a `configure.ac' to avoid unnecessary
  6675. quotes, it is bad practice for Autoconf macros which must both be more
  6676. robust and also advocate perfect style.
  6677. At the top level, there are only two possibilities: either you quote
  6678. or you don't:
  6679. car(foo, bar, baz)
  6680. =>foo
  6681. [car(foo, bar, baz)]
  6682. =>car(foo, bar, baz)
  6683. Let's pay attention to the special characters:
  6684. car(#)
  6685. error-->EOF in argument list
  6686. The closing parenthesis is hidden in the comment; with a hypothetical
  6687. quoting, the top level understood it this way:
  6688. car([#)]
  6689. Proper quotation, of course, fixes the problem:
  6690. car([#])
  6691. =>#
  6692. Here are more examples:
  6693. car(foo, bar)
  6694. =>foo
  6695. car([foo, bar])
  6696. =>foo, bar
  6697. car((foo, bar))
  6698. =>(foo, bar)
  6699. car([(foo], [bar)])
  6700. =>(foo
  6701. define([a], [b])
  6702. =>
  6703. car(a)
  6704. =>b
  6705. car([a])
  6706. =>b
  6707. car([[a]])
  6708. =>a
  6709. car([[[a]]])
  6710. =>[a]
  6711. 
  6712. File: autoconf.info, Node: Quoting and Parameters, Next: Quotation and Nested Macros, Prev: One Macro Call, Up: M4 Quotation
  6713. 8.1.3 Quoting and Parameters
  6714. ----------------------------
  6715. When M4 encounters `$' within a macro definition, followed immediately
  6716. by a character it recognizes (`0'...`9', `#', `@', or `*'), it will
  6717. perform M4 parameter expansion. This happens regardless of how many
  6718. layers of quotes the parameter expansion is nested within, or even if
  6719. it occurs in text that will be rescanned as a comment.
  6720. define([none], [$1])
  6721. =>
  6722. define([one], [[$1]])
  6723. =>
  6724. define([two], [[[$1]]])
  6725. =>
  6726. define([comment], [# $1])
  6727. =>
  6728. define([active], [ACTIVE])
  6729. =>
  6730. none([active])
  6731. =>ACTIVE
  6732. one([active])
  6733. =>active
  6734. two([active])
  6735. =>[active]
  6736. comment([active])
  6737. =># active
  6738. On the other hand, since autoconf generates shell code, you often
  6739. want to output shell variable expansion, rather than performing M4
  6740. parameter expansion. To do this, you must use M4 quoting to separate
  6741. the `$' from the next character in the definition of your macro. If
  6742. the macro definition occurs in single-quoted text, then insert another
  6743. level of quoting; if the usage is already inside a double-quoted
  6744. string, then split it into concatenated strings.
  6745. define([single], [a single-quoted $[]1 definition])
  6746. =>
  6747. define([double], [[a double-quoted $][1 definition]])
  6748. =>
  6749. single
  6750. =>a single-quoted $1 definition
  6751. double
  6752. =>a double-quoted $1 definition
  6753. Posix states that M4 implementations are free to provide
  6754. implementation extensions when `${' is encountered in a macro
  6755. definition. Autoconf reserves the longer sequence `${{' for use with
  6756. planned extensions that will be available in the future GNU M4 2.0, but
  6757. guarantees that all other instances of `${' will be output literally.
  6758. Therefore, this idiom can also be used to output shell code parameter
  6759. references:
  6760. define([first], [${1}])first
  6761. =>${1}
  6762. Posix also states that `$11' should expand to the first parameter
  6763. concatenated with a literal `1', although some versions of GNU M4
  6764. expand the eleventh parameter instead. For portability, you should
  6765. only use single-digit M4 parameter expansion.
  6766. With this in mind, we can explore the cases where macros invoke
  6767. macros...
  6768. 
  6769. File: autoconf.info, Node: Quotation and Nested Macros, Next: Changequote is Evil, Prev: Quoting and Parameters, Up: M4 Quotation
  6770. 8.1.4 Quotation and Nested Macros
  6771. ---------------------------------
  6772. The examples below use the following macros:
  6773. define([car], [$1])
  6774. define([active], [ACT, IVE])
  6775. define([array], [int tab[10]])
  6776. Each additional embedded macro call introduces other possible
  6777. interesting quotations:
  6778. car(active)
  6779. =>ACT
  6780. car([active])
  6781. =>ACT, IVE
  6782. car([[active]])
  6783. =>active
  6784. In the first case, the top level looks for the arguments of `car',
  6785. and finds `active'. Because M4 evaluates its arguments before applying
  6786. the macro, `active' is expanded, which results in:
  6787. car(ACT, IVE)
  6788. =>ACT
  6789. In the second case, the top level gives `active' as first and only
  6790. argument of `car', which results in:
  6791. active
  6792. =>ACT, IVE
  6793. i.e., the argument is evaluated _after_ the macro that invokes it. In
  6794. the third case, `car' receives `[active]', which results in:
  6795. [active]
  6796. =>active
  6797. exactly as we already saw above.
  6798. The example above, applied to a more realistic example, gives:
  6799. car(int tab[10];)
  6800. =>int tab10;
  6801. car([int tab[10];])
  6802. =>int tab10;
  6803. car([[int tab[10];]])
  6804. =>int tab[10];
  6805. Huh? The first case is easily understood, but why is the second wrong,
  6806. and the third right? To understand that, you must know that after M4
  6807. expands a macro, the resulting text is immediately subjected to macro
  6808. expansion and quote removal. This means that the quote removal occurs
  6809. twice--first before the argument is passed to the `car' macro, and
  6810. second after the `car' macro expands to the first argument.
  6811. As the author of the Autoconf macro `car', you then consider it to
  6812. be incorrect that your users have to double-quote the arguments of
  6813. `car', so you "fix" your macro. Let's call it `qar' for quoted car:
  6814. define([qar], [[$1]])
  6815. and check that `qar' is properly fixed:
  6816. qar([int tab[10];])
  6817. =>int tab[10];
  6818. Ahhh! That's much better.
  6819. But note what you've done: now that the result of `qar' is always a
  6820. literal string, the only time a user can use nested macros is if she
  6821. relies on an _unquoted_ macro call:
  6822. qar(active)
  6823. =>ACT
  6824. qar([active])
  6825. =>active
  6826. leaving no way for her to reproduce what she used to do with `car':
  6827. car([active])
  6828. =>ACT, IVE
  6829. Worse yet: she wants to use a macro that produces a set of `cpp' macros:
  6830. define([my_includes], [#include <stdio.h>])
  6831. car([my_includes])
  6832. =>#include <stdio.h>
  6833. qar(my_includes)
  6834. error-->EOF in argument list
  6835. This macro, `qar', because it double quotes its arguments, forces
  6836. its users to leave their macro calls unquoted, which is dangerous.
  6837. Commas and other active symbols are interpreted by M4 before they are
  6838. given to the macro, often not in the way the users expect. Also,
  6839. because `qar' behaves differently from the other macros, it's an
  6840. exception that should be avoided in Autoconf.
  6841. 
  6842. File: autoconf.info, Node: Changequote is Evil, Next: Quadrigraphs, Prev: Quotation and Nested Macros, Up: M4 Quotation
  6843. 8.1.5 `changequote' is Evil
  6844. ---------------------------
  6845. The temptation is often high to bypass proper quotation, in particular
  6846. when it's late at night. Then, many experienced Autoconf hackers
  6847. finally surrender to the dark side of the force and use the ultimate
  6848. weapon: `changequote'.
  6849. The M4 builtin `changequote' belongs to a set of primitives that
  6850. allow one to adjust the syntax of the language to adjust it to one's
  6851. needs. For instance, by default M4 uses ``' and `'' as quotes, but in
  6852. the context of shell programming (and actually of most programming
  6853. languages), that's about the worst choice one can make: because of
  6854. strings and back-quoted expressions in shell code (such as `'this'' and
  6855. ``that`'), and because of literal characters in usual programming
  6856. languages (as in `'0''), there are many unbalanced ``' and `''. Proper
  6857. M4 quotation then becomes a nightmare, if not impossible. In order to
  6858. make M4 useful in such a context, its designers have equipped it with
  6859. `changequote', which makes it possible to choose another pair of
  6860. quotes. M4sugar, M4sh, Autoconf, and Autotest all have chosen to use
  6861. `[' and `]'. Not especially because they are unlikely characters, but
  6862. _because they are characters unlikely to be unbalanced_.
  6863. There are other magic primitives, such as `changecom' to specify
  6864. what syntactic forms are comments (it is common to see `changecom(<!--,
  6865. -->)' when M4 is used to produce HTML pages), `changeword' and
  6866. `changesyntax' to change other syntactic details (such as the character
  6867. to denote the Nth argument, `$' by default, the parentheses around
  6868. arguments, etc.).
  6869. These primitives are really meant to make M4 more useful for specific
  6870. domains: they should be considered like command line options:
  6871. `--quotes', `--comments', `--words', and `--syntax'. Nevertheless,
  6872. they are implemented as M4 builtins, as it makes M4 libraries self
  6873. contained (no need for additional options).
  6874. There lies the problem...
  6875. The problem is that it is then tempting to use them in the middle of
  6876. an M4 script, as opposed to its initialization. This, if not carefully
  6877. thought out, can lead to disastrous effects: _you are changing the
  6878. language in the middle of the execution_. Changing and restoring the
  6879. syntax is often not enough: if you happened to invoke macros in between,
  6880. these macros are lost, as the current syntax is probably not the one
  6881. they were implemented with.
  6882. 
  6883. File: autoconf.info, Node: Quadrigraphs, Next: Balancing Parentheses, Prev: Changequote is Evil, Up: M4 Quotation
  6884. 8.1.6 Quadrigraphs
  6885. ------------------
  6886. When writing an Autoconf macro you may occasionally need to generate
  6887. special characters that are difficult to express with the standard
  6888. Autoconf quoting rules. For example, you may need to output the regular
  6889. expression `[^[]', which matches any character other than `['. This
  6890. expression contains unbalanced brackets so it cannot be put easily into
  6891. an M4 macro.
  6892. Additionally, there are a few m4sugar macros (such as `m4_split' and
  6893. `m4_expand') which internally use special markers in addition to the
  6894. regular quoting characters. If the arguments to these macros contain
  6895. the literal strings `-=<{(' or `)}>=-', the macros might behave
  6896. incorrectly.
  6897. You can work around these problems by using one of the following
  6898. "quadrigraphs":
  6899. `@<:@'
  6900. `['
  6901. `@:>@'
  6902. `]'
  6903. `@S|@'
  6904. `$'
  6905. `@%:@'
  6906. `#'
  6907. `@{:@'
  6908. `('
  6909. `@:}@'
  6910. `)'
  6911. `@&t@'
  6912. Expands to nothing.
  6913. Quadrigraphs are replaced at a late stage of the translation process,
  6914. after `m4' is run, so they do not get in the way of M4 quoting. For
  6915. example, the string `^@<:@', independently of its quotation, appears as
  6916. `^[' in the output.
  6917. The empty quadrigraph can be used:
  6918. - to mark trailing spaces explicitly
  6919. Trailing spaces are smashed by `autom4te'. This is a feature.
  6920. - to produce quadrigraphs and other strings reserved by m4sugar
  6921. For instance `@<@&t@:@' produces `@<:@'. For a more contrived
  6922. example:
  6923. m4_define([a], [A])m4_define([b], [B])m4_define([c], [C])dnl
  6924. m4_split([a )}>=- b -=<{( c])
  6925. =>[a], [], [B], [], [c]
  6926. m4_split([a )}@&t@>=- b -=<@&t@{( c])
  6927. =>[a], [)}>=-], [b], [-=<{(], [c]
  6928. - to escape _occurrences_ of forbidden patterns
  6929. For instance you might want to mention `AC_FOO' in a comment, while
  6930. still being sure that `autom4te' still catches unexpanded `AC_*'.
  6931. Then write `AC@&t@_FOO'.
  6932. The name `@&t@' was suggested by Paul Eggert:
  6933. I should give some credit to the `@&t@' pun. The `&' is my own
  6934. invention, but the `t' came from the source code of the ALGOL68C
  6935. compiler, written by Steve Bourne (of Bourne shell fame), and
  6936. which used `mt' to denote the empty string. In C, it would have
  6937. looked like something like:
  6938. char const mt[] = "";
  6939. but of course the source code was written in Algol 68.
  6940. I don't know where he got `mt' from: it could have been his own
  6941. invention, and I suppose it could have been a common pun around the
  6942. Cambridge University computer lab at the time.
  6943. 
  6944. File: autoconf.info, Node: Balancing Parentheses, Next: Quotation Rule Of Thumb, Prev: Quadrigraphs, Up: M4 Quotation
  6945. 8.1.7 Dealing with unbalanced parentheses
  6946. -----------------------------------------
  6947. One of the pitfalls of portable shell programming is that `case'
  6948. statements require unbalanced parentheses (*note Limitations of Shell
  6949. Builtins: case.). With syntax highlighting editors, the presence of
  6950. unbalanced `)' can interfere with editors that perform syntax
  6951. highlighting of macro contents based on finding the matching `('.
  6952. Another concern is how much editing must be done when transferring code
  6953. snippets between shell scripts and macro definitions. But most
  6954. importantly, the presence of unbalanced parentheses can introduce
  6955. expansion bugs.
  6956. For an example, here is an underquoted attempt to use the macro
  6957. `my_case', which happens to expand to a portable `case' statement:
  6958. AC_DEFUN([my_case],
  6959. [case $file_name in
  6960. *.c) echo "C source code";;
  6961. esac])
  6962. AS_IF(:, my_case)
  6963. In the above example, the `AS_IF' call underquotes its arguments. As a
  6964. result, the unbalanced `)' generated by the premature expansion of
  6965. `my_case' results in expanding `AS_IF' with a truncated parameter, and
  6966. the expansion is syntactically invalid:
  6967. if :; then
  6968. case $file_name in
  6969. *.c
  6970. fi echo "C source code";;
  6971. esac)
  6972. If nothing else, this should emphasize the importance of the quoting
  6973. arguments to macro calls. On the other hand, there are several
  6974. variations for defining `my_case' to be more robust, even when used
  6975. without proper quoting, each with some benefits and some drawbacks.
  6976. Creative literal shell comment
  6977. AC_DEFUN([my_case],
  6978. [case $file_name in #(
  6979. *.c) echo "C source code";;
  6980. esac])
  6981. This version provides balanced parentheses to several editors, and
  6982. can be copied and pasted into a terminal as is. Unfortunately, it
  6983. is still unbalanced as an Autoconf argument, since `#(' is an M4
  6984. comment that masks the normal properties of `('.
  6985. Quadrigraph shell comment
  6986. AC_DEFUN([my_case],
  6987. [case $file_name in @%:@(
  6988. *.c) echo "C source code";;
  6989. esac])
  6990. This version provides balanced parentheses to even more editors,
  6991. and can be used as a balanced Autoconf argument. Unfortunately,
  6992. it requires some editing before it can be copied and pasted into a
  6993. terminal, and the use of the quadrigraph `@%:@' for `#' reduces
  6994. readability.
  6995. Quoting just the parenthesis
  6996. AC_DEFUN([my_case],
  6997. [case $file_name in
  6998. *.c[)] echo "C source code";;
  6999. esac])
  7000. This version quotes the `)', so that it can be used as a balanced
  7001. Autoconf argument. As written, this is not balanced to an editor,
  7002. but it can be coupled with `[#(]' to meet that need, too.
  7003. However, it still requires some edits before it can be copied and
  7004. pasted into a terminal.
  7005. Double-quoting the entire statement
  7006. AC_DEFUN([my_case],
  7007. [[case $file_name in #(
  7008. *.c) echo "C source code";;
  7009. esac]])
  7010. Since the entire macro is double-quoted, there is no problem with
  7011. using this as an Autoconf argument; and since the double-quoting
  7012. is over the entire statement, this code can be easily copied and
  7013. pasted into a terminal. However, the double quoting prevents the
  7014. expansion of any macros inside the case statement, which may cause
  7015. its own set of problems.
  7016. Using `AS_CASE'
  7017. AC_DEFUN([my_case],
  7018. [AS_CASE([$file_name],
  7019. [*.c], [echo "C source code"])])
  7020. This version avoids the balancing issue altogether, by relying on
  7021. `AS_CASE' (*note Common Shell Constructs::); it also allows for the
  7022. expansion of `AC_REQUIRE' to occur prior to the entire case
  7023. statement, rather than within a branch of the case statement that
  7024. might not be taken. However, the abstraction comes with a penalty
  7025. that it is no longer a quick copy, paste, and edit to get back to
  7026. shell code.
  7027. 
  7028. File: autoconf.info, Node: Quotation Rule Of Thumb, Prev: Balancing Parentheses, Up: M4 Quotation
  7029. 8.1.8 Quotation Rule Of Thumb
  7030. -----------------------------
  7031. To conclude, the quotation rule of thumb is:
  7032. _One pair of quotes per pair of parentheses._
  7033. Never over-quote, never under-quote, in particular in the definition
  7034. of macros. In the few places where the macros need to use brackets
  7035. (usually in C program text or regular expressions), properly quote _the
  7036. arguments_!
  7037. It is common to read Autoconf programs with snippets like:
  7038. AC_TRY_LINK(
  7039. changequote(<<, >>)dnl
  7040. <<#include <time.h>
  7041. #ifndef tzname /* For SGI. */
  7042. extern char *tzname[]; /* RS6000 and others reject char **tzname. */
  7043. #endif>>,
  7044. changequote([, ])dnl
  7045. [atoi (*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)
  7046. which is incredibly useless since `AC_TRY_LINK' is _already_ double
  7047. quoting, so you just need:
  7048. AC_TRY_LINK(
  7049. [#include <time.h>
  7050. #ifndef tzname /* For SGI. */
  7051. extern char *tzname[]; /* RS6000 and others reject char **tzname. */
  7052. #endif],
  7053. [atoi (*tzname);],
  7054. [ac_cv_var_tzname=yes],
  7055. [ac_cv_var_tzname=no])
  7056. The M4-fluent reader might note that these two examples are rigorously
  7057. equivalent, since M4 swallows both the `changequote(<<, >>)' and `<<'
  7058. `>>' when it "collects" the arguments: these quotes are not part of the
  7059. arguments!
  7060. Simplified, the example above is just doing this:
  7061. changequote(<<, >>)dnl
  7062. <<[]>>
  7063. changequote([, ])dnl
  7064. instead of simply:
  7065. [[]]
  7066. With macros that do not double quote their arguments (which is the
  7067. rule), double-quote the (risky) literals:
  7068. AC_LINK_IFELSE([AC_LANG_PROGRAM(
  7069. [[#include <time.h>
  7070. #ifndef tzname /* For SGI. */
  7071. extern char *tzname[]; /* RS6000 and others reject char **tzname. */
  7072. #endif]],
  7073. [atoi (*tzname);])],
  7074. [ac_cv_var_tzname=yes],
  7075. [ac_cv_var_tzname=no])
  7076. Please note that the macro `AC_TRY_LINK' is obsolete, so you really
  7077. should be using `AC_LINK_IFELSE' instead.
  7078. *Note Quadrigraphs::, for what to do if you run into a hopeless case
  7079. where quoting does not suffice.
  7080. When you create a `configure' script using newly written macros,
  7081. examine it carefully to check whether you need to add more quotes in
  7082. your macros. If one or more words have disappeared in the M4 output,
  7083. you need more quotes. When in doubt, quote.
  7084. However, it's also possible to put on too many layers of quotes. If
  7085. this happens, the resulting `configure' script may contain unexpanded
  7086. macros. The `autoconf' program checks for this problem by looking for
  7087. the string `AC_' in `configure'. However, this heuristic does not work
  7088. in general: for example, it does not catch overquoting in `AC_DEFINE'
  7089. descriptions.
  7090. 
  7091. File: autoconf.info, Node: Using autom4te, Next: Programming in M4sugar, Prev: M4 Quotation, Up: Programming in M4
  7092. 8.2 Using `autom4te'
  7093. ====================
  7094. The Autoconf suite, including M4sugar, M4sh, and Autotest, in addition
  7095. to Autoconf per se, heavily rely on M4. All these different uses
  7096. revealed common needs factored into a layer over M4: `autom4te'(1).
  7097. `autom4te' is a preprocessor that is like `m4'. It supports M4
  7098. extensions designed for use in tools like Autoconf.
  7099. * Menu:
  7100. * autom4te Invocation:: A GNU M4 wrapper
  7101. * Customizing autom4te:: Customizing the Autoconf package
  7102. ---------- Footnotes ----------
  7103. (1) Yet another great name from Lars J. Aas.
  7104. 
  7105. File: autoconf.info, Node: autom4te Invocation, Next: Customizing autom4te, Up: Using autom4te
  7106. 8.2.1 Invoking `autom4te'
  7107. -------------------------
  7108. The command line arguments are modeled after M4's:
  7109. autom4te OPTIONS FILES
  7110. where the FILES are directly passed to `m4'. By default, GNU M4 is
  7111. found during configuration, but the environment variable `M4' can be
  7112. set to tell `autom4te' where to look. In addition to the regular
  7113. expansion, it handles the replacement of the quadrigraphs (*note
  7114. Quadrigraphs::), and of `__oline__', the current line in the output.
  7115. It supports an extended syntax for the FILES:
  7116. `FILE.m4f'
  7117. This file is an M4 frozen file. Note that _all the previous files
  7118. are ignored_. See the option `--melt' for the rationale.
  7119. `FILE?'
  7120. If found in the library path, the FILE is included for expansion,
  7121. otherwise it is ignored instead of triggering a failure.
  7122. Of course, it supports the Autoconf common subset of options:
  7123. `--help'
  7124. `-h'
  7125. Print a summary of the command line options and exit.
  7126. `--version'
  7127. `-V'
  7128. Print the version number of Autoconf and exit.
  7129. `--verbose'
  7130. `-v'
  7131. Report processing steps.
  7132. `--debug'
  7133. `-d'
  7134. Don't remove the temporary files and be even more verbose.
  7135. `--include=DIR'
  7136. `-I DIR'
  7137. Also look for input files in DIR. Multiple invocations accumulate.
  7138. `--output=FILE'
  7139. `-o FILE'
  7140. Save output (script or trace) to FILE. The file `-' stands for
  7141. the standard output.
  7142. As an extension of `m4', it includes the following options:
  7143. `--warnings=CATEGORY'
  7144. `-W CATEGORY'
  7145. Report the warnings related to CATEGORY (which can actually be a
  7146. comma separated list). *Note Reporting Messages::, macro
  7147. `AC_DIAGNOSE', for a comprehensive list of categories. Special
  7148. values include:
  7149. `all'
  7150. report all the warnings
  7151. `none'
  7152. report none
  7153. `error'
  7154. treats warnings as errors
  7155. `no-CATEGORY'
  7156. disable warnings falling into CATEGORY
  7157. Warnings about `syntax' are enabled by default, and the environment
  7158. variable `WARNINGS', a comma separated list of categories, is
  7159. honored. `autom4te -W CATEGORY' actually behaves as if you had
  7160. run:
  7161. autom4te --warnings=syntax,$WARNINGS,CATEGORY
  7162. For example, if you want to disable defaults and `WARNINGS' of
  7163. `autom4te', but enable the warnings about obsolete constructs, you
  7164. would use `-W none,obsolete'.
  7165. `autom4te' displays a back trace for errors, but not for warnings;
  7166. if you want them, just pass `-W error'.
  7167. `--melt'
  7168. `-M'
  7169. Do not use frozen files. Any argument `FILE.m4f' is replaced by
  7170. `FILE.m4'. This helps tracing the macros which are executed only
  7171. when the files are frozen, typically `m4_define'. For instance,
  7172. running:
  7173. autom4te --melt 1.m4 2.m4f 3.m4 4.m4f input.m4
  7174. is roughly equivalent to running:
  7175. m4 1.m4 2.m4 3.m4 4.m4 input.m4
  7176. while
  7177. autom4te 1.m4 2.m4f 3.m4 4.m4f input.m4
  7178. is equivalent to:
  7179. m4 --reload-state=4.m4f input.m4
  7180. `--freeze'
  7181. `-F'
  7182. Produce a frozen state file. `autom4te' freezing is stricter than
  7183. M4's: it must produce no warnings, and no output other than empty
  7184. lines (a line with white space is _not_ empty) and comments
  7185. (starting with `#'). Unlike `m4''s similarly-named option, this
  7186. option takes no argument:
  7187. autom4te 1.m4 2.m4 3.m4 --freeze --output=3.m4f
  7188. corresponds to
  7189. m4 1.m4 2.m4 3.m4 --freeze-state=3.m4f
  7190. `--mode=OCTAL-MODE'
  7191. `-m OCTAL-MODE'
  7192. Set the mode of the non-traces output to OCTAL-MODE; by default
  7193. `0666'.
  7194. As another additional feature over `m4', `autom4te' caches its
  7195. results. GNU M4 is able to produce a regular output and traces at the
  7196. same time. Traces are heavily used in the GNU Build System:
  7197. `autoheader' uses them to build `config.h.in', `autoreconf' to
  7198. determine what GNU Build System components are used, `automake' to
  7199. "parse" `configure.ac' etc. To avoid recomputation, traces are cached
  7200. while performing regular expansion, and conversely. This cache is
  7201. (actually, the caches are) stored in the directory `autom4te.cache'.
  7202. _It can safely be removed_ at any moment (especially if for some reason
  7203. `autom4te' considers it trashed).
  7204. `--cache=DIRECTORY'
  7205. `-C DIRECTORY'
  7206. Specify the name of the directory where the result should be
  7207. cached. Passing an empty value disables caching. Be sure to pass
  7208. a relative file name, as for the time being, global caches are not
  7209. supported.
  7210. `--no-cache'
  7211. Don't cache the results.
  7212. `--force'
  7213. `-f'
  7214. If a cache is used, consider it obsolete (but update it anyway).
  7215. Because traces are so important to the GNU Build System, `autom4te'
  7216. provides high level tracing features as compared to M4, and helps
  7217. exploiting the cache:
  7218. `--trace=MACRO[:FORMAT]'
  7219. `-t MACRO[:FORMAT]'
  7220. Trace the invocations of MACRO according to the FORMAT. Multiple
  7221. `--trace' arguments can be used to list several macros. Multiple
  7222. `--trace' arguments for a single macro are not cumulative;
  7223. instead, you should just make FORMAT as long as needed.
  7224. The FORMAT is a regular string, with newlines if desired, and
  7225. several special escape codes. It defaults to `$f:$l:$n:$%'. It
  7226. can use the following special escapes:
  7227. `$$'
  7228. The character `$'.
  7229. `$f'
  7230. The file name from which MACRO is called.
  7231. `$l'
  7232. The line number from which MACRO is called.
  7233. `$d'
  7234. The depth of the MACRO call. This is an M4 technical detail
  7235. that you probably don't want to know about.
  7236. `$n'
  7237. The name of the MACRO.
  7238. `$NUM'
  7239. The NUMth argument of the call to MACRO.
  7240. `$@'
  7241. `$SEP@'
  7242. `${SEPARATOR}@'
  7243. All the arguments passed to MACRO, separated by the character
  7244. SEP or the string SEPARATOR (`,' by default). Each argument
  7245. is quoted, i.e., enclosed in a pair of square brackets.
  7246. `$*'
  7247. `$SEP*'
  7248. `${SEPARATOR}*'
  7249. As above, but the arguments are not quoted.
  7250. `$%'
  7251. `$SEP%'
  7252. `${SEPARATOR}%'
  7253. As above, but the arguments are not quoted, all new line
  7254. characters in the arguments are smashed, and the default
  7255. separator is `:'.
  7256. The escape `$%' produces single-line trace outputs (unless
  7257. you put newlines in the `separator'), while `$@' and `$*' do
  7258. not.
  7259. *Note autoconf Invocation::, for examples of trace uses.
  7260. `--preselect=MACRO'
  7261. `-p MACRO'
  7262. Cache the traces of MACRO, but do not enable traces. This is
  7263. especially important to save CPU cycles in the future. For
  7264. instance, when invoked, `autoconf' preselects all the macros that
  7265. `autoheader', `automake', `autoreconf', etc., trace, so that
  7266. running `m4' is not needed to trace them: the cache suffices.
  7267. This results in a huge speed-up.
  7268. Finally, `autom4te' introduces the concept of "Autom4te libraries".
  7269. They consists in a powerful yet extremely simple feature: sets of
  7270. combined command line arguments:
  7271. `--language=LANGUAGE'
  7272. `-l LANGUAGE'
  7273. Use the LANGUAGE Autom4te library. Current languages include:
  7274. `M4sugar'
  7275. create M4sugar output.
  7276. `M4sh'
  7277. create M4sh executable shell scripts.
  7278. `Autotest'
  7279. create Autotest executable test suites.
  7280. `Autoconf-without-aclocal-m4'
  7281. create Autoconf executable configure scripts without reading
  7282. `aclocal.m4'.
  7283. `Autoconf'
  7284. create Autoconf executable configure scripts. This language
  7285. inherits all the characteristics of
  7286. `Autoconf-without-aclocal-m4' and additionally reads
  7287. `aclocal.m4'.
  7288. `--prepend-include=DIR'
  7289. `-B DIR'
  7290. Prepend directory DIR to the search path. This is used to include
  7291. the language-specific files before any third-party macros.
  7292. As an example, if Autoconf is installed in its default location,
  7293. `/usr/local', the command `autom4te -l m4sugar foo.m4' is strictly
  7294. equivalent to the command:
  7295. autom4te --prepend-include /usr/local/share/autoconf \
  7296. m4sugar/m4sugar.m4f --warnings syntax foo.m4
  7297. Recursive expansion applies here: the command `autom4te -l m4sh foo.m4'
  7298. is the same as `autom4te --language M4sugar m4sugar/m4sh.m4f foo.m4',
  7299. i.e.:
  7300. autom4te --prepend-include /usr/local/share/autoconf \
  7301. m4sugar/m4sugar.m4f m4sugar/m4sh.m4f --mode 777 foo.m4
  7302. The definition of the languages is stored in `autom4te.cfg'.
  7303. 
  7304. File: autoconf.info, Node: Customizing autom4te, Prev: autom4te Invocation, Up: Using autom4te
  7305. 8.2.2 Customizing `autom4te'
  7306. ----------------------------
  7307. One can customize `autom4te' via `~/.autom4te.cfg' (i.e., as found in
  7308. the user home directory), and `./.autom4te.cfg' (i.e., as found in the
  7309. directory from which `autom4te' is run). The order is first reading
  7310. `autom4te.cfg', then `~/.autom4te.cfg', then `./.autom4te.cfg', and
  7311. finally the command line arguments.
  7312. In these text files, comments are introduced with `#', and empty
  7313. lines are ignored. Customization is performed on a per-language basis,
  7314. wrapped in between a `begin-language: "LANGUAGE"', `end-language:
  7315. "LANGUAGE"' pair.
  7316. Customizing a language stands for appending options (*note autom4te
  7317. Invocation::) to the current definition of the language. Options, and
  7318. more generally arguments, are introduced by `args: ARGUMENTS'. You may
  7319. use the traditional shell syntax to quote the ARGUMENTS.
  7320. As an example, to disable Autoconf caches (`autom4te.cache')
  7321. globally, include the following lines in `~/.autom4te.cfg':
  7322. ## ------------------ ##
  7323. ## User Preferences. ##
  7324. ## ------------------ ##
  7325. begin-language: "Autoconf-without-aclocal-m4"
  7326. args: --no-cache
  7327. end-language: "Autoconf-without-aclocal-m4"
  7328. 
  7329. File: autoconf.info, Node: Programming in M4sugar, Next: Debugging via autom4te, Prev: Using autom4te, Up: Programming in M4
  7330. 8.3 Programming in M4sugar
  7331. ==========================
  7332. M4 by itself provides only a small, but sufficient, set of all-purpose
  7333. macros. M4sugar introduces additional generic macros. Its name was
  7334. coined by Lars J. Aas: "Readability And Greater Understanding Stands 4
  7335. M4sugar".
  7336. M4sugar reserves the macro namespace `^_m4_' for internal use, and
  7337. the macro namespace `^m4_' for M4sugar macros. You should not define
  7338. your own macros into these namespaces.
  7339. * Menu:
  7340. * Redefined M4 Macros:: M4 builtins changed in M4sugar
  7341. * Diagnostic Macros:: Diagnostic messages from M4sugar
  7342. * Diversion support:: Diversions in M4sugar
  7343. * Conditional constructs:: Conditions in M4
  7344. * Looping constructs:: Iteration in M4
  7345. * Evaluation Macros:: More quotation and evaluation control
  7346. * Text processing Macros:: String manipulation in M4
  7347. * Number processing Macros:: Arithmetic computation in M4
  7348. * Set manipulation Macros:: Set manipulation in M4
  7349. * Forbidden Patterns:: Catching unexpanded macros
  7350. 
  7351. File: autoconf.info, Node: Redefined M4 Macros, Next: Diagnostic Macros, Up: Programming in M4sugar
  7352. 8.3.1 Redefined M4 Macros
  7353. -------------------------
  7354. With a few exceptions, all the M4 native macros are moved in the `m4_'
  7355. pseudo-namespace, e.g., M4sugar renames `define' as `m4_define' etc.
  7356. The list of macros unchanged from M4, except for their name, is:
  7357. - m4_builtin
  7358. - m4_changecom
  7359. - m4_changequote
  7360. - m4_debugfile
  7361. - m4_debugmode
  7362. - m4_decr
  7363. - m4_define
  7364. - m4_divnum
  7365. - m4_errprint
  7366. - m4_esyscmd
  7367. - m4_eval
  7368. - m4_format
  7369. - m4_ifdef
  7370. - m4_incr
  7371. - m4_index
  7372. - m4_indir
  7373. - m4_len
  7374. - m4_pushdef
  7375. - m4_shift
  7376. - m4_substr
  7377. - m4_syscmd
  7378. - m4_sysval
  7379. - m4_traceoff
  7380. - m4_traceon
  7381. - m4_translit
  7382. Some M4 macros are redefined, and are slightly incompatible with
  7383. their native equivalent.
  7384. -- Macro: __file__
  7385. -- Macro: __line__
  7386. All M4 macros starting with `__' retain their original name: for
  7387. example, no `m4__file__' is defined.
  7388. -- Macro: __oline__
  7389. This is not technically a macro, but a feature of Autom4te. The
  7390. sequence `__oline__' can be used similarly to the other m4sugar
  7391. location macros, but rather than expanding to the location of the
  7392. input file, it is translated to the line number where it appears
  7393. in the output file after all other M4 expansions.
  7394. -- Macro: dnl
  7395. This macro kept its original name: no `m4_dnl' is defined.
  7396. -- Macro: m4_bpatsubst (STRING, REGEXP, [REPLACEMENT])
  7397. This macro corresponds to `patsubst'. The name `m4_patsubst' is
  7398. kept for future versions of M4sugar, once GNU M4 2.0 is released
  7399. and supports extended regular expression syntax.
  7400. -- Macro: m4_bregexp (STRING, REGEXP, [REPLACEMENT])
  7401. This macro corresponds to `regexp'. The name `m4_regexp' is kept
  7402. for future versions of M4sugar, once GNU M4 2.0 is released and
  7403. supports extended regular expression syntax.
  7404. -- Macro: m4_copy (SOURCE, DEST)
  7405. -- Macro: m4_copy_force (SOURCE, DEST)
  7406. -- Macro: m4_rename (SOURCE, DEST)
  7407. -- Macro: m4_rename_force (SOURCE, DEST)
  7408. These macros aren't directly builtins, but are closely related to
  7409. `m4_pushdef' and `m4_defn'. `m4_copy' and `m4_rename' ensure that
  7410. DEST is undefined, while `m4_copy_force' and `m4_rename_force'
  7411. overwrite any existing definition. All four macros then proceed
  7412. to copy the entire pushdef stack of definitions of SOURCE over to
  7413. DEST. `m4_copy' and `m4_copy_force' preserve the source
  7414. (including in the special case where SOURCE is undefined), while
  7415. `m4_rename' and `m4_rename_force' undefine the original macro name
  7416. (making it an error to rename an undefined SOURCE).
  7417. Note that attempting to invoke a renamed macro might not work,
  7418. since the macro may have a dependence on helper macros accessed
  7419. via composition of `$0' but that were not also renamed; likewise,
  7420. other macros may have a hard-coded dependence on SOURCE and could
  7421. break if SOURCE has been deleted. On the other hand, it is always
  7422. safe to rename a macro to temporarily move it out of the way, then
  7423. rename it back later to restore original semantics.
  7424. -- Macro: m4_defn (MACRO...)
  7425. This macro fails if MACRO is not defined, even when using older
  7426. versions of M4 that did not warn. See `m4_undefine'.
  7427. Unfortunately, in order to support these older versions of M4,
  7428. there are some situations involving unbalanced quotes where
  7429. concatenating multiple macros together will work in newer M4 but
  7430. not in m4sugar; use quadrigraphs to work around this.
  7431. -- Macro: m4_divert (DIVERSION)
  7432. M4sugar relies heavily on diversions, so rather than behaving as a
  7433. primitive, `m4_divert' behaves like:
  7434. m4_divert_pop()m4_divert_push([DIVERSION])
  7435. *Note Diversion support::, for more details about the use of the
  7436. diversion stack. In particular, this implies that DIVERSION
  7437. should be a named diversion rather than a raw number. But be
  7438. aware that it is seldom necessary to explicitly change the
  7439. diversion stack, and that when done incorrectly, it can lead to
  7440. syntactically invalid scripts.
  7441. -- Macro: m4_dumpdef (NAME...)
  7442. -- Macro: m4_dumpdefs (NAME...)
  7443. `m4_dumpdef' is like the M4 builtin, except that this version
  7444. requires at least one argument, output always goes to standard
  7445. error rather than the current debug file, no sorting is done on
  7446. multiple arguments, and an error is issued if any NAME is
  7447. undefined. `m4_dumpdefs' is a convenience macro that calls
  7448. `m4_dumpdef' for all of the `m4_pushdef' stack of definitions,
  7449. starting with the current, and silently does nothing if NAME is
  7450. undefined.
  7451. Unfortunately, due to a limitation in M4 1.4.x, any macro defined
  7452. as a builtin is output as the empty string. This behavior is
  7453. rectified by using M4 1.6 or newer. However, this behavior
  7454. difference means that `m4_dumpdef' should only be used while
  7455. developing m4sugar macros, and never in the final published form
  7456. of a macro.
  7457. -- Macro: m4_esyscmd_s (COMMAND)
  7458. Like `m4_esyscmd', this macro expands to the result of running
  7459. COMMAND in a shell. The difference is that any trailing newlines
  7460. are removed, so that the output behaves more like shell command
  7461. substitution.
  7462. -- Macro: m4_exit (EXIT-STATUS)
  7463. This macro corresponds to `m4exit'.
  7464. -- Macro: m4_if (COMMENT)
  7465. -- Macro: m4_if (STRING-1, STRING-2, EQUAL, [NOT-EQUAL])
  7466. -- Macro: m4_if (STRING-1, STRING-2, EQUAL-1, STRING-3, STRING-4,
  7467. EQUAL-2, ..., [NOT-EQUAL])
  7468. This macro corresponds to `ifelse'. STRING-1 and STRING-2 are
  7469. compared literally, so usually one of the two arguments is passed
  7470. unquoted. *Note Conditional constructs::, for more conditional
  7471. idioms.
  7472. -- Macro: m4_include (FILE)
  7473. -- Macro: m4_sinclude (FILE)
  7474. Like the M4 builtins, but warn against multiple inclusions of FILE.
  7475. -- Macro: m4_mkstemp (TEMPLATE)
  7476. -- Macro: m4_maketemp (TEMPLATE)
  7477. Posix requires `maketemp' to replace the trailing `X' characters
  7478. in TEMPLATE with the process id, without regards to the existence
  7479. of a file by that name, but this a security hole. When this was
  7480. pointed out to the Posix folks, they agreed to invent a new macro
  7481. `mkstemp' that always creates a uniquely named file, but not all
  7482. versions of GNU M4 support the new macro. In M4sugar,
  7483. `m4_maketemp' and `m4_mkstemp' are synonyms for each other, and
  7484. both have the secure semantics regardless of which macro the
  7485. underlying M4 provides.
  7486. -- Macro: m4_popdef (MACRO...)
  7487. This macro fails if MACRO is not defined, even when using older
  7488. versions of M4 that did not warn. See `m4_undefine'.
  7489. -- Macro: m4_undefine (MACRO...)
  7490. This macro fails if MACRO is not defined, even when using older
  7491. versions of M4 that did not warn. Use
  7492. m4_ifdef([MACRO], [m4_undefine([MACRO])])
  7493. if you are not sure whether MACRO is defined.
  7494. -- Macro: m4_undivert (DIVERSION...)
  7495. Unlike the M4 builtin, at least one DIVERSION must be specified.
  7496. Also, since the M4sugar diversion stack prefers named diversions,
  7497. the use of `m4_undivert' to include files is risky. *Note
  7498. Diversion support::, for more details about the use of the
  7499. diversion stack. But be aware that it is seldom necessary to
  7500. explicitly change the diversion stack, and that when done
  7501. incorrectly, it can lead to syntactically invalid scripts.
  7502. -- Macro: m4_wrap (TEXT)
  7503. -- Macro: m4_wrap_lifo (TEXT)
  7504. These macros correspond to `m4wrap'. Posix requires arguments of
  7505. multiple wrap calls to be reprocessed at EOF in the same order as
  7506. the original calls (first-in, first-out). GNU M4 versions through
  7507. 1.4.10, however, reprocess them in reverse order (last-in,
  7508. first-out). Both orders are useful, therefore, you can rely on
  7509. `m4_wrap' to provide FIFO semantics and `m4_wrap_lifo' for LIFO
  7510. semantics, regardless of the underlying GNU M4 version.
  7511. Unlike the GNU M4 builtin, these macros only recognize one
  7512. argument, and avoid token pasting between consecutive invocations.
  7513. On the other hand, nested calls to `m4_wrap' from within wrapped
  7514. text work just as in the builtin.
  7515. 
  7516. File: autoconf.info, Node: Diagnostic Macros, Next: Diversion support, Prev: Redefined M4 Macros, Up: Programming in M4sugar
  7517. 8.3.2 Diagnostic messages from M4sugar
  7518. --------------------------------------
  7519. When macros statically diagnose abnormal situations, benign or fatal,
  7520. they should report them using these macros. For issuing dynamic issues,
  7521. i.e., when `configure' is run, see *note Printing Messages::.
  7522. -- Macro: m4_assert (EXPRESSION, [EXIT-STATUS = `1'])
  7523. Assert that the arithmetic EXPRESSION evaluates to non-zero.
  7524. Otherwise, issue a fatal error, and exit `autom4te' with
  7525. EXIT-STATUS.
  7526. -- Macro: m4_errprintn (MESSAGE)
  7527. Similar to the builtin `m4_errprint', except that a newline is
  7528. guaranteed after MESSAGE.
  7529. -- Macro: m4_fatal (MESSAGE)
  7530. Report a severe error MESSAGE prefixed with the current location,
  7531. and have `autom4te' die.
  7532. -- Macro: m4_location
  7533. Useful as a prefix in a message line. Short for:
  7534. __file__:__line__
  7535. -- Macro: m4_warn (CATEGORY, MESSAGE)
  7536. Report MESSAGE as a warning (or as an error if requested by the
  7537. user) if warnings of the CATEGORY are turned on. If the message
  7538. is emitted, it is prefixed with the current location, and followed
  7539. by a call trace of all macros defined via `AC_DEFUN' used to get
  7540. to the current expansion. You are encouraged to use standard
  7541. categories, which currently include:
  7542. `all'
  7543. messages that don't fall into one of the following
  7544. categories. Use of an empty CATEGORY is equivalent.
  7545. `cross'
  7546. related to cross compilation issues.
  7547. `obsolete'
  7548. use of an obsolete construct.
  7549. `syntax'
  7550. dubious syntactic constructs, incorrectly ordered macro calls.
  7551. 
  7552. File: autoconf.info, Node: Diversion support, Next: Conditional constructs, Prev: Diagnostic Macros, Up: Programming in M4sugar
  7553. 8.3.3 Diversion support
  7554. -----------------------
  7555. M4sugar makes heavy use of diversions under the hood, because it is
  7556. often the case that text that must appear early in the output is not
  7557. discovered until late in the input. Additionally, some of the
  7558. topological sorting algorithms used in resolving macro dependencies use
  7559. diversions. However, most macros should not need to change diversions
  7560. directly, but rather rely on higher-level M4sugar macros to manage
  7561. diversions transparently. If you change diversions improperly, you
  7562. risk generating a syntactically invalid script, because an incorrect
  7563. diversion will violate assumptions made by many macros about whether
  7564. prerequisite text has been previously output. In short, if you
  7565. manually change the diversion, you should not expect any macros
  7566. provided by the Autoconf package to work until you have restored the
  7567. diversion stack back to its original state.
  7568. In the rare case that it is necessary to write a macro that
  7569. explicitly outputs text to a different diversion, it is important to be
  7570. aware of an M4 limitation regarding diversions: text only goes to a
  7571. diversion if it is not part of argument collection. Therefore, any
  7572. macro that changes the current diversion cannot be used as an unquoted
  7573. argument to another macro, but must be expanded at the top level. The
  7574. macro `m4_expand' will diagnose any attempt to change diversions, since
  7575. it is generally useful only as an argument to another macro. The
  7576. following example shows what happens when diversion manipulation is
  7577. attempted within macro arguments:
  7578. m4_do([normal text]
  7579. m4_divert_push([KILL])unwanted[]m4_divert_pop([KILL])
  7580. [m4_divert_push([KILL])discarded[]m4_divert_pop([KILL])])dnl
  7581. =>normal text
  7582. =>unwanted
  7583. Notice that the unquoted text `unwanted' is output, even though it was
  7584. processed while the current diversion was `KILL', because it was
  7585. collected as part of the argument to `m4_do'. However, the text
  7586. `discarded' disappeared as desired, because the diversion changes were
  7587. single-quoted, and were not expanded until the top-level rescan of the
  7588. output of `m4_do'.
  7589. To make diversion management easier, M4sugar uses the concept of
  7590. named diversions. Rather than using diversion numbers directly, it is
  7591. nicer to associate a name with each diversion. The diversion number
  7592. associated with a particular diversion name is an implementation
  7593. detail, and a syntax warning is issued if a diversion number is used
  7594. instead of a name. In general, you should not output text to a named
  7595. diversion until after calling the appropriate initialization routine
  7596. for your language (`m4_init', `AS_INIT', `AT_INIT', ...), although
  7597. there are some exceptions documented below.
  7598. M4sugar defines two named diversions.
  7599. `KILL'
  7600. Text written to this diversion is discarded. This is the default
  7601. diversion once M4sugar is initialized.
  7602. `GROW'
  7603. This diversion is used behind the scenes by topological sorting
  7604. macros, such as `AC_REQUIRE'.
  7605. M4sh adds several more named diversions.
  7606. `BINSH'
  7607. This diversion is reserved for the `#!' interpreter line.
  7608. `HEADER-REVISION'
  7609. This diversion holds text from `AC_REVISION'.
  7610. `HEADER-COMMENT'
  7611. This diversion holds comments about the purpose of a file.
  7612. `HEADER-COPYRIGHT'
  7613. This diversion is managed by `AC_COPYRIGHT'.
  7614. `M4SH-SANITIZE'
  7615. This diversion contains M4sh sanitization code, used to ensure
  7616. M4sh is executing in a reasonable shell environment.
  7617. `M4SH-INIT'
  7618. This diversion contains M4sh initialization code, initializing
  7619. variables that are required by other M4sh macros.
  7620. `BODY'
  7621. This diversion contains the body of the shell code, and is the
  7622. default diversion once M4sh is initialized.
  7623. Autotest inherits diversions from M4sh, and changes the default
  7624. diversion from `BODY' back to `KILL'. It also adds several more named
  7625. diversions, with the following subset designed for developer use.
  7626. `PREPARE_TESTS'
  7627. This diversion contains initialization sequences which are executed
  7628. after `atconfig' and `atlocal', and after all command line
  7629. arguments have been parsed, but prior to running any tests. It
  7630. can be used to set up state that is required across all tests.
  7631. This diversion will work even before `AT_INIT'.
  7632. Autoconf inherits diversions from M4sh, and adds the following named
  7633. diversions which developers can utilize.
  7634. `DEFAULTS'
  7635. This diversion contains shell variable assignments to set defaults
  7636. that must be in place before arguments are parsed. This diversion
  7637. is placed early enough in `configure' that it is unsafe to expand
  7638. any autoconf macros into this diversion.
  7639. `HELP_ENABLE'
  7640. If `AC_PRESERVE_HELP_ORDER' was used, then text placed in this
  7641. diversion will be included as part of a quoted here-doc providing
  7642. all of the `--help' output of `configure' related to options
  7643. created by `AC_ARG_WITH' and `AC_ARG_ENABLE'.
  7644. `INIT_PREPARE'
  7645. This diversion occurs after all command line options have been
  7646. parsed, but prior to the main body of the `configure' script. This
  7647. diversion is the last chance to insert shell code such as variable
  7648. assignments or shell function declarations that will used by the
  7649. expansion of other macros.
  7650. For now, the remaining named diversions of Autoconf, Autoheader, and
  7651. Autotest are not documented. In other words, intentionally outputting
  7652. text into an undocumented diversion is subject to breakage in a future
  7653. release of Autoconf.
  7654. -- Macro: m4_cleardivert (DIVERSION...)
  7655. Permanently discard any text that has been diverted into DIVERSION.
  7656. -- Macro: m4_divert_once (DIVERSION, [CONTENT])
  7657. Similar to `m4_divert_text', except that CONTENT is only output to
  7658. DIVERSION if this is the first time that `m4_divert_once' has been
  7659. called with its particular arguments.
  7660. -- Macro: m4_divert_pop ([DIVERSION])
  7661. If provided, check that the current diversion is indeed DIVERSION.
  7662. Then change to the diversion located earlier on the stack, giving
  7663. an error if an attempt is made to pop beyond the initial m4sugar
  7664. diversion of `KILL'.
  7665. -- Macro: m4_divert_push (DIVERSION)
  7666. Remember the former diversion on the diversion stack, and output
  7667. subsequent text into DIVERSION. M4sugar maintains a diversion
  7668. stack, and issues an error if there is not a matching pop for every
  7669. push.
  7670. -- Macro: m4_divert_text (DIVERSION, [CONTENT])
  7671. Output CONTENT and a newline into DIVERSION, without affecting the
  7672. current diversion. Shorthand for:
  7673. m4_divert_push([DIVERSION])CONTENT
  7674. m4_divert_pop([DIVERSION])dnl
  7675. One use of `m4_divert_text' is to develop two related macros, where
  7676. macro `MY_A' does the work, but adjusts what work is performed
  7677. based on whether the optional macro `MY_B' has also been expanded.
  7678. Of course, it is possible to use `AC_BEFORE' within `MY_A' to
  7679. require that `MY_B' occurs first, if it occurs at all. But this
  7680. imposes an ordering restriction on the user; it would be nicer if
  7681. macros `MY_A' and `MY_B' can be invoked in either order. The trick
  7682. is to let `MY_B' leave a breadcrumb in an early diversion, which
  7683. `MY_A' can then use to determine whether `MY_B' has been expanded.
  7684. AC_DEFUN([MY_A],
  7685. [# various actions
  7686. if test -n "$b_was_used"; then
  7687. # extra action
  7688. fi])
  7689. AC_DEFUN([MY_B],
  7690. [AC_REQUIRE([MY_A])dnl
  7691. m4_divert_text([INIT_PREPARE], [b_was_used=true])])
  7692. -- Macro: m4_init
  7693. Initialize the M4sugar environment, setting up the default named
  7694. diversion to be `KILL'.
  7695. 
  7696. File: autoconf.info, Node: Conditional constructs, Next: Looping constructs, Prev: Diversion support, Up: Programming in M4sugar
  7697. 8.3.4 Conditional constructs
  7698. ----------------------------
  7699. The following macros provide additional conditional constructs as
  7700. convenience wrappers around `m4_if'.
  7701. -- Macro: m4_bmatch (STRING, REGEX-1, VALUE-1, [REGEX-2], [VALUE-2],
  7702. ..., [DEFAULT])
  7703. The string STRING is repeatedly compared against a series of REGEX
  7704. arguments; if a match is found, the expansion is the corresponding
  7705. VALUE, otherwise, the macro moves on to the next REGEX. If no
  7706. REGEX match, then the result is the optional DEFAULT, or nothing.
  7707. -- Macro: m4_bpatsubsts (STRING, REGEX-1, SUBST-1, [REGEX-2],
  7708. [SUBST-2], ...)
  7709. The string STRING is altered by REGEX-1 and SUBST-1, as if by:
  7710. m4_bpatsubst([[STRING]], [REGEX], [SUBST])
  7711. The result of the substitution is then passed through the next set
  7712. of REGEX and SUBST, and so forth. An empty SUBST implies deletion
  7713. of any matched portions in the current string. Note that this
  7714. macro over-quotes STRING; this behavior is intentional, so that
  7715. the result of each step of the recursion remains as a quoted
  7716. string. However, it means that anchors (`^' and `$' in the REGEX
  7717. will line up with the extra quotations, and not the characters of
  7718. the original string. The overquoting is removed after the final
  7719. substitution.
  7720. -- Macro: m4_case (STRING, VALUE-1, IF-VALUE-1, [VALUE-2],
  7721. [IF-VALUE-2], ..., [DEFAULT])
  7722. Test STRING against multiple VALUE possibilities, resulting in the
  7723. first IF-VALUE for a match, or in the optional DEFAULT. This is
  7724. shorthand for:
  7725. m4_if([STRING], [VALUE-1], [IF-VALUE-1],
  7726. [STRING], [VALUE-2], [IF-VALUE-2], ...,
  7727. [DEFAULT])
  7728. -- Macro: m4_cond (TEST-1, VALUE-1, IF-VALUE-1, [TEST-2], [VALUE-2],
  7729. [IF-VALUE-2], ..., [DEFAULT])
  7730. This macro was introduced in Autoconf 2.62. Similar to `m4_if',
  7731. except that each TEST is expanded only when it is encountered.
  7732. This is useful for short-circuiting expensive tests; while `m4_if'
  7733. requires all its strings to be expanded up front before doing
  7734. comparisons, `m4_cond' only expands a TEST when all earlier tests
  7735. have failed.
  7736. For an example, these two sequences give the same result, but in
  7737. the case where `$1' does not contain a backslash, the `m4_cond'
  7738. version only expands `m4_index' once, instead of five times, for
  7739. faster computation if this is a common case for `$1'. Notice that
  7740. every third argument is unquoted for `m4_if', and quoted for
  7741. `m4_cond':
  7742. m4_if(m4_index([$1], [\]), [-1], [$2],
  7743. m4_eval(m4_index([$1], [\\]) >= 0), [1], [$2],
  7744. m4_eval(m4_index([$1], [\$]) >= 0), [1], [$2],
  7745. m4_eval(m4_index([$1], [\`]) >= 0), [1], [$3],
  7746. m4_eval(m4_index([$1], [\"]) >= 0), [1], [$3],
  7747. [$2])
  7748. m4_cond([m4_index([$1], [\])], [-1], [$2],
  7749. [m4_eval(m4_index([$1], [\\]) >= 0)], [1], [$2],
  7750. [m4_eval(m4_index([$1], [\$]) >= 0)], [1], [$2],
  7751. [m4_eval(m4_index([$1], [\`]) >= 0)], [1], [$3],
  7752. [m4_eval(m4_index([$1], [\"]) >= 0)], [1], [$3],
  7753. [$2])
  7754. -- Macro: m4_default (EXPR-1, EXPR-2)
  7755. -- Macro: m4_default_quoted (EXPR-1, EXPR-2)
  7756. -- Macro: m4_default_nblank (EXPR-1, [EXPR-2])
  7757. -- Macro: m4_default_nblank_quoted (EXPR-1, [EXPR-2])
  7758. If EXPR-1 contains text, use it. Otherwise, select EXPR-2.
  7759. `m4_default' expands the result, while `m4_default_quoted' does
  7760. not. Useful for providing a fixed default if the expression that
  7761. results in EXPR-1 would otherwise be empty. The difference
  7762. between `m4_default' and `m4_default_nblank' is whether an
  7763. argument consisting of just blanks (space, tab, newline) is
  7764. significant. When using the expanding versions, note that an
  7765. argument may contain text but still expand to an empty string.
  7766. m4_define([active], [ACTIVE])dnl
  7767. m4_define([empty], [])dnl
  7768. m4_define([demo1], [m4_default([$1], [$2])])dnl
  7769. m4_define([demo2], [m4_default_quoted([$1], [$2])])dnl
  7770. m4_define([demo3], [m4_default_nblank([$1], [$2])])dnl
  7771. m4_define([demo4], [m4_default_nblank_quoted([$1], [$2])])dnl
  7772. demo1([active], [default])
  7773. =>ACTIVE
  7774. demo1([], [active])
  7775. =>ACTIVE
  7776. demo1([empty], [text])
  7777. =>
  7778. -demo1([ ], [active])-
  7779. =>- -
  7780. demo2([active], [default])
  7781. =>active
  7782. demo2([], [active])
  7783. =>active
  7784. demo2([empty], [text])
  7785. =>empty
  7786. -demo2([ ], [active])-
  7787. =>- -
  7788. demo3([active], [default])
  7789. =>ACTIVE
  7790. demo3([], [active])
  7791. =>ACTIVE
  7792. demo3([empty], [text])
  7793. =>
  7794. -demo3([ ], [active])-
  7795. =>-ACTIVE-
  7796. demo4([active], [default])
  7797. =>active
  7798. demo4([], [active])
  7799. =>active
  7800. demo4([empty], [text])
  7801. =>empty
  7802. -demo4([ ], [active])-
  7803. =>-active-
  7804. -- Macro: m4_define_default (MACRO, [DEFAULT-DEFINITION])
  7805. If MACRO does not already have a definition, then define it to
  7806. DEFAULT-DEFINITION.
  7807. -- Macro: m4_ifblank (COND, [IF-BLANK], [IF-TEXT])
  7808. -- Macro: m4_ifnblank (COND, [IF-TEXT], [IF-BLANK])
  7809. If COND is empty or consists only of blanks (space, tab, newline),
  7810. then expand IF-BLANK; otherwise, expand IF-TEXT. Two variants
  7811. exist, in order to make it easier to select the correct logical
  7812. sense when using only two parameters. Note that this is more
  7813. efficient than the equivalent behavior of:
  7814. m4_ifval(m4_normalize([COND]), IF-TEXT, IF-BLANK)
  7815. -- Macro: m4_ifndef (MACRO, IF-NOT-DEFINED, [IF-DEFINED])
  7816. This is shorthand for:
  7817. m4_ifdef([MACRO], [IF-DEFINED], [IF-NOT-DEFINED])
  7818. -- Macro: m4_ifset (MACRO, [IF-TRUE], [IF-FALSE])
  7819. If MACRO is undefined, or is defined as the empty string, expand
  7820. to IF-FALSE. Otherwise, expands to IF-TRUE. Similar to:
  7821. m4_ifval(m4_defn([MACRO]), [IF-TRUE], [IF-FALSE])
  7822. except that it is not an error if MACRO is undefined.
  7823. -- Macro: m4_ifval (COND, [IF-TRUE], [IF-FALSE])
  7824. Expands to IF-TRUE if COND is not empty, otherwise to IF-FALSE.
  7825. This is shorthand for:
  7826. m4_if([COND], [], [IF-FALSE], [IF-TRUE])
  7827. -- Macro: m4_ifvaln (COND, [IF-TRUE], [IF-FALSE])
  7828. Similar to `m4_ifval', except guarantee that a newline is present
  7829. after any non-empty expansion. Often followed by `dnl'.
  7830. -- Macro: m4_n (TEXT)
  7831. Expand to TEXT, and add a newline if TEXT is not empty. Often
  7832. followed by `dnl'.
  7833. 
  7834. File: autoconf.info, Node: Looping constructs, Next: Evaluation Macros, Prev: Conditional constructs, Up: Programming in M4sugar
  7835. 8.3.5 Looping constructs
  7836. ------------------------
  7837. The following macros are useful in implementing recursive algorithms in
  7838. M4, including loop operations. An M4 list is formed by quoting a list
  7839. of quoted elements; generally the lists are comma-separated, although
  7840. `m4_foreach_w' is whitespace-separated. For example, the list `[[a],
  7841. [b,c]]' contains two elements: `[a]' and `[b,c]'. It is common to see
  7842. lists with unquoted elements when those elements are not likely to be
  7843. macro names, as in `[fputc_unlocked, fgetc_unlocked]'.
  7844. Although not generally recommended, it is possible for quoted lists
  7845. to have side effects; all side effects are expanded only once, and
  7846. prior to visiting any list element. On the other hand, the fact that
  7847. unquoted macros are expanded exactly once means that macros without
  7848. side effects can be used to generate lists. For example,
  7849. m4_foreach([i], [[1], [2], [3]m4_errprintn([hi])], [i])
  7850. error-->hi
  7851. =>123
  7852. m4_define([list], [[1], [2], [3]])
  7853. =>
  7854. m4_foreach([i], [list], [i])
  7855. =>123
  7856. -- Macro: m4_argn (N, [ARG]...)
  7857. Extracts argument N (larger than 0) from the remaining arguments.
  7858. If there are too few arguments, the empty string is used. For any
  7859. N besides 1, this is more efficient than the similar
  7860. `m4_car(m4_shiftn([N], [], [ARG...]))'.
  7861. -- Macro: m4_car (ARG...)
  7862. Expands to the quoted first ARG. Can be used with `m4_cdr' to
  7863. recursively iterate through a list. Generally, when using quoted
  7864. lists of quoted elements, `m4_car' should be called without any
  7865. extra quotes.
  7866. -- Macro: m4_cdr (ARG...)
  7867. Expands to a quoted list of all but the first ARG, or the empty
  7868. string if there was only one argument. Generally, when using
  7869. quoted lists of quoted elements, `m4_cdr' should be called without
  7870. any extra quotes.
  7871. For example, this is a simple implementation of `m4_map'; note how
  7872. each iteration checks for the end of recursion, then merely
  7873. applies the first argument to the first element of the list, then
  7874. repeats with the rest of the list. (The actual implementation in
  7875. M4sugar is a bit more involved, to gain some speed and share code
  7876. with `m4_map_sep', and also to avoid expanding side effects in
  7877. `$2' twice).
  7878. m4_define([m4_map], [m4_ifval([$2],
  7879. [m4_apply([$1], m4_car($2))[]$0([$1], m4_cdr($2))])])dnl
  7880. m4_map([ m4_eval], [[[1]], [[1+1]], [[10],[16]]])
  7881. => 1 2 a
  7882. -- Macro: m4_for (VAR, FIRST, LAST, [STEP], EXPRESSION)
  7883. Loop over the numeric values between FIRST and LAST including
  7884. bounds by increments of STEP. For each iteration, expand
  7885. EXPRESSION with the numeric value assigned to VAR. If STEP is
  7886. omitted, it defaults to `1' or `-1' depending on the order of the
  7887. limits. If given, STEP has to match this order. The number of
  7888. iterations is determined independently from definition of VAR;
  7889. iteration cannot be short-circuited or lengthened by modifying VAR
  7890. from within EXPRESSION.
  7891. -- Macro: m4_foreach (VAR, LIST, EXPRESSION)
  7892. Loop over the comma-separated M4 list LIST, assigning each value
  7893. to VAR, and expand EXPRESSION. The following example outputs two
  7894. lines:
  7895. m4_foreach([myvar], [[foo], [bar, baz]],
  7896. [echo myvar
  7897. ])dnl
  7898. =>echo foo
  7899. =>echo bar, baz
  7900. Note that for some forms of EXPRESSION, it may be faster to use
  7901. `m4_map_args'.
  7902. -- Macro: m4_foreach_w (VAR, LIST, EXPRESSION)
  7903. Loop over the white-space-separated list LIST, assigning each value
  7904. to VAR, and expand EXPRESSION. If VAR is only referenced once in
  7905. EXPRESSION, it is more efficient to use `m4_map_args_w'.
  7906. The deprecated macro `AC_FOREACH' is an alias of `m4_foreach_w'.
  7907. -- Macro: m4_map (MACRO, LIST)
  7908. -- Macro: m4_mapall (MACRO, LIST)
  7909. -- Macro: m4_map_sep (MACRO, SEPARATOR, LIST)
  7910. -- Macro: m4_mapall_sep (MACRO, SEPARATOR, LIST)
  7911. Loop over the comma separated quoted list of argument descriptions
  7912. in LIST, and invoke MACRO with the arguments. An argument
  7913. description is in turn a comma-separated quoted list of quoted
  7914. elements, suitable for `m4_apply'. The macros `m4_map' and
  7915. `m4_map_sep' ignore empty argument descriptions, while `m4_mapall'
  7916. and `m4_mapall_sep' invoke MACRO with no arguments. The macros
  7917. `m4_map_sep' and `m4_mapall_sep' additionally expand SEPARATOR
  7918. between invocations of MACRO.
  7919. Note that SEPARATOR is expanded, unlike in `m4_join'. When
  7920. separating output with commas, this means that the map result can
  7921. be used as a series of arguments, by using a single-quoted comma as
  7922. SEPARATOR, or as a single string, by using a double-quoted comma.
  7923. m4_map([m4_count], [])
  7924. =>
  7925. m4_map([ m4_count], [[],
  7926. [[1]],
  7927. [[1], [2]]])
  7928. => 1 2
  7929. m4_mapall([ m4_count], [[],
  7930. [[1]],
  7931. [[1], [2]]])
  7932. => 0 1 2
  7933. m4_map_sep([m4_eval], [,], [[[1+2]],
  7934. [[10], [16]]])
  7935. =>3,a
  7936. m4_map_sep([m4_echo], [,], [[[a]], [[b]]])
  7937. =>a,b
  7938. m4_count(m4_map_sep([m4_echo], [,], [[[a]], [[b]]]))
  7939. =>2
  7940. m4_map_sep([m4_echo], [[,]], [[[a]], [[b]]])
  7941. =>a,b
  7942. m4_count(m4_map_sep([m4_echo], [[,]], [[[a]], [[b]]]))
  7943. =>1
  7944. -- Macro: m4_map_args (MACRO, ARG...)
  7945. Repeatedly invoke MACRO with each successive ARG as its only
  7946. argument. In the following example, three solutions are presented
  7947. with the same expansion; the solution using `m4_map_args' is the
  7948. most efficient.
  7949. m4_define([active], [ACTIVE])dnl
  7950. m4_foreach([var], [[plain], [active]], [ m4_echo(m4_defn([var]))])
  7951. => plain active
  7952. m4_map([ m4_echo], [[[plain]], [[active]]])
  7953. => plain active
  7954. m4_map_args([ m4_echo], [plain], [active])
  7955. => plain active
  7956. In cases where it is useful to operate on additional parameters
  7957. besides the list elements, the macro `m4_curry' can be used in
  7958. MACRO to supply the argument currying necessary to generate the
  7959. desired argument list. In the following example, `list_add_n' is
  7960. more efficient than `list_add_x'. On the other hand, using
  7961. `m4_map_args_sep' can be even more efficient.
  7962. m4_define([list], [[1], [2], [3]])dnl
  7963. m4_define([add], [m4_eval(([$1]) + ([$2]))])dnl
  7964. dnl list_add_n(N, ARG...)
  7965. dnl Output a list consisting of each ARG added to N
  7966. m4_define([list_add_n],
  7967. [m4_shift(m4_map_args([,m4_curry([add], [$1])], m4_shift($@)))])dnl
  7968. list_add_n([1], list)
  7969. =>2,3,4
  7970. list_add_n([2], list)
  7971. =>3,4,5
  7972. m4_define([list_add_x],
  7973. [m4_shift(m4_foreach([var], m4_dquote(m4_shift($@)),
  7974. [,add([$1],m4_defn([var]))]))])dnl
  7975. list_add_x([1], list)
  7976. =>2,3,4
  7977. -- Macro: m4_map_args_pair (MACRO, [MACRO-END = `macro'], ARG...)
  7978. For every pair of arguments ARG, invoke MACRO with two arguments.
  7979. If there is an odd number of arguments, invoke MACRO-END, which
  7980. defaults to MACRO, with the remaining argument.
  7981. m4_map_args_pair([, m4_reverse], [], [1], [2], [3])
  7982. =>, 2, 1, 3
  7983. m4_map_args_pair([, m4_reverse], [, m4_dquote], [1], [2], [3])
  7984. =>, 2, 1, [3]
  7985. m4_map_args_pair([, m4_reverse], [, m4_dquote], [1], [2], [3], [4])
  7986. =>, 2, 1, 4, 3
  7987. -- Macro: m4_map_args_sep ([PRE], [POST], [SEP], ARG...)
  7988. Expand the sequence `PRE[ARG]POST' for each argument, additionally
  7989. expanding SEP between arguments. One common use of this macro is
  7990. constructing a macro call, where the opening and closing
  7991. parentheses are split between PRE and POST; in particular,
  7992. `m4_map_args([MACRO], [ARG])' is equivalent to
  7993. `m4_map_args_sep([MACRO(], [)], [], [ARG])'. This macro provides
  7994. the most efficient means for iterating over an arbitrary list of
  7995. arguments, particularly when repeatedly constructing a macro call
  7996. with more arguments than ARG.
  7997. -- Macro: m4_map_args_w (STRING, [PRE], [POST], [SEP])
  7998. Expand the sequence `PRE[word]POST' for each word in the
  7999. whitespace-separated STRING, additionally expanding SEP between
  8000. words. This macro provides the most efficient means for iterating
  8001. over a whitespace-separated string. In particular,
  8002. `m4_map_args_w([STRING], [ACTION(], [)])' is more efficient than
  8003. `m4_foreach_w([var], [STRING], [ACTION(m4_defn([var]))])'.
  8004. -- Macro: m4_shiftn (COUNT, ...)
  8005. -- Macro: m4_shift2 (...)
  8006. -- Macro: m4_shift3 (...)
  8007. `m4_shiftn' performs COUNT iterations of `m4_shift', along with
  8008. validation that enough arguments were passed in to match the shift
  8009. count, and that the count is positive. `m4_shift2' and
  8010. `m4_shift3' are specializations of `m4_shiftn', introduced in
  8011. Autoconf 2.62, and are more efficient for two and three shifts,
  8012. respectively.
  8013. -- Macro: m4_stack_foreach (MACRO, ACTION)
  8014. -- Macro: m4_stack_foreach_lifo (MACRO, ACTION)
  8015. For each of the `m4_pushdef' definitions of MACRO, expand ACTION
  8016. with the single argument of a definition of MACRO.
  8017. `m4_stack_foreach' starts with the oldest definition, while
  8018. `m4_stack_foreach_lifo' starts with the current definition.
  8019. ACTION should not push or pop definitions of MACRO, nor is there
  8020. any guarantee that the current definition of MACRO matches the
  8021. argument that was passed to ACTION. The macro `m4_curry' can be
  8022. used if ACTION needs more than one argument, although in that case
  8023. it is more efficient to use M4_STACK_FOREACH_SEP.
  8024. Due to technical limitations, there are a few low-level m4sugar
  8025. functions, such as `m4_pushdef', that cannot be used as the MACRO
  8026. argument.
  8027. m4_pushdef([a], [1])m4_pushdef([a], [2])dnl
  8028. m4_stack_foreach([a], [ m4_incr])
  8029. => 2 3
  8030. m4_stack_foreach_lifo([a], [ m4_curry([m4_substr], [abcd])])
  8031. => cd bcd
  8032. -- Macro: m4_stack_foreach_sep (MACRO, [PRE], [POST], [SEP])
  8033. -- Macro: m4_stack_foreach_sep_lifo (MACRO, [PRE], [POST], [SEP])
  8034. Expand the sequence `PRE[definition]POST' for each `m4_pushdef'
  8035. definition of MACRO, additionally expanding SEP between
  8036. definitions. `m4_stack_foreach_sep' visits the oldest definition
  8037. first, while `m4_stack_foreach_sep_lifo' visits the current
  8038. definition first. This macro provides the most efficient means
  8039. for iterating over a pushdef stack. In particular,
  8040. `m4_stack_foreach([MACRO], [ACTION])' is short for
  8041. `m4_stack_foreach_sep([MACRO], [ACTION(], [)])'.
  8042. 
  8043. File: autoconf.info, Node: Evaluation Macros, Next: Text processing Macros, Prev: Looping constructs, Up: Programming in M4sugar
  8044. 8.3.6 Evaluation Macros
  8045. -----------------------
  8046. The following macros give some control over the order of the evaluation
  8047. by adding or removing levels of quotes.
  8048. -- Macro: m4_apply (MACRO, LIST)
  8049. Apply the elements of the quoted, comma-separated LIST as the
  8050. arguments to MACRO. If LIST is empty, invoke MACRO without
  8051. arguments. Note the difference between `m4_indir', which expects
  8052. its first argument to be a macro name but can use names that are
  8053. otherwise invalid, and `m4_apply', where MACRO can contain other
  8054. text, but must end in a valid macro name.
  8055. m4_apply([m4_count], [])
  8056. =>0
  8057. m4_apply([m4_count], [[]])
  8058. =>1
  8059. m4_apply([m4_count], [[1], [2]])
  8060. =>2
  8061. m4_apply([m4_join], [[|], [1], [2]])
  8062. =>1|2
  8063. -- Macro: m4_count (ARG, ...)
  8064. This macro returns the decimal count of the number of arguments it
  8065. was passed.
  8066. -- Macro: m4_curry (MACRO, ARG...)
  8067. This macro performs argument currying. The expansion of this
  8068. macro is another macro name that expects exactly one argument;
  8069. that argument is then appended to the ARG list, and then MACRO is
  8070. expanded with the resulting argument list.
  8071. m4_curry([m4_curry], [m4_reverse], [1])([2])([3])
  8072. =>3, 2, 1
  8073. Unfortunately, due to a limitation in M4 1.4.x, it is not possible
  8074. to pass the definition of a builtin macro as the argument to the
  8075. output of `m4_curry'; the empty string is used instead of the
  8076. builtin token. This behavior is rectified by using M4 1.6 or
  8077. newer.
  8078. -- Macro: m4_do (ARG, ...)
  8079. This macro loops over its arguments and expands each ARG in
  8080. sequence. Its main use is for readability; it allows the use of
  8081. indentation and fewer `dnl' to result in the same expansion. This
  8082. macro guarantees that no expansion will be concatenated with
  8083. subsequent text; to achieve full concatenation, use
  8084. `m4_unquote(m4_join([], ARG...))'.
  8085. m4_define([ab],[1])m4_define([bc],[2])m4_define([abc],[3])dnl
  8086. m4_do([a],[b])c
  8087. =>abc
  8088. m4_unquote(m4_join([],[a],[b]))c
  8089. =>3
  8090. m4_define([a],[A])m4_define([b],[B])m4_define([c],[C])dnl
  8091. m4_define([AB],[4])m4_define([BC],[5])m4_define([ABC],[6])dnl
  8092. m4_do([a],[b])c
  8093. =>ABC
  8094. m4_unquote(m4_join([],[a],[b]))c
  8095. =>3
  8096. -- Macro: m4_dquote (ARG, ...)
  8097. Return the arguments as a quoted list of quoted arguments.
  8098. Conveniently, if there is just one ARG, this effectively adds a
  8099. level of quoting.
  8100. -- Macro: m4_dquote_elt (ARG, ...)
  8101. Return the arguments as a series of double-quoted arguments.
  8102. Whereas `m4_dquote' returns a single argument, `m4_dquote_elt'
  8103. returns as many arguments as it was passed.
  8104. -- Macro: m4_echo (ARG, ...)
  8105. Return the arguments, with the same level of quoting. Other than
  8106. discarding whitespace after unquoted commas, this macro is a no-op.
  8107. -- Macro: m4_expand (ARG)
  8108. Return the expansion of ARG as a quoted string. Whereas
  8109. `m4_quote' is designed to collect expanded text into a single
  8110. argument, `m4_expand' is designed to perform one level of expansion
  8111. on quoted text. One distinction is in the treatment of whitespace
  8112. following a comma in the original ARG. Any time multiple
  8113. arguments are collected into one with `m4_quote', the M4 argument
  8114. collection rules discard the whitespace. However, with
  8115. `m4_expand', whitespace is preserved, even after the expansion of
  8116. macros contained in ARG. Additionally, `m4_expand' is able to
  8117. expand text that would involve an unterminated comment, whereas
  8118. expanding that same text as the argument to `m4_quote' runs into
  8119. difficulty in finding the end of the argument. Since manipulating
  8120. diversions during argument collection is inherently unsafe,
  8121. `m4_expand' issues an error if ARG attempts to change the current
  8122. diversion (*note Diversion support::).
  8123. m4_define([active], [ACT, IVE])dnl
  8124. m4_define([active2], [[ACT, IVE]])dnl
  8125. m4_quote(active, active)
  8126. =>ACT,IVE,ACT,IVE
  8127. m4_expand([active, active])
  8128. =>ACT, IVE, ACT, IVE
  8129. m4_quote(active2, active2)
  8130. =>ACT, IVE,ACT, IVE
  8131. m4_expand([active2, active2])
  8132. =>ACT, IVE, ACT, IVE
  8133. m4_expand([# m4_echo])
  8134. =># m4_echo
  8135. m4_quote(# m4_echo)
  8136. )
  8137. =># m4_echo)
  8138. =>
  8139. Note that `m4_expand' cannot handle an ARG that expands to literal
  8140. unbalanced quotes, but that quadrigraphs can be used when
  8141. unbalanced output is necessary. Likewise, unbalanced parentheses
  8142. should be supplied with double quoting or a quadrigraph.
  8143. m4_define([pattern], [[!@<:@]])dnl
  8144. m4_define([bar], [BAR])dnl
  8145. m4_expand([case $foo in
  8146. m4_defn([pattern])@:}@ bar ;;
  8147. *[)] blah ;;
  8148. esac])
  8149. =>case $foo in
  8150. => [![]) BAR ;;
  8151. => *) blah ;;
  8152. =>esac
  8153. -- Macro: m4_ignore (...)
  8154. This macro was introduced in Autoconf 2.62. Expands to nothing,
  8155. ignoring all of its arguments. By itself, this isn't very useful.
  8156. However, it can be used to conditionally ignore an arbitrary
  8157. number of arguments, by deciding which macro name to apply to a
  8158. list of arguments.
  8159. dnl foo outputs a message only if [debug] is defined.
  8160. m4_define([foo],
  8161. [m4_ifdef([debug],[AC_MSG_NOTICE],[m4_ignore])([debug message])])
  8162. Note that for earlier versions of Autoconf, the macro `__gnu__' can
  8163. serve the same purpose, although it is less readable.
  8164. -- Macro: m4_make_list (ARG, ...)
  8165. This macro exists to aid debugging of M4sugar algorithms. Its net
  8166. effect is similar to `m4_dquote'--it produces a quoted list of
  8167. quoted arguments, for each ARG. The difference is that this
  8168. version uses a comma-newline separator instead of just comma, to
  8169. improve readability of the list; with the result that it is less
  8170. efficient than `m4_dquote'.
  8171. m4_define([zero],[0])m4_define([one],[1])m4_define([two],[2])dnl
  8172. m4_dquote(zero, [one], [[two]])
  8173. =>[0],[one],[[two]]
  8174. m4_make_list(zero, [one], [[two]])
  8175. =>[0],
  8176. =>[one],
  8177. =>[[two]]
  8178. m4_foreach([number], m4_dquote(zero, [one], [[two]]), [ number])
  8179. => 0 1 two
  8180. m4_foreach([number], m4_make_list(zero, [one], [[two]]), [ number])
  8181. => 0 1 two
  8182. -- Macro: m4_quote (ARG, ...)
  8183. Return the arguments as a single entity, i.e., wrap them into a
  8184. pair of quotes. This effectively collapses multiple arguments
  8185. into one, although it loses whitespace after unquoted commas in
  8186. the process.
  8187. -- Macro: m4_reverse (ARG, ...)
  8188. Outputs each argument with the same level of quoting, but in
  8189. reverse order, and with space following each comma for readability.
  8190. m4_define([active], [ACT,IVE])
  8191. =>
  8192. m4_reverse(active, [active])
  8193. =>active, IVE, ACT
  8194. -- Macro: m4_unquote (ARG, ...)
  8195. This macro was introduced in Autoconf 2.62. Expand each argument,
  8196. separated by commas. For a single ARG, this effectively removes a
  8197. layer of quoting, and `m4_unquote([ARG])' is more efficient than
  8198. the equivalent `m4_do([ARG])'. For multiple arguments, this
  8199. results in an unquoted list of expansions. This is commonly used
  8200. with `m4_split', in order to convert a single quoted list into a
  8201. series of quoted elements.
  8202. The following example aims at emphasizing the difference between
  8203. several scenarios: not using these macros, using `m4_defn', using
  8204. `m4_quote', using `m4_dquote', and using `m4_expand'.
  8205. $ cat example.m4
  8206. dnl Overquote, so that quotes are visible.
  8207. m4_define([show], [$[]1 = [$1], $[]@ = [$@]])
  8208. m4_define([a], [A])
  8209. m4_define([mkargs], [1, 2[,] 3])
  8210. m4_define([arg1], [[$1]])
  8211. m4_divert([0])dnl
  8212. show(a, b)
  8213. show([a, b])
  8214. show(m4_quote(a, b))
  8215. show(m4_dquote(a, b))
  8216. show(m4_expand([a, b]))
  8217. arg1(mkargs)
  8218. arg1([mkargs])
  8219. arg1(m4_defn([mkargs]))
  8220. arg1(m4_quote(mkargs))
  8221. arg1(m4_dquote(mkargs))
  8222. arg1(m4_expand([mkargs]))
  8223. $ autom4te -l m4sugar example.m4
  8224. $1 = A, $@ = [A],[b]
  8225. $1 = a, b, $@ = [a, b]
  8226. $1 = A,b, $@ = [A,b]
  8227. $1 = [A],[b], $@ = [[A],[b]]
  8228. $1 = A, b, $@ = [A, b]
  8229. 1
  8230. mkargs
  8231. 1, 2[,] 3
  8232. 1,2, 3
  8233. [1],[2, 3]
  8234. 1, 2, 3
  8235. 
  8236. File: autoconf.info, Node: Text processing Macros, Next: Number processing Macros, Prev: Evaluation Macros, Up: Programming in M4sugar
  8237. 8.3.7 String manipulation in M4
  8238. -------------------------------
  8239. The following macros may be used to manipulate strings in M4. Many of
  8240. the macros in this section intentionally result in quoted strings as
  8241. output, rather than subjecting the arguments to further expansions. As
  8242. a result, if you are manipulating text that contains active M4
  8243. characters, the arguments are passed with single quoting rather than
  8244. double.
  8245. -- Macro: m4_append (MACRO-NAME, STRING, [SEPARATOR])
  8246. -- Macro: m4_append_uniq (MACRO-NAME, STRING, [SEPARATOR] [IF-UNIQ],
  8247. [IF-DUPLICATE])
  8248. Redefine MACRO-NAME to its former contents with SEPARATOR and
  8249. STRING added at the end. If MACRO-NAME was undefined before (but
  8250. not if it was defined but empty), then no SEPARATOR is added. As
  8251. of Autoconf 2.62, neither STRING nor SEPARATOR are expanded during
  8252. this macro; instead, they are expanded when MACRO-NAME is invoked.
  8253. `m4_append' can be used to grow strings, and `m4_append_uniq' to
  8254. grow strings without duplicating substrings. Additionally,
  8255. `m4_append_uniq' takes two optional parameters as of Autoconf 2.62;
  8256. IF-UNIQ is expanded if STRING was appended, and IF-DUPLICATE is
  8257. expanded if STRING was already present. Also, `m4_append_uniq'
  8258. warns if SEPARATOR is not empty, but occurs within STRING, since
  8259. that can lead to duplicates.
  8260. Note that `m4_append' can scale linearly in the length of the final
  8261. string, depending on the quality of the underlying M4
  8262. implementation, while `m4_append_uniq' has an inherent quadratic
  8263. scaling factor. If an algorithm can tolerate duplicates in the
  8264. final string, use the former for speed. If duplicates must be
  8265. avoided, consider using `m4_set_add' instead (*note Set
  8266. manipulation Macros::).
  8267. m4_define([active], [ACTIVE])dnl
  8268. m4_append([sentence], [This is an])dnl
  8269. m4_append([sentence], [ active ])dnl
  8270. m4_append([sentence], [symbol.])dnl
  8271. sentence
  8272. =>This is an ACTIVE symbol.
  8273. m4_undefine([active])dnl
  8274. =>This is an active symbol.
  8275. m4_append_uniq([list], [one], [, ], [new], [existing])
  8276. =>new
  8277. m4_append_uniq([list], [one], [, ], [new], [existing])
  8278. =>existing
  8279. m4_append_uniq([list], [two], [, ], [new], [existing])
  8280. =>new
  8281. m4_append_uniq([list], [three], [, ], [new], [existing])
  8282. =>new
  8283. m4_append_uniq([list], [two], [, ], [new], [existing])
  8284. =>existing
  8285. list
  8286. =>one, two, three
  8287. m4_dquote(list)
  8288. =>[one],[two],[three]
  8289. m4_append([list2], [one], [[, ]])dnl
  8290. m4_append_uniq([list2], [two], [[, ]])dnl
  8291. m4_append([list2], [three], [[, ]])dnl
  8292. list2
  8293. =>one, two, three
  8294. m4_dquote(list2)
  8295. =>[one, two, three]
  8296. -- Macro: m4_append_uniq_w (MACRO-NAME, STRINGS)
  8297. This macro was introduced in Autoconf 2.62. It is similar to
  8298. `m4_append_uniq', but treats STRINGS as a whitespace separated
  8299. list of words to append, and only appends unique words.
  8300. MACRO-NAME is updated with a single space between new words.
  8301. m4_append_uniq_w([numbers], [1 1 2])dnl
  8302. m4_append_uniq_w([numbers], [ 2 3 ])dnl
  8303. numbers
  8304. =>1 2 3
  8305. -- Macro: m4_chomp (STRING)
  8306. -- Macro: m4_chomp_all (STRING)
  8307. Output STRING in quotes, but without a trailing newline. The
  8308. macro `m4_chomp' is slightly faster, and removes at most one
  8309. newline; the macro `m4_chomp_all' removes all consecutive trailing
  8310. newlines. Unlike `m4_flatten', embedded newlines are left intact,
  8311. and backslash does not influence the result.
  8312. -- Macro: m4_combine ([SEPARATOR], PREFIX-LIST, [INFIX], SUFFIX-1,
  8313. [SUFFIX-2], ...)
  8314. This macro produces a quoted string containing the pairwise
  8315. combination of every element of the quoted, comma-separated
  8316. PREFIX-LIST, and every element from the SUFFIX arguments. Each
  8317. pairwise combination is joined with INFIX in the middle, and
  8318. successive pairs are joined by SEPARATOR. No expansion occurs on
  8319. any of the arguments. No output occurs if either the PREFIX or
  8320. SUFFIX list is empty, but the lists can contain empty elements.
  8321. m4_define([a], [oops])dnl
  8322. m4_combine([, ], [[a], [b], [c]], [-], [1], [2], [3])
  8323. =>a-1, a-2, a-3, b-1, b-2, b-3, c-1, c-2, c-3
  8324. m4_combine([, ], [[a], [b]], [-])
  8325. =>
  8326. m4_combine([, ], [[a], [b]], [-], [])
  8327. =>a-, b-
  8328. m4_combine([, ], [], [-], [1], [2])
  8329. =>
  8330. m4_combine([, ], [[]], [-], [1], [2])
  8331. =>-1, -2
  8332. -- Macro: m4_escape (STRING)
  8333. Convert all instances of `[', `]', `#', and `$' within STRING into
  8334. their respective quadrigraphs. The result is still a quoted
  8335. string.
  8336. -- Macro: m4_flatten (STRING)
  8337. Flatten STRING into a single line. Delete all backslash-newline
  8338. pairs, and replace all remaining newlines with a space. The
  8339. result is still a quoted string.
  8340. -- Macro: m4_join ([SEPARATOR], ARGS...)
  8341. -- Macro: m4_joinall ([SEPARATOR], ARGS...)
  8342. Concatenate each ARG, separated by SEPARATOR. `joinall' uses
  8343. every argument, while `join' omits empty arguments so that there
  8344. are no back-to-back separators in the output. The result is a
  8345. quoted string.
  8346. m4_define([active], [ACTIVE])dnl
  8347. m4_join([|], [one], [], [active], [two])
  8348. =>one|active|two
  8349. m4_joinall([|], [one], [], [active], [two])
  8350. =>one||active|two
  8351. Note that if all you intend to do is join ARGS with commas between
  8352. them, to form a quoted list suitable for `m4_foreach', it is more
  8353. efficient to use `m4_dquote'.
  8354. -- Macro: m4_newline ([TEXT])
  8355. This macro was introduced in Autoconf 2.62, and expands to a
  8356. newline, followed by any TEXT. It is primarily useful for
  8357. maintaining macro formatting, and ensuring that M4 does not
  8358. discard leading whitespace during argument collection.
  8359. -- Macro: m4_normalize (STRING)
  8360. Remove leading and trailing spaces and tabs, sequences of
  8361. backslash-then-newline, and replace multiple spaces, tabs, and
  8362. newlines with a single space. This is a combination of
  8363. `m4_flatten' and `m4_strip'. To determine if STRING consists only
  8364. of bytes that would be removed by `m4_normalize', you can use
  8365. `m4_ifblank'.
  8366. -- Macro: m4_re_escape (STRING)
  8367. Backslash-escape all characters in STRING that are active in
  8368. regexps.
  8369. -- Macro: m4_split (STRING, [REGEXP = `[\t ]+'])
  8370. Split STRING into an M4 list of elements quoted by `[' and `]',
  8371. while keeping white space at the beginning and at the end. If
  8372. REGEXP is given, use it instead of `[\t ]+' for splitting. If
  8373. STRING is empty, the result is an empty list.
  8374. -- Macro: m4_strip (STRING)
  8375. Strip whitespace from STRING. Sequences of spaces and tabs are
  8376. reduced to a single space, then leading and trailing spaces are
  8377. removed. The result is still a quoted string. Note that this
  8378. does not interfere with newlines; if you want newlines stripped as
  8379. well, consider `m4_flatten', or do it all at once with
  8380. `m4_normalize'. To quickly test if STRING has only whitespace,
  8381. use `m4_ifblank'.
  8382. -- Macro: m4_text_box (MESSAGE, [FRAME = `-'])
  8383. Add a text box around MESSAGE, using FRAME as the border character
  8384. above and below the message. The FRAME argument must be a single
  8385. byte, and does not support quadrigraphs. The frame correctly
  8386. accounts for the subsequent expansion of MESSAGE. For example:
  8387. m4_define([macro], [abc])dnl
  8388. m4_text_box([macro])
  8389. =>## --- ##
  8390. =>## abc ##
  8391. =>## --- ##
  8392. The MESSAGE must contain balanced quotes and parentheses, although
  8393. quadrigraphs can be used to work around this.
  8394. -- Macro: m4_text_wrap (STRING, [PREFIX], [PREFIX1 = `PREFIX'], [WIDTH
  8395. = `79'])
  8396. Break STRING into a series of whitespace-separated words, then
  8397. output those words separated by spaces, and wrapping lines any
  8398. time the output would exceed WIDTH columns. If given, PREFIX1
  8399. begins the first line, and PREFIX begins all wrapped lines. If
  8400. PREFIX1 is longer than PREFIX, then the first line consists of
  8401. just PREFIX1. If PREFIX is longer than PREFIX1, padding is
  8402. inserted so that the first word of STRING begins at the same
  8403. indentation as all wrapped lines. Note that using literal tab
  8404. characters in any of the arguments will interfere with the
  8405. calculation of width. No expansions occur on PREFIX, PREFIX1, or
  8406. the words of STRING, although quadrigraphs are recognized.
  8407. For some examples:
  8408. m4_text_wrap([Short string */], [ ], [/* ], [20])
  8409. =>/* Short string */
  8410. m4_text_wrap([Much longer string */], [ ], [/* ], [20])
  8411. =>/* Much longer
  8412. => string */
  8413. m4_text_wrap([Short doc.], [ ], [ --short ], [30])
  8414. => --short Short doc.
  8415. m4_text_wrap([Short doc.], [ ], [ --too-wide ], [30])
  8416. => --too-wide
  8417. => Short doc.
  8418. m4_text_wrap([Super long documentation.], [ ],
  8419. [ --too-wide ], 30)
  8420. => --too-wide
  8421. => Super long
  8422. => documentation.
  8423. -- Macro: m4_tolower (STRING)
  8424. -- Macro: m4_toupper (STRING)
  8425. Return STRING with letters converted to upper or lower case,
  8426. respectively.
  8427. 
  8428. File: autoconf.info, Node: Number processing Macros, Next: Set manipulation Macros, Prev: Text processing Macros, Up: Programming in M4sugar
  8429. 8.3.8 Arithmetic computation in M4
  8430. ----------------------------------
  8431. The following macros facilitate integer arithmetic operations. Where a
  8432. parameter is documented as taking an arithmetic expression, you can use
  8433. anything that can be parsed by `m4_eval'.
  8434. -- Macro: m4_cmp (EXPR-1, EXPR-2)
  8435. Compare the arithmetic expressions EXPR-1 and EXPR-2, and expand
  8436. to `-1' if EXPR-1 is smaller, `0' if they are equal, and `1' if
  8437. EXPR-1 is larger.
  8438. -- Macro: m4_list_cmp (LIST-1, LIST-2)
  8439. Compare the two M4 lists consisting of comma-separated arithmetic
  8440. expressions, left to right. Expand to `-1' for the first element
  8441. pairing where the value from LIST-1 is smaller, `1' where the
  8442. value from LIST-2 is smaller, or `0' if both lists have the same
  8443. values. If one list is shorter than the other, the remaining
  8444. elements of the longer list are compared against zero.
  8445. m4_list_cmp([1, 0], [1])
  8446. =>0
  8447. m4_list_cmp([1, [1 * 0]], [1, 0])
  8448. =>0
  8449. m4_list_cmp([1, 2], [1, 0])
  8450. =>1
  8451. m4_list_cmp([1, [1+1], 3],[1, 2])
  8452. =>1
  8453. m4_list_cmp([1, 2, -3], [1, 2])
  8454. =>-1
  8455. m4_list_cmp([1, 0], [1, 2])
  8456. =>-1
  8457. m4_list_cmp([1], [1, 2])
  8458. =>-1
  8459. -- Macro: m4_max (ARG, ...)
  8460. This macro was introduced in Autoconf 2.62. Expand to the decimal
  8461. value of the maximum arithmetic expression among all the arguments.
  8462. -- Macro: m4_min (ARG, ...)
  8463. This macro was introduced in Autoconf 2.62. Expand to the decimal
  8464. value of the minimum arithmetic expression among all the arguments.
  8465. -- Macro: m4_sign (EXPR)
  8466. Expand to `-1' if the arithmetic expression EXPR is negative, `1'
  8467. if it is positive, and `0' if it is zero.
  8468. -- Macro: m4_version_compare (VERSION-1, VERSION-2)
  8469. This macro was introduced in Autoconf 2.53, but had a number of
  8470. usability limitations that were not lifted until Autoconf 2.62.
  8471. Compare the version strings VERSION-1 and VERSION-2, and expand to
  8472. `-1' if VERSION-1 is smaller, `0' if they are the same, or `1'
  8473. VERSION-2 is smaller. Version strings must be a list of elements
  8474. separated by `.', `,' or `-', where each element is a number along
  8475. with optional case-insensitive letters designating beta releases.
  8476. The comparison stops at the leftmost element that contains a
  8477. difference, although a 0 element compares equal to a missing
  8478. element.
  8479. It is permissible to include commit identifiers in VERSION, such
  8480. as an abbreviated SHA1 of the commit, provided there is still a
  8481. monotonically increasing prefix to allow for accurate version-based
  8482. comparisons. For example, this paragraph was written when the
  8483. development snapshot of autoconf claimed to be at version
  8484. `2.61a-248-dc51', or 248 commits after the 2.61a release, with an
  8485. abbreviated commit identification of `dc51'.
  8486. m4_version_compare([1.1], [2.0])
  8487. =>-1
  8488. m4_version_compare([2.0b], [2.0a])
  8489. =>1
  8490. m4_version_compare([1.1.1], [1.1.1a])
  8491. =>-1
  8492. m4_version_compare([1.2], [1.1.1a])
  8493. =>1
  8494. m4_version_compare([1.0], [1])
  8495. =>0
  8496. m4_version_compare([1.1pre], [1.1PRE])
  8497. =>0
  8498. m4_version_compare([1.1a], [1,10])
  8499. =>-1
  8500. m4_version_compare([2.61a], [2.61a-248-dc51])
  8501. =>-1
  8502. m4_version_compare([2.61b], [2.61a-248-dc51])
  8503. =>1
  8504. -- Macro: m4_version_prereq (VERSION, [IF-NEW-ENOUGH], [IF-OLD =
  8505. `m4_fatal'])
  8506. Compares VERSION against the version of Autoconf currently
  8507. running. If the running version is at VERSION or newer, expand
  8508. IF-NEW-ENOUGH, but if VERSION is larger than the version currently
  8509. executing, expand IF-OLD, which defaults to printing an error
  8510. message and exiting m4sugar with status 63. When given only one
  8511. argument, this behaves like `AC_PREREQ' (*note Versioning::).
  8512. Remember that the autoconf philosophy favors feature checks over
  8513. version checks.
  8514. 
  8515. File: autoconf.info, Node: Set manipulation Macros, Next: Forbidden Patterns, Prev: Number processing Macros, Up: Programming in M4sugar
  8516. 8.3.9 Set manipulation in M4
  8517. ----------------------------
  8518. Sometimes, it is necessary to track a set of data, where the order does
  8519. not matter and where there are no duplicates in the set. The following
  8520. macros facilitate set manipulations. Each set is an opaque object,
  8521. which can only be accessed via these basic operations. The underlying
  8522. implementation guarantees linear scaling for set creation, which is more
  8523. efficient than using the quadratic `m4_append_uniq'. Both set names
  8524. and values can be arbitrary strings, except for unbalanced quotes.
  8525. This implementation ties up memory for removed elements until the next
  8526. operation that must traverse all the elements of a set; and although
  8527. that may slow down some operations until the memory for removed elements
  8528. is pruned, it still guarantees linear performance.
  8529. -- Macro: m4_set_add (SET, VALUE, [IF-UNIQ], [IF-DUP])
  8530. Adds the string VALUE as a member of set SET. Expand IF-UNIQ if
  8531. the element was added, or IF-DUP if it was previously in the set.
  8532. Operates in amortized constant time, so that set creation scales
  8533. linearly.
  8534. -- Macro: m4_set_add_all (SET, VALUE...)
  8535. Adds each VALUE to the set SET. This is slightly more efficient
  8536. than repeatedly invoking `m4_set_add'.
  8537. -- Macro: m4_set_contains (SET, VALUE, [IF-PRESENT], [IF-ABSENT])
  8538. Expands IF-PRESENT if the string VALUE is a member of SET,
  8539. otherwise IF-ABSENT.
  8540. m4_set_contains([a], [1], [yes], [no])
  8541. =>no
  8542. m4_set_add([a], [1], [added], [dup])
  8543. =>added
  8544. m4_set_add([a], [1], [added], [dup])
  8545. =>dup
  8546. m4_set_contains([a], [1], [yes], [no])
  8547. =>yes
  8548. m4_set_remove([a], [1], [removed], [missing])
  8549. =>removed
  8550. m4_set_contains([a], [1], [yes], [no])
  8551. =>no
  8552. m4_set_remove([a], [1], [removed], [missing])
  8553. =>missing
  8554. -- Macro: m4_set_contents (SET, [SEP])
  8555. -- Macro: m4_set_dump (SET, [SEP])
  8556. Expands to a single string consisting of all the members of the set
  8557. SET, each separated by SEP, which is not expanded.
  8558. `m4_set_contents' leaves the elements in SET but reclaims any
  8559. memory occupied by removed elements, while `m4_set_dump' is a
  8560. faster one-shot action that also deletes the set. No provision is
  8561. made for disambiguating members that contain a non-empty SEP as a
  8562. substring; use `m4_set_empty' to distinguish between an empty set
  8563. and the set containing only the empty string. The order of the
  8564. output is unspecified; in the current implementation, part of the
  8565. speed of `m4_set_dump' results from using a different output order
  8566. than `m4_set_contents'. These macros scale linearly in the size
  8567. of the set before memory pruning, and `m4_set_contents([SET],
  8568. [SEP])' is faster than `m4_joinall([SEP]m4_set_listc([SET]))'.
  8569. m4_set_add_all([a], [1], [2], [3])
  8570. =>
  8571. m4_set_contents([a], [-])
  8572. =>1-2-3
  8573. m4_joinall([-]m4_set_listc([a]))
  8574. =>1-2-3
  8575. m4_set_dump([a], [-])
  8576. =>3-2-1
  8577. m4_set_contents([a])
  8578. =>
  8579. m4_set_add([a], [])
  8580. =>
  8581. m4_set_contents([a], [-])
  8582. =>
  8583. -- Macro: m4_set_delete (SET)
  8584. Delete all elements and memory associated with SET. This is
  8585. linear in the set size, and faster than removing one element at a
  8586. time.
  8587. -- Macro: m4_set_difference (SETA, SETB)
  8588. -- Macro: m4_set_intersection (SETA, SETB)
  8589. -- Macro: m4_set_union (SETA, SETB)
  8590. Compute the relation between SETA and SETB, and output the result
  8591. as a list of quoted arguments without duplicates and with a
  8592. leading comma. Set difference selects the elements in SETA but
  8593. not SETB, intersection selects only elements in both sets, and
  8594. union selects elements in either set. These actions are linear in
  8595. the sum of the set sizes. The leading comma is necessary to
  8596. distinguish between no elements and the empty string as the only
  8597. element.
  8598. m4_set_add_all([a], [1], [2], [3])
  8599. =>
  8600. m4_set_add_all([b], [3], [], [4])
  8601. =>
  8602. m4_set_difference([a], [b])
  8603. =>,1,2
  8604. m4_set_difference([b], [a])
  8605. =>,,4
  8606. m4_set_intersection([a], [b])
  8607. =>,3
  8608. m4_set_union([a], [b])
  8609. =>,1,2,3,,4
  8610. -- Macro: m4_set_empty (SET, [IF-EMPTY], [IF-ELEMENTS])
  8611. Expand IF-EMPTY if the set SET has no elements, otherwise expand
  8612. IF-ELEMENTS. This macro operates in constant time. Using this
  8613. macro can help disambiguate output from `m4_set_contents' or
  8614. `m4_set_list'.
  8615. -- Macro: m4_set_foreach (SET, VARIABLE, ACTION)
  8616. For each element in the set SET, expand ACTION with the macro
  8617. VARIABLE defined as the set element. Behavior is unspecified if
  8618. ACTION recursively lists the contents of SET (although listing
  8619. other sets is acceptable), or if it modifies the set in any way
  8620. other than removing the element currently contained in VARIABLE.
  8621. This macro is faster than the corresponding `m4_foreach([VARIABLE],
  8622. m4_indir([m4_dquote]m4_set_listc([SET])), [ACTION])', although
  8623. `m4_set_map' might be faster still.
  8624. m4_set_add_all([a]m4_for([i], [1], [5], [], [,i]))
  8625. =>
  8626. m4_set_contents([a])
  8627. =>12345
  8628. m4_set_foreach([a], [i],
  8629. [m4_if(m4_eval(i&1), [0], [m4_set_remove([a], i, [i])])])
  8630. =>24
  8631. m4_set_contents([a])
  8632. =>135
  8633. -- Macro: m4_set_list (SET)
  8634. -- Macro: m4_set_listc (SET)
  8635. Produce a list of arguments, where each argument is a quoted
  8636. element from the set SET. The variant `m4_set_listc' is
  8637. unambiguous, by adding a leading comma if there are any set
  8638. elements, whereas the variant `m4_set_list' cannot distinguish
  8639. between an empty set and a set containing only the empty string.
  8640. These can be directly used in macros that take multiple arguments,
  8641. such as `m4_join' or `m4_set_add_all', or wrapped by `m4_dquote'
  8642. for macros that take a quoted list, such as `m4_map' or
  8643. `m4_foreach'. Any memory occupied by removed elements is
  8644. reclaimed during these macros.
  8645. m4_set_add_all([a], [1], [2], [3])
  8646. =>
  8647. m4_set_list([a])
  8648. =>1,2,3
  8649. m4_set_list([b])
  8650. =>
  8651. m4_set_listc([b])
  8652. =>
  8653. m4_count(m4_set_list([b]))
  8654. =>1
  8655. m4_set_empty([b], [0], [m4_count(m4_set_list([b]))])
  8656. =>0
  8657. m4_set_add([b], [])
  8658. =>
  8659. m4_set_list([b])
  8660. =>
  8661. m4_set_listc([b])
  8662. =>,
  8663. m4_count(m4_set_list([b]))
  8664. =>1
  8665. m4_set_empty([b], [0], [m4_count(m4_set_list([b]))])
  8666. =>1
  8667. -- Macro: m4_set_map (SET, ACTION)
  8668. For each element in the set SET, expand ACTION with a single
  8669. argument of the set element. Behavior is unspecified if ACTION
  8670. recursively lists the contents of SET (although listing other sets
  8671. is acceptable), or if it modifies the set in any way other than
  8672. removing the element passed as an argument. This macro is faster
  8673. than either corresponding counterpart of
  8674. `m4_map_args([ACTION]m4_set_listc([SET]))' or
  8675. `m4_set_foreach([SET], [var], [ACTION(m4_defn([var]))])'. It is
  8676. possible to use `m4_curry' if more than one argument is needed for
  8677. ACTION, although it is more efficient to use `m4_set_map_sep' in
  8678. that case.
  8679. -- Macro: m4_set_map_sep (SET, [PRE], [POST], [SEP])
  8680. For each element in the set SET, expand `PRE[element]POST',
  8681. additionally expanding SEP between elements. Behavior is
  8682. unspecified if the expansion recursively lists the contents of SET
  8683. (although listing other sets is acceptable), or if it modifies the
  8684. set in any way other than removing the element visited by the
  8685. expansion. This macro provides the most efficient means for
  8686. non-destructively visiting the elements of a set; in particular,
  8687. `m4_set_map([SET], [ACTION])' is equivalent to
  8688. `m4_set_map_sep([SET], [ACTION(], [)])'.
  8689. -- Macro: m4_set_remove (SET, VALUE, [IF-PRESENT], [IF-ABSENT])
  8690. If VALUE is an element in the set SET, then remove it and expand
  8691. IF-PRESENT. Otherwise expand IF-ABSENT. This macro operates in
  8692. constant time so that multiple removals will scale linearly rather
  8693. than quadratically; but when used outside of `m4_set_foreach' or
  8694. `m4_set_map', it leaves memory occupied until the set is later
  8695. compacted by `m4_set_contents' or `m4_set_list'. Several other
  8696. set operations are then less efficient between the time of element
  8697. removal and subsequent memory compaction, but still maintain their
  8698. guaranteed scaling performance.
  8699. -- Macro: m4_set_size (SET)
  8700. Expand to the size of the set SET. This implementation operates
  8701. in constant time, and is thus more efficient than
  8702. `m4_eval(m4_count(m4_set_listc([set])) - 1)'.
  8703. 
  8704. File: autoconf.info, Node: Forbidden Patterns, Prev: Set manipulation Macros, Up: Programming in M4sugar
  8705. 8.3.10 Forbidden Patterns
  8706. -------------------------
  8707. M4sugar provides a means to define suspicious patterns, patterns
  8708. describing tokens which should not be found in the output. For
  8709. instance, if an Autoconf `configure' script includes tokens such as
  8710. `AC_DEFINE', or `dnl', then most probably something went wrong
  8711. (typically a macro was not evaluated because of overquotation).
  8712. M4sugar forbids all the tokens matching `^_?m4_' and `^dnl$'.
  8713. Additional layers, such as M4sh and Autoconf, add additional forbidden
  8714. patterns to the list.
  8715. -- Macro: m4_pattern_forbid (PATTERN)
  8716. Declare that no token matching PATTERN must be found in the output.
  8717. Comments are not checked; this can be a problem if, for instance,
  8718. you have some macro left unexpanded after an `#include'. No
  8719. consensus is currently found in the Autoconf community, as some
  8720. people consider it should be valid to name macros in comments
  8721. (which doesn't make sense to the authors of this documentation:
  8722. input, such as macros, should be documented by `dnl' comments;
  8723. reserving `#'-comments to document the output).
  8724. Of course, you might encounter exceptions to these generic rules, for
  8725. instance you might have to refer to `$m4_flags'.
  8726. -- Macro: m4_pattern_allow (PATTERN)
  8727. Any token matching PATTERN is allowed, including if it matches an
  8728. `m4_pattern_forbid' pattern.
  8729. 
  8730. File: autoconf.info, Node: Debugging via autom4te, Prev: Programming in M4sugar, Up: Programming in M4
  8731. 8.4 Debugging via autom4te
  8732. ==========================
  8733. At times, it is desirable to see what was happening inside m4, to see
  8734. why output was not matching expectations. However, post-processing done
  8735. by `autom4te' means that directly using the m4 builtin `m4_traceon' is
  8736. likely to interfere with operation. Also, frequent diversion changes
  8737. and the concept of forbidden tokens make it difficult to use `m4_defn'
  8738. to generate inline comments in the final output.
  8739. There are a couple of tools to help with this. One is the use of the
  8740. `--trace' option provided by `autom4te' (as well as each of the
  8741. programs that wrap `autom4te', such as `autoconf'), in order to inspect
  8742. when a macro is called and with which arguments. For example, when
  8743. this paragraph was written, the autoconf version could be found by:
  8744. $ autoconf --trace=AC_INIT
  8745. configure.ac:23:AC_INIT:GNU Autoconf:2.63b.95-3963:bug-autoconf@gnu.org
  8746. $ autoconf --trace='AC_INIT:version is $2'
  8747. version is 2.63b.95-3963
  8748. Another trick is to print out the expansion of various m4
  8749. expressions to standard error or to an independent file, with no
  8750. further m4 expansion, and without interfering with diversion changes or
  8751. the post-processing done to standard output. `m4_errprintn' shows a
  8752. given expression on standard error. For example, if you want to see
  8753. the expansion of an autoconf primitive or of one of your autoconf
  8754. macros, you can do it like this:
  8755. $ cat <<\EOF > configure.ac
  8756. AC_INIT
  8757. m4_errprintn([The definition of AC_DEFINE_UNQUOTED:])
  8758. m4_errprintn(m4_defn([AC_DEFINE_UNQUOTED]))
  8759. AC_OUTPUT
  8760. EOF
  8761. $ autoconf
  8762. error-->The definition of AC_DEFINE_UNQUOTED:
  8763. error-->_AC_DEFINE_Q([], $@)
  8764. 
  8765. File: autoconf.info, Node: Programming in M4sh, Next: Writing Autoconf Macros, Prev: Programming in M4, Up: Top
  8766. 9 Programming in M4sh
  8767. *********************
  8768. M4sh, pronounced "mash", is aiming at producing portable Bourne shell
  8769. scripts. This name was coined by Lars J. Aas, who notes that,
  8770. according to the Webster's Revised Unabridged Dictionary (1913):
  8771. Mash \Mash\, n. [Akin to G. meisch, maisch, meische, maische,
  8772. mash, wash, and prob. to AS. miscian to mix. See "Mix".]
  8773. 1. A mass of mixed ingredients reduced to a soft pulpy state by
  8774. beating or pressure...
  8775. 2. A mixture of meal or bran and water fed to animals.
  8776. 3. A mess; trouble. [Obs.] -Beau. & Fl.
  8777. M4sh reserves the M4 macro namespace `^_AS_' for internal use, and
  8778. the namespace `^AS_' for M4sh macros. It also reserves the shell and
  8779. environment variable namespace `^as_', and the here-document delimiter
  8780. namespace `^_AS[A-Z]' in the output file. You should not define your
  8781. own macros or output shell code that conflicts with these namespaces.
  8782. * Menu:
  8783. * Common Shell Constructs:: Portability layer for common shell constructs
  8784. * Polymorphic Variables:: Support for indirect variable names
  8785. * Initialization Macros:: Macros to establish a sane shell environment
  8786. * File Descriptor Macros:: File descriptor macros for input and output
  8787. 
  8788. File: autoconf.info, Node: Common Shell Constructs, Next: Polymorphic Variables, Up: Programming in M4sh
  8789. 9.1 Common Shell Constructs
  8790. ===========================
  8791. M4sh provides portable alternatives for some common shell constructs
  8792. that unfortunately are not portable in practice.
  8793. -- Macro: AS_BOX (TEXT, [CHAR = `-'])
  8794. Expand into shell code that will output TEXT surrounded by a box
  8795. with CHAR in the top and bottom border. TEXT should not contain a
  8796. newline, but may contain shell expansions valid for unquoted
  8797. here-documents. CHAR defaults to `-', but can be any character
  8798. except `/', `'', `"', `\', `&', or ``'. This is useful for
  8799. outputting a comment box into log files to separate distinct
  8800. phases of script operation.
  8801. -- Macro: AS_CASE (WORD, [PATTERN1], [IF-MATCHED1], ..., [DEFAULT])
  8802. Expand into a shell `case' statement, where WORD is matched
  8803. against one or more patterns. IF-MATCHED is run if the
  8804. corresponding pattern matched WORD, else DEFAULT is run. Avoids
  8805. several portability issues (*note Limitations of Shell Builtins:
  8806. case.).
  8807. -- Macro: AS_DIRNAME (FILE-NAME)
  8808. Output the directory portion of FILE-NAME. For example, if
  8809. `$file' is `/one/two/three', the command
  8810. `dir=`AS_DIRNAME(["$file"])`' sets `dir' to `/one/two'.
  8811. This interface may be improved in the future to avoid forks and
  8812. losing trailing newlines.
  8813. -- Macro: AS_ECHO (WORD)
  8814. Emits WORD to the standard output, followed by a newline. WORD
  8815. must be a single shell word (typically a quoted string). The
  8816. bytes of WORD are output as-is, even if it starts with "-" or
  8817. contains "\". Redirections can be placed outside the macro
  8818. invocation. This is much more portable than using `echo' (*note
  8819. Limitations of Shell Builtins: echo.).
  8820. -- Macro: AS_ECHO_N (WORD)
  8821. Emits WORD to the standard output, without a following newline.
  8822. WORD must be a single shell word (typically a quoted string) and,
  8823. for portability, should not include more than one newline. The
  8824. bytes of WORD are output as-is, even if it starts with "-" or
  8825. contains "\". Redirections can be placed outside the macro
  8826. invocation.
  8827. -- Macro: AS_ESCAPE (STRING, [CHARS = ``\"$'])
  8828. Expands to STRING, with any characters in CHARS escaped with a
  8829. backslash (`\'). CHARS should be at most four bytes long, and
  8830. only contain characters from the set ``\"$'; however, characters
  8831. may be safely listed more than once in CHARS for the sake of
  8832. syntax highlighting editors. The current implementation expands
  8833. STRING after adding escapes; if STRING contains macro calls that
  8834. in turn expand to text needing shell quoting, you can use
  8835. `AS_ESCAPE(m4_dquote(m4_expand([string])))'.
  8836. The default for CHARS (`\"$`') is the set of characters needing
  8837. escapes when STRING will be used literally within double quotes.
  8838. One common variant is the set of characters to protect when STRING
  8839. will be used literally within back-ticks or an unquoted
  8840. here-document (`\$`'). Another common variant is `""', which can
  8841. be used to form a double-quoted string containing the same
  8842. expansions that would have occurred if STRING were expanded in an
  8843. unquoted here-document; however, when using this variant, care
  8844. must be taken that STRING does not use double quotes within
  8845. complex variable expansions (such as `${foo-`echo "hi"`}') that
  8846. would be broken with improper escapes.
  8847. This macro is often used with `AS_ECHO'. For an example, observe
  8848. the output generated by the shell code generated from this snippet:
  8849. foo=bar
  8850. AS_ECHO(["AS_ESCAPE(["$foo" = ])AS_ESCAPE(["$foo"], [""])"])
  8851. =>"$foo" = "bar"
  8852. m4_define([macro], [a, [\b]])
  8853. AS_ECHO(["AS_ESCAPE([[macro]])"])
  8854. =>macro
  8855. AS_ECHO(["AS_ESCAPE([macro])"])
  8856. =>a, b
  8857. AS_ECHO(["AS_ESCAPE(m4_dquote(m4_expand([macro])))"])
  8858. =>a, \b
  8859. To escape a string that will be placed within single quotes, use:
  8860. m4_bpatsubst([[STRING]], ['], ['\\''])
  8861. -- Macro: AS_EXECUTABLE_P (FILE)
  8862. Emit code to probe whether FILE is a regular file with executable
  8863. permissions (and not a directory with search permissions). The
  8864. caller is responsible for quoting FILE.
  8865. -- Macro: AS_EXIT ([STATUS = `$?'])
  8866. Emit code to exit the shell with STATUS, defaulting to `$?'. This
  8867. macro works around shells that see the exit status of the command
  8868. prior to `exit' inside a `trap 0' handler (*note Limitations of
  8869. Shell Builtins: trap.).
  8870. -- Macro: AS_IF (TEST1, [RUN-IF-TRUE1], ..., [RUN-IF-FALSE])
  8871. Run shell code TEST1. If TEST1 exits with a zero status then run
  8872. shell code RUN-IF-TRUE1, else examine further tests. If no test
  8873. exits with a zero status, run shell code RUN-IF-FALSE, with
  8874. simplifications if either RUN-IF-TRUE1 or RUN-IF-FALSE is empty.
  8875. For example,
  8876. AS_IF([test "x$foo" = xyes], [HANDLE_FOO([yes])],
  8877. [test "x$foo" != xno], [HANDLE_FOO([maybe])],
  8878. [echo foo not specified])
  8879. ensures any required macros of `HANDLE_FOO' are expanded before
  8880. the first test.
  8881. -- Macro: AS_MKDIR_P (FILE-NAME)
  8882. Make the directory FILE-NAME, including intervening directories as
  8883. necessary. This is equivalent to `mkdir -p -- FILE-NAME', except
  8884. that it is portable to older versions of `mkdir' that lack support
  8885. for the `-p' option or for the `--' delimiter (*note Limitations
  8886. of Usual Tools: mkdir.). Also, `AS_MKDIR_P' succeeds if FILE-NAME
  8887. is a symbolic link to an existing directory, even though Posix is
  8888. unclear whether `mkdir -p' should succeed in that case. If
  8889. creation of FILE-NAME fails, exit the script.
  8890. Also see the `AC_PROG_MKDIR_P' macro (*note Particular Programs::).
  8891. -- Macro: AS_SET_STATUS (STATUS)
  8892. Emit shell code to set the value of `$?' to STATUS, as efficiently
  8893. as possible. However, this is not guaranteed to abort a shell
  8894. running with `set -e' (*note Limitations of Shell Builtins: set.).
  8895. This should also be used at the end of a complex shell function
  8896. instead of `return' (*note Shell Functions::) to avoid a DJGPP
  8897. shell bug.
  8898. -- Macro: AS_TR_CPP (EXPRESSION)
  8899. Transform EXPRESSION into a valid right-hand side for a C
  8900. `#define'. For example:
  8901. # This outputs "#define HAVE_CHAR_P 1".
  8902. # Notice the m4 quoting around #, to prevent an m4 comment
  8903. type="char *"
  8904. echo "[#]define AS_TR_CPP([HAVE_$type]) 1"
  8905. -- Macro: AS_TR_SH (EXPRESSION)
  8906. Transform EXPRESSION into shell code that generates a valid shell
  8907. variable name. The result is literal when possible at m4 time,
  8908. but must be used with `eval' if EXPRESSION causes shell
  8909. indirections. For example:
  8910. # This outputs "Have it!".
  8911. header="sys/some file.h"
  8912. eval AS_TR_SH([HAVE_$header])=yes
  8913. if test "x$HAVE_sys_some_file_h" = xyes; then echo "Have it!"; fi
  8914. -- Macro: AS_SET_CATFILE (VAR, DIR, FILE)
  8915. Set the polymorphic shell variable VAR to DIR/FILE, but optimizing
  8916. the common cases (DIR or FILE is `.', FILE is absolute, etc.).
  8917. -- Macro: AS_UNSET (VAR)
  8918. Unsets the shell variable VAR, working around bugs in older shells
  8919. (*note Limitations of Shell Builtins: unset.). VAR can be a
  8920. literal or indirect variable name.
  8921. -- Macro: AS_VERSION_COMPARE (VERSION-1, VERSION-2, [ACTION-IF-LESS],
  8922. [ACTION-IF-EQUAL], [ACTION-IF-GREATER])
  8923. Compare two strings VERSION-1 and VERSION-2, possibly containing
  8924. shell variables, as version strings, and expand ACTION-IF-LESS,
  8925. ACTION-IF-EQUAL, or ACTION-IF-GREATER depending upon the result.
  8926. The algorithm to compare is similar to the one used by strverscmp
  8927. in glibc (*note String/Array Comparison: (libc)String/Array
  8928. Comparison.).
  8929. 
  8930. File: autoconf.info, Node: Polymorphic Variables, Next: Initialization Macros, Prev: Common Shell Constructs, Up: Programming in M4sh
  8931. 9.2 Support for indirect variable names
  8932. =======================================
  8933. Often, it is convenient to write a macro that will emit shell code
  8934. operating on a shell variable. The simplest case is when the variable
  8935. name is known. But a more powerful idiom is writing shell code that can
  8936. work through an indirection, where another variable or command
  8937. substitution produces the name of the variable to actually manipulate.
  8938. M4sh supports the notion of polymorphic shell variables, making it easy
  8939. to write a macro that can deal with either literal or indirect variable
  8940. names and output shell code appropriate for both use cases. Behavior is
  8941. undefined if expansion of an indirect variable does not result in a
  8942. literal variable name.
  8943. -- Macro: AS_LITERAL_IF (EXPRESSION, [IF-LITERAL], [IF-NOT],
  8944. [IF-SIMPLE-REF = `IF-NOT'])
  8945. -- Macro: AS_LITERAL_WORD_IF (EXPRESSION, [IF-LITERAL], [IF-NOT],
  8946. [IF-SIMPLE-REF = `IF-NOT'])
  8947. If the expansion of EXPRESSION is definitely a shell literal,
  8948. expand IF-LITERAL. If the expansion of EXPRESSION looks like it
  8949. might contain shell indirections (such as `$var' or ``expr`'),
  8950. then IF-NOT is expanded. Sometimes, it is possible to output
  8951. optimized code if EXPRESSION consists only of shell variable
  8952. expansions (such as `${var}'), in which case IF-SIMPLE-REF can be
  8953. provided; but defaulting to IF-NOT should always be safe.
  8954. `AS_LITERAL_WORD_IF' only expands IF-LITERAL if EXPRESSION looks
  8955. like a single shell word, containing no whitespace; while
  8956. `AS_LITERAL_IF' allows whitespace in EXPRESSION.
  8957. In order to reduce the time spent recognizing whether an
  8958. EXPRESSION qualifies as a literal or a simple indirection, the
  8959. implementation is somewhat conservative: EXPRESSION must be a
  8960. single shell word (possibly after stripping whitespace),
  8961. consisting only of bytes that would have the same meaning whether
  8962. unquoted or enclosed in double quotes (for example, `a.b' results
  8963. in IF-LITERAL, even though it is not a valid shell variable name;
  8964. while both `'a'' and `[$]' result in IF-NOT, because they behave
  8965. differently than `"'a'"' and `"[$]"'). This macro can be used in
  8966. contexts for recognizing portable file names (such as in the
  8967. implementation of `AC_LIBSOURCE'), or coupled with some
  8968. transliterations for forming valid variable names (such as in the
  8969. implementation of `AS_TR_SH', which uses an additional
  8970. `m4_translit' to convert `.' to `_').
  8971. This example shows how to read the contents of the shell variable
  8972. `bar', exercising all three arguments to `AS_LITERAL_IF'. It
  8973. results in a script that will output the line `hello' three times.
  8974. AC_DEFUN([MY_ACTION],
  8975. [AS_LITERAL_IF([$1],
  8976. [echo "$$1"],
  8977. [AS_VAR_COPY([var], [$1])
  8978. echo "$var"],
  8979. [eval 'echo "$'"$1"\"])])
  8980. foo=bar bar=hello
  8981. MY_ACTION([bar])
  8982. MY_ACTION([`echo bar`])
  8983. MY_ACTION([$foo])
  8984. -- Macro: AS_VAR_APPEND (VAR, TEXT)
  8985. Emit shell code to append the shell expansion of TEXT to the end
  8986. of the current contents of the polymorphic shell variable VAR,
  8987. taking advantage of shells that provide the `+=' extension for more
  8988. efficient scaling.
  8989. For situations where the final contents of VAR are relatively
  8990. short (less than 256 bytes), it is more efficient to use the
  8991. simpler code sequence of `VAR=${VAR}TEXT' (or its polymorphic
  8992. equivalent of `AS_VAR_COPY([t], [VAR])' and `AS_VAR_SET([VAR],
  8993. ["$t"TEXT])'). But in the case when the script will be repeatedly
  8994. appending text into `var', issues of scaling start to become
  8995. apparent. A naive implementation requires execution time linear
  8996. to the length of the current contents of VAR as well as the length
  8997. of TEXT for a single append, for an overall quadratic scaling with
  8998. multiple appends. This macro takes advantage of shells which
  8999. provide the extension `VAR+=TEXT', which can provide amortized
  9000. constant time for a single append, for an overall linear scaling
  9001. with multiple appends. Note that unlike `AS_VAR_SET', this macro
  9002. requires that TEXT be quoted properly to avoid field splitting and
  9003. file name expansion.
  9004. -- Macro: AS_VAR_ARITH (VAR, EXPRESSION)
  9005. Emit shell code to compute the arithmetic expansion of EXPRESSION,
  9006. assigning the result as the contents of the polymorphic shell
  9007. variable VAR. The code takes advantage of shells that provide
  9008. `$(())' for fewer forks, but uses `expr' as a fallback.
  9009. Therefore, the syntax for a valid EXPRESSION is rather limited:
  9010. all operators must occur as separate shell arguments and with
  9011. proper quoting, there is no portable equality operator, all
  9012. variables containing numeric values must be expanded prior to the
  9013. computation, all numeric values must be provided in decimal
  9014. without leading zeroes, and the first shell argument should not be
  9015. a negative number. In the following example, this snippet will
  9016. print `(2+3)*4 == 20'.
  9017. bar=3
  9018. AS_VAR_ARITH([foo], [\( 2 + $bar \) \* 4])
  9019. echo "(2+$bar)*4 == $foo"
  9020. -- Macro: AS_VAR_COPY (DEST, SOURCE)
  9021. Emit shell code to assign the contents of the polymorphic shell
  9022. variable SOURCE to the polymorphic shell variable DEST. For
  9023. example, executing this M4sh snippet will output `bar hi':
  9024. foo=bar bar=hi
  9025. AS_VAR_COPY([a], [foo])
  9026. AS_VAR_COPY([b], [$foo])
  9027. echo "$a $b"
  9028. When it is necessary to access the contents of an indirect variable
  9029. inside a shell double-quoted context, the recommended idiom is to
  9030. first copy the contents into a temporary literal shell variable.
  9031. for header in stdint_h inttypes_h ; do
  9032. AS_VAR_COPY([var], [ac_cv_header_$header])
  9033. echo "$header detected: $var"
  9034. done
  9035. -- Macro: AS_VAR_IF (VAR, [WORD], [IF-EQUAL], [IF-NOT-EQUAL])
  9036. Output a shell conditional statement. If the contents of the
  9037. polymorphic shell variable VAR match the string WORD, execute
  9038. IF-EQUAL; otherwise execute IF-NOT-EQUAL. WORD must be a single
  9039. shell word (typically a quoted string). Avoids shell bugs if an
  9040. interrupt signal arrives while a command substitution in VAR is
  9041. being expanded.
  9042. -- Macro: AS_VAR_PUSHDEF (M4-NAME, VALUE)
  9043. -- Macro: AS_VAR_POPDEF (M4-NAME)
  9044. A common M4sh idiom involves composing shell variable names from
  9045. an m4 argument (for example, writing a macro that uses a cache
  9046. variable). VALUE can be an arbitrary string, which will be
  9047. transliterated into a valid shell name by `AS_TR_SH'. In order to
  9048. access the composed variable name based on VALUE, it is easier to
  9049. declare a temporary m4 macro M4-NAME with `AS_VAR_PUSHDEF', then
  9050. use that macro as the argument to subsequent `AS_VAR' macros as a
  9051. polymorphic variable name, and finally free the temporary macro
  9052. with `AS_VAR_POPDEF'. These macros are often followed with `dnl',
  9053. to avoid excess newlines in the output.
  9054. Here is an involved example, that shows the power of writing
  9055. macros that can handle composed shell variable names:
  9056. m4_define([MY_CHECK_HEADER],
  9057. [AS_VAR_PUSHDEF([my_Header], [ac_cv_header_$1])dnl
  9058. AS_VAR_IF([my_Header], [yes], [echo "header $1 detected"])dnl
  9059. AS_VAR_POPDEF([my_Header])dnl
  9060. ])
  9061. MY_CHECK_HEADER([stdint.h])
  9062. for header in inttypes.h stdlib.h ; do
  9063. MY_CHECK_HEADER([$header])
  9064. done
  9065. In the above example, `MY_CHECK_HEADER' can operate on polymorphic
  9066. variable names. In the first invocation, the m4 argument is
  9067. `stdint.h', which transliterates into a literal `stdint_h'. As a
  9068. result, the temporary macro `my_Header' expands to the literal
  9069. shell name `ac_cv_header_stdint_h'. In the second invocation, the
  9070. m4 argument to `MY_CHECK_HEADER' is `$header', and the temporary
  9071. macro `my_Header' expands to the indirect shell name
  9072. `$as_my_Header'. During the shell execution of the for loop, when
  9073. `$header' contains `inttypes.h', then `$as_my_Header' contains
  9074. `ac_cv_header_inttypes_h'. If this script is then run on a
  9075. platform where all three headers have been previously detected, the
  9076. output of the script will include:
  9077. header stdint.h detected
  9078. header inttypes.h detected
  9079. header stdlib.h detected
  9080. -- Macro: AS_VAR_SET (VAR, [VALUE])
  9081. Emit shell code to assign the contents of the polymorphic shell
  9082. variable VAR to the shell expansion of VALUE. VALUE is not
  9083. subject to field splitting or file name expansion, so if command
  9084. substitution is used, it may be done with ``""`' rather than using
  9085. an intermediate variable (*note Shell Substitutions::). However,
  9086. VALUE does undergo rescanning for additional macro names; behavior
  9087. is unspecified if late expansion results in any shell
  9088. meta-characters.
  9089. -- Macro: AS_VAR_SET_IF (VAR, [IF-SET], [IF-UNDEF])
  9090. Emit a shell conditional statement, which executes IF-SET if the
  9091. polymorphic shell variable `var' is set to any value, and IF-UNDEF
  9092. otherwise.
  9093. -- Macro: AS_VAR_TEST_SET (VAR)
  9094. Emit a shell statement that results in a successful exit status
  9095. only if the polymorphic shell variable `var' is set.
  9096. 
  9097. File: autoconf.info, Node: Initialization Macros, Next: File Descriptor Macros, Prev: Polymorphic Variables, Up: Programming in M4sh
  9098. 9.3 Initialization Macros
  9099. =========================
  9100. -- Macro: AS_BOURNE_COMPATIBLE
  9101. Set up the shell to be more compatible with the Bourne shell as
  9102. standardized by Posix, if possible. This may involve setting
  9103. environment variables, or setting options, or similar
  9104. implementation-specific actions. This macro is deprecated, since
  9105. `AS_INIT' already invokes it.
  9106. -- Macro: AS_INIT
  9107. Initialize the M4sh environment. This macro calls `m4_init', then
  9108. outputs the `#! /bin/sh' line, a notice about where the output was
  9109. generated from, and code to sanitize the environment for the rest
  9110. of the script. Among other initializations, this sets `SHELL' to
  9111. the shell chosen to run the script (*note CONFIG_SHELL::), and
  9112. `LC_ALL' to ensure the C locale. Finally, it changes the current
  9113. diversion to `BODY'. `AS_INIT' is called automatically by
  9114. `AC_INIT' and `AT_INIT', so shell code in `configure',
  9115. `config.status', and `testsuite' all benefit from a sanitized
  9116. shell environment.
  9117. -- Macro: AS_INIT_GENERATED (FILE, [COMMENT])
  9118. Emit shell code to start the creation of a subsidiary shell script
  9119. in FILE, including changing FILE to be executable. This macro
  9120. populates the child script with information learned from the parent
  9121. (thus, the emitted code is equivalent in effect, but more
  9122. efficient, than the code output by `AS_INIT',
  9123. `AS_BOURNE_COMPATIBLE', and `AS_SHELL_SANITIZE'). If present,
  9124. COMMENT is output near the beginning of the child, prior to the
  9125. shell initialization code, and is subject to parameter expansion,
  9126. command substitution, and backslash quote removal. The parent
  9127. script should check the exit status after this macro, in case FILE
  9128. could not be properly created (for example, if the disk was full).
  9129. If successfully created, the parent script can then proceed to
  9130. append additional M4sh constructs into the child script.
  9131. Note that the child script starts life without a log file open, so
  9132. if the parent script uses logging (*note AS_MESSAGE_LOG_FD::), you
  9133. must temporarily disable any attempts to use the log file until
  9134. after emitting code to open a log within the child. On the other
  9135. hand, if the parent script has `AS_MESSAGE_FD' redirected
  9136. somewhere besides `1', then the child script already has code that
  9137. copies stdout to that descriptor. Currently, the suggested idiom
  9138. for writing a M4sh shell script from within another script is:
  9139. AS_INIT_GENERATED([FILE], [[# My child script.
  9140. ]]) || { AS_ECHO(["Failed to create child script"]); AS_EXIT; }
  9141. m4_pushdef([AS_MESSAGE_LOG_FD])dnl
  9142. cat >> "FILE" <<\__EOF__
  9143. # Code to initialize AS_MESSAGE_LOG_FD
  9144. m4_popdef([AS_MESSAGE_LOG_FD])dnl
  9145. # Additional code
  9146. __EOF__
  9147. This, however, may change in the future as the M4sh interface is
  9148. stabilized further.
  9149. Also, be aware that use of `LINENO' within the child script may
  9150. report line numbers relative to their location in the parent
  9151. script, even when using `AS_LINENO_PREPARE', if the parent script
  9152. was unable to locate a shell with working `LINENO' support.
  9153. -- Macro: AS_LINENO_PREPARE
  9154. Find a shell that supports the special variable `LINENO', which
  9155. contains the number of the currently executing line. This macro is
  9156. automatically invoked by `AC_INIT' in configure scripts.
  9157. -- Macro: AS_ME_PREPARE
  9158. Set up variable `as_me' to be the basename of the currently
  9159. executing script. This macro is automatically invoked by
  9160. `AC_INIT' in configure scripts.
  9161. -- Macro: AS_TMPDIR (PREFIX, [DIR = `${TMPDIR:=/tmp}'])
  9162. Create, as safely as possible, a temporary sub-directory within
  9163. DIR with a name starting with PREFIX. PREFIX should be 2-4
  9164. characters, to make it slightly easier to identify the owner of
  9165. the directory. If DIR is omitted, then the value of `TMPDIR' will
  9166. be used (defaulting to `/tmp'). On success, the name of the newly
  9167. created directory is stored in the shell variable `tmp'. On
  9168. error, the script is aborted.
  9169. Typically, this macro is coupled with some exit traps to delete
  9170. the created directory and its contents on exit or interrupt.
  9171. However, there is a slight window between when the directory is
  9172. created and when the name is actually known to the shell, so an
  9173. interrupt at the right moment might leave the temporary directory
  9174. behind. Hence it is important to use a PREFIX that makes it
  9175. easier to determine if a leftover temporary directory from an
  9176. interrupted script is safe to delete.
  9177. The use of the output variable `$tmp' rather than something in the
  9178. `as_' namespace is historical; it has the unfortunate consequence
  9179. that reusing this otherwise common name for any other purpose
  9180. inside your script has the potential to break any cleanup traps
  9181. designed to remove the temporary directory.
  9182. -- Macro: AS_SHELL_SANITIZE
  9183. Initialize the shell suitably for `configure' scripts. This has
  9184. the effect of `AS_BOURNE_COMPATIBLE', and sets some other
  9185. environment variables for predictable results from configuration
  9186. tests. For example, it sets `LC_ALL' to change to the default C
  9187. locale. *Note Special Shell Variables::. This macro is
  9188. deprecated, since `AS_INIT' already invokes it.
  9189. 
  9190. File: autoconf.info, Node: File Descriptor Macros, Prev: Initialization Macros, Up: Programming in M4sh
  9191. 9.4 File Descriptor Macros
  9192. ==========================
  9193. The following macros define file descriptors used to output messages
  9194. (or input values) from `configure' scripts. For example:
  9195. echo "$wombats found" >&AS_MESSAGE_LOG_FD
  9196. echo 'Enter desired kangaroo count:' >&AS_MESSAGE_FD
  9197. read kangaroos <&AS_ORIGINAL_STDIN_FD`
  9198. However doing so is seldom needed, because Autoconf provides higher
  9199. level macros as described below.
  9200. -- Macro: AS_MESSAGE_FD
  9201. The file descriptor for `checking for...' messages and results.
  9202. By default, `AS_INIT' sets this to `1' for standalone M4sh
  9203. clients. However, `AC_INIT' shuffles things around to another file
  9204. descriptor, in order to allow the `-q' option of `configure' to
  9205. choose whether messages should go to the script's standard output
  9206. or be discarded.
  9207. If you want to display some messages, consider using one of the
  9208. printing macros (*note Printing Messages::) instead. Copies of
  9209. messages output via these macros are also recorded in `config.log'.
  9210. -- Macro: AS_MESSAGE_LOG_FD
  9211. This must either be empty, or expand to a file descriptor for log
  9212. messages. By default, `AS_INIT' sets this macro to the empty
  9213. string for standalone M4sh clients, thus disabling logging.
  9214. However, `AC_INIT' shuffles things around so that both `configure'
  9215. and `config.status' use `config.log' for log messages. Macros
  9216. that run tools, like `AC_COMPILE_IFELSE' (*note Running the
  9217. Compiler::), redirect all output to this descriptor. You may want
  9218. to do so if you develop such a low-level macro.
  9219. -- Macro: AS_ORIGINAL_STDIN_FD
  9220. This must expand to a file descriptor for the original standard
  9221. input. By default, `AS_INIT' sets this macro to `0' for standalone
  9222. M4sh clients. However, `AC_INIT' shuffles things around for
  9223. safety.
  9224. When `configure' runs, it may accidentally execute an interactive
  9225. command that has the same name as the non-interactive meant to be
  9226. used or checked. If the standard input was the terminal, such
  9227. interactive programs would cause `configure' to stop, pending some
  9228. user input. Therefore `configure' redirects its standard input
  9229. from `/dev/null' during its initialization. This is not normally
  9230. a problem, since `configure' normally does not need user input.
  9231. In the extreme case where your `configure' script really needs to
  9232. obtain some values from the original standard input, you can read
  9233. them explicitly from `AS_ORIGINAL_STDIN_FD'.
  9234. 
  9235. File: autoconf.info, Node: Writing Autoconf Macros, Next: Portable Shell, Prev: Programming in M4sh, Up: Top
  9236. 10 Writing Autoconf Macros
  9237. **************************
  9238. When you write a feature test that could be applicable to more than one
  9239. software package, the best thing to do is encapsulate it in a new macro.
  9240. Here are some instructions and guidelines for writing Autoconf macros.
  9241. * Menu:
  9242. * Macro Definitions:: Basic format of an Autoconf macro
  9243. * Macro Names:: What to call your new macros
  9244. * Reporting Messages:: Notifying `autoconf' users
  9245. * Dependencies Between Macros:: What to do when macros depend on other macros
  9246. * Obsoleting Macros:: Warning about old ways of doing things
  9247. * Coding Style:: Writing Autoconf macros a` la Autoconf
  9248. 
  9249. File: autoconf.info, Node: Macro Definitions, Next: Macro Names, Up: Writing Autoconf Macros
  9250. 10.1 Macro Definitions
  9251. ======================
  9252. -- Macro: AC_DEFUN (NAME, [BODY])
  9253. Autoconf macros are defined using the `AC_DEFUN' macro, which is
  9254. similar to the M4 builtin `m4_define' macro; this creates a macro
  9255. named NAME and with BODY as its expansion. In addition to
  9256. defining a macro, `AC_DEFUN' adds to it some code that is used to
  9257. constrain the order in which macros are called, while avoiding
  9258. redundant output (*note Prerequisite Macros::).
  9259. An Autoconf macro definition looks like this:
  9260. AC_DEFUN(MACRO-NAME, MACRO-BODY)
  9261. You can refer to any arguments passed to the macro as `$1', `$2',
  9262. etc. *Note How to define new macros: (m4.info)Definitions, for more
  9263. complete information on writing M4 macros.
  9264. Most macros fall in one of two general categories. The first
  9265. category includes macros which take arguments, in order to generate
  9266. output parameterized by those arguments. Macros in this category are
  9267. designed to be directly expanded, often multiple times, and should not
  9268. be used as the argument to `AC_REQUIRE'. The other category includes
  9269. macros which are shorthand for a fixed block of text, and therefore do
  9270. not take arguments. For this category of macros, directly expanding
  9271. the macro multiple times results in redundant output, so it is more
  9272. common to use the macro as the argument to `AC_REQUIRE', or to declare
  9273. the macro with `AC_DEFUN_ONCE' (*note One-Shot Macros::).
  9274. Be sure to properly quote both the MACRO-BODY _and_ the MACRO-NAME
  9275. to avoid any problems if the macro happens to have been previously
  9276. defined.
  9277. Each macro should have a header comment that gives its prototype,
  9278. and a brief description. When arguments have default values, display
  9279. them in the prototype. For example:
  9280. # AC_MSG_ERROR(ERROR, [EXIT-STATUS = 1])
  9281. # --------------------------------------
  9282. m4_define([AC_MSG_ERROR],
  9283. [{ AS_MESSAGE([error: $1], [2])
  9284. exit m4_default([$2], [1]); }])
  9285. Comments about the macro should be left in the header comment. Most
  9286. other comments make their way into `configure', so just keep using `#'
  9287. to introduce comments.
  9288. If you have some special comments about pure M4 code, comments that
  9289. make no sense in `configure' and in the header comment, then use the
  9290. builtin `dnl': it causes M4 to discard the text through the next
  9291. newline.
  9292. Keep in mind that `dnl' is rarely needed to introduce comments;
  9293. `dnl' is more useful to get rid of the newlines following macros that
  9294. produce no output, such as `AC_REQUIRE'.
  9295. Public third-party macros need to use `AC_DEFUN', and not
  9296. `m4_define', in order to be found by `aclocal' (*note Extending
  9297. aclocal: (automake)Extending aclocal.). Additionally, if it is ever
  9298. determined that a macro should be made obsolete, it is easy to convert
  9299. from `AC_DEFUN' to `AU_DEFUN' in order to have `autoupdate' assist the
  9300. user in choosing a better alternative, but there is no corresponding
  9301. way to make `m4_define' issue an upgrade notice (*note AU_DEFUN::).
  9302. There is another subtle, but important, difference between using
  9303. `m4_define' and `AC_DEFUN': only the former is unaffected by
  9304. `AC_REQUIRE'. When writing a file, it is always safe to replace a
  9305. block of text with a `m4_define' macro that will expand to the same
  9306. text. But replacing a block of text with an `AC_DEFUN' macro with the
  9307. same content does not necessarily give the same results, because it
  9308. changes the location where any embedded but unsatisfied `AC_REQUIRE'
  9309. invocations within the block will be expanded. For an example of this,
  9310. see *note Expanded Before Required::.
  9311. 
  9312. File: autoconf.info, Node: Macro Names, Next: Reporting Messages, Prev: Macro Definitions, Up: Writing Autoconf Macros
  9313. 10.2 Macro Names
  9314. ================
  9315. All of the public Autoconf macros have all-uppercase names in the
  9316. namespace `^AC_' to prevent them from accidentally conflicting with
  9317. other text; Autoconf also reserves the namespace `^_AC_' for internal
  9318. macros. All shell variables that they use for internal purposes have
  9319. mostly-lowercase names starting with `ac_'. Autoconf also uses
  9320. here-document delimiters in the namespace `^_AC[A-Z]'. During
  9321. `configure', files produced by Autoconf make heavy use of the file
  9322. system namespace `^conf'.
  9323. Since Autoconf is built on top of M4sugar (*note Programming in
  9324. M4sugar::) and M4sh (*note Programming in M4sh::), you must also be
  9325. aware of those namespaces (`^_?\(m4\|AS\)_'). And since `configure.ac'
  9326. is also designed to be scanned by Autoheader, Autoscan, Autoupdate, and
  9327. Automake, you should be aware of the `^_?A[HNUM]_' namespaces. In
  9328. general, you _should not use_ the namespace of a package that does not
  9329. own the macro or shell code you are writing.
  9330. To ensure that your macros don't conflict with present or future
  9331. Autoconf macros, you should prefix your own macro names and any shell
  9332. variables they use with some other sequence. Possibilities include your
  9333. initials, or an abbreviation for the name of your organization or
  9334. software package. Historically, people have not always followed the
  9335. rule of using a namespace appropriate for their package, and this has
  9336. made it difficult for determining the origin of a macro (and where to
  9337. report bugs about that macro), as well as difficult for the true
  9338. namespace owner to add new macros without interference from pre-existing
  9339. uses of third-party macros. Perhaps the best example of this confusion
  9340. is the `AM_GNU_GETTEXT' macro, which belongs, not to Automake, but to
  9341. Gettext.
  9342. Most of the Autoconf macros' names follow a structured naming
  9343. convention that indicates the kind of feature check by the name. The
  9344. macro names consist of several words, separated by underscores, going
  9345. from most general to most specific. The names of their cache variables
  9346. use the same convention (*note Cache Variable Names::, for more
  9347. information on them).
  9348. The first word of the name after the namespace initials (such as
  9349. `AC_') usually tells the category of the feature being tested. Here
  9350. are the categories used in Autoconf for specific test macros, the kind
  9351. of macro that you are more likely to write. They are also used for
  9352. cache variables, in all-lowercase. Use them where applicable; where
  9353. they're not, invent your own categories.
  9354. `C'
  9355. C language builtin features.
  9356. `DECL'
  9357. Declarations of C variables in header files.
  9358. `FUNC'
  9359. Functions in libraries.
  9360. `GROUP'
  9361. Posix group owners of files.
  9362. `HEADER'
  9363. Header files.
  9364. `LIB'
  9365. C libraries.
  9366. `PROG'
  9367. The base names of programs.
  9368. `MEMBER'
  9369. Members of aggregates.
  9370. `SYS'
  9371. Operating system features.
  9372. `TYPE'
  9373. C builtin or declared types.
  9374. `VAR'
  9375. C variables in libraries.
  9376. After the category comes the name of the particular feature being
  9377. tested. Any further words in the macro name indicate particular aspects
  9378. of the feature. For example, `AC_PROG_CC_STDC' checks whether the C
  9379. compiler supports ISO Standard C.
  9380. An internal macro should have a name that starts with an underscore;
  9381. Autoconf internals should therefore start with `_AC_'. Additionally, a
  9382. macro that is an internal subroutine of another macro should have a
  9383. name that starts with an underscore and the name of that other macro,
  9384. followed by one or more words saying what the internal macro does. For
  9385. example, `AC_PATH_X' has internal macros `_AC_PATH_X_XMKMF' and
  9386. `_AC_PATH_X_DIRECT'.
  9387. 
  9388. File: autoconf.info, Node: Reporting Messages, Next: Dependencies Between Macros, Prev: Macro Names, Up: Writing Autoconf Macros
  9389. 10.3 Reporting Messages
  9390. =======================
  9391. When macros statically diagnose abnormal situations, benign or fatal, it
  9392. is possible to make `autoconf' detect the problem, and refuse to create
  9393. `configure' in the case of an error. The macros in this section are
  9394. considered obsolescent, and new code should use M4sugar macros for this
  9395. purpose, see *note Diagnostic Macros::.
  9396. On the other hand, it is possible to want to detect errors when
  9397. `configure' is run, which are dependent on the environment of the user
  9398. rather than the maintainer. For dynamic diagnostics, see *note
  9399. Printing Messages::.
  9400. -- Macro: AC_DIAGNOSE (CATEGORY, MESSAGE)
  9401. Report MESSAGE as a warning (or as an error if requested by the
  9402. user) if warnings of the CATEGORY are turned on. This macro is
  9403. obsolescent; you are encouraged to use:
  9404. m4_warn([CATEGORY], [MESSAGE])
  9405. instead. *Note m4_warn::, for more details, including valid
  9406. CATEGORY names.
  9407. -- Macro: AC_WARNING (MESSAGE)
  9408. Report MESSAGE as a syntax warning. This macro is obsolescent;
  9409. you are encouraged to use:
  9410. m4_warn([syntax], [MESSAGE])
  9411. instead. *Note m4_warn::, for more details, as well as better
  9412. finer-grained categories of warnings (not all problems have to do
  9413. with syntax).
  9414. -- Macro: AC_FATAL (MESSAGE)
  9415. Report a severe error MESSAGE, and have `autoconf' die. This
  9416. macro is obsolescent; you are encouraged to use:
  9417. m4_fatal([MESSAGE])
  9418. instead. *Note m4_fatal::, for more details.
  9419. When the user runs `autoconf -W error', warnings from `m4_warn'
  9420. (including those issued through `AC_DIAGNOSE' and `AC_WARNING') are
  9421. reported as errors, see *note autoconf Invocation::.
  9422. 
  9423. File: autoconf.info, Node: Dependencies Between Macros, Next: Obsoleting Macros, Prev: Reporting Messages, Up: Writing Autoconf Macros
  9424. 10.4 Dependencies Between Macros
  9425. ================================
  9426. Some Autoconf macros depend on other macros having been called first in
  9427. order to work correctly. Autoconf provides a way to ensure that certain
  9428. macros are called if needed and a way to warn the user if macros are
  9429. called in an order that might cause incorrect operation.
  9430. * Menu:
  9431. * Prerequisite Macros:: Ensuring required information
  9432. * Suggested Ordering:: Warning about possible ordering problems
  9433. * One-Shot Macros:: Ensuring a macro is called only once
  9434. 
  9435. File: autoconf.info, Node: Prerequisite Macros, Next: Suggested Ordering, Up: Dependencies Between Macros
  9436. 10.4.1 Prerequisite Macros
  9437. --------------------------
  9438. A macro that you write might need to use values that have previously
  9439. been computed by other macros. For example, `AC_DECL_YYTEXT' examines
  9440. the output of `flex' or `lex', so it depends on `AC_PROG_LEX' having
  9441. been called first to set the shell variable `LEX'.
  9442. Rather than forcing the user of the macros to keep track of the
  9443. dependencies between them, you can use the `AC_REQUIRE' macro to do it
  9444. automatically. `AC_REQUIRE' can ensure that a macro is only called if
  9445. it is needed, and only called once.
  9446. -- Macro: AC_REQUIRE (MACRO-NAME)
  9447. If the M4 macro MACRO-NAME has not already been called, call it
  9448. (without any arguments). Make sure to quote MACRO-NAME with
  9449. square brackets. MACRO-NAME must have been defined using
  9450. `AC_DEFUN' or else contain a call to `AC_PROVIDE' to indicate that
  9451. it has been called.
  9452. `AC_REQUIRE' must be used inside a macro defined by `AC_DEFUN'; it
  9453. must not be called from the top level. Also, it does not make
  9454. sense to require a macro that takes parameters.
  9455. `AC_REQUIRE' is often misunderstood. It really implements
  9456. dependencies between macros in the sense that if one macro depends upon
  9457. another, the latter is expanded _before_ the body of the former. To be
  9458. more precise, the required macro is expanded before the outermost
  9459. defined macro in the current expansion stack. In particular,
  9460. `AC_REQUIRE([FOO])' is not replaced with the body of `FOO'. For
  9461. instance, this definition of macros:
  9462. AC_DEFUN([TRAVOLTA],
  9463. [test "$body_temperature_in_celsius" -gt "38" &&
  9464. dance_floor=occupied])
  9465. AC_DEFUN([NEWTON_JOHN],
  9466. [test "x$hair_style" = xcurly &&
  9467. dance_floor=occupied])
  9468. AC_DEFUN([RESERVE_DANCE_FLOOR],
  9469. [if date | grep '^Sat.*pm' >/dev/null 2>&1; then
  9470. AC_REQUIRE([TRAVOLTA])
  9471. AC_REQUIRE([NEWTON_JOHN])
  9472. fi])
  9473. with this `configure.ac'
  9474. AC_INIT([Dance Manager], [1.0], [bug-dance@example.org])
  9475. RESERVE_DANCE_FLOOR
  9476. if test "x$dance_floor" = xoccupied; then
  9477. AC_MSG_ERROR([cannot pick up here, let's move])
  9478. fi
  9479. does not leave you with a better chance to meet a kindred soul at other
  9480. times than Saturday night since it expands into:
  9481. test "$body_temperature_in_Celsius" -gt "38" &&
  9482. dance_floor=occupied
  9483. test "x$hair_style" = xcurly &&
  9484. dance_floor=occupied
  9485. fi
  9486. if date | grep '^Sat.*pm' >/dev/null 2>&1; then
  9487. fi
  9488. This behavior was chosen on purpose: (i) it prevents messages in
  9489. required macros from interrupting the messages in the requiring macros;
  9490. (ii) it avoids bad surprises when shell conditionals are used, as in:
  9491. if ...; then
  9492. AC_REQUIRE([SOME_CHECK])
  9493. fi
  9494. ...
  9495. SOME_CHECK
  9496. However, this implementation can lead to another class of problems.
  9497. Consider the case where an outer macro first expands, then indirectly
  9498. requires, an inner macro:
  9499. AC_DEFUN([TESTA], [[echo in A
  9500. if test -n "$SEEN_A" ; then echo duplicate ; fi
  9501. SEEN_A=:]])
  9502. AC_DEFUN([TESTB], [AC_REQUIRE([TESTA])[echo in B
  9503. if test -z "$SEEN_A" ; then echo bug ; fi]])
  9504. AC_DEFUN([TESTC], [AC_REQUIRE([TESTB])[echo in C]])
  9505. AC_DEFUN([OUTER], [[echo in OUTER]
  9506. TESTA
  9507. TESTC])
  9508. OUTER
  9509. Prior to Autoconf 2.64, the implementation of `AC_REQUIRE' recognized
  9510. that `TESTB' needed to be hoisted prior to the expansion of `OUTER',
  9511. but because `TESTA' had already been directly expanded, it failed to
  9512. hoist `TESTA'. Therefore, the expansion of `TESTB' occurs prior to its
  9513. prerequisites, leading to the following output:
  9514. in B
  9515. bug
  9516. in OUTER
  9517. in A
  9518. in C
  9519. Newer Autoconf is smart enough to recognize this situation, and hoists
  9520. `TESTA' even though it has already been expanded, but issues a syntax
  9521. warning in the process. This is because the hoisted expansion of
  9522. `TESTA' defeats the purpose of using `AC_REQUIRE' to avoid redundant
  9523. code, and causes its own set of problems if the hoisted macro is not
  9524. idempotent:
  9525. in A
  9526. in B
  9527. in OUTER
  9528. in A
  9529. duplicate
  9530. in C
  9531. The bug is not in Autoconf, but in the macro definitions. If you
  9532. ever pass a particular macro name to `AC_REQUIRE', then you are implying
  9533. that the macro only needs to be expanded once. But to enforce this,
  9534. either the macro must be declared with `AC_DEFUN_ONCE' (although this
  9535. only helps in Autoconf 2.64 or newer), or all uses of that macro should
  9536. be through `AC_REQUIRE'; directly expanding the macro defeats the point
  9537. of using `AC_REQUIRE' to eliminate redundant expansion. In the
  9538. example, this rule of thumb was violated because `TESTB' requires
  9539. `TESTA' while `OUTER' directly expands it. One way of fixing the bug
  9540. is to factor `TESTA' into two macros, the portion designed for direct
  9541. and repeated use (here, named `TESTA'), and the portion designed for
  9542. one-shot output and used only inside `AC_REQUIRE' (here, named
  9543. `TESTA_PREREQ'). Then, by fixing all clients to use the correct
  9544. calling convention according to their needs:
  9545. AC_DEFUN([TESTA], [AC_REQUIRE([TESTA_PREREQ])[echo in A]])
  9546. AC_DEFUN([TESTA_PREREQ], [[echo in A_PREREQ
  9547. if test -n "$SEEN_A" ; then echo duplicate ; fi
  9548. SEEN_A=:]])
  9549. AC_DEFUN([TESTB], [AC_REQUIRE([TESTA_PREREQ])[echo in B
  9550. if test -z "$SEEN_A" ; then echo bug ; fi]])
  9551. AC_DEFUN([TESTC], [AC_REQUIRE([TESTB])[echo in C]])
  9552. AC_DEFUN([OUTER], [[echo in OUTER]
  9553. TESTA
  9554. TESTC])
  9555. OUTER
  9556. the resulting output will then obey all dependency rules and avoid any
  9557. syntax warnings, whether the script is built with old or new Autoconf
  9558. versions:
  9559. in A_PREREQ
  9560. in B
  9561. in OUTER
  9562. in A
  9563. in C
  9564. The helper macros `AS_IF' and `AS_CASE' may be used to enforce
  9565. expansion of required macros outside of shell conditional constructs.
  9566. You are furthermore encouraged, although not required, to put all
  9567. `AC_REQUIRE' calls at the beginning of a macro. You can use `dnl' to
  9568. avoid the empty lines they leave.
  9569. 
  9570. File: autoconf.info, Node: Suggested Ordering, Next: One-Shot Macros, Prev: Prerequisite Macros, Up: Dependencies Between Macros
  9571. 10.4.2 Suggested Ordering
  9572. -------------------------
  9573. Some macros should be run before another macro if both are called, but
  9574. neither _requires_ that the other be called. For example, a macro that
  9575. changes the behavior of the C compiler should be called before any
  9576. macros that run the C compiler. Many of these dependencies are noted in
  9577. the documentation.
  9578. Autoconf provides the `AC_BEFORE' macro to warn users when macros
  9579. with this kind of dependency appear out of order in a `configure.ac'
  9580. file. The warning occurs when creating `configure' from
  9581. `configure.ac', not when running `configure'.
  9582. For example, `AC_PROG_CPP' checks whether the C compiler can run the
  9583. C preprocessor when given the `-E' option. It should therefore be
  9584. called after any macros that change which C compiler is being used,
  9585. such as `AC_PROG_CC'. So `AC_PROG_CC' contains:
  9586. AC_BEFORE([$0], [AC_PROG_CPP])dnl
  9587. This warns the user if a call to `AC_PROG_CPP' has already occurred
  9588. when `AC_PROG_CC' is called.
  9589. -- Macro: AC_BEFORE (THIS-MACRO-NAME, CALLED-MACRO-NAME)
  9590. Make M4 print a warning message to the standard error output if
  9591. CALLED-MACRO-NAME has already been called. THIS-MACRO-NAME should
  9592. be the name of the macro that is calling `AC_BEFORE'. The macro
  9593. CALLED-MACRO-NAME must have been defined using `AC_DEFUN' or else
  9594. contain a call to `AC_PROVIDE' to indicate that it has been called.
  9595. 
  9596. File: autoconf.info, Node: One-Shot Macros, Prev: Suggested Ordering, Up: Dependencies Between Macros
  9597. 10.4.3 One-Shot Macros
  9598. ----------------------
  9599. Some macros should be called only once, either because calling them
  9600. multiple time is unsafe, or because it is bad style. For instance
  9601. Autoconf ensures that `AC_CANONICAL_BUILD' and cousins (*note
  9602. Canonicalizing::) are evaluated only once, because it makes no sense to
  9603. run these expensive checks more than once. Such one-shot macros can be
  9604. defined using `AC_DEFUN_ONCE'.
  9605. -- Macro: AC_DEFUN_ONCE (MACRO-NAME, MACRO-BODY)
  9606. Declare macro MACRO-NAME like `AC_DEFUN' would (*note Macro
  9607. Definitions::), but add additional logic that guarantees that only
  9608. the first use of the macro (whether by direct expansion or
  9609. `AC_REQUIRE') causes an expansion of MACRO-BODY; the expansion
  9610. will occur before the start of any enclosing macro defined by
  9611. `AC_DEFUN'. Subsequent expansions are silently ignored.
  9612. Generally, it does not make sense for MACRO-BODY to use parameters
  9613. such as `$1'.
  9614. Prior to Autoconf 2.64, a macro defined by `AC_DEFUN_ONCE' would
  9615. emit a warning if it was directly expanded a second time, so for
  9616. portability, it is better to use `AC_REQUIRE' than direct invocation of
  9617. MACRO-NAME inside a macro defined by `AC_DEFUN' (*note Prerequisite
  9618. Macros::).
  9619. 
  9620. File: autoconf.info, Node: Obsoleting Macros, Next: Coding Style, Prev: Dependencies Between Macros, Up: Writing Autoconf Macros
  9621. 10.5 Obsoleting Macros
  9622. ======================
  9623. Configuration and portability technology has evolved over the years.
  9624. Often better ways of solving a particular problem are developed, or
  9625. ad-hoc approaches are systematized. This process has occurred in many
  9626. parts of Autoconf. One result is that some of the macros are now
  9627. considered "obsolete"; they still work, but are no longer considered
  9628. the best thing to do, hence they should be replaced with more modern
  9629. macros. Ideally, `autoupdate' should replace the old macro calls with
  9630. their modern implementation.
  9631. Autoconf provides a simple means to obsolete a macro.
  9632. -- Macro: AU_DEFUN (OLD-MACRO, IMPLEMENTATION, [MESSAGE])
  9633. Define OLD-MACRO as IMPLEMENTATION. The only difference with
  9634. `AC_DEFUN' is that the user is warned that OLD-MACRO is now
  9635. obsolete.
  9636. If she then uses `autoupdate', the call to OLD-MACRO is replaced
  9637. by the modern IMPLEMENTATION. MESSAGE should include information
  9638. on what to do after running `autoupdate'; `autoupdate' prints it
  9639. as a warning, and includes it in the updated `configure.ac' file.
  9640. The details of this macro are hairy: if `autoconf' encounters an
  9641. `AU_DEFUN'ed macro, all macros inside its second argument are
  9642. expanded as usual. However, when `autoupdate' is run, only M4 and
  9643. M4sugar macros are expanded here, while all other macros are
  9644. disabled and appear literally in the updated `configure.ac'.
  9645. -- Macro: AU_ALIAS (OLD-NAME, NEW-NAME)
  9646. Used if the OLD-NAME is to be replaced by a call to NEW-MACRO with
  9647. the same parameters. This happens for example if the macro was
  9648. renamed.
  9649. 
  9650. File: autoconf.info, Node: Coding Style, Prev: Obsoleting Macros, Up: Writing Autoconf Macros
  9651. 10.6 Coding Style
  9652. =================
  9653. The Autoconf macros follow a strict coding style. You are encouraged to
  9654. follow this style, especially if you intend to distribute your macro,
  9655. either by contributing it to Autoconf itself or the Autoconf Macro
  9656. Archive (http://www.gnu.org/software/autoconf-archive/), or by other
  9657. means.
  9658. The first requirement is to pay great attention to the quotation.
  9659. For more details, see *note Autoconf Language::, and *note M4
  9660. Quotation::.
  9661. Do not try to invent new interfaces. It is likely that there is a
  9662. macro in Autoconf that resembles the macro you are defining: try to
  9663. stick to this existing interface (order of arguments, default values,
  9664. etc.). We _are_ conscious that some of these interfaces are not
  9665. perfect; nevertheless, when harmless, homogeneity should be preferred
  9666. over creativity.
  9667. Be careful about clashes both between M4 symbols and between shell
  9668. variables.
  9669. If you stick to the suggested M4 naming scheme (*note Macro Names::),
  9670. you are unlikely to generate conflicts. Nevertheless, when you need to
  9671. set a special value, _avoid using a regular macro name_; rather, use an
  9672. "impossible" name. For instance, up to version 2.13, the macro
  9673. `AC_SUBST' used to remember what SYMBOL macros were already defined by
  9674. setting `AC_SUBST_SYMBOL', which is a regular macro name. But since
  9675. there is a macro named `AC_SUBST_FILE', it was just impossible to
  9676. `AC_SUBST(FILE)'! In this case, `AC_SUBST(SYMBOL)' or
  9677. `_AC_SUBST(SYMBOL)' should have been used (yes, with the parentheses).
  9678. No Autoconf macro should ever enter the user-variable name space;
  9679. i.e., except for the variables that are the actual result of running the
  9680. macro, all shell variables should start with `ac_'. In addition, small
  9681. macros or any macro that is likely to be embedded in other macros
  9682. should be careful not to use obvious names.
  9683. Do not use `dnl' to introduce comments: most of the comments you are
  9684. likely to write are either header comments which are not output anyway,
  9685. or comments that should make their way into `configure'. There are
  9686. exceptional cases where you do want to comment special M4 constructs,
  9687. in which case `dnl' is right, but keep in mind that it is unlikely.
  9688. M4 ignores the leading blanks and newlines before each argument.
  9689. Use this feature to indent in such a way that arguments are (more or
  9690. less) aligned with the opening parenthesis of the macro being called.
  9691. For instance, instead of
  9692. AC_CACHE_CHECK(for EMX OS/2 environment,
  9693. ac_cv_emxos2,
  9694. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [return __EMX__;])],
  9695. [ac_cv_emxos2=yes], [ac_cv_emxos2=no])])
  9696. write
  9697. AC_CACHE_CHECK([for EMX OS/2 environment], [ac_cv_emxos2],
  9698. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return __EMX__;])],
  9699. [ac_cv_emxos2=yes],
  9700. [ac_cv_emxos2=no])])
  9701. or even
  9702. AC_CACHE_CHECK([for EMX OS/2 environment],
  9703. [ac_cv_emxos2],
  9704. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
  9705. [return __EMX__;])],
  9706. [ac_cv_emxos2=yes],
  9707. [ac_cv_emxos2=no])])
  9708. When using `AC_RUN_IFELSE' or any macro that cannot work when
  9709. cross-compiling, provide a pessimistic value (typically `no').
  9710. Feel free to use various tricks to prevent auxiliary tools, such as
  9711. syntax-highlighting editors, from behaving improperly. For instance,
  9712. instead of:
  9713. m4_bpatsubst([$1], [$"])
  9714. use
  9715. m4_bpatsubst([$1], [$""])
  9716. so that Emacsen do not open an endless "string" at the first quote.
  9717. For the same reasons, avoid:
  9718. test $[#] != 0
  9719. and use:
  9720. test $[@%:@] != 0
  9721. Otherwise, the closing bracket would be hidden inside a `#'-comment,
  9722. breaking the bracket-matching highlighting from Emacsen. Note the
  9723. preferred style to escape from M4: `$[1]', `$[@]', etc. Do not escape
  9724. when it is unnecessary. Common examples of useless quotation are
  9725. `[$]$1' (write `$$1'), `[$]var' (use `$var'), etc. If you add
  9726. portability issues to the picture, you'll prefer `${1+"$[@]"}' to
  9727. `"[$]@"', and you'll prefer do something better than hacking Autoconf
  9728. `:-)'.
  9729. When using `sed', don't use `-e' except for indenting purposes.
  9730. With the `s' and `y' commands, the preferred separator is `/' unless
  9731. `/' itself might appear in the pattern or replacement, in which case
  9732. you should use `|', or optionally `,' if you know the pattern and
  9733. replacement cannot contain a file name. If none of these characters
  9734. will do, choose a printable character that cannot appear in the pattern
  9735. or replacement. Characters from the set `"#$&'()*;<=>?`|~' are good
  9736. choices if the pattern or replacement might contain a file name, since
  9737. they have special meaning to the shell and are less likely to occur in
  9738. file names.
  9739. *Note Macro Definitions::, for details on how to define a macro. If
  9740. a macro doesn't use `AC_REQUIRE', is expected to never be the object of
  9741. an `AC_REQUIRE' directive, and macros required by other macros inside
  9742. arguments do not need to be expanded before this macro, then use
  9743. `m4_define'. In case of doubt, use `AC_DEFUN'. Also take into account
  9744. that public third-party macros need to use `AC_DEFUN' in order to be
  9745. found by `aclocal' (*note Extending aclocal: (automake)Extending
  9746. aclocal.). All the `AC_REQUIRE' statements should be at the beginning
  9747. of the macro, and each statement should be followed by `dnl'.
  9748. You should not rely on the number of arguments: instead of checking
  9749. whether an argument is missing, test that it is not empty. It provides
  9750. both a simpler and a more predictable interface to the user, and saves
  9751. room for further arguments.
  9752. Unless the macro is short, try to leave the closing `])' at the
  9753. beginning of a line, followed by a comment that repeats the name of the
  9754. macro being defined. This introduces an additional newline in
  9755. `configure'; normally, that is not a problem, but if you want to remove
  9756. it you can use `[]dnl' on the last line. You can similarly use `[]dnl'
  9757. after a macro call to remove its newline. `[]dnl' is recommended
  9758. instead of `dnl' to ensure that M4 does not interpret the `dnl' as
  9759. being attached to the preceding text or macro output. For example,
  9760. instead of:
  9761. AC_DEFUN([AC_PATH_X],
  9762. [AC_MSG_CHECKING([for X])
  9763. AC_REQUIRE_CPP()
  9764. # ...omitted...
  9765. AC_MSG_RESULT([libraries $x_libraries, headers $x_includes])
  9766. fi])
  9767. you would write:
  9768. AC_DEFUN([AC_PATH_X],
  9769. [AC_REQUIRE_CPP()[]dnl
  9770. AC_MSG_CHECKING([for X])
  9771. # ...omitted...
  9772. AC_MSG_RESULT([libraries $x_libraries, headers $x_includes])
  9773. fi[]dnl
  9774. ])# AC_PATH_X
  9775. If the macro is long, try to split it into logical chunks.
  9776. Typically, macros that check for a bug in a function and prepare its
  9777. `AC_LIBOBJ' replacement should have an auxiliary macro to perform this
  9778. setup. Do not hesitate to introduce auxiliary macros to factor your
  9779. code.
  9780. In order to highlight the recommended coding style, here is a macro
  9781. written the old way:
  9782. dnl Check for EMX on OS/2.
  9783. dnl _AC_EMXOS2
  9784. AC_DEFUN(_AC_EMXOS2,
  9785. [AC_CACHE_CHECK(for EMX OS/2 environment, ac_cv_emxos2,
  9786. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, return __EMX__;)],
  9787. ac_cv_emxos2=yes, ac_cv_emxos2=no)])
  9788. test "x$ac_cv_emxos2" = xyes && EMXOS2=yes])
  9789. and the new way:
  9790. # _AC_EMXOS2
  9791. # ----------
  9792. # Check for EMX on OS/2.
  9793. m4_define([_AC_EMXOS2],
  9794. [AC_CACHE_CHECK([for EMX OS/2 environment], [ac_cv_emxos2],
  9795. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return __EMX__;])],
  9796. [ac_cv_emxos2=yes],
  9797. [ac_cv_emxos2=no])])
  9798. test "x$ac_cv_emxos2" = xyes && EMXOS2=yes[]dnl
  9799. ])# _AC_EMXOS2
  9800. 
  9801. File: autoconf.info, Node: Portable Shell, Next: Portable Make, Prev: Writing Autoconf Macros, Up: Top
  9802. 11 Portable Shell Programming
  9803. *****************************
  9804. When writing your own checks, there are some shell-script programming
  9805. techniques you should avoid in order to make your code portable. The
  9806. Bourne shell and upward-compatible shells like the Korn shell and Bash
  9807. have evolved over the years, and many features added to the original
  9808. System7 shell are now supported on all interesting porting targets.
  9809. However, the following discussion between Russ Allbery and Robert Lipe
  9810. is worth reading:
  9811. Russ Allbery:
  9812. The GNU assumption that `/bin/sh' is the one and only shell leads
  9813. to a permanent deadlock. Vendors don't want to break users'
  9814. existing shell scripts, and there are some corner cases in the
  9815. Bourne shell that are not completely compatible with a Posix
  9816. shell. Thus, vendors who have taken this route will _never_
  9817. (OK..."never say never") replace the Bourne shell (as `/bin/sh')
  9818. with a Posix shell.
  9819. Robert Lipe:
  9820. This is exactly the problem. While most (at least most System
  9821. V's) do have a Bourne shell that accepts shell functions most
  9822. vendor `/bin/sh' programs are not the Posix shell.
  9823. So while most modern systems do have a shell _somewhere_ that
  9824. meets the Posix standard, the challenge is to find it.
  9825. For this reason, part of the job of M4sh (*note Programming in
  9826. M4sh::) is to find such a shell. But to prevent trouble, if you're not
  9827. using M4sh you should not take advantage of features that were added
  9828. after Unix version 7, circa 1977 (*note Systemology::); you should not
  9829. use aliases, negated character classes, or even `unset'. `#' comments,
  9830. while not in Unix version 7, were retrofitted in the original Bourne
  9831. shell and can be assumed to be part of the least common denominator.
  9832. On the other hand, if you're using M4sh you can assume that the shell
  9833. has the features that were added in SVR2 (circa 1984), including shell
  9834. functions, `return', `unset', and I/O redirection for builtins. For
  9835. more information, refer to `http://www.in-ulm.de/~mascheck/bourne/'.
  9836. However, some pitfalls have to be avoided for portable use of these
  9837. constructs; these will be documented in the rest of this chapter. See
  9838. in particular *note Shell Functions:: and *note Limitations of Shell
  9839. Builtins: Limitations of Builtins.
  9840. Some ancient systems have quite small limits on the length of the
  9841. `#!' line; for instance, 32 bytes (not including the newline) on SunOS
  9842. 4. However, these ancient systems are no longer of practical concern.
  9843. The set of external programs you should run in a `configure' script
  9844. is fairly small. *Note Utilities in Makefiles: (standards)Utilities in
  9845. Makefiles, for the list. This restriction allows users to start out
  9846. with a fairly small set of programs and build the rest, avoiding too
  9847. many interdependencies between packages.
  9848. Some of these external utilities have a portable subset of features;
  9849. see *note Limitations of Usual Tools::.
  9850. There are other sources of documentation about shells. The
  9851. specification for the Posix Shell Command Language
  9852. (http://www.opengroup.org/susv3/utilities/xcu_chap02.html), though more
  9853. generous than the restrictive shell subset described above, is fairly
  9854. portable nowadays. Also please see the Shell FAQs
  9855. (http://www.faqs.org/faqs/unix-faq/shell/).
  9856. * Menu:
  9857. * Shellology:: A zoology of shells
  9858. * Invoking the Shell:: Invoking the shell as a command
  9859. * Here-Documents:: Quirks and tricks
  9860. * File Descriptors:: FDs and redirections
  9861. * Signal Handling:: Shells, signals, and headaches
  9862. * File System Conventions:: File names
  9863. * Shell Pattern Matching:: Pattern matching
  9864. * Shell Substitutions:: Variable and command expansions
  9865. * Assignments:: Varying side effects of assignments
  9866. * Parentheses:: Parentheses in shell scripts
  9867. * Slashes:: Slashes in shell scripts
  9868. * Special Shell Variables:: Variables you should not change
  9869. * Shell Functions:: What to look out for if you use them
  9870. * Limitations of Builtins:: Portable use of not so portable /bin/sh
  9871. * Limitations of Usual Tools:: Portable use of portable tools
  9872. 
  9873. File: autoconf.info, Node: Shellology, Next: Invoking the Shell, Up: Portable Shell
  9874. 11.1 Shellology
  9875. ===============
  9876. There are several families of shells, most prominently the Bourne family
  9877. and the C shell family which are deeply incompatible. If you want to
  9878. write portable shell scripts, avoid members of the C shell family. The
  9879. the Shell difference FAQ
  9880. (http://www.faqs.org/faqs/unix-faq/shell/shell-differences/) includes a
  9881. small history of Posix shells, and a comparison between several of them.
  9882. Below we describe some of the members of the Bourne shell family.
  9883. Ash
  9884. Ash is often used on GNU/Linux and BSD systems as a light-weight
  9885. Bourne-compatible shell. Ash 0.2 has some bugs that are fixed in
  9886. the 0.3.x series, but portable shell scripts should work around
  9887. them, since version 0.2 is still shipped with many GNU/Linux
  9888. distributions.
  9889. To be compatible with Ash 0.2:
  9890. - don't use `$?' after expanding empty or unset variables, or
  9891. at the start of an `eval':
  9892. foo=
  9893. false
  9894. $foo
  9895. echo "Do not use it: $?"
  9896. false
  9897. eval 'echo "Do not use it: $?"'
  9898. - don't use command substitution within variable expansion:
  9899. cat ${FOO=`bar`}
  9900. - beware that single builtin substitutions are not performed by
  9901. a subshell, hence their effect applies to the current shell!
  9902. *Note Shell Substitutions::, item "Command Substitution".
  9903. Bash
  9904. To detect whether you are running Bash, test whether
  9905. `BASH_VERSION' is set. To require Posix compatibility, run `set
  9906. -o posix'. *Note Bash Posix Mode: (bash)Bash POSIX Mode, for
  9907. details.
  9908. Bash 2.05 and later
  9909. Versions 2.05 and later of Bash use a different format for the
  9910. output of the `set' builtin, designed to make evaluating its
  9911. output easier. However, this output is not compatible with earlier
  9912. versions of Bash (or with many other shells, probably). So if you
  9913. use Bash 2.05 or higher to execute `configure', you'll need to use
  9914. Bash 2.05 for all other build tasks as well.
  9915. Ksh
  9916. The Korn shell is compatible with the Bourne family and it mostly
  9917. conforms to Posix. It has two major variants commonly called
  9918. `ksh88' and `ksh93', named after the years of initial release. It
  9919. is usually called `ksh', but is called `sh' on some hosts if you
  9920. set your path appropriately.
  9921. Solaris systems have three variants: `/usr/bin/ksh' is `ksh88'; it
  9922. is standard on Solaris 2.0 and later. `/usr/xpg4/bin/sh' is a
  9923. Posix-compliant variant of `ksh88'; it is standard on Solaris 9
  9924. and later. `/usr/dt/bin/dtksh' is `ksh93'. Variants that are not
  9925. standard may be parts of optional packages. There is no extra
  9926. charge for these packages, but they are not part of a minimal OS
  9927. install and therefore some installations may not have it.
  9928. Starting with Tru64 Version 4.0, the Korn shell `/usr/bin/ksh' is
  9929. also available as `/usr/bin/posix/sh'. If the environment
  9930. variable `BIN_SH' is set to `xpg4', subsidiary invocations of the
  9931. standard shell conform to Posix.
  9932. Pdksh
  9933. A public-domain clone of the Korn shell called `pdksh' is widely
  9934. available: it has most of the `ksh88' features along with a few of
  9935. its own. It usually sets `KSH_VERSION', except if invoked as
  9936. `/bin/sh' on OpenBSD, and similarly to Bash you can require Posix
  9937. compatibility by running `set -o posix'. Unfortunately, with
  9938. `pdksh' 5.2.14 (the latest stable version as of January 2007)
  9939. Posix mode is buggy and causes `pdksh' to depart from Posix in at
  9940. least one respect, see *note Shell Substitutions::.
  9941. Zsh
  9942. To detect whether you are running `zsh', test whether
  9943. `ZSH_VERSION' is set. By default `zsh' is _not_ compatible with
  9944. the Bourne shell: you must execute `emulate sh', and for `zsh'
  9945. versions before 3.1.6-dev-18 you must also set `NULLCMD' to `:'.
  9946. *Note Compatibility: (zsh)Compatibility, for details.
  9947. The default Mac OS X `sh' was originally Zsh; it was changed to
  9948. Bash in Mac OS X 10.2.
  9949. 
  9950. File: autoconf.info, Node: Invoking the Shell, Next: Here-Documents, Prev: Shellology, Up: Portable Shell
  9951. 11.2 Invoking the Shell
  9952. =======================
  9953. The Korn shell (up to at least version M-12/28/93d) has a bug when
  9954. invoked on a file whose name does not contain a slash. It first
  9955. searches for the file's name in `PATH', and if found it executes that
  9956. rather than the original file. For example, assuming there is a binary
  9957. executable `/usr/bin/script' in your `PATH', the last command in the
  9958. following example fails because the Korn shell finds `/usr/bin/script'
  9959. and refuses to execute it as a shell script:
  9960. $ touch xxyzzyz script
  9961. $ ksh xxyzzyz
  9962. $ ksh ./script
  9963. $ ksh script
  9964. ksh: script: cannot execute
  9965. Bash 2.03 has a bug when invoked with the `-c' option: if the
  9966. option-argument ends in backslash-newline, Bash incorrectly reports a
  9967. syntax error. The problem does not occur if a character follows the
  9968. backslash:
  9969. $ $ bash -c 'echo foo \
  9970. > '
  9971. bash: -c: line 2: syntax error: unexpected end of file
  9972. $ bash -c 'echo foo \
  9973. > '
  9974. foo
  9975. *Note Backslash-Newline-Empty::, for how this can cause problems in
  9976. makefiles.
  9977. 
  9978. File: autoconf.info, Node: Here-Documents, Next: File Descriptors, Prev: Invoking the Shell, Up: Portable Shell
  9979. 11.3 Here-Documents
  9980. ===================
  9981. Don't rely on `\' being preserved just because it has no special
  9982. meaning together with the next symbol. In the native `sh' on OpenBSD
  9983. 2.7 `\"' expands to `"' in here-documents with unquoted delimiter. As
  9984. a general rule, if `\\' expands to `\' use `\\' to get `\'.
  9985. With OpenBSD 2.7's `sh'
  9986. $ cat <<EOF
  9987. > \" \\
  9988. > EOF
  9989. " \
  9990. and with Bash:
  9991. bash-2.04$ cat <<EOF
  9992. > \" \\
  9993. > EOF
  9994. \" \
  9995. Using command substitutions in a here-document that is fed to a shell
  9996. function is not portable. For example, with Solaris 10 `/bin/sh':
  9997. $ kitty () { cat; }
  9998. $ kitty <<EOF
  9999. > `echo ok`
  10000. > EOF
  10001. /tmp/sh199886: cannot open
  10002. $ echo $?
  10003. 1
  10004. Some shells mishandle large here-documents: for example, Solaris 10
  10005. `dtksh' and the UnixWare 7.1.1 Posix shell, which are derived from Korn
  10006. shell version M-12/28/93d, mishandle braced variable expansion that
  10007. crosses a 1024- or 4096-byte buffer boundary within a here-document.
  10008. Only the part of the variable name after the boundary is used. For
  10009. example, `${variable}' could be replaced by the expansion of `${ble}'.
  10010. If the end of the variable name is aligned with the block boundary, the
  10011. shell reports an error, as if you used `${}'. Instead of
  10012. `${variable-default}', the shell may expand `${riable-default}', or
  10013. even `${fault}'. This bug can often be worked around by omitting the
  10014. braces: `$variable'. The bug was fixed in `ksh93g' (1998-04-30) but as
  10015. of 2006 many operating systems were still shipping older versions with
  10016. the bug.
  10017. Empty here-documents are not portable either; with the following
  10018. code, `zsh' up to at least version 4.3.10 creates a file with a single
  10019. newline, whereas other shells create an empty file:
  10020. cat >file <<EOF
  10021. EOF
  10022. Many shells (including the Bourne shell) implement here-documents
  10023. inefficiently. In particular, some shells can be extremely inefficient
  10024. when a single statement contains many here-documents. For instance if
  10025. your `configure.ac' includes something like:
  10026. if <cross_compiling>; then
  10027. assume this and that
  10028. else
  10029. check this
  10030. check that
  10031. check something else
  10032. ...
  10033. on and on forever
  10034. ...
  10035. fi
  10036. A shell parses the whole `if'/`fi' construct, creating temporary
  10037. files for each here-document in it. Some shells create links for such
  10038. here-documents on every `fork', so that the clean-up code they had
  10039. installed correctly removes them. It is creating the links that can
  10040. take the shell forever.
  10041. Moving the tests out of the `if'/`fi', or creating multiple
  10042. `if'/`fi' constructs, would improve the performance significantly.
  10043. Anyway, this kind of construct is not exactly the typical use of
  10044. Autoconf. In fact, it's even not recommended, because M4 macros can't
  10045. look into shell conditionals, so we may fail to expand a macro when it
  10046. was expanded before in a conditional path, and the condition turned out
  10047. to be false at runtime, and we end up not executing the macro at all.
  10048. Be careful with the use of `<<-' to unindent here-documents. The
  10049. behavior is only portable for stripping leading <TAB>s, and things can
  10050. silently break if an overzealous editor converts to using leading
  10051. spaces (not all shells are nice enough to warn about unterminated
  10052. here-documents).
  10053. $ printf 'cat <<-x\n\t1\n\t 2\n\tx\n' | bash && echo done
  10054. 1
  10055. 2
  10056. done
  10057. $ printf 'cat <<-x\n 1\n 2\n x\n' | bash-3.2 && echo done
  10058. 1
  10059. 2
  10060. x
  10061. done
  10062. 
  10063. File: autoconf.info, Node: File Descriptors, Next: Signal Handling, Prev: Here-Documents, Up: Portable Shell
  10064. 11.4 File Descriptors
  10065. =====================
  10066. Most shells, if not all (including Bash, Zsh, Ash), output traces on
  10067. stderr, even for subshells. This might result in undesirable content
  10068. if you meant to capture the standard-error output of the inner command:
  10069. $ ash -x -c '(eval "echo foo >&2") 2>stderr'
  10070. $ cat stderr
  10071. + eval echo foo >&2
  10072. + echo foo
  10073. foo
  10074. $ bash -x -c '(eval "echo foo >&2") 2>stderr'
  10075. $ cat stderr
  10076. + eval 'echo foo >&2'
  10077. ++ echo foo
  10078. foo
  10079. $ zsh -x -c '(eval "echo foo >&2") 2>stderr'
  10080. # Traces on startup files deleted here.
  10081. $ cat stderr
  10082. +zsh:1> eval echo foo >&2
  10083. +zsh:1> echo foo
  10084. foo
  10085. One workaround is to grep out uninteresting lines, hoping not to remove
  10086. good ones.
  10087. If you intend to redirect both standard error and standard output,
  10088. redirect standard output first. This works better with HP-UX, since
  10089. its shell mishandles tracing if standard error is redirected first:
  10090. $ sh -x -c ': 2>err >out'
  10091. + :
  10092. + 2> err $ cat err
  10093. 1> out
  10094. Don't try to redirect the standard error of a command substitution.
  10095. It must be done _inside_ the command substitution. When running `: `cd
  10096. /zorglub` 2>/dev/null' expect the error message to escape, while `: `cd
  10097. /zorglub 2>/dev/null`' works properly.
  10098. On the other hand, some shells, such as Solaris or FreeBSD
  10099. `/bin/sh', warn about missing programs before performing redirections.
  10100. Therefore, to silently check whether a program exists, it is necessary
  10101. to perform redirections on a subshell or brace group:
  10102. $ /bin/sh -c 'nosuch 2>/dev/null'
  10103. nosuch: not found
  10104. $ /bin/sh -c '(nosuch) 2>/dev/null'
  10105. $ /bin/sh -c '{ nosuch; } 2>/dev/null'
  10106. $ bash -c 'nosuch 2>/dev/null'
  10107. FreeBSD 6.2 sh may mix the trace output lines from the statements in
  10108. a shell pipeline.
  10109. It is worth noting that Zsh (but not Ash nor Bash) makes it possible
  10110. in assignments though: `foo=`cd /zorglub` 2>/dev/null'.
  10111. Some shells, like `ash', don't recognize bi-directional redirection
  10112. (`<>'). And even on shells that recognize it, it is not portable to
  10113. use on fifos: Posix does not require read-write support for named
  10114. pipes, and Cygwin does not support it:
  10115. $ mkfifo fifo
  10116. $ exec 5<>fifo
  10117. $ echo hi >&5
  10118. bash: echo: write error: Communication error on send
  10119. Furthermore, versions of `dash' before 0.5.6 mistakenly truncate
  10120. regular files when using `<>':
  10121. $ echo a > file
  10122. $ bash -c ': 1<>file'; cat file
  10123. a
  10124. $ dash -c ': 1<>file'; cat file
  10125. $ rm a
  10126. When catering to old systems, don't redirect the same file descriptor
  10127. several times, as you are doomed to failure under Ultrix.
  10128. ULTRIX V4.4 (Rev. 69) System #31: Thu Aug 10 19:42:23 GMT 1995
  10129. UWS V4.4 (Rev. 11)
  10130. $ eval 'echo matter >fullness' >void
  10131. illegal io
  10132. $ eval '(echo matter >fullness)' >void
  10133. illegal io
  10134. $ (eval '(echo matter >fullness)') >void
  10135. Ambiguous output redirect.
  10136. In each case the expected result is of course `fullness' containing
  10137. `matter' and `void' being empty. However, this bug is probably not of
  10138. practical concern to modern platforms.
  10139. Solaris 10 `sh' will try to optimize away a `:' command (even if it
  10140. is redirected) in a loop after the first iteration, or in a shell
  10141. function after the first call:
  10142. $ for i in 1 2 3 ; do : >x$i; done
  10143. $ ls x*
  10144. x1
  10145. $ f () { : >$1; }; f y1; f y2; f y3;
  10146. $ ls y*
  10147. y1
  10148. As a workaround, `echo' or `eval' can be used.
  10149. Don't rely on file descriptors 0, 1, and 2 remaining closed in a
  10150. subsidiary program. If any of these descriptors is closed, the
  10151. operating system may open an unspecified file for the descriptor in the
  10152. new process image. Posix 2008 says this may be done only if the
  10153. subsidiary program is set-user-ID or set-group-ID, but HP-UX 11.23 does
  10154. it even for ordinary programs, and the next version of Posix will allow
  10155. HP-UX behavior.
  10156. If you want a file descriptor above 2 to be inherited into a child
  10157. process, then you must use redirections specific to that command or a
  10158. containing subshell or command group, rather than relying on `exec' in
  10159. the shell. In `ksh' as well as HP-UX `sh', file descriptors above 2
  10160. which are opened using `exec N>file' are closed by a subsequent `exec'
  10161. (such as that involved in the fork-and-exec which runs a program or
  10162. script):
  10163. $ echo 'echo hello >&5' >k
  10164. $ /bin/sh -c 'exec 5>t; ksh ./k; exec 5>&-; cat t
  10165. hello
  10166. $ bash -c 'exec 5>t; ksh ./k; exec 5>&-; cat t
  10167. hello
  10168. $ ksh -c 'exec 5>t; ksh ./k; exec 5>&-; cat t
  10169. ./k[1]: 5: cannot open [Bad file number]
  10170. $ ksh -c '(ksh ./k) 5>t; cat t'
  10171. hello
  10172. $ ksh -c '{ ksh ./k; } 5>t; cat t'
  10173. hello
  10174. $ ksh -c '5>t ksh ./k; cat t
  10175. hello
  10176. Don't rely on duplicating a closed file descriptor to cause an
  10177. error. With Solaris `/bin/sh', failed duplication is silently ignored,
  10178. which can cause unintended leaks to the original file descriptor. In
  10179. this example, observe the leak to standard output:
  10180. $ bash -c 'echo hi >&3' 3>&-; echo $?
  10181. bash: 3: Bad file descriptor
  10182. 1
  10183. $ /bin/sh -c 'echo hi >&3' 3>&-; echo $?
  10184. hi
  10185. 0
  10186. Fortunately, an attempt to close an already closed file descriptor
  10187. will portably succeed. Likewise, it is safe to use either style of
  10188. `N<&-' or `N>&-' for closing a file descriptor, even if it doesn't
  10189. match the read/write mode that the file descriptor was opened with.
  10190. DOS variants cannot rename or remove open files, such as in `mv foo
  10191. bar >foo' or `rm foo >foo', even though this is perfectly portable
  10192. among Posix hosts.
  10193. A few ancient systems reserved some file descriptors. By convention,
  10194. file descriptor 3 was opened to `/dev/tty' when you logged into Eighth
  10195. Edition (1985) through Tenth Edition Unix (1989). File descriptor 4
  10196. had a special use on the Stardent/Kubota Titan (circa 1990), though we
  10197. don't now remember what it was. Both these systems are obsolete, so
  10198. it's now safe to treat file descriptors 3 and 4 like any other file
  10199. descriptors.
  10200. On the other hand, you can't portably use multi-digit file
  10201. descriptors. Solaris `ksh' doesn't understand any file descriptor
  10202. larger than `9':
  10203. $ bash -c 'exec 10>&-'; echo $?
  10204. 0
  10205. $ ksh -c 'exec 9>&-'; echo $?
  10206. 0
  10207. $ ksh -c 'exec 10>&-'; echo $?
  10208. ksh[1]: exec: 10: not found
  10209. 127
  10210. 
  10211. File: autoconf.info, Node: Signal Handling, Next: File System Conventions, Prev: File Descriptors, Up: Portable Shell
  10212. 11.5 Signal Handling
  10213. ====================
  10214. Portable handling of signals within the shell is another major source of
  10215. headaches. This is worsened by the fact that various different,
  10216. mutually incompatible approaches are possible in this area, each with
  10217. its distinctive merits and demerits. A detailed description of these
  10218. possible approaches, as well as of their pros and cons, can be found in
  10219. this article (http://www.cons.org/cracauer/sigint.html).
  10220. Solaris 10 `/bin/sh' automatically traps most signals by default;
  10221. the shell still exits with error upon termination by one of those
  10222. signals, but in such a case the exit status might be somewhat
  10223. unexpected (even if allowed by POSIX, strictly speaking):
  10224. $ bash -c 'kill -1 $$'; echo $? # Will exit 128 + (signal number).
  10225. Hangup
  10226. 129
  10227. $ /bin/ksh -c 'kill -15 $$'; echo $? # Likewise.
  10228. Terminated
  10229. 143
  10230. $ for sig in 1 2 3 15; do
  10231. > echo $sig:
  10232. > /bin/sh -c "kill -$s \$\$"; echo $?
  10233. > done
  10234. signal 1:
  10235. Hangup
  10236. 129
  10237. signal 2:
  10238. 208
  10239. signal 3:
  10240. 208
  10241. signal 15:
  10242. 208
  10243. This gets even worse if one is using the POSIX `wait' interface to
  10244. get details about the shell process terminations: it will result in the
  10245. shell having exited normally, rather than by receiving a signal.
  10246. $ cat > foo.c <<'END'
  10247. #include <stdio.h> /* for printf */
  10248. #include <stdlib.h> /* for system */
  10249. #include <sys/wait.h> /* for WIF* macros */
  10250. int main(void)
  10251. {
  10252. int status = system ("kill -15 $$");
  10253. printf ("Terminated by signal: %s\n",
  10254. WIFSIGNALED (status) ? "yes" : "no");
  10255. printf ("Exited normally: %s\n",
  10256. WIFEXITED (status) ? "yes" : "no");
  10257. return 0;
  10258. }
  10259. END
  10260. $ cc -o foo foo.c
  10261. $ ./a.out # On GNU/Linux
  10262. Terminated by signal: no
  10263. Exited normally: yes
  10264. $ ./a.out # On Solaris 10
  10265. Terminated by signal: yes
  10266. Exited normally: no
  10267. Various shells seem to handle `SIGQUIT' specially: they ignore it
  10268. even if it is not blocked, and even if the shell is not running
  10269. interactively (in fact, even if the shell has no attached tty); among
  10270. these shells are at least Bash (from version 2 onwards), Zsh 4.3.12,
  10271. Solaris 10 `/bin/ksh' and `/usr/xpg4/bin/sh', and AT&T `ksh93' (2011).
  10272. Still, `SIGQUIT' seems to be trappable quite portably within all these
  10273. shells. OTOH, some other shells doesn't special-case the handling of
  10274. `SIGQUIT'; among these shells are at least `pdksh' 5.2.14, Solaris 10
  10275. and NetBSD 5.1 `/bin/sh', and the Almquist Shell 0.5.5.1.
  10276. Some shells (especially Korn shells and derivatives) might try to
  10277. propagate to themselves a signal that has killed a child process; this
  10278. is not a bug, but a conscious design choice (although its overall value
  10279. might be debatable). The exact details of how this is attained vary
  10280. from shell to shell. For example, upon running `perl -e 'kill 2, $$'',
  10281. after the perl process has been interrupted AT&T `ksh93' (2011) will
  10282. proceed to send itself a `SIGINT', while Solaris 10 `/bin/ksh' and
  10283. `/usr/xpg4/bin/sh' will proceed to exit with status 130 (i.e., 128 +
  10284. 2). In any case, if there is an active trap associated with `SIGINT',
  10285. those shells will correctly execute it.
  10286. Some Korn shells, when a child process die due receiving a signal
  10287. with signal number N, can leave in `$?' an exit status of 256+N instead
  10288. of the more common 128+N. Observe the difference between AT&T `ksh93'
  10289. (2011) and `bash' 4.1.5 on Debian:
  10290. $ /bin/ksh -c 'sh -c "kill -1 \$\$"; echo $?'
  10291. /bin/ksh: line 1: 7837: Hangup
  10292. 257
  10293. $ /bin/bash -c 'sh -c "kill -1 \$\$"; echo $?'
  10294. /bin/bash: line 1: 7861 Hangup (sh -c "kill -1 \$\$")
  10295. 129
  10296. This `ksh' behavior is allowed by POSIX, if implemented with due care;
  10297. see this Austin Group discussion
  10298. (http://www.austingroupbugs.net/view.php?id=51) for more background.
  10299. However, if it is not implemented with proper care, such a behavior
  10300. might cause problems in some corner cases. To see why, assume we have
  10301. a "wrapper" script like this:
  10302. #!/bin/sh
  10303. # Ignore some signals in the shell only, not in its child processes.
  10304. trap : 1 2 13 15
  10305. wrapped_command "$@"
  10306. ret=$?
  10307. other_command
  10308. exit $ret
  10309. If `wrapped_command' is interrupted by a `SIGHUP' (which has signal
  10310. number 1), `ret' will be set to 257. Unless the `exit' shell builtin
  10311. is smart enough to understand that such a value can only have
  10312. originated from a signal, and adjust the final wait status of the shell
  10313. appropriately, the value 257 will just get truncated to 1 by the
  10314. closing `exit' call, so that a caller of the script will have no way to
  10315. determine that termination by a signal was involved. Observe the
  10316. different behavior of AT&T `ksh93' (2011) and `bash' 4.1.5 on Debian:
  10317. $ cat foo.sh
  10318. #!/bin/sh
  10319. sh -c 'kill -1 $$'
  10320. ret=$?
  10321. echo $ret
  10322. exit $ret
  10323. $ /bin/ksh foo.sh; echo $?
  10324. foo.sh: line 2: 12479: Hangup
  10325. 257
  10326. 1
  10327. $ /bin/bash foo.sh; echo $?
  10328. foo.sh: line 2: 12487 Hangup (sh -c 'kill -1 $$')
  10329. 129
  10330. 129
  10331. 
  10332. File: autoconf.info, Node: File System Conventions, Next: Shell Pattern Matching, Prev: Signal Handling, Up: Portable Shell
  10333. 11.6 File System Conventions
  10334. ============================
  10335. Autoconf uses shell-script processing extensively, so the file names
  10336. that it processes should not contain characters that are special to the
  10337. shell. Special characters include space, tab, newline, NUL, and the
  10338. following:
  10339. " # $ & ' ( ) * ; < = > ? [ \ ` |
  10340. Also, file names should not begin with `~' or `-', and should
  10341. contain neither `-' immediately after `/' nor `~' immediately after
  10342. `:'. On Posix-like platforms, directory names should not contain `:',
  10343. as this runs afoul of `:' used as the path separator.
  10344. These restrictions apply not only to the files that you distribute,
  10345. but also to the absolute file names of your source, build, and
  10346. destination directories.
  10347. On some Posix-like platforms, `!' and `^' are special too, so they
  10348. should be avoided.
  10349. Posix lets implementations treat leading `//' specially, but
  10350. requires leading `///' and beyond to be equivalent to `/'. Most Unix
  10351. variants treat `//' like `/'. However, some treat `//' as a
  10352. "super-root" that can provide access to files that are not otherwise
  10353. reachable from `/'. The super-root tradition began with Apollo
  10354. Domain/OS, which died out long ago, but unfortunately Cygwin has
  10355. revived it.
  10356. While `autoconf' and friends are usually run on some Posix variety,
  10357. they can be used on other systems, most notably DOS variants. This
  10358. impacts several assumptions regarding file names.
  10359. For example, the following code:
  10360. case $foo_dir in
  10361. /*) # Absolute
  10362. ;;
  10363. *)
  10364. foo_dir=$dots$foo_dir ;;
  10365. esac
  10366. fails to properly detect absolute file names on those systems, because
  10367. they can use a drivespec, and usually use a backslash as directory
  10368. separator. If you want to be portable to DOS variants (at the price of
  10369. rejecting valid but oddball Posix file names like `a:\b'), you can
  10370. check for absolute file names like this:
  10371. case $foo_dir in
  10372. [\\/]* | ?:[\\/]* ) # Absolute
  10373. ;;
  10374. *)
  10375. foo_dir=$dots$foo_dir ;;
  10376. esac
  10377. Make sure you quote the brackets if appropriate and keep the backslash
  10378. as first character (*note Limitations of Shell Builtins: case.).
  10379. Also, because the colon is used as part of a drivespec, these
  10380. systems don't use it as path separator. When creating or accessing
  10381. paths, you can use the `PATH_SEPARATOR' output variable instead.
  10382. `configure' sets this to the appropriate value for the build system
  10383. (`:' or `;') when it starts up.
  10384. File names need extra care as well. While DOS variants that are
  10385. Posixy enough to run `autoconf' (such as DJGPP) are usually able to
  10386. handle long file names properly, there are still limitations that can
  10387. seriously break packages. Several of these issues can be easily
  10388. detected by the doschk
  10389. (ftp://ftp.gnu.org/gnu/non-gnu/doschk/doschk-1.1.tar.gz) package.
  10390. A short overview follows; problems are marked with SFN/LFN to
  10391. indicate where they apply: SFN means the issues are only relevant to
  10392. plain DOS, not to DOS under Microsoft Windows variants, while LFN
  10393. identifies problems that exist even under Microsoft Windows variants.
  10394. No multiple dots (SFN)
  10395. DOS cannot handle multiple dots in file names. This is an
  10396. especially important thing to remember when building a portable
  10397. configure script, as `autoconf' uses a .in suffix for template
  10398. files.
  10399. This is perfectly OK on Posix variants:
  10400. AC_CONFIG_HEADERS([config.h])
  10401. AC_CONFIG_FILES([source.c foo.bar])
  10402. AC_OUTPUT
  10403. but it causes problems on DOS, as it requires `config.h.in',
  10404. `source.c.in' and `foo.bar.in'. To make your package more portable
  10405. to DOS-based environments, you should use this instead:
  10406. AC_CONFIG_HEADERS([config.h:config.hin])
  10407. AC_CONFIG_FILES([source.c:source.cin foo.bar:foobar.in])
  10408. AC_OUTPUT
  10409. No leading dot (SFN)
  10410. DOS cannot handle file names that start with a dot. This is
  10411. usually not important for `autoconf'.
  10412. Case insensitivity (LFN)
  10413. DOS is case insensitive, so you cannot, for example, have both a
  10414. file called `INSTALL' and a directory called `install'. This also
  10415. affects `make'; if there's a file called `INSTALL' in the
  10416. directory, `make install' does nothing (unless the `install'
  10417. target is marked as PHONY).
  10418. The 8+3 limit (SFN)
  10419. Because the DOS file system only stores the first 8 characters of
  10420. the file name and the first 3 of the extension, those must be
  10421. unique. That means that `foobar-part1.c', `foobar-part2.c' and
  10422. `foobar-prettybird.c' all resolve to the same file name
  10423. (`FOOBAR-P.C'). The same goes for `foo.bar' and `foo.bartender'.
  10424. The 8+3 limit is not usually a problem under Microsoft Windows, as
  10425. it uses numeric tails in the short version of file names to make
  10426. them unique. However, a registry setting can turn this behavior
  10427. off. While this makes it possible to share file trees containing
  10428. long file names between SFN and LFN environments, it also means
  10429. the above problem applies there as well.
  10430. Invalid characters (LFN)
  10431. Some characters are invalid in DOS file names, and should therefore
  10432. be avoided. In a LFN environment, these are `/', `\', `?', `*',
  10433. `:', `<', `>', `|' and `"'. In a SFN environment, other
  10434. characters are also invalid. These include `+', `,', `[' and `]'.
  10435. Invalid names (LFN)
  10436. Some DOS file names are reserved, and cause problems if you try to
  10437. use files with those names. These names include `CON', `AUX',
  10438. `COM1', `COM2', `COM3', `COM4', `LPT1', `LPT2', `LPT3', `NUL', and
  10439. `PRN'. File names are case insensitive, so even names like
  10440. `aux/config.guess' are disallowed.
  10441. 
  10442. File: autoconf.info, Node: Shell Pattern Matching, Next: Shell Substitutions, Prev: File System Conventions, Up: Portable Shell
  10443. 11.7 Shell Pattern Matching
  10444. ===========================
  10445. Nowadays portable patterns can use negated character classes like
  10446. `[!-aeiou]'. The older syntax `[^-aeiou]' is supported by some shells
  10447. but not others; hence portable scripts should never use `^' as the
  10448. first character of a bracket pattern.
  10449. Outside the C locale, patterns like `[a-z]' are problematic since
  10450. they may match characters that are not lower-case letters.
  10451. 
  10452. File: autoconf.info, Node: Shell Substitutions, Next: Assignments, Prev: Shell Pattern Matching, Up: Portable Shell
  10453. 11.8 Shell Substitutions
  10454. ========================
  10455. Contrary to a persistent urban legend, the Bourne shell does not
  10456. systematically split variables and back-quoted expressions, in
  10457. particular on the right-hand side of assignments and in the argument of
  10458. `case'. For instance, the following code:
  10459. case "$given_srcdir" in
  10460. .) top_srcdir="`echo "$dots" | sed 's|/$||'`" ;;
  10461. *) top_srcdir="$dots$given_srcdir" ;;
  10462. esac
  10463. is more readable when written as:
  10464. case $given_srcdir in
  10465. .) top_srcdir=`echo "$dots" | sed 's|/$||'` ;;
  10466. *) top_srcdir=$dots$given_srcdir ;;
  10467. esac
  10468. and in fact it is even _more_ portable: in the first case of the first
  10469. attempt, the computation of `top_srcdir' is not portable, since not all
  10470. shells properly understand `"`..."..."...`"', for example Solaris 10
  10471. ksh:
  10472. $ foo="`echo " bar" | sed 's, ,,'`"
  10473. ksh: : cannot execute
  10474. ksh: bar | sed 's, ,,': cannot execute
  10475. Posix does not specify behavior for this sequence. On the other hand,
  10476. behavior for `"`...\"...\"...`"' is specified by Posix, but in
  10477. practice, not all shells understand it the same way: pdksh 5.2.14
  10478. prints spurious quotes when in Posix mode:
  10479. $ echo "`echo \"hello\"`"
  10480. hello
  10481. $ set -o posix
  10482. $ echo "`echo \"hello\"`"
  10483. "hello"
  10484. There is just no portable way to use double-quoted strings inside
  10485. double-quoted back-quoted expressions (pfew!).
  10486. Bash 4.1 has a bug where quoted empty strings adjacent to unquoted
  10487. parameter expansions are elided during word splitting. Meanwhile, zsh
  10488. does not perform word splitting except when in Bourne compatibility
  10489. mode. In the example below, the correct behavior is to have five
  10490. arguments to the function, and exactly two spaces on either side of the
  10491. middle `-', since word splitting collapses multiple spaces in `$f' but
  10492. leaves empty arguments intact.
  10493. $ bash -c 'n() { echo "$#$@"; }; f=" - "; n - ""$f"" -'
  10494. 3- - -
  10495. $ ksh -c 'n() { echo "$#$@"; }; f=" - "; n - ""$f"" -'
  10496. 5- - -
  10497. $ zsh -c 'n() { echo "$#$@"; }; f=" - "; n - ""$f"" -'
  10498. 3- - -
  10499. $ zsh -c 'emulate sh;
  10500. > n() { echo "$#$@"; }; f=" - "; n - ""$f"" -'
  10501. 5- - -
  10502. You can work around this by doing manual word splitting, such as using
  10503. `"$str" $list' rather than `"$str"$list'.
  10504. There are also portability pitfalls with particular expansions:
  10505. `$@'
  10506. One of the most famous shell-portability issues is related to
  10507. `"$@"'. When there are no positional arguments, Posix says that
  10508. `"$@"' is supposed to be equivalent to nothing, but the original
  10509. Unix version 7 Bourne shell treated it as equivalent to `""'
  10510. instead, and this behavior survives in later implementations like
  10511. Digital Unix 5.0.
  10512. The traditional way to work around this portability problem is to
  10513. use `${1+"$@"}'. Unfortunately this method does not work with Zsh
  10514. (3.x and 4.x), which is used on Mac OS X. When emulating the
  10515. Bourne shell, Zsh performs word splitting on `${1+"$@"}':
  10516. zsh $ emulate sh
  10517. zsh $ for i in "$@"; do echo $i; done
  10518. Hello World
  10519. !
  10520. zsh $ for i in ${1+"$@"}; do echo $i; done
  10521. Hello
  10522. World
  10523. !
  10524. Zsh handles plain `"$@"' properly, but we can't use plain `"$@"'
  10525. because of the portability problems mentioned above. One
  10526. workaround relies on Zsh's "global aliases" to convert `${1+"$@"}'
  10527. into `"$@"' by itself:
  10528. test "${ZSH_VERSION+set}" = set && alias -g '${1+"$@"}'='"$@"'
  10529. Zsh only recognizes this alias when a shell word matches it
  10530. exactly; `"foo"${1+"$@"}' remains subject to word splitting.
  10531. Since this case always yields at least one shell word, use plain
  10532. `"$@"'.
  10533. A more conservative workaround is to avoid `"$@"' if it is
  10534. possible that there may be no positional arguments. For example,
  10535. instead of:
  10536. cat conftest.c "$@"
  10537. you can use this instead:
  10538. case $# in
  10539. 0) cat conftest.c;;
  10540. *) cat conftest.c "$@";;
  10541. esac
  10542. Autoconf macros often use the `set' command to update `$@', so if
  10543. you are writing shell code intended for `configure' you should not
  10544. assume that the value of `$@' persists for any length of time.
  10545. `${10}'
  10546. The 10th, 11th, ... positional parameters can be accessed only
  10547. after a `shift'. The 7th Edition shell reported an error if given
  10548. `${10}', and Solaris 10 `/bin/sh' still acts that way:
  10549. $ set 1 2 3 4 5 6 7 8 9 10
  10550. $ echo ${10}
  10551. bad substitution
  10552. Conversely, not all shells obey the Posix rule that when braces are
  10553. omitted, multiple digits beyond a `$' imply the single-digit
  10554. positional parameter expansion concatenated with the remaining
  10555. literal digits. To work around the issue, you must use braces.
  10556. $ bash -c 'set a b c d e f g h i j; echo $10 ${1}0'
  10557. a0 a0
  10558. $ dash -c 'set a b c d e f g h i j; echo $10 ${1}0'
  10559. j a0
  10560. `${VAR:-VALUE}'
  10561. Old BSD shells, including the Ultrix `sh', don't accept the colon
  10562. for any shell substitution, and complain and die. Similarly for
  10563. ${VAR:=VALUE}, ${VAR:?VALUE}, etc. However, all shells that
  10564. support functions allow the use of colon in shell substitution,
  10565. and since m4sh requires functions, you can portably use null
  10566. variable substitution patterns in configure scripts.
  10567. `${VAR+VALUE}'
  10568. When using `${VAR-VALUE}' or `${VAR-VALUE}' for providing
  10569. alternate substitutions, VALUE must either be a single shell word,
  10570. quoted, or in the context of an unquoted here-document. Solaris
  10571. `/bin/sh' complains otherwise.
  10572. $ /bin/sh -c 'echo ${a-b c}'
  10573. /bin/sh: bad substitution
  10574. $ /bin/sh -c 'echo ${a-'\''b c'\''}'
  10575. b c
  10576. $ /bin/sh -c 'echo "${a-b c}"'
  10577. b c
  10578. $ /bin/sh -c 'cat <<EOF
  10579. ${a-b c}
  10580. EOF
  10581. b c
  10582. According to Posix, if an expansion occurs inside double quotes,
  10583. then the use of unquoted double quotes within VALUE is
  10584. unspecified, and any single quotes become literal characters; in
  10585. that case, escaping must be done with backslash. Likewise, the
  10586. use of unquoted here-documents is a case where double quotes have
  10587. unspecified results:
  10588. $ /bin/sh -c 'echo "${a-"b c"}"'
  10589. /bin/sh: bad substitution
  10590. $ ksh -c 'echo "${a-"b c"}"'
  10591. b c
  10592. $ bash -c 'echo "${a-"b c"}"'
  10593. b c
  10594. $ /bin/sh -c 'a=; echo ${a+'\''b c'\''}'
  10595. b c
  10596. $ /bin/sh -c 'a=; echo "${a+'\''b c'\''}"'
  10597. 'b c'
  10598. $ /bin/sh -c 'a=; echo "${a+\"b c\"}"'
  10599. "b c"
  10600. $ /bin/sh -c 'a=; echo "${a+b c}"'
  10601. b c
  10602. $ /bin/sh -c 'cat <<EOF
  10603. ${a-"b c"}
  10604. EOF'
  10605. "b c"
  10606. $ /bin/sh -c 'cat <<EOF
  10607. ${a-'b c'}
  10608. EOF'
  10609. 'b c'
  10610. $ bash -c 'cat <<EOF
  10611. ${a-"b c"}
  10612. EOF'
  10613. b c
  10614. $ bash -c 'cat <<EOF
  10615. ${a-'b c'}
  10616. EOF'
  10617. 'b c'
  10618. Perhaps the easiest way to work around quoting issues in a manner
  10619. portable to all shells is to place the results in a temporary
  10620. variable, then use `$t' as the VALUE, rather than trying to inline
  10621. the expression needing quoting.
  10622. $ /bin/sh -c 't="b c\"'\''}\\"; echo "${a-$t}"'
  10623. b c"'}\
  10624. $ ksh -c 't="b c\"'\''}\\"; echo "${a-$t}"'
  10625. b c"'}\
  10626. $ bash -c 't="b c\"'\''}\\"; echo "${a-$t}"'
  10627. b c"'}\
  10628. `${VAR=VALUE}'
  10629. When using `${VAR=VALUE}' to assign a default value to VAR,
  10630. remember that even though the assignment to VAR does not undergo
  10631. file name expansion, the result of the variable expansion does
  10632. unless the expansion occurred within double quotes. In particular,
  10633. when using `:' followed by unquoted variable expansion for the
  10634. side effect of setting a default value, if the final value of
  10635. `$var' contains any globbing characters (either from VALUE or from
  10636. prior contents), the shell has to spend time performing file name
  10637. expansion and field splitting even though those results will not be
  10638. used. Therefore, it is a good idea to consider double quotes when
  10639. performing default initialization; while remembering how this
  10640. impacts any quoting characters appearing in VALUE.
  10641. $ time bash -c ': "${a=/usr/bin/*}"; echo "$a"'
  10642. /usr/bin/*
  10643. real 0m0.005s
  10644. user 0m0.002s
  10645. sys 0m0.003s
  10646. $ time bash -c ': ${a=/usr/bin/*}; echo "$a"'
  10647. /usr/bin/*
  10648. real 0m0.039s
  10649. user 0m0.026s
  10650. sys 0m0.009s
  10651. $ time bash -c 'a=/usr/bin/*; : ${a=noglob}; echo "$a"'
  10652. /usr/bin/*
  10653. real 0m0.031s
  10654. user 0m0.020s
  10655. sys 0m0.010s
  10656. $ time bash -c 'a=/usr/bin/*; : "${a=noglob}"; echo "$a"'
  10657. /usr/bin/*
  10658. real 0m0.006s
  10659. user 0m0.002s
  10660. sys 0m0.003s
  10661. As with `+' and `-', you must use quotes when using `=' if the
  10662. VALUE contains more than one shell word; either single quotes for
  10663. just the VALUE, or double quotes around the entire expansion:
  10664. $ : ${var1='Some words'}
  10665. $ : "${var2=like this}"
  10666. $ echo $var1 $var2
  10667. Some words like this
  10668. otherwise some shells, such as Solaris `/bin/sh' or on Digital
  10669. Unix V 5.0, die because of a "bad substitution". Meanwhile, Posix
  10670. requires that with `=', quote removal happens prior to the
  10671. assignment, and the expansion be the final contents of VAR without
  10672. quoting (and thus subject to field splitting), in contrast to the
  10673. behavior with `-' passing the quoting through to the final
  10674. expansion. However, `bash' 4.1 does not obey this rule.
  10675. $ ksh -c 'echo ${var-a\ \ b}'
  10676. a b
  10677. $ ksh -c 'echo ${var=a\ \ b}'
  10678. a b
  10679. $ bash -c 'echo ${var=a\ \ b}'
  10680. a b
  10681. Finally, Posix states that when mixing `${a=b}' with regular
  10682. commands, it is unspecified whether the assignments affect the
  10683. parent shell environment. It is best to perform assignments
  10684. independently from commands, to avoid the problems demonstrated in
  10685. this example:
  10686. $ bash -c 'x= y=${x:=b} sh -c "echo +\$x+\$y+";echo -$x-'
  10687. +b+b+
  10688. -b-
  10689. $ /bin/sh -c 'x= y=${x:=b} sh -c "echo +\$x+\$y+";echo -$x-'
  10690. ++b+
  10691. --
  10692. $ ksh -c 'x= y=${x:=b} sh -c "echo +\$x+\$y+";echo -$x-'
  10693. +b+b+
  10694. --
  10695. `${VAR=VALUE}'
  10696. Solaris `/bin/sh' has a frightening bug in its handling of literal
  10697. assignments. Imagine you need set a variable to a string
  10698. containing `}'. This `}' character confuses Solaris `/bin/sh'
  10699. when the affected variable was already set. This bug can be
  10700. exercised by running:
  10701. $ unset foo
  10702. $ foo=${foo='}'}
  10703. $ echo $foo
  10704. }
  10705. $ foo=${foo='}' # no error; this hints to what the bug is
  10706. $ echo $foo
  10707. }
  10708. $ foo=${foo='}'}
  10709. $ echo $foo
  10710. }}
  10711. ^ ugh!
  10712. It seems that `}' is interpreted as matching `${', even though it
  10713. is enclosed in single quotes. The problem doesn't happen using
  10714. double quotes, or when using a temporary variable holding the
  10715. problematic string.
  10716. `${VAR=EXPANDED-VALUE}'
  10717. On Ultrix, running
  10718. default="yu,yaa"
  10719. : ${var="$default"}
  10720. sets VAR to `M-yM-uM-,M-yM-aM-a', i.e., the 8th bit of each char
  10721. is set. You don't observe the phenomenon using a simple `echo
  10722. $var' since apparently the shell resets the 8th bit when it
  10723. expands $var. Here are two means to make this shell confess its
  10724. sins:
  10725. $ cat -v <<EOF
  10726. $var
  10727. EOF
  10728. and
  10729. $ set | grep '^var=' | cat -v
  10730. One classic incarnation of this bug is:
  10731. default="a b c"
  10732. : ${list="$default"}
  10733. for c in $list; do
  10734. echo $c
  10735. done
  10736. You'll get `a b c' on a single line. Why? Because there are no
  10737. spaces in `$list': there are `M- ', i.e., spaces with the 8th bit
  10738. set, hence no IFS splitting is performed!!!
  10739. One piece of good news is that Ultrix works fine with `:
  10740. ${list=$default}'; i.e., if you _don't_ quote. The bad news is
  10741. then that QNX 4.25 then sets LIST to the _last_ item of DEFAULT!
  10742. The portable way out consists in using a double assignment, to
  10743. switch the 8th bit twice on Ultrix:
  10744. list=${list="$default"}
  10745. ...but beware of the `}' bug from Solaris (see above). For safety,
  10746. use:
  10747. test "${var+set}" = set || var={VALUE}
  10748. `${#VAR}'
  10749. `${VAR%WORD}'
  10750. `${VAR%%WORD}'
  10751. `${VAR#WORD}'
  10752. `${VAR##WORD}'
  10753. Posix requires support for these usages, but they do not work with
  10754. many traditional shells, e.g., Solaris 10 `/bin/sh'.
  10755. Also, `pdksh' 5.2.14 mishandles some WORD forms. For example if
  10756. `$1' is `a/b' and `$2' is `a', then `${1#$2}' should yield `/b',
  10757. but with `pdksh' it yields the empty string.
  10758. ``COMMANDS`'
  10759. Posix requires shells to trim all trailing newlines from command
  10760. output before substituting it, so assignments like `dir=`echo
  10761. "$file" | tr a A`' do not work as expected if `$file' ends in a
  10762. newline.
  10763. While in general it makes no sense, do not substitute a single
  10764. builtin with side effects, because Ash 0.2, trying to optimize,
  10765. does not fork a subshell to perform the command.
  10766. For instance, if you wanted to check that `cd' is silent, do not
  10767. use `test -z "`cd /`"' because the following can happen:
  10768. $ pwd
  10769. /tmp
  10770. $ test -z "`cd /`" && pwd
  10771. /
  10772. The result of `foo=`exit 1`' is left as an exercise to the reader.
  10773. The MSYS shell leaves a stray byte in the expansion of a
  10774. double-quoted command substitution of a native program, if the end
  10775. of the substitution is not aligned with the end of the double
  10776. quote. This may be worked around by inserting another pair of
  10777. quotes:
  10778. $ echo "`printf 'foo\r\n'` bar" > broken
  10779. $ echo "`printf 'foo\r\n'`"" bar" | cmp - broken
  10780. - broken differ: char 4, line 1
  10781. Upon interrupt or SIGTERM, some shells may abort a command
  10782. substitution, replace it with a null string, and wrongly evaluate
  10783. the enclosing command before entering the trap or ending the
  10784. script. This can lead to spurious errors:
  10785. $ sh -c 'if test `sleep 5; echo hi` = hi; then echo yes; fi'
  10786. $ ^C
  10787. sh: test: hi: unexpected operator/operand
  10788. You can avoid this by assigning the command substitution to a
  10789. temporary variable:
  10790. $ sh -c 'res=`sleep 5; echo hi`
  10791. if test "x$res" = xhi; then echo yes; fi'
  10792. $ ^C
  10793. `$(COMMANDS)'
  10794. This construct is meant to replace ``COMMANDS`', and it has most
  10795. of the problems listed under ``COMMANDS`'.
  10796. This construct can be nested while this is impossible to do
  10797. portably with back quotes. Unfortunately it is not yet
  10798. universally supported. Most notably, even recent releases of
  10799. Solaris don't support it:
  10800. $ showrev -c /bin/sh | grep version
  10801. Command version: SunOS 5.10 Generic 121005-03 Oct 2006
  10802. $ echo $(echo blah)
  10803. syntax error: `(' unexpected
  10804. nor does IRIX 6.5's Bourne shell:
  10805. $ uname -a
  10806. IRIX firebird-image 6.5 07151432 IP22
  10807. $ echo $(echo blah)
  10808. $(echo blah)
  10809. If you do use `$(COMMANDS)', make sure that the commands do not
  10810. start with a parenthesis, as that would cause confusion with a
  10811. different notation `$((EXPRESSION))' that in modern shells is an
  10812. arithmetic expression not a command. To avoid the confusion,
  10813. insert a space between the two opening parentheses.
  10814. Avoid COMMANDS that contain unbalanced parentheses in
  10815. here-documents, comments, or case statement patterns, as many
  10816. shells mishandle them. For example, Bash 3.1, `ksh88', `pdksh'
  10817. 5.2.14, and Zsh 4.2.6 all mishandle the following valid command:
  10818. echo $(case x in x) echo hello;; esac)
  10819. `$((EXPRESSION))'
  10820. Arithmetic expansion is not portable as some shells (most notably
  10821. Solaris 10 `/bin/sh') don't support it.
  10822. Among shells that do support `$(( ))', not all of them obey the
  10823. Posix rule that octal and hexadecimal constants must be recognized:
  10824. $ bash -c 'echo $(( 010 + 0x10 ))'
  10825. 24
  10826. $ zsh -c 'echo $(( 010 + 0x10 ))'
  10827. 26
  10828. $ zsh -c 'emulate sh; echo $(( 010 + 0x10 ))'
  10829. 24
  10830. $ pdksh -c 'echo $(( 010 + 0x10 ))'
  10831. pdksh: 010 + 0x10 : bad number `0x10'
  10832. $ pdksh -c 'echo $(( 010 ))'
  10833. 10
  10834. When it is available, using arithmetic expansion provides a
  10835. noticeable speedup in script execution; but testing for support
  10836. requires `eval' to avoid syntax errors. The following construct
  10837. is used by `AS_VAR_ARITH' to provide arithmetic computation when
  10838. all arguments are provided in decimal and without a leading zero,
  10839. and all operators are properly quoted and appear as distinct
  10840. arguments:
  10841. if ( eval 'test $(( 1 + 1 )) = 2' ) 2>/dev/null; then
  10842. eval 'func_arith ()
  10843. {
  10844. func_arith_result=$(( $* ))
  10845. }'
  10846. else
  10847. func_arith ()
  10848. {
  10849. func_arith_result=`expr "$@"`
  10850. }
  10851. fi
  10852. func_arith 1 + 1
  10853. foo=$func_arith_result
  10854. `^'
  10855. Always quote `^', otherwise traditional shells such as `/bin/sh'
  10856. on Solaris 10 treat this like `|'.
  10857. 
  10858. File: autoconf.info, Node: Assignments, Next: Parentheses, Prev: Shell Substitutions, Up: Portable Shell
  10859. 11.9 Assignments
  10860. ================
  10861. When setting several variables in a row, be aware that the order of the
  10862. evaluation is undefined. For instance `foo=1 foo=2; echo $foo' gives
  10863. `1' with Solaris `/bin/sh', but `2' with Bash. You must use `;' to
  10864. enforce the order: `foo=1; foo=2; echo $foo'.
  10865. Don't rely on the following to find `subdir/program':
  10866. PATH=subdir$PATH_SEPARATOR$PATH program
  10867. as this does not work with Zsh 3.0.6. Use something like this instead:
  10868. (PATH=subdir$PATH_SEPARATOR$PATH; export PATH; exec program)
  10869. Don't rely on the exit status of an assignment: Ash 0.2 does not
  10870. change the status and propagates that of the last statement:
  10871. $ false || foo=bar; echo $?
  10872. 1
  10873. $ false || foo=`:`; echo $?
  10874. 0
  10875. and to make things even worse, QNX 4.25 just sets the exit status to 0
  10876. in any case:
  10877. $ foo=`exit 1`; echo $?
  10878. 0
  10879. To assign default values, follow this algorithm:
  10880. 1. If the default value is a literal and does not contain any closing
  10881. brace, use:
  10882. : "${var='my literal'}"
  10883. 2. If the default value contains no closing brace, has to be
  10884. expanded, and the variable being initialized is not intended to be
  10885. IFS-split (i.e., it's not a list), then use:
  10886. : ${var="$default"}
  10887. 3. If the default value contains no closing brace, has to be
  10888. expanded, and the variable being initialized is intended to be
  10889. IFS-split (i.e., it's a list), then use:
  10890. var=${var="$default"}
  10891. 4. If the default value contains a closing brace, then use:
  10892. test "${var+set}" = set || var="has a '}'"
  10893. In most cases `var=${var="$default"}' is fine, but in case of doubt,
  10894. just use the last form. *Note Shell Substitutions::, items
  10895. `${VAR:-VALUE}' and `${VAR=VALUE}' for the rationale.
  10896. 
  10897. File: autoconf.info, Node: Parentheses, Next: Slashes, Prev: Assignments, Up: Portable Shell
  10898. 11.10 Parentheses in Shell Scripts
  10899. ==================================
  10900. Beware of two opening parentheses in a row, as many shell
  10901. implementations treat them specially, and Posix says that a portable
  10902. script cannot use `((' outside the `$((' form used for shell
  10903. arithmetic. In traditional shells, `((cat))' behaves like `(cat)'; but
  10904. many shells, including Bash and the Korn shell, treat `((cat))' as an
  10905. arithmetic expression equivalent to `let "cat"', and may or may not
  10906. report an error when they detect that `cat' is not a number. As another
  10907. example, `pdksh' 5.2.14 does not treat the following code as a
  10908. traditional shell would:
  10909. if ((true) || false); then
  10910. echo ok
  10911. fi
  10912. To work around this problem, insert a space between the two opening
  10913. parentheses. There is a similar problem and workaround with `$(('; see
  10914. *note Shell Substitutions::.
  10915. 
  10916. File: autoconf.info, Node: Slashes, Next: Special Shell Variables, Prev: Parentheses, Up: Portable Shell
  10917. 11.11 Slashes in Shell Scripts
  10918. ==============================
  10919. Unpatched Tru64 5.1 `sh' omits the last slash of command-line arguments
  10920. that contain two trailing slashes:
  10921. $ echo / // /// //// .// //.
  10922. / / // /// ./ //.
  10923. $ x=//
  10924. $ eval "echo \$x"
  10925. /
  10926. $ set -x
  10927. $ echo abc | tr -t ab //
  10928. + echo abc
  10929. + tr -t ab /
  10930. /bc
  10931. Unpatched Tru64 4.0 `sh' adds a slash after `"$var"' if the variable
  10932. is empty and the second double-quote is followed by a word that begins
  10933. and ends with slash:
  10934. $ sh -xc 'p=; echo "$p"/ouch/'
  10935. p=
  10936. + echo //ouch/
  10937. //ouch/
  10938. However, our understanding is that patches are available, so perhaps
  10939. it's not worth worrying about working around these horrendous bugs.
  10940. 
  10941. File: autoconf.info, Node: Special Shell Variables, Next: Shell Functions, Prev: Slashes, Up: Portable Shell
  10942. 11.12 Special Shell Variables
  10943. =============================
  10944. Some shell variables should not be used, since they can have a deep
  10945. influence on the behavior of the shell. In order to recover a sane
  10946. behavior from the shell, some variables should be unset; M4sh takes
  10947. care of this and provides fallback values, whenever needed, to cater
  10948. for a very old `/bin/sh' that does not support `unset'. (*note
  10949. Portable Shell Programming: Portable Shell.).
  10950. As a general rule, shell variable names containing a lower-case
  10951. letter are safe; you can define and use these variables without
  10952. worrying about their effect on the underlying system, and without
  10953. worrying about whether the shell changes them unexpectedly. (The
  10954. exception is the shell variable `status', as described below.)
  10955. Here is a list of names that are known to cause trouble. This list
  10956. is not exhaustive, but you should be safe if you avoid the name
  10957. `status' and names containing only upper-case letters and underscores.
  10958. `?'
  10959. Not all shells correctly reset `$?' after conditionals (*note
  10960. Limitations of Shell Builtins: if.). Not all shells manage `$?'
  10961. correctly in shell functions (*note Shell Functions::) or in traps
  10962. (*note Limitations of Shell Builtins: trap.). Not all shells reset
  10963. `$?' to zero after an empty command.
  10964. $ bash -c 'false; $empty; echo $?'
  10965. 0
  10966. $ zsh -c 'false; $empty; echo $?'
  10967. 1
  10968. `_'
  10969. Many shells reserve `$_' for various purposes, e.g., the name of
  10970. the last command executed.
  10971. `BIN_SH'
  10972. In Tru64, if `BIN_SH' is set to `xpg4', subsidiary invocations of
  10973. the standard shell conform to Posix.
  10974. `CDPATH'
  10975. When this variable is set it specifies a list of directories to
  10976. search when invoking `cd' with a relative file name that did not
  10977. start with `./' or `../'. Posix 1003.1-2001 says that if a
  10978. nonempty directory name from `CDPATH' is used successfully, `cd'
  10979. prints the resulting absolute file name. Unfortunately this
  10980. output can break idioms like `abs=`cd src && pwd`' because `abs'
  10981. receives the name twice. Also, many shells do not conform to this
  10982. part of Posix; for example, `zsh' prints the result only if a
  10983. directory name other than `.' was chosen from `CDPATH'.
  10984. In practice the shells that have this problem also support
  10985. `unset', so you can work around the problem as follows:
  10986. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  10987. You can also avoid output by ensuring that your directory name is
  10988. absolute or anchored at `./', as in `abs=`cd ./src && pwd`'.
  10989. Configure scripts use M4sh, which automatically unsets `CDPATH' if
  10990. possible, so you need not worry about this problem in those
  10991. scripts.
  10992. `CLICOLOR_FORCE'
  10993. When this variable is set, some implementations of tools like `ls'
  10994. attempt to add color to their output via terminal escape
  10995. sequences, even when the output is not directed to a terminal, and
  10996. can thus cause spurious failures in scripts. Configure scripts
  10997. use M4sh, which automatically unsets this variable.
  10998. `DUALCASE'
  10999. In the MKS shell, case statements and file name generation are
  11000. case-insensitive unless `DUALCASE' is nonzero. Autoconf-generated
  11001. scripts export this variable when they start up.
  11002. `ENV'
  11003. `MAIL'
  11004. `MAILPATH'
  11005. `PS1'
  11006. `PS2'
  11007. `PS4'
  11008. These variables should not matter for shell scripts, since they are
  11009. supposed to affect only interactive shells. However, at least one
  11010. shell (the pre-3.0 UWIN Korn shell) gets confused about whether it
  11011. is interactive, which means that (for example) a `PS1' with a side
  11012. effect can unexpectedly modify `$?'. To work around this bug,
  11013. M4sh scripts (including `configure' scripts) do something like
  11014. this:
  11015. (unset ENV) >/dev/null 2>&1 && unset ENV MAIL MAILPATH
  11016. PS1='$ '
  11017. PS2='> '
  11018. PS4='+ '
  11019. (actually, there is some complication due to bugs in `unset';
  11020. *note Limitations of Shell Builtins: unset.).
  11021. `FPATH'
  11022. The Korn shell uses `FPATH' to find shell functions, so avoid
  11023. `FPATH' in portable scripts. `FPATH' is consulted after `PATH',
  11024. but you still need to be wary of tests that use `PATH' to find
  11025. whether a command exists, since they might report the wrong result
  11026. if `FPATH' is also set.
  11027. `GREP_OPTIONS'
  11028. When this variable is set, some implementations of `grep' honor
  11029. these options, even if the options include direction to enable
  11030. colored output via terminal escape sequences, and the result can
  11031. cause spurious failures when the output is not directed to a
  11032. terminal. Configure scripts use M4sh, which automatically unsets
  11033. this variable.
  11034. `IFS'
  11035. Long ago, shell scripts inherited `IFS' from the environment, but
  11036. this caused many problems so modern shells ignore any environment
  11037. settings for `IFS'.
  11038. Don't set the first character of `IFS' to backslash. Indeed,
  11039. Bourne shells use the first character (backslash) when joining the
  11040. components in `"$@"' and some shells then reinterpret (!) the
  11041. backslash escapes, so you can end up with backspace and other
  11042. strange characters.
  11043. The proper value for `IFS' (in regular code, not when performing
  11044. splits) is `<SPC><TAB><RET>'. The first character is especially
  11045. important, as it is used to join the arguments in `$*'; however,
  11046. note that traditional shells, but also bash-2.04, fail to adhere
  11047. to this and join with a space anyway.
  11048. M4sh guarantees that `IFS' will have the default value at the
  11049. beginning of a script, and many macros within autoconf rely on this
  11050. setting. It is okay to use blocks of shell code that temporarily
  11051. change the value of `IFS' in order to split on another character,
  11052. but remember to restore it before expanding further macros.
  11053. Unsetting `IFS' instead of resetting it to the default sequence is
  11054. not suggested, since code that tries to save and restore the
  11055. variable's value will incorrectly reset it to an empty value, thus
  11056. disabling field splitting:
  11057. unset IFS
  11058. # default separators used for field splitting
  11059. save_IFS=$IFS
  11060. IFS=:
  11061. # ...
  11062. IFS=$save_IFS
  11063. # no field splitting performed
  11064. `LANG'
  11065. `LC_ALL'
  11066. `LC_COLLATE'
  11067. `LC_CTYPE'
  11068. `LC_MESSAGES'
  11069. `LC_MONETARY'
  11070. `LC_NUMERIC'
  11071. `LC_TIME'
  11072. You should set all these variables to `C' because so much
  11073. configuration code assumes the C locale and Posix requires that
  11074. locale environment variables be set to `C' if the C locale is
  11075. desired; `configure' scripts and M4sh do that for you. Export
  11076. these variables after setting them.
  11077. `LANGUAGE'
  11078. `LANGUAGE' is not specified by Posix, but it is a GNU extension
  11079. that overrides `LC_ALL' in some cases, so you (or M4sh) should set
  11080. it too.
  11081. `LC_ADDRESS'
  11082. `LC_IDENTIFICATION'
  11083. `LC_MEASUREMENT'
  11084. `LC_NAME'
  11085. `LC_PAPER'
  11086. `LC_TELEPHONE'
  11087. These locale environment variables are GNU extensions. They are
  11088. treated like their Posix brethren (`LC_COLLATE', etc.) as
  11089. described above.
  11090. `LINENO'
  11091. Most modern shells provide the current line number in `LINENO'.
  11092. Its value is the line number of the beginning of the current
  11093. command. M4sh, and hence Autoconf, attempts to execute
  11094. `configure' with a shell that supports `LINENO'. If no such shell
  11095. is available, it attempts to implement `LINENO' with a Sed prepass
  11096. that replaces each instance of the string `$LINENO' (not followed
  11097. by an alphanumeric character) with the line's number. In M4sh
  11098. scripts you should execute `AS_LINENO_PREPARE' so that these
  11099. workarounds are included in your script; configure scripts do this
  11100. automatically in `AC_INIT'.
  11101. You should not rely on `LINENO' within `eval' or shell functions,
  11102. as the behavior differs in practice. The presence of a quoted
  11103. newline within simple commands can alter which line number is used
  11104. as the starting point for `$LINENO' substitutions within that
  11105. command. Also, the possibility of the Sed prepass means that you
  11106. should not rely on `$LINENO' when quoted, when in here-documents,
  11107. or when line continuations are used. Subshells should be OK,
  11108. though. In the following example, lines 1, 9, and 14 are
  11109. portable, but the other instances of `$LINENO' do not have
  11110. deterministic values:
  11111. $ cat lineno
  11112. echo 1. $LINENO
  11113. echo "2. $LINENO
  11114. 3. $LINENO"
  11115. cat <<EOF
  11116. 5. $LINENO
  11117. 6. $LINENO
  11118. 7. \$LINENO
  11119. EOF
  11120. ( echo 9. $LINENO )
  11121. eval 'echo 10. $LINENO'
  11122. eval 'echo 11. $LINENO
  11123. echo 12. $LINENO'
  11124. echo 13. '$LINENO'
  11125. echo 14. $LINENO '
  11126. 15.' $LINENO
  11127. f () { echo $1 $LINENO;
  11128. echo $1 $LINENO }
  11129. f 18.
  11130. echo 19. \
  11131. $LINENO
  11132. $ bash-3.2 ./lineno
  11133. 1. 1
  11134. 2. 3
  11135. 3. 3
  11136. 5. 4
  11137. 6. 4
  11138. 7. $LINENO
  11139. 9. 9
  11140. 10. 10
  11141. 11. 12
  11142. 12. 13
  11143. 13. $LINENO
  11144. 14. 14
  11145. 15. 14
  11146. 18. 16
  11147. 18. 17
  11148. 19. 19
  11149. $ zsh-4.3.4 ./lineno
  11150. 1. 1
  11151. 2. 2
  11152. 3. 2
  11153. 5. 4
  11154. 6. 4
  11155. 7. $LINENO
  11156. 9. 9
  11157. 10. 1
  11158. 11. 1
  11159. 12. 2
  11160. 13. $LINENO
  11161. 14. 14
  11162. 15. 14
  11163. 18. 0
  11164. 18. 1
  11165. 19. 19
  11166. $ pdksh-5.2.14 ./lineno
  11167. 1. 1
  11168. 2. 2
  11169. 3. 2
  11170. 5. 4
  11171. 6. 4
  11172. 7. $LINENO
  11173. 9. 9
  11174. 10. 0
  11175. 11. 0
  11176. 12. 0
  11177. 13. $LINENO
  11178. 14. 14
  11179. 15. 14
  11180. 18. 16
  11181. 18. 17
  11182. 19. 19
  11183. $ sed '=' <lineno |
  11184. > sed '
  11185. > N
  11186. > s,$,-,
  11187. > t loop
  11188. > :loop
  11189. > s,^\([0-9]*\)\(.*\)[$]LINENO\([^a-zA-Z0-9_]\),\1\2\1\3,
  11190. > t loop
  11191. > s,-$,,
  11192. > s,^[0-9]*\n,,
  11193. > ' |
  11194. > sh
  11195. 1. 1
  11196. 2. 2
  11197. 3. 3
  11198. 5. 5
  11199. 6. 6
  11200. 7. \7
  11201. 9. 9
  11202. 10. 10
  11203. 11. 11
  11204. 12. 12
  11205. 13. 13
  11206. 14. 14
  11207. 15. 15
  11208. 18. 16
  11209. 18. 17
  11210. 19. 20
  11211. In particular, note that `config.status' (and any other subsidiary
  11212. script created by `AS_INIT_GENERATED') might report line numbers
  11213. relative to the parent script as a result of the potential Sed
  11214. pass.
  11215. `NULLCMD'
  11216. When executing the command `>foo', `zsh' executes `$NULLCMD >foo'
  11217. unless it is operating in Bourne shell compatibility mode and the
  11218. `zsh' version is newer than 3.1.6-dev-18. If you are using an
  11219. older `zsh' and forget to set `NULLCMD', your script might be
  11220. suspended waiting for data on its standard input.
  11221. `options'
  11222. For `zsh' 4.3.10, `options' is treated as an associative array
  11223. even after `emulate sh', so it should not be used.
  11224. `PATH_SEPARATOR'
  11225. On DJGPP systems, the `PATH_SEPARATOR' environment variable can be
  11226. set to either `:' or `;' to control the path separator Bash uses
  11227. to set up certain environment variables (such as `PATH'). You can
  11228. set this variable to `;' if you want `configure' to use `;' as a
  11229. separator; this might be useful if you plan to use non-Posix
  11230. shells to execute files. *Note File System Conventions::, for
  11231. more information about `PATH_SEPARATOR'.
  11232. `POSIXLY_CORRECT'
  11233. In the GNU environment, exporting `POSIXLY_CORRECT' with any value
  11234. (even empty) causes programs to try harder to conform to Posix.
  11235. Autoconf does not directly manipulate this variable, but `bash'
  11236. ties the shell variable `POSIXLY_CORRECT' to whether the script is
  11237. running in Posix mode. Therefore, take care when exporting or
  11238. unsetting this variable, so as not to change whether `bash' is in
  11239. Posix mode.
  11240. $ bash --posix -c 'set -o | grep posix
  11241. > unset POSIXLY_CORRECT
  11242. > set -o | grep posix'
  11243. posix on
  11244. posix off
  11245. `PWD'
  11246. Posix 1003.1-2001 requires that `cd' and `pwd' must update the
  11247. `PWD' environment variable to point to the logical name of the
  11248. current directory, but traditional shells do not support this.
  11249. This can cause confusion if one shell instance maintains `PWD' but
  11250. a subsidiary and different shell does not know about `PWD' and
  11251. executes `cd'; in this case `PWD' points to the wrong directory.
  11252. Use ``pwd`' rather than `$PWD'.
  11253. `RANDOM'
  11254. Many shells provide `RANDOM', a variable that returns a different
  11255. integer each time it is used. Most of the time, its value does not
  11256. change when it is not used, but on IRIX 6.5 the value changes all
  11257. the time. This can be observed by using `set'. It is common
  11258. practice to use `$RANDOM' as part of a file name, but code
  11259. shouldn't rely on `$RANDOM' expanding to a nonempty string.
  11260. `status'
  11261. This variable is an alias to `$?' for `zsh' (at least 3.1.6),
  11262. hence read-only. Do not use it.
  11263. 
  11264. File: autoconf.info, Node: Shell Functions, Next: Limitations of Builtins, Prev: Special Shell Variables, Up: Portable Shell
  11265. 11.13 Shell Functions
  11266. =====================
  11267. Nowadays, it is difficult to find a shell that does not support shell
  11268. functions at all. However, some differences should be expected.
  11269. When declaring a shell function, you must include whitespace between
  11270. the `)' after the function name and the start of the compound
  11271. expression, to avoid upsetting `ksh'. While it is possible to use any
  11272. compound command, most scripts use `{...}'.
  11273. $ /bin/sh -c 'a(){ echo hi;}; a'
  11274. hi
  11275. $ ksh -c 'a(){ echo hi;}; a'
  11276. ksh: syntax error at line 1: `}' unexpected
  11277. $ ksh -c 'a() { echo hi;}; a'
  11278. hi
  11279. Inside a shell function, you should not rely on the error status of a
  11280. subshell if the last command of that subshell was `exit' or `trap', as
  11281. this triggers bugs in zsh 4.x; while Autoconf tries to find a shell
  11282. that does not exhibit the bug, zsh might be the only shell present on
  11283. the user's machine.
  11284. Likewise, the state of `$?' is not reliable when entering a shell
  11285. function. This has the effect that using a function as the first
  11286. command in a `trap' handler can cause problems.
  11287. $ bash -c 'foo() { echo $?; }; trap foo 0; (exit 2); exit 2'; echo $?
  11288. 2
  11289. 2
  11290. $ ash -c 'foo() { echo $?; }; trap foo 0; (exit 2); exit 2'; echo $?
  11291. 0
  11292. 2
  11293. DJGPP bash 2.04 has a bug in that `return' from a shell function
  11294. which also used a command substitution causes a segmentation fault. To
  11295. work around the issue, you can use `return' from a subshell, or
  11296. `AS_SET_STATUS' as last command in the execution flow of the function
  11297. (*note Common Shell Constructs::).
  11298. Not all shells treat shell functions as simple commands impacted by
  11299. `set -e', for example with Solaris 10 `/bin/sh':
  11300. $ bash -c 'f() { return 1; }; set -e; f; echo oops'
  11301. $ /bin/sh -c 'f() { return 1; }; set -e; f; echo oops'
  11302. oops
  11303. Shell variables and functions may share the same namespace, for
  11304. example with Solaris 10 `/bin/sh':
  11305. $ f () { :; }; f=; f
  11306. f: not found
  11307. For this reason, Autoconf (actually M4sh, *note Programming in M4sh::)
  11308. uses the prefix `as_fn_' for its functions.
  11309. Handling of positional parameters and shell options varies among
  11310. shells. For example, Korn shells reset and restore trace output (`set
  11311. -x') and other options upon function entry and exit. Inside a function,
  11312. IRIX sh sets `$0' to the function name.
  11313. It is not portable to pass temporary environment variables to shell
  11314. functions. Solaris `/bin/sh' does not see the variable. Meanwhile,
  11315. not all shells follow the Posix rule that the assignment must affect
  11316. the current environment in the same manner as special built-ins.
  11317. $ /bin/sh -c 'func() { echo $a;}; a=1 func; echo $a'
  11318. =>
  11319. =>
  11320. $ ash -c 'func() { echo $a;}; a=1 func; echo $a'
  11321. =>1
  11322. =>
  11323. $ bash -c 'set -o posix; func() { echo $a;}; a=1 func; echo $a'
  11324. =>1
  11325. =>1
  11326. Some ancient Bourne shell variants with function support did not
  11327. reset `$I, I >= 0', upon function exit, so effectively the arguments of
  11328. the script were lost after the first function invocation. It is
  11329. probably not worth worrying about these shells any more.
  11330. With AIX sh, a `trap' on 0 installed in a shell function triggers at
  11331. function exit rather than at script exit. *Note Limitations of Shell
  11332. Builtins: trap.
  11333. 
  11334. File: autoconf.info, Node: Limitations of Builtins, Next: Limitations of Usual Tools, Prev: Shell Functions, Up: Portable Shell
  11335. 11.14 Limitations of Shell Builtins
  11336. ===================================
  11337. No, no, we are serious: some shells do have limitations! :)
  11338. You should always keep in mind that any builtin or command may
  11339. support options, and therefore differ in behavior with arguments
  11340. starting with a dash. For instance, even the innocent `echo "$word"'
  11341. can give unexpected results when `word' starts with a dash. It is
  11342. often possible to avoid this problem using `echo "x$word"', taking the
  11343. `x' into account later in the pipe. Many of these limitations can be
  11344. worked around using M4sh (*note Programming in M4sh::).
  11345. `.'
  11346. Use `.' only with regular files (use `test -f'). Bash 2.03, for
  11347. instance, chokes on `. /dev/null'. Remember that `.' uses `PATH'
  11348. if its argument contains no slashes. Also, some shells, including
  11349. bash 3.2, implicitly append the current directory to this `PATH'
  11350. search, even though Posix forbids it. So if you want to use `.'
  11351. on a file `foo' in the current directory, you must use `. ./foo'.
  11352. Not all shells gracefully handle syntax errors within a sourced
  11353. file. On one extreme, some non-interactive shells abort the
  11354. entire script. On the other, `zsh' 4.3.10 has a bug where it
  11355. fails to react to the syntax error.
  11356. $ echo 'fi' > syntax
  11357. $ bash -c '. ./syntax; echo $?'
  11358. ./syntax: line 1: syntax error near unexpected token `fi'
  11359. ./syntax: line 1: `fi'
  11360. 1
  11361. $ ash -c '. ./syntax; echo $?'
  11362. ./syntax: 1: Syntax error: "fi" unexpected
  11363. $ zsh -c '. ./syntax; echo $?'
  11364. ./syntax:1: parse error near `fi'
  11365. 0
  11366. `!'
  11367. The Unix version 7 shell did not support negating the exit status
  11368. of commands with `!', and this feature is still absent from some
  11369. shells (e.g., Solaris `/bin/sh'). Other shells, such as FreeBSD
  11370. `/bin/sh' or `ash', have bugs when using `!':
  11371. $ sh -c '! : | :'; echo $?
  11372. 1
  11373. $ ash -c '! : | :'; echo $?
  11374. 0
  11375. $ sh -c '! { :; }'; echo $?
  11376. 1
  11377. $ ash -c '! { :; }'; echo $?
  11378. {: not found
  11379. Syntax error: "}" unexpected
  11380. 2
  11381. Shell code like this:
  11382. if ! cmp file1 file2 >/dev/null 2>&1; then
  11383. echo files differ or trouble
  11384. fi
  11385. is therefore not portable in practice. Typically it is easy to
  11386. rewrite such code, e.g.:
  11387. cmp file1 file2 >/dev/null 2>&1 ||
  11388. echo files differ or trouble
  11389. More generally, one can always rewrite `! COMMAND' as:
  11390. if COMMAND; then (exit 1); else :; fi
  11391. `{...}'
  11392. Bash 3.2 (and earlier versions) sometimes does not properly set
  11393. `$?' when failing to write redirected output of a compound command.
  11394. This problem is most commonly observed with `{...}'; it does not
  11395. occur with `(...)'. For example:
  11396. $ bash -c '{ echo foo; } >/bad; echo $?'
  11397. bash: line 1: /bad: Permission denied
  11398. 0
  11399. $ bash -c 'while :; do echo; done >/bad; echo $?'
  11400. bash: line 1: /bad: Permission denied
  11401. 0
  11402. To work around the bug, prepend `:;':
  11403. $ bash -c ':;{ echo foo; } >/bad; echo $?'
  11404. bash: line 1: /bad: Permission denied
  11405. 1
  11406. Posix requires a syntax error if a brace list has no contents.
  11407. However, not all shells obey this rule; and on shells where empty
  11408. lists are permitted, the effect on `$?' is inconsistent. To avoid
  11409. problems, ensure that a brace list is never empty.
  11410. $ bash -c 'false; { }; echo $?' || echo $?
  11411. bash: line 1: syntax error near unexpected token `}'
  11412. bash: line 1: `false; { }; echo $?'
  11413. 2
  11414. $ zsh -c 'false; { }; echo $?' || echo $?
  11415. 1
  11416. $ pdksh -c 'false; { }; echo $?' || echo $?
  11417. 0
  11418. `break'
  11419. The use of `break 2' etc. is safe.
  11420. `case'
  11421. You don't need to quote the argument; no splitting is performed.
  11422. You don't need the final `;;', but you should use it.
  11423. Posix requires support for `case' patterns with opening
  11424. parentheses like this:
  11425. case $file_name in
  11426. (*.c) echo "C source code";;
  11427. esac
  11428. but the `(' in this example is not portable to many Bourne shell
  11429. implementations, which is a pity for those of us using tools that
  11430. rely on balanced parentheses. For instance, with Solaris
  11431. `/bin/sh':
  11432. $ case foo in (foo) echo foo;; esac
  11433. error-->syntax error: `(' unexpected
  11434. The leading `(' can be omitted safely. Unfortunately, there are
  11435. contexts where unbalanced parentheses cause other problems, such
  11436. as when using a syntax-highlighting editor that searches for the
  11437. balancing counterpart, or more importantly, when using a case
  11438. statement as an underquoted argument to an Autoconf macro. *Note
  11439. Balancing Parentheses::, for tradeoffs involved in various styles
  11440. of dealing with unbalanced `)'.
  11441. Zsh handles pattern fragments derived from parameter expansions or
  11442. command substitutions as though quoted:
  11443. $ pat=\?; case aa in ?$pat) echo match;; esac
  11444. $ pat=\?; case a? in ?$pat) echo match;; esac
  11445. match
  11446. Because of a bug in its `fnmatch', Bash fails to properly handle
  11447. backslashes in character classes:
  11448. bash-2.02$ case /tmp in [/\\]*) echo OK;; esac
  11449. bash-2.02$
  11450. This is extremely unfortunate, since you are likely to use this
  11451. code to handle Posix or MS-DOS absolute file names. To work
  11452. around this bug, always put the backslash first:
  11453. bash-2.02$ case '\TMP' in [\\/]*) echo OK;; esac
  11454. OK
  11455. bash-2.02$ case /tmp in [\\/]*) echo OK;; esac
  11456. OK
  11457. Many Bourne shells cannot handle closing brackets in character
  11458. classes correctly.
  11459. Some shells also have problems with backslash escaping in case you
  11460. do not want to match the backslash: both a backslash and the
  11461. escaped character match this pattern. To work around this,
  11462. specify the character class in a variable, so that quote removal
  11463. does not apply afterwards, and the special characters don't have
  11464. to be backslash-escaped:
  11465. $ case '\' in [\<]) echo OK;; esac
  11466. OK
  11467. $ scanset='[<]'; case '\' in $scanset) echo OK;; esac
  11468. $
  11469. Even with this, Solaris `ksh' matches a backslash if the set
  11470. contains any of the characters `|', `&', `(', or `)'.
  11471. Conversely, Tru64 `ksh' (circa 2003) erroneously always matches a
  11472. closing parenthesis if not specified in a character class:
  11473. $ case foo in *\)*) echo fail ;; esac
  11474. fail
  11475. $ case foo in *')'*) echo fail ;; esac
  11476. fail
  11477. Some shells, such as Ash 0.3.8, are confused by an empty
  11478. `case'/`esac':
  11479. ash-0.3.8 $ case foo in esac;
  11480. error-->Syntax error: ";" unexpected (expecting ")")
  11481. Posix requires `case' to give an exit status of 0 if no cases
  11482. match. However, `/bin/sh' in Solaris 10 does not obey this rule.
  11483. Meanwhile, it is unclear whether a case that matches, but contains
  11484. no statements, must also change the exit status to 0. The M4sh
  11485. macro `AS_CASE' works around these inconsistencies.
  11486. $ bash -c 'case `false` in ?) ;; esac; echo $?'
  11487. 0
  11488. $ /bin/sh -c 'case `false` in ?) ;; esac; echo $?'
  11489. 255
  11490. `cd'
  11491. Posix 1003.1-2001 requires that `cd' must support the `-L'
  11492. ("logical") and `-P' ("physical") options, with `-L' being the
  11493. default. However, traditional shells do not support these
  11494. options, and their `cd' command has the `-P' behavior.
  11495. Portable scripts should assume neither option is supported, and
  11496. should assume neither behavior is the default. This can be a bit
  11497. tricky, since the Posix default behavior means that, for example,
  11498. `ls ..' and `cd ..' may refer to different directories if the
  11499. current logical directory is a symbolic link. It is safe to use
  11500. `cd DIR' if DIR contains no `..' components. Also,
  11501. Autoconf-generated scripts check for this problem when computing
  11502. variables like `ac_top_srcdir' (*note Configuration Actions::), so
  11503. it is safe to `cd' to these variables.
  11504. Posix states that behavior is undefined if `cd' is given an
  11505. explicit empty argument. Some shells do nothing, some change to
  11506. the first entry in `CDPATH', some change to `HOME', and some exit
  11507. the shell rather than returning an error. Unfortunately, this
  11508. means that if `$var' is empty, then `cd "$var"' is less predictable
  11509. than `cd $var' (at least the latter is well-behaved in all shells
  11510. at changing to `HOME', although this is probably not what you
  11511. wanted in a script). You should check that a directory name was
  11512. supplied before trying to change locations.
  11513. *Note Special Shell Variables::, for portability problems involving
  11514. `cd' and the `CDPATH' environment variable. Also please see the
  11515. discussion of the `pwd' command.
  11516. `echo'
  11517. The simple `echo' is probably the most surprising source of
  11518. portability troubles. It is not possible to use `echo' portably
  11519. unless both options and escape sequences are omitted. Don't
  11520. expect any option.
  11521. Do not use backslashes in the arguments, as there is no consensus
  11522. on their handling. For `echo '\n' | wc -l', the `sh' of Solaris
  11523. outputs 2, but Bash and Zsh (in `sh' emulation mode) output 1.
  11524. The problem is truly `echo': all the shells understand `'\n'' as
  11525. the string composed of a backslash and an `n'. Within a command
  11526. substitution, `echo 'string\c'' will mess up the internal state of
  11527. ksh88 on AIX 6.1 so that it will print the first character `s'
  11528. only, followed by a newline, and then entirely drop the output of
  11529. the next echo in a command substitution.
  11530. Because of these problems, do not pass a string containing
  11531. arbitrary characters to `echo'. For example, `echo "$foo"' is safe
  11532. only if you know that FOO's value cannot contain backslashes and
  11533. cannot start with `-'.
  11534. If this may not be true, `printf' is in general safer and easier
  11535. to use than `echo' and `echo -n'. Thus, scripts where portability
  11536. is not a major concern should use `printf '%s\n'' whenever `echo'
  11537. could fail, and similarly use `printf %s' instead of `echo -n'.
  11538. For portable shell scripts, instead, it is suggested to use a
  11539. here-document like this:
  11540. cat <<EOF
  11541. $foo
  11542. EOF
  11543. Alternatively, M4sh provides `AS_ECHO' and `AS_ECHO_N' macros
  11544. which choose between various portable implementations: `echo' or
  11545. `print' where they work, `printf' if it is available, or else
  11546. other creative tricks in order to work around the above problems.
  11547. `eval'
  11548. The `eval' command is useful in limited circumstances, e.g., using
  11549. commands like `eval table_$key=\$value' and `eval
  11550. value=table_$key' to simulate a hash table when the key is known
  11551. to be alphanumeric.
  11552. You should also be wary of common bugs in `eval' implementations.
  11553. In some shell implementations (e.g., older `ash', OpenBSD 3.8
  11554. `sh', `pdksh' v5.2.14 99/07/13.2, and `zsh' 4.2.5), the arguments
  11555. of `eval' are evaluated in a context where `$?' is 0, so they
  11556. exhibit behavior like this:
  11557. $ false; eval 'echo $?'
  11558. 0
  11559. The correct behavior here is to output a nonzero value, but
  11560. portable scripts should not rely on this.
  11561. You should not rely on `LINENO' within `eval'. *Note Special
  11562. Shell Variables::.
  11563. Note that, even though these bugs are easily avoided, `eval' is
  11564. tricky to use on arbitrary arguments. It is obviously unwise to
  11565. use `eval $cmd' if the string value of `cmd' was derived from an
  11566. untrustworthy source. But even if the string value is valid,
  11567. `eval $cmd' might not work as intended, since it causes field
  11568. splitting and file name expansion to occur twice, once for the
  11569. `eval' and once for the command itself. It is therefore safer to
  11570. use `eval "$cmd"'. For example, if CMD has the value `cat
  11571. test?.c', `eval $cmd' might expand to the equivalent of `cat
  11572. test;.c' if there happens to be a file named `test;.c' in the
  11573. current directory; and this in turn mistakenly attempts to invoke
  11574. `cat' on the file `test' and then execute the command `.c'. To
  11575. avoid this problem, use `eval "$cmd"' rather than `eval $cmd'.
  11576. However, suppose that you want to output the text of the evaluated
  11577. command just before executing it. Assuming the previous example,
  11578. `echo "Executing: $cmd"' outputs `Executing: cat test?.c', but
  11579. this output doesn't show the user that `test;.c' is the actual name
  11580. of the copied file. Conversely, `eval "echo Executing: $cmd"'
  11581. works on this example, but it fails with `cmd='cat foo >bar'',
  11582. since it mistakenly replaces the contents of `bar' by the string
  11583. `cat foo'. No simple, general, and portable solution to this
  11584. problem is known.
  11585. `exec'
  11586. Posix describes several categories of shell built-ins. Special
  11587. built-ins (such as `exit') must impact the environment of the
  11588. current shell, and need not be available through `exec'. All
  11589. other built-ins are regular, and must not propagate variable
  11590. assignments to the environment of the current shell. However, the
  11591. group of regular built-ins is further distinguished by commands
  11592. that do not require a `PATH' search (such as `cd'), in contrast to
  11593. built-ins that are offered as a more efficient version of
  11594. something that must still be found in a `PATH' search (such as
  11595. `echo'). Posix is not clear on whether `exec' must work with the
  11596. list of 17 utilities that are invoked without a `PATH' search, and
  11597. many platforms lack an executable for some of those built-ins:
  11598. $ sh -c 'exec cd /tmp'
  11599. sh: line 0: exec: cd: not found
  11600. All other built-ins that provide utilities specified by Posix must
  11601. have a counterpart executable that exists on `PATH', although Posix
  11602. allows `exec' to use the built-in instead of the executable. For
  11603. example, contrast `bash' 3.2 and `pdksh' 5.2.14:
  11604. $ bash -c 'pwd --version' | head -n1
  11605. bash: line 0: pwd: --: invalid option
  11606. pwd: usage: pwd [-LP]
  11607. $ bash -c 'exec pwd --version' | head -n1
  11608. pwd (GNU coreutils) 6.10
  11609. $ pdksh -c 'exec pwd --version' | head -n1
  11610. pdksh: pwd: --: unknown option
  11611. When it is desired to avoid a regular shell built-in, the
  11612. workaround is to use some other forwarding command, such as `env'
  11613. or `nice', that will ensure a path search:
  11614. $ pdksh -c 'exec true --version' | head -n1
  11615. $ pdksh -c 'nice true --version' | head -n1
  11616. true (GNU coreutils) 6.10
  11617. $ pdksh -c 'env true --version' | head -n1
  11618. true (GNU coreutils) 6.10
  11619. `exit'
  11620. The default value of `exit' is supposed to be `$?'; unfortunately,
  11621. some shells, such as the DJGPP port of Bash 2.04, just perform
  11622. `exit 0'.
  11623. bash-2.04$ foo=`exit 1` || echo fail
  11624. fail
  11625. bash-2.04$ foo=`(exit 1)` || echo fail
  11626. fail
  11627. bash-2.04$ foo=`(exit 1); exit` || echo fail
  11628. bash-2.04$
  11629. Using `exit $?' restores the expected behavior.
  11630. Some shell scripts, such as those generated by `autoconf', use a
  11631. trap to clean up before exiting. If the last shell command exited
  11632. with nonzero status, the trap also exits with nonzero status so
  11633. that the invoker can tell that an error occurred.
  11634. Unfortunately, in some shells, such as Solaris `/bin/sh', an exit
  11635. trap ignores the `exit' command's argument. In these shells, a
  11636. trap cannot determine whether it was invoked by plain `exit' or by
  11637. `exit 1'. Instead of calling `exit' directly, use the
  11638. `AC_MSG_ERROR' macro that has a workaround for this problem.
  11639. `export'
  11640. The builtin `export' dubs a shell variable "environment variable".
  11641. Each update of exported variables corresponds to an update of the
  11642. environment variables. Conversely, each environment variable
  11643. received by the shell when it is launched should be imported as a
  11644. shell variable marked as exported.
  11645. Alas, many shells, such as Solaris `/bin/sh', IRIX 6.3, IRIX 5.2,
  11646. AIX 4.1.5, and Digital Unix 4.0, forget to `export' the
  11647. environment variables they receive. As a result, two variables
  11648. coexist: the environment variable and the shell variable. The
  11649. following code demonstrates this failure:
  11650. #!/bin/sh
  11651. echo $FOO
  11652. FOO=bar
  11653. echo $FOO
  11654. exec /bin/sh $0
  11655. when run with `FOO=foo' in the environment, these shells print
  11656. alternately `foo' and `bar', although they should print only `foo'
  11657. and then a sequence of `bar's.
  11658. Therefore you should `export' again each environment variable that
  11659. you update; the export can occur before or after the assignment.
  11660. Posix is not clear on whether the `export' of an undefined
  11661. variable causes the variable to be defined with the value of an
  11662. empty string, or merely marks any future definition of a variable
  11663. by that name for export. Various shells behave differently in
  11664. this regard:
  11665. $ sh -c 'export foo; env | grep foo'
  11666. $ ash -c 'export foo; env | grep foo'
  11667. foo=
  11668. Posix requires `export' to honor assignments made as arguments,
  11669. but older shells do not support this, including `/bin/sh' in
  11670. Solaris 10. Portable scripts should separate assignments and
  11671. exports into different statements.
  11672. $ bash -c 'export foo=bar; echo $foo'
  11673. bar
  11674. $ /bin/sh -c 'export foo=bar; echo $foo'
  11675. /bin/sh: foo=bar: is not an identifier
  11676. $ /bin/sh -c 'export foo; foo=bar; echo $foo'
  11677. bar
  11678. `false'
  11679. Don't expect `false' to exit with status 1: in native Solaris
  11680. `/bin/false' exits with status 255.
  11681. `for'
  11682. To loop over positional arguments, use:
  11683. for arg
  11684. do
  11685. echo "$arg"
  11686. done
  11687. You may _not_ leave the `do' on the same line as `for', since some
  11688. shells improperly grok:
  11689. for arg; do
  11690. echo "$arg"
  11691. done
  11692. If you want to explicitly refer to the positional arguments, given
  11693. the `$@' bug (*note Shell Substitutions::), use:
  11694. for arg in ${1+"$@"}; do
  11695. echo "$arg"
  11696. done
  11697. But keep in mind that Zsh, even in Bourne shell emulation mode,
  11698. performs word splitting on `${1+"$@"}'; see *note Shell
  11699. Substitutions::, item `$@', for more.
  11700. In Solaris `/bin/sh', when the list of arguments of a `for' loop
  11701. starts with _unquoted_ tokens looking like variable assignments,
  11702. the loop is not executed on those tokens:
  11703. $ /bin/sh -c 'for v in a=b c=d x e=f; do echo $v; done'
  11704. x
  11705. e=f
  11706. Thankfully, quoting the assignment-like tokens, or starting the
  11707. list with other tokens (including unquoted variable expansion that
  11708. results in an assignment-like result), avoids the problem, so it
  11709. is easy to work around:
  11710. $ /bin/sh -c 'for v in "a=b"; do echo $v; done'
  11711. a=b
  11712. $ /bin/sh -c 'x=a=b; for v in $x c=d; do echo $v; done'
  11713. a=b
  11714. c=d
  11715. `if'
  11716. Using `!' is not portable. Instead of:
  11717. if ! cmp -s file file.new; then
  11718. mv file.new file
  11719. fi
  11720. use:
  11721. if cmp -s file file.new; then :; else
  11722. mv file.new file
  11723. fi
  11724. Or, especially if the "else" branch is short, you can use `||'.
  11725. In M4sh, the `AS_IF' macro provides an easy way to write these
  11726. kinds of conditionals:
  11727. AS_IF([cmp -s file file.new], [], [mv file.new file])
  11728. This is especially useful in other M4 macros, where the "then" and
  11729. "else" branches might be macro arguments.
  11730. Some very old shells did not reset the exit status from an `if'
  11731. with no `else':
  11732. $ if (exit 42); then true; fi; echo $?
  11733. 42
  11734. whereas a proper shell should have printed `0'. But this is no
  11735. longer a portability problem; any shell that supports functions
  11736. gets it correct. However, it explains why some makefiles have
  11737. lengthy constructs:
  11738. if test -f "$file"; then
  11739. install "$file" "$dest"
  11740. else
  11741. :
  11742. fi
  11743. `printf'
  11744. A format string starting with a `-' can cause problems. Bash
  11745. interprets it as an option and gives an error. And `--' to mark
  11746. the end of options is not good in the NetBSD Almquist shell (e.g.,
  11747. 0.4.6) which takes that literally as the format string. Putting
  11748. the `-' in a `%c' or `%s' is probably easiest:
  11749. printf %s -foo
  11750. Bash 2.03 mishandles an escape sequence that happens to evaluate
  11751. to `%':
  11752. $ printf '\045'
  11753. bash: printf: `%': missing format character
  11754. Large outputs may cause trouble. On Solaris 2.5.1 through 10, for
  11755. example, `/usr/bin/printf' is buggy, so when using `/bin/sh' the
  11756. command `printf %010000x 123' normally dumps core.
  11757. Since `printf' is not always a shell builtin, there is a potential
  11758. speed penalty for using `printf '%s\n'' as a replacement for an
  11759. `echo' that does not interpret `\' or leading `-'. With Solaris
  11760. `ksh', it is possible to use `print -r --' for this role instead.
  11761. *Note Limitations of Shell Builtins: echo for a discussion of
  11762. portable alternatives to both `printf' and `echo'.
  11763. `pwd'
  11764. With modern shells, plain `pwd' outputs a "logical" directory
  11765. name, some of whose components may be symbolic links. These
  11766. directory names are in contrast to "physical" directory names,
  11767. whose components are all directories.
  11768. Posix 1003.1-2001 requires that `pwd' must support the `-L'
  11769. ("logical") and `-P' ("physical") options, with `-L' being the
  11770. default. However, traditional shells do not support these
  11771. options, and their `pwd' command has the `-P' behavior.
  11772. Portable scripts should assume neither option is supported, and
  11773. should assume neither behavior is the default. Also, on many hosts
  11774. `/bin/pwd' is equivalent to `pwd -P', but Posix does not require
  11775. this behavior and portable scripts should not rely on it.
  11776. Typically it's best to use plain `pwd'. On modern hosts this
  11777. outputs logical directory names, which have the following
  11778. advantages:
  11779. * Logical names are what the user specified.
  11780. * Physical names may not be portable from one installation host
  11781. to another due to network file system gymnastics.
  11782. * On modern hosts `pwd -P' may fail due to lack of permissions
  11783. to some parent directory, but plain `pwd' cannot fail for this
  11784. reason.
  11785. Also please see the discussion of the `cd' command.
  11786. `read'
  11787. No options are portable, not even support `-r' (Solaris `/bin/sh'
  11788. for example). Tru64/OSF 5.1 `sh' treats `read' as a special
  11789. built-in, so it may exit if input is redirected from a
  11790. non-existent or unreadable file.
  11791. `set'
  11792. With the FreeBSD 6.0 shell, the `set' command (without any
  11793. options) does not sort its output.
  11794. The `set' builtin faces the usual problem with arguments starting
  11795. with a dash. Modern shells such as Bash or Zsh understand `--' to
  11796. specify the end of the options (any argument after `--' is a
  11797. parameter, even `-x' for instance), but many traditional shells
  11798. (e.g., Solaris 10 `/bin/sh') simply stop option processing as soon
  11799. as a non-option argument is found. Therefore, use `dummy' or
  11800. simply `x' to end the option processing, and use `shift' to pop it
  11801. out:
  11802. set x $my_list; shift
  11803. Avoid `set -', e.g., `set - $my_list'. Posix no longer requires
  11804. support for this command, and in traditional shells `set -
  11805. $my_list' resets the `-v' and `-x' options, which makes scripts
  11806. harder to debug.
  11807. Some nonstandard shells do not recognize more than one option
  11808. (e.g., `set -e -x' assigns `-x' to the command line). It is
  11809. better to combine them:
  11810. set -ex
  11811. The option `-e' has historically been underspecified, with enough
  11812. ambiguities to cause numerous differences across various shell
  11813. implementations; see for example this overview
  11814. (http://www.in-ulm.de/~mascheck/various/set-e/), or this link
  11815. (http://www.austingroupbugs.net/view.php?id=52), documenting a
  11816. change to Posix 2008 to match `ksh88' behavior. Note that mixing
  11817. `set -e' and shell functions is asking for surprises:
  11818. set -e
  11819. doit()
  11820. {
  11821. rm file
  11822. echo one
  11823. }
  11824. doit || echo two
  11825. According to the recommendation, `one' should always be output
  11826. regardless of whether the `rm' failed, because it occurs within
  11827. the body of the shell function `doit' invoked on the left side of
  11828. `||', where the effects of `set -e' are not enforced. Likewise,
  11829. `two' should never be printed, since the failure of `rm' does not
  11830. abort the function, such that the status of `doit' is 0.
  11831. The BSD shell has had several problems with the `-e' option.
  11832. Older versions of the BSD shell (circa 1990) mishandled `&&',
  11833. `||', `if', and `case' when `-e' was in effect, causing the shell
  11834. to exit unexpectedly in some cases. This was particularly a
  11835. problem with makefiles, and led to circumlocutions like `sh -c
  11836. 'test -f file || touch file'', where the seemingly-unnecessary `sh
  11837. -c '...'' wrapper works around the bug (*note Failure in Make
  11838. Rules::).
  11839. Even relatively-recent versions of the BSD shell (e.g., OpenBSD
  11840. 3.4) wrongly exit with `-e' if the last command within a compound
  11841. statement fails and is guarded by an `&&' only. For example:
  11842. #! /bin/sh
  11843. set -e
  11844. foo=''
  11845. test -n "$foo" && exit 1
  11846. echo one
  11847. if :; then
  11848. test -n "$foo" && exit 1
  11849. echo two
  11850. test -n "$foo" && exit 1
  11851. fi
  11852. echo three
  11853. does not print `three'. One workaround is to change the last
  11854. instance of `test -n "$foo" && exit 1' to be `if test -n "$foo";
  11855. then exit 1; fi' instead. Another possibility is to warn BSD
  11856. users not to use `sh -e'.
  11857. When `set -e' is in effect, a failed command substitution in
  11858. Solaris `/bin/sh' cannot be ignored, even with `||'.
  11859. $ /bin/sh -c 'set -e; foo=`false` || echo foo; echo bar'
  11860. $ bash -c 'set -e; foo=`false` || echo foo; echo bar'
  11861. foo
  11862. bar
  11863. Moreover, a command substitution, successful or not, causes this
  11864. shell to exit from a failing outer command even in presence of an
  11865. `&&' list:
  11866. $ bash -c 'set -e; false `true` && echo notreached; echo ok'
  11867. ok
  11868. $ sh -c 'set -e; false `true` && echo notreached; echo ok'
  11869. $
  11870. Portable scripts should not use `set -e' if `trap' is used to
  11871. install an exit handler. This is because Tru64/OSF 5.1 `sh'
  11872. sometimes enters the trap handler with the exit status of the
  11873. command prior to the one that triggered the errexit handler:
  11874. $ sh -ec 'trap '\''echo $?'\'' 0; false'
  11875. 0
  11876. $ sh -c 'set -e; trap '\''echo $?'\'' 0; false'
  11877. 1
  11878. Thus, when writing a script in M4sh, rather than trying to rely on
  11879. `set -e', it is better to append `|| AS_EXIT' to any statement
  11880. where it is desirable to abort on failure.
  11881. Job control is not provided by all shells, so the use of `set -m'
  11882. or `set -b' must be done with care. When using `zsh' in native
  11883. mode, asynchronous notification (`set -b') is enabled by default,
  11884. and using `emulate sh' to switch to Posix mode does not clear this
  11885. setting (although asynchronous notification has no impact unless
  11886. job monitoring is also enabled). Also, `zsh' 4.3.10 and earlier
  11887. have a bug where job control can be manipulated in interactive
  11888. shells, but not in subshells or scripts. Furthermore, some
  11889. shells, like `pdksh', fail to treat subshells as interactive, even
  11890. though the parent shell was.
  11891. $ echo $ZSH_VERSION
  11892. 4.3.10
  11893. $ set -m; echo $?
  11894. 0
  11895. $ zsh -c 'set -m; echo $?'
  11896. set: can't change option: -m
  11897. $ (set -m); echo $?
  11898. set: can't change option: -m
  11899. 1
  11900. $ pdksh -ci 'echo $-; (echo $-)'
  11901. cim
  11902. c
  11903. Use of `set -n' (typically via `sh -n script') to validate a
  11904. script is not foolproof. Modern `ksh93' tries to be helpful by
  11905. informing you about better syntax, but switching the script to use
  11906. the suggested syntax in order to silence the warnings would render
  11907. the script no longer portable to older shells:
  11908. $ ksh -nc '``'
  11909. ksh: warning: line 1: `...` obsolete, use $(...)
  11910. 0
  11911. Furthermore, on ancient hosts, such as SunOS 4, `sh -n' could go
  11912. into an infinite loop; even with that bug fixed, Solaris 8
  11913. `/bin/sh' takes extremely long to parse large scripts. Autoconf
  11914. itself uses `sh -n' within its testsuite to check that correct
  11915. scripts were generated, but only after first probing for other
  11916. shell features (such as `test -n "${BASH_VERSION+set}"') that
  11917. indicate a reasonably fast and working implementation.
  11918. `shift'
  11919. Not only is `shift'ing a bad idea when there is nothing left to
  11920. shift, but in addition it is not portable: the shell of MIPS
  11921. RISC/OS 4.52 refuses to do it.
  11922. Don't use `shift 2' etc.; while it in the SVR1 shell (1983), it is
  11923. also absent in many pre-Posix shells.
  11924. `source'
  11925. This command is not portable, as Posix does not require it; use
  11926. `.' instead.
  11927. `test'
  11928. The `test' program is the way to perform many file and string
  11929. tests. It is often invoked by the alternate name `[', but using
  11930. that name in Autoconf code is asking for trouble since it is an M4
  11931. quote character.
  11932. The `-a', `-o', `(', and `)' operands are not present in all
  11933. implementations, and have been marked obsolete by Posix 2008.
  11934. This is because there are inherent ambiguities in using them. For
  11935. example, `test "$1" -a "$2"' looks like a binary operator to check
  11936. whether two strings are both non-empty, but if `$1' is the literal
  11937. `!', then some implementations of `test' treat it as a negation of
  11938. the unary operator `-a'.
  11939. Thus, portable uses of `test' should never have more than four
  11940. arguments, and scripts should use shell constructs like `&&' and
  11941. `||' instead. If you combine `&&' and `||' in the same statement,
  11942. keep in mind that they have equal precedence, so it is often
  11943. better to parenthesize even when this is redundant. For example:
  11944. # Not portable:
  11945. test "X$a" = "X$b" -a \
  11946. '(' "X$c" != "X$d" -o "X$e" = "X$f" ')'
  11947. # Portable:
  11948. test "X$a" = "X$b" &&
  11949. { test "X$c" != "X$d" || test "X$e" = "X$f"; }
  11950. `test' does not process options like most other commands do; for
  11951. example, it does not recognize the `--' argument as marking the
  11952. end of options.
  11953. It is safe to use `!' as a `test' operator. For example, `if test
  11954. ! -d foo; ...' is portable even though `if ! test -d foo; ...' is
  11955. not.
  11956. `test' (files)
  11957. To enable `configure' scripts to support cross-compilation, they
  11958. shouldn't do anything that tests features of the build system
  11959. instead of the host system. But occasionally you may find it
  11960. necessary to check whether some arbitrary file exists. To do so,
  11961. use `test -f', `test -r', or `test -x'. Do not use `test -e',
  11962. because Solaris 10 `/bin/sh' lacks it. To test for symbolic links
  11963. on systems that have them, use `test -h' rather than `test -L';
  11964. either form conforms to Posix 1003.1-2001, but older shells like
  11965. Solaris 8 `/bin/sh' support only `-h'.
  11966. For historical reasons, Posix reluctantly allows implementations of
  11967. `test -x' that will succeed for the root user, even if no execute
  11968. permissions are present. Furthermore, shells do not all agree on
  11969. whether Access Control Lists should affect `test -r', `test -w',
  11970. and `test -x'; some shells base test results strictly on the
  11971. current user id compared to file owner and mode, as if by
  11972. `stat(2)'; while other shells base test results on whether the
  11973. current user has the given right, even if that right is only
  11974. granted by an ACL, as if by `faccessat(2)'. Furthermore, there is
  11975. a classic time of check to time of use race between any use of
  11976. `test' followed by operating on the just-checked file. Therefore,
  11977. it is a good idea to write scripts that actually attempt an
  11978. operation, and are prepared for the resulting failure if
  11979. permission is denied, rather than trying to avoid an operation
  11980. based solely on whether `test' guessed that it might not be
  11981. permitted.
  11982. `test' (strings)
  11983. Posix says that `test "STRING"' succeeds if STRING is not null,
  11984. but this usage is not portable to traditional platforms like
  11985. Solaris 10 `/bin/sh', which mishandle strings like `!' and `-n'.
  11986. Posix also says that `test ! "STRING"', `test -n "STRING"' and
  11987. `test -z "STRING"' work with any string, but many shells (such as
  11988. Solaris, AIX 3.2, UNICOS 10.0.0.6, Digital Unix 4, etc.) get
  11989. confused if STRING looks like an operator:
  11990. $ test -n =
  11991. test: argument expected
  11992. $ test ! -n
  11993. test: argument expected
  11994. $ test -z ")"; echo $?
  11995. 0
  11996. Similarly, Posix says that both `test "STRING1" = "STRING2"' and
  11997. `test "STRING1" != "STRING2"' work for any pairs of strings, but
  11998. in practice this is not true for troublesome strings that look
  11999. like operators or parentheses, or that begin with `-'.
  12000. It is best to protect such strings with a leading `X', e.g., `test
  12001. "XSTRING" != X' rather than `test -n "STRING"' or `test !
  12002. "STRING"'.
  12003. It is common to find variations of the following idiom:
  12004. test -n "`echo $ac_feature | sed 's/[-a-zA-Z0-9_]//g'`" &&
  12005. ACTION
  12006. to take an action when a token matches a given pattern. Such
  12007. constructs should be avoided by using:
  12008. case $ac_feature in
  12009. *[!-a-zA-Z0-9_]*) ACTION;;
  12010. esac
  12011. If the pattern is a complicated regular expression that cannot be
  12012. expressed as a shell pattern, use something like this instead:
  12013. expr "X$ac_feature" : 'X.*[^-a-zA-Z0-9_]' >/dev/null &&
  12014. ACTION
  12015. `expr "XFOO" : "XBAR"' is more robust than `echo "XFOO" | grep
  12016. "^XBAR"', because it avoids problems when `FOO' contains
  12017. backslashes.
  12018. `trap'
  12019. It is safe to trap at least the signals 1, 2, 13, and 15. You can
  12020. also trap 0, i.e., have the `trap' run when the script ends
  12021. (either via an explicit `exit', or the end of the script). The
  12022. trap for 0 should be installed outside of a shell function, or AIX
  12023. 5.3 `/bin/sh' will invoke the trap at the end of this function.
  12024. Posix says that `trap - 1 2 13 15' resets the traps for the
  12025. specified signals to their default values, but many common shells
  12026. (e.g., Solaris `/bin/sh') misinterpret this and attempt to execute
  12027. a "command" named `-' when the specified conditions arise. Posix
  12028. 2008 also added a requirement to support `trap 1 2 13 15' to reset
  12029. traps, as this is supported by a larger set of shells, but there
  12030. are still shells like `dash' that mistakenly try to execute `1'
  12031. instead of resetting the traps. Therefore, there is no portable
  12032. workaround, except for `trap - 0', for which `trap '' 0' is a
  12033. portable substitute.
  12034. Although Posix is not absolutely clear on this point, it is widely
  12035. admitted that when entering the trap `$?' should be set to the exit
  12036. status of the last command run before the trap. The ambiguity can
  12037. be summarized as: "when the trap is launched by an `exit', what is
  12038. the _last_ command run: that before `exit', or `exit' itself?"
  12039. Bash considers `exit' to be the last command, while Zsh and
  12040. Solaris `/bin/sh' consider that when the trap is run it is _still_
  12041. in the `exit', hence it is the previous exit status that the trap
  12042. receives:
  12043. $ cat trap.sh
  12044. trap 'echo $?' 0
  12045. (exit 42); exit 0
  12046. $ zsh trap.sh
  12047. 42
  12048. $ bash trap.sh
  12049. 0
  12050. The portable solution is then simple: when you want to `exit 42',
  12051. run `(exit 42); exit 42', the first `exit' being used to set the
  12052. exit status to 42 for Zsh, and the second to trigger the trap and
  12053. pass 42 as exit status for Bash. In M4sh, this is covered by using
  12054. `AS_EXIT'.
  12055. The shell in FreeBSD 4.0 has the following bug: `$?' is reset to 0
  12056. by empty lines if the code is inside `trap'.
  12057. $ trap 'false
  12058. echo $?' 0
  12059. $ exit
  12060. 0
  12061. Fortunately, this bug only affects `trap'.
  12062. Several shells fail to execute an exit trap that is defined inside
  12063. a subshell, when the last command of that subshell is not a
  12064. builtin. A workaround is to use `exit $?' as the shell builtin.
  12065. $ bash -c '(trap "echo hi" 0; /bin/true)'
  12066. hi
  12067. $ /bin/sh -c '(trap "echo hi" 0; /bin/true)'
  12068. $ /bin/sh -c '(trap "echo hi" 0; /bin/true; exit $?)'
  12069. hi
  12070. Likewise, older implementations of `bash' failed to preserve `$?'
  12071. across an exit trap consisting of a single cleanup command.
  12072. $ bash -c 'trap "/bin/true" 0; exit 2'; echo $?
  12073. 2
  12074. $ bash-2.05b -c 'trap "/bin/true" 0; exit 2'; echo $?
  12075. 0
  12076. $ bash-2.05b -c 'trap ":; /bin/true" 0; exit 2'; echo $?
  12077. 2
  12078. `true'
  12079. Don't worry: as far as we know `true' is portable. Nevertheless,
  12080. it's not always a builtin (e.g., Bash 1.x), and the portable shell
  12081. community tends to prefer using `:'. This has a funny side
  12082. effect: when asked whether `false' is more portable than `true'
  12083. Alexandre Oliva answered:
  12084. In a sense, yes, because if it doesn't exist, the shell will
  12085. produce an exit status of failure, which is correct for
  12086. `false', but not for `true'.
  12087. Remember that even though `:' ignores its arguments, it still takes
  12088. time to compute those arguments. It is a good idea to use double
  12089. quotes around any arguments to `:' to avoid time spent in field
  12090. splitting and file name expansion.
  12091. `unset'
  12092. In some nonconforming shells (e.g., Solaris 10 `/bin/ksh' and
  12093. `/usr/xpg4/bin/sh', NetBSD 5.99.43 sh, or Bash 2.05a), `unset FOO'
  12094. fails when `FOO' is not set. This can interfere with `set -e'
  12095. operation. You can use
  12096. FOO=; unset FOO
  12097. if you are not sure that `FOO' is set.
  12098. A few ancient shells lack `unset' entirely. For some variables
  12099. such as `PS1', you can use a neutralizing value instead:
  12100. PS1='$ '
  12101. Usually, shells that do not support `unset' need less effort to
  12102. make the environment sane, so for example is not a problem if you
  12103. cannot unset `CDPATH' on those shells. However, Bash 2.01
  12104. mishandles `unset MAIL' and `unset MAILPATH' in some cases and
  12105. dumps core. So, you should do something like
  12106. ( (unset MAIL) || exit 1) >/dev/null 2>&1 && unset MAIL || :
  12107. *Note Special Shell Variables::, for some neutralizing values.
  12108. Also, see *note Limitations of Builtins: export, for the case of
  12109. environment variables.
  12110. `wait'
  12111. The exit status of `wait' is not always reliable.
  12112. 
  12113. File: autoconf.info, Node: Limitations of Usual Tools, Prev: Limitations of Builtins, Up: Portable Shell
  12114. 11.15 Limitations of Usual Tools
  12115. ================================
  12116. The small set of tools you can expect to find on any machine can still
  12117. include some limitations you should be aware of.
  12118. `awk'
  12119. Don't leave white space before the opening parenthesis in a user
  12120. function call. Posix does not allow this and GNU Awk rejects it:
  12121. $ gawk 'function die () { print "Aaaaarg!" }
  12122. BEGIN { die () }'
  12123. gawk: cmd. line:2: BEGIN { die () }
  12124. gawk: cmd. line:2: ^ parse error
  12125. $ gawk 'function die () { print "Aaaaarg!" }
  12126. BEGIN { die() }'
  12127. Aaaaarg!
  12128. Posix says that if a program contains only `BEGIN' actions, and
  12129. contains no instances of `getline', then the program merely
  12130. executes the actions without reading input. However, traditional
  12131. Awk implementations (such as Solaris 10 `awk') read and discard
  12132. input in this case. Portable scripts can redirect input from
  12133. `/dev/null' to work around the problem. For example:
  12134. awk 'BEGIN {print "hello world"}' </dev/null
  12135. Posix says that in an `END' action, `$NF' (and presumably, `$1')
  12136. retain their value from the last record read, if no intervening
  12137. `getline' occurred. However, some implementations (such as
  12138. Solaris 10 `/usr/bin/awk', `nawk', or Darwin `awk') reset these
  12139. variables. A workaround is to use an intermediate variable prior
  12140. to the `END' block. For example:
  12141. $ cat end.awk
  12142. { tmp = $1 }
  12143. END { print "a", $1, $NF, "b", tmp }
  12144. $ echo 1 | awk -f end.awk
  12145. a b 1
  12146. $ echo 1 | gawk -f end.awk
  12147. a 1 1 b 1
  12148. If you want your program to be deterministic, don't depend on `for'
  12149. on arrays:
  12150. $ cat for.awk
  12151. END {
  12152. arr["foo"] = 1
  12153. arr["bar"] = 1
  12154. for (i in arr)
  12155. print i
  12156. }
  12157. $ gawk -f for.awk </dev/null
  12158. foo
  12159. bar
  12160. $ nawk -f for.awk </dev/null
  12161. bar
  12162. foo
  12163. Some Awk implementations, such as HP-UX 11.0's native one,
  12164. mishandle anchors:
  12165. $ echo xfoo | $AWK '/foo|^bar/ { print }'
  12166. $ echo bar | $AWK '/foo|^bar/ { print }'
  12167. bar
  12168. $ echo xfoo | $AWK '/^bar|foo/ { print }'
  12169. xfoo
  12170. $ echo bar | $AWK '/^bar|foo/ { print }'
  12171. bar
  12172. Either do not depend on such patterns (i.e., use `/^(.*foo|bar)/',
  12173. or use a simple test to reject such implementations.
  12174. On `ia64-hp-hpux11.23', Awk mishandles `printf' conversions after
  12175. `%u':
  12176. $ awk 'BEGIN { printf "%u %d\n", 0, -1 }'
  12177. 0 0
  12178. AIX version 5.2 has an arbitrary limit of 399 on the length of
  12179. regular expressions and literal strings in an Awk program.
  12180. Traditional Awk implementations derived from Unix version 7, such
  12181. as Solaris `/bin/awk', have many limitations and do not conform to
  12182. Posix. Nowadays `AC_PROG_AWK' (*note Particular Programs::) finds
  12183. you an Awk that doesn't have these problems, but if for some
  12184. reason you prefer not to use `AC_PROG_AWK' you may need to address
  12185. them. For more detailed descriptions, see *note `awk' language
  12186. history: (gawk)Language History.
  12187. Traditional Awk does not support multidimensional arrays or
  12188. user-defined functions.
  12189. Traditional Awk does not support the `-v' option. You can use
  12190. assignments after the program instead, e.g., `$AWK '{print v $1}'
  12191. v=x'; however, don't forget that such assignments are not
  12192. evaluated until they are encountered (e.g., after any `BEGIN'
  12193. action).
  12194. Traditional Awk does not support the keywords `delete' or `do'.
  12195. Traditional Awk does not support the expressions `A?B:C', `!A',
  12196. `A^B', or `A^=B'.
  12197. Traditional Awk does not support the predefined `CONVFMT' or
  12198. `ENVIRON' variables.
  12199. Traditional Awk supports only the predefined functions `exp',
  12200. `index', `int', `length', `log', `split', `sprintf', `sqrt', and
  12201. `substr'.
  12202. Traditional Awk `getline' is not at all compatible with Posix;
  12203. avoid it.
  12204. Traditional Awk has `for (i in a) ...' but no other uses of the
  12205. `in' keyword. For example, it lacks `if (i in a) ...'.
  12206. In code portable to both traditional and modern Awk, `FS' must be a
  12207. string containing just one ordinary character, and similarly for
  12208. the field-separator argument to `split'.
  12209. Traditional Awk has a limit of 99 fields in a record. Since some
  12210. Awk implementations, like Tru64's, split the input even if you
  12211. don't refer to any field in the script, to circumvent this
  12212. problem, set `FS' to an unusual character and use `split'.
  12213. Traditional Awk has a limit of at most 99 bytes in a number
  12214. formatted by `OFMT'; for example, `OFMT="%.300e"; print 0.1;'
  12215. typically dumps core.
  12216. The original version of Awk had a limit of at most 99 bytes per
  12217. `split' field, 99 bytes per `substr' substring, and 99 bytes per
  12218. run of non-special characters in a `printf' format, but these bugs
  12219. have been fixed on all practical hosts that we know of.
  12220. HP-UX 11.00 and IRIX 6.5 Awk require that input files have a line
  12221. length of at most 3070 bytes.
  12222. `basename'
  12223. Not all hosts have a working `basename'. You can use `expr'
  12224. instead.
  12225. `cat'
  12226. Don't rely on any option.
  12227. `cc'
  12228. The command `cc -c foo.c' traditionally produces an object file
  12229. named `foo.o'. Most compilers allow `-c' to be combined with `-o'
  12230. to specify a different object file name, but Posix does not
  12231. require this combination and a few compilers lack support for it.
  12232. *Note C Compiler::, for how GNU Make tests for this feature with
  12233. `AC_PROG_CC_C_O'.
  12234. When a compilation such as `cc -o foo foo.c' fails, some compilers
  12235. (such as CDS on Reliant Unix) leave a `foo.o'.
  12236. HP-UX `cc' doesn't accept `.S' files to preprocess and assemble.
  12237. `cc -c foo.S' appears to succeed, but in fact does nothing.
  12238. The default executable, produced by `cc foo.c', can be
  12239. * `a.out' -- usual Posix convention.
  12240. * `b.out' -- i960 compilers (including `gcc').
  12241. * `a.exe' -- DJGPP port of `gcc'.
  12242. * `a_out.exe' -- GNV `cc' wrapper for DEC C on OpenVMS.
  12243. * `foo.exe' -- various MS-DOS compilers.
  12244. The C compiler's traditional name is `cc', but other names like
  12245. `gcc' are common. Posix 1003.1-2001 specifies the name `c99', but
  12246. older Posix editions specified `c89' and anyway these standard
  12247. names are rarely used in practice. Typically the C compiler is
  12248. invoked from makefiles that use `$(CC)', so the value of the `CC'
  12249. make variable selects the compiler name.
  12250. `chgrp'
  12251. `chown'
  12252. It is not portable to change a file's group to a group that the
  12253. owner does not belong to.
  12254. `chmod'
  12255. Avoid usages like `chmod -w file'; use `chmod a-w file' instead,
  12256. for two reasons. First, plain `-w' does not necessarily make the
  12257. file unwritable, since it does not affect mode bits that
  12258. correspond to bits in the file mode creation mask. Second, Posix
  12259. says that the `-w' might be interpreted as an
  12260. implementation-specific option, not as a mode; Posix suggests
  12261. using `chmod -- -w file' to avoid this confusion, but unfortunately
  12262. `--' does not work on some older hosts.
  12263. `cmp'
  12264. `cmp' performs a raw data comparison of two files, while `diff'
  12265. compares two text files. Therefore, if you might compare DOS
  12266. files, even if only checking whether two files are different, use
  12267. `diff' to avoid spurious differences due to differences of newline
  12268. encoding.
  12269. `cp'
  12270. Avoid the `-r' option, since Posix 1003.1-2004 marks it as
  12271. obsolescent and its behavior on special files is
  12272. implementation-defined. Use `-R' instead. On GNU hosts the two
  12273. options are equivalent, but on Solaris hosts (for example) `cp -r'
  12274. reads from pipes instead of replicating them. AIX 5.3 `cp -R' may
  12275. corrupt its own memory with some directory hierarchies and error
  12276. out or dump core:
  12277. mkdir -p 12345678/12345678/12345678/12345678
  12278. touch 12345678/12345678/x
  12279. cp -R 12345678 t
  12280. cp: 0653-440 12345678/12345678/: name too long.
  12281. Some `cp' implementations (e.g., BSD/OS 4.2) do not allow trailing
  12282. slashes at the end of nonexistent destination directories. To
  12283. avoid this problem, omit the trailing slashes. For example, use
  12284. `cp -R source /tmp/newdir' rather than `cp -R source /tmp/newdir/'
  12285. if `/tmp/newdir' does not exist.
  12286. The ancient SunOS 4 `cp' does not support `-f', although its `mv'
  12287. does.
  12288. Traditionally, file timestamps had 1-second resolution, and `cp
  12289. -p' copied the timestamps exactly. However, many modern file
  12290. systems have timestamps with 1-nanosecond resolution.
  12291. Unfortunately, some older `cp -p' implementations truncate
  12292. timestamps when copying files, which can cause the destination
  12293. file to appear to be older than the source. The exact amount of
  12294. truncation depends on the resolution of the system calls that `cp'
  12295. uses. Traditionally this was `utime', which has 1-second
  12296. resolution. Less-ancient `cp' implementations such as GNU Core
  12297. Utilities 5.0.91 (2003) use `utimes', which has 1-microsecond
  12298. resolution. Modern implementations such as GNU Core Utilities
  12299. 6.12 (2008) can set timestamps to the full nanosecond resolution,
  12300. using the modern system calls `futimens' and `utimensat' when they
  12301. are available. As of 2011, though, many platforms do not yet
  12302. fully support these new system calls.
  12303. Bob Proulx notes that `cp -p' always _tries_ to copy ownerships.
  12304. But whether it actually does copy ownerships or not is a system
  12305. dependent policy decision implemented by the kernel. If the
  12306. kernel allows it then it happens. If the kernel does not allow it
  12307. then it does not happen. It is not something `cp' itself has
  12308. control over.
  12309. In Unix System V any user can chown files to any other user, and
  12310. System V also has a non-sticky `/tmp'. That probably derives from
  12311. the heritage of System V in a business environment without hostile
  12312. users. BSD changed this to be a more secure model where only root
  12313. can `chown' files and a sticky `/tmp' is used. That undoubtedly
  12314. derives from the heritage of BSD in a campus environment.
  12315. GNU/Linux and Solaris by default follow BSD, but can be configured
  12316. to allow a System V style `chown'. On the other hand, HP-UX
  12317. follows System V, but can be configured to use the modern security
  12318. model and disallow `chown'. Since it is an
  12319. administrator-configurable parameter you can't use the name of the
  12320. kernel as an indicator of the behavior.
  12321. `date'
  12322. Some versions of `date' do not recognize special `%' directives,
  12323. and unfortunately, instead of complaining, they just pass them
  12324. through, and exit with success:
  12325. $ uname -a
  12326. OSF1 medusa.sis.pasteur.fr V5.1 732 alpha
  12327. $ date "+%s"
  12328. %s
  12329. `diff'
  12330. Option `-u' is nonportable.
  12331. Some implementations, such as Tru64's, fail when comparing to
  12332. `/dev/null'. Use an empty file instead.
  12333. `dirname'
  12334. Not all hosts have a working `dirname', and you should instead use
  12335. `AS_DIRNAME' (*note Programming in M4sh::). For example:
  12336. dir=`dirname "$file"` # This is not portable.
  12337. dir=`AS_DIRNAME(["$file"])` # This is more portable.
  12338. `egrep'
  12339. Posix 1003.1-2001 no longer requires `egrep', but many hosts do
  12340. not yet support the Posix replacement `grep -E'. Also, some
  12341. traditional implementations do not work on long input lines. To
  12342. work around these problems, invoke `AC_PROG_EGREP' and then use
  12343. `$EGREP'.
  12344. Portable extended regular expressions should use `\' only to escape
  12345. characters in the string `$()*+.?[\^{|'. For example, `\}' is not
  12346. portable, even though it typically matches `}'.
  12347. The empty alternative is not portable. Use `?' instead. For
  12348. instance with Digital Unix v5.0:
  12349. > printf "foo\n|foo\n" | $EGREP '^(|foo|bar)$'
  12350. |foo
  12351. > printf "bar\nbar|\n" | $EGREP '^(foo|bar|)$'
  12352. bar|
  12353. > printf "foo\nfoo|\n|bar\nbar\n" | $EGREP '^(foo||bar)$'
  12354. foo
  12355. |bar
  12356. `$EGREP' also suffers the limitations of `grep' (*note Limitations
  12357. of Usual Tools: grep.).
  12358. `expr'
  12359. Not all implementations obey the Posix rule that `--' separates
  12360. options from arguments; likewise, not all implementations provide
  12361. the extension to Posix that the first argument can be treated as
  12362. part of a valid expression rather than an invalid option if it
  12363. begins with `-'. When performing arithmetic, use `expr 0 + $var'
  12364. if `$var' might be a negative number, to keep `expr' from
  12365. interpreting it as an option.
  12366. No `expr' keyword starts with `X', so use `expr X"WORD" :
  12367. 'XREGEX'' to keep `expr' from misinterpreting WORD.
  12368. Don't use `length', `substr', `match' and `index'.
  12369. `expr' (`|')
  12370. You can use `|'. Although Posix does require that `expr '''
  12371. return the empty string, it does not specify the result when you
  12372. `|' together the empty string (or zero) with the empty string. For
  12373. example:
  12374. expr '' \| ''
  12375. Posix 1003.2-1992 returns the empty string for this case, but
  12376. traditional Unix returns `0' (Solaris is one such example). In
  12377. Posix 1003.1-2001, the specification was changed to match
  12378. traditional Unix's behavior (which is bizarre, but it's too late
  12379. to fix this). Please note that the same problem does arise when
  12380. the empty string results from a computation, as in:
  12381. expr bar : foo \| foo : bar
  12382. Avoid this portability problem by avoiding the empty string.
  12383. `expr' (`:')
  12384. Portable `expr' regular expressions should use `\' to escape only
  12385. characters in the string `$()*.0123456789[\^n{}'. For example,
  12386. alternation, `\|', is common but Posix does not require its
  12387. support, so it should be avoided in portable scripts. Similarly,
  12388. `\+' and `\?' should be avoided.
  12389. Portable `expr' regular expressions should not begin with `^'.
  12390. Patterns are automatically anchored so leading `^' is not needed
  12391. anyway.
  12392. On the other hand, the behavior of the `$' anchor is not portable
  12393. on multi-line strings. Posix is ambiguous whether the anchor
  12394. applies to each line, as was done in older versions of the GNU
  12395. Core Utilities, or whether it applies only to the end of the
  12396. overall string, as in Coreutils 6.0 and most other implementations.
  12397. $ baz='foo
  12398. > bar'
  12399. $ expr "X$baz" : 'X\(foo\)$'
  12400. $ expr-5.97 "X$baz" : 'X\(foo\)$'
  12401. foo
  12402. The Posix standard is ambiguous as to whether `expr 'a' : '\(b\)''
  12403. outputs `0' or the empty string. In practice, it outputs the
  12404. empty string on most platforms, but portable scripts should not
  12405. assume this. For instance, the QNX 4.25 native `expr' returns `0'.
  12406. One might think that a way to get a uniform behavior would be to
  12407. use the empty string as a default value:
  12408. expr a : '\(b\)' \| ''
  12409. Unfortunately this behaves exactly as the original expression; see
  12410. the `expr' (`|') entry for more information.
  12411. Some ancient `expr' implementations (e.g., SunOS 4 `expr' and
  12412. Solaris 8 `/usr/ucb/expr') have a silly length limit that causes
  12413. `expr' to fail if the matched substring is longer than 120 bytes.
  12414. In this case, you might want to fall back on `echo|sed' if `expr'
  12415. fails. Nowadays this is of practical importance only for the rare
  12416. installer who mistakenly puts `/usr/ucb' before `/usr/bin' in
  12417. `PATH'.
  12418. On Mac OS X 10.4, `expr' mishandles the pattern `[^-]' in some
  12419. cases. For example, the command
  12420. expr Xpowerpc-apple-darwin8.1.0 : 'X[^-]*-[^-]*-\(.*\)'
  12421. outputs `apple-darwin8.1.0' rather than the correct `darwin8.1.0'.
  12422. This particular case can be worked around by substituting `[^--]'
  12423. for `[^-]'.
  12424. Don't leave, there is some more!
  12425. The QNX 4.25 `expr', in addition of preferring `0' to the empty
  12426. string, has a funny behavior in its exit status: it's always 1
  12427. when parentheses are used!
  12428. $ val=`expr 'a' : 'a'`; echo "$?: $val"
  12429. 0: 1
  12430. $ val=`expr 'a' : 'b'`; echo "$?: $val"
  12431. 1: 0
  12432. $ val=`expr 'a' : '\(a\)'`; echo "?: $val"
  12433. 1: a
  12434. $ val=`expr 'a' : '\(b\)'`; echo "?: $val"
  12435. 1: 0
  12436. In practice this can be a big problem if you are ready to catch
  12437. failures of `expr' programs with some other method (such as using
  12438. `sed'), since you may get twice the result. For instance
  12439. $ expr 'a' : '\(a\)' || echo 'a' | sed 's/^\(a\)$/\1/'
  12440. outputs `a' on most hosts, but `aa' on QNX 4.25. A simple
  12441. workaround consists of testing `expr' and using a variable set to
  12442. `expr' or to `false' according to the result.
  12443. Tru64 `expr' incorrectly treats the result as a number, if it can
  12444. be interpreted that way:
  12445. $ expr 00001 : '.*\(...\)'
  12446. 1
  12447. On HP-UX 11, `expr' only supports a single sub-expression.
  12448. $ expr 'Xfoo' : 'X\(f\(oo\)*\)$'
  12449. expr: More than one '\(' was used.
  12450. `fgrep'
  12451. Posix 1003.1-2001 no longer requires `fgrep', but many hosts do
  12452. not yet support the Posix replacement `grep -F'. Also, some
  12453. traditional implementations do not work on long input lines. To
  12454. work around these problems, invoke `AC_PROG_FGREP' and then use
  12455. `$FGREP'.
  12456. Tru64/OSF 5.1 `fgrep' does not match an empty pattern.
  12457. `find'
  12458. The option `-maxdepth' seems to be GNU specific. Tru64 v5.1,
  12459. NetBSD 1.5 and Solaris `find' commands do not understand it.
  12460. The replacement of `{}' is guaranteed only if the argument is
  12461. exactly _{}_, not if it's only a part of an argument. For
  12462. instance on DU, and HP-UX 10.20 and HP-UX 11:
  12463. $ touch foo
  12464. $ find . -name foo -exec echo "{}-{}" \;
  12465. {}-{}
  12466. while GNU `find' reports `./foo-./foo'.
  12467. `grep'
  12468. Portable scripts can rely on the `grep' options `-c', `-l', `-n',
  12469. and `-v', but should avoid other options. For example, don't use
  12470. `-w', as Posix does not require it and Irix 6.5.16m's `grep' does
  12471. not support it. Also, portable scripts should not combine `-c'
  12472. with `-l', as Posix does not allow this.
  12473. Some of the options required by Posix are not portable in practice.
  12474. Don't use `grep -q' to suppress output, because many `grep'
  12475. implementations (e.g., Solaris) do not support `-q'. Don't use
  12476. `grep -s' to suppress output either, because Posix says `-s' does
  12477. not suppress output, only some error messages; also, the `-s'
  12478. option of traditional `grep' behaved like `-q' does in most modern
  12479. implementations. Instead, redirect the standard output and
  12480. standard error (in case the file doesn't exist) of `grep' to
  12481. `/dev/null'. Check the exit status of `grep' to determine whether
  12482. it found a match.
  12483. The QNX4 implementation fails to count lines with `grep -c '$'',
  12484. but works with `grep -c '^''. Other alternatives for counting
  12485. lines are to use `sed -n '$='' or `wc -l'.
  12486. Some traditional `grep' implementations do not work on long input
  12487. lines. On AIX the default `grep' silently truncates long lines on
  12488. the input before matching.
  12489. Also, many implementations do not support multiple regexps with
  12490. `-e': they either reject `-e' entirely (e.g., Solaris) or honor
  12491. only the last pattern (e.g., IRIX 6.5 and NeXT). To work around
  12492. these problems, invoke `AC_PROG_GREP' and then use `$GREP'.
  12493. Another possible workaround for the multiple `-e' problem is to
  12494. separate the patterns by newlines, for example:
  12495. grep 'foo
  12496. bar' in.txt
  12497. except that this fails with traditional `grep' implementations and
  12498. with OpenBSD 3.8 `grep'.
  12499. Traditional `grep' implementations (e.g., Solaris) do not support
  12500. the `-E' or `-F' options. To work around these problems, invoke
  12501. `AC_PROG_EGREP' and then use `$EGREP', and similarly for
  12502. `AC_PROG_FGREP' and `$FGREP'. Even if you are willing to require
  12503. support for Posix `grep', your script should not use both `-E' and
  12504. `-F', since Posix does not allow this combination.
  12505. Portable `grep' regular expressions should use `\' only to escape
  12506. characters in the string `$()*.0123456789[\^{}'. For example,
  12507. alternation, `\|', is common but Posix does not require its
  12508. support in basic regular expressions, so it should be avoided in
  12509. portable scripts. Solaris and HP-UX `grep' do not support it.
  12510. Similarly, the following escape sequences should also be avoided:
  12511. `\<', `\>', `\+', `\?', `\`', `\'', `\B', `\b', `\S', `\s', `\W',
  12512. and `\w'.
  12513. Posix does not specify the behavior of `grep' on binary files. An
  12514. example where this matters is using BSD `grep' to search text that
  12515. includes embedded ANSI escape sequences for colored output to
  12516. terminals (`\033[m' is the sequence to restore normal output); the
  12517. behavior depends on whether input is seekable:
  12518. $ printf 'esc\033[mape\n' > sample
  12519. $ grep . sample
  12520. Binary file sample matches
  12521. $ cat sample | grep .
  12522. escape
  12523. `join'
  12524. Solaris 8 `join' has bugs when the second operand is standard
  12525. input, and when standard input is a pipe. For example, the
  12526. following shell script causes Solaris 8 `join' to loop forever:
  12527. cat >file <<'EOF'
  12528. 1 x
  12529. 2 y
  12530. EOF
  12531. cat file | join file -
  12532. Use `join - file' instead.
  12533. On NetBSD, `join -a 1 file1 file2' mistakenly behaves like `join
  12534. -a 1 -a 2 1 file1 file2', resulting in a usage warning; the
  12535. workaround is to use `join -a1 file1 file2' instead.
  12536. `ln'
  12537. Don't rely on `ln' having a `-f' option. Symbolic links are not
  12538. available on old systems; use `$(LN_S)' as a portable substitute.
  12539. For versions of the DJGPP before 2.04, `ln' emulates symbolic links
  12540. to executables by generating a stub that in turn calls the real
  12541. program. This feature also works with nonexistent files like in
  12542. the Posix spec. So `ln -s file link' generates `link.exe', which
  12543. attempts to call `file.exe' if run. But this feature only works
  12544. for executables, so `cp -p' is used instead for these systems.
  12545. DJGPP versions 2.04 and later have full support for symbolic links.
  12546. `ls'
  12547. The portable options are `-acdilrtu'. Current practice is for
  12548. `-l' to output both owner and group, even though ancient versions
  12549. of `ls' omitted the group.
  12550. On ancient hosts, `ls foo' sent the diagnostic `foo not found' to
  12551. standard output if `foo' did not exist. Hence a shell command
  12552. like `sources=`ls *.c 2>/dev/null`' did not always work, since it
  12553. was equivalent to `sources='*.c not found'' in the absence of `.c'
  12554. files. This is no longer a practical problem, since current `ls'
  12555. implementations send diagnostics to standard error.
  12556. The behavior of `ls' on a directory that is being concurrently
  12557. modified is not always predictable, because of a data race where
  12558. cached information returned by `readdir' does not match the current
  12559. directory state. In fact, MacOS 10.5 has an intermittent bug where
  12560. `readdir', and thus `ls', sometimes lists a file more than once if
  12561. other files were added or removed from the directory immediately
  12562. prior to the `ls' call. Since `ls' already sorts its output, the
  12563. duplicate entries can be avoided by piping the results through
  12564. `uniq'.
  12565. `mkdir'
  12566. No `mkdir' option is portable to older systems. Instead of `mkdir
  12567. -p FILE-NAME', you should use `AS_MKDIR_P(FILE-NAME)' (*note
  12568. Programming in M4sh::) or `AC_PROG_MKDIR_P' (*note Particular
  12569. Programs::).
  12570. Combining the `-m' and `-p' options, as in `mkdir -m go-w -p DIR',
  12571. often leads to trouble. FreeBSD `mkdir' incorrectly attempts to
  12572. change the permissions of DIR even if it already exists. HP-UX
  12573. 11.23 and IRIX 6.5 `mkdir' often assign the wrong permissions to
  12574. any newly-created parents of DIR.
  12575. Posix does not clearly specify whether `mkdir -p foo' should
  12576. succeed when `foo' is a symbolic link to an already-existing
  12577. directory. The GNU Core Utilities 5.1.0 `mkdir' succeeds, but
  12578. Solaris `mkdir' fails.
  12579. Traditional `mkdir -p' implementations suffer from race conditions.
  12580. For example, if you invoke `mkdir -p a/b' and `mkdir -p a/c' at
  12581. the same time, both processes might detect that `a' is missing,
  12582. one might create `a', then the other might try to create `a' and
  12583. fail with a `File exists' diagnostic. The GNU Core Utilities
  12584. (`fileutils' version 4.1), FreeBSD 5.0, NetBSD 2.0.2, and OpenBSD
  12585. 2.4 are known to be race-free when two processes invoke `mkdir -p'
  12586. simultaneously, but earlier versions are vulnerable. Solaris
  12587. `mkdir' is still vulnerable as of Solaris 10, and other
  12588. traditional Unix systems are probably vulnerable too. This
  12589. possible race is harmful in parallel builds when several Make
  12590. rules call `mkdir -p' to construct directories. You may use
  12591. `install-sh -d' as a safe replacement, provided this script is
  12592. recent enough; the copy shipped with Autoconf 2.60 and Automake
  12593. 1.10 is OK, but copies from older versions are vulnerable.
  12594. `mkfifo'
  12595. `mknod'
  12596. The GNU Coding Standards state that `mknod' is safe to use on
  12597. platforms where it has been tested to exist; but it is generally
  12598. portable only for creating named FIFOs, since device numbers are
  12599. platform-specific. Autotest uses `mkfifo' to implement parallel
  12600. testsuites. Posix states that behavior is unspecified when
  12601. opening a named FIFO for both reading and writing; on at least
  12602. Cygwin, this results in failure on any attempt to read or write to
  12603. that file descriptor.
  12604. `mktemp'
  12605. Shell scripts can use temporary files safely with `mktemp', but it
  12606. does not exist on all systems. A portable way to create a safe
  12607. temporary file name is to create a temporary directory with mode
  12608. 700 and use a file inside this directory. Both methods prevent
  12609. attackers from gaining control, though `mktemp' is far less likely
  12610. to fail gratuitously under attack.
  12611. Here is sample code to create a new temporary directory `$dir'
  12612. safely:
  12613. # Create a temporary directory $dir in $TMPDIR (default /tmp).
  12614. # Use mktemp if possible; otherwise fall back on mkdir,
  12615. # with $RANDOM to make collisions less likely.
  12616. : "${TMPDIR:=/tmp}"
  12617. {
  12618. dir=`
  12619. (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null
  12620. ` &&
  12621. test -d "$dir"
  12622. } || {
  12623. dir=$TMPDIR/foo$$-$RANDOM
  12624. (umask 077 && mkdir "$dir")
  12625. } || exit $?
  12626. `mv'
  12627. The only portable options are `-f' and `-i'.
  12628. Moving individual files between file systems is portable (it was
  12629. in Unix version 6), but it is not always atomic: when doing `mv
  12630. new existing', there's a critical section where neither the old
  12631. nor the new version of `existing' actually exists.
  12632. On some systems moving files from `/tmp' can sometimes cause
  12633. undesirable (but perfectly valid) warnings, even if you created
  12634. these files. This is because `/tmp' belongs to a group that
  12635. ordinary users are not members of, and files created in `/tmp'
  12636. inherit the group of `/tmp'. When the file is copied, `mv' issues
  12637. a diagnostic without failing:
  12638. $ touch /tmp/foo
  12639. $ mv /tmp/foo .
  12640. error-->mv: ./foo: set owner/group (was: 100/0): Operation not permitted
  12641. $ echo $?
  12642. 0
  12643. $ ls foo
  12644. foo
  12645. This annoying behavior conforms to Posix, unfortunately.
  12646. Moving directories across mount points is not portable, use `cp'
  12647. and `rm'.
  12648. DOS variants cannot rename or remove open files, and do not
  12649. support commands like `mv foo bar >foo', even though this is
  12650. perfectly portable among Posix hosts.
  12651. `od'
  12652. In Mac OS X 10.3, `od' does not support the standard Posix options
  12653. `-A', `-j', `-N', or `-t', or the XSI option `-s'. The only
  12654. supported Posix option is `-v', and the only supported XSI options
  12655. are those in `-bcdox'. The BSD `hexdump' program can be used
  12656. instead.
  12657. This problem no longer exists in Mac OS X 10.4.3.
  12658. `rm'
  12659. The `-f' and `-r' options are portable.
  12660. It is not portable to invoke `rm' without options or operands. On
  12661. the other hand, Posix now requires `rm -f' to silently succeed
  12662. when there are no operands (useful for constructs like `rm -rf
  12663. $filelist' without first checking if `$filelist' was empty). But
  12664. this was not always portable; at least NetBSD `rm' built before
  12665. 2008 would fail with a diagnostic.
  12666. A file might not be removed even if its parent directory is
  12667. writable and searchable. Many Posix hosts cannot remove a mount
  12668. point, a named stream, a working directory, or a last link to a
  12669. file that is being executed.
  12670. DOS variants cannot rename or remove open files, and do not
  12671. support commands like `rm foo >foo', even though this is perfectly
  12672. portable among Posix hosts.
  12673. `rmdir'
  12674. Just as with `rm', some platforms refuse to remove a working
  12675. directory.
  12676. `sed'
  12677. Patterns should not include the separator (unless escaped), even
  12678. as part of a character class. In conformance with Posix, the Cray
  12679. `sed' rejects `s/[^/]*$//': use `s%[^/]*$%%'. Even when escaped,
  12680. patterns should not include separators that are also used as `sed'
  12681. metacharacters. For example, GNU sed 4.0.9 rejects
  12682. `s,x\{1\,\},,', while sed 4.1 strips the backslash before the comma
  12683. before evaluating the basic regular expression.
  12684. Avoid empty patterns within parentheses (i.e., `\(\)'). Posix does
  12685. not require support for empty patterns, and Unicos 9 `sed' rejects
  12686. them.
  12687. Unicos 9 `sed' loops endlessly on patterns like `.*\n.*'.
  12688. Sed scripts should not use branch labels longer than 7 characters
  12689. and should not contain comments; AIX 5.3 `sed' rejects indented
  12690. comments. HP-UX sed has a limit of 99 commands (not counting `:'
  12691. commands) and 48 labels, which cannot be circumvented by using
  12692. more than one script file. It can execute up to 19 reads with the
  12693. `r' command per cycle. Solaris `/usr/ucb/sed' rejects usages that
  12694. exceed a limit of about 6000 bytes for the internal representation
  12695. of commands.
  12696. Avoid redundant `;', as some `sed' implementations, such as NetBSD
  12697. 1.4.2's, incorrectly try to interpret the second `;' as a command:
  12698. $ echo a | sed 's/x/x/;;s/x/x/'
  12699. sed: 1: "s/x/x/;;s/x/x/": invalid command code ;
  12700. Some `sed' implementations have a buffer limited to 4000 bytes,
  12701. and this limits the size of input lines, output lines, and internal
  12702. buffers that can be processed portably. Likewise, not all `sed'
  12703. implementations can handle embedded `NUL' or a missing trailing
  12704. newline.
  12705. Remember that ranges within a bracket expression of a regular
  12706. expression are only well-defined in the `C' (or `POSIX') locale.
  12707. Meanwhile, support for character classes like `[[:upper:]]' is not
  12708. yet universal, so if you cannot guarantee the setting of `LC_ALL',
  12709. it is better to spell out a range `[ABCDEFGHIJKLMNOPQRSTUVWXYZ]'
  12710. than to rely on `[A-Z]'.
  12711. Additionally, Posix states that regular expressions are only
  12712. well-defined on characters. Unfortunately, there exist platforms
  12713. such as MacOS X 10.5 where not all 8-bit byte values are valid
  12714. characters, even though that platform has a single-byte `C'
  12715. locale. And Posix allows the existence of a multi-byte `C'
  12716. locale, although that does not yet appear to be a common
  12717. implementation. At any rate, it means that not all bytes will be
  12718. matched by the regular expression `.':
  12719. $ printf '\200\n' | LC_ALL=C sed -n /./p | wc -l
  12720. 0
  12721. $ printf '\200\n' | LC_ALL=en_US.ISO8859-1 sed -n /./p | wc -l
  12722. 1
  12723. Portable `sed' regular expressions should use `\' only to escape
  12724. characters in the string `$()*.0123456789[\^n{}'. For example,
  12725. alternation, `\|', is common but Posix does not require its
  12726. support, so it should be avoided in portable scripts. Solaris
  12727. `sed' does not support alternation; e.g., `sed '/a\|b/d'' deletes
  12728. only lines that contain the literal string `a|b'. Similarly, `\+'
  12729. and `\?' should be avoided.
  12730. Anchors (`^' and `$') inside groups are not portable.
  12731. Nested parentheses in patterns (e.g., `\(\(a*\)b*)\)') are quite
  12732. portable to current hosts, but was not supported by some ancient
  12733. `sed' implementations like SVR3.
  12734. Some `sed' implementations, e.g., Solaris, restrict the special
  12735. role of the asterisk `*' to one-character regular expressions and
  12736. back-references, and the special role of interval expressions
  12737. `\{M\}', `\{M,\}', or `\{M,N\}' to one-character regular
  12738. expressions. This may lead to unexpected behavior:
  12739. $ echo '1*23*4' | /usr/bin/sed 's/\(.\)*/x/g'
  12740. x2x4
  12741. $ echo '1*23*4' | /usr/xpg4/bin/sed 's/\(.\)*/x/g'
  12742. x
  12743. The `-e' option is mostly portable. However, its argument cannot
  12744. start with `a', `c', or `i', as this runs afoul of a Tru64 5.1 bug.
  12745. Also, its argument cannot be empty, as this fails on AIX 5.3.
  12746. Some people prefer to use `-e':
  12747. sed -e 'COMMAND-1' \
  12748. -e 'COMMAND-2'
  12749. as opposed to the equivalent:
  12750. sed '
  12751. COMMAND-1
  12752. COMMAND-2
  12753. '
  12754. The following usage is sometimes equivalent:
  12755. sed 'COMMAND-1;COMMAND-2'
  12756. but Posix says that this use of a semicolon has undefined effect if
  12757. COMMAND-1's verb is `{', `a', `b', `c', `i', `r', `t', `w', `:',
  12758. or `#', so you should use semicolon only with simple scripts that
  12759. do not use these verbs.
  12760. Posix up to the 2008 revision requires the argument of the `-e'
  12761. option to be a syntactically complete script. GNU `sed' allows to
  12762. pass multiple script fragments, each as argument of a separate
  12763. `-e' option, that are then combined, with newlines between the
  12764. fragments, and a future Posix revision may allow this as well.
  12765. This approach is not portable with script fragments ending in
  12766. backslash; for example, the `sed' programs on Solaris 10, HP-UX
  12767. 11, and AIX don't allow splitting in this case:
  12768. $ echo a | sed -n -e 'i\
  12769. 0'
  12770. 0
  12771. $ echo a | sed -n -e 'i\' -e 0
  12772. Unrecognized command: 0
  12773. In practice, however, this technique of joining fragments through
  12774. `-e' works for multiple `sed' functions within `{' and `}', even
  12775. if that is not specified by Posix:
  12776. $ echo a | sed -n -e '/a/{' -e s/a/b/ -e p -e '}'
  12777. b
  12778. Commands inside { } brackets are further restricted. Posix 2008
  12779. says that they cannot be preceded by addresses, `!', or `;', and
  12780. that each command must be followed immediately by a newline,
  12781. without any intervening blanks or semicolons. The closing bracket
  12782. must be alone on a line, other than white space preceding or
  12783. following it. However, a future version of Posix may standardize
  12784. the use of addresses within brackets.
  12785. Contrary to yet another urban legend, you may portably use `&' in
  12786. the replacement part of the `s' command to mean "what was
  12787. matched". All descendants of Unix version 7 `sed' (at least; we
  12788. don't have first hand experience with older `sed' implementations)
  12789. have supported it.
  12790. Posix requires that you must not have any white space between `!'
  12791. and the following command. It is OK to have blanks between the
  12792. address and the `!'. For instance, on Solaris:
  12793. $ echo "foo" | sed -n '/bar/ ! p'
  12794. error-->Unrecognized command: /bar/ ! p
  12795. $ echo "foo" | sed -n '/bar/! p'
  12796. error-->Unrecognized command: /bar/! p
  12797. $ echo "foo" | sed -n '/bar/ !p'
  12798. foo
  12799. Posix also says that you should not combine `!' and `;'. If you
  12800. use `!', it is best to put it on a command that is delimited by
  12801. newlines rather than `;'.
  12802. Also note that Posix requires that the `b', `t', `r', and `w'
  12803. commands be followed by exactly one space before their argument.
  12804. On the other hand, no white space is allowed between `:' and the
  12805. subsequent label name.
  12806. If a sed script is specified on the command line and ends in an
  12807. `a', `c', or `i' command, the last line of inserted text should be
  12808. followed by a newline. Otherwise some `sed' implementations
  12809. (e.g., OpenBSD 3.9) do not append a newline to the inserted text.
  12810. Many `sed' implementations (e.g., MacOS X 10.4, OpenBSD 3.9,
  12811. Solaris 10 `/usr/ucb/sed') strip leading white space from the text
  12812. of `a', `c', and `i' commands. Prepend a backslash to work around
  12813. this incompatibility with Posix:
  12814. $ echo flushleft | sed 'a\
  12815. > indented
  12816. > '
  12817. flushleft
  12818. indented
  12819. $ echo foo | sed 'a\
  12820. > \ indented
  12821. > '
  12822. flushleft
  12823. indented
  12824. Posix requires that with an empty regular expression, the last
  12825. non-empty regular expression from either an address specification
  12826. or substitution command is applied. However, busybox 1.6.1
  12827. complains when using a substitution command with a replacement
  12828. containing a back-reference to an empty regular expression; the
  12829. workaround is repeating the regular expression.
  12830. $ echo abc | busybox sed '/a\(b\)c/ s//\1/'
  12831. sed: No previous regexp.
  12832. $ echo abc | busybox sed '/a\(b\)c/ s/a\(b\)c/\1/'
  12833. b
  12834. `sed' (`t')
  12835. Some old systems have `sed' that "forget" to reset their `t' flag
  12836. when starting a new cycle. For instance on MIPS RISC/OS, and on
  12837. IRIX 5.3, if you run the following `sed' script (the line numbers
  12838. are not actual part of the texts):
  12839. s/keep me/kept/g # a
  12840. t end # b
  12841. s/.*/deleted/g # c
  12842. :end # d
  12843. on
  12844. delete me # 1
  12845. delete me # 2
  12846. keep me # 3
  12847. delete me # 4
  12848. you get
  12849. deleted
  12850. delete me
  12851. kept
  12852. deleted
  12853. instead of
  12854. deleted
  12855. deleted
  12856. kept
  12857. deleted
  12858. Why? When processing line 1, (c) matches, therefore sets the `t'
  12859. flag, and the output is produced. When processing line 2, the `t'
  12860. flag is still set (this is the bug). Command (a) fails to match,
  12861. but `sed' is not supposed to clear the `t' flag when a
  12862. substitution fails. Command (b) sees that the flag is set,
  12863. therefore it clears it, and jumps to (d), hence you get `delete me'
  12864. instead of `deleted'. When processing line (3), `t' is clear, (a)
  12865. matches, so the flag is set, hence (b) clears the flags and jumps.
  12866. Finally, since the flag is clear, line 4 is processed properly.
  12867. There are two things one should remember about `t' in `sed'.
  12868. Firstly, always remember that `t' jumps if _some_ substitution
  12869. succeeded, not only the immediately preceding substitution.
  12870. Therefore, always use a fake `t clear' followed by a `:clear' on
  12871. the next line, to reset the `t' flag where needed.
  12872. Secondly, you cannot rely on `sed' to clear the flag at each new
  12873. cycle.
  12874. One portable implementation of the script above is:
  12875. t clear
  12876. :clear
  12877. s/keep me/kept/g
  12878. t end
  12879. s/.*/deleted/g
  12880. :end
  12881. `sleep'
  12882. Using `sleep' is generally portable. However, remember that
  12883. adding a `sleep' to work around timestamp issues, with a minimum
  12884. granularity of one second, doesn't scale well for parallel builds
  12885. on modern machines with sub-second process completion.
  12886. `sort'
  12887. Remember that sort order is influenced by the current locale.
  12888. Inside `configure', the C locale is in effect, but in Makefile
  12889. snippets, you may need to specify `LC_ALL=C sort'.
  12890. `tar'
  12891. There are multiple file formats for `tar'; if you use Automake,
  12892. the macro `AM_INIT_AUTOMAKE' has some options controlling which
  12893. level of portability to use.
  12894. `touch'
  12895. If you specify the desired timestamp (e.g., with the `-r' option),
  12896. older `touch' implementations use the `utime' or `utimes' system
  12897. call, which can result in the same kind of timestamp truncation
  12898. problems that `cp -p' has.
  12899. On ancient BSD systems, `touch' or any command that results in an
  12900. empty file does not update the timestamps, so use a command like
  12901. `echo' as a workaround. Also, GNU `touch' 3.16r (and presumably
  12902. all before that) fails to work on SunOS 4.1.3 when the empty file
  12903. is on an NFS-mounted 4.2 volume. However, these problems are no
  12904. longer of practical concern.
  12905. `tr'
  12906. Not all versions of `tr' handle all backslash character escapes.
  12907. For example, Solaris 10 `/usr/ucb/tr' falls over, even though
  12908. Solaris contains more modern `tr' in other locations. Using octal
  12909. escapes is more portable for carriage returns, since `\015' is the
  12910. same for both ASCII and EBCDIC, and since use of literal carriage
  12911. returns in scripts causes a number of other problems. But for
  12912. other characters, like newline, using octal escapes ties the
  12913. operation to ASCII, so it is better to use literal characters.
  12914. $ { echo moon; echo light; } | /usr/ucb/tr -d '\n' ; echo
  12915. moo
  12916. light
  12917. $ { echo moon; echo light; } | /usr/bin/tr -d '\n' ; echo
  12918. moonlight
  12919. $ { echo moon; echo light; } | /usr/ucb/tr -d '\012' ; echo
  12920. moonlight
  12921. $ nl='
  12922. '; { echo moon; echo light; } | /usr/ucb/tr -d "$nl" ; echo
  12923. moonlight
  12924. Not all versions of `tr' recognize direct ranges of characters: at
  12925. least Solaris `/usr/bin/tr' still fails to do so. But you can use
  12926. `/usr/xpg4/bin/tr' instead, or add brackets (which in Posix
  12927. transliterate to themselves).
  12928. $ echo "Hazy Fantazy" | LC_ALL=C /usr/bin/tr a-z A-Z
  12929. HAZy FAntAZy
  12930. $ echo "Hazy Fantazy" | LC_ALL=C /usr/bin/tr '[a-z]' '[A-Z]'
  12931. HAZY FANTAZY
  12932. $ echo "Hazy Fantazy" | LC_ALL=C /usr/xpg4/bin/tr a-z A-Z
  12933. HAZY FANTAZY
  12934. When providing two arguments, be sure the second string is at
  12935. least as long as the first.
  12936. $ echo abc | /usr/xpg4/bin/tr bc d
  12937. adc
  12938. $ echo abc | coreutils/tr bc d
  12939. add
  12940. Posix requires `tr' to operate on binary files. But at least
  12941. Solaris `/usr/ucb/tr' and `/usr/bin/tr' silently discard `NUL' in
  12942. the input prior to doing any translation. When using `tr' to
  12943. process a binary file that may contain `NUL' bytes, it is
  12944. necessary to use `/usr/xpg4/bin/tr' instead, or `/usr/xpg6/bin/tr'
  12945. if that is available.
  12946. $ printf 'a\0b' | /usr/ucb/tr x x | od -An -tx1
  12947. 61 62
  12948. $ printf 'a\0b' | /usr/bin/tr x x | od -An -tx1
  12949. 61 62
  12950. $ printf 'a\0b' | /usr/xpg4/bin/tr x x | od -An -tx1
  12951. 61 00 62
  12952. Solaris `/usr/ucb/tr' additionally fails to handle `\0' as the
  12953. octal escape for `NUL'.
  12954. $ printf 'abc' | /usr/ucb/tr 'bc' '\0d' | od -An -tx1
  12955. 61 62 63
  12956. $ printf 'abc' | /usr/bin/tr 'bc' '\0d' | od -An -tx1
  12957. 61 00 64
  12958. $ printf 'abc' | /usr/xpg4/bin/tr 'bc' '\0d' | od -An -tx1
  12959. 61 00 64
  12960. 
  12961. File: autoconf.info, Node: Portable Make, Next: Portable C and C++, Prev: Portable Shell, Up: Top
  12962. 12 Portable Make Programming
  12963. ****************************
  12964. Writing portable makefiles is an art. Since a makefile's commands are
  12965. executed by the shell, you must consider the shell portability issues
  12966. already mentioned. However, other issues are specific to `make' itself.
  12967. * Menu:
  12968. * $< in Ordinary Make Rules:: $< in ordinary rules
  12969. * Failure in Make Rules:: Failing portably in rules
  12970. * Special Chars in Names:: Special Characters in Macro Names
  12971. * Backslash-Newline-Empty:: Empty lines after backslash-newline
  12972. * Backslash-Newline Comments:: Spanning comments across line boundaries
  12973. * Long Lines in Makefiles:: Line length limitations
  12974. * Macros and Submakes:: `make macro=value' and submakes
  12975. * The Make Macro MAKEFLAGS:: `$(MAKEFLAGS)' portability issues
  12976. * The Make Macro SHELL:: `$(SHELL)' portability issues
  12977. * Parallel Make:: Parallel `make' quirks
  12978. * Comments in Make Rules:: Other problems with Make comments
  12979. * Newlines in Make Rules:: Using literal newlines in rules
  12980. * Comments in Make Macros:: Other problems with Make comments in macros
  12981. * Trailing whitespace in Make Macros:: Macro substitution problems
  12982. * Command-line Macros and whitespace:: Whitespace trimming of values
  12983. * obj/ and Make:: Don't name a subdirectory `obj'
  12984. * make -k Status:: Exit status of `make -k'
  12985. * VPATH and Make:: `VPATH' woes
  12986. * Single Suffix Rules:: Single suffix rules and separated dependencies
  12987. * Timestamps and Make:: Subsecond timestamp resolution
  12988. 
  12989. File: autoconf.info, Node: $< in Ordinary Make Rules, Next: Failure in Make Rules, Up: Portable Make
  12990. 12.1 `$<' in Ordinary Make Rules
  12991. ================================
  12992. Posix says that the `$<' construct in makefiles can be used only in
  12993. inference rules and in the `.DEFAULT' rule; its meaning in ordinary
  12994. rules is unspecified. Solaris `make' for instance replaces it with the
  12995. empty string. OpenBSD (3.0 and later) `make' diagnoses these uses and
  12996. errors out.
  12997. 
  12998. File: autoconf.info, Node: Failure in Make Rules, Next: Special Chars in Names, Prev: $< in Ordinary Make Rules, Up: Portable Make
  12999. 12.2 Failure in Make Rules
  13000. ==========================
  13001. Posix 2008 requires that `make' must invoke each command with the
  13002. equivalent of a `sh -e -c' subshell, which causes the subshell to exit
  13003. immediately if a subsidiary simple-command fails, although not all
  13004. `make' implementations have historically followed this rule. For
  13005. example, the command `touch T; rm -f U' may attempt to remove `U' even
  13006. if the `touch' fails, although this is not permitted with Posix make.
  13007. One way to work around failures in simple commands is to reword them so
  13008. that they always succeed, e.g., `touch T || :; rm -f U'. However, even
  13009. this approach can run into common bugs in BSD implementations of the
  13010. `-e' option of `sh' and `set' (*note Limitations of Shell Builtins:
  13011. set.), so if you are worried about porting to buggy BSD shells it may
  13012. be simpler to migrate complicated `make' actions into separate scripts.
  13013. 
  13014. File: autoconf.info, Node: Special Chars in Names, Next: Backslash-Newline-Empty, Prev: Failure in Make Rules, Up: Portable Make
  13015. 12.3 Special Characters in Make Macro Names
  13016. ===========================================
  13017. Posix limits macro names to nonempty strings containing only ASCII
  13018. letters and digits, `.', and `_'. Many `make' implementations allow a
  13019. wider variety of characters, but portable makefiles should avoid them.
  13020. It is portable to start a name with a special character, e.g.,
  13021. `$(.FOO)'.
  13022. Some ancient `make' implementations don't support leading
  13023. underscores in macro names. An example is NEWS-OS 4.2R.
  13024. $ cat Makefile
  13025. _am_include = #
  13026. _am_quote =
  13027. all:; @echo this is test
  13028. $ make
  13029. Make: Must be a separator on rules line 2. Stop.
  13030. $ cat Makefile2
  13031. am_include = #
  13032. am_quote =
  13033. all:; @echo this is test
  13034. $ make -f Makefile2
  13035. this is test
  13036. However, this problem is no longer of practical concern.
  13037. 
  13038. File: autoconf.info, Node: Backslash-Newline-Empty, Next: Backslash-Newline Comments, Prev: Special Chars in Names, Up: Portable Make
  13039. 12.4 Backslash-Newline Before Empty Lines
  13040. =========================================
  13041. A bug in Bash 2.03 can cause problems if a Make rule contains a
  13042. backslash-newline followed by line that expands to nothing. For
  13043. example, on Solaris 8:
  13044. SHELL = /bin/bash
  13045. EMPTY =
  13046. foo:
  13047. touch foo \
  13048. $(EMPTY)
  13049. executes
  13050. /bin/bash -c 'touch foo \
  13051. '
  13052. which fails with a syntax error, due to the Bash bug. To avoid this
  13053. problem, avoid nullable macros in the last line of a multiline command.
  13054. On some versions of HP-UX, `make' reads multiple newlines following
  13055. a backslash, continuing to the next non-empty line. For example,
  13056. FOO = one \
  13057. BAR = two
  13058. test:
  13059. : FOO is "$(FOO)"
  13060. : BAR is "$(BAR)"
  13061. shows `FOO' equal to `one BAR = two'. Other implementations sensibly
  13062. let a backslash continue only to the immediately following line.
  13063. 
  13064. File: autoconf.info, Node: Backslash-Newline Comments, Next: Long Lines in Makefiles, Prev: Backslash-Newline-Empty, Up: Portable Make
  13065. 12.5 Backslash-Newline in Make Comments
  13066. =======================================
  13067. According to Posix, Make comments start with `#' and continue until an
  13068. unescaped newline is reached.
  13069. $ cat Makefile
  13070. # A = foo \
  13071. bar \
  13072. baz
  13073. all:
  13074. @echo ok
  13075. $ make # GNU make
  13076. ok
  13077. However this is not always the case. Some implementations discard
  13078. everything from `#' through the end of the line, ignoring any trailing
  13079. backslash.
  13080. $ pmake # BSD make
  13081. "Makefile", line 3: Need an operator
  13082. Fatal errors encountered -- cannot continue
  13083. Therefore, if you want to comment out a multi-line definition, prefix
  13084. each line with `#', not only the first.
  13085. # A = foo \
  13086. # bar \
  13087. # baz
  13088. 
  13089. File: autoconf.info, Node: Long Lines in Makefiles, Next: Macros and Submakes, Prev: Backslash-Newline Comments, Up: Portable Make
  13090. 12.6 Long Lines in Makefiles
  13091. ============================
  13092. Tru64 5.1's `make' has been reported to crash when given a makefile
  13093. with lines longer than around 20 kB. Earlier versions are reported to
  13094. exit with `Line too long' diagnostics.
  13095. 
  13096. File: autoconf.info, Node: Macros and Submakes, Next: The Make Macro MAKEFLAGS, Prev: Long Lines in Makefiles, Up: Portable Make
  13097. 12.7 `make macro=value' and Submakes
  13098. ====================================
  13099. A command-line variable definition such as `foo=bar' overrides any
  13100. definition of `foo' in a makefile. Some `make' implementations (such
  13101. as GNU `make') propagate this override to subsidiary invocations of
  13102. `make'. Some other implementations do not pass the substitution along
  13103. to submakes.
  13104. $ cat Makefile
  13105. foo = foo
  13106. one:
  13107. @echo $(foo)
  13108. $(MAKE) two
  13109. two:
  13110. @echo $(foo)
  13111. $ make foo=bar # GNU make 3.79.1
  13112. bar
  13113. make two
  13114. make[1]: Entering directory `/home/adl'
  13115. bar
  13116. make[1]: Leaving directory `/home/adl'
  13117. $ pmake foo=bar # BSD make
  13118. bar
  13119. pmake two
  13120. foo
  13121. You have a few possibilities if you do want the `foo=bar' override
  13122. to propagate to submakes. One is to use the `-e' option, which causes
  13123. all environment variables to have precedence over the makefile macro
  13124. definitions, and declare foo as an environment variable:
  13125. $ env foo=bar make -e
  13126. The `-e' option is propagated to submakes automatically, and since
  13127. the environment is inherited between `make' invocations, the `foo'
  13128. macro is overridden in submakes as expected.
  13129. This syntax (`foo=bar make -e') is portable only when used outside
  13130. of a makefile, for instance from a script or from the command line.
  13131. When run inside a `make' rule, GNU `make' 3.80 and prior versions
  13132. forget to propagate the `-e' option to submakes.
  13133. Moreover, using `-e' could have unexpected side effects if your
  13134. environment contains some other macros usually defined by the makefile.
  13135. (See also the note about `make -e' and `SHELL' below.)
  13136. If you can foresee all macros that a user might want to override,
  13137. then you can propagate them to submakes manually, from your makefile:
  13138. foo = foo
  13139. one:
  13140. @echo $(foo)
  13141. $(MAKE) foo=$(foo) two
  13142. two:
  13143. @echo $(foo)
  13144. Another way to propagate a variable to submakes in a portable way is
  13145. to expand an extra variable in every invocation of `$(MAKE)' within
  13146. your makefile:
  13147. foo = foo
  13148. one:
  13149. @echo $(foo)
  13150. $(MAKE) $(SUBMAKEFLAGS) two
  13151. two:
  13152. @echo $(foo)
  13153. Users must be aware that this technique is in use to take advantage
  13154. of it, e.g. with `make foo=bar SUBMAKEFLAGS='foo=bar'', but it allows
  13155. any macro to be overridden. Makefiles generated by `automake' use this
  13156. technique, expanding `$(AM_MAKEFLAGS)' on the command lines of submakes
  13157. (*note Automake: (automake)Subdirectories.).
  13158. 
  13159. File: autoconf.info, Node: The Make Macro MAKEFLAGS, Next: The Make Macro SHELL, Prev: Macros and Submakes, Up: Portable Make
  13160. 12.8 The Make Macro MAKEFLAGS
  13161. =============================
  13162. Posix requires `make' to use `MAKEFLAGS' to affect the current and
  13163. recursive invocations of make, but allows implementations several
  13164. formats for the variable. It is tricky to parse `$MAKEFLAGS' to
  13165. determine whether `-s' for silent execution or `-k' for continued
  13166. execution are in effect. For example, you cannot assume that the first
  13167. space-separated word in `$MAKEFLAGS' contains single-letter options,
  13168. since in the Cygwin version of GNU `make' it is either `--unix' or
  13169. `--win32' with the second word containing single-letter options.
  13170. $ cat Makefile
  13171. all:
  13172. @echo MAKEFLAGS = $(MAKEFLAGS)
  13173. $ make
  13174. MAKEFLAGS = --unix
  13175. $ make -k
  13176. MAKEFLAGS = --unix -k
  13177. 
  13178. File: autoconf.info, Node: The Make Macro SHELL, Next: Parallel Make, Prev: The Make Macro MAKEFLAGS, Up: Portable Make
  13179. 12.9 The Make Macro `SHELL'
  13180. ===========================
  13181. Posix-compliant `make' internally uses the `$(SHELL)' macro to spawn
  13182. shell processes and execute Make rules. This is a builtin macro
  13183. supplied by `make', but it can be modified by a makefile or by a
  13184. command-line argument.
  13185. Not all `make' implementations define this `SHELL' macro. Tru64
  13186. `make' is an example; this implementation always uses `/bin/sh'. So
  13187. it's a good idea to always define `SHELL' in your makefiles. If you
  13188. use Autoconf, do
  13189. SHELL = @SHELL@
  13190. If you use Automake, this is done for you.
  13191. Do not force `SHELL = /bin/sh' because that is not correct
  13192. everywhere. Remember, `/bin/sh' is not Posix compliant on many
  13193. systems, such as FreeBSD 4, NetBSD 3, AIX 3, Solaris 10, or Tru64.
  13194. Additionally, DJGPP lacks `/bin/sh', and when its GNU `make' port sees
  13195. such a setting it enters a special emulation mode where features like
  13196. pipes and redirections are emulated on top of DOS's `command.com'.
  13197. Unfortunately this emulation is incomplete; for instance it does not
  13198. handle command substitutions. Using `@SHELL@' means that your makefile
  13199. will benefit from the same improved shell, such as `bash' or `ksh',
  13200. that was discovered during `configure', so that you aren't fighting two
  13201. different sets of shell bugs between the two contexts.
  13202. Posix-compliant `make' should never acquire the value of $(SHELL)
  13203. from the environment, even when `make -e' is used (otherwise, think
  13204. about what would happen to your rules if `SHELL=/bin/tcsh').
  13205. However not all `make' implementations have this exception. For
  13206. instance it's not surprising that Tru64 `make' doesn't protect `SHELL',
  13207. since it doesn't use it.
  13208. $ cat Makefile
  13209. SHELL = /bin/sh
  13210. FOO = foo
  13211. all:
  13212. @echo $(SHELL)
  13213. @echo $(FOO)
  13214. $ env SHELL=/bin/tcsh FOO=bar make -e # Tru64 Make
  13215. /bin/tcsh
  13216. bar
  13217. $ env SHELL=/bin/tcsh FOO=bar gmake -e # GNU make
  13218. /bin/sh
  13219. bar
  13220. Conversely, `make' is not supposed to export any changes to the
  13221. macro `SHELL' to child processes. Again, many implementations break
  13222. this rule:
  13223. $ cat Makefile
  13224. all:
  13225. @echo $(SHELL)
  13226. @printenv SHELL
  13227. $ env SHELL=sh make -e SHELL=/bin/ksh # BSD Make, GNU make 3.80
  13228. /bin/ksh
  13229. /bin/ksh
  13230. $ env SHELL=sh gmake -e SHELL=/bin/ksh # GNU make 3.81
  13231. /bin/ksh
  13232. sh
  13233. 
  13234. File: autoconf.info, Node: Parallel Make, Next: Comments in Make Rules, Prev: The Make Macro SHELL, Up: Portable Make
  13235. 12.10 Parallel Make
  13236. ===================
  13237. Support for parallel execution in `make' implementation varies.
  13238. Generally, using GNU make is your best bet.
  13239. When NetBSD or FreeBSD `make' are run in parallel mode, they will
  13240. reuse the same shell for multiple commands within one recipe. This can
  13241. have various unexpected consequences. For example, changes of
  13242. directories or variables persist between recipes, so that:
  13243. all:
  13244. @var=value; cd /; pwd; echo $$var; echo $$$$
  13245. @pwd; echo $$var; echo $$$$
  13246. may output the following with `make -j1', at least on NetBSD up to 5.1
  13247. and FreeBSD up to 8.2:
  13248. /
  13249. value
  13250. 32235
  13251. /
  13252. value
  13253. 32235
  13254. while without `-j1', or with `-B', the output looks less surprising:
  13255. /
  13256. value
  13257. 32238
  13258. /tmp
  13259. 32239
  13260. Another consequence is that, if one command in a recipe uses `exit 0'
  13261. to indicate a successful exit, the shell will be gone and the remaining
  13262. commands of this recipe will not be executed.
  13263. The BSD `make' implementations, when run in parallel mode, will also
  13264. pass the `Makefile' recipes to the shell through its standard input,
  13265. thus making it unusable from the recipes:
  13266. $ cat Makefile
  13267. read:
  13268. @read line; echo LINE: $$line
  13269. $ echo foo | make read
  13270. LINE: foo
  13271. $ echo foo | make -j1 read # NetBSD 5.1 and FreeBSD 8.2
  13272. LINE:
  13273. Moreover, when FreeBSD `make' (up at least to 8.2) is run in parallel
  13274. mode, it implements the `@' and `-' "recipe modifiers" by dynamically
  13275. modifying the active shell flags. This behavior has the effects of
  13276. potentially clobbering the exit status of recipes silenced with the `@'
  13277. modifier if they also unset the `errexit' shell flag, and of mangling
  13278. the output in unexpected ways:
  13279. $ cat Makefile
  13280. a:
  13281. @echo $$-; set +e; false
  13282. b:
  13283. -echo $$-; false; echo set -
  13284. $ make a; echo status: $?
  13285. ehBc
  13286. *** Error code 1
  13287. status: 1
  13288. $ make -j1 a; echo status: $?
  13289. ehB
  13290. status: 0
  13291. $ make b
  13292. echo $-; echo set -
  13293. hBc
  13294. set -
  13295. $ make -j1 b
  13296. echo $-; echo hvB
  13297. You can avoid all these issues by using the `-B' option to enable
  13298. compatibility semantics. However, that will effectively also disable
  13299. all parallelism as that will cause prerequisites to be updated in the
  13300. order they are listed in a rule.
  13301. Some make implementations (among them, FreeBSD `make', NetBSD
  13302. `make', and Solaris `dmake'), when invoked with a `-jN' option, connect
  13303. the standard output and standard error of all their child processes to
  13304. pipes or temporary regular files. This can lead to subtly different
  13305. semantics in the behavior of the spawned processes. For example, even
  13306. if the `make' standard output is connected to a tty, the recipe command
  13307. will not be:
  13308. $ cat Makefile
  13309. all:
  13310. @test -t 1 && echo "Is a tty" || echo "Is not a tty"
  13311. $ make -j 2 # FreeBSD 8.2 make
  13312. Is not a tty
  13313. $ make -j 2 # NetBSD 5.1 make
  13314. --- all ---
  13315. Is not a tty
  13316. $ dmake -j 2 # Solaris 10 dmake
  13317. HOSTNAME --> 1 job
  13318. HOSTNAME --> Job output
  13319. Is not a tty
  13320. On the other hand:
  13321. $ make -j 2 # GNU make, Heirloom make
  13322. Is a tty
  13323. The above examples also show additional status output produced in
  13324. parallel mode for targets being updated by Solaris `dmake' and NetBSD
  13325. `make' (but _not_ by FreeBSD `make').
  13326. Furthermore, parallel runs of those `make' implementations will
  13327. route standard error from commands that they spawn into their own
  13328. standard output, and may remove leading whitespace from output lines.
  13329. 
  13330. File: autoconf.info, Node: Comments in Make Rules, Next: Newlines in Make Rules, Prev: Parallel Make, Up: Portable Make
  13331. 12.11 Comments in Make Rules
  13332. ============================
  13333. Never put comments in a rule.
  13334. Some `make' treat anything starting with a tab as a command for the
  13335. current rule, even if the tab is immediately followed by a `#'. The
  13336. `make' from Tru64 Unix V5.1 is one of them. The following makefile
  13337. runs `# foo' through the shell.
  13338. all:
  13339. # foo
  13340. As a workaround, you can use the `:' no-op command with a string
  13341. argument that gets ignored:
  13342. all:
  13343. : "foo"
  13344. Conversely, if you want to use the `#' character in some command,
  13345. you can only do so by expanding it inside a rule (*note Comments in
  13346. Make Macros::). So for example, if `COMMENT_CHAR' is substituted by
  13347. `config.status' as `#', then the following substitutes `@COMMENT_CHAR@'
  13348. in a generated header:
  13349. foo.h: foo.h.in
  13350. sed -e 's|@''COMMENT_CHAR''@|@COMMENT_CHAR@|g' \
  13351. $(srcdir)/foo.h.in > $@
  13352. The funny shell quoting avoids a substitution at `config.status' run
  13353. time of the left-hand side of the `sed' `s' command.
  13354. 
  13355. File: autoconf.info, Node: Newlines in Make Rules, Next: Comments in Make Macros, Prev: Comments in Make Rules, Up: Portable Make
  13356. 12.12 Newlines in Make Rules
  13357. ============================
  13358. In shell scripts, newlines can be used inside string literals. But in
  13359. the shell statements of `Makefile' rules, this is not possible: A
  13360. newline not preceded by a backslash is a separator between shell
  13361. statements. Whereas a newline that is preceded by a backslash becomes
  13362. part of the shell statement according to POSIX, but gets replaced,
  13363. together with the backslash that precedes it, by a space in GNU `make'
  13364. 3.80 and older. So, how can a newline be used in a string literal?
  13365. The trick is to set up a shell variable that contains a newline:
  13366. nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"
  13367. For example, in order to create a multiline `sed' expression that
  13368. inserts a blank line after every line of a file, this code can be used:
  13369. nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"; \
  13370. sed -e "s/\$$/\\$${nl}/" < input > output
  13371. 
  13372. File: autoconf.info, Node: Comments in Make Macros, Next: Trailing whitespace in Make Macros, Prev: Newlines in Make Rules, Up: Portable Make
  13373. 12.13 Comments in Make Macros
  13374. =============================
  13375. Avoid putting comments in macro values as far as possible. Posix
  13376. specifies that the text starting from the `#' sign until the end of the
  13377. line is to be ignored, which has the unfortunate effect of disallowing
  13378. them even within quotes. Thus, the following might lead to a syntax
  13379. error at compile time:
  13380. CPPFLAGS = "-DCOMMENT_CHAR='#'"
  13381. as `CPPFLAGS' may be expanded to `"-DCOMMENT_CHAR=''.
  13382. Most `make' implementations disregard this and treat single and
  13383. double quotes specially here. Also, GNU `make' lets you put `#' into a
  13384. macro value by escaping it with a backslash, i.e., `\#'. However,
  13385. neither of these usages are portable. *Note Comments in Make Rules::,
  13386. for a portable alternative.
  13387. Even without quoting involved, comments can have surprising effects,
  13388. because the whitespace before them is part of the variable value:
  13389. foo = bar # trailing comment
  13390. print: ; @echo "$(foo)."
  13391. prints `bar .', which is usually not intended, and can expose `make'
  13392. bugs as described below.
  13393. 
  13394. File: autoconf.info, Node: Trailing whitespace in Make Macros, Next: Command-line Macros and whitespace, Prev: Comments in Make Macros, Up: Portable Make
  13395. 12.14 Trailing whitespace in Make Macros
  13396. ========================================
  13397. GNU `make' 3.80 mistreats trailing whitespace in macro substitutions
  13398. and appends another spurious suffix:
  13399. empty =
  13400. foo = bar $(empty)
  13401. print: ; @echo $(foo:=.test)
  13402. prints `bar.test .test'.
  13403. BSD and Solaris `make' implementations do not honor trailing
  13404. whitespace in macro definitions as Posix requires:
  13405. foo = bar # Note the space after "bar".
  13406. print: ; @echo $(foo)t
  13407. prints `bart' instead of `bar t'. To work around this, you can use a
  13408. helper macro as in the previous example.
  13409. 
  13410. File: autoconf.info, Node: Command-line Macros and whitespace, Next: obj/ and Make, Prev: Trailing whitespace in Make Macros, Up: Portable Make
  13411. 12.15 Command-line Macros and whitespace
  13412. ========================================
  13413. Some `make' implementations may strip trailing whitespace off of macros
  13414. set on the command line in addition to leading whitespace. Further,
  13415. some may strip leading whitespace off of macros set from environment
  13416. variables:
  13417. $ echo 'print: ; @echo "x$(foo)x$(bar)x"' |
  13418. foo=' f f ' make -f - bar=' b b '
  13419. x f f xb b x # AIX, BSD, GNU make
  13420. xf f xb b x # HP-UX, IRIX, Tru64/OSF make
  13421. x f f xb bx # Solaris make
  13422. 
  13423. File: autoconf.info, Node: obj/ and Make, Next: make -k Status, Prev: Command-line Macros and whitespace, Up: Portable Make
  13424. 12.16 The `obj/' Subdirectory and Make
  13425. ======================================
  13426. Never name one of your subdirectories `obj/' if you don't like
  13427. surprises.
  13428. If an `obj/' directory exists, BSD `make' enters it before reading
  13429. the makefile. Hence the makefile in the current directory is not read.
  13430. $ cat Makefile
  13431. all:
  13432. echo Hello
  13433. $ cat obj/Makefile
  13434. all:
  13435. echo World
  13436. $ make # GNU make
  13437. echo Hello
  13438. Hello
  13439. $ pmake # BSD make
  13440. echo World
  13441. World
  13442. 
  13443. File: autoconf.info, Node: make -k Status, Next: VPATH and Make, Prev: obj/ and Make, Up: Portable Make
  13444. 12.17 Exit Status of `make -k'
  13445. ==============================
  13446. Do not rely on the exit status of `make -k'. Some implementations
  13447. reflect whether they encountered an error in their exit status; other
  13448. implementations always succeed.
  13449. $ cat Makefile
  13450. all:
  13451. false
  13452. $ make -k; echo exit status: $? # GNU make
  13453. false
  13454. make: *** [all] Error 1
  13455. exit status: 2
  13456. $ pmake -k; echo exit status: $? # BSD make
  13457. false
  13458. *** Error code 1 (continuing)
  13459. exit status: 0
  13460. 
  13461. File: autoconf.info, Node: VPATH and Make, Next: Single Suffix Rules, Prev: make -k Status, Up: Portable Make
  13462. 12.18 `VPATH' and Make
  13463. ======================
  13464. Posix does not specify the semantics of `VPATH'. Typically, `make'
  13465. supports `VPATH', but its implementation is not consistent.
  13466. Autoconf and Automake support makefiles whose usages of `VPATH' are
  13467. portable to recent-enough popular implementations of `make', but to
  13468. keep the resulting makefiles portable, a package's makefile prototypes
  13469. must take the following issues into account. These issues are
  13470. complicated and are often poorly understood, and installers who use
  13471. `VPATH' should expect to find many bugs in this area. If you use
  13472. `VPATH', the simplest way to avoid these portability bugs is to stick
  13473. with GNU `make', since it is the most commonly-used `make' among
  13474. Autoconf users.
  13475. Here are some known issues with some `VPATH' implementations.
  13476. * Menu:
  13477. * Variables listed in VPATH:: `VPATH' must be literal on ancient hosts
  13478. * VPATH and Double-colon:: Problems with `::' on ancient hosts
  13479. * $< in Explicit Rules:: `$<' does not work in ordinary rules
  13480. * Automatic Rule Rewriting:: `VPATH' goes wild on Solaris
  13481. * Tru64 Directory Magic:: `mkdir' goes wild on Tru64
  13482. * Make Target Lookup:: More details about `VPATH' lookup
  13483. 
  13484. File: autoconf.info, Node: Variables listed in VPATH, Next: VPATH and Double-colon, Up: VPATH and Make
  13485. 12.18.1 Variables listed in `VPATH'
  13486. -----------------------------------
  13487. Do not set `VPATH' to the value of another variable, for example `VPATH
  13488. = $(srcdir)', because some ancient versions of `make' do not do
  13489. variable substitutions on the value of `VPATH'. For example, use this
  13490. srcdir = @srcdir@
  13491. VPATH = @srcdir@
  13492. rather than `VPATH = $(srcdir)'. Note that with GNU Automake, there is
  13493. no need to set this yourself.
  13494. 
  13495. File: autoconf.info, Node: VPATH and Double-colon, Next: $< in Explicit Rules, Prev: Variables listed in VPATH, Up: VPATH and Make
  13496. 12.18.2 `VPATH' and Double-colon Rules
  13497. --------------------------------------
  13498. With ancient versions of Sun `make', any assignment to `VPATH' causes
  13499. `make' to execute only the first set of double-colon rules. However,
  13500. this problem is no longer of practical concern.
  13501. 
  13502. File: autoconf.info, Node: $< in Explicit Rules, Next: Automatic Rule Rewriting, Prev: VPATH and Double-colon, Up: VPATH and Make
  13503. 12.18.3 `$<' Not Supported in Explicit Rules
  13504. --------------------------------------------
  13505. Using `$<' in explicit rules is not portable. The prerequisite file
  13506. must be named explicitly in the rule. If you want to find the
  13507. prerequisite via a `VPATH' search, you have to code the whole thing
  13508. manually. *Note Build Directories::.
  13509. 
  13510. File: autoconf.info, Node: Automatic Rule Rewriting, Next: Tru64 Directory Magic, Prev: $< in Explicit Rules, Up: VPATH and Make
  13511. 12.18.4 Automatic Rule Rewriting
  13512. --------------------------------
  13513. Some `make' implementations, such as Solaris and Tru64, search for
  13514. prerequisites in `VPATH' and then rewrite each occurrence as a plain
  13515. word in the rule. For instance:
  13516. # This isn't portable to GNU make.
  13517. VPATH = ../pkg/src
  13518. f.c: if.c
  13519. cp if.c f.c
  13520. executes `cp ../pkg/src/if.c f.c' if `if.c' is found in `../pkg/src'.
  13521. However, this rule leads to real problems in practice. For example,
  13522. if the source directory contains an ordinary file named `test' that is
  13523. used in a dependency, Solaris `make' rewrites commands like `if test -r
  13524. foo; ...' to `if ../pkg/src/test -r foo; ...', which is typically
  13525. undesirable. In fact, `make' is completely unaware of shell syntax
  13526. used in the rules, so the VPATH rewrite can potentially apply to _any_
  13527. whitespace-separated word in a rule, including shell variables,
  13528. functions, and keywords.
  13529. $ mkdir build
  13530. $ cd build
  13531. $ cat > Makefile <<'END'
  13532. VPATH = ..
  13533. all: arg func for echo
  13534. func () { for arg in "$$@"; do echo $$arg; done; }; \
  13535. func "hello world"
  13536. END
  13537. $ touch ../arg ../func ../for ../echo
  13538. $ make
  13539. ../func () { ../for ../arg in "$@"; do ../echo $arg; done; }; \
  13540. ../func "hello world"
  13541. sh: syntax error at line 1: `do' unexpected
  13542. *** Error code 2
  13543. To avoid this problem, portable makefiles should never mention a source
  13544. file or dependency whose name is that of a shell keyword like `for' or
  13545. `until', a shell command like `cat' or `gcc' or `test', or a shell
  13546. function or variable used in the corresponding `Makefile' recipe.
  13547. Because of these problems GNU `make' and many other `make'
  13548. implementations do not rewrite commands, so portable makefiles should
  13549. search `VPATH' manually. It is tempting to write this:
  13550. # This isn't portable to Solaris make.
  13551. VPATH = ../pkg/src
  13552. f.c: if.c
  13553. cp `test -f if.c || echo $(VPATH)/`if.c f.c
  13554. However, the "prerequisite rewriting" still applies here. So if `if.c'
  13555. is in `../pkg/src', Solaris and Tru64 `make' execute
  13556. cp `test -f ../pkg/src/if.c || echo ../pkg/src/`if.c f.c
  13557. which reduces to
  13558. cp if.c f.c
  13559. and thus fails. Oops.
  13560. A simple workaround, and good practice anyway, is to use `$?' and
  13561. `$@' when possible:
  13562. VPATH = ../pkg/src
  13563. f.c: if.c
  13564. cp $? $@
  13565. but this does not generalize well to commands with multiple
  13566. prerequisites. A more general workaround is to rewrite the rule so that
  13567. the prerequisite `if.c' never appears as a plain word. For example,
  13568. these three rules would be safe, assuming `if.c' is in `../pkg/src' and
  13569. the other files are in the working directory:
  13570. VPATH = ../pkg/src
  13571. f.c: if.c f1.c
  13572. cat `test -f ./if.c || echo $(VPATH)/`if.c f1.c >$@
  13573. g.c: if.c g1.c
  13574. cat `test -f 'if.c' || echo $(VPATH)/`if.c g1.c >$@
  13575. h.c: if.c h1.c
  13576. cat `test -f "if.c" || echo $(VPATH)/`if.c h1.c >$@
  13577. Things get worse when your prerequisites are in a macro.
  13578. VPATH = ../pkg/src
  13579. HEADERS = f.h g.h h.h
  13580. install-HEADERS: $(HEADERS)
  13581. for i in $(HEADERS); do \
  13582. $(INSTALL) -m 644 \
  13583. `test -f $$i || echo $(VPATH)/`$$i \
  13584. $(DESTDIR)$(includedir)/$$i; \
  13585. done
  13586. The above `install-HEADERS' rule is not Solaris-proof because `for i
  13587. in $(HEADERS);' is expanded to `for i in f.h g.h h.h;' where `f.h' and
  13588. `g.h' are plain words and are hence subject to `VPATH' adjustments.
  13589. If the three files are in `../pkg/src', the rule is run as:
  13590. for i in ../pkg/src/f.h ../pkg/src/g.h h.h; do \
  13591. install -m 644 \
  13592. `test -f $i || echo ../pkg/src/`$i \
  13593. /usr/local/include/$i; \
  13594. done
  13595. where the two first `install' calls fail. For instance, consider
  13596. the `f.h' installation:
  13597. install -m 644 \
  13598. `test -f ../pkg/src/f.h || \
  13599. echo ../pkg/src/ \
  13600. `../pkg/src/f.h \
  13601. /usr/local/include/../pkg/src/f.h;
  13602. It reduces to:
  13603. install -m 644 \
  13604. ../pkg/src/f.h \
  13605. /usr/local/include/../pkg/src/f.h;
  13606. Note that the manual `VPATH' search did not cause any problems here;
  13607. however this command installs `f.h' in an incorrect directory.
  13608. Trying to quote `$(HEADERS)' in some way, as we did for `foo.c' a
  13609. few makefiles ago, does not help:
  13610. install-HEADERS: $(HEADERS)
  13611. headers='$(HEADERS)'; \
  13612. for i in $$headers; do \
  13613. $(INSTALL) -m 644 \
  13614. `test -f $$i || echo $(VPATH)/`$$i \
  13615. $(DESTDIR)$(includedir)/$$i; \
  13616. done
  13617. Now, `headers='$(HEADERS)'' macro-expands to:
  13618. headers='f.h g.h h.h'
  13619. but `g.h' is still a plain word. (As an aside, the idiom
  13620. `headers='$(HEADERS)'; for i in $$headers;' is a good idea if
  13621. `$(HEADERS)' can be empty, because some shells diagnose a syntax error
  13622. on `for i in;'.)
  13623. One workaround is to strip this unwanted `../pkg/src/' prefix
  13624. manually:
  13625. VPATH = ../pkg/src
  13626. HEADERS = f.h g.h h.h
  13627. install-HEADERS: $(HEADERS)
  13628. headers='$(HEADERS)'; \
  13629. for i in $$headers; do \
  13630. i=`expr "$$i" : '$(VPATH)/\(.*\)'`;
  13631. $(INSTALL) -m 644 \
  13632. `test -f $$i || echo $(VPATH)/`$$i \
  13633. $(DESTDIR)$(includedir)/$$i; \
  13634. done
  13635. Automake does something similar. However the above hack works only
  13636. if the files listed in `HEADERS' are in the current directory or a
  13637. subdirectory; they should not be in an enclosing directory. If we had
  13638. `HEADERS = ../f.h', the above fragment would fail in a VPATH build with
  13639. Tru64 `make'. The reason is that not only does Tru64 `make' rewrite
  13640. dependencies, but it also simplifies them. Hence `../f.h' becomes
  13641. `../pkg/f.h' instead of `../pkg/src/../f.h'. This obviously defeats
  13642. any attempt to strip a leading `../pkg/src/' component.
  13643. The following example makes the behavior of Tru64 `make' more
  13644. apparent.
  13645. $ cat Makefile
  13646. VPATH = sub
  13647. all: ../foo
  13648. echo ../foo
  13649. $ ls
  13650. Makefile foo
  13651. $ make
  13652. echo foo
  13653. foo
  13654. Dependency `../foo' was found in `sub/../foo', but Tru64 `make'
  13655. simplified it as `foo'. (Note that the `sub/' directory does not even
  13656. exist, this just means that the simplification occurred before the file
  13657. was checked for.)
  13658. For the record here is how SunOS 4 `make' behaves on this example.
  13659. $ make
  13660. make: Fatal error: Don't know how to make target `../foo'
  13661. $ mkdir sub
  13662. $ make
  13663. echo sub/../foo
  13664. sub/../foo
  13665. 
  13666. File: autoconf.info, Node: Tru64 Directory Magic, Next: Make Target Lookup, Prev: Automatic Rule Rewriting, Up: VPATH and Make
  13667. 12.18.5 Tru64 `make' Creates Prerequisite Directories Magically
  13668. ---------------------------------------------------------------
  13669. When a prerequisite is a subdirectory of `VPATH', Tru64 `make' creates
  13670. it in the current directory.
  13671. $ mkdir -p foo/bar build
  13672. $ cd build
  13673. $ cat >Makefile <<END
  13674. VPATH = ..
  13675. all: foo/bar
  13676. END
  13677. $ make
  13678. mkdir foo
  13679. mkdir foo/bar
  13680. This can yield unexpected results if a rule uses a manual `VPATH'
  13681. search as presented before.
  13682. VPATH = ..
  13683. all : foo/bar
  13684. command `test -d foo/bar || echo ../`foo/bar
  13685. The above `command' is run on the empty `foo/bar' directory that was
  13686. created in the current directory.
  13687. 
  13688. File: autoconf.info, Node: Make Target Lookup, Prev: Tru64 Directory Magic, Up: VPATH and Make
  13689. 12.18.6 Make Target Lookup
  13690. --------------------------
  13691. GNU `make' uses a complex algorithm to decide when it should use files
  13692. found via a `VPATH' search. *Note How Directory Searches are
  13693. Performed: (make)Search Algorithm.
  13694. If a target needs to be rebuilt, GNU `make' discards the file name
  13695. found during the `VPATH' search for this target, and builds the file
  13696. locally using the file name given in the makefile. If a target does
  13697. not need to be rebuilt, GNU `make' uses the file name found during the
  13698. `VPATH' search.
  13699. Other `make' implementations, like NetBSD `make', are easier to
  13700. describe: the file name found during the `VPATH' search is used whether
  13701. the target needs to be rebuilt or not. Therefore new files are created
  13702. locally, but existing files are updated at their `VPATH' location.
  13703. OpenBSD and FreeBSD `make', however, never perform a `VPATH' search
  13704. for a dependency that has an explicit rule. This is extremely annoying.
  13705. When attempting a `VPATH' build for an autoconfiscated package
  13706. (e.g., `mkdir build && cd build && ../configure'), this means GNU
  13707. `make' builds everything locally in the `build' directory, while BSD
  13708. `make' builds new files locally and updates existing files in the
  13709. source directory.
  13710. $ cat Makefile
  13711. VPATH = ..
  13712. all: foo.x bar.x
  13713. foo.x bar.x: newer.x
  13714. @echo Building $@
  13715. $ touch ../bar.x
  13716. $ touch ../newer.x
  13717. $ make # GNU make
  13718. Building foo.x
  13719. Building bar.x
  13720. $ pmake # NetBSD make
  13721. Building foo.x
  13722. Building ../bar.x
  13723. $ fmake # FreeBSD make, OpenBSD make
  13724. Building foo.x
  13725. Building bar.x
  13726. $ tmake # Tru64 make
  13727. Building foo.x
  13728. Building bar.x
  13729. $ touch ../bar.x
  13730. $ make # GNU make
  13731. Building foo.x
  13732. $ pmake # NetBSD make
  13733. Building foo.x
  13734. $ fmake # FreeBSD make, OpenBSD make
  13735. Building foo.x
  13736. Building bar.x
  13737. $ tmake # Tru64 make
  13738. Building foo.x
  13739. Building bar.x
  13740. Note how NetBSD `make' updates `../bar.x' in its VPATH location, and
  13741. how FreeBSD, OpenBSD, and Tru64 `make' always update `bar.x', even when
  13742. `../bar.x' is up to date.
  13743. Another point worth mentioning is that once GNU `make' has decided
  13744. to ignore a `VPATH' file name (e.g., it ignored `../bar.x' in the above
  13745. example) it continues to ignore it when the target occurs as a
  13746. prerequisite of another rule.
  13747. The following example shows that GNU `make' does not look up `bar.x'
  13748. in `VPATH' before performing the `.x.y' rule, because it ignored the
  13749. `VPATH' result of `bar.x' while running the `bar.x: newer.x' rule.
  13750. $ cat Makefile
  13751. VPATH = ..
  13752. all: bar.y
  13753. bar.x: newer.x
  13754. @echo Building $@
  13755. .SUFFIXES: .x .y
  13756. .x.y:
  13757. cp $< $@
  13758. $ touch ../bar.x
  13759. $ touch ../newer.x
  13760. $ make # GNU make
  13761. Building bar.x
  13762. cp bar.x bar.y
  13763. cp: cannot stat `bar.x': No such file or directory
  13764. make: *** [bar.y] Error 1
  13765. $ pmake # NetBSD make
  13766. Building ../bar.x
  13767. cp ../bar.x bar.y
  13768. $ rm bar.y
  13769. $ fmake # FreeBSD make, OpenBSD make
  13770. echo Building bar.x
  13771. cp bar.x bar.y
  13772. cp: cannot stat `bar.x': No such file or directory
  13773. *** Error code 1
  13774. $ tmake # Tru64 make
  13775. Building bar.x
  13776. cp: bar.x: No such file or directory
  13777. *** Exit 1
  13778. Note that if you drop away the command from the `bar.x: newer.x'
  13779. rule, GNU `make' magically starts to work: it knows that `bar.x' hasn't
  13780. been updated, therefore it doesn't discard the result from `VPATH'
  13781. (`../bar.x') in succeeding uses. Tru64 also works, but FreeBSD and
  13782. OpenBSD still don't.
  13783. $ cat Makefile
  13784. VPATH = ..
  13785. all: bar.y
  13786. bar.x: newer.x
  13787. .SUFFIXES: .x .y
  13788. .x.y:
  13789. cp $< $@
  13790. $ touch ../bar.x
  13791. $ touch ../newer.x
  13792. $ make # GNU make
  13793. cp ../bar.x bar.y
  13794. $ rm bar.y
  13795. $ pmake # NetBSD make
  13796. cp ../bar.x bar.y
  13797. $ rm bar.y
  13798. $ fmake # FreeBSD make, OpenBSD make
  13799. cp bar.x bar.y
  13800. cp: cannot stat `bar.x': No such file or directory
  13801. *** Error code 1
  13802. $ tmake # Tru64 make
  13803. cp ../bar.x bar.y
  13804. It seems the sole solution that would please every `make'
  13805. implementation is to never rely on `VPATH' searches for targets. In
  13806. other words, `VPATH' should be reserved to unbuilt sources.
  13807. 
  13808. File: autoconf.info, Node: Single Suffix Rules, Next: Timestamps and Make, Prev: VPATH and Make, Up: Portable Make
  13809. 12.19 Single Suffix Rules and Separated Dependencies
  13810. ====================================================
  13811. A "Single Suffix Rule" is basically a usual suffix (inference) rule
  13812. (`.from.to:'), but which _destination_ suffix is empty (`.from:').
  13813. "Separated dependencies" simply refers to listing the prerequisite
  13814. of a target, without defining a rule. Usually one can list on the one
  13815. hand side, the rules, and on the other hand side, the dependencies.
  13816. Solaris `make' does not support separated dependencies for targets
  13817. defined by single suffix rules:
  13818. $ cat Makefile
  13819. .SUFFIXES: .in
  13820. foo: foo.in
  13821. .in:
  13822. cp $< $@
  13823. $ touch foo.in
  13824. $ make
  13825. $ ls
  13826. Makefile foo.in
  13827. while GNU Make does:
  13828. $ gmake
  13829. cp foo.in foo
  13830. $ ls
  13831. Makefile foo foo.in
  13832. Note it works without the `foo: foo.in' dependency.
  13833. $ cat Makefile
  13834. .SUFFIXES: .in
  13835. .in:
  13836. cp $< $@
  13837. $ make foo
  13838. cp foo.in foo
  13839. and it works with double suffix inference rules:
  13840. $ cat Makefile
  13841. foo.out: foo.in
  13842. .SUFFIXES: .in .out
  13843. .in.out:
  13844. cp $< $@
  13845. $ make
  13846. cp foo.in foo.out
  13847. As a result, in such a case, you have to write target rules.
  13848. 
  13849. File: autoconf.info, Node: Timestamps and Make, Prev: Single Suffix Rules, Up: Portable Make
  13850. 12.20 Timestamp Resolution and Make
  13851. ===================================
  13852. Traditionally, file timestamps had 1-second resolution, and `make' used
  13853. those timestamps to determine whether one file was newer than the
  13854. other. However, many modern file systems have timestamps with
  13855. 1-nanosecond resolution. Some `make' implementations look at the
  13856. entire timestamp; others ignore the fractional part, which can lead to
  13857. incorrect results. Normally this is not a problem, but in some extreme
  13858. cases you may need to use tricks like `sleep 1' to work around
  13859. timestamp truncation bugs.
  13860. Commands like `cp -p' and `touch -r' typically do not copy file
  13861. timestamps to their full resolutions (*note Limitations of Usual Tools:
  13862. touch.). Hence you should be wary of rules like this:
  13863. dest: src
  13864. cp -p src dest
  13865. as `dest' often appears to be older than `src' after the timestamp
  13866. is truncated, and this can cause `make' to do needless rework the next
  13867. time it is invoked. To work around this problem, you can use a
  13868. timestamp file, e.g.:
  13869. dest-stamp: src
  13870. cp -p src dest
  13871. date >dest-stamp
  13872. Apart from timestamp resolution, there are also differences in
  13873. handling equal timestamps. HP-UX `make' updates targets if it has the
  13874. same time stamp as one of its prerequisites, in violation of Posix
  13875. rules.
  13876. This can cause spurious rebuilds for repeated runs of `make'. This
  13877. in turn can cause `make' to fail if it tries to rebuild generated files
  13878. in a possibly read-only source tree with tools not present on the
  13879. end-user machine. Use GNU `make' instead.
  13880. 
  13881. File: autoconf.info, Node: Portable C and C++, Next: Manual Configuration, Prev: Portable Make, Up: Top
  13882. 13 Portable C and C++ Programming
  13883. *********************************
  13884. C and C++ programs often use low-level features of the underlying
  13885. system, and therefore are often more difficult to make portable to other
  13886. platforms.
  13887. Several standards have been developed to help make your programs more
  13888. portable. If you write programs with these standards in mind, you can
  13889. have greater confidence that your programs work on a wide variety of
  13890. systems. *Note Language Standards Supported by GCC: (gcc)Standards,
  13891. for a list of C-related standards. Many programs also assume the Posix
  13892. standard (http://www.opengroup.org/susv3).
  13893. Some old code is written to be portable to K&R C, which predates any
  13894. C standard. K&R C compilers are no longer of practical interest,
  13895. though, and the rest of section assumes at least C89, the first C
  13896. standard.
  13897. Program portability is a huge topic, and this section can only
  13898. briefly introduce common pitfalls. *Note Portability between System
  13899. Types: (standards)System Portability, for more information.
  13900. * Menu:
  13901. * Varieties of Unportability:: How to make your programs unportable
  13902. * Integer Overflow:: When integers get too large
  13903. * Preprocessor Arithmetic:: `#if' expression problems
  13904. * Null Pointers:: Properties of null pointers
  13905. * Buffer Overruns:: Subscript errors and the like
  13906. * Volatile Objects:: `volatile' and signals
  13907. * Floating Point Portability:: Portable floating-point arithmetic
  13908. * Exiting Portably:: Exiting and the exit status
  13909. 
  13910. File: autoconf.info, Node: Varieties of Unportability, Next: Integer Overflow, Up: Portable C and C++
  13911. 13.1 Varieties of Unportability
  13912. ===============================
  13913. Autoconf tests and ordinary programs often need to test what is allowed
  13914. on a system, and therefore they may need to deliberately exceed the
  13915. boundaries of what the standards allow, if only to see whether an
  13916. optional feature is present. When you write such a program, you should
  13917. keep in mind the difference between constraints, unspecified behavior,
  13918. and undefined behavior.
  13919. In C, a "constraint" is a rule that the compiler must enforce. An
  13920. example constraint is that C programs must not declare a bit-field with
  13921. negative width. Tests can therefore reliably assume that programs with
  13922. negative-width bit-fields are rejected by a compiler that conforms to
  13923. the standard.
  13924. "Unspecified behavior" is valid behavior, where the standard allows
  13925. multiple possibilities. For example, the order of evaluation of
  13926. function arguments is unspecified. Some unspecified behavior is
  13927. "implementation-defined", i.e., documented by the implementation, but
  13928. since Autoconf tests cannot read the documentation they cannot
  13929. distinguish between implementation-defined and other unspecified
  13930. behavior. It is common for Autoconf tests to probe implementations to
  13931. determine otherwise-unspecified behavior.
  13932. "Undefined behavior" is invalid behavior, where the standard allows
  13933. the implementation to do anything it pleases. For example,
  13934. dereferencing a null pointer leads to undefined behavior. If possible,
  13935. test programs should avoid undefined behavior, since a program with
  13936. undefined behavior might succeed on a test that should fail.
  13937. The above rules apply to programs that are intended to conform to the
  13938. standard. However, strictly-conforming programs are quite rare, since
  13939. the standards are so limiting. A major goal of Autoconf is to support
  13940. programs that use implementation features not described by the standard,
  13941. and it is fairly common for test programs to violate the above rules, if
  13942. the programs work well enough in practice.
  13943. 
  13944. File: autoconf.info, Node: Integer Overflow, Next: Preprocessor Arithmetic, Prev: Varieties of Unportability, Up: Portable C and C++
  13945. 13.2 Integer Overflow
  13946. =====================
  13947. In practice many portable C programs assume that signed integer
  13948. overflow wraps around reliably using two's complement arithmetic. Yet
  13949. the C standard says that program behavior is undefined on overflow, and
  13950. in a few cases C programs do not work on some modern implementations
  13951. because their overflows do not wrap around as their authors expected.
  13952. Conversely, in signed integer remainder, the C standard requires
  13953. overflow behavior that is commonly not implemented.
  13954. * Menu:
  13955. * Integer Overflow Basics:: Why integer overflow is a problem
  13956. * Signed Overflow Examples:: Examples of code assuming wraparound
  13957. * Optimization and Wraparound:: Optimizations that break uses of wraparound
  13958. * Signed Overflow Advice:: Practical advice for signed overflow issues
  13959. * Signed Integer Division:: `INT_MIN / -1' and `INT_MIN % -1'
  13960. 
  13961. File: autoconf.info, Node: Integer Overflow Basics, Next: Signed Overflow Examples, Up: Integer Overflow
  13962. 13.2.1 Basics of Integer Overflow
  13963. ---------------------------------
  13964. In languages like C, unsigned integer overflow reliably wraps around;
  13965. e.g., `UINT_MAX + 1' yields zero. This is guaranteed by the C standard
  13966. and is portable in practice, unless you specify aggressive, nonstandard
  13967. optimization options suitable only for special applications.
  13968. In contrast, the C standard says that signed integer overflow leads
  13969. to undefined behavior where a program can do anything, including dumping
  13970. core or overrunning a buffer. The misbehavior can even precede the
  13971. overflow. Such an overflow can occur during addition, subtraction,
  13972. multiplication, division, and left shift.
  13973. Despite this requirement of the standard, many C programs and
  13974. Autoconf tests assume that signed integer overflow silently wraps
  13975. around modulo a power of two, using two's complement arithmetic, so
  13976. long as you cast the resulting value to a signed integer type or store
  13977. it into a signed integer variable. If you use conservative
  13978. optimization flags, such programs are generally portable to the vast
  13979. majority of modern platforms, with a few exceptions discussed later.
  13980. For historical reasons the C standard also allows implementations
  13981. with ones' complement or signed magnitude arithmetic, but it is safe to
  13982. assume two's complement nowadays.
  13983. Also, overflow can occur when converting an out-of-range value to a
  13984. signed integer type. Here a standard implementation must define what
  13985. happens, but this might include raising an exception. In practice all
  13986. known implementations support silent wraparound in this case, so you
  13987. need not worry about other possibilities.
  13988. 
  13989. File: autoconf.info, Node: Signed Overflow Examples, Next: Optimization and Wraparound, Prev: Integer Overflow Basics, Up: Integer Overflow
  13990. 13.2.2 Examples of Code Assuming Wraparound Overflow
  13991. ----------------------------------------------------
  13992. There has long been a tension between what the C standard requires for
  13993. signed integer overflow, and what C programs commonly assume. The
  13994. standard allows aggressive optimizations based on assumptions that
  13995. overflow never occurs, but many practical C programs rely on overflow
  13996. wrapping around. These programs do not conform to the standard, but
  13997. they commonly work in practice because compiler writers are
  13998. understandably reluctant to implement optimizations that would break
  13999. many programs, unless perhaps a user specifies aggressive optimization.
  14000. The C Standard says that if a program has signed integer overflow its
  14001. behavior is undefined, and the undefined behavior can even precede the
  14002. overflow. To take an extreme example:
  14003. if (password == expected_password)
  14004. allow_superuser_privileges ();
  14005. else if (counter++ == INT_MAX)
  14006. abort ();
  14007. else
  14008. printf ("%d password mismatches\n", counter);
  14009. If the `int' variable `counter' equals `INT_MAX', `counter++' must
  14010. overflow and the behavior is undefined, so the C standard allows the
  14011. compiler to optimize away the test against `INT_MAX' and the `abort'
  14012. call. Worse, if an earlier bug in the program lets the compiler deduce
  14013. that `counter == INT_MAX' or that `counter' previously overflowed, the
  14014. C standard allows the compiler to optimize away the password test and
  14015. generate code that allows superuser privileges unconditionally.
  14016. Despite this requirement by the standard, it has long been common
  14017. for C code to assume wraparound arithmetic after signed overflow, and
  14018. all known practical C implementations support some C idioms that assume
  14019. wraparound signed arithmetic, even if the idioms do not conform
  14020. strictly to the standard. If your code looks like the following
  14021. examples it will almost surely work with real-world compilers.
  14022. Here is an example derived from the 7th Edition Unix implementation
  14023. of `atoi' (1979-01-10):
  14024. char *p;
  14025. int f, n;
  14026. ...
  14027. while (*p >= '0' && *p <= '9')
  14028. n = n * 10 + *p++ - '0';
  14029. return (f ? -n : n);
  14030. Even if the input string is in range, on most modern machines this has
  14031. signed overflow when computing the most negative integer (the `-n'
  14032. overflows) or a value near an extreme integer (the first `+' overflows).
  14033. Here is another example, derived from the 7th Edition implementation
  14034. of `rand' (1979-01-10). Here the programmer expects both
  14035. multiplication and addition to wrap on overflow:
  14036. static long int randx = 1;
  14037. ...
  14038. randx = randx * 1103515245 + 12345;
  14039. return (randx >> 16) & 077777;
  14040. In the following example, derived from the GNU C Library 2.5
  14041. implementation of `mktime' (2006-09-09), the code assumes wraparound
  14042. arithmetic in `+' to detect signed overflow:
  14043. time_t t, t1, t2;
  14044. int sec_requested, sec_adjustment;
  14045. ...
  14046. t1 = t + sec_requested;
  14047. t2 = t1 + sec_adjustment;
  14048. if (((t1 < t) != (sec_requested < 0))
  14049. | ((t2 < t1) != (sec_adjustment < 0)))
  14050. return -1;
  14051. If your code looks like these examples, it is probably safe even
  14052. though it does not strictly conform to the C standard. This might lead
  14053. one to believe that one can generally assume wraparound on overflow,
  14054. but that is not always true, as can be seen in the next section.
  14055. 
  14056. File: autoconf.info, Node: Optimization and Wraparound, Next: Signed Overflow Advice, Prev: Signed Overflow Examples, Up: Integer Overflow
  14057. 13.2.3 Optimizations That Break Wraparound Arithmetic
  14058. -----------------------------------------------------
  14059. Compilers sometimes generate code that is incompatible with wraparound
  14060. integer arithmetic. A simple example is an algebraic simplification: a
  14061. compiler might translate `(i * 2000) / 1000' to `i * 2' because it
  14062. assumes that `i * 2000' does not overflow. The translation is not
  14063. equivalent to the original when overflow occurs: e.g., in the typical
  14064. case of 32-bit signed two's complement wraparound `int', if `i' has
  14065. type `int' and value `1073742', the original expression returns
  14066. -2147483 but the optimized version returns the mathematically correct
  14067. value 2147484.
  14068. More subtly, loop induction optimizations often exploit the undefined
  14069. behavior of signed overflow. Consider the following contrived function
  14070. `sumc':
  14071. int
  14072. sumc (int lo, int hi)
  14073. {
  14074. int sum = 0;
  14075. int i;
  14076. for (i = lo; i <= hi; i++)
  14077. sum ^= i * 53;
  14078. return sum;
  14079. }
  14080. To avoid multiplying by 53 each time through the loop, an optimizing
  14081. compiler might internally transform `sumc' to the equivalent of the
  14082. following:
  14083. int
  14084. transformed_sumc (int lo, int hi)
  14085. {
  14086. int sum = 0;
  14087. int hic = hi * 53;
  14088. int ic;
  14089. for (ic = lo * 53; ic <= hic; ic += 53)
  14090. sum ^= ic;
  14091. return sum;
  14092. }
  14093. This transformation is allowed by the C standard, but it is invalid for
  14094. wraparound arithmetic when `INT_MAX / 53 < hi', because then the
  14095. overflow in computing expressions like `hi * 53' can cause the
  14096. expression `i <= hi' to yield a different value from the transformed
  14097. expression `ic <= hic'.
  14098. For this reason, compilers that use loop induction and similar
  14099. techniques often do not support reliable wraparound arithmetic when a
  14100. loop induction variable like `ic' is involved. Since loop induction
  14101. variables are generated by the compiler, and are not visible in the
  14102. source code, it is not always trivial to say whether the problem
  14103. affects your code.
  14104. Hardly any code actually depends on wraparound arithmetic in cases
  14105. like these, so in practice these loop induction optimizations are almost
  14106. always useful. However, edge cases in this area can cause problems.
  14107. For example:
  14108. int j;
  14109. for (j = 1; 0 < j; j *= 2)
  14110. test (j);
  14111. Here, the loop attempts to iterate through all powers of 2 that `int'
  14112. can represent, but the C standard allows a compiler to optimize away
  14113. the comparison and generate an infinite loop, under the argument that
  14114. behavior is undefined on overflow. As of this writing this
  14115. optimization is not done by any production version of GCC with `-O2',
  14116. but it might be performed by other compilers, or by more aggressive GCC
  14117. optimization options, and the GCC developers have not decided whether
  14118. it will continue to work with GCC and `-O2'.
  14119. 
  14120. File: autoconf.info, Node: Signed Overflow Advice, Next: Signed Integer Division, Prev: Optimization and Wraparound, Up: Integer Overflow
  14121. 13.2.4 Practical Advice for Signed Overflow Issues
  14122. --------------------------------------------------
  14123. Ideally the safest approach is to avoid signed integer overflow
  14124. entirely. For example, instead of multiplying two signed integers, you
  14125. can convert them to unsigned integers, multiply the unsigned values,
  14126. then test whether the result is in signed range.
  14127. Rewriting code in this way will be inconvenient, though,
  14128. particularly if the signed values might be negative. Also, it may hurt
  14129. performance. Using unsigned arithmetic to check for overflow is
  14130. particularly painful to do portably and efficiently when dealing with an
  14131. integer type like `uid_t' whose width and signedness vary from platform
  14132. to platform.
  14133. Furthermore, many C applications pervasively assume wraparound
  14134. behavior and typically it is not easy to find and remove all these
  14135. assumptions. Hence it is often useful to maintain nonstandard code
  14136. that assumes wraparound on overflow, instead of rewriting the code.
  14137. The rest of this section attempts to give practical advice for this
  14138. situation.
  14139. If your code wants to detect signed integer overflow in `sum = a +
  14140. b', it is generally safe to use an expression like `(sum < a) != (b <
  14141. 0)'.
  14142. If your code uses a signed loop index, make sure that the index
  14143. cannot overflow, along with all signed expressions derived from the
  14144. index. Here is a contrived example of problematic code with two
  14145. instances of overflow.
  14146. for (i = INT_MAX - 10; i <= INT_MAX; i++)
  14147. if (i + 1 < 0)
  14148. {
  14149. report_overflow ();
  14150. break;
  14151. }
  14152. Because of the two overflows, a compiler might optimize away or
  14153. transform the two comparisons in a way that is incompatible with the
  14154. wraparound assumption.
  14155. If your code uses an expression like `(i * 2000) / 1000' and you
  14156. actually want the multiplication to wrap around on overflow, use
  14157. unsigned arithmetic to do it, e.g., `((int) (i * 2000u)) / 1000'.
  14158. If your code assumes wraparound behavior and you want to insulate it
  14159. against any GCC optimizations that would fail to support that behavior,
  14160. you should use GCC's `-fwrapv' option, which causes signed overflow to
  14161. wrap around reliably (except for division and remainder, as discussed
  14162. in the next section).
  14163. If you need to port to platforms where signed integer overflow does
  14164. not reliably wrap around (e.g., due to hardware overflow checking, or to
  14165. highly aggressive optimizations), you should consider debugging with
  14166. GCC's `-ftrapv' option, which causes signed overflow to raise an
  14167. exception.
  14168. 
  14169. File: autoconf.info, Node: Signed Integer Division, Prev: Signed Overflow Advice, Up: Integer Overflow
  14170. 13.2.5 Signed Integer Division and Integer Overflow
  14171. ---------------------------------------------------
  14172. Overflow in signed integer division is not always harmless: for
  14173. example, on CPUs of the i386 family, dividing `INT_MIN' by `-1' yields
  14174. a SIGFPE signal which by default terminates the program. Worse, taking
  14175. the remainder of these two values typically yields the same signal on
  14176. these CPUs, even though the C standard requires `INT_MIN % -1' to yield
  14177. zero because the expression does not overflow.
  14178. 
  14179. File: autoconf.info, Node: Preprocessor Arithmetic, Next: Null Pointers, Prev: Integer Overflow, Up: Portable C and C++
  14180. 13.3 Preprocessor Arithmetic
  14181. ============================
  14182. In C99, preprocessor arithmetic, used for `#if' expressions, must be
  14183. evaluated as if all signed values are of type `intmax_t' and all
  14184. unsigned values of type `uintmax_t'. Many compilers are buggy in this
  14185. area, though. For example, as of 2007, Sun C mishandles `#if LLONG_MIN
  14186. < 0' on a platform with 32-bit `long int' and 64-bit `long long int'.
  14187. Also, some older preprocessors mishandle constants ending in `LL'. To
  14188. work around these problems, you can compute the value of expressions
  14189. like `LONG_MAX < LLONG_MAX' at `configure'-time rather than at
  14190. `#if'-time.
  14191. 
  14192. File: autoconf.info, Node: Null Pointers, Next: Buffer Overruns, Prev: Preprocessor Arithmetic, Up: Portable C and C++
  14193. 13.4 Properties of Null Pointers
  14194. ================================
  14195. Most modern hosts reliably fail when you attempt to dereference a null
  14196. pointer.
  14197. On almost all modern hosts, null pointers use an all-bits-zero
  14198. internal representation, so you can reliably use `memset' with 0 to set
  14199. all the pointers in an array to null values.
  14200. If `p' is a null pointer to an object type, the C expression `p + 0'
  14201. always evaluates to `p' on modern hosts, even though the standard says
  14202. that it has undefined behavior.
  14203. 
  14204. File: autoconf.info, Node: Buffer Overruns, Next: Volatile Objects, Prev: Null Pointers, Up: Portable C and C++
  14205. 13.5 Buffer Overruns and Subscript Errors
  14206. =========================================
  14207. Buffer overruns and subscript errors are the most common dangerous
  14208. errors in C programs. They result in undefined behavior because storing
  14209. outside an array typically modifies storage that is used by some other
  14210. object, and most modern systems lack runtime checks to catch these
  14211. errors. Programs should not rely on buffer overruns being caught.
  14212. There is one exception to the usual rule that a portable program
  14213. cannot address outside an array. In C, it is valid to compute the
  14214. address just past an object, e.g., `&a[N]' where `a' has `N' elements,
  14215. so long as you do not dereference the resulting pointer. But it is not
  14216. valid to compute the address just before an object, e.g., `&a[-1]'; nor
  14217. is it valid to compute two past the end, e.g., `&a[N+1]'. On most
  14218. platforms `&a[-1] < &a[0] && &a[N] < &a[N+1]', but this is not reliable
  14219. in general, and it is usually easy enough to avoid the potential
  14220. portability problem, e.g., by allocating an extra unused array element
  14221. at the start or end.
  14222. Valgrind (http://valgrind.org/) can catch many overruns. GCC users
  14223. might also consider using the `-fmudflap' option to catch overruns.
  14224. Buffer overruns are usually caused by off-by-one errors, but there
  14225. are more subtle ways to get them.
  14226. Using `int' values to index into an array or compute array sizes
  14227. causes problems on typical 64-bit hosts where an array index might be
  14228. 2^31 or larger. Index values of type `size_t' avoid this problem, but
  14229. cannot be negative. Index values of type `ptrdiff_t' are signed, and
  14230. are wide enough in practice.
  14231. If you add or multiply two numbers to calculate an array size, e.g.,
  14232. `malloc (x * sizeof y + z)', havoc ensues if the addition or
  14233. multiplication overflows.
  14234. Many implementations of the `alloca' function silently misbehave and
  14235. can generate buffer overflows if given sizes that are too large. The
  14236. size limits are implementation dependent, but are at least 4000 bytes
  14237. on all platforms that we know about.
  14238. The standard functions `asctime', `asctime_r', `ctime', `ctime_r',
  14239. and `gets' are prone to buffer overflows, and portable code should not
  14240. use them unless the inputs are known to be within certain limits. The
  14241. time-related functions can overflow their buffers if given timestamps
  14242. out of range (e.g., a year less than -999 or greater than 9999).
  14243. Time-related buffer overflows cannot happen with recent-enough versions
  14244. of the GNU C library, but are possible with other implementations. The
  14245. `gets' function is the worst, since it almost invariably overflows its
  14246. buffer when presented with an input line larger than the buffer.
  14247. 
  14248. File: autoconf.info, Node: Volatile Objects, Next: Floating Point Portability, Prev: Buffer Overruns, Up: Portable C and C++
  14249. 13.6 Volatile Objects
  14250. =====================
  14251. The keyword `volatile' is often misunderstood in portable code. Its
  14252. use inhibits some memory-access optimizations, but programmers often
  14253. wish that it had a different meaning than it actually does.
  14254. `volatile' was designed for code that accesses special objects like
  14255. memory-mapped device registers whose contents spontaneously change.
  14256. Such code is inherently low-level, and it is difficult to specify
  14257. portably what `volatile' means in these cases. The C standard says,
  14258. "What constitutes an access to an object that has volatile-qualified
  14259. type is implementation-defined," so in theory each implementation is
  14260. supposed to fill in the gap by documenting what `volatile' means for
  14261. that implementation. In practice, though, this documentation is
  14262. usually absent or incomplete.
  14263. One area of confusion is the distinction between objects defined with
  14264. volatile types, and volatile lvalues. From the C standard's point of
  14265. view, an object defined with a volatile type has externally visible
  14266. behavior. You can think of such objects as having little oscilloscope
  14267. probes attached to them, so that the user can observe some properties of
  14268. accesses to them, just as the user can observe data written to output
  14269. files. However, the standard does not make it clear whether users can
  14270. observe accesses by volatile lvalues to ordinary objects. For example:
  14271. /* Declare and access a volatile object.
  14272. Accesses to X are "visible" to users. */
  14273. static int volatile x;
  14274. x = 1;
  14275. /* Access two ordinary objects via a volatile lvalue.
  14276. It's not clear whether accesses to *P are "visible". */
  14277. int y;
  14278. int *z = malloc (sizeof (int));
  14279. int volatile *p;
  14280. p = &y;
  14281. *p = 1;
  14282. p = z;
  14283. *p = 1;
  14284. Programmers often wish that `volatile' meant "Perform the memory
  14285. access here and now, without merging several memory accesses, without
  14286. changing the memory word size, and without reordering." But the C
  14287. standard does not require this. For objects defined with a volatile
  14288. type, accesses must be done before the next sequence point; but
  14289. otherwise merging, reordering, and word-size change is allowed. Worse,
  14290. it is not clear from the standard whether volatile lvalues provide more
  14291. guarantees in general than nonvolatile lvalues, if the underlying
  14292. objects are ordinary.
  14293. Even when accessing objects defined with a volatile type, the C
  14294. standard allows only extremely limited signal handlers: the behavior is
  14295. undefined if a signal handler reads any nonlocal object, or writes to
  14296. any nonlocal object whose type is not `sig_atomic_t volatile', or calls
  14297. any standard library function other than `abort', `signal', and (if C99)
  14298. `_Exit'. Hence C compilers need not worry about a signal handler
  14299. disturbing ordinary computation, unless the computation accesses a
  14300. `sig_atomic_t volatile' lvalue that is not a local variable. (There is
  14301. an obscure exception for accesses via a pointer to a volatile
  14302. character, since it may point into part of a `sig_atomic_t volatile'
  14303. object.) Posix adds to the list of library functions callable from a
  14304. portable signal handler, but otherwise is like the C standard in this
  14305. area.
  14306. Some C implementations allow memory-access optimizations within each
  14307. translation unit, such that actual behavior agrees with the behavior
  14308. required by the standard only when calling a function in some other
  14309. translation unit, and a signal handler acts like it was called from a
  14310. different translation unit. The C standard hints that in these
  14311. implementations, objects referred to by signal handlers "would require
  14312. explicit specification of `volatile' storage, as well as other
  14313. implementation-defined restrictions." But unfortunately even for this
  14314. special case these other restrictions are often not documented well.
  14315. *Note When is a Volatile Object Accessed?: (gcc)Volatiles, for some
  14316. restrictions imposed by GCC. *Note Defining Signal Handlers:
  14317. (libc)Defining Handlers, for some restrictions imposed by the GNU C
  14318. library. Restrictions differ on other platforms.
  14319. If possible, it is best to use a signal handler that fits within the
  14320. limits imposed by the C and Posix standards.
  14321. If this is not practical, you can try the following rules of thumb.
  14322. A signal handler should access only volatile lvalues, preferably lvalues
  14323. that refer to objects defined with a volatile type, and should not
  14324. assume that the accessed objects have an internally consistent state if
  14325. they are larger than a machine word. Furthermore, installers should
  14326. employ compilers and compiler options that are commonly used for
  14327. building operating system kernels, because kernels often need more from
  14328. `volatile' than the C Standard requires, and installers who compile an
  14329. application in a similar environment can sometimes benefit from the
  14330. extra constraints imposed by kernels on compilers. Admittedly we are
  14331. handwaving somewhat here, as there are few guarantees in this area; the
  14332. rules of thumb may help to fix some bugs but there is a good chance
  14333. that they will not fix them all.
  14334. For `volatile', C++ has the same problems that C does.
  14335. Multithreaded applications have even more problems with `volatile', but
  14336. they are beyond the scope of this section.
  14337. The bottom line is that using `volatile' typically hurts performance
  14338. but should not hurt correctness. In some cases its use does help
  14339. correctness, but these cases are often so poorly understood that all
  14340. too often adding `volatile' to a data structure merely alleviates some
  14341. symptoms of a bug while not fixing the bug in general.
  14342. 
  14343. File: autoconf.info, Node: Floating Point Portability, Next: Exiting Portably, Prev: Volatile Objects, Up: Portable C and C++
  14344. 13.7 Floating Point Portability
  14345. ===============================
  14346. Almost all modern systems use IEEE-754 floating point, and it is safe to
  14347. assume IEEE-754 in most portable code these days. For more information,
  14348. please see David Goldberg's classic paper What Every Computer Scientist
  14349. Should Know About Floating-Point Arithmetic
  14350. (http://www.validlab.com/goldberg/paper.pdf).
  14351. 
  14352. File: autoconf.info, Node: Exiting Portably, Prev: Floating Point Portability, Up: Portable C and C++
  14353. 13.8 Exiting Portably
  14354. =====================
  14355. A C or C++ program can exit with status N by returning N from the
  14356. `main' function. Portable programs are supposed to exit either with
  14357. status 0 or `EXIT_SUCCESS' to succeed, or with status `EXIT_FAILURE' to
  14358. fail, but in practice it is portable to fail by exiting with status 1,
  14359. and test programs that assume Posix can fail by exiting with status
  14360. values from 1 through 255. Programs on SunOS 2.0 (1985) through 3.5.2
  14361. (1988) incorrectly exited with zero status when `main' returned
  14362. nonzero, but ancient systems like these are no longer of practical
  14363. concern.
  14364. A program can also exit with status N by passing N to the `exit'
  14365. function, and a program can fail by calling the `abort' function. If a
  14366. program is specialized to just some platforms, it can fail by calling
  14367. functions specific to those platforms, e.g., `_exit' (Posix) and
  14368. `_Exit' (C99). However, like other functions, an exit function should
  14369. be declared, typically by including a header. For example, if a C
  14370. program calls `exit', it should include `stdlib.h' either directly or
  14371. via the default includes (*note Default Includes::).
  14372. A program can fail due to undefined behavior such as dereferencing a
  14373. null pointer, but this is not recommended as undefined behavior allows
  14374. an implementation to do whatever it pleases and this includes exiting
  14375. successfully.
  14376. 
  14377. File: autoconf.info, Node: Manual Configuration, Next: Site Configuration, Prev: Portable C and C++, Up: Top
  14378. 14 Manual Configuration
  14379. ***********************
  14380. A few kinds of features can't be guessed automatically by running test
  14381. programs. For example, the details of the object-file format, or
  14382. special options that need to be passed to the compiler or linker. You
  14383. can check for such features using ad-hoc means, such as having
  14384. `configure' check the output of the `uname' program, or looking for
  14385. libraries that are unique to particular systems. However, Autoconf
  14386. provides a uniform method for handling unguessable features.
  14387. * Menu:
  14388. * Specifying Target Triplets:: Specifying target triplets
  14389. * Canonicalizing:: Getting the canonical system type
  14390. * Using System Type:: What to do with the system type
  14391. 
  14392. File: autoconf.info, Node: Specifying Target Triplets, Next: Canonicalizing, Up: Manual Configuration
  14393. 14.1 Specifying target triplets
  14394. ===============================
  14395. Autoconf-generated `configure' scripts can make decisions based on a
  14396. canonical name for the system type, or "target triplet", which has the
  14397. form: `CPU-VENDOR-OS', where OS can be `SYSTEM' or `KERNEL-SYSTEM'
  14398. `configure' can usually guess the canonical name for the type of
  14399. system it's running on. To do so it runs a script called
  14400. `config.guess', which infers the name using the `uname' command or
  14401. symbols predefined by the C preprocessor.
  14402. Alternately, the user can specify the system type with command line
  14403. arguments to `configure' (*note System Type::. Doing so is necessary
  14404. when cross-compiling. In the most complex case of cross-compiling,
  14405. three system types are involved. The options to specify them are:
  14406. `--build=BUILD-TYPE'
  14407. the type of system on which the package is being configured and
  14408. compiled. It defaults to the result of running `config.guess'.
  14409. Specifying a BUILD-TYPE that differs from HOST-TYPE enables
  14410. cross-compilation mode.
  14411. `--host=HOST-TYPE'
  14412. the type of system on which the package runs. By default it is the
  14413. same as the build machine. Specifying a HOST-TYPE that differs
  14414. from BUILD-TYPE, when BUILD-TYPE was also explicitly specified,
  14415. enables cross-compilation mode.
  14416. `--target=TARGET-TYPE'
  14417. the type of system for which any compiler tools in the package
  14418. produce code (rarely needed). By default, it is the same as host.
  14419. If you mean to override the result of `config.guess', use `--build',
  14420. not `--host', since the latter enables cross-compilation. For
  14421. historical reasons, whenever you specify `--host', be sure to specify
  14422. `--build' too; this will be fixed in the future. So, to enter
  14423. cross-compilation mode, use a command like this
  14424. ./configure --build=i686-pc-linux-gnu --host=m68k-coff
  14425. Note that if you do not specify `--host', `configure' fails if it can't
  14426. run the code generated by the specified compiler. For example,
  14427. configuring as follows fails:
  14428. ./configure CC=m68k-coff-gcc
  14429. When cross-compiling, `configure' will warn about any tools
  14430. (compilers, linkers, assemblers) whose name is not prefixed with the
  14431. host type. This is an aid to users performing cross-compilation.
  14432. Continuing the example above, if a cross-compiler named `cc' is used
  14433. with a native `pkg-config', then libraries found by `pkg-config' will
  14434. likely cause subtle build failures; but using the names `m68k-coff-cc'
  14435. and `m68k-coff-pkg-config' avoids any confusion. Avoiding the warning
  14436. is as simple as creating the correct symlinks naming the cross tools.
  14437. `configure' recognizes short aliases for many system types; for
  14438. example, `decstation' can be used instead of `mips-dec-ultrix4.2'.
  14439. `configure' runs a script called `config.sub' to canonicalize system
  14440. type aliases.
  14441. This section deliberately omits the description of the obsolete
  14442. interface; see *note Hosts and Cross-Compilation::.
  14443. 
  14444. File: autoconf.info, Node: Canonicalizing, Next: Using System Type, Prev: Specifying Target Triplets, Up: Manual Configuration
  14445. 14.2 Getting the Canonical System Type
  14446. ======================================
  14447. The following macros make the system type available to `configure'
  14448. scripts.
  14449. The variables `build_alias', `host_alias', and `target_alias' are
  14450. always exactly the arguments of `--build', `--host', and `--target'; in
  14451. particular, they are left empty if the user did not use them, even if
  14452. the corresponding `AC_CANONICAL' macro was run. Any configure script
  14453. may use these variables anywhere. These are the variables that should
  14454. be used when in interaction with the user.
  14455. If you need to recognize some special environments based on their
  14456. system type, run the following macros to get canonical system names.
  14457. These variables are not set before the macro call.
  14458. If you use these macros, you must distribute `config.guess' and
  14459. `config.sub' along with your source code. *Note Output::, for
  14460. information about the `AC_CONFIG_AUX_DIR' macro which you can use to
  14461. control in which directory `configure' looks for those scripts.
  14462. -- Macro: AC_CANONICAL_BUILD
  14463. Compute the canonical build-system type variable, `build', and its
  14464. three individual parts `build_cpu', `build_vendor', and `build_os'.
  14465. If `--build' was specified, then `build' is the canonicalization
  14466. of `build_alias' by `config.sub', otherwise it is determined by
  14467. the shell script `config.guess'.
  14468. -- Macro: AC_CANONICAL_HOST
  14469. Compute the canonical host-system type variable, `host', and its
  14470. three individual parts `host_cpu', `host_vendor', and `host_os'.
  14471. If `--host' was specified, then `host' is the canonicalization of
  14472. `host_alias' by `config.sub', otherwise it defaults to `build'.
  14473. -- Macro: AC_CANONICAL_TARGET
  14474. Compute the canonical target-system type variable, `target', and
  14475. its three individual parts `target_cpu', `target_vendor', and
  14476. `target_os'.
  14477. If `--target' was specified, then `target' is the canonicalization
  14478. of `target_alias' by `config.sub', otherwise it defaults to `host'.
  14479. Note that there can be artifacts due to the backward compatibility
  14480. code. *Note Hosts and Cross-Compilation::, for more.
  14481. 
  14482. File: autoconf.info, Node: Using System Type, Prev: Canonicalizing, Up: Manual Configuration
  14483. 14.3 Using the System Type
  14484. ==========================
  14485. In `configure.ac' the system type is generally used by one or more
  14486. `case' statements to select system-specifics. Shell wildcards can be
  14487. used to match a group of system types.
  14488. For example, an extra assembler code object file could be chosen,
  14489. giving access to a CPU cycle counter register. `$(CYCLE_OBJ)' in the
  14490. following would be used in a makefile to add the object to a program or
  14491. library.
  14492. AS_CASE([$host],
  14493. [alpha*-*-*], [CYCLE_OBJ=rpcc.o],
  14494. [i?86-*-*], [CYCLE_OBJ=rdtsc.o],
  14495. [CYCLE_OBJ=""]
  14496. )
  14497. AC_SUBST([CYCLE_OBJ])
  14498. `AC_CONFIG_LINKS' (*note Configuration Links::) is another good way
  14499. to select variant source files, for example optimized code for some
  14500. CPUs. The configured CPU type doesn't always indicate exact CPU types,
  14501. so some runtime capability checks may be necessary too.
  14502. case $host in
  14503. alpha*-*-*) AC_CONFIG_LINKS([dither.c:alpha/dither.c]) ;;
  14504. powerpc*-*-*) AC_CONFIG_LINKS([dither.c:powerpc/dither.c]) ;;
  14505. *-*-*) AC_CONFIG_LINKS([dither.c:generic/dither.c]) ;;
  14506. esac
  14507. The host system type can also be used to find cross-compilation tools
  14508. with `AC_CHECK_TOOL' (*note Generic Programs::).
  14509. The above examples all show `$host', since this is where the code is
  14510. going to run. Only rarely is it necessary to test `$build' (which is
  14511. where the build is being done).
  14512. Whenever you're tempted to use `$host' it's worth considering
  14513. whether some sort of probe would be better. New system types come along
  14514. periodically or previously missing features are added. Well-written
  14515. probes can adapt themselves to such things, but hard-coded lists of
  14516. names can't. Here are some guidelines,
  14517. * Availability of libraries and library functions should always be
  14518. checked by probing.
  14519. * Variant behavior of system calls is best identified with runtime
  14520. tests if possible, but bug workarounds or obscure difficulties
  14521. might have to be driven from `$host'.
  14522. * Assembler code is inevitably highly CPU-specific and is best
  14523. selected according to `$host_cpu'.
  14524. * Assembler variations like underscore prefix on globals or ELF
  14525. versus COFF type directives are however best determined by
  14526. probing, perhaps even examining the compiler output.
  14527. `$target' is for use by a package creating a compiler or similar.
  14528. For ordinary packages it's meaningless and should not be used. It
  14529. indicates what the created compiler should generate code for, if it can
  14530. cross-compile. `$target' generally selects various hard-coded CPU and
  14531. system conventions, since usually the compiler or tools under
  14532. construction themselves determine how the target works.
  14533. 
  14534. File: autoconf.info, Node: Site Configuration, Next: Running configure Scripts, Prev: Manual Configuration, Up: Top
  14535. 15 Site Configuration
  14536. *********************
  14537. `configure' scripts support several kinds of local configuration
  14538. decisions. There are ways for users to specify where external software
  14539. packages are, include or exclude optional features, install programs
  14540. under modified names, and set default values for `configure' options.
  14541. * Menu:
  14542. * Help Formatting:: Customizing `configure --help'
  14543. * External Software:: Working with other optional software
  14544. * Package Options:: Selecting optional features
  14545. * Pretty Help Strings:: Formatting help string
  14546. * Option Checking:: Controlling checking of `configure' options
  14547. * Site Details:: Configuring site details
  14548. * Transforming Names:: Changing program names when installing
  14549. * Site Defaults:: Giving `configure' local defaults
  14550. 
  14551. File: autoconf.info, Node: Help Formatting, Next: External Software, Up: Site Configuration
  14552. 15.1 Controlling Help Output
  14553. ============================
  14554. Users consult `configure --help' to learn of configuration decisions
  14555. specific to your package. By default, `configure' breaks this output
  14556. into sections for each type of option; within each section, help
  14557. strings appear in the order `configure.ac' defines them:
  14558. Optional Features:
  14559. ...
  14560. --enable-bar include bar
  14561. Optional Packages:
  14562. ...
  14563. --with-foo use foo
  14564. -- Macro: AC_PRESERVE_HELP_ORDER
  14565. Request an alternate `--help' format, in which options of all
  14566. types appear together, in the order defined. Call this macro
  14567. before any `AC_ARG_ENABLE' or `AC_ARG_WITH'.
  14568. Optional Features and Packages:
  14569. ...
  14570. --enable-bar include bar
  14571. --with-foo use foo
  14572. 
  14573. File: autoconf.info, Node: External Software, Next: Package Options, Prev: Help Formatting, Up: Site Configuration
  14574. 15.2 Working With External Software
  14575. ===================================
  14576. Some packages require, or can optionally use, other software packages
  14577. that are already installed. The user can give `configure' command line
  14578. options to specify which such external software to use. The options
  14579. have one of these forms:
  14580. --with-PACKAGE[=ARG]
  14581. --without-PACKAGE
  14582. For example, `--with-gnu-ld' means work with the GNU linker instead
  14583. of some other linker. `--with-x' means work with The X Window System.
  14584. The user can give an argument by following the package name with `='
  14585. and the argument. Giving an argument of `no' is for packages that are
  14586. used by default; it says to _not_ use the package. An argument that is
  14587. neither `yes' nor `no' could include a name or number of a version of
  14588. the other package, to specify more precisely which other package this
  14589. program is supposed to work with. If no argument is given, it defaults
  14590. to `yes'. `--without-PACKAGE' is equivalent to `--with-PACKAGE=no'.
  14591. Normally `configure' scripts complain about `--with-PACKAGE' options
  14592. that they do not support. *Note Option Checking::, for details, and
  14593. for how to override the defaults.
  14594. For each external software package that may be used, `configure.ac'
  14595. should call `AC_ARG_WITH' to detect whether the `configure' user asked
  14596. to use it. Whether each package is used or not by default, and which
  14597. arguments are valid, is up to you.
  14598. -- Macro: AC_ARG_WITH (PACKAGE, HELP-STRING, [ACTION-IF-GIVEN],
  14599. [ACTION-IF-NOT-GIVEN])
  14600. If the user gave `configure' the option `--with-PACKAGE' or
  14601. `--without-PACKAGE', run shell commands ACTION-IF-GIVEN. If
  14602. neither option was given, run shell commands ACTION-IF-NOT-GIVEN.
  14603. The name PACKAGE indicates another software package that this
  14604. program should work with. It should consist only of alphanumeric
  14605. characters, dashes, plus signs, and dots.
  14606. The option's argument is available to the shell commands
  14607. ACTION-IF-GIVEN in the shell variable `withval', which is actually
  14608. just the value of the shell variable named `with_PACKAGE', with
  14609. any non-alphanumeric characters in PACKAGE changed into `_'. You
  14610. may use that variable instead, if you wish.
  14611. The argument HELP-STRING is a description of the option that looks
  14612. like this:
  14613. --with-readline support fancy command line editing
  14614. HELP-STRING may be more than one line long, if more detail is
  14615. needed. Just make sure the columns line up in `configure --help'.
  14616. Avoid tabs in the help string. The easiest way to provide the
  14617. proper leading whitespace is to format your HELP-STRING with the
  14618. macro `AS_HELP_STRING' (*note Pretty Help Strings::).
  14619. The following example shows how to use the `AC_ARG_WITH' macro in
  14620. a common situation. You want to let the user decide whether to
  14621. enable support for an external library (e.g., the readline
  14622. library); if the user specified neither `--with-readline' nor
  14623. `--without-readline', you want to enable support for readline only
  14624. if the library is available on the system.
  14625. AC_ARG_WITH([readline],
  14626. [AS_HELP_STRING([--with-readline],
  14627. [support fancy command line editing @<:@default=check@:>@])],
  14628. [],
  14629. [with_readline=check])
  14630. LIBREADLINE=
  14631. AS_IF([test "x$with_readline" != xno],
  14632. [AC_CHECK_LIB([readline], [main],
  14633. [AC_SUBST([LIBREADLINE], ["-lreadline -lncurses"])
  14634. AC_DEFINE([HAVE_LIBREADLINE], [1],
  14635. [Define if you have libreadline])
  14636. ],
  14637. [if test "x$with_readline" != xcheck; then
  14638. AC_MSG_FAILURE(
  14639. [--with-readline was given, but test for readline failed])
  14640. fi
  14641. ], -lncurses)])
  14642. The next example shows how to use `AC_ARG_WITH' to give the user
  14643. the possibility to enable support for the readline library, in
  14644. case it is still experimental and not well tested, and is
  14645. therefore disabled by default.
  14646. AC_ARG_WITH([readline],
  14647. [AS_HELP_STRING([--with-readline],
  14648. [enable experimental support for readline])],
  14649. [],
  14650. [with_readline=no])
  14651. LIBREADLINE=
  14652. AS_IF([test "x$with_readline" != xno],
  14653. [AC_CHECK_LIB([readline], [main],
  14654. [AC_SUBST([LIBREADLINE], ["-lreadline -lncurses"])
  14655. AC_DEFINE([HAVE_LIBREADLINE], [1],
  14656. [Define if you have libreadline])
  14657. ],
  14658. [AC_MSG_FAILURE(
  14659. [--with-readline was given, but test for readline failed])],
  14660. [-lncurses])])
  14661. The last example shows how to use `AC_ARG_WITH' to give the user
  14662. the possibility to disable support for the readline library, given
  14663. that it is an important feature and that it should be enabled by
  14664. default.
  14665. AC_ARG_WITH([readline],
  14666. [AS_HELP_STRING([--without-readline],
  14667. [disable support for readline])],
  14668. [],
  14669. [with_readline=yes])
  14670. LIBREADLINE=
  14671. AS_IF([test "x$with_readline" != xno],
  14672. [AC_CHECK_LIB([readline], [main],
  14673. [AC_SUBST([LIBREADLINE], ["-lreadline -lncurses"])
  14674. AC_DEFINE([HAVE_LIBREADLINE], [1],
  14675. [Define if you have libreadline])
  14676. ],
  14677. [AC_MSG_FAILURE(
  14678. [readline test failed (--without-readline to disable)])],
  14679. [-lncurses])])
  14680. These three examples can be easily adapted to the case where
  14681. `AC_ARG_ENABLE' should be preferred to `AC_ARG_WITH' (see *note
  14682. Package Options::).
  14683. 
  14684. File: autoconf.info, Node: Package Options, Next: Pretty Help Strings, Prev: External Software, Up: Site Configuration
  14685. 15.3 Choosing Package Options
  14686. =============================
  14687. If a software package has optional compile-time features, the user can
  14688. give `configure' command line options to specify whether to compile
  14689. them. The options have one of these forms:
  14690. --enable-FEATURE[=ARG]
  14691. --disable-FEATURE
  14692. These options allow users to choose which optional features to build
  14693. and install. `--enable-FEATURE' options should never make a feature
  14694. behave differently or cause one feature to replace another. They
  14695. should only cause parts of the program to be built rather than left out.
  14696. The user can give an argument by following the feature name with `='
  14697. and the argument. Giving an argument of `no' requests that the feature
  14698. _not_ be made available. A feature with an argument looks like
  14699. `--enable-debug=stabs'. If no argument is given, it defaults to `yes'.
  14700. `--disable-FEATURE' is equivalent to `--enable-FEATURE=no'.
  14701. Normally `configure' scripts complain about `--enable-PACKAGE'
  14702. options that they do not support. *Note Option Checking::, for
  14703. details, and for how to override the defaults.
  14704. For each optional feature, `configure.ac' should call
  14705. `AC_ARG_ENABLE' to detect whether the `configure' user asked to include
  14706. it. Whether each feature is included or not by default, and which
  14707. arguments are valid, is up to you.
  14708. -- Macro: AC_ARG_ENABLE (FEATURE, HELP-STRING, [ACTION-IF-GIVEN],
  14709. [ACTION-IF-NOT-GIVEN])
  14710. If the user gave `configure' the option `--enable-FEATURE' or
  14711. `--disable-FEATURE', run shell commands ACTION-IF-GIVEN. If
  14712. neither option was given, run shell commands ACTION-IF-NOT-GIVEN.
  14713. The name FEATURE indicates an optional user-level facility. It
  14714. should consist only of alphanumeric characters, dashes, plus
  14715. signs, and dots.
  14716. The option's argument is available to the shell commands
  14717. ACTION-IF-GIVEN in the shell variable `enableval', which is
  14718. actually just the value of the shell variable named
  14719. `enable_FEATURE', with any non-alphanumeric characters in FEATURE
  14720. changed into `_'. You may use that variable instead, if you wish.
  14721. The HELP-STRING argument is like that of `AC_ARG_WITH' (*note
  14722. External Software::).
  14723. You should format your HELP-STRING with the macro `AS_HELP_STRING'
  14724. (*note Pretty Help Strings::).
  14725. See the examples suggested with the definition of `AC_ARG_WITH'
  14726. (*note External Software::) to get an idea of possible
  14727. applications of `AC_ARG_ENABLE'.
  14728. 
  14729. File: autoconf.info, Node: Pretty Help Strings, Next: Option Checking, Prev: Package Options, Up: Site Configuration
  14730. 15.4 Making Your Help Strings Look Pretty
  14731. =========================================
  14732. Properly formatting the `help strings' which are used in `AC_ARG_WITH'
  14733. (*note External Software::) and `AC_ARG_ENABLE' (*note Package
  14734. Options::) can be challenging. Specifically, you want your own `help
  14735. strings' to line up in the appropriate columns of `configure --help'
  14736. just like the standard Autoconf `help strings' do. This is the purpose
  14737. of the `AS_HELP_STRING' macro.
  14738. -- Macro: AS_HELP_STRING (LEFT-HAND-SIDE, RIGHT-HAND-SIDE
  14739. [INDENT-COLUMN = `26'], [WRAP-COLUMN = `79'])
  14740. Expands into a help string that looks pretty when the user executes
  14741. `configure --help'. It is typically used in `AC_ARG_WITH' (*note
  14742. External Software::) or `AC_ARG_ENABLE' (*note Package Options::).
  14743. The following example makes this clearer.
  14744. AC_ARG_WITH([foo],
  14745. [AS_HELP_STRING([--with-foo],
  14746. [use foo (default is no)])],
  14747. [use_foo=$withval],
  14748. [use_foo=no])
  14749. Then the last few lines of `configure --help' appear like this:
  14750. --enable and --with options recognized:
  14751. --with-foo use foo (default is no)
  14752. Macro expansion is performed on the first argument. However, the
  14753. second argument of `AS_HELP_STRING' is treated as a whitespace
  14754. separated list of text to be reformatted, and is not subject to
  14755. macro expansion. Since it is not expanded, it should not be
  14756. double quoted. *Note Autoconf Language::, for a more detailed
  14757. explanation.
  14758. The `AS_HELP_STRING' macro is particularly helpful when the
  14759. LEFT-HAND-SIDE and/or RIGHT-HAND-SIDE are composed of macro
  14760. arguments, as shown in the following example. Be aware that
  14761. LEFT-HAND-SIDE may not expand to unbalanced quotes, although
  14762. quadrigraphs can be used.
  14763. AC_DEFUN([MY_ARG_WITH],
  14764. [AC_ARG_WITH(m4_translit([[$1]], [_], [-]),
  14765. [AS_HELP_STRING([--with-m4_translit([$1], [_], [-])],
  14766. [use $1 (default is $2)])],
  14767. [use_[]$1=$withval],
  14768. [use_[]$1=$2])])
  14769. MY_ARG_WITH([a_b], [no])
  14770. Here, the last few lines of `configure --help' will include:
  14771. --enable and --with options recognized:
  14772. --with-a-b use a_b (default is no)
  14773. The parameters INDENT-COLUMN and WRAP-COLUMN were introduced in
  14774. Autoconf 2.62. Generally, they should not be specified; they exist
  14775. for fine-tuning of the wrapping.
  14776. AS_HELP_STRING([--option], [description of option])
  14777. => --option description of option
  14778. AS_HELP_STRING([--option], [description of option], [15], [30])
  14779. => --option description of
  14780. => option
  14781. 
  14782. File: autoconf.info, Node: Option Checking, Next: Site Details, Prev: Pretty Help Strings, Up: Site Configuration
  14783. 15.5 Controlling Checking of `configure' Options
  14784. ================================================
  14785. The `configure' script checks its command-line options against a list
  14786. of known options, like `--help' or `--config-cache'. An unknown option
  14787. ordinarily indicates a mistake by the user and `configure' halts with
  14788. an error. However, by default unknown `--with-PACKAGE' and
  14789. `--enable-FEATURE' options elicit only a warning, to support
  14790. configuring entire source trees.
  14791. Source trees often contain multiple packages with a top-level
  14792. `configure' script that uses the `AC_CONFIG_SUBDIRS' macro (*note
  14793. Subdirectories::). Because the packages generally support different
  14794. `--with-PACKAGE' and `--enable-FEATURE' options, the GNU Coding
  14795. Standards say they must accept unrecognized options without halting.
  14796. Even a warning message is undesirable here, so `AC_CONFIG_SUBDIRS'
  14797. automatically disables the warnings.
  14798. This default behavior may be modified in two ways. First, the
  14799. installer can invoke `configure --disable-option-checking' to disable
  14800. these warnings, or invoke `configure --enable-option-checking=fatal'
  14801. options to turn them into fatal errors, respectively. Second, the
  14802. maintainer can use `AC_DISABLE_OPTION_CHECKING'.
  14803. -- Macro: AC_DISABLE_OPTION_CHECKING
  14804. By default, disable warnings related to any unrecognized
  14805. `--with-PACKAGE' or `--enable-FEATURE' options. This is implied
  14806. by `AC_CONFIG_SUBDIRS'.
  14807. The installer can override this behavior by passing
  14808. `--enable-option-checking' (enable warnings) or
  14809. `--enable-option-checking=fatal' (enable errors) to `configure'.
  14810. 
  14811. File: autoconf.info, Node: Site Details, Next: Transforming Names, Prev: Option Checking, Up: Site Configuration
  14812. 15.6 Configuring Site Details
  14813. =============================
  14814. Some software packages require complex site-specific information. Some
  14815. examples are host names to use for certain services, company names, and
  14816. email addresses to contact. Since some configuration scripts generated
  14817. by Metaconfig ask for such information interactively, people sometimes
  14818. wonder how to get that information in Autoconf-generated configuration
  14819. scripts, which aren't interactive.
  14820. Such site configuration information should be put in a file that is
  14821. edited _only by users_, not by programs. The location of the file can
  14822. either be based on the `prefix' variable, or be a standard location
  14823. such as the user's home directory. It could even be specified by an
  14824. environment variable. The programs should examine that file at
  14825. runtime, rather than at compile time. Runtime configuration is more
  14826. convenient for users and makes the configuration process simpler than
  14827. getting the information while configuring. *Note Variables for
  14828. Installation Directories: (standards)Directory Variables, for more
  14829. information on where to put data files.
  14830. 
  14831. File: autoconf.info, Node: Transforming Names, Next: Site Defaults, Prev: Site Details, Up: Site Configuration
  14832. 15.7 Transforming Program Names When Installing
  14833. ===============================================
  14834. Autoconf supports changing the names of programs when installing them.
  14835. In order to use these transformations, `configure.ac' must call the
  14836. macro `AC_ARG_PROGRAM'.
  14837. -- Macro: AC_ARG_PROGRAM
  14838. Place in output variable `program_transform_name' a sequence of
  14839. `sed' commands for changing the names of installed programs.
  14840. If any of the options described below are given to `configure',
  14841. program names are transformed accordingly. Otherwise, if
  14842. `AC_CANONICAL_TARGET' has been called and a `--target' value is
  14843. given, the target type followed by a dash is used as a prefix.
  14844. Otherwise, no program name transformation is done.
  14845. * Menu:
  14846. * Transformation Options:: `configure' options to transform names
  14847. * Transformation Examples:: Sample uses of transforming names
  14848. * Transformation Rules:: Makefile uses of transforming names
  14849. 
  14850. File: autoconf.info, Node: Transformation Options, Next: Transformation Examples, Up: Transforming Names
  14851. 15.7.1 Transformation Options
  14852. -----------------------------
  14853. You can specify name transformations by giving `configure' these
  14854. command line options:
  14855. `--program-prefix=PREFIX'
  14856. prepend PREFIX to the names;
  14857. `--program-suffix=SUFFIX'
  14858. append SUFFIX to the names;
  14859. `--program-transform-name=EXPRESSION'
  14860. perform `sed' substitution EXPRESSION on the names.
  14861. 
  14862. File: autoconf.info, Node: Transformation Examples, Next: Transformation Rules, Prev: Transformation Options, Up: Transforming Names
  14863. 15.7.2 Transformation Examples
  14864. ------------------------------
  14865. These transformations are useful with programs that can be part of a
  14866. cross-compilation development environment. For example, a
  14867. cross-assembler running on a Sun 4 configured with
  14868. `--target=i960-vxworks' is normally installed as `i960-vxworks-as',
  14869. rather than `as', which could be confused with a native Sun 4 assembler.
  14870. You can force a program name to begin with `g', if you don't want
  14871. GNU programs installed on your system to shadow other programs with the
  14872. same name. For example, if you configure GNU `diff' with
  14873. `--program-prefix=g', then when you run `make install' it is installed
  14874. as `/usr/local/bin/gdiff'.
  14875. As a more sophisticated example, you could use
  14876. --program-transform-name='s/^/g/; s/^gg/g/; s/^gless/less/'
  14877. to prepend `g' to most of the program names in a source tree,
  14878. excepting those like `gdb' that already have one and those like `less'
  14879. and `lesskey' that aren't GNU programs. (That is assuming that you
  14880. have a source tree containing those programs that is set up to use this
  14881. feature.)
  14882. One way to install multiple versions of some programs simultaneously
  14883. is to append a version number to the name of one or both. For example,
  14884. if you want to keep Autoconf version 1 around for awhile, you can
  14885. configure Autoconf version 2 using `--program-suffix=2' to install the
  14886. programs as `/usr/local/bin/autoconf2', `/usr/local/bin/autoheader2',
  14887. etc. Nevertheless, pay attention that only the binaries are renamed,
  14888. therefore you'd have problems with the library files which might
  14889. overlap.
  14890. 
  14891. File: autoconf.info, Node: Transformation Rules, Prev: Transformation Examples, Up: Transforming Names
  14892. 15.7.3 Transformation Rules
  14893. ---------------------------
  14894. Here is how to use the variable `program_transform_name' in a
  14895. `Makefile.in':
  14896. PROGRAMS = cp ls rm
  14897. transform = @program_transform_name@
  14898. install:
  14899. for p in $(PROGRAMS); do \
  14900. $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p | \
  14901. sed '$(transform)'`; \
  14902. done
  14903. uninstall:
  14904. for p in $(PROGRAMS); do \
  14905. rm -f $(DESTDIR)$(bindir)/`echo $$p | sed '$(transform)'`; \
  14906. done
  14907. It is guaranteed that `program_transform_name' is never empty, and
  14908. that there are no useless separators. Therefore you may safely embed
  14909. `program_transform_name' within a sed program using `;':
  14910. transform = @program_transform_name@
  14911. transform_exe = s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/
  14912. Whether to do the transformations on documentation files (Texinfo or
  14913. `man') is a tricky question; there seems to be no perfect answer, due
  14914. to the several reasons for name transforming. Documentation is not
  14915. usually particular to a specific architecture, and Texinfo files do not
  14916. conflict with system documentation. But they might conflict with
  14917. earlier versions of the same files, and `man' pages sometimes do
  14918. conflict with system documentation. As a compromise, it is probably
  14919. best to do name transformations on `man' pages but not on Texinfo
  14920. manuals.
  14921. 
  14922. File: autoconf.info, Node: Site Defaults, Prev: Transforming Names, Up: Site Configuration
  14923. 15.8 Setting Site Defaults
  14924. ==========================
  14925. Autoconf-generated `configure' scripts allow your site to provide
  14926. default values for some configuration values. You do this by creating
  14927. site- and system-wide initialization files.
  14928. If the environment variable `CONFIG_SITE' is set, `configure' uses
  14929. its value as the name of a shell script to read; it is recommended that
  14930. this be an absolute file name. Otherwise, it reads the shell script
  14931. `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site'
  14932. if it exists. Thus, settings in machine-specific files override those
  14933. in machine-independent ones in case of conflict.
  14934. Site files can be arbitrary shell scripts, but only certain kinds of
  14935. code are really appropriate to be in them. Because `configure' reads
  14936. any cache file after it has read any site files, a site file can define
  14937. a default cache file to be shared between all Autoconf-generated
  14938. `configure' scripts run on that system (*note Cache Files::). If you
  14939. set a default cache file in a site file, it is a good idea to also set
  14940. the output variable `CC' in that site file, because the cache file is
  14941. only valid for a particular compiler, but many systems have several
  14942. available.
  14943. You can examine or override the value set by a command line option to
  14944. `configure' in a site file; options set shell variables that have the
  14945. same names as the options, with any dashes turned into underscores.
  14946. The exceptions are that `--without-' and `--disable-' options are like
  14947. giving the corresponding `--with-' or `--enable-' option and the value
  14948. `no'. Thus, `--cache-file=localcache' sets the variable `cache_file'
  14949. to the value `localcache'; `--enable-warnings=no' or
  14950. `--disable-warnings' sets the variable `enable_warnings' to the value
  14951. `no'; `--prefix=/usr' sets the variable `prefix' to the value `/usr';
  14952. etc.
  14953. Site files are also good places to set default values for other
  14954. output variables, such as `CFLAGS', if you need to give them non-default
  14955. values: anything you would normally do, repetitively, on the command
  14956. line. If you use non-default values for PREFIX or EXEC_PREFIX
  14957. (wherever you locate the site file), you can set them in the site file
  14958. if you specify it with the `CONFIG_SITE' environment variable.
  14959. You can set some cache values in the site file itself. Doing this is
  14960. useful if you are cross-compiling, where it is impossible to check
  14961. features that require running a test program. You could "prime the
  14962. cache" by setting those values correctly for that system in
  14963. `PREFIX/etc/config.site'. To find out the names of the cache variables
  14964. you need to set, see the documentation of the respective Autoconf
  14965. macro. If the variables or their semantics are undocumented, you may
  14966. need to look for shell variables with `_cv_' in their names in the
  14967. affected `configure' scripts, or in the Autoconf M4 source code for
  14968. those macros; but in that case, their name or semantics may change in a
  14969. future Autoconf version.
  14970. The cache file is careful to not override any variables set in the
  14971. site files. Similarly, you should not override command-line options in
  14972. the site files. Your code should check that variables such as `prefix'
  14973. and `cache_file' have their default values (as set near the top of
  14974. `configure') before changing them.
  14975. Here is a sample file `/usr/share/local/gnu/share/config.site'. The
  14976. command `configure --prefix=/usr/share/local/gnu' would read this file
  14977. (if `CONFIG_SITE' is not set to a different file).
  14978. # /usr/share/local/gnu/share/config.site for configure
  14979. #
  14980. # Change some defaults.
  14981. test "$prefix" = NONE && prefix=/usr/share/local/gnu
  14982. test "$exec_prefix" = NONE && exec_prefix=/usr/local/gnu
  14983. test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=/var
  14984. test "$localstatedir" = '${prefix}/var' && localstatedir=/var
  14985. # Give Autoconf 2.x generated configure scripts a shared default
  14986. # cache file for feature test results, architecture-specific.
  14987. if test "$cache_file" = /dev/null; then
  14988. cache_file="$prefix/var/config.cache"
  14989. # A cache file is only valid for one C compiler.
  14990. CC=gcc
  14991. fi
  14992. Another use of `config.site' is for priming the directory variables
  14993. in a manner consistent with the Filesystem Hierarchy Standard (FHS).
  14994. Once the following file is installed at `/usr/share/config.site', a
  14995. user can execute simply `./configure --prefix=/usr' to get all the
  14996. directories chosen in the locations recommended by FHS.
  14997. # /usr/share/config.site for FHS defaults when installing below /usr,
  14998. # and the respective settings were not changed on the command line.
  14999. if test "$prefix" = /usr; then
  15000. test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
  15001. test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=/var
  15002. test "$localstatedir" = '${prefix}/var' && localstatedir=/var
  15003. fi
  15004. Likewise, on platforms where 64-bit libraries are built by default,
  15005. then installed in `/usr/local/lib64' instead of `/usr/local/lib', it is
  15006. appropriate to install `/usr/local/share/config.site':
  15007. # /usr/local/share/config.site for platforms that prefer
  15008. # the directory /usr/local/lib64 over /usr/local/lib.
  15009. test "$libdir" = '${exec_prefix}/lib' && libdir='${exec_prefix}/lib64'
  15010. 
  15011. File: autoconf.info, Node: Running configure Scripts, Next: config.status Invocation, Prev: Site Configuration, Up: Top
  15012. 16 Running `configure' Scripts
  15013. ******************************
  15014. Below are instructions on how to configure a package that uses a
  15015. `configure' script, suitable for inclusion as an `INSTALL' file in the
  15016. package. A plain-text version of `INSTALL' which you may use comes
  15017. with Autoconf.
  15018. * Menu:
  15019. * Basic Installation:: Instructions for typical cases
  15020. * Compilers and Options:: Selecting compilers and optimization
  15021. * Multiple Architectures:: Compiling for multiple architectures at once
  15022. * Installation Names:: Installing in different directories
  15023. * Optional Features:: Selecting optional features
  15024. * Particular Systems:: Particular systems
  15025. * System Type:: Specifying the system type
  15026. * Sharing Defaults:: Setting site-wide defaults for `configure'
  15027. * Defining Variables:: Specifying the compiler etc.
  15028. * configure Invocation:: Changing how `configure' runs
  15029. 
  15030. File: autoconf.info, Node: Basic Installation, Next: Compilers and Options, Up: Running configure Scripts
  15031. 16.1 Basic Installation
  15032. =======================
  15033. Briefly, the shell commands `./configure; make; make install' should
  15034. configure, build, and install this package. The following
  15035. more-detailed instructions are generic; see the `README' file for
  15036. instructions specific to this package. More recommendations for GNU
  15037. packages can be found in *note Makefile Conventions:
  15038. (standards)Makefile Conventions.
  15039. The `configure' shell script attempts to guess correct values for
  15040. various system-dependent variables used during compilation. It uses
  15041. those values to create a `Makefile' in each directory of the package.
  15042. It may also create one or more `.h' files containing system-dependent
  15043. definitions. Finally, it creates a shell script `config.status' that
  15044. you can run in the future to recreate the current configuration, and a
  15045. file `config.log' containing compiler output (useful mainly for
  15046. debugging `configure').
  15047. It can also use an optional file (typically called `config.cache'
  15048. and enabled with `--cache-file=config.cache' or simply `-C') that saves
  15049. the results of its tests to speed up reconfiguring. Caching is
  15050. disabled by default to prevent problems with accidental use of stale
  15051. cache files.
  15052. If you need to do unusual things to compile the package, please try
  15053. to figure out how `configure' could check whether to do them, and mail
  15054. diffs or instructions to the address given in the `README' so they can
  15055. be considered for the next release. If you are using the cache, and at
  15056. some point `config.cache' contains results you don't want to keep, you
  15057. may remove or edit it.
  15058. The file `configure.ac' (or `configure.in') is used to create
  15059. `configure' by a program called `autoconf'. You need `configure.ac' if
  15060. you want to change it or regenerate `configure' using a newer version
  15061. of `autoconf'.
  15062. The simplest way to compile this package is:
  15063. 1. `cd' to the directory containing the package's source code and type
  15064. `./configure' to configure the package for your system.
  15065. Running `configure' might take a while. While running, it prints
  15066. some messages telling which features it is checking for.
  15067. 2. Type `make' to compile the package.
  15068. 3. Optionally, type `make check' to run any self-tests that come with
  15069. the package, generally using the just-built uninstalled binaries.
  15070. 4. Type `make install' to install the programs and any data files and
  15071. documentation. When installing into a prefix owned by root, it is
  15072. recommended that the package be configured and built as a regular
  15073. user, and only the `make install' phase executed with root
  15074. privileges.
  15075. 5. Optionally, type `make installcheck' to repeat any self-tests, but
  15076. this time using the binaries in their final installed location.
  15077. This target does not install anything. Running this target as a
  15078. regular user, particularly if the prior `make install' required
  15079. root privileges, verifies that the installation completed
  15080. correctly.
  15081. 6. You can remove the program binaries and object files from the
  15082. source code directory by typing `make clean'. To also remove the
  15083. files that `configure' created (so you can compile the package for
  15084. a different kind of computer), type `make distclean'. There is
  15085. also a `make maintainer-clean' target, but that is intended mainly
  15086. for the package's developers. If you use it, you may have to get
  15087. all sorts of other programs in order to regenerate files that came
  15088. with the distribution.
  15089. 7. Often, you can also type `make uninstall' to remove the installed
  15090. files again. In practice, not all packages have tested that
  15091. uninstallation works correctly, even though it is required by the
  15092. GNU Coding Standards.
  15093. 8. Some packages, particularly those that use Automake, provide `make
  15094. distcheck', which can by used by developers to test that all other
  15095. targets like `make install' and `make uninstall' work correctly.
  15096. This target is generally not run by end users.
  15097. 
  15098. File: autoconf.info, Node: Compilers and Options, Next: Multiple Architectures, Prev: Basic Installation, Up: Running configure Scripts
  15099. 16.2 Compilers and Options
  15100. ==========================
  15101. Some systems require unusual options for compilation or linking that the
  15102. `configure' script does not know about. Run `./configure --help' for
  15103. details on some of the pertinent environment variables.
  15104. You can give `configure' initial values for configuration parameters
  15105. by setting variables in the command line or in the environment. Here
  15106. is an example:
  15107. ./configure CC=c99 CFLAGS=-g LIBS=-lposix
  15108. *Note Defining Variables::, for more details.
  15109. 
  15110. File: autoconf.info, Node: Multiple Architectures, Next: Installation Names, Prev: Compilers and Options, Up: Running configure Scripts
  15111. 16.3 Compiling For Multiple Architectures
  15112. =========================================
  15113. You can compile the package for more than one kind of computer at the
  15114. same time, by placing the object files for each architecture in their
  15115. own directory. To do this, you can use GNU `make'. `cd' to the
  15116. directory where you want the object files and executables to go and run
  15117. the `configure' script. `configure' automatically checks for the
  15118. source code in the directory that `configure' is in and in `..'. This
  15119. is known as a "VPATH" build.
  15120. With a non-GNU `make', it is safer to compile the package for one
  15121. architecture at a time in the source code directory. After you have
  15122. installed the package for one architecture, use `make distclean' before
  15123. reconfiguring for another architecture.
  15124. On MacOS X 10.5 and later systems, you can create libraries and
  15125. executables that work on multiple system types--known as "fat" or
  15126. "universal" binaries--by specifying multiple `-arch' options to the
  15127. compiler but only a single `-arch' option to the preprocessor. Like
  15128. this:
  15129. ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
  15130. CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
  15131. CPP="gcc -E" CXXCPP="g++ -E"
  15132. This is not guaranteed to produce working output in all cases, you
  15133. may have to build one architecture at a time and combine the results
  15134. using the `lipo' tool if you have problems.
  15135. 
  15136. File: autoconf.info, Node: Installation Names, Next: Optional Features, Prev: Multiple Architectures, Up: Running configure Scripts
  15137. 16.4 Installation Names
  15138. =======================
  15139. By default, `make install' installs the package's commands under
  15140. `/usr/local/bin', include files under `/usr/local/include', etc. You
  15141. can specify an installation prefix other than `/usr/local' by giving
  15142. `configure' the option `--prefix=PREFIX', where PREFIX must be an
  15143. absolute file name.
  15144. You can specify separate installation prefixes for
  15145. architecture-specific files and architecture-independent files. If you
  15146. pass the option `--exec-prefix=PREFIX' to `configure', the package uses
  15147. PREFIX as the prefix for installing programs and libraries.
  15148. Documentation and other data files still use the regular prefix.
  15149. In addition, if you use an unusual directory layout you can give
  15150. options like `--bindir=DIR' to specify different values for particular
  15151. kinds of files. Run `configure --help' for a list of the directories
  15152. you can set and what kinds of files go in them. In general, the
  15153. default for these options is expressed in terms of `${prefix}', so that
  15154. specifying just `--prefix' will affect all of the other directory
  15155. specifications that were not explicitly provided.
  15156. The most portable way to affect installation locations is to pass the
  15157. correct locations to `configure'; however, many packages provide one or
  15158. both of the following shortcuts of passing variable assignments to the
  15159. `make install' command line to change installation locations without
  15160. having to reconfigure or recompile.
  15161. The first method involves providing an override variable for each
  15162. affected directory. For example, `make install
  15163. prefix=/alternate/directory' will choose an alternate location for all
  15164. directory configuration variables that were expressed in terms of
  15165. `${prefix}'. Any directories that were specified during `configure',
  15166. but not in terms of `${prefix}', must each be overridden at install
  15167. time for the entire installation to be relocated. The approach of
  15168. makefile variable overrides for each directory variable is required by
  15169. the GNU Coding Standards, and ideally causes no recompilation.
  15170. However, some platforms have known limitations with the semantics of
  15171. shared libraries that end up requiring recompilation when using this
  15172. method, particularly noticeable in packages that use GNU Libtool.
  15173. The second method involves providing the `DESTDIR' variable. For
  15174. example, `make install DESTDIR=/alternate/directory' will prepend
  15175. `/alternate/directory' before all installation names. The approach of
  15176. `DESTDIR' overrides is not required by the GNU Coding Standards, and
  15177. does not work on platforms that have drive letters. On the other hand,
  15178. it does better at avoiding recompilation issues, and works well even
  15179. when some directory options were not specified in terms of `${prefix}'
  15180. at `configure' time.
  15181. 
  15182. File: autoconf.info, Node: Optional Features, Next: Particular Systems, Prev: Installation Names, Up: Running configure Scripts
  15183. 16.5 Optional Features
  15184. ======================
  15185. If the package supports it, you can cause programs to be installed with
  15186. an extra prefix or suffix on their names by giving `configure' the
  15187. option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
  15188. Some packages pay attention to `--enable-FEATURE' options to
  15189. `configure', where FEATURE indicates an optional part of the package.
  15190. They may also pay attention to `--with-PACKAGE' options, where PACKAGE
  15191. is something like `gnu-as' or `x' (for the X Window System). The
  15192. `README' should mention any `--enable-' and `--with-' options that the
  15193. package recognizes.
  15194. For packages that use the X Window System, `configure' can usually
  15195. find the X include and library files automatically, but if it doesn't,
  15196. you can use the `configure' options `--x-includes=DIR' and
  15197. `--x-libraries=DIR' to specify their locations.
  15198. Some packages offer the ability to configure how verbose the
  15199. execution of `make' will be. For these packages, running `./configure
  15200. --enable-silent-rules' sets the default to minimal output, which can be
  15201. overridden with `make V=1'; while running `./configure
  15202. --disable-silent-rules' sets the default to verbose, which can be
  15203. overridden with `make V=0'.
  15204. 
  15205. File: autoconf.info, Node: Particular Systems, Next: System Type, Prev: Optional Features, Up: Running configure Scripts
  15206. 16.6 Particular systems
  15207. =======================
  15208. On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is
  15209. not installed, it is recommended to use the following options in order
  15210. to use an ANSI C compiler:
  15211. ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
  15212. and if that doesn't work, install pre-built binaries of GCC for HP-UX.
  15213. HP-UX `make' updates targets which have the same time stamps as
  15214. their prerequisites, which makes it generally unusable when shipped
  15215. generated files such as `configure' are involved. Use GNU `make'
  15216. instead.
  15217. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
  15218. parse its `<wchar.h>' header file. The option `-nodtk' can be used as
  15219. a workaround. If GNU CC is not installed, it is therefore recommended
  15220. to try
  15221. ./configure CC="cc"
  15222. and if that doesn't work, try
  15223. ./configure CC="cc -nodtk"
  15224. On Solaris, don't put `/usr/ucb' early in your `PATH'. This
  15225. directory contains several dysfunctional programs; working variants of
  15226. these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
  15227. in your `PATH', put it _after_ `/usr/bin'.
  15228. On Haiku, software installed for all users goes in `/boot/common',
  15229. not `/usr/local'. It is recommended to use the following options:
  15230. ./configure --prefix=/boot/common
  15231. 
  15232. File: autoconf.info, Node: System Type, Next: Sharing Defaults, Prev: Particular Systems, Up: Running configure Scripts
  15233. 16.7 Specifying the System Type
  15234. ===============================
  15235. There may be some features `configure' cannot figure out automatically,
  15236. but needs to determine by the type of machine the package will run on.
  15237. Usually, assuming the package is built to be run on the _same_
  15238. architectures, `configure' can figure that out, but if it prints a
  15239. message saying it cannot guess the machine type, give it the
  15240. `--build=TYPE' option. TYPE can either be a short name for the system
  15241. type, such as `sun4', or a canonical name which has the form:
  15242. CPU-COMPANY-SYSTEM
  15243. where SYSTEM can have one of these forms:
  15244. OS
  15245. KERNEL-OS
  15246. See the file `config.sub' for the possible values of each field. If
  15247. `config.sub' isn't included in this package, then this package doesn't
  15248. need to know the machine type.
  15249. If you are _building_ compiler tools for cross-compiling, you should
  15250. use the option `--target=TYPE' to select the type of system they will
  15251. produce code for.
  15252. If you want to _use_ a cross compiler, that generates code for a
  15253. platform different from the build platform, you should specify the
  15254. "host" platform (i.e., that on which the generated programs will
  15255. eventually be run) with `--host=TYPE'.
  15256. 
  15257. File: autoconf.info, Node: Sharing Defaults, Next: Defining Variables, Prev: System Type, Up: Running configure Scripts
  15258. 16.8 Sharing Defaults
  15259. =====================
  15260. If you want to set default values for `configure' scripts to share, you
  15261. can create a site shell script called `config.site' that gives default
  15262. values for variables like `CC', `cache_file', and `prefix'.
  15263. `configure' looks for `PREFIX/share/config.site' if it exists, then
  15264. `PREFIX/etc/config.site' if it exists. Or, you can set the
  15265. `CONFIG_SITE' environment variable to the location of the site script.
  15266. A warning: not all `configure' scripts look for a site script.
  15267. 
  15268. File: autoconf.info, Node: Defining Variables, Next: configure Invocation, Prev: Sharing Defaults, Up: Running configure Scripts
  15269. 16.9 Defining Variables
  15270. =======================
  15271. Variables not defined in a site shell script can be set in the
  15272. environment passed to `configure'. However, some packages may run
  15273. configure again during the build, and the customized values of these
  15274. variables may be lost. In order to avoid this problem, you should set
  15275. them in the `configure' command line, using `VAR=value'. For example:
  15276. ./configure CC=/usr/local2/bin/gcc
  15277. causes the specified `gcc' to be used as the C compiler (unless it is
  15278. overridden in the site shell script).
  15279. Unfortunately, this technique does not work for `CONFIG_SHELL' due to
  15280. an Autoconf limitation. Until the limitation is lifted, you can use
  15281. this workaround:
  15282. CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
  15283. 
  15284. File: autoconf.info, Node: configure Invocation, Prev: Defining Variables, Up: Running configure Scripts
  15285. 16.10 `configure' Invocation
  15286. ============================
  15287. `configure' recognizes the following options to control how it operates.
  15288. `--help'
  15289. `-h'
  15290. Print a summary of all of the options to `configure', and exit.
  15291. `--help=short'
  15292. `--help=recursive'
  15293. Print a summary of the options unique to this package's
  15294. `configure', and exit. The `short' variant lists options used
  15295. only in the top level, while the `recursive' variant lists options
  15296. also present in any nested packages.
  15297. `--version'
  15298. `-V'
  15299. Print the version of Autoconf used to generate the `configure'
  15300. script, and exit.
  15301. `--cache-file=FILE'
  15302. Enable the cache: use and save the results of the tests in FILE,
  15303. traditionally `config.cache'. FILE defaults to `/dev/null' to
  15304. disable caching.
  15305. `--config-cache'
  15306. `-C'
  15307. Alias for `--cache-file=config.cache'.
  15308. `--quiet'
  15309. `--silent'
  15310. `-q'
  15311. Do not print messages saying which checks are being made. To
  15312. suppress all normal output, redirect it to `/dev/null' (any error
  15313. messages will still be shown).
  15314. `--srcdir=DIR'
  15315. Look for the package's source code in directory DIR. Usually
  15316. `configure' can determine that directory automatically.
  15317. `--prefix=DIR'
  15318. Use DIR as the installation prefix. *note Installation Names::
  15319. for more details, including other options available for fine-tuning
  15320. the installation locations.
  15321. `--no-create'
  15322. `-n'
  15323. Run the configure checks, but stop before creating any output
  15324. files.
  15325. `configure' also accepts some other, not widely useful, options. Run
  15326. `configure --help' for more details.
  15327. 
  15328. File: autoconf.info, Node: config.status Invocation, Next: Obsolete Constructs, Prev: Running configure Scripts, Up: Top
  15329. 17 config.status Invocation
  15330. ***************************
  15331. The `configure' script creates a file named `config.status', which
  15332. actually configures, "instantiates", the template files. It also
  15333. records the configuration options that were specified when the package
  15334. was last configured in case reconfiguring is needed.
  15335. Synopsis:
  15336. ./config.status [OPTION]... [TAG]...
  15337. It configures each TAG; if none are specified, all the templates are
  15338. instantiated. A TAG refers to a file or other tag associated with a
  15339. configuration action, as specified by an `AC_CONFIG_ITEMS' macro (*note
  15340. Configuration Actions::). The files must be specified without their
  15341. dependencies, as in
  15342. ./config.status foobar
  15343. not
  15344. ./config.status foobar:foo.in:bar.in
  15345. The supported options are:
  15346. `--help'
  15347. `-h'
  15348. Print a summary of the command line options, the list of the
  15349. template files, and exit.
  15350. `--version'
  15351. `-V'
  15352. Print the version number of Autoconf and the configuration
  15353. settings, and exit.
  15354. `--config'
  15355. Print the configuration settings in reusable way, quoted for the
  15356. shell, and exit. For example, for a debugging build that
  15357. otherwise reuses the configuration from a different build
  15358. directory BUILD-DIR of a package in SRC-DIR, you could use the
  15359. following:
  15360. args=`BUILD-DIR/config.status --config`
  15361. eval SRC-DIR/configure "$args" CFLAGS=-g --srcdir=SRC-DIR
  15362. Note that it may be necessary to override a `--srcdir' setting
  15363. that was saved in the configuration, if the arguments are used in a
  15364. different build directory.
  15365. `--silent'
  15366. `--quiet'
  15367. `-q'
  15368. Do not print progress messages.
  15369. `--debug'
  15370. `-d'
  15371. Don't remove the temporary files.
  15372. `--file=FILE[:TEMPLATE]'
  15373. Require that FILE be instantiated as if
  15374. `AC_CONFIG_FILES(FILE:TEMPLATE)' was used. Both FILE and TEMPLATE
  15375. may be `-' in which case the standard output and/or standard
  15376. input, respectively, is used. If a TEMPLATE file name is
  15377. relative, it is first looked for in the build tree, and then in
  15378. the source tree. *Note Configuration Actions::, for more details.
  15379. This option and the following ones provide one way for separately
  15380. distributed packages to share the values computed by `configure'.
  15381. Doing so can be useful if some of the packages need a superset of
  15382. the features that one of them, perhaps a common library, does.
  15383. These options allow a `config.status' file to create files other
  15384. than the ones that its `configure.ac' specifies, so it can be used
  15385. for a different package, or for extracting a subset of values.
  15386. For example,
  15387. echo '@CC@' | ./config.status --file=-
  15388. provides the value of `@CC@' on standard output.
  15389. `--header=FILE[:TEMPLATE]'
  15390. Same as `--file' above, but with `AC_CONFIG_HEADERS'.
  15391. `--recheck'
  15392. Ask `config.status' to update itself and exit (no instantiation).
  15393. This option is useful if you change `configure', so that the
  15394. results of some tests might be different from the previous run.
  15395. The `--recheck' option reruns `configure' with the same arguments
  15396. you used before, plus the `--no-create' option, which prevents
  15397. `configure' from running `config.status' and creating `Makefile'
  15398. and other files, and the `--no-recursion' option, which prevents
  15399. `configure' from running other `configure' scripts in
  15400. subdirectories. (This is so other Make rules can run
  15401. `config.status' when it changes; *note Automatic Remaking::, for
  15402. an example).
  15403. `config.status' checks several optional environment variables that
  15404. can alter its behavior:
  15405. -- Variable: CONFIG_SHELL
  15406. The shell with which to run `configure'. It must be
  15407. Bourne-compatible, and the absolute name of the shell should be
  15408. passed. The default is a shell that supports `LINENO' if
  15409. available, and `/bin/sh' otherwise.
  15410. -- Variable: CONFIG_STATUS
  15411. The file name to use for the shell script that records the
  15412. configuration. The default is `./config.status'. This variable is
  15413. useful when one package uses parts of another and the `configure'
  15414. scripts shouldn't be merged because they are maintained separately.
  15415. You can use `./config.status' in your makefiles. For example, in
  15416. the dependencies given above (*note Automatic Remaking::),
  15417. `config.status' is run twice when `configure.ac' has changed. If that
  15418. bothers you, you can make each run only regenerate the files for that
  15419. rule:
  15420. config.h: stamp-h
  15421. stamp-h: config.h.in config.status
  15422. ./config.status config.h
  15423. echo > stamp-h
  15424. Makefile: Makefile.in config.status
  15425. ./config.status Makefile
  15426. The calling convention of `config.status' has changed; see *note
  15427. Obsolete config.status Use::, for details.
  15428. 
  15429. File: autoconf.info, Node: Obsolete Constructs, Next: Using Autotest, Prev: config.status Invocation, Up: Top
  15430. 18 Obsolete Constructs
  15431. **********************
  15432. Autoconf changes, and throughout the years some constructs have been
  15433. obsoleted. Most of the changes involve the macros, but in some cases
  15434. the tools themselves, or even some concepts, are now considered
  15435. obsolete.
  15436. You may completely skip this chapter if you are new to Autoconf. Its
  15437. intention is mainly to help maintainers updating their packages by
  15438. understanding how to move to more modern constructs.
  15439. * Menu:
  15440. * Obsolete config.status Use:: Obsolete convention for `config.status'
  15441. * acconfig Header:: Additional entries in `config.h.in'
  15442. * autoupdate Invocation:: Automatic update of `configure.ac'
  15443. * Obsolete Macros:: Backward compatibility macros
  15444. * Autoconf 1:: Tips for upgrading your files
  15445. * Autoconf 2.13:: Some fresher tips
  15446. 
  15447. File: autoconf.info, Node: Obsolete config.status Use, Next: acconfig Header, Up: Obsolete Constructs
  15448. 18.1 Obsolete `config.status' Invocation
  15449. ========================================
  15450. `config.status' now supports arguments to specify the files to
  15451. instantiate; see *note config.status Invocation::, for more details.
  15452. Before, environment variables had to be used.
  15453. -- Variable: CONFIG_COMMANDS
  15454. The tags of the commands to execute. The default is the arguments
  15455. given to `AC_OUTPUT' and `AC_CONFIG_COMMANDS' in `configure.ac'.
  15456. -- Variable: CONFIG_FILES
  15457. The files in which to perform `@VARIABLE@' substitutions. The
  15458. default is the arguments given to `AC_OUTPUT' and
  15459. `AC_CONFIG_FILES' in `configure.ac'.
  15460. -- Variable: CONFIG_HEADERS
  15461. The files in which to substitute C `#define' statements. The
  15462. default is the arguments given to `AC_CONFIG_HEADERS'; if that
  15463. macro was not called, `config.status' ignores this variable.
  15464. -- Variable: CONFIG_LINKS
  15465. The symbolic links to establish. The default is the arguments
  15466. given to `AC_CONFIG_LINKS'; if that macro was not called,
  15467. `config.status' ignores this variable.
  15468. In *note config.status Invocation::, using this old interface, the
  15469. example would be:
  15470. config.h: stamp-h
  15471. stamp-h: config.h.in config.status
  15472. CONFIG_COMMANDS= CONFIG_LINKS= CONFIG_FILES= \
  15473. CONFIG_HEADERS=config.h ./config.status
  15474. echo > stamp-h
  15475. Makefile: Makefile.in config.status
  15476. CONFIG_COMMANDS= CONFIG_LINKS= CONFIG_HEADERS= \
  15477. CONFIG_FILES=Makefile ./config.status
  15478. (If `configure.ac' does not call `AC_CONFIG_HEADERS', there is no need
  15479. to set `CONFIG_HEADERS' in the `make' rules. Equally for
  15480. `CONFIG_COMMANDS', etc.)
  15481. 
  15482. File: autoconf.info, Node: acconfig Header, Next: autoupdate Invocation, Prev: Obsolete config.status Use, Up: Obsolete Constructs
  15483. 18.2 `acconfig.h'
  15484. =================
  15485. In order to produce `config.h.in', `autoheader' needs to build or to
  15486. find templates for each symbol. Modern releases of Autoconf use
  15487. `AH_VERBATIM' and `AH_TEMPLATE' (*note Autoheader Macros::), but in
  15488. older releases a file, `acconfig.h', contained the list of needed
  15489. templates. `autoheader' copied comments and `#define' and `#undef'
  15490. statements from `acconfig.h' in the current directory, if present.
  15491. This file used to be mandatory if you `AC_DEFINE' any additional
  15492. symbols.
  15493. Modern releases of Autoconf also provide `AH_TOP' and `AH_BOTTOM' if
  15494. you need to prepend/append some information to `config.h.in'. Ancient
  15495. versions of Autoconf had a similar feature: if `./acconfig.h' contains
  15496. the string `@TOP@', `autoheader' copies the lines before the line
  15497. containing `@TOP@' into the top of the file that it generates.
  15498. Similarly, if `./acconfig.h' contains the string `@BOTTOM@',
  15499. `autoheader' copies the lines after that line to the end of the file it
  15500. generates. Either or both of those strings may be omitted. An even
  15501. older alternate way to produce the same effect in ancient versions of
  15502. Autoconf is to create the files `FILE.top' (typically `config.h.top')
  15503. and/or `FILE.bot' in the current directory. If they exist,
  15504. `autoheader' copies them to the beginning and end, respectively, of its
  15505. output.
  15506. In former versions of Autoconf, the files used in preparing a
  15507. software package for distribution were:
  15508. configure.ac --. .------> autoconf* -----> configure
  15509. +---+
  15510. [aclocal.m4] --+ `---.
  15511. [acsite.m4] ---' |
  15512. +--> [autoheader*] -> [config.h.in]
  15513. [acconfig.h] ----. |
  15514. +-----'
  15515. [config.h.top] --+
  15516. [config.h.bot] --'
  15517. Using only the `AH_' macros, `configure.ac' should be
  15518. self-contained, and should not depend upon `acconfig.h' etc.
  15519. 
  15520. File: autoconf.info, Node: autoupdate Invocation, Next: Obsolete Macros, Prev: acconfig Header, Up: Obsolete Constructs
  15521. 18.3 Using `autoupdate' to Modernize `configure.ac'
  15522. ===================================================
  15523. The `autoupdate' program updates a `configure.ac' file that calls
  15524. Autoconf macros by their old names to use the current macro names. In
  15525. version 2 of Autoconf, most of the macros were renamed to use a more
  15526. uniform and descriptive naming scheme. *Note Macro Names::, for a
  15527. description of the new scheme. Although the old names still work
  15528. (*note Obsolete Macros::, for a list of the old macros and the
  15529. corresponding new names), you can make your `configure.ac' files more
  15530. readable and make it easier to use the current Autoconf documentation
  15531. if you update them to use the new macro names.
  15532. If given no arguments, `autoupdate' updates `configure.ac', backing
  15533. up the original version with the suffix `~' (or the value of the
  15534. environment variable `SIMPLE_BACKUP_SUFFIX', if that is set). If you
  15535. give `autoupdate' an argument, it reads that file instead of
  15536. `configure.ac' and writes the updated file to the standard output.
  15537. `autoupdate' accepts the following options:
  15538. `--help'
  15539. `-h'
  15540. Print a summary of the command line options and exit.
  15541. `--version'
  15542. `-V'
  15543. Print the version number of Autoconf and exit.
  15544. `--verbose'
  15545. `-v'
  15546. Report processing steps.
  15547. `--debug'
  15548. `-d'
  15549. Don't remove the temporary files.
  15550. `--force'
  15551. `-f'
  15552. Force the update even if the file has not changed. Disregard the
  15553. cache.
  15554. `--include=DIR'
  15555. `-I DIR'
  15556. Also look for input files in DIR. Multiple invocations accumulate.
  15557. Directories are browsed from last to first.
  15558. `--prepend-include=DIR'
  15559. `-B DIR'
  15560. Prepend directory DIR to the search path. This is used to include
  15561. the language-specific files before any third-party macros.
  15562. 
  15563. File: autoconf.info, Node: Obsolete Macros, Next: Autoconf 1, Prev: autoupdate Invocation, Up: Obsolete Constructs
  15564. 18.4 Obsolete Macros
  15565. ====================
  15566. Several macros are obsoleted in Autoconf, for various reasons (typically
  15567. they failed to quote properly, couldn't be extended for more recent
  15568. issues, etc.). They are still supported, but deprecated: their use
  15569. should be avoided.
  15570. During the jump from Autoconf version 1 to version 2, most of the
  15571. macros were renamed to use a more uniform and descriptive naming scheme,
  15572. but their signature did not change. *Note Macro Names::, for a
  15573. description of the new naming scheme. Below, if there is just the
  15574. mapping from old names to new names for these macros, the reader is
  15575. invited to refer to the definition of the new macro for the signature
  15576. and the description.
  15577. -- Macro: AC_AIX
  15578. This macro is a platform-specific subset of
  15579. `AC_USE_SYSTEM_EXTENSIONS' (*note AC_USE_SYSTEM_EXTENSIONS::).
  15580. -- Macro: AC_ALLOCA
  15581. Replaced by `AC_FUNC_ALLOCA' (*note AC_FUNC_ALLOCA::).
  15582. -- Macro: AC_ARG_ARRAY
  15583. Removed because of limited usefulness.
  15584. -- Macro: AC_C_CROSS
  15585. This macro is obsolete; it does nothing.
  15586. -- Macro: AC_C_LONG_DOUBLE
  15587. If the C compiler supports a working `long double' type with more
  15588. range or precision than the `double' type, define
  15589. `HAVE_LONG_DOUBLE'.
  15590. You should use `AC_TYPE_LONG_DOUBLE' or
  15591. `AC_TYPE_LONG_DOUBLE_WIDER' instead. *Note Particular Types::.
  15592. -- Macro: AC_CANONICAL_SYSTEM
  15593. Determine the system type and set output variables to the names of
  15594. the canonical system types. *Note Canonicalizing::, for details
  15595. about the variables this macro sets.
  15596. The user is encouraged to use either `AC_CANONICAL_BUILD', or
  15597. `AC_CANONICAL_HOST', or `AC_CANONICAL_TARGET', depending on the
  15598. needs. Using `AC_CANONICAL_TARGET' is enough to run the two other
  15599. macros (*note Canonicalizing::).
  15600. -- Macro: AC_CHAR_UNSIGNED
  15601. Replaced by `AC_C_CHAR_UNSIGNED' (*note AC_C_CHAR_UNSIGNED::).
  15602. -- Macro: AC_CHECK_TYPE (TYPE, DEFAULT)
  15603. Autoconf, up to 2.13, used to provide this version of
  15604. `AC_CHECK_TYPE', deprecated because of its flaws. First, although
  15605. it is a member of the `CHECK' clan, it does more than just
  15606. checking. Secondly, missing types are defined using `#define',
  15607. not `typedef', and this can lead to problems in the case of
  15608. pointer types.
  15609. This use of `AC_CHECK_TYPE' is obsolete and discouraged; see *note
  15610. Generic Types::, for the description of the current macro.
  15611. If the type TYPE is not defined, define it to be the C (or C++)
  15612. builtin type DEFAULT, e.g., `short int' or `unsigned int'.
  15613. This macro is equivalent to:
  15614. AC_CHECK_TYPE([TYPE], [],
  15615. [AC_DEFINE_UNQUOTED([TYPE], [DEFAULT],
  15616. [Define to `DEFAULT'
  15617. if <sys/types.h> does not define.])])
  15618. In order to keep backward compatibility, the two versions of
  15619. `AC_CHECK_TYPE' are implemented, selected using these heuristics:
  15620. 1. If there are three or four arguments, the modern version is
  15621. used.
  15622. 2. If the second argument appears to be a C or C++ type, then the
  15623. obsolete version is used. This happens if the argument is a
  15624. C or C++ _builtin_ type or a C identifier ending in `_t',
  15625. optionally followed by one of `[(* ' and then by a string of
  15626. zero or more characters taken from the set `[]()* _a-zA-Z0-9'.
  15627. 3. If the second argument is spelled with the alphabet of valid
  15628. C and C++ types, the user is warned and the modern version is
  15629. used.
  15630. 4. Otherwise, the modern version is used.
  15631. You are encouraged either to use a valid builtin type, or to use
  15632. the equivalent modern code (see above), or better yet, to use
  15633. `AC_CHECK_TYPES' together with
  15634. #ifndef HAVE_LOFF_T
  15635. typedef loff_t off_t;
  15636. #endif
  15637. -- Macro: AC_CHECKING (FEATURE-DESCRIPTION)
  15638. Same as
  15639. AC_MSG_NOTICE([checking FEATURE-DESCRIPTION...]
  15640. *Note AC_MSG_NOTICE::.
  15641. -- Macro: AC_COMPILE_CHECK (ECHO-TEXT, INCLUDES, FUNCTION-BODY,
  15642. ACTION-IF-TRUE, [ACTION-IF-FALSE])
  15643. This is an obsolete version of `AC_TRY_COMPILE' itself replaced by
  15644. `AC_COMPILE_IFELSE' (*note Running the Compiler::), with the
  15645. addition that it prints `checking for ECHO-TEXT' to the standard
  15646. output first, if ECHO-TEXT is non-empty. Use `AC_MSG_CHECKING'
  15647. and `AC_MSG_RESULT' instead to print messages (*note Printing
  15648. Messages::).
  15649. -- Macro: AC_CONST
  15650. Replaced by `AC_C_CONST' (*note AC_C_CONST::).
  15651. -- Macro: AC_CROSS_CHECK
  15652. Same as `AC_C_CROSS', which is obsolete too, and does nothing
  15653. `:-)'.
  15654. -- Macro: AC_CYGWIN
  15655. Check for the Cygwin environment in which case the shell variable
  15656. `CYGWIN' is set to `yes'. Don't use this macro, the dignified
  15657. means to check the nature of the host is using `AC_CANONICAL_HOST'
  15658. (*note Canonicalizing::). As a matter of fact this macro is
  15659. defined as:
  15660. AC_REQUIRE([AC_CANONICAL_HOST])[]dnl
  15661. case $host_os in
  15662. *cygwin* ) CYGWIN=yes;;
  15663. * ) CYGWIN=no;;
  15664. esac
  15665. Beware that the variable `CYGWIN' has a special meaning when
  15666. running Cygwin, and should not be changed. That's yet another
  15667. reason not to use this macro.
  15668. -- Macro: AC_DECL_SYS_SIGLIST
  15669. Same as:
  15670. AC_CHECK_DECLS([sys_siglist], [], [],
  15671. [#include <signal.h>
  15672. /* NetBSD declares sys_siglist in unistd.h. */
  15673. #ifdef HAVE_UNISTD_H
  15674. # include <unistd.h>
  15675. #endif
  15676. ])
  15677. *Note AC_CHECK_DECLS::.
  15678. -- Macro: AC_DECL_YYTEXT
  15679. Does nothing, now integrated in `AC_PROG_LEX' (*note
  15680. AC_PROG_LEX::).
  15681. -- Macro: AC_DIR_HEADER
  15682. Like calling `AC_FUNC_CLOSEDIR_VOID' (*note
  15683. AC_FUNC_CLOSEDIR_VOID::) and `AC_HEADER_DIRENT' (*note
  15684. AC_HEADER_DIRENT::), but defines a different set of C preprocessor
  15685. macros to indicate which header file is found:
  15686. Header Old Symbol New Symbol
  15687. `dirent.h' `DIRENT' `HAVE_DIRENT_H'
  15688. `sys/ndir.h' `SYSNDIR' `HAVE_SYS_NDIR_H'
  15689. `sys/dir.h' `SYSDIR' `HAVE_SYS_DIR_H'
  15690. `ndir.h' `NDIR' `HAVE_NDIR_H'
  15691. -- Macro: AC_DYNIX_SEQ
  15692. If on DYNIX/ptx, add `-lseq' to output variable `LIBS'. This
  15693. macro used to be defined as
  15694. AC_CHECK_LIB([seq], [getmntent], [LIBS="-lseq $LIBS"])
  15695. now it is just `AC_FUNC_GETMNTENT' (*note AC_FUNC_GETMNTENT::).
  15696. -- Macro: AC_EXEEXT
  15697. Defined the output variable `EXEEXT' based on the output of the
  15698. compiler, which is now done automatically. Typically set to empty
  15699. string if Posix and `.exe' if a DOS variant.
  15700. -- Macro: AC_EMXOS2
  15701. Similar to `AC_CYGWIN' but checks for the EMX environment on OS/2
  15702. and sets `EMXOS2'. Don't use this macro, the dignified means to
  15703. check the nature of the host is using `AC_CANONICAL_HOST' (*note
  15704. Canonicalizing::).
  15705. -- Macro: AC_ENABLE (FEATURE, ACTION-IF-GIVEN, [ACTION-IF-NOT-GIVEN])
  15706. This is an obsolete version of `AC_ARG_ENABLE' that does not
  15707. support providing a help string (*note AC_ARG_ENABLE::).
  15708. -- Macro: AC_ERROR
  15709. Replaced by `AC_MSG_ERROR' (*note AC_MSG_ERROR::).
  15710. -- Macro: AC_FIND_X
  15711. Replaced by `AC_PATH_X' (*note AC_PATH_X::).
  15712. -- Macro: AC_FIND_XTRA
  15713. Replaced by `AC_PATH_XTRA' (*note AC_PATH_XTRA::).
  15714. -- Macro: AC_FOREACH
  15715. Replaced by `m4_foreach_w' (*note m4_foreach_w::).
  15716. -- Macro: AC_FUNC_CHECK
  15717. Replaced by `AC_CHECK_FUNC' (*note AC_CHECK_FUNC::).
  15718. -- Macro: AC_FUNC_SETVBUF_REVERSED
  15719. Do nothing. Formerly, this macro checked whether `setvbuf' takes
  15720. the buffering type as its second argument and the buffer pointer
  15721. as the third, instead of the other way around, and defined
  15722. `SETVBUF_REVERSED'. However, the last systems to have the problem
  15723. were those based on SVR2, which became obsolete in 1987, and the
  15724. macro is no longer needed.
  15725. -- Macro: AC_FUNC_WAIT3
  15726. If `wait3' is found and fills in the contents of its third argument
  15727. (a `struct rusage *'), which HP-UX does not do, define
  15728. `HAVE_WAIT3'.
  15729. These days portable programs should use `waitpid', not `wait3', as
  15730. `wait3' has been removed from Posix.
  15731. -- Macro: AC_GCC_TRADITIONAL
  15732. Replaced by `AC_PROG_GCC_TRADITIONAL' (*note
  15733. AC_PROG_GCC_TRADITIONAL::).
  15734. -- Macro: AC_GETGROUPS_T
  15735. Replaced by `AC_TYPE_GETGROUPS' (*note AC_TYPE_GETGROUPS::).
  15736. -- Macro: AC_GETLOADAVG
  15737. Replaced by `AC_FUNC_GETLOADAVG' (*note AC_FUNC_GETLOADAVG::).
  15738. -- Macro: AC_GNU_SOURCE
  15739. This macro is a platform-specific subset of
  15740. `AC_USE_SYSTEM_EXTENSIONS' (*note AC_USE_SYSTEM_EXTENSIONS::).
  15741. -- Macro: AC_HAVE_FUNCS
  15742. Replaced by `AC_CHECK_FUNCS' (*note AC_CHECK_FUNCS::).
  15743. -- Macro: AC_HAVE_HEADERS
  15744. Replaced by `AC_CHECK_HEADERS' (*note AC_CHECK_HEADERS::).
  15745. -- Macro: AC_HAVE_LIBRARY (LIBRARY, [ACTION-IF-FOUND],
  15746. [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES])
  15747. This macro is equivalent to calling `AC_CHECK_LIB' with a FUNCTION
  15748. argument of `main'. In addition, LIBRARY can be written as any of
  15749. `foo', `-lfoo', or `libfoo.a'. In all of those cases, the
  15750. compiler is passed `-lfoo'. However, LIBRARY cannot be a shell
  15751. variable; it must be a literal name. *Note AC_CHECK_LIB::.
  15752. -- Macro: AC_HAVE_POUNDBANG
  15753. Replaced by `AC_SYS_INTERPRETER' (*note AC_SYS_INTERPRETER::).
  15754. -- Macro: AC_HEADER_CHECK
  15755. Replaced by `AC_CHECK_HEADER' (*note AC_CHECK_HEADER::).
  15756. -- Macro: AC_HEADER_EGREP
  15757. Replaced by `AC_EGREP_HEADER' (*note AC_EGREP_HEADER::).
  15758. -- Macro: AC_HELP_STRING
  15759. Replaced by `AS_HELP_STRING' (*note AS_HELP_STRING::).
  15760. -- Macro: AC_INIT (UNIQUE-FILE-IN-SOURCE-DIR)
  15761. Formerly `AC_INIT' used to have a single argument, and was
  15762. equivalent to:
  15763. AC_INIT
  15764. AC_CONFIG_SRCDIR(UNIQUE-FILE-IN-SOURCE-DIR)
  15765. See *note AC_INIT:: and *note AC_CONFIG_SRCDIR::.
  15766. -- Macro: AC_INLINE
  15767. Replaced by `AC_C_INLINE' (*note AC_C_INLINE::).
  15768. -- Macro: AC_INT_16_BITS
  15769. If the C type `int' is 16 bits wide, define `INT_16_BITS'. Use
  15770. `AC_CHECK_SIZEOF(int)' instead (*note AC_CHECK_SIZEOF::).
  15771. -- Macro: AC_IRIX_SUN
  15772. If on IRIX (Silicon Graphics Unix), add `-lsun' to output `LIBS'.
  15773. If you were using it to get `getmntent', use `AC_FUNC_GETMNTENT'
  15774. instead. If you used it for the NIS versions of the password and
  15775. group functions, use `AC_CHECK_LIB(sun, getpwnam)'. Up to
  15776. Autoconf 2.13, it used to be
  15777. AC_CHECK_LIB([sun], [getmntent], [LIBS="-lsun $LIBS"])
  15778. now it is defined as
  15779. AC_FUNC_GETMNTENT
  15780. AC_CHECK_LIB([sun], [getpwnam])
  15781. See *note AC_FUNC_GETMNTENT:: and *note AC_CHECK_LIB::.
  15782. -- Macro: AC_ISC_POSIX
  15783. This macro adds `-lcposix' to output variable `LIBS' if necessary
  15784. for Posix facilities. Sun dropped support for the obsolete
  15785. INTERACTIVE Systems Corporation Unix on 2006-07-23. New programs
  15786. need not use this macro. It is implemented as
  15787. `AC_SEARCH_LIBS([strerror], [cposix])' (*note AC_SEARCH_LIBS::).
  15788. -- Macro: AC_LANG_C
  15789. Same as `AC_LANG([C])' (*note AC_LANG::).
  15790. -- Macro: AC_LANG_CPLUSPLUS
  15791. Same as `AC_LANG([C++])' (*note AC_LANG::).
  15792. -- Macro: AC_LANG_FORTRAN77
  15793. Same as `AC_LANG([Fortran 77])' (*note AC_LANG::).
  15794. -- Macro: AC_LANG_RESTORE
  15795. Select the LANGUAGE that is saved on the top of the stack, as set
  15796. by `AC_LANG_SAVE', remove it from the stack, and call
  15797. `AC_LANG(LANGUAGE)'. *Note Language Choice::, for the preferred
  15798. way to change languages.
  15799. -- Macro: AC_LANG_SAVE
  15800. Remember the current language (as set by `AC_LANG') on a stack.
  15801. The current language does not change. `AC_LANG_PUSH' is preferred
  15802. (*note AC_LANG_PUSH::).
  15803. -- Macro: AC_LINK_FILES (SOURCE..., DEST...)
  15804. This is an obsolete version of `AC_CONFIG_LINKS' (*note
  15805. AC_CONFIG_LINKS::. An updated version of:
  15806. AC_LINK_FILES(config/$machine.h config/$obj_format.h,
  15807. host.h object.h)
  15808. is:
  15809. AC_CONFIG_LINKS([host.h:config/$machine.h
  15810. object.h:config/$obj_format.h])
  15811. -- Macro: AC_LN_S
  15812. Replaced by `AC_PROG_LN_S' (*note AC_PROG_LN_S::).
  15813. -- Macro: AC_LONG_64_BITS
  15814. Define `LONG_64_BITS' if the C type `long int' is 64 bits wide.
  15815. Use the generic macro `AC_CHECK_SIZEOF([long int])' instead (*note
  15816. AC_CHECK_SIZEOF::).
  15817. -- Macro: AC_LONG_DOUBLE
  15818. If the C compiler supports a working `long double' type with more
  15819. range or precision than the `double' type, define
  15820. `HAVE_LONG_DOUBLE'.
  15821. You should use `AC_TYPE_LONG_DOUBLE' or
  15822. `AC_TYPE_LONG_DOUBLE_WIDER' instead. *Note Particular Types::.
  15823. -- Macro: AC_LONG_FILE_NAMES
  15824. Replaced by
  15825. AC_SYS_LONG_FILE_NAMES
  15826. *Note AC_SYS_LONG_FILE_NAMES::.
  15827. -- Macro: AC_MAJOR_HEADER
  15828. Replaced by `AC_HEADER_MAJOR' (*note AC_HEADER_MAJOR::).
  15829. -- Macro: AC_MEMORY_H
  15830. Used to define `NEED_MEMORY_H' if the `mem' functions were defined
  15831. in `memory.h'. Today it is equivalent to
  15832. `AC_CHECK_HEADERS([memory.h])' (*note AC_CHECK_HEADERS::). Adjust
  15833. your code to depend upon `HAVE_MEMORY_H', not `NEED_MEMORY_H'; see
  15834. *note Standard Symbols::.
  15835. -- Macro: AC_MINGW32
  15836. Similar to `AC_CYGWIN' but checks for the MinGW compiler
  15837. environment and sets `MINGW32'. Don't use this macro, the
  15838. dignified means to check the nature of the host is using
  15839. `AC_CANONICAL_HOST' (*note Canonicalizing::).
  15840. -- Macro: AC_MINIX
  15841. This macro is a platform-specific subset of
  15842. `AC_USE_SYSTEM_EXTENSIONS' (*note AC_USE_SYSTEM_EXTENSIONS::).
  15843. -- Macro: AC_MINUS_C_MINUS_O
  15844. Replaced by `AC_PROG_CC_C_O' (*note AC_PROG_CC_C_O::).
  15845. -- Macro: AC_MMAP
  15846. Replaced by `AC_FUNC_MMAP' (*note AC_FUNC_MMAP::).
  15847. -- Macro: AC_MODE_T
  15848. Replaced by `AC_TYPE_MODE_T' (*note AC_TYPE_MODE_T::).
  15849. -- Macro: AC_OBJEXT
  15850. Defined the output variable `OBJEXT' based on the output of the
  15851. compiler, after .c files have been excluded. Typically set to `o'
  15852. if Posix, `obj' if a DOS variant. Now the compiler checking
  15853. macros handle this automatically.
  15854. -- Macro: AC_OBSOLETE (THIS-MACRO-NAME, [SUGGESTION])
  15855. Make M4 print a message to the standard error output warning that
  15856. THIS-MACRO-NAME is obsolete, and giving the file and line number
  15857. where it was called. THIS-MACRO-NAME should be the name of the
  15858. macro that is calling `AC_OBSOLETE'. If SUGGESTION is given, it
  15859. is printed at the end of the warning message; for example, it can
  15860. be a suggestion for what to use instead of THIS-MACRO-NAME.
  15861. For instance
  15862. AC_OBSOLETE([$0], [; use AC_CHECK_HEADERS(unistd.h) instead])dnl
  15863. You are encouraged to use `AU_DEFUN' instead, since it gives better
  15864. services to the user (*note AU_DEFUN::).
  15865. -- Macro: AC_OFF_T
  15866. Replaced by `AC_TYPE_OFF_T' (*note AC_TYPE_OFF_T::).
  15867. -- Macro: AC_OUTPUT ([FILE]..., [EXTRA-CMDS], [INIT-CMDS])
  15868. The use of `AC_OUTPUT' with arguments is deprecated. This
  15869. obsoleted interface is equivalent to:
  15870. AC_CONFIG_FILES(FILE...)
  15871. AC_CONFIG_COMMANDS([default],
  15872. EXTRA-CMDS, INIT-CMDS)
  15873. AC_OUTPUT
  15874. See *note AC_CONFIG_FILES::, *note AC_CONFIG_COMMANDS::, and *note
  15875. AC_OUTPUT::.
  15876. -- Macro: AC_OUTPUT_COMMANDS (EXTRA-CMDS, [INIT-CMDS])
  15877. Specify additional shell commands to run at the end of
  15878. `config.status', and shell commands to initialize any variables
  15879. from `configure'. This macro may be called multiple times. It is
  15880. obsolete, replaced by `AC_CONFIG_COMMANDS' (*note
  15881. AC_CONFIG_COMMANDS::).
  15882. Here is an unrealistic example:
  15883. fubar=27
  15884. AC_OUTPUT_COMMANDS([echo this is extra $fubar, and so on.],
  15885. [fubar=$fubar])
  15886. AC_OUTPUT_COMMANDS([echo this is another, extra, bit],
  15887. [echo init bit])
  15888. Aside from the fact that `AC_CONFIG_COMMANDS' requires an
  15889. additional key, an important difference is that
  15890. `AC_OUTPUT_COMMANDS' is quoting its arguments twice, unlike
  15891. `AC_CONFIG_COMMANDS'. This means that `AC_CONFIG_COMMANDS' can
  15892. safely be given macro calls as arguments:
  15893. AC_CONFIG_COMMANDS(foo, [my_FOO()])
  15894. Conversely, where one level of quoting was enough for literal
  15895. strings with `AC_OUTPUT_COMMANDS', you need two with
  15896. `AC_CONFIG_COMMANDS'. The following lines are equivalent:
  15897. AC_OUTPUT_COMMANDS([echo "Square brackets: []"])
  15898. AC_CONFIG_COMMANDS([default], [[echo "Square brackets: []"]])
  15899. -- Macro: AC_PID_T
  15900. Replaced by `AC_TYPE_PID_T' (*note AC_TYPE_PID_T::).
  15901. -- Macro: AC_PREFIX
  15902. Replaced by `AC_PREFIX_PROGRAM' (*note AC_PREFIX_PROGRAM::).
  15903. -- Macro: AC_PROGRAMS_CHECK
  15904. Replaced by `AC_CHECK_PROGS' (*note AC_CHECK_PROGS::).
  15905. -- Macro: AC_PROGRAMS_PATH
  15906. Replaced by `AC_PATH_PROGS' (*note AC_PATH_PROGS::).
  15907. -- Macro: AC_PROGRAM_CHECK
  15908. Replaced by `AC_CHECK_PROG' (*note AC_CHECK_PROG::).
  15909. -- Macro: AC_PROGRAM_EGREP
  15910. Replaced by `AC_EGREP_CPP' (*note AC_EGREP_CPP::).
  15911. -- Macro: AC_PROGRAM_PATH
  15912. Replaced by `AC_PATH_PROG' (*note AC_PATH_PROG::).
  15913. -- Macro: AC_REMOTE_TAPE
  15914. Removed because of limited usefulness.
  15915. -- Macro: AC_RESTARTABLE_SYSCALLS
  15916. This macro was renamed `AC_SYS_RESTARTABLE_SYSCALLS'. However,
  15917. these days portable programs should use `sigaction' with
  15918. `SA_RESTART' if they want restartable system calls. They should
  15919. not rely on `HAVE_RESTARTABLE_SYSCALLS', since nowadays whether a
  15920. system call is restartable is a dynamic issue, not a
  15921. configuration-time issue.
  15922. -- Macro: AC_RETSIGTYPE
  15923. Replaced by `AC_TYPE_SIGNAL' (*note AC_TYPE_SIGNAL::), which itself
  15924. is obsolete when assuming C89 or better.
  15925. -- Macro: AC_RSH
  15926. Removed because of limited usefulness.
  15927. -- Macro: AC_SCO_INTL
  15928. If on SCO Unix, add `-lintl' to output variable `LIBS'. This
  15929. macro used to do this:
  15930. AC_CHECK_LIB([intl], [strftime], [LIBS="-lintl $LIBS"])
  15931. Now it just calls `AC_FUNC_STRFTIME' instead (*note
  15932. AC_FUNC_STRFTIME::).
  15933. -- Macro: AC_SETVBUF_REVERSED
  15934. Replaced by
  15935. AC_FUNC_SETVBUF_REVERSED
  15936. *Note AC_FUNC_SETVBUF_REVERSED::.
  15937. -- Macro: AC_SET_MAKE
  15938. Replaced by `AC_PROG_MAKE_SET' (*note AC_PROG_MAKE_SET::).
  15939. -- Macro: AC_SIZEOF_TYPE
  15940. Replaced by `AC_CHECK_SIZEOF' (*note AC_CHECK_SIZEOF::).
  15941. -- Macro: AC_SIZE_T
  15942. Replaced by `AC_TYPE_SIZE_T' (*note AC_TYPE_SIZE_T::).
  15943. -- Macro: AC_STAT_MACROS_BROKEN
  15944. Replaced by `AC_HEADER_STAT' (*note AC_HEADER_STAT::).
  15945. -- Macro: AC_STDC_HEADERS
  15946. Replaced by `AC_HEADER_STDC' (*note AC_HEADER_STDC::).
  15947. -- Macro: AC_STRCOLL
  15948. Replaced by `AC_FUNC_STRCOLL' (*note AC_FUNC_STRCOLL::).
  15949. -- Macro: AC_STRUCT_ST_BLKSIZE
  15950. If `struct stat' contains an `st_blksize' member, define
  15951. `HAVE_STRUCT_STAT_ST_BLKSIZE'. The former name, `HAVE_ST_BLKSIZE'
  15952. is to be avoided, as its support will cease in the future. This
  15953. macro is obsoleted, and should be replaced by
  15954. AC_CHECK_MEMBERS([struct stat.st_blksize])
  15955. *Note AC_CHECK_MEMBERS::.
  15956. -- Macro: AC_STRUCT_ST_RDEV
  15957. If `struct stat' contains an `st_rdev' member, define
  15958. `HAVE_STRUCT_STAT_ST_RDEV'. The former name for this macro,
  15959. `HAVE_ST_RDEV', is to be avoided as it will cease to be supported
  15960. in the future. Actually, even the new macro is obsolete and
  15961. should be replaced by:
  15962. AC_CHECK_MEMBERS([struct stat.st_rdev])
  15963. *Note AC_CHECK_MEMBERS::.
  15964. -- Macro: AC_ST_BLKSIZE
  15965. Replaced by `AC_CHECK_MEMBERS' (*note AC_CHECK_MEMBERS::).
  15966. -- Macro: AC_ST_BLOCKS
  15967. Replaced by `AC_STRUCT_ST_BLOCKS' (*note AC_STRUCT_ST_BLOCKS::).
  15968. -- Macro: AC_ST_RDEV
  15969. Replaced by `AC_CHECK_MEMBERS' (*note AC_CHECK_MEMBERS::).
  15970. -- Macro: AC_SYS_RESTARTABLE_SYSCALLS
  15971. If the system automatically restarts a system call that is
  15972. interrupted by a signal, define `HAVE_RESTARTABLE_SYSCALLS'. This
  15973. macro does not check whether system calls are restarted in
  15974. general--it checks whether a signal handler installed with
  15975. `signal' (but not `sigaction') causes system calls to be
  15976. restarted. It does not check whether system calls can be
  15977. restarted when interrupted by signals that have no handler.
  15978. These days portable programs should use `sigaction' with
  15979. `SA_RESTART' if they want restartable system calls. They should
  15980. not rely on `HAVE_RESTARTABLE_SYSCALLS', since nowadays whether a
  15981. system call is restartable is a dynamic issue, not a
  15982. configuration-time issue.
  15983. -- Macro: AC_SYS_SIGLIST_DECLARED
  15984. This macro was renamed `AC_DECL_SYS_SIGLIST'. However, even that
  15985. name is obsolete, as the same functionality is now achieved via
  15986. `AC_CHECK_DECLS' (*note AC_CHECK_DECLS::).
  15987. -- Macro: AC_TEST_CPP
  15988. This macro was renamed `AC_TRY_CPP', which in turn was replaced by
  15989. `AC_PREPROC_IFELSE' (*note AC_PREPROC_IFELSE::).
  15990. -- Macro: AC_TEST_PROGRAM
  15991. This macro was renamed `AC_TRY_RUN', which in turn was replaced by
  15992. `AC_RUN_IFELSE' (*note AC_RUN_IFELSE::).
  15993. -- Macro: AC_TIMEZONE
  15994. Replaced by `AC_STRUCT_TIMEZONE' (*note AC_STRUCT_TIMEZONE::).
  15995. -- Macro: AC_TIME_WITH_SYS_TIME
  15996. Replaced by `AC_HEADER_TIME' (*note AC_HEADER_TIME::).
  15997. -- Macro: AC_TRY_COMPILE (INCLUDES, FUNCTION-BODY, [ACTION-IF-TRUE],
  15998. [ACTION-IF-FALSE])
  15999. Same as:
  16000. AC_COMPILE_IFELSE(
  16001. [AC_LANG_PROGRAM([[INCLUDES]],
  16002. [[FUNCTION-BODY]])],
  16003. [ACTION-IF-TRUE],
  16004. [ACTION-IF-FALSE])
  16005. *Note Running the Compiler::.
  16006. This macro double quotes both INCLUDES and FUNCTION-BODY.
  16007. For C and C++, INCLUDES is any `#include' statements needed by the
  16008. code in FUNCTION-BODY (INCLUDES is ignored if the currently
  16009. selected language is Fortran or Fortran 77). The compiler and
  16010. compilation flags are determined by the current language (*note
  16011. Language Choice::).
  16012. -- Macro: AC_TRY_CPP (INPUT, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
  16013. Same as:
  16014. AC_PREPROC_IFELSE(
  16015. [AC_LANG_SOURCE([[INPUT]])],
  16016. [ACTION-IF-TRUE],
  16017. [ACTION-IF-FALSE])
  16018. *Note Running the Preprocessor::.
  16019. This macro double quotes the INPUT.
  16020. -- Macro: AC_TRY_LINK (INCLUDES, FUNCTION-BODY, [ACTION-IF-TRUE],
  16021. [ACTION-IF-FALSE])
  16022. Same as:
  16023. AC_LINK_IFELSE(
  16024. [AC_LANG_PROGRAM([[INCLUDES]],
  16025. [[FUNCTION-BODY]])],
  16026. [ACTION-IF-TRUE],
  16027. [ACTION-IF-FALSE])
  16028. *Note Running the Compiler::.
  16029. This macro double quotes both INCLUDES and FUNCTION-BODY.
  16030. Depending on the current language (*note Language Choice::),
  16031. create a test program to see whether a function whose body
  16032. consists of FUNCTION-BODY can be compiled and linked. If the file
  16033. compiles and links successfully, run shell commands
  16034. ACTION-IF-FOUND, otherwise run ACTION-IF-NOT-FOUND.
  16035. This macro double quotes both INCLUDES and FUNCTION-BODY.
  16036. For C and C++, INCLUDES is any `#include' statements needed by the
  16037. code in FUNCTION-BODY (INCLUDES is ignored if the currently
  16038. selected language is Fortran or Fortran 77). The compiler and
  16039. compilation flags are determined by the current language (*note
  16040. Language Choice::), and in addition `LDFLAGS' and `LIBS' are used
  16041. for linking.
  16042. -- Macro: AC_TRY_LINK_FUNC (FUNCTION, [ACTION-IF-FOUND],
  16043. [ACTION-IF-NOT-FOUND])
  16044. This macro is equivalent to
  16045. AC_LINK_IFELSE([AC_LANG_CALL([], [FUNCTION])],
  16046. [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
  16047. *Note AC_LINK_IFELSE::.
  16048. -- Macro: AC_TRY_RUN (PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE],
  16049. [ACTION-IF-CROSS-COMPILING = `AC_MSG_FAILURE'])
  16050. Same as:
  16051. AC_RUN_IFELSE(
  16052. [AC_LANG_SOURCE([[PROGRAM]])],
  16053. [ACTION-IF-TRUE],
  16054. [ACTION-IF-FALSE],
  16055. [ACTION-IF-CROSS-COMPILING])
  16056. *Note Runtime::.
  16057. -- Macro: AC_TYPE_SIGNAL
  16058. If `signal.h' declares `signal' as returning a pointer to a
  16059. function returning `void', define `RETSIGTYPE' to be `void';
  16060. otherwise, define it to be `int'. These days, it is portable to
  16061. assume C89, and that signal handlers return `void', without
  16062. needing to use this macro or `RETSIGTYPE'.
  16063. When targeting older K&R C, it is possible to define signal
  16064. handlers as returning type `RETSIGTYPE', and omit a return
  16065. statement:
  16066. RETSIGTYPE
  16067. hup_handler ()
  16068. {
  16069. ...
  16070. }
  16071. -- Macro: AC_UID_T
  16072. Replaced by `AC_TYPE_UID_T' (*note AC_TYPE_UID_T::).
  16073. -- Macro: AC_UNISTD_H
  16074. Same as `AC_CHECK_HEADERS([unistd.h])' (*note AC_CHECK_HEADERS::).
  16075. -- Macro: AC_USG
  16076. Define `USG' if the BSD string functions are defined in
  16077. `strings.h'. You should no longer depend upon `USG', but on
  16078. `HAVE_STRING_H'; see *note Standard Symbols::.
  16079. -- Macro: AC_UTIME_NULL
  16080. Replaced by `AC_FUNC_UTIME_NULL' (*note AC_FUNC_UTIME_NULL::).
  16081. -- Macro: AC_VALIDATE_CACHED_SYSTEM_TUPLE ([CMD])
  16082. If the cache file is inconsistent with the current host, target and
  16083. build system types, it used to execute CMD or print a default
  16084. error message. This is now handled by default.
  16085. -- Macro: AC_VERBOSE (RESULT-DESCRIPTION)
  16086. Replaced by `AC_MSG_RESULT' (*note AC_MSG_RESULT::).
  16087. -- Macro: AC_VFORK
  16088. Replaced by `AC_FUNC_FORK' (*note AC_FUNC_FORK::).
  16089. -- Macro: AC_VPRINTF
  16090. Replaced by `AC_FUNC_VPRINTF' (*note AC_FUNC_VPRINTF::).
  16091. -- Macro: AC_WAIT3
  16092. This macro was renamed `AC_FUNC_WAIT3'. However, these days
  16093. portable programs should use `waitpid', not `wait3', as `wait3'
  16094. has been removed from Posix.
  16095. -- Macro: AC_WARN
  16096. Replaced by `AC_MSG_WARN' (*note AC_MSG_WARN::).
  16097. -- Macro: AC_WITH (PACKAGE, ACTION-IF-GIVEN, [ACTION-IF-NOT-GIVEN])
  16098. This is an obsolete version of `AC_ARG_WITH' that does not support
  16099. providing a help string (*note AC_ARG_WITH::).
  16100. -- Macro: AC_WORDS_BIGENDIAN
  16101. Replaced by `AC_C_BIGENDIAN' (*note AC_C_BIGENDIAN::).
  16102. -- Macro: AC_XENIX_DIR
  16103. This macro used to add `-lx' to output variable `LIBS' if on
  16104. Xenix. Also, if `dirent.h' is being checked for, added `-ldir' to
  16105. `LIBS'. Now it is merely an alias of `AC_HEADER_DIRENT' instead,
  16106. plus some code to detect whether running XENIX on which you should
  16107. not depend:
  16108. AC_MSG_CHECKING([for Xenix])
  16109. AC_EGREP_CPP([yes],
  16110. [#if defined M_XENIX && !defined M_UNIX
  16111. yes
  16112. #endif],
  16113. [AC_MSG_RESULT([yes]); XENIX=yes],
  16114. [AC_MSG_RESULT([no]); XENIX=])
  16115. Don't use this macro, the dignified means to check the nature of
  16116. the host is using `AC_CANONICAL_HOST' (*note Canonicalizing::).
  16117. -- Macro: AC_YYTEXT_POINTER
  16118. This macro was renamed `AC_DECL_YYTEXT', which in turn was
  16119. integrated into `AC_PROG_LEX' (*note AC_PROG_LEX::).
  16120. 
  16121. File: autoconf.info, Node: Autoconf 1, Next: Autoconf 2.13, Prev: Obsolete Macros, Up: Obsolete Constructs
  16122. 18.5 Upgrading From Version 1
  16123. =============================
  16124. Autoconf version 2 is mostly backward compatible with version 1.
  16125. However, it introduces better ways to do some things, and doesn't
  16126. support some of the ugly things in version 1. So, depending on how
  16127. sophisticated your `configure.ac' files are, you might have to do some
  16128. manual work in order to upgrade to version 2. This chapter points out
  16129. some problems to watch for when upgrading. Also, perhaps your
  16130. `configure' scripts could benefit from some of the new features in
  16131. version 2; the changes are summarized in the file `NEWS' in the
  16132. Autoconf distribution.
  16133. * Menu:
  16134. * Changed File Names:: Files you might rename
  16135. * Changed Makefiles:: New things to put in `Makefile.in'
  16136. * Changed Macros:: Macro calls you might replace
  16137. * Changed Results:: Changes in how to check test results
  16138. * Changed Macro Writing:: Better ways to write your own macros
  16139. 
  16140. File: autoconf.info, Node: Changed File Names, Next: Changed Makefiles, Up: Autoconf 1
  16141. 18.5.1 Changed File Names
  16142. -------------------------
  16143. If you have an `aclocal.m4' installed with Autoconf (as opposed to in a
  16144. particular package's source directory), you must rename it to
  16145. `acsite.m4'. *Note autoconf Invocation::.
  16146. If you distribute `install.sh' with your package, rename it to
  16147. `install-sh' so `make' builtin rules don't inadvertently create a file
  16148. called `install' from it. `AC_PROG_INSTALL' looks for the script under
  16149. both names, but it is best to use the new name.
  16150. If you were using `config.h.top', `config.h.bot', or `acconfig.h',
  16151. you still can, but you have less clutter if you use the `AH_' macros.
  16152. *Note Autoheader Macros::.
  16153. 
  16154. File: autoconf.info, Node: Changed Makefiles, Next: Changed Macros, Prev: Changed File Names, Up: Autoconf 1
  16155. 18.5.2 Changed Makefiles
  16156. ------------------------
  16157. Add `@CFLAGS@', `@CPPFLAGS@', and `@LDFLAGS@' in your `Makefile.in'
  16158. files, so they can take advantage of the values of those variables in
  16159. the environment when `configure' is run. Doing this isn't necessary,
  16160. but it's a convenience for users.
  16161. Also add `@configure_input@' in a comment to each input file for
  16162. `AC_OUTPUT', so that the output files contain a comment saying they
  16163. were produced by `configure'. Automatically selecting the right
  16164. comment syntax for all the kinds of files that people call `AC_OUTPUT'
  16165. on became too much work.
  16166. Add `config.log' and `config.cache' to the list of files you remove
  16167. in `distclean' targets.
  16168. If you have the following in `Makefile.in':
  16169. prefix = /usr/local
  16170. exec_prefix = $(prefix)
  16171. you must change it to:
  16172. prefix = @prefix@
  16173. exec_prefix = @exec_prefix@
  16174. The old behavior of replacing those variables without `@' characters
  16175. around them has been removed.
  16176. 
  16177. File: autoconf.info, Node: Changed Macros, Next: Changed Results, Prev: Changed Makefiles, Up: Autoconf 1
  16178. 18.5.3 Changed Macros
  16179. ---------------------
  16180. Many of the macros were renamed in Autoconf version 2. You can still
  16181. use the old names, but the new ones are clearer, and it's easier to find
  16182. the documentation for them. *Note Obsolete Macros::, for a table
  16183. showing the new names for the old macros. Use the `autoupdate' program
  16184. to convert your `configure.ac' to using the new macro names. *Note
  16185. autoupdate Invocation::.
  16186. Some macros have been superseded by similar ones that do the job
  16187. better, but are not call-compatible. If you get warnings about calling
  16188. obsolete macros while running `autoconf', you may safely ignore them,
  16189. but your `configure' script generally works better if you follow the
  16190. advice that is printed about what to replace the obsolete macros with.
  16191. In particular, the mechanism for reporting the results of tests has
  16192. changed. If you were using `echo' or `AC_VERBOSE' (perhaps via
  16193. `AC_COMPILE_CHECK'), your `configure' script's output looks better if
  16194. you switch to `AC_MSG_CHECKING' and `AC_MSG_RESULT'. *Note Printing
  16195. Messages::. Those macros work best in conjunction with cache
  16196. variables. *Note Caching Results::.
  16197. 
  16198. File: autoconf.info, Node: Changed Results, Next: Changed Macro Writing, Prev: Changed Macros, Up: Autoconf 1
  16199. 18.5.4 Changed Results
  16200. ----------------------
  16201. If you were checking the results of previous tests by examining the
  16202. shell variable `DEFS', you need to switch to checking the values of the
  16203. cache variables for those tests. `DEFS' no longer exists while
  16204. `configure' is running; it is only created when generating output
  16205. files. This difference from version 1 is because properly quoting the
  16206. contents of that variable turned out to be too cumbersome and
  16207. inefficient to do every time `AC_DEFINE' is called. *Note Cache
  16208. Variable Names::.
  16209. For example, here is a `configure.ac' fragment written for Autoconf
  16210. version 1:
  16211. AC_HAVE_FUNCS(syslog)
  16212. case "$DEFS" in
  16213. *-DHAVE_SYSLOG*) ;;
  16214. *) # syslog is not in the default libraries. See if it's in some other.
  16215. saved_LIBS="$LIBS"
  16216. for lib in bsd socket inet; do
  16217. AC_CHECKING(for syslog in -l$lib)
  16218. LIBS="-l$lib $saved_LIBS"
  16219. AC_HAVE_FUNCS(syslog)
  16220. case "$DEFS" in
  16221. *-DHAVE_SYSLOG*) break ;;
  16222. *) ;;
  16223. esac
  16224. LIBS="$saved_LIBS"
  16225. done ;;
  16226. esac
  16227. Here is a way to write it for version 2:
  16228. AC_CHECK_FUNCS([syslog])
  16229. if test "x$ac_cv_func_syslog" = xno; then
  16230. # syslog is not in the default libraries. See if it's in some other.
  16231. for lib in bsd socket inet; do
  16232. AC_CHECK_LIB([$lib], [syslog], [AC_DEFINE([HAVE_SYSLOG])
  16233. LIBS="-l$lib $LIBS"; break])
  16234. done
  16235. fi
  16236. If you were working around bugs in `AC_DEFINE_UNQUOTED' by adding
  16237. backslashes before quotes, you need to remove them. It now works
  16238. predictably, and does not treat quotes (except back quotes) specially.
  16239. *Note Setting Output Variables::.
  16240. All of the Boolean shell variables set by Autoconf macros now use
  16241. `yes' for the true value. Most of them use `no' for false, though for
  16242. backward compatibility some use the empty string instead. If you were
  16243. relying on a shell variable being set to something like 1 or `t' for
  16244. true, you need to change your tests.
  16245. 
  16246. File: autoconf.info, Node: Changed Macro Writing, Prev: Changed Results, Up: Autoconf 1
  16247. 18.5.5 Changed Macro Writing
  16248. ----------------------------
  16249. When defining your own macros, you should now use `AC_DEFUN' instead of
  16250. `define'. `AC_DEFUN' automatically calls `AC_PROVIDE' and ensures that
  16251. macros called via `AC_REQUIRE' do not interrupt other macros, to
  16252. prevent nested `checking...' messages on the screen. There's no actual
  16253. harm in continuing to use the older way, but it's less convenient and
  16254. attractive. *Note Macro Definitions::.
  16255. You probably looked at the macros that came with Autoconf as a guide
  16256. for how to do things. It would be a good idea to take a look at the new
  16257. versions of them, as the style is somewhat improved and they take
  16258. advantage of some new features.
  16259. If you were doing tricky things with undocumented Autoconf internals
  16260. (macros, variables, diversions), check whether you need to change
  16261. anything to account for changes that have been made. Perhaps you can
  16262. even use an officially supported technique in version 2 instead of
  16263. kludging. Or perhaps not.
  16264. To speed up your locally written feature tests, add caching to them.
  16265. See whether any of your tests are of general enough usefulness to
  16266. encapsulate them into macros that you can share.
  16267. 
  16268. File: autoconf.info, Node: Autoconf 2.13, Prev: Autoconf 1, Up: Obsolete Constructs
  16269. 18.6 Upgrading From Version 2.13
  16270. ================================
  16271. The introduction of the previous section (*note Autoconf 1::) perfectly
  16272. suits this section...
  16273. Autoconf version 2.50 is mostly backward compatible with version
  16274. 2.13. However, it introduces better ways to do some things, and
  16275. doesn't support some of the ugly things in version 2.13. So,
  16276. depending on how sophisticated your `configure.ac' files are, you
  16277. might have to do some manual work in order to upgrade to version
  16278. 2.50. This chapter points out some problems to watch for when
  16279. upgrading. Also, perhaps your `configure' scripts could benefit
  16280. from some of the new features in version 2.50; the changes are
  16281. summarized in the file `NEWS' in the Autoconf distribution.
  16282. * Menu:
  16283. * Changed Quotation:: Broken code which used to work
  16284. * New Macros:: Interaction with foreign macros
  16285. * Hosts and Cross-Compilation:: Bugward compatibility kludges
  16286. * AC_LIBOBJ vs LIBOBJS:: LIBOBJS is a forbidden token
  16287. * AC_ACT_IFELSE vs AC_TRY_ACT:: A more generic scheme for testing sources
  16288. 
  16289. File: autoconf.info, Node: Changed Quotation, Next: New Macros, Up: Autoconf 2.13
  16290. 18.6.1 Changed Quotation
  16291. ------------------------
  16292. The most important changes are invisible to you: the implementation of
  16293. most macros have completely changed. This allowed more factorization of
  16294. the code, better error messages, a higher uniformity of the user's
  16295. interface etc. Unfortunately, as a side effect, some construct which
  16296. used to (miraculously) work might break starting with Autoconf 2.50.
  16297. The most common culprit is bad quotation.
  16298. For instance, in the following example, the message is not properly
  16299. quoted:
  16300. AC_INIT
  16301. AC_CHECK_HEADERS(foo.h, ,
  16302. AC_MSG_ERROR(cannot find foo.h, bailing out))
  16303. AC_OUTPUT
  16304. Autoconf 2.13 simply ignores it:
  16305. $ autoconf-2.13; ./configure --silent
  16306. creating cache ./config.cache
  16307. configure: error: cannot find foo.h
  16308. $
  16309. while Autoconf 2.50 produces a broken `configure':
  16310. $ autoconf-2.50; ./configure --silent
  16311. configure: error: cannot find foo.h
  16312. ./configure: exit: bad non-numeric arg `bailing'
  16313. ./configure: exit: bad non-numeric arg `bailing'
  16314. $
  16315. The message needs to be quoted, and the `AC_MSG_ERROR' invocation
  16316. too!
  16317. AC_INIT([Example], [1.0], [bug-example@example.org])
  16318. AC_CHECK_HEADERS([foo.h], [],
  16319. [AC_MSG_ERROR([cannot find foo.h, bailing out])])
  16320. AC_OUTPUT
  16321. Many many (and many more) Autoconf macros were lacking proper
  16322. quotation, including no less than... `AC_DEFUN' itself!
  16323. $ cat configure.in
  16324. AC_DEFUN([AC_PROG_INSTALL],
  16325. [# My own much better version
  16326. ])
  16327. AC_INIT
  16328. AC_PROG_INSTALL
  16329. AC_OUTPUT
  16330. $ autoconf-2.13
  16331. autoconf: Undefined macros:
  16332. ***BUG in Autoconf--please report*** AC_FD_MSG
  16333. ***BUG in Autoconf--please report*** AC_EPI
  16334. configure.in:1:AC_DEFUN([AC_PROG_INSTALL],
  16335. configure.in:5:AC_PROG_INSTALL
  16336. $ autoconf-2.50
  16337. $
  16338. 
  16339. File: autoconf.info, Node: New Macros, Next: Hosts and Cross-Compilation, Prev: Changed Quotation, Up: Autoconf 2.13
  16340. 18.6.2 New Macros
  16341. -----------------
  16342. While Autoconf was relatively dormant in the late 1990s, Automake
  16343. provided Autoconf-like macros for a while. Starting with Autoconf 2.50
  16344. in 2001, Autoconf provided versions of these macros, integrated in the
  16345. `AC_' namespace, instead of `AM_'. But in order to ease the upgrading
  16346. via `autoupdate', bindings to such `AM_' macros are provided.
  16347. Unfortunately older versions of Automake (e.g., Automake 1.4) did
  16348. not quote the names of these macros. Therefore, when `m4' finds
  16349. something like `AC_DEFUN(AM_TYPE_PTRDIFF_T, ...)' in `aclocal.m4',
  16350. `AM_TYPE_PTRDIFF_T' is expanded, replaced with its Autoconf definition.
  16351. Fortunately Autoconf catches pre-`AC_INIT' expansions, and
  16352. complains, in its own words:
  16353. $ cat configure.ac
  16354. AC_INIT([Example], [1.0], [bug-example@example.org])
  16355. AM_TYPE_PTRDIFF_T
  16356. $ aclocal-1.4
  16357. $ autoconf
  16358. aclocal.m4:17: error: m4_defn: undefined macro: _m4_divert_diversion
  16359. aclocal.m4:17: the top level
  16360. autom4te: m4 failed with exit status: 1
  16361. $
  16362. Modern versions of Automake no longer define most of these macros,
  16363. and properly quote the names of the remaining macros. If you must use
  16364. an old Automake, do not depend upon macros from Automake as it is
  16365. simply not its job to provide macros (but the one it requires itself):
  16366. $ cat configure.ac
  16367. AC_INIT([Example], [1.0], [bug-example@example.org])
  16368. AM_TYPE_PTRDIFF_T
  16369. $ rm aclocal.m4
  16370. $ autoupdate
  16371. autoupdate: `configure.ac' is updated
  16372. $ cat configure.ac
  16373. AC_INIT([Example], [1.0], [bug-example@example.org])
  16374. AC_CHECK_TYPES([ptrdiff_t])
  16375. $ aclocal-1.4
  16376. $ autoconf
  16377. $
  16378. 
  16379. File: autoconf.info, Node: Hosts and Cross-Compilation, Next: AC_LIBOBJ vs LIBOBJS, Prev: New Macros, Up: Autoconf 2.13
  16380. 18.6.3 Hosts and Cross-Compilation
  16381. ----------------------------------
  16382. Based on the experience of compiler writers, and after long public
  16383. debates, many aspects of the cross-compilation chain have changed:
  16384. - the relationship between the build, host, and target architecture
  16385. types,
  16386. - the command line interface for specifying them to `configure',
  16387. - the variables defined in `configure',
  16388. - the enabling of cross-compilation mode.
  16389. The relationship between build, host, and target have been cleaned
  16390. up: the chain of default is now simply: target defaults to host, host to
  16391. build, and build to the result of `config.guess'. Nevertheless, in
  16392. order to ease the transition from 2.13 to 2.50, the following
  16393. transition scheme is implemented. _Do not rely on it_, as it will be
  16394. completely disabled in a couple of releases (we cannot keep it, as it
  16395. proves to cause more problems than it cures).
  16396. They all default to the result of running `config.guess', unless you
  16397. specify either `--build' or `--host'. In this case, the default
  16398. becomes the system type you specified. If you specify both, and
  16399. they're different, `configure' enters cross compilation mode, so it
  16400. doesn't run any tests that require execution.
  16401. Hint: if you mean to override the result of `config.guess', prefer
  16402. `--build' over `--host'.
  16403. For backward compatibility, `configure' accepts a system type as an
  16404. option by itself. Such an option overrides the defaults for build,
  16405. host, and target system types. The following configure statement
  16406. configures a cross toolchain that runs on NetBSD/alpha but generates
  16407. code for GNU Hurd/sparc, which is also the build platform.
  16408. ./configure --host=alpha-netbsd sparc-gnu
  16409. In Autoconf 2.13 and before, the variables `build', `host', and
  16410. `target' had a different semantics before and after the invocation of
  16411. `AC_CANONICAL_BUILD' etc. Now, the argument of `--build' is strictly
  16412. copied into `build_alias', and is left empty otherwise. After the
  16413. `AC_CANONICAL_BUILD', `build' is set to the canonicalized build type.
  16414. To ease the transition, before, its contents is the same as that of
  16415. `build_alias'. Do _not_ rely on this broken feature.
  16416. For consistency with the backward compatibility scheme exposed above,
  16417. when `--host' is specified but `--build' isn't, the build system is
  16418. assumed to be the same as `--host', and `build_alias' is set to that
  16419. value. Eventually, this historically incorrect behavior will go away.
  16420. The former scheme to enable cross-compilation proved to cause more
  16421. harm than good, in particular, it used to be triggered too easily,
  16422. leaving regular end users puzzled in front of cryptic error messages.
  16423. `configure' could even enter cross-compilation mode only because the
  16424. compiler was not functional. This is mainly because `configure' used
  16425. to try to detect cross-compilation, instead of waiting for an explicit
  16426. flag from the user.
  16427. Now, `configure' enters cross-compilation mode if and only if
  16428. `--host' is passed.
  16429. That's the short documentation. To ease the transition between 2.13
  16430. and its successors, a more complicated scheme is implemented. _Do not
  16431. rely on the following_, as it will be removed in the near future.
  16432. If you specify `--host', but not `--build', when `configure'
  16433. performs the first compiler test it tries to run an executable produced
  16434. by the compiler. If the execution fails, it enters cross-compilation
  16435. mode. This is fragile. Moreover, by the time the compiler test is
  16436. performed, it may be too late to modify the build-system type: other
  16437. tests may have already been performed. Therefore, whenever you specify
  16438. `--host', be sure to specify `--build' too.
  16439. ./configure --build=i686-pc-linux-gnu --host=m68k-coff
  16440. enters cross-compilation mode. The former interface, which consisted
  16441. in setting the compiler to a cross-compiler without informing
  16442. `configure' is obsolete. For instance, `configure' fails if it can't
  16443. run the code generated by the specified compiler if you configure as
  16444. follows:
  16445. ./configure CC=m68k-coff-gcc
  16446. 
  16447. File: autoconf.info, Node: AC_LIBOBJ vs LIBOBJS, Next: AC_ACT_IFELSE vs AC_TRY_ACT, Prev: Hosts and Cross-Compilation, Up: Autoconf 2.13
  16448. 18.6.4 `AC_LIBOBJ' vs. `LIBOBJS'
  16449. --------------------------------
  16450. Up to Autoconf 2.13, the replacement of functions was triggered via the
  16451. variable `LIBOBJS'. Since Autoconf 2.50, the macro `AC_LIBOBJ' should
  16452. be used instead (*note Generic Functions::). Starting at Autoconf
  16453. 2.53, the use of `LIBOBJS' is an error.
  16454. This change is mandated by the unification of the GNU Build System
  16455. components. In particular, the various fragile techniques used to parse
  16456. a `configure.ac' are all replaced with the use of traces. As a
  16457. consequence, any action must be traceable, which obsoletes critical
  16458. variable assignments. Fortunately, `LIBOBJS' was the only problem, and
  16459. it can even be handled gracefully (read, "without your having to change
  16460. something").
  16461. There were two typical uses of `LIBOBJS': asking for a replacement
  16462. function, and adjusting `LIBOBJS' for Automake and/or Libtool.
  16463. As for function replacement, the fix is immediate: use `AC_LIBOBJ'.
  16464. For instance:
  16465. LIBOBJS="$LIBOBJS fnmatch.o"
  16466. LIBOBJS="$LIBOBJS malloc.$ac_objext"
  16467. should be replaced with:
  16468. AC_LIBOBJ([fnmatch])
  16469. AC_LIBOBJ([malloc])
  16470. When used with Automake 1.10 or newer, a suitable value for
  16471. `LIBOBJDIR' is set so that the `LIBOBJS' and `LTLIBOBJS' can be
  16472. referenced from any `Makefile.am'. Even without Automake, arranging
  16473. for `LIBOBJDIR' to be set correctly enables referencing `LIBOBJS' and
  16474. `LTLIBOBJS' in another directory. The `LIBOBJDIR' feature is
  16475. experimental.
  16476. 
  16477. File: autoconf.info, Node: AC_ACT_IFELSE vs AC_TRY_ACT, Prev: AC_LIBOBJ vs LIBOBJS, Up: Autoconf 2.13
  16478. 18.6.5 `AC_ACT_IFELSE' vs. `AC_TRY_ACT'
  16479. ---------------------------------------
  16480. Since Autoconf 2.50, internal codes uses `AC_PREPROC_IFELSE',
  16481. `AC_COMPILE_IFELSE', `AC_LINK_IFELSE', and `AC_RUN_IFELSE' on one hand
  16482. and `AC_LANG_SOURCE', and `AC_LANG_PROGRAM' on the other hand instead
  16483. of the deprecated `AC_TRY_CPP', `AC_TRY_COMPILE', `AC_TRY_LINK', and
  16484. `AC_TRY_RUN'. The motivations where:
  16485. - a more consistent interface: `AC_TRY_COMPILE' etc. were double
  16486. quoting their arguments;
  16487. - the combinatoric explosion is solved by decomposing on the one
  16488. hand the generation of sources, and on the other hand executing
  16489. the program;
  16490. - this scheme helps supporting more languages than plain C and C++.
  16491. In addition to the change of syntax, the philosophy has changed too:
  16492. while emphasis was put on speed at the expense of accuracy, today's
  16493. Autoconf promotes accuracy of the testing framework at, ahem..., the
  16494. expense of speed.
  16495. As a perfect example of what is _not_ to be done, here is how to
  16496. find out whether a header file contains a particular declaration, such
  16497. as a typedef, a structure, a structure member, or a function. Use
  16498. `AC_EGREP_HEADER' instead of running `grep' directly on the header
  16499. file; on some systems the symbol might be defined in another header
  16500. file that the file you are checking includes.
  16501. As a (bad) example, here is how you should not check for C
  16502. preprocessor symbols, either defined by header files or predefined by
  16503. the C preprocessor: using `AC_EGREP_CPP':
  16504. AC_EGREP_CPP(yes,
  16505. [#ifdef _AIX
  16506. yes
  16507. #endif
  16508. ], is_aix=yes, is_aix=no)
  16509. The above example, properly written would (i) use `AC_LANG_PROGRAM',
  16510. and (ii) run the compiler:
  16511. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
  16512. [[#ifndef _AIX
  16513. error: This isn't AIX!
  16514. #endif
  16515. ]])],
  16516. [is_aix=yes],
  16517. [is_aix=no])
  16518. 
  16519. File: autoconf.info, Node: Using Autotest, Next: FAQ, Prev: Obsolete Constructs, Up: Top
  16520. 19 Generating Test Suites with Autotest
  16521. ***************************************
  16522. *N.B.: This section describes a feature which is still
  16523. stabilizing. Although we believe that Autotest is useful as-is, this
  16524. documentation describes an interface which might change in the future:
  16525. do not depend upon Autotest without subscribing to the Autoconf mailing
  16526. lists.*
  16527. It is paradoxical that portable projects depend on nonportable tools
  16528. to run their test suite. Autoconf by itself is the paragon of this
  16529. problem: although it aims at perfectly portability, up to 2.13 its test
  16530. suite was using DejaGNU, a rich and complex testing framework, but
  16531. which is far from being standard on Posix systems. Worse yet, it was
  16532. likely to be missing on the most fragile platforms, the very platforms
  16533. that are most likely to torture Autoconf and exhibit deficiencies.
  16534. To circumvent this problem, many package maintainers have developed
  16535. their own testing framework, based on simple shell scripts whose sole
  16536. outputs are exit status values describing whether the test succeeded.
  16537. Most of these tests share common patterns, and this can result in lots
  16538. of duplicated code and tedious maintenance.
  16539. Following exactly the same reasoning that yielded to the inception of
  16540. Autoconf, Autotest provides a test suite generation framework, based on
  16541. M4 macros building a portable shell script. The suite itself is
  16542. equipped with automatic logging and tracing facilities which greatly
  16543. diminish the interaction with bug reporters, and simple timing reports.
  16544. Autoconf itself has been using Autotest for years, and we do attest
  16545. that it has considerably improved the strength of the test suite and the
  16546. quality of bug reports. Other projects are known to use some generation
  16547. of Autotest, such as Bison, Free Recode, Free Wdiff, GNU Tar, each of
  16548. them with different needs, and this usage has validated Autotest as a
  16549. general testing framework.
  16550. Nonetheless, compared to DejaGNU, Autotest is inadequate for
  16551. interactive tool testing, which is probably its main limitation.
  16552. * Menu:
  16553. * Using an Autotest Test Suite:: Autotest and the user
  16554. * Writing Testsuites:: Autotest macros
  16555. * testsuite Invocation:: Running `testsuite' scripts
  16556. * Making testsuite Scripts:: Using autom4te to create `testsuite'
  16557. 
  16558. File: autoconf.info, Node: Using an Autotest Test Suite, Next: Writing Testsuites, Up: Using Autotest
  16559. 19.1 Using an Autotest Test Suite
  16560. =================================
  16561. * Menu:
  16562. * testsuite Scripts:: The concepts of Autotest
  16563. * Autotest Logs:: Their contents
  16564. 
  16565. File: autoconf.info, Node: testsuite Scripts, Next: Autotest Logs, Up: Using an Autotest Test Suite
  16566. 19.1.1 `testsuite' Scripts
  16567. --------------------------
  16568. Generating testing or validation suites using Autotest is rather easy.
  16569. The whole validation suite is held in a file to be processed through
  16570. `autom4te', itself using GNU M4 under the hood, to produce a
  16571. stand-alone Bourne shell script which then gets distributed. Neither
  16572. `autom4te' nor GNU M4 are needed at the installer's end.
  16573. Each test of the validation suite should be part of some test group.
  16574. A "test group" is a sequence of interwoven tests that ought to be
  16575. executed together, usually because one test in the group creates data
  16576. files that a later test in the same group needs to read. Complex test
  16577. groups make later debugging more tedious. It is much better to keep
  16578. only a few tests per test group. Ideally there is only one test per
  16579. test group.
  16580. For all but the simplest packages, some file such as `testsuite.at'
  16581. does not fully hold all test sources, as these are often easier to
  16582. maintain in separate files. Each of these separate files holds a single
  16583. test group, or a sequence of test groups all addressing some common
  16584. functionality in the package. In such cases, `testsuite.at' merely
  16585. initializes the validation suite, and sometimes does elementary health
  16586. checking, before listing include statements for all other test files.
  16587. The special file `package.m4', containing the identification of the
  16588. package, is automatically included if found.
  16589. A convenient alternative consists in moving all the global issues
  16590. (local Autotest macros, elementary health checking, and `AT_INIT'
  16591. invocation) into the file `local.at', and making `testsuite.at' be a
  16592. simple list of `m4_include's of sub test suites. In such case,
  16593. generating the whole test suite or pieces of it is only a matter of
  16594. choosing the `autom4te' command line arguments.
  16595. The validation scripts that Autotest produces are by convention
  16596. called `testsuite'. When run, `testsuite' executes each test group in
  16597. turn, producing only one summary line per test to say if that
  16598. particular test succeeded or failed. At end of all tests, summarizing
  16599. counters get printed. One debugging directory is left for each test
  16600. group which failed, if any: such directories are named
  16601. `testsuite.dir/NN', where NN is the sequence number of the test group,
  16602. and they include:
  16603. * a debugging script named `run' which reruns the test in "debug
  16604. mode" (*note testsuite Invocation::). The automatic generation of
  16605. debugging scripts has the purpose of easing the chase for bugs.
  16606. * all the files created with `AT_DATA'
  16607. * all the Erlang source code files created with `AT_CHECK_EUNIT'
  16608. * a log of the run, named `testsuite.log'
  16609. In the ideal situation, none of the tests fail, and consequently no
  16610. debugging directory is left behind for validation.
  16611. It often happens in practice that individual tests in the validation
  16612. suite need to get information coming out of the configuration process.
  16613. Some of this information, common for all validation suites, is provided
  16614. through the file `atconfig', automatically created by
  16615. `AC_CONFIG_TESTDIR'. For configuration information which your testing
  16616. environment specifically needs, you might prepare an optional file
  16617. named `atlocal.in', instantiated by `AC_CONFIG_FILES'. The
  16618. configuration process produces `atconfig' and `atlocal' out of these
  16619. two input files, and these two produced files are automatically read by
  16620. the `testsuite' script.
  16621. Here is a diagram showing the relationship between files.
  16622. Files used in preparing a software package for distribution:
  16623. [package.m4] -->.
  16624. \
  16625. subfile-1.at ->. [local.at] ---->+
  16626. ... \ \
  16627. subfile-i.at ---->-- testsuite.at -->-- autom4te* -->testsuite
  16628. ... /
  16629. subfile-n.at ->'
  16630. Files used in configuring a software package:
  16631. .--> atconfig
  16632. /
  16633. [atlocal.in] --> config.status* --<
  16634. \
  16635. `--> [atlocal]
  16636. Files created during test suite execution:
  16637. atconfig -->. .--> testsuite.log
  16638. \ /
  16639. >-- testsuite* --<
  16640. / \
  16641. [atlocal] ->' `--> [testsuite.dir]
  16642. 
  16643. File: autoconf.info, Node: Autotest Logs, Prev: testsuite Scripts, Up: Using an Autotest Test Suite
  16644. 19.1.2 Autotest Logs
  16645. --------------------
  16646. When run, the test suite creates a log file named after itself, e.g., a
  16647. test suite named `testsuite' creates `testsuite.log'. It contains a
  16648. lot of information, usually more than maintainers actually need, but
  16649. therefore most of the time it contains all that is needed:
  16650. command line arguments
  16651. A bad but unfortunately widespread habit consists of setting
  16652. environment variables before the command, such as in
  16653. `CC=my-home-grown-cc ./testsuite'. The test suite does not know
  16654. this change, hence (i) it cannot report it to you, and (ii) it
  16655. cannot preserve the value of `CC' for subsequent runs. Autoconf
  16656. faced exactly the same problem, and solved it by asking users to
  16657. pass the variable definitions as command line arguments. Autotest
  16658. requires this rule, too, but has no means to enforce it; the log
  16659. then contains a trace of the variables that were changed by the
  16660. user.
  16661. `ChangeLog' excerpts
  16662. The topmost lines of all the `ChangeLog' files found in the source
  16663. hierarchy. This is especially useful when bugs are reported
  16664. against development versions of the package, since the version
  16665. string does not provide sufficient information to know the exact
  16666. state of the sources the user compiled. Of course, this relies on
  16667. the use of a `ChangeLog'.
  16668. build machine
  16669. Running a test suite in a cross-compile environment is not an easy
  16670. task, since it would mean having the test suite run on a machine
  16671. BUILD, while running programs on a machine HOST. It is much
  16672. simpler to run both the test suite and the programs on HOST, but
  16673. then, from the point of view of the test suite, there remains a
  16674. single environment, HOST = BUILD. The log contains relevant
  16675. information on the state of the BUILD machine, including some
  16676. important environment variables.
  16677. tested programs
  16678. The absolute file name and answers to `--version' of the tested
  16679. programs (see *note Writing Testsuites::, `AT_TESTED').
  16680. configuration log
  16681. The contents of `config.log', as created by `configure', are
  16682. appended. It contains the configuration flags and a detailed
  16683. report on the configuration itself.
  16684. 
  16685. File: autoconf.info, Node: Writing Testsuites, Next: testsuite Invocation, Prev: Using an Autotest Test Suite, Up: Using Autotest
  16686. 19.2 Writing `testsuite.at'
  16687. ===========================
  16688. The `testsuite.at' is a Bourne shell script making use of special
  16689. Autotest M4 macros. It often contains a call to `AT_INIT' near its
  16690. beginning followed by one call to `m4_include' per source file for
  16691. tests. Each such included file, or the remainder of `testsuite.at' if
  16692. include files are not used, contain a sequence of test groups. Each
  16693. test group begins with a call to `AT_SETUP', then an arbitrary number
  16694. of shell commands or calls to `AT_CHECK', and then completes with a
  16695. call to `AT_CLEANUP'. Multiple test groups can be categorized by a
  16696. call to `AT_BANNER'.
  16697. All of the public Autotest macros have all-uppercase names in the
  16698. namespace `^AT_' to prevent them from accidentally conflicting with
  16699. other text; Autoconf also reserves the namespace `^_AT_' for internal
  16700. macros. All shell variables used in the testsuite for internal
  16701. purposes have mostly-lowercase names starting with `at_'. Autotest
  16702. also uses here-document delimiters in the namespace `^_AT[A-Z]', and
  16703. makes use of the file system namespace `^at-'.
  16704. Since Autoconf is built on top of M4sugar (*note Programming in
  16705. M4sugar::) and M4sh (*note Programming in M4sh::), you must also be
  16706. aware of those namespaces (`^_?\(m4\|AS\)_'). In general, you _should
  16707. not use_ the namespace of a package that does not own the macro or
  16708. shell code you are writing.
  16709. -- Macro: AT_INIT ([NAME])
  16710. Initialize Autotest. Giving a NAME to the test suite is
  16711. encouraged if your package includes several test suites. Before
  16712. this macro is called, `AT_PACKAGE_STRING' and
  16713. `AT_PACKAGE_BUGREPORT' must be defined, which are used to display
  16714. information about the testsuite to the user. Typically, these
  16715. macros are provided by a file `package.m4' built by `make' (*note
  16716. Making testsuite Scripts::), in order to inherit the package name,
  16717. version, and bug reporting address from `configure.ac'.
  16718. -- Macro: AT_COPYRIGHT (COPYRIGHT-NOTICE)
  16719. State that, in addition to the Free Software Foundation's
  16720. copyright on the Autotest macros, parts of your test suite are
  16721. covered by COPYRIGHT-NOTICE.
  16722. The COPYRIGHT-NOTICE shows up in both the head of `testsuite' and
  16723. in `testsuite --version'.
  16724. -- Macro: AT_ARG_OPTION (OPTIONS, HELP-TEXT, [ACTION-IF-GIVEN],
  16725. [ACTION-IF-NOT-GIVEN])
  16726. Accept options from the space-separated list OPTIONS, a list that
  16727. has leading dashes removed from the options. Long options will be
  16728. prefixed with `--', single-character options with `-'. The first
  16729. word in this list is the primary OPTION, any others are assumed to
  16730. be short-hand aliases. The variable associated with it is
  16731. `at_arg_OPTION', with any dashes in OPTION replaced with
  16732. underscores.
  16733. If the user passes `--OPTION' to the `testsuite', the variable
  16734. will be set to `:'. If the user does not pass the option, or
  16735. passes `--no-OPTION', then the variable will be set to `false'.
  16736. ACTION-IF-GIVEN is run each time the option is encountered; here,
  16737. the variable `at_optarg' will be set to `:' or `false' as
  16738. appropriate. `at_optarg' is actually just a copy of
  16739. `at_arg_OPTION'.
  16740. ACTION-IF-NOT-GIVEN will be run once after option parsing is
  16741. complete and if no option from OPTIONS was used.
  16742. HELP-TEXT is added to the end of the list of options shown in
  16743. `testsuite --help' (*note AS_HELP_STRING::).
  16744. It is recommended that you use a package-specific prefix to OPTIONS
  16745. names in order to avoid clashes with future Autotest built-in
  16746. options.
  16747. -- Macro: AT_ARG_OPTION_ARG (OPTIONS, HELP-TEXT, [ACTION-IF-GIVEN],
  16748. [ACTION-IF-NOT-GIVEN])
  16749. Accept options with arguments from the space-separated list
  16750. OPTIONS, a list that has leading dashes removed from the options.
  16751. Long options will be prefixed with `--', single-character options
  16752. with `-'. The first word in this list is the primary OPTION, any
  16753. others are assumed to be short-hand aliases. The variable
  16754. associated with it is `at_arg_OPTION', with any dashes in OPTION
  16755. replaced with underscores.
  16756. If the user passes `--OPTION=ARG' or `--OPTION ARG' to the
  16757. `testsuite', the variable will be set to `ARG'.
  16758. ACTION-IF-GIVEN is run each time the option is encountered; here,
  16759. the variable `at_optarg' will be set to `ARG'. `at_optarg' is
  16760. actually just a copy of `at_arg_OPTION'.
  16761. ACTION-IF-NOT-GIVEN will be run once after option parsing is
  16762. complete and if no option from OPTIONS was used.
  16763. HELP-TEXT is added to the end of the list of options shown in
  16764. `testsuite --help' (*note AS_HELP_STRING::).
  16765. It is recommended that you use a package-specific prefix to OPTIONS
  16766. names in order to avoid clashes with future Autotest built-in
  16767. options.
  16768. -- Macro: AT_COLOR_TESTS
  16769. Enable colored test results by default when the output is
  16770. connected to a terminal.
  16771. -- Macro: AT_TESTED (EXECUTABLES)
  16772. Log the file name and answer to `--version' of each program in
  16773. space-separated list EXECUTABLES. Several invocations register
  16774. new executables, in other words, don't fear registering one program
  16775. several times.
  16776. Autotest test suites rely on `PATH' to find the tested program.
  16777. This avoids the need to generate absolute names of the various
  16778. tools, and makes it possible to test installed programs.
  16779. Therefore, knowing which programs are being exercised is crucial
  16780. to understanding problems in the test suite itself, or its
  16781. occasional misuses. It is a good idea to also subscribe foreign
  16782. programs you depend upon, to avoid incompatible diagnostics.
  16783. -- Macro: AT_BANNER (TEST-CATEGORY-NAME)
  16784. This macro identifies the start of a category of related test
  16785. groups. When the resulting `testsuite' is invoked with more than
  16786. one test group to run, its output will include a banner containing
  16787. TEST-CATEGORY-NAME prior to any tests run from that category. The
  16788. banner should be no more than about 40 or 50 characters. A blank
  16789. banner indicates uncategorized tests; an empty line will be
  16790. inserted after tests from an earlier category, effectively ending
  16791. that category.
  16792. -- Macro: AT_SETUP (TEST-GROUP-NAME)
  16793. This macro starts a group of related tests, all to be executed in
  16794. the same subshell. It accepts a single argument, which holds a
  16795. few words (no more than about 30 or 40 characters) quickly
  16796. describing the purpose of the test group being started.
  16797. TEST-GROUP-NAME must not expand to unbalanced quotes, although
  16798. quadrigraphs can be used.
  16799. -- Macro: AT_KEYWORDS (KEYWORDS)
  16800. Associate the space-separated list of KEYWORDS to the enclosing
  16801. test group. This makes it possible to run "slices" of the test
  16802. suite. For instance, if some of your test groups exercise some
  16803. `foo' feature, then using `AT_KEYWORDS(foo)' lets you run
  16804. `./testsuite -k foo' to run exclusively these test groups. The
  16805. TEST-GROUP-NAME of the test group is automatically recorded to
  16806. `AT_KEYWORDS'.
  16807. Several invocations within a test group accumulate new keywords.
  16808. In other words, don't fear registering the same keyword several
  16809. times in a test group.
  16810. -- Macro: AT_CAPTURE_FILE (FILE)
  16811. If the current test group fails, log the contents of FILE.
  16812. Several identical calls within one test group have no additional
  16813. effect.
  16814. -- Macro: AT_FAIL_IF (SHELL-CONDITION)
  16815. Make the test group fail and skip the rest of its execution, if
  16816. SHELL-CONDITION is true. SHELL-CONDITION is a shell expression
  16817. such as a `test' command. Tests before `AT_FAIL_IF' will be
  16818. executed and may still cause the test group to be skipped. You
  16819. can instantiate this macro many times from within the same test
  16820. group.
  16821. You should use this macro only for very simple failure conditions.
  16822. If the SHELL-CONDITION could emit any kind of output you should
  16823. instead use `AT_CHECK' like
  16824. AT_CHECK([if SHELL-CONDITION; then exit 99; fi])
  16825. so that such output is properly recorded in the `testsuite.log'
  16826. file.
  16827. -- Macro: AT_SKIP_IF (SHELL-CONDITION)
  16828. Determine whether the test should be skipped because it requires
  16829. features that are unsupported on the machine under test.
  16830. SHELL-CONDITION is a shell expression such as a `test' command.
  16831. Tests before `AT_SKIP_IF' will be executed and may still cause the
  16832. test group to fail. You can instantiate this macro many times
  16833. from within the same test group.
  16834. You should use this macro only for very simple skip conditions.
  16835. If the SHELL-CONDITION could emit any kind of output you should
  16836. instead use `AT_CHECK' like
  16837. AT_CHECK([if SHELL-CONDITION; then exit 77; fi])
  16838. so that such output is properly recorded in the `testsuite.log'
  16839. file.
  16840. -- Macro: AT_XFAIL_IF (SHELL-CONDITION)
  16841. Determine whether the test is expected to fail because it is a
  16842. known bug (for unsupported features, you should skip the test).
  16843. SHELL-CONDITION is a shell expression such as a `test' command;
  16844. you can instantiate this macro many times from within the same
  16845. test group, and one of the conditions is enough to turn the test
  16846. into an expected failure.
  16847. -- Macro: AT_CLEANUP
  16848. End the current test group.
  16849. -- Macro: AT_DATA (FILE, CONTENTS)
  16850. Initialize an input data FILE with given CONTENTS. Of course, the
  16851. CONTENTS have to be properly quoted between square brackets to
  16852. protect against included commas or spurious M4 expansion.
  16853. CONTENTS must be empty or end with a newline. FILE must be a
  16854. single shell word that expands into a single file name.
  16855. -- Macro: AT_CHECK (COMMANDS, [STATUS = `0'], [STDOUT], [STDERR],
  16856. [RUN-IF-FAIL], [RUN-IF-PASS])
  16857. -- Macro: AT_CHECK_UNQUOTED (COMMANDS, [STATUS = `0'], [STDOUT],
  16858. [STDERR], [RUN-IF-FAIL], [RUN-IF-PASS])
  16859. Execute a test by performing given shell COMMANDS in a subshell.
  16860. COMMANDS is output as-is, so shell expansions are honored. These
  16861. commands should normally exit with STATUS, while producing expected
  16862. STDOUT and STDERR contents. If COMMANDS exit with unexpected
  16863. status 77, then the rest of the test group is skipped. If
  16864. COMMANDS exit with unexpected status 99, then the test group is
  16865. immediately failed. Otherwise, if this test fails, run shell
  16866. commands RUN-IF-FAIL or, if this test passes, run shell commands
  16867. RUN-IF-PASS, both inside the current shell execution environment.
  16868. At the beginning of RUN-IF-FAIL and RUN-IF-PASS, the status of
  16869. COMMANDS is available in the `at_status' shell variable.
  16870. This macro must be invoked in between `AT_SETUP' and `AT_CLEANUP'.
  16871. If STATUS is the literal `ignore', then the corresponding exit
  16872. status is not checked, except for the special cases of 77 (skip)
  16873. and 99 (hard failure). The existence of hard failures allows one
  16874. to mark a test as an expected failure with `AT_XFAIL_IF' because a
  16875. feature has not yet been implemented, but to still distinguish
  16876. between gracefully handling the missing feature and dumping core.
  16877. A hard failure also inhibits post-test actions in RUN-IF-FAIL.
  16878. If the value of the STDOUT or STDERR parameter is one of the
  16879. literals in the following table, then the test treats the output
  16880. according to the rules of that literal. Otherwise, the value of
  16881. the parameter is treated as text that must exactly match the
  16882. output given by COMMANDS on standard output and standard error
  16883. (including an empty parameter for no output); any differences are
  16884. captured in the testsuite log and the test is failed (unless an
  16885. unexpected exit status of 77 skipped the test instead). The
  16886. difference between `AT_CHECK' and `AT_CHECK_UNQUOTED' is that only
  16887. the latter performs shell variable expansion (`$'), command
  16888. substitution (``'), and backslash escaping (`\') on comparison
  16889. text given in the STDOUT and STDERR arguments; if the text
  16890. includes a trailing newline, this would be the same as if it were
  16891. specified via an unquoted here-document. (However, there is no
  16892. difference in the interpretation of COMMANDS).
  16893. `ignore'
  16894. The content of the output is ignored, but still captured in
  16895. the test group log (if the testsuite is run with option `-v',
  16896. the test group log is displayed as the test is run; if the
  16897. test group later fails, the test group log is also copied
  16898. into the overall testsuite log). This action is valid for
  16899. both STDOUT and STDERR.
  16900. `ignore-nolog'
  16901. The content of the output is ignored, and nothing is captured
  16902. in the log files. If COMMANDS are likely to produce binary
  16903. output (including long lines) or large amounts of output,
  16904. then logging the output can make it harder to locate details
  16905. related to subsequent tests within the group, and could
  16906. potentially corrupt terminal display of a user running
  16907. `testsuite -v'.
  16908. `stdout'
  16909. For the STDOUT parameter, capture the content of standard
  16910. output to both the file `stdout' and the test group log.
  16911. Subsequent commands in the test group can then post-process
  16912. the file. This action is often used when it is desired to
  16913. use `grep' to look for a substring in the output, or when the
  16914. output must be post-processed to normalize error messages
  16915. into a common form.
  16916. `stderr'
  16917. Like `stdout', except that it only works for the STDERR
  16918. parameter, and the standard error capture file will be named
  16919. `stderr'.
  16920. `stdout-nolog'
  16921. `stderr-nolog'
  16922. Like `stdout' or `stderr', except that the captured output is
  16923. not duplicated into the test group log. This action is
  16924. particularly useful for an intermediate check that produces
  16925. large amounts of data, which will be followed by another
  16926. check that filters down to the relevant data, as it makes it
  16927. easier to locate details in the log.
  16928. `expout'
  16929. For the STDOUT parameter, compare standard output contents
  16930. with the previously created file `expout', and list any
  16931. differences in the testsuite log.
  16932. `experr'
  16933. Like `expout', except that it only works for the STDERR
  16934. parameter, and the standard error contents are compared with
  16935. `experr'.
  16936. -- Macro: AT_CHECK_EUNIT (MODULE, TEST-SPEC, [ERLFLAGS],
  16937. [RUN-IF-FAIL], [RUN-IF-PASS])
  16938. Initialize and execute an Erlang module named MODULE that performs
  16939. tests following the TEST-SPEC EUnit test specification. TEST-SPEC
  16940. must be a valid EUnit test specification, as defined in the EUnit
  16941. Reference Manual (http://erlang.org/doc/apps/eunit/index.html).
  16942. ERLFLAGS are optional command-line options passed to the Erlang
  16943. interpreter to execute the test Erlang module. Typically,
  16944. ERLFLAGS defines at least the paths to directories containing the
  16945. compiled Erlang modules under test, as `-pa path1 path2 ...'.
  16946. For example, the unit tests associated with Erlang module `testme',
  16947. which compiled code is in subdirectory `src', can be performed
  16948. with:
  16949. AT_CHECK_EUNIT([testme_testsuite], [{module, testme}],
  16950. [-pa "${abs_top_builddir}/src"])
  16951. This macro must be invoked in between `AT_SETUP' and `AT_CLEANUP'.
  16952. Variables `ERL', `ERLC', and (optionally) `ERLCFLAGS' must be
  16953. defined as the path of the Erlang interpreter, the path of the
  16954. Erlang compiler, and the command-line flags to pass to the
  16955. compiler, respectively. Those variables should be configured in
  16956. `configure.ac' using the `AC_ERLANG_PATH_ERL' and
  16957. `AC_ERLANG_PATH_ERLC' macros, and the configured values of those
  16958. variables are automatically defined in the testsuite. If `ERL' or
  16959. `ERLC' is not defined, the test group is skipped.
  16960. If the EUnit library cannot be found, i.e. if module `eunit' cannot
  16961. be loaded, the test group is skipped. Otherwise, if TEST-SPEC is
  16962. an invalid EUnit test specification, the test group fails.
  16963. Otherwise, if the EUnit test passes, shell commands RUN-IF-PASS
  16964. are executed or, if the EUnit test fails, shell commands
  16965. RUN-IF-FAIL are executed and the test group fails.
  16966. Only the generated test Erlang module is automatically compiled and
  16967. executed. If TEST-SPEC involves testing other Erlang modules,
  16968. e.g. module `testme' in the example above, those modules must be
  16969. already compiled.
  16970. If the testsuite is run in verbose mode, with option `--verbose',
  16971. EUnit is also run in verbose mode to output more details about
  16972. individual unit tests.
  16973. 
  16974. File: autoconf.info, Node: testsuite Invocation, Next: Making testsuite Scripts, Prev: Writing Testsuites, Up: Using Autotest
  16975. 19.3 Running `testsuite' Scripts
  16976. ================================
  16977. Autotest test suites support the following options:
  16978. `--help'
  16979. `-h'
  16980. Display the list of options and exit successfully.
  16981. `--version'
  16982. `-V'
  16983. Display the version of the test suite and exit successfully.
  16984. `--directory=DIR'
  16985. `-C DIR'
  16986. Change the current directory to DIR before creating any files.
  16987. Useful for running the testsuite in a subdirectory from a top-level
  16988. Makefile.
  16989. `--jobs[=N]'
  16990. `-j[N]'
  16991. Run N tests in parallel, if possible. If N is not given, run all
  16992. given tests in parallel. Note that there should be no space
  16993. before the argument to `-j', as `-j NUMBER' denotes the separate
  16994. arguments `-j' and `NUMBER', see below.
  16995. In parallel mode, the standard input device of the testsuite
  16996. script is not available to commands inside a test group.
  16997. Furthermore, banner lines are not printed, and the summary line
  16998. for each test group is output after the test group completes.
  16999. Summary lines may appear unordered. If verbose and trace output
  17000. are enabled (see below), they may appear intermixed from
  17001. concurrently running tests.
  17002. Parallel mode requires the `mkfifo' command to work, and will be
  17003. silently disabled otherwise.
  17004. `--clean'
  17005. `-c'
  17006. Remove all the files the test suite might have created and exit.
  17007. Meant for `clean' Make targets.
  17008. `--list'
  17009. `-l'
  17010. List all the tests (or only the selection), including their
  17011. possible keywords.
  17012. By default all tests are performed (or described with `--list')
  17013. silently in the default environment, but the environment, set of tests,
  17014. and verbosity level can be tuned:
  17015. `VARIABLE=VALUE'
  17016. Set the environment VARIABLE to VALUE. Use this rather than
  17017. `FOO=foo ./testsuite' as debugging scripts would then run in a
  17018. different environment.
  17019. The variable `AUTOTEST_PATH' specifies the testing path to prepend
  17020. to `PATH'. Relative directory names (not starting with `/') are
  17021. considered to be relative to the top level of the package being
  17022. built. All directories are made absolute, first starting from the
  17023. top level _build_ tree, then from the _source_ tree. For instance
  17024. `./testsuite AUTOTEST_PATH=tests:bin' for a `/src/foo-1.0' source
  17025. package built in `/tmp/foo' results in
  17026. `/tmp/foo/tests:/tmp/foo/bin' and then
  17027. `/src/foo-1.0/tests:/src/foo-1.0/bin' being prepended to `PATH'.
  17028. `NUMBER'
  17029. `NUMBER-NUMBER'
  17030. `NUMBER-'
  17031. `-NUMBER'
  17032. Add the corresponding test groups, with obvious semantics, to the
  17033. selection.
  17034. `--keywords=KEYWORDS'
  17035. `-k KEYWORDS'
  17036. Add to the selection the test groups with title or keywords
  17037. (arguments to `AT_SETUP' or `AT_KEYWORDS') that match _all_
  17038. keywords of the comma separated list KEYWORDS, case-insensitively.
  17039. Use `!' immediately before the keyword to invert the selection for
  17040. this keyword. By default, the keywords match whole words; enclose
  17041. them in `.*' to also match parts of words.
  17042. For example, running
  17043. ./testsuite -k 'autoupdate,.*FUNC.*'
  17044. selects all tests tagged `autoupdate' _and_ with tags containing
  17045. `FUNC' (as in `AC_CHECK_FUNC', `AC_FUNC_ALLOCA', etc.), while
  17046. ./testsuite -k '!autoupdate' -k '.*FUNC.*'
  17047. selects all tests not tagged `autoupdate' _or_ with tags
  17048. containing `FUNC'.
  17049. `--errexit'
  17050. `-e'
  17051. If any test fails, immediately abort testing. This implies
  17052. `--debug': post test group clean up, and top-level logging are
  17053. inhibited. This option is meant for the full test suite, it is
  17054. not really useful for generated debugging scripts. If the
  17055. testsuite is run in parallel mode using `--jobs', then
  17056. concurrently running tests will finish before exiting.
  17057. `--verbose'
  17058. `-v'
  17059. Force more verbosity in the detailed output of what is being done.
  17060. This is the default for debugging scripts.
  17061. `--color'
  17062. `--color[=never|auto|always]'
  17063. Enable colored test results. Without an argument, or with
  17064. `always', test results will be colored. With `never', color mode
  17065. is turned off. Otherwise, if either the macro `AT_COLOR_TESTS' is
  17066. used by the testsuite author, or the argument `auto' is given,
  17067. then test results are colored if standard output is connected to a
  17068. terminal.
  17069. `--debug'
  17070. `-d'
  17071. Do not remove the files after a test group was performed--but they
  17072. are still removed _before_, therefore using this option is sane
  17073. when running several test groups. Create debugging scripts. Do
  17074. not overwrite the top-level log (in order to preserve a supposedly
  17075. existing full log file). This is the default for debugging
  17076. scripts, but it can also be useful to debug the testsuite itself.
  17077. `--recheck'
  17078. Add to the selection all test groups that failed or passed
  17079. unexpectedly during the last non-debugging test run.
  17080. `--trace'
  17081. `-x'
  17082. Trigger shell tracing of the test groups.
  17083. Besides these options accepted by every Autotest testsuite, the
  17084. testsuite author might have added package-specific options via the
  17085. `AT_ARG_OPTION' and `AT_ARG_OPTION_ARG' macros (*note Writing
  17086. Testsuites::); refer to `testsuite --help' and the package
  17087. documentation for details.
  17088. 
  17089. File: autoconf.info, Node: Making testsuite Scripts, Prev: testsuite Invocation, Up: Using Autotest
  17090. 19.4 Making `testsuite' Scripts
  17091. ===============================
  17092. For putting Autotest into movement, you need some configuration and
  17093. makefile machinery. We recommend, at least if your package uses deep or
  17094. shallow hierarchies, that you use `tests/' as the name of the directory
  17095. holding all your tests and their makefile. Here is a check list of
  17096. things to do.
  17097. - Make sure to create the file `package.m4', which defines the
  17098. identity of the package. It must define `AT_PACKAGE_STRING', the
  17099. full signature of the package, and `AT_PACKAGE_BUGREPORT', the
  17100. address to which bug reports should be sent. For sake of
  17101. completeness, we suggest that you also define `AT_PACKAGE_NAME',
  17102. `AT_PACKAGE_TARNAME', `AT_PACKAGE_VERSION', and `AT_PACKAGE_URL'.
  17103. *Note Initializing configure::, for a description of these
  17104. variables. Be sure to distribute `package.m4' and to put it into
  17105. the source hierarchy: the test suite ought to be shipped! See
  17106. below for an example `Makefile' excerpt.
  17107. - Invoke `AC_CONFIG_TESTDIR'.
  17108. -- Macro: AC_CONFIG_TESTDIR (DIRECTORY, [TEST-PATH = `directory'])
  17109. An Autotest test suite is to be configured in DIRECTORY. This
  17110. macro causes `DIRECTORY/atconfig' to be created by
  17111. `config.status' and sets the default `AUTOTEST_PATH' to
  17112. TEST-PATH (*note testsuite Invocation::).
  17113. - Still within `configure.ac', as appropriate, ensure that some
  17114. `AC_CONFIG_FILES' command includes substitution for
  17115. `tests/atlocal'.
  17116. - The appropriate `Makefile' should be modified so the validation in
  17117. your package is triggered by `make check'. An example is provided
  17118. below.
  17119. With Automake, here is a minimal example for inclusion in
  17120. `tests/Makefile.am', in order to link `make check' with a validation
  17121. suite.
  17122. # The `:;' works around a Bash 3.2 bug when the output is not writable.
  17123. $(srcdir)/package.m4: $(top_srcdir)/configure.ac
  17124. :;{ \
  17125. echo '# Signature of the current package.' && \
  17126. echo 'm4_define([AT_PACKAGE_NAME],' && \
  17127. echo ' [$(PACKAGE_NAME)])' && \
  17128. echo 'm4_define([AT_PACKAGE_TARNAME],' && \
  17129. echo ' [$(PACKAGE_TARNAME)])' && \
  17130. echo 'm4_define([AT_PACKAGE_VERSION],' && \
  17131. echo ' [$(PACKAGE_VERSION)])' && \
  17132. echo 'm4_define([AT_PACKAGE_STRING],' && \
  17133. echo ' [$(PACKAGE_STRING)])' && \
  17134. echo 'm4_define([AT_PACKAGE_BUGREPORT],' && \
  17135. echo ' [$(PACKAGE_BUGREPORT)])'; \
  17136. echo 'm4_define([AT_PACKAGE_URL],' && \
  17137. echo ' [$(PACKAGE_URL)])'; \
  17138. } >'$(srcdir)/package.m4'
  17139. EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE) atlocal.in
  17140. TESTSUITE = $(srcdir)/testsuite
  17141. check-local: atconfig atlocal $(TESTSUITE)
  17142. $(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
  17143. installcheck-local: atconfig atlocal $(TESTSUITE)
  17144. $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' \
  17145. $(TESTSUITEFLAGS)
  17146. clean-local:
  17147. test ! -f '$(TESTSUITE)' || \
  17148. $(SHELL) '$(TESTSUITE)' --clean
  17149. AUTOM4TE = $(SHELL) $(srcdir)/build-aux/missing --run autom4te
  17150. AUTOTEST = $(AUTOM4TE) --language=autotest
  17151. $(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4
  17152. $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
  17153. mv $@.tmp $@
  17154. Note that the built testsuite is distributed; this is necessary
  17155. because users might not have Autoconf installed, and thus would not be
  17156. able to rebuild it. Likewise, the use of `missing' provides the user
  17157. with a nicer error message if they modify a source file to the
  17158. testsuite, and accidentally trigger the rebuild rules.
  17159. You might want to list explicitly the dependencies, i.e., the list of
  17160. the files `testsuite.at' includes.
  17161. If you don't use Automake, you should include the above example in
  17162. `tests/Makefile.in', along with additional lines inspired from the
  17163. following:
  17164. subdir = tests
  17165. PACKAGE_NAME = @PACKAGE_NAME@
  17166. PACKAGE_TARNAME = @PACKAGE_TARNAME@
  17167. PACKAGE_VERSION = @PACKAGE_VERSION@
  17168. PACKAGE_STRING = @PACKAGE_STRING@
  17169. PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
  17170. PACKAGE_URL = @PACKAGE_URL@
  17171. atconfig: $(top_builddir)/config.status
  17172. cd $(top_builddir) && \
  17173. $(SHELL) ./config.status $(subdir)/$@
  17174. atlocal: $(srcdir)/atlocal.in $(top_builddir)/config.status
  17175. cd $(top_builddir) && \
  17176. $(SHELL) ./config.status $(subdir)/$@
  17177. and manage to have `$(EXTRA_DIST)' distributed. You will also want to
  17178. distribute the file `build-aux/missing' from the Automake project; a
  17179. copy of this file resides in the Autoconf source tree.
  17180. With all this in place, and if you have not initialized
  17181. `TESTSUITEFLAGS' within your makefile, you can fine-tune test suite
  17182. execution with this variable, for example:
  17183. make check TESTSUITEFLAGS='-v -d -x 75 -k AC_PROG_CC CFLAGS=-g'
  17184. 
  17185. File: autoconf.info, Node: FAQ, Next: History, Prev: Using Autotest, Up: Top
  17186. 20 Frequent Autoconf Questions, with answers
  17187. ********************************************
  17188. Several questions about Autoconf come up occasionally. Here some of
  17189. them are addressed.
  17190. * Menu:
  17191. * Distributing:: Distributing `configure' scripts
  17192. * Why GNU M4:: Why not use the standard M4?
  17193. * Bootstrapping:: Autoconf and GNU M4 require each other?
  17194. * Why Not Imake:: Why GNU uses `configure' instead of Imake
  17195. * Defining Directories:: Passing `datadir' to program
  17196. * Autom4te Cache:: What is it? Can I remove it?
  17197. * Present But Cannot Be Compiled:: Compiler and Preprocessor Disagree
  17198. * Expanded Before Required:: Expanded Before Required
  17199. * Debugging:: Debugging `configure' scripts
  17200. 
  17201. File: autoconf.info, Node: Distributing, Next: Why GNU M4, Up: FAQ
  17202. 20.1 Distributing `configure' Scripts
  17203. =====================================
  17204. What are the restrictions on distributing `configure'
  17205. scripts that Autoconf generates? How does that affect my
  17206. programs that use them?
  17207. There are no restrictions on how the configuration scripts that
  17208. Autoconf produces may be distributed or used. In Autoconf version 1,
  17209. they were covered by the GNU General Public License. We still encourage
  17210. software authors to distribute their work under terms like those of the
  17211. GPL, but doing so is not required to use Autoconf.
  17212. Of the other files that might be used with `configure',
  17213. `config.h.in' is under whatever copyright you use for your
  17214. `configure.ac'. `config.sub' and `config.guess' have an exception to
  17215. the GPL when they are used with an Autoconf-generated `configure'
  17216. script, which permits you to distribute them under the same terms as
  17217. the rest of your package. `install-sh' is from the X Consortium and is
  17218. not copyrighted.
  17219. 
  17220. File: autoconf.info, Node: Why GNU M4, Next: Bootstrapping, Prev: Distributing, Up: FAQ
  17221. 20.2 Why Require GNU M4?
  17222. ========================
  17223. Why does Autoconf require GNU M4?
  17224. Many M4 implementations have hard-coded limitations on the size and
  17225. number of macros that Autoconf exceeds. They also lack several builtin
  17226. macros that it would be difficult to get along without in a
  17227. sophisticated application like Autoconf, including:
  17228. m4_builtin
  17229. m4_indir
  17230. m4_bpatsubst
  17231. __file__
  17232. __line__
  17233. Autoconf requires version 1.4.6 or later of GNU M4.
  17234. Since only software maintainers need to use Autoconf, and since GNU
  17235. M4 is simple to configure and install, it seems reasonable to require
  17236. GNU M4 to be installed also. Many maintainers of GNU and other free
  17237. software already have most of the GNU utilities installed, since they
  17238. prefer them.
  17239. 
  17240. File: autoconf.info, Node: Bootstrapping, Next: Why Not Imake, Prev: Why GNU M4, Up: FAQ
  17241. 20.3 How Can I Bootstrap?
  17242. =========================
  17243. If Autoconf requires GNU M4 and GNU M4 has an Autoconf
  17244. `configure' script, how do I bootstrap? It seems like a chicken
  17245. and egg problem!
  17246. This is a misunderstanding. Although GNU M4 does come with a
  17247. `configure' script produced by Autoconf, Autoconf is not required in
  17248. order to run the script and install GNU M4. Autoconf is only required
  17249. if you want to change the M4 `configure' script, which few people have
  17250. to do (mainly its maintainer).
  17251. 
  17252. File: autoconf.info, Node: Why Not Imake, Next: Defining Directories, Prev: Bootstrapping, Up: FAQ
  17253. 20.4 Why Not Imake?
  17254. ===================
  17255. Why not use Imake instead of `configure' scripts?
  17256. Several people have written addressing this question, so adaptations
  17257. of their explanations are included here.
  17258. The following answer is based on one written by Richard Pixley:
  17259. Autoconf generated scripts frequently work on machines that it has
  17260. never been set up to handle before. That is, it does a good job of
  17261. inferring a configuration for a new system. Imake cannot do this.
  17262. Imake uses a common database of host specific data. For X11, this
  17263. makes sense because the distribution is made as a collection of
  17264. tools, by one central authority who has control over the database.
  17265. GNU tools are not released this way. Each GNU tool has a
  17266. maintainer; these maintainers are scattered across the world.
  17267. Using a common database would be a maintenance nightmare.
  17268. Autoconf may appear to be this kind of database, but in fact it is
  17269. not. Instead of listing host dependencies, it lists program
  17270. requirements.
  17271. If you view the GNU suite as a collection of native tools, then the
  17272. problems are similar. But the GNU development tools can be
  17273. configured as cross tools in almost any host+target permutation.
  17274. All of these configurations can be installed concurrently. They
  17275. can even be configured to share host independent files across
  17276. hosts. Imake doesn't address these issues.
  17277. Imake templates are a form of standardization. The GNU coding
  17278. standards address the same issues without necessarily imposing the
  17279. same restrictions.
  17280. Here is some further explanation, written by Per Bothner:
  17281. One of the advantages of Imake is that it is easy to generate large
  17282. makefiles using the `#include' and macro mechanisms of `cpp'.
  17283. However, `cpp' is not programmable: it has limited conditional
  17284. facilities, and no looping. And `cpp' cannot inspect its
  17285. environment.
  17286. All of these problems are solved by using `sh' instead of `cpp'.
  17287. The shell is fully programmable, has macro substitution, can
  17288. execute (or source) other shell scripts, and can inspect its
  17289. environment.
  17290. Paul Eggert elaborates more:
  17291. With Autoconf, installers need not assume that Imake itself is
  17292. already installed and working well. This may not seem like much
  17293. of an advantage to people who are accustomed to Imake. But on
  17294. many hosts Imake is not installed or the default installation is
  17295. not working well, and requiring Imake to install a package hinders
  17296. the acceptance of that package on those hosts. For example, the
  17297. Imake template and configuration files might not be installed
  17298. properly on a host, or the Imake build procedure might wrongly
  17299. assume that all source files are in one big directory tree, or the
  17300. Imake configuration might assume one compiler whereas the package
  17301. or the installer needs to use another, or there might be a version
  17302. mismatch between the Imake expected by the package and the Imake
  17303. supported by the host. These problems are much rarer with
  17304. Autoconf, where each package comes with its own independent
  17305. configuration processor.
  17306. Also, Imake often suffers from unexpected interactions between
  17307. `make' and the installer's C preprocessor. The fundamental problem
  17308. here is that the C preprocessor was designed to preprocess C
  17309. programs, not makefiles. This is much less of a problem with
  17310. Autoconf, which uses the general-purpose preprocessor M4, and
  17311. where the package's author (rather than the installer) does the
  17312. preprocessing in a standard way.
  17313. Finally, Mark Eichin notes:
  17314. Imake isn't all that extensible, either. In order to add new
  17315. features to Imake, you need to provide your own project template,
  17316. and duplicate most of the features of the existing one. This
  17317. means that for a sophisticated project, using the vendor-provided
  17318. Imake templates fails to provide any leverage--since they don't
  17319. cover anything that your own project needs (unless it is an X11
  17320. program).
  17321. On the other side, though:
  17322. The one advantage that Imake has over `configure': `Imakefile'
  17323. files tend to be much shorter (likewise, less redundant) than
  17324. `Makefile.in' files. There is a fix to this, however--at least
  17325. for the Kerberos V5 tree, we've modified things to call in common
  17326. `post.in' and `pre.in' makefile fragments for the entire tree.
  17327. This means that a lot of common things don't have to be
  17328. duplicated, even though they normally are in `configure' setups.
  17329. 
  17330. File: autoconf.info, Node: Defining Directories, Next: Autom4te Cache, Prev: Why Not Imake, Up: FAQ
  17331. 20.5 How Do I `#define' Installation Directories?
  17332. =================================================
  17333. My program needs library files, installed in `datadir' and
  17334. similar. If I use
  17335. AC_DEFINE_UNQUOTED([DATADIR], [$datadir],
  17336. [Define to the read-only architecture-independent
  17337. data directory.])
  17338. I get
  17339. #define DATADIR "${prefix}/share"
  17340. As already explained, this behavior is on purpose, mandated by the GNU
  17341. Coding Standards, see *note Installation Directory Variables::. There
  17342. are several means to achieve a similar goal:
  17343. - Do not use `AC_DEFINE' but use your makefile to pass the actual
  17344. value of `datadir' via compilation flags. *Note Installation
  17345. Directory Variables::, for the details.
  17346. - This solution can be simplified when compiling a program: you may
  17347. either extend the `CPPFLAGS':
  17348. CPPFLAGS = -DDATADIR='"$(datadir)"' @CPPFLAGS@
  17349. If you are using Automake, you should use `AM_CPPFLAGS' instead:
  17350. AM_CPPFLAGS = -DDATADIR='"$(datadir)"'
  17351. Alternatively, create a dedicated header file:
  17352. DISTCLEANFILES = myprog-paths.h
  17353. myprog-paths.h: Makefile
  17354. echo '#define DATADIR "$(datadir)"' >$@
  17355. The gnulib module `configmake' provides such a header with all the
  17356. standard directory variables defined, *note configmake:
  17357. (gnulib)configmake.
  17358. - Use `AC_DEFINE' but have `configure' compute the literal value of
  17359. `datadir' and others. Many people have wrapped macros to automate
  17360. this task; for an example, see the macro `AC_DEFINE_DIR' from the
  17361. Autoconf Macro Archive
  17362. (http://www.gnu.org/software/autoconf-archive/).
  17363. This solution does not conform to the GNU Coding Standards.
  17364. - Note that all the previous solutions hard wire the absolute name of
  17365. these directories in the executables, which is not a good
  17366. property. You may try to compute the names relative to `prefix',
  17367. and try to find `prefix' at runtime, this way your package is
  17368. relocatable.
  17369. 
  17370. File: autoconf.info, Node: Autom4te Cache, Next: Present But Cannot Be Compiled, Prev: Defining Directories, Up: FAQ
  17371. 20.6 What is `autom4te.cache'?
  17372. ==============================
  17373. What is this directory `autom4te.cache'? Can I safely remove it?
  17374. In the GNU Build System, `configure.ac' plays a central role and is
  17375. read by many tools: `autoconf' to create `configure', `autoheader' to
  17376. create `config.h.in', `automake' to create `Makefile.in', `autoscan' to
  17377. check the completeness of `configure.ac', `autoreconf' to check the GNU
  17378. Build System components that are used. To "read `configure.ac'"
  17379. actually means to compile it with M4, which can be a long process for
  17380. complex `configure.ac'.
  17381. This is why all these tools, instead of running directly M4, invoke
  17382. `autom4te' (*note autom4te Invocation::) which, while answering to a
  17383. specific demand, stores additional information in `autom4te.cache' for
  17384. future runs. For instance, if you run `autoconf', behind the scenes,
  17385. `autom4te' also stores information for the other tools, so that when
  17386. you invoke `autoheader' or `automake' etc., reprocessing `configure.ac'
  17387. is not needed. The speed up is frequently 30%, and is increasing with
  17388. the size of `configure.ac'.
  17389. But it is and remains being simply a cache: you can safely remove it.
  17390. Can I permanently get rid of it?
  17391. The creation of this cache can be disabled from `~/.autom4te.cfg',
  17392. see *note Customizing autom4te::, for more details. You should be
  17393. aware that disabling the cache slows down the Autoconf test suite by
  17394. 40%. The more GNU Build System components are used, the more the cache
  17395. is useful; for instance running `autoreconf -f' on the Core Utilities
  17396. is twice slower without the cache _although `--force' implies that the
  17397. cache is not fully exploited_, and eight times slower than without
  17398. `--force'.
  17399. 
  17400. File: autoconf.info, Node: Present But Cannot Be Compiled, Next: Expanded Before Required, Prev: Autom4te Cache, Up: FAQ
  17401. 20.7 Header Present But Cannot Be Compiled
  17402. ==========================================
  17403. The most important guideline to bear in mind when checking for features
  17404. is to mimic as much as possible the intended use. Unfortunately, old
  17405. versions of `AC_CHECK_HEADER' and `AC_CHECK_HEADERS' failed to follow
  17406. this idea, and called the preprocessor, instead of the compiler, to
  17407. check for headers. As a result, incompatibilities between headers went
  17408. unnoticed during configuration, and maintainers finally had to deal
  17409. with this issue elsewhere.
  17410. The transition began with Autoconf 2.56. As of Autoconf 2.64 both
  17411. checks are performed, and `configure' complains loudly if the compiler
  17412. and the preprocessor do not agree. However, only the compiler result
  17413. is considered.
  17414. Consider the following example:
  17415. $ cat number.h
  17416. typedef int number;
  17417. $ cat pi.h
  17418. const number pi = 3;
  17419. $ cat configure.ac
  17420. AC_INIT([Example], [1.0], [bug-example@example.org])
  17421. AC_CHECK_HEADERS([pi.h])
  17422. $ autoconf -Wall
  17423. $ ./configure
  17424. checking for gcc... gcc
  17425. checking for C compiler default output file name... a.out
  17426. checking whether the C compiler works... yes
  17427. checking whether we are cross compiling... no
  17428. checking for suffix of executables...
  17429. checking for suffix of object files... o
  17430. checking whether we are using the GNU C compiler... yes
  17431. checking whether gcc accepts -g... yes
  17432. checking for gcc option to accept ISO C89... none needed
  17433. checking how to run the C preprocessor... gcc -E
  17434. checking for grep that handles long lines and -e... grep
  17435. checking for egrep... grep -E
  17436. checking for ANSI C header files... yes
  17437. checking for sys/types.h... yes
  17438. checking for sys/stat.h... yes
  17439. checking for stdlib.h... yes
  17440. checking for string.h... yes
  17441. checking for memory.h... yes
  17442. checking for strings.h... yes
  17443. checking for inttypes.h... yes
  17444. checking for stdint.h... yes
  17445. checking for unistd.h... yes
  17446. checking pi.h usability... no
  17447. checking pi.h presence... yes
  17448. configure: WARNING: pi.h: present but cannot be compiled
  17449. configure: WARNING: pi.h: check for missing prerequisite headers?
  17450. configure: WARNING: pi.h: see the Autoconf documentation
  17451. configure: WARNING: pi.h: section "Present But Cannot Be Compiled"
  17452. configure: WARNING: pi.h: proceeding with the compiler's result
  17453. configure: WARNING: ## -------------------------------------- ##
  17454. configure: WARNING: ## Report this to bug-example@example.org ##
  17455. configure: WARNING: ## -------------------------------------- ##
  17456. checking for pi.h... yes
  17457. The proper way the handle this case is using the fourth argument (*note
  17458. Generic Headers::):
  17459. $ cat configure.ac
  17460. AC_INIT([Example], [1.0], [bug-example@example.org])
  17461. AC_CHECK_HEADERS([number.h pi.h], [], [],
  17462. [[#ifdef HAVE_NUMBER_H
  17463. # include <number.h>
  17464. #endif
  17465. ]])
  17466. $ autoconf -Wall
  17467. $ ./configure
  17468. checking for gcc... gcc
  17469. checking for C compiler default output... a.out
  17470. checking whether the C compiler works... yes
  17471. checking whether we are cross compiling... no
  17472. checking for suffix of executables...
  17473. checking for suffix of object files... o
  17474. checking whether we are using the GNU C compiler... yes
  17475. checking whether gcc accepts -g... yes
  17476. checking for gcc option to accept ANSI C... none needed
  17477. checking for number.h... yes
  17478. checking for pi.h... yes
  17479. See *note Particular Headers::, for a list of headers with their
  17480. prerequisites.
  17481. 
  17482. File: autoconf.info, Node: Expanded Before Required, Next: Debugging, Prev: Present But Cannot Be Compiled, Up: FAQ
  17483. 20.8 Expanded Before Required
  17484. =============================
  17485. Older versions of Autoconf silently built files with incorrect ordering
  17486. between dependent macros if an outer macro first expanded, then later
  17487. indirectly required, an inner macro. Starting with Autoconf 2.64, this
  17488. situation no longer generates out-of-order code, but results in
  17489. duplicate output and a syntax warning:
  17490. $ cat configure.ac
  17491. =>AC_DEFUN([TESTA], [[echo in A
  17492. =>if test -n "$SEEN_A" ; then echo duplicate ; fi
  17493. =>SEEN_A=:]])
  17494. =>AC_DEFUN([TESTB], [AC_REQUIRE([TESTA])[echo in B
  17495. =>if test -z "$SEEN_A" ; then echo bug ; fi]])
  17496. =>AC_DEFUN([TESTC], [AC_REQUIRE([TESTB])[echo in C]])
  17497. =>AC_DEFUN([OUTER], [[echo in OUTER]
  17498. =>TESTA
  17499. =>TESTC])
  17500. =>AC_INIT
  17501. =>OUTER
  17502. =>AC_OUTPUT
  17503. $ autoconf
  17504. =>configure.ac:11: warning: AC_REQUIRE:
  17505. => `TESTA' was expanded before it was required
  17506. =>configure.ac:4: TESTB is expanded from...
  17507. =>configure.ac:6: TESTC is expanded from...
  17508. =>configure.ac:7: OUTER is expanded from...
  17509. =>configure.ac:11: the top level
  17510. To avoid this warning, decide what purpose the macro in question serves.
  17511. If it only needs to be expanded once (for example, if it provides
  17512. initialization text used by later macros), then the simplest fix is to
  17513. change the macro to be declared with `AC_DEFUN_ONCE' (*note One-Shot
  17514. Macros::), although this only works in Autoconf 2.64 and newer. A more
  17515. portable fix is to change all instances of direct calls to instead go
  17516. through `AC_REQUIRE' (*note Prerequisite Macros::). If, instead, the
  17517. macro is parameterized by arguments or by the current definition of
  17518. other macros in the m4 environment, then the macro should always be
  17519. directly expanded instead of required.
  17520. For another case study, consider this example trimmed down from an
  17521. actual package. Originally, the package contained shell code and
  17522. multiple macro invocations at the top level of `configure.ac':
  17523. AC_DEFUN([FOO], [AC_COMPILE_IFELSE([...])])
  17524. foobar=
  17525. AC_PROG_CC
  17526. FOO
  17527. but that was getting complex, so the author wanted to offload some of
  17528. the text into a new macro in another file included via `aclocal.m4'.
  17529. The nai"ve approach merely wraps the text in a new macro:
  17530. AC_DEFUN([FOO], [AC_COMPILE_IFELSE([...])])
  17531. AC_DEFUN([BAR], [
  17532. foobar=
  17533. AC_PROG_CC
  17534. FOO
  17535. ])
  17536. BAR
  17537. With older versions of Autoconf, the setting of `foobar=' occurs before
  17538. the single compiler check, as the author intended. But with Autoconf
  17539. 2.64, this issues the "expanded before it was required" warning for
  17540. `AC_PROG_CC', and outputs two copies of the compiler check, one before
  17541. `foobar=', and one after. To understand why this is happening,
  17542. remember that the use of `AC_COMPILE_IFELSE' includes a call to
  17543. `AC_REQUIRE([AC_PROG_CC])' under the hood. According to the documented
  17544. semantics of `AC_REQUIRE', this means that `AC_PROG_CC' _must_ occur
  17545. before the body of the outermost `AC_DEFUN', which in this case is
  17546. `BAR', thus preceding the use of `foobar='. The older versions of
  17547. Autoconf were broken with regards to the rules of `AC_REQUIRE', which
  17548. explains why the code changed from one over to two copies of
  17549. `AC_PROG_CC' when upgrading autoconf. In other words, the author was
  17550. unknowingly relying on a bug exploit to get the desired results, and
  17551. that exploit broke once the bug was fixed.
  17552. So, what recourse does the author have, to restore their intended
  17553. semantics of setting `foobar=' prior to a single compiler check,
  17554. regardless of whether Autoconf 2.63 or 2.64 is used? One idea is to
  17555. remember that only `AC_DEFUN' is impacted by `AC_REQUIRE'; there is
  17556. always the possibility of using the lower-level `m4_define':
  17557. AC_DEFUN([FOO], [AC_COMPILE_IFELSE([...])])
  17558. m4_define([BAR], [
  17559. foobar=
  17560. AC_PROG_CC
  17561. FOO
  17562. ])
  17563. BAR
  17564. This works great if everything is in the same file. However, it does
  17565. not help in the case where the author wants to have `aclocal' find the
  17566. definition of `BAR' from its own file, since `aclocal' requires the use
  17567. of `AC_DEFUN'. In this case, a better fix is to recognize that if
  17568. `BAR' also uses `AC_REQUIRE', then there will no longer be direct
  17569. expansion prior to a subsequent require. Then, by creating yet another
  17570. helper macro, the author can once again guarantee a single invocation of
  17571. `AC_PROG_CC', which will still occur after `foobar='. The author can
  17572. also use `AC_BEFORE' to make sure no other macro appearing before `BAR'
  17573. has triggered an unwanted expansion of `AC_PROG_CC'.
  17574. AC_DEFUN([FOO], [AC_COMPILE_IFELSE([...])])
  17575. AC_DEFUN([BEFORE_CC], [
  17576. foobar=
  17577. ])
  17578. AC_DEFUN([BAR], [
  17579. AC_BEFORE([$0], [AC_PROG_CC])dnl
  17580. AC_REQUIRE([BEFORE_CC])dnl
  17581. AC_REQUIRE([AC_PROG_CC])dnl
  17582. FOO
  17583. ])
  17584. BAR
  17585. 
  17586. File: autoconf.info, Node: Debugging, Prev: Expanded Before Required, Up: FAQ
  17587. 20.9 Debugging `configure' scripts
  17588. ==================================
  17589. While in general, `configure' scripts generated by Autoconf strive to
  17590. be fairly portable to various systems, compilers, shells, and other
  17591. tools, it may still be necessary to debug a failing test, broken script
  17592. or makefile, or fix or override an incomplete, faulty, or erroneous
  17593. test, especially during macro development. Failures can occur at all
  17594. levels, in M4 syntax or semantics, shell script issues, or due to bugs
  17595. in the test or the tools invoked by `configure'. Together with the
  17596. rather arcane error message that `m4' and `make' may produce when their
  17597. input contains syntax errors, this can make debugging rather painful.
  17598. Nevertheless, here is a list of hints and strategies that may help:
  17599. * When `autoconf' fails, common causes for error include:
  17600. * mismatched or unbalanced parentheses or braces (*note
  17601. Balancing Parentheses::),
  17602. * under- or overquoted macro arguments (*note Autoconf
  17603. Language::, *note Quoting and Parameters::, *note Quotation
  17604. and Nested Macros::),
  17605. * spaces between macro name and opening parenthesis (*note
  17606. Autoconf Language::).
  17607. Typically, it helps to go back to the last working version of the
  17608. input and compare the differences for each of these errors.
  17609. Another possibility is to sprinkle pairs of `m4_traceon' and
  17610. `m4_traceoff' judiciously in the code, either without a parameter
  17611. or listing some macro names and watch `m4' expand its input
  17612. verbosely (*note Debugging via autom4te::).
  17613. * Sometimes `autoconf' succeeds but the generated `configure' script
  17614. has invalid shell syntax. You can detect this case by running
  17615. `bash -n configure' or `sh -n configure'. If this command fails,
  17616. the same tips apply, as if `autoconf' had failed.
  17617. * Debugging `configure' script execution may be done by sprinkling
  17618. pairs of `set -x' and `set +x' into the shell script before and
  17619. after the region that contains a bug. Running the whole script
  17620. with `SHELL -vx ./configure 2>&1 | tee LOG-FILE' with a decent
  17621. SHELL may work, but produces lots of output. Here, it can help to
  17622. search for markers like `checking for' a particular test in the
  17623. LOG-FILE.
  17624. * Alternatively, you might use a shell with debugging capabilities
  17625. like bashdb (http://bashdb.sourceforge.net/).
  17626. * When `configure' tests produce invalid results for your system, it
  17627. may be necessary to override them:
  17628. * For programs, tools or libraries variables, preprocessor,
  17629. compiler, or linker flags, it is often sufficient to override
  17630. them at `make' run time with some care (*note Macros and
  17631. Submakes::). Since this normally won't cause `configure' to
  17632. be run again with these changed settings, it may fail if the
  17633. changed variable would have caused different test results
  17634. from `configure', so this may work only for simple
  17635. differences.
  17636. * Most tests which produce their result in a substituted
  17637. variable allow to override the test by setting the variable
  17638. on the `configure' command line (*note Compilers and
  17639. Options::, *note Defining Variables::, *note Particular
  17640. Systems::).
  17641. * Many tests store their result in a cache variable (*note
  17642. Caching Results::). This lets you override them either on the
  17643. `configure' command line as above, or through a primed cache
  17644. or site file (*note Cache Files::, *note Site Defaults::).
  17645. The name of a cache variable is documented with a test macro
  17646. or may be inferred from *note Cache Variable Names::; the
  17647. precise semantics of undocumented variables are often
  17648. internal details, subject to change.
  17649. * Alternatively, `configure' may produce invalid results because of
  17650. uncaught programming errors, in your package or in an upstream
  17651. library package. For example, when `AC_CHECK_LIB' fails to find a
  17652. library with a specified function, always check `config.log'. This
  17653. will reveal the exact error that produced the failing result: the
  17654. library linked by `AC_CHECK_LIB' probably has a fatal bug.
  17655. Conversely, as macro author, you can make it easier for users of your
  17656. macro:
  17657. * by minimizing dependencies between tests and between test results
  17658. as far as possible,
  17659. * by using `make' variables to factorize and allow override of
  17660. settings at `make' run time,
  17661. * by honoring the GNU Coding Standards and not overriding flags
  17662. reserved for the user except temporarily during `configure' tests,
  17663. * by not requiring users of your macro to use the cache variables.
  17664. Instead, expose the result of the test via RUN-IF-TRUE and
  17665. RUN-IF-FALSE parameters. If the result is not a boolean, then
  17666. provide it through documented shell variables.
  17667. 
  17668. File: autoconf.info, Node: History, Next: GNU Free Documentation License, Prev: FAQ, Up: Top
  17669. 21 History of Autoconf
  17670. **********************
  17671. _This chapter was written by the original author, David MacKenzie._
  17672. You may be wondering, Why was Autoconf originally written? How did
  17673. it get into its present form? (Why does it look like gorilla spit?) If
  17674. you're not wondering, then this chapter contains no information useful
  17675. to you, and you might as well skip it. If you _are_ wondering, then
  17676. let there be light...
  17677. * Menu:
  17678. * Genesis:: Prehistory and naming of `configure'
  17679. * Exodus:: The plagues of M4 and Perl
  17680. * Leviticus:: The priestly code of portability arrives
  17681. * Numbers:: Growth and contributors
  17682. * Deuteronomy:: Approaching the promises of easy configuration
  17683. 
  17684. File: autoconf.info, Node: Genesis, Next: Exodus, Up: History
  17685. 21.1 Genesis
  17686. ============
  17687. In June 1991 I was maintaining many of the GNU utilities for the Free
  17688. Software Foundation. As they were ported to more platforms and more
  17689. programs were added, the number of `-D' options that users had to
  17690. select in the makefile (around 20) became burdensome. Especially for
  17691. me--I had to test each new release on a bunch of different systems. So
  17692. I wrote a little shell script to guess some of the correct settings for
  17693. the fileutils package, and released it as part of fileutils 2.0. That
  17694. `configure' script worked well enough that the next month I adapted it
  17695. (by hand) to create similar `configure' scripts for several other GNU
  17696. utilities packages. Brian Berliner also adapted one of my scripts for
  17697. his CVS revision control system.
  17698. Later that summer, I learned that Richard Stallman and Richard Pixley
  17699. were developing similar scripts to use in the GNU compiler tools; so I
  17700. adapted my `configure' scripts to support their evolving interface:
  17701. using the file name `Makefile.in' as the templates; adding `+srcdir',
  17702. the first option (of many); and creating `config.status' files.
  17703. 
  17704. File: autoconf.info, Node: Exodus, Next: Leviticus, Prev: Genesis, Up: History
  17705. 21.2 Exodus
  17706. ===========
  17707. As I got feedback from users, I incorporated many improvements, using
  17708. Emacs to search and replace, cut and paste, similar changes in each of
  17709. the scripts. As I adapted more GNU utilities packages to use
  17710. `configure' scripts, updating them all by hand became impractical.
  17711. Rich Murphey, the maintainer of the GNU graphics utilities, sent me
  17712. mail saying that the `configure' scripts were great, and asking if I
  17713. had a tool for generating them that I could send him. No, I thought,
  17714. but I should! So I started to work out how to generate them. And the
  17715. journey from the slavery of hand-written `configure' scripts to the
  17716. abundance and ease of Autoconf began.
  17717. Cygnus `configure', which was being developed at around that time,
  17718. is table driven; it is meant to deal mainly with a discrete number of
  17719. system types with a small number of mainly unguessable features (such as
  17720. details of the object file format). The automatic configuration system
  17721. that Brian Fox had developed for Bash takes a similar approach. For
  17722. general use, it seems to me a hopeless cause to try to maintain an
  17723. up-to-date database of which features each variant of each operating
  17724. system has. It's easier and more reliable to check for most features on
  17725. the fly--especially on hybrid systems that people have hacked on
  17726. locally or that have patches from vendors installed.
  17727. I considered using an architecture similar to that of Cygnus
  17728. `configure', where there is a single `configure' script that reads
  17729. pieces of `configure.in' when run. But I didn't want to have to
  17730. distribute all of the feature tests with every package, so I settled on
  17731. having a different `configure' made from each `configure.in' by a
  17732. preprocessor. That approach also offered more control and flexibility.
  17733. I looked briefly into using the Metaconfig package, by Larry Wall,
  17734. Harlan Stenn, and Raphael Manfredi, but I decided not to for several
  17735. reasons. The `Configure' scripts it produces are interactive, which I
  17736. find quite inconvenient; I didn't like the ways it checked for some
  17737. features (such as library functions); I didn't know that it was still
  17738. being maintained, and the `Configure' scripts I had seen didn't work on
  17739. many modern systems (such as System V R4 and NeXT); it wasn't flexible
  17740. in what it could do in response to a feature's presence or absence; I
  17741. found it confusing to learn; and it was too big and complex for my
  17742. needs (I didn't realize then how much Autoconf would eventually have to
  17743. grow).
  17744. I considered using Perl to generate my style of `configure' scripts,
  17745. but decided that M4 was better suited to the job of simple textual
  17746. substitutions: it gets in the way less, because output is implicit.
  17747. Plus, everyone already has it. (Initially I didn't rely on the GNU
  17748. extensions to M4.) Also, some of my friends at the University of
  17749. Maryland had recently been putting M4 front ends on several programs,
  17750. including `tvtwm', and I was interested in trying out a new language.
  17751. 
  17752. File: autoconf.info, Node: Leviticus, Next: Numbers, Prev: Exodus, Up: History
  17753. 21.3 Leviticus
  17754. ==============
  17755. Since my `configure' scripts determine the system's capabilities
  17756. automatically, with no interactive user intervention, I decided to call
  17757. the program that generates them Autoconfig. But with a version number
  17758. tacked on, that name would be too long for old Unix file systems, so I
  17759. shortened it to Autoconf.
  17760. In the fall of 1991 I called together a group of fellow questers
  17761. after the Holy Grail of portability (er, that is, alpha testers) to
  17762. give me feedback as I encapsulated pieces of my handwritten scripts in
  17763. M4 macros and continued to add features and improve the techniques used
  17764. in the checks. Prominent among the testers were Franc,ois Pinard, who
  17765. came up with the idea of making an Autoconf shell script to run M4 and
  17766. check for unresolved macro calls; Richard Pixley, who suggested running
  17767. the compiler instead of searching the file system to find include files
  17768. and symbols, for more accurate results; Karl Berry, who got Autoconf to
  17769. configure TeX and added the macro index to the documentation; and Ian
  17770. Lance Taylor, who added support for creating a C header file as an
  17771. alternative to putting `-D' options in a makefile, so he could use
  17772. Autoconf for his UUCP package. The alpha testers cheerfully adjusted
  17773. their files again and again as the names and calling conventions of the
  17774. Autoconf macros changed from release to release. They all contributed
  17775. many specific checks, great ideas, and bug fixes.
  17776. 
  17777. File: autoconf.info, Node: Numbers, Next: Deuteronomy, Prev: Leviticus, Up: History
  17778. 21.4 Numbers
  17779. ============
  17780. In July 1992, after months of alpha testing, I released Autoconf 1.0,
  17781. and converted many GNU packages to use it. I was surprised by how
  17782. positive the reaction to it was. More people started using it than I
  17783. could keep track of, including people working on software that wasn't
  17784. part of the GNU Project (such as TCL, FSP, and Kerberos V5). Autoconf
  17785. continued to improve rapidly, as many people using the `configure'
  17786. scripts reported problems they encountered.
  17787. Autoconf turned out to be a good torture test for M4 implementations.
  17788. Unix M4 started to dump core because of the length of the macros that
  17789. Autoconf defined, and several bugs showed up in GNU M4 as well.
  17790. Eventually, we realized that we needed to use some features that only
  17791. GNU M4 has. 4.3BSD M4, in particular, has an impoverished set of
  17792. builtin macros; the System V version is better, but still doesn't
  17793. provide everything we need.
  17794. More development occurred as people put Autoconf under more stresses
  17795. (and to uses I hadn't anticipated). Karl Berry added checks for X11.
  17796. david zuhn contributed C++ support. Franc,ois Pinard made it diagnose
  17797. invalid arguments. Jim Blandy bravely coerced it into configuring GNU
  17798. Emacs, laying the groundwork for several later improvements. Roland
  17799. McGrath got it to configure the GNU C Library, wrote the `autoheader'
  17800. script to automate the creation of C header file templates, and added a
  17801. `--verbose' option to `configure'. Noah Friedman added the
  17802. `--autoconf-dir' option and `AC_MACRODIR' environment variable. (He
  17803. also coined the term "autoconfiscate" to mean "adapt a software package
  17804. to use Autoconf".) Roland and Noah improved the quoting protection in
  17805. `AC_DEFINE' and fixed many bugs, especially when I got sick of dealing
  17806. with portability problems from February through June, 1993.
  17807. 
  17808. File: autoconf.info, Node: Deuteronomy, Prev: Numbers, Up: History
  17809. 21.5 Deuteronomy
  17810. ================
  17811. A long wish list for major features had accumulated, and the effect of
  17812. several years of patching by various people had left some residual
  17813. cruft. In April 1994, while working for Cygnus Support, I began a major
  17814. revision of Autoconf. I added most of the features of the Cygnus
  17815. `configure' that Autoconf had lacked, largely by adapting the relevant
  17816. parts of Cygnus `configure' with the help of david zuhn and Ken
  17817. Raeburn. These features include support for using `config.sub',
  17818. `config.guess', `--host', and `--target'; making links to files; and
  17819. running `configure' scripts in subdirectories. Adding these features
  17820. enabled Ken to convert GNU `as', and Rob Savoye to convert DejaGNU, to
  17821. using Autoconf.
  17822. I added more features in response to other peoples' requests. Many
  17823. people had asked for `configure' scripts to share the results of the
  17824. checks between runs, because (particularly when configuring a large
  17825. source tree, like Cygnus does) they were frustratingly slow. Mike
  17826. Haertel suggested adding site-specific initialization scripts. People
  17827. distributing software that had to unpack on MS-DOS asked for a way to
  17828. override the `.in' extension on the file names, which produced file
  17829. names like `config.h.in' containing two dots. Jim Avera did an
  17830. extensive examination of the problems with quoting in `AC_DEFINE' and
  17831. `AC_SUBST'; his insights led to significant improvements. Richard
  17832. Stallman asked that compiler output be sent to `config.log' instead of
  17833. `/dev/null', to help people debug the Emacs `configure' script.
  17834. I made some other changes because of my dissatisfaction with the
  17835. quality of the program. I made the messages showing results of the
  17836. checks less ambiguous, always printing a result. I regularized the
  17837. names of the macros and cleaned up coding style inconsistencies. I
  17838. added some auxiliary utilities that I had developed to help convert
  17839. source code packages to use Autoconf. With the help of Franc,ois
  17840. Pinard, I made the macros not interrupt each others' messages. (That
  17841. feature revealed some performance bottlenecks in GNU M4, which he
  17842. hastily corrected!) I reorganized the documentation around problems
  17843. people want to solve. And I began a test suite, because experience had
  17844. shown that Autoconf has a pronounced tendency to regress when we change
  17845. it.
  17846. Again, several alpha testers gave invaluable feedback, especially
  17847. Franc,ois Pinard, Jim Meyering, Karl Berry, Rob Savoye, Ken Raeburn,
  17848. and Mark Eichin.
  17849. Finally, version 2.0 was ready. And there was much rejoicing. (And
  17850. I have free time again. I think. Yeah, right.)
  17851. 
  17852. File: autoconf.info, Node: GNU Free Documentation License, Next: Indices, Prev: History, Up: Top
  17853. Appendix A GNU Free Documentation License
  17854. *****************************************
  17855. Version 1.3, 3 November 2008
  17856. Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
  17857. `http://fsf.org/'
  17858. Everyone is permitted to copy and distribute verbatim copies
  17859. of this license document, but changing it is not allowed.
  17860. 0. PREAMBLE
  17861. The purpose of this License is to make a manual, textbook, or other
  17862. functional and useful document "free" in the sense of freedom: to
  17863. assure everyone the effective freedom to copy and redistribute it,
  17864. with or without modifying it, either commercially or
  17865. noncommercially. Secondarily, this License preserves for the
  17866. author and publisher a way to get credit for their work, while not
  17867. being considered responsible for modifications made by others.
  17868. This License is a kind of "copyleft", which means that derivative
  17869. works of the document must themselves be free in the same sense.
  17870. It complements the GNU General Public License, which is a copyleft
  17871. license designed for free software.
  17872. We have designed this License in order to use it for manuals for
  17873. free software, because free software needs free documentation: a
  17874. free program should come with manuals providing the same freedoms
  17875. that the software does. But this License is not limited to
  17876. software manuals; it can be used for any textual work, regardless
  17877. of subject matter or whether it is published as a printed book.
  17878. We recommend this License principally for works whose purpose is
  17879. instruction or reference.
  17880. 1. APPLICABILITY AND DEFINITIONS
  17881. This License applies to any manual or other work, in any medium,
  17882. that contains a notice placed by the copyright holder saying it
  17883. can be distributed under the terms of this License. Such a notice
  17884. grants a world-wide, royalty-free license, unlimited in duration,
  17885. to use that work under the conditions stated herein. The
  17886. "Document", below, refers to any such manual or work. Any member
  17887. of the public is a licensee, and is addressed as "you". You
  17888. accept the license if you copy, modify or distribute the work in a
  17889. way requiring permission under copyright law.
  17890. A "Modified Version" of the Document means any work containing the
  17891. Document or a portion of it, either copied verbatim, or with
  17892. modifications and/or translated into another language.
  17893. A "Secondary Section" is a named appendix or a front-matter section
  17894. of the Document that deals exclusively with the relationship of the
  17895. publishers or authors of the Document to the Document's overall
  17896. subject (or to related matters) and contains nothing that could
  17897. fall directly within that overall subject. (Thus, if the Document
  17898. is in part a textbook of mathematics, a Secondary Section may not
  17899. explain any mathematics.) The relationship could be a matter of
  17900. historical connection with the subject or with related matters, or
  17901. of legal, commercial, philosophical, ethical or political position
  17902. regarding them.
  17903. The "Invariant Sections" are certain Secondary Sections whose
  17904. titles are designated, as being those of Invariant Sections, in
  17905. the notice that says that the Document is released under this
  17906. License. If a section does not fit the above definition of
  17907. Secondary then it is not allowed to be designated as Invariant.
  17908. The Document may contain zero Invariant Sections. If the Document
  17909. does not identify any Invariant Sections then there are none.
  17910. The "Cover Texts" are certain short passages of text that are
  17911. listed, as Front-Cover Texts or Back-Cover Texts, in the notice
  17912. that says that the Document is released under this License. A
  17913. Front-Cover Text may be at most 5 words, and a Back-Cover Text may
  17914. be at most 25 words.
  17915. A "Transparent" copy of the Document means a machine-readable copy,
  17916. represented in a format whose specification is available to the
  17917. general public, that is suitable for revising the document
  17918. straightforwardly with generic text editors or (for images
  17919. composed of pixels) generic paint programs or (for drawings) some
  17920. widely available drawing editor, and that is suitable for input to
  17921. text formatters or for automatic translation to a variety of
  17922. formats suitable for input to text formatters. A copy made in an
  17923. otherwise Transparent file format whose markup, or absence of
  17924. markup, has been arranged to thwart or discourage subsequent
  17925. modification by readers is not Transparent. An image format is
  17926. not Transparent if used for any substantial amount of text. A
  17927. copy that is not "Transparent" is called "Opaque".
  17928. Examples of suitable formats for Transparent copies include plain
  17929. ASCII without markup, Texinfo input format, LaTeX input format,
  17930. SGML or XML using a publicly available DTD, and
  17931. standard-conforming simple HTML, PostScript or PDF designed for
  17932. human modification. Examples of transparent image formats include
  17933. PNG, XCF and JPG. Opaque formats include proprietary formats that
  17934. can be read and edited only by proprietary word processors, SGML or
  17935. XML for which the DTD and/or processing tools are not generally
  17936. available, and the machine-generated HTML, PostScript or PDF
  17937. produced by some word processors for output purposes only.
  17938. The "Title Page" means, for a printed book, the title page itself,
  17939. plus such following pages as are needed to hold, legibly, the
  17940. material this License requires to appear in the title page. For
  17941. works in formats which do not have any title page as such, "Title
  17942. Page" means the text near the most prominent appearance of the
  17943. work's title, preceding the beginning of the body of the text.
  17944. The "publisher" means any person or entity that distributes copies
  17945. of the Document to the public.
  17946. A section "Entitled XYZ" means a named subunit of the Document
  17947. whose title either is precisely XYZ or contains XYZ in parentheses
  17948. following text that translates XYZ in another language. (Here XYZ
  17949. stands for a specific section name mentioned below, such as
  17950. "Acknowledgements", "Dedications", "Endorsements", or "History".)
  17951. To "Preserve the Title" of such a section when you modify the
  17952. Document means that it remains a section "Entitled XYZ" according
  17953. to this definition.
  17954. The Document may include Warranty Disclaimers next to the notice
  17955. which states that this License applies to the Document. These
  17956. Warranty Disclaimers are considered to be included by reference in
  17957. this License, but only as regards disclaiming warranties: any other
  17958. implication that these Warranty Disclaimers may have is void and
  17959. has no effect on the meaning of this License.
  17960. 2. VERBATIM COPYING
  17961. You may copy and distribute the Document in any medium, either
  17962. commercially or noncommercially, provided that this License, the
  17963. copyright notices, and the license notice saying this License
  17964. applies to the Document are reproduced in all copies, and that you
  17965. add no other conditions whatsoever to those of this License. You
  17966. may not use technical measures to obstruct or control the reading
  17967. or further copying of the copies you make or distribute. However,
  17968. you may accept compensation in exchange for copies. If you
  17969. distribute a large enough number of copies you must also follow
  17970. the conditions in section 3.
  17971. You may also lend copies, under the same conditions stated above,
  17972. and you may publicly display copies.
  17973. 3. COPYING IN QUANTITY
  17974. If you publish printed copies (or copies in media that commonly
  17975. have printed covers) of the Document, numbering more than 100, and
  17976. the Document's license notice requires Cover Texts, you must
  17977. enclose the copies in covers that carry, clearly and legibly, all
  17978. these Cover Texts: Front-Cover Texts on the front cover, and
  17979. Back-Cover Texts on the back cover. Both covers must also clearly
  17980. and legibly identify you as the publisher of these copies. The
  17981. front cover must present the full title with all words of the
  17982. title equally prominent and visible. You may add other material
  17983. on the covers in addition. Copying with changes limited to the
  17984. covers, as long as they preserve the title of the Document and
  17985. satisfy these conditions, can be treated as verbatim copying in
  17986. other respects.
  17987. If the required texts for either cover are too voluminous to fit
  17988. legibly, you should put the first ones listed (as many as fit
  17989. reasonably) on the actual cover, and continue the rest onto
  17990. adjacent pages.
  17991. If you publish or distribute Opaque copies of the Document
  17992. numbering more than 100, you must either include a
  17993. machine-readable Transparent copy along with each Opaque copy, or
  17994. state in or with each Opaque copy a computer-network location from
  17995. which the general network-using public has access to download
  17996. using public-standard network protocols a complete Transparent
  17997. copy of the Document, free of added material. If you use the
  17998. latter option, you must take reasonably prudent steps, when you
  17999. begin distribution of Opaque copies in quantity, to ensure that
  18000. this Transparent copy will remain thus accessible at the stated
  18001. location until at least one year after the last time you
  18002. distribute an Opaque copy (directly or through your agents or
  18003. retailers) of that edition to the public.
  18004. It is requested, but not required, that you contact the authors of
  18005. the Document well before redistributing any large number of
  18006. copies, to give them a chance to provide you with an updated
  18007. version of the Document.
  18008. 4. MODIFICATIONS
  18009. You may copy and distribute a Modified Version of the Document
  18010. under the conditions of sections 2 and 3 above, provided that you
  18011. release the Modified Version under precisely this License, with
  18012. the Modified Version filling the role of the Document, thus
  18013. licensing distribution and modification of the Modified Version to
  18014. whoever possesses a copy of it. In addition, you must do these
  18015. things in the Modified Version:
  18016. A. Use in the Title Page (and on the covers, if any) a title
  18017. distinct from that of the Document, and from those of
  18018. previous versions (which should, if there were any, be listed
  18019. in the History section of the Document). You may use the
  18020. same title as a previous version if the original publisher of
  18021. that version gives permission.
  18022. B. List on the Title Page, as authors, one or more persons or
  18023. entities responsible for authorship of the modifications in
  18024. the Modified Version, together with at least five of the
  18025. principal authors of the Document (all of its principal
  18026. authors, if it has fewer than five), unless they release you
  18027. from this requirement.
  18028. C. State on the Title page the name of the publisher of the
  18029. Modified Version, as the publisher.
  18030. D. Preserve all the copyright notices of the Document.
  18031. E. Add an appropriate copyright notice for your modifications
  18032. adjacent to the other copyright notices.
  18033. F. Include, immediately after the copyright notices, a license
  18034. notice giving the public permission to use the Modified
  18035. Version under the terms of this License, in the form shown in
  18036. the Addendum below.
  18037. G. Preserve in that license notice the full lists of Invariant
  18038. Sections and required Cover Texts given in the Document's
  18039. license notice.
  18040. H. Include an unaltered copy of this License.
  18041. I. Preserve the section Entitled "History", Preserve its Title,
  18042. and add to it an item stating at least the title, year, new
  18043. authors, and publisher of the Modified Version as given on
  18044. the Title Page. If there is no section Entitled "History" in
  18045. the Document, create one stating the title, year, authors,
  18046. and publisher of the Document as given on its Title Page,
  18047. then add an item describing the Modified Version as stated in
  18048. the previous sentence.
  18049. J. Preserve the network location, if any, given in the Document
  18050. for public access to a Transparent copy of the Document, and
  18051. likewise the network locations given in the Document for
  18052. previous versions it was based on. These may be placed in
  18053. the "History" section. You may omit a network location for a
  18054. work that was published at least four years before the
  18055. Document itself, or if the original publisher of the version
  18056. it refers to gives permission.
  18057. K. For any section Entitled "Acknowledgements" or "Dedications",
  18058. Preserve the Title of the section, and preserve in the
  18059. section all the substance and tone of each of the contributor
  18060. acknowledgements and/or dedications given therein.
  18061. L. Preserve all the Invariant Sections of the Document,
  18062. unaltered in their text and in their titles. Section numbers
  18063. or the equivalent are not considered part of the section
  18064. titles.
  18065. M. Delete any section Entitled "Endorsements". Such a section
  18066. may not be included in the Modified Version.
  18067. N. Do not retitle any existing section to be Entitled
  18068. "Endorsements" or to conflict in title with any Invariant
  18069. Section.
  18070. O. Preserve any Warranty Disclaimers.
  18071. If the Modified Version includes new front-matter sections or
  18072. appendices that qualify as Secondary Sections and contain no
  18073. material copied from the Document, you may at your option
  18074. designate some or all of these sections as invariant. To do this,
  18075. add their titles to the list of Invariant Sections in the Modified
  18076. Version's license notice. These titles must be distinct from any
  18077. other section titles.
  18078. You may add a section Entitled "Endorsements", provided it contains
  18079. nothing but endorsements of your Modified Version by various
  18080. parties--for example, statements of peer review or that the text
  18081. has been approved by an organization as the authoritative
  18082. definition of a standard.
  18083. You may add a passage of up to five words as a Front-Cover Text,
  18084. and a passage of up to 25 words as a Back-Cover Text, to the end
  18085. of the list of Cover Texts in the Modified Version. Only one
  18086. passage of Front-Cover Text and one of Back-Cover Text may be
  18087. added by (or through arrangements made by) any one entity. If the
  18088. Document already includes a cover text for the same cover,
  18089. previously added by you or by arrangement made by the same entity
  18090. you are acting on behalf of, you may not add another; but you may
  18091. replace the old one, on explicit permission from the previous
  18092. publisher that added the old one.
  18093. The author(s) and publisher(s) of the Document do not by this
  18094. License give permission to use their names for publicity for or to
  18095. assert or imply endorsement of any Modified Version.
  18096. 5. COMBINING DOCUMENTS
  18097. You may combine the Document with other documents released under
  18098. this License, under the terms defined in section 4 above for
  18099. modified versions, provided that you include in the combination
  18100. all of the Invariant Sections of all of the original documents,
  18101. unmodified, and list them all as Invariant Sections of your
  18102. combined work in its license notice, and that you preserve all
  18103. their Warranty Disclaimers.
  18104. The combined work need only contain one copy of this License, and
  18105. multiple identical Invariant Sections may be replaced with a single
  18106. copy. If there are multiple Invariant Sections with the same name
  18107. but different contents, make the title of each such section unique
  18108. by adding at the end of it, in parentheses, the name of the
  18109. original author or publisher of that section if known, or else a
  18110. unique number. Make the same adjustment to the section titles in
  18111. the list of Invariant Sections in the license notice of the
  18112. combined work.
  18113. In the combination, you must combine any sections Entitled
  18114. "History" in the various original documents, forming one section
  18115. Entitled "History"; likewise combine any sections Entitled
  18116. "Acknowledgements", and any sections Entitled "Dedications". You
  18117. must delete all sections Entitled "Endorsements."
  18118. 6. COLLECTIONS OF DOCUMENTS
  18119. You may make a collection consisting of the Document and other
  18120. documents released under this License, and replace the individual
  18121. copies of this License in the various documents with a single copy
  18122. that is included in the collection, provided that you follow the
  18123. rules of this License for verbatim copying of each of the
  18124. documents in all other respects.
  18125. You may extract a single document from such a collection, and
  18126. distribute it individually under this License, provided you insert
  18127. a copy of this License into the extracted document, and follow
  18128. this License in all other respects regarding verbatim copying of
  18129. that document.
  18130. 7. AGGREGATION WITH INDEPENDENT WORKS
  18131. A compilation of the Document or its derivatives with other
  18132. separate and independent documents or works, in or on a volume of
  18133. a storage or distribution medium, is called an "aggregate" if the
  18134. copyright resulting from the compilation is not used to limit the
  18135. legal rights of the compilation's users beyond what the individual
  18136. works permit. When the Document is included in an aggregate, this
  18137. License does not apply to the other works in the aggregate which
  18138. are not themselves derivative works of the Document.
  18139. If the Cover Text requirement of section 3 is applicable to these
  18140. copies of the Document, then if the Document is less than one half
  18141. of the entire aggregate, the Document's Cover Texts may be placed
  18142. on covers that bracket the Document within the aggregate, or the
  18143. electronic equivalent of covers if the Document is in electronic
  18144. form. Otherwise they must appear on printed covers that bracket
  18145. the whole aggregate.
  18146. 8. TRANSLATION
  18147. Translation is considered a kind of modification, so you may
  18148. distribute translations of the Document under the terms of section
  18149. 4. Replacing Invariant Sections with translations requires special
  18150. permission from their copyright holders, but you may include
  18151. translations of some or all Invariant Sections in addition to the
  18152. original versions of these Invariant Sections. You may include a
  18153. translation of this License, and all the license notices in the
  18154. Document, and any Warranty Disclaimers, provided that you also
  18155. include the original English version of this License and the
  18156. original versions of those notices and disclaimers. In case of a
  18157. disagreement between the translation and the original version of
  18158. this License or a notice or disclaimer, the original version will
  18159. prevail.
  18160. If a section in the Document is Entitled "Acknowledgements",
  18161. "Dedications", or "History", the requirement (section 4) to
  18162. Preserve its Title (section 1) will typically require changing the
  18163. actual title.
  18164. 9. TERMINATION
  18165. You may not copy, modify, sublicense, or distribute the Document
  18166. except as expressly provided under this License. Any attempt
  18167. otherwise to copy, modify, sublicense, or distribute it is void,
  18168. and will automatically terminate your rights under this License.
  18169. However, if you cease all violation of this License, then your
  18170. license from a particular copyright holder is reinstated (a)
  18171. provisionally, unless and until the copyright holder explicitly
  18172. and finally terminates your license, and (b) permanently, if the
  18173. copyright holder fails to notify you of the violation by some
  18174. reasonable means prior to 60 days after the cessation.
  18175. Moreover, your license from a particular copyright holder is
  18176. reinstated permanently if the copyright holder notifies you of the
  18177. violation by some reasonable means, this is the first time you have
  18178. received notice of violation of this License (for any work) from
  18179. that copyright holder, and you cure the violation prior to 30 days
  18180. after your receipt of the notice.
  18181. Termination of your rights under this section does not terminate
  18182. the licenses of parties who have received copies or rights from
  18183. you under this License. If your rights have been terminated and
  18184. not permanently reinstated, receipt of a copy of some or all of
  18185. the same material does not give you any rights to use it.
  18186. 10. FUTURE REVISIONS OF THIS LICENSE
  18187. The Free Software Foundation may publish new, revised versions of
  18188. the GNU Free Documentation License from time to time. Such new
  18189. versions will be similar in spirit to the present version, but may
  18190. differ in detail to address new problems or concerns. See
  18191. `http://www.gnu.org/copyleft/'.
  18192. Each version of the License is given a distinguishing version
  18193. number. If the Document specifies that a particular numbered
  18194. version of this License "or any later version" applies to it, you
  18195. have the option of following the terms and conditions either of
  18196. that specified version or of any later version that has been
  18197. published (not as a draft) by the Free Software Foundation. If
  18198. the Document does not specify a version number of this License,
  18199. you may choose any version ever published (not as a draft) by the
  18200. Free Software Foundation. If the Document specifies that a proxy
  18201. can decide which future versions of this License can be used, that
  18202. proxy's public statement of acceptance of a version permanently
  18203. authorizes you to choose that version for the Document.
  18204. 11. RELICENSING
  18205. "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
  18206. World Wide Web server that publishes copyrightable works and also
  18207. provides prominent facilities for anybody to edit those works. A
  18208. public wiki that anybody can edit is an example of such a server.
  18209. A "Massive Multiauthor Collaboration" (or "MMC") contained in the
  18210. site means any set of copyrightable works thus published on the MMC
  18211. site.
  18212. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
  18213. license published by Creative Commons Corporation, a not-for-profit
  18214. corporation with a principal place of business in San Francisco,
  18215. California, as well as future copyleft versions of that license
  18216. published by that same organization.
  18217. "Incorporate" means to publish or republish a Document, in whole or
  18218. in part, as part of another Document.
  18219. An MMC is "eligible for relicensing" if it is licensed under this
  18220. License, and if all works that were first published under this
  18221. License somewhere other than this MMC, and subsequently
  18222. incorporated in whole or in part into the MMC, (1) had no cover
  18223. texts or invariant sections, and (2) were thus incorporated prior
  18224. to November 1, 2008.
  18225. The operator of an MMC Site may republish an MMC contained in the
  18226. site under CC-BY-SA on the same site at any time before August 1,
  18227. 2009, provided the MMC is eligible for relicensing.
  18228. ADDENDUM: How to use this License for your documents
  18229. ====================================================
  18230. To use this License in a document you have written, include a copy of
  18231. the License in the document and put the following copyright and license
  18232. notices just after the title page:
  18233. Copyright (C) YEAR YOUR NAME.
  18234. Permission is granted to copy, distribute and/or modify this document
  18235. under the terms of the GNU Free Documentation License, Version 1.3
  18236. or any later version published by the Free Software Foundation;
  18237. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  18238. Texts. A copy of the license is included in the section entitled ``GNU
  18239. Free Documentation License''.
  18240. If you have Invariant Sections, Front-Cover Texts and Back-Cover
  18241. Texts, replace the "with...Texts." line with this:
  18242. with the Invariant Sections being LIST THEIR TITLES, with
  18243. the Front-Cover Texts being LIST, and with the Back-Cover Texts
  18244. being LIST.
  18245. If you have Invariant Sections without Cover Texts, or some other
  18246. combination of the three, merge those two alternatives to suit the
  18247. situation.
  18248. If your document contains nontrivial examples of program code, we
  18249. recommend releasing these examples in parallel under your choice of
  18250. free software license, such as the GNU General Public License, to
  18251. permit their use in free software.
  18252. 
  18253. File: autoconf.info, Node: Indices, Prev: GNU Free Documentation License, Up: Top
  18254. Appendix B Indices
  18255. ******************
  18256. * Menu:
  18257. * Environment Variable Index:: Index of environment variables used
  18258. * Output Variable Index:: Index of variables set in output files
  18259. * Preprocessor Symbol Index:: Index of C preprocessor symbols defined
  18260. * Cache Variable Index:: Index of documented cache variables
  18261. * Autoconf Macro Index:: Index of Autoconf macros
  18262. * M4 Macro Index:: Index of M4, M4sugar, and M4sh macros
  18263. * Autotest Macro Index:: Index of Autotest macros
  18264. * Program & Function Index:: Index of those with portability problems
  18265. * Concept Index:: General index
  18266. 
  18267. File: autoconf.info, Node: Environment Variable Index, Next: Output Variable Index, Up: Indices
  18268. B.1 Environment Variable Index
  18269. ==============================
  18270. This is an alphabetical list of the environment variables that might
  18271. influence Autoconf checks.
  18272. �[index�]
  18273. * Menu:
  18274. * _: Special Shell Variables.
  18275. (line 36)
  18276. * BIN_SH: Special Shell Variables.
  18277. (line 40)
  18278. * CC: C Compiler. (line 61)
  18279. * CDPATH: Special Shell Variables.
  18280. (line 44)
  18281. * CFLAGS <1>: C Compiler. (line 61)
  18282. * CFLAGS: Preset Output Variables.
  18283. (line 23)
  18284. * CLICOLOR_FORCE: Special Shell Variables.
  18285. (line 67)
  18286. * CONFIG_COMMANDS: Obsolete config.status Use.
  18287. (line 11)
  18288. * CONFIG_FILES: Obsolete config.status Use.
  18289. (line 15)
  18290. * CONFIG_HEADERS: Obsolete config.status Use.
  18291. (line 20)
  18292. * CONFIG_LINKS: Obsolete config.status Use.
  18293. (line 25)
  18294. * CONFIG_SHELL: config.status Invocation.
  18295. (line 102)
  18296. * CONFIG_SITE: Site Defaults. (line 10)
  18297. * CONFIG_STATUS: config.status Invocation.
  18298. (line 108)
  18299. * CPP: C Compiler. (line 113)
  18300. * CPPFLAGS: Preset Output Variables.
  18301. (line 72)
  18302. * CXX: C++ Compiler. (line 7)
  18303. * CXXCPP: C++ Compiler. (line 35)
  18304. * CXXFLAGS <1>: C++ Compiler. (line 7)
  18305. * CXXFLAGS: Preset Output Variables.
  18306. (line 94)
  18307. * CYGWIN: Obsolete Macros. (line 124)
  18308. * DUALCASE: Special Shell Variables.
  18309. (line 74)
  18310. * ENV: Special Shell Variables.
  18311. (line 84)
  18312. * ERL: Erlang Compiler and Interpreter.
  18313. (line 29)
  18314. * ERLC: Erlang Compiler and Interpreter.
  18315. (line 10)
  18316. * ERLCFLAGS <1>: Erlang Compiler and Interpreter.
  18317. (line 10)
  18318. * ERLCFLAGS: Preset Output Variables.
  18319. (line 120)
  18320. * F77: Fortran Compiler. (line 19)
  18321. * FC: Fortran Compiler. (line 44)
  18322. * FCFLAGS <1>: Fortran Compiler. (line 44)
  18323. * FCFLAGS: Preset Output Variables.
  18324. (line 126)
  18325. * FFLAGS <1>: Fortran Compiler. (line 19)
  18326. * FFLAGS: Preset Output Variables.
  18327. (line 133)
  18328. * FPATH: Special Shell Variables.
  18329. (line 101)
  18330. * GOFLAGS: Preset Output Variables.
  18331. (line 170)
  18332. * GREP_OPTIONS: Special Shell Variables.
  18333. (line 108)
  18334. * IFS: Special Shell Variables.
  18335. (line 116)
  18336. * LANG: Special Shell Variables.
  18337. (line 160)
  18338. * LANGUAGE: Special Shell Variables.
  18339. (line 167)
  18340. * LC_ADDRESS: Special Shell Variables.
  18341. (line 177)
  18342. * LC_ALL <1>: Special Shell Variables.
  18343. (line 160)
  18344. * LC_ALL: Initialization Macros.
  18345. (line 14)
  18346. * LC_COLLATE: Special Shell Variables.
  18347. (line 160)
  18348. * LC_CTYPE: Special Shell Variables.
  18349. (line 160)
  18350. * LC_IDENTIFICATION: Special Shell Variables.
  18351. (line 177)
  18352. * LC_MEASUREMENT: Special Shell Variables.
  18353. (line 177)
  18354. * LC_MESSAGES: Special Shell Variables.
  18355. (line 160)
  18356. * LC_MONETARY: Special Shell Variables.
  18357. (line 160)
  18358. * LC_NAME: Special Shell Variables.
  18359. (line 177)
  18360. * LC_NUMERIC: Special Shell Variables.
  18361. (line 160)
  18362. * LC_PAPER: Special Shell Variables.
  18363. (line 177)
  18364. * LC_TELEPHONE: Special Shell Variables.
  18365. (line 177)
  18366. * LC_TIME: Special Shell Variables.
  18367. (line 160)
  18368. * LDFLAGS: Preset Output Variables.
  18369. (line 140)
  18370. * LIBS: Preset Output Variables.
  18371. (line 154)
  18372. * LINENO <1>: Special Shell Variables.
  18373. (line 182)
  18374. * LINENO: Initialization Macros.
  18375. (line 67)
  18376. * M4: autom4te Invocation. (line 10)
  18377. * MAIL: Special Shell Variables.
  18378. (line 84)
  18379. * MAILPATH: Special Shell Variables.
  18380. (line 84)
  18381. * NULLCMD: Special Shell Variables.
  18382. (line 311)
  18383. * OBJC: Objective C Compiler.
  18384. (line 7)
  18385. * OBJCFLAGS <1>: Objective C Compiler.
  18386. (line 7)
  18387. * OBJCFLAGS: Preset Output Variables.
  18388. (line 162)
  18389. * OBJCPP: Objective C Compiler.
  18390. (line 26)
  18391. * OBJCXX: Objective C++ Compiler.
  18392. (line 7)
  18393. * OBJCXXCPP: Objective C++ Compiler.
  18394. (line 27)
  18395. * OBJCXXFLAGS <1>: Objective C++ Compiler.
  18396. (line 7)
  18397. * OBJCXXFLAGS: Preset Output Variables.
  18398. (line 166)
  18399. * options: Special Shell Variables.
  18400. (line 318)
  18401. * PATH_SEPARATOR: Special Shell Variables.
  18402. (line 322)
  18403. * POSIXLY_CORRECT: Special Shell Variables.
  18404. (line 331)
  18405. * PS1: Special Shell Variables.
  18406. (line 84)
  18407. * PS2: Special Shell Variables.
  18408. (line 84)
  18409. * PS4: Special Shell Variables.
  18410. (line 84)
  18411. * PWD: Special Shell Variables.
  18412. (line 346)
  18413. * RANDOM: Special Shell Variables.
  18414. (line 355)
  18415. * SHELL: Initialization Macros.
  18416. (line 14)
  18417. * SIMPLE_BACKUP_SUFFIX: autoupdate Invocation.
  18418. (line 16)
  18419. * status: Special Shell Variables.
  18420. (line 363)
  18421. * TMPDIR: Initialization Macros.
  18422. (line 77)
  18423. * WARNINGS <1>: autom4te Invocation. (line 58)
  18424. * WARNINGS <2>: autoheader Invocation.
  18425. (line 83)
  18426. * WARNINGS <3>: autoreconf Invocation.
  18427. (line 97)
  18428. * WARNINGS: autoconf Invocation. (line 62)
  18429. * XMKMF: System Services. (line 10)
  18430. * YACC: Particular Programs. (line 200)
  18431. * YFLAGS: Particular Programs. (line 200)
  18432. 
  18433. File: autoconf.info, Node: Output Variable Index, Next: Preprocessor Symbol Index, Prev: Environment Variable Index, Up: Indices
  18434. B.2 Output Variable Index
  18435. =========================
  18436. This is an alphabetical list of the variables that Autoconf can
  18437. substitute into files that it creates, typically one or more makefiles.
  18438. *Note Setting Output Variables::, for more information on how this is
  18439. done.
  18440. �[index�]
  18441. * Menu:
  18442. * abs_builddir: Preset Output Variables.
  18443. (line 177)
  18444. * abs_srcdir: Preset Output Variables.
  18445. (line 199)
  18446. * abs_top_builddir: Preset Output Variables.
  18447. (line 192)
  18448. * abs_top_srcdir: Preset Output Variables.
  18449. (line 206)
  18450. * ac_empty: Fortran Compiler. (line 465)
  18451. * ALLOCA: Particular Functions.
  18452. (line 10)
  18453. * AWK: Particular Programs. (line 10)
  18454. * bindir: Installation Directory Variables.
  18455. (line 15)
  18456. * build: Canonicalizing. (line 26)
  18457. * build_alias: Canonicalizing. (line 9)
  18458. * build_cpu: Canonicalizing. (line 26)
  18459. * build_os: Canonicalizing. (line 26)
  18460. * build_vendor: Canonicalizing. (line 26)
  18461. * builddir: Preset Output Variables.
  18462. (line 174)
  18463. * CC <1>: System Services. (line 49)
  18464. * CC: C Compiler. (line 61)
  18465. * CFLAGS <1>: C Compiler. (line 61)
  18466. * CFLAGS: Preset Output Variables.
  18467. (line 23)
  18468. * configure_input: Preset Output Variables.
  18469. (line 58)
  18470. * CPP: C Compiler. (line 113)
  18471. * CPPFLAGS: Preset Output Variables.
  18472. (line 72)
  18473. * cross_compiling: Runtime. (line 71)
  18474. * CXX: C++ Compiler. (line 7)
  18475. * CXXCPP: C++ Compiler. (line 35)
  18476. * CXXFLAGS <1>: C++ Compiler. (line 7)
  18477. * CXXFLAGS: Preset Output Variables.
  18478. (line 94)
  18479. * datadir: Installation Directory Variables.
  18480. (line 18)
  18481. * datarootdir: Installation Directory Variables.
  18482. (line 22)
  18483. * DEFS: Preset Output Variables.
  18484. (line 98)
  18485. * docdir: Installation Directory Variables.
  18486. (line 26)
  18487. * dvidir: Installation Directory Variables.
  18488. (line 30)
  18489. * ECHO_C: Preset Output Variables.
  18490. (line 108)
  18491. * ECHO_N: Preset Output Variables.
  18492. (line 108)
  18493. * ECHO_T: Preset Output Variables.
  18494. (line 108)
  18495. * EGREP: Particular Programs. (line 29)
  18496. * ERL <1>: Running the Compiler.
  18497. (line 30)
  18498. * ERL <2>: Language Choice. (line 40)
  18499. * ERL: Erlang Compiler and Interpreter.
  18500. (line 29)
  18501. * ERLANG_ERTS_VER: Erlang Libraries. (line 12)
  18502. * ERLANG_INSTALL_LIB_DIR <1>: Erlang Libraries. (line 86)
  18503. * ERLANG_INSTALL_LIB_DIR: Installation Directory Variables.
  18504. (line 201)
  18505. * ERLANG_INSTALL_LIB_DIR_LIBRARY <1>: Erlang Libraries. (line 93)
  18506. * ERLANG_INSTALL_LIB_DIR_LIBRARY: Installation Directory Variables.
  18507. (line 206)
  18508. * ERLANG_LIB_DIR: Erlang Libraries. (line 28)
  18509. * ERLANG_LIB_DIR_LIBRARY: Erlang Libraries. (line 36)
  18510. * ERLANG_LIB_VER_LIBRARY: Erlang Libraries. (line 36)
  18511. * ERLANG_ROOT_DIR: Erlang Libraries. (line 22)
  18512. * ERLC <1>: Language Choice. (line 40)
  18513. * ERLC: Erlang Compiler and Interpreter.
  18514. (line 10)
  18515. * ERLCFLAGS <1>: Language Choice. (line 40)
  18516. * ERLCFLAGS <2>: Erlang Compiler and Interpreter.
  18517. (line 10)
  18518. * ERLCFLAGS: Preset Output Variables.
  18519. (line 120)
  18520. * exec_prefix: Installation Directory Variables.
  18521. (line 33)
  18522. * EXEEXT <1>: Obsolete Macros. (line 178)
  18523. * EXEEXT: Compilers and Preprocessors.
  18524. (line 6)
  18525. * F77: Fortran Compiler. (line 19)
  18526. * FC: Fortran Compiler. (line 44)
  18527. * FC_MODEXT: Fortran Compiler. (line 438)
  18528. * FC_MODINC: Fortran Compiler. (line 465)
  18529. * FC_MODOUT: Fortran Compiler. (line 501)
  18530. * FCFLAGS <1>: Fortran Compiler. (line 44)
  18531. * FCFLAGS: Preset Output Variables.
  18532. (line 126)
  18533. * FCLIBS: Fortran Compiler. (line 92)
  18534. * FFLAGS <1>: Fortran Compiler. (line 19)
  18535. * FFLAGS: Preset Output Variables.
  18536. (line 133)
  18537. * FGREP: Particular Programs. (line 36)
  18538. * FLIBS: Fortran Compiler. (line 92)
  18539. * GETGROUPS_LIBS: Particular Functions.
  18540. (line 155)
  18541. * GETLOADAVG_LIBS: Particular Functions.
  18542. (line 161)
  18543. * GOFLAGS: Preset Output Variables.
  18544. (line 170)
  18545. * GREP: Particular Programs. (line 20)
  18546. * host: Canonicalizing. (line 34)
  18547. * host_alias: Canonicalizing. (line 9)
  18548. * host_cpu: Canonicalizing. (line 34)
  18549. * host_os: Canonicalizing. (line 34)
  18550. * host_vendor: Canonicalizing. (line 34)
  18551. * htmldir: Installation Directory Variables.
  18552. (line 40)
  18553. * includedir: Installation Directory Variables.
  18554. (line 43)
  18555. * infodir: Installation Directory Variables.
  18556. (line 46)
  18557. * INSTALL: Particular Programs. (line 43)
  18558. * INSTALL_DATA: Particular Programs. (line 43)
  18559. * INSTALL_PROGRAM: Particular Programs. (line 43)
  18560. * INSTALL_SCRIPT: Particular Programs. (line 43)
  18561. * KMEM_GROUP: Particular Functions.
  18562. (line 161)
  18563. * LDFLAGS: Preset Output Variables.
  18564. (line 140)
  18565. * LEX: Particular Programs. (line 114)
  18566. * LEX_OUTPUT_ROOT: Particular Programs. (line 114)
  18567. * LEXLIB: Particular Programs. (line 114)
  18568. * libdir: Installation Directory Variables.
  18569. (line 49)
  18570. * libexecdir: Installation Directory Variables.
  18571. (line 52)
  18572. * LIBOBJDIR: AC_LIBOBJ vs LIBOBJS.
  18573. (line 35)
  18574. * LIBOBJS <1>: Particular Structures.
  18575. (line 26)
  18576. * LIBOBJS <2>: Generic Functions. (line 56)
  18577. * LIBOBJS: Particular Functions.
  18578. (line 161)
  18579. * LIBS <1>: Obsolete Macros. (line 295)
  18580. * LIBS: Preset Output Variables.
  18581. (line 154)
  18582. * LN_S: Particular Programs. (line 168)
  18583. * localedir: Installation Directory Variables.
  18584. (line 55)
  18585. * localstatedir: Installation Directory Variables.
  18586. (line 60)
  18587. * mandir: Installation Directory Variables.
  18588. (line 63)
  18589. * MKDIR_P: Particular Programs. (line 80)
  18590. * NEED_SETGID: Particular Functions.
  18591. (line 161)
  18592. * OBJC: Objective C Compiler.
  18593. (line 7)
  18594. * OBJCFLAGS <1>: Objective C Compiler.
  18595. (line 7)
  18596. * OBJCFLAGS: Preset Output Variables.
  18597. (line 162)
  18598. * OBJCPP: Objective C Compiler.
  18599. (line 26)
  18600. * OBJCXX: Objective C++ Compiler.
  18601. (line 7)
  18602. * OBJCXXCPP: Objective C++ Compiler.
  18603. (line 27)
  18604. * OBJCXXFLAGS <1>: Objective C++ Compiler.
  18605. (line 7)
  18606. * OBJCXXFLAGS: Preset Output Variables.
  18607. (line 166)
  18608. * OBJEXT <1>: Obsolete Macros. (line 384)
  18609. * OBJEXT: Compilers and Preprocessors.
  18610. (line 11)
  18611. * oldincludedir: Installation Directory Variables.
  18612. (line 66)
  18613. * OPENMP_CFLAGS: Generic Compiler Characteristics.
  18614. (line 64)
  18615. * OPENMP_CXXFLAGS: Generic Compiler Characteristics.
  18616. (line 64)
  18617. * OPENMP_FCFLAGS: Generic Compiler Characteristics.
  18618. (line 64)
  18619. * OPENMP_FFLAGS: Generic Compiler Characteristics.
  18620. (line 64)
  18621. * PACKAGE_BUGREPORT: Initializing configure.
  18622. (line 57)
  18623. * PACKAGE_NAME: Initializing configure.
  18624. (line 45)
  18625. * PACKAGE_STRING: Initializing configure.
  18626. (line 54)
  18627. * PACKAGE_TARNAME: Initializing configure.
  18628. (line 48)
  18629. * PACKAGE_URL: Initializing configure.
  18630. (line 61)
  18631. * PACKAGE_VERSION: Initializing configure.
  18632. (line 51)
  18633. * pdfdir: Installation Directory Variables.
  18634. (line 69)
  18635. * POW_LIB: Particular Functions.
  18636. (line 408)
  18637. * prefix: Installation Directory Variables.
  18638. (line 72)
  18639. * program_transform_name: Transforming Names. (line 11)
  18640. * psdir: Installation Directory Variables.
  18641. (line 77)
  18642. * RANLIB: Particular Programs. (line 187)
  18643. * sbindir: Installation Directory Variables.
  18644. (line 80)
  18645. * SED: Particular Programs. (line 191)
  18646. * SET_MAKE: Output. (line 45)
  18647. * sharedstatedir: Installation Directory Variables.
  18648. (line 84)
  18649. * srcdir: Preset Output Variables.
  18650. (line 195)
  18651. * subdirs: Subdirectories. (line 12)
  18652. * sysconfdir: Installation Directory Variables.
  18653. (line 88)
  18654. * target: Canonicalizing. (line 41)
  18655. * target_alias: Canonicalizing. (line 9)
  18656. * target_cpu: Canonicalizing. (line 41)
  18657. * target_os: Canonicalizing. (line 41)
  18658. * target_vendor: Canonicalizing. (line 41)
  18659. * tmp: Initialization Macros.
  18660. (line 77)
  18661. * top_build_prefix: Preset Output Variables.
  18662. (line 184)
  18663. * top_builddir: Preset Output Variables.
  18664. (line 180)
  18665. * top_srcdir: Preset Output Variables.
  18666. (line 202)
  18667. * X_CFLAGS: System Services. (line 30)
  18668. * X_EXTRA_LIBS: System Services. (line 30)
  18669. * X_LIBS: System Services. (line 30)
  18670. * X_PRE_LIBS: System Services. (line 30)
  18671. * YACC: Particular Programs. (line 200)
  18672. 
  18673. File: autoconf.info, Node: Preprocessor Symbol Index, Next: Cache Variable Index, Prev: Output Variable Index, Up: Indices
  18674. B.3 Preprocessor Symbol Index
  18675. =============================
  18676. This is an alphabetical list of the C preprocessor symbols that the
  18677. Autoconf macros define. To work with Autoconf, C source code needs to
  18678. use these names in `#if' or `#ifdef' directives.
  18679. �[index�]
  18680. * Menu:
  18681. * __CHAR_UNSIGNED__: C Compiler. (line 291)
  18682. * __EXTENSIONS__: Posix Variants. (line 10)
  18683. * __PROTOTYPES: C Compiler. (line 351)
  18684. * _ALL_SOURCE <1>: Obsolete Macros. (line 20)
  18685. * _ALL_SOURCE: Posix Variants. (line 10)
  18686. * _FILE_OFFSET_BITS: System Services. (line 49)
  18687. * _GNU_SOURCE <1>: Obsolete Macros. (line 234)
  18688. * _GNU_SOURCE: Posix Variants. (line 10)
  18689. * _LARGE_FILES: System Services. (line 49)
  18690. * _LARGEFILE_SOURCE: Particular Functions.
  18691. (line 147)
  18692. * _MINIX <1>: Obsolete Macros. (line 371)
  18693. * _MINIX: Posix Variants. (line 10)
  18694. * _OPENMP: Generic Compiler Characteristics.
  18695. (line 64)
  18696. * _POSIX_1_SOURCE <1>: Obsolete Macros. (line 371)
  18697. * _POSIX_1_SOURCE: Posix Variants. (line 10)
  18698. * _POSIX_PTHREAD_SEMANTICS: Posix Variants. (line 10)
  18699. * _POSIX_SOURCE <1>: Obsolete Macros. (line 371)
  18700. * _POSIX_SOURCE: Posix Variants. (line 10)
  18701. * _POSIX_VERSION: Particular Headers. (line 228)
  18702. * _TANDEM_SOURCE: Posix Variants. (line 10)
  18703. * ALIGNOF_TYPE: Generic Compiler Characteristics.
  18704. (line 30)
  18705. * C_ALLOCA: Particular Functions.
  18706. (line 10)
  18707. * C_GETLOADAVG: Particular Functions.
  18708. (line 161)
  18709. * CLOSEDIR_VOID: Particular Functions.
  18710. (line 69)
  18711. * const: C Compiler. (line 217)
  18712. * CXX_NO_MINUS_C_MINUS_O: C++ Compiler. (line 48)
  18713. * DGUX: Particular Functions.
  18714. (line 161)
  18715. * DIRENT: Obsolete Macros. (line 158)
  18716. * F77_DUMMY_MAIN: Fortran Compiler. (line 130)
  18717. * F77_FUNC: Fortran Compiler. (line 202)
  18718. * F77_FUNC_: Fortran Compiler. (line 202)
  18719. * F77_MAIN: Fortran Compiler. (line 176)
  18720. * F77_NO_MINUS_C_MINUS_O: Fortran Compiler. (line 76)
  18721. * FC_DUMMY_MAIN: Fortran Compiler. (line 130)
  18722. * FC_FUNC: Fortran Compiler. (line 202)
  18723. * FC_FUNC_: Fortran Compiler. (line 202)
  18724. * FC_MAIN: Fortran Compiler. (line 176)
  18725. * FC_NO_MINUS_C_MINUS_O: Fortran Compiler. (line 76)
  18726. * FLEXIBLE_ARRAY_MEMBER: C Compiler. (line 315)
  18727. * GETGROUPS_T: Particular Types. (line 14)
  18728. * GETLOADAVG_PRIVILEGED: Particular Functions.
  18729. (line 161)
  18730. * GETPGRP_VOID: Particular Functions.
  18731. (line 205)
  18732. * gid_t: Particular Types. (line 126)
  18733. * GWINSZ_IN_SYS_IOCTL: Particular Headers. (line 270)
  18734. * HAVE__BOOL: Particular Headers. (line 10)
  18735. * HAVE_AGGREGATE_MEMBER: Generic Structures. (line 29)
  18736. * HAVE_ALLOCA_H: Particular Functions.
  18737. (line 10)
  18738. * HAVE_C_BACKSLASH_A: C Compiler. (line 176)
  18739. * HAVE_C_VARARRAYS: C Compiler. (line 339)
  18740. * HAVE_CHOWN: Particular Functions.
  18741. (line 63)
  18742. * HAVE_CONFIG_H: Configuration Headers.
  18743. (line 33)
  18744. * HAVE_DECL_STRERROR_R: Particular Functions.
  18745. (line 388)
  18746. * HAVE_DECL_SYMBOL: Generic Declarations.
  18747. (line 34)
  18748. * HAVE_DECL_TZNAME: Particular Structures.
  18749. (line 43)
  18750. * HAVE_DIRENT_H: Particular Headers. (line 25)
  18751. * HAVE_DOPRNT: Particular Functions.
  18752. (line 443)
  18753. * HAVE_FSEEKO: Particular Functions.
  18754. (line 147)
  18755. * HAVE_FUNCTION: Generic Functions. (line 27)
  18756. * HAVE_GETGROUPS: Particular Functions.
  18757. (line 155)
  18758. * HAVE_GETMNTENT: Particular Functions.
  18759. (line 195)
  18760. * HAVE_HEADER: Generic Headers. (line 46)
  18761. * HAVE_INT16_T: Particular Types. (line 40)
  18762. * HAVE_INT32_T: Particular Types. (line 43)
  18763. * HAVE_INT64_T: Particular Types. (line 46)
  18764. * HAVE_INT8_T: Particular Types. (line 21)
  18765. * HAVE_INTMAX_T: Particular Types. (line 49)
  18766. * HAVE_INTPTR_T: Particular Types. (line 54)
  18767. * HAVE_LONG_DOUBLE <1>: Obsolete Macros. (line 33)
  18768. * HAVE_LONG_DOUBLE: Particular Types. (line 59)
  18769. * HAVE_LONG_DOUBLE_WIDER: Particular Types. (line 70)
  18770. * HAVE_LONG_FILE_NAMES: System Services. (line 71)
  18771. * HAVE_LONG_LONG_INT: Particular Types. (line 78)
  18772. * HAVE_LSTAT_EMPTY_STRING_BUG: Particular Functions.
  18773. (line 363)
  18774. * HAVE_MALLOC: Particular Functions.
  18775. (line 247)
  18776. * HAVE_MBRTOWC: Particular Functions.
  18777. (line 279)
  18778. * HAVE_MMAP: Particular Functions.
  18779. (line 311)
  18780. * HAVE_NDIR_H: Particular Headers. (line 25)
  18781. * HAVE_NLIST_H: Particular Functions.
  18782. (line 161)
  18783. * HAVE_OBSTACK: Particular Functions.
  18784. (line 319)
  18785. * HAVE_REALLOC: Particular Functions.
  18786. (line 326)
  18787. * HAVE_RESOLV_H: Particular Headers. (line 73)
  18788. * HAVE_RESTARTABLE_SYSCALLS: Obsolete Macros. (line 548)
  18789. * HAVE_ST_BLKSIZE: Obsolete Macros. (line 521)
  18790. * HAVE_ST_BLOCKS: Particular Structures.
  18791. (line 26)
  18792. * HAVE_ST_RDEV: Obsolete Macros. (line 530)
  18793. * HAVE_STAT_EMPTY_STRING_BUG: Particular Functions.
  18794. (line 363)
  18795. * HAVE_STDBOOL_H: Particular Headers. (line 101)
  18796. * HAVE_STRCOLL: Particular Functions.
  18797. (line 379)
  18798. * HAVE_STRERROR_R: Particular Functions.
  18799. (line 388)
  18800. * HAVE_STRFTIME: Particular Functions.
  18801. (line 401)
  18802. * HAVE_STRINGIZE: C Compiler. (line 305)
  18803. * HAVE_STRNLEN: Particular Functions.
  18804. (line 426)
  18805. * HAVE_STRTOLD: Particular Functions.
  18806. (line 420)
  18807. * HAVE_STRUCT_DIRENT_D_INO: Particular Structures.
  18808. (line 9)
  18809. * HAVE_STRUCT_DIRENT_D_TYPE: Particular Structures.
  18810. (line 21)
  18811. * HAVE_STRUCT_STAT_ST_BLKSIZE: Obsolete Macros. (line 521)
  18812. * HAVE_STRUCT_STAT_ST_BLOCKS: Particular Structures.
  18813. (line 26)
  18814. * HAVE_STRUCT_STAT_ST_RDEV: Obsolete Macros. (line 530)
  18815. * HAVE_STRUCT_TM_TM_ZONE: Particular Structures.
  18816. (line 43)
  18817. * HAVE_SYS_DIR_H: Particular Headers. (line 25)
  18818. * HAVE_SYS_NDIR_H: Particular Headers. (line 25)
  18819. * HAVE_SYS_WAIT_H: Particular Headers. (line 204)
  18820. * HAVE_TM_ZONE: Particular Structures.
  18821. (line 43)
  18822. * HAVE_TYPE: Generic Types. (line 28)
  18823. * HAVE_TYPEOF: C Compiler. (line 345)
  18824. * HAVE_TZNAME: Particular Structures.
  18825. (line 43)
  18826. * HAVE_UINT16_T: Particular Types. (line 138)
  18827. * HAVE_UINT32_T: Particular Types. (line 141)
  18828. * HAVE_UINT64_T: Particular Types. (line 144)
  18829. * HAVE_UINT8_T: Particular Types. (line 132)
  18830. * HAVE_UINTMAX_T: Particular Types. (line 147)
  18831. * HAVE_UINTPTR_T: Particular Types. (line 152)
  18832. * HAVE_UNSIGNED_LONG_LONG_INT: Particular Types. (line 157)
  18833. * HAVE_UTIME_NULL: Particular Functions.
  18834. (line 433)
  18835. * HAVE_VFORK_H: Particular Functions.
  18836. (line 120)
  18837. * HAVE_VPRINTF: Particular Functions.
  18838. (line 443)
  18839. * HAVE_WAIT3: Obsolete Macros. (line 216)
  18840. * HAVE_WORKING_FORK: Particular Functions.
  18841. (line 120)
  18842. * HAVE_WORKING_VFORK: Particular Functions.
  18843. (line 120)
  18844. * inline: C Compiler. (line 286)
  18845. * int16_t: Particular Types. (line 40)
  18846. * int32_t: Particular Types. (line 43)
  18847. * int64_t: Particular Types. (line 46)
  18848. * int8_t: Particular Types. (line 21)
  18849. * INT_16_BITS: Obsolete Macros. (line 275)
  18850. * intmax_t: Particular Types. (line 49)
  18851. * intptr_t: Particular Types. (line 54)
  18852. * LONG_64_BITS: Obsolete Macros. (line 337)
  18853. * LSTAT_FOLLOWS_SLASHED_SYMLINK: Particular Functions.
  18854. (line 228)
  18855. * MAJOR_IN_MKDEV: Particular Headers. (line 68)
  18856. * MAJOR_IN_SYSMACROS: Particular Headers. (line 68)
  18857. * malloc: Particular Functions.
  18858. (line 247)
  18859. * mbstate_t: Particular Types. (line 88)
  18860. * mode_t: Particular Types. (line 96)
  18861. * NDEBUG: Particular Headers. (line 20)
  18862. * NDIR: Obsolete Macros. (line 158)
  18863. * NEED_MEMORY_H: Obsolete Macros. (line 358)
  18864. * NEED_SETGID: Particular Functions.
  18865. (line 161)
  18866. * NLIST_NAME_UNION: Particular Functions.
  18867. (line 161)
  18868. * NO_MINUS_C_MINUS_O: C Compiler. (line 102)
  18869. * off_t: Particular Types. (line 102)
  18870. * PACKAGE_BUGREPORT: Initializing configure.
  18871. (line 57)
  18872. * PACKAGE_NAME: Initializing configure.
  18873. (line 45)
  18874. * PACKAGE_STRING: Initializing configure.
  18875. (line 54)
  18876. * PACKAGE_TARNAME: Initializing configure.
  18877. (line 48)
  18878. * PACKAGE_URL: Initializing configure.
  18879. (line 61)
  18880. * PACKAGE_VERSION: Initializing configure.
  18881. (line 51)
  18882. * PARAMS: C Compiler. (line 351)
  18883. * pid_t: Particular Types. (line 108)
  18884. * PROTOTYPES: C Compiler. (line 351)
  18885. * realloc: Particular Functions.
  18886. (line 326)
  18887. * restrict: C Compiler. (line 247)
  18888. * RETSIGTYPE: Obsolete Macros. (line 662)
  18889. * SELECT_TYPE_ARG1: Particular Functions.
  18890. (line 337)
  18891. * SELECT_TYPE_ARG234: Particular Functions.
  18892. (line 337)
  18893. * SELECT_TYPE_ARG5: Particular Functions.
  18894. (line 337)
  18895. * SETPGRP_VOID: Particular Functions.
  18896. (line 348)
  18897. * SETVBUF_REVERSED: Obsolete Macros. (line 208)
  18898. * size_t: Particular Types. (line 114)
  18899. * SIZEOF_TYPE-OR-EXPR: Generic Compiler Characteristics.
  18900. (line 8)
  18901. * ssize_t: Particular Types. (line 120)
  18902. * STAT_MACROS_BROKEN: Particular Headers. (line 92)
  18903. * STDC_HEADERS: Particular Headers. (line 135)
  18904. * STRERROR_R_CHAR_P: Particular Functions.
  18905. (line 388)
  18906. * SVR4: Particular Functions.
  18907. (line 161)
  18908. * SYS_SIGLIST_DECLARED: Obsolete Macros. (line 141)
  18909. * SYSDIR: Obsolete Macros. (line 158)
  18910. * SYSNDIR: Obsolete Macros. (line 158)
  18911. * TIME_WITH_SYS_TIME: Particular Headers. (line 244)
  18912. * TM_IN_SYS_TIME: Particular Structures.
  18913. (line 35)
  18914. * typeof: C Compiler. (line 345)
  18915. * uid_t: Particular Types. (line 126)
  18916. * uint16_t: Particular Types. (line 138)
  18917. * uint32_t: Particular Types. (line 141)
  18918. * uint64_t: Particular Types. (line 144)
  18919. * uint8_t: Particular Types. (line 132)
  18920. * uintmax_t: Particular Types. (line 147)
  18921. * uintptr_t: Particular Types. (line 152)
  18922. * UMAX: Particular Functions.
  18923. (line 161)
  18924. * UMAX4_3: Particular Functions.
  18925. (line 161)
  18926. * USG: Obsolete Macros. (line 685)
  18927. * VARIABLE: Defining Symbols. (line 32)
  18928. * vfork: Particular Functions.
  18929. (line 120)
  18930. * volatile: C Compiler. (line 265)
  18931. * WORDS_BIGENDIAN: C Compiler. (line 184)
  18932. * X_DISPLAY_MISSING: System Services. (line 30)
  18933. * YYTEXT_POINTER: Particular Programs. (line 114)
  18934. 
  18935. File: autoconf.info, Node: Cache Variable Index, Next: Autoconf Macro Index, Prev: Preprocessor Symbol Index, Up: Indices
  18936. B.4 Cache Variable Index
  18937. ========================
  18938. This is an alphabetical list of documented cache variables used by
  18939. macros defined in Autoconf. Autoconf macros may use additional cache
  18940. variables internally.
  18941. �[index�]
  18942. * Menu:
  18943. * ac_cv_alignof_TYPE-OR-EXPR: Generic Compiler Characteristics.
  18944. (line 30)
  18945. * ac_cv_c_const: C Compiler. (line 217)
  18946. * ac_cv_c_int16_t: Particular Types. (line 40)
  18947. * ac_cv_c_int32_t: Particular Types. (line 43)
  18948. * ac_cv_c_int64_t: Particular Types. (line 46)
  18949. * ac_cv_c_int8_t: Particular Types. (line 21)
  18950. * ac_cv_c_restrict: C Compiler. (line 247)
  18951. * ac_cv_c_uint16_t: Particular Types. (line 138)
  18952. * ac_cv_c_uint32_t: Particular Types. (line 141)
  18953. * ac_cv_c_uint64_t: Particular Types. (line 144)
  18954. * ac_cv_c_uint8_t: Particular Types. (line 132)
  18955. * ac_cv_f77_compiler_gnu: Fortran Compiler. (line 19)
  18956. * ac_cv_f77_dummy_main: Fortran Compiler. (line 130)
  18957. * ac_cv_f77_implicit_none: Fortran Compiler. (line 427)
  18958. * ac_cv_f77_libs: Fortran Compiler. (line 92)
  18959. * ac_cv_f77_main: Fortran Compiler. (line 176)
  18960. * ac_cv_f77_mangling: Fortran Compiler. (line 202)
  18961. * ac_cv_fc_check_bounds: Fortran Compiler. (line 413)
  18962. * ac_cv_fc_compiler_gnu: Fortran Compiler. (line 44)
  18963. * ac_cv_fc_dummy_main: Fortran Compiler. (line 130)
  18964. * ac_cv_fc_fixedform: Fortran Compiler. (line 375)
  18965. * ac_cv_fc_freeform: Fortran Compiler. (line 351)
  18966. * ac_cv_fc_implicit_none: Fortran Compiler. (line 427)
  18967. * ac_cv_fc_libs: Fortran Compiler. (line 92)
  18968. * ac_cv_fc_line_length: Fortran Compiler. (line 396)
  18969. * ac_cv_fc_main: Fortran Compiler. (line 176)
  18970. * ac_cv_fc_mangling: Fortran Compiler. (line 202)
  18971. * ac_cv_fc_module_ext: Fortran Compiler. (line 438)
  18972. * ac_cv_fc_module_flag: Fortran Compiler. (line 465)
  18973. * ac_cv_fc_module_output_flag: Fortran Compiler. (line 501)
  18974. * ac_cv_fc_pp_define: Fortran Compiler. (line 336)
  18975. * ac_cv_fc_pp_srcext_EXT: Fortran Compiler. (line 279)
  18976. * ac_cv_fc_srcext_EXT: Fortran Compiler. (line 279)
  18977. * ac_cv_file_FILE: Files. (line 13)
  18978. * ac_cv_func_chown_works: Particular Functions.
  18979. (line 63)
  18980. * ac_cv_func_closedir_void: Particular Functions.
  18981. (line 69)
  18982. * ac_cv_func_fnmatch_gnu: Particular Functions.
  18983. (line 109)
  18984. * ac_cv_func_fnmatch_works: Particular Functions.
  18985. (line 94)
  18986. * ac_cv_func_FUNCTION: Generic Functions. (line 15)
  18987. * ac_cv_func_getgroups_works: Particular Functions.
  18988. (line 155)
  18989. * ac_cv_func_getpgrp_void: Particular Functions.
  18990. (line 205)
  18991. * ac_cv_func_lstat_dereferences_slashed_symlink: Particular Functions.
  18992. (line 228)
  18993. * ac_cv_func_lstat_empty_string_bug: Particular Functions.
  18994. (line 363)
  18995. * ac_cv_func_malloc_0_nonnull: Particular Functions.
  18996. (line 247)
  18997. * ac_cv_func_mbrtowc: Particular Functions.
  18998. (line 279)
  18999. * ac_cv_func_memcmp_working: Particular Functions.
  19000. (line 286)
  19001. * ac_cv_func_mmap_fixed_mapped: Particular Functions.
  19002. (line 311)
  19003. * ac_cv_func_obstack: Particular Functions.
  19004. (line 319)
  19005. * ac_cv_func_pow: Particular Functions.
  19006. (line 408)
  19007. * ac_cv_func_realloc_0_nonnull: Particular Functions.
  19008. (line 326)
  19009. * ac_cv_func_setpgrp_void: Particular Functions.
  19010. (line 348)
  19011. * ac_cv_func_stat_empty_string_bug: Particular Functions.
  19012. (line 363)
  19013. * ac_cv_func_strcoll_works: Particular Functions.
  19014. (line 379)
  19015. * ac_cv_func_strerror_r_char_p: Particular Functions.
  19016. (line 388)
  19017. * ac_cv_func_strnlen_working: Particular Functions.
  19018. (line 426)
  19019. * ac_cv_func_strtod: Particular Functions.
  19020. (line 408)
  19021. * ac_cv_func_strtold: Particular Functions.
  19022. (line 420)
  19023. * ac_cv_func_utime_null: Particular Functions.
  19024. (line 433)
  19025. * ac_cv_func_working_mktime: Particular Functions.
  19026. (line 299)
  19027. * ac_cv_have_decl_SYMBOL: Generic Declarations.
  19028. (line 11)
  19029. * ac_cv_header_HEADER-FILE: Generic Headers. (line 13)
  19030. * ac_cv_header_stdbool_h: Particular Headers. (line 10)
  19031. * ac_cv_header_stdc: Particular Headers. (line 135)
  19032. * ac_cv_header_sys_wait_h: Particular Headers. (line 204)
  19033. * ac_cv_header_time: Particular Headers. (line 244)
  19034. * ac_cv_lib_error_at_line: Particular Functions.
  19035. (line 84)
  19036. * ac_cv_lib_LIBRARY_FUNCTION: Libraries. (line 11)
  19037. * ac_cv_member_AGGREGATE_MEMBER: Generic Structures. (line 11)
  19038. * ac_cv_member_struct_stat_st_blocks: Particular Structures.
  19039. (line 26)
  19040. * ac_cv_path_install: Particular Programs. (line 43)
  19041. * ac_cv_path_mkdir: Particular Programs. (line 80)
  19042. * ac_cv_path_SED: Particular Programs. (line 191)
  19043. * ac_cv_path_VARIABLE: Generic Programs. (line 108)
  19044. * ac_cv_prog_AWK: Particular Programs. (line 10)
  19045. * ac_cv_prog_c_openmp: Generic Compiler Characteristics.
  19046. (line 64)
  19047. * ac_cv_prog_cc_c89: C Compiler. (line 61)
  19048. * ac_cv_prog_cc_c99: C Compiler. (line 161)
  19049. * ac_cv_prog_cc_COMPILER_c_o: C Compiler. (line 102)
  19050. * ac_cv_prog_cc_stdc: C Compiler. (line 137)
  19051. * ac_cv_prog_cxx_openmp: Generic Compiler Characteristics.
  19052. (line 64)
  19053. * ac_cv_prog_EGREP: Particular Programs. (line 29)
  19054. * ac_cv_prog_f77_c_o: Fortran Compiler. (line 76)
  19055. * ac_cv_prog_f77_g: Fortran Compiler. (line 19)
  19056. * ac_cv_prog_f77_openmp: Generic Compiler Characteristics.
  19057. (line 64)
  19058. * ac_cv_prog_f77_v: Fortran Compiler. (line 92)
  19059. * ac_cv_prog_fc_c_o: Fortran Compiler. (line 76)
  19060. * ac_cv_prog_fc_g: Fortran Compiler. (line 44)
  19061. * ac_cv_prog_fc_openmp: Generic Compiler Characteristics.
  19062. (line 64)
  19063. * ac_cv_prog_fc_v: Fortran Compiler. (line 92)
  19064. * ac_cv_prog_FGREP: Particular Programs. (line 36)
  19065. * ac_cv_prog_GREP: Particular Programs. (line 20)
  19066. * ac_cv_prog_LEX: Particular Programs. (line 114)
  19067. * ac_cv_prog_VARIABLE: Generic Programs. (line 24)
  19068. * ac_cv_prog_YACC: Particular Programs. (line 200)
  19069. * ac_cv_search_FUNCTION: Libraries. (line 52)
  19070. * ac_cv_search_getmntent: Particular Functions.
  19071. (line 195)
  19072. * ac_cv_sizeof_TYPE-OR-EXPR: Generic Compiler Characteristics.
  19073. (line 8)
  19074. * ac_cv_sys_posix_termios: System Services. (line 75)
  19075. * ac_cv_type_getgroups: Particular Types. (line 14)
  19076. * ac_cv_type_long_double: Particular Types. (line 59)
  19077. * ac_cv_type_long_double_wider: Particular Types. (line 70)
  19078. * ac_cv_type_long_long_int: Particular Types. (line 78)
  19079. * ac_cv_type_mbstate_t: Particular Types. (line 88)
  19080. * ac_cv_type_mode_t: Particular Types. (line 96)
  19081. * ac_cv_type_off_t: Particular Types. (line 102)
  19082. * ac_cv_type_pid_t: Particular Types. (line 108)
  19083. * ac_cv_type_size_t: Particular Types. (line 114)
  19084. * ac_cv_type_ssize_t: Particular Types. (line 120)
  19085. * ac_cv_type_TYPE: Generic Types. (line 11)
  19086. * ac_cv_type_uid_t: Particular Types. (line 126)
  19087. * ac_cv_type_unsigned_long_long_int: Particular Types. (line 157)
  19088. 
  19089. File: autoconf.info, Node: Autoconf Macro Index, Next: M4 Macro Index, Prev: Cache Variable Index, Up: Indices
  19090. B.5 Autoconf Macro Index
  19091. ========================
  19092. This is an alphabetical list of the Autoconf macros.
  19093. �[index�]
  19094. * Menu:
  19095. * AC_ACT_IFELSE: AC_ACT_IFELSE vs AC_TRY_ACT.
  19096. (line 6)
  19097. * AC_AIX: Obsolete Macros. (line 20)
  19098. * AC_ALLOCA: Obsolete Macros. (line 24)
  19099. * AC_ARG_ARRAY: Obsolete Macros. (line 27)
  19100. * AC_ARG_ENABLE: Package Options. (line 35)
  19101. * AC_ARG_PROGRAM: Transforming Names. (line 11)
  19102. * AC_ARG_VAR: Setting Output Variables.
  19103. (line 79)
  19104. * AC_ARG_WITH: External Software. (line 36)
  19105. * AC_AUTOCONF_VERSION: Versioning. (line 21)
  19106. * AC_BEFORE: Suggested Ordering. (line 28)
  19107. * AC_C_BACKSLASH_A: C Compiler. (line 176)
  19108. * AC_C_BIGENDIAN: C Compiler. (line 184)
  19109. * AC_C_CHAR_UNSIGNED: C Compiler. (line 291)
  19110. * AC_C_CONST: C Compiler. (line 217)
  19111. * AC_C_CROSS: Obsolete Macros. (line 30)
  19112. * AC_C_FLEXIBLE_ARRAY_MEMBER: C Compiler. (line 315)
  19113. * AC_C_INLINE: C Compiler. (line 286)
  19114. * AC_C_LONG_DOUBLE: Obsolete Macros. (line 33)
  19115. * AC_C_PROTOTYPES: C Compiler. (line 351)
  19116. * AC_C_RESTRICT: C Compiler. (line 247)
  19117. * AC_C_STRINGIZE: C Compiler. (line 305)
  19118. * AC_C_TYPEOF: C Compiler. (line 345)
  19119. * AC_C_VARARRAYS: C Compiler. (line 339)
  19120. * AC_C_VOLATILE: C Compiler. (line 265)
  19121. * AC_CACHE_CHECK: Caching Results. (line 30)
  19122. * AC_CACHE_LOAD: Cache Checkpointing. (line 13)
  19123. * AC_CACHE_SAVE: Cache Checkpointing. (line 17)
  19124. * AC_CACHE_VAL: Caching Results. (line 16)
  19125. * AC_CANONICAL_BUILD: Canonicalizing. (line 26)
  19126. * AC_CANONICAL_HOST: Canonicalizing. (line 34)
  19127. * AC_CANONICAL_SYSTEM: Obsolete Macros. (line 41)
  19128. * AC_CANONICAL_TARGET: Canonicalizing. (line 41)
  19129. * AC_CHAR_UNSIGNED: Obsolete Macros. (line 51)
  19130. * AC_CHECK_ALIGNOF: Generic Compiler Characteristics.
  19131. (line 30)
  19132. * AC_CHECK_DECL: Generic Declarations.
  19133. (line 11)
  19134. * AC_CHECK_DECLS: Generic Declarations.
  19135. (line 34)
  19136. * AC_CHECK_DECLS_ONCE: Generic Declarations.
  19137. (line 79)
  19138. * AC_CHECK_FILE: Files. (line 13)
  19139. * AC_CHECK_FILES: Files. (line 21)
  19140. * AC_CHECK_FUNC: Generic Functions. (line 15)
  19141. * AC_CHECK_FUNCS: Generic Functions. (line 27)
  19142. * AC_CHECK_FUNCS_ONCE: Generic Functions. (line 38)
  19143. * AC_CHECK_HEADER: Generic Headers. (line 13)
  19144. * AC_CHECK_HEADER_STDBOOL: Particular Headers. (line 10)
  19145. * AC_CHECK_HEADERS: Generic Headers. (line 46)
  19146. * AC_CHECK_HEADERS_ONCE: Generic Headers. (line 87)
  19147. * AC_CHECK_LIB: Libraries. (line 11)
  19148. * AC_CHECK_MEMBER: Generic Structures. (line 11)
  19149. * AC_CHECK_MEMBERS: Generic Structures. (line 29)
  19150. * AC_CHECK_PROG: Generic Programs. (line 24)
  19151. * AC_CHECK_PROGS: Generic Programs. (line 36)
  19152. * AC_CHECK_SIZEOF: Generic Compiler Characteristics.
  19153. (line 8)
  19154. * AC_CHECK_TARGET_TOOL: Generic Programs. (line 48)
  19155. * AC_CHECK_TARGET_TOOLS: Generic Programs. (line 79)
  19156. * AC_CHECK_TOOL: Generic Programs. (line 64)
  19157. * AC_CHECK_TOOLS: Generic Programs. (line 92)
  19158. * AC_CHECK_TYPE <1>: Obsolete Macros. (line 54)
  19159. * AC_CHECK_TYPE: Generic Types. (line 11)
  19160. * AC_CHECK_TYPES: Generic Types. (line 28)
  19161. * AC_CHECKING: Obsolete Macros. (line 101)
  19162. * AC_COMPILE_CHECK: Obsolete Macros. (line 109)
  19163. * AC_COMPILE_IFELSE: Running the Compiler.
  19164. (line 13)
  19165. * AC_COMPUTE_INT: Generic Compiler Characteristics.
  19166. (line 42)
  19167. * AC_CONFIG_AUX_DIR: Input. (line 20)
  19168. * AC_CONFIG_COMMANDS: Configuration Commands.
  19169. (line 13)
  19170. * AC_CONFIG_COMMANDS_POST: Configuration Commands.
  19171. (line 41)
  19172. * AC_CONFIG_COMMANDS_PRE: Configuration Commands.
  19173. (line 35)
  19174. * AC_CONFIG_FILES: Configuration Files. (line 9)
  19175. * AC_CONFIG_HEADERS: Configuration Headers.
  19176. (line 33)
  19177. * AC_CONFIG_ITEMS: Configuration Actions.
  19178. (line 12)
  19179. * AC_CONFIG_LIBOBJ_DIR: Generic Functions. (line 97)
  19180. * AC_CONFIG_LINKS: Configuration Links. (line 12)
  19181. * AC_CONFIG_MACRO_DIR: Input. (line 48)
  19182. * AC_CONFIG_SRCDIR: Input. (line 7)
  19183. * AC_CONFIG_SUBDIRS: Subdirectories. (line 12)
  19184. * AC_CONFIG_TESTDIR: Making testsuite Scripts.
  19185. (line 26)
  19186. * AC_CONST: Obsolete Macros. (line 117)
  19187. * AC_COPYRIGHT: Notices. (line 10)
  19188. * AC_CROSS_CHECK: Obsolete Macros. (line 120)
  19189. * AC_CYGWIN: Obsolete Macros. (line 124)
  19190. * AC_DATAROOTDIR_CHECKED: Changed Directory Variables.
  19191. (line 58)
  19192. * AC_DECL_SYS_SIGLIST: Obsolete Macros. (line 141)
  19193. * AC_DECL_YYTEXT: Obsolete Macros. (line 154)
  19194. * AC_DEFINE: Defining Symbols. (line 32)
  19195. * AC_DEFINE_UNQUOTED: Defining Symbols. (line 74)
  19196. * AC_DEFUN: Macro Definitions. (line 7)
  19197. * AC_DEFUN_ONCE: One-Shot Macros. (line 14)
  19198. * AC_DIAGNOSE: Reporting Messages. (line 18)
  19199. * AC_DIR_HEADER: Obsolete Macros. (line 158)
  19200. * AC_DISABLE_OPTION_CHECKING: Option Checking. (line 28)
  19201. * AC_DYNIX_SEQ: Obsolete Macros. (line 170)
  19202. * AC_EGREP_CPP: Running the Preprocessor.
  19203. (line 74)
  19204. * AC_EGREP_HEADER: Running the Preprocessor.
  19205. (line 67)
  19206. * AC_EMXOS2: Obsolete Macros. (line 183)
  19207. * AC_ENABLE: Obsolete Macros. (line 189)
  19208. * AC_ERLANG_CHECK_LIB: Erlang Libraries. (line 36)
  19209. * AC_ERLANG_NEED_ERL: Erlang Compiler and Interpreter.
  19210. (line 41)
  19211. * AC_ERLANG_NEED_ERLC: Erlang Compiler and Interpreter.
  19212. (line 24)
  19213. * AC_ERLANG_PATH_ERL: Erlang Compiler and Interpreter.
  19214. (line 29)
  19215. * AC_ERLANG_PATH_ERLC: Erlang Compiler and Interpreter.
  19216. (line 10)
  19217. * AC_ERLANG_SUBST_ERTS_VER: Erlang Libraries. (line 12)
  19218. * AC_ERLANG_SUBST_INSTALL_LIB_DIR <1>: Erlang Libraries. (line 86)
  19219. * AC_ERLANG_SUBST_INSTALL_LIB_DIR: Installation Directory Variables.
  19220. (line 201)
  19221. * AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR <1>: Erlang Libraries. (line 93)
  19222. * AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR: Installation Directory Variables.
  19223. (line 206)
  19224. * AC_ERLANG_SUBST_LIB_DIR: Erlang Libraries. (line 28)
  19225. * AC_ERLANG_SUBST_ROOT_DIR: Erlang Libraries. (line 22)
  19226. * AC_ERROR: Obsolete Macros. (line 193)
  19227. * AC_EXEEXT: Obsolete Macros. (line 178)
  19228. * AC_F77_DUMMY_MAIN: Fortran Compiler. (line 130)
  19229. * AC_F77_FUNC: Fortran Compiler. (line 266)
  19230. * AC_F77_IMPLICIT_NONE: Fortran Compiler. (line 427)
  19231. * AC_F77_LIBRARY_LDFLAGS: Fortran Compiler. (line 92)
  19232. * AC_F77_MAIN: Fortran Compiler. (line 176)
  19233. * AC_F77_WRAPPERS: Fortran Compiler. (line 202)
  19234. * AC_FATAL: Reporting Messages. (line 34)
  19235. * AC_FC_CHECK_BOUNDS: Fortran Compiler. (line 413)
  19236. * AC_FC_DUMMY_MAIN: Fortran Compiler. (line 130)
  19237. * AC_FC_FIXEDFORM: Fortran Compiler. (line 375)
  19238. * AC_FC_FREEFORM: Fortran Compiler. (line 351)
  19239. * AC_FC_FUNC: Fortran Compiler. (line 266)
  19240. * AC_FC_IMPLICIT_NONE: Fortran Compiler. (line 427)
  19241. * AC_FC_LIBRARY_LDFLAGS: Fortran Compiler. (line 92)
  19242. * AC_FC_LINE_LENGTH: Fortran Compiler. (line 396)
  19243. * AC_FC_MAIN: Fortran Compiler. (line 176)
  19244. * AC_FC_MODULE_EXTENSION: Fortran Compiler. (line 438)
  19245. * AC_FC_MODULE_FLAG: Fortran Compiler. (line 465)
  19246. * AC_FC_MODULE_OUTPUT_FLAG: Fortran Compiler. (line 501)
  19247. * AC_FC_PP_DEFINE: Fortran Compiler. (line 336)
  19248. * AC_FC_PP_SRCEXT: Fortran Compiler. (line 279)
  19249. * AC_FC_SRCEXT: Fortran Compiler. (line 279)
  19250. * AC_FC_WRAPPERS: Fortran Compiler. (line 202)
  19251. * AC_FIND_X: Obsolete Macros. (line 196)
  19252. * AC_FIND_XTRA: Obsolete Macros. (line 199)
  19253. * AC_FOREACH: Obsolete Macros. (line 202)
  19254. * AC_FUNC_ALLOCA: Particular Functions.
  19255. (line 10)
  19256. * AC_FUNC_CHECK: Obsolete Macros. (line 205)
  19257. * AC_FUNC_CHOWN: Particular Functions.
  19258. (line 63)
  19259. * AC_FUNC_CLOSEDIR_VOID: Particular Functions.
  19260. (line 69)
  19261. * AC_FUNC_ERROR_AT_LINE: Particular Functions.
  19262. (line 84)
  19263. * AC_FUNC_FNMATCH: Particular Functions.
  19264. (line 94)
  19265. * AC_FUNC_FNMATCH_GNU: Particular Functions.
  19266. (line 109)
  19267. * AC_FUNC_FORK: Particular Functions.
  19268. (line 120)
  19269. * AC_FUNC_FSEEKO: Particular Functions.
  19270. (line 147)
  19271. * AC_FUNC_GETGROUPS: Particular Functions.
  19272. (line 155)
  19273. * AC_FUNC_GETLOADAVG: Particular Functions.
  19274. (line 161)
  19275. * AC_FUNC_GETMNTENT: Particular Functions.
  19276. (line 195)
  19277. * AC_FUNC_GETPGRP: Particular Functions.
  19278. (line 205)
  19279. * AC_FUNC_LSTAT: Particular Functions.
  19280. (line 363)
  19281. * AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK: Particular Functions.
  19282. (line 228)
  19283. * AC_FUNC_MALLOC: Particular Functions.
  19284. (line 247)
  19285. * AC_FUNC_MBRTOWC: Particular Functions.
  19286. (line 279)
  19287. * AC_FUNC_MEMCMP: Particular Functions.
  19288. (line 286)
  19289. * AC_FUNC_MKTIME: Particular Functions.
  19290. (line 299)
  19291. * AC_FUNC_MMAP: Particular Functions.
  19292. (line 311)
  19293. * AC_FUNC_OBSTACK: Particular Functions.
  19294. (line 319)
  19295. * AC_FUNC_REALLOC: Particular Functions.
  19296. (line 326)
  19297. * AC_FUNC_SELECT_ARGTYPES: Particular Functions.
  19298. (line 337)
  19299. * AC_FUNC_SETPGRP: Particular Functions.
  19300. (line 348)
  19301. * AC_FUNC_SETVBUF_REVERSED: Obsolete Macros. (line 208)
  19302. * AC_FUNC_STAT: Particular Functions.
  19303. (line 363)
  19304. * AC_FUNC_STRCOLL: Particular Functions.
  19305. (line 379)
  19306. * AC_FUNC_STRERROR_R: Particular Functions.
  19307. (line 388)
  19308. * AC_FUNC_STRFTIME: Particular Functions.
  19309. (line 401)
  19310. * AC_FUNC_STRNLEN: Particular Functions.
  19311. (line 426)
  19312. * AC_FUNC_STRTOD: Particular Functions.
  19313. (line 408)
  19314. * AC_FUNC_STRTOLD: Particular Functions.
  19315. (line 420)
  19316. * AC_FUNC_UTIME_NULL: Particular Functions.
  19317. (line 433)
  19318. * AC_FUNC_VPRINTF: Particular Functions.
  19319. (line 443)
  19320. * AC_FUNC_WAIT3: Obsolete Macros. (line 216)
  19321. * AC_GCC_TRADITIONAL: Obsolete Macros. (line 224)
  19322. * AC_GETGROUPS_T: Obsolete Macros. (line 228)
  19323. * AC_GETLOADAVG: Obsolete Macros. (line 231)
  19324. * AC_GNU_SOURCE: Obsolete Macros. (line 234)
  19325. * AC_HAVE_FUNCS: Obsolete Macros. (line 238)
  19326. * AC_HAVE_HEADERS: Obsolete Macros. (line 241)
  19327. * AC_HAVE_LIBRARY: Obsolete Macros. (line 245)
  19328. * AC_HAVE_POUNDBANG: Obsolete Macros. (line 252)
  19329. * AC_HEADER_ASSERT: Particular Headers. (line 20)
  19330. * AC_HEADER_CHECK: Obsolete Macros. (line 255)
  19331. * AC_HEADER_DIRENT: Particular Headers. (line 25)
  19332. * AC_HEADER_EGREP: Obsolete Macros. (line 258)
  19333. * AC_HEADER_MAJOR: Particular Headers. (line 68)
  19334. * AC_HEADER_RESOLV: Particular Headers. (line 73)
  19335. * AC_HEADER_STAT: Particular Headers. (line 92)
  19336. * AC_HEADER_STDBOOL: Particular Headers. (line 101)
  19337. * AC_HEADER_STDC: Particular Headers. (line 135)
  19338. * AC_HEADER_SYS_WAIT: Particular Headers. (line 204)
  19339. * AC_HEADER_TIME: Particular Headers. (line 244)
  19340. * AC_HEADER_TIOCGWINSZ: Particular Headers. (line 270)
  19341. * AC_HELP_STRING: Obsolete Macros. (line 261)
  19342. * AC_INCLUDES_DEFAULT: Default Includes. (line 29)
  19343. * AC_INIT <1>: Obsolete Macros. (line 264)
  19344. * AC_INIT: Initializing configure.
  19345. (line 14)
  19346. * AC_INLINE: Obsolete Macros. (line 272)
  19347. * AC_INT_16_BITS: Obsolete Macros. (line 275)
  19348. * AC_IRIX_SUN: Obsolete Macros. (line 279)
  19349. * AC_ISC_POSIX: Obsolete Macros. (line 295)
  19350. * AC_LANG: Language Choice. (line 14)
  19351. * AC_LANG_ASSERT: Language Choice. (line 79)
  19352. * AC_LANG_C: Obsolete Macros. (line 302)
  19353. * AC_LANG_CALL: Generating Sources. (line 142)
  19354. * AC_LANG_CONFTEST: Generating Sources. (line 12)
  19355. * AC_LANG_CPLUSPLUS: Obsolete Macros. (line 305)
  19356. * AC_LANG_DEFINES_PROVIDED: Generating Sources. (line 31)
  19357. * AC_LANG_FORTRAN77: Obsolete Macros. (line 308)
  19358. * AC_LANG_FUNC_LINK_TRY: Generating Sources. (line 154)
  19359. * AC_LANG_POP: Language Choice. (line 66)
  19360. * AC_LANG_PROGRAM: Generating Sources. (line 78)
  19361. * AC_LANG_PUSH: Language Choice. (line 61)
  19362. * AC_LANG_RESTORE: Obsolete Macros. (line 311)
  19363. * AC_LANG_SAVE: Obsolete Macros. (line 317)
  19364. * AC_LANG_SOURCE: Generating Sources. (line 40)
  19365. * AC_LANG_WERROR: Generic Compiler Characteristics.
  19366. (line 54)
  19367. * AC_LIBOBJ: Generic Functions. (line 56)
  19368. * AC_LIBSOURCE: Generic Functions. (line 65)
  19369. * AC_LIBSOURCES: Generic Functions. (line 89)
  19370. * AC_LINK_FILES: Obsolete Macros. (line 322)
  19371. * AC_LINK_IFELSE: Running the Linker. (line 24)
  19372. * AC_LN_S: Obsolete Macros. (line 334)
  19373. * AC_LONG_64_BITS: Obsolete Macros. (line 337)
  19374. * AC_LONG_DOUBLE: Obsolete Macros. (line 342)
  19375. * AC_LONG_FILE_NAMES: Obsolete Macros. (line 350)
  19376. * AC_MAJOR_HEADER: Obsolete Macros. (line 355)
  19377. * AC_MEMORY_H: Obsolete Macros. (line 358)
  19378. * AC_MINGW32: Obsolete Macros. (line 365)
  19379. * AC_MINIX: Obsolete Macros. (line 371)
  19380. * AC_MINUS_C_MINUS_O: Obsolete Macros. (line 375)
  19381. * AC_MMAP: Obsolete Macros. (line 378)
  19382. * AC_MODE_T: Obsolete Macros. (line 381)
  19383. * AC_MSG_CHECKING: Printing Messages. (line 24)
  19384. * AC_MSG_ERROR: Printing Messages. (line 56)
  19385. * AC_MSG_FAILURE: Printing Messages. (line 66)
  19386. * AC_MSG_NOTICE: Printing Messages. (line 46)
  19387. * AC_MSG_RESULT: Printing Messages. (line 35)
  19388. * AC_MSG_WARN: Printing Messages. (line 72)
  19389. * AC_OBJEXT: Obsolete Macros. (line 384)
  19390. * AC_OBSOLETE: Obsolete Macros. (line 390)
  19391. * AC_OFF_T: Obsolete Macros. (line 405)
  19392. * AC_OPENMP: Generic Compiler Characteristics.
  19393. (line 64)
  19394. * AC_OUTPUT <1>: Obsolete Macros. (line 408)
  19395. * AC_OUTPUT: Output. (line 13)
  19396. * AC_OUTPUT_COMMANDS: Obsolete Macros. (line 420)
  19397. * AC_PACKAGE_BUGREPORT: Initializing configure.
  19398. (line 57)
  19399. * AC_PACKAGE_NAME: Initializing configure.
  19400. (line 45)
  19401. * AC_PACKAGE_STRING: Initializing configure.
  19402. (line 54)
  19403. * AC_PACKAGE_TARNAME: Initializing configure.
  19404. (line 48)
  19405. * AC_PACKAGE_URL: Initializing configure.
  19406. (line 61)
  19407. * AC_PACKAGE_VERSION: Initializing configure.
  19408. (line 51)
  19409. * AC_PATH_PROG: Generic Programs. (line 108)
  19410. * AC_PATH_PROGS: Generic Programs. (line 115)
  19411. * AC_PATH_PROGS_FEATURE_CHECK: Generic Programs. (line 123)
  19412. * AC_PATH_TARGET_TOOL: Generic Programs. (line 159)
  19413. * AC_PATH_TOOL: Generic Programs. (line 164)
  19414. * AC_PATH_X: System Services. (line 10)
  19415. * AC_PATH_XTRA: System Services. (line 30)
  19416. * AC_PID_T: Obsolete Macros. (line 450)
  19417. * AC_PREFIX: Obsolete Macros. (line 453)
  19418. * AC_PREFIX_DEFAULT: Default Prefix. (line 16)
  19419. * AC_PREFIX_PROGRAM: Default Prefix. (line 25)
  19420. * AC_PREPROC_IFELSE: Running the Preprocessor.
  19421. (line 20)
  19422. * AC_PREREQ: Versioning. (line 11)
  19423. * AC_PRESERVE_HELP_ORDER: Help Formatting. (line 20)
  19424. * AC_PROG_AWK: Particular Programs. (line 10)
  19425. * AC_PROG_CC: C Compiler. (line 61)
  19426. * AC_PROG_CC_C89: C Compiler. (line 147)
  19427. * AC_PROG_CC_C99: C Compiler. (line 161)
  19428. * AC_PROG_CC_C_O: C Compiler. (line 102)
  19429. * AC_PROG_CC_STDC: C Compiler. (line 137)
  19430. * AC_PROG_CPP: C Compiler. (line 113)
  19431. * AC_PROG_CPP_WERROR: C Compiler. (line 126)
  19432. * AC_PROG_CXX: C++ Compiler. (line 7)
  19433. * AC_PROG_CXX_C_O: C++ Compiler. (line 48)
  19434. * AC_PROG_CXXCPP: C++ Compiler. (line 35)
  19435. * AC_PROG_EGREP: Particular Programs. (line 29)
  19436. * AC_PROG_F77: Fortran Compiler. (line 19)
  19437. * AC_PROG_F77_C_O: Fortran Compiler. (line 76)
  19438. * AC_PROG_FC: Fortran Compiler. (line 44)
  19439. * AC_PROG_FC_C_O: Fortran Compiler. (line 76)
  19440. * AC_PROG_FGREP: Particular Programs. (line 36)
  19441. * AC_PROG_GCC_TRADITIONAL: C Compiler. (line 361)
  19442. * AC_PROG_GREP: Particular Programs. (line 20)
  19443. * AC_PROG_INSTALL: Particular Programs. (line 43)
  19444. * AC_PROG_LEX: Particular Programs. (line 114)
  19445. * AC_PROG_LN_S: Particular Programs. (line 168)
  19446. * AC_PROG_MAKE_SET: Output. (line 45)
  19447. * AC_PROG_MKDIR_P: Particular Programs. (line 80)
  19448. * AC_PROG_OBJC: Objective C Compiler.
  19449. (line 7)
  19450. * AC_PROG_OBJCPP: Objective C Compiler.
  19451. (line 26)
  19452. * AC_PROG_OBJCXX: Objective C++ Compiler.
  19453. (line 7)
  19454. * AC_PROG_OBJCXXCPP: Objective C++ Compiler.
  19455. (line 27)
  19456. * AC_PROG_RANLIB: Particular Programs. (line 187)
  19457. * AC_PROG_SED: Particular Programs. (line 191)
  19458. * AC_PROG_YACC: Particular Programs. (line 200)
  19459. * AC_PROGRAM_CHECK: Obsolete Macros. (line 462)
  19460. * AC_PROGRAM_EGREP: Obsolete Macros. (line 465)
  19461. * AC_PROGRAM_PATH: Obsolete Macros. (line 468)
  19462. * AC_PROGRAMS_CHECK: Obsolete Macros. (line 456)
  19463. * AC_PROGRAMS_PATH: Obsolete Macros. (line 459)
  19464. * AC_REMOTE_TAPE: Obsolete Macros. (line 471)
  19465. * AC_REPLACE_FNMATCH: Particular Functions.
  19466. (line 452)
  19467. * AC_REPLACE_FUNCS: Generic Functions. (line 117)
  19468. * AC_REQUIRE: Prerequisite Macros. (line 17)
  19469. * AC_REQUIRE_AUX_FILE: Input. (line 37)
  19470. * AC_REQUIRE_CPP: Language Choice. (line 94)
  19471. * AC_RESTARTABLE_SYSCALLS: Obsolete Macros. (line 474)
  19472. * AC_RETSIGTYPE: Obsolete Macros. (line 482)
  19473. * AC_REVISION: Notices. (line 18)
  19474. * AC_RSH: Obsolete Macros. (line 486)
  19475. * AC_RUN_IFELSE: Runtime. (line 20)
  19476. * AC_SCO_INTL: Obsolete Macros. (line 489)
  19477. * AC_SEARCH_LIBS: Libraries. (line 52)
  19478. * AC_SET_MAKE: Obsolete Macros. (line 503)
  19479. * AC_SETVBUF_REVERSED: Obsolete Macros. (line 498)
  19480. * AC_SIZE_T: Obsolete Macros. (line 509)
  19481. * AC_SIZEOF_TYPE: Obsolete Macros. (line 506)
  19482. * AC_ST_BLKSIZE: Obsolete Macros. (line 539)
  19483. * AC_ST_BLOCKS: Obsolete Macros. (line 542)
  19484. * AC_ST_RDEV: Obsolete Macros. (line 545)
  19485. * AC_STAT_MACROS_BROKEN: Obsolete Macros. (line 512)
  19486. * AC_STDC_HEADERS: Obsolete Macros. (line 515)
  19487. * AC_STRCOLL: Obsolete Macros. (line 518)
  19488. * AC_STRUCT_DIRENT_D_INO: Particular Structures.
  19489. (line 9)
  19490. * AC_STRUCT_DIRENT_D_TYPE: Particular Structures.
  19491. (line 21)
  19492. * AC_STRUCT_ST_BLKSIZE: Obsolete Macros. (line 521)
  19493. * AC_STRUCT_ST_BLOCKS: Particular Structures.
  19494. (line 26)
  19495. * AC_STRUCT_ST_RDEV: Obsolete Macros. (line 530)
  19496. * AC_STRUCT_TIMEZONE: Particular Structures.
  19497. (line 43)
  19498. * AC_STRUCT_TM: Particular Structures.
  19499. (line 35)
  19500. * AC_SUBST: Setting Output Variables.
  19501. (line 13)
  19502. * AC_SUBST_FILE: Setting Output Variables.
  19503. (line 38)
  19504. * AC_SYS_INTERPRETER: System Services. (line 42)
  19505. * AC_SYS_LARGEFILE: System Services. (line 49)
  19506. * AC_SYS_LONG_FILE_NAMES: System Services. (line 71)
  19507. * AC_SYS_POSIX_TERMIOS: System Services. (line 75)
  19508. * AC_SYS_RESTARTABLE_SYSCALLS: Obsolete Macros. (line 548)
  19509. * AC_SYS_SIGLIST_DECLARED: Obsolete Macros. (line 563)
  19510. * AC_TEST_CPP: Obsolete Macros. (line 568)
  19511. * AC_TEST_PROGRAM: Obsolete Macros. (line 572)
  19512. * AC_TIME_WITH_SYS_TIME: Obsolete Macros. (line 579)
  19513. * AC_TIMEZONE: Obsolete Macros. (line 576)
  19514. * AC_TRY_ACT: AC_ACT_IFELSE vs AC_TRY_ACT.
  19515. (line 6)
  19516. * AC_TRY_COMPILE: Obsolete Macros. (line 583)
  19517. * AC_TRY_CPP: Obsolete Macros. (line 602)
  19518. * AC_TRY_LINK: Obsolete Macros. (line 615)
  19519. * AC_TRY_LINK_FUNC: Obsolete Macros. (line 644)
  19520. * AC_TRY_RUN: Obsolete Macros. (line 651)
  19521. * AC_TYPE_GETGROUPS: Particular Types. (line 14)
  19522. * AC_TYPE_INT16_T: Particular Types. (line 40)
  19523. * AC_TYPE_INT32_T: Particular Types. (line 43)
  19524. * AC_TYPE_INT64_T: Particular Types. (line 46)
  19525. * AC_TYPE_INT8_T: Particular Types. (line 21)
  19526. * AC_TYPE_INTMAX_T: Particular Types. (line 49)
  19527. * AC_TYPE_INTPTR_T: Particular Types. (line 54)
  19528. * AC_TYPE_LONG_DOUBLE: Particular Types. (line 59)
  19529. * AC_TYPE_LONG_DOUBLE_WIDER: Particular Types. (line 70)
  19530. * AC_TYPE_LONG_LONG_INT: Particular Types. (line 78)
  19531. * AC_TYPE_MBSTATE_T: Particular Types. (line 88)
  19532. * AC_TYPE_MODE_T: Particular Types. (line 96)
  19533. * AC_TYPE_OFF_T: Particular Types. (line 102)
  19534. * AC_TYPE_PID_T: Particular Types. (line 108)
  19535. * AC_TYPE_SIGNAL: Obsolete Macros. (line 662)
  19536. * AC_TYPE_SIZE_T: Particular Types. (line 114)
  19537. * AC_TYPE_SSIZE_T: Particular Types. (line 120)
  19538. * AC_TYPE_UID_T: Particular Types. (line 126)
  19539. * AC_TYPE_UINT16_T: Particular Types. (line 138)
  19540. * AC_TYPE_UINT32_T: Particular Types. (line 141)
  19541. * AC_TYPE_UINT64_T: Particular Types. (line 144)
  19542. * AC_TYPE_UINT8_T: Particular Types. (line 132)
  19543. * AC_TYPE_UINTMAX_T: Particular Types. (line 147)
  19544. * AC_TYPE_UINTPTR_T: Particular Types. (line 152)
  19545. * AC_TYPE_UNSIGNED_LONG_LONG_INT: Particular Types. (line 157)
  19546. * AC_UID_T: Obsolete Macros. (line 679)
  19547. * AC_UNISTD_H: Obsolete Macros. (line 682)
  19548. * AC_USE_SYSTEM_EXTENSIONS: Posix Variants. (line 10)
  19549. * AC_USG: Obsolete Macros. (line 685)
  19550. * AC_UTIME_NULL: Obsolete Macros. (line 690)
  19551. * AC_VALIDATE_CACHED_SYSTEM_TUPLE: Obsolete Macros. (line 693)
  19552. * AC_VERBOSE: Obsolete Macros. (line 698)
  19553. * AC_VFORK: Obsolete Macros. (line 701)
  19554. * AC_VPRINTF: Obsolete Macros. (line 704)
  19555. * AC_WAIT3: Obsolete Macros. (line 707)
  19556. * AC_WARN: Obsolete Macros. (line 712)
  19557. * AC_WARNING: Reporting Messages. (line 26)
  19558. * AC_WITH: Obsolete Macros. (line 715)
  19559. * AC_WORDS_BIGENDIAN: Obsolete Macros. (line 719)
  19560. * AC_XENIX_DIR: Obsolete Macros. (line 722)
  19561. * AC_YYTEXT_POINTER: Obsolete Macros. (line 739)
  19562. * AH_BOTTOM: Autoheader Macros. (line 50)
  19563. * AH_HEADER: Configuration Headers.
  19564. (line 54)
  19565. * AH_TEMPLATE: Autoheader Macros. (line 19)
  19566. * AH_TOP: Autoheader Macros. (line 47)
  19567. * AH_VERBATIM: Autoheader Macros. (line 40)
  19568. * AU_ALIAS: Obsoleting Macros. (line 34)
  19569. * AU_DEFUN: Obsoleting Macros. (line 18)
  19570. 
  19571. File: autoconf.info, Node: M4 Macro Index, Next: Autotest Macro Index, Prev: Autoconf Macro Index, Up: Indices
  19572. B.6 M4 Macro Index
  19573. ==================
  19574. This is an alphabetical list of the M4, M4sugar, and M4sh macros.
  19575. �[index�]
  19576. * Menu:
  19577. * __file__: Redefined M4 Macros. (line 65)
  19578. * __line__: Redefined M4 Macros. (line 65)
  19579. * __oline__: Redefined M4 Macros. (line 69)
  19580. * AS_BOURNE_COMPATIBLE: Initialization Macros.
  19581. (line 7)
  19582. * AS_BOX: Common Shell Constructs.
  19583. (line 10)
  19584. * AS_CASE: Common Shell Constructs.
  19585. (line 19)
  19586. * AS_DIRNAME: Common Shell Constructs.
  19587. (line 26)
  19588. * AS_ECHO: Common Shell Constructs.
  19589. (line 34)
  19590. * AS_ECHO_N: Common Shell Constructs.
  19591. (line 42)
  19592. * AS_ESCAPE: Common Shell Constructs.
  19593. (line 50)
  19594. * AS_EXECUTABLE_P: Common Shell Constructs.
  19595. (line 90)
  19596. * AS_EXIT: Common Shell Constructs.
  19597. (line 95)
  19598. * AS_HELP_STRING: Pretty Help Strings. (line 15)
  19599. * AS_IF: Common Shell Constructs.
  19600. (line 101)
  19601. * AS_INIT: Initialization Macros.
  19602. (line 14)
  19603. * AS_INIT_GENERATED: Initialization Macros.
  19604. (line 26)
  19605. * AS_LINENO_PREPARE: Initialization Macros.
  19606. (line 67)
  19607. * AS_LITERAL_IF: Polymorphic Variables.
  19608. (line 21)
  19609. * AS_LITERAL_WORD_IF: Polymorphic Variables.
  19610. (line 21)
  19611. * AS_ME_PREPARE: Initialization Macros.
  19612. (line 72)
  19613. * AS_MESSAGE_FD: File Descriptor Macros.
  19614. (line 17)
  19615. * AS_MESSAGE_LOG_FD: File Descriptor Macros.
  19616. (line 29)
  19617. * AS_MKDIR_P: Common Shell Constructs.
  19618. (line 115)
  19619. * AS_ORIGINAL_STDIN_FD: File Descriptor Macros.
  19620. (line 39)
  19621. * AS_SET_CATFILE: Common Shell Constructs.
  19622. (line 155)
  19623. * AS_SET_STATUS: Common Shell Constructs.
  19624. (line 127)
  19625. * AS_SHELL_SANITIZE: Initialization Macros.
  19626. (line 101)
  19627. * AS_TMPDIR: Initialization Macros.
  19628. (line 77)
  19629. * AS_TR_CPP: Common Shell Constructs.
  19630. (line 135)
  19631. * AS_TR_SH: Common Shell Constructs.
  19632. (line 144)
  19633. * AS_UNSET: Common Shell Constructs.
  19634. (line 159)
  19635. * AS_VAR_APPEND: Polymorphic Variables.
  19636. (line 63)
  19637. * AS_VAR_ARITH: Polymorphic Variables.
  19638. (line 85)
  19639. * AS_VAR_COPY: Polymorphic Variables.
  19640. (line 103)
  19641. * AS_VAR_IF: Polymorphic Variables.
  19642. (line 122)
  19643. * AS_VAR_POPDEF: Polymorphic Variables.
  19644. (line 131)
  19645. * AS_VAR_PUSHDEF: Polymorphic Variables.
  19646. (line 131)
  19647. * AS_VAR_SET: Polymorphic Variables.
  19648. (line 173)
  19649. * AS_VAR_SET_IF: Polymorphic Variables.
  19650. (line 183)
  19651. * AS_VAR_TEST_SET: Polymorphic Variables.
  19652. (line 188)
  19653. * AS_VERSION_COMPARE: Common Shell Constructs.
  19654. (line 165)
  19655. * dnl: Redefined M4 Macros. (line 76)
  19656. * m4_append: Text processing Macros.
  19657. (line 16)
  19658. * m4_append_uniq: Text processing Macros.
  19659. (line 16)
  19660. * m4_append_uniq_w: Text processing Macros.
  19661. (line 69)
  19662. * m4_apply: Evaluation Macros. (line 10)
  19663. * m4_argn: Looping constructs. (line 29)
  19664. * m4_assert: Diagnostic Macros. (line 11)
  19665. * m4_bmatch: Conditional constructs.
  19666. (line 11)
  19667. * m4_bpatsubst: Redefined M4 Macros. (line 79)
  19668. * m4_bpatsubsts: Conditional constructs.
  19669. (line 18)
  19670. * m4_bregexp: Redefined M4 Macros. (line 84)
  19671. * m4_builtin: Redefined M4 Macros. (line 6)
  19672. * m4_car: Looping constructs. (line 35)
  19673. * m4_case: Conditional constructs.
  19674. (line 33)
  19675. * m4_cdr: Looping constructs. (line 41)
  19676. * m4_changecom: Redefined M4 Macros. (line 6)
  19677. * m4_changequote: Redefined M4 Macros. (line 6)
  19678. * m4_chomp: Text processing Macros.
  19679. (line 80)
  19680. * m4_chomp_all: Text processing Macros.
  19681. (line 80)
  19682. * m4_cleardivert: Diversion support. (line 125)
  19683. * m4_cmp: Number processing Macros.
  19684. (line 11)
  19685. * m4_combine: Text processing Macros.
  19686. (line 88)
  19687. * m4_cond: Conditional constructs.
  19688. (line 42)
  19689. * m4_copy: Redefined M4 Macros. (line 92)
  19690. * m4_copy_force: Redefined M4 Macros. (line 92)
  19691. * m4_count: Evaluation Macros. (line 26)
  19692. * m4_curry: Evaluation Macros. (line 30)
  19693. * m4_debugfile: Redefined M4 Macros. (line 6)
  19694. * m4_debugmode: Redefined M4 Macros. (line 6)
  19695. * m4_decr: Redefined M4 Macros. (line 6)
  19696. * m4_default: Conditional constructs.
  19697. (line 73)
  19698. * m4_default_nblank: Conditional constructs.
  19699. (line 73)
  19700. * m4_default_nblank_quoted: Conditional constructs.
  19701. (line 73)
  19702. * m4_default_quoted: Conditional constructs.
  19703. (line 73)
  19704. * m4_define: Redefined M4 Macros. (line 6)
  19705. * m4_define_default: Conditional constructs.
  19706. (line 122)
  19707. * m4_defn: Redefined M4 Macros. (line 111)
  19708. * m4_divert: Redefined M4 Macros. (line 119)
  19709. * m4_divert_once: Diversion support. (line 128)
  19710. * m4_divert_pop: Diversion support. (line 133)
  19711. * m4_divert_push: Diversion support. (line 139)
  19712. * m4_divert_text: Diversion support. (line 145)
  19713. * m4_divnum: Redefined M4 Macros. (line 6)
  19714. * m4_do: Evaluation Macros. (line 45)
  19715. * m4_dquote: Evaluation Macros. (line 65)
  19716. * m4_dquote_elt: Evaluation Macros. (line 70)
  19717. * m4_dumpdef: Redefined M4 Macros. (line 131)
  19718. * m4_dumpdefs: Redefined M4 Macros. (line 131)
  19719. * m4_echo: Evaluation Macros. (line 75)
  19720. * m4_errprint: Redefined M4 Macros. (line 6)
  19721. * m4_errprintn: Diagnostic Macros. (line 16)
  19722. * m4_escape: Text processing Macros.
  19723. (line 108)
  19724. * m4_esyscmd: Redefined M4 Macros. (line 6)
  19725. * m4_esyscmd_s: Redefined M4 Macros. (line 148)
  19726. * m4_eval: Redefined M4 Macros. (line 6)
  19727. * m4_exit: Redefined M4 Macros. (line 154)
  19728. * m4_expand: Evaluation Macros. (line 79)
  19729. * m4_fatal: Diagnostic Macros. (line 20)
  19730. * m4_flatten: Text processing Macros.
  19731. (line 113)
  19732. * m4_for: Looping constructs. (line 59)
  19733. * m4_foreach: Looping constructs. (line 69)
  19734. * m4_foreach_w: Looping constructs. (line 83)
  19735. * m4_format: Redefined M4 Macros. (line 6)
  19736. * m4_if: Redefined M4 Macros. (line 160)
  19737. * m4_ifblank: Conditional constructs.
  19738. (line 127)
  19739. * m4_ifdef: Redefined M4 Macros. (line 6)
  19740. * m4_ifnblank: Conditional constructs.
  19741. (line 127)
  19742. * m4_ifndef: Conditional constructs.
  19743. (line 135)
  19744. * m4_ifset: Conditional constructs.
  19745. (line 139)
  19746. * m4_ifval: Conditional constructs.
  19747. (line 145)
  19748. * m4_ifvaln: Conditional constructs.
  19749. (line 150)
  19750. * m4_ignore: Evaluation Macros. (line 129)
  19751. * m4_include: Redefined M4 Macros. (line 167)
  19752. * m4_incr: Redefined M4 Macros. (line 6)
  19753. * m4_index: Redefined M4 Macros. (line 6)
  19754. * m4_indir: Redefined M4 Macros. (line 6)
  19755. * m4_init: Diversion support. (line 171)
  19756. * m4_join: Text processing Macros.
  19757. (line 119)
  19758. * m4_joinall: Text processing Macros.
  19759. (line 119)
  19760. * m4_len: Redefined M4 Macros. (line 6)
  19761. * m4_list_cmp: Number processing Macros.
  19762. (line 16)
  19763. * m4_location: Diagnostic Macros. (line 24)
  19764. * m4_make_list: Evaluation Macros. (line 142)
  19765. * m4_maketemp: Redefined M4 Macros. (line 171)
  19766. * m4_map: Looping constructs. (line 93)
  19767. * m4_map_args: Looping constructs. (line 130)
  19768. * m4_map_args_pair: Looping constructs. (line 166)
  19769. * m4_map_args_sep: Looping constructs. (line 178)
  19770. * m4_map_args_w: Looping constructs. (line 189)
  19771. * m4_map_sep: Looping constructs. (line 93)
  19772. * m4_mapall: Looping constructs. (line 93)
  19773. * m4_mapall_sep: Looping constructs. (line 93)
  19774. * m4_max: Number processing Macros.
  19775. (line 38)
  19776. * m4_min: Number processing Macros.
  19777. (line 42)
  19778. * m4_mkstemp: Redefined M4 Macros. (line 171)
  19779. * m4_n: Conditional constructs.
  19780. (line 154)
  19781. * m4_newline: Text processing Macros.
  19782. (line 134)
  19783. * m4_normalize: Text processing Macros.
  19784. (line 140)
  19785. * m4_pattern_allow: Forbidden Patterns. (line 30)
  19786. * m4_pattern_forbid: Forbidden Patterns. (line 17)
  19787. * m4_popdef: Redefined M4 Macros. (line 182)
  19788. * m4_pushdef: Redefined M4 Macros. (line 6)
  19789. * m4_quote: Evaluation Macros. (line 161)
  19790. * m4_re_escape: Text processing Macros.
  19791. (line 148)
  19792. * m4_rename: Redefined M4 Macros. (line 92)
  19793. * m4_rename_force: Redefined M4 Macros. (line 92)
  19794. * m4_reverse: Evaluation Macros. (line 167)
  19795. * m4_set_add: Set manipulation Macros.
  19796. (line 19)
  19797. * m4_set_add_all: Set manipulation Macros.
  19798. (line 25)
  19799. * m4_set_contains: Set manipulation Macros.
  19800. (line 29)
  19801. * m4_set_contents: Set manipulation Macros.
  19802. (line 49)
  19803. * m4_set_delete: Set manipulation Macros.
  19804. (line 79)
  19805. * m4_set_difference: Set manipulation Macros.
  19806. (line 86)
  19807. * m4_set_dump: Set manipulation Macros.
  19808. (line 49)
  19809. * m4_set_empty: Set manipulation Macros.
  19810. (line 109)
  19811. * m4_set_foreach: Set manipulation Macros.
  19812. (line 115)
  19813. * m4_set_intersection: Set manipulation Macros.
  19814. (line 86)
  19815. * m4_set_list: Set manipulation Macros.
  19816. (line 136)
  19817. * m4_set_listc: Set manipulation Macros.
  19818. (line 136)
  19819. * m4_set_map: Set manipulation Macros.
  19820. (line 171)
  19821. * m4_set_map_sep: Set manipulation Macros.
  19822. (line 184)
  19823. * m4_set_remove: Set manipulation Macros.
  19824. (line 195)
  19825. * m4_set_size: Set manipulation Macros.
  19826. (line 206)
  19827. * m4_set_union: Set manipulation Macros.
  19828. (line 86)
  19829. * m4_shift: Redefined M4 Macros. (line 6)
  19830. * m4_shift2: Looping constructs. (line 199)
  19831. * m4_shift3: Looping constructs. (line 199)
  19832. * m4_shiftn: Looping constructs. (line 199)
  19833. * m4_sign: Number processing Macros.
  19834. (line 46)
  19835. * m4_sinclude: Redefined M4 Macros. (line 167)
  19836. * m4_split: Text processing Macros.
  19837. (line 152)
  19838. * m4_stack_foreach: Looping constructs. (line 208)
  19839. * m4_stack_foreach_lifo: Looping constructs. (line 208)
  19840. * m4_stack_foreach_sep: Looping constructs. (line 230)
  19841. * m4_stack_foreach_sep_lifo: Looping constructs. (line 230)
  19842. * m4_strip: Text processing Macros.
  19843. (line 158)
  19844. * m4_substr: Redefined M4 Macros. (line 6)
  19845. * m4_syscmd: Redefined M4 Macros. (line 6)
  19846. * m4_sysval: Redefined M4 Macros. (line 6)
  19847. * m4_text_box: Text processing Macros.
  19848. (line 167)
  19849. * m4_text_wrap: Text processing Macros.
  19850. (line 182)
  19851. * m4_tolower: Text processing Macros.
  19852. (line 213)
  19853. * m4_toupper: Text processing Macros.
  19854. (line 213)
  19855. * m4_traceoff: Redefined M4 Macros. (line 6)
  19856. * m4_traceon: Redefined M4 Macros. (line 6)
  19857. * m4_translit: Redefined M4 Macros. (line 6)
  19858. * m4_undefine: Redefined M4 Macros. (line 186)
  19859. * m4_undivert: Redefined M4 Macros. (line 194)
  19860. * m4_unquote: Evaluation Macros. (line 176)
  19861. * m4_version_compare: Number processing Macros.
  19862. (line 50)
  19863. * m4_version_prereq: Number processing Macros.
  19864. (line 90)
  19865. * m4_warn: Diagnostic Macros. (line 28)
  19866. * m4_wrap: Redefined M4 Macros. (line 204)
  19867. * m4_wrap_lifo: Redefined M4 Macros. (line 204)
  19868. 
  19869. File: autoconf.info, Node: Autotest Macro Index, Next: Program & Function Index, Prev: M4 Macro Index, Up: Indices
  19870. B.7 Autotest Macro Index
  19871. ========================
  19872. This is an alphabetical list of the Autotest macros.
  19873. �[index�]
  19874. * Menu:
  19875. * AT_ARG_OPTION: Writing Testsuites. (line 50)
  19876. * AT_ARG_OPTION_ARG: Writing Testsuites. (line 79)
  19877. * AT_BANNER: Writing Testsuites. (line 124)
  19878. * AT_CAPTURE_FILE: Writing Testsuites. (line 155)
  19879. * AT_CHECK: Writing Testsuites. (line 212)
  19880. * AT_CHECK_EUNIT: Writing Testsuites. (line 302)
  19881. * AT_CHECK_UNQUOTED: Writing Testsuites. (line 212)
  19882. * AT_CLEANUP: Writing Testsuites. (line 198)
  19883. * AT_COLOR_TESTS: Writing Testsuites. (line 105)
  19884. * AT_COPYRIGHT: Writing Testsuites. (line 41)
  19885. * AT_DATA: Writing Testsuites. (line 202)
  19886. * AT_FAIL_IF: Writing Testsuites. (line 160)
  19887. * AT_INIT: Writing Testsuites. (line 31)
  19888. * AT_KEYWORDS: Writing Testsuites. (line 142)
  19889. * AT_PACKAGE_BUGREPORT: Making testsuite Scripts.
  19890. (line 12)
  19891. * AT_PACKAGE_NAME: Making testsuite Scripts.
  19892. (line 12)
  19893. * AT_PACKAGE_STRING: Making testsuite Scripts.
  19894. (line 12)
  19895. * AT_PACKAGE_TARNAME: Making testsuite Scripts.
  19896. (line 12)
  19897. * AT_PACKAGE_URL: Making testsuite Scripts.
  19898. (line 12)
  19899. * AT_PACKAGE_VERSION: Making testsuite Scripts.
  19900. (line 12)
  19901. * AT_SETUP: Writing Testsuites. (line 134)
  19902. * AT_SKIP_IF: Writing Testsuites. (line 175)
  19903. * AT_TESTED: Writing Testsuites. (line 109)
  19904. * AT_XFAIL_IF: Writing Testsuites. (line 190)
  19905. 
  19906. File: autoconf.info, Node: Program & Function Index, Next: Concept Index, Prev: Autotest Macro Index, Up: Indices
  19907. B.8 Program and Function Index
  19908. ==============================
  19909. This is an alphabetical list of the programs and functions whose
  19910. portability is discussed in this document.
  19911. �[index�]
  19912. * Menu:
  19913. * !: Limitations of Builtins.
  19914. (line 41)
  19915. * .: Limitations of Builtins.
  19916. (line 17)
  19917. * /usr/bin/ksh on Solaris: Shellology. (line 63)
  19918. * /usr/dt/bin/dtksh on Solaris: Shellology. (line 66)
  19919. * /usr/xpg4/bin/sh on Solaris: Shellology. (line 64)
  19920. * alloca: Particular Functions.
  19921. (line 10)
  19922. * alloca.h: Particular Functions.
  19923. (line 10)
  19924. * assert.h: Particular Headers. (line 20)
  19925. * awk: Limitations of Usual Tools.
  19926. (line 10)
  19927. * basename: Limitations of Usual Tools.
  19928. (line 142)
  19929. * break: Limitations of Builtins.
  19930. (line 107)
  19931. * case: Limitations of Builtins.
  19932. (line 110)
  19933. * cat: Limitations of Usual Tools.
  19934. (line 146)
  19935. * cc: Limitations of Usual Tools.
  19936. (line 149)
  19937. * cd: Limitations of Builtins.
  19938. (line 203)
  19939. * chgrp: Limitations of Usual Tools.
  19940. (line 183)
  19941. * chmod: Limitations of Usual Tools.
  19942. (line 187)
  19943. * chown <1>: Limitations of Usual Tools.
  19944. (line 183)
  19945. * chown: Particular Functions.
  19946. (line 63)
  19947. * closedir: Particular Functions.
  19948. (line 69)
  19949. * cmp: Limitations of Usual Tools.
  19950. (line 197)
  19951. * cp: Limitations of Usual Tools.
  19952. (line 204)
  19953. * ctype.h: Particular Headers. (line 135)
  19954. * date: Limitations of Usual Tools.
  19955. (line 264)
  19956. * diff: Limitations of Usual Tools.
  19957. (line 274)
  19958. * dirent.h: Particular Headers. (line 25)
  19959. * dirname: Limitations of Usual Tools.
  19960. (line 280)
  19961. * echo: Limitations of Builtins.
  19962. (line 233)
  19963. * egrep: Limitations of Usual Tools.
  19964. (line 287)
  19965. * error_at_line: Particular Functions.
  19966. (line 84)
  19967. * eval: Limitations of Builtins.
  19968. (line 270)
  19969. * exec: Limitations of Builtins.
  19970. (line 315)
  19971. * exit <1>: Limitations of Builtins.
  19972. (line 355)
  19973. * exit: Function Portability.
  19974. (line 17)
  19975. * export: Limitations of Builtins.
  19976. (line 380)
  19977. * expr: Limitations of Usual Tools.
  19978. (line 312)
  19979. * expr (|): Limitations of Usual Tools.
  19980. (line 326)
  19981. * false: Limitations of Builtins.
  19982. (line 428)
  19983. * fgrep: Limitations of Usual Tools.
  19984. (line 435)
  19985. * find: Limitations of Usual Tools.
  19986. (line 444)
  19987. * float.h: Particular Headers. (line 135)
  19988. * fnmatch: Particular Functions.
  19989. (line 94)
  19990. * fnmatch.h: Particular Functions.
  19991. (line 452)
  19992. * for: Limitations of Builtins.
  19993. (line 432)
  19994. * fork: Particular Functions.
  19995. (line 120)
  19996. * free: Function Portability.
  19997. (line 27)
  19998. * fseeko: Particular Functions.
  19999. (line 147)
  20000. * ftello: Particular Functions.
  20001. (line 147)
  20002. * getgroups: Particular Functions.
  20003. (line 155)
  20004. * getloadavg: Particular Functions.
  20005. (line 161)
  20006. * getmntent: Particular Functions.
  20007. (line 195)
  20008. * getpgid: Particular Functions.
  20009. (line 205)
  20010. * getpgrp: Particular Functions.
  20011. (line 205)
  20012. * grep: Limitations of Usual Tools.
  20013. (line 458)
  20014. * if: Limitations of Builtins.
  20015. (line 477)
  20016. * inttypes.h <1>: Particular Types. (line 6)
  20017. * inttypes.h: Header Portability. (line 20)
  20018. * isinf: Function Portability.
  20019. (line 32)
  20020. * isnan: Function Portability.
  20021. (line 32)
  20022. * join: Limitations of Usual Tools.
  20023. (line 526)
  20024. * ksh: Shellology. (line 57)
  20025. * ksh88: Shellology. (line 57)
  20026. * ksh93: Shellology. (line 57)
  20027. * linux/irda.h: Header Portability. (line 27)
  20028. * linux/random.h: Header Portability. (line 30)
  20029. * ln: Limitations of Usual Tools.
  20030. (line 543)
  20031. * ls: Limitations of Usual Tools.
  20032. (line 555)
  20033. * lstat: Particular Functions.
  20034. (line 228)
  20035. * make: Portable Make. (line 6)
  20036. * malloc <1>: Particular Functions.
  20037. (line 247)
  20038. * malloc: Function Portability.
  20039. (line 82)
  20040. * mbrtowc: Particular Functions.
  20041. (line 279)
  20042. * memcmp: Particular Functions.
  20043. (line 286)
  20044. * mkdir: Limitations of Usual Tools.
  20045. (line 577)
  20046. * mkfifo: Limitations of Usual Tools.
  20047. (line 611)
  20048. * mknod: Limitations of Usual Tools.
  20049. (line 611)
  20050. * mktemp: Limitations of Usual Tools.
  20051. (line 621)
  20052. * mktime: Particular Functions.
  20053. (line 299)
  20054. * mmap: Particular Functions.
  20055. (line 311)
  20056. * mv: Limitations of Usual Tools.
  20057. (line 646)
  20058. * ndir.h: Particular Headers. (line 25)
  20059. * net/if.h: Header Portability. (line 33)
  20060. * netinet/if_ether.h: Header Portability. (line 53)
  20061. * nlist.h: Particular Functions.
  20062. (line 178)
  20063. * od: Limitations of Usual Tools.
  20064. (line 678)
  20065. * pdksh: Shellology. (line 77)
  20066. * printf: Limitations of Builtins.
  20067. (line 516)
  20068. * putenv: Function Portability.
  20069. (line 89)
  20070. * pwd: Limitations of Builtins.
  20071. (line 543)
  20072. * read: Limitations of Builtins.
  20073. (line 574)
  20074. * realloc <1>: Particular Functions.
  20075. (line 326)
  20076. * realloc: Function Portability.
  20077. (line 105)
  20078. * resolv.h: Particular Headers. (line 73)
  20079. * rm: Limitations of Usual Tools.
  20080. (line 687)
  20081. * rmdir: Limitations of Usual Tools.
  20082. (line 706)
  20083. * sed: Limitations of Usual Tools.
  20084. (line 710)
  20085. * sed (t): Limitations of Usual Tools.
  20086. (line 905)
  20087. * select: Particular Functions.
  20088. (line 337)
  20089. * set: Limitations of Builtins.
  20090. (line 580)
  20091. * setpgrp: Particular Functions.
  20092. (line 348)
  20093. * setvbuf: Obsolete Macros. (line 208)
  20094. * shift: Limitations of Builtins.
  20095. (line 732)
  20096. * sigaction: Function Portability.
  20097. (line 110)
  20098. * signal: Function Portability.
  20099. (line 110)
  20100. * signal.h: Obsolete Macros. (line 662)
  20101. * sleep: Limitations of Usual Tools.
  20102. (line 965)
  20103. * snprintf: Function Portability.
  20104. (line 124)
  20105. * sort: Limitations of Usual Tools.
  20106. (line 971)
  20107. * source: Limitations of Builtins.
  20108. (line 740)
  20109. * sprintf: Function Portability.
  20110. (line 135)
  20111. * sscanf: Function Portability.
  20112. (line 141)
  20113. * stat: Particular Functions.
  20114. (line 363)
  20115. * stdarg.h: Particular Headers. (line 135)
  20116. * stdbool.h: Particular Headers. (line 10)
  20117. * stdint.h <1>: Particular Types. (line 6)
  20118. * stdint.h: Header Portability. (line 20)
  20119. * stdlib.h <1>: Particular Types. (line 6)
  20120. * stdlib.h <2>: Particular Headers. (line 135)
  20121. * stdlib.h: Header Portability. (line 76)
  20122. * strcoll: Particular Functions.
  20123. (line 379)
  20124. * strerror_r <1>: Particular Functions.
  20125. (line 388)
  20126. * strerror_r: Function Portability.
  20127. (line 149)
  20128. * strftime: Particular Functions.
  20129. (line 401)
  20130. * string.h: Particular Headers. (line 135)
  20131. * strings.h: Particular Headers. (line 154)
  20132. * strnlen <1>: Particular Functions.
  20133. (line 426)
  20134. * strnlen: Function Portability.
  20135. (line 155)
  20136. * strtod: Particular Functions.
  20137. (line 408)
  20138. * strtold: Particular Functions.
  20139. (line 420)
  20140. * sys/dir.h: Particular Headers. (line 25)
  20141. * sys/ioctl.h: Particular Headers. (line 270)
  20142. * sys/mkdev.h: Particular Headers. (line 68)
  20143. * sys/mount.h: Header Portability. (line 79)
  20144. * sys/ndir.h: Particular Headers. (line 25)
  20145. * sys/ptem.h: Header Portability. (line 83)
  20146. * sys/socket.h: Header Portability. (line 86)
  20147. * sys/stat.h: Particular Headers. (line 92)
  20148. * sys/sysmacros.h: Particular Headers. (line 68)
  20149. * sys/time.h <1>: Particular Structures.
  20150. (line 35)
  20151. * sys/time.h: Particular Headers. (line 244)
  20152. * sys/types.h: Particular Types. (line 6)
  20153. * sys/ucred.h: Header Portability. (line 89)
  20154. * sys/wait.h: Particular Headers. (line 204)
  20155. * sysconf: Function Portability.
  20156. (line 170)
  20157. * tar: Limitations of Usual Tools.
  20158. (line 976)
  20159. * termios.h: Particular Headers. (line 270)
  20160. * test: Limitations of Builtins.
  20161. (line 744)
  20162. * time.h <1>: Particular Structures.
  20163. (line 35)
  20164. * time.h: Particular Headers. (line 244)
  20165. * touch: Limitations of Usual Tools.
  20166. (line 981)
  20167. * tr: Limitations of Usual Tools.
  20168. (line 994)
  20169. * trap: Limitations of Builtins.
  20170. (line 856)
  20171. * true: Limitations of Builtins.
  20172. (line 930)
  20173. * unistd.h: Particular Headers. (line 228)
  20174. * unlink: Function Portability.
  20175. (line 174)
  20176. * unset: Limitations of Builtins.
  20177. (line 946)
  20178. * unsetenv: Function Portability.
  20179. (line 180)
  20180. * utime: Particular Functions.
  20181. (line 433)
  20182. * va_copy: Function Portability.
  20183. (line 185)
  20184. * va_list: Function Portability.
  20185. (line 192)
  20186. * vfork: Particular Functions.
  20187. (line 120)
  20188. * vfork.h: Particular Functions.
  20189. (line 120)
  20190. * vprintf: Particular Functions.
  20191. (line 443)
  20192. * vsnprintf: Function Portability.
  20193. (line 124)
  20194. * vsprintf <1>: Particular Functions.
  20195. (line 443)
  20196. * vsprintf: Function Portability.
  20197. (line 135)
  20198. * wait: Limitations of Builtins.
  20199. (line 973)
  20200. * wait3: Obsolete Macros. (line 216)
  20201. * wchar.h: Particular Types. (line 88)
  20202. * X11/extensions/scrnsaver.h: Header Portability. (line 92)
  20203. * {...}: Limitations of Builtins.
  20204. (line 74)
  20205. 
  20206. File: autoconf.info, Node: Concept Index, Prev: Program & Function Index, Up: Indices
  20207. B.9 Concept Index
  20208. =================
  20209. This is an alphabetical list of the files, tools, and concepts
  20210. introduced in this document.
  20211. �[index�]
  20212. * Menu:
  20213. * "$@": Shell Substitutions. (line 70)
  20214. * $((EXPRESSION)): Shell Substitutions. (line 456)
  20215. * $(COMMANDS): Shell Substitutions. (line 423)
  20216. * $<, explicit rules, and VPATH: $< in Explicit Rules.
  20217. (line 6)
  20218. * ${#VAR}: Shell Substitutions. (line 369)
  20219. * ${VAR##WORD}: Shell Substitutions. (line 369)
  20220. * ${VAR#WORD}: Shell Substitutions. (line 369)
  20221. * ${VAR%%WORD}: Shell Substitutions. (line 369)
  20222. * ${VAR%WORD}: Shell Substitutions. (line 369)
  20223. * ${VAR+VALUE}: Shell Substitutions. (line 148)
  20224. * ${VAR-VALUE}: Shell Substitutions. (line 140)
  20225. * ${VAR=EXPANDED-VALUE}: Shell Substitutions. (line 319)
  20226. * ${VAR=LITERAL}: Shell Substitutions. (line 295)
  20227. * ${VAR=VALUE}: Shell Substitutions. (line 215)
  20228. * 64-bit libraries: Site Defaults. (line 97)
  20229. * @&t@: Quadrigraphs. (line 6)
  20230. * @S|@: Quadrigraphs. (line 6)
  20231. * ^ quoting: Shell Substitutions. (line 496)
  20232. * _m4_divert_diversion: New Macros. (line 6)
  20233. * `COMMANDS`: Shell Substitutions. (line 377)
  20234. * abs_builddir: Preset Output Variables.
  20235. (line 177)
  20236. * abs_srcdir: Preset Output Variables.
  20237. (line 199)
  20238. * abs_top_builddir: Preset Output Variables.
  20239. (line 192)
  20240. * abs_top_srcdir: Preset Output Variables.
  20241. (line 206)
  20242. * absolute file names, detect: File System Conventions.
  20243. (line 52)
  20244. * ac_objext: Generic Functions. (line 59)
  20245. * ac_path_VARIABLE: Generic Programs. (line 123)
  20246. * ac_path_VARIABLE_found: Generic Programs. (line 123)
  20247. * ac_srcdir: Configuration Actions.
  20248. (line 85)
  20249. * ac_top_build_prefix: Configuration Actions.
  20250. (line 80)
  20251. * ac_top_srcdir: Configuration Actions.
  20252. (line 76)
  20253. * acconfig.h: acconfig Header. (line 6)
  20254. * aclocal.m4: Making configure Scripts.
  20255. (line 6)
  20256. * Ash: Shellology. (line 16)
  20257. * at_arg_OPTION: Writing Testsuites. (line 50)
  20258. * at_optarg: Writing Testsuites. (line 62)
  20259. * at_optarg_OPTION: Writing Testsuites. (line 62)
  20260. * at_status: Writing Testsuites. (line 212)
  20261. * autoconf: autoconf Invocation. (line 6)
  20262. * Autoconf upgrading <1>: Autoconf 2.13. (line 6)
  20263. * Autoconf upgrading: Autoconf 1. (line 6)
  20264. * Autoconf version: Versioning. (line 6)
  20265. * autoheader: autoheader Invocation.
  20266. (line 6)
  20267. * Autoheader macros: Autoheader Macros. (line 6)
  20268. * autom4te debugging tips: Debugging via autom4te.
  20269. (line 6)
  20270. * Autom4te Library: autom4te Invocation. (line 225)
  20271. * autom4te.cache: autom4te Invocation. (line 130)
  20272. * autom4te.cfg: autom4te Invocation. (line 258)
  20273. * Automake: Automake. (line 19)
  20274. * Automatic remaking: Automatic Remaking. (line 6)
  20275. * automatic rule rewriting and VPATH: Automatic Rule Rewriting.
  20276. (line 6)
  20277. * autopoint: autoreconf Invocation.
  20278. (line 30)
  20279. * autoreconf: autoreconf Invocation.
  20280. (line 6)
  20281. * autoscan: autoscan Invocation. (line 6)
  20282. * Autotest: Using Autotest. (line 6)
  20283. * AUTOTEST_PATH: testsuite Invocation.
  20284. (line 60)
  20285. * autoupdate: autoupdate Invocation.
  20286. (line 6)
  20287. * Back trace <1>: autom4te Invocation. (line 86)
  20288. * Back trace: autoconf Invocation. (line 86)
  20289. * balancing parentheses: Balancing Parentheses.
  20290. (line 6)
  20291. * Bash: Shellology. (line 43)
  20292. * Bash 2.05 and later: Shellology. (line 49)
  20293. * bindir: Installation Directory Variables.
  20294. (line 15)
  20295. * Bootstrap: Bootstrapping. (line 6)
  20296. * BSD make and obj/: obj/ and Make. (line 6)
  20297. * buffer overruns: Buffer Overruns. (line 6)
  20298. * Build directories: Build Directories. (line 6)
  20299. * builddir: Preset Output Variables.
  20300. (line 174)
  20301. * C function portability: Function Portability.
  20302. (line 6)
  20303. * C types: Types. (line 6)
  20304. * Cache: Caching Results. (line 6)
  20305. * Cache variable: Cache Variable Names.
  20306. (line 6)
  20307. * Cache, enabling: configure Invocation.
  20308. (line 25)
  20309. * Canonical system type: Canonicalizing. (line 6)
  20310. * carriage return, deleting: Limitations of Usual Tools.
  20311. (line 994)
  20312. * CFLAGS: Preset Output Variables.
  20313. (line 23)
  20314. * changequote: Changequote is Evil. (line 6)
  20315. * Coding style: Coding Style. (line 6)
  20316. * Command Substitution: Shell Substitutions. (line 377)
  20317. * command-line, macros set on: Command-line Macros and whitespace.
  20318. (line 6)
  20319. * Commands for configuration: Configuration Commands.
  20320. (line 6)
  20321. * Comments in Makefile macros: Comments in Make Macros.
  20322. (line 6)
  20323. * Comments in Makefile rules: Comments in Make Rules.
  20324. (line 6)
  20325. * Common autoconf behavior: Common Behavior. (line 6)
  20326. * Compilers: Compilers and Preprocessors.
  20327. (line 6)
  20328. * composing variable names: Polymorphic Variables.
  20329. (line 131)
  20330. * config.h: Configuration Headers.
  20331. (line 6)
  20332. * config.h.bot: acconfig Header. (line 6)
  20333. * config.h.in: Header Templates. (line 6)
  20334. * config.h.top: acconfig Header. (line 6)
  20335. * config.site: Site Defaults. (line 6)
  20336. * config.status: config.status Invocation.
  20337. (line 6)
  20338. * config.sub: Specifying Target Triplets.
  20339. (line 59)
  20340. * CONFIG_COMMANDS: Obsolete config.status Use.
  20341. (line 11)
  20342. * CONFIG_FILES: Obsolete config.status Use.
  20343. (line 15)
  20344. * CONFIG_HEADERS: Obsolete config.status Use.
  20345. (line 20)
  20346. * CONFIG_LINKS: Obsolete config.status Use.
  20347. (line 25)
  20348. * CONFIG_SHELL: config.status Invocation.
  20349. (line 102)
  20350. * CONFIG_STATUS: config.status Invocation.
  20351. (line 108)
  20352. * Configuration actions: Configuration Actions.
  20353. (line 6)
  20354. * Configuration commands: Configuration Commands.
  20355. (line 6)
  20356. * Configuration file creation: Configuration Files. (line 6)
  20357. * Configuration Header: Configuration Headers.
  20358. (line 6)
  20359. * Configuration Header Template: Header Templates. (line 6)
  20360. * Configuration links: Configuration Links. (line 6)
  20361. * configure <1>: Running configure Scripts.
  20362. (line 6)
  20363. * configure: Making configure Scripts.
  20364. (line 6)
  20365. * Configure subdirectories: Subdirectories. (line 6)
  20366. * configure.ac: Making configure Scripts.
  20367. (line 27)
  20368. * configure.in: Making configure Scripts.
  20369. (line 27)
  20370. * configure_input: Preset Output Variables.
  20371. (line 58)
  20372. * Copyright Notice <1>: Writing Testsuites. (line 41)
  20373. * Copyright Notice: Notices. (line 10)
  20374. * CPPFLAGS: Preset Output Variables.
  20375. (line 72)
  20376. * Creating configuration files: Configuration Files. (line 6)
  20377. * Creating temporary files: Limitations of Usual Tools.
  20378. (line 621)
  20379. * Cross compilation: Hosts and Cross-Compilation.
  20380. (line 6)
  20381. * CXXFLAGS: Preset Output Variables.
  20382. (line 94)
  20383. * Darwin: Systemology. (line 23)
  20384. * Data structure, set: Set manipulation Macros.
  20385. (line 6)
  20386. * datadir: Installation Directory Variables.
  20387. (line 18)
  20388. * datarootdir <1>: Changed Directory Variables.
  20389. (line 6)
  20390. * datarootdir: Installation Directory Variables.
  20391. (line 22)
  20392. * debugging tips: Debugging via autom4te.
  20393. (line 6)
  20394. * Declaration, checking: Declarations. (line 6)
  20395. * Default includes: Default Includes. (line 6)
  20396. * DEFS: Preset Output Variables.
  20397. (line 98)
  20398. * deleting carriage return: Limitations of Usual Tools.
  20399. (line 994)
  20400. * Dependencies between macros: Dependencies Between Macros.
  20401. (line 6)
  20402. * Descriptors: File Descriptors. (line 6)
  20403. * descriptors: File Descriptor Macros.
  20404. (line 6)
  20405. * Directories, build: Build Directories. (line 6)
  20406. * Directories, installation: Installation Directory Variables.
  20407. (line 6)
  20408. * division, integer: Signed Integer Division.
  20409. (line 6)
  20410. * dnl <1>: Coding Style. (line 42)
  20411. * dnl: Macro Definitions. (line 51)
  20412. * docdir: Installation Directory Variables.
  20413. (line 26)
  20414. * double-colon rules and VPATH: VPATH and Double-colon.
  20415. (line 6)
  20416. * dvidir: Installation Directory Variables.
  20417. (line 30)
  20418. * ECHO_C: Preset Output Variables.
  20419. (line 106)
  20420. * ECHO_N: Preset Output Variables.
  20421. (line 107)
  20422. * ECHO_T: Preset Output Variables.
  20423. (line 108)
  20424. * Endianness: C Compiler. (line 184)
  20425. * environment, macros set from: Command-line Macros and whitespace.
  20426. (line 6)
  20427. * Erlang: Erlang Compiler and Interpreter.
  20428. (line 6)
  20429. * Erlang, Library, checking: Erlang Libraries. (line 6)
  20430. * ERLANG_INSTALL_LIB_DIR: Installation Directory Variables.
  20431. (line 201)
  20432. * ERLANG_INSTALL_LIB_DIR_: Installation Directory Variables.
  20433. (line 206)
  20434. * ERLCFLAGS: Preset Output Variables.
  20435. (line 120)
  20436. * exec_prefix: Installation Directory Variables.
  20437. (line 33)
  20438. * exiting portably: Exiting Portably. (line 6)
  20439. * expanded before required: Expanded Before Required.
  20440. (line 6)
  20441. * explicit rules, $<, and VPATH: $< in Explicit Rules.
  20442. (line 6)
  20443. * External software: External Software. (line 6)
  20444. * F77: Fortran Compiler. (line 6)
  20445. * FCFLAGS: Preset Output Variables.
  20446. (line 126)
  20447. * FFLAGS: Preset Output Variables.
  20448. (line 133)
  20449. * FHS: Site Defaults. (line 83)
  20450. * File descriptors: File Descriptors. (line 6)
  20451. * file descriptors: File Descriptor Macros.
  20452. (line 6)
  20453. * File system conventions: File System Conventions.
  20454. (line 6)
  20455. * File, checking: Files. (line 6)
  20456. * Filesystem Hierarchy Standard: Site Defaults. (line 83)
  20457. * floating point: Floating Point Portability.
  20458. (line 6)
  20459. * Forbidden patterns: Forbidden Patterns. (line 6)
  20460. * Fortran: Fortran Compiler. (line 6)
  20461. * Function, checking: Particular Functions.
  20462. (line 6)
  20463. * Gettext: autoreconf Invocation.
  20464. (line 30)
  20465. * GNU build system: The GNU Build System.
  20466. (line 6)
  20467. * Gnulib: Gnulib. (line 11)
  20468. * Go: Go Compiler. (line 6)
  20469. * GOFLAGS: Preset Output Variables.
  20470. (line 170)
  20471. * Header portability: Header Portability. (line 6)
  20472. * Header templates: Header Templates. (line 6)
  20473. * Header, checking: Header Files. (line 6)
  20474. * Help strings: Pretty Help Strings. (line 6)
  20475. * Here-documents: Here-Documents. (line 6)
  20476. * History of autoconf: History. (line 6)
  20477. * htmldir: Installation Directory Variables.
  20478. (line 40)
  20479. * ifnames: ifnames Invocation. (line 6)
  20480. * Imake: Why Not Imake. (line 6)
  20481. * includedir: Installation Directory Variables.
  20482. (line 43)
  20483. * Includes, default: Default Includes. (line 6)
  20484. * indirection, variable name: Polymorphic Variables.
  20485. (line 6)
  20486. * infodir: Installation Directory Variables.
  20487. (line 46)
  20488. * input: File Descriptor Macros.
  20489. (line 6)
  20490. * Install prefix: Default Prefix. (line 6)
  20491. * Installation directories: Installation Directory Variables.
  20492. (line 6)
  20493. * Instantiation: Output. (line 13)
  20494. * integer overflow <1>: Signed Overflow Advice.
  20495. (line 6)
  20496. * integer overflow <2>: Signed Overflow Examples.
  20497. (line 6)
  20498. * integer overflow <3>: Integer Overflow Basics.
  20499. (line 6)
  20500. * integer overflow: Integer Overflow. (line 6)
  20501. * Introduction: Introduction. (line 6)
  20502. * invoking the shell: Invoking the Shell. (line 6)
  20503. * Korn shell: Shellology. (line 57)
  20504. * Ksh: Shellology. (line 57)
  20505. * Language: Language Choice. (line 6)
  20506. * Large file support: System Services. (line 49)
  20507. * LDFLAGS: Preset Output Variables.
  20508. (line 140)
  20509. * LFS: System Services. (line 49)
  20510. * lib64: Site Defaults. (line 97)
  20511. * libdir: Installation Directory Variables.
  20512. (line 49)
  20513. * libexecdir: Installation Directory Variables.
  20514. (line 52)
  20515. * Library, checking: Libraries. (line 6)
  20516. * LIBS: Preset Output Variables.
  20517. (line 154)
  20518. * Libtool: Libtool. (line 14)
  20519. * License: Distributing. (line 6)
  20520. * Limitations of make: Portable Make. (line 6)
  20521. * Limitations of shell builtins: Limitations of Builtins.
  20522. (line 6)
  20523. * Limitations of usual tools: Limitations of Usual Tools.
  20524. (line 6)
  20525. * Links: Configuration Links. (line 12)
  20526. * Links for configuration: Configuration Links. (line 6)
  20527. * Listing directories: Limitations of Usual Tools.
  20528. (line 555)
  20529. * localedir: Installation Directory Variables.
  20530. (line 55)
  20531. * localstatedir: Installation Directory Variables.
  20532. (line 60)
  20533. * loop induction: Optimization and Wraparound.
  20534. (line 6)
  20535. * low-level output: File Descriptor Macros.
  20536. (line 6)
  20537. * M4: Programming in M4. (line 6)
  20538. * M4 quotation: M4 Quotation. (line 6)
  20539. * M4sugar: Programming in M4sugar.
  20540. (line 6)
  20541. * m4sugar debugging tips: Debugging via autom4te.
  20542. (line 6)
  20543. * Macro invocation stack <1>: autom4te Invocation. (line 86)
  20544. * Macro invocation stack: autoconf Invocation. (line 86)
  20545. * Macros, called once: One-Shot Macros. (line 6)
  20546. * Macros, obsoleting: Obsoleting Macros. (line 6)
  20547. * Macros, ordering: Suggested Ordering. (line 6)
  20548. * Macros, prerequisites: Prerequisite Macros. (line 6)
  20549. * make -k: make -k Status. (line 6)
  20550. * make and MAKEFLAGS: The Make Macro MAKEFLAGS.
  20551. (line 6)
  20552. * make and SHELL: The Make Macro SHELL.
  20553. (line 6)
  20554. * Makefile macros and comments: Comments in Make Macros.
  20555. (line 6)
  20556. * Makefile macros and whitespace: Trailing whitespace in Make Macros.
  20557. (line 6)
  20558. * Makefile rules and comments: Comments in Make Rules.
  20559. (line 6)
  20560. * Makefile rules and newlines: Newlines in Make Rules.
  20561. (line 6)
  20562. * Makefile substitutions: Makefile Substitutions.
  20563. (line 6)
  20564. * MAKEFLAGS and make: The Make Macro MAKEFLAGS.
  20565. (line 6)
  20566. * Making directories: Limitations of Usual Tools.
  20567. (line 577)
  20568. * mandir: Installation Directory Variables.
  20569. (line 63)
  20570. * Messages, from autoconf: Reporting Messages. (line 6)
  20571. * Messages, from configure: Printing Messages. (line 6)
  20572. * Messages, from M4sugar: Diagnostic Macros. (line 6)
  20573. * Moving open files: Limitations of Usual Tools.
  20574. (line 646)
  20575. * newline, deleting: Limitations of Usual Tools.
  20576. (line 994)
  20577. * Newlines in Makefile rules: Newlines in Make Rules.
  20578. (line 6)
  20579. * Notices in configure: Notices. (line 6)
  20580. * null pointers: Null Pointers. (line 6)
  20581. * obj/, subdirectory: obj/ and Make. (line 6)
  20582. * OBJCFLAGS: Preset Output Variables.
  20583. (line 162)
  20584. * OBJCXXFLAGS: Preset Output Variables.
  20585. (line 166)
  20586. * Obsolete constructs: Obsolete Constructs. (line 6)
  20587. * Obsoleting macros: Obsoleting Macros. (line 6)
  20588. * obstack: Particular Functions.
  20589. (line 319)
  20590. * oldincludedir: Installation Directory Variables.
  20591. (line 66)
  20592. * One-shot macros: One-Shot Macros. (line 6)
  20593. * Options, Package: Option Checking. (line 6)
  20594. * Options, package: Package Options. (line 6)
  20595. * Ordering macros: Suggested Ordering. (line 6)
  20596. * Output variables <1>: Setting Output Variables.
  20597. (line 6)
  20598. * Output variables: Preset Output Variables.
  20599. (line 6)
  20600. * Output variables, special characters in: Special Chars in Variables.
  20601. (line 6)
  20602. * output, low-level: File Descriptor Macros.
  20603. (line 6)
  20604. * Outputting files: Output. (line 6)
  20605. * overflow, signed integer <1>: Signed Overflow Advice.
  20606. (line 6)
  20607. * overflow, signed integer <2>: Signed Overflow Examples.
  20608. (line 6)
  20609. * overflow, signed integer <3>: Integer Overflow Basics.
  20610. (line 6)
  20611. * overflow, signed integer: Integer Overflow. (line 6)
  20612. * Package options: Package Options. (line 6)
  20613. * package.m4: Making testsuite Scripts.
  20614. (line 12)
  20615. * Parallel make: Parallel Make. (line 6)
  20616. * parentheses, balancing: Balancing Parentheses.
  20617. (line 6)
  20618. * Patterns, forbidden: Forbidden Patterns. (line 6)
  20619. * pdfdir: Installation Directory Variables.
  20620. (line 69)
  20621. * polymorphic variable name: Polymorphic Variables.
  20622. (line 6)
  20623. * portability: Varieties of Unportability.
  20624. (line 6)
  20625. * Portability of C functions: Function Portability.
  20626. (line 6)
  20627. * Portability of headers: Header Portability. (line 6)
  20628. * Portable C and C++ programming: Portable C and C++. (line 6)
  20629. * Portable shell programming: Portable Shell. (line 6)
  20630. * positional parameters: Shell Substitutions. (line 121)
  20631. * Posix termios headers: System Services. (line 75)
  20632. * Precious Variable: Setting Output Variables.
  20633. (line 65)
  20634. * prefix: Installation Directory Variables.
  20635. (line 72)
  20636. * Prefix for install: Default Prefix. (line 6)
  20637. * preprocessor arithmetic: Preprocessor Arithmetic.
  20638. (line 6)
  20639. * Preprocessors: Compilers and Preprocessors.
  20640. (line 6)
  20641. * prerequisite directories and VPATH: Tru64 Directory Magic.
  20642. (line 6)
  20643. * Prerequisite macros: Prerequisite Macros. (line 6)
  20644. * Program names, transforming: Transforming Names. (line 6)
  20645. * Programs, checking: Alternative Programs.
  20646. (line 6)
  20647. * psdir: Installation Directory Variables.
  20648. (line 77)
  20649. * QNX 4.25: Systemology. (line 37)
  20650. * quadrigraphs: Quadrigraphs. (line 6)
  20651. * quotation <1>: M4 Quotation. (line 6)
  20652. * quotation: Autoconf Language. (line 6)
  20653. * Remaking automatically: Automatic Remaking. (line 6)
  20654. * Revision: Notices. (line 18)
  20655. * Rule, Single Suffix Inference: Single Suffix Rules. (line 6)
  20656. * sbindir: Installation Directory Variables.
  20657. (line 80)
  20658. * Separated Dependencies: Single Suffix Rules. (line 9)
  20659. * set -b: Limitations of Builtins.
  20660. (line 689)
  20661. * set -e: Limitations of Builtins.
  20662. (line 605)
  20663. * set -m: Limitations of Builtins.
  20664. (line 689)
  20665. * set -n: Limitations of Builtins.
  20666. (line 713)
  20667. * Set manipulation: Set manipulation Macros.
  20668. (line 6)
  20669. * sharedstatedir: Installation Directory Variables.
  20670. (line 84)
  20671. * SHELL and make: The Make Macro SHELL.
  20672. (line 6)
  20673. * Shell assignments: Assignments. (line 6)
  20674. * Shell builtins: Limitations of Builtins.
  20675. (line 6)
  20676. * Shell file descriptors: File Descriptors. (line 6)
  20677. * Shell Functions: Shell Functions. (line 6)
  20678. * Shell here-documents: Here-Documents. (line 6)
  20679. * shell invocation: Invoking the Shell. (line 6)
  20680. * Shell parentheses: Parentheses. (line 6)
  20681. * Shell pattern matching: Shell Pattern Matching.
  20682. (line 6)
  20683. * Shell slashes: Slashes. (line 6)
  20684. * Shell substitutions: Shell Substitutions. (line 6)
  20685. * Shell variables: Special Shell Variables.
  20686. (line 6)
  20687. * Shellology: Shellology. (line 6)
  20688. * Signal handling in the shell: Signal Handling. (line 6)
  20689. * Signals, shells and: Signal Handling. (line 6)
  20690. * signed integer overflow <1>: Signed Overflow Advice.
  20691. (line 6)
  20692. * signed integer overflow <2>: Signed Overflow Examples.
  20693. (line 6)
  20694. * signed integer overflow <3>: Integer Overflow Basics.
  20695. (line 6)
  20696. * signed integer overflow: Integer Overflow. (line 6)
  20697. * Single Suffix Inference Rule: Single Suffix Rules. (line 6)
  20698. * Site defaults: Site Defaults. (line 6)
  20699. * Site details: Site Details. (line 6)
  20700. * Special shell variables: Special Shell Variables.
  20701. (line 6)
  20702. * srcdir <1>: Preset Output Variables.
  20703. (line 195)
  20704. * srcdir: Configuration Actions.
  20705. (line 71)
  20706. * standard input: File Descriptor Macros.
  20707. (line 6)
  20708. * Standard symbols: Standard Symbols. (line 6)
  20709. * Structure, checking: Structures. (line 6)
  20710. * Subdirectory configure: Subdirectories. (line 6)
  20711. * Substitutions in makefiles: Makefile Substitutions.
  20712. (line 6)
  20713. * Symbolic links: Limitations of Usual Tools.
  20714. (line 543)
  20715. * sysconfdir: Installation Directory Variables.
  20716. (line 88)
  20717. * System type <1>: Canonicalizing. (line 6)
  20718. * System type: Specifying Target Triplets.
  20719. (line 6)
  20720. * Systemology: Systemology. (line 6)
  20721. * Target triplet: Specifying Target Triplets.
  20722. (line 6)
  20723. * termios Posix headers: System Services. (line 75)
  20724. * test group: testsuite Scripts. (line 12)
  20725. * testsuite <1>: testsuite Invocation.
  20726. (line 6)
  20727. * testsuite: testsuite Scripts. (line 6)
  20728. * timestamp resolution <1>: Timestamps and Make. (line 6)
  20729. * timestamp resolution: Limitations of Usual Tools.
  20730. (line 226)
  20731. * tmp: Configuration Actions.
  20732. (line 89)
  20733. * top_build_prefix: Preset Output Variables.
  20734. (line 184)
  20735. * top_builddir: Preset Output Variables.
  20736. (line 180)
  20737. * top_srcdir: Preset Output Variables.
  20738. (line 202)
  20739. * Transforming program names: Transforming Names. (line 6)
  20740. * Tru64: Systemology. (line 44)
  20741. * Types: Types. (line 6)
  20742. * unbalanced parentheses, managing: Balancing Parentheses.
  20743. (line 6)
  20744. * undefined macro: New Macros. (line 6)
  20745. * Unix version 7: Systemology. (line 49)
  20746. * Unordered set manipulation: Set manipulation Macros.
  20747. (line 6)
  20748. * Upgrading autoconf <1>: Autoconf 2.13. (line 6)
  20749. * Upgrading autoconf: Autoconf 1. (line 6)
  20750. * V7: Systemology. (line 49)
  20751. * variable name indirection: Polymorphic Variables.
  20752. (line 6)
  20753. * variable names, composing: Polymorphic Variables.
  20754. (line 131)
  20755. * Variable, Precious: Setting Output Variables.
  20756. (line 65)
  20757. * variables and VPATH: Variables listed in VPATH.
  20758. (line 6)
  20759. * Version: Versioning. (line 11)
  20760. * version, Autoconf: Versioning. (line 6)
  20761. * volatile objects: Volatile Objects. (line 6)
  20762. * VPATH: VPATH and Make. (line 6)
  20763. * VPATH and automatic rule rewriting: Automatic Rule Rewriting.
  20764. (line 6)
  20765. * VPATH and double-colon rules: VPATH and Double-colon.
  20766. (line 6)
  20767. * VPATH and prerequisite directories: Tru64 Directory Magic.
  20768. (line 6)
  20769. * VPATH and variables: Variables listed in VPATH.
  20770. (line 6)
  20771. * VPATH, explicit rules, and $<: $< in Explicit Rules.
  20772. (line 6)
  20773. * VPATH, resolving target pathnames: Make Target Lookup. (line 6)
  20774. * whitespace in command-line macros: Command-line Macros and whitespace.
  20775. (line 6)
  20776. * whitespace in Makefile macros: Trailing whitespace in Make Macros.
  20777. (line 6)
  20778. * wraparound arithmetic <1>: Signed Overflow Advice.
  20779. (line 6)
  20780. * wraparound arithmetic <2>: Signed Overflow Examples.
  20781. (line 6)
  20782. * wraparound arithmetic <3>: Integer Overflow Basics.
  20783. (line 6)
  20784. * wraparound arithmetic: Integer Overflow. (line 6)
  20785. * X Window System: System Services. (line 10)
  20786. * Zsh: Shellology. (line 87)
  20787. 
  20788. Tag Table:
  20789. Node: Top1954
  20790. Node: Introduction21371
  20791. Node: The GNU Build System27935
  20792. Node: Automake28914
  20793. Node: Gnulib30863
  20794. Node: Libtool32172
  20795. Node: Pointers33594
  20796. Ref: Pointers-Footnote-134895
  20797. Node: Making configure Scripts35055
  20798. Node: Writing Autoconf Input38404
  20799. Node: Shell Script Compiler39867
  20800. Node: Autoconf Language42228
  20801. Node: Autoconf Input Layout49397
  20802. Node: autoscan Invocation50805
  20803. Node: ifnames Invocation53361
  20804. Node: autoconf Invocation54561
  20805. Node: autoreconf Invocation59846
  20806. Node: Setup64607
  20807. Node: Initializing configure65929
  20808. Ref: AC_INIT66434
  20809. Node: Versioning69318
  20810. Node: Notices71179
  20811. Node: Input72354
  20812. Ref: AC_CONFIG_SRCDIR72495
  20813. Node: Output75442
  20814. Ref: AC_OUTPUT75877
  20815. Ref: AC_PROG_MAKE_SET77495
  20816. Node: Configuration Actions77920
  20817. Node: Configuration Files83208
  20818. Ref: AC_CONFIG_FILES83469
  20819. Node: Makefile Substitutions84688
  20820. Node: Preset Output Variables86431
  20821. Node: Installation Directory Variables95945
  20822. Node: Changed Directory Variables103793
  20823. Node: Build Directories106387
  20824. Node: Automatic Remaking108242
  20825. Node: Configuration Headers110410
  20826. Node: Header Templates113712
  20827. Node: autoheader Invocation116447
  20828. Node: Autoheader Macros120089
  20829. Node: Configuration Commands122354
  20830. Ref: AC_CONFIG_COMMANDS122866
  20831. Node: Configuration Links124151
  20832. Ref: AC_CONFIG_LINKS124602
  20833. Node: Subdirectories125575
  20834. Node: Default Prefix128055
  20835. Ref: AC_PREFIX_PROGRAM128946
  20836. Node: Existing Tests129477
  20837. Node: Common Behavior131279
  20838. Node: Standard Symbols131918
  20839. Node: Default Includes132499
  20840. Node: Alternative Programs134753
  20841. Node: Particular Programs135439
  20842. Ref: AC_PROG_LEX141187
  20843. Ref: AC_PROG_LN_S143798
  20844. Node: Generic Programs145416
  20845. Ref: AC_CHECK_PROG146388
  20846. Ref: AC_CHECK_PROGS147114
  20847. Ref: AC_PATH_PROG151114
  20848. Ref: AC_PATH_PROGS151488
  20849. Node: Files154567
  20850. Node: Libraries155767
  20851. Ref: AC_CHECK_LIB156008
  20852. Ref: AC_SEARCH_LIBS158267
  20853. Node: Library Functions159451
  20854. Node: Function Portability160074
  20855. Node: Particular Functions169586
  20856. Ref: AC_FUNC_ALLOCA169917
  20857. Ref: AC_FUNC_CLOSEDIR_VOID172306
  20858. Ref: AC_FUNC_FORK174296
  20859. Ref: AC_FUNC_GETLOADAVG176338
  20860. Ref: AC_FUNC_GETMNTENT177903
  20861. Ref: AC_FUNC_MMAP182145
  20862. Ref: AC_FUNC_STRCOLL185000
  20863. Ref: AC_FUNC_STRFTIME185975
  20864. Ref: AC_FUNC_UTIME_NULL187257
  20865. Ref: AC_FUNC_VPRINTF187605
  20866. Node: Generic Functions188821
  20867. Ref: AC_CHECK_FUNC189347
  20868. Ref: AC_CHECK_FUNCS189976
  20869. Node: Header Files194602
  20870. Node: Header Portability195235
  20871. Node: Particular Headers198330
  20872. Ref: AC_HEADER_DIRENT199369
  20873. Ref: AC_HEADER_MAJOR200899
  20874. Ref: AC_HEADER_STAT201683
  20875. Ref: AC_HEADER_STDC203189
  20876. Ref: AC_HEADER_TIME207928
  20877. Node: Generic Headers209315
  20878. Ref: AC_CHECK_HEADER209715
  20879. Ref: AC_CHECK_HEADERS211588
  20880. Node: Declarations214153
  20881. Node: Particular Declarations214749
  20882. Node: Generic Declarations214973
  20883. Ref: AC_CHECK_DECLS216358
  20884. Node: Structures218884
  20885. Node: Particular Structures219499
  20886. Ref: AC_STRUCT_ST_BLOCKS220568
  20887. Ref: AC_STRUCT_TIMEZONE221264
  20888. Node: Generic Structures221593
  20889. Ref: AC_CHECK_MEMBERS222584
  20890. Node: Types223417
  20891. Node: Particular Types223937
  20892. Ref: AC_TYPE_GETGROUPS224380
  20893. Ref: AC_TYPE_MODE_T227416
  20894. Ref: AC_TYPE_OFF_T227599
  20895. Ref: AC_TYPE_PID_T227779
  20896. Ref: AC_TYPE_SIZE_T227959
  20897. Ref: AC_TYPE_UID_T228328
  20898. Node: Generic Types229973
  20899. Node: Compilers and Preprocessors232128
  20900. Node: Specific Compiler Characteristics233402
  20901. Node: Generic Compiler Characteristics234507
  20902. Ref: AC_CHECK_SIZEOF234747
  20903. Node: C Compiler239537
  20904. Ref: AC_PROG_CC_C_O243988
  20905. Ref: AC_C_BIGENDIAN247796
  20906. Ref: AC_C_CONST249637
  20907. Ref: AC_C_INLINE252955
  20908. Ref: AC_C_CHAR_UNSIGNED253178
  20909. Ref: AC_PROG_GCC_TRADITIONAL255800
  20910. Node: C++ Compiler256212
  20911. Node: Objective C Compiler258609
  20912. Node: Objective C++ Compiler259983
  20913. Node: Erlang Compiler and Interpreter261433
  20914. Node: Fortran Compiler263478
  20915. Node: Go Compiler288878
  20916. Node: System Services289923
  20917. Ref: AC_PATH_X290168
  20918. Ref: AC_PATH_XTRA291161
  20919. Ref: AC_SYS_INTERPRETER291738
  20920. Ref: AC_SYS_LONG_FILE_NAMES293150
  20921. Node: Posix Variants293527
  20922. Ref: AC_USE_SYSTEM_EXTENSIONS293827
  20923. Node: Erlang Libraries294903
  20924. Node: Writing Tests299841
  20925. Node: Language Choice301865
  20926. Ref: AC_LANG302362
  20927. Ref: AC_LANG_PUSH304161
  20928. Ref: Language Choice-Footnote-1306034
  20929. Node: Writing Test Programs306190
  20930. Node: Guidelines306768
  20931. Node: Test Functions309028
  20932. Node: Generating Sources310426
  20933. Node: Running the Preprocessor316510
  20934. Ref: AC_PREPROC_IFELSE317242
  20935. Ref: AC_EGREP_HEADER319172
  20936. Ref: AC_EGREP_CPP319501
  20937. Node: Running the Compiler319926
  20938. Node: Running the Linker321681
  20939. Ref: AC_LINK_IFELSE322821
  20940. Node: Runtime323697
  20941. Ref: AC_RUN_IFELSE324472
  20942. Node: Systemology329322
  20943. Node: Multiple Cases331671
  20944. Node: Results333372
  20945. Node: Defining Symbols334191
  20946. Node: Setting Output Variables339082
  20947. Node: Special Chars in Variables344973
  20948. Node: Caching Results346233
  20949. Node: Cache Variable Names349951
  20950. Node: Cache Files351602
  20951. Node: Cache Checkpointing353927
  20952. Node: Printing Messages355301
  20953. Ref: AC_MSG_RESULT356815
  20954. Ref: AC_MSG_NOTICE357322
  20955. Ref: AC_MSG_ERROR357686
  20956. Ref: AC_MSG_WARN358519
  20957. Node: Programming in M4358942
  20958. Node: M4 Quotation359747
  20959. Node: Active Characters360716
  20960. Ref: Active Characters-Footnote-1362106
  20961. Ref: Active Characters-Footnote-2362220
  20962. Node: One Macro Call362242
  20963. Node: Quoting and Parameters363798
  20964. Node: Quotation and Nested Macros366134
  20965. Node: Changequote is Evil369144
  20966. Node: Quadrigraphs371674
  20967. Node: Balancing Parentheses374356
  20968. Node: Quotation Rule Of Thumb378450
  20969. Node: Using autom4te381348
  20970. Ref: Using autom4te-Footnote-1381999
  20971. Node: autom4te Invocation382048
  20972. Node: Customizing autom4te390550
  20973. Node: Programming in M4sugar391831
  20974. Node: Redefined M4 Macros393012
  20975. Node: Diagnostic Macros401342
  20976. Ref: m4_fatal402095
  20977. Ref: m4_warn402334
  20978. Node: Diversion support403102
  20979. Node: Conditional constructs410888
  20980. Node: Looping constructs417742
  20981. Ref: m4_foreach_w421354
  20982. Node: Evaluation Macros428706
  20983. Node: Text processing Macros437395
  20984. Node: Number processing Macros447105
  20985. Ref: m4_version_compare449057
  20986. Node: Set manipulation Macros451364
  20987. Node: Forbidden Patterns460480
  20988. Node: Debugging via autom4te461971
  20989. Node: Programming in M4sh463790
  20990. Node: Common Shell Constructs465163
  20991. Node: Polymorphic Variables473136
  20992. Node: Initialization Macros482725
  20993. Node: File Descriptor Macros488314
  20994. Ref: AS_MESSAGE_LOG_FD489466
  20995. Node: Writing Autoconf Macros490968
  20996. Node: Macro Definitions491773
  20997. Node: Macro Names495452
  20998. Node: Reporting Messages499213
  20999. Node: Dependencies Between Macros501057
  21000. Node: Prerequisite Macros501752
  21001. Node: Suggested Ordering507827
  21002. Node: One-Shot Macros509370
  21003. Node: Obsoleting Macros510723
  21004. Ref: AU_DEFUN511477
  21005. Node: Coding Style512506
  21006. Node: Portable Shell520313
  21007. Node: Shellology524621
  21008. Node: Invoking the Shell528792
  21009. Node: Here-Documents529974
  21010. Node: File Descriptors533594
  21011. Node: Signal Handling540032
  21012. Node: File System Conventions545240
  21013. Node: Shell Pattern Matching551052
  21014. Node: Shell Substitutions551616
  21015. Node: Assignments569492
  21016. Node: Parentheses571383
  21017. Node: Slashes572340
  21018. Node: Special Shell Variables573194
  21019. Node: Shell Functions586526
  21020. Node: Limitations of Builtins589933
  21021. Ref: case593955
  21022. Ref: echo599113
  21023. Ref: export606087
  21024. Ref: if609507
  21025. Ref: set613318
  21026. Ref: trap625040
  21027. Ref: unset628851
  21028. Node: Limitations of Usual Tools629946
  21029. Ref: awk630245
  21030. Ref: grep648349
  21031. Ref: mkdir653981
  21032. Ref: sed659801
  21033. Ref: touch670932
  21034. Node: Portable Make674207
  21035. Node: $< in Ordinary Make Rules675869
  21036. Node: Failure in Make Rules676335
  21037. Node: Special Chars in Names677363
  21038. Node: Backslash-Newline-Empty678335
  21039. Node: Backslash-Newline Comments679367
  21040. Node: Long Lines in Makefiles680256
  21041. Node: Macros and Submakes680632
  21042. Node: The Make Macro MAKEFLAGS683319
  21043. Node: The Make Macro SHELL684204
  21044. Node: Parallel Make686703
  21045. Node: Comments in Make Rules690387
  21046. Node: Newlines in Make Rules691557
  21047. Node: Comments in Make Macros692602
  21048. Node: Trailing whitespace in Make Macros693812
  21049. Node: Command-line Macros and whitespace694563
  21050. Node: obj/ and Make695233
  21051. Node: make -k Status695884
  21052. Node: VPATH and Make696506
  21053. Node: Variables listed in VPATH697830
  21054. Node: VPATH and Double-colon698369
  21055. Node: $< in Explicit Rules698775
  21056. Node: Automatic Rule Rewriting699242
  21057. Node: Tru64 Directory Magic705924
  21058. Node: Make Target Lookup706750
  21059. Node: Single Suffix Rules711192
  21060. Node: Timestamps and Make712538
  21061. Node: Portable C and C++714223
  21062. Node: Varieties of Unportability715864
  21063. Node: Integer Overflow717961
  21064. Node: Integer Overflow Basics718974
  21065. Node: Signed Overflow Examples720722
  21066. Node: Optimization and Wraparound724224
  21067. Node: Signed Overflow Advice727186
  21068. Node: Signed Integer Division729860
  21069. Node: Preprocessor Arithmetic730471
  21070. Node: Null Pointers731220
  21071. Node: Buffer Overruns731854
  21072. Node: Volatile Objects734643
  21073. Node: Floating Point Portability740321
  21074. Node: Exiting Portably740828
  21075. Node: Manual Configuration742304
  21076. Node: Specifying Target Triplets743137
  21077. Ref: Specifying Names743310
  21078. Node: Canonicalizing746185
  21079. Node: Using System Type748448
  21080. Node: Site Configuration751252
  21081. Node: Help Formatting752224
  21082. Node: External Software753168
  21083. Ref: AC_ARG_WITH754714
  21084. Node: Package Options759039
  21085. Ref: AC_ARG_ENABLE760494
  21086. Node: Pretty Help Strings761655
  21087. Ref: AS_HELP_STRING762241
  21088. Node: Option Checking764582
  21089. Node: Site Details766310
  21090. Node: Transforming Names767539
  21091. Node: Transformation Options768621
  21092. Node: Transformation Examples769098
  21093. Node: Transformation Rules770819
  21094. Node: Site Defaults772365
  21095. Node: Running configure Scripts777706
  21096. Node: Basic Installation778771
  21097. Node: Compilers and Options782868
  21098. Node: Multiple Architectures783522
  21099. Node: Installation Names785102
  21100. Node: Optional Features787997
  21101. Node: Particular Systems789351
  21102. Node: System Type790775
  21103. Node: Sharing Defaults792103
  21104. Node: Defining Variables792741
  21105. Node: configure Invocation793639
  21106. Node: config.status Invocation795345
  21107. Ref: CONFIG_SHELL799092
  21108. Node: Obsolete Constructs800258
  21109. Node: Obsolete config.status Use801221
  21110. Node: acconfig Header802999
  21111. Node: autoupdate Invocation805021
  21112. Node: Obsolete Macros806887
  21113. Ref: AC_FUNC_SETVBUF_REVERSED814529
  21114. Ref: AC_TYPE_SIGNAL831075
  21115. Node: Autoconf 1834053
  21116. Node: Changed File Names835119
  21117. Node: Changed Makefiles835869
  21118. Node: Changed Macros836957
  21119. Node: Changed Results838211
  21120. Node: Changed Macro Writing840335
  21121. Node: Autoconf 2.13841615
  21122. Node: Changed Quotation842823
  21123. Node: New Macros844741
  21124. Node: Hosts and Cross-Compilation846536
  21125. Node: AC_LIBOBJ vs LIBOBJS850691
  21126. Node: AC_ACT_IFELSE vs AC_TRY_ACT852306
  21127. Ref: AC_FOO_IFELSE vs AC_TRY_FOO852495
  21128. Node: Using Autotest854308
  21129. Node: Using an Autotest Test Suite856712
  21130. Node: testsuite Scripts857003
  21131. Node: Autotest Logs861485
  21132. Node: Writing Testsuites863826
  21133. Node: testsuite Invocation880858
  21134. Node: Making testsuite Scripts886205
  21135. Node: FAQ891343
  21136. Node: Distributing892203
  21137. Node: Why GNU M4893252
  21138. Node: Bootstrapping894121
  21139. Node: Why Not Imake894731
  21140. Node: Defining Directories899482
  21141. Node: Autom4te Cache901640
  21142. Node: Present But Cannot Be Compiled903478
  21143. Node: Expanded Before Required907195
  21144. Node: Debugging912093
  21145. Node: History917116
  21146. Node: Genesis917985
  21147. Node: Exodus919163
  21148. Node: Leviticus922208
  21149. Node: Numbers923736
  21150. Node: Deuteronomy925651
  21151. Node: GNU Free Documentation License928322
  21152. Node: Indices953487
  21153. Node: Environment Variable Index954206
  21154. Node: Output Variable Index965546
  21155. Node: Preprocessor Symbol Index982426
  21156. Node: Cache Variable Index1000695
  21157. Node: Autoconf Macro Index1011383
  21158. Node: M4 Macro Index1045712
  21159. Node: Autotest Macro Index1066462
  21160. Node: Program & Function Index1068865
  21161. Node: Concept Index1089579
  21162. 
  21163. End Tag Table