configure.ac 76 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272
  1. # -*- autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. # Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
  4. #
  5. # This configure.ac is free software; the author
  6. # gives unlimited permission to copy and/or distribute it,
  7. # with or without modifications, as long as this notice is preserved.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
  11. # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  12. # PARTICULAR PURPOSE.
  13. dnl This configure script is complicated, because GRUB needs to deal
  14. dnl with three potentially different types:
  15. dnl
  16. dnl build -- the environment for building GRUB
  17. dnl host -- the environment for running utilities
  18. dnl target -- the environment for running GRUB
  19. dnl
  20. dnl In addition, GRUB needs to deal with a platform specification
  21. dnl which specifies the system running GRUB, such as firmware.
  22. dnl This is necessary because the target type in autoconf does not
  23. dnl describe such a system very well.
  24. dnl
  25. dnl The current strategy is to use variables with no prefix (such as
  26. dnl CC, CFLAGS, etc.) for the host and target type, variables with
  27. dnl prefix "BUILD_" (such as BUILD_CC, BUILD_CFLAGS, etc.) for the
  28. dnl build type, variables with prefix "HOST_" (such as HOST_CC,
  29. dnl HOST_CFLAGS, etc.) for the host type and variables with the prefix
  30. dnl "TARGET_" (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for
  31. dnl the target type. See INSTALL for full list of variables and
  32. dnl description of the relationships between them.
  33. AC_INIT([GRUB],[2.12~rc1],[bug-grub@gnu.org])
  34. AS_CASE(["$ERROR_PLATFORM_NOT_SUPPORT_SSP"],
  35. [n | no | nO | N | No | NO], [ERROR_PLATFORM_NOT_SUPPORT_SSP=no],
  36. [ERROR_PLATFORM_NOT_SUPPORT_SSP=yes])
  37. # We don't want -g -O2 by default in CFLAGS
  38. : ${CFLAGS=""}
  39. AC_USE_SYSTEM_EXTENSIONS
  40. AC_CONFIG_AUX_DIR([build-aux])
  41. # Checks for build, host and target systems.
  42. AC_CANONICAL_BUILD
  43. AC_CANONICAL_HOST
  44. save_program_prefix="${program_prefix}"
  45. AC_CANONICAL_TARGET
  46. program_prefix="${save_program_prefix}"
  47. AM_INIT_AUTOMAKE([1.11])
  48. AC_PREREQ(2.64)
  49. AC_CONFIG_SRCDIR([include/grub/dl.h])
  50. AC_CONFIG_HEADERS([config-util.h])
  51. # Explicitly check for pkg-config early on, since otherwise conditional
  52. # calls are problematic.
  53. PKG_PROG_PKG_CONFIG
  54. # Program name transformations
  55. AC_ARG_PROGRAM
  56. grub_TRANSFORM([grub-bios-setup])
  57. grub_TRANSFORM([grub-editenv])
  58. grub_TRANSFORM([grub-install])
  59. grub_TRANSFORM([grub-mkconfig])
  60. grub_TRANSFORM([grub-mkfont])
  61. grub_TRANSFORM([grub-mkimage])
  62. grub_TRANSFORM([grub-glue-efi])
  63. grub_TRANSFORM([grub-mklayout])
  64. grub_TRANSFORM([grub-mkpasswd-pbkdf2])
  65. grub_TRANSFORM([grub-mkrelpath])
  66. grub_TRANSFORM([grub-mkrescue])
  67. grub_TRANSFORM([grub-probe])
  68. grub_TRANSFORM([grub-reboot])
  69. grub_TRANSFORM([grub-script-check])
  70. grub_TRANSFORM([grub-set-default])
  71. grub_TRANSFORM([grub-sparc64-setup])
  72. grub_TRANSFORM([grub-render-label])
  73. grub_TRANSFORM([grub-file])
  74. # Allow HOST_CC to override CC.
  75. if test "x$HOST_CC" != x; then
  76. CC=$HOST_CC
  77. fi
  78. # Optimization flag. Allow user to override.
  79. if test "x$TARGET_CFLAGS" = x; then
  80. TARGET_CFLAGS=-Os
  81. fi
  82. # Enable support for "restrict" keyword and other
  83. # features from gnu99 C language standard.
  84. BUILD_CFLAGS="-std=gnu99 -fno-common $BUILD_CFLAGS"
  85. HOST_CFLAGS="-std=gnu99 -fno-common $HOST_CFLAGS"
  86. TARGET_CFLAGS="-std=gnu99 -fno-common $TARGET_CFLAGS"
  87. # Default HOST_CPPFLAGS
  88. HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
  89. HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
  90. TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W"
  91. case "$target_cpu" in
  92. i[[3456]]86) target_cpu=i386 ;;
  93. amd64) target_cpu=x86_64 ;;
  94. sparc) target_cpu=sparc64 ;;
  95. mipsel|mips64el)
  96. target_cpu=mipsel
  97. machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1"
  98. ;;
  99. mips|mips64)
  100. target_cpu=mips
  101. machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1"
  102. ;;
  103. arm*) target_cpu=arm ;;
  104. aarch64*) target_cpu=arm64 ;;
  105. loongarch64) target_cpu=loongarch64 ;;
  106. riscv32*) target_cpu=riscv32 ;;
  107. riscv64*) target_cpu=riscv64 ;;
  108. esac
  109. # Specify the platform (such as firmware).
  110. AC_ARG_WITH([platform],
  111. AS_HELP_STRING([--with-platform=PLATFORM],
  112. [select the host platform [[guessed]]]))
  113. # Guess the platform if not specified.
  114. if test "x$with_platform" = x; then
  115. case "$target_cpu"-"$target_vendor" in
  116. i386-apple) platform=efi ;;
  117. i386-*) platform=pc ;;
  118. x86_64-apple) platform=efi ;;
  119. x86_64-*) platform=pc ;;
  120. powerpc-*) platform=ieee1275 ;;
  121. powerpc64-*) platform=ieee1275 ;;
  122. powerpc64le-*) platform=ieee1275 ;;
  123. sparc64-*) platform=ieee1275 ;;
  124. mipsel-*) platform=loongson ;;
  125. mips-*) platform=arc ;;
  126. ia64-*) platform=efi ;;
  127. arm-*) platform=uboot ;;
  128. arm64-*) platform=efi ;;
  129. loongarch64-*) platform=efi;;
  130. riscv32-*) platform=efi ;;
  131. riscv64-*) platform=efi ;;
  132. *)
  133. AC_MSG_WARN([unsupported CPU: "$target_cpu" - only building utilities])
  134. platform=none
  135. ;;
  136. esac
  137. else
  138. platform="$with_platform"
  139. fi
  140. case "$target_cpu"-"$platform" in
  141. x86_64-efi) ;;
  142. x86_64-emu) ;;
  143. x86_64-xen) ;;
  144. x86_64-none) ;;
  145. x86_64-*) target_cpu=i386 ;;
  146. powerpc64-ieee1275) target_cpu=powerpc ;;
  147. powerpc64le-ieee1275) target_cpu=powerpc ;;
  148. esac
  149. # Check if the platform is supported, make final adjustments.
  150. case "$target_cpu"-"$platform" in
  151. i386-efi) ;;
  152. x86_64-efi) ;;
  153. i386-xen) ;;
  154. i386-xen_pvh) ;;
  155. x86_64-xen) ;;
  156. i386-pc) ;;
  157. i386-multiboot) ;;
  158. i386-coreboot) ;;
  159. i386-linuxbios) platform=coreboot ;;
  160. i386-ieee1275) ;;
  161. i386-qemu) ;;
  162. powerpc-ieee1275) ;;
  163. sparc64-ieee1275) ;;
  164. ia64-efi) ;;
  165. mips-qemu_mips) ;;
  166. mips-qemu-mips) platform=qemu_mips;;
  167. mips-arc) ;;
  168. mipsel-arc) ;;
  169. mipsel-qemu_mips) ;;
  170. mipsel-qemu-mips) platform=qemu_mips;;
  171. mipsel-yeeloong) platform=loongson ;;
  172. mipsel-fuloong) platform=loongson ;;
  173. mipsel-loongson) ;;
  174. arm-uboot) ;;
  175. arm-coreboot) ;;
  176. arm-efi) ;;
  177. arm64-efi) ;;
  178. loongarch64-efi) ;;
  179. riscv32-efi) ;;
  180. riscv64-efi) ;;
  181. *-emu) ;;
  182. *-none) ;;
  183. *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
  184. esac
  185. if test x$platform != xemu ; then
  186. case "$target_cpu" in
  187. i386 | powerpc) target_m32=1 ;;
  188. x86_64 | sparc64) target_m64=1 ;;
  189. esac
  190. fi
  191. if test x"$target_cpu-$platform" = xsparc64-emu ; then
  192. target_m64=1
  193. fi
  194. case "$target_os" in
  195. windows* | mingw32*) target_os=cygwin ;;
  196. esac
  197. # This normalizes the names, and creates a new variable ("host_kernel")
  198. # while at it, since the mapping is not always 1:1 (e.g. different OSes
  199. # using the same kernel type).
  200. case "$host_os" in
  201. gnu*) host_kernel=hurd ;;
  202. linux*) host_kernel=linux ;;
  203. freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
  204. netbsd*) host_kernel=netbsd ;;
  205. solaris*) host_kernel=illumos ;;
  206. darwin*) host_kernel=xnu ;;
  207. cygwin | windows* | mingw32*) host_kernel=windows ;;
  208. esac
  209. case "$host_os" in
  210. cygwin) have_exec=y ;;
  211. windows* | mingw32*) have_exec=n ;;
  212. aros*) have_exec=n ;;
  213. *) have_exec=y;;
  214. esac
  215. case "$platform" in
  216. coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;;
  217. multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;;
  218. efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;;
  219. xen) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_XEN=1" ;;
  220. xen_pvh) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_XEN_PVH=1" ;;
  221. ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;;
  222. uboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;;
  223. qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
  224. pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
  225. emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
  226. loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1" ;;
  227. qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1" ;;
  228. arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;;
  229. esac
  230. if test x${target_cpu} = xmipsel ; then
  231. machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
  232. else
  233. machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
  234. fi
  235. case "${target_cpu}-$platform" in
  236. mips-arc)
  237. TARGET_LINK_ADDR=0x88200000
  238. TARGET_DECOMPRESSOR_LINK_ADDR=0x88100000
  239. ;;
  240. mipsel-arc)
  241. TARGET_LINK_ADDR=0x80700000
  242. TARGET_DECOMPRESSOR_LINK_ADDR=0x80600000
  243. ;;
  244. mips*-qemu_mips | mips*-loongson)
  245. TARGET_DECOMPRESSOR_LINK_ADDR=0x80100000
  246. ;;
  247. esac
  248. AC_SUBST(TARGET_LINK_ADDR)
  249. AC_SUBST(TARGET_DECOMPRESSOR_LINK_ADDR)
  250. TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
  251. AC_SUBST(host_cpu)
  252. AC_SUBST(host_os)
  253. AC_SUBST(host_kernel)
  254. AC_SUBST(target_cpu)
  255. AC_SUBST(platform)
  256. # Define default variables
  257. have_with_bootdir=n
  258. AC_ARG_WITH([bootdir],
  259. AS_HELP_STRING([--with-bootdir=DIR],
  260. [set the name of /boot directory [[guessed]]]),
  261. [have_with_bootdir=y],
  262. [have_with_bootdir=n])
  263. if test x$have_with_bootdir = xy; then
  264. bootdirname="$with_bootdir"
  265. else
  266. case "$host_os" in
  267. netbsd* | openbsd*)
  268. # Because /boot is used for the boot block in NetBSD and OpenBSD,
  269. bootdirname='' ;;
  270. *) bootdirname='boot' ;;
  271. esac
  272. fi
  273. AC_SUBST(bootdirname)
  274. AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
  275. [Default boot directory name])
  276. AC_ARG_WITH([grubdir],
  277. AS_HELP_STRING([--with-grubdir=DIR],
  278. [set the name of grub directory [[guessed]]]),
  279. [grubdirname="$with_grubdir"],
  280. [grubdirname="$PACKAGE"])
  281. AC_SUBST(grubdirname)
  282. AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
  283. [Default grub directory name])
  284. #
  285. # Checks for build programs.
  286. #
  287. # Although cmp is listed in the GNU Coding Standards as a command which
  288. # can used directly, OpenBSD lacks cmp in the default installation.
  289. AC_CHECK_PROGS([CMP], [cmp])
  290. if test "x$CMP" = x; then
  291. AC_MSG_ERROR([cmp is not found])
  292. fi
  293. AC_CHECK_PROGS([YACC], [bison])
  294. if test "x$YACC" = x; then
  295. AC_MSG_ERROR([bison is not found])
  296. fi
  297. AC_PROG_RANLIB
  298. AC_PROG_INSTALL
  299. AC_PROG_AWK
  300. AC_PROG_LEX([noyywrap])
  301. AC_PROG_YACC
  302. AC_PROG_MAKE_SET
  303. AC_PROG_MKDIR_P
  304. AC_PROG_LN_S
  305. if test "x$LEX" = "x:"; then
  306. AC_MSG_ERROR([flex is not found])
  307. else
  308. version=`$LEX --version | $AWK '{ split($2,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
  309. if test -n "$version" -a "$version" -ge 20535; then
  310. :
  311. else
  312. AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
  313. fi
  314. fi
  315. # These are not a "must".
  316. AC_PATH_PROGS(MAKEINFO, makeinfo true)
  317. #
  318. # Checks for host programs.
  319. #
  320. AC_PROG_CC
  321. gl_EARLY
  322. AC_PROG_CXX
  323. AM_PROG_CC_C_O
  324. AM_PROG_AS
  325. AM_PATH_PYTHON([2.6])
  326. # Must be GCC.
  327. test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
  328. AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
  329. AM_GNU_GETTEXT([external])
  330. AM_GNU_GETTEXT_VERSION([0.18.3])
  331. AC_SYS_LARGEFILE
  332. PLATFORMS_PCI=" $(PYTHONPATH="${srcdir}" $PYTHON -c 'import gentpl; print(" ".join(gentpl.GROUPS[["pci"]]))') "
  333. if test x"${PLATFORMS_PCI##* ${target_cpu}_${platform} *}" = x ; then
  334. have_pci=y
  335. fi
  336. # Identify characteristics of the host architecture.
  337. unset ac_cv_c_bigendian
  338. if test x"$target_cpu-$platform" = xsparc64-emu ; then
  339. CFLAGS="$CFLAGS -m64"
  340. HOST_CFLAGS="$HOST_CFLAGS -m64"
  341. fi
  342. CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64"
  343. HOST_CPPFLAGS="$HOST_CPPFLAGS -D_FILE_OFFSET_BITS=64"
  344. AC_C_BIGENDIAN
  345. AC_CHECK_SIZEOF(void *)
  346. AC_CHECK_SIZEOF(long)
  347. case "$host_os" in
  348. cygwin | windows* | mingw32*)
  349. HOST_CPPFLAGS="$HOST_CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500"
  350. CPPFLAGS="$CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500"
  351. AC_CHECK_SIZEOF(TCHAR,,[#include <windows.h>])
  352. ;;
  353. esac
  354. case "$host_os" in
  355. cygwin | windows* | mingw32* | aros*)
  356. ;;
  357. *)
  358. AC_CHECK_SIZEOF(off_t)
  359. if test x"$ac_cv_sizeof_off_t" != x8 ; then
  360. AC_CHECK_SIZEOF(off64_t)
  361. test x"$ac_cv_sizeof_off64_t" = x8 || AC_MSG_ERROR([Large file support is required])
  362. fi;;
  363. esac
  364. if test x$USE_NLS = xno; then
  365. HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
  366. fi
  367. if test "x$cross_compiling" = xyes; then
  368. AC_MSG_WARN([cannot generate manual pages while cross compiling])
  369. else
  370. AC_PATH_PROG(HELP2MAN, help2man)
  371. fi
  372. # Check for functions and headers.
  373. AC_CHECK_FUNCS(posix_memalign memalign getextmntent atexit)
  374. AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h limits.h)
  375. # glibc 2.25 still includes sys/sysmacros.h in sys/types.h but emits deprecation
  376. # warning which causes compilation failure later with -Werror. So use -Werror here
  377. # as well to force proper sys/sysmacros.h detection. Used in include/grub/osdep/major.h.
  378. SAVED_CFLAGS="$CFLAGS"
  379. CFLAGS="$HOST_CFLAGS -Werror"
  380. AC_HEADER_MAJOR
  381. CFLAGS="$SAVED_CFLAGS"
  382. AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
  383. #include <sys/param.h>
  384. #include <sys/mount.h>])
  385. AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default
  386. #include <sys/param.h>
  387. #include <sys/mount.h>])
  388. # For opendisk() and getrawpartition() on NetBSD.
  389. # Used in util/deviceiter.c and in util/hostdisk.c.
  390. AC_CHECK_HEADER([util.h], [
  391. AC_CHECK_LIB([util], [opendisk], [
  392. LIBUTIL="-lutil"
  393. AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
  394. ])
  395. AC_CHECK_LIB([util], [getrawpartition], [
  396. LIBUTIL="-lutil"
  397. AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
  398. ])
  399. ])
  400. AC_SUBST([LIBUTIL])
  401. AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [
  402. SAVED_CFLAGS="$CFLAGS"
  403. CFLAGS="$HOST_CFLAGS -Wtrampolines -Werror"
  404. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
  405. int va_arg_func (int fixed, va_list args);]], [[]])],
  406. [grub_cv_host_cc_wtrampolines=yes],
  407. [grub_cv_host_cc_wtrampolines=no])
  408. CFLAGS="$SAVED_CFLAGS"
  409. ])
  410. if test x"$grub_host_cv_cc_wtrampolines" = xyes ; then
  411. HOST_CFLAGS="$HOST_CFLAGS -Wtrampolines"
  412. fi
  413. #
  414. # Check for host and build compilers.
  415. #
  416. HOST_CC=$CC
  417. AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc])
  418. test -z "$BUILD_CC" && AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])
  419. BUILD_CPP="$BUILD_CC -E"
  420. case "$build_os" in
  421. haiku*) BUILD_LIBM= ;;
  422. *) BUILD_LIBM=-lm ;;
  423. esac
  424. dnl FIXME proper test seems to require too deep dive into Autoconf internals.
  425. dnl For now just list known platforms that we support.
  426. case "$build_os" in
  427. cygwin*|mingw32*|mingw64*) BUILD_EXEEXT=.exe ;;
  428. *) BUILD_EXEEXT= ;;
  429. esac
  430. AC_SUBST(BUILD_EXEEXT)
  431. # In some build environments like termux /bin/sh is not a valid
  432. # shebang. Use $SHELL instead if it's executable and /bin/sh isn't
  433. BUILD_SHEBANG=/bin/sh
  434. for she in /bin/sh "$SHELL"; do
  435. if test -x "$she" ; then
  436. BUILD_SHEBANG="$she"
  437. fi
  438. done
  439. AC_SUBST(BUILD_SHEBANG)
  440. # For gnulib.
  441. gl_INIT
  442. WARN_FLAGS="-Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes"
  443. EXTRA_WARN_FLAGS="-Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2"
  444. HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align"
  445. AC_CACHE_CHECK([which extra warnings work], [grub_cv_cc_w_extra_flags], [
  446. SAVED_CFLAGS="$CFLAGS"
  447. grub_cv_cc_w_extra_flags=
  448. for x in $EXTRA_WARN_FLAGS; do
  449. CFLAGS="$HOST_CFLAGS $x -Werror"
  450. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0])
  451. if test x$flag = x1 ; then
  452. grub_cv_cc_w_extra_flags="$grub_cv_cc_w_extra_flags $x"
  453. fi
  454. done
  455. CFLAGS="$SAVED_CFLAGS"
  456. ])
  457. HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags"
  458. #
  459. # Check for target programs.
  460. #
  461. # Find tools for the target.
  462. if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
  463. tmp_ac_tool_prefix="$ac_tool_prefix"
  464. ac_tool_prefix=$target_alias-
  465. AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
  466. [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
  467. AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
  468. AC_CHECK_TOOL(TARGET_STRIP, strip)
  469. AC_CHECK_TOOL(TARGET_NM, nm)
  470. AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
  471. ac_tool_prefix="$tmp_ac_tool_prefix"
  472. else
  473. if test "x$TARGET_CC" = x; then
  474. TARGET_CC=$CC
  475. fi
  476. AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
  477. AC_CHECK_TOOL(TARGET_STRIP, strip)
  478. AC_CHECK_TOOL(TARGET_NM, nm)
  479. AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
  480. fi
  481. AC_SUBST(HOST_CC)
  482. AC_SUBST(BUILD_CC)
  483. AC_SUBST(BUILD_CFLAGS)
  484. AC_SUBST(BUILD_CPPFLAGS)
  485. AC_SUBST(BUILD_LDFLAGS)
  486. AC_SUBST(TARGET_CC)
  487. AC_SUBST(TARGET_NM)
  488. AC_SUBST(TARGET_RANLIB)
  489. AC_SUBST(TARGET_STRIP)
  490. AC_SUBST(TARGET_OBJCOPY)
  491. # Test the C compiler for the target environment.
  492. tmp_CC="$CC"
  493. tmp_CFLAGS="$CFLAGS"
  494. tmp_LDFLAGS="$LDFLAGS"
  495. tmp_CPPFLAGS="$CPPFLAGS"
  496. tmp_LIBS="$LIBS"
  497. CC="$TARGET_CC"
  498. CFLAGS="$TARGET_CFLAGS"
  499. CPPFLAGS="$TARGET_CPPFLAGS"
  500. LDFLAGS="$TARGET_LDFLAGS"
  501. LIBS=""
  502. if test "x$target_m32" = x1; then
  503. # Force 32-bit mode.
  504. TARGET_CFLAGS="$TARGET_CFLAGS -m32"
  505. TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
  506. TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
  507. TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
  508. TARGET_MODULE_FORMAT="elf32"
  509. fi
  510. if test "x$target_m64" = x1; then
  511. # Force 64-bit mode.
  512. TARGET_CFLAGS="$TARGET_CFLAGS -m64"
  513. TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
  514. TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
  515. TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
  516. TARGET_MODULE_FORMAT="elf64"
  517. fi
  518. # debug flags.
  519. TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
  520. TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
  521. if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then
  522. TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align"
  523. fi
  524. TARGET_CC_VERSION="$(LC_ALL=C $TARGET_CC --version | head -n1)"
  525. AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], [
  526. LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
  527. grub_cv_target_cc_w_extra_flags=
  528. for x in $EXTRA_WARN_FLAGS; do
  529. CFLAGS="$TARGET_CFLAGS $x -Werror"
  530. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  531. asm (".globl start; start:");
  532. void __main (void);
  533. void __main (void) {}
  534. int main (void);
  535. ]], [[]])], [flag=1], [flag=0])
  536. if test x$flag = x1 ; then
  537. grub_cv_target_cc_w_extra_flags="$grub_cv_target_cc_w_extra_flags $x"
  538. fi
  539. done
  540. ])
  541. TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_w_extra_flags"
  542. AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang],
  543. [
  544. CFLAGS="$TARGET_CFLAGS"
  545. AC_COMPILE_IFELSE(
  546. [AC_LANG_PROGRAM([], [[
  547. #ifdef __clang__
  548. #error "is clang"
  549. #endif
  550. ]])],
  551. [grub_cv_cc_target_clang=no], [grub_cv_cc_target_clang=yes])])
  552. if test x$target_cpu = xpowerpc -o x$target_cpu = xmips; then
  553. AC_CACHE_CHECK([for options to get big-endian compilation], grub_cv_target_cc_big_endian, [
  554. grub_cv_target_cc_big_endian=no
  555. for cand in "-target $target_cpu -Wl,-EB" "-target $target_cpu" \
  556. "-target $target_cpu-linux-gnu -Wl,-EB" "-target $target_cpu-linux-gnu" \
  557. "-EB" "-mbig-endian"; do
  558. if test x"$grub_cv_target_cc_big_endian" != xno ; then
  559. break
  560. fi
  561. CFLAGS="$TARGET_CFLAGS $cand -Werror"
  562. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  563. #if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__ORDER_BIG_ENDIAN__ != __BYTE_ORDER__)
  564. #error still little endian
  565. #endif
  566. asm (".globl start; start:");
  567. asm (".globl _start; _start:");
  568. asm (".globl __start; __start:");
  569. void __main (void);
  570. void __main (void) {}
  571. int main (void);
  572. ]], [[]])],
  573. [grub_cv_target_cc_big_endian="$cand"], [])
  574. done
  575. ])
  576. if test x"$grub_cv_target_cc_big_endian" = xno ; then
  577. AC_MSG_ERROR([could not force big-endian])
  578. fi
  579. skip_linkflags="$(echo "$grub_cv_target_cc_big_endian"|sed 's@-Wl,-EB@@')"
  580. TARGET_CFLAGS="$TARGET_CFLAGS $skip_linkflags"
  581. TARGET_CPPFLAGS="$TARGET_CPPFLAGS $skip_linkflags"
  582. TARGET_CCASFLAGS="$TARGET_CCASFLAGS $skip_linkflags"
  583. TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_big_endian"
  584. elif test x$target_cpu = xmipsel; then
  585. AC_CACHE_CHECK([for options to get little-endian compilation], grub_cv_target_cc_little_endian, [
  586. grub_cv_target_cc_little_endian=no
  587. for cand in "-target $target_cpu -Wl,-EL" "-target $target_cpu" \
  588. "-target $target_cpu-linux-gnu -Wl,-EL" "-target $target_cpu-linux-gnu" \
  589. "-EL"; do
  590. if test x"$grub_cv_target_cc_little_endian" != xno ; then
  591. break
  592. fi
  593. CFLAGS="$TARGET_CFLAGS $cand -Werror"
  594. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  595. #if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__ORDER_BIG_ENDIAN__ == __BYTE_ORDER__)
  596. #error still big endian
  597. #endif
  598. asm (".globl start; start:");
  599. asm (".globl _start; _start:");
  600. asm (".globl __start; __start:");
  601. void __main (void);
  602. void __main (void) {}
  603. int main (void);
  604. ]], [[]])],
  605. [grub_cv_target_cc_little_endian="$cand"], [])
  606. done
  607. ])
  608. if test x"$grub_cv_target_cc_little_endian" = xno ; then
  609. AC_MSG_ERROR([could not force little-endian])
  610. fi
  611. skip_linkflags="$(echo "$grub_cv_target_cc_little_endian"|sed 's@-Wl,-EL@@')"
  612. TARGET_CFLAGS="$TARGET_CFLAGS $skip_linkflags"
  613. TARGET_CPPFLAGS="$TARGET_CPPFLAGS $skip_linkflags"
  614. TARGET_CCASFLAGS="$TARGET_CCASFLAGS $skip_linkflags"
  615. TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_little_endian"
  616. fi
  617. # GRUB code is N32-compliant but it's experimental and we would prefer to
  618. # avoid having too much variety when it doesn't result in any real improvement.
  619. # Moreover N64 isn't supported.
  620. if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then
  621. AC_CACHE_CHECK([for options to force MIPS o32 ABI], grub_cv_target_cc_mips_o32_abi, [
  622. grub_cv_target_cc_mips_o32_abi=no
  623. for arg in "" "-mabi=32" "-target $target_cpu -mabi=32" ; do
  624. if test x"$grub_cv_target_cc_mips_o32_abi" != xno ; then
  625. break
  626. fi
  627. CFLAGS="$TARGET_CFLAGS $arg -Werror"
  628. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  629. #if !defined(_ABIO32) || !defined(_MIPS_SIM) || (_MIPS_SIM != _ABIO32)
  630. #error not o32 ABI
  631. #endif
  632. asm (".globl start; start:");
  633. asm (".globl _start; _start:");
  634. asm (".globl __start; __start:");
  635. void __main (void);
  636. void __main (void) {}
  637. int main (void);
  638. ]], [[]])],
  639. [grub_cv_target_cc_mips_o32_abi="$arg"], [])
  640. done
  641. ])
  642. if test x"$grub_cv_target_cc_mips_o32_abi" = xno ; then
  643. AC_MSG_ERROR([could not force MIPS o32 ABI])
  644. fi
  645. TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_mips_o32_abi"
  646. TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_mips_o32_abi"
  647. fi
  648. AC_CACHE_CHECK([for options to compile assembly], [grub_cv_cc_target_asm_compile], [
  649. test_program=
  650. case "x$target_cpu-$platform" in
  651. xmips-* | xmipsel-*)
  652. test_program=mips
  653. ;;
  654. xi386-pc)
  655. test_program=i386-pc
  656. ;;
  657. xi386-* | xx86_64-*)
  658. test_program=i386
  659. ;;
  660. xpowerpc-* | xsparc64-* | xarm-*)
  661. test_program=$target_cpu
  662. ;;
  663. esac
  664. if test x"$test_program" = x ; then
  665. grub_cv_cc_target_asm_compile=
  666. else
  667. found=no
  668. for arg in "" "-no-integrated-as"; do
  669. cmdline="$TARGET_CC -c -o /dev/null $TARGET_CCASFLAGS $arg $TARGET_CPPFLAGS $srcdir/asm-tests/$test_program.S"
  670. echo "Running $cmdline" >&AS_MESSAGE_LOG_FD
  671. if $cmdline >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
  672. grub_cv_cc_target_asm_compile="$arg"
  673. found=yes
  674. break
  675. fi
  676. done
  677. if test x"$found" = xno ; then
  678. AC_MSG_ERROR([could not compile assembly])
  679. fi
  680. fi
  681. ])
  682. TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_cc_target_asm_compile"
  683. if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
  684. TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
  685. fi
  686. if test "x$grub_cv_cc_target_clang" = xno && test "x$target_cpu" = xi386 && test "x$platform" != xemu && test "x$platform" != xefi; then
  687. TARGET_CFLAGS="$TARGET_CFLAGS -mrtd -mregparm=3"
  688. fi
  689. # on mips redirect cache flushing function to non-existant one.
  690. if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then
  691. AC_CACHE_CHECK([whether -mflush-func=grub_red_herring works], [grub_cv_cc_mflush_func], [
  692. CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring -Werror"
  693. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  694. [grub_cv_cc_mflush_func=yes],
  695. [grub_cv_cc_mflush_func=no])
  696. ])
  697. if test "x$grub_cv_cc_mflush_func" = xyes; then
  698. TARGET_CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring"
  699. fi
  700. fi
  701. # Force no alignment to save space on i386.
  702. if test "x$target_cpu" = xi386; then
  703. TARGET_CFLAGS="$TARGET_CFLAGS -falign-functions=1"
  704. AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
  705. CFLAGS="$TARGET_CFLAGS -falign-loops=1 -Werror"
  706. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  707. [grub_cv_cc_falign_loop=yes],
  708. [grub_cv_cc_falign_loop=no])
  709. ])
  710. if test "x$grub_cv_cc_falign_loop" = xyes; then
  711. TARGET_CFLAGS="$TARGET_CFLAGS -falign-loops=1"
  712. fi
  713. AC_CACHE_CHECK([whether -falign-jumps works], [grub_cv_cc_falign_jumps], [
  714. CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -Werror"
  715. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  716. [grub_cv_cc_falign_jumps=yes],
  717. [grub_cv_cc_falign_jumps=no])
  718. ])
  719. if test "x$grub_cv_cc_falign_jumps" = xyes; then
  720. TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1"
  721. fi
  722. fi
  723. AC_CACHE_CHECK([whether -freg-struct-return works], [grub_cv_cc_freg_struct_return], [
  724. CFLAGS="$TARGET_CFLAGS -freg-struct-return -Werror"
  725. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  726. [grub_cv_cc_freg_struct_return=yes],
  727. [grub_cv_cc_freg_struct_return=no])
  728. ])
  729. if test "x$grub_cv_cc_freg_struct_return" = xyes; then
  730. TARGET_CFLAGS="$TARGET_CFLAGS -freg-struct-return"
  731. fi
  732. if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
  733. # Some toolchains enable these features by default, but they need
  734. # registers that aren't set up properly in GRUB.
  735. TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow"
  736. fi
  737. if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ); then
  738. AC_CACHE_CHECK([whether -Wa,-mx86-used-note works], [grub_cv_cc_mx86_used_note], [
  739. CFLAGS="$TARGET_CFLAGS -Wa,-mx86-used-note=no -Werror"
  740. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  741. [grub_cv_cc_mx86_used_note=yes],
  742. [grub_cv_cc_mx86_used_note=no])
  743. ])
  744. if test "x$grub_cv_cc_mx86_used_note" = xyes; then
  745. TARGET_CFLAGS="$TARGET_CFLAGS -Wa,-mx86-used-note=no"
  746. TARGET_CCASFLAGS="$TARGET_CCASFLAGS -Wa,-mx86-used-note=no"
  747. fi
  748. fi
  749. if test "x$target_cpu" = xloongarch64; then
  750. AC_CACHE_CHECK([whether _mno_explicit_relocs works], [grub_cv_cc_mno_explicit_relocs], [
  751. CFLAGS="$TARGET_CFLAGS -mno-explicit-relocs -Werror"
  752. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  753. [grub_cv_cc_mno_explicit_relocs=yes],
  754. [grub_cv_cc_mno_explicit_relocs=no])
  755. ])
  756. if test "x$grub_cv_cc_mno_explicit_relocs" = xyes; then
  757. TARGET_CFLAGS="$TARGET_CFLAGS -mno-explicit-relocs -fno-plt"
  758. TARGET_CCASFLAGS="$TARGET_CCASFLAGS -mno-explicit-relocs -fno-plt"
  759. fi
  760. AC_CACHE_CHECK([for no-relax options], grub_cv_target_cc_mno_relax, [
  761. grub_cv_target_cc_mno_relax=no
  762. for cand in "-mno-relax" "-Wa,-mno-relax"; do
  763. if test x"$grub_cv_target_cc_mno_relax" != xno ; then
  764. break
  765. fi
  766. CFLAGS="$TARGET_CFLAGS $cand -Werror"
  767. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  768. asm (".globl start; start:");
  769. void __main (void);
  770. void __main (void) {}
  771. int main (void);
  772. ]], [[]])], [grub_cv_target_cc_mno_relax="$cand"], [])
  773. done
  774. ])
  775. CFLAGS="$TARGET_CFLAGS"
  776. if test x"$grub_cv_target_cc_mno_relax" != xno ; then
  777. TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_mno_relax"
  778. TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_mno_relax"
  779. fi
  780. TARGET_CFLAGS="$TARGET_CFLAGS -Wa,-mla-global-with-abs"
  781. TARGET_CCASFLAGS="$TARGET_CCASFLAGS -Wa,-mla-global-with-abs"
  782. fi
  783. # GRUB doesn't use float or doubles at all. Yet some toolchains may decide
  784. # that floats are a good fit to run instead of what's written in the code.
  785. # Given that floating point unit is disabled (if present to begin with)
  786. # when GRUB is running which may result in various hard crashes.
  787. if test x"$platform" != xemu ; then
  788. AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [
  789. grub_cv_target_cc_soft_float=no
  790. if test "x$target_cpu" = xarm64; then
  791. CFLAGS="$TARGET_CFLAGS -mgeneral-regs-only -Werror"
  792. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  793. [grub_cv_target_cc_soft_float="-mgeneral-regs-only"], [])
  794. fi
  795. if test "x$target_cpu" = xriscv32; then
  796. CFLAGS="$TARGET_CFLAGS -march=rv32imac -mabi=ilp32 -Werror"
  797. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  798. [grub_cv_target_cc_soft_float="-march=rv32imac -mabi=ilp32"], [])
  799. # ISA spec version 20191213 factored out extensions Zicsr and Zifencei
  800. CFLAGS="$TARGET_CFLAGS -march=rv32imac_zicsr_zifencei -mabi=ilp32 -Werror"
  801. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  802. [grub_cv_target_cc_soft_float="-march=rv32imac_zicsr_zifencei -mabi=ilp32"], [])
  803. fi
  804. if test "x$target_cpu" = xriscv64; then
  805. CFLAGS="$TARGET_CFLAGS -march=rv64imac -mabi=lp64 -Werror"
  806. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  807. [grub_cv_target_cc_soft_float="-march=rv64imac -mabi=lp64"], [])
  808. # ISA spec version 20191213 factored out extensions Zicsr and Zifencei
  809. CFLAGS="$TARGET_CFLAGS -march=rv64imac_zicsr_zifencei -mabi=lp64 -Werror"
  810. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  811. [grub_cv_target_cc_soft_float="-march=rv64imac_zicsr_zifencei -mabi=lp64"], [])
  812. fi
  813. if test "x$target_cpu" = xia64; then
  814. CFLAGS="$TARGET_CFLAGS -mno-inline-float-divide -mno-inline-sqrt -Werror"
  815. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  816. [grub_cv_target_cc_soft_float="-mno-inline-float-divide -mno-inline-sqrt"], [])
  817. fi
  818. if test "x$target_cpu" = xsh4; then
  819. CFLAGS="$TARGET_CFLAGS -m4-nofpu -Werror"
  820. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  821. [grub_cv_target_cc_soft_float="-m4-nofpu"], [])
  822. fi
  823. for cand in "-msoft-float -Xclang -msoft-float -Xclang -no-implicit-float" \
  824. "-Xclang -msoft-float -Xclang -no-implicit-float" \
  825. "-Xclang -msoft-float" "-msoft-float"; do
  826. if test x"$grub_cv_target_cc_soft_float" != xno ; then
  827. break
  828. fi
  829. CFLAGS="$TARGET_CFLAGS $cand -Werror"
  830. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  831. [grub_cv_target_cc_soft_float="$cand"], [])
  832. done
  833. ])
  834. if test x"$grub_cv_target_cc_soft_float" = xno ; then
  835. AC_MSG_ERROR([could not force soft-float])
  836. fi
  837. case x"$grub_cv_target_cc_soft_float" in
  838. x*"-Xclang"*)
  839. # A trick so that clang doesn't see it on link stаge
  840. TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_soft_float"
  841. ;;
  842. *)
  843. TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_soft_float"
  844. ;;
  845. esac
  846. TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_soft_float"
  847. fi
  848. if test x"$target_cpu" = xsparc64 ; then
  849. AC_CACHE_CHECK([for options to reserve application registers], grub_cv_target_cc_mno_app_regs, [
  850. grub_cv_target_cc_mno_app_regs=no
  851. for cand in "-mllvm -sparc-reserve-app-registers" \
  852. "-mno-app-regs"; do
  853. if test x"$grub_cv_target_cc_mno_app_regs" != xno ; then
  854. break
  855. fi
  856. CFLAGS="$TARGET_CFLAGS $cand -Werror"
  857. CPPFLAGS="$TARGET_CPPFLAGS"
  858. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  859. [grub_cv_target_cc_mno_app_regs="$cand"], [])
  860. done
  861. ])
  862. if test x"$grub_cv_target_cc_mno_app_regs" = xno ; then
  863. AC_MSG_ERROR([could not reserve application registers])
  864. fi
  865. if test x"$grub_cv_target_cc_mno_app_regs" = x"-mllvm -sparc-reserve-app-registers" ; then
  866. # A trick so that clang doesn't see it on link stаge
  867. TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_mno_app_regs"
  868. else
  869. TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_mno_app_regs"
  870. fi
  871. AC_CACHE_CHECK([for no-relax options], grub_cv_target_cc_mno_relax, [
  872. grub_cv_target_cc_mno_relax=no
  873. for cand in "-mno-relax" "-Wl,--no-relax"; do
  874. if test x"$grub_cv_target_cc_mno_relax" != xno ; then
  875. break
  876. fi
  877. LDFLAGS="$TARGET_LDFLAGS $cand -nostdlib -static"
  878. CFLAGS="$TARGET_CFLAGS -Werror"
  879. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  880. asm (".globl start; start:");
  881. void __main (void);
  882. void __main (void) {}
  883. int main (void);
  884. ]], [[]])], [grub_cv_target_cc_mno_relax="$cand"], [])
  885. done
  886. ])
  887. LDFLAGS="$TARGET_LDFLAGS"
  888. CFLAGS="$TARGET_CFLAGS"
  889. if test x"$grub_cv_target_cc_mno_relax" = xno ; then
  890. AC_MSG_ERROR([could not find no-relax options])
  891. fi
  892. TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_mno_relax"
  893. fi
  894. # By default, GCC 4.4 generates .eh_frame sections containing unwind
  895. # information in some cases where it previously did not. GRUB doesn't need
  896. # these and they just use up vital space. Restore the old compiler
  897. # behaviour.
  898. AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
  899. CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
  900. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  901. [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
  902. [grub_cv_cc_fno_dwarf2_cfi_asm=no])
  903. ])
  904. if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
  905. TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
  906. fi
  907. if test x"$target_os" = xcygwin; then
  908. AC_CACHE_CHECK([whether option -fno-reorder-functions works], grub_cv_cc_no_reorder_functions, [
  909. CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
  910. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  911. [grub_cv_cc_no_reorder_functions=yes],
  912. [grub_cv_cc_no_reorder_functions=no])
  913. ])
  914. fi
  915. if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xyes; then
  916. TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
  917. fi
  918. AC_CACHE_CHECK([whether -mno-stack-arg-probe works], [grub_cv_cc_mno_stack_arg_probe], [
  919. CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
  920. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  921. [grub_cv_cc_mno_stack_arg_probe=yes],
  922. [grub_cv_cc_mno_stack_arg_probe=no])
  923. ])
  924. if test "x$grub_cv_cc_mno_stack_arg_probe" = xyes; then
  925. TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
  926. fi
  927. # By default, GCC 4.6 generates .eh_frame sections containing unwind
  928. # information in some cases where it previously did not. GRUB doesn't need
  929. # these and they just use up vital space. Restore the old compiler
  930. # behaviour.
  931. AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
  932. CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
  933. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  934. [grub_cv_cc_fno_asynchronous_unwind_tables=yes],
  935. [grub_cv_cc_fno_asynchronous_unwind_tables=no])
  936. ])
  937. if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
  938. TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
  939. fi
  940. AC_CACHE_CHECK([whether -fno-unwind-tables works], [grub_cv_cc_fno_unwind_tables], [
  941. CFLAGS="$TARGET_CFLAGS -fno-unwind-tables"
  942. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  943. [grub_cv_cc_fno_unwind_tables=yes],
  944. [grub_cv_cc_fno_unwind_tables=no])
  945. ])
  946. if test "x$grub_cv_cc_fno_unwind_tables" = xyes; then
  947. TARGET_CFLAGS="$TARGET_CFLAGS -fno-unwind-tables"
  948. fi
  949. # Do not generate .ident sections.
  950. AC_CACHE_CHECK([whether -fno-ident works], [grub_cv_cc_fno_ident], [
  951. CFLAGS="$TARGET_CFLAGS -fno-ident"
  952. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  953. [grub_cv_cc_fno_ident=yes],
  954. [grub_cv_cc_fno_ident=no])
  955. ])
  956. if test "x$grub_cv_cc_fno_ident" = xyes; then
  957. TARGET_CFLAGS="$TARGET_CFLAGS -fno-ident"
  958. fi
  959. CFLAGS="$TARGET_CFLAGS"
  960. if test x"$platform" = xemu ; then
  961. TARGET_OBJ2ELF=
  962. grub_cv_target_cc_link_format=
  963. case "$host_os" in
  964. *darwin* | *mac*)
  965. grub_cv_target_cc_link_format="-arch,${target_cpu}"
  966. TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
  967. ;;
  968. *windows* | *cygwin* | *mingw*)
  969. if test x${target_cpu} = xi386 ; then
  970. grub_cv_target_cc_link_format=-mi386pe
  971. TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)'
  972. fi
  973. if test x${target_cpu} = xx86_64 ; then
  974. grub_cv_target_cc_link_format=-mi386pep
  975. TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)'
  976. fi
  977. TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
  978. ;;
  979. esac
  980. elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
  981. AC_CACHE_CHECK([for target linking format], [grub_cv_target_cc_link_format], [
  982. grub_cv_target_cc_link_format=unknown
  983. for format in -melf_${target_cpu} -melf_${target_cpu}_fbsd -melf_${target_cpu}_obsd -melf_${target_cpu}_haiku -mi386pe -mi386pep -arch,${target_cpu}; do
  984. if test x${target_cpu} != xi386 && test x$format = x-mi386pe; then
  985. continue
  986. fi
  987. if test x${target_cpu} != xx86_64 && test x$format = x-mi386pep; then
  988. continue
  989. fi
  990. CFLAGS="$TARGET_CFLAGS"
  991. LDFLAGS="$TARGET_LDFLAGS -Wl,$format -nostdlib -static"
  992. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  993. asm (".globl start; start:");
  994. asm (".globl _start; _start:");
  995. asm (".globl __start; __start:");
  996. void __main (void);
  997. void __main (void) {}
  998. ]], [[]])], [flag=1], [flag=0])
  999. if test x"$flag" = x1; then
  1000. grub_cv_target_cc_link_format="$format"
  1001. break
  1002. fi
  1003. done])
  1004. if test x"$grub_cv_target_cc_link_format" = xunknown; then
  1005. AC_MSG_ERROR([no suitable link format found])
  1006. fi
  1007. TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
  1008. if test x"$grub_cv_target_cc_link_format" = x-mi386pe ; then
  1009. TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)'
  1010. fi
  1011. if test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
  1012. TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)'
  1013. fi
  1014. fi
  1015. if test x$grub_cv_target_cc_link_format = x-arch,i386 || test x$grub_cv_target_cc_link_format = x-arch,x86_64; then
  1016. TARGET_APPLE_LINKER=1
  1017. AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [objconv], [])
  1018. if test "x$TARGET_OBJCONV" = x ; then
  1019. AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [./objconv], [], [.])
  1020. fi
  1021. if test "x$TARGET_OBJCONV" = x ; then
  1022. AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
  1023. fi
  1024. TARGET_IMG_LDSCRIPT=
  1025. TARGET_IMG_CFLAGS="-static"
  1026. TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
  1027. TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
  1028. TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
  1029. TARGET_LDFLAGS_OLDMAGIC=""
  1030. elif test x$grub_cv_target_cc_link_format = x-mi386pe || test x$grub_cv_target_cc_link_format = x-mi386pep ; then
  1031. TARGET_APPLE_LINKER=0
  1032. TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
  1033. TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/i386-cygwin-img-ld.sc"
  1034. TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
  1035. TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/i386-cygwin-img-ld.sc"
  1036. TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
  1037. TARGET_IMG_CFLAGS=
  1038. else
  1039. TARGET_APPLE_LINKER=0
  1040. TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
  1041. TARGET_IMG_LDSCRIPT=
  1042. TARGET_IMG_LDFLAGS='-Wl,-N'
  1043. TARGET_IMG_LDFLAGS_AC='-Wl,-N'
  1044. TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
  1045. TARGET_IMG_CFLAGS=
  1046. fi
  1047. CFLAGS="$TARGET_CFLAGS"
  1048. AC_ARG_ENABLE([efiemu],
  1049. [AS_HELP_STRING([--enable-efiemu],
  1050. [build and install the efiemu runtimes (default=guessed)])])
  1051. if test x"$enable_efiemu" = xno ; then
  1052. efiemu_excuse="explicitly disabled"
  1053. fi
  1054. if test x"$grub_cv_target_cc_link_format" = x-mi386pe || test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
  1055. efiemu_excuse="not available on cygwin"
  1056. fi
  1057. if test x"$target_cpu" != xi386 ; then
  1058. efiemu_excuse="only available on i386"
  1059. fi
  1060. if test x"$platform" = xefi ; then
  1061. efiemu_excuse="not available on efi"
  1062. fi
  1063. if test x"$efiemu_excuse" = x ; then
  1064. AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
  1065. CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
  1066. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  1067. [grub_cv_cc_efiemu=yes],
  1068. [grub_cv_cc_efiemu=no])
  1069. ])
  1070. if test x$grub_cv_cc_efiemu = xno; then
  1071. efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
  1072. fi
  1073. fi
  1074. if test x"$efiemu_excuse" = x ; then
  1075. AC_CACHE_CHECK([for efiemu64 linking format], [grub_cv_target_cc_efiemu64_link_format], [
  1076. grub_cv_target_cc_efiemu64_link_format=unknown
  1077. for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -melf_x86_64_haiku -arch,x86_64; do
  1078. CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
  1079. LDFLAGS="-m64 -Wl,$format -nostdlib -static"
  1080. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  1081. asm (".globl start; start:");
  1082. asm (".globl _start; _start:");
  1083. asm (".globl __start; __start:");
  1084. void __main (void);
  1085. void __main (void) {}
  1086. ]], [[]])], [flag=1], [flag=0])
  1087. if test x"$flag" = x1; then
  1088. grub_cv_target_cc_efiemu64_link_format="$format"
  1089. break
  1090. fi
  1091. done])
  1092. if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then
  1093. efiemu_excuse="no suitable link format for efiemu64 found"
  1094. else
  1095. EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format"
  1096. fi
  1097. fi
  1098. if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
  1099. AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled ($efiemu_excuse)])
  1100. fi
  1101. if test x"$efiemu_excuse" = x ; then
  1102. enable_efiemu=yes
  1103. else
  1104. enable_efiemu=no
  1105. fi
  1106. AC_SUBST([enable_efiemu])
  1107. AC_SUBST([EFIEMU64_LINK_FORMAT])
  1108. CFLAGS="$TARGET_CFLAGS"
  1109. AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
  1110. LDFLAGS="$TARGET_LDFLAGS"
  1111. if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 || test "$target_cpu" = riscv64 \
  1112. || test "$target_cpu" = loongarch64 ; then
  1113. # Use large model to support 4G memory
  1114. AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
  1115. CFLAGS="$TARGET_CFLAGS -mcmodel=large"
  1116. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  1117. [grub_cv_cc_mcmodel=yes],
  1118. [grub_cv_cc_mcmodel=no])
  1119. ])
  1120. if test "x$grub_cv_cc_mcmodel" = xyes; then
  1121. TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
  1122. elif test "$target_cpu" = sparc64 || test "$target_cpu" = riscv64; then
  1123. TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany"
  1124. fi
  1125. fi
  1126. if test "$target_cpu"-"$platform" = x86_64-efi; then
  1127. # EFI writes to stack below %rsp, we must not use the red zone
  1128. AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
  1129. CFLAGS="$TARGET_CFLAGS -mno-red-zone"
  1130. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  1131. [grub_cv_cc_no_red_zone=yes],
  1132. [grub_cv_cc_no_red_zone=no])
  1133. ])
  1134. if test "x$grub_cv_cc_no_red_zone" = xno; then
  1135. AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
  1136. fi
  1137. TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
  1138. fi
  1139. if test "x$target_cpu" = xarm; then
  1140. AC_CACHE_CHECK([for options to disable movt and movw], grub_cv_target_cc_mno_movt, [
  1141. grub_cv_target_cc_mno_movt=no
  1142. for cand in "-mno-movt" \
  1143. "-mllvm -arm-use-movt=0" \
  1144. "-mword-relocations"; do
  1145. if test x"$grub_cv_target_cc_mno_movt" != xno ; then
  1146. break
  1147. fi
  1148. CFLAGS="$TARGET_CFLAGS $cand -Werror"
  1149. CPPFLAGS="$TARGET_CPPFLAGS"
  1150. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  1151. [grub_cv_target_cc_mno_movt="$cand"], [])
  1152. done
  1153. ])
  1154. if test x"$grub_cv_target_cc_mno_movt" != xno ; then
  1155. # A trick so that clang doesn't see it on link stage
  1156. TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_mno_movt"
  1157. fi
  1158. AC_CACHE_CHECK([whether option -mthumb-interwork works], grub_cv_cc_mthumb_interwork, [
  1159. CFLAGS="$TARGET_CFLAGS -mthumb-interwork -Werror"
  1160. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  1161. [grub_cv_cc_mthumb_interwork=yes],
  1162. [grub_cv_cc_mthumb_interwork=no])
  1163. ])
  1164. if test "x$grub_cv_cc_mthumb_interwork" = xyes; then
  1165. TARGET_CFLAGS="$TARGET_CFLAGS -mthumb-interwork"
  1166. # Clang defaults to thumb interworking
  1167. elif test "x$grub_cv_cc_target_clang" = xno ; then
  1168. AC_MSG_ERROR([your compiler doesn't support -mthumb-interwork])
  1169. fi
  1170. fi
  1171. AC_CACHE_CHECK([whether option -Qn works], grub_cv_target_cc_qn, [
  1172. CFLAGS="$TARGET_CFLAGS -Qn -Qunused-arguments -Werror"
  1173. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  1174. [grub_cv_target_cc_qn=yes],
  1175. [grub_cv_target_cc_qn=no])])
  1176. if test "x$grub_cv_target_cc_qn" = xyes; then
  1177. TARGET_CFLAGS="$TARGET_CFLAGS -Qn -Qunused-arguments"
  1178. fi
  1179. #
  1180. # Compiler features.
  1181. #
  1182. CFLAGS="$TARGET_CFLAGS"
  1183. # Position independent executable.
  1184. grub_CHECK_PIE
  1185. grub_CHECK_NO_PIE
  1186. grub_CHECK_NO_PIE_ONEWORD
  1187. grub_CHECK_LINK_PIE
  1188. [# Need that, because some distributions ship compilers that include
  1189. # `-fPIE' or '-fpie' and '-pie' in the default specs.
  1190. if [ x"$pie_possible" = xyes ]; then
  1191. TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE -fno-pie"
  1192. TARGET_CCASFLAGS="$TARGET_CCASFLAGS -fno-PIE -fno-pie"
  1193. fi
  1194. if [ x"$link_nopie_needed" = xyes ] || [ x"$pie_possible" = xyes ]; then
  1195. if [ x"$nopie_possible" = xyes ]; then
  1196. TARGET_LDFLAGS="$TARGET_LDFLAGS -no-pie"
  1197. fi
  1198. if [ x"$nopie_oneword_possible" = xyes ]; then
  1199. TARGET_LDFLAGS="$TARGET_LDFLAGS -nopie"
  1200. fi
  1201. fi]
  1202. CFLAGS="$TARGET_CFLAGS"
  1203. LDFLAGS="$TARGET_LDFLAGS"
  1204. # Position independent executable.
  1205. grub_CHECK_PIC
  1206. [# On most platforms we don't want PIC as it only makes relocations harder
  1207. # and code less efficient. On mips we want to have one got table per module
  1208. # and reload $gp in every function.
  1209. # GCC implements it using symbol __gnu_local_gp in non-PIC as well.
  1210. # However with clang we need PIC for this reloading to happen.
  1211. # With arm64 we need relocations that are in some way representable in
  1212. # PE as we need to support arm64-efi. Without -fPIC clang generates
  1213. # movk's which aren't representable.
  1214. # Since default varies across dictributions use either -fPIC or -fno-PIC
  1215. # explicitly.
  1216. if ( test x$target_cpu = xmips || test x$target_cpu = xmipsel || test x$target_cpu = xarm64 ) && test "x$grub_cv_cc_target_clang" = xyes ; then
  1217. TARGET_CFLAGS="$TARGET_CFLAGS -fPIC"
  1218. elif [ x"$pic_possible" = xyes ]; then
  1219. TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
  1220. fi]
  1221. CFLAGS="$TARGET_CFLAGS"
  1222. # Stack smashing protector.
  1223. grub_CHECK_STACK_PROTECTOR
  1224. AC_ARG_ENABLE([stack-protector],
  1225. AS_HELP_STRING([--enable-stack-protector],
  1226. [enable the stack protector]),
  1227. [],
  1228. [enable_stack_protector=no])
  1229. if test "x$enable_stack_protector" = xno; then
  1230. if test "x$ssp_possible" = xyes; then
  1231. # Need that, because some distributions ship compilers that include
  1232. # `-fstack-protector' in the default specs.
  1233. TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
  1234. fi
  1235. elif test "x$platform" != xefi; then
  1236. if test "$ERROR_PLATFORM_NOT_SUPPORT_SSP" = "yes"; then
  1237. AC_MSG_ERROR([--enable-stack-protector is only supported on EFI platforms])
  1238. else
  1239. AC_MSG_WARN([--enable-stack-protector is only supported on EFI platforms])
  1240. fi
  1241. enable_stack_protector=no
  1242. elif test "x$ssp_global_possible" != xyes; then
  1243. AC_MSG_ERROR([--enable-stack-protector is not supported (compiler doesn't support -mstack-protector-guard=global)])
  1244. else
  1245. TARGET_CFLAGS="$TARGET_CFLAGS -mstack-protector-guard=global"
  1246. if test "x$enable_stack_protector" = xyes; then
  1247. if test "x$ssp_possible" != xyes; then
  1248. AC_MSG_ERROR([--enable-stack-protector is not supported (compiler doesn't support -fstack-protector)])
  1249. fi
  1250. TARGET_CFLAGS="$TARGET_CFLAGS -fstack-protector"
  1251. elif test "x$enable_stack_protector" = xstrong; then
  1252. if test "x$ssp_strong_possible" != xyes; then
  1253. AC_MSG_ERROR([--enable-stack-protector=strong is not supported (compiler doesn't support -fstack-protector-strong)])
  1254. fi
  1255. TARGET_CFLAGS="$TARGET_CFLAGS -fstack-protector-strong"
  1256. else
  1257. # Note, -fstack-protector-all requires that the protector is disabled for
  1258. # functions that appear in the call stack when the canary is initialized.
  1259. AC_MSG_ERROR([invalid value $enable_stack_protector for --enable-stack-protector])
  1260. fi
  1261. TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DGRUB_STACK_PROTECTOR=1"
  1262. fi
  1263. CFLAGS="$TARGET_CFLAGS"
  1264. grub_CHECK_STACK_ARG_PROBE
  1265. # Cygwin's GCC uses alloca() to probe the stackframe on static
  1266. # stack allocations above some threshold.
  1267. if test x"$sap_possible" = xyes; then
  1268. TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
  1269. fi
  1270. CFLAGS="$TARGET_CFLAGS"
  1271. # -mno-unaligned-access -mstrict-align
  1272. if test "$target_cpu" = arm; then
  1273. AC_CACHE_CHECK([for compile options to get strict alignment], [grub_cv_target_cc_strict_align], [
  1274. grub_cv_target_cc_strict_align=
  1275. for arg in -mno-unaligned-access "-Xclang -mstrict-align" -mstrict-align; do
  1276. CFLAGS="$TARGET_CFLAGS $arg -Werror"
  1277. LDFLAGS="$TARGET_LDFLAGS"
  1278. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0])
  1279. if test x"$flag" = x1; then
  1280. grub_cv_target_cc_strict_align="$arg"
  1281. break
  1282. fi
  1283. done])
  1284. TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_strict_align"
  1285. if test x"$grub_cv_target_cc_strict_align" = x"-Xclang -mstrict-align"; then
  1286. TARGET_LDFLAGS="$TARGET_LDFLAGS -Qunused-arguments"
  1287. fi
  1288. AC_CACHE_CHECK([if compiler generates unaligned accesses], [grub_cv_cc_target_emits_unaligned],
  1289. [CFLAGS="$TARGET_CFLAGS"
  1290. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
  1291. #ifdef __ARM_FEATURE_UNALIGNED
  1292. #error "unaligned"
  1293. #endif
  1294. ]])],
  1295. [grub_cv_cc_target_emits_unaligned=no], [grub_cv_cc_target_emits_unaligned=yes])])
  1296. if test x$grub_cv_cc_target_emits_unaligned = xyes; then
  1297. AC_MSG_ERROR([compiler generates unaligned accesses])
  1298. fi
  1299. fi
  1300. # Set them to their new values for the tests below.
  1301. CC="$TARGET_CC"
  1302. CPPFLAGS="$TARGET_CPPFLAGS"
  1303. # Check for libgcc symbols
  1304. if test x"$platform" = xemu; then
  1305. CFLAGS="$TARGET_CFLAGS -Wno-error"
  1306. AC_CHECK_FUNCS(__udivsi3 __umodsi3 __divsi3 __modsi3 __divdi3 __moddi3 __udivdi3 __umoddi3 __ctzdi2 __ctzsi2 __clzdi2 __aeabi_uidiv __aeabi_uidivmod __aeabi_idiv __aeabi_idivmod __aeabi_ulcmp __muldi3 __aeabi_lmul __aeabi_memcpy __aeabi_memcpy4 __aeabi_memcpy8 __aeabi_memclr __aeabi_memclr4 __aeabi_memclr8 __aeabi_memset __aeabi_lasr __aeabi_llsl __aeabi_llsr _restgpr_14_x __ucmpdi2 __ashldi3 __ashrdi3 __lshrdi3 __bswapsi2 __bswapdi2 __bzero __register_frame_info __deregister_frame_info ___chkstk_ms __chkstk_ms)
  1307. fi
  1308. if test "x$TARGET_APPLE_LINKER" = x1 ; then
  1309. CFLAGS="$TARGET_CFLAGS -nostdlib -static"
  1310. else
  1311. CFLAGS="$TARGET_CFLAGS -nostdlib"
  1312. fi
  1313. LIBS=""
  1314. # Defined in acinclude.m4.
  1315. grub_ASM_USCORE
  1316. grub_PROG_TARGET_CC
  1317. if test "x$TARGET_APPLE_LINKER" != x1 ; then
  1318. grub_PROG_OBJCOPY_ABSOLUTE
  1319. fi
  1320. grub_PROG_LD_BUILD_ID_NONE
  1321. if test "x$target_cpu" = xi386; then
  1322. if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then
  1323. if test ! -z "$TARGET_IMG_LDSCRIPT"; then
  1324. # Check symbols provided by linker script.
  1325. CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},0x8000"
  1326. fi
  1327. grub_CHECK_BSS_START_SYMBOL
  1328. grub_CHECK_END_SYMBOL
  1329. fi
  1330. CFLAGS="$TARGET_CFLAGS"
  1331. fi
  1332. grub_PROG_NM_WORKS
  1333. grub_PROG_NM_MINUS_P
  1334. grub_PROG_NM_DEFINED_ONLY
  1335. AC_SUBST(TARGET_NMFLAGS_MINUS_P)
  1336. AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY)
  1337. if test "$platform" != emu; then
  1338. AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
  1339. SAVED_CPPFLAGS="$CPPFLAGS"
  1340. CPPFLAGS="$TARGET_CPPFLAGS -nostdlib -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
  1341. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
  1342. #include <stddef.h>
  1343. int va_arg_func (int fixed, va_list args);]], [[]])],
  1344. [grub_cv_cc_isystem=yes],
  1345. [grub_cv_cc_isystem=no])
  1346. CPPFLAGS="$SAVED_CPPFLAGS"
  1347. ])
  1348. if test x"$grub_cv_cc_isystem" = xyes ; then
  1349. TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
  1350. fi
  1351. fi
  1352. AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_cc_wtrampolines], [
  1353. CFLAGS="$TARGET_CFLAGS -Wtrampolines -Werror"
  1354. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
  1355. int va_arg_func (int fixed, va_list args);]], [[]])],
  1356. [grub_cv_cc_wtrampolines=yes],
  1357. [grub_cv_cc_wtrampolines=no])
  1358. ])
  1359. if test x"$grub_cv_cc_wtrampolines" = xyes ; then
  1360. TARGET_CFLAGS="$TARGET_CFLAGS -Wtrampolines"
  1361. fi
  1362. # Restore the flags.
  1363. CC="$tmp_CC"
  1364. CFLAGS="$tmp_CFLAGS"
  1365. CPPFLAGS="$tmp_CPPFLAGS"
  1366. LDFLAGS="$tmp_LDFLAGS"
  1367. LIBS="$tmp_LIBS"
  1368. #
  1369. # Check for options.
  1370. #
  1371. # Memory manager debugging.
  1372. AC_ARG_ENABLE([mm-debug],
  1373. AS_HELP_STRING([--enable-mm-debug],
  1374. [include memory manager debugging]))
  1375. if test x$enable_mm_debug = xyes; then
  1376. MM_DEBUG=1
  1377. else
  1378. MM_DEBUG=0
  1379. fi
  1380. AC_SUBST([MM_DEBUG])
  1381. AM_CONDITIONAL([COND_MM_DEBUG], [test x$MM_DEBUG = x1])
  1382. AC_ARG_ENABLE([cache-stats],
  1383. AS_HELP_STRING([--enable-cache-stats],
  1384. [enable disk cache statistics collection]))
  1385. if test x$enable_cache_stats = xyes; then
  1386. DISK_CACHE_STATS=1
  1387. else
  1388. DISK_CACHE_STATS=0
  1389. fi
  1390. AC_SUBST([DISK_CACHE_STATS])
  1391. AC_ARG_ENABLE([boot-time],
  1392. AS_HELP_STRING([--enable-boot-time],
  1393. [enable boot time statistics collection]))
  1394. if test x$enable_boot_time = xyes; then
  1395. BOOT_TIME_STATS=1
  1396. else
  1397. BOOT_TIME_STATS=0
  1398. fi
  1399. AC_SUBST([BOOT_TIME_STATS])
  1400. AC_ARG_ENABLE([grub-emu-sdl2],
  1401. [AS_HELP_STRING([--enable-grub-emu-sdl2],
  1402. [build and install the `grub-emu' debugging utility with SDL2 support (default=guessed)])])
  1403. AC_ARG_ENABLE([grub-emu-sdl],
  1404. [AS_HELP_STRING([--enable-grub-emu-sdl],
  1405. [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
  1406. AC_ARG_ENABLE([grub-emu-pci],
  1407. [AS_HELP_STRING([--enable-grub-emu-pci],
  1408. [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
  1409. if test "$platform" = emu; then
  1410. if test x"$enable_grub_emu_sdl2" = xno ; then
  1411. grub_emu_sdl2_excuse="explicitly disabled"
  1412. fi
  1413. [if [ x"$grub_emu_sdl2_excuse" = x ]; then
  1414. # Check for libSDL libraries.]
  1415. PKG_CHECK_MODULES([SDL2], [sdl2], [
  1416. AC_DEFINE([HAVE_SDL2], [1], [Define to 1 if you have SDL2 library.])
  1417. AC_SUBST(HAVE_SDL2)],
  1418. [grub_emu_sdl2_excuse="libSDL2 libraries are required to build \`grub-emu' with SDL2 support"])
  1419. [fi]
  1420. if test x"enable_grub_emu_sdl2" = xyes && test x"$grub_emu_sdl2_excuse" != x ; then
  1421. AC_MSG_ERROR([SDL2 support for grub-emu was explicitly requested but can't be compiled ($grub_emu_sdl2_excuse)])
  1422. fi
  1423. if test x"$grub_emu_sdl2_excuse" = x ; then
  1424. enable_grub_emu_sdl2=yes
  1425. else
  1426. enable_grub_emu_sdl2=no
  1427. fi
  1428. if test x"$enable_grub_emu_sdl2" = xyes ; then
  1429. grub_emu_sdl_excuse="disabled by sdl2"
  1430. fi
  1431. if test x"$enable_grub_emu_sdl" = xno ; then
  1432. grub_emu_sdl_excuse="explicitly disabled"
  1433. fi
  1434. [if [ x"$grub_emu_sdl_excuse" = x ]; then
  1435. # Check for libSDL libraries.]
  1436. AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
  1437. [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
  1438. AC_SUBST([LIBSDL])
  1439. [fi]
  1440. [if [ x"$grub_emu_sdl_excuse" = x ]; then
  1441. # Check for headers.]
  1442. AC_CHECK_HEADERS([SDL/SDL.h], [],
  1443. [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
  1444. [fi]
  1445. if test x"$enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
  1446. AC_MSG_ERROR([SDL support for grub-emu was explicitly requested but can't be compiled ($grub_emu_sdl_excuse)])
  1447. fi
  1448. if test x"$grub_emu_sdl_excuse" = x ; then
  1449. enable_grub_emu_sdl=yes
  1450. else
  1451. enable_grub_emu_sdl=no
  1452. fi
  1453. if test x"$enable_grub_emu_pci" != xyes ; then
  1454. grub_emu_pci_excuse="not enabled"
  1455. fi
  1456. [if [ x"$grub_emu_pci_excuse" = x ]; then
  1457. # Check for libpci libraries.]
  1458. AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
  1459. [grub_emu_pci_excuse=["need libpciaccess library"]])
  1460. AC_SUBST([LIBPCIACCESS])
  1461. [fi]
  1462. [if [ x"$grub_emu_pci_excuse" = x ]; then
  1463. # Check for headers.]
  1464. AC_CHECK_HEADERS([pciaccess.h], [],
  1465. [grub_emu_pci_excuse=["need libpciaccess headers"]])
  1466. [fi]
  1467. if test x"$grub_emu_pci_excuse" = x ; then
  1468. enable_grub_emu_pci=yes
  1469. else
  1470. enable_grub_emu_pci=no
  1471. fi
  1472. AC_SUBST([enable_grub_emu_sdl2])
  1473. AC_SUBST([enable_grub_emu_sdl])
  1474. AC_SUBST([enable_grub_emu_pci])
  1475. else
  1476. # Ignore --enable-emu-* if platform is not emu
  1477. enable_grub_emu_sdl2=no
  1478. enable_grub_emu_sdl=no
  1479. enable_grub_emu_pci=no
  1480. fi
  1481. AC_ARG_ENABLE([grub-mkfont],
  1482. [AS_HELP_STRING([--enable-grub-mkfont],
  1483. [build and install the `grub-mkfont' utility (default=guessed)])])
  1484. if test x"$enable_grub_mkfont" = xno ; then
  1485. grub_mkfont_excuse="explicitly disabled"
  1486. fi
  1487. unset ac_cv_header_ft2build_h
  1488. if test x"$grub_mkfont_excuse" = x ; then
  1489. # Check for freetype libraries.
  1490. PKG_CHECK_MODULES([FREETYPE], [freetype2], [
  1491. SAVED_CPPFLAGS="$CPPFLAGS"
  1492. SAVED_LIBS="$LIBS"
  1493. CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
  1494. LIBS="$LIBS $FREETYPE_LIBS"
  1495. AC_CHECK_HEADERS([ft2build.h], [],
  1496. [grub_mkfont_excuse=["need freetype2 headers"]])
  1497. AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [],
  1498. [grub_mkfont_excuse=["freetype2 library unusable"]])
  1499. CPPFLAGS="$SAVED_CPPFLAGS"
  1500. LIBS="$SAVED_LIBS"
  1501. ], [grub_mkfont_excuse=["need freetype2 library"]])
  1502. fi
  1503. if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
  1504. AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled ($grub_mkfont_excuse)])
  1505. fi
  1506. if test x"$grub_mkfont_excuse" = x ; then
  1507. enable_grub_mkfont=yes
  1508. else
  1509. enable_grub_mkfont=no
  1510. fi
  1511. AC_SUBST([enable_grub_mkfont])
  1512. SAVED_CC="$CC"
  1513. SAVED_CPP="$CPP"
  1514. SAVED_CFLAGS="$CFLAGS"
  1515. SAVED_CPPFLAGS="$CPPFLAGS"
  1516. SAVED_LDFLAGS="$LDFLAGS"
  1517. CC="$BUILD_CC"
  1518. CPP="$BUILD_CPP"
  1519. CFLAGS="$BUILD_CFLAGS"
  1520. CPPFLAGS="$BUILD_CPPFLAGS"
  1521. LDFLAGS="$BUILD_LDFLAGS"
  1522. unset ac_cv_c_bigendian
  1523. unset ac_cv_header_ft2build_h
  1524. AC_COMPUTE_INT([BUILD_SIZEOF_VOID_P], [sizeof (void *)])
  1525. AC_COMPUTE_INT([BUILD_SIZEOF_LONG], [sizeof (long)])
  1526. AC_C_BIGENDIAN([BUILD_WORDS_BIGENDIAN=1], [BUILD_WORDS_BIGENDIAN=0], [BUILD_WORDS_BIGENDIAN=err], [BUILD_WORDS_BIGENDIAN=err])
  1527. if test x$BUILD_WORDS_BIGENDIAN = xerr ; then
  1528. AC_MSG_ERROR([couldnt determine build endianness])
  1529. fi
  1530. AC_SUBST([BUILD_SIZEOF_LONG])
  1531. AC_SUBST([BUILD_SIZEOF_VOID_P])
  1532. AC_SUBST([BUILD_WORDS_BIGENDIAN])
  1533. if test x"$grub_build_mkfont_excuse" = x ; then
  1534. # Check for freetype libraries.
  1535. SAVED_PKG_CONFIG="$PKG_CONFIG"
  1536. test -z "$BUILD_PKG_CONFIG" || PKG_CONFIG="$BUILD_PKG_CONFIG"
  1537. PKG_CHECK_MODULES([BUILD_FREETYPE], [freetype2], [
  1538. SAVED_CPPFLAGS_2="$CPPFLAGS"
  1539. SAVED_LIBS="$LIBS"
  1540. CPPFLAGS="$CPPFLAGS $BUILD_FREETYPE_CFLAGS"
  1541. LIBS="$LIBS $BUILD_FREETYPE_LIBS"
  1542. AC_CHECK_HEADERS([ft2build.h], [],
  1543. [grub_build_mkfont_excuse=["need freetype2 headers"]])
  1544. AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [],
  1545. [grub_build_mkfont_excuse=["freetype2 library unusable"]])
  1546. LIBS="$SAVED_LIBS"
  1547. CPPFLAGS="$SAVED_CPPFLAGS_2"
  1548. ], [grub_build_mkfont_excuse=["need freetype2 library"]])
  1549. PKG_CONFIG="$SAVED_PKG_CONFIG"
  1550. fi
  1551. if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then
  1552. AC_MSG_ERROR([build-grub-mkfont was explicitly requested but can't be compiled ($grub_build_mkfont_excuse)])
  1553. fi
  1554. if test x"$grub_build_mkfont_excuse" = x ; then
  1555. enable_build_grub_mkfont=yes
  1556. else
  1557. enable_build_grub_mkfont=no
  1558. fi
  1559. if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$platform" = xcoreboot ); then
  1560. if test x"$grub_build_mkfont_excuse" = x ; then
  1561. AC_MSG_ERROR([qemu, coreboot and loongson ports need build-time grub-mkfont])
  1562. else
  1563. AC_MSG_ERROR([qemu, coreboot and loongson ports need build-time grub-mkfont ($grub_build_mkfont_excuse)])
  1564. fi
  1565. fi
  1566. CC="$SAVED_CC"
  1567. CPP="$SAVED_CPP"
  1568. CFLAGS="$SAVED_CFLAGS"
  1569. CPPFLAGS="$SAVED_CPPFLAGS"
  1570. LDFLAGS="$SAVED_LDFLAGS"
  1571. DJVU_FONT_SOURCE=
  1572. starfield_excuse=
  1573. AC_ARG_ENABLE([grub-themes],
  1574. [AS_HELP_STRING([--enable-grub-themes],
  1575. [build and install GRUB themes (default=guessed)])])
  1576. if test x"$enable_grub_themes" = xno ; then
  1577. starfield_excuse="explicitly disabled"
  1578. fi
  1579. if test x"$starfield_excuse" = x && test x"$enable_build_grub_mkfont" = xno ; then
  1580. starfield_excuse="No build-time grub-mkfont"
  1581. fi
  1582. if test x"$starfield_excuse" = x; then
  1583. for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
  1584. for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype; do
  1585. if test -f "$dir/DejaVuSans.$ext"; then
  1586. DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
  1587. break 2
  1588. fi
  1589. done
  1590. done
  1591. if test "x$DJVU_FONT_SOURCE" = x; then
  1592. starfield_excuse="No DejaVu found"
  1593. fi
  1594. fi
  1595. if test x"$enable_grub_themes" = xyes && test x"$starfield_excuse" != x; then
  1596. AC_MSG_ERROR([themes were explicitly requested but requirements are not satisfied ($starfield_excuse)])
  1597. fi
  1598. AC_SUBST([DJVU_FONT_SOURCE])
  1599. FONT_SOURCE=
  1600. for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
  1601. for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont /usr/share/fonts/uni /usr/share/fonts/truetype/unifont /usr/share/fonts/misc; do
  1602. if test -f "$dir/unifont.$ext"; then
  1603. md5="$(md5sum "$dir/unifont.$ext"|awk '{ print $1; }')"
  1604. # PCF and BDF from version 6.3 isn't hanled properly by libfreetype.
  1605. if test "$md5" = 0a54834d2788c83886a3e1785a6a1e61 || test "$md5" = 28f2565c7a41d8d407e2551159385edb || test "$md5" = dae5e588461b3b92b87b6ffee734f936 || test "$md5" = 4a3d687aa5bb329ed05f4263a1016791 ; then
  1606. continue
  1607. fi
  1608. FONT_SOURCE="$dir/unifont.$ext"
  1609. break 2
  1610. fi
  1611. done
  1612. done
  1613. if test x"$enable_build_grub_mkfont" = xno ; then
  1614. FONT_SOURCE=
  1615. fi
  1616. if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$platform" = xcoreboot ); then
  1617. if test x"$grub_build_mkfont_excuse" = x ; then
  1618. AC_MSG_ERROR([qemu, coreboot and loongson ports need unifont])
  1619. else
  1620. AC_MSG_ERROR([qemu, coreboot and loongson ports need unifont ($grub_build_mkfont_excuse)])
  1621. fi
  1622. fi
  1623. AC_SUBST([FONT_SOURCE])
  1624. if test x"$FONT_SOURCE" = x && test x"$DJVU_FONT_SOURCE" = x && test x"$grub_build_mkfont_excuse" = x; then
  1625. grub_build_mkfont_excuse="no fonts"
  1626. fi
  1627. AC_ARG_ENABLE([grub-mount],
  1628. [AS_HELP_STRING([--enable-grub-mount],
  1629. [build and install the `grub-mount' utility (default=guessed)])])
  1630. if test x"$enable_grub_mount" = xno ; then
  1631. grub_mount_excuse="explicitly disabled"
  1632. fi
  1633. if test x"$grub_mount_excuse" = x ; then
  1634. PKG_CHECK_MODULES([FUSE], [fuse3], [FUSE_CFLAGS="$FUSE_CFLAGS -DFUSE_USE_VERSION=32"], [
  1635. PKG_CHECK_MODULES([FUSE], [fuse], [FUSE_CFLAGS="$FUSE_CFLAGS -DFUSE_USE_VERSION=26"], [
  1636. grub_mount_excuse="need fuse or fuse3 libraries"
  1637. ])
  1638. ])
  1639. fi
  1640. if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
  1641. AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled ($grub_mount_excuse)])
  1642. fi
  1643. if test x"$grub_mount_excuse" = x ; then
  1644. enable_grub_mount=yes
  1645. else
  1646. enable_grub_mount=no
  1647. fi
  1648. AC_SUBST([enable_grub_mount])
  1649. AC_ARG_ENABLE([device-mapper],
  1650. [AS_HELP_STRING([--enable-device-mapper],
  1651. [enable Linux device-mapper support (default=guessed)])])
  1652. if test x"$enable_device_mapper" = xno ; then
  1653. device_mapper_excuse="explicitly disabled"
  1654. fi
  1655. if test x"$device_mapper_excuse" = x ; then
  1656. # Check for device-mapper header.
  1657. AC_CHECK_HEADER([libdevmapper.h], [],
  1658. [device_mapper_excuse="need libdevmapper header"])
  1659. fi
  1660. if test x"$device_mapper_excuse" = x ; then
  1661. # Check for device-mapper library.
  1662. AC_CHECK_LIB([devmapper], [dm_task_create], [],
  1663. [device_mapper_excuse="need devmapper library"])
  1664. fi
  1665. if test x"$device_mapper_excuse" = x ; then
  1666. # Check for device-mapper library.
  1667. AC_CHECK_LIB([devmapper], [dm_log_with_errno_init],
  1668. [],
  1669. [device_mapper_excuse="need devmapper library"])
  1670. fi
  1671. if test x"$device_mapper_excuse" = x ; then
  1672. LIBDEVMAPPER="-ldevmapper"
  1673. AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
  1674. [Define to 1 if you have the devmapper library.])
  1675. fi
  1676. AC_SUBST([LIBDEVMAPPER])
  1677. LIBGEOM=
  1678. if test x$host_kernel = xkfreebsd; then
  1679. AC_CHECK_LIB([geom], [geom_gettree], [],
  1680. [AC_MSG_ERROR([Your platform requires libgeom])])
  1681. LIBGEOM="-lgeom"
  1682. fi
  1683. AC_SUBST([LIBGEOM])
  1684. AC_ARG_ENABLE([liblzma],
  1685. [AS_HELP_STRING([--enable-liblzma],
  1686. [enable liblzma integration (default=guessed)])])
  1687. if test x"$enable_liblzma" = xno ; then
  1688. liblzma_excuse="explicitly disabled"
  1689. fi
  1690. if test x"$liblzma_excuse" = x ; then
  1691. AC_CHECK_LIB([lzma], [lzma_code],
  1692. [],[liblzma_excuse="need lzma library"])
  1693. fi
  1694. if test x"$liblzma_excuse" = x ; then
  1695. AC_CHECK_HEADER([lzma.h], [], [liblzma_excuse="need lzma header"])
  1696. fi
  1697. if test x"$enable_liblzma" = xyes && test x"$liblzma_excuse" != x ; then
  1698. AC_MSG_ERROR([liblzma support was explicitly requested but requirements are not satisfied ($liblzma_excuse)])
  1699. fi
  1700. if test x"$liblzma_excuse" = x ; then
  1701. LIBLZMA="-llzma"
  1702. AC_DEFINE([USE_LIBLZMA], [1],
  1703. [Define to 1 if you have the LZMA library.])
  1704. fi
  1705. AC_SUBST([LIBLZMA])
  1706. AC_ARG_ENABLE([libzfs],
  1707. [AS_HELP_STRING([--enable-libzfs],
  1708. [enable libzfs integration (default=guessed)])])
  1709. if test x"$enable_libzfs" = xno ; then
  1710. libzfs_excuse="explicitly disabled"
  1711. fi
  1712. if test x"$libzfs_excuse" = x ; then
  1713. # Only check for system headers if libzfs support has not been disabled.
  1714. AC_CHECK_HEADERS(libzfs.h libnvpair.h)
  1715. fi
  1716. if test x"$libzfs_excuse" = x ; then
  1717. AC_CHECK_LIB([zfs], [libzfs_init],
  1718. [],
  1719. [libzfs_excuse="need zfs library"])
  1720. fi
  1721. if test x"$libzfs_excuse" = x ; then
  1722. AC_CHECK_LIB([nvpair], [nvlist_lookup_string],
  1723. [],
  1724. [libzfs_excuse="need nvpair library"])
  1725. fi
  1726. if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then
  1727. AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied ($libzfs_excuse)])
  1728. fi
  1729. if test x"$libzfs_excuse" = x ; then
  1730. # We need both libzfs and libnvpair for a successful build.
  1731. LIBZFS="-lzfs"
  1732. AC_DEFINE([HAVE_LIBZFS], [1],
  1733. [Define to 1 if you have the ZFS library.])
  1734. LIBNVPAIR="-lnvpair"
  1735. AC_DEFINE([HAVE_LIBNVPAIR], [1],
  1736. [Define to 1 if you have the NVPAIR library.])
  1737. fi
  1738. AC_SUBST([LIBZFS])
  1739. AC_SUBST([LIBNVPAIR])
  1740. LIBS=""
  1741. AC_SUBST([FONT_SOURCE])
  1742. AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
  1743. [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
  1744. AC_SUBST(HAVE_ASM_USCORE)
  1745. AC_SUBST(BSS_START_SYMBOL)
  1746. AC_SUBST(END_SYMBOL)
  1747. AC_SUBST(PACKAGE)
  1748. AC_SUBST(VERSION)
  1749. AC_ARG_ENABLE([werror],
  1750. [AS_HELP_STRING([--disable-werror],
  1751. [do not use -Werror when building GRUB])])
  1752. if test x"$enable_werror" != xno ; then
  1753. TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
  1754. HOST_CFLAGS="$HOST_CFLAGS -Werror"
  1755. if test "x$grub_cv_cc_target_clang" = xyes; then
  1756. TARGET_CFLAGS="$TARGET_CFLAGS -Wno-error=vla"
  1757. HOST_CFLAGS="$HOST_CFLAGS -Wno-error=vla"
  1758. fi
  1759. fi
  1760. TARGET_CPP="$TARGET_CC -E"
  1761. TARGET_CCAS=$TARGET_CC
  1762. # Includes which include make-time substitutions. They must come last
  1763. # as to avoid executing top_builddir in shell.
  1764. HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
  1765. TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
  1766. TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
  1767. GRUB_TARGET_CPU="${target_cpu}"
  1768. GRUB_PLATFORM="${platform}"
  1769. AC_SUBST(GRUB_TARGET_CPU)
  1770. AC_SUBST(GRUB_PLATFORM)
  1771. AC_SUBST(TARGET_OBJCONV)
  1772. AC_SUBST(TARGET_CPP)
  1773. AC_SUBST(TARGET_CCAS)
  1774. AC_SUBST(TARGET_OBJ2ELF)
  1775. AC_SUBST(TARGET_MODULE_FORMAT)
  1776. AC_SUBST(TARGET_CC_VERSION)
  1777. AC_SUBST(TARGET_CFLAGS)
  1778. AC_SUBST(TARGET_LDFLAGS)
  1779. AC_SUBST(TARGET_CPPFLAGS)
  1780. AC_SUBST(TARGET_CCASFLAGS)
  1781. AC_SUBST(TARGET_IMG_LDFLAGS)
  1782. AC_SUBST(TARGET_IMG_CFLAGS)
  1783. AC_SUBST(TARGET_IMG_BASE_LDOPT)
  1784. AC_SUBST(TARGET_APPLE_LINKER)
  1785. AC_SUBST(HOST_CFLAGS)
  1786. AC_SUBST(HOST_LDFLAGS)
  1787. AC_SUBST(HOST_CPPFLAGS)
  1788. AC_SUBST(HOST_CCASFLAGS)
  1789. AC_SUBST(BUILD_LIBM)
  1790. #
  1791. # Automake conditionals
  1792. #
  1793. AM_CONDITIONAL([COND_real_platform], [test x$platform != xnone])
  1794. AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
  1795. AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ])
  1796. AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot])
  1797. AM_CONDITIONAL([COND_arm_coreboot], [test x$target_cpu = xarm -a x$platform = xcoreboot])
  1798. AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi])
  1799. AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ])
  1800. AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a x$platform = xefi])
  1801. AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])
  1802. AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
  1803. AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
  1804. AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
  1805. AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
  1806. AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
  1807. AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
  1808. AM_CONDITIONAL([COND_i386_xen], [test x$target_cpu = xi386 -a x$platform = xxen])
  1809. AM_CONDITIONAL([COND_i386_xen_pvh], [test x$target_cpu = xi386 -a x$platform = xxen_pvh])
  1810. AM_CONDITIONAL([COND_loongarch64], [test x$target_cpu = xloongarch64])
  1811. AM_CONDITIONAL([COND_loongarch64_efi], [test x$target_cpu = xloongarch64 -a x$platform = xefi])
  1812. AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
  1813. AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc])
  1814. AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
  1815. AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
  1816. AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
  1817. AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
  1818. AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
  1819. AM_CONDITIONAL([COND_riscv32], [test x$target_cpu = xriscv32 ])
  1820. AM_CONDITIONAL([COND_riscv64], [test x$target_cpu = xriscv64 ])
  1821. AM_CONDITIONAL([COND_riscv32_efi], [test x$target_cpu = xriscv32 -a x$platform = xefi])
  1822. AM_CONDITIONAL([COND_riscv64_efi], [test x$target_cpu = xriscv64 -a x$platform = xefi])
  1823. AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
  1824. AM_CONDITIONAL([COND_sparc64_emu], [test x$target_cpu = xsparc64 -a x$platform = xemu])
  1825. AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
  1826. AM_CONDITIONAL([COND_x86_64_xen], [test x$target_cpu = xx86_64 -a x$platform = xxen])
  1827. AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
  1828. AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
  1829. AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
  1830. AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
  1831. AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
  1832. AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
  1833. AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
  1834. AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
  1835. AM_CONDITIONAL([COND_GRUB_EMU_SDL2], [test x$enable_grub_emu_sdl2 = xyes])
  1836. AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
  1837. AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
  1838. AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
  1839. AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
  1840. AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
  1841. if test x$FONT_SOURCE != x ; then
  1842. HAVE_FONT_SOURCE=1
  1843. else
  1844. HAVE_FONT_SOURCE=0
  1845. fi
  1846. AC_SUBST(HAVE_FONT_SOURCE)
  1847. AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1])
  1848. AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
  1849. AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
  1850. AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
  1851. AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
  1852. AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
  1853. AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
  1854. AM_CONDITIONAL([COND_HAVE_EXEC], [test "x$have_exec" = xy])
  1855. AM_CONDITIONAL([COND_HAVE_PCI], [test "x$have_pci" = xy])
  1856. test "x$prefix" = xNONE && prefix="$ac_default_prefix"
  1857. test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
  1858. datarootdir="$(eval echo "$datarootdir")"
  1859. grub_libdir="$(eval echo "$libdir")"
  1860. grub_localedir="$(eval echo "$localedir")"
  1861. grub_datadir="$(eval echo "$datadir")"
  1862. grub_sysconfdir="$(eval echo "$sysconfdir")"
  1863. AC_DEFINE_UNQUOTED(LOCALEDIR, "$grub_localedir", [Locale dir])
  1864. AC_DEFINE_UNQUOTED(GRUB_LIBDIR, "$grub_libdir", [Library dir])
  1865. AC_DEFINE_UNQUOTED(GRUB_DATADIR, "$grub_datadir", [Data dir])
  1866. AC_DEFINE_UNQUOTED(GRUB_SYSCONFDIR, "$grub_sysconfdir", [Configuration dir])
  1867. # Output files.
  1868. if test "$platform" != none; then
  1869. cpudir="${target_cpu}"
  1870. if test x${cpudir} = xmipsel; then
  1871. cpudir=mips;
  1872. fi
  1873. grub_CHECK_LINK_DIR
  1874. if test x"$link_dir" = xyes ; then
  1875. AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
  1876. if test "$platform" != emu ; then
  1877. AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
  1878. fi
  1879. else
  1880. mkdir -p include/grub 2>/dev/null
  1881. rm -rf include/grub/cpu
  1882. cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
  1883. if test "$platform" != emu ; then
  1884. rm -rf include/grub/machine
  1885. cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
  1886. fi
  1887. fi
  1888. else
  1889. # Just enough to stop the compiler failing with -I$(srcdir)/include.
  1890. mkdir -p include 2>/dev/null
  1891. rm -rf include/grub/cpu include/grub/machine
  1892. fi
  1893. AC_CONFIG_FILES([Makefile])
  1894. AC_CONFIG_FILES([grub-core/Makefile])
  1895. AC_CONFIG_FILES([grub-core/lib/gnulib/Makefile])
  1896. AC_CONFIG_FILES([po/Makefile.in])
  1897. AC_CONFIG_FILES([docs/Makefile])
  1898. AC_CONFIG_FILES([util/bash-completion.d/Makefile])
  1899. AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
  1900. AC_CONFIG_FILES([config.h])
  1901. AC_OUTPUT
  1902. [
  1903. echo "*******************************************************"
  1904. echo GRUB2 will be compiled with following components:
  1905. echo Platform: "$target_cpu"-"$platform"
  1906. if [ x"$platform" = xemu ]; then
  1907. if [ x"$grub_emu_sdl2_excuse" = x ]; then
  1908. echo SDL2 support for grub-emu: Yes
  1909. else
  1910. echo SDL2 support for grub-emu: No "($grub_emu_sdl2_excuse)"
  1911. fi
  1912. if [ x"$grub_emu_sdl_excuse" = x ]; then
  1913. echo SDL support for grub-emu: Yes
  1914. else
  1915. echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
  1916. fi
  1917. if [ x"$grub_emu_pci_excuse" = x ]; then
  1918. echo PCI support for grub-emu: Yes
  1919. else
  1920. echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
  1921. fi
  1922. fi
  1923. if test x"$device_mapper_excuse" = x ; then
  1924. echo With devmapper support: Yes
  1925. else
  1926. echo With devmapper support: No "($device_mapper_excuse)"
  1927. fi
  1928. if [ x"$enable_mm_debug" = xyes ]; then
  1929. echo With memory debugging: Yes
  1930. else
  1931. echo With memory debugging: No
  1932. fi
  1933. if [ x"$enable_cache_stats" = xyes ]; then
  1934. echo With disk cache statistics: Yes
  1935. else
  1936. echo With disk cache statistics: No
  1937. fi
  1938. if [ x"$enable_boot_time" = xyes ]; then
  1939. echo With boot time statistics: Yes
  1940. else
  1941. echo With boot time statistics: No
  1942. fi
  1943. if [ x"$efiemu_excuse" = x ]; then
  1944. echo efiemu runtime: Yes
  1945. else
  1946. echo efiemu runtime: No "($efiemu_excuse)"
  1947. fi
  1948. if [ x"$grub_mkfont_excuse" = x ]; then
  1949. echo grub-mkfont: Yes
  1950. else
  1951. echo grub-mkfont: No "($grub_mkfont_excuse)"
  1952. fi
  1953. if [ x"$grub_mount_excuse" = x ]; then
  1954. echo grub-mount: Yes
  1955. else
  1956. echo grub-mount: No "($grub_mount_excuse)"
  1957. fi
  1958. if [ x"$starfield_excuse" = x ]; then
  1959. echo starfield theme: Yes
  1960. echo With DejaVuSans font from $DJVU_FONT_SOURCE
  1961. else
  1962. echo starfield theme: No "($starfield_excuse)"
  1963. fi
  1964. if [ x"$libzfs_excuse" = x ]; then
  1965. echo With libzfs support: Yes
  1966. else
  1967. echo With libzfs support: No "($libzfs_excuse)"
  1968. fi
  1969. if [ x"$grub_build_mkfont_excuse" = x ]; then
  1970. echo Build-time grub-mkfont: Yes
  1971. if test "x$FONT_SOURCE" = x ; then
  1972. echo "Without unifont"
  1973. else
  1974. echo "With unifont from $FONT_SOURCE"
  1975. fi
  1976. else
  1977. echo Build-time grub-mkfont: No "($grub_build_mkfont_excuse)"
  1978. echo "Without unifont (no build-time grub-mkfont)"
  1979. fi
  1980. if test x"$liblzma_excuse" != x ; then
  1981. echo "Without liblzma (no support for XZ-compressed mips images) ($liblzma_excuse)"
  1982. else
  1983. echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
  1984. fi
  1985. if test "x$enable_stack_protector" != xno; then
  1986. echo "With stack smashing protector: Yes"
  1987. else
  1988. echo "With stack smashing protector: No"
  1989. fi
  1990. echo "*******************************************************"
  1991. ]