Commit aaae7f1e authored by Diego Elio Pettenò's avatar Diego Elio Pettenò Committed by Jean-Baptiste Kempf

build: cleanup configure

This includes a new way to identify the dlopen library and dvdcss
(based on pkg-config) and dropping a bunch of unused tests.
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 9991d172
AM_CPPFLAGS = -I$(top_srcdir)/src
AM_CPPFLAGS = -I$(top_srcdir)/src $(CSS_CFLAGS)
EXTRA_DIST = \
README \
......@@ -22,7 +22,7 @@ libdvdread_la_SOURCES = \
src/nav_print.c \
src/nav_read.c
libdvdread_la_LIBADD = $(DYNAMIC_LD_LIBS) $(CSS_LIBS)
libdvdread_la_LIBADD = $(CSS_LIBS)
libdvdread_la_LDFLAGS = -version-info $(DVDREAD_LT_CURRENT):$(DVDREAD_LT_REVISION):$(DVDREAD_LT_AGE) \
-export-symbols-regex "(^dvd.*|^nav.*|^ifo.*|^DVD.*|^UDF.*)"
......
dnl --------------------------------------------------------------
dnl Configure.ac for libdvdread
dnl --------------------------------------------------------------
dnl --------------------------------------------------------------
dnl Require autoconf version 2.53
dnl --------------------------------------------------------------
AC_PREREQ([2.53])
dnl --------------------------------------------------------------
......@@ -19,7 +12,7 @@ m4_define([dvdread_pre], [])
AC_INIT([libdvdread], [dvdread_major.dvdread_minor.dvdread_sub[]dvdread_pre])
AC_CONFIG_SRCDIR([src/dvdread/dvd_reader.h])
AM_INIT_AUTOMAKE([1.6])
AM_INIT_AUTOMAKE([1.6 foreign])
dnl create a config.h file (Automake will add -DHAVE_CONFIG_H)
AC_CONFIG_HEADERS([config.h])
......@@ -67,66 +60,20 @@ AC_SUBST(DVDREAD_LT_CURRENT)
AC_SUBST(DVDREAD_LT_AGE)
AC_SUBST(DVDREAD_LT_REVISION)
dnl --------------------------------------------------------------
dnl Checks for programs.
dnl --------------------------------------------------------------
dnl Save CFLAGS, AC_ISC_POSIX set some unwanted default CFLAGS
saved_CFLAGS="$CFLAGS"
AC_ISC_POSIX
CFLAGS="$saved_CFLAGS"
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_LN_S
dnl --------------------------------------------------------------
dnl Libtool
dnl --------------------------------------------------------------
dnl LT_PREREQ only available in libtool-2.2+
dnl LT_PREREQ([1.4.0])
AC_LIBTOOL_DLOPEN
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then
STATIC="-static"
else
STATIC=
fi
AC_SUBST(STATIC)
LT_INIT
dnl --------------------------------------------------------------
dnl Checks for header files.
dnl --------------------------------------------------------------
AC_HEADER_STDC
AC_CHECK_HEADER(unistd.h)
AC_CHECK_HEADER(string.h)
AC_CHECK_HEADERS_ONCE([sys/param.h limits.h dlfcn.h])
dnl --------------------------------------------------------------
dnl Checks for typedefs, structures, and compiler characteristics.
dnl --------------------------------------------------------------
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
dnl AC_CHECK_TYPES([ptrdiff_t])
AC_SYS_LARGEFILE
AC_C_BIGENDIAN
dnl -------------------------------------------------------------
dnl Check for basic *nix fonction that we may emulate on windows.
dnl -------------------------------------------------------------
case $host in
*mingw32* | *cygwin*)
AC_CHECK_FUNCS(gettimeofday)
;;
*)
;;
esac
AS_CASE([$host],
[*mingw32* | *cygwin*], [AC_CHECK_FUNCS(gettimeofday)])
dnl ---------------------------------------------
dnl dynamic linker
dnl ---------------------------------------------
AC_ARG_ENABLE([libdvdcss], [ --enable-libdvdcss force linking against libdvdcss])
AC_ARG_WITH([libdvdcss],
AS_HELP_STRING([--with-libdvdcss], [Link directly against libdvdcss @<:@default=no@:>@]))
AC_ARG_ENABLE([dlfcn],
[AS_HELP_STRING([--enable-dlfcn],
......@@ -134,63 +81,22 @@ AC_ARG_ENABLE([dlfcn],
[use_builtin_dlfcn=$enableval],
[use_builtin_dlfcn=no])
if [[ $use_builtin_dlfcn = "yes" ]]; then
AC_DEFINE([USING_BUILTIN_DLFCN], [1], ["Define to 1 to use builtin dlfcn"])
fi
CSS_LIBS=""
if test x"$enable_libdvdcss" != xyes; then
dnl dlopen libdvdcss
case $host in
*mingw32*)
if [[ $use_builtin_dlfcn = "no" ]]; then
AC_CHECK_LIB(c, dlopen,
DYNAMIC_LD_LIBS="",
AC_CHECK_LIB(dl, dlopen,
DYNAMIC_LD_LIBS="-ldl",
AC_MSG_WARN(Using builtin dlopen)))
AC_SUBST(DYNAMIC_LD_LIBS)
fi
LDFLAGS="-no-undefined $LDFLAGS"
;;
*cygwin*)
LDFLAGS="-no-undefined $LDFLAGS"
;;
*os2*)
LDFLAGS="-no-undefined -Zbin-files $LDFLAGS"
;;
*)
AC_CHECK_LIB(c, dlopen,
DYNAMIC_LD_LIBS="",
AC_CHECK_LIB(dl, dlopen,
DYNAMIC_LD_LIBS="-ldl",
AC_MSG_ERROR(dynamic linker needed)))
AC_SUBST(DYNAMIC_LD_LIBS)
;;
esac
else
dnl link with libdvdcss
CSS_LIBS=-ldvdcss
case "${host}" in
*darwin*) CSS_LIBS="${CSS_LIBS} -Wl,-framework,CoreFoundation -Wl,-framework,IOKit"
;;
esac
AC_CHECK_LIB(dvdcss, dvdcss_interface_2,, AC_MSG_ERROR(You need libdvdcss.so.2 or later), ${CSS_LIBS})
AC_CHECK_HEADERS(dvdcss/dvdcss.h,, AC_MSG_ERROR(You need libdvdcss (dvdcss.h)))
fi
AC_SUBST(CSS_LIBS)
dnl ---------------------------------------------
dnl cflags
dnl ---------------------------------------------
dnl Common cflags for all platforms
CFLAGS="-O3 -Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE $CFLAGS"
DEBUG_CFLAGS="-g -DDEBUG $CFLAGS"
AC_SUBST(DEBUG_CFLAGS)
AS_IF([test x"$with_libdvdcss" = "xyes"], [
CSS_REQUIRES="libdvdcss >= 1.2"
PKG_CHECK_MODULES([CSS], [$CSS_REQUIRES])
], [
AS_CASE([$host],
[*mingw32*], [],
[use_builtin_dlfcn=no])
AS_IF([test $use_builtin_dlfcn = "yes"], [
AC_DEFINE([USING_BUILTIN_DLFCN], [1], ["Define to 1 to use builtin dlfcn"])
], [
AC_SEARCH_LIBS([dlopen], [dl])
])
])
AC_SUBST([CSS_REQUIRES])
dnl ---------------------------------------------
dnl Check for doxygen (dynamic documentation generator)
dnl ---------------------------------------------
......
......@@ -7,6 +7,7 @@ Name: libdvdread
Description: Low level DVD access library
Version: @VERSION@
Requires.private: @CSS_REQUIRES@
Cflags: -I${includedir}
Libs: -L${libdir} -ldvdread
Libs.private: @CSS_LIBS@
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment