From bd450d0e6834e3f9331ef9115f2fcdb25b5d61e3 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 10 May 2002 09:16:38 +0000 Subject: [PATCH] Initial add. --- Makefile.am | 33 +++++++ acconfig.h | 8 ++ archivers/Makefile.am | 14 +++ bootstrap | 12 +++ configure.in | 215 ++++++++++++++++++++++++++++++++++++++++++ platform/Makefile.am | 7 ++ test/Makefile.am | 10 ++ 7 files changed, 299 insertions(+) create mode 100644 Makefile.am create mode 100644 acconfig.h create mode 100644 archivers/Makefile.am create mode 100755 bootstrap create mode 100644 configure.in create mode 100644 platform/Makefile.am create mode 100644 test/Makefile.am diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..d3d3bc54 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,33 @@ +lib_LTLIBRARIES = libphysfs.la + +SUBDIRS = platform archivers zlib114 . test + +libphysfsincludedir = $(includedir) +libphysfsinclude_HEADERS = \ + physfs.h + +libphysfs_la_SOURCES = \ + physfs.c \ + physfs_internal.h \ + physfs_byteorder.c + +if BUILD_ZLIB +ZLIB_LIB = zlib114/libz.la +else +ZLIB_LIB = +endif + +libphysfs_la_LDFLAGS = \ + -release $(LT_RELEASE) \ + -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) +libphysfs_la_LIBADD = \ + archivers/libarchivers.la \ + platform/libplatform.la \ + $(ZLIB_LIB) + +EXTRA_DIST = \ + CREDITS \ + LICENSE \ + CHANGELOG \ + INSTALL \ + TODO diff --git a/acconfig.h b/acconfig.h new file mode 100644 index 00000000..97b96f86 --- /dev/null +++ b/acconfig.h @@ -0,0 +1,8 @@ + +#undef DEBUG +#undef DEBUG_CHATTER +#undef NDEBUG +#undef PHYSFS_SUPPORTS_ZIP +#undef PHYSFS_SUPPORTS_GRP +#undef PHYSFS_HAVE_READLINE + diff --git a/archivers/Makefile.am b/archivers/Makefile.am new file mode 100644 index 00000000..0bb73403 --- /dev/null +++ b/archivers/Makefile.am @@ -0,0 +1,14 @@ +noinst_LTLIBRARIES = libarchivers.la + +if BUILD_ZLIB +INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/zlib114 +else +INCLUDES = -I$(top_srcdir) +endif + +libarchivers_la_SOURCES = \ + dir.c \ + grp.c \ + zip.c \ + unzip.c + diff --git a/bootstrap b/bootstrap new file mode 100755 index 00000000..fe543dd4 --- /dev/null +++ b/bootstrap @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e +echo "Initial preparation...this can take awhile, so sit tight..." +aclocal +libtoolize --automake --copy --force +autoheader +automake --foreign --add-missing --copy +autoconf + +echo "You are now ready to run ./configure ..." + diff --git a/configure.in b/configure.in new file mode 100644 index 00000000..92732b8c --- /dev/null +++ b/configure.in @@ -0,0 +1,215 @@ +# 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 +MICRO_VERSION=6 +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_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 +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_LIBTOOL + + +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 + CFLAGS="-g -O0" + else + CFLAGS="-O0" + fi + CFLAGS="$CFLAGS -Werror" + AC_DEFINE(DEBUG) + AC_DEFINE(DEBUG_CHATTER) +else + CFLAGS="-O2" + AC_DEFINE(NDEBUG) +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) + 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 + AC_DEFINE(PHYSFS_SUPPORTS_GRP) +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 !!! FIXME: separate checks for history and readline... + +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) + AC_CHECK_HEADER(readline/history.h, have_history_hdr=yes) + AC_CHECK_LIB(readline, add_history, have_history_lib=yes) + 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) + LIBS="$LIBS -lreadline" + fi + fi +fi + + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([stdlib.h string.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +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]) + +dnl Add Makefile conditionals +AM_CONDITIONAL(BUILD_ZLIB, test x$enable_internal_zlib = xyes) +AM_CONDITIONAL(BUILD_TEST_PHYSFS, test x$enable_testprog = xyes) + +AC_OUTPUT([ +Makefile +platform/Makefile +archivers/Makefile +test/Makefile +zlib114/Makefile +]) diff --git a/platform/Makefile.am b/platform/Makefile.am new file mode 100644 index 00000000..4d1e395a --- /dev/null +++ b/platform/Makefile.am @@ -0,0 +1,7 @@ +noinst_LTLIBRARIES = libplatform.la + +INCLUDES = -I$(top_srcdir) + +libplatform_la_SOURCES = \ + unix.c + diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 00000000..139a1c5b --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,10 @@ +if BUILD_TEST_PHYSFS + +bin_PROGRAMS = test_physfs + +INCLUDES = -I$(top_srcdir) + +test_physfs_LDADD = ../libphysfs.la +test_physfs_SOURCES = test_physfs.c + +endif