aclocal.m4 110 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053
  1. # generated automatically by aclocal 1.12.5 -*- Autoconf -*-
  2. # Copyright (C) 1996-2012 Free Software Foundation, Inc.
  3. # This file is free software; the Free Software Foundation
  4. # gives unlimited permission to copy and/or distribute it,
  5. # with or without modifications, as long as this notice is preserved.
  6. # This program is distributed in the hope that it will be useful,
  7. # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
  8. # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  9. # PARTICULAR PURPOSE.
  10. m4_ifndef([AC_AUTOCONF_VERSION],
  11. [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
  12. m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
  13. [m4_warning([this file was generated for autoconf 2.69.
  14. You have another version of autoconf. It may work, but is not guaranteed to.
  15. If you have problems, you may need to regenerate the build system entirely.
  16. To do so, use the procedure documented by the package, typically 'autoreconf'.])])
  17. # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
  18. #
  19. # Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
  20. #
  21. # This program is free software; you can redistribute it and/or modify
  22. # it under the terms of the GNU General Public License as published by
  23. # the Free Software Foundation; either version 2 of the License, or
  24. # (at your option) any later version.
  25. #
  26. # This program is distributed in the hope that it will be useful, but
  27. # WITHOUT ANY WARRANTY; without even the implied warranty of
  28. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  29. # General Public License for more details.
  30. #
  31. # You should have received a copy of the GNU General Public License
  32. # along with this program; if not, write to the Free Software
  33. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  34. #
  35. # As a special exception to the GNU General Public License, if you
  36. # distribute this file as part of a program that contains a
  37. # configuration script generated by Autoconf, you may include it under
  38. # the same distribution terms that you use for the rest of that program.
  39. # PKG_PROG_PKG_CONFIG([MIN-VERSION])
  40. # ----------------------------------
  41. AC_DEFUN([PKG_PROG_PKG_CONFIG],
  42. [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
  43. m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
  44. AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
  45. if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
  46. AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
  47. fi
  48. if test -n "$PKG_CONFIG"; then
  49. _pkg_min_version=m4_default([$1], [0.9.0])
  50. AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
  51. if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
  52. AC_MSG_RESULT([yes])
  53. else
  54. AC_MSG_RESULT([no])
  55. PKG_CONFIG=""
  56. fi
  57. fi[]dnl
  58. ])# PKG_PROG_PKG_CONFIG
  59. # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
  60. #
  61. # Check to see whether a particular set of modules exists. Similar
  62. # to PKG_CHECK_MODULES(), but does not set variables or print errors.
  63. #
  64. #
  65. # Similar to PKG_CHECK_MODULES, make sure that the first instance of
  66. # this or PKG_CHECK_MODULES is called, or make sure to call
  67. # PKG_CHECK_EXISTS manually
  68. # --------------------------------------------------------------
  69. AC_DEFUN([PKG_CHECK_EXISTS],
  70. [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
  71. if test -n "$PKG_CONFIG" && \
  72. AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
  73. m4_ifval([$2], [$2], [:])
  74. m4_ifvaln([$3], [else
  75. $3])dnl
  76. fi])
  77. # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
  78. # ---------------------------------------------
  79. m4_define([_PKG_CONFIG],
  80. [if test -n "$PKG_CONFIG"; then
  81. if test -n "$$1"; then
  82. pkg_cv_[]$1="$$1"
  83. else
  84. PKG_CHECK_EXISTS([$3],
  85. [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
  86. [pkg_failed=yes])
  87. fi
  88. else
  89. pkg_failed=untried
  90. fi[]dnl
  91. ])# _PKG_CONFIG
  92. # _PKG_SHORT_ERRORS_SUPPORTED
  93. # -----------------------------
  94. AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
  95. [AC_REQUIRE([PKG_PROG_PKG_CONFIG])
  96. if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
  97. _pkg_short_errors_supported=yes
  98. else
  99. _pkg_short_errors_supported=no
  100. fi[]dnl
  101. ])# _PKG_SHORT_ERRORS_SUPPORTED
  102. # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
  103. # [ACTION-IF-NOT-FOUND])
  104. #
  105. #
  106. # Note that if there is a possibility the first call to
  107. # PKG_CHECK_MODULES might not happen, you should be sure to include an
  108. # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
  109. #
  110. #
  111. # --------------------------------------------------------------
  112. AC_DEFUN([PKG_CHECK_MODULES],
  113. [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
  114. AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
  115. AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
  116. pkg_failed=no
  117. AC_MSG_CHECKING([for $1])
  118. _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
  119. _PKG_CONFIG([$1][_LIBS], [libs], [$2])
  120. m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
  121. and $1[]_LIBS to avoid the need to call pkg-config.
  122. See the pkg-config man page for more details.])
  123. if test $pkg_failed = yes; then
  124. _PKG_SHORT_ERRORS_SUPPORTED
  125. if test $_pkg_short_errors_supported = yes; then
  126. $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
  127. else
  128. $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
  129. fi
  130. # Put the nasty error message in config.log where it belongs
  131. echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
  132. ifelse([$4], , [AC_MSG_ERROR(dnl
  133. [Package requirements ($2) were not met:
  134. $$1_PKG_ERRORS
  135. Consider adjusting the PKG_CONFIG_PATH environment variable if you
  136. installed software in a non-standard prefix.
  137. _PKG_TEXT
  138. ])],
  139. [AC_MSG_RESULT([no])
  140. $4])
  141. elif test $pkg_failed = untried; then
  142. ifelse([$4], , [AC_MSG_FAILURE(dnl
  143. [The pkg-config script could not be found or is too old. Make sure it
  144. is in your PATH or set the PKG_CONFIG environment variable to the full
  145. path to pkg-config.
  146. _PKG_TEXT
  147. To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
  148. [$4])
  149. else
  150. $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
  151. $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
  152. AC_MSG_RESULT([yes])
  153. ifelse([$3], , :, [$3])
  154. fi[]dnl
  155. ])# PKG_CHECK_MODULES
  156. # Copyright (C) 2002-2012 Free Software Foundation, Inc.
  157. #
  158. # This file is free software; the Free Software Foundation
  159. # gives unlimited permission to copy and/or distribute it,
  160. # with or without modifications, as long as this notice is preserved.
  161. # AM_AUTOMAKE_VERSION(VERSION)
  162. # ----------------------------
  163. # Automake X.Y traces this macro to ensure aclocal.m4 has been
  164. # generated from the m4 files accompanying Automake X.Y.
  165. # (This private macro should not be called outside this file.)
  166. AC_DEFUN([AM_AUTOMAKE_VERSION],
  167. [am__api_version='1.12'
  168. dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
  169. dnl require some minimum version. Point them to the right macro.
  170. m4_if([$1], [1.12.5], [],
  171. [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
  172. ])
  173. # _AM_AUTOCONF_VERSION(VERSION)
  174. # -----------------------------
  175. # aclocal traces this macro to find the Autoconf version.
  176. # This is a private macro too. Using m4_define simplifies
  177. # the logic in aclocal, which can simply ignore this definition.
  178. m4_define([_AM_AUTOCONF_VERSION], [])
  179. # AM_SET_CURRENT_AUTOMAKE_VERSION
  180. # -------------------------------
  181. # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
  182. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
  183. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
  184. [AM_AUTOMAKE_VERSION([1.12.5])dnl
  185. m4_ifndef([AC_AUTOCONF_VERSION],
  186. [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
  187. _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
  188. # AM_AUX_DIR_EXPAND -*- Autoconf -*-
  189. # Copyright (C) 2001-2012 Free Software Foundation, Inc.
  190. #
  191. # This file is free software; the Free Software Foundation
  192. # gives unlimited permission to copy and/or distribute it,
  193. # with or without modifications, as long as this notice is preserved.
  194. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
  195. # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
  196. # '$srcdir', '$srcdir/..', or '$srcdir/../..'.
  197. #
  198. # Of course, Automake must honor this variable whenever it calls a
  199. # tool from the auxiliary directory. The problem is that $srcdir (and
  200. # therefore $ac_aux_dir as well) can be either absolute or relative,
  201. # depending on how configure is run. This is pretty annoying, since
  202. # it makes $ac_aux_dir quite unusable in subdirectories: in the top
  203. # source directory, any form will work fine, but in subdirectories a
  204. # relative path needs to be adjusted first.
  205. #
  206. # $ac_aux_dir/missing
  207. # fails when called from a subdirectory if $ac_aux_dir is relative
  208. # $top_srcdir/$ac_aux_dir/missing
  209. # fails if $ac_aux_dir is absolute,
  210. # fails when called from a subdirectory in a VPATH build with
  211. # a relative $ac_aux_dir
  212. #
  213. # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
  214. # are both prefixed by $srcdir. In an in-source build this is usually
  215. # harmless because $srcdir is '.', but things will broke when you
  216. # start a VPATH build or use an absolute $srcdir.
  217. #
  218. # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
  219. # iff we strip the leading $srcdir from $ac_aux_dir. That would be:
  220. # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
  221. # and then we would define $MISSING as
  222. # MISSING="\${SHELL} $am_aux_dir/missing"
  223. # This will work as long as MISSING is not called from configure, because
  224. # unfortunately $(top_srcdir) has no meaning in configure.
  225. # However there are other variables, like CC, which are often used in
  226. # configure, and could therefore not use this "fixed" $ac_aux_dir.
  227. #
  228. # Another solution, used here, is to always expand $ac_aux_dir to an
  229. # absolute PATH. The drawback is that using absolute paths prevent a
  230. # configured tree to be moved without reconfiguration.
  231. AC_DEFUN([AM_AUX_DIR_EXPAND],
  232. [dnl Rely on autoconf to set up CDPATH properly.
  233. AC_PREREQ([2.50])dnl
  234. # expand $ac_aux_dir to an absolute path
  235. am_aux_dir=`cd $ac_aux_dir && pwd`
  236. ])
  237. # AM_CONDITIONAL -*- Autoconf -*-
  238. # Copyright (C) 1997-2012 Free Software Foundation, Inc.
  239. #
  240. # This file is free software; the Free Software Foundation
  241. # gives unlimited permission to copy and/or distribute it,
  242. # with or without modifications, as long as this notice is preserved.
  243. # AM_CONDITIONAL(NAME, SHELL-CONDITION)
  244. # -------------------------------------
  245. # Define a conditional.
  246. AC_DEFUN([AM_CONDITIONAL],
  247. [AC_PREREQ([2.52])dnl
  248. m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
  249. [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
  250. AC_SUBST([$1_TRUE])dnl
  251. AC_SUBST([$1_FALSE])dnl
  252. _AM_SUBST_NOTMAKE([$1_TRUE])dnl
  253. _AM_SUBST_NOTMAKE([$1_FALSE])dnl
  254. m4_define([_AM_COND_VALUE_$1], [$2])dnl
  255. if $2; then
  256. $1_TRUE=
  257. $1_FALSE='#'
  258. else
  259. $1_TRUE='#'
  260. $1_FALSE=
  261. fi
  262. AC_CONFIG_COMMANDS_PRE(
  263. [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
  264. AC_MSG_ERROR([[conditional "$1" was never defined.
  265. Usually this means the macro was only invoked conditionally.]])
  266. fi])])
  267. # Copyright (C) 1999-2012 Free Software Foundation, Inc.
  268. #
  269. # This file is free software; the Free Software Foundation
  270. # gives unlimited permission to copy and/or distribute it,
  271. # with or without modifications, as long as this notice is preserved.
  272. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
  273. # written in clear, in which case automake, when reading aclocal.m4,
  274. # will think it sees a *use*, and therefore will trigger all it's
  275. # C support machinery. Also note that it means that autoscan, seeing
  276. # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
  277. # _AM_DEPENDENCIES(NAME)
  278. # ----------------------
  279. # See how the compiler implements dependency checking.
  280. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
  281. # We try a few techniques and use that to set a single cache variable.
  282. #
  283. # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
  284. # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
  285. # dependency, and given that the user is not expected to run this macro,
  286. # just rely on AC_PROG_CC.
  287. AC_DEFUN([_AM_DEPENDENCIES],
  288. [AC_REQUIRE([AM_SET_DEPDIR])dnl
  289. AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
  290. AC_REQUIRE([AM_MAKE_INCLUDE])dnl
  291. AC_REQUIRE([AM_DEP_TRACK])dnl
  292. m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
  293. [$1], [CXX], [depcc="$CXX" am_compiler_list=],
  294. [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
  295. [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
  296. [$1], [UPC], [depcc="$UPC" am_compiler_list=],
  297. [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
  298. [depcc="$$1" am_compiler_list=])
  299. AC_CACHE_CHECK([dependency style of $depcc],
  300. [am_cv_$1_dependencies_compiler_type],
  301. [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
  302. # We make a subdir and do the tests there. Otherwise we can end up
  303. # making bogus files that we don't know about and never remove. For
  304. # instance it was reported that on HP-UX the gcc test will end up
  305. # making a dummy file named 'D' -- because '-MD' means "put the output
  306. # in D".
  307. rm -rf conftest.dir
  308. mkdir conftest.dir
  309. # Copy depcomp to subdir because otherwise we won't find it if we're
  310. # using a relative directory.
  311. cp "$am_depcomp" conftest.dir
  312. cd conftest.dir
  313. # We will build objects and dependencies in a subdirectory because
  314. # it helps to detect inapplicable dependency modes. For instance
  315. # both Tru64's cc and ICC support -MD to output dependencies as a
  316. # side effect of compilation, but ICC will put the dependencies in
  317. # the current directory while Tru64 will put them in the object
  318. # directory.
  319. mkdir sub
  320. am_cv_$1_dependencies_compiler_type=none
  321. if test "$am_compiler_list" = ""; then
  322. am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
  323. fi
  324. am__universal=false
  325. m4_case([$1], [CC],
  326. [case " $depcc " in #(
  327. *\ -arch\ *\ -arch\ *) am__universal=true ;;
  328. esac],
  329. [CXX],
  330. [case " $depcc " in #(
  331. *\ -arch\ *\ -arch\ *) am__universal=true ;;
  332. esac])
  333. for depmode in $am_compiler_list; do
  334. # Setup a source with many dependencies, because some compilers
  335. # like to wrap large dependency lists on column 80 (with \), and
  336. # we should not choose a depcomp mode which is confused by this.
  337. #
  338. # We need to recreate these files for each test, as the compiler may
  339. # overwrite some of them when testing with obscure command lines.
  340. # This happens at least with the AIX C compiler.
  341. : > sub/conftest.c
  342. for i in 1 2 3 4 5 6; do
  343. echo '#include "conftst'$i'.h"' >> sub/conftest.c
  344. # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
  345. # Solaris 10 /bin/sh.
  346. echo '/* dummy */' > sub/conftst$i.h
  347. done
  348. echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
  349. # We check with '-c' and '-o' for the sake of the "dashmstdout"
  350. # mode. It turns out that the SunPro C++ compiler does not properly
  351. # handle '-M -o', and we need to detect this. Also, some Intel
  352. # versions had trouble with output in subdirs.
  353. am__obj=sub/conftest.${OBJEXT-o}
  354. am__minus_obj="-o $am__obj"
  355. case $depmode in
  356. gcc)
  357. # This depmode causes a compiler race in universal mode.
  358. test "$am__universal" = false || continue
  359. ;;
  360. nosideeffect)
  361. # After this tag, mechanisms are not by side-effect, so they'll
  362. # only be used when explicitly requested.
  363. if test "x$enable_dependency_tracking" = xyes; then
  364. continue
  365. else
  366. break
  367. fi
  368. ;;
  369. msvc7 | msvc7msys | msvisualcpp | msvcmsys)
  370. # This compiler won't grok '-c -o', but also, the minuso test has
  371. # not run yet. These depmodes are late enough in the game, and
  372. # so weak that their functioning should not be impacted.
  373. am__obj=conftest.${OBJEXT-o}
  374. am__minus_obj=
  375. ;;
  376. none) break ;;
  377. esac
  378. if depmode=$depmode \
  379. source=sub/conftest.c object=$am__obj \
  380. depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
  381. $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
  382. >/dev/null 2>conftest.err &&
  383. grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
  384. grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
  385. grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
  386. ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
  387. # icc doesn't choke on unknown options, it will just issue warnings
  388. # or remarks (even with -Werror). So we grep stderr for any message
  389. # that says an option was ignored or not supported.
  390. # When given -MP, icc 7.0 and 7.1 complain thusly:
  391. # icc: Command line warning: ignoring option '-M'; no argument required
  392. # The diagnosis changed in icc 8.0:
  393. # icc: Command line remark: option '-MP' not supported
  394. if (grep 'ignoring option' conftest.err ||
  395. grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
  396. am_cv_$1_dependencies_compiler_type=$depmode
  397. break
  398. fi
  399. fi
  400. done
  401. cd ..
  402. rm -rf conftest.dir
  403. else
  404. am_cv_$1_dependencies_compiler_type=none
  405. fi
  406. ])
  407. AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
  408. AM_CONDITIONAL([am__fastdep$1], [
  409. test "x$enable_dependency_tracking" != xno \
  410. && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
  411. ])
  412. # AM_SET_DEPDIR
  413. # -------------
  414. # Choose a directory name for dependency files.
  415. # This macro is AC_REQUIREd in _AM_DEPENDENCIES.
  416. AC_DEFUN([AM_SET_DEPDIR],
  417. [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
  418. AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
  419. ])
  420. # AM_DEP_TRACK
  421. # ------------
  422. AC_DEFUN([AM_DEP_TRACK],
  423. [AC_ARG_ENABLE([dependency-tracking], [dnl
  424. AS_HELP_STRING(
  425. [--enable-dependency-tracking],
  426. [do not reject slow dependency extractors])
  427. AS_HELP_STRING(
  428. [--disable-dependency-tracking],
  429. [speeds up one-time build])])
  430. if test "x$enable_dependency_tracking" != xno; then
  431. am_depcomp="$ac_aux_dir/depcomp"
  432. AMDEPBACKSLASH='\'
  433. am__nodep='_no'
  434. fi
  435. AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
  436. AC_SUBST([AMDEPBACKSLASH])dnl
  437. _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
  438. AC_SUBST([am__nodep])dnl
  439. _AM_SUBST_NOTMAKE([am__nodep])dnl
  440. ])
  441. # Generate code to set up dependency tracking. -*- Autoconf -*-
  442. # Copyright (C) 1999-2012 Free Software Foundation, Inc.
  443. #
  444. # This file is free software; the Free Software Foundation
  445. # gives unlimited permission to copy and/or distribute it,
  446. # with or without modifications, as long as this notice is preserved.
  447. # _AM_OUTPUT_DEPENDENCY_COMMANDS
  448. # ------------------------------
  449. AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
  450. [{
  451. # Autoconf 2.62 quotes --file arguments for eval, but not when files
  452. # are listed without --file. Let's play safe and only enable the eval
  453. # if we detect the quoting.
  454. case $CONFIG_FILES in
  455. *\'*) eval set x "$CONFIG_FILES" ;;
  456. *) set x $CONFIG_FILES ;;
  457. esac
  458. shift
  459. for mf
  460. do
  461. # Strip MF so we end up with the name of the file.
  462. mf=`echo "$mf" | sed -e 's/:.*$//'`
  463. # Check whether this is an Automake generated Makefile or not.
  464. # We used to match only the files named 'Makefile.in', but
  465. # some people rename them; so instead we look at the file content.
  466. # Grep'ing the first line is not enough: some people post-process
  467. # each Makefile.in and add a new line on top of each file to say so.
  468. # Grep'ing the whole file is not good either: AIX grep has a line
  469. # limit of 2048, but all sed's we know have understand at least 4000.
  470. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
  471. dirpart=`AS_DIRNAME("$mf")`
  472. else
  473. continue
  474. fi
  475. # Extract the definition of DEPDIR, am__include, and am__quote
  476. # from the Makefile without running 'make'.
  477. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
  478. test -z "$DEPDIR" && continue
  479. am__include=`sed -n 's/^am__include = //p' < "$mf"`
  480. test -z "am__include" && continue
  481. am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
  482. # Find all dependency output files, they are included files with
  483. # $(DEPDIR) in their names. We invoke sed twice because it is the
  484. # simplest approach to changing $(DEPDIR) to its actual value in the
  485. # expansion.
  486. for file in `sed -n "
  487. s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
  488. sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
  489. # Make sure the directory exists.
  490. test -f "$dirpart/$file" && continue
  491. fdir=`AS_DIRNAME(["$file"])`
  492. AS_MKDIR_P([$dirpart/$fdir])
  493. # echo "creating $dirpart/$file"
  494. echo '# dummy' > "$dirpart/$file"
  495. done
  496. done
  497. }
  498. ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
  499. # AM_OUTPUT_DEPENDENCY_COMMANDS
  500. # -----------------------------
  501. # This macro should only be invoked once -- use via AC_REQUIRE.
  502. #
  503. # This code is only required when automatic dependency tracking
  504. # is enabled. FIXME. This creates each '.P' file that we will
  505. # need in order to bootstrap the dependency handling code.
  506. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
  507. [AC_CONFIG_COMMANDS([depfiles],
  508. [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
  509. [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
  510. ])
  511. # Do all the work for Automake. -*- Autoconf -*-
  512. # Copyright (C) 1996-2012 Free Software Foundation, Inc.
  513. #
  514. # This file is free software; the Free Software Foundation
  515. # gives unlimited permission to copy and/or distribute it,
  516. # with or without modifications, as long as this notice is preserved.
  517. # This macro actually does too much. Some checks are only needed if
  518. # your package does certain things. But this isn't really a big deal.
  519. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
  520. # AM_INIT_AUTOMAKE([OPTIONS])
  521. # -----------------------------------------------
  522. # The call with PACKAGE and VERSION arguments is the old style
  523. # call (pre autoconf-2.50), which is being phased out. PACKAGE
  524. # and VERSION should now be passed to AC_INIT and removed from
  525. # the call to AM_INIT_AUTOMAKE.
  526. # We support both call styles for the transition. After
  527. # the next Automake release, Autoconf can make the AC_INIT
  528. # arguments mandatory, and then we can depend on a new Autoconf
  529. # release and drop the old call support.
  530. AC_DEFUN([AM_INIT_AUTOMAKE],
  531. [AC_PREREQ([2.62])dnl
  532. dnl Autoconf wants to disallow AM_ names. We explicitly allow
  533. dnl the ones we care about.
  534. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
  535. AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
  536. AC_REQUIRE([AC_PROG_INSTALL])dnl
  537. if test "`cd $srcdir && pwd`" != "`pwd`"; then
  538. # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
  539. # is not polluted with repeated "-I."
  540. AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
  541. # test to see if srcdir already configured
  542. if test -f $srcdir/config.status; then
  543. AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
  544. fi
  545. fi
  546. # test whether we have cygpath
  547. if test -z "$CYGPATH_W"; then
  548. if (cygpath --version) >/dev/null 2>/dev/null; then
  549. CYGPATH_W='cygpath -w'
  550. else
  551. CYGPATH_W=echo
  552. fi
  553. fi
  554. AC_SUBST([CYGPATH_W])
  555. # Define the identity of the package.
  556. dnl Distinguish between old-style and new-style calls.
  557. m4_ifval([$2],
  558. [AC_DIAGNOSE([obsolete],
  559. [$0: two- and three-arguments forms are deprecated. For more info, see:
  560. http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation])
  561. m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
  562. AC_SUBST([PACKAGE], [$1])dnl
  563. AC_SUBST([VERSION], [$2])],
  564. [_AM_SET_OPTIONS([$1])dnl
  565. dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
  566. m4_if(
  567. m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
  568. [ok:ok],,
  569. [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
  570. AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
  571. AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
  572. _AM_IF_OPTION([no-define],,
  573. [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
  574. AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
  575. # Some tools Automake needs.
  576. AC_REQUIRE([AM_SANITY_CHECK])dnl
  577. AC_REQUIRE([AC_ARG_PROGRAM])dnl
  578. AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
  579. AM_MISSING_PROG([AUTOCONF], [autoconf])
  580. AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
  581. AM_MISSING_PROG([AUTOHEADER], [autoheader])
  582. AM_MISSING_PROG([MAKEINFO], [makeinfo])
  583. AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
  584. AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
  585. AC_REQUIRE([AC_PROG_MKDIR_P])dnl
  586. # For better backward compatibility. To be removed once Automake 1.9.x
  587. # dies out for good. For more background, see:
  588. # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
  589. # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
  590. AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
  591. # We need awk for the "check" target. The system "awk" is bad on
  592. # some platforms.
  593. AC_REQUIRE([AC_PROG_AWK])dnl
  594. AC_REQUIRE([AC_PROG_MAKE_SET])dnl
  595. AC_REQUIRE([AM_SET_LEADING_DOT])dnl
  596. _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
  597. [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
  598. [_AM_PROG_TAR([v7])])])
  599. _AM_IF_OPTION([no-dependencies],,
  600. [AC_PROVIDE_IFELSE([AC_PROG_CC],
  601. [_AM_DEPENDENCIES([CC])],
  602. [m4_define([AC_PROG_CC],
  603. m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
  604. AC_PROVIDE_IFELSE([AC_PROG_CXX],
  605. [_AM_DEPENDENCIES([CXX])],
  606. [m4_define([AC_PROG_CXX],
  607. m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
  608. AC_PROVIDE_IFELSE([AC_PROG_OBJC],
  609. [_AM_DEPENDENCIES([OBJC])],
  610. [m4_define([AC_PROG_OBJC],
  611. m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
  612. dnl Support for Objective C++ was only introduced in Autoconf 2.65,
  613. dnl but we still cater to Autoconf 2.62.
  614. m4_ifdef([AC_PROG_OBJCXX],
  615. [AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
  616. [_AM_DEPENDENCIES([OBJCXX])],
  617. [m4_define([AC_PROG_OBJCXX],
  618. m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl
  619. ])
  620. _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
  621. dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the
  622. dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
  623. dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
  624. AC_CONFIG_COMMANDS_PRE(dnl
  625. [m4_provide_if([_AM_COMPILER_EXEEXT],
  626. [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
  627. ])
  628. dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
  629. dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
  630. dnl mangled by Autoconf and run in a shell conditional statement.
  631. m4_define([_AC_COMPILER_EXEEXT],
  632. m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
  633. # When config.status generates a header, we must update the stamp-h file.
  634. # This file resides in the same directory as the config header
  635. # that is generated. The stamp files are numbered to have different names.
  636. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
  637. # loop where config.status creates the headers, so we can generate
  638. # our stamp files there.
  639. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
  640. [# Compute $1's index in $config_headers.
  641. _am_arg=$1
  642. _am_stamp_count=1
  643. for _am_header in $config_headers :; do
  644. case $_am_header in
  645. $_am_arg | $_am_arg:* )
  646. break ;;
  647. * )
  648. _am_stamp_count=`expr $_am_stamp_count + 1` ;;
  649. esac
  650. done
  651. echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
  652. # Copyright (C) 2001-2012 Free Software Foundation, Inc.
  653. #
  654. # This file is free software; the Free Software Foundation
  655. # gives unlimited permission to copy and/or distribute it,
  656. # with or without modifications, as long as this notice is preserved.
  657. # AM_PROG_INSTALL_SH
  658. # ------------------
  659. # Define $install_sh.
  660. AC_DEFUN([AM_PROG_INSTALL_SH],
  661. [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
  662. if test x"${install_sh}" != xset; then
  663. case $am_aux_dir in
  664. *\ * | *\ *)
  665. install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
  666. *)
  667. install_sh="\${SHELL} $am_aux_dir/install-sh"
  668. esac
  669. fi
  670. AC_SUBST([install_sh])])
  671. # Copyright (C) 2003-2012 Free Software Foundation, Inc.
  672. #
  673. # This file is free software; the Free Software Foundation
  674. # gives unlimited permission to copy and/or distribute it,
  675. # with or without modifications, as long as this notice is preserved.
  676. # Check whether the underlying file-system supports filenames
  677. # with a leading dot. For instance MS-DOS doesn't.
  678. AC_DEFUN([AM_SET_LEADING_DOT],
  679. [rm -rf .tst 2>/dev/null
  680. mkdir .tst 2>/dev/null
  681. if test -d .tst; then
  682. am__leading_dot=.
  683. else
  684. am__leading_dot=_
  685. fi
  686. rmdir .tst 2>/dev/null
  687. AC_SUBST([am__leading_dot])])
  688. # Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
  689. # From Jim Meyering
  690. # Copyright (C) 1996-2012 Free Software Foundation, Inc.
  691. #
  692. # This file is free software; the Free Software Foundation
  693. # gives unlimited permission to copy and/or distribute it,
  694. # with or without modifications, as long as this notice is preserved.
  695. # AM_MAINTAINER_MODE([DEFAULT-MODE])
  696. # ----------------------------------
  697. # Control maintainer-specific portions of Makefiles.
  698. # Default is to disable them, unless 'enable' is passed literally.
  699. # For symmetry, 'disable' may be passed as well. Anyway, the user
  700. # can override the default with the --enable/--disable switch.
  701. AC_DEFUN([AM_MAINTAINER_MODE],
  702. [m4_case(m4_default([$1], [disable]),
  703. [enable], [m4_define([am_maintainer_other], [disable])],
  704. [disable], [m4_define([am_maintainer_other], [enable])],
  705. [m4_define([am_maintainer_other], [enable])
  706. m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
  707. AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
  708. dnl maintainer-mode's default is 'disable' unless 'enable' is passed
  709. AC_ARG_ENABLE([maintainer-mode],
  710. [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
  711. am_maintainer_other[ make rules and dependencies not useful
  712. (and sometimes confusing) to the casual installer])],
  713. [USE_MAINTAINER_MODE=$enableval],
  714. [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
  715. AC_MSG_RESULT([$USE_MAINTAINER_MODE])
  716. AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
  717. MAINT=$MAINTAINER_MODE_TRUE
  718. AC_SUBST([MAINT])dnl
  719. ]
  720. )
  721. AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
  722. # Check to see how 'make' treats includes. -*- Autoconf -*-
  723. # Copyright (C) 2001-2012 Free Software Foundation, Inc.
  724. #
  725. # This file is free software; the Free Software Foundation
  726. # gives unlimited permission to copy and/or distribute it,
  727. # with or without modifications, as long as this notice is preserved.
  728. # AM_MAKE_INCLUDE()
  729. # -----------------
  730. # Check to see how make treats includes.
  731. AC_DEFUN([AM_MAKE_INCLUDE],
  732. [am_make=${MAKE-make}
  733. cat > confinc << 'END'
  734. am__doit:
  735. @echo this is the am__doit target
  736. .PHONY: am__doit
  737. END
  738. # If we don't find an include directive, just comment out the code.
  739. AC_MSG_CHECKING([for style of include used by $am_make])
  740. am__include="#"
  741. am__quote=
  742. _am_result=none
  743. # First try GNU make style include.
  744. echo "include confinc" > confmf
  745. # Ignore all kinds of additional output from 'make'.
  746. case `$am_make -s -f confmf 2> /dev/null` in #(
  747. *the\ am__doit\ target*)
  748. am__include=include
  749. am__quote=
  750. _am_result=GNU
  751. ;;
  752. esac
  753. # Now try BSD make style include.
  754. if test "$am__include" = "#"; then
  755. echo '.include "confinc"' > confmf
  756. case `$am_make -s -f confmf 2> /dev/null` in #(
  757. *the\ am__doit\ target*)
  758. am__include=.include
  759. am__quote="\""
  760. _am_result=BSD
  761. ;;
  762. esac
  763. fi
  764. AC_SUBST([am__include])
  765. AC_SUBST([am__quote])
  766. AC_MSG_RESULT([$_am_result])
  767. rm -f confinc confmf
  768. ])
  769. # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
  770. # Copyright (C) 1997-2012 Free Software Foundation, Inc.
  771. #
  772. # This file is free software; the Free Software Foundation
  773. # gives unlimited permission to copy and/or distribute it,
  774. # with or without modifications, as long as this notice is preserved.
  775. # AM_MISSING_PROG(NAME, PROGRAM)
  776. # ------------------------------
  777. AC_DEFUN([AM_MISSING_PROG],
  778. [AC_REQUIRE([AM_MISSING_HAS_RUN])
  779. $1=${$1-"${am_missing_run}$2"}
  780. AC_SUBST($1)])
  781. # AM_MISSING_HAS_RUN
  782. # ------------------
  783. # Define MISSING if not defined so far and test if it supports --run.
  784. # If it does, set am_missing_run to use it, otherwise, to nothing.
  785. AC_DEFUN([AM_MISSING_HAS_RUN],
  786. [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
  787. AC_REQUIRE_AUX_FILE([missing])dnl
  788. if test x"${MISSING+set}" != xset; then
  789. case $am_aux_dir in
  790. *\ * | *\ *)
  791. MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
  792. *)
  793. MISSING="\${SHELL} $am_aux_dir/missing" ;;
  794. esac
  795. fi
  796. # Use eval to expand $SHELL
  797. if eval "$MISSING --run true"; then
  798. am_missing_run="$MISSING --run "
  799. else
  800. am_missing_run=
  801. AC_MSG_WARN(['missing' script is too old or missing])
  802. fi
  803. ])
  804. # Helper functions for option handling. -*- Autoconf -*-
  805. # Copyright (C) 2001-2012 Free Software Foundation, Inc.
  806. #
  807. # This file is free software; the Free Software Foundation
  808. # gives unlimited permission to copy and/or distribute it,
  809. # with or without modifications, as long as this notice is preserved.
  810. # _AM_MANGLE_OPTION(NAME)
  811. # -----------------------
  812. AC_DEFUN([_AM_MANGLE_OPTION],
  813. [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
  814. # _AM_SET_OPTION(NAME)
  815. # --------------------
  816. # Set option NAME. Presently that only means defining a flag for this option.
  817. AC_DEFUN([_AM_SET_OPTION],
  818. [m4_define(_AM_MANGLE_OPTION([$1]), [1])])
  819. # _AM_SET_OPTIONS(OPTIONS)
  820. # ------------------------
  821. # OPTIONS is a space-separated list of Automake options.
  822. AC_DEFUN([_AM_SET_OPTIONS],
  823. [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
  824. # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
  825. # -------------------------------------------
  826. # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
  827. AC_DEFUN([_AM_IF_OPTION],
  828. [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
  829. # Check to make sure that the build environment is sane. -*- Autoconf -*-
  830. # Copyright (C) 1996-2012 Free Software Foundation, Inc.
  831. #
  832. # This file is free software; the Free Software Foundation
  833. # gives unlimited permission to copy and/or distribute it,
  834. # with or without modifications, as long as this notice is preserved.
  835. # AM_SANITY_CHECK
  836. # ---------------
  837. AC_DEFUN([AM_SANITY_CHECK],
  838. [AC_MSG_CHECKING([whether build environment is sane])
  839. # Reject unsafe characters in $srcdir or the absolute working directory
  840. # name. Accept space and tab only in the latter.
  841. am_lf='
  842. '
  843. case `pwd` in
  844. *[[\\\"\#\$\&\'\`$am_lf]]*)
  845. AC_MSG_ERROR([unsafe absolute working directory name]);;
  846. esac
  847. case $srcdir in
  848. *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
  849. AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
  850. esac
  851. # Do 'set' in a subshell so we don't clobber the current shell's
  852. # arguments. Must try -L first in case configure is actually a
  853. # symlink; some systems play weird games with the mod time of symlinks
  854. # (eg FreeBSD returns the mod time of the symlink's containing
  855. # directory).
  856. if (
  857. am_has_slept=no
  858. for am_try in 1 2; do
  859. echo "timestamp, slept: $am_has_slept" > conftest.file
  860. set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
  861. if test "$[*]" = "X"; then
  862. # -L didn't work.
  863. set X `ls -t "$srcdir/configure" conftest.file`
  864. fi
  865. if test "$[*]" != "X $srcdir/configure conftest.file" \
  866. && test "$[*]" != "X conftest.file $srcdir/configure"; then
  867. # If neither matched, then we have a broken ls. This can happen
  868. # if, for instance, CONFIG_SHELL is bash and it inherits a
  869. # broken ls alias from the environment. This has actually
  870. # happened. Such a system could not be considered "sane".
  871. AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
  872. alias in your environment])
  873. fi
  874. if test "$[2]" = conftest.file || test $am_try -eq 2; then
  875. break
  876. fi
  877. # Just in case.
  878. sleep 1
  879. am_has_slept=yes
  880. done
  881. test "$[2]" = conftest.file
  882. )
  883. then
  884. # Ok.
  885. :
  886. else
  887. AC_MSG_ERROR([newly created file is older than distributed files!
  888. Check your system clock])
  889. fi
  890. AC_MSG_RESULT([yes])
  891. # If we didn't sleep, we still need to ensure time stamps of config.status and
  892. # generated files are strictly newer.
  893. am_sleep_pid=
  894. if grep 'slept: no' conftest.file >/dev/null 2>&1; then
  895. ( sleep 1 ) &
  896. am_sleep_pid=$!
  897. fi
  898. AC_CONFIG_COMMANDS_PRE(
  899. [AC_MSG_CHECKING([that generated files are newer than configure])
  900. if test -n "$am_sleep_pid"; then
  901. # Hide warnings about reused PIDs.
  902. wait $am_sleep_pid 2>/dev/null
  903. fi
  904. AC_MSG_RESULT([done])])
  905. rm -f conftest.file
  906. ])
  907. # Copyright (C) 2009-2012 Free Software Foundation, Inc.
  908. #
  909. # This file is free software; the Free Software Foundation
  910. # gives unlimited permission to copy and/or distribute it,
  911. # with or without modifications, as long as this notice is preserved.
  912. # AM_SILENT_RULES([DEFAULT])
  913. # --------------------------
  914. # Enable less verbose build rules; with the default set to DEFAULT
  915. # ("yes" being less verbose, "no" or empty being verbose).
  916. AC_DEFUN([AM_SILENT_RULES],
  917. [AC_ARG_ENABLE([silent-rules], [dnl
  918. AS_HELP_STRING(
  919. [--enable-silent-rules],
  920. [less verbose build output (undo: "make V=1")])
  921. AS_HELP_STRING(
  922. [--disable-silent-rules],
  923. [verbose build output (undo: "make V=0")])dnl
  924. ])
  925. case $enable_silent_rules in @%:@ (((
  926. yes) AM_DEFAULT_VERBOSITY=0;;
  927. no) AM_DEFAULT_VERBOSITY=1;;
  928. *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
  929. esac
  930. dnl
  931. dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
  932. dnl do not support nested variable expansions.
  933. dnl See automake bug#9928 and bug#10237.
  934. am_make=${MAKE-make}
  935. AC_CACHE_CHECK([whether $am_make supports nested variables],
  936. [am_cv_make_support_nested_variables],
  937. [if AS_ECHO([['TRUE=$(BAR$(V))
  938. BAR0=false
  939. BAR1=true
  940. V=1
  941. am__doit:
  942. @$(TRUE)
  943. .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
  944. am_cv_make_support_nested_variables=yes
  945. else
  946. am_cv_make_support_nested_variables=no
  947. fi])
  948. if test $am_cv_make_support_nested_variables = yes; then
  949. dnl Using '$V' instead of '$(V)' breaks IRIX make.
  950. AM_V='$(V)'
  951. AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
  952. else
  953. AM_V=$AM_DEFAULT_VERBOSITY
  954. AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
  955. fi
  956. AC_SUBST([AM_V])dnl
  957. AM_SUBST_NOTMAKE([AM_V])dnl
  958. AC_SUBST([AM_DEFAULT_V])dnl
  959. AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
  960. AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
  961. AM_BACKSLASH='\'
  962. AC_SUBST([AM_BACKSLASH])dnl
  963. _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
  964. ])
  965. # Copyright (C) 2001-2012 Free Software Foundation, Inc.
  966. #
  967. # This file is free software; the Free Software Foundation
  968. # gives unlimited permission to copy and/or distribute it,
  969. # with or without modifications, as long as this notice is preserved.
  970. # AM_PROG_INSTALL_STRIP
  971. # ---------------------
  972. # One issue with vendor 'install' (even GNU) is that you can't
  973. # specify the program used to strip binaries. This is especially
  974. # annoying in cross-compiling environments, where the build's strip
  975. # is unlikely to handle the host's binaries.
  976. # Fortunately install-sh will honor a STRIPPROG variable, so we
  977. # always use install-sh in "make install-strip", and initialize
  978. # STRIPPROG with the value of the STRIP variable (set by the user).
  979. AC_DEFUN([AM_PROG_INSTALL_STRIP],
  980. [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
  981. # Installed binaries are usually stripped using 'strip' when the user
  982. # run "make install-strip". However 'strip' might not be the right
  983. # tool to use in cross-compilation environments, therefore Automake
  984. # will honor the 'STRIP' environment variable to overrule this program.
  985. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
  986. if test "$cross_compiling" != no; then
  987. AC_CHECK_TOOL([STRIP], [strip], :)
  988. fi
  989. INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
  990. AC_SUBST([INSTALL_STRIP_PROGRAM])])
  991. # Copyright (C) 2006-2012 Free Software Foundation, Inc.
  992. #
  993. # This file is free software; the Free Software Foundation
  994. # gives unlimited permission to copy and/or distribute it,
  995. # with or without modifications, as long as this notice is preserved.
  996. # _AM_SUBST_NOTMAKE(VARIABLE)
  997. # ---------------------------
  998. # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
  999. # This macro is traced by Automake.
  1000. AC_DEFUN([_AM_SUBST_NOTMAKE])
  1001. # AM_SUBST_NOTMAKE(VARIABLE)
  1002. # --------------------------
  1003. # Public sister of _AM_SUBST_NOTMAKE.
  1004. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
  1005. # Check how to create a tarball. -*- Autoconf -*-
  1006. # Copyright (C) 2004-2012 Free Software Foundation, Inc.
  1007. #
  1008. # This file is free software; the Free Software Foundation
  1009. # gives unlimited permission to copy and/or distribute it,
  1010. # with or without modifications, as long as this notice is preserved.
  1011. # _AM_PROG_TAR(FORMAT)
  1012. # --------------------
  1013. # Check how to create a tarball in format FORMAT.
  1014. # FORMAT should be one of 'v7', 'ustar', or 'pax'.
  1015. #
  1016. # Substitute a variable $(am__tar) that is a command
  1017. # writing to stdout a FORMAT-tarball containing the directory
  1018. # $tardir.
  1019. # tardir=directory && $(am__tar) > result.tar
  1020. #
  1021. # Substitute a variable $(am__untar) that extract such
  1022. # a tarball read from stdin.
  1023. # $(am__untar) < result.tar
  1024. AC_DEFUN([_AM_PROG_TAR],
  1025. [# Always define AMTAR for backward compatibility. Yes, it's still used
  1026. # in the wild :-( We should find a proper way to deprecate it ...
  1027. AC_SUBST([AMTAR], ['$${TAR-tar}'])
  1028. m4_if([$1], [v7],
  1029. [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
  1030. [m4_case([$1], [ustar],, [pax],,
  1031. [m4_fatal([Unknown tar format])])
  1032. AC_MSG_CHECKING([how to create a $1 tar archive])
  1033. # Loop over all known methods to create a tar archive until one works.
  1034. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
  1035. _am_tools=${am_cv_prog_tar_$1-$_am_tools}
  1036. # Do not fold the above two line into one, because Tru64 sh and
  1037. # Solaris sh will not grok spaces in the rhs of '-'.
  1038. for _am_tool in $_am_tools
  1039. do
  1040. case $_am_tool in
  1041. gnutar)
  1042. for _am_tar in tar gnutar gtar;
  1043. do
  1044. AM_RUN_LOG([$_am_tar --version]) && break
  1045. done
  1046. am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
  1047. am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
  1048. am__untar="$_am_tar -xf -"
  1049. ;;
  1050. plaintar)
  1051. # Must skip GNU tar: if it does not support --format= it doesn't create
  1052. # ustar tarball either.
  1053. (tar --version) >/dev/null 2>&1 && continue
  1054. am__tar='tar chf - "$$tardir"'
  1055. am__tar_='tar chf - "$tardir"'
  1056. am__untar='tar xf -'
  1057. ;;
  1058. pax)
  1059. am__tar='pax -L -x $1 -w "$$tardir"'
  1060. am__tar_='pax -L -x $1 -w "$tardir"'
  1061. am__untar='pax -r'
  1062. ;;
  1063. cpio)
  1064. am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
  1065. am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
  1066. am__untar='cpio -i -H $1 -d'
  1067. ;;
  1068. none)
  1069. am__tar=false
  1070. am__tar_=false
  1071. am__untar=false
  1072. ;;
  1073. esac
  1074. # If the value was cached, stop now. We just wanted to have am__tar
  1075. # and am__untar set.
  1076. test -n "${am_cv_prog_tar_$1}" && break
  1077. # tar/untar a dummy directory, and stop if the command works
  1078. rm -rf conftest.dir
  1079. mkdir conftest.dir
  1080. echo GrepMe > conftest.dir/file
  1081. AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
  1082. rm -rf conftest.dir
  1083. if test -s conftest.tar; then
  1084. AM_RUN_LOG([$am__untar <conftest.tar])
  1085. grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
  1086. fi
  1087. done
  1088. rm -rf conftest.dir
  1089. AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
  1090. AC_MSG_RESULT([$am_cv_prog_tar_$1])])
  1091. AC_SUBST([am__tar])
  1092. AC_SUBST([am__untar])
  1093. ]) # _AM_PROG_TAR
  1094. dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure.
  1095. dnl
  1096. dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
  1097. dnl
  1098. dnl Permission is hereby granted, free of charge, to any person obtaining a
  1099. dnl copy of this software and associated documentation files (the "Software"),
  1100. dnl to deal in the Software without restriction, including without limitation
  1101. dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
  1102. dnl and/or sell copies of the Software, and to permit persons to whom the
  1103. dnl Software is furnished to do so, subject to the following conditions:
  1104. dnl
  1105. dnl The above copyright notice and this permission notice (including the next
  1106. dnl paragraph) shall be included in all copies or substantial portions of the
  1107. dnl Software.
  1108. dnl
  1109. dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1110. dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1111. dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  1112. dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1113. dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  1114. dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  1115. dnl DEALINGS IN THE SOFTWARE.
  1116. # XORG_MACROS_VERSION(required-version)
  1117. # -------------------------------------
  1118. # Minimum version: 1.1.0
  1119. #
  1120. # If you're using a macro added in Version 1.1 or newer, include this in
  1121. # your configure.ac with the minimum required version, such as:
  1122. # XORG_MACROS_VERSION(1.1)
  1123. #
  1124. # To ensure that this macro is defined, also add:
  1125. # m4_ifndef([XORG_MACROS_VERSION],
  1126. # [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
  1127. #
  1128. #
  1129. # See the "minimum version" comment for each macro you use to see what
  1130. # version you require.
  1131. m4_defun([XORG_MACROS_VERSION],[
  1132. m4_define([vers_have], [1.17])
  1133. m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
  1134. m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
  1135. m4_if(m4_cmp(maj_have, maj_needed), 0,,
  1136. [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
  1137. m4_if(m4_version_compare(vers_have, [$1]), -1,
  1138. [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
  1139. m4_undefine([vers_have])
  1140. m4_undefine([maj_have])
  1141. m4_undefine([maj_needed])
  1142. ]) # XORG_MACROS_VERSION
  1143. # XORG_PROG_RAWCPP()
  1144. # ------------------
  1145. # Minimum version: 1.0.0
  1146. #
  1147. # Find cpp program and necessary flags for use in pre-processing text files
  1148. # such as man pages and config files
  1149. AC_DEFUN([XORG_PROG_RAWCPP],[
  1150. AC_REQUIRE([AC_PROG_CPP])
  1151. AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
  1152. [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
  1153. # Check for flag to avoid builtin definitions - assumes unix is predefined,
  1154. # which is not the best choice for supporting other OS'es, but covers most
  1155. # of the ones we need for now.
  1156. AC_MSG_CHECKING([if $RAWCPP requires -undef])
  1157. AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
  1158. if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
  1159. AC_MSG_RESULT([no])
  1160. else
  1161. if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
  1162. RAWCPPFLAGS=-undef
  1163. AC_MSG_RESULT([yes])
  1164. # under Cygwin unix is still defined even with -undef
  1165. elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
  1166. RAWCPPFLAGS="-undef -ansi"
  1167. AC_MSG_RESULT([yes, with -ansi])
  1168. else
  1169. AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef. I don't know what to do.])
  1170. fi
  1171. fi
  1172. rm -f conftest.$ac_ext
  1173. AC_MSG_CHECKING([if $RAWCPP requires -traditional])
  1174. AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve "whitespace"?]])])
  1175. if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
  1176. AC_MSG_RESULT([no])
  1177. else
  1178. if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
  1179. RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
  1180. AC_MSG_RESULT([yes])
  1181. else
  1182. AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional. I don't know what to do.])
  1183. fi
  1184. fi
  1185. rm -f conftest.$ac_ext
  1186. AC_SUBST(RAWCPPFLAGS)
  1187. ]) # XORG_PROG_RAWCPP
  1188. # XORG_MANPAGE_SECTIONS()
  1189. # -----------------------
  1190. # Minimum version: 1.0.0
  1191. #
  1192. # Determine which sections man pages go in for the different man page types
  1193. # on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
  1194. # Not sure if there's any better way than just hardcoding by OS name.
  1195. # Override default settings by setting environment variables
  1196. # Added MAN_SUBSTS in version 1.8
  1197. # Added AC_PROG_SED in version 1.8
  1198. AC_DEFUN([XORG_MANPAGE_SECTIONS],[
  1199. AC_REQUIRE([AC_CANONICAL_HOST])
  1200. AC_REQUIRE([AC_PROG_SED])
  1201. if test x$APP_MAN_SUFFIX = x ; then
  1202. APP_MAN_SUFFIX=1
  1203. fi
  1204. if test x$APP_MAN_DIR = x ; then
  1205. APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
  1206. fi
  1207. if test x$LIB_MAN_SUFFIX = x ; then
  1208. LIB_MAN_SUFFIX=3
  1209. fi
  1210. if test x$LIB_MAN_DIR = x ; then
  1211. LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
  1212. fi
  1213. if test x$FILE_MAN_SUFFIX = x ; then
  1214. case $host_os in
  1215. solaris*) FILE_MAN_SUFFIX=4 ;;
  1216. *) FILE_MAN_SUFFIX=5 ;;
  1217. esac
  1218. fi
  1219. if test x$FILE_MAN_DIR = x ; then
  1220. FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
  1221. fi
  1222. if test x$MISC_MAN_SUFFIX = x ; then
  1223. case $host_os in
  1224. solaris*) MISC_MAN_SUFFIX=5 ;;
  1225. *) MISC_MAN_SUFFIX=7 ;;
  1226. esac
  1227. fi
  1228. if test x$MISC_MAN_DIR = x ; then
  1229. MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
  1230. fi
  1231. if test x$DRIVER_MAN_SUFFIX = x ; then
  1232. case $host_os in
  1233. solaris*) DRIVER_MAN_SUFFIX=7 ;;
  1234. *) DRIVER_MAN_SUFFIX=4 ;;
  1235. esac
  1236. fi
  1237. if test x$DRIVER_MAN_DIR = x ; then
  1238. DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
  1239. fi
  1240. if test x$ADMIN_MAN_SUFFIX = x ; then
  1241. case $host_os in
  1242. solaris*) ADMIN_MAN_SUFFIX=1m ;;
  1243. *) ADMIN_MAN_SUFFIX=8 ;;
  1244. esac
  1245. fi
  1246. if test x$ADMIN_MAN_DIR = x ; then
  1247. ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
  1248. fi
  1249. AC_SUBST([APP_MAN_SUFFIX])
  1250. AC_SUBST([LIB_MAN_SUFFIX])
  1251. AC_SUBST([FILE_MAN_SUFFIX])
  1252. AC_SUBST([MISC_MAN_SUFFIX])
  1253. AC_SUBST([DRIVER_MAN_SUFFIX])
  1254. AC_SUBST([ADMIN_MAN_SUFFIX])
  1255. AC_SUBST([APP_MAN_DIR])
  1256. AC_SUBST([LIB_MAN_DIR])
  1257. AC_SUBST([FILE_MAN_DIR])
  1258. AC_SUBST([MISC_MAN_DIR])
  1259. AC_SUBST([DRIVER_MAN_DIR])
  1260. AC_SUBST([ADMIN_MAN_DIR])
  1261. XORG_MAN_PAGE="X Version 11"
  1262. AC_SUBST([XORG_MAN_PAGE])
  1263. MAN_SUBSTS="\
  1264. -e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
  1265. -e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
  1266. -e 's|__xservername__|Xorg|g' \
  1267. -e 's|__xconfigfile__|xorg.conf|g' \
  1268. -e 's|__projectroot__|\$(prefix)|g' \
  1269. -e 's|__apploaddir__|\$(appdefaultdir)|g' \
  1270. -e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
  1271. -e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
  1272. -e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
  1273. -e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
  1274. -e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
  1275. -e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
  1276. AC_SUBST([MAN_SUBSTS])
  1277. ]) # XORG_MANPAGE_SECTIONS
  1278. # XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
  1279. # ------------------------
  1280. # Minimum version: 1.7.0
  1281. #
  1282. # Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
  1283. # provided by xorg-sgml-doctools, if installed.
  1284. AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
  1285. AC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
  1286. XORG_SGML_PATH=
  1287. PKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
  1288. [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
  1289. [m4_ifval([$1],[:],
  1290. [if test x"$cross_compiling" != x"yes" ; then
  1291. AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
  1292. [XORG_SGML_PATH=$prefix/share/sgml])
  1293. fi])
  1294. ])
  1295. # Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
  1296. # the path and the name of the doc stylesheet
  1297. if test "x$XORG_SGML_PATH" != "x" ; then
  1298. AC_MSG_RESULT([$XORG_SGML_PATH])
  1299. STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
  1300. XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
  1301. else
  1302. AC_MSG_RESULT([no])
  1303. fi
  1304. AC_SUBST(XORG_SGML_PATH)
  1305. AC_SUBST(STYLESHEET_SRCDIR)
  1306. AC_SUBST(XSL_STYLESHEET)
  1307. AM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
  1308. ]) # XORG_CHECK_SGML_DOCTOOLS
  1309. # XORG_CHECK_LINUXDOC
  1310. # -------------------
  1311. # Minimum version: 1.0.0
  1312. #
  1313. # Defines the variable MAKE_TEXT if the necessary tools and
  1314. # files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
  1315. # Whether or not the necessary tools and files are found can be checked
  1316. # with the AM_CONDITIONAL "BUILD_LINUXDOC"
  1317. AC_DEFUN([XORG_CHECK_LINUXDOC],[
  1318. AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
  1319. AC_REQUIRE([XORG_WITH_PS2PDF])
  1320. AC_PATH_PROG(LINUXDOC, linuxdoc)
  1321. AC_MSG_CHECKING([whether to build documentation])
  1322. if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
  1323. BUILDDOC=yes
  1324. else
  1325. BUILDDOC=no
  1326. fi
  1327. AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
  1328. AC_MSG_RESULT([$BUILDDOC])
  1329. AC_MSG_CHECKING([whether to build pdf documentation])
  1330. if test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
  1331. BUILDPDFDOC=yes
  1332. else
  1333. BUILDPDFDOC=no
  1334. fi
  1335. AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
  1336. AC_MSG_RESULT([$BUILDPDFDOC])
  1337. MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
  1338. MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
  1339. MAKE_PDF="$PS2PDF"
  1340. MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B html --split=0"
  1341. AC_SUBST(MAKE_TEXT)
  1342. AC_SUBST(MAKE_PS)
  1343. AC_SUBST(MAKE_PDF)
  1344. AC_SUBST(MAKE_HTML)
  1345. ]) # XORG_CHECK_LINUXDOC
  1346. # XORG_CHECK_DOCBOOK
  1347. # -------------------
  1348. # Minimum version: 1.0.0
  1349. #
  1350. # Checks for the ability to build output formats from SGML DocBook source.
  1351. # For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
  1352. # indicates whether the necessary tools and files are found and, if set,
  1353. # $(MAKE_XXX) blah.sgml will produce blah.xxx.
  1354. AC_DEFUN([XORG_CHECK_DOCBOOK],[
  1355. AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
  1356. BUILDTXTDOC=no
  1357. BUILDPDFDOC=no
  1358. BUILDPSDOC=no
  1359. BUILDHTMLDOC=no
  1360. AC_PATH_PROG(DOCBOOKPS, docbook2ps)
  1361. AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
  1362. AC_PATH_PROG(DOCBOOKHTML, docbook2html)
  1363. AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
  1364. AC_MSG_CHECKING([whether to build text documentation])
  1365. if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
  1366. test x$BUILD_TXTDOC != xno; then
  1367. BUILDTXTDOC=yes
  1368. fi
  1369. AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
  1370. AC_MSG_RESULT([$BUILDTXTDOC])
  1371. AC_MSG_CHECKING([whether to build PDF documentation])
  1372. if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
  1373. test x$BUILD_PDFDOC != xno; then
  1374. BUILDPDFDOC=yes
  1375. fi
  1376. AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
  1377. AC_MSG_RESULT([$BUILDPDFDOC])
  1378. AC_MSG_CHECKING([whether to build PostScript documentation])
  1379. if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
  1380. test x$BUILD_PSDOC != xno; then
  1381. BUILDPSDOC=yes
  1382. fi
  1383. AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
  1384. AC_MSG_RESULT([$BUILDPSDOC])
  1385. AC_MSG_CHECKING([whether to build HTML documentation])
  1386. if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
  1387. test x$BUILD_HTMLDOC != xno; then
  1388. BUILDHTMLDOC=yes
  1389. fi
  1390. AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
  1391. AC_MSG_RESULT([$BUILDHTMLDOC])
  1392. MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
  1393. MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
  1394. MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
  1395. MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
  1396. AC_SUBST(MAKE_TEXT)
  1397. AC_SUBST(MAKE_PS)
  1398. AC_SUBST(MAKE_PDF)
  1399. AC_SUBST(MAKE_HTML)
  1400. ]) # XORG_CHECK_DOCBOOK
  1401. # XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
  1402. # ----------------
  1403. # Minimum version: 1.5.0
  1404. # Minimum version for optional DEFAULT argument: 1.11.0
  1405. #
  1406. # Documentation tools are not always available on all platforms and sometimes
  1407. # not at the appropriate level. This macro enables a module to test for the
  1408. # presence of the tool and obtain it's path in separate variables. Coupled with
  1409. # the --with-xmlto option, it allows maximum flexibilty in making decisions
  1410. # as whether or not to use the xmlto package. When DEFAULT is not specified,
  1411. # --with-xmlto assumes 'auto'.
  1412. #
  1413. # Interface to module:
  1414. # HAVE_XMLTO: used in makefiles to conditionally generate documentation
  1415. # XMLTO: returns the path of the xmlto program found
  1416. # returns the path set by the user in the environment
  1417. # --with-xmlto: 'yes' user instructs the module to use xmlto
  1418. # 'no' user instructs the module not to use xmlto
  1419. #
  1420. # Added in version 1.10.0
  1421. # HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
  1422. # xmlto for text output requires either lynx, links, or w3m browsers
  1423. #
  1424. # If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
  1425. #
  1426. AC_DEFUN([XORG_WITH_XMLTO],[
  1427. AC_ARG_VAR([XMLTO], [Path to xmlto command])
  1428. m4_define([_defopt], m4_default([$2], [auto]))
  1429. AC_ARG_WITH(xmlto,
  1430. AS_HELP_STRING([--with-xmlto],
  1431. [Use xmlto to regenerate documentation (default: ]_defopt[)]),
  1432. [use_xmlto=$withval], [use_xmlto=]_defopt)
  1433. m4_undefine([_defopt])
  1434. if test "x$use_xmlto" = x"auto"; then
  1435. AC_PATH_PROG([XMLTO], [xmlto])
  1436. if test "x$XMLTO" = "x"; then
  1437. AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
  1438. have_xmlto=no
  1439. else
  1440. have_xmlto=yes
  1441. fi
  1442. elif test "x$use_xmlto" = x"yes" ; then
  1443. AC_PATH_PROG([XMLTO], [xmlto])
  1444. if test "x$XMLTO" = "x"; then
  1445. AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
  1446. fi
  1447. have_xmlto=yes
  1448. elif test "x$use_xmlto" = x"no" ; then
  1449. if test "x$XMLTO" != "x"; then
  1450. AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
  1451. fi
  1452. have_xmlto=no
  1453. else
  1454. AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
  1455. fi
  1456. # Test for a minimum version of xmlto, if provided.
  1457. m4_ifval([$1],
  1458. [if test "$have_xmlto" = yes; then
  1459. # scrape the xmlto version
  1460. AC_MSG_CHECKING([the xmlto version])
  1461. xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
  1462. AC_MSG_RESULT([$xmlto_version])
  1463. AS_VERSION_COMPARE([$xmlto_version], [$1],
  1464. [if test "x$use_xmlto" = xauto; then
  1465. AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
  1466. have_xmlto=no
  1467. else
  1468. AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
  1469. fi])
  1470. fi])
  1471. # Test for the ability of xmlto to generate a text target
  1472. have_xmlto_text=no
  1473. cat > conftest.xml << "EOF"
  1474. EOF
  1475. AS_IF([test "$have_xmlto" = yes],
  1476. [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
  1477. [have_xmlto_text=yes],
  1478. [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
  1479. rm -f conftest.xml
  1480. AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
  1481. AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
  1482. ]) # XORG_WITH_XMLTO
  1483. # XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
  1484. # --------------------------------------------
  1485. # Minimum version: 1.12.0
  1486. # Minimum version for optional DEFAULT argument: 1.12.0
  1487. #
  1488. # XSLT (Extensible Stylesheet Language Transformations) is a declarative,
  1489. # XML-based language used for the transformation of XML documents.
  1490. # The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
  1491. # It is used under the cover by xmlto to generate html files from DocBook/XML.
  1492. # The XSLT processor is often used as a standalone tool for transformations.
  1493. # It should not be assumed that this tool is used only to work with documnetation.
  1494. # When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
  1495. #
  1496. # Interface to module:
  1497. # HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
  1498. # XSLTPROC: returns the path of the xsltproc program found
  1499. # returns the path set by the user in the environment
  1500. # --with-xsltproc: 'yes' user instructs the module to use xsltproc
  1501. # 'no' user instructs the module not to use xsltproc
  1502. # have_xsltproc: returns yes if xsltproc found in PATH or no
  1503. #
  1504. # If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
  1505. #
  1506. AC_DEFUN([XORG_WITH_XSLTPROC],[
  1507. AC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
  1508. # Preserves the interface, should it be implemented later
  1509. m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
  1510. m4_define([_defopt], m4_default([$2], [auto]))
  1511. AC_ARG_WITH(xsltproc,
  1512. AS_HELP_STRING([--with-xsltproc],
  1513. [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
  1514. [use_xsltproc=$withval], [use_xsltproc=]_defopt)
  1515. m4_undefine([_defopt])
  1516. if test "x$use_xsltproc" = x"auto"; then
  1517. AC_PATH_PROG([XSLTPROC], [xsltproc])
  1518. if test "x$XSLTPROC" = "x"; then
  1519. AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
  1520. have_xsltproc=no
  1521. else
  1522. have_xsltproc=yes
  1523. fi
  1524. elif test "x$use_xsltproc" = x"yes" ; then
  1525. AC_PATH_PROG([XSLTPROC], [xsltproc])
  1526. if test "x$XSLTPROC" = "x"; then
  1527. AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
  1528. fi
  1529. have_xsltproc=yes
  1530. elif test "x$use_xsltproc" = x"no" ; then
  1531. if test "x$XSLTPROC" != "x"; then
  1532. AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
  1533. fi
  1534. have_xsltproc=no
  1535. else
  1536. AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
  1537. fi
  1538. AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
  1539. ]) # XORG_WITH_XSLTPROC
  1540. # XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
  1541. # ----------------------------------------
  1542. # Minimum version: 1.15.0
  1543. #
  1544. # PERL (Practical Extraction and Report Language) is a language optimized for
  1545. # scanning arbitrary text files, extracting information from those text files,
  1546. # and printing reports based on that information.
  1547. #
  1548. # When DEFAULT is not specified, --with-perl assumes 'auto'.
  1549. #
  1550. # Interface to module:
  1551. # HAVE_PERL: used in makefiles to conditionally scan text files
  1552. # PERL: returns the path of the perl program found
  1553. # returns the path set by the user in the environment
  1554. # --with-perl: 'yes' user instructs the module to use perl
  1555. # 'no' user instructs the module not to use perl
  1556. # have_perl: returns yes if perl found in PATH or no
  1557. #
  1558. # If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
  1559. #
  1560. AC_DEFUN([XORG_WITH_PERL],[
  1561. AC_ARG_VAR([PERL], [Path to perl command])
  1562. # Preserves the interface, should it be implemented later
  1563. m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
  1564. m4_define([_defopt], m4_default([$2], [auto]))
  1565. AC_ARG_WITH(perl,
  1566. AS_HELP_STRING([--with-perl],
  1567. [Use perl for extracting information from files (default: ]_defopt[)]),
  1568. [use_perl=$withval], [use_perl=]_defopt)
  1569. m4_undefine([_defopt])
  1570. if test "x$use_perl" = x"auto"; then
  1571. AC_PATH_PROG([PERL], [perl])
  1572. if test "x$PERL" = "x"; then
  1573. AC_MSG_WARN([perl not found - cannot extract information and report])
  1574. have_perl=no
  1575. else
  1576. have_perl=yes
  1577. fi
  1578. elif test "x$use_perl" = x"yes" ; then
  1579. AC_PATH_PROG([PERL], [perl])
  1580. if test "x$PERL" = "x"; then
  1581. AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
  1582. fi
  1583. have_perl=yes
  1584. elif test "x$use_perl" = x"no" ; then
  1585. if test "x$PERL" != "x"; then
  1586. AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
  1587. fi
  1588. have_perl=no
  1589. else
  1590. AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
  1591. fi
  1592. AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
  1593. ]) # XORG_WITH_PERL
  1594. # XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
  1595. # ----------------
  1596. # Minimum version: 1.5.0
  1597. # Minimum version for optional DEFAULT argument: 1.11.0
  1598. #
  1599. # Documentation tools are not always available on all platforms and sometimes
  1600. # not at the appropriate level. This macro enables a module to test for the
  1601. # presence of the tool and obtain it's path in separate variables. Coupled with
  1602. # the --with-asciidoc option, it allows maximum flexibilty in making decisions
  1603. # as whether or not to use the asciidoc package. When DEFAULT is not specified,
  1604. # --with-asciidoc assumes 'auto'.
  1605. #
  1606. # Interface to module:
  1607. # HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
  1608. # ASCIIDOC: returns the path of the asciidoc program found
  1609. # returns the path set by the user in the environment
  1610. # --with-asciidoc: 'yes' user instructs the module to use asciidoc
  1611. # 'no' user instructs the module not to use asciidoc
  1612. #
  1613. # If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
  1614. #
  1615. AC_DEFUN([XORG_WITH_ASCIIDOC],[
  1616. AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
  1617. m4_define([_defopt], m4_default([$2], [auto]))
  1618. AC_ARG_WITH(asciidoc,
  1619. AS_HELP_STRING([--with-asciidoc],
  1620. [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
  1621. [use_asciidoc=$withval], [use_asciidoc=]_defopt)
  1622. m4_undefine([_defopt])
  1623. if test "x$use_asciidoc" = x"auto"; then
  1624. AC_PATH_PROG([ASCIIDOC], [asciidoc])
  1625. if test "x$ASCIIDOC" = "x"; then
  1626. AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
  1627. have_asciidoc=no
  1628. else
  1629. have_asciidoc=yes
  1630. fi
  1631. elif test "x$use_asciidoc" = x"yes" ; then
  1632. AC_PATH_PROG([ASCIIDOC], [asciidoc])
  1633. if test "x$ASCIIDOC" = "x"; then
  1634. AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
  1635. fi
  1636. have_asciidoc=yes
  1637. elif test "x$use_asciidoc" = x"no" ; then
  1638. if test "x$ASCIIDOC" != "x"; then
  1639. AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
  1640. fi
  1641. have_asciidoc=no
  1642. else
  1643. AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
  1644. fi
  1645. m4_ifval([$1],
  1646. [if test "$have_asciidoc" = yes; then
  1647. # scrape the asciidoc version
  1648. AC_MSG_CHECKING([the asciidoc version])
  1649. asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
  1650. AC_MSG_RESULT([$asciidoc_version])
  1651. AS_VERSION_COMPARE([$asciidoc_version], [$1],
  1652. [if test "x$use_asciidoc" = xauto; then
  1653. AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
  1654. have_asciidoc=no
  1655. else
  1656. AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
  1657. fi])
  1658. fi])
  1659. AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
  1660. ]) # XORG_WITH_ASCIIDOC
  1661. # XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
  1662. # --------------------------------
  1663. # Minimum version: 1.5.0
  1664. # Minimum version for optional DEFAULT argument: 1.11.0
  1665. #
  1666. # Documentation tools are not always available on all platforms and sometimes
  1667. # not at the appropriate level. This macro enables a module to test for the
  1668. # presence of the tool and obtain it's path in separate variables. Coupled with
  1669. # the --with-doxygen option, it allows maximum flexibilty in making decisions
  1670. # as whether or not to use the doxygen package. When DEFAULT is not specified,
  1671. # --with-doxygen assumes 'auto'.
  1672. #
  1673. # Interface to module:
  1674. # HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
  1675. # DOXYGEN: returns the path of the doxygen program found
  1676. # returns the path set by the user in the environment
  1677. # --with-doxygen: 'yes' user instructs the module to use doxygen
  1678. # 'no' user instructs the module not to use doxygen
  1679. #
  1680. # If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
  1681. #
  1682. AC_DEFUN([XORG_WITH_DOXYGEN],[
  1683. AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
  1684. m4_define([_defopt], m4_default([$2], [auto]))
  1685. AC_ARG_WITH(doxygen,
  1686. AS_HELP_STRING([--with-doxygen],
  1687. [Use doxygen to regenerate documentation (default: ]_defopt[)]),
  1688. [use_doxygen=$withval], [use_doxygen=]_defopt)
  1689. m4_undefine([_defopt])
  1690. if test "x$use_doxygen" = x"auto"; then
  1691. AC_PATH_PROG([DOXYGEN], [doxygen])
  1692. if test "x$DOXYGEN" = "x"; then
  1693. AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
  1694. have_doxygen=no
  1695. else
  1696. have_doxygen=yes
  1697. fi
  1698. elif test "x$use_doxygen" = x"yes" ; then
  1699. AC_PATH_PROG([DOXYGEN], [doxygen])
  1700. if test "x$DOXYGEN" = "x"; then
  1701. AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
  1702. fi
  1703. have_doxygen=yes
  1704. elif test "x$use_doxygen" = x"no" ; then
  1705. if test "x$DOXYGEN" != "x"; then
  1706. AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
  1707. fi
  1708. have_doxygen=no
  1709. else
  1710. AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
  1711. fi
  1712. m4_ifval([$1],
  1713. [if test "$have_doxygen" = yes; then
  1714. # scrape the doxygen version
  1715. AC_MSG_CHECKING([the doxygen version])
  1716. doxygen_version=`$DOXYGEN --version 2>/dev/null`
  1717. AC_MSG_RESULT([$doxygen_version])
  1718. AS_VERSION_COMPARE([$doxygen_version], [$1],
  1719. [if test "x$use_doxygen" = xauto; then
  1720. AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
  1721. have_doxygen=no
  1722. else
  1723. AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
  1724. fi])
  1725. fi])
  1726. AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
  1727. ]) # XORG_WITH_DOXYGEN
  1728. # XORG_WITH_GROFF([DEFAULT])
  1729. # ----------------
  1730. # Minimum version: 1.6.0
  1731. # Minimum version for optional DEFAULT argument: 1.11.0
  1732. #
  1733. # Documentation tools are not always available on all platforms and sometimes
  1734. # not at the appropriate level. This macro enables a module to test for the
  1735. # presence of the tool and obtain it's path in separate variables. Coupled with
  1736. # the --with-groff option, it allows maximum flexibilty in making decisions
  1737. # as whether or not to use the groff package. When DEFAULT is not specified,
  1738. # --with-groff assumes 'auto'.
  1739. #
  1740. # Interface to module:
  1741. # HAVE_GROFF: used in makefiles to conditionally generate documentation
  1742. # HAVE_GROFF_MM: the memorandum macros (-mm) package
  1743. # HAVE_GROFF_MS: the -ms macros package
  1744. # GROFF: returns the path of the groff program found
  1745. # returns the path set by the user in the environment
  1746. # --with-groff: 'yes' user instructs the module to use groff
  1747. # 'no' user instructs the module not to use groff
  1748. #
  1749. # Added in version 1.9.0:
  1750. # HAVE_GROFF_HTML: groff has dependencies to output HTML format:
  1751. # pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
  1752. # psselect from the psutils package.
  1753. # the ghostcript package. Refer to the grohtml man pages
  1754. #
  1755. # If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
  1756. #
  1757. # OS and distros often splits groff in a basic and full package, the former
  1758. # having the groff program and the later having devices, fonts and macros
  1759. # Checking for the groff executable is not enough.
  1760. #
  1761. # If macros are missing, we cannot assume that groff is useless, so we don't
  1762. # unset HAVE_GROFF or GROFF env variables.
  1763. # HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
  1764. #
  1765. AC_DEFUN([XORG_WITH_GROFF],[
  1766. AC_ARG_VAR([GROFF], [Path to groff command])
  1767. m4_define([_defopt], m4_default([$1], [auto]))
  1768. AC_ARG_WITH(groff,
  1769. AS_HELP_STRING([--with-groff],
  1770. [Use groff to regenerate documentation (default: ]_defopt[)]),
  1771. [use_groff=$withval], [use_groff=]_defopt)
  1772. m4_undefine([_defopt])
  1773. if test "x$use_groff" = x"auto"; then
  1774. AC_PATH_PROG([GROFF], [groff])
  1775. if test "x$GROFF" = "x"; then
  1776. AC_MSG_WARN([groff not found - documentation targets will be skipped])
  1777. have_groff=no
  1778. else
  1779. have_groff=yes
  1780. fi
  1781. elif test "x$use_groff" = x"yes" ; then
  1782. AC_PATH_PROG([GROFF], [groff])
  1783. if test "x$GROFF" = "x"; then
  1784. AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
  1785. fi
  1786. have_groff=yes
  1787. elif test "x$use_groff" = x"no" ; then
  1788. if test "x$GROFF" != "x"; then
  1789. AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
  1790. fi
  1791. have_groff=no
  1792. else
  1793. AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
  1794. fi
  1795. # We have groff, test for the presence of the macro packages
  1796. if test "x$have_groff" = x"yes"; then
  1797. AC_MSG_CHECKING([for ${GROFF} -ms macros])
  1798. if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
  1799. groff_ms_works=yes
  1800. else
  1801. groff_ms_works=no
  1802. fi
  1803. AC_MSG_RESULT([$groff_ms_works])
  1804. AC_MSG_CHECKING([for ${GROFF} -mm macros])
  1805. if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
  1806. groff_mm_works=yes
  1807. else
  1808. groff_mm_works=no
  1809. fi
  1810. AC_MSG_RESULT([$groff_mm_works])
  1811. fi
  1812. # We have groff, test for HTML dependencies, one command per package
  1813. if test "x$have_groff" = x"yes"; then
  1814. AC_PATH_PROGS(GS_PATH, [gs gswin32c])
  1815. AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
  1816. AC_PATH_PROG(PSSELECT_PATH, [psselect])
  1817. if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
  1818. have_groff_html=yes
  1819. else
  1820. have_groff_html=no
  1821. AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
  1822. fi
  1823. fi
  1824. # Set Automake conditionals for Makefiles
  1825. AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
  1826. AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
  1827. AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
  1828. AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
  1829. ]) # XORG_WITH_GROFF
  1830. # XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
  1831. # ---------------------------------------
  1832. # Minimum version: 1.6.0
  1833. # Minimum version for optional DEFAULT argument: 1.11.0
  1834. # Minimum version for optional MIN-VERSION argument: 1.15.0
  1835. #
  1836. # Documentation tools are not always available on all platforms and sometimes
  1837. # not at the appropriate level. This macro enables a module to test for the
  1838. # presence of the tool and obtain it's path in separate variables. Coupled with
  1839. # the --with-fop option, it allows maximum flexibilty in making decisions
  1840. # as whether or not to use the fop package. When DEFAULT is not specified,
  1841. # --with-fop assumes 'auto'.
  1842. #
  1843. # Interface to module:
  1844. # HAVE_FOP: used in makefiles to conditionally generate documentation
  1845. # FOP: returns the path of the fop program found
  1846. # returns the path set by the user in the environment
  1847. # --with-fop: 'yes' user instructs the module to use fop
  1848. # 'no' user instructs the module not to use fop
  1849. #
  1850. # If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
  1851. #
  1852. AC_DEFUN([XORG_WITH_FOP],[
  1853. AC_ARG_VAR([FOP], [Path to fop command])
  1854. m4_define([_defopt], m4_default([$2], [auto]))
  1855. AC_ARG_WITH(fop,
  1856. AS_HELP_STRING([--with-fop],
  1857. [Use fop to regenerate documentation (default: ]_defopt[)]),
  1858. [use_fop=$withval], [use_fop=]_defopt)
  1859. m4_undefine([_defopt])
  1860. if test "x$use_fop" = x"auto"; then
  1861. AC_PATH_PROG([FOP], [fop])
  1862. if test "x$FOP" = "x"; then
  1863. AC_MSG_WARN([fop not found - documentation targets will be skipped])
  1864. have_fop=no
  1865. else
  1866. have_fop=yes
  1867. fi
  1868. elif test "x$use_fop" = x"yes" ; then
  1869. AC_PATH_PROG([FOP], [fop])
  1870. if test "x$FOP" = "x"; then
  1871. AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
  1872. fi
  1873. have_fop=yes
  1874. elif test "x$use_fop" = x"no" ; then
  1875. if test "x$FOP" != "x"; then
  1876. AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
  1877. fi
  1878. have_fop=no
  1879. else
  1880. AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
  1881. fi
  1882. # Test for a minimum version of fop, if provided.
  1883. m4_ifval([$1],
  1884. [if test "$have_fop" = yes; then
  1885. # scrape the fop version
  1886. AC_MSG_CHECKING([for fop minimum version])
  1887. fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
  1888. AC_MSG_RESULT([$fop_version])
  1889. AS_VERSION_COMPARE([$fop_version], [$1],
  1890. [if test "x$use_fop" = xauto; then
  1891. AC_MSG_WARN([fop version $fop_version found, but $1 needed])
  1892. have_fop=no
  1893. else
  1894. AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
  1895. fi])
  1896. fi])
  1897. AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
  1898. ]) # XORG_WITH_FOP
  1899. # XORG_WITH_PS2PDF([DEFAULT])
  1900. # ----------------
  1901. # Minimum version: 1.6.0
  1902. # Minimum version for optional DEFAULT argument: 1.11.0
  1903. #
  1904. # Documentation tools are not always available on all platforms and sometimes
  1905. # not at the appropriate level. This macro enables a module to test for the
  1906. # presence of the tool and obtain it's path in separate variables. Coupled with
  1907. # the --with-ps2pdf option, it allows maximum flexibilty in making decisions
  1908. # as whether or not to use the ps2pdf package. When DEFAULT is not specified,
  1909. # --with-ps2pdf assumes 'auto'.
  1910. #
  1911. # Interface to module:
  1912. # HAVE_PS2PDF: used in makefiles to conditionally generate documentation
  1913. # PS2PDF: returns the path of the ps2pdf program found
  1914. # returns the path set by the user in the environment
  1915. # --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
  1916. # 'no' user instructs the module not to use ps2pdf
  1917. #
  1918. # If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
  1919. #
  1920. AC_DEFUN([XORG_WITH_PS2PDF],[
  1921. AC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
  1922. m4_define([_defopt], m4_default([$1], [auto]))
  1923. AC_ARG_WITH(ps2pdf,
  1924. AS_HELP_STRING([--with-ps2pdf],
  1925. [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
  1926. [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
  1927. m4_undefine([_defopt])
  1928. if test "x$use_ps2pdf" = x"auto"; then
  1929. AC_PATH_PROG([PS2PDF], [ps2pdf])
  1930. if test "x$PS2PDF" = "x"; then
  1931. AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
  1932. have_ps2pdf=no
  1933. else
  1934. have_ps2pdf=yes
  1935. fi
  1936. elif test "x$use_ps2pdf" = x"yes" ; then
  1937. AC_PATH_PROG([PS2PDF], [ps2pdf])
  1938. if test "x$PS2PDF" = "x"; then
  1939. AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
  1940. fi
  1941. have_ps2pdf=yes
  1942. elif test "x$use_ps2pdf" = x"no" ; then
  1943. if test "x$PS2PDF" != "x"; then
  1944. AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
  1945. fi
  1946. have_ps2pdf=no
  1947. else
  1948. AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
  1949. fi
  1950. AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
  1951. ]) # XORG_WITH_PS2PDF
  1952. # XORG_ENABLE_DOCS (enable_docs=yes)
  1953. # ----------------
  1954. # Minimum version: 1.6.0
  1955. #
  1956. # Documentation tools are not always available on all platforms and sometimes
  1957. # not at the appropriate level. This macro enables a builder to skip all
  1958. # documentation targets except traditional man pages.
  1959. # Combined with the specific tool checking macros XORG_WITH_*, it provides
  1960. # maximum flexibilty in controlling documentation building.
  1961. # Refer to:
  1962. # XORG_WITH_XMLTO --with-xmlto
  1963. # XORG_WITH_ASCIIDOC --with-asciidoc
  1964. # XORG_WITH_DOXYGEN --with-doxygen
  1965. # XORG_WITH_FOP --with-fop
  1966. # XORG_WITH_GROFF --with-groff
  1967. # XORG_WITH_PS2PDF --with-ps2pdf
  1968. #
  1969. # Interface to module:
  1970. # ENABLE_DOCS: used in makefiles to conditionally generate documentation
  1971. # --enable-docs: 'yes' user instructs the module to generate docs
  1972. # 'no' user instructs the module not to generate docs
  1973. # parm1: specify the default value, yes or no.
  1974. #
  1975. AC_DEFUN([XORG_ENABLE_DOCS],[
  1976. m4_define([docs_default], m4_default([$1], [yes]))
  1977. AC_ARG_ENABLE(docs,
  1978. AS_HELP_STRING([--enable-docs],
  1979. [Enable building the documentation (default: ]docs_default[)]),
  1980. [build_docs=$enableval], [build_docs=]docs_default)
  1981. m4_undefine([docs_default])
  1982. AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
  1983. AC_MSG_CHECKING([whether to build documentation])
  1984. AC_MSG_RESULT([$build_docs])
  1985. ]) # XORG_ENABLE_DOCS
  1986. # XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
  1987. # ----------------
  1988. # Minimum version: 1.6.0
  1989. #
  1990. # This macro enables a builder to skip all developer documentation.
  1991. # Combined with the specific tool checking macros XORG_WITH_*, it provides
  1992. # maximum flexibilty in controlling documentation building.
  1993. # Refer to:
  1994. # XORG_WITH_XMLTO --with-xmlto
  1995. # XORG_WITH_ASCIIDOC --with-asciidoc
  1996. # XORG_WITH_DOXYGEN --with-doxygen
  1997. # XORG_WITH_FOP --with-fop
  1998. # XORG_WITH_GROFF --with-groff
  1999. # XORG_WITH_PS2PDF --with-ps2pdf
  2000. #
  2001. # Interface to module:
  2002. # ENABLE_DEVEL_DOCS: used in makefiles to conditionally generate developer docs
  2003. # --enable-devel-docs: 'yes' user instructs the module to generate developer docs
  2004. # 'no' user instructs the module not to generate developer docs
  2005. # parm1: specify the default value, yes or no.
  2006. #
  2007. AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
  2008. m4_define([devel_default], m4_default([$1], [yes]))
  2009. AC_ARG_ENABLE(devel-docs,
  2010. AS_HELP_STRING([--enable-devel-docs],
  2011. [Enable building the developer documentation (default: ]devel_default[)]),
  2012. [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
  2013. m4_undefine([devel_default])
  2014. AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
  2015. AC_MSG_CHECKING([whether to build developer documentation])
  2016. AC_MSG_RESULT([$build_devel_docs])
  2017. ]) # XORG_ENABLE_DEVEL_DOCS
  2018. # XORG_ENABLE_SPECS (enable_specs=yes)
  2019. # ----------------
  2020. # Minimum version: 1.6.0
  2021. #
  2022. # This macro enables a builder to skip all functional specification targets.
  2023. # Combined with the specific tool checking macros XORG_WITH_*, it provides
  2024. # maximum flexibilty in controlling documentation building.
  2025. # Refer to:
  2026. # XORG_WITH_XMLTO --with-xmlto
  2027. # XORG_WITH_ASCIIDOC --with-asciidoc
  2028. # XORG_WITH_DOXYGEN --with-doxygen
  2029. # XORG_WITH_FOP --with-fop
  2030. # XORG_WITH_GROFF --with-groff
  2031. # XORG_WITH_PS2PDF --with-ps2pdf
  2032. #
  2033. # Interface to module:
  2034. # ENABLE_SPECS: used in makefiles to conditionally generate specs
  2035. # --enable-specs: 'yes' user instructs the module to generate specs
  2036. # 'no' user instructs the module not to generate specs
  2037. # parm1: specify the default value, yes or no.
  2038. #
  2039. AC_DEFUN([XORG_ENABLE_SPECS],[
  2040. m4_define([spec_default], m4_default([$1], [yes]))
  2041. AC_ARG_ENABLE(specs,
  2042. AS_HELP_STRING([--enable-specs],
  2043. [Enable building the specs (default: ]spec_default[)]),
  2044. [build_specs=$enableval], [build_specs=]spec_default)
  2045. m4_undefine([spec_default])
  2046. AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
  2047. AC_MSG_CHECKING([whether to build functional specifications])
  2048. AC_MSG_RESULT([$build_specs])
  2049. ]) # XORG_ENABLE_SPECS
  2050. # XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
  2051. # ----------------------------------------------
  2052. # Minimum version: 1.13.0
  2053. #
  2054. # This macro enables a builder to enable/disable unit testing
  2055. # It makes no assumption about the test cases implementation
  2056. # Test cases may or may not use Automake "Support for test suites"
  2057. # They may or may not use the software utility library GLib
  2058. #
  2059. # When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
  2060. # ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
  2061. # The variable enable_unit_tests is used by other macros in this file.
  2062. #
  2063. # Interface to module:
  2064. # ENABLE_UNIT_TESTS: used in makefiles to conditionally build tests
  2065. # enable_unit_tests: used in configure.ac for additional configuration
  2066. # --enable-unit-tests: 'yes' user instructs the module to build tests
  2067. # 'no' user instructs the module not to build tests
  2068. # parm1: specify the default value, yes or no.
  2069. #
  2070. AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
  2071. AC_BEFORE([$0], [XORG_WITH_GLIB])
  2072. AC_BEFORE([$0], [XORG_LD_WRAP])
  2073. AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
  2074. m4_define([_defopt], m4_default([$1], [auto]))
  2075. AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
  2076. [Enable building unit test cases (default: ]_defopt[)]),
  2077. [enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
  2078. m4_undefine([_defopt])
  2079. AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
  2080. AC_MSG_CHECKING([whether to build unit test cases])
  2081. AC_MSG_RESULT([$enable_unit_tests])
  2082. ]) # XORG_ENABLE_UNIT_TESTS
  2083. # XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
  2084. # ------------------------------------------------------
  2085. # Minimum version: 1.17.0
  2086. #
  2087. # This macro enables a builder to enable/disable integration testing
  2088. # It makes no assumption about the test cases' implementation
  2089. # Test cases may or may not use Automake "Support for test suites"
  2090. #
  2091. # Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
  2092. # usually requires less dependencies and may be built and run under less
  2093. # stringent environments than integration tests.
  2094. #
  2095. # Interface to module:
  2096. # ENABLE_INTEGRATION_TESTS: used in makefiles to conditionally build tests
  2097. # enable_integration_tests: used in configure.ac for additional configuration
  2098. # --enable-integration-tests: 'yes' user instructs the module to build tests
  2099. # 'no' user instructs the module not to build tests
  2100. # parm1: specify the default value, yes or no.
  2101. #
  2102. AC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
  2103. AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
  2104. m4_define([_defopt], m4_default([$1], [auto]))
  2105. AC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
  2106. [Enable building integration test cases (default: ]_defopt[)]),
  2107. [enable_integration_tests=$enableval],
  2108. [enable_integration_tests=]_defopt)
  2109. m4_undefine([_defopt])
  2110. AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
  2111. [test "x$enable_integration_tests" != xno])
  2112. AC_MSG_CHECKING([whether to build unit test cases])
  2113. AC_MSG_RESULT([$enable_integration_tests])
  2114. ]) # XORG_ENABLE_INTEGRATION_TESTS
  2115. # XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
  2116. # ----------------------------------------
  2117. # Minimum version: 1.13.0
  2118. #
  2119. # GLib is a library which provides advanced data structures and functions.
  2120. # This macro enables a module to test for the presence of Glib.
  2121. #
  2122. # When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
  2123. # Otherwise the value of $enable_unit_tests is blank.
  2124. #
  2125. # Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
  2126. # test support usually requires less dependencies and may be built and run under
  2127. # less stringent environments than integration tests.
  2128. #
  2129. # Interface to module:
  2130. # HAVE_GLIB: used in makefiles to conditionally build targets
  2131. # with_glib: used in configure.ac to know if GLib has been found
  2132. # --with-glib: 'yes' user instructs the module to use glib
  2133. # 'no' user instructs the module not to use glib
  2134. #
  2135. AC_DEFUN([XORG_WITH_GLIB],[
  2136. AC_REQUIRE([PKG_PROG_PKG_CONFIG])
  2137. m4_define([_defopt], m4_default([$2], [auto]))
  2138. AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
  2139. [Use GLib library for unit testing (default: ]_defopt[)]),
  2140. [with_glib=$withval], [with_glib=]_defopt)
  2141. m4_undefine([_defopt])
  2142. have_glib=no
  2143. # Do not probe GLib if user explicitly disabled unit testing
  2144. if test "x$enable_unit_tests" != x"no"; then
  2145. # Do not probe GLib if user explicitly disabled it
  2146. if test "x$with_glib" != x"no"; then
  2147. m4_ifval(
  2148. [$1],
  2149. [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
  2150. [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
  2151. )
  2152. fi
  2153. fi
  2154. # Not having GLib when unit testing has been explicitly requested is an error
  2155. if test "x$enable_unit_tests" = x"yes"; then
  2156. if test "x$have_glib" = x"no"; then
  2157. AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
  2158. fi
  2159. fi
  2160. # Having unit testing disabled when GLib has been explicitly requested is an error
  2161. if test "x$enable_unit_tests" = x"no"; then
  2162. if test "x$with_glib" = x"yes"; then
  2163. AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
  2164. fi
  2165. fi
  2166. # Not having GLib when it has been explicitly requested is an error
  2167. if test "x$with_glib" = x"yes"; then
  2168. if test "x$have_glib" = x"no"; then
  2169. AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
  2170. fi
  2171. fi
  2172. AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
  2173. ]) # XORG_WITH_GLIB
  2174. # XORG_LD_WRAP([required|optional])
  2175. # ---------------------------------
  2176. # Minimum version: 1.13.0
  2177. #
  2178. # Check if linker supports -wrap, passed via compiler flags
  2179. #
  2180. # When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
  2181. # Otherwise the value of $enable_unit_tests is blank.
  2182. #
  2183. # Argument added in 1.16.0 - default is "required", to match existing behavior
  2184. # of returning an error if enable_unit_tests is yes, and ld -wrap is not
  2185. # available, an argument of "optional" allows use when some unit tests require
  2186. # ld -wrap and others do not.
  2187. #
  2188. AC_DEFUN([XORG_LD_WRAP],[
  2189. XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
  2190. [AC_LANG_PROGRAM([#include <stdlib.h>
  2191. void __wrap_exit(int status) { return; }],
  2192. [exit(0);])])
  2193. # Not having ld wrap when unit testing has been explicitly requested is an error
  2194. if test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
  2195. if test "x$have_ld_wrap" = x"no"; then
  2196. AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
  2197. fi
  2198. fi
  2199. AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
  2200. #
  2201. ]) # XORG_LD_WRAP
  2202. # XORG_CHECK_LINKER_FLAGS
  2203. # -----------------------
  2204. # SYNOPSIS
  2205. #
  2206. # XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
  2207. #
  2208. # DESCRIPTION
  2209. #
  2210. # Check whether the given linker FLAGS work with the current language's
  2211. # linker, or whether they give an error.
  2212. #
  2213. # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
  2214. # success/failure.
  2215. #
  2216. # PROGRAM-SOURCE is the program source to link with, if needed
  2217. #
  2218. # NOTE: Based on AX_CHECK_COMPILER_FLAGS.
  2219. #
  2220. # LICENSE
  2221. #
  2222. # Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
  2223. # Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
  2224. # Copyright (c) 2009 Matteo Frigo
  2225. #
  2226. # This program is free software: you can redistribute it and/or modify it
  2227. # under the terms of the GNU General Public License as published by the
  2228. # Free Software Foundation, either version 3 of the License, or (at your
  2229. # option) any later version.
  2230. #
  2231. # This program is distributed in the hope that it will be useful, but
  2232. # WITHOUT ANY WARRANTY; without even the implied warranty of
  2233. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  2234. # Public License for more details.
  2235. #
  2236. # You should have received a copy of the GNU General Public License along
  2237. # with this program. If not, see <http://www.gnu.org/licenses/>.
  2238. #
  2239. # As a special exception, the respective Autoconf Macro's copyright owner
  2240. # gives unlimited permission to copy, distribute and modify the configure
  2241. # scripts that are the output of Autoconf when processing the Macro. You
  2242. # need not follow the terms of the GNU General Public License when using
  2243. # or distributing such scripts, even though portions of the text of the
  2244. # Macro appear in them. The GNU General Public License (GPL) does govern
  2245. # all other use of the material that constitutes the Autoconf Macro.
  2246. #
  2247. # This special exception to the GPL applies to versions of the Autoconf
  2248. # Macro released by the Autoconf Archive. When you make and distribute a
  2249. # modified version of the Autoconf Macro, you may extend this special
  2250. # exception to the GPL to apply to your modified version as well.#
  2251. AC_DEFUN([XORG_CHECK_LINKER_FLAGS],
  2252. [AC_MSG_CHECKING([whether the linker accepts $1])
  2253. dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
  2254. AS_LITERAL_IF([$1],
  2255. [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
  2256. ax_save_FLAGS=$LDFLAGS
  2257. LDFLAGS="$1"
  2258. AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
  2259. AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
  2260. AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
  2261. LDFLAGS=$ax_save_FLAGS])],
  2262. [ax_save_FLAGS=$LDFLAGS
  2263. LDFLAGS="$1"
  2264. AC_LINK_IFELSE([AC_LANG_PROGRAM()],
  2265. eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
  2266. eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
  2267. LDFLAGS=$ax_save_FLAGS])
  2268. eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
  2269. AC_MSG_RESULT($xorg_check_linker_flags)
  2270. if test "x$xorg_check_linker_flags" = xyes; then
  2271. m4_default([$2], :)
  2272. else
  2273. m4_default([$3], :)
  2274. fi
  2275. ]) # XORG_CHECK_LINKER_FLAGS
  2276. # XORG_MEMORY_CHECK_FLAGS
  2277. # -----------------------
  2278. # Minimum version: 1.16.0
  2279. #
  2280. # This macro attempts to find appropriate memory checking functionality
  2281. # for various platforms which unit testing code may use to catch various
  2282. # forms of memory allocation and access errors in testing.
  2283. #
  2284. # Interface to module:
  2285. # XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
  2286. # Usually added to TESTS_ENVIRONMENT in Makefile.am
  2287. #
  2288. # If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
  2289. #
  2290. AC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
  2291. AC_REQUIRE([AC_CANONICAL_HOST])
  2292. AC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
  2293. [Environment variables to enable memory checking in tests])
  2294. # Check for different types of support on different platforms
  2295. case $host_os in
  2296. solaris*)
  2297. AC_CHECK_LIB([umem], [umem_alloc],
  2298. [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
  2299. ;;
  2300. *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
  2301. # both directly and inverted, so should not be 0 or 255.
  2302. malloc_debug_env='MALLOC_PERTURB_=15'
  2303. ;;
  2304. darwin*)
  2305. malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
  2306. ;;
  2307. *bsd*)
  2308. malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
  2309. ;;
  2310. esac
  2311. # User supplied flags override default flags
  2312. if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
  2313. malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
  2314. fi
  2315. AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
  2316. ]) # XORG_WITH_LINT
  2317. # XORG_CHECK_MALLOC_ZERO
  2318. # ----------------------
  2319. # Minimum version: 1.0.0
  2320. #
  2321. # Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
  2322. # malloc(0) returns NULL. Packages should add one of these cflags to
  2323. # their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
  2324. AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
  2325. AC_ARG_ENABLE(malloc0returnsnull,
  2326. AS_HELP_STRING([--enable-malloc0returnsnull],
  2327. [malloc(0) returns NULL (default: auto)]),
  2328. [MALLOC_ZERO_RETURNS_NULL=$enableval],
  2329. [MALLOC_ZERO_RETURNS_NULL=auto])
  2330. AC_MSG_CHECKING([whether malloc(0) returns NULL])
  2331. if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
  2332. AC_RUN_IFELSE([AC_LANG_PROGRAM([
  2333. #include <stdlib.h>
  2334. ],[
  2335. char *m0, *r0, *c0, *p;
  2336. m0 = malloc(0);
  2337. p = malloc(10);
  2338. r0 = realloc(p,0);
  2339. c0 = calloc(0,10);
  2340. exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
  2341. ])],
  2342. [MALLOC_ZERO_RETURNS_NULL=yes],
  2343. [MALLOC_ZERO_RETURNS_NULL=no],
  2344. [MALLOC_ZERO_RETURNS_NULL=yes])
  2345. fi
  2346. AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
  2347. if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
  2348. MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
  2349. XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
  2350. XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
  2351. else
  2352. MALLOC_ZERO_CFLAGS=""
  2353. XMALLOC_ZERO_CFLAGS=""
  2354. XTMALLOC_ZERO_CFLAGS=""
  2355. fi
  2356. AC_SUBST([MALLOC_ZERO_CFLAGS])
  2357. AC_SUBST([XMALLOC_ZERO_CFLAGS])
  2358. AC_SUBST([XTMALLOC_ZERO_CFLAGS])
  2359. ]) # XORG_CHECK_MALLOC_ZERO
  2360. # XORG_WITH_LINT()
  2361. # ----------------
  2362. # Minimum version: 1.1.0
  2363. #
  2364. # This macro enables the use of a tool that flags some suspicious and
  2365. # non-portable constructs (likely to be bugs) in C language source code.
  2366. # It will attempt to locate the tool and use appropriate options.
  2367. # There are various lint type tools on different platforms.
  2368. #
  2369. # Interface to module:
  2370. # LINT: returns the path to the tool found on the platform
  2371. # or the value set to LINT on the configure cmd line
  2372. # also an Automake conditional
  2373. # LINT_FLAGS: an Automake variable with appropriate flags
  2374. #
  2375. # --with-lint: 'yes' user instructs the module to use lint
  2376. # 'no' user instructs the module not to use lint (default)
  2377. #
  2378. # If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
  2379. # If the user sets the value of LINT_FLAGS, they are used verbatim.
  2380. #
  2381. AC_DEFUN([XORG_WITH_LINT],[
  2382. AC_ARG_VAR([LINT], [Path to a lint-style command])
  2383. AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
  2384. AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
  2385. [Use a lint-style source code checker (default: disabled)])],
  2386. [use_lint=$withval], [use_lint=no])
  2387. # Obtain platform specific info like program name and options
  2388. # The lint program on FreeBSD and NetBSD is different from the one on Solaris
  2389. case $host_os in
  2390. *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
  2391. lint_name=splint
  2392. lint_options="-badflag"
  2393. ;;
  2394. *freebsd* | *netbsd*)
  2395. lint_name=lint
  2396. lint_options="-u -b"
  2397. ;;
  2398. *solaris*)
  2399. lint_name=lint
  2400. lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
  2401. ;;
  2402. esac
  2403. # Test for the presence of the program (either guessed by the code or spelled out by the user)
  2404. if test "x$use_lint" = x"yes" ; then
  2405. AC_PATH_PROG([LINT], [$lint_name])
  2406. if test "x$LINT" = "x"; then
  2407. AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
  2408. fi
  2409. elif test "x$use_lint" = x"no" ; then
  2410. if test "x$LINT" != "x"; then
  2411. AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
  2412. fi
  2413. else
  2414. AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
  2415. fi
  2416. # User supplied flags override default flags
  2417. if test "x$LINT_FLAGS" != "x"; then
  2418. lint_options=$LINT_FLAGS
  2419. fi
  2420. AC_SUBST([LINT_FLAGS],[$lint_options])
  2421. AM_CONDITIONAL(LINT, [test "x$LINT" != x])
  2422. ]) # XORG_WITH_LINT
  2423. # XORG_LINT_LIBRARY(LIBNAME)
  2424. # --------------------------
  2425. # Minimum version: 1.1.0
  2426. #
  2427. # Sets up flags for building lint libraries for checking programs that call
  2428. # functions in the library.
  2429. #
  2430. # Interface to module:
  2431. # LINTLIB - Automake variable with the name of lint library file to make
  2432. # MAKE_LINT_LIB - Automake conditional
  2433. #
  2434. # --enable-lint-library: - 'yes' user instructs the module to created a lint library
  2435. # - 'no' user instructs the module not to create a lint library (default)
  2436. AC_DEFUN([XORG_LINT_LIBRARY],[
  2437. AC_REQUIRE([XORG_WITH_LINT])
  2438. AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
  2439. [Create lint library (default: disabled)])],
  2440. [make_lint_lib=$enableval], [make_lint_lib=no])
  2441. if test "x$make_lint_lib" = x"yes" ; then
  2442. LINTLIB=llib-l$1.ln
  2443. if test "x$LINT" = "x"; then
  2444. AC_MSG_ERROR([Cannot make lint library without --with-lint])
  2445. fi
  2446. elif test "x$make_lint_lib" != x"no" ; then
  2447. AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
  2448. fi
  2449. AC_SUBST(LINTLIB)
  2450. AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
  2451. ]) # XORG_LINT_LIBRARY
  2452. # XORG_COMPILER_BRAND
  2453. # -------------------
  2454. # Minimum version: 1.14.0
  2455. #
  2456. # Checks for various brands of compilers and sets flags as appropriate:
  2457. # GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
  2458. # GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
  2459. # clang compiler - sets CLANGCC to "yes"
  2460. # Intel compiler - sets INTELCC to "yes"
  2461. # Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
  2462. #
  2463. AC_DEFUN([XORG_COMPILER_BRAND], [
  2464. AC_LANG_CASE(
  2465. [C], [
  2466. AC_REQUIRE([AC_PROG_CC_C99])
  2467. ],
  2468. [C++], [
  2469. AC_REQUIRE([AC_PROG_CXX])
  2470. ]
  2471. )
  2472. AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
  2473. AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
  2474. AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
  2475. ]) # XORG_COMPILER_BRAND
  2476. # XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
  2477. # ---------------
  2478. # Minimum version: 1.16.0
  2479. #
  2480. # Test if the compiler works when passed the given flag as a command line argument.
  2481. # If it succeeds, the flag is appeneded to the given variable. If not, it tries the
  2482. # next flag in the list until there are no more options.
  2483. #
  2484. # Note that this does not guarantee that the compiler supports the flag as some
  2485. # compilers will simply ignore arguments that they do not understand, but we do
  2486. # attempt to weed out false positives by using -Werror=unknown-warning-option and
  2487. # -Werror=unused-command-line-argument
  2488. #
  2489. AC_DEFUN([XORG_TESTSET_CFLAG], [
  2490. m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
  2491. m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
  2492. AC_LANG_COMPILER_REQUIRE
  2493. AC_LANG_CASE(
  2494. [C], [
  2495. AC_REQUIRE([AC_PROG_CC_C99])
  2496. define([PREFIX], [C])
  2497. define([CACHE_PREFIX], [cc])
  2498. define([COMPILER], [$CC])
  2499. ],
  2500. [C++], [
  2501. define([PREFIX], [CXX])
  2502. define([CACHE_PREFIX], [cxx])
  2503. define([COMPILER], [$CXX])
  2504. ]
  2505. )
  2506. [xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
  2507. if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
  2508. PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
  2509. AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
  2510. [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
  2511. AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
  2512. [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
  2513. [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
  2514. [xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
  2515. PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
  2516. fi
  2517. if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
  2518. if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
  2519. PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
  2520. fi
  2521. PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
  2522. AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
  2523. [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
  2524. AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
  2525. [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
  2526. [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
  2527. [xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
  2528. PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
  2529. fi
  2530. found="no"
  2531. m4_foreach([flag], m4_cdr($@), [
  2532. if test $found = "no" ; then
  2533. if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
  2534. PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
  2535. fi
  2536. if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
  2537. PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
  2538. fi
  2539. PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
  2540. dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
  2541. AC_MSG_CHECKING([if ]COMPILER[ supports]flag[])
  2542. cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
  2543. AC_CACHE_VAL($cacheid,
  2544. [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
  2545. [eval $cacheid=yes],
  2546. [eval $cacheid=no])])
  2547. PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
  2548. eval supported=\$$cacheid
  2549. AC_MSG_RESULT([$supported])
  2550. if test "$supported" = "yes" ; then
  2551. $1="$$1 ]flag["
  2552. found="yes"
  2553. fi
  2554. fi
  2555. ])
  2556. ]) # XORG_TESTSET_CFLAG
  2557. # XORG_COMPILER_FLAGS
  2558. # ---------------
  2559. # Minimum version: 1.16.0
  2560. #
  2561. # Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
  2562. # arguments supported by the selected compiler which do NOT alter the generated
  2563. # code. These arguments will cause the compiler to print various warnings
  2564. # during compilation AND turn a conservative set of warnings into errors.
  2565. #
  2566. # The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
  2567. # future versions of util-macros as options are added to new compilers.
  2568. #
  2569. AC_DEFUN([XORG_COMPILER_FLAGS], [
  2570. AC_REQUIRE([XORG_COMPILER_BRAND])
  2571. AC_ARG_ENABLE(selective-werror,
  2572. AS_HELP_STRING([--disable-selective-werror],
  2573. [Turn off selective compiler errors. (default: enabled)]),
  2574. [SELECTIVE_WERROR=$enableval],
  2575. [SELECTIVE_WERROR=yes])
  2576. AC_LANG_CASE(
  2577. [C], [
  2578. define([PREFIX], [C])
  2579. ],
  2580. [C++], [
  2581. define([PREFIX], [CXX])
  2582. ]
  2583. )
  2584. # -v is too short to test reliably with XORG_TESTSET_CFLAG
  2585. if test "x$SUNCC" = "xyes"; then
  2586. [BASE_]PREFIX[FLAGS]="-v"
  2587. else
  2588. [BASE_]PREFIX[FLAGS]=""
  2589. fi
  2590. # This chunk of warnings were those that existed in the legacy CWARNFLAGS
  2591. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
  2592. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
  2593. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
  2594. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
  2595. AC_LANG_CASE(
  2596. [C], [
  2597. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
  2598. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
  2599. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
  2600. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
  2601. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
  2602. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
  2603. ]
  2604. )
  2605. # This chunk adds additional warnings that could catch undesired effects.
  2606. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
  2607. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
  2608. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
  2609. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
  2610. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
  2611. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
  2612. # These are currently disabled because they are noisy. They will be enabled
  2613. # in the future once the codebase is sufficiently modernized to silence
  2614. # them. For now, I don't want them to drown out the other warnings.
  2615. # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
  2616. # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
  2617. # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
  2618. # Turn some warnings into errors, so we don't accidently get successful builds
  2619. # when there are problems that should be fixed.
  2620. if test "x$SELECTIVE_WERROR" = "xyes" ; then
  2621. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
  2622. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
  2623. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
  2624. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
  2625. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
  2626. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
  2627. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
  2628. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
  2629. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
  2630. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
  2631. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
  2632. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
  2633. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
  2634. else
  2635. AC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors. This should not be necessary. Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT])
  2636. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
  2637. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
  2638. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
  2639. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
  2640. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
  2641. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
  2642. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
  2643. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
  2644. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
  2645. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
  2646. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
  2647. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
  2648. XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
  2649. fi
  2650. AC_SUBST([BASE_]PREFIX[FLAGS])
  2651. ]) # XORG_COMPILER_FLAGS
  2652. # XORG_CWARNFLAGS
  2653. # ---------------
  2654. # Minimum version: 1.2.0
  2655. # Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
  2656. #
  2657. # Defines CWARNFLAGS to enable C compiler warnings.
  2658. #
  2659. # This function is deprecated because it defines -fno-strict-aliasing
  2660. # which alters the code generated by the compiler. If -fno-strict-aliasing
  2661. # is needed, then it should be added explicitly in the module when
  2662. # it is updated to use BASE_CFLAGS.
  2663. #
  2664. AC_DEFUN([XORG_CWARNFLAGS], [
  2665. AC_REQUIRE([XORG_COMPILER_FLAGS])
  2666. AC_REQUIRE([XORG_COMPILER_BRAND])
  2667. AC_LANG_CASE(
  2668. [C], [
  2669. CWARNFLAGS="$BASE_CFLAGS"
  2670. if test "x$GCC" = xyes ; then
  2671. CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
  2672. fi
  2673. AC_SUBST(CWARNFLAGS)
  2674. ]
  2675. )
  2676. ]) # XORG_CWARNFLAGS
  2677. # XORG_STRICT_OPTION
  2678. # -----------------------
  2679. # Minimum version: 1.3.0
  2680. #
  2681. # Add configure option to enable strict compilation flags, such as treating
  2682. # warnings as fatal errors.
  2683. # If --enable-strict-compilation is passed to configure, adds strict flags to
  2684. # $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
  2685. #
  2686. # Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
  2687. # when strict compilation is unconditionally desired.
  2688. AC_DEFUN([XORG_STRICT_OPTION], [
  2689. AC_REQUIRE([XORG_CWARNFLAGS])
  2690. AC_REQUIRE([XORG_COMPILER_FLAGS])
  2691. AC_ARG_ENABLE(strict-compilation,
  2692. AS_HELP_STRING([--enable-strict-compilation],
  2693. [Enable all warnings from compiler and make them errors (default: disabled)]),
  2694. [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
  2695. AC_LANG_CASE(
  2696. [C], [
  2697. define([PREFIX], [C])
  2698. ],
  2699. [C++], [
  2700. define([PREFIX], [CXX])
  2701. ]
  2702. )
  2703. [STRICT_]PREFIX[FLAGS]=""
  2704. XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
  2705. XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
  2706. # Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
  2707. # activate it with -Werror, so we add it here explicitly.
  2708. XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
  2709. if test "x$STRICT_COMPILE" = "xyes"; then
  2710. [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
  2711. AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
  2712. fi
  2713. AC_SUBST([STRICT_]PREFIX[FLAGS])
  2714. AC_SUBST([BASE_]PREFIX[FLAGS])
  2715. AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
  2716. ]) # XORG_STRICT_OPTION
  2717. # XORG_DEFAULT_OPTIONS
  2718. # --------------------
  2719. # Minimum version: 1.3.0
  2720. #
  2721. # Defines default options for X.Org modules.
  2722. #
  2723. AC_DEFUN([XORG_DEFAULT_OPTIONS], [
  2724. AC_REQUIRE([AC_PROG_INSTALL])
  2725. XORG_COMPILER_FLAGS
  2726. XORG_CWARNFLAGS
  2727. XORG_STRICT_OPTION
  2728. XORG_RELEASE_VERSION
  2729. XORG_CHANGELOG
  2730. XORG_INSTALL
  2731. XORG_MANPAGE_SECTIONS
  2732. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
  2733. [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
  2734. ]) # XORG_DEFAULT_OPTIONS
  2735. # XORG_INSTALL()
  2736. # ----------------
  2737. # Minimum version: 1.4.0
  2738. #
  2739. # Defines the variable INSTALL_CMD as the command to copy
  2740. # INSTALL from $prefix/share/util-macros.
  2741. #
  2742. AC_DEFUN([XORG_INSTALL], [
  2743. AC_REQUIRE([PKG_PROG_PKG_CONFIG])
  2744. macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
  2745. INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
  2746. mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
  2747. || (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
  2748. echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
  2749. AC_SUBST([INSTALL_CMD])
  2750. ]) # XORG_INSTALL
  2751. dnl Copyright 2005 Red Hat, Inc
  2752. dnl
  2753. dnl Permission to use, copy, modify, distribute, and sell this software and its
  2754. dnl documentation for any purpose is hereby granted without fee, provided that
  2755. dnl the above copyright notice appear in all copies and that both that
  2756. dnl copyright notice and this permission notice appear in supporting
  2757. dnl documentation.
  2758. dnl
  2759. dnl The above copyright notice and this permission notice shall be included
  2760. dnl in all copies or substantial portions of the Software.
  2761. dnl
  2762. dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  2763. dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2764. dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  2765. dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
  2766. dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  2767. dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  2768. dnl OTHER DEALINGS IN THE SOFTWARE.
  2769. dnl
  2770. dnl Except as contained in this notice, the name of the copyright holders shall
  2771. dnl not be used in advertising or otherwise to promote the sale, use or
  2772. dnl other dealings in this Software without prior written authorization
  2773. dnl from the copyright holders.
  2774. dnl
  2775. # XORG_RELEASE_VERSION
  2776. # --------------------
  2777. # Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
  2778. AC_DEFUN([XORG_RELEASE_VERSION],[
  2779. AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
  2780. [`echo $PACKAGE_VERSION | cut -d . -f 1`],
  2781. [Major version of this package])
  2782. PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
  2783. if test "x$PVM" = "x"; then
  2784. PVM="0"
  2785. fi
  2786. AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
  2787. [$PVM],
  2788. [Minor version of this package])
  2789. PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
  2790. if test "x$PVP" = "x"; then
  2791. PVP="0"
  2792. fi
  2793. AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
  2794. [$PVP],
  2795. [Patch version of this package])
  2796. ])
  2797. # XORG_CHANGELOG()
  2798. # ----------------
  2799. # Minimum version: 1.2.0
  2800. #
  2801. # Defines the variable CHANGELOG_CMD as the command to generate
  2802. # ChangeLog from git.
  2803. #
  2804. #
  2805. AC_DEFUN([XORG_CHANGELOG], [
  2806. CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
  2807. mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
  2808. || (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
  2809. echo 'git directory not found: installing possibly empty changelog.' >&2)"
  2810. AC_SUBST([CHANGELOG_CMD])
  2811. ]) # XORG_CHANGELOG