configure.ac 7.9 KB
Newer Older
1
dnl library version number
2
m4_define([bluray_major], 0)
anonymous's avatar
0.6.0  
anonymous committed
3
m4_define([bluray_minor], 6)
hpi1's avatar
0.6.1  
hpi1 committed
4
m4_define([bluray_micro], 1)
5 6
m4_define([bluray_version],[bluray_major.bluray_minor.bluray_micro])

7 8 9 10 11 12 13 14
dnl shared library version (.so version)
dnl
dnl - If there are no interface changes, increase revision.
dnl - If interfaces have been added, increase current and age. Set revision to 0.
dnl - If interfaces have been changed or removed, increase current and set age and revision to 0.
dnl
dnl Library file name will be libbluray.so.(current-age).age.revision
dnl
anonymous's avatar
0.6.0  
anonymous committed
15
m4_define([lt_current],  7)
hpi1's avatar
0.6.1  
hpi1 committed
16
m4_define([lt_revision], 1)
anonymous's avatar
0.6.0  
anonymous committed
17
m4_define([lt_age],      6)
18

19
dnl initilization
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
20
AC_INIT([libbluray], bluray_version, [http://www.videolan.org/developers/libbluray.html])
Accident's avatar
 
Accident committed
21
AC_CONFIG_AUX_DIR([build-aux])
22
AC_CONFIG_MACRO_DIR([m4])
23
AC_CANONICAL_HOST
24
AM_INIT_AUTOMAKE([foreign tar-ustar dist-bzip2 no-dist-gzip subdir-objects])
25
AC_CONFIG_HEADERS(config.h)
Accident's avatar
 
Accident committed
26

27 28 29
dnl Enable silent rules only when available (automake 1.11 or later).
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

30 31 32 33 34 35 36 37 38 39 40
case "${host_os}" in
  "")
    SYS=unknown
    ;;
  *mingw32* | *cygwin* | *wince* | *mingwce*)
    case "${host_os}" in
      *wince* | *mingwce* | *mingw32ce*)
        SYS=mingwce
        ;;
      *mingw32*)
        SYS=mingw32
41
        AC_DEFINE([_WIN32_WINNT], 0x0502, [Define to '0x0502' for Windows XP SP2 APIs.])
hpi1's avatar
hpi1 committed
42
        AC_DEFINE([_WIN32_IE], 0x0501, [Define to '0x0501' for IE 5.01.])
43
        CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=1"
44 45 46
        ;;
    esac
    ;;
47 48 49
  *darwin*)
    SYS=darwin
    ;;
50 51 52 53 54
  *)
    SYS="${host_os}"
    ;;
esac

55 56 57
AM_CONDITIONAL(HAVE_WIN32,   test "${SYS}" = "mingw32")
AM_CONDITIONAL(HAVE_DARWIN,  test "${SYS}" = "darwin")

58
dnl messages
gates's avatar
gates committed
59
library_not_found="Could not find required library!"
60
function_not_found="Could not find required function!"
61

62
dnl configure options
63
AC_ARG_VAR([JDK_HOME], [Path to the JDK])
64

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

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

71
AC_ARG_ENABLE([optimizations],
72
  [AS_HELP_STRING([--disable-optimizations], [disable optimizations @<:@default=enabled@:>@])])
Accident's avatar
 
Accident committed
73

74 75 76 77 78 79
AC_ARG_ENABLE([examples],
  [AS_HELP_STRING([--enable-examples],
  [build examples (default is yes)])],
  [use_examples=$enableval],
  [use_examples=yes])

80 81 82 83 84 85
AC_ARG_ENABLE([bdjava],
  [AS_HELP_STRING([--enable-bdjava],
  [enable BD-Java support (default is no)])],
  [use_bdjava=$enableval],
  [use_bdjava=no])

86 87
AC_ARG_WITH([libxml2],
  [AS_HELP_STRING([--without-libxml2], [build without libxml2 support @<:@default=with@:>@])])
88

89 90
AC_ARG_WITH([freetype],
  [AS_HELP_STRING([--without-freetype], [build without freetype support @<:@default=with@:>@])])
91 92 93 94 95 96 97

AC_ARG_WITH([bdj-type],
  [AS_HELP_STRING([--with-bdj-type=TYPE],
  [Specify the type of BD-J implementation (j2se, j2me). Default is j2se.])],
  [BDJ_TYPE=$withval],
  [BDJ_TYPE=j2se])

98 99 100 101 102 103
AC_ARG_WITH([bdj-bootclasspath],
  [AS_HELP_STRING([--with-bdj-bootclasspath=PATH],
  [Specify BD-J build-time bootclass path (example /opt/PhoneME/lib/btclasses.zip;/opt/PhoneME/lib/xmlparer.jar). Default is empty.])],
  [BDJ_BOOTCLASSPATH=$withval],
  [BDJ_BOOTCLASSPATH=])

104
dnl required programs
Accident's avatar
 
Accident committed
105
AC_PROG_CC
106
AM_PROG_CC_C_O
gates's avatar
gates committed
107
AC_PROG_LIBTOOL
Accident's avatar
 
Accident committed
108

109
dnl required types
Accident's avatar
 
Accident committed
110
AC_TYPE_SIGNAL
Accident's avatar
 
Accident committed
111

112
dnl required headers
gates's avatar
gates committed
113
AC_CHECK_HEADERS([stdarg.h sys/types.h dirent.h errno.h libgen.h malloc.h])
hpi1's avatar
hpi1 committed
114
AC_CHECK_HEADERS([stdlib.h mntent.h linux/cdrom.h inttypes.h strings.h])
hpi1's avatar
hpi1 committed
115
AC_CHECK_HEADERS([sys/time.h time.h mntent.h])
Accident's avatar
 
Accident committed
116

117
dnl required structures
Accident's avatar
 
Accident committed
118 119
AC_STRUCT_DIRENT_D_TYPE

120
dnl required system services
Accident's avatar
 
Accident committed
121 122
AC_SYS_LARGEFILE

123
dnl required functions
124
AC_CHECK_FUNC([snprintf],, [AC_MSG_ERROR($function_not_found)])
Accident's avatar
 
Accident committed
125

126 127
dnl required libraries
dnl pthreads (not on win32)
128 129 130 131 132 133
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])])
  AC_SEARCH_LIBS([dlopen], [dl])
134 135 136 137
  DLOPEN_LIBS="$ac_cv_search_dlopen"
  AS_CASE([$DLOPEN_LIBS],
    [no|none\ required], [DLOPEN_LIBS=""])
  AC_SUBST([DLOPEN_LIBS])
138
])
139

140
dnl libxml2 for metadata parser
141 142
AS_IF([test "x$with_libxml2" != "xno"], [
  PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6],
143
    [with_libxml2=yes; AC_DEFINE([HAVE_LIBXML2], [1],
144 145
        [Define to 1 if libxml2 is to be used for metadata parsing])])
])
146

147
dnl FreeType2
148
AS_IF([test "x$with_freetype" != "xno"], [
149
  PKG_CHECK_MODULES([FT2], [freetype2],
150
    [with_freetype=yes; AC_DEFINE([HAVE_FT2], 1, [Define this if you have FreeType2 library])])
151
])
152

153 154 155
CC_CHECK_CFLAGS_APPEND([-Wall -Wdisabled-optimization -Wpointer-arith ]dnl
[-Wredundant-decls -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef ]dnl
[-Wmissing-prototypes -Wshadow])
156

157 158 159
CC_CHECK_CFLAGS_APPEND([-Werror=implicit-function-declaration ]dnl
                       [-Werror-implicit-function-declaration],
                       [break;])
160

161 162 163 164
CC_CHECK_WERROR
AS_IF([test "x$enable_werror" = "xyes"], [
  CFLAGS="${CFLAGS} $cc_cv_werror"
])
165

166 167 168 169 170 171 172
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])
])
173

174
dnl use examples
175 176
AM_CONDITIONAL([USING_EXAMPLES], [ test $use_examples = "yes" ])

177
dnl use bdjava
178
if [[ $use_bdjava = "yes" ]]; then
179
  case $host_cpu in
180 181
       x86_64) java_arch=amd64 ;;
       i?86)   java_arch=i386 ;;
hpi1's avatar
hpi1 committed
182
       arm*)   java_arch=arm ;;
183
       *)      java_arch=$host_cpu ;;
184
  esac
185
  case $host_os in
186 187
       linux*)   java_os=linux ;;
       win*)     java_os=win32 ;;
188
       mingw*)   java_os=win32 ;;
189
       freebsd*) java_os=freebsd ;;
190
       solaris*) java_os=solaris ;;
191
       darwin*)  java_os=darwin ;;
192
       *)        java_os=$host_os ;;
193 194
  esac

195 196 197 198 199 200 201 202
  AS_IF([test "x${JDK_HOME}" != "x"], [
    BDJAVA_CFLAGS="-I${JDK_HOME}/include -I${JDK_HOME}/include/$java_os"

    temp_CPPFLAGS="$CPPFLAGS"
    CPPFLAGS="$BDJAVA_CFLAGS $CPPFLAGS"
    AC_CHECK_HEADERS([jni.h], [], [AC_MSG_ERROR(could not find jni.h)])
    CPPFLAGS="$temp_CPPFLAGS"
  ], [
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
203
    BDJAVA_CFLAGS='-I${abs_top_srcdir}/jni -I${abs_top_srcdir}/jni/'"${java_os}"
204
  ])
205

206 207 208 209 210
  AC_CHECK_PROG(HAVE_ANT, [ant], yes, no)
  if test "x$HAVE_ANT" = "xno"; then
      AC_MSG_ERROR([BD-J requires ANT, but ant was not found. Please install it.])
  fi

211
  AC_DEFINE([USING_BDJAVA], [1], ["Define to 1 if using BD-Java"])
212
  AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$java_arch"], ["Defines the architecture of the java vm."])
213
  AC_DEFINE_UNQUOTED([JDK_HOME], ["$JDK_HOME"], [""])
214
fi
215 216
AM_CONDITIONAL([USING_BDJAVA], [ test $use_bdjava = "yes" ])

217
dnl BD-J type
218 219 220 221 222 223
if test "$BDJ_TYPE" = "j2me"; then
  AC_DEFINE([HAVE_BDJ_J2ME], [1], [Define to 1 if using libbluray J2ME stack])
else
  BDJ_TYPE=j2se
fi
AC_SUBST(BDJ_TYPE)
224
dnl bootclasspath
225
AC_SUBST(BDJ_BOOTCLASSPATH)
226

227
dnl generate documentation
228 229
DX_INIT_DOXYGEN(libbluray, doc/doxygen-config, [doc/doxygen])

230
dnl export library version number
231 232 233 234 235 236 237
BLURAY_VERSION_MAJOR=bluray_major()
AC_SUBST(BLURAY_VERSION_MAJOR)
BLURAY_VERSION_MINOR=bluray_minor()
AC_SUBST(BLURAY_VERSION_MINOR)
BLURAY_VERSION_MICRO=bluray_micro()
AC_SUBST(BLURAY_VERSION_MICRO)

238
dnl export library (.so) version
239 240 241
LT_VERSION_INFO="lt_current():lt_revision():lt_age()"
AC_SUBST(LT_VERSION_INFO)

242
dnl generate output files
243
AC_SUBST(BDJAVA_CFLAGS)
244
AC_CONFIG_FILES([Makefile src/Makefile src/libbluray.pc src/libbluray/bluray-version.h])
Accident's avatar
 
Accident committed
245
AC_OUTPUT
246 247 248 249 250 251 252 253


dnl ---------------------------------------------
dnl Some infos:
dnl ---------------------------------------------

echo "  Summary:"
echo "  --------"
254 255 256
echo "  BD-J support:                  $use_bdjava"
if [[ $use_bdjava = "yes" ]]; then
echo "  BD-J type:                     $BDJ_TYPE"
257 258 259
if test x"$BDJ_BOOTCLASSPATH" != x""; then
echo "  BD-J bootclasspath:            $BDJ_BOOTCLASSPATH"
fi
260
fi
261
echo "  Font support (freetype2):      $with_freetype"
262
echo "  Metadata support (libxml2):    $with_libxml2"
263
echo "  Build examples:                $use_examples"
264