/
configure.in
557 lines (462 loc) · 16.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Process this file with autoconf to produce a configure script.
AC_INIT(physfs.c)
dnl ---------------------------------------------------------------------
dnl System/version info
dnl ---------------------------------------------------------------------
# Making releases:
# MICRO_VERSION += 1;
# INTERFACE_AGE += 1;
# BINARY_AGE += 1;
# if any functions have been added, set INTERFACE_AGE to 0.
# if backwards compatibility has been broken,
# set BINARY_AGE and INTERFACE_AGE to 0.
16
17
18
MAJOR_VERSION=1
MINOR_VERSION=0
MICRO_VERSION=0
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
INTERFACE_AGE=0
BINARY_AGE=0
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
AC_SUBST(MAJOR_VERSION)
AC_SUBST(MINOR_VERSION)
AC_SUBST(MICRO_VERSION)
AC_SUBST(INTERFACE_AGE)
AC_SUBST(BINARY_AGE)
AC_SUBST(VERSION)
# libtool versioning
LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
LT_REVISION=$INTERFACE_AGE
LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
dnl Detect the canonical host and target build environment
42
AC_CANONICAL_SYSTEM
43
44
45
46
47
48
49
50
51
52
53
dnl Setup for automake
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(physfs, $VERSION)
dnl ---------------------------------------------------------------------
dnl Compilers and other tools
dnl ---------------------------------------------------------------------
AC_PROG_CC
54
AC_PROG_CXX
55
56
AC_PROG_INSTALL
AC_PROG_LN_S
57
AC_LIBTOOL_WIN32_DLL
58
59
LIBTOOL="libtool"
AM_PROG_LIBTOOL
60
AC_CHECK_PROG(we_have_sed, sed, yes, no)
61
62
63
64
65
66
dnl ---------------------------------------------------------------------
dnl Debug mode?
dnl ---------------------------------------------------------------------
AC_ARG_ENABLE(debug,
67
[ --enable-debug enable debug mode [default=no]],
68
, enable_debug=no)
69
70
if test x$enable_debug = xyes; then
if test x$ac_cv_prog_cc_g = xyes; then
71
PHYSFSCFLAGS="-g -O0"
72
else
73
PHYSFSCFLAGS="-O0"
74
fi
75
PHYSFSCFLAGS="$PHYSFSCFLAGS -Werror -Wall"
76
77
AC_DEFINE([DEBUG], 1, [define if debug build is enabled])
AC_DEFINE([DEBUG_CHATTER], 1, [define if debug chatter is enabled])
78
else
79
PHYSFSCFLAGS="-O2"
80
AC_DEFINE([NDEBUG], 1, [define if debug build is disabled])
81
82
83
fi
84
85
86
87
88
89
90
91
92
93
94
95
dnl ---------------------------------------------------------------------
dnl Profile sorts, etc?
dnl ---------------------------------------------------------------------
AC_ARG_ENABLE(profiling,
[ --enable-profiling do algorithm profiling [default=no]],
, enable_profiling=no)
if test x$enable_profiling = xyes; then
AC_DEFINE([PHYSFS_PROFILING], 1, [define to profile sorting, etc algorithms])
fi
96
97
98
99
100
101
dnl ---------------------------------------------------------------------
dnl Build test program?
dnl ---------------------------------------------------------------------
AC_ARG_ENABLE(testprog,
[ --enable-testprog build test program [default=yes]],
102
, enable_testprog=yes)
103
104
105
106
107
108
109
110
111
112
dnl ---------------------------------------------------------------------
dnl Checks for libraries.
dnl ---------------------------------------------------------------------
require_zlib="no"
dnl Check for zip archiver inclusion...
AC_ARG_ENABLE(zip,
[ --enable-zip enable ZIP support [default=yes]],
113
, enable_zip=yes)
114
if test x$enable_zip = xyes; then
115
AC_DEFINE([PHYSFS_SUPPORTS_ZIP], 1, [define if zip support is enabled])
116
117
118
119
require_zlib="yes"
fi
120
dnl Check for grp archiver inclusion...
121
122
AC_ARG_ENABLE(grp,
[ --enable-grp enable Build Engine GRP support [default=yes]],
123
, enable_grp=yes)
124
if test x$enable_grp = xyes; then
125
AC_DEFINE([PHYSFS_SUPPORTS_GRP], 1, [define if grp support is enabled])
126
127
fi
128
129
130
131
132
133
134
dnl Check for wad archiver inclusion...
AC_ARG_ENABLE(wad,
[ --enable-wad enable Doom WAD support [default=yes]],
, enable_wad=yes)
if test x$enable_wad = xyes; then
AC_DEFINE([PHYSFS_SUPPORTS_WAD], 1, [define if wad support is enabled])
fi
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
dnl Check for hog archiver inclusion...
AC_ARG_ENABLE(hog,
[ --enable-hog enable Descent I/II HOG support [default=yes]],
, enable_hog=yes)
if test x$enable_hog = xyes; then
AC_DEFINE([PHYSFS_SUPPORTS_HOG], 1, [define if hog support is enabled])
fi
dnl Check for mvl archiver inclusion...
AC_ARG_ENABLE(mvl,
[ --enable-mvl enable Descent II MVL support [default=yes]],
, enable_mvl=yes)
if test x$enable_mvl = xyes; then
AC_DEFINE([PHYSFS_SUPPORTS_MVL], 1, [define if mvl support is enabled])
fi
154
155
156
dnl Check for qpak archiver inclusion...
AC_ARG_ENABLE(qpak,
[ --enable-qpak enable Quake PAK support [default=yes]],
157
, enable_qpak=yes)
158
159
160
161
if test x$enable_qpak = xyes; then
AC_DEFINE([PHYSFS_SUPPORTS_QPAK], 1, [define if qpak support is enabled])
fi
162
163
164
165
166
167
168
169
170
dnl Check for mix archiver inclusion...
AC_ARG_ENABLE(mix,
[ --enable-mix enable Westwood MIX support [default=no]],
, enable_mix=no)
if test x$enable_mix = xyes; then
AC_DEFINE([PHYSFS_SUPPORTS_MIX], 1, [define if mix support is enabled])
fi
171
dnl Check if we should statically link the included zlib...
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
AC_ARG_ENABLE(internal-zlib,
[ --enable-internal-zlib use included zlib [default=only if needed]],
, enable_internal_zlib=maybe)
dnl Check for zlib if needed.
have_external_zlib="no"
if test x$enable_internal_zlib != xyes; then
if test x$require_zlib = xyes; then
AC_CHECK_HEADER(zlib.h, have_zlib_hdr=yes)
AC_CHECK_LIB(z, zlibVersion, have_zlib_lib=yes)
if test x$have_zlib_hdr = xyes -a x$have_zlib_lib = xyes; then
have_external_zlib="yes"
fi
fi
fi
AC_MSG_CHECKING([what zlib to use])
dnl no zlib is needed at all if we aren't supporting ZIP files.
if test x$require_zlib = xno; then
enable_internal_zlib="no"
enable_external_zlib="no"
AC_MSG_RESULT([no zlib needed])
else
if test x$enable_internal_zlib = xmaybe; then
if test x$have_external_zlib = xyes; then
enable_internal_zlib="no"
enable_external_zlib="yes"
else
enable_internal_zlib="yes"
enable_external_zlib="no"
fi
else
if test x$enable_internal_zlib = xno -a x$have_external_zlib = xyes; then
enable_internal_zlib="no"
enable_external_zlib="yes"
fi
fi
if test x$enable_internal_zlib = xyes; then
AC_MSG_RESULT([internal zlib])
214
PHYSFSCFLAGS="$PHYSFSCFLAGS -DZ_PREFIX"
215
216
217
218
219
220
221
222
223
224
225
226
227
228
else
if test x$enable_external_zlib = xyes; then
AC_MSG_RESULT([external zlib])
LIBS="$LIBS -lz"
else
AC_MSG_ERROR([Need zlib, but you disabled our copy and have no system lib])
fi
fi
fi
dnl determine if we should include readline support...
AC_ARG_ENABLE(readline,
[ --enable-readline use GNU readline in test program [default=yes]],
229
230
, enable_readline=yes)
231
232
if test x$enable_readline = xyes; then
AC_CHECK_HEADER(readline/readline.h, have_readline_hdr=yes)
233
AC_CHECK_LIB(readline, readline, have_readline_lib=yes, , -lcurses)
234
AC_CHECK_HEADER(readline/history.h, have_history_hdr=yes)
235
AC_CHECK_LIB(readline, add_history, have_history_lib=yes, , -lcurses)
236
237
if test x$have_readline_hdr = xyes -a x$have_readline_lib = xyes; then
if test x$have_history_hdr = xyes -a x$have_history_lib = xyes; then
238
AC_DEFINE([PHYSFS_HAVE_READLINE], 1, [define if we have readline])
239
have_readline="yes"
240
241
242
243
fi
fi
fi
244
245
246
247
248
249
250
251
dnl !!! FIXME: Not sure how to detect this...
dnl check for 64-bit llseek()...
dnl AC_CHECK_LIB(c, llseek, have_llseek=yes)
if test x$have_llseek = xyes; then
AC_DEFINE([PHYSFS_HAVE_LLSEEK], 1, [define if we have llseek])
fi
252
253
254
dnl determine if we should use the stubbed pthread code.
AC_ARG_ENABLE(pthreads,
[ --enable-pthreads include POSIX threads support [default=yes]],
255
, enable_pthreads=yes)
256
257
258
259
260
261
262
if test x$enable_pthreads = xyes; then
AC_CHECK_HEADER(pthread.h, have_pthread_hdr=yes)
if test x$have_pthread_hdr != xyes; then
enable_pthreads=no
fi
fi
263
264
265
dnl determine if we should use the stubbed CD-ROM detection code.
AC_ARG_ENABLE(cdrom,
[ --enable-cdrom include CD-ROM support [default=yes]],
266
267
, enable_cdrom=yes)
268
269
270
271
272
273
274
275
276
277
278
if test x$enable_cdrom = xyes; then
dnl reset this and let header detection reenable...
enable_cdrom=no
dnl BSD systems use sys/ucred.h for getting mounted volumes.
dnl Linux and others use mntent.h.
AC_CHECK_HEADER(sys/ucred.h, have_ucred_hdr=yes)
if test x$have_ucred_hdr = xyes; then
AC_DEFINE([PHYSFS_HAVE_SYS_UCRED_H], 1, [define if we have sys/ucred.h])
enable_cdrom=yes
fi
279
280
281
282
283
284
AC_CHECK_HEADER(mntent.h, have_mntent_hdr=yes)
if test x$have_mntent_hdr = xyes; then
AC_DEFINE([PHYSFS_HAVE_MNTENT_H], 1, [define if we have mntent.h])
enable_cdrom=yes
fi
285
fi
286
287
288
dnl determine language.
AC_ARG_ENABLE(language,
289
[ --enable-language=lang Select natural language. [default=english]],
290
physfslang=`echo $enable_language |tr A-Z a-z`, physfslang=english)
291
292
293
AC_MSG_CHECKING([if language choice is supported])
physfs_valid_lang=no
294
295
296
297
298
299
if test x$physfslang = xenglish; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_ENGLISH, [define desired natural language])
fi
300
301
302
303
304
if test x$physfslang = xgerman; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_GERMAN, [define desired natural language])
fi
305
306
307
308
309
if test x$physfslang = xfrench; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_FRENCH, [define desired natural language])
fi
310
311
312
313
314
if test x$physfslang = xspanish; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_SPANISH, [define desired natural language])
fi
315
if test x$physfslang = xportuguese-br; then
316
physfs_valid_lang=yes
317
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_PORTUGUESE_BR, [define desired natural language])
318
319
fi
320
if test x$physfslang = xrussian-koi8-r; then
321
physfs_valid_lang=yes
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_RUSSIAN_KOI8_R, [define desired natural language])
fi
if test x$physfslang = xrussian-cp1251; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_RUSSIAN_CP866, [define desired natural language])
fi
if test x$physfslang = xrussian-cp866; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_RUSSIAN_CP866, [define desired natural language])
fi
if test x$physfslang = xrussian-iso-8859-5; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_RUSSIAN_ISO_8859_5, [define desired natural language])
338
fi
339
340
341
342
343
344
if test x$physfslang = xportuguese-br; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_PORTUGUESE_BR, [define desired natural language])
fi
345
346
dnl Add other language checks here...
347
348
349
350
351
352
353
354
355
356
357
AC_MSG_RESULT([$physfs_valid_lang])
if test x$physfs_valid_lang = xno; then
AC_MSG_WARN([***])
AC_MSG_WARN([*** You've asked for "$physfslang" language support...])
AC_MSG_WARN([*** ...but we don't support that.])
AC_MSG_WARN([*** You could choose another language,])
AC_MSG_WARN([*** but is this what you REALLY wanted?])
AC_MSG_WARN([*** Please see the LANG section of physfs_internal.h])
AC_MSG_WARN([*** for info on writing a translation.])
AC_MSG_WARN([***])
358
359
AC_MSG_WARN([*** Currently known languages:])
AC_MSG_WARN([*** --enable-language=english])
360
AC_MSG_WARN([*** --enable-language=spanish])
361
362
AC_MSG_WARN([*** --enable-language=german])
AC_MSG_WARN([*** --enable-language=french])
363
364
AC_MSG_WARN([*** --enable-language=spanish])
AC_MSG_WARN([*** --enable-language=portuguese-br])
365
366
367
368
AC_MSG_WARN([*** --enable-language=russian-koi8-r])
AC_MSG_WARN([*** --enable-language=russian-cp1251])
AC_MSG_WARN([*** --enable-language=russian-cp866])
AC_MSG_WARN([*** --enable-language=russian-iso-8859-5])
369
AC_MSG_WARN([*** --enable-language=portuguese-br])
370
AC_MSG_WARN([***])
371
372
373
AC_MSG_ERROR([*** unsupported language. stop.])
fi
374
375
have_non_posix_threads=no
376
AC_MSG_CHECKING([if this is BeOS])
377
if test x$target_os = xbeos; then
378
this_is_beos=yes
379
have_non_posix_threads=yes
380
381
enable_cdrom=yes
enable_pthreads=no
382
LIBS="$LIBS -lroot -lbe"
383
384
385
386
387
388
else
this_is_beos=no
fi
AC_MSG_RESULT([$this_is_beos])
389
AC_MSG_CHECKING([if this is Cygwin])
390
if test x$target_os = xcygwin; then
391
this_is_cygwin=yes
392
PHYSFSCFLAGS="$PHYSFSCFLAGS -DWIN32"
393
enable_cdrom=yes
394
395
enable_pthreads=no
have_non_posix_threads=yes
396
397
398
399
400
else
this_is_cygwin=no
fi
AC_MSG_RESULT([$this_is_cygwin])
401
402
403
404
405
406
407
408
409
410
411
412
AC_MSG_CHECKING([if this is mingw])
if test x$target_os = xmingw32msvc; then
this_is_mingw=yes
PHYSFSCFLAGS="$PHYSFSCFLAGS -DWIN32"
enable_cdrom=yes
enable_pthreads=no
have_non_posix_threads=yes
else
this_is_mingw=no
fi
AC_MSG_RESULT([$this_is_mingw])
413
414
415
this_is_macosx=no
if test x$we_have_sed = xyes; then
AC_MSG_CHECKING([if this is MacOS X])
416
417
x=`echo $target_os |sed "s/darwin.*/darwin/"`
if test x$x = xdarwin -a x$target_vendor = xapple; then
418
this_is_macosx=yes
419
PHYSFSLDFLAGS="$PHYSFSLDFLAGS -Wl,-framework -Wl,Carbon -Wl,-framework -Wl,IOKit"
420
421
422
fi
AC_MSG_RESULT([$this_is_macosx])
423
fi
424
425
426
427
this_is_freebsd=no
if test x$we_have_sed = xyes; then
AC_MSG_CHECKING([if this is FreeBSD])
428
x=`echo $target_os |tr A-Z a-z |sed "s/.*freebsd.*/freebsd/"`
429
430
if test x$x = xfreebsd; then
this_is_freebsd=yes
431
PHYSFSLDFLAGS="$PHYSFSLDFLAGS -pthread"
432
433
434
435
436
fi
AC_MSG_RESULT([$this_is_freebsd])
fi
437
438
439
this_is_openbsd=no
if test x$we_have_sed = xyes; then
AC_MSG_CHECKING([if this is OpenBSD])
440
x=`echo $target_os |tr A-Z a-z |sed "s/.*openbsd.*/openbsd/"`
441
442
if test x$x = xopenbsd; then
this_is_openbsd=yes
443
PHYSFSLDFLAGS="$PHYSFSLDFLAGS -pthread"
444
445
446
447
448
fi
AC_MSG_RESULT([$this_is_openbsd])
fi
449
450
451
this_is_atheos=no
if test x$we_have_sed = xyes; then
AC_MSG_CHECKING([if this is AtheOS])
452
x=`echo $target_os |tr A-Z a-z |sed "s/.*atheos.*/atheos/"`
453
454
455
if test x$x = xatheos; then
this_is_atheos=yes
enable_cdrom=no
456
enable_pthreads=no
457
458
459
460
461
fi
AC_MSG_RESULT([$this_is_atheos])
fi
462
463
464
this_is_os2=no
if test x$we_have_sed = xyes; then
AC_MSG_CHECKING([if this is OS/2])
465
x=`echo $target_os |tr A-Z a-z |sed "s/.*os2.*/os2/"`
466
467
if test x$x = xos2; then
this_is_os2=yes
468
469
470
have_non_posix_threads=yes
enable_cdrom=yes
enable_pthreads=no
471
PHYSFSCFLAGS="$PHYSFSCFLAGS -DOS2"
472
473
474
475
476
fi
AC_MSG_RESULT([$this_is_os2])
fi
477
478
479
480
481
482
483
484
485
486
487
488
this_is_mint=no
if test x$we_have_sed = xyes; then
AC_MSG_CHECKING([if this is MiNT])
x=`echo $target_os |tr A-Z a-z |sed "s/.*mint.*/mint/"`
if test x$x = xmint; then
this_is_mint=yes
enable_cdrom=no
enable_pthreads=no
fi
AC_MSG_RESULT([$this_is_mint])
fi
489
490
491
492
493
dnl Some platform might disable this, so check this down here...
if test x$enable_cdrom != xyes; then
AC_DEFINE([PHYSFS_NO_CDROM_SUPPORT], 1, [define if we have no CD support])
494
495
AC_MSG_WARN([***])
AC_MSG_WARN([*** There is no CD-ROM support in this build!])
496
497
498
499
AC_MSG_WARN([*** PhysicsFS will just pretend there are no discs.])
AC_MSG_WARN([*** This may be fine, depending on how PhysicsFS is used,])
AC_MSG_WARN([*** but is this what you REALLY wanted?])
AC_MSG_WARN([*** (Maybe fix configure.in, or write a platform driver?)])
500
AC_MSG_WARN([***])
501
502
fi
503
504
505
506
507
508
509
510
511
512
513
514
515
if test x$enable_pthreads != xyes; then
AC_DEFINE([PHYSFS_NO_PTHREADS_SUPPORT], 1, [define if we have no POSIX threads support])
if test x$have_non_posix_threads != xyes; then
AC_MSG_WARN([***])
AC_MSG_WARN([*** There is no thread support in this build!])
AC_MSG_WARN([*** PhysicsFS will NOT be reentrant!])
AC_MSG_WARN([*** This may be fine, depending on how PhysicsFS is used,])
AC_MSG_WARN([*** but is this what you REALLY wanted?])
AC_MSG_WARN([*** (Maybe fix configure.in, or write a platform driver?)])
AC_MSG_WARN([***])
fi
fi
516
517
518
# Checks for header files.
AC_HEADER_STDC
519
AC_CHECK_HEADERS([stdlib.h string.h assert.h])
520
521
# Checks for typedefs, structures, and compiler characteristics.
522
523
dnl AC_C_CONST
dnl AC_TYPE_SIZE_T
524
525
526
527
528
529
530
531
532
# Checks for library functions.
# This is only in the bleeding edge autoconf distro...
#AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_CHECK_FUNCS([memset strrchr])
533
534
AC_CHECK_SIZEOF(int, 4)
535
CFLAGS="$PHYSFSCFLAGS $CFLAGS -D_REENTRANT -D_THREAD_SAFE"
536
LDFLAGS="$LDFLAGS $PHYSFSLDFLAGS -no-undefined"
537
538
539
540
dnl Add Makefile conditionals
AM_CONDITIONAL(BUILD_ZLIB, test x$enable_internal_zlib = xyes)
AM_CONDITIONAL(BUILD_TEST_PHYSFS, test x$enable_testprog = xyes)
541
AM_CONDITIONAL(BUILD_MACOSX, test x$this_is_macosx = xyes)
542
AM_CONDITIONAL(BUILD_BEOS, test x$this_is_beos = xyes)
543
AM_CONDITIONAL(BUILD_CYGWIN, test x$this_is_cygwin = xyes)
544
AM_CONDITIONAL(BUILD_READLINE, test x$have_readline = xyes)
545
546
547
AC_OUTPUT([
Makefile
548
549
archivers/Makefile
platform/Makefile
550
zlib122/Makefile
551
552
test/Makefile
extras/Makefile
553
physfs.spec
554
])
555
556
dnl end of configure.in ...