allow linking selected libraries statically. This can reduce certain runtime dependencies.

This commit is contained in:
Glenn Maynard
2007-05-13 18:43:25 +00:00
parent 1a1551bfc1
commit 79b3de00f5
3 changed files with 39 additions and 5 deletions
+11 -2
View File
@@ -1,9 +1,16 @@
AC_DEFUN([SM_AUDIO], [
AC_REQUIRE([SM_STATIC])
AC_ARG_WITH(vorbis, AS_HELP_STRING([--without-vorbis],[Disable Vorbis support]), with_vorbis=$withval, with_vorbis=yes)
# This is used to force the integer decoder, on systems that prefer it.
AC_ARG_WITH(integer-vorbis, AS_HELP_STRING([--with-integer-vorbis],[Integer vorbis decoding only]), with_int_vorbis=$withval, with_int_vorbis=no)
AC_ARG_WITH(static-vorbis, AS_HELP_STRING([--with-static-vorbis],[Statically link vorbis libraries]), with_static_vorbis=$withval, with_static_vorbis=no)
if test "$with_static_vorbis" = "yes"; then
LIB_PRE=$START_STATIC
LIB_POST=$END_STATIC
fi
have_vorbis=no
if test "$with_vorbis" = "yes" -a "$with_int_vorbis" = "no"; then
@@ -12,7 +19,7 @@ if test "$with_vorbis" = "yes" -a "$with_int_vorbis" = "no"; then
AC_CHECK_LIB(vorbisfile, ov_open, have_libvorbisfile=yes, have_libvorbisfile=no, [-lvorbis -logg])
if test "$have_libvorbis" = "yes" -a "$have_libogg" = "yes" -a "$have_libvorbisfile" = "yes"; then
have_vorbis=yes
AUDIO_LIBS="$AUDIO_LIBS -lvorbisfile -lvorbis -logg"
AUDIO_LIBS="$AUDIO_LIBS $LIB_PRE -lvorbisfile -lvorbis -logg $LIB_POST"
else
echo Not all vorbis libraries found.
fi
@@ -24,7 +31,7 @@ if test "$with_vorbis" = "yes" -a "$have_vorbis" = "no"; then
AC_CHECK_LIB(ivorbisfile, ov_open, have_libivorbisfile=yes, have_libivorbisfile=no)
if test "$have_libivorbisfile" = "yes"; then
have_vorbis=yes
AUDIO_LIBS="$AUDIO_LIBS -livorbisfile"
AUDIO_LIBS="$AUDIO_LIBS $LIB_PRE -livorbisfile $LIB_POST"
AC_DEFINE(INTEGER_VORBIS, 1, [Integer Vorbis decoding])
fi
fi
@@ -40,6 +47,8 @@ the "--without-vorbis" flag to configure.])
AC_DEFINE(NO_VORBIS_SUPPORT, 1, [Vorbis support not available])
fi
LIB_PRE=
LIB_POST=
AM_CONDITIONAL(HAVE_VORBIS, test "$have_vorbis" = "yes" )
+11 -1
View File
@@ -1,7 +1,14 @@
AC_DEFUN([SM_ZLIB],
[
AC_REQUIRE([SM_STATIC])
AC_CHECK_LIB(z, inflate, have_libz=yes, have_libz=no)
AC_CHECK_HEADER(zlib.h, have_libz_header=yes, have_libz_header=no)
AC_ARG_WITH(static-zlib, AS_HELP_STRING([--with-static-zlib],[Statically link zlib]), with_static_zlib=$withval, with_static_zlib=no)
if test "$with_static_zlib" = "yes"; then
LIB_PRE=$START_STATIC
LIB_POST=$END_STATIC
fi
if test "$have_libz_header" = "no"; then
have_libz=no
@@ -13,6 +20,9 @@ AC_DEFUN([SM_ZLIB],
exit 0;
fi
LIBS="$LIBS -lz"
LIBS="$LIBS $LIB_PRE -lz $LIB_POST"
LIB_PRE=
LIB_POST=
])
+17 -2
View File
@@ -124,18 +124,31 @@ fi
SM_X_WITH_OPENGL
have_libpng=yes
SM_STATIC
AC_CHECK_LIB(png, png_create_read_struct, [x=y], have_libpng=no, [-lz -lm]) # x=y to stop autoconf from messing with LIBS
AC_CHECK_HEADER(png.h, , have_libpng=no)
AC_ARG_WITH(static-png, AS_HELP_STRING([--with-static-png],[Statically link libpng]), with_static_png=$withval, with_static_png=no)
if test "$with_static_png" = "yes"; then
LIB_PRE=$START_STATIC
LIB_POST=$END_STATIC
fi
if test "$have_libpng" = "no"; then
echo
echo "*** libpng is required to build StepMania; please make sure that"
echo "*** it is installed to continue the build process."
exit 1
fi
LIBS="$LIBS -lpng -lz -lm"
LIBS="$LIBS $LIB_PRE -lpng -lz -lm $LIB_POST"
LIB_PRE=
LIB_POST=
AC_ARG_WITH(jpeg, AS_HELP_STRING([--without-jpeg],[Disable JPEG support]), with_jpeg=$withval, with_jpeg=yes)
AC_ARG_WITH(static-jpeg, AS_HELP_STRING([--with-static-jpeg],[Statically link libjpeg]), with_static_jpeg=$withval, with_static_jpeg=no)
if test "$with_static_png" = "yes"; then
LIB_PRE=$START_STATIC
LIB_POST=$END_STATIC
fi
if test "$with_jpeg" = "yes"; then
have_libjpeg=yes
AC_CHECK_LIB(jpeg, jpeg_read_scanlines, [x=y], have_libjpeg=no) # x=y to stop autoconf from messing with LIBS
@@ -151,10 +164,12 @@ support, pass the "--without-jpeg" flag to configure.])
fi
have_libjpeg=
LIBS="$LIBS -ljpeg"
LIBS="$LIBS $LIB_PRE -ljpeg $LIB_POST"
else
AC_DEFINE(NO_JPEG_SUPPORT, 1, [JPEG support not available])
fi
LIB_PRE=
LIB_POST=
AC_ARG_WITH(network, AS_HELP_STRING([--without-network],[Disable networking]), with_network=$withval, with_network=yes)
if test "$with_network" = "no"; then