| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557 |
- # 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.
- MAJOR_VERSION=1
- MINOR_VERSION=1
- MICRO_VERSION=0
- 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
- AC_CANONICAL_SYSTEM
- dnl Setup for automake
- AM_CONFIG_HEADER(config.h)
- AM_INIT_AUTOMAKE(physfs, $VERSION)
- dnl ---------------------------------------------------------------------
- dnl Compilers and other tools
- dnl ---------------------------------------------------------------------
- AC_PROG_CC
- AC_PROG_CXX
- AC_PROG_INSTALL
- AC_PROG_LN_S
- AC_LIBTOOL_WIN32_DLL
- LIBTOOL="libtool"
- AM_PROG_LIBTOOL
- AC_CHECK_PROG(we_have_sed, sed, yes, no)
- dnl ---------------------------------------------------------------------
- dnl Debug mode?
- dnl ---------------------------------------------------------------------
- AC_ARG_ENABLE(debug,
- [ --enable-debug enable debug mode [default=no]],
- , enable_debug=no)
- if test x$enable_debug = xyes; then
- if test x$ac_cv_prog_cc_g = xyes; then
- PHYSFSCFLAGS="-g -O0"
- else
- PHYSFSCFLAGS="-O0"
- fi
- PHYSFSCFLAGS="$PHYSFSCFLAGS -Werror -Wall"
- AC_DEFINE([DEBUG], 1, [define if debug build is enabled])
- AC_DEFINE([DEBUG_CHATTER], 1, [define if debug chatter is enabled])
- else
- PHYSFSCFLAGS="-O2"
- AC_DEFINE([NDEBUG], 1, [define if debug build is disabled])
- fi
- 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
- dnl ---------------------------------------------------------------------
- dnl Build test program?
- dnl ---------------------------------------------------------------------
- AC_ARG_ENABLE(testprog,
- [ --enable-testprog build test program [default=yes]],
- , enable_testprog=yes)
- 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]],
- , enable_zip=yes)
- if test x$enable_zip = xyes; then
- AC_DEFINE([PHYSFS_SUPPORTS_ZIP], 1, [define if zip support is enabled])
- require_zlib="yes"
- fi
- dnl Check for grp archiver inclusion...
- AC_ARG_ENABLE(grp,
- [ --enable-grp enable Build Engine GRP support [default=yes]],
- , enable_grp=yes)
- if test x$enable_grp = xyes; then
- AC_DEFINE([PHYSFS_SUPPORTS_GRP], 1, [define if grp support is enabled])
- fi
- 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
- 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
- dnl Check for qpak archiver inclusion...
- AC_ARG_ENABLE(qpak,
- [ --enable-qpak enable Quake PAK support [default=yes]],
- , enable_qpak=yes)
- if test x$enable_qpak = xyes; then
- AC_DEFINE([PHYSFS_SUPPORTS_QPAK], 1, [define if qpak support is enabled])
- fi
- 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
- dnl Check if we should statically link the included zlib...
- 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])
- PHYSFSCFLAGS="$PHYSFSCFLAGS -DZ_PREFIX"
- 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]],
- , enable_readline=yes)
- if test x$enable_readline = xyes; then
- AC_CHECK_HEADER(readline/readline.h, have_readline_hdr=yes)
- AC_CHECK_LIB(readline, readline, have_readline_lib=yes, , -lcurses)
- AC_CHECK_HEADER(readline/history.h, have_history_hdr=yes)
- AC_CHECK_LIB(readline, add_history, have_history_lib=yes, , -lcurses)
- 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
- AC_DEFINE([PHYSFS_HAVE_READLINE], 1, [define if we have readline])
- have_readline="yes"
- fi
- fi
- fi
- 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
- dnl determine if we should use the stubbed pthread code.
- AC_ARG_ENABLE(pthreads,
- [ --enable-pthreads include POSIX threads support [default=yes]],
- , enable_pthreads=yes)
- 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
- dnl determine if we should use the stubbed CD-ROM detection code.
- AC_ARG_ENABLE(cdrom,
- [ --enable-cdrom include CD-ROM support [default=yes]],
- , enable_cdrom=yes)
- 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
- 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
- fi
- dnl determine language.
- AC_ARG_ENABLE(language,
- [ --enable-language=lang Select natural language. [default=english]],
- physfslang=`echo $enable_language |tr A-Z a-z`, physfslang=english)
- AC_MSG_CHECKING([if language choice is supported])
- physfs_valid_lang=no
- if test x$physfslang = xenglish; then
- physfs_valid_lang=yes
- AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_ENGLISH, [define desired natural language])
- fi
- if test x$physfslang = xgerman; then
- physfs_valid_lang=yes
- AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_GERMAN, [define desired natural language])
- fi
- if test x$physfslang = xfrench; then
- physfs_valid_lang=yes
- AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_FRENCH, [define desired natural language])
- fi
- if test x$physfslang = xspanish; then
- physfs_valid_lang=yes
- AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_SPANISH, [define desired natural language])
- fi
- if test x$physfslang = xportuguese-br; then
- physfs_valid_lang=yes
- AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_PORTUGUESE_BR, [define desired natural language])
- fi
- if test x$physfslang = xrussian-koi8-r; then
- physfs_valid_lang=yes
- 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])
- fi
- if test x$physfslang = xportuguese-br; then
- physfs_valid_lang=yes
- AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_PORTUGUESE_BR, [define desired natural language])
- fi
- dnl Add other language checks here...
- 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([***])
- AC_MSG_WARN([*** Currently known languages:])
- AC_MSG_WARN([*** --enable-language=english])
- AC_MSG_WARN([*** --enable-language=spanish])
- AC_MSG_WARN([*** --enable-language=german])
- AC_MSG_WARN([*** --enable-language=french])
- AC_MSG_WARN([*** --enable-language=spanish])
- AC_MSG_WARN([*** --enable-language=portuguese-br])
- 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])
- AC_MSG_WARN([*** --enable-language=portuguese-br])
- AC_MSG_WARN([***])
- AC_MSG_ERROR([*** unsupported language. stop.])
- fi
- have_non_posix_threads=no
- AC_MSG_CHECKING([if this is BeOS])
- if test x$target_os = xbeos; then
- this_is_beos=yes
- have_non_posix_threads=yes
- enable_cdrom=yes
- enable_pthreads=no
- LIBS="$LIBS -lroot -lbe"
- else
- this_is_beos=no
- fi
- AC_MSG_RESULT([$this_is_beos])
- AC_MSG_CHECKING([if this is Cygwin])
- if test x$target_os = xcygwin; then
- this_is_cygwin=yes
- PHYSFSCFLAGS="$PHYSFSCFLAGS -DWIN32"
- enable_cdrom=yes
- enable_pthreads=no
- have_non_posix_threads=yes
- else
- this_is_cygwin=no
- fi
- AC_MSG_RESULT([$this_is_cygwin])
- 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])
- this_is_macosx=no
- if test x$we_have_sed = xyes; then
- AC_MSG_CHECKING([if this is MacOS X])
- x=`echo $target_os |sed "s/darwin.*/darwin/"`
- if test x$x = xdarwin -a x$target_vendor = xapple; then
- this_is_macosx=yes
- PHYSFSLDFLAGS="$PHYSFSLDFLAGS -Wl,-framework -Wl,Carbon -Wl,-framework -Wl,IOKit"
- fi
- AC_MSG_RESULT([$this_is_macosx])
- fi
- this_is_freebsd=no
- if test x$we_have_sed = xyes; then
- AC_MSG_CHECKING([if this is FreeBSD])
- x=`echo $target_os |tr A-Z a-z |sed "s/.*freebsd.*/freebsd/"`
- if test x$x = xfreebsd; then
- this_is_freebsd=yes
- PHYSFSLDFLAGS="$PHYSFSLDFLAGS -pthread"
- fi
- AC_MSG_RESULT([$this_is_freebsd])
- fi
- this_is_openbsd=no
- if test x$we_have_sed = xyes; then
- AC_MSG_CHECKING([if this is OpenBSD])
- x=`echo $target_os |tr A-Z a-z |sed "s/.*openbsd.*/openbsd/"`
- if test x$x = xopenbsd; then
- this_is_openbsd=yes
- PHYSFSLDFLAGS="$PHYSFSLDFLAGS -pthread"
- fi
- AC_MSG_RESULT([$this_is_openbsd])
- fi
- this_is_atheos=no
- if test x$we_have_sed = xyes; then
- AC_MSG_CHECKING([if this is AtheOS])
- x=`echo $target_os |tr A-Z a-z |sed "s/.*atheos.*/atheos/"`
- if test x$x = xatheos; then
- this_is_atheos=yes
- enable_cdrom=no
- enable_pthreads=no
- fi
- AC_MSG_RESULT([$this_is_atheos])
- fi
- this_is_os2=no
- if test x$we_have_sed = xyes; then
- AC_MSG_CHECKING([if this is OS/2])
- x=`echo $target_os |tr A-Z a-z |sed "s/.*os2.*/os2/"`
- if test x$x = xos2; then
- this_is_os2=yes
- have_non_posix_threads=yes
- enable_cdrom=yes
- enable_pthreads=no
- PHYSFSCFLAGS="$PHYSFSCFLAGS -DOS2"
- fi
- AC_MSG_RESULT([$this_is_os2])
- fi
- 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
- 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])
- AC_MSG_WARN([***])
- AC_MSG_WARN([*** There is no CD-ROM support in this build!])
- 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?)])
- AC_MSG_WARN([***])
- fi
- 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
- # Checks for header files.
- AC_HEADER_STDC
- AC_CHECK_HEADERS([stdlib.h string.h assert.h])
- # Checks for typedefs, structures, and compiler characteristics.
- dnl AC_C_CONST
- dnl AC_TYPE_SIZE_T
- # Checks for library functions.
- # This is only in the bleeding edge autoconf distro...
- #AC_FUNC_MALLOC
- AC_FUNC_MEMCMP
- AC_CHECK_FUNCS([memset strrchr])
- AC_CHECK_SIZEOF(int, 4)
- CFLAGS="$PHYSFSCFLAGS $CFLAGS -D_REENTRANT -D_THREAD_SAFE"
- LDFLAGS="$LDFLAGS $PHYSFSLDFLAGS -no-undefined"
- dnl Add Makefile conditionals
- AM_CONDITIONAL(BUILD_ZLIB, test x$enable_internal_zlib = xyes)
- AM_CONDITIONAL(BUILD_TEST_PHYSFS, test x$enable_testprog = xyes)
- AM_CONDITIONAL(BUILD_MACOSX, test x$this_is_macosx = xyes)
- AM_CONDITIONAL(BUILD_BEOS, test x$this_is_beos = xyes)
- AM_CONDITIONAL(BUILD_CYGWIN, test x$this_is_cygwin = xyes)
- AM_CONDITIONAL(BUILD_READLINE, test x$have_readline = xyes)
- AC_OUTPUT([
- Makefile
- archivers/Makefile
- platform/Makefile
- zlib123/Makefile
- test/Makefile
- extras/Makefile
- physfs.spec
- ])
- dnl end of configure.in ...
|