aclocal.m4 102 KB

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