configure.ac 6.99 KB
Newer Older
1
dnl --------------------------------------------------------------
2
dnl Configure.ac for libdvdread
3 4 5 6 7
dnl --------------------------------------------------------------

dnl --------------------------------------------------------------
dnl Require autoconf version 2.53
dnl --------------------------------------------------------------
8
AC_PREREQ([2.53])
9 10

dnl --------------------------------------------------------------
11 12 13
dnl Making releases: dvdread_sub += 1; change DVDREAD_LT_* accordingly
dnl
dnl These are defined in m4 so they can be passed to AC_INIT
14
dnl --------------------------------------------------------------
15
m4_define([dvdread_major], [4])
16 17
m4_define([dvdread_minor], [2])
m4_define([dvdread_sub],   [0])
18 19 20
m4_define([dvdread_pre],   [])

AC_INIT([libdvdread], [dvdread_major.dvdread_minor.dvdread_sub[]dvdread_pre])
21
AC_CONFIG_SRCDIR([src/dvdread/dvd_reader.h])
22
AM_INIT_AUTOMAKE([1.6])
23 24 25 26 27 28 29 30 31

dnl create a config.h file (Automake will add -DHAVE_CONFIG_H)
AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_HOST

DVDREAD_MAJOR="dvdread_major"
DVDREAD_MINOR="dvdread_minor"
DVDREAD_SUB="dvdread_sub"
DVDREAD_PRE="dvdread_pre"
32

33 34 35
AC_SUBST(DVDREAD_MAJOR)
AC_SUBST(DVDREAD_MINOR)
AC_SUBST(DVDREAD_SUB)
36

37
dnl The libtool version numbers (DVDREAD_LT_*); Don't even think about faking this!
38
dnl
39 40 41
dnl immediately before every release do:
dnl ===================================
dnl if (the interface is totally unchanged from previous release)
42
dnl    DVDREAD_LT_REVISION ++;
43
dnl else { /* interfaces have been added, removed or changed */
44 45
dnl    DVDREAD_LT_REVISION = 0;
dnl    DVDREAD_LT_CURRENT ++;
46 47 48 49 50
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 }
51
dnl
52
dnl If you want to know more about what you are doing, here are some details:
53 54
dnl  * DVDREAD_LT_CURRENT is the current API version
dnl  * DVDREAD_LT_REVISION is an internal revision number which is increased when the API
55
dnl    itself did not change
56
dnl  * DVDREAD_LT_AGE is the number of previous API versions still supported by this library
57 58 59
dnl  * libtool has its own numbering scheme, because local library numbering schemes
dnl    are platform dependent
dnl  * in Linux, the library will be named
60
dnl    libname.so.(DVDREAD_LT_CURRENT - DVDREAD_LT_AGE).DVDREAD_LT_AGE.DVDREAD_LT_REVISION
61

62 63
DVDREAD_LT_CURRENT=5
DVDREAD_LT_AGE=1
Nico Sabbi's avatar
Nico Sabbi committed
64
DVDREAD_LT_REVISION=2
65

66 67 68
AC_SUBST(DVDREAD_LT_CURRENT)
AC_SUBST(DVDREAD_LT_AGE)
AC_SUBST(DVDREAD_LT_REVISION)
69 70 71 72

dnl --------------------------------------------------------------
dnl Make possible to build for another arch.
dnl --------------------------------------------------------------
73 74 75 76
if test x$DVDREAD_BUILD != "x"; then
  AC_MSG_RESULT(*** build forced to $DVDREAD_BUILD ***)
  build=$DVDREAD_BUILD
  host=$DVDREAD_BUILD
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
else
  check_athlon=yes
fi

dnl --------------------------------------------------------------
dnl Checks for programs.
dnl --------------------------------------------------------------
dnl Save CFLAGS, AC_ISC_POSIX set some unwanted default CFLAGS
saved_CFLAGS="$CFLAGS"
AC_ISC_POSIX
CFLAGS="$saved_CFLAGS"
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_LN_S

dnl --------------------------------------------------------------
dnl Libtool
dnl --------------------------------------------------------------
96 97
dnl LT_PREREQ only available in libtool-2.2+
dnl LT_PREREQ([1.4.0])
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
AC_LIBTOOL_DLOPEN
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then
  STATIC="-static"
else
  STATIC=
fi
AC_SUBST(STATIC)

dnl --------------------------------------------------------------
dnl Checks for header files.
dnl --------------------------------------------------------------
AC_HEADER_STDC
AC_CHECK_HEADER(unistd.h)
AC_CHECK_HEADER(string.h)

dnl --------------------------------------------------------------
dnl Checks for typedefs, structures, and compiler characteristics.
dnl --------------------------------------------------------------
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
dnl AC_CHECK_TYPES([ptrdiff_t])
AC_C_BIGENDIAN

126 127 128 129 130 131 132 133 134 135 136
dnl -------------------------------------------------------------
dnl Check for basic *nix fonction that we may emulate on windows.
dnl -------------------------------------------------------------
case $host in
  *mingw32* | *cygwin*)
    AC_CHECK_FUNCS(gettimeofday)
    ;;
  *)
    ;;
esac

137 138 139
dnl ---------------------------------------------
dnl dynamic linker
dnl ---------------------------------------------
140 141
AC_ARG_ENABLE([libdvdcss], [  --enable-libdvdcss    force linking against libdvdcss])

142 143 144 145 146 147 148 149 150 151
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])

if [[ $use_builtin_dlfcn = "yes" ]]; then
	AC_DEFINE([USING_BUILTIN_DLFCN], [1], ["Define to 1 to use builtin dlfcn"])
fi

152 153 154
CSS_LIBS=""
if test x"$enable_libdvdcss" != xyes; then
dnl dlopen libdvdcss
155 156
case $host in
  *mingw32*)
157 158 159 160 161 162 163 164
    if [[ $use_builtin_dlfcn = "no" ]]; then
        AC_CHECK_LIB(c, dlopen,
                     DYNAMIC_LD_LIBS="",
                     AC_CHECK_LIB(dl, dlopen,
                                  DYNAMIC_LD_LIBS="-ldl",
                                  AC_MSG_WARN(Using builtin dlopen)))
        AC_SUBST(DYNAMIC_LD_LIBS)
    fi
165 166 167 168 169
    LDFLAGS="-no-undefined $LDFLAGS"
    ;;
  *cygwin*)
    LDFLAGS="-no-undefined $LDFLAGS"
    ;;
KO Myung-Hun's avatar
KO Myung-Hun committed
170 171 172
  *os2*)
    LDFLAGS="-no-undefined -Zbin-files $LDFLAGS"
    ;;
173 174
  *)
    AC_CHECK_LIB(c, dlopen,
175 176 177 178
                 DYNAMIC_LD_LIBS="",
                 AC_CHECK_LIB(dl, dlopen,
                              DYNAMIC_LD_LIBS="-ldl",
                              AC_MSG_ERROR(dynamic linker needed)))
179 180 181
    AC_SUBST(DYNAMIC_LD_LIBS)
    ;;
esac
182 183 184 185 186 187 188 189 190 191 192 193
else
dnl link with libdvdcss
  CSS_LIBS=-ldvdcss
  case "${host}" in
    *darwin*) CSS_LIBS="${CSS_LIBS} -Wl,-framework,CoreFoundation -Wl,-framework,IOKit"
    ;;
  esac
  AC_CHECK_LIB(dvdcss, dvdcss_interface_2,, AC_MSG_ERROR(You need libdvdcss.so.2 or later))
  AC_CHECK_HEADERS(dvdcss/dvdcss.h,, AC_MSG_ERROR(You need libdvdcss (dvdcss.h)))
fi

AC_SUBST(CSS_LIBS)
194

195

196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
dnl ---------------------------------------------
dnl cflags
dnl ---------------------------------------------
dnl Common cflags for all platforms
CFLAGS="-O3 -Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE $CFLAGS"
DEBUG_CFLAGS="-g -DDEBUG $CFLAGS"

AC_SUBST(DEBUG_CFLAGS)

dnl ---------------------------------------------
dnl Check for doxygen (dynamic documentation generator)
dnl ---------------------------------------------
AC_CHECK_PROG(DOXYGEN, doxygen, doxygen, no)

dnl ---------------------------------------------
dnl Some include paths ( !!! DO NOT REMOVE !!! )
dnl ---------------------------------------------
213
INCLUDES='-I$(top_srcdir) $(DVDREAD_CFLAGS)'
214 215 216 217 218 219
AC_SUBST(INCLUDES)

dnl ---------------------------------------------
dnl Output configuration files
dnl ---------------------------------------------
AC_OUTPUT([
220
Makefile
221 222
src/Makefile
misc/Makefile
223
misc/dvdread-config
224
misc/dvdread.pc
225
misc/libdvdread.spec
226 227 228
misc/relchk.sh
m4/Makefile
])