configure.ac 6.29 KB
Newer Older
1
AC_INIT(libdvdcss, 1.3.0, , , https://www.videolan.org/developers/libdvdcss.html)
2
AC_CONFIG_SRCDIR([src/libdvdcss.c])
Sam Hocevar's avatar
Sam Hocevar committed
3

4
AC_PREREQ(2.50)
5
AC_CANONICAL_HOST
Jon Lech Johansen's avatar
   
Jon Lech Johansen committed
6

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

12
13
LT_INIT([win32-dll])

14
AC_CONFIG_HEADER(config.h)
15
AC_CONFIG_MACRO_DIR([m4])
Sam Hocevar's avatar
 
Sam Hocevar committed
16

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
dnl The libtool version numbers (DVDCSS_LT_*); Don't even think about faking this!
dnl
dnl immediately before every release do:
dnl ===================================
dnl if (the interface is totally unchanged from previous release)
dnl    DVDCSS_LT_REVISION ++;
dnl else { /* interfaces have been added, removed or changed */
dnl    DVDCSS_LT_REVISION = 0;
dnl    DVDCSS_LT_CURRENT ++;
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 }
dnl
dnl If you want to know more about what you are doing, here are some details:
dnl  * DVDCSS_LT_CURRENT is the current API version
dnl  * DVDCSS_LT_REVISION is an internal revision number which is increased when the API
dnl    itself did not change
dnl  * DVDCSS_LT_AGE is the number of previous API versions still supported by this library
dnl  * libtool has its own numbering scheme, because local library numbering schemes
dnl    are platform dependent
dnl  * in Linux, the library will be named
dnl    libname.so.(DVDCSS_LT_CURRENT - DVDCSS_LT_AGE).DVDCSS_LT_AGE.DVDCSS_LT_REVISION

DVDCSS_LT_CURRENT=3
DVDCSS_LT_AGE=0
DVDCSS_LT_REVISION=1

AC_SUBST([DVDCSS_LTVERSION], [$DVDCSS_LT_CURRENT:$DVDCSS_LT_AGE:$DVDCSS_LT_REVISION])

Sam Hocevar's avatar
 
Sam Hocevar committed
48
AC_PROG_CC
49
AC_HEADER_STDC
Sam Hocevar's avatar
 
Sam Hocevar committed
50
51
52
53
54

AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
AC_CHECK_HEADERS([unistd.h sys/param.h sys/uio.h limits.h pwd.h]dnl
  [errno.h sys/types.h sys/stat.h fcntl.h io.h])

AC_CHECK_DECL([O_BINARY], [],
  [AC_DEFINE([O_BINARY], [0], [Define O_BINARY if missing])],
  [
    #if HAVE_SYS_TYPES_H
    # include <sys/types.h>
    #endif
    #if HAVE_SYS_STAT_H
    # include <sys/stat.h>
    #endif
    #if HAVE_FCNTL_H
    # include <fcntl.h>
    #endif
  ])
71

72
73
AC_SYS_LARGEFILE

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
AC_CACHE_CHECK(
  [for posix mkdir()],
  [css_cv_mkdir_posix], [
    AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#ifdef HAVE_IO_H
# include <io.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif

int mkdir(const char *path, mode_t mode);
      ])
    ],
    [css_cv_mkdir_posix=yes],
    [css_cv_mkdir_posix=no])
  ])

AS_IF([test "$css_cv_mkdir_posix" = "no"], [
  AC_DEFINE([HAVE_BROKEN_MKDIR], 1, [Define if you have a broken mkdir])
])

Jon Lech Johansen's avatar
   
Jon Lech Johansen committed
99
100
101
dnl
dnl  Check the operating system
dnl
102
103

case x"${host_os}" in
Jon Lech Johansen's avatar
   
Jon Lech Johansen committed
104
  xdarwin*)
Sam Hocevar's avatar
   
Sam Hocevar committed
105
106
    CFLAGS="${CFLAGS} -no-cpp-precomp"
    ;;
107
  x*cygwin*)
108
    CFLAGS="${CFLAGS} -mwin32"
109
    AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
110
    ;;
KO Myung-Hun's avatar
KO Myung-Hun committed
111
112
113
  xos2*)
    LDFLAGS="-Zbin-files"
    ;;
114
115
  x*msvc*)
    SYS_MSVC=1
116
    AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
117
118
    ;;
  x*mingw* | *wince* | *mingwce*)
119
    AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
Jon Lech Johansen's avatar
   
Jon Lech Johansen committed
120
121
122
123
124
    ;;
  x*)
    ;;
esac

Sam Hocevar's avatar
 
Sam Hocevar committed
125
126
127
128
129
130
131
132
dnl
dnl  libdvdcss: check for DVD ioctls
dnl

dnl  default is no
CAN_BUILD_LIBDVDCSS=0

dnl  for windoze
133
134
135
136
137
138
AC_CHECK_HEADERS(windows.h,[
  AC_CHECK_HEADERS(winioctl.h,[
    CAN_BUILD_LIBDVDCSS=1
  ],,[
  #include <windows.h>
  ])
Sam Hocevar's avatar
 
Sam Hocevar committed
139
140
])

141
dnl for Unix
Sam Hocevar's avatar
 
Sam Hocevar committed
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
AC_CHECK_HEADERS(sys/ioctl.h,[
  CAN_BUILD_LIBDVDCSS=1
  AC_CHECK_HEADERS(sys/cdio.h sys/dvdio.h linux/cdrom.h dvd.h)
  BSD_DVD_STRUCT=0
  LINUX_DVD_STRUCT=0
  OPENBSD_DVD_STRUCT=0
  dnl
  dnl Old FreeBSD: sys/cdio.h
  dnl
  AC_EGREP_HEADER(dvd_struct,sys/cdio.h,[
    AC_DEFINE(DVD_STRUCT_IN_SYS_CDIO_H, 1,
              Define if <sys/cdio.h> defines dvd_struct.)
    AC_EGREP_HEADER(struct dvd_struct,sys/cdio.h,[
                    BSD_DVD_STRUCT=1],[LINUX_DVD_STRUCT=1; OPENBSD_DVD_STRUCT=1])
  ])
  dnl
  dnl Newer FreeBSD: sys/dvdio.h
  dnl
  AC_EGREP_HEADER(dvd_struct,sys/dvdio.h,[
    AC_DEFINE(DVD_STRUCT_IN_SYS_DVDIO_H, 1,
              Define if <sys/dvdio.h> defines dvd_struct.)
    AC_EGREP_HEADER(struct dvd_struct,sys/dvdio.h,[
                    BSD_DVD_STRUCT=1],[LINUX_DVD_STRUCT=1])
  ])
  dnl
  dnl Linux: linux/cdrom.h
  dnl
  AC_EGREP_HEADER(dvd_struct,linux/cdrom.h,[
    AC_DEFINE(DVD_STRUCT_IN_LINUX_CDROM_H, 1,
              Define if <linux/cdrom.h> defines DVD_STRUCT.)
    LINUX_DVD_STRUCT=1
  ])
  dnl
  dnl Solaris: sys/scsi/scsi_types.h, sys/scsi/impl/uscsi.h
  dnl
177
  solaris_uscsi=yes
178
  AC_CHECK_HEADERS([sys/scsi/scsi_types.h sys/scsi/impl/uscsi.h], [],
179
180
181
    [solaris_uscsi=no; break;])
  AS_IF([test "$solaris_uscsi" = "yes"], [
    AC_DEFINE(SOLARIS_USCSI, 1, Have userspace SCSI headers.)
Sam Hocevar's avatar
 
Sam Hocevar committed
182
183
  ])
  dnl
Diego Biurrun's avatar
Diego Biurrun committed
184
  dnl Darwin
Jon Lech Johansen's avatar
   
Jon Lech Johansen committed
185
186
187
  dnl
  AC_CHECK_HEADER(IOKit/storage/IODVDMediaBSDClient.h,[
    AC_DEFINE(DARWIN_DVD_IOCTL, 1, Have IOKit DVD IOCTL headers)
188
    DVDCSS_LDFLAGS="-Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,IOKit"
Jon Lech Johansen's avatar
   
Jon Lech Johansen committed
189
190
  ])
  dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
191
192
193
  dnl Final tests to check what was detected
  dnl
  if test x$LINUX_DVD_STRUCT = x1; then
Diego Biurrun's avatar
Diego Biurrun committed
194
    AC_DEFINE(HAVE_LINUX_DVD_STRUCT, 1,
Sam Hocevar's avatar
 
Sam Hocevar committed
195
196
197
198
199
200
201
202
203
204
205
206
207
              Define if Linux-like dvd_struct is defined.)
    if test x$OPENBSD_DVD_STRUCT = x1; then
      AC_DEFINE(HAVE_OPENBSD_DVD_STRUCT, 1,
                Define if OpenBSD-like dvd_struct is defined.)
    fi
  else
    if test x$BSD_DVD_STRUCT = x1; then
      AC_DEFINE(HAVE_BSD_DVD_STRUCT, 1,
                Define if FreeBSD-like dvd_struct is defined.)
    fi
  fi
])

208
CC_CHECK_CFLAGS_APPEND([-Wall -Wextra])
209
210
211
212
213
CC_FLAG_VISIBILITY([
  CC_ATTRIBUTE_VISIBILITY([default], [
    CFLAGS="${CFLAGS} -fvisibility=hidden"
  ])
])
214

Sam Hocevar's avatar
Sam Hocevar committed
215
AM_CONDITIONAL(SYS_MSVC, test "${SYS_MSVC}" = "1")
Sam Hocevar's avatar
 
Sam Hocevar committed
216

217
AC_ARG_ENABLE([doc],
218
  AS_HELP_STRING([--disable-doc], [Disable building (with Doxygen) and intalling API documentation @<:@default=auto@:@>]))
219

220
221
222
AS_IF([test "x$enable_doc" != "xno"], [
  AC_PATH_PROG([DOXYGEN], [doxygen])
])
223
224

AS_IF([test "x$DOXYGEN" = "x"], [
225
  AS_IF([test "x$enable_doc" = "xyes"], [
226
227
228
229
    AC_MSG_ERROR([You need Doxygen to build API documentation])
  ])
])
AM_CONDITIONAL([APIDOC], [test "x$DOXYGEN" != "x"])
230

231
232
233
AC_PATH_PROG([GIT], [git])
AM_CONDITIONAL([GIT], [test "x$GIT" != "x"])

234
AC_SUBST(DVDCSS_LDFLAGS)
235
236
AC_OUTPUT([
  Makefile
237
  libdvdcss.spec
238
  doc/doxygen.cfg
239
  src/libdvdcss.pc
240
])