-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.ac
236 lines (212 loc) · 7.62 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# Copyright (c) 2019 Damien Ciabrini
# This file is part of ngdevkit
#
# ngdevkit is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# ngdevkit is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with ngdevkit. If not, see <http://www.gnu.org/licenses/>.
AC_INIT([ngdevkit-examples], [0.1])
# This set of examples is meant to be built against this ngdevkit version
NGDEVKIT_MIN_VERSION=0.4
dnl
dnl MinGW-specific options
dnl
AC_ARG_ENABLE([mingw],
AS_HELP_STRING([--enable-mingw], [Look for a Win10-native version of gngeo available in PATH]),
AS_IF([test "x$enable_mingw" = xyes], [ENABLE_MINGW="yes"], [ENABLE_MINGW="no"]),
[ENABLE_MINGW="no"])
AC_SUBST([ENABLE_MINGW])
AC_ARG_ENABLE([msys2],
AS_HELP_STRING([--enable-msys2], [Look for a Win10-native version of gngeo available in PATH]),
AS_IF([test "x$enable_msys2" = xyes], [ENABLE_MSYS2="yes"], [ENABLE_MSYS2="no"]),
[ENABLE_MSYS2="no"])
AC_SUBST([ENABLE_MSYS2])
# ngdevkit-toolkit and ngdevkit can be installed in
# two different location, so search for executable
# in two steps
# ngdevkit-toolkit common tools
AC_PATH_PROG([nggcc], [m68k-neogeo-elf-gcc])
AC_PATH_PROG([ngas], [m68k-neogeo-elf-as])
AC_PATH_PROG([ngld], [m68k-neogeo-elf-ld])
AC_PATH_PROG([ngar], [m68k-neogeo-elf-ar])
AC_PATH_PROG([ngranlib], [m68k-neogeo-elf-ranlib])
AC_PATH_PROG([ngobjcopy], [m68k-neogeo-elf-objcopy])
AC_PATH_PROG([ngsdcc], [z80-neogeo-ihx-sdcc])
AC_PATH_PROG([ngsdas], [z80-neogeo-ihx-sdasz80])
AC_PATH_PROG([ngsdld], [z80-neogeo-ihx-sdldz80])
AC_PATH_PROG([ngsdar], [z80-neogeo-ihx-sdar])
AC_PATH_PROG([ngsdranlib], [z80-neogeo-ihx-sdranlib])
AC_PATH_PROG([ngsdobjcopy], [z80-neogeo-ihx-sdobjcopy])
# ngdevkit location and common flags
PKG_CHECK_MODULES([ngdevkit],[ngdevkit])
AC_MSG_CHECKING([whether detected ngdevkit version >= ${NGDEVKIT_MIN_VERSION}])
[ngdevkitver=`pkg-config --modversion ngdevkit`]
highestver=`(echo ${ngdevkitver}; echo ${NGDEVKIT_MIN_VERSION}) | sort | tail -1`
if test ${highestver} = ${ngdevkitver} ; then
AC_MSG_RESULT([yes])
else
AC_MSG_ERROR([ngdevkit version too old (detected: ${ngdevkitver}, required: ${NGDEVKIT_MIN_VERSION})])
fi
AC_SUBST([ngdkbindir],`pkg-config --variable=bindir ngdevkit`)
AC_SUBST([ngdksharedir],`pkg-config --variable=sharedir ngdevkit`)
AC_SUBST([ngdkz80includedir],`pkg-config --variable=z80includedir ngdevkit`)
AC_SUBST([ngdkz80libdir],`pkg-config --variable=z80libdir ngdevkit`)
# additional dependencies
AC_ARG_WITH([python],
AS_HELP_STRING([--with-python=path], [Absolute path to the python 3 binary]))
if test -n "$with_python"; then
python="$with_python"
AC_SUBST([python])
else
AC_PATH_PROGS([python], [python3 python], [no])
if test x"$python" = x"no"; then
AC_MSG_ERROR([no python detected.])
fi
fi
dnl AC_PATH_PROGS([python], [python3 python], [no])
dnl if test x"$python" = x"no"; then
dnl AC_MSG_ERROR([no python detected.])
dnl fi
AC_MSG_CHECKING([whether detected python is at least python3])
[pyver=`$python -c 'import sys; print(sys.version_info[0])'`]
if test $pyver -ge 3; then
AC_MSG_RESULT([yes])
else
AC_MSG_ERROR([python major version too old (detected: $pyver, required: 3)])
fi
dnl Configure how to run ngdevkit's python tools
AC_MSG_CHECKING([how to call ngdevkit's python tools])
ngdktool=$ngdkbindir/paltool.py
shebang=`head -1 $ngdktool | sed -ne 's|^#!\(.*python\S*\)\s*.*|\1|p'`
if test -n "$shebang" ; then
ngdkpython=`which $shebang | grep -i python`
else
ngdkpython=""
fi
if test -f "$ngdkpython" && test "$ngdkpython" = "$python" ; then
PALTOOL="$ngdkbindir/paltool.py"
TILETOOL="$ngdkbindir/tiletool.py"
ADPCMTOOL="$ngdkbindir/adpcmtool.py"
VROMTOOL="$ngdkbindir/vromtool.py"
FURTOOL="$ngdkbindir/furtool.py"
NSSTOOL="$ngdkbindir/nsstool.py"
SOUNDTOOL="$ngdkbindir/soundtool.py"
AC_MSG_RESULT([run directly])
else
PALTOOL="$python $ngdkbindir/paltool.py"
TILETOOL="$python $ngdkbindir/tiletool.py"
ADPCMTOOL="$python $ngdkbindir/adpcmtool.py"
VROMTOOL="$python $ngdkbindir/vromtool.py"
FURTOOL="$python $ngdkbindir/furtool.py"
NSSTOOL="$python $ngdkbindir/nsstool.py"
SOUNDTOOL="$python $ngdkbindir/soundtool.py"
AC_MSG_RESULT([run with $python])
fi
AC_SUBST([PALTOOL])
AC_SUBST([TILETOOL])
AC_SUBST([ADPCMTOOL])
AC_SUBST([VROMTOOL])
AC_SUBST([FURTOOL])
AC_SUBST([NSSTOOL])
AC_SUBST([SOUNDTOOL])
dnl External tools for the examples
AC_PATH_PROG([zip], [zip])
AC_PATH_PROG([convert], [convert])
AC_PATH_PROG([sox], [sox])
AC_PATH_PROG([rsync], [rsync])
if test x"$ENABLE_MINGW" = x"yes"; then
gngeo_name=ngdevkit-gngeo.exe
else
gngeo_name=ngdevkit-gngeo
fi
AC_PATH_PROG([gngeo], [$gngeo_name])
# escape potential spaces from path
gngeo=$(echo "$gngeo" | sed 's/ /\\ /g')
if test x"$ENABLE_MINGW" = x"yes"; then
GNGEO_ABS_PREFIX="`eval dirname ${gngeo}`/"
GNGEO_PRE="cd \"$GNGEO_ABS_PREFIX\" &&"
GNGEO_POST="; cat gngeo_log.txt"
elif test x"$ENABLE_MSYS2" = x"yes"; then
GNGEO_ABS_PREFIX=""
GNGEO_PRE=""
GNGEO_POST="; cat gngeo_log.txt"
else
GNGEO_ABS_PREFIX=""
GNGEO_PRE=""
GNGEO_POST=""
fi
if test x"$gngeo" != x""; then
if test x"$ENABLE_MINGW" = x"yes"; then
AC_MSG_CHECKING([ngdevkit-gngeo install path])
gngeo_install_path="`eval dirname ${gngeo}`"
if eval test -d \"${gngeo_install_path}\"; then
AC_MSG_RESULT([$gngeo_install_path])
GNGEO_INSTALL_PATH=$(echo "$gngeo_install_path" | sed 's/ /\\ /g')
else
AC_MSG_ERROR([not found])
fi
AC_SUBST([GNGEO_INSTALL_PATH])
fi
AC_MSG_CHECKING([whether ngdevkit-gngeo is built with GLSL shader blitter])
(eval $GNGEO_PRE $gngeo -b help $GNGEO_POST) | grep -q -w '^glsl'
if test $? = 0; then
AC_MSG_RESULT([yes])
GNGEO_GLSL=yes
else
GNGEO_GLSL=no
AC_MSG_RESULT([no])
fi
fi
AC_SUBST([GNGEO_GLSL])
if test x"$GNGEO_GLSL" = x"yes"; then
AC_SUBST([GNGEO_SHADER_PATH])
if test x"$GNGEO_GLSL" = x"yes"; then
AC_MSG_CHECKING([ngdevkit-gngeo GLSL shader path])
gngeo_shader_path=`(eval $GNGEO_PRE $gngeo -b glsl --shader=noop.glslp forcefail $GNGEO_POST) | sed -ne 's%.*GLSL preset \(.*\)/noop\.glslp.*%\1%p'`
dnl MinGW generates self-contained builds, so all paths are relative
if test -n "$gngeo_shader_path" && test -d "${GNGEO_ABS_PREFIX}$gngeo_shader_path"; then
AC_MSG_RESULT([$gngeo_shader_path])
GNGEO_SHADER_PATH=$gngeo_shader_path
else
AC_MSG_RESULT([not found])
fi
AC_MSG_CHECKING([whether the GLSL shaders directory is available])
if test -d "$PWD/shaders"; then
AC_MSG_RESULT([$PWD/shaders])
GLSL_SHADER_PATH=$PWD/shaders
else
AC_MSG_RESULT([not found. git submodule not checked out])
fi
fi
fi
AC_SUBST([GNGEO_SHADER_PATH])
AC_SUBST([GLSL_SHADER_PATH])
AC_MSG_CHECKING([which default shader to use in ngdevkit-gngeo])
if test -n "$GLSL_SHADER_PATH" && test -f "$GLSL_SHADER_PATH/qcrt-flat.glslp"; then
SHADER_PATH=$GLSL_SHADER_PATH
SHADER=qcrt-flat.glslp
else
SHADER_PATH=$GNGEO_SHADER_PATH
SHADER=noop.glslp
fi
# MSYS2: gngeo can only parse native Windows paths
if test x"$ENABLE_MSYS2" = x"yes"; then
SHADER_PATH=`cygpath -w $SHADER_PATH`
AC_MSG_RESULT([$SHADER_PATH\\$SHADER])
else
AC_MSG_RESULT([$SHADER_PATH/$SHADER])
fi
AC_SUBST([SHADER_PATH])
AC_SUBST([SHADER])
AC_CONFIG_FILES([
Makefile.config
])
AC_OUTPUT