]> git.draconx.ca Git - dxcommon.git/blob - m4/w32gui.m4
DX_C_ALIGNAS: Work around bash-5 parsing bug.
[dxcommon.git] / m4 / w32gui.m4
1 dnl Copyright © 2022 Nick Bowler
2 dnl
3 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 dnl This is free software: you are free to do what the fuck you want to.
5 dnl There is NO WARRANTY, to the extent permitted by law.
6
7 dnl DX_W32_GUI
8 dnl
9 dnl Determine the C linker options needed to build a Windows graphical
10 dnl application (i.e., for the "windows" subsystem).  The result is saved
11 dnl in the cache variable dx_cv_w32_gui_flags.
12 dnl
13 dnl If no suitable flags could be determined, the cache variable dx_cv_w32_gui
14 dnl is set to "unknown" and dx_cv_w32_gui_flags is set to the empty string.
15
16 AC_DEFUN([DX_W32_GUI], [AC_REQUIRE([AC_PROG_AWK])dnl
17 AC_CACHE_CHECK([for $CC option to target W32 GUI], [dx_cv_w32_gui],
18 [_dx_check_pe_subsys () {
19   $AWK -f m4_do([m4_pushdef([m4_include], [$][1])],
20                 [m4_include(DX_BASEDIR[/scripts/pe-subsys.awk])],
21                 [m4_popdef([m4_include])]) "conftest$EXEEXT"
22 }
23 dx_cv_w32_gui=unknown _dx_save_LDFLAGS=$LDFLAGS
24 for dx_cv_w32_gui_flags in '' -mwindows; do
25 LDFLAGS="$_dx_save_LDFLAGS $dx_cv_w32_gui_flags"
26 AC_LINK_IFELSE([AC_LANG_PROGRAM],
27 [AS_CASE([`_dx_check_pe_subsys`],
28 [gui], [dx_cv_w32_gui=${dx_cv_w32_gui_flags:-none needed}; break]
29 )])
30 done
31 test x"$dx_cv_w32_gui" != x"unknown" || dx_cv_w32_gui_flags=
32 LDFLAGS=$_dx_save_LDFLAGS])])