aboutsummaryrefslogtreecommitdiff
path: root/lib/libdvd/libdvdnav/configure.ac
blob: 8c5bafdaf2393cfd2f75cfaabcc16bae0d101a25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
dnl --------------------------------------------------------------
dnl Configure.ac for libdvdnav
dnl --------------------------------------------------------------

dnl --------------------------------------------------------------
dnl Require autoconf version 2.53
dnl --------------------------------------------------------------
AC_PREREQ([2.53])

dnl --------------------------------------------------------------
dnl Making releases: dvdnav_sub += 1; change DVDNAV_LT_* accordingly
dnl
dnl These are defined in m4 so they can be passed to AC_INIT
dnl --------------------------------------------------------------
m4_define([dvdnav_major], [4])
m4_define([dvdnav_minor], [2])
m4_define([dvdnav_sub],   [1])
m4_define([dvdnav_pre],   [])

AC_INIT([libdvdnav], [dvdnav_major.dvdnav_minor.dvdnav_sub[]dvdnav_pre])
AC_CONFIG_SRCDIR([src/dvdnav.c])
AM_INIT_AUTOMAKE([1.6])

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

DVDNAV_MAJOR="dvdnav_major"
DVDNAV_MINOR="dvdnav_minor"
DVDNAV_SUB="dvdnav_sub"
DVDNAV_PRE="dvdnav_pre"

AC_SUBST(DVDNAV_MAJOR)
AC_SUBST(DVDNAV_MINOR)
AC_SUBST(DVDNAV_SUB)

dnl The libtool version numbers (DVDNAV_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    DVDNAV_LT_REVISION ++;
dnl else { /* interfaces have been added, removed or changed */
dnl    DVDNAV_LT_REVISION = 0;
dnl    DVDNAV_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  * DVDNAV_LT_CURRENT is the current API version
dnl  * DVDNAV_LT_REVISION is an internal revision number which is increased when the API
dnl    itself did not change
dnl  * DVDNAV_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.(DVDNAV_LT_CURRENT - DVDNAV_LT_AGE).DVDNAV_LT_AGE.DVDNAV_LT_REVISION

DVDNAV_LT_CURRENT=5
DVDNAV_LT_AGE=1
DVDNAV_LT_REVISION=2

AC_SUBST(DVDNAV_LT_CURRENT)
AC_SUBST(DVDNAV_LT_AGE)
AC_SUBST(DVDNAV_LT_REVISION)

dnl --------------------------------------------------------------
dnl Make possible to build for another arch.
dnl --------------------------------------------------------------
if test x$DVDNAV_BUILD != "x"; then
  AC_MSG_RESULT(*** build forced to $DVDNAV_BUILD ***)
  build=$DVDNAV_BUILD
  host=$DVDNAV_BUILD
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 --------------------------------------------------------------
dnl LT_PREREQ only available in libtool-2.2+
dnl LT_PREREQ([1.4.0])
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

dnl -------------------------------------------------------------
dnl Check for basic *nix fonction that we may emulate on windows.
dnl -------------------------------------------------------------
case $host in
  *mingw32* | *cygwin*)
    AC_CHECK_FUNCS(gettimeofday)
    ;;
  *)
    ;;
esac

dnl ---------------------------------------------
dnl threads
dnl ---------------------------------------------
case $host in
  *-*-freebsd*)
    THREAD_LIBS="-L/usr/local/lib -pthread"
    THREAD_CFLAGS="-I/usr/local/include -D_THREAD_SAFE"
    CFLAGS="$THREAD_CFLAGS $CFLAGS"
    ;;
  *mingw32* | *cygwin*)
    ;;
  *)
    AC_CHECK_LIB(pthread, pthread_create,
	[THREAD_LIBS="-lpthread"],
	AC_MSG_ERROR(pthread needed))
    ;;
esac
AC_SUBST(THREAD_LIBS)
AC_SUBST(THREAD_CFLAGS)

dnl ---------------------------------------------
dnl dynamic linker
dnl ---------------------------------------------
case $host in
  *mingw32*)
    CFLAGS="-idirafter \$(top_srcdir)/msvc/include $CFLAGS"
    LDFLAGS="-no-undefined $LDFLAGS"
    ;;
  *cygwin*)
    LDFLAGS="-no-undefined $LDFLAGS"
    ;;
  *os2*)
    LDFLAGS="-no-undefined -Zbin-files $LDFLAGS"
    ;;
  *)
    AC_CHECK_LIB(c, dlopen,
	         DYNAMIC_LD_LIBS="",
	         AC_CHECK_LIB(dl, dlopen,
             	              DYNAMIC_LD_LIBS="-ldl",
	                      AC_MSG_ERROR(dynamic linker needed)))
    AC_SUBST(DYNAMIC_LD_LIBS)
    ;;
esac

dnl ---------------------------------------------
dnl libdvdread
dnl ---------------------------------------------
AC_ARG_WITH([dvdread-config],
  [AS_HELP_STRING([--with-dvdread-config=PROG],
    [dvdread-config program to use @<:@default=from PATH@:>@])],
  [DVDREAD_CONFIG="$withval"],
  [dnl User didn't specify program, search PATH
  AC_PATH_PROG([DVDREAD_CONFIG], [dvdread-config], [no])
  test "x$DVDREAD_CONFIG" = xno && \
    AC_MSG_ERROR([dvdread-config required to link with libdvdread])
  ])
DVDREAD_CFLAGS=`$DVDREAD_CONFIG --cflags` || \
  AC_MSG_ERROR([Could not get libdvdread CFLAGS from $DVDREAD_CONFIG])
DVDREAD_LIBS=`$DVDREAD_CONFIG --libs` || \
  AC_MSG_ERROR([Could not get libdvdread LIBS from $DVDREAD_CONFIG])
AC_SUBST([DVDREAD_CFLAGS])
AC_SUBST([DVDREAD_LIBS])

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 ---------------------------------------------
INCLUDES='-I$(top_srcdir) $(DVDNAV_CFLAGS)'
AC_SUBST(INCLUDES)

dnl ---------------------------------------------
dnl Output configuration files
dnl ---------------------------------------------
AC_OUTPUT([
Makefile 
src/Makefile
src/vm/Makefile
misc/Makefile
misc/dvdnav-config
misc/dvdnav.pc
misc/dvdnavmini.pc
misc/libdvdnav.spec
misc/relchk.sh
m4/Makefile
doc/Makefile
examples/Makefile
])