configure.ac 3.51 KB
Newer Older
Thomas Guillem's avatar
Thomas Guillem committed
1
AC_INIT(libdvdread, 5.0.3)
2
AC_CONFIG_SRCDIR([src/dvd_reader.c])
3

4
AC_PREREQ(2.53)
5 6
AC_CANONICAL_HOST

7 8 9 10 11 12
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip subdir-objects])
AM_MAINTAINER_MODE([enable])
dnl Enable silent rules only when available (automake 1.11 or later).
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

LT_INIT
13

14 15
AC_CONFIG_HEADER(config.h)
AC_CONFIG_MACRO_DIR([m4])
16

17
dnl The libtool version numbers (DVDREAD_LT_*); Don't even think about faking this!
18
dnl
19 20 21
dnl immediately before every release do:
dnl ===================================
dnl if (the interface is totally unchanged from previous release)
22
dnl    DVDREAD_LT_REVISION ++;
23
dnl else { /* interfaces have been added, removed or changed */
24 25
dnl    DVDREAD_LT_REVISION = 0;
dnl    DVDREAD_LT_CURRENT ++;
26 27 28 29 30
dnl    if (any interfaces have been _added_ since last release)
dnl       AGE ++;
dnl    if (any interfaces have been _removed_ or _incompatibly changed_)
dnl       AGE = 0;
dnl }
31
dnl
32
dnl If you want to know more about what you are doing, here are some details:
33 34
dnl  * DVDREAD_LT_CURRENT is the current API version
dnl  * DVDREAD_LT_REVISION is an internal revision number which is increased when the API
35
dnl    itself did not change
36
dnl  * DVDREAD_LT_AGE is the number of previous API versions still supported by this library
37 38 39
dnl  * libtool has its own numbering scheme, because local library numbering schemes
dnl    are platform dependent
dnl  * in Linux, the library will be named
Marcel Mol's avatar
Marcel Mol committed
40
dnl    libname.so.(DVDREAD_LT_CURRENT - DVDREAD_LT_AGE).DVDREAD_LT_REVISION.DVDREAD_LT_AGE
41

42 43 44
DVDREAD_LT_CURRENT=6
DVDREAD_LT_AGE=2
DVDREAD_LT_REVISION=0
45

Marcel Mol's avatar
Marcel Mol committed
46
AC_SUBST([DVDREAD_LTVERSION], [$DVDREAD_LT_CURRENT:$DVDREAD_LT_REVISION:$DVDREAD_LT_AGE])
47 48 49

AC_PROG_CC

50
AC_CHECK_HEADERS_ONCE([sys/param.h limits.h dlfcn.h])
51

52
AC_SYS_LARGEFILE
53 54
AC_C_BIGENDIAN

55 56
AS_CASE([$host],
  [*mingw32* | *cygwin*], [AC_CHECK_FUNCS(gettimeofday)])
57

58
AS_CASE([$host],
59
  [*-os2-*], LDFLAGS="-no-undefined -Zbin-files $LDFLAGS")
60

61 62
AC_ARG_WITH([libdvdcss],
  AS_HELP_STRING([--with-libdvdcss], [Link directly against libdvdcss @<:@default=no@:>@]))
63

64 65 66 67 68 69
AC_ARG_ENABLE([dlfcn],
  [AS_HELP_STRING([--enable-dlfcn],
  [use builtin dlfcn for mingw (default is auto)])],
  [use_builtin_dlfcn=$enableval],
  [use_builtin_dlfcn=no])

70 71 72
AS_IF([test x"$with_libdvdcss" = "xyes"], [
  CSS_REQUIRES="libdvdcss >= 1.2"
  PKG_CHECK_MODULES([CSS], [$CSS_REQUIRES])
73
  AC_CHECK_HEADERS(dvdcss/dvdcss.h,, AC_MSG_ERROR(You need libdvdcss (dvdcss.h)))
74 75 76 77 78 79 80 81 82 83 84 85
], [
  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])
86

87
CC_CHECK_CFLAGS_APPEND([-Wall -Wsign-compare -Wextra])
88 89


90
AC_ARG_ENABLE([apidoc],
91 92 93 94 95 96 97 98 99
  AS_HELP_STRING([--disable-apidoc], [Disable building (with Doxygen) and intalling API documentation @<:@default=auto@:@>]))

AC_PATH_PROG([DOXYGEN], [doxygen])

AS_IF([test "x$DOXYGEN" = "x"], [
  AS_IF([test "x$enable_apidoc" = "xyes"], [
    AC_MSG_ERROR([You need Doxygen to build API documentation])
  ])
])
100
AM_CONDITIONAL([APIDOC], [test "x$DOXYGEN" != "x" && test "x$enable_apidoc" = "xyes"])
101

102 103 104 105 106 107
AS_IF([test "x$ac_cv_c_compiler_gnu" = "xyes"], [
  AC_DEFINE([UNUSED], [__attribute__((unused))], [Unused parameter annotation])
], [
  AC_DEFINE([UNUSED], [], [Unused parameter annotation])
])

108 109 110 111
dnl ---------------------------------------------
dnl Output configuration files
dnl ---------------------------------------------
AC_OUTPUT([
112
Makefile
113
doc/doxygen.cfg
114
misc/dvdread.pc
115
])