-
Notifications
You must be signed in to change notification settings - Fork 21
/
configure
executable file
·305 lines (238 loc) · 8.37 KB
/
configure
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
#!/usr/bin/env bash
# dvdisaster: Additional error correction for optical media.
# Copyright (C) 2004-2018 Carsten Gnoerlich.
# Copyright (C) 2019-2021 The dvdisaster development team.
#
# Email: [email protected]
#
# This file is part of dvdisaster.
#
# dvdisaster is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# dvdisaster 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
# Load the shell functions needed for the rest of this script.
BASH_BASED_CONFIGURE=./scripts/bash-based-configure
BASH_BASED_CONFIGURE_OPTS="--buildtmp=$(pwd)/build $@"
REQUIRED_CFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -I. -pipe"
RECOMMENDED_CFLAGS="-O2 -fomit-frame-pointer -Wall -Wno-unknown-warning-option -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-format-zero-length -Wno-unused-but-set-variable"
DEBUG_CFLAGS="-ggdb -Wall"
if test -e $BASH_BASED_CONFIGURE; then
source $BASH_BASED_CONFIGURE $BASH_BASED_CONFIGURE_OPTS
else
echo "Could not find $BASH_BASED_CONFIGURE"
echo "You're probably not in the right directory."
exit 1
fi
# Set the package name and version
PACKAGE dvdisaster 0.79.10
DEFINE_INT PATCHLEVEL 3
DEFINE_STRING HAVE_UNSTABLE_RELEASE 1
DEFINE_STRING HOMEPAGE "https://dvdisaster.jcea.es"
# Check for some essential tools.
REQUIRE_GMAKE
if [[ $(uname) =~ Darwin ]]; then
REQUIRE_CLANG
else
REQUIRE_GCC
fi
# Find out and verify the basedir of the source installation,
# and where to install the binary.
GET_SRCDIR GNUmakefile.template
GET_PKGNAME
GET_PREFIX /usr/local
GET_BINDIR
GET_MANDIR
GET_DOCDIR
GET_DIR "$PKGNAME" docsub "Documentation sub"\
" put documentation into this subdirectory\n under \$DOCDIR "
GET_LOCALEDIR
GET_BUILDROOT
GET_BUILDTMP
PRINT_MESSAGE "\nDetermining build flavor:"
WITH_OPTION gui yes "[yes | no]"
# Remove the useless CLI console under windows
if [[ $(uname) =~ MINGW ]] && [ "$cfg_with_gui" == "yes" ]; then
CFG_LDFLAGS="$CFG_LDFLAGS -mwindows"
fi
# Look for required libraries
PRINT_MESSAGE "\nLooking for includes and libraries:"
REQUIRE_GLIB2 2 32 0
echo
if test "$cfg_with_gui" == "yes"; then
REQUIRE_GTK2 2 6 0 WITH_THREADS
fi
if ! CHECK_INCLUDE locale.h locale || ! CHECK_INCLUDE libintl.h intl ; then
echo " [previous test forces -with-nls=no]"
cfg_force_with_nls=no
fi
if CHECK_INCLUDE cpuid.h cpuid; then
CFG_HAVE_OPTIONS="$CFG_HAVE_OPTIONS -DHAVE_CPUID"
fi
CHECK_LIBRARY intl gettext intl
CHECK_LIBRARY cam cam_open_device cam
# Look for required functions
PRINT_MESSAGE "\nChecking for functions and symbols..."
CHECK_FUNCTION mmap
if ! CHECK_FUNCTION getopt_long ; then
if ! test -e src/getopt.h || ! test -e src/getopt.c ; then
echo " * getopt_long is missing. You can provide one by simply"
echo " * copying getopt.c, getopt1.c and getopt.h from the GNU"
echo " * C library into the src/ directory."
exit 1
fi
fi
if ! CHECK_FUNCTION gettext ; then
echo " [previous test forces -with-nls=no]"
cfg_force_with_nls=no
fi
CHECK_FUNCTION round
SAVE_CFLAGS=$CFG_CFLAGS
CFG_CFLAGS="$CFG_CFLAGS -D_LARGEFILE64_SOURCE"
CHECK_SYMBOL fcntl.h O_LARGEFILE
CFG_CFLAGS=$SAVE_CFLAGS
if [[ $(uname) =~ Darwin ]]; then
CFG_CFLAGS="$CFG_CFLAGS -Wno-void-pointer-to-int-cast"
CFG_LDFLAGS="$CFG_LDFLAGS -framework CoreFoundation -framework IOKit"
fi
# Machine specific
echo
CHECK_ENDIAN
CHECK_BITNESS
CHECK_SSE2
CHECK_ALTIVEC
# Look for required tools
PRINT_MESSAGE "\nChecking for additional tools..."
if ! EXECUTE_PROGRAM "xgettext --help" xgettext \
||! EXECUTE_PROGRAM "msgmerge --help" msgmerge \
||! EXECUTE_PROGRAM "msgfmt --help" msgfmt ; then
echo "* You need to install the GNU gettext tools"
echo "* for localization support."
echo " [previous test forces -with-nls=no]"
cfg_force_with_nls=no
fi
if test "$cfg_with_gui" == "yes"; then
if ! EXECUTE_PROGRAM "gdk-pixbuf-csource --help" gdk_pixbuf_csource ; then
echo "* gdk-pixbuf not installed"
echo "* or path to gdk-pixbuf-csource is missing."
exit 1
fi
fi
# Evaluate the --with* customization options
PRINT_MESSAGE "\nAdditional configuration options:"
WITH_OPTION nls yes "[yes | no]"
WITH_OPTION embedded-src-path yes "[yes | no]"
PRINT_MESSAGE "\nDebugging options (do not use in production system):"
WITH_OPTION memdebug no "[no | yes]"
WITH_OPTION debug-printf-format no "[no | yes]"
WITH_OPTION werror no "[no | yes]"
if test "$cfg_with_debug_printf_format" == "yes"; then
# don't use the binary compiled with this,
# it's only useful to properly get all the build-time
# warnings around printf-errors, that are otherwise
# not catched by the compiler because of the _() macro
DEFINE_STRING DEBUG_PRINTF_FORMAT 1
else
# warnings given by -Wformat-security are bogus because of _(),
# see above comment if you actually want to check for format errors
CFG_CFLAGS="$CFG_CFLAGS -Wno-format-security"
fi
if test "$cfg_with_werror" == "yes"; then
CFG_CFLAGS="$CFG_CFLAGS -Werror"
fi
if test "$cfg_with_efence" == "yes"; then
if ! CHECK_LIBRARY efence malloc efence; then
exit 1;
fi
fi
# -------------- end of manual configuration --------------------
# Do not proceed further if in --help mode
if test -n "$cfg_help_mode"; then
FINALIZE_HELP
exit 0
fi
# Fetch the source files and build the CFILES/OFILES list
PRINT_MESSAGE "\nCollecting source files:"
rm -f src/conftest.c src/method-link.c
cfiles="src/method-link.c"
ofiles="$BUILDTMP/method-link.o"
for cfile in src/*.c; do
cfile_prefix=`echo $cfile | sed -e 's/\.c//'`
cfiles="$cfiles $cfile"
ofiles="$ofiles $BUILDTMP/$(basename $cfile_prefix.o)"
echo -n " $cfile_prefix"
done
echo
echo -e "\nCFG_CFILES = $cfiles" >> Makefile.config
echo "CFG_OFILES = $ofiles" >> Makefile.config
if test "$cfg_with_gui" == "yes"; then
echo "ICONS = src/inlined-icons.h" >> Makefile.config
fi
# Create the method wrapper
PRINT_MESSAGE "\nCollecting methods:"
cat >> src/method-link.c <<EOF
/* Automatically generated wrapper for registering the methods */
void BindMethods(void)
{
EOF
for method in src/ecc-*.c; do
method_name=`echo $(basename $method) | sed -e 's/\.c//' -e 's/ecc-//'`
method_prefix="$method_prefix $method_name"
echo -n " $method_name"
done
for method in $method_prefix; do
echo " void register_${method}(void);" >> src/method-link.c
done
echo >> src/method-link.c
for method in $method_prefix; do
echo " register_${method}();" >> src/method-link.c
done
echo "}" >> src/method-link.c
echo
# Okay, hopefully we've got everything together now.
(cd locale; bash create-makefile)
CREATE_MAKEFILES GNUmakefile
# Okay, tell the user we're done and how to proceed.
echo
echo "Configuration is complete."
echo "Type 'make show' to verify the settings,"
echo "or enter 'make' to start the build immediately."
echo
if test -n "$CFLAGS"; then
echo "* Note that your \$CFLAGS=$CFLAGS"
echo "* have been included into the configuration."
echo "* It is recommended not to specify additional \$CFLAGS,"
echo "* but feel free to continue at your own risk."
echo
fi
if test -n "$LDFLAGS"; then
echo "* Note that your \$LDFLAGS=$LDFLAGS"
echo "* have been included into the configuration."
echo "* It is recommended not to specify additional \$LDFLAGS,"
echo "* but feel free to continue at your own risk."
echo
fi
if test -n "$BUILDROOT"; then
echo "* Note that installation will be done relative to"
echo "* \$BUILDROOT=$BUILDROOT."
echo "* This is okay if you want to create packages like rpm or"
echo "* debian archives."
echo "* Normal installs will be broken by setting --buildroot."
echo
fi
id_binary="id"
if test `$id_binary -u` -eq 0; then
echo "* WARNING: Compiling the project as ROOT USER is not recommended"
echo "* and may cause unexpected problems. If compilation fails"
echo "* please delete the source archive, unpack it anew and"
echo "* try again as ordinary user."
echo "* Installing the package as root is okay, of course."
fi