Skip to content

Commit

Permalink
Initial add.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed May 10, 2002
1 parent 44d4465 commit bd450d0
Show file tree
Hide file tree
Showing 7 changed files with 299 additions and 0 deletions.
33 changes: 33 additions & 0 deletions 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
8 changes: 8 additions & 0 deletions 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

14 changes: 14 additions & 0 deletions 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

12 changes: 12 additions & 0 deletions 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 ..."

215 changes: 215 additions & 0 deletions 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
])
7 changes: 7 additions & 0 deletions platform/Makefile.am
@@ -0,0 +1,7 @@
noinst_LTLIBRARIES = libplatform.la

INCLUDES = -I$(top_srcdir)

libplatform_la_SOURCES = \
unix.c

10 changes: 10 additions & 0 deletions 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

0 comments on commit bd450d0

Please sign in to comment.