configure.ac 70 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257
  1. dnl Autoconf configure script for GDB, the GNU debugger.
  2. dnl Copyright (C) 1995-2022 Free Software Foundation, Inc.
  3. dnl
  4. dnl This file is part of GDB.
  5. dnl
  6. dnl This program is free software; you can redistribute it and/or modify
  7. dnl it under the terms of the GNU General Public License as published by
  8. dnl the Free Software Foundation; either version 3 of the License, or
  9. dnl (at your option) any later version.
  10. dnl
  11. dnl This program is distributed in the hope that it will be useful,
  12. dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. dnl GNU General Public License for more details.
  15. dnl
  16. dnl You should have received a copy of the GNU General Public License
  17. dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. dnl Process this file with autoconf to produce a configure script.
  19. AC_INIT
  20. AC_CONFIG_MACRO_DIRS([../config])
  21. AC_CONFIG_SRCDIR([main.c])
  22. AC_CONFIG_HEADERS(config.h:config.in, [echo > stamp-h])
  23. AM_MAINTAINER_MODE
  24. AC_PROG_CC
  25. AC_PROG_CXX
  26. AC_USE_SYSTEM_EXTENSIONS
  27. ACX_LARGEFILE
  28. AM_PROG_INSTALL_STRIP
  29. AC_CONFIG_AUX_DIR(..)
  30. # Set build, build_cpu, build_vendor and build_os.
  31. AC_CANONICAL_BUILD
  32. # Set host, host_cpu, host_vendor, and host_os.
  33. AC_CANONICAL_HOST
  34. # Set target, target_cpu, target_vendor, and target_os.
  35. AC_CANONICAL_TARGET
  36. ACX_NONCANONICAL_TARGET
  37. AC_ARG_PROGRAM
  38. # We require a C++11 compiler. Check if one is available, and if
  39. # necessary, set CXX_DIALECT to some -std=xxx switch.
  40. AX_CXX_COMPILE_STDCXX(11, , mandatory)
  41. # Dependency checking.
  42. ZW_CREATE_DEPDIR
  43. ZW_PROG_COMPILER_DEPENDENCIES([CC])
  44. dnl List of object files and targets accumulated by configure.
  45. CONFIG_OBS=
  46. CONFIG_DEPS=
  47. CONFIG_SRCS=
  48. ENABLE_CFLAGS=
  49. CONFIG_ALL=
  50. CONFIG_CLEAN=
  51. CONFIG_INSTALL=
  52. CONFIG_UNINSTALL=
  53. dnl Set up for gettext.
  54. ZW_GNU_GETTEXT_SISTER_DIR
  55. localedir='${datadir}/locale'
  56. AC_SUBST(localedir)
  57. if test x"$USE_NLS" = xyes; then
  58. CONFIG_ALL="$CONFIG_ALL all-po"
  59. CONFIG_CLEAN="$CONFIG_CLEAN clean-po"
  60. CONFIG_INSTALL="$CONFIG_INSTALL install-po"
  61. CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-po"
  62. fi
  63. PACKAGE=gdb
  64. AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ])
  65. AC_SUBST(PACKAGE)
  66. # We never need to detect it in this sub-configure.
  67. # But preserve it for config.status --recheck.
  68. AC_ARG_VAR(MAKEINFO,
  69. [Parent configure detects if it is of sufficient version.])
  70. AC_ARG_VAR(MAKEINFOFLAGS,
  71. [Parameters for MAKEINFO.])
  72. MAKEINFO_EXTRA_FLAGS=""
  73. AC_CACHE_CHECK([whether $MAKEINFO supports @click], gdb_cv_have_makeinfo_click,
  74. [echo '@clicksequence{a @click{} b}' >conftest.texinfo
  75. if eval "$MAKEINFO conftest.texinfo >&5 2>&5"; then
  76. gdb_cv_have_makeinfo_click=yes
  77. else
  78. gdb_cv_have_makeinfo_click=no
  79. fi])
  80. if test x"$gdb_cv_have_makeinfo_click" = xyes; then
  81. MAKEINFO_EXTRA_FLAGS="$MAKEINFO_EXTRA_FLAGS -DHAVE_MAKEINFO_CLICK"
  82. fi
  83. AC_SUBST(MAKEINFO_EXTRA_FLAGS)
  84. GDB_AC_WITH_DIR(DEBUGDIR, separate-debug-dir,
  85. [look for global separate debug info in this path @<:@LIBDIR/debug@:>@],
  86. [${libdir}/debug])
  87. # We can't pass paths as command line arguments.
  88. # Mingw32 tries to be clever and will convert the paths for us.
  89. # For example -DBINDIR="/usr/local/bin" passed on the command line may get
  90. # converted to -DBINDIR="E:/msys/mingw32/msys/1.0/local/bin".
  91. # This breaks GDB's relocatable path conversions since paths passed in
  92. # config.h would not get so translated, the path prefixes no longer match.
  93. AC_DEFINE_DIR(BINDIR, bindir, [Directory of programs.])
  94. # GDB's datadir relocation
  95. GDB_AC_WITH_DIR(GDB_DATADIR, gdb-datadir,
  96. [look for global separate data files in this path @<:@DATADIR/gdb@:>@],
  97. [${datadir}/gdb])
  98. AC_ARG_WITH(relocated-sources,
  99. AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this path for source files]),
  100. [reloc_srcdir="${withval}"
  101. AC_DEFINE_DIR(RELOC_SRCDIR, reloc_srcdir,
  102. [Relocated directory for source files. ])
  103. ])
  104. AC_MSG_CHECKING([for default auto-load directory])
  105. AC_ARG_WITH(auto-load-dir,
  106. AS_HELP_STRING([--with-auto-load-dir=PATH],
  107. [directories from which to load auto-loaded scripts @<:@$debugdir:$datadir/auto-load@:>@]),,
  108. [with_auto_load_dir='$debugdir:$datadir/auto-load'])
  109. escape_dir=`echo $with_auto_load_dir | sed -e 's/[[$]]datadir\>/\\\\\\\\\\\\&/g' -e 's/[[$]]debugdir\>/\\\\\\\\\\\\&/g'`
  110. AC_DEFINE_DIR(AUTO_LOAD_DIR, escape_dir,
  111. [Directories from which to load auto-loaded scripts.])
  112. AC_MSG_RESULT([$with_auto_load_dir])
  113. AC_MSG_CHECKING([for default auto-load safe-path])
  114. AC_ARG_WITH(auto-load-safe-path,
  115. AS_HELP_STRING([--with-auto-load-safe-path=PATH],
  116. [directories safe to hold auto-loaded files @<:@--with-auto-load-dir@:>@])
  117. AS_HELP_STRING([--without-auto-load-safe-path],
  118. [do not restrict auto-loaded files locations]),
  119. [if test "$with_auto_load_safe_path" = "no"; then
  120. with_auto_load_safe_path="/"
  121. fi],
  122. [with_auto_load_safe_path="$with_auto_load_dir"])
  123. escape_dir=`echo $with_auto_load_safe_path | sed -e 's/[[$]]datadir\>/\\\\\\\\\\\\&/g' -e 's/[[$]]debugdir\>/\\\\\\\\\\\\&/g'`
  124. AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
  125. [Directories safe to hold auto-loaded files.])
  126. AC_MSG_RESULT([$with_auto_load_safe_path])
  127. AC_CONFIG_SUBDIRS(testsuite)
  128. # Check whether to support alternative target configurations
  129. AC_ARG_ENABLE(targets,
  130. AS_HELP_STRING([--enable-targets=TARGETS], [alternative target configurations]),
  131. [case "${enableval}" in
  132. yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
  133. ;;
  134. no) enable_targets= ;;
  135. *) enable_targets=$enableval ;;
  136. esac])
  137. BFD_64_BIT
  138. # Provide defaults for some variables set by the per-host and per-target
  139. # configuration.
  140. gdb_host_obs=posix-hdep.o
  141. if test "${target}" = "${host}"; then
  142. gdb_native=yes
  143. else
  144. gdb_native=no
  145. fi
  146. . $srcdir/configure.host
  147. # Accumulate some settings from configure.tgt over all enabled targets
  148. TARGET_OBS=
  149. all_targets=
  150. HAVE_NATIVE_GCORE_TARGET=
  151. for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
  152. do
  153. if test "$targ_alias" = "all"; then
  154. all_targets=true
  155. else
  156. # Canonicalize the secondary target names.
  157. result=`$ac_config_sub $targ_alias 2>/dev/null`
  158. if test -n "$result"; then
  159. targ=$result
  160. else
  161. targ=$targ_alias
  162. fi
  163. . ${srcdir}/configure.tgt
  164. AS_IF([test -z "${gdb_target_obs}"],
  165. [AC_MSG_ERROR([configuration ${targ} is unsupported.])])
  166. # Target-specific object files
  167. for i in ${gdb_target_obs}; do
  168. case " $TARGET_OBS " in
  169. *" ${i} "*) ;;
  170. *)
  171. TARGET_OBS="$TARGET_OBS ${i}"
  172. ;;
  173. esac
  174. done
  175. # Check whether this target needs 64-bit CORE_ADDR
  176. if test x${enable_64_bit_bfd} = xno; then
  177. . ${srcdir}/../bfd/config.bfd
  178. fi
  179. # Check whether this target is native and supports gcore.
  180. if test $gdb_native = yes -a "$targ_alias" = "$target_alias" \
  181. && $gdb_have_gcore; then
  182. HAVE_NATIVE_GCORE_TARGET=1
  183. fi
  184. fi
  185. done
  186. if test x${all_targets} = xtrue; then
  187. if test x${enable_64_bit_bfd} = xyes; then
  188. TARGET_OBS='$(ALL_TARGET_OBS) $(ALL_64_TARGET_OBS)'
  189. else
  190. TARGET_OBS='$(ALL_TARGET_OBS)'
  191. fi
  192. fi
  193. AC_SUBST(TARGET_OBS)
  194. AC_SUBST(HAVE_NATIVE_GCORE_TARGET)
  195. # For other settings, only the main target counts.
  196. gdb_sim=
  197. gdb_osabi=
  198. targ=$target; . ${srcdir}/configure.tgt
  199. # Fetch the default architecture and default target vector from BFD.
  200. targ=$target; . $srcdir/../bfd/config.bfd
  201. # We only want the first architecture, so strip off the others if
  202. # there is more than one.
  203. targ_archs=`echo $targ_archs | sed 's/ .*//'`
  204. if test "x$targ_archs" != x; then
  205. AC_DEFINE_UNQUOTED(DEFAULT_BFD_ARCH, $targ_archs,
  206. [Define to BFD's default architecture. ])
  207. fi
  208. if test "x$targ_defvec" != x; then
  209. AC_DEFINE_UNQUOTED(DEFAULT_BFD_VEC, $targ_defvec,
  210. [Define to BFD's default target vector. ])
  211. fi
  212. # Enable MI.
  213. AC_ARG_ENABLE(gdbmi,
  214. AS_HELP_STRING([--disable-gdbmi], [disable machine-interface (MI)]),
  215. [case $enableval in
  216. yes | no)
  217. ;;
  218. *)
  219. AC_MSG_ERROR([bad value $enableval for --enable-gdbmi]) ;;
  220. esac],
  221. [enable_gdbmi=yes])
  222. if test x"$enable_gdbmi" = xyes; then
  223. if test -d "$srcdir/mi"; then
  224. CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_MI_OBS)"
  225. CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_MI_DEPS)"
  226. CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_MI_SRCS)"
  227. ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_MI_CFLAGS)"
  228. fi
  229. fi
  230. # Enable TUI.
  231. AC_ARG_ENABLE(tui,
  232. AS_HELP_STRING([--enable-tui], [enable full-screen terminal user interface (TUI)]),
  233. [case $enableval in
  234. yes | no | auto)
  235. ;;
  236. *)
  237. AC_MSG_ERROR([bad value $enableval for --enable-tui]) ;;
  238. esac],enable_tui=auto)
  239. # Enable gdbtk.
  240. AC_ARG_ENABLE(gdbtk,
  241. AS_HELP_STRING([--enable-gdbtk], [enable gdbtk graphical user interface (GUI)]),
  242. [case $enableval in
  243. yes | no)
  244. ;;
  245. *)
  246. AC_MSG_ERROR([bad value $enableval for --enable-gdbtk]) ;;
  247. esac],
  248. [if test -d "$srcdir/gdbtk"; then
  249. enable_gdbtk=yes
  250. else
  251. enable_gdbtk=no
  252. fi])
  253. # We unconditionally disable gdbtk tests on selected platforms.
  254. case $host_os in
  255. go32* | windows*)
  256. AC_MSG_WARN([gdbtk isn't supported on $host; disabling])
  257. enable_gdbtk=no ;;
  258. esac
  259. # Handle optional debuginfod support
  260. AC_DEBUGINFOD
  261. # Libunwind support for ia64.
  262. AC_ARG_WITH(libunwind-ia64,
  263. AS_HELP_STRING([--with-libunwind-ia64],
  264. [use libunwind frame unwinding for ia64 targets]),,
  265. [with_libunwind_ia64=auto])
  266. # Backward compatibility option.
  267. if test "${with_libunwind+set}" = set; then
  268. if test x"$with_libunwind_ia64" != xauto; then
  269. AC_MSG_ERROR(
  270. [option --with-libunwind is deprecated, use --with-libunwind-ia64])
  271. fi
  272. AC_MSG_WARN([option --with-libunwind is deprecated, use --with-libunwind-ia64])
  273. with_libunwind_ia64="$with_libunwind"
  274. fi
  275. case "$with_libunwind_ia64" in
  276. yes | no)
  277. ;;
  278. auto)
  279. AC_CHECK_HEADERS(libunwind-ia64.h)
  280. with_libunwind_ia64=$ac_cv_header_libunwind_ia64_h
  281. ;;
  282. *)
  283. AC_MSG_ERROR(
  284. [bad value $with_libunwind_ia64 for GDB --with-libunwind-ia64 option])
  285. ;;
  286. esac
  287. if test x"$with_libunwind_ia64" = xyes; then
  288. AC_CHECK_HEADERS(libunwind-ia64.h)
  289. if test x"$ac_cv_header_libunwind_ia64_h" != xyes; then
  290. AC_MSG_ERROR([GDB option --with-libunwind-ia64 requires libunwind-ia64.h])
  291. fi
  292. CONFIG_OBS="$CONFIG_OBS ia64-libunwind-tdep.o"
  293. CONFIG_DEPS="$CONFIG_DEPS ia64-libunwind-tdep.o"
  294. CONFIG_SRCS="$CONFIG_SRCS ia64-libunwind-tdep.c"
  295. fi
  296. opt_curses=no
  297. AC_ARG_WITH(curses, AS_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
  298. prefer_curses=no
  299. if test "$opt_curses" = "yes"; then
  300. prefer_curses=yes
  301. fi
  302. # Profiling support.
  303. AC_ARG_ENABLE(profiling,
  304. AS_HELP_STRING([--enable-profiling], [enable profiling of GDB]),
  305. [case $enableval in
  306. yes | no)
  307. ;;
  308. *)
  309. AC_MSG_ERROR([bad value $enableval for --enable-profile]) ;;
  310. esac],
  311. [enable_profiling=no])
  312. AC_CHECK_FUNCS(monstartup _mcleanup)
  313. AC_CACHE_CHECK(
  314. [for _etext],
  315. [ac_cv_var__etext],
  316. [AC_LINK_IFELSE(
  317. [AC_LANG_PROGRAM(
  318. [#include <stdlib.h>
  319. extern char _etext;],
  320. [free (&_etext);]
  321. )],
  322. [ac_cv_var__etext=yes],
  323. [ac_cv_var__etext=no]
  324. )]
  325. )
  326. if test "$ac_cv_var__etext" = yes; then
  327. AC_DEFINE(HAVE__ETEXT, 1,
  328. [Define to 1 if your system has the _etext variable. ])
  329. fi
  330. AC_CACHE_CHECK(
  331. [for etext],
  332. [ac_cv_var_etext],
  333. [AC_LINK_IFELSE(
  334. [AC_LANG_PROGRAM(
  335. [#include <stdlib.h>
  336. extern char etext;],
  337. [free (&etext);]
  338. )],
  339. [ac_cv_var_etext=yes],
  340. [ac_cv_var_etext=no]
  341. )]
  342. )
  343. if test "$ac_cv_var_etext" = yes; then
  344. AC_DEFINE(HAVE_ETEXT, 1,
  345. [Define to 1 if your system has the etext variable. ])
  346. fi
  347. if test "$enable_profiling" = yes ; then
  348. if test "$ac_cv_func_monstartup" = no || test "$ac_cv_func__mcleanup" = no; then
  349. AC_MSG_ERROR(--enable-profiling requires monstartup and _mcleanup)
  350. fi
  351. PROFILE_CFLAGS=-pg
  352. OLD_CFLAGS="$CFLAGS"
  353. CFLAGS="$CFLAGS $PROFILE_CFLAGS"
  354. AC_CACHE_CHECK(
  355. [whether $CC supports -pg],
  356. [ac_cv_cc_supports_pg],
  357. [AC_COMPILE_IFELSE(
  358. [AC_LANG_PROGRAM([], [int x;])],
  359. [ac_cv_cc_supports_pg=yes],
  360. [ac_cv_cc_supports_pg=no]
  361. )]
  362. )
  363. if test "$ac_cv_cc_supports_pg" = no; then
  364. AC_MSG_ERROR(--enable-profiling requires a compiler which supports -pg)
  365. fi
  366. CFLAGS="$OLD_CFLAGS"
  367. fi
  368. CODESIGN_CERT=
  369. AC_ARG_ENABLE([codesign],
  370. AS_HELP_STRING([--enable-codesign=CERT],
  371. [sign gdb with 'codesign -s CERT']),
  372. [CODESIGN_CERT=$enableval])
  373. AC_SUBST([CODESIGN_CERT])
  374. ACX_PKGVERSION([GDB])
  375. ACX_BUGURL([https://www.gnu.org/software/gdb/bugs/])
  376. AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
  377. AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
  378. # --------------------- #
  379. # Checks for programs. #
  380. # --------------------- #
  381. AC_PROG_AWK
  382. AC_PROG_INSTALL
  383. AC_PROG_LN_S
  384. AC_PROG_RANLIB
  385. AC_PROG_YACC
  386. AC_CHECK_TOOL(AR, ar)
  387. AC_CHECK_TOOL(DLLTOOL, dlltool)
  388. AC_CHECK_TOOL(WINDRES, windres)
  389. case $host_os in
  390. gnu*)
  391. # Needed for GNU Hurd hosts.
  392. AC_CHECK_TOOL(MIG, mig)
  393. if test x"$MIG" = x; then
  394. AC_MSG_ERROR([MIG not found but required for $host hosts])
  395. fi
  396. ;;
  397. esac
  398. # ---------------------- #
  399. # Checks for libraries. #
  400. # ---------------------- #
  401. # We might need to link with -lm; most simulators need it.
  402. AC_CHECK_LIB(m, main)
  403. # Some systems (e.g. Solaris) have `gethostbyname' in libnsl.
  404. AC_SEARCH_LIBS(gethostbyname, nsl)
  405. # Some systems (e.g. Solaris) have `socketpair' in libsocket.
  406. AC_SEARCH_LIBS(socketpair, socket)
  407. # Link in zlib if we can. This allows us to read compressed debug sections.
  408. AM_ZLIB
  409. AM_ICONV
  410. # GDB may fork/exec the iconv program to get the list of supported character
  411. # sets. Allow the user to specify where to find it.
  412. # There are several factors affecting the choice of option name:
  413. # - There is already --with-libiconv-prefix but we can't use it, it specifies
  414. # the build-time location of libiconv files.
  415. # - The program we need to find is iconv, which comes with glibc. The user
  416. # doesn't necessarily have libiconv installed. Therefore naming this
  417. # --with-libiconv-foo feels wrong.
  418. # - We want the path to be relocatable, but GDB_AC_DEFINE_RELOCATABLE is
  419. # defined to work on directories not files (though it really doesn't know
  420. # the difference).
  421. # - Calling this --with-iconv-prefix is perceived to cause too much confusion
  422. # with --with-libiconv-prefix.
  423. # Putting these together is why the option name is --with-iconv-bin.
  424. AC_ARG_WITH(iconv-bin,
  425. AS_HELP_STRING([--with-iconv-bin=PATH], [specify where to find the iconv program]),
  426. [iconv_bin="${withval}"
  427. AC_DEFINE_UNQUOTED([ICONV_BIN], ["${iconv_bin}"],
  428. [Path of directory of iconv program.])
  429. GDB_AC_DEFINE_RELOCATABLE(ICONV_BIN, iconv, ${iconv_bin})
  430. ])
  431. # For the TUI, we need enhanced curses functionality.
  432. if test x"$enable_tui" != xno; then
  433. prefer_curses=yes
  434. fi
  435. curses_found=no
  436. if test x"$prefer_curses" = xyes; then
  437. # FIXME: kettenis/20040905: We prefer ncurses over the vendor-supplied
  438. # curses library because the latter might not provide all the
  439. # functionality we need. However, this leads to problems on systems
  440. # where the linker searches /usr/local/lib, but the compiler doesn't
  441. # search /usr/local/include, if ncurses is installed in /usr/local. A
  442. # default installation of ncurses on alpha*-dec-osf* will lead to such
  443. # a situation.
  444. AC_SEARCH_LIBS(waddstr, [ncursesw ncurses cursesX curses])
  445. if test "$ac_cv_search_waddstr" != no; then
  446. curses_found=yes
  447. fi
  448. fi
  449. # Check whether we should enable the TUI, but only do so if we really
  450. # can.
  451. if test x"$enable_tui" != xno; then
  452. if test -d "$srcdir/tui"; then
  453. if test "$curses_found" != no; then
  454. CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
  455. CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
  456. CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
  457. ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
  458. else
  459. if test x"$enable_tui" = xyes; then
  460. AC_MSG_ERROR([no enhanced curses library found; disable TUI])
  461. else
  462. AC_MSG_WARN([no enhanced curses library found; disabling TUI])
  463. fi
  464. fi
  465. fi
  466. fi
  467. # Since GDB uses Readline, we need termcap functionality. In many
  468. # cases this will be provided by the curses library, but some systems
  469. # have a separate termcap library, or no curses library at all.
  470. case $host_os in
  471. cygwin*)
  472. if test -d "$srcdir/libtermcap"; then
  473. LIBS="../libtermcap/libtermcap.a $LIBS"
  474. ac_cv_search_tgetent="../libtermcap/libtermcap.a"
  475. fi ;;
  476. go32* | *djgpp*)
  477. ac_cv_search_tgetent="none required"
  478. ;;
  479. esac
  480. # These are the libraries checked by Readline.
  481. AC_SEARCH_LIBS(tgetent, [termcap tinfow tinfo curses ncursesw ncurses])
  482. if test "$ac_cv_search_tgetent" = no; then
  483. CONFIG_OBS="$CONFIG_OBS stub-termcap.o"
  484. fi
  485. AC_ARG_WITH([system-readline],
  486. [AS_HELP_STRING([--with-system-readline],
  487. [use installed readline library])])
  488. if test "$with_system_readline" = yes; then
  489. AC_CHECK_HEADERS(readline/readline.h, [readline_h=yes], [readline_h=no])
  490. if test "$readline_h" = "no"; then
  491. AC_MSG_ERROR([readline development packages are probably missing])
  492. fi
  493. AC_CACHE_CHECK(
  494. [whether system readline is new enough],
  495. [gdb_cv_readline_ok],
  496. [AC_COMPILE_IFELSE(
  497. [AC_LANG_PROGRAM(
  498. [#include <stdio.h>
  499. #include <readline/readline.h>],
  500. [#if RL_VERSION_MAJOR < 7
  501. # error "readline version 7 required"
  502. #endif]
  503. )],
  504. [gdb_cv_readline_ok=yes],
  505. [gdb_cv_readline_ok=no]
  506. )]
  507. )
  508. if test "$gdb_cv_readline_ok" != yes; then
  509. AC_MSG_ERROR([system readline is not new enough])
  510. fi
  511. READLINE=-lreadline
  512. READLINE_DEPS=
  513. READLINE_CFLAGS=
  514. READLINE_TEXI_INCFLAG=
  515. else
  516. READLINE='$(READLINE_DIR)/libreadline.a'
  517. READLINE_DEPS='$(READLINE)'
  518. READLINE_CFLAGS='-I$(READLINE_SRC)/..'
  519. READLINE_TEXI_INCFLAG='-I $(READLINE_DIR)'
  520. fi
  521. AC_SUBST(READLINE)
  522. AC_SUBST(READLINE_DEPS)
  523. AC_SUBST(READLINE_CFLAGS)
  524. AC_SUBST(READLINE_TEXI_INCFLAG)
  525. # Generate jit-reader.h
  526. # This is typedeffed to GDB_CORE_ADDR in jit-reader.h
  527. TARGET_PTR=
  528. AC_CHECK_SIZEOF(unsigned long long)
  529. AC_CHECK_SIZEOF(unsigned long)
  530. AC_CHECK_SIZEOF(unsigned __int128)
  531. if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
  532. TARGET_PTR="unsigned long"
  533. elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
  534. TARGET_PTR="unsigned long long"
  535. elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then
  536. TARGET_PTR="unsigned __int128"
  537. else
  538. TARGET_PTR="unsigned long"
  539. fi
  540. AC_SUBST(TARGET_PTR)
  541. AC_CONFIG_FILES([jit-reader.h:jit-reader.in])
  542. AC_SEARCH_LIBS(dlopen, dl)
  543. GDB_AC_WITH_DIR([JIT_READER_DIR], [jit-reader-dir],
  544. [directory to load the JIT readers from],
  545. [${libdir}/gdb])
  546. AC_ARG_WITH(expat,
  547. AS_HELP_STRING([--with-expat], [include expat support (auto/yes/no)]),
  548. [], [with_expat=auto])
  549. AC_MSG_CHECKING([whether to use expat])
  550. AC_MSG_RESULT([$with_expat])
  551. if test "${with_expat}" = no; then
  552. AC_MSG_WARN([expat support disabled; some features may be unavailable.])
  553. HAVE_LIBEXPAT=no
  554. else
  555. AC_LIB_HAVE_LINKFLAGS([expat], [], [#include "expat.h"],
  556. [XML_Parser p = XML_ParserCreate (0);])
  557. if test "$HAVE_LIBEXPAT" != yes; then
  558. if test "$with_expat" = yes; then
  559. AC_MSG_ERROR([expat is missing or unusable])
  560. else
  561. AC_MSG_WARN([expat is missing or unusable; some features may be unavailable.])
  562. fi
  563. else
  564. save_LIBS=$LIBS
  565. LIBS="$LIBS $LIBEXPAT"
  566. AC_CHECK_FUNCS(XML_StopParser)
  567. LIBS=$save_LIBS
  568. fi
  569. fi
  570. # Verify that we have a usable GMP library.
  571. AC_LIB_HAVE_LINKFLAGS([gmp], [], [#include <gmp.h>],
  572. [mpz_t n;
  573. mpz_init (n);])
  574. if test "$HAVE_LIBGMP" != yes; then
  575. AC_MSG_ERROR([GMP is missing or unusable])
  576. fi
  577. AC_ARG_WITH(mpfr,
  578. AS_HELP_STRING([--with-mpfr], [include MPFR support (auto/yes/no)]),
  579. [], [with_mpfr=auto])
  580. AC_MSG_CHECKING([whether to use MPFR])
  581. AC_MSG_RESULT([$with_mpfr])
  582. if test "${with_mpfr}" = no; then
  583. AC_MSG_WARN([MPFR support disabled; some features may be unavailable.])
  584. HAVE_LIBMPFR=no
  585. else
  586. AC_LIB_HAVE_LINKFLAGS([mpfr], [gmp], [#include <mpfr.h>],
  587. [mpfr_exp_t exp; mpfr_t x;
  588. mpfr_frexp (&exp, x, x, MPFR_RNDN);])
  589. if test "$HAVE_LIBMPFR" != yes; then
  590. if test "$with_mpfr" = yes; then
  591. AC_MSG_ERROR([MPFR is missing or unusable])
  592. else
  593. AC_MSG_WARN([MPFR is missing or unusable; some features may be unavailable.])
  594. fi
  595. fi
  596. fi
  597. # --------------------- #
  598. # Check for libpython. #
  599. # --------------------- #
  600. dnl Utility to simplify finding libpython.
  601. dnl $1 = the shell variable to assign the result to
  602. dnl If libpython is found we store $version here.
  603. dnl $2 = additional flags to add to CPPFLAGS
  604. dnl $3 = additional flags to add to LIBS
  605. AC_DEFUN([AC_TRY_LIBPYTHON],
  606. [
  607. define([have_libpython_var],$1)
  608. new_CPPFLAGS=$2
  609. new_LIBS=$3
  610. AC_MSG_CHECKING([for python])
  611. save_CPPFLAGS=$CPPFLAGS
  612. save_LIBS=$LIBS
  613. CPPFLAGS="$CPPFLAGS $new_CPPFLAGS"
  614. LIBS="$new_LIBS $LIBS"
  615. found_usable_python=no
  616. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "Python.h"]],
  617. [[
  618. #if PY_MAJOR_VERSION != 3
  619. # error "We only support Python 3"
  620. #endif
  621. Py_Initialize ();
  622. ]])],
  623. [have_libpython_var=yes
  624. found_usable_python=yes
  625. PYTHON_CPPFLAGS=$new_CPPFLAGS
  626. PYTHON_LIBS=$new_LIBS])
  627. CPPFLAGS=$save_CPPFLAGS
  628. LIBS=$save_LIBS
  629. AC_MSG_RESULT([${found_usable_python}])
  630. ])
  631. dnl There are several different values for --with-python:
  632. dnl
  633. dnl no - Don't include python support.
  634. dnl yes - Include python support, error if it's missing.
  635. dnl If we find python in $PATH, use it to fetch configure options,
  636. dnl otherwise assume the compiler can find it with no help from us.
  637. dnl auto - Same as "yes", but if python is missing from the system,
  638. dnl fall back to "no".
  639. dnl /path/to/python/exec-prefix -
  640. dnl Use the python located in this directory.
  641. dnl If /path/to/python/exec-prefix/bin/python exists, use it to find
  642. dnl the compilation parameters. Otherwise use
  643. dnl -I/path/to/python/exec-prefix/include,
  644. dnl -L/path/to/python/exec-prefix/lib.
  645. dnl NOTE: This case is historical. It is what was done for 7.0/7.1
  646. dnl but is deprecated.
  647. dnl /path/to/python/executable -
  648. dnl Run python-config.py with this version of python to fetch the
  649. dnl compilation parameters.
  650. dnl NOTE: This needn't be the real python executable.
  651. dnl In a cross-compilation scenario (build != host), this could be
  652. dnl a shell script that provides what python-config.py provides for
  653. dnl --ldflags, --includes, --exec-prefix.
  654. dnl python-executable -
  655. dnl Find python-executable in $PATH, and then handle the same as
  656. dnl /path/to/python/executable.
  657. dnl
  658. dnl If a python program is specified, it is used to run python-config.py and
  659. dnl is passed --ldflags, --includes, --exec-prefix.
  660. AC_ARG_WITH(python,
  661. AS_HELP_STRING([--with-python@<:@=PYTHON@:>@], [include python support (auto/yes/no/<python-program>)]),
  662. [], [with_python=auto])
  663. AC_MSG_CHECKING([whether to use python])
  664. AC_MSG_RESULT([$with_python])
  665. if test "${with_python}" = no; then
  666. AC_MSG_WARN([python support disabled; some features may be unavailable.])
  667. have_libpython=no
  668. else
  669. case "${with_python}" in
  670. [[\\/]]* | ?:[[\\/]]*)
  671. if test -d "${with_python}"; then
  672. # Assume the python binary is ${with_python}/bin/python.
  673. python_prog="${with_python}/bin/python"
  674. python_prefix=
  675. # If python does not exit ${with_python}/bin, then try in
  676. # ${with_python}. On Windows/MinGW, this is where the Python
  677. # executable is.
  678. if test ! -x "${python_prog}"; then
  679. python_prog="${with_python}/python"
  680. python_prefix=
  681. fi
  682. if test ! -x "${python_prog}"; then
  683. # Fall back to gdb 7.0/7.1 behaviour.
  684. python_prog=missing
  685. python_prefix=${with_python}
  686. fi
  687. elif test -x "${with_python}"; then
  688. # While we can't run python compiled for $host (unless host == build),
  689. # the user could write a script that provides the needed information,
  690. # so we support that.
  691. python_prog=${with_python}
  692. python_prefix=
  693. else
  694. AC_MSG_ERROR(invalid value for --with-python)
  695. fi
  696. ;;
  697. */*)
  698. # Disallow --with-python=foo/bar.
  699. AC_MSG_ERROR(invalid value for --with-python)
  700. ;;
  701. *)
  702. # The user has either specified auto, yes, or the name of the python
  703. # program assumed to be in $PATH.
  704. python_prefix=
  705. case "${with_python}" in
  706. yes | auto)
  707. if test "${build}" = "${host}"; then
  708. AC_PATH_PROG(python_prog_path, python, missing)
  709. if test "${python_prog_path}" = missing; then
  710. python_prog=missing
  711. else
  712. python_prog=${python_prog_path}
  713. fi
  714. else
  715. # Not much we can do except assume the cross-compiler will find the
  716. # right files.
  717. python_prog=missing
  718. fi
  719. ;;
  720. *)
  721. # While we can't run python compiled for $host (unless host == build),
  722. # the user could write a script that provides the needed information,
  723. # so we support that.
  724. python_prog="${with_python}"
  725. AC_PATH_PROG(python_prog_path, ${python_prog}, missing)
  726. if test "${python_prog_path}" = missing; then
  727. AC_MSG_ERROR(unable to find python program ${python_prog})
  728. fi
  729. ;;
  730. esac
  731. esac
  732. if test "${python_prog}" != missing; then
  733. # We have a python program to use, but it may be too old.
  734. # Don't flag an error for --with-python=auto (the default).
  735. have_python_config=yes
  736. python_includes=`${python_prog} ${srcdir}/python/python-config.py --includes`
  737. if test $? != 0; then
  738. have_python_config=failed
  739. if test "${with_python}" != auto; then
  740. AC_MSG_ERROR(failure running python-config --includes)
  741. fi
  742. fi
  743. python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
  744. if test $? != 0; then
  745. have_python_config=failed
  746. if test "${with_python}" != auto; then
  747. AC_MSG_ERROR(failure running python-config --ldflags)
  748. fi
  749. fi
  750. python_prefix=`${python_prog} ${srcdir}/python/python-config.py --exec-prefix`
  751. if test $? != 0; then
  752. have_python_config=failed
  753. if test "${with_python}" != auto; then
  754. AC_MSG_ERROR(failure running python-config --exec-prefix)
  755. fi
  756. fi
  757. else
  758. # We do not have a python executable we can use to determine where
  759. # to find the Python headers and libs. We cannot guess the include
  760. # path from the python_prefix either, because that include path
  761. # depends on the Python version. So, there is nothing much we can
  762. # do except assume that the compiler will be able to find those files.
  763. python_includes=
  764. python_libs=
  765. have_python_config=no
  766. fi
  767. # If we have python-config, only try the configuration it provides.
  768. # Otherwise fallback on the old way of trying different versions of
  769. # python in turn.
  770. have_libpython=no
  771. if test "${have_python_config}" = yes; then
  772. AC_TRY_LIBPYTHON(have_libpython,
  773. ${python_includes}, ${python_libs})
  774. fi
  775. if test "${have_libpython}" = no; then
  776. case "${with_python}" in
  777. yes)
  778. AC_MSG_ERROR([python is missing or unusable])
  779. ;;
  780. auto)
  781. AC_MSG_WARN([python is missing or unusable; some features may be unavailable.])
  782. ;;
  783. *)
  784. AC_MSG_ERROR([no usable python found at ${with_python}])
  785. ;;
  786. esac
  787. else
  788. if test -n "${python_prefix}"; then
  789. AC_DEFINE_UNQUOTED(WITH_PYTHON_PATH, "${python_prefix}",
  790. [Define if --with-python provides a path, either directly or via python-config.py --exec-prefix.])
  791. GDB_AC_DEFINE_RELOCATABLE(PYTHON_PATH, python, ${python_prefix})
  792. fi
  793. fi
  794. fi
  795. dnl Use --with-python-libdir to control where GDB looks for the Python
  796. dnl libraries.
  797. dnl
  798. dnl If this is not given then the default will be based on the value
  799. dnl passed to --with-python, which is in the python_prefix variable.
  800. dnl If the --with-python option wasn't given then the default value in
  801. dnl python_prefix is based on running the 'gdb/python/python-config
  802. dnl --exec-prefix' script.
  803. AC_ARG_WITH(python-libdir,
  804. AS_HELP_STRING([--with-python-libdir@<:@=DIR@:>@], [search for python's libraries in DIR]),
  805. [],[
  806. # If no python libdir is specified then select one based on
  807. # python's prefix path.
  808. if test -n "${python_prefix}"; then
  809. with_python_libdir=${python_prefix}/lib
  810. fi
  811. ])
  812. if test "${have_libpython}" != no; then
  813. AC_DEFINE(HAVE_PYTHON, 1, [Define if Python interpreter is being linked in.])
  814. CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)"
  815. CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)"
  816. CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)"
  817. CONFIG_INSTALL="$CONFIG_INSTALL install-python"
  818. ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)"
  819. if test -n "${with_python_libdir}"; then
  820. AC_DEFINE_UNQUOTED(WITH_PYTHON_LIBDIR, "${with_python_libdir}",
  821. [Directory containing Python's standard libraries from --with-python-libdir.])
  822. GDB_AC_DEFINE_RELOCATABLE(PYTHON_LIBDIR, [python lib], ${with_python_libdir})
  823. fi
  824. # Flags needed to compile Python code (taken from python-config --cflags).
  825. # We cannot call python-config directly because it will output whatever was
  826. # used when compiling the Python interpreter itself, including flags which
  827. # would make the python-related objects be compiled differently from the
  828. # rest of GDB (e.g., -O2 and -fPIC).
  829. if test "${GCC}" = yes; then
  830. tentative_python_cflags="-fno-strict-aliasing -fwrapv"
  831. # Python headers recommend -DNDEBUG, but it's unclear if that just
  832. # refers to building Python itself. In release mode, though, it
  833. # doesn't hurt for the Python code in gdb to follow.
  834. $development || tentative_python_cflags="$tentative_python_cflags -DNDEBUG"
  835. fi
  836. if test "x${tentative_python_cflags}" != x; then
  837. AC_MSG_CHECKING(compiler flags for python code)
  838. for flag in ${tentative_python_cflags}; do
  839. # Check that the compiler accepts it
  840. saved_CFLAGS="$CFLAGS"
  841. CFLAGS="$CFLAGS $flag"
  842. AC_COMPILE_IFELSE(
  843. [AC_LANG_PROGRAM([], [])],
  844. [PYTHON_CFLAGS="${PYTHON_CFLAGS} $flag"],
  845. []
  846. )
  847. CFLAGS="$saved_CFLAGS"
  848. done
  849. AC_MSG_RESULT(${PYTHON_CFLAGS})
  850. fi
  851. # On x64 Windows, Python's include headers, and pyconfig.h in
  852. # particular, rely on MS_WIN64 macro to detect that it's a 64bit
  853. # version of Windows. Unfortunately, MS_WIN64 is only defined if
  854. # _MSC_VER, a Microsoft-specific macro, is defined. So, when
  855. # building on x64 Windows with GCC, we define MS_WIN64 ourselves.
  856. # The issue was reported to the Python community, but still isn't
  857. # solved as of 2012-10-02 (http://bugs.python.org/issue4709).
  858. case "$gdb_host" in
  859. mingw64)
  860. if test "${GCC}" = yes; then
  861. CPPFLAGS="$CPPFLAGS -DMS_WIN64"
  862. fi
  863. ;;
  864. esac
  865. else
  866. # Even if Python support is not compiled in, we need to have this file
  867. # included so that the "python" command, et.al., still exists.
  868. CONFIG_OBS="$CONFIG_OBS python/python.o"
  869. CONFIG_SRCS="$CONFIG_SRCS python/python.c"
  870. fi
  871. # Work around Python http://bugs.python.org/issue10112. See also
  872. # http://bugs.python.org/issue11410, otherwise -Wl,--dynamic-list has
  873. # no effect. Note that the only test after this that uses Python is
  874. # the -rdynamic/-Wl,--dynamic-list test, and we do want that one to be
  875. # run without -export-dynamic too.
  876. PYTHON_LIBS=`echo $PYTHON_LIBS | sed -e 's/-Xlinker -export-dynamic//'`
  877. AC_SUBST(PYTHON_CFLAGS)
  878. AC_SUBST(PYTHON_CPPFLAGS)
  879. AC_SUBST(PYTHON_LIBS)
  880. AM_CONDITIONAL(HAVE_PYTHON, test "${have_libpython}" != no)
  881. # -------------------- #
  882. # Check for libguile. #
  883. # -------------------- #
  884. dnl Utility to simplify finding libguile.
  885. dnl $1 = pkg-config-program
  886. dnl $2 = space-separate list of guile versions to try
  887. dnl $3 = yes|no, indicating whether to flag errors or ignore them
  888. dnl $4 = the shell variable to assign the result to
  889. dnl If libguile is found we store "yes" here.
  890. AC_DEFUN([AC_TRY_LIBGUILE],
  891. [
  892. pkg_config=$1
  893. guile_version_list=$2
  894. flag_errors=$3
  895. define([have_libguile_var],$4)
  896. found_usable_guile=checking
  897. AC_MSG_CHECKING([for usable guile from ${pkg_config}])
  898. for guile_version in ${guile_version_list}; do
  899. ${pkg_config} --exists ${guile_version} 2>/dev/null
  900. if test $? != 0; then
  901. continue
  902. fi
  903. dnl pkg-config says the package exists, so if we get an error now,
  904. dnl that's bad.
  905. new_CPPFLAGS=`${pkg_config} --cflags ${guile_version}`
  906. if test $? != 0; then
  907. AC_MSG_ERROR([failure running pkg-config --cflags ${guile_version}])
  908. fi
  909. new_LIBS=`${pkg_config} --libs ${guile_version}`
  910. if test $? != 0; then
  911. AC_MSG_ERROR([failure running pkg-config --libs ${guile_version}])
  912. fi
  913. dnl If we get this far, great.
  914. found_usable_guile=${guile_version}
  915. break
  916. done
  917. if test "${found_usable_guile}" = "checking"; then
  918. if test "${flag_errors}" = "yes"; then
  919. AC_MSG_ERROR([unable to find usable guile version from "${guile_version_list}"])
  920. else
  921. found_usable_guile=no
  922. fi
  923. fi
  924. dnl One final sanity check.
  925. dnl The user could have said --with-guile=python-2.7.
  926. if test "${found_usable_guile}" != no; then
  927. save_CPPFLAGS=$CPPFLAGS
  928. save_LIBS=$LIBS
  929. CPPFLAGS="$CPPFLAGS $new_CPPFLAGS"
  930. LIBS="$LIBS $new_LIBS"
  931. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "libguile.h"]],
  932. [[scm_init_guile ();]])],
  933. [have_libguile_var=yes
  934. GUILE_CPPFLAGS=$new_CPPFLAGS
  935. GUILE_LIBS=$new_LIBS],
  936. [found_usable_guile=no])
  937. dnl scm_set_automatic_finalization_enabled added in Guile 2.2.
  938. AC_CHECK_FUNC(scm_set_automatic_finalization_enabled,
  939. AC_DEFINE(HAVE_GUILE_MANUAL_FINALIZATION, 1,
  940. [Define if Guile supports manual finalization.])
  941. )
  942. CPPFLAGS=$save_CPPFLAGS
  943. LIBS=$save_LIBS
  944. if test "${found_usable_guile}" = no; then
  945. if test "${flag_errors}" = yes; then
  946. AC_MSG_FAILURE([linking guile version ${guile_version} test program failed])
  947. fi
  948. fi
  949. fi
  950. AC_MSG_RESULT([${found_usable_guile}])
  951. ])
  952. dnl There are several different values for --with-guile:
  953. dnl
  954. dnl no - Don't include guile support.
  955. dnl yes - Include guile support, error if it's missing.
  956. dnl The pkg-config program must be in $PATH.
  957. dnl auto - Same as "yes", but if guile is missing from the system,
  958. dnl fall back to "no".
  959. dnl guile-version [guile-version-choice-2 ...] -
  960. dnl A space-separated list of guile package versions to try.
  961. dnl These are passed to pkg-config as-is.
  962. dnl E.g., guile-2.0 or guile-2.2-uninstalled
  963. dnl This requires making sure PKG_CONFIG_PATH is set appropriately.
  964. dnl /path/to/pkg-config -
  965. dnl Use this pkg-config program.
  966. dnl NOTE: This needn't be the "real" pkg-config program.
  967. dnl It could be a shell script. It is invoked as:
  968. dnl pkg-config --exists $version
  969. dnl pkg-config --cflags $version
  970. dnl pkg-config --libs $version
  971. dnl pkg-config --variable guild $version
  972. dnl The script will be called with $version having each value in
  973. dnl $try_guile_versions until --exists indicates success.
  974. AC_ARG_WITH(guile,
  975. AS_HELP_STRING([--with-guile@<:@=GUILE@:>@], [include guile support (auto/yes/no/<guile-version>/<pkg-config-program>)]),
  976. [], [with_guile=auto])
  977. AC_MSG_CHECKING([whether to use guile])
  978. AC_MSG_RESULT([$with_guile])
  979. dnl We check guile with pkg-config.
  980. AC_PATH_PROG(pkg_config_prog_path, pkg-config, missing)
  981. try_guile_versions="guile-3.0 guile-2.2 guile-2.0"
  982. have_libguile=no
  983. case "${with_guile}" in
  984. no)
  985. AC_MSG_WARN([guile support disabled; some features will be unavailable.])
  986. ;;
  987. auto)
  988. if test "${pkg_config_prog_path}" = "missing"; then
  989. AC_MSG_WARN([pkg-config not found, guile support disabled])
  990. else
  991. AC_TRY_LIBGUILE(${pkg_config_prog_path}, ${try_guile_versions}, no, have_libguile)
  992. fi
  993. ;;
  994. yes)
  995. if test "${pkg_config_prog_path}" = "missing"; then
  996. AC_MSG_ERROR([pkg-config not found])
  997. fi
  998. AC_TRY_LIBGUILE(${pkg_config_prog_path}, ${try_guile_versions}, yes, have_libguile)
  999. ;;
  1000. [[\\/]]* | ?:[[\\/]]*)
  1001. if test -x "${with_guile}"; then
  1002. AC_TRY_LIBGUILE(${with_guile}, ${try_guile_versions}, yes, have_libguile)
  1003. else
  1004. AC_MSG_ERROR([Guile config program not executable: ${with_guile}])
  1005. fi
  1006. ;;
  1007. "" | */*)
  1008. # Disallow --with=guile="" and --with-guile=foo/bar.
  1009. AC_MSG_ERROR([invalid value for --with-guile])
  1010. ;;
  1011. *)
  1012. # A space separate list of guile versions to try, in order.
  1013. if test "${pkg_config_prog_path}" = "missing"; then
  1014. AC_MSG_ERROR([pkg-config not found])
  1015. fi
  1016. AC_TRY_LIBGUILE(${pkg_config_prog_path}, ${with_guile}, yes, have_libguile)
  1017. ;;
  1018. esac
  1019. if test "${have_libguile}" != no; then
  1020. dnl Get the name of the 'guild' program.
  1021. case "${with_guile}" in
  1022. [[\\/]]* | ?:[[\\/]]*)
  1023. GDB_GUILE_PROGRAM_NAMES(["${with_guile}"], ["${guile_version}"])
  1024. ;;
  1025. *)
  1026. GDB_GUILE_PROGRAM_NAMES(["${pkg_config_prog_path}"], ["${guile_version}"])
  1027. ;;
  1028. esac
  1029. dnl Make sure guild can handle this host.
  1030. GDB_TRY_GUILD([$srcdir/guile/lib/gdb/support.scm])
  1031. dnl If not, disable guile support.
  1032. if test "$ac_cv_guild_ok" = no; then
  1033. have_libguile=no
  1034. AC_MSG_WARN(disabling guile support, $GUILD fails compiling for $host)
  1035. fi
  1036. fi
  1037. if test "${have_libguile}" != no; then
  1038. AC_DEFINE(HAVE_GUILE, 1, [Define if Guile interpreter is being linked in.])
  1039. CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_GUILE_OBS)"
  1040. CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_GUILE_DEPS)"
  1041. CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_GUILE_SRCS)"
  1042. CONFIG_INSTALL="$CONFIG_INSTALL install-guile"
  1043. ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_GUILE_CFLAGS)"
  1044. dnl The 'scm_new_smob' function appeared in Guile 2.0.6.
  1045. save_LIBS="$LIBS"
  1046. save_CPPFLAGS="$CPPFLAGS"
  1047. LIBS="$GUILE_LIBS"
  1048. CPPFLAGS="$GUILE_CPPFLAGS"
  1049. AC_CHECK_FUNCS([scm_new_smob])
  1050. LIBS="$save_LIBS"
  1051. CPPFLAGS="$save_CPPFLAGS"
  1052. else
  1053. # Even if Guile support is not compiled in, we need to have these files
  1054. # included.
  1055. CONFIG_OBS="$CONFIG_OBS guile/guile.o"
  1056. CONFIG_SRCS="$CONFIG_SRCS guile/guile.c"
  1057. fi
  1058. AC_SUBST(GUILE_CPPFLAGS)
  1059. AC_SUBST(GUILE_LIBS)
  1060. AM_CONDITIONAL(HAVE_GUILE, test "${have_libguile}" != no)
  1061. # ---------------------------- #
  1062. # Check for source highlight. #
  1063. # ---------------------------- #
  1064. SRCHIGH_LIBS=
  1065. SRCHIGH_CFLAGS=
  1066. AC_ARG_ENABLE(source-highlight,
  1067. AS_HELP_STRING([--enable-source-highlight],
  1068. [enable source-highlight for source listings]),
  1069. [case "${enableval}" in
  1070. yes) enable_source_highlight=yes ;;
  1071. no) enable_source_highlight=no ;;
  1072. *) AC_MSG_ERROR(bad value ${enableval} for source-highlight option) ;;
  1073. esac],
  1074. [enable_source_highlight=auto])
  1075. if test "${enable_source_highlight}" != "no"; then
  1076. AC_MSG_CHECKING([for the source-highlight library])
  1077. if test "${pkg_config_prog_path}" = "missing"; then
  1078. AC_MSG_RESULT([no - pkg-config not found])
  1079. if test "${enable_source_highlight}" = "yes"; then
  1080. AC_MSG_ERROR([pkg-config was not found in your system])
  1081. fi
  1082. else
  1083. if ${pkg_config_prog_path} --exists source-highlight; then
  1084. case "$LDFLAGS" in
  1085. *static-libstdc*)
  1086. AC_MSG_ERROR([source highlight is incompatible with -static-libstdc++; dnl
  1087. either use --disable-source-highlight or dnl
  1088. --without-static-standard-libraries])
  1089. ;;
  1090. esac
  1091. srchigh_pkg_cflags=`${pkg_config_prog_path} --cflags source-highlight`
  1092. srchigh_pkg_libs=`${pkg_config_prog_path} --libs source-highlight`
  1093. # Now that we have found a source-highlight library, check if we can use
  1094. # it. In particular, we're trying to detect the situation that the
  1095. # library is using the new libstdc++ library abi ( see
  1096. # https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html )
  1097. # while the compiler being used to compile gdb is using the old abi.
  1098. # Such a situation will result in an undefined reference to
  1099. # srchilite::SourceHighlight::SourceHighlight(std::string const&).
  1100. # This situation can occur for instance when using a source highlight
  1101. # library compiled with g++ 7.5.0 while building gdb with g++ 4.8.5.
  1102. AC_LANG_PUSH(C++)
  1103. save_CXXFLAGS="$CXXFLAGS"
  1104. save_LIBS="$LIBS"
  1105. CXXFLAGS="$CXXFLAGS $srchigh_pkg_cflags"
  1106. LIBS="$LIBS $srchigh_pkg_libs"
  1107. AC_LINK_IFELSE(
  1108. [AC_LANG_PROGRAM(
  1109. [#include <srchilite/sourcehighlight.h>],
  1110. [std::string outlang = "esc.outlang";
  1111. new srchilite::SourceHighlight (outlang);]
  1112. )],
  1113. [have_usable_source_highlight=yes],
  1114. [have_usable_source_highlight=no]
  1115. )
  1116. CXXFLAGS="$save_CXXFLAGS"
  1117. LIBS="$save_LIBS"
  1118. AC_LANG_POP(C++)
  1119. if test "${have_usable_source_highlight}" = "yes"; then
  1120. AC_DEFINE([HAVE_SOURCE_HIGHLIGHT], 1,
  1121. [Define to 1 if the source-highlight library is available])
  1122. AC_MSG_RESULT([yes])
  1123. SRCHIGH_CFLAGS="$srchigh_pkg_cflags"
  1124. SRCHIGH_LIBS="$srchigh_pkg_libs"
  1125. else
  1126. AC_MSG_RESULT([no])
  1127. if test "${enable_source_highlight}" = "yes"; then
  1128. AC_MSG_ERROR([source-highlight in your system could not be used])
  1129. fi
  1130. fi
  1131. else
  1132. AC_MSG_RESULT([no])
  1133. if test "${enable_source_highlight}" = "yes"; then
  1134. AC_MSG_ERROR([source-highlight was not found in your system])
  1135. fi
  1136. fi
  1137. fi
  1138. fi
  1139. AC_SUBST(SRCHIGH_LIBS)
  1140. AC_SUBST(SRCHIGH_CFLAGS)
  1141. # ------------------------- #
  1142. # Checks for header files. #
  1143. # ------------------------- #
  1144. AC_HEADER_STDC
  1145. # elf_hp.h is for HP/UX 64-bit shared library support.
  1146. AC_CHECK_HEADERS([nlist.h machine/reg.h \
  1147. thread_db.h \
  1148. sys/file.h sys/filio.h sys/ioctl.h sys/param.h \
  1149. sys/procctl.h sys/resource.h sys/ptrace.h ptrace.h \
  1150. sys/reg.h sys/debugreg.h \
  1151. termios.h elf_hp.h])
  1152. AC_CHECK_HEADERS(sys/user.h, [], [],
  1153. [#if HAVE_SYS_PARAM_H
  1154. # include <sys/param.h>
  1155. #endif
  1156. ])
  1157. AC_CHECK_HEADERS(curses.h cursesX.h ncurses.h ncursesw/ncurses.h ncurses/ncurses.h ncurses/term.h)
  1158. AC_CHECK_HEADERS(term.h, [], [],
  1159. [#if HAVE_CURSES_H
  1160. # include <curses.h>
  1161. #endif
  1162. ])
  1163. AC_CHECK_HEADERS([sys/socket.h])
  1164. AC_CHECK_HEADERS([ws2tcpip.h])
  1165. AC_CHECK_HEADERS([execinfo.h])
  1166. # ------------------------- #
  1167. # Checks for declarations. #
  1168. # ------------------------- #
  1169. libiberty_INIT
  1170. AC_CHECK_DECLS([snprintf])
  1171. AM_LC_MESSAGES
  1172. # ------------------ #
  1173. # Checks for types. #
  1174. # ------------------ #
  1175. AC_CHECK_TYPES(socklen_t, [], [],
  1176. [#include <sys/types.h>
  1177. #if HAVE_SYS_SOCKET_H
  1178. # include <sys/socket.h>
  1179. #elif HAVE_WS2TCPIP_H
  1180. # include <ws2tcpip.h>
  1181. #endif
  1182. ])
  1183. # ------------------------------------- #
  1184. # Checks for compiler characteristics. #
  1185. # ------------------------------------- #
  1186. AC_C_CONST
  1187. AC_C_INLINE
  1188. AC_C_BIGENDIAN
  1189. # ------------------------------ #
  1190. # Checks for library functions. #
  1191. # ------------------------------ #
  1192. AC_CHECK_FUNCS([getuid getgid \
  1193. pipe pread pread64 pwrite resize_term \
  1194. getpgid setsid \
  1195. sigaction sigsetmask socketpair \
  1196. ttrace wborder wresize setlocale iconvlist libiconvlist btowc \
  1197. setrlimit getrlimit posix_madvise waitpid \
  1198. use_default_colors])
  1199. AM_LANGINFO_CODESET
  1200. GDB_AC_COMMON
  1201. # Check the return and argument types of ptrace.
  1202. GDB_AC_PTRACE
  1203. dnl AC_FUNC_SETPGRP does not work when cross compiling
  1204. dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
  1205. if test "$cross_compiling" = no; then
  1206. AC_FUNC_SETPGRP
  1207. else
  1208. AC_CACHE_CHECK(
  1209. [whether setpgrp takes no argument],
  1210. [ac_cv_func_setpgrp_void],
  1211. [AC_COMPILE_IFELSE(
  1212. [AC_LANG_PROGRAM(
  1213. [#include <unistd.h>],
  1214. [if (setpgrp(1,1) == -1)
  1215. exit (0);
  1216. else
  1217. exit (1);]
  1218. )],
  1219. [ac_cv_func_setpgrp_void=no],
  1220. [ac_cv_func_setpgrp_void=yes]
  1221. )]
  1222. )
  1223. if test "$ac_cv_func_setpgrp_void" = yes; then
  1224. AC_DEFINE(SETPGRP_VOID, 1)
  1225. fi
  1226. fi
  1227. # Check if <sys/proc.h> defines `struct thread' with a td_pcb member.
  1228. AC_CHECK_MEMBERS([struct thread.td_pcb], [], [],
  1229. [#include <sys/param.h>
  1230. #include <sys/proc.h>
  1231. ])
  1232. # See if <sys/lwp.h> defines `struct lwp`.
  1233. AC_CACHE_CHECK(
  1234. [for struct lwp],
  1235. [gdb_cv_struct_lwp],
  1236. [AC_COMPILE_IFELSE(
  1237. [AC_LANG_PROGRAM(
  1238. [#include <sys/param.h>
  1239. #define _KMEMUSER
  1240. #include <sys/lwp.h>],
  1241. [struct lwp l;]
  1242. )],
  1243. [gdb_cv_struct_lwp=yes],
  1244. [gdb_cv_struct_lwp=no]
  1245. )]
  1246. )
  1247. if test "$gdb_cv_struct_lwp" = yes; then
  1248. AC_DEFINE(HAVE_STRUCT_LWP, 1,
  1249. [Define to 1 if your system has struct lwp.])
  1250. fi
  1251. # See if <machine/reg.h> degines `struct reg'.
  1252. AC_CACHE_CHECK(
  1253. [for struct reg in machine/reg.h],
  1254. [gdb_cv_struct_reg],
  1255. [AC_COMPILE_IFELSE(
  1256. [AC_LANG_PROGRAM(
  1257. [#include <sys/types.h>
  1258. #include <machine/reg.h>],
  1259. [struct reg r;]
  1260. )],
  1261. [gdb_cv_struct_reg=yes],
  1262. [gdb_cv_struct_reg=no]
  1263. )]
  1264. )
  1265. if test "$gdb_cv_struct_reg" = yes; then
  1266. AC_DEFINE(HAVE_STRUCT_REG, 1,
  1267. [Define to 1 if your system has struct reg in <machine/reg.h>.])
  1268. fi
  1269. # See if <machine/reg.h> supports the %fs and %gs i386 segment registers.
  1270. # Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'.
  1271. AC_CHECK_MEMBERS([struct reg.r_fs, struct reg.r_gs], [], [],
  1272. [#include <sys/types.h>
  1273. #include <machine/reg.h>])
  1274. # See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
  1275. AC_MSG_CHECKING(for PTRACE_GETREGS)
  1276. AC_CACHE_VAL(
  1277. [gdb_cv_have_ptrace_getregs],
  1278. [AC_COMPILE_IFELSE(
  1279. [AC_LANG_PROGRAM([#include <sys/ptrace.h>], [PTRACE_GETREGS;])],
  1280. [gdb_cv_have_ptrace_getregs=yes],
  1281. [gdb_cv_have_ptrace_getregs=no]
  1282. )]
  1283. )
  1284. AC_MSG_RESULT($gdb_cv_have_ptrace_getregs)
  1285. if test "$gdb_cv_have_ptrace_getregs" = yes; then
  1286. AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
  1287. [Define if sys/ptrace.h defines the PTRACE_GETREGS request.])
  1288. fi
  1289. # See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
  1290. AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
  1291. AC_CACHE_VAL(
  1292. [gdb_cv_have_ptrace_getfpxregs],
  1293. [AC_COMPILE_IFELSE(
  1294. [AC_LANG_PROGRAM([#include <sys/ptrace.h>], [PTRACE_GETFPXREGS;])],
  1295. [gdb_cv_have_ptrace_getfpxregs=yes],
  1296. [gdb_cv_have_ptrace_getfpxregs=no]
  1297. )]
  1298. )
  1299. AC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs)
  1300. if test "$gdb_cv_have_ptrace_getfpxregs" = yes; then
  1301. AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
  1302. [Define if sys/ptrace.h defines the PTRACE_GETFPXREGS request.])
  1303. fi
  1304. # See if <sys/ptrace.h> provides the PT_GETDBREGS request.
  1305. AC_MSG_CHECKING(for PT_GETDBREGS)
  1306. AC_CACHE_VAL(
  1307. [gdb_cv_have_pt_getdbregs],
  1308. [AC_COMPILE_IFELSE(
  1309. [AC_LANG_PROGRAM(
  1310. [#include <sys/types.h>
  1311. #include <sys/ptrace.h>],
  1312. [PT_GETDBREGS;]
  1313. )],
  1314. [gdb_cv_have_pt_getdbregs=yes],
  1315. [gdb_cv_have_pt_getdbregs=no]
  1316. )]
  1317. )
  1318. AC_MSG_RESULT($gdb_cv_have_pt_getdbregs)
  1319. if test "$gdb_cv_have_pt_getdbregs" = yes; then
  1320. AC_DEFINE(HAVE_PT_GETDBREGS, 1,
  1321. [Define if sys/ptrace.h defines the PT_GETDBREGS request.])
  1322. fi
  1323. # See if <sys/ptrace.h> supports LWP names on FreeBSD
  1324. # Older FreeBSD versions don't have the pl_tdname member of
  1325. # `struct ptrace_lwpinfo'.
  1326. AC_CHECK_MEMBERS([struct ptrace_lwpinfo.pl_tdname], [], [],
  1327. [#include <sys/ptrace.h>])
  1328. # See if <sys/ptrace.h> supports syscall fields on FreeBSD. The
  1329. # pl_syscall_code member of `struct ptrace_lwpinfo' was added in
  1330. # FreeBSD 10.3.
  1331. AC_CHECK_MEMBERS([struct ptrace_lwpinfo.pl_syscall_code], [], [],
  1332. [#include <sys/ptrace.h>])
  1333. # Check if the compiler supports the `long long' type.
  1334. AC_CACHE_CHECK([for long long support in compiler], gdb_cv_c_long_long,
  1335. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
  1336. [[extern long long foo;]],
  1337. [[switch (foo & 2) { case 0: return 1; }]])],
  1338. gdb_cv_c_long_long=yes,
  1339. gdb_cv_c_long_long=no)])
  1340. if test "$gdb_cv_c_long_long" != yes; then
  1341. # libdecnumber requires long long.
  1342. AC_MSG_ERROR([Compiler must support long long for GDB.])
  1343. fi
  1344. # Check if the compiler and runtime support printing decfloats.
  1345. AC_CACHE_CHECK([for decfloat support in printf],
  1346. gdb_cv_printf_has_decfloat,
  1347. [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
  1348. [[char buf[64];
  1349. _Decimal32 d32 = 1.2345df;
  1350. _Decimal64 d64 = 1.2345dd;
  1351. _Decimal128 d128 = 1.2345dl;
  1352. sprintf (buf, "Decimal32: %H\nDecimal64: %D\nDecimal128: %DD", d32, d64, d128);
  1353. return (strcmp ("Decimal32: 1.2345\nDecimal64: 1.2345\nDecimal128: 1.2345", buf));]])],
  1354. gdb_cv_printf_has_decfloat=yes,
  1355. gdb_cv_printf_has_decfloat=no,
  1356. gdb_cv_printf_has_decfloat=no)])
  1357. if test "$gdb_cv_printf_has_decfloat" = yes; then
  1358. AC_DEFINE(PRINTF_HAS_DECFLOAT, 1,
  1359. [Define to 1 if the "%H, %D and %DD" formats work to print decfloats.])
  1360. fi
  1361. # Check if the compiler supports the `long double' type. We can't use
  1362. # AC_C_LONG_DOUBLE because that one does additional checks on the
  1363. # constants defined in <float.h> that fail on some systems,
  1364. # e.g. FreeBSD/i386 4.7 and OpenBSD/i386 3.6.
  1365. AC_CACHE_CHECK([for long double support in compiler], gdb_cv_c_long_double,
  1366. [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[long double foo;]])],
  1367. gdb_cv_c_long_double=yes,
  1368. gdb_cv_c_long_double=no)])
  1369. if test "$gdb_cv_c_long_double" = yes; then
  1370. AC_DEFINE(HAVE_LONG_DOUBLE, 1,
  1371. [Define to 1 if the compiler supports long double.])
  1372. fi
  1373. # Check if the compiler and runtime support printing long doubles.
  1374. AC_CACHE_CHECK([for long double support in printf],
  1375. gdb_cv_printf_has_long_double,
  1376. [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
  1377. [[char buf[16];
  1378. long double f = 3.141592653;
  1379. sprintf (buf, "%Lg", f);
  1380. return (strncmp ("3.14159", buf, 7));]])],
  1381. gdb_cv_printf_has_long_double=yes,
  1382. gdb_cv_printf_has_long_double=no,
  1383. gdb_cv_printf_has_long_double=no)])
  1384. if test "$gdb_cv_printf_has_long_double" = yes; then
  1385. AC_DEFINE(PRINTF_HAS_LONG_DOUBLE, 1,
  1386. [Define to 1 if the "%Lg" format works to print long doubles.])
  1387. fi
  1388. # Check if the compiler and runtime support scanning long doubles.
  1389. AC_CACHE_CHECK([for long double support in scanf],
  1390. gdb_cv_scanf_has_long_double,
  1391. [AC_RUN_IFELSE([AC_LANG_PROGRAM(
  1392. [[#include <stdio.h>]],
  1393. [[char *buf = "3.141592653";
  1394. long double f = 0;
  1395. sscanf (buf, "%Lg", &f);
  1396. return !(f > 3.14159 && f < 3.14160);]])],
  1397. gdb_cv_scanf_has_long_double=yes,
  1398. gdb_cv_scanf_has_long_double=no,
  1399. gdb_cv_scanf_has_long_double=no)])
  1400. if test "$gdb_cv_scanf_has_long_double" = yes; then
  1401. AC_DEFINE(SCANF_HAS_LONG_DOUBLE, 1,
  1402. [Define to 1 if the "%Lg" format works to scan long doubles.])
  1403. fi
  1404. case ${host_os} in
  1405. aix*)
  1406. AC_CACHE_CHECK(
  1407. [for -bbigtoc option], [gdb_cv_bigtoc],
  1408. [SAVE_LDFLAGS=$LDFLAGS
  1409. case $GCC in
  1410. yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
  1411. *) gdb_cv_bigtoc=-bbigtoc ;;
  1412. esac
  1413. LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
  1414. AC_LINK_IFELSE(
  1415. [AC_LANG_PROGRAM([], [int i;])],
  1416. [],
  1417. [gdb_cv_bigtoc=]
  1418. )
  1419. LDFLAGS="${SAVE_LDFLAGS}"]
  1420. )
  1421. CONFIG_LDFLAGS="${CONFIG_LDFLAGS} ${gdb_cv_bigtoc}"
  1422. ;;
  1423. esac
  1424. AC_MSG_CHECKING(for the dynamic export flag)
  1425. dynamic_list=false
  1426. if test "${gdb_native}" = yes; then
  1427. # The dynamically loaded libthread_db needs access to symbols in the gdb
  1428. # executable. Older GNU ld supports --export-dynamic but --dynamic-list
  1429. # may not be supported there.
  1430. old_LDFLAGS="$LDFLAGS"
  1431. # Older GNU ld supports --export-dynamic but --dynamic-list it does not.
  1432. RDYNAMIC="-Wl,--dynamic-list=${srcdir}/proc-service.list"
  1433. LDFLAGS="$LDFLAGS $RDYNAMIC"
  1434. if test "${have_libpython}" = no; then
  1435. AC_LINK_IFELSE(
  1436. [AC_LANG_PROGRAM([], [])],
  1437. [dynamic_list=true],
  1438. []
  1439. )
  1440. else
  1441. # Workaround http://bugs.python.org/issue4434 where static
  1442. # libpythonX.Y.a would get its symbols required for
  1443. # pythonX.Y/lib-dynload/*.so modules hidden by -Wl,--dynamic-list.
  1444. # Problem does not happen for the recommended libpythonX.Y.so linkage.
  1445. # Note the workaround for Python
  1446. # http://bugs.python.org/issue10112 earlier has removed
  1447. # -export-dynamic from PYTHON_LIBS. That's exactly what we want
  1448. # here too, as otherwise it'd make this -Wl,--dynamic-list test
  1449. # always pass.
  1450. old_CFLAGS="$CFLAGS"
  1451. CFLAGS="$CFLAGS $PYTHON_CFLAGS"
  1452. old_LIBS="$LIBS"
  1453. LIBS="$LIBS $PYTHON_LIBS"
  1454. old_CPPFLAGS="$CPPFLAGS"
  1455. CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
  1456. AC_RUN_IFELSE(
  1457. [AC_LANG_PROGRAM(
  1458. [#include "Python.h"],
  1459. [int err;
  1460. Py_Initialize ();
  1461. err = PyRun_SimpleString ("import ctypes\n");
  1462. Py_Finalize ();
  1463. return err == 0 ? 0 : 1;])],
  1464. [dynamic_list=true], [], [true])
  1465. LIBS="$old_LIBS"
  1466. CFLAGS="$old_CFLAGS"
  1467. CPPFLAGS="$old_CPPFLAGS"
  1468. fi
  1469. LDFLAGS="$old_LDFLAGS"
  1470. fi
  1471. if $dynamic_list; then
  1472. found="-Wl,--dynamic-list"
  1473. RDYNAMIC='-Wl,--dynamic-list=$(srcdir)/proc-service.list'
  1474. else
  1475. found="-rdynamic"
  1476. RDYNAMIC="-rdynamic"
  1477. fi
  1478. AC_SUBST(RDYNAMIC)
  1479. AC_MSG_RESULT($found)
  1480. AC_CACHE_CHECK(
  1481. [whether execinfo.h backtrace is available],
  1482. gdb_cv_execinfo_backtrace,
  1483. [AC_LINK_IFELSE(
  1484. [AC_LANG_PROGRAM(
  1485. [
  1486. #include <execinfo.h>
  1487. ],
  1488. [
  1489. int f;
  1490. void *b[[2]];
  1491. f = backtrace (b, 2);
  1492. backtrace_symbols_fd (b, f, 2);
  1493. ])],
  1494. [gdb_cv_execinfo_backtrace=yes],
  1495. [gdb_cv_execinfo_backtrace=no])])
  1496. if test "$gdb_cv_execinfo_backtrace" = yes; then
  1497. AC_DEFINE(HAVE_EXECINFO_BACKTRACE, 1,
  1498. [Define to 1 if execinfo.h backtrace functions are available.])
  1499. fi
  1500. dnl For certain native configurations, we need to check whether thread
  1501. dnl support can be built in or not.
  1502. dnl
  1503. dnl Note that we only want this if we are both native (host == target),
  1504. dnl and not doing a canadian cross build (build == host).
  1505. if test "${build}" = "${host}" -a "${host}" = "${target}" ; then
  1506. case ${host_os} in
  1507. aix*)
  1508. AC_MSG_CHECKING(for AiX thread debugging library)
  1509. AC_CACHE_VAL(
  1510. [gdb_cv_have_aix_thread_debug],
  1511. [AC_COMPILE_IFELSE(
  1512. [AC_LANG_PROGRAM(
  1513. [#include <sys/pthdebug.h>],
  1514. [#ifndef PTHDB_VERSION_3
  1515. #error
  1516. #endif]
  1517. )],
  1518. [gdb_cv_have_aix_thread_debug=yes],
  1519. [gdb_cv_have_aix_thread_debug=no]
  1520. )]
  1521. )
  1522. AC_MSG_RESULT($gdb_cv_have_aix_thread_debug)
  1523. if test "$gdb_cv_have_aix_thread_debug" = yes; then
  1524. CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c"
  1525. CONFIG_OBS="${CONFIG_OBS} aix-thread.o"
  1526. LIBS="$LIBS -lpthdebug"
  1527. # Older versions of AIX do not provide the declaration for
  1528. # the getthrds function (it appears that it was introduced
  1529. # with AIX 6.x).
  1530. AC_CHECK_DECLS(getthrds, [], [], [[#include <procinfo.h>]])
  1531. fi
  1532. ;;
  1533. esac
  1534. AC_SUBST(CONFIG_LDFLAGS)
  1535. fi
  1536. dnl See if we have a thread_db header file that has TD_NOTALLOC and
  1537. dnl other error codes.
  1538. if test "x$ac_cv_header_thread_db_h" = "xyes"; then
  1539. AC_CACHE_CHECK(
  1540. [whether <thread_db.h> has TD_NOTALLOC],
  1541. [gdb_cv_thread_db_h_has_td_notalloc],
  1542. [AC_COMPILE_IFELSE(
  1543. [AC_LANG_PROGRAM(
  1544. [#include <thread_db.h>],
  1545. [int i = TD_NOTALLOC;]
  1546. )],
  1547. [gdb_cv_thread_db_h_has_td_notalloc=yes],
  1548. [gdb_cv_thread_db_h_has_td_notalloc=no]
  1549. )]
  1550. )
  1551. AC_CACHE_CHECK(
  1552. [whether <thread_db.h> has TD_VERSION],
  1553. [gdb_cv_thread_db_h_has_td_version],
  1554. [AC_COMPILE_IFELSE(
  1555. [AC_LANG_PROGRAM(
  1556. [#include <thread_db.h>],
  1557. [int i = TD_VERSION;]
  1558. )],
  1559. [gdb_cv_thread_db_h_has_td_version=yes],
  1560. [gdb_cv_thread_db_h_has_td_version=no]
  1561. )]
  1562. )
  1563. AC_CACHE_CHECK(
  1564. [whether <thread_db.h> has TD_NOTLS],
  1565. [gdb_cv_thread_db_h_has_td_notls],
  1566. [AC_COMPILE_IFELSE(
  1567. [AC_LANG_PROGRAM(
  1568. [#include <thread_db.h>],
  1569. [int i = TD_NOTLS;]
  1570. )],
  1571. [gdb_cv_thread_db_h_has_td_notls=yes],
  1572. [gdb_cv_thread_db_h_has_td_notls=no]
  1573. )]
  1574. )
  1575. fi
  1576. if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then
  1577. AC_DEFINE(THREAD_DB_HAS_TD_NOTALLOC, 1,
  1578. [Define if <thread_db.h> has the TD_NOTALLOC error code.])
  1579. fi
  1580. if test "x$gdb_cv_thread_db_h_has_td_version" = "xyes"; then
  1581. AC_DEFINE(THREAD_DB_HAS_TD_VERSION, 1,
  1582. [Define if <thread_db.h> has the TD_VERSION error code.])
  1583. fi
  1584. if test "x$gdb_cv_thread_db_h_has_td_notls" = "xyes"; then
  1585. AC_DEFINE(THREAD_DB_HAS_TD_NOTLS, 1,
  1586. [Define if <thread_db.h> has the TD_NOTLS error code.])
  1587. fi
  1588. dnl Set the host's .gdbinit filename.
  1589. case $host_os in
  1590. go32* | *djgpp*)
  1591. gdbinit=gdb.ini
  1592. ;;
  1593. *)
  1594. gdbinit=.gdbinit
  1595. ;;
  1596. esac
  1597. AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.])
  1598. dnl Set the host's .gdbearlyinit filename
  1599. AC_DEFINE_UNQUOTED(GDBEARLYINIT,".gdbearlyinit",[The .gdbearlyinit filename.])
  1600. dnl Handle optional features that can be enabled.
  1601. # Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
  1602. # except that the argument to --with-sysroot is optional.
  1603. # --with-sysroot (or --with-sysroot=yes) sets the default sysroot path.
  1604. if test "x$with_sysroot" = xyes; then
  1605. with_sysroot="${exec_prefix}/${target_alias}/sys-root"
  1606. fi
  1607. AC_ARG_WITH(sysroot,
  1608. AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@],
  1609. [search for usr/lib et al within DIR]),
  1610. [TARGET_SYSTEM_ROOT=$withval], [TARGET_SYSTEM_ROOT=])
  1611. AC_DEFINE_DIR(TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT,
  1612. [search for usr/lib et al within DIR])
  1613. AC_SUBST(TARGET_SYSTEM_ROOT)
  1614. GDB_AC_DEFINE_RELOCATABLE(TARGET_SYSTEM_ROOT, sysroot, ${ac_define_dir})
  1615. GDB_AC_WITH_DIR(SYSTEM_GDBINIT, system-gdbinit,
  1616. [automatically load a system-wide gdbinit file],
  1617. [])
  1618. GDB_AC_WITH_DIR(SYSTEM_GDBINIT_DIR, system-gdbinit-dir,
  1619. [automatically load system-wide gdbinit files from this directory],
  1620. [])
  1621. AM_GDB_COMPILER_TYPE
  1622. AM_GDB_WARNINGS
  1623. AM_GDB_UBSAN
  1624. # In the Cygwin environment, we need some additional flags.
  1625. AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
  1626. [AC_EGREP_CPP(^lose$, [
  1627. #if defined (__CYGWIN__) || defined (__CYGWIN32__)
  1628. lose
  1629. #endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
  1630. dnl Figure out which of the many generic ser-*.c files the _host_ supports.
  1631. SER_HARDWIRE="ser-base.o ser-unix.o ser-pipe.o ser-tcp.o"
  1632. case ${host} in
  1633. *go32* ) SER_HARDWIRE=ser-go32.o ;;
  1634. *djgpp* ) SER_HARDWIRE=ser-go32.o ;;
  1635. *mingw32*) SER_HARDWIRE="ser-base.o ser-tcp.o ser-mingw.o" ;;
  1636. *) SER_HARDWIRE="$SER_HARDWIRE ser-uds.o" ;;
  1637. esac
  1638. AC_SUBST(SER_HARDWIRE)
  1639. # libreadline needs libuser32.a in a cygwin environment
  1640. WIN32LIBS=
  1641. if test x"$gdb_cv_os_cygwin" = xyes; then
  1642. WIN32LIBS="-luser32"
  1643. case "${target}" in
  1644. *cygwin*) WIN32LIBS="$WIN32LIBS -limagehlp"
  1645. ;;
  1646. esac
  1647. fi
  1648. # The ser-tcp.c module requires sockets.
  1649. # Note that WIN32APILIBS is set by GDB_AC_COMMON.
  1650. WIN32LIBS="$WIN32LIBS $WIN32APILIBS"
  1651. # Add ELF support to GDB, but only if BFD includes ELF support.
  1652. GDB_AC_CHECK_BFD([for ELF support in BFD], gdb_cv_var_elf,
  1653. [bfd_get_elf_phdr_upper_bound (NULL)], elf-bfd.h)
  1654. if test "$gdb_cv_var_elf" = yes; then
  1655. CONFIG_OBS="$CONFIG_OBS elfread.o stap-probe.o dtrace-probe.o \
  1656. gcore-elf.o elf-none-tdep.o"
  1657. AC_DEFINE(HAVE_ELF, 1,
  1658. [Define if ELF support should be included.])
  1659. # -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
  1660. if test "$plugins" = "yes"; then
  1661. AC_SEARCH_LIBS(dlopen, dl)
  1662. fi
  1663. fi
  1664. # Add macho support to GDB, but only if BFD includes it.
  1665. GDB_AC_CHECK_BFD([for Mach-O support in BFD], gdb_cv_var_macho,
  1666. [bfd_mach_o_lookup_command (NULL, 0, NULL)], mach-o.h)
  1667. if test "$gdb_cv_var_macho" = yes; then
  1668. CONFIG_OBS="$CONFIG_OBS machoread.o"
  1669. fi
  1670. # Add any host-specific objects to GDB.
  1671. CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}"
  1672. # If building on ELF, look for lzma support for embedded compressed debug info.
  1673. if test "$gdb_cv_var_elf" = yes; then
  1674. AC_ARG_WITH(lzma,
  1675. AS_HELP_STRING([--with-lzma], [support lzma compression (auto/yes/no)]),
  1676. [], [with_lzma=auto])
  1677. AC_MSG_CHECKING([whether to use lzma])
  1678. AC_MSG_RESULT([$with_lzma])
  1679. if test "${with_lzma}" != no; then
  1680. AC_LIB_HAVE_LINKFLAGS([lzma], [], [#include "lzma.h"],
  1681. [lzma_index_iter iter;
  1682. lzma_index_iter_init (&iter, 0);
  1683. lzma_mf_is_supported (LZMA_MF_HC3);])
  1684. if test "$HAVE_LIBLZMA" != yes; then
  1685. if test "$with_lzma" = yes; then
  1686. AC_MSG_ERROR([missing liblzma for --with-lzma])
  1687. fi
  1688. fi
  1689. fi
  1690. fi
  1691. LIBGUI="../libgui/src/libgui.a"
  1692. GUI_CFLAGS_X="-I${srcdir}/../libgui/src"
  1693. AC_SUBST(LIBGUI)
  1694. AC_SUBST(GUI_CFLAGS_X)
  1695. WIN32LDAPP=
  1696. AC_SUBST(WIN32LIBS)
  1697. AC_SUBST(WIN32LDAPP)
  1698. case "${host}" in
  1699. *-*-cygwin* | *-*-mingw* )
  1700. configdir="win"
  1701. ;;
  1702. *)
  1703. configdir="unix"
  1704. ;;
  1705. esac
  1706. GDBTKLIBS=
  1707. if test "${enable_gdbtk}" = "yes"; then
  1708. # Gdbtk must have an absolute path to srcdir in order to run
  1709. # properly when not installed.
  1710. here=`pwd`
  1711. cd ${srcdir}
  1712. GDBTK_SRC_DIR=`pwd`
  1713. cd $here
  1714. SC_PATH_TCLCONFIG
  1715. # If $no_tk is nonempty, then we can't do Tk, and there is no
  1716. # point to doing Tcl.
  1717. SC_PATH_TKCONFIG
  1718. if test -z "${no_tcl}" -a -z "${no_tk}"; then
  1719. SC_LOAD_TCLCONFIG
  1720. # Check for in-tree tcl
  1721. here=`pwd`
  1722. cd ${srcdir}/..
  1723. topdir=`pwd`
  1724. cd ${here}
  1725. intree="no"
  1726. if test "${TCL_SRC_DIR}" = "${topdir}/tcl"; then
  1727. intree="yes"
  1728. fi
  1729. # Find Tcl private headers
  1730. if test x"${intree}" = xno; then
  1731. CY_AC_TCL_PRIVATE_HEADERS
  1732. TCL_INCLUDE="${TCL_INCLUDE_SPEC} ${TCL_PRIVATE_INCLUDE}"
  1733. TCL_LIBRARY="${TCL_LIB_SPEC}"
  1734. TCL_DEPS=""
  1735. else
  1736. # If building tcl in the same src tree, private headers
  1737. # are not needed, but we need to be sure to use the right
  1738. # headers library
  1739. TCL_INCLUDE="-I${TCL_SRC_DIR}/generic"
  1740. TCL_LIBRARY="${TCL_BUILD_LIB_SPEC}"
  1741. TCL_DEPS="../tcl/${configdir}${TCL_LIB_FILE}"
  1742. fi
  1743. AC_SUBST(TCL_INCLUDE)
  1744. AC_SUBST(TCL_LIBRARY)
  1745. AC_SUBST(TCL_DEPS)
  1746. SC_LOAD_TKCONFIG
  1747. # Check for in-tree Tk
  1748. intree="no"
  1749. if test "${TK_SRC_DIR}" = "${topdir}/tk"; then
  1750. intree="yes"
  1751. fi
  1752. # Find Tk private headers
  1753. if test x"${intree}" = xno; then
  1754. CY_AC_TK_PRIVATE_HEADERS
  1755. TK_INCLUDE="${TK_INCLUDE_SPEC} ${TK_PRIVATE_INCLUDE}"
  1756. TK_LIBRARY=${TK_LIB_SPEC}
  1757. TK_DEPS=""
  1758. else
  1759. TK_INCLUDE="-I${TK_SRC_DIR}/generic"
  1760. TK_LIBRARY="${TK_BUILD_LIB_SPEC}"
  1761. TK_DEPS="../tk/${configdir}/${TK_LIB_FILE}"
  1762. fi
  1763. AC_SUBST(TK_INCLUDE)
  1764. AC_SUBST(TK_LIBRARY)
  1765. AC_SUBST(TK_DEPS)
  1766. AC_SUBST(TK_XINCLUDES)
  1767. ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_GDBTK_CFLAGS)"
  1768. # Include some libraries that Tcl and Tk want.
  1769. TCL_LIBS='$(LIBGUI) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
  1770. # Yes, the ordering seems wrong here. But it isn't.
  1771. # TK_LIBS is the list of libraries that need to be linked
  1772. # after Tcl/Tk. Note that this isn't put into LIBS. If it
  1773. # were in LIBS then any link tests after this point would
  1774. # try to include things like `$(LIBGUI)', which wouldn't work.
  1775. GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}"
  1776. CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_GDBTK_OBS)"
  1777. CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_GDBTK_DEPS)"
  1778. CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_GDBTK_SRCS)"
  1779. CONFIG_ALL="${CONFIG_ALL} all-gdbtk"
  1780. CONFIG_CLEAN="${CONFIG_CLEAN} clean-gdbtk"
  1781. CONFIG_INSTALL="${CONFIG_INSTALL} install-gdbtk"
  1782. CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-gdbtk"
  1783. if test x"$gdb_cv_os_cygwin" = xyes; then
  1784. WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32"
  1785. WIN32LDAPP="-Wl,--subsystem,console"
  1786. CONFIG_OBS="${CONFIG_OBS} gdbres.o"
  1787. fi
  1788. AC_CONFIG_SUBDIRS(gdbtk)
  1789. fi
  1790. fi
  1791. AC_SUBST(X_CFLAGS)
  1792. AC_SUBST(X_LDFLAGS)
  1793. AC_SUBST(X_LIBS)
  1794. AC_SUBST(GDBTKLIBS)
  1795. AC_SUBST(GDBTK_CFLAGS)
  1796. AC_SUBST(GDBTK_SRC_DIR)
  1797. AC_PATH_X
  1798. # Unlike the sim directory, whether a simulator is linked is controlled by
  1799. # presence of a gdb_sim definition in the target configure.tgt entry.
  1800. # This code just checks for a few cases where we'd like to ignore those
  1801. # definitions, even when they're present in the '.mt' file. These cases
  1802. # are when --disable-sim is specified, or if the simulator directory is
  1803. # not part of the source tree.
  1804. #
  1805. AC_ARG_ENABLE(sim,
  1806. AS_HELP_STRING([--enable-sim], [link gdb with simulator]),
  1807. [echo "enable_sim = $enable_sim";
  1808. echo "enableval = ${enableval}";
  1809. case "${enableval}" in
  1810. yes) ignore_sim=false ;;
  1811. no) ignore_sim=true ;;
  1812. *) ignore_sim=false ;;
  1813. esac],
  1814. [ignore_sim=false])
  1815. if test ! -d "${srcdir}/../sim"; then
  1816. ignore_sim=true
  1817. fi
  1818. SIM=
  1819. SIM_OBS=
  1820. if test "${ignore_sim}" = "false"; then
  1821. if test x"${gdb_sim}" != x ; then
  1822. SIM="${gdb_sim}"
  1823. SIM_OBS="remote-sim.o"
  1824. AC_DEFINE(WITH_SIM, 1, [Define if the simulator is being linked in.])
  1825. # Some tdep code should only be compiled in when the ppc sim is
  1826. # built. PR sim/13418.
  1827. case $target in
  1828. powerpc*-*-*)
  1829. AC_DEFINE(WITH_PPC_SIM, 1, [Define if the PPC simulator is being linked in.])
  1830. ;;
  1831. esac
  1832. fi
  1833. fi
  1834. AC_SUBST(SIM)
  1835. AC_SUBST(SIM_OBS)
  1836. AC_SUBST(ENABLE_CFLAGS)
  1837. AC_SUBST(PROFILE_CFLAGS)
  1838. AC_SUBST(CONFIG_OBS)
  1839. AC_SUBST(CONFIG_DEPS)
  1840. AC_SUBST(CONFIG_SRCS)
  1841. AC_SUBST(CONFIG_ALL)
  1842. AC_SUBST(CONFIG_CLEAN)
  1843. AC_SUBST(CONFIG_INSTALL)
  1844. AC_SUBST(CONFIG_UNINSTALL)
  1845. # List of host floatformats.
  1846. AC_DEFINE_UNQUOTED(GDB_HOST_FLOAT_FORMAT,$gdb_host_float_format,[Host float floatformat])
  1847. AC_DEFINE_UNQUOTED(GDB_HOST_DOUBLE_FORMAT,$gdb_host_double_format,[Host double floatformat])
  1848. AC_DEFINE_UNQUOTED(GDB_HOST_LONG_DOUBLE_FORMAT,$gdb_host_long_double_format,[Host long double floatformat])
  1849. # target_subdir is used by the testsuite to find the target libraries.
  1850. target_subdir=
  1851. if test "${host}" != "${target}"; then
  1852. target_subdir="${target_alias}/"
  1853. fi
  1854. AC_SUBST(target_subdir)
  1855. # Import nat definitions.
  1856. nat_makefile_frag=/dev/null
  1857. if test "${gdb_native}" = "yes"; then
  1858. . ${srcdir}/configure.nat
  1859. nativefile=$NAT_FILE
  1860. fi
  1861. AC_SUBST(NAT_FILE)
  1862. AC_SUBST(NATDEPFILES)
  1863. AC_SUBST(NAT_CDEPS)
  1864. AC_SUBST(LOADLIBES)
  1865. AC_SUBST(MH_CFLAGS)
  1866. AC_SUBST(XM_CLIBS)
  1867. AC_SUBST(NAT_GENERATED_FILES)
  1868. AC_SUBST(HAVE_NATIVE_GCORE_HOST)
  1869. AC_SUBST_FILE(nat_makefile_frag)
  1870. if test x"${gdb_osabi}" != x ; then
  1871. AC_DEFINE_UNQUOTED(GDB_OSABI_DEFAULT, $gdb_osabi,
  1872. [Define to the default OS ABI for this configuration.])
  1873. fi
  1874. # Setup possible use of libbacktrace.
  1875. AC_ARG_ENABLE([libbacktrace],
  1876. [AS_HELP_STRING([--enable-libbacktrace],
  1877. [use libbacktrace to write a backtrace after a fatal signal.])],
  1878. [case "${enableval}" in
  1879. yes) enable_libbacktrace=yes ;;
  1880. no) enable_libbacktrace=no ;;
  1881. *) AC_MSG_ERROR(bad value ${enableval} for --enable-libbacktrace option) ;;
  1882. esac],
  1883. enable_libbacktrace=yes)
  1884. if test "${enable_libbacktrace}" == "yes"; then
  1885. LIBBACKTRACE_INC="-I$srcdir/../libbacktrace/ -I../libbacktrace/"
  1886. LIBBACKTRACE_LIB=../libbacktrace/.libs/libbacktrace.a
  1887. AC_DEFINE(HAVE_LIBBACKTRACE, 1, [Define if libbacktrace is being used.])
  1888. else
  1889. LIBBACKTRACE_INC=
  1890. LIBBACKTRACE_LIB=
  1891. fi
  1892. AC_SUBST(LIBBACKTRACE_INC)
  1893. AC_SUBST(LIBBACKTRACE_LIB)
  1894. # Check for babeltrace and babeltrace-ctf
  1895. AC_ARG_WITH(babeltrace,
  1896. AS_HELP_STRING([--with-babeltrace], [include babeltrace support (auto/yes/no)]),
  1897. [], [with_babeltrace=auto])
  1898. AC_MSG_CHECKING([whether to use babeltrace])
  1899. AC_MSG_RESULT([$with_babeltrace])
  1900. if test "x$with_babeltrace" = "xno"; then
  1901. AC_MSG_WARN([babletrace support disabled; GDB is unable to read CTF data.])
  1902. else
  1903. # Append -Werror to CFLAGS so that configure can catch the warning
  1904. # "assignment from incompatible pointer type", which is related to
  1905. # the babeltrace change from 1.0.3 to 1.1.0. Babeltrace 1.1.0 works
  1906. # in GDB, while babeltrace 1.0.3 is broken.
  1907. # AC_LIB_HAVE_LINKFLAGS may modify CPPFLAGS in it, so it should be
  1908. # safe to save and restore CFLAGS here.
  1909. saved_CFLAGS=$CFLAGS
  1910. CFLAGS="$CFLAGS -Werror"
  1911. AC_LIB_HAVE_LINKFLAGS([babeltrace], [babeltrace-ctf],
  1912. [#include <babeltrace/babeltrace.h>
  1913. #include <babeltrace/ctf/events.h>
  1914. #include <babeltrace/ctf/iterator.h>],
  1915. [struct bt_iter_pos *pos = bt_iter_get_pos (bt_ctf_get_iter (NULL));
  1916. struct bt_ctf_event *event = NULL;
  1917. const struct bt_definition *scope;
  1918. pos->type = BT_SEEK_BEGIN;
  1919. bt_iter_set_pos (bt_ctf_get_iter (NULL), pos);
  1920. scope = bt_ctf_get_top_level_scope (event,
  1921. BT_STREAM_EVENT_HEADER);
  1922. bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id"));
  1923. ])
  1924. CFLAGS=$saved_CFLAGS
  1925. if test "$HAVE_LIBBABELTRACE" != yes; then
  1926. if test "$with_babeltrace" = yes; then
  1927. AC_MSG_ERROR([babeltrace is missing or unusable])
  1928. else
  1929. AC_MSG_WARN([babeltrace is missing or unusable; GDB is unable to read CTF data.])
  1930. fi
  1931. fi
  1932. fi
  1933. # Check for xxhash
  1934. AC_ARG_WITH(xxhash,
  1935. AS_HELP_STRING([--with-xxhash], [use libxxhash for hashing (faster) (auto/yes/no)]),
  1936. [], [with_xxhash=auto])
  1937. GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections])
  1938. if test x${enable_static} = xno; then
  1939. LIBCTF="-Wl,--rpath,../libctf/.libs ../libctf/.libs/libctf.so"
  1940. CTF_DEPS="../libctf/.libs/libctf.so"
  1941. else
  1942. LIBCTF="../libctf/.libs/libctf.a"
  1943. CTF_DEPS="$LIBCTF"
  1944. fi
  1945. if test "${enable_libctf}" = yes; then
  1946. AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections])
  1947. else
  1948. LIBCTF=
  1949. CTF_DEPS=
  1950. fi
  1951. AC_SUBST(LIBCTF)
  1952. AC_SUBST(CTF_DEPS)
  1953. # If nativefile (NAT_FILE) is not set in configure.nat, we link to an
  1954. # empty version.
  1955. if test "x$with_xxhash" != "xno"; then
  1956. AC_LIB_HAVE_LINKFLAGS([xxhash], [],
  1957. [#include <xxhash.h>],
  1958. [XXH32("foo", 3, 0);
  1959. ])
  1960. if test "$HAVE_LIBXXHASH" != yes; then
  1961. if test "$with_xxhash" = yes; then
  1962. AC_MSG_ERROR([xxhash is missing or unusable])
  1963. fi
  1964. fi
  1965. if test "x$with_xxhash" = "xauto"; then
  1966. with_xxhash="$HAVE_LIBXXHASH"
  1967. fi
  1968. fi
  1969. AC_MSG_CHECKING([whether to use xxhash])
  1970. AC_MSG_RESULT([$with_xxhash])
  1971. NM_H=
  1972. rm -f nm.h
  1973. if test "${nativefile}" != ""; then
  1974. case "${nativefile}" in
  1975. nm-*.h ) GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}" ;;
  1976. * ) GDB_NM_FILE="${nativefile}"
  1977. esac
  1978. AC_CONFIG_LINKS([nm.h:$GDB_NM_FILE], [echo > stamp-nmh],
  1979. [GDB_NM_FILE=$GDB_NM_FILE])
  1980. AC_DEFINE_UNQUOTED(GDB_NM_FILE, "${GDB_NM_FILE}", [nativefile])
  1981. NM_H=nm.h
  1982. fi
  1983. AC_SUBST(GDB_NM_FILE)
  1984. AC_SUBST(NM_H)
  1985. dnl Add dependency for xsltproc if building with maintainer-mode enabled.
  1986. AC_PATH_PROGS(XSLTPROC, xsltproc, missing)
  1987. if test "x$USE_MAINTAINER_MODE" = xyes; then
  1988. if test "${XSLTPROC}" = missing; then
  1989. AC_MSG_ERROR(unable to find xsltproc. maintainer-mode requires xsltproc.)
  1990. fi
  1991. fi
  1992. AC_SUBST(XSLTPROC)
  1993. dnl Check for exe extension set on certain hosts (e.g. Win32)
  1994. AC_EXEEXT
  1995. dnl Detect the character set used by this host.
  1996. dnl At the moment, we just assume it's UTF-8.
  1997. AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "UTF-8",
  1998. [Define to be a string naming the default host character set.])
  1999. GDB_AC_SELFTEST([
  2000. CONFIG_OBS="$CONFIG_OBS \$(SELFTESTS_OBS)"
  2001. CONFIG_SRCS="$CONFIG_SRCS \$(SELFTESTS_SRCS)"
  2002. ])
  2003. GDB_AC_TRANSFORM([gdb], [GDB_TRANSFORM_NAME])
  2004. GDB_AC_TRANSFORM([gcore], [GCORE_TRANSFORM_NAME])
  2005. AC_CONFIG_FILES([gcore], [chmod +x gcore])
  2006. AC_CONFIG_FILES([Makefile gdb-gdb.gdb gdb-gdb.py doc/Makefile data-directory/Makefile])
  2007. AC_OUTPUT