2002-05-10 11:16:38 +02:00
|
|
|
# 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=0
|
|
|
|
MINOR_VERSION=1
|
2002-07-10 09:22:41 +02:00
|
|
|
MICRO_VERSION=7
|
2002-05-10 11:16:38 +02:00
|
|
|
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
|
2002-06-28 07:01:41 +02:00
|
|
|
AC_CANONICAL_BUILD
|
2002-05-10 11:16:38 +02:00
|
|
|
AC_CANONICAL_HOST
|
|
|
|
AC_CANONICAL_TARGET
|
|
|
|
|
|
|
|
dnl Setup for automake
|
|
|
|
AM_CONFIG_HEADER(config.h)
|
|
|
|
AM_INIT_AUTOMAKE(physfs, $VERSION)
|
|
|
|
|
|
|
|
|
|
|
|
dnl ---------------------------------------------------------------------
|
|
|
|
dnl Compilers and other tools
|
|
|
|
dnl ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
AC_PROG_CC
|
2002-05-24 11:44:38 +02:00
|
|
|
AC_PROG_CXX
|
2002-05-10 11:16:38 +02:00
|
|
|
AC_PROG_INSTALL
|
|
|
|
AC_PROG_LN_S
|
2002-06-15 12:25:52 +02:00
|
|
|
AC_LIBTOOL_WIN32_DLL
|
2002-06-28 07:59:14 +02:00
|
|
|
LIBTOOL="libtool"
|
|
|
|
AM_PROG_LIBTOOL
|
2002-06-28 07:01:41 +02:00
|
|
|
AC_CHECK_PROG(we_have_sed, sed, yes, no)
|
2002-05-10 11:16:38 +02:00
|
|
|
|
|
|
|
dnl ---------------------------------------------------------------------
|
|
|
|
dnl Debug mode?
|
|
|
|
dnl ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(debug,
|
2002-05-10 11:28:25 +02:00
|
|
|
[ --enable-debug enable debug mode [default=yes]],
|
|
|
|
, enable_debug=yes)
|
2002-05-10 11:16:38 +02:00
|
|
|
if test x$enable_debug = xyes; then
|
|
|
|
if test x$ac_cv_prog_cc_g = xyes; then
|
|
|
|
CFLAGS="-g -O0"
|
|
|
|
else
|
|
|
|
CFLAGS="-O0"
|
|
|
|
fi
|
2002-06-02 05:50:16 +02:00
|
|
|
CFLAGS="$CFLAGS -Werror -Wall"
|
2002-07-11 10:46:30 +02:00
|
|
|
AC_DEFINE([DEBUG], 1, [define if debug build is enabled])
|
|
|
|
AC_DEFINE([DEBUG_CHATTER], 1, [define if debug chatter is enabled])
|
2002-05-10 11:16:38 +02:00
|
|
|
else
|
|
|
|
CFLAGS="-O2"
|
2002-07-11 10:46:30 +02:00
|
|
|
AC_DEFINE([NDEBUG], 1, [define if debug build is disabled])
|
2002-05-10 11:16:38 +02:00
|
|
|
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
|
2002-07-11 10:46:30 +02:00
|
|
|
AC_DEFINE([PHYSFS_SUPPORTS_ZIP], 1, [define if zip support is enabled])
|
2002-05-10 11:16:38 +02:00
|
|
|
require_zlib="yes"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
dnl Check for zip 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
|
2002-07-11 10:46:30 +02:00
|
|
|
AC_DEFINE([PHYSFS_SUPPORTS_GRP], 1, [define if grp support is enabled])
|
2002-05-10 11:16:38 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
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])
|
|
|
|
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)
|
2002-05-16 04:45:09 +02:00
|
|
|
AC_CHECK_LIB(readline, readline, have_readline_lib=yes, , -lcurses)
|
2002-05-10 11:16:38 +02:00
|
|
|
AC_CHECK_HEADER(readline/history.h, have_history_hdr=yes)
|
2002-05-16 04:45:09 +02:00
|
|
|
AC_CHECK_LIB(readline, add_history, have_history_lib=yes, , -lcurses)
|
2002-05-10 11:16:38 +02:00
|
|
|
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
|
2002-07-11 10:46:30 +02:00
|
|
|
AC_DEFINE([PHYSFS_HAVE_READLINE], 1, [define if we have readline])
|
2002-05-16 04:45:09 +02:00
|
|
|
LIBS="$LIBS -lreadline -lcurses"
|
2002-05-10 11:16:38 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2002-07-25 07:24:23 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2002-07-25 08:00:12 +02:00
|
|
|
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
|
2002-07-25 07:24:23 +02:00
|
|
|
|
2002-07-25 08:00:12 +02:00
|
|
|
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
|
2002-07-25 07:24:23 +02:00
|
|
|
fi
|
2002-07-25 07:21:00 +02:00
|
|
|
|
2002-06-28 07:01:41 +02:00
|
|
|
dnl AC_CHECK_HEADER(be/kernel/OS.h, this_is_beos=yes)
|
|
|
|
AC_MSG_CHECKING([if this is BeOS])
|
|
|
|
if test x$build_os = xbeos; then
|
|
|
|
this_is_beos=yes
|
2002-05-24 11:44:38 +02:00
|
|
|
LIBS="$LIBS -lroot -lbe"
|
2002-06-28 07:01:41 +02:00
|
|
|
else
|
|
|
|
this_is_beos=no
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$this_is_beos])
|
|
|
|
|
2002-06-29 12:23:17 +02:00
|
|
|
AC_MSG_CHECKING([if this is Cygwin])
|
|
|
|
if test x$build_os = xcygwin; then
|
|
|
|
this_is_cygwin=yes
|
|
|
|
CFLAGS="$CFLAGS -DWIN32"
|
|
|
|
else
|
|
|
|
this_is_cygwin=no
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$this_is_cygwin])
|
|
|
|
|
2002-06-28 07:01:41 +02:00
|
|
|
this_is_macosx=no
|
|
|
|
if test x$we_have_sed = xyes; then
|
|
|
|
AC_MSG_CHECKING([if this is MacOS X])
|
|
|
|
x=`echo $build_os |sed "s/darwin.*/darwin/"`
|
|
|
|
if test x$x = xdarwin -a x$build_vendor = xapple; then
|
|
|
|
this_is_macosx=yes
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$this_is_macosx])
|
2002-05-24 11:44:38 +02:00
|
|
|
fi
|
2002-05-10 11:16:38 +02:00
|
|
|
|
2002-07-18 01:25:18 +02:00
|
|
|
this_is_freebsd=no
|
|
|
|
if test x$we_have_sed = xyes; then
|
|
|
|
AC_MSG_CHECKING([if this is FreeBSD])
|
|
|
|
x=`echo $build_os |tr A-Z a-z |sed "s/.*freebsd.*/freebsd/"`
|
|
|
|
if test x$x = xfreebsd; then
|
|
|
|
this_is_freebsd=yes
|
2002-07-21 11:06:28 +02:00
|
|
|
LDFLAGS="$LDFLAGS -pthread"
|
2002-07-18 01:25:18 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$this_is_freebsd])
|
|
|
|
fi
|
|
|
|
|
2002-07-24 01:10:50 +02:00
|
|
|
this_is_openbsd=no
|
|
|
|
if test x$we_have_sed = xyes; then
|
|
|
|
AC_MSG_CHECKING([if this is OpenBSD])
|
|
|
|
x=`echo $build_os |tr A-Z a-z |sed "s/.*openbsd.*/openbsd/"`
|
|
|
|
if test x$x = xopenbsd; then
|
|
|
|
this_is_openbsd=yes
|
|
|
|
LDFLAGS="$LDFLAGS -pthread"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$this_is_openbsd])
|
|
|
|
fi
|
|
|
|
|
2002-07-25 07:21:00 +02:00
|
|
|
this_is_atheos=no
|
|
|
|
if test x$we_have_sed = xyes; then
|
|
|
|
AC_MSG_CHECKING([if this is AtheOS])
|
|
|
|
x=`echo $build_os |tr A-Z a-z |sed "s/.*atheos.*/atheos/"`
|
|
|
|
if test x$x = xatheos; then
|
|
|
|
this_is_atheos=yes
|
|
|
|
enable_cdrom=no
|
|
|
|
LDFLAGS="$LDFLAGS -lpthread"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$this_is_atheos])
|
|
|
|
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])
|
2002-07-25 08:00:12 +02:00
|
|
|
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([*** Is this what you really wanted?])
|
|
|
|
AC_MSG_WARN([***])
|
2002-07-25 07:21:00 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2002-05-10 11:16:38 +02:00
|
|
|
# Checks for header files.
|
|
|
|
AC_HEADER_STDC
|
|
|
|
AC_CHECK_HEADERS([stdlib.h string.h])
|
|
|
|
|
|
|
|
# Checks for typedefs, structures, and compiler characteristics.
|
2002-06-08 10:37:45 +02:00
|
|
|
dnl AC_C_CONST
|
|
|
|
dnl AC_TYPE_SIZE_T
|
2002-05-10 11:16:38 +02:00
|
|
|
|
|
|
|
# Checks for library functions.
|
|
|
|
|
|
|
|
# This is only in the bleeding edge autoconf distro...
|
|
|
|
#AC_FUNC_MALLOC
|
|
|
|
|
|
|
|
AC_FUNC_MEMCMP
|
|
|
|
AC_CHECK_FUNCS([memset strrchr])
|
|
|
|
|
2002-07-18 01:25:18 +02:00
|
|
|
CFLAGS="$CFLAGS -D_REENTRANT -D_THREAD_SAFE"
|
|
|
|
LDFLAGS="$LDFLAGS -no-undefined"
|
|
|
|
|
2002-05-10 11:16:38 +02:00
|
|
|
dnl Add Makefile conditionals
|
|
|
|
AM_CONDITIONAL(BUILD_ZLIB, test x$enable_internal_zlib = xyes)
|
|
|
|
AM_CONDITIONAL(BUILD_TEST_PHYSFS, test x$enable_testprog = xyes)
|
2002-06-28 07:01:41 +02:00
|
|
|
AM_CONDITIONAL(BUILD_MACOSX, test x$this_is_macosx = xyes)
|
2002-06-28 08:21:17 +02:00
|
|
|
AM_CONDITIONAL(BUILD_BEOS, test x$this_is_beos = xyes)
|
2002-06-29 12:23:17 +02:00
|
|
|
AM_CONDITIONAL(BUILD_CYGWIN, test x$this_is_cygwin = xyes)
|
2002-06-28 07:59:14 +02:00
|
|
|
|
2002-05-10 11:16:38 +02:00
|
|
|
AC_OUTPUT([
|
|
|
|
Makefile
|
2002-06-28 07:01:41 +02:00
|
|
|
archivers/Makefile
|
|
|
|
platform/Makefile
|
|
|
|
zlib114/Makefile
|
|
|
|
test/Makefile
|
|
|
|
extras/Makefile
|
2002-05-10 11:16:38 +02:00
|
|
|
])
|
2002-05-24 05:39:05 +02:00
|
|
|
|
2002-06-28 07:01:41 +02:00
|
|
|
dnl end of configure.in ...
|
|
|
|
|