configure.ac 4.75 KB
Newer Older
npzacs's avatar
npzacs committed
1
dnl library version number
2
m4_define([aacs_major], 0)
hpi1's avatar
hpi1 committed
3
m4_define([aacs_minor], 11)
npzacs's avatar
npzacs committed
4
m4_define([aacs_micro], 0)
5 6
m4_define([aacs_version],[aacs_major.aacs_minor.aacs_micro])

npzacs's avatar
use dnl  
npzacs committed
7 8
dnl shared library version (.so version)
dnl
npzacs's avatar
npzacs committed
9
dnl update when making new release
npzacs's avatar
use dnl  
npzacs committed
10
dnl
npzacs's avatar
npzacs committed
11 12 13
dnl - If there are no ABI changes, increase revision.
dnl - If ABI is changed backwards-compatible way, increase current and age. Set revision to 0.
dnl - If ABI is broken, increase current and set age and revision to 0.
npzacs's avatar
use dnl  
npzacs committed
14
dnl
npzacs's avatar
npzacs committed
15
dnl Library file name will be libaacs.(current-age).age.revision
npzacs's avatar
use dnl  
npzacs committed
16

hpi1's avatar
0.10.0  
hpi1 committed
17 18
m4_define([lt_current],  7)
m4_define([lt_age],      7)
hpi1's avatar
hpi1 committed
19
m4_define([lt_revision], 1)
20

npzacs's avatar
npzacs committed
21
dnl initilization
npzacs's avatar
npzacs committed
22
AC_INIT([libaacs], aacs_version, [http://www.videolan.org/developers/libaacs.html])
Accident's avatar
 
Accident committed
23
AC_CONFIG_AUX_DIR([build-aux])
24
AC_CONFIG_MACRO_DIR([m4])
npzacs's avatar
npzacs committed
25
AC_CANONICAL_SYSTEM
anonymous's avatar
anonymous committed
26
AM_INIT_AUTOMAKE([foreign tar-ustar dist-bzip2 no-dist-gzip subdir-objects])
npzacs's avatar
npzacs committed
27
AC_CONFIG_HEADERS(config.h)
Ano Nymous's avatar
Ano Nymous committed
28
AM_MAINTAINER_MODE
Accident's avatar
 
Accident committed
29

npzacs's avatar
npzacs committed
30 31 32
dnl Enable silent rules only when available (automake 1.11 or later).
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

33 34
SET_FEATURES="-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112L"

npzacs's avatar
npzacs committed
35 36 37 38 39 40 41 42 43 44 45 46
case "${host_os}" in
  "")
    SYS=unknown
    ;;
  *mingw32* | *cygwin* | *wince* | *mingwce*)
    case "${host_os}" in
      *wince* | *mingwce* | *mingw32ce*)
        SYS=mingwce
        ;;
      *mingw32*)
        SYS=mingw32
        AC_DEFINE([_WIN32_WINNT], 0x0501, [Define to '0x0500' for Windows XP APIs.])
47
        AC_DEFINE([_WIN32_IE], 0x0501, [Define to '0x0501' for IE 5.01.])
npzacs's avatar
npzacs committed
48 49 50
        ;;
    esac
    ;;
51
  *darwin*)
52
    SYS=darwin
53 54 55 56
    AC_DEFINE([USE_IOKIT], 1, [Use IOKit for MMC access])
    LDFLAGS="${LDFLAGS} -lobjc -Wl,-framework,IOKit,-framework,Cocoa,-framework,DiskArbitration"
    SET_FEATURES="${SET_FEATURES} -D_DARWIN_C_SOURCE"
    ;;
npzacs's avatar
npzacs committed
57 58 59 60 61
  *)
    SYS="${host_os}"
    ;;
esac

62
AM_CONDITIONAL(HAVE_WIN32,   test "${SYS}" = "mingw32")
63
AM_CONDITIONAL(HAVE_DARWIN,  test "${SYS}" = "darwin")
64

npzacs's avatar
npzacs committed
65
dnl configure options
66
AC_ARG_ENABLE([werror],
67
  [AS_HELP_STRING([--enable-werror], [set warnings as errors via -Werror @<:@default=disabled@:>@])])
gates's avatar
gates committed
68

69
AC_ARG_ENABLE([extra-warnings],
70
  [AS_HELP_STRING([--disable-extra-warnings], [set extra warnings @<:@default=enabled@:>@])])
71

72
AC_ARG_ENABLE([optimizations],
73
  [AS_HELP_STRING([--disable-optimizations], [disable optimizations @<:@default=enabled@:>@])])
74

John Doe's avatar
John Doe committed
75 76 77 78 79 80
dnl override platform specific check for dependent libraries
dnl otherwise libtool linking of shared libraries will
dnl fail on anything other than pass_all.
AC_CACHE_VAL(lt_cv_deplibs_check_method,
    [lt_cv_deplibs_check_method=pass_all])

npzacs's avatar
npzacs committed
81
dnl required programs
Accident's avatar
 
Accident committed
82
AC_PROG_CC
gates's avatar
gates committed
83
AC_PROG_LIBTOOL
John Doe's avatar
John Doe committed
84
AC_LIBTOOL_WIN32_DLL
Ano Nymous's avatar
Ano Nymous committed
85 86
AM_PROG_LEX
AC_PROG_YACC
Accident's avatar
 
Accident committed
87

npzacs's avatar
npzacs committed
88
dnl required types
Accident's avatar
 
Accident committed
89
AC_TYPE_SIGNAL
Accident's avatar
 
Accident committed
90

npzacs's avatar
npzacs committed
91
dnl required headers
92
AC_CHECK_HEADERS([stdarg.h sys/types.h errno.h libgen.h malloc.h])
93
AC_CHECK_HEADERS([stdlib.h mntent.h linux/cdrom.h inttypes.h])
94
AC_CHECK_HEADERS([sys/select.h limits.h sys/param.h])
95
AC_CHECK_HEADERS([sys/mount.h])
Accident's avatar
 
Accident committed
96

npzacs's avatar
npzacs committed
97
dnl required system services
Accident's avatar
 
Accident committed
98 99
AC_SYS_LARGEFILE

npzacs's avatar
npzacs committed
100 101
dnl required libraries

npzacs's avatar
npzacs committed
102
dnl gcrypt check
103 104 105 106 107 108 109 110 111 112 113 114 115
AM_PATH_LIBGCRYPT([1.6.0], [have_gcrypt=yes])
AS_IF([test "x$have_gcrypt" != xyes],[
    dnl older gcrypt requires pthread
    AM_PATH_LIBGCRYPT([1.1.94],,
                      AC_MSG_ERROR([libgcrypt not found on system]))
    dnl pthread check (not on win32)
    AS_IF([test "${SYS}" != "mingw32"], [
        AC_CHECK_HEADERS([pthread.h], ,
            [AC_MSG_ERROR([pthread required])])
        AC_SEARCH_LIBS([pthread_create], [pthread], ,
            [AC_MSG_ERROR([pthread required])])
        ])
    ])
116

npzacs's avatar
use dnl  
npzacs committed
117
dnl use re-entrant version of gcrypt_error() from gpg-error
118 119 120
AC_FUNC_STRERROR_R
AM_PATH_GPG_ERROR([0.5],
                  AC_DEFINE(HAVE_LIBGPG_ERROR, 1, [Define to 1 if you have the gpg-error library]))
121

122 123 124
CC_CHECK_CFLAGS_APPEND([-Wall -Wdisabled-optimization -Wpointer-arith ]dnl
[-Wredundant-decls -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef ]dnl
[-Wmissing-prototypes -Wshadow])
125

126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
CC_CHECK_CFLAGS_APPEND([-Werror=implicit-function-declaration ]dnl
                       [-Werror-implicit-function-declaration],
                       [break;])

CC_CHECK_WERROR
AS_IF([test "x$enable_werror" = "xyes"], [
  CFLAGS="${CFLAGS} $cc_cv_werror"
])

AS_IF([test "x$enable_extra_warnings" != "xno"], [
  CC_CHECK_CFLAGS_APPEND([-Wextra -Winline])
])

AS_IF([test "x$enable_optimizations" != "xno"], [
  CC_CHECK_CFLAGS_APPEND([-O3 -fomit-frame-pointer])
])
142

143

npzacs's avatar
npzacs committed
144
dnl export library version number
npzacs's avatar
npzacs committed
145 146 147 148 149 150 151
AACS_VERSION_MAJOR=aacs_major()
AC_SUBST(AACS_VERSION_MAJOR)
AACS_VERSION_MINOR=aacs_minor()
AC_SUBST(AACS_VERSION_MINOR)
AACS_VERSION_MICRO=aacs_micro()
AC_SUBST(AACS_VERSION_MICRO)

npzacs's avatar
npzacs committed
152
dnl export library (.so) version
153 154 155
LT_VERSION_INFO="lt_current:lt_revision:lt_age"
AC_SUBST(LT_VERSION_INFO)

npzacs's avatar
npzacs committed
156
dnl generate output files
157
AC_SUBST(SET_FEATURES)
npzacs's avatar
npzacs committed
158
AC_CONFIG_FILES([Makefile src/libaacs.pc src/libaacs/aacs-version.h])
Accident's avatar
 
Accident committed
159
AC_OUTPUT