-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
209 lines (190 loc) · 8.25 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# Define the package name and version
AC_INIT([helapordo], [1.4.12], [[email protected]])
# Verify automake version and enable foreign option
AM_INIT_AUTOMAKE([foreign -Wall])
# Detect the host system and set PACK_PREFIX accordingly, later
AC_CANONICAL_HOST
build_linux=no
build_windows=no
build_mac=no
build_anvilpick=no
build_curses=yes
build_raylib=no
# Check for the --enable-debug option
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [Enable debug build])],
[enable_debug=$enableval],
[enable_debug=no])
# Define the DEBUG_BUILD conditional based on the --enable-debug option
AM_CONDITIONAL([DEBUG_BUILD], [test "$enable_debug" = "yes"])
# Check for the --enable-anvilpick option
AC_ARG_ENABLE([anvilpick],
[AS_HELP_STRING([--enable-anvilpick], [Enable interactive selection of ./anvil impl])],
[enable_anvilpick=$enableval],
[enable_anvilpick=no])
AC_ARG_ENABLE([raylib],
[AS_HELP_STRING([--enable-raylib], [Enable raylib build])],
[enable_raylib=$enableval],
[enable_raylib=no])
AC_ARG_ENABLE([anvil],
[AS_HELP_STRING([--enable-anvil], [Enable anvil-backed build])],
[enable_anvil=$enableval],
[enable_anvil=no])
AC_ARG_ENABLE([emoji],
[AS_HELP_STRING([--enable-emoji], [Enable emoji icons of equips])],
[enable_emoji=$enableval],
[enable_emoji=yes])
AC_ARG_ENABLE([default_background],
[AS_HELP_STRING([--enable-default-background], [Enable usage of terminal default background])],
[enable_default_background=$enableval],
[enable_default_background=no])
if test "$enable_anvil" = "yes"; then
echo "CONF Building using anvil."
else
echo "CONF Building without using anvil."
fi
# Define the include and library paths based on the host system
case "${host_os}" in
mingw*)
# mingw32 specific flags
echo "CONF Building for mingw32: [$host_cpu-$host_vendor-$host_os]"
build_windows=yes
if test "$enable_raylib" = "yes"; then
echo "CONF Building with raylib"
build_raylib=yes
AC_SUBST([HELAPORDO_CFLAGS], ["-I/usr/x86_64-w64-mingw32/include -fstack-protector -DWINDOWS_BUILD -DS4C_HAS_ANIMATE -DS4C_RAYLIB_EXTENSION -DS4C_RL_QUIETER"])
AC_SUBST([HELAPORDO_LDFLAGS], ["-L/usr/x86_64-w64-mingw32/lib -lraylib -lm -lgdi32 -lwinmm -static"])
AC_SUBST([CCOMP], ["/usr/bin/x86_64-w64-mingw32-gcc"])
AC_SUBST([OS], ["w64-mingw32"])
AC_SUBST([TARGET], ["helapordo.exe"])
if test "$enable_anvilpick" = "yes"; then
echo "CONF Building with anvil interactive selection"
build_anvilpick=yes
AC_SUBST([ANVIL_IMPL], ["-i repo_invil"])
else
AC_SUBST([ANVIL_IMPL], ["repo_amboso"])
fi
AC_SUBST([HL_BUILD_STR], ["rl"])
else
echo "CONF Building with ncurses"
#build_raylib=no
#build_curses=yes
AC_SUBST([HELAPORDO_CFLAGS], ["-I/usr/x86_64-w64-mingw32/include -fstack-protector -DWINDOWS_BUILD -DNCURSES_NO_PADDING -DNCURSES_STATIC -DS4C_HAS_ANIMATE -DS4C_HAS_GUI -DS4C_UNCHECKED"])
AC_SUBST([HELAPORDO_LDFLAGS], ["-L/usr/x86_64-w64-mingw32/lib -lpanelw -lmenuw -lncursesw -static"])
AC_SUBST([CCOMP], ["/usr/bin/x86_64-w64-mingw32-gcc"])
AC_SUBST([OS], ["w64-mingw32"])
AC_SUBST([TARGET], ["helapordo.exe"])
if test "$enable_anvilpick" = "yes"; then
echo "CONF Building with anvil interactive selection"
build_anvilpick=yes
AC_SUBST([ANVIL_IMPL], ["-i repo_invil"])
else
AC_SUBST([ANVIL_IMPL], ["repo_amboso"])
fi
AC_SUBST([HL_BUILD_STR], ["nc"])
fi
;;
darwin*)
# macOS specific flags
echo "CONF Building for macos: [$host_cpu-$host_vendor-$host_os]"
build_mac=yes
if test "$enable_raylib" = "yes"; then
echo "CONF Building with raylib"
build_raylib=yes
build_curses=no
AC_SUBST([HELAPORDO_CFLAGS], ["-I/opt/homebrew/opt/raylib/include -DS4C_HAS_ANIMATE -DS4C_RAYLIB_EXTENSION -DS4C_RL_QUIETER"])
AC_SUBST([HELAPORDO_LDFLAGS], ["-L/opt/homebrew/opt/raylib/lib -lraylib"])
AC_SUBST([OS], ["darwin"])
AC_SUBST([TARGET], ["helapordo"])
if test "$enable_anvilpick" = "yes"; then
echo "CONF Building with anvil interactive selection"
build_anvilpick=yes
AC_SUBST([ANVIL_IMPL], ["-i repo_invil"])
else
AC_SUBST([ANVIL_IMPL], ["repo_invil"])
fi
AC_SUBST([HL_BUILD_STR], ["rl"])
else
echo "CONF Building with ncurses"
#build_raylib=no
#build_curses=yes
AC_SUBST([HELAPORDO_CFLAGS], ["-I/opt/homebrew/opt/ncurses/include -DNCURSES_NO_PADDING -DS4C_HAS_ANIMATE -DS4C_HAS_GUI -DS4C_UNCHECKED"])
AC_SUBST([HELAPORDO_LDFLAGS], ["-L/opt/homebrew/opt/ncurses/lib -lmenu -lpanel -lncurses"])
AC_SUBST([OS], ["darwin"])
AC_SUBST([TARGET], ["helapordo"])
if test "$enable_anvilpick" = "yes"; then
echo "CONF Building with anvil interactive selection"
build_anvilpick=yes
AC_SUBST([ANVIL_IMPL], ["-i repo_invil"])
else
AC_SUBST([ANVIL_IMPL], ["repo_invil"])
fi
AC_SUBST([HL_BUILD_STR], ["nc"])
fi
;;
linux*)
# Linux specific flags
echo "CONF Building for Linux: [$host_cpu-$host_vendor-$host_os]"
build_linux=yes
if test "$enable_raylib" = "yes"; then
echo "CONF Building with raylib"
build_raylib=yes
build_curses=no
AC_SUBST([HELAPORDO_CFLAGS], ["-DS4C_HAS_ANIMATE -DS4C_RAYLIB_EXTENSION -DS4C_RL_QUIETER"])
AC_SUBST([HELAPORDO_LDFLAGS], ["-lraylib"])
AC_SUBST([OS], ["Linux"])
AC_SUBST([CCOMP], ["gcc"]) #Yes
AC_SUBST([TARGET], ["helapordo"])
if test "$enable_anvilpick" = "yes"; then
echo "CONF Building with anvil interactive selection"
build_anvilpick=yes
AC_SUBST([ANVIL_IMPL], ["-i repo_invil"])
else
AC_SUBST([ANVIL_IMPL], ["repo_amboso"])
fi
AC_SUBST([HL_BUILD_STR], ["rl"])
else
echo "CONF Building with ncurses"
#build_raylib=no
#build_curses=yes
AC_SUBST([HELAPORDO_CFLAGS], ["-DNCURSES_NO_PADDING -DS4C_HAS_ANIMATE -DS4C_HAS_GUI -DS4C_UNCHECKED"])
AC_SUBST([HELAPORDO_LDFLAGS], ["-lmenu -lpanel -lncurses"])
AC_SUBST([OS], ["Linux"])
AC_SUBST([CCOMP], ["gcc"]) #Yes
AC_SUBST([TARGET], ["helapordo"])
if test "$enable_anvilpick" = "yes"; then
echo "CONF Building with anvil interactive selection"
build_anvilpick=yes
AC_SUBST([ANVIL_IMPL], ["-i repo_invil"])
else
AC_SUBST([ANVIL_IMPL], ["repo_amboso"])
fi
AC_SUBST([HL_BUILD_STR], ["nc"])
fi
;;
*)
AC_MSG_ERROR(["OS $host_os is not supported"])
;;
esac
AM_CONDITIONAL([HL_RAYLIB_BUILD], [test "$build_raylib" = "yes"])
AM_CONDITIONAL([HL_CURSES_BUILD], [test "$build_curses" = "yes"])
AM_CONDITIONAL([ANVILPICK_BUILD], [test "$build_anvilpick" = "yes"])
AM_CONDITIONAL([USE_ANVIL_BUILD], [test "$enable_anvil" = "yes"])
AM_CONDITIONAL([WINDOWS_BUILD], [test "$build_windows" = "yes"])
AM_CONDITIONAL([DARWIN_BUILD], [test "$build_mac" = "yes"])
AM_CONDITIONAL([LINUX_BUILD], [test "$build_linux" = "yes"])
AM_CONDITIONAL([USE_EMOJI_BUILD], [test "$enable_emoji" = "yes"])
AM_CONDITIONAL([USE_DEFAULT_BACKGROUND], [test "$enable_default_background" = "yes"])
# Set a default version number if not specified externally
AC_ARG_VAR([VERSION], [Version number])
if test -z "$VERSION"; then
VERSION="1.4.12"
fi
# Output variables to the config.h header
AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number])
AC_CHECK_PROGS([CCOMP], [gcc clang])
AC_CHECK_HEADERS([stdio.h])
AC_CHECK_FUNCS([malloc calloc])
# Output the generated files (Makefile and config.h)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT