configure.ac 5.31 KB
Newer Older
Sam Hocevar's avatar
 
Sam Hocevar committed
1
AC_INIT(src/libdvdcss.c)
Sam Hocevar's avatar
Sam Hocevar committed
2

3
4
AC_PREREQ(2.50)
AC_CONFIG_AUX_DIR(autotools)
Jon Lech Johansen's avatar
   
Jon Lech Johansen committed
5
6
AC_CANONICAL_SYSTEM

7
AM_INIT_AUTOMAKE(libdvdcss, 1.2.9)
8
AM_CONFIG_HEADER(config.h)
Sam Hocevar's avatar
 
Sam Hocevar committed
9
10
11
12

AC_PROG_CC
AC_STDC_HEADERS

13
AC_LIBTOOL_WIN32_DLL
Sam Hocevar's avatar
 
Sam Hocevar committed
14
15
16
17
18
19
AM_PROG_LIBTOOL 

AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T

20
AC_CHECK_HEADERS(unistd.h sys/param.h limits.h pwd.h errno.h)
21

Jon Lech Johansen's avatar
   
Jon Lech Johansen committed
22
23
24
25
26
dnl
dnl  Check the operating system
dnl
case x"${target_os}" in
  xdarwin*)
Sam Hocevar's avatar
   
Sam Hocevar committed
27
28
    CFLAGS="${CFLAGS} -no-cpp-precomp"
    ;;
29
  x*cygwin*)
gbazin's avatar
   
gbazin committed
30
31
32
33
34
35
    dnl Check if we are using the mno-cygwin mode in which case we are
    dnl actually dealing with a mingw32 compiler.
    AC_EGREP_CPP(yes, [#ifndef WIN32
                       yes
                       #endif],
                 AC_DEFINE(SYS_CYGWIN, 1, Have a Cygwin system.))
36
    AC_DEFINE(WIN32, 1, Using Win32.)
37
    ;;
Sam Hocevar's avatar
   
Sam Hocevar committed
38
39
  xbeos*)
    AC_DEFINE(SYS_BEOS, 1, Have a BeOS system.)
40
41
42
    ;;
  x*msvc*)
    SYS_MSVC=1
Jon Lech Johansen's avatar
   
Jon Lech Johansen committed
43
44
45
46
47
    ;;
  x*)
    ;;
esac

Sam Hocevar's avatar
 
Sam Hocevar committed
48
49
50
51
52
53
54
55
dnl
dnl  libdvdcss: check for DVD ioctls
dnl

dnl  default is no
CAN_BUILD_LIBDVDCSS=0

dnl  for windoze
56
57
58
59
60
61
62
63
64
AC_CHECK_HEADERS(windows.h,[
  AC_CHECK_HEADERS(direct.h,,,[
  #include <windows.h>
  ])
  AC_CHECK_HEADERS(winioctl.h,[
    CAN_BUILD_LIBDVDCSS=1
  ],,[
  #include <windows.h>
  ])
Sam Hocevar's avatar
 
Sam Hocevar committed
65
66
67
68
69
70
71
72
73
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
99
100
])

dnl  for Un*x and BeOS
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
Sam Hocevar's avatar
Sam Hocevar committed
101
  dnl BSDI: dvd.h - may require -ldvd IF a local copy of libdvd is installed
Sam Hocevar's avatar
 
Sam Hocevar committed
102
103
104
105
  dnl
  AC_EGREP_HEADER(dvd_struct,dvd.h,[
    AC_DEFINE(DVD_STRUCT_IN_DVD_H, 1,
              Define if <dvd.h> defines DVD_STRUCT.)
Sam Hocevar's avatar
Sam Hocevar committed
106
    SYS_BSDI_LIBDVD=1
Sam Hocevar's avatar
 
Sam Hocevar committed
107
108
109
110
111
112
113
114
    LINUX_DVD_STRUCT=1
  ],[
    dnl
    dnl BSDI: /sys/dev/scsi/scsi_ioctl.h, using our own libdvd
    dnl
    AC_CHECK_HEADERS(/sys/dev/scsi/scsi_ioctl.h,[
      AC_DEFINE(DVD_STRUCT_IN_BSDI_DVDIOCTL_DVD_H, 1,
                Define if <extras/BSDI_dvdioctl/dvd.h> defines DVD_STRUCT.)
115
      SYS_BSDI=1
Sam Hocevar's avatar
 
Sam Hocevar committed
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
      LINUX_DVD_STRUCT=1
    ])
  ])
  dnl
  dnl Solaris: sys/scsi/scsi_types.h, sys/scsi/impl/uscsi.h
  dnl
  AC_CHECK_HEADER(sys/scsi/scsi_types.h,[
    AC_CHECK_HEADER(sys/scsi/impl/uscsi.h,[
      AC_DEFINE(SOLARIS_USCSI, 1, Have userspace SCSI headers.)
    ])
  ])
  dnl
  dnl HP-UX: sys/scsi.h
  dnl
  AC_CHECK_HEADER(sys/scsi.h,[
    AC_EGREP_HEADER(sctl_io,sys/scsi.h,[
      AC_DEFINE(HPUX_SCTL_IO, 1, Define if <sys/scsi.h> defines sctl_io.)
    ])
  ])
  dnl
Jon Lech Johansen's avatar
   
Jon Lech Johansen committed
136
137
138
139
  dnl Darwin 
  dnl
  AC_CHECK_HEADER(IOKit/storage/IODVDMediaBSDClient.h,[
    AC_DEFINE(DARWIN_DVD_IOCTL, 1, Have IOKit DVD IOCTL headers)
140
    DVDCSS_LDFLAGS="-Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,IOKit"
Jon Lech Johansen's avatar
   
Jon Lech Johansen committed
141
142
  ])
  dnl
Sam Hocevar's avatar
 
Sam Hocevar committed
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
  dnl Final tests to check what was detected
  dnl
  if test x$LINUX_DVD_STRUCT = x1; then
    AC_DEFINE(HAVE_LINUX_DVD_STRUCT, 1, 
              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
])

160
161
162
163
164
165
166
167
168
dnl
dnl  Check for available warning flags
dnl
CFLAGS_save="${CFLAGS}"

AC_CACHE_CHECK([if \$CC accepts -Wall],
    [ac_cv_c_Wall],
    [CFLAGS="-Wall ${CFLAGS_save}"
     AC_TRY_COMPILE([],,ac_cv_c_Wall=yes, ac_cv_c_Wall=no)])
Sam Hocevar's avatar
Sam Hocevar committed
169
if test "${ac_cv_c_Wall}" != "no"; then
170
171
172
173
174
175
176
    CFLAGS_save="-Wall ${CFLAGS_save}"
fi

AC_CACHE_CHECK([if \$CC accepts -Wsign-compare],
    [ac_cv_c_Wsign_compare],
    [CFLAGS="-Wsign-compare ${CFLAGS_save}"
     AC_TRY_COMPILE([],,ac_cv_c_Wsign_compare=yes, ac_cv_c_Wsign_compare=no)])
Sam Hocevar's avatar
Sam Hocevar committed
177
if test "${ac_cv_c_Wsign_compare}" != "no"; then
178
179
180
181
182
183
184
185
    CFLAGS_save="-Wsign-compare ${CFLAGS_save}"
fi

CFLAGS="${CFLAGS_save}"

dnl
dnl  Use 64 bits offsets
dnl
186
CFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DDVDCSS_DIST ${CFLAGS}"
Sam Hocevar's avatar
 
Sam Hocevar committed
187

Sam Hocevar's avatar
Sam Hocevar committed
188
189
190
AM_CONDITIONAL(SYS_BSDI, test "${SYS_BSDI}" = "1")
AM_CONDITIONAL(SYS_BSDI_LIBDVD, test "${SYS_BSDI_LIBDVD}" = "1")
AM_CONDITIONAL(SYS_MSVC, test "${SYS_MSVC}" = "1")
Sam Hocevar's avatar
 
Sam Hocevar committed
191

192
193
194
dnl
dnl  Shall we build documentation?
dnl
Sam Hocevar's avatar
Sam Hocevar committed
195
196
197
198
199
200
201
202
AC_ARG_ENABLE([doc], AC_HELP_STRING([--disable-doc], [do not build API documentation with Doxygen]))
if test "$enable_doc" != "no"; then
  AC_PATH_PROG(DOXYGEN, doxygen, no)
  AC_PATH_PROG(LATEX, latex, no)
else
  DOXYGEN="no"
  LATEX="no"
fi
203
204
205
AM_CONDITIONAL(DOXYGEN, test "${DOXYGEN}" != "no")
AM_CONDITIONAL(LATEX, test "${LATEX}" != "no")

206
AC_SUBST(DVDCSS_LDFLAGS)
207
208
209
210
211
212
213
AC_OUTPUT([
  Makefile
  doc/Makefile
  src/Makefile
  src/dvdcss/Makefile
  test/Makefile
])
Sam Hocevar's avatar
 
Sam Hocevar committed
214