[libdvdnav-devel] build: cleanup configure
Diego Elio Pettenò
git at videolan.org
Mon Nov 18 12:37:22 CET 2013
libdvdread | branch: master | Diego Elio Pettenò <flameeyes at flameeyes.eu> | Wed Feb 6 10:34:19 2013 -0800| [aaae7f1e503610b2d8a286e2b911fac60d38098b] | committer: 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 <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/libdvdread.git/?a=commit;h=aaae7f1e503610b2d8a286e2b911fac60d38098b
---
Makefile.am | 4 +-
configure.ac | 142 +++++++++-------------------------------------------
misc/dvdread.pc.in | 3 +-
3 files changed, 28 insertions(+), 121 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index cea4c78..7294d7d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-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.*)"
diff --git a/configure.ac b/configure.ac
index 61eeb24..a7e2bed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,3 @@
-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 ---------------------------------------------
diff --git a/misc/dvdread.pc.in b/misc/dvdread.pc.in
index 46f0d73..2e8f66a 100644
--- a/misc/dvdread.pc.in
+++ b/misc/dvdread.pc.in
@@ -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@
More information about the libdvdnav-devel
mailing list