configure.ac 3.97 KB
Newer Older
1 2 3 4 5 6 7 8
dnl library version number
m4_define([dvdread_major], 5)
m4_define([dvdread_minor], 0)
m4_define([dvdread_micro], 3)
m4_define([dvdread_version],[dvdread_major.dvdread_minor.dvdread_micro])

AC_INIT(libdvdread, dvdread_version)

9
AC_CONFIG_SRCDIR([src/dvd_reader.c])
10

11
AC_PREREQ(2.53)
12 13
AC_CANONICAL_HOST

14 15 16 17 18 19
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
20

21 22
AC_CONFIG_HEADER(config.h)
AC_CONFIG_MACRO_DIR([m4])
23

24
dnl The libtool version numbers (DVDREAD_LT_*); Don't even think about faking this!
25
dnl
26 27 28
dnl immediately before every release do:
dnl ===================================
dnl if (the interface is totally unchanged from previous release)
29
dnl    DVDREAD_LT_REVISION ++;
30
dnl else { /* interfaces have been added, removed or changed */
31 32
dnl    DVDREAD_LT_REVISION = 0;
dnl    DVDREAD_LT_CURRENT ++;
33 34 35 36 37
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 }
38
dnl
39
dnl If you want to know more about what you are doing, here are some details:
40 41
dnl  * DVDREAD_LT_CURRENT is the current API version
dnl  * DVDREAD_LT_REVISION is an internal revision number which is increased when the API
42
dnl    itself did not change
43
dnl  * DVDREAD_LT_AGE is the number of previous API versions still supported by this library
44 45 46
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
47
dnl    libname.so.(DVDREAD_LT_CURRENT - DVDREAD_LT_AGE).DVDREAD_LT_REVISION.DVDREAD_LT_AGE
48

49 50 51
DVDREAD_LT_CURRENT=6
DVDREAD_LT_AGE=2
DVDREAD_LT_REVISION=0
52

Marcel Mol's avatar
Marcel Mol committed
53
AC_SUBST([DVDREAD_LTVERSION], [$DVDREAD_LT_CURRENT:$DVDREAD_LT_REVISION:$DVDREAD_LT_AGE])
54 55 56

AC_PROG_CC

57
AC_CHECK_HEADERS_ONCE([sys/param.h limits.h dlfcn.h])
58

59
AC_SYS_LARGEFILE
60 61
AC_C_BIGENDIAN

62 63
AS_CASE([$host],
  [*mingw32* | *cygwin*], [AC_CHECK_FUNCS(gettimeofday)])
64

65
AS_CASE([$host],
66
  [*-os2-*], LDFLAGS="-no-undefined -Zbin-files $LDFLAGS")
67

68 69
AC_ARG_WITH([libdvdcss],
  AS_HELP_STRING([--with-libdvdcss], [Link directly against libdvdcss @<:@default=no@:>@]))
70

71 72 73 74 75 76
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])

77 78 79
AS_IF([test x"$with_libdvdcss" = "xyes"], [
  CSS_REQUIRES="libdvdcss >= 1.2"
  PKG_CHECK_MODULES([CSS], [$CSS_REQUIRES])
80
  AC_CHECK_HEADERS(dvdcss/dvdcss.h,, AC_MSG_ERROR(You need libdvdcss (dvdcss.h)))
81 82 83 84 85 86 87 88 89 90 91 92
], [
  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])
93

94
CC_CHECK_CFLAGS_APPEND([-Wall -Wsign-compare -Wextra])
95 96


97
AC_ARG_ENABLE([apidoc],
98 99 100 101 102 103 104 105 106
  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])
  ])
])
107
AM_CONDITIONAL([APIDOC], [test "x$DOXYGEN" != "x" && test "x$enable_apidoc" = "xyes"])
108

109 110 111 112 113 114
AS_IF([test "x$ac_cv_c_compiler_gnu" = "xyes"], [
  AC_DEFINE([UNUSED], [__attribute__((unused))], [Unused parameter annotation])
], [
  AC_DEFINE([UNUSED], [], [Unused parameter annotation])
])

115 116 117 118 119 120 121 122
dnl export library version number
DVDREAD_VERSION_MAJOR=dvdread_major()
DVDREAD_VERSION_MINOR=dvdread_minor()
DVDREAD_VERSION_MICRO=dvdread_micro()
AC_SUBST(DVDREAD_VERSION_MAJOR)
AC_SUBST(DVDREAD_VERSION_MINOR)
AC_SUBST(DVDREAD_VERSION_MICRO)

123 124 125 126
dnl ---------------------------------------------
dnl Output configuration files
dnl ---------------------------------------------
AC_OUTPUT([
127
Makefile
128
doc/doxygen.cfg
129
misc/dvdread.pc
130
src/dvdread/version.h
131
])