1dnl
2dnl Configure.in for xine
3dnl
4dnl
5dnl Don't forget to update the misc/xine_splash.{xcf,png}
6dnl
7
8dnl Change these three m4_define lines to set the version
9dnl Presence of .cvsversion causes an "hg" suffix
10m4_define([xine_MAJOR], [0])
11m4_define([xine_MINOR], [99])
12m4_define([xine_SUB],   [12])
13
14m4_define([xine_PRE], [m4_esyscmd([test -f .cvsversion && echo -n hg || :])])
15m4_define([xine_VERSION], [xine_MAJOR.xine_MINOR.m4_expand([xine_SUB])xine_PRE])
16
17XINE_MAJOR=xine_MAJOR
18XINE_MINOR=xine_MINOR
19XINE_SUB=xine_SUB
20XINE_PRE=xine_PRE
21
22AC_PREREQ(2.59)
23AC_INIT([xine-ui], [xine_VERSION])
24
25dnl evilness
26
27AC_CONFIG_SRCDIR([src/xitk/main.c])
28AM_CONFIG_HEADER(config.h)
29AC_CONFIG_LIBOBJ_DIR([src/common])
30
31AM_INIT_AUTOMAKE([dist-xz no-dist-gzip -Wall])
32AM_MAINTAINER_MODE
33
34m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
35
36TAR_NAME=$PACKAGE_NAME-xine_VERSION
37SPEC_VERSION=xine_VERSION
38
39AC_SUBST(XINE_MAJOR)
40AC_SUBST(XINE_MINOR)
41AC_SUBST(XINE_SUB)
42AC_SUBST(TAR_NAME)
43AC_SUBST(SPEC_VERSION)
44
45dnl
46dnl Check for programs.
47dnl
48dnl Save CFLAGS, AC_ISC_POSIX set some unwanted default CFLAGS
49dnl saved_CFLAGS="$CFLAGS"
50AC_ISC_POSIX
51dnl CFLAGS="$saved_CFLAGS"
52AC_PROG_CC
53AM_PROG_CC_C_O
54AC_MINIX dnl readline
55AC_HEADER_STDC([])
56AC_PROG_MAKE_SET
57AC_PROG_INSTALL
58AC_PROG_RANLIB
59AC_PROG_LN_S
60PKG_PROG_PKG_CONFIG
61m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
62
63dnl NLS Support
64AM_GNU_GETTEXT(external)
65AM_GNU_GETTEXT_VERSION([0.18.3])
66AC_PROG_GMSGFMT_PLURAL
67
68AC_ARG_WITH([iconv],
69   AS_HELP_STRING([--without-iconv], [Disable iconv() use for recoding. You can do this if your system is set to use UTF-8.]))
70
71if test "x$with_iconv" != "xno"; then
72  AM_ICONV
73fi
74
75AM_CONDITIONAL([HAVE_ICONV], [test "$am_cv_func_iconv" = yes])
76
77dnl
78dnl Checks for typedefs, structures, and compiler characteristics.
79dnl
80AC_C_CONST
81AC_C_INLINE
82AC_TYPE_OFF_T
83AC_TYPE_SIZE_T
84dnl AC_CHECK_TYPES([ptrdiff_t])
85dnl AC_C_BIGENDIAN
86
87dnl
88dnl Check for xine-lib
89dnl
90PKG_CHECK_MODULES([XINE], [libxine >= 1.1.0])
91XINE_LIB_SHIMS
92XINE_LIB_OPEN_CLOEXEC
93XINE_LIB_SOCKET_CLOEXEC
94XINE_LIB_LIST_NEXT_VALUE
95
96CFLAGS="${CFLAGS} ${XINE_CFLAGS}"
97
98dnl Check for xine-list-* (MIME types)
99XINE_LIST="`pkg-config --variable=xine_list libxine 2>/dev/null || xine-config --xine-list 2>/dev/null`"
100AM_CONDITIONAL([XINE_LIST], [test "$XINE_LIST" != ''])
101AC_SUBST(XINE_LIST)
102
103dnl
104dnl threads: pkgconfig tell us what should be used, but xitk needs to be
105dnl          linked to thread lib, so the following AC_SUBST() are only used
106dnl          in src/xitk/xine-toolkit/Makefile.am
107dnl
108case "$host" in
109  *-*-freebsd*)
110    THREAD_LIBS="-pthread"
111    THREAD_CFLAGS="-D_THREAD_SAFE"
112    CFLAGS="$THREAD_CFLAGS $CFLAGS"
113    ;;
114
115  *-*-openbsd*)
116    THREAD_LIBS="-pthread"
117    ;;
118
119  *-*-hpux11*)
120    THREAD_LIBS=" -pthread"
121    THREAD_CFLAGS="-D_REENTRANT"
122    CFLAGS="$THREAD_CFLAGS $CFLAGS"
123    ;;
124
125  *)
126    AC_CHECK_LIB(pthread, pthread_create,
127  	     THREAD_LIBS="-lpthread",
128 	     AC_MSG_ERROR(pthread needed))
129    ;;
130esac
131AC_SUBST(THREAD_LIBS)
132AC_SUBST(THREAD_CFLAGS)
133
134dnl
135dnl Checks for X11
136dnl
137if test "x$with_x" != "xno"; then
138   PKG_CHECK_MODULES([X11], [x11], , [AC_PATH_XTRA])
139else
140   no_x="yes"
141fi
142
143if test x"$no_x" != x"yes"; then
144    AC_DEFINE(HAVE_X11,,[Define this if you have X11R6 installed])
145fi
146AM_CONDITIONAL(HAVE_X11, [test x"$no_x" != "xyes"])
147
148PKG_CHECK_MODULES([XV], [xv], [
149  XV_LIB=$XV_LIBS
150  ac_have_xv="yes"
151  AC_DEFINE(HAVE_XV, 1, [Define this if you have libXv installed])
152], [
153  AC_CHECK_LIB(Xv, XvQueryExtension,
154            [ XV_LIB="-lXv"
155	      AC_DEFINE(HAVE_XV, 1, [Define this if you have libXv installed])
156            ],, [$X_LIBS $X_PRE_LIBS -lXext $X_EXTRA_LIBS])
157])
158
159AC_SUBST(XV_LIB)
160AM_CONDITIONAL(HAVE_XV, test x$ac_have_xv = "xyes")
161
162
163dnl
164dnl Shm
165dnl
166AC_ARG_ENABLE([shm],
167   AS_HELP_STRING([--disable-shm], [Disable shared memory support in build.]))
168AC_ARG_ENABLE([shm-default],
169   AS_HELP_STRING([--disable-shm-default], [Disable shared memory support by default.]))
170
171if test "x$enable_shm_default" = "xno"; then
172  AC_DEFINE(DISABLE_SHM_DEFAULT,,[Disable shared memory by default])
173fi
174
175dnl If we are compiling without shared memory support, then don\'t do
176dnl the checks for XShm
177if test "x$enable_shm" != "xno"; then
178  dnl Check for the Xext library (needed for XShm extension)
179  AC_CHECK_LIB(Xext, XShmAttach,
180      X_LIBS="-lXext $X_LIBS",
181      dnl On AIX, it is in XextSam instead, but we still need -lXext
182      AC_CHECK_LIB(XextSam, XShmAttach,
183          [X_LIBS="-lXextSam -lXext $X_LIBS"],
184          no_xshm_ext=yes; have_shm=no, $X_LIBS),
185      $X_LIBS)
186
187  dnl Test for shared memory headers and semantics, unless we are
188  dnl configured to build without shared memory extensions.
189  AC_CHECK_HEADERS([sys/ipc.h sys/shm.h], [have_shm=no])
190
191  if test "x$have_shm" != "xno" ; then
192    AC_DEFINE(HAVE_SHM,,[Define if have shm])
193  fi
194
195  dnl Check whether shmctl IPC_RMID allowes subsequent attaches
196  if test "$ac_cv_header_sys_shm_h" = "yes"; then
197    AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
198    AC_TRY_RUN([
199          #include <sys/types.h>
200          #include <sys/ipc.h>
201          #include <sys/shm.h>
202          int main()
203          {
204            int id;
205            char *shmaddr;
206          id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0777);
207          if (id == -1)
208            exit (2);
209            shmaddr = shmat (id, 0, 0);
210            shmctl (id, IPC_RMID, 0);
211            if ((char*) shmat (id, 0, 0) == (char*) -1)
212            {
213              shmdt (shmaddr);
214              exit (1);
215            }
216            shmdt (shmaddr);
217            shmdt (shmaddr);
218            exit (0);
219          }
220      ],
221      AC_DEFINE(IPC_RMID_DEFERRED_RELEASE,,[Define if IPC_RMID_DEFERRED_RELEASE is true])
222        AC_MSG_RESULT(yes),
223      AC_MSG_RESULT(no),
224      AC_MSG_RESULT(assuming no))
225  fi
226
227  dnl Check for the X shared memory extension header file
228  if test "x$no_xext_lib" != "xyes"; then
229    saved_CPPFLAGS=$CPPFLAGS
230    CPPFLAGS="$CPPFLAGS $X_CFLAGS"
231    AC_CHECK_HEADERS([X11/extensions/XShm.h], , , [#include <X11/Xlib.h>])
232    CPPFLAGS=$saved_CPPFLAGS
233  fi
234fi
235
236
237dnl
238dnl Checks for Xinerama extension
239dnl
240AC_ARG_ENABLE([xinerama],
241   AS_HELP_STRING([--disable-xinerama], [Do not build support for xinerama (default: check)]))
242if test "x$enable_xinerama" != "xno"; then
243  PKG_CHECK_MODULES([XINERAMA], [xinerama], [ac_have_xinerama="yes"], [
244    AC_CHECK_LIB(Xinerama, XineramaQueryExtension,
245               XINERAMA_LIBS="-lXinerama"
246               ac_have_xinerama="yes",,
247               $X_LIBS $X_PRE_LIBS -lXext $X_EXTRA_LIBS)
248  ])
249
250  if test "x$ac_have_xinerama" = "xyes"; then
251     X_PRE_LIBS="$X_PRE_LIBS $XINERAMA_LIBS"
252     AC_DEFINE(HAVE_XINERAMA,,[Define this if you have libXinerama installed])
253  fi
254fi
255AM_CONDITIONAL(HAVE_XINERAMA, test x$ac_have_xinerama = "xyes")
256
257
258dnl
259dnl Checks for XF86VidMode extension
260dnl
261PKG_CHECK_MODULES([XXF86VM], [xxf86vm], [ac_have_xf86vidmode="yes"], [
262  AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension,
263             XXF86VM_LIBS="-lXxf86vm"
264             ac_have_xf86vidmode="yes",,
265             $X_LIBS $X_PRE_LIBS -lXext $X_EXTRA_LIBS)
266])
267
268if test "x$ac_have_xf86vidmode" = "xyes"; then
269   X_PRE_LIBS="$X_PRE_LIBS ${XXF86VM_LIBS}"
270   AC_DEFINE(HAVE_XF86VIDMODE,,[Define this if you have libXxf86vm installed])
271fi
272
273AM_CONDITIONAL(HAVE_XF86VIDMODE, test x$ac_have_xf86vidmode = "xyes")
274
275
276dnl
277dnl XTest Extension
278dnl
279PKG_CHECK_MODULES([XTEST], [xtst], [ac_have_xtest="yes"], [
280  AC_CHECK_LIB(Xtst, XTestFakeKeyEvent,
281             XTEST_LIBS="-lXtst"
282	     ac_have_xtest="yes",, $X_LIBS $X_PRE_LIBS -lXext $X_EXTRA_LIBS)
283])
284
285if test "x$ac_have_xtest" = "xyes"; then
286   AC_DEFINE(HAVE_XTESTEXTENSION,,[Define this if you have libXtst installed])
287fi
288
289AC_SUBST(XTEST_LIBS)
290AM_CONDITIONAL(HAVE_XTESTEXTENSION, test x$ac_have_xtest = "xyes")
291
292dnl
293dnl XScreenSaver Extension
294dnl
295PKG_CHECK_MODULES([XSSAVER], [xscrnsaver], [ac_have_xscreensaver="yes"], [
296  AC_CHECK_LIB(Xss, XScreenSaverQueryExtension,
297		XSSAVER_LIBS="-lXss"
298		ac_have_xscreensaver="yes",,  $X_LIBS $X_PRE_LIBS -lXext $X_EXTRA_LIBS)
299])
300
301if test "x$ac_have_xscreensaver" = "xyes"; then
302  AC_DEFINE(HAVE_XSSAVEREXTENSION,,[Define this if you have libXss installed])
303fi
304
305AC_SUBST(XSSAVER_LIBS)
306AM_CONDITIONAL(HAVE_XSSAVEREXTENSION, test x$ac_have_xscreensaver = "xyes")
307
308
309dnl
310dnl readline
311dnl
312if test x"$with_readline" != xno; then
313  AC_CHECK_READLINE
314fi
315
316AM_CONDITIONAL(HAVE_READLINE, test x"$have_readline" = "xyes")
317if test x"$have_readline" != "xyes"; then
318  AC_MSG_RESULT([*** no readline found, xine network interface will be disabled ***])
319fi
320
321dnl
322dnl Libcurl
323dnl
324AC_ARG_WITH([curl],
325   AS_HELP_STRING([--without-curl], [Turn off CURL support.]))
326
327if test x"$with_curl" != xno; then
328   PKG_CHECK_MODULES([CURL], [libcurl >= 7.10.2], have_curl="yes", have_curl="no")
329
330   if test "x$have_curl" = "xyes"; then
331      AC_DEFINE([HAVE_CURL], [1], [Define this if you have libcurl installed])
332   else
333      AC_MSG_RESULT([*** All of curl dependent parts will be disabled ***])
334   fi
335fi
336AM_CONDITIONAL(HAVE_CURL, test x$have_curl = "xyes")
337
338
339dnl
340dnl
341dnl
342NET_LIBS=""
343AC_CHECK_LIB(socket, socket, NET_LIBS="-lsocket $NET_LIBS",)
344AC_CHECK_LIB(nsl, gethostbyname, NET_LIBS="-lnsl $NET_LIBS",)
345AC_SUBST(NET_LIBS)
346
347dnl
348dnl check for ascii-art library
349dnl
350AC_ARG_WITH([aalib],
351   AS_HELP_STRING([--without-aalib], [Turn off AALIB support.]))
352
353if test x"$with_aalib" != "xno"; then
354  AM_PATH_AALIB(1.2.0,,)
355  if test x"$no_aalib" != "xyes"; then
356    AM_DL()
357  fi
358else
359  no_aalib=yes
360fi
361AM_CONDITIONAL(HAVE_AA, test x$no_aalib != "xyes")
362
363dnl
364dnl checks for Color AsCii Art library
365dnl
366AC_ARG_WITH([caca],
367  AS_HELP_STRING([--without-caca], [Do not build CACA support]))
368
369have_cucul=yes
370if test "x$with_caca" != "xno"; then
371   PKG_CHECK_MODULES([CACA], [caca >= 0.99beta19],
372                     [have_caca="yes"
373                      have_cucul="no"],
374                     [PKG_CHECK_MODULES([CACA], [caca cucul], [have_caca="yes"], [have_caca="no"])])
375   if test "x$with_caca" = "xyes" && test "x$have_caca" = "xno"; then
376      AC_MSG_ERROR([CACA support requested, but libcaca 0.99 not found])
377   fi
378   if test "x$have_caca" = "xyes"; then
379     AM_DL()
380   fi
381   AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <caca.h>
382                                        caca_event_t ev;]],
383                                        [[ev.type = 0;]]
384                       )],
385                       [],
386                       [AC_DEFINE(CACA_EVENT_OPAQUE, [1], ["Define if struct caca_event is opaque and must not be accessed directly"])]
387   )
388
389fi
390AM_CONDITIONAL([HAVE_CACA], [test "x$have_caca" = "xyes"])
391if test x"$have_caca$have_cucul" = x"yesyes"; then
392   HAVE_CUCUL=1
393   AC_SUBST([CUCUL])
394fi
395
396dnl option for font sets and multibyte string support
397AC_ARG_ENABLE([mbs],
398   AS_HELP_STRING([--disable-mbs], [Disable multibyte string support]))
399if test "x$enable_mbs" != "xno"; then
400  AC_DEFINE(WITH_XMB,,[Define this if you want support multibyte strings in gui])
401fi
402
403dnl
404dnl Check for Xft
405dnl
406AC_MSG_CHECKING([whether to have Xft support])
407AM_PATH_XFT(yes, XFT=true, XFT=false)
408if test x"$XFT" = "xtrue" ; then
409  saved_CFLAGS=$CFLAGS
410  saved_LIBS=$LIBS
411  CFLAGS="$CFLAGS $XFT_CFLAGS"
412  LIBS="$LIBS $XFT_LIBS"
413  AC_TRY_LINK([
414#include <X11/Xft/Xft.h>], [ XftFontClose(0, 0); return 1; ],
415    [
416      AC_DEFINE(WITH_XFT, 1, [font antialiasing support])
417      AC_MSG_CHECKING([Xft UTF-8 support])
418      AC_TRY_LINK([
419#include <X11/Xft/Xft.h>
420        ], [
421XftDrawStringUtf8(0, 0, 0, 0, 0, 0, 0); return 0;
422        ],
423          AC_DEFINE(HAVE_XFT_UTF8_STRING, 1, "Xft UTF8 support")
424          AC_MSG_RESULT(yes),
425          AC_MSG_RESULT(no))
426    ],
427    [
428      AC_MSG_RESULT([***Could not link with Xft. Install Xft if you want support for it***])
429      XFT=false
430      XFT_CFLAGS=
431      XFT_LIBS=
432    ])
433  CFLAGS=$saved_CFLAGS
434  LIBS=$saved_LIBS
435fi
436AM_CONDITIONAL(WITH_XFT, test x"$XFT" = "xtrue")
437
438AC_ARG_WITH([fb], AS_HELP_STRING([--without-fb], [Turn off framebuffer support]))
439AM_CONDITIONAL([HAVE_FB], [test "x$with_fb" != xno])
440
441dnl
442dnl Check for DirectFB
443dnl
444
445dnl NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
446dnl  DFB:
447dnl  Temporary disabled, port to new API needed
448dnl NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
449  if test "x" != "x"; then
450
451    DIRECTFB_REQUIRED_VERSION=0.9.10
452    PKG_CHECK_MODULES([DIRECTFB], [directfb >= $DIRECTFB_REQUIRED_VERSION],
453       [have_directfb=yes], [have_directfb=no])
454
455    if test "x$have_directfb" != "xyes"; then
456       AC_MSG_RESULT([*** All of DirectFB dependent parts will be disabled ***])
457    fi
458  fi
459
460AC_SUBST(DIRECTFB_CFLAGS)
461AC_SUBST(DIRECTFB_LIBS)
462AM_CONDITIONAL(HAVE_DIRECTFB, test x$have_directfb = "xyes" )
463
464dnl
465dnl check for libpng
466dnl
467PKG_CHECK_MODULES([LIBPNG], [libpng >= 1.2.8],,
468  [PKG_CHECK_MODULES([LIBPNG], [libpng12 >= 1.2.8])])
469
470dnl
471dnl check for libjpeg
472dnl
473AC_ARG_VAR([JPEG_CFLAGS], [C compiler flags for libjpeg])
474AC_ARG_VAR([JPEG_LIBS], [Linker flags for libjpeg])
475JPEG_LIBS="${JPEG_LIBS:--ljpeg}"
476saved_CFLAGS="$CFLAGS"
477saved_LIBS="$LIBS"
478CFLAGS="$CFLAGS $JPEG_CFLAGS"
479LIBS="$LIBS $JPEG_LIBS"
480AC_CHECK_LIB([jpeg], [jpeg_read_header],,
481             [AC_CHECK_HEADER([jpeglib.h], [],
482                              [AC_MSG_ERROR([JPEG library is required])])],
483             [$JPEG_LIBS])
484CFLAGS="$saved_CFLAGS"
485LIBS="$saved_LIBS"
486
487dnl
488dnl Check for LIRC client support
489dnl
490AC_CHECK_LIRC
491
492
493dnl
494dnl user selectable support for special VDR interaction keys
495dnl
496AC_ARG_ENABLE([vdr-keys],
497   AS_HELP_STRING([--enable-vdr-keys], [Support special keys for VDR interaction.]))
498if test x"$enable_vdr_keys" = xyes ; then
499  AC_DEFINE(ENABLE_VDR_KEYS,, [Define this if you want support for VDR keys.])
500fi
501
502
503dnl
504dnl Check for nvtvsimple library
505dnl
506AC_ARG_ENABLE([nvtvsimple],
507   AS_HELP_STRING([--disable-nvtvsimple], [Disable support for nvtvsimple]))
508
509if test "x$enable_nvtvsimple" != "xno"; then
510   PKG_CHECK_MODULES([NVTVSIMPLE], [nvtvsimple >= 0.4.6],
511      [nvtvsimple="yes"], [nvtvsimple="no"])
512fi
513
514if test "x$nvtvsimple" = "xyes"; then
515   AC_DEFINE([HAVE_NVTVSIMPLE], [1], [Define this if you have nvtvsimple installed])
516else
517   AC_MSG_RESULT([*** nvtvsimple support will be disabled ***])
518fi
519
520dnl
521dnl xine-ui use tar, check it
522dnl
523AC_ARG_WITH([tar],
524   AS_HELP_STRING([--without-tar], [Do not use the tar command from within xine-ui (disable skin download)]))
525
526if test "x$with_tar" != "xno"; then
527   AC_CHECK_PROGS(TAR, [tar bsdtar star])
528fi
529
530if test x"$TAR" = "x"; then
531    AC_MSG_RESULT([*** tar-dependent part will be disabled (skin download) ***])
532else
533    AC_DEFINE(HAVE_TAR,,[Define this if you have tar installed])
534fi
535AM_CONDITIONAL([HAVE_TAR], [test x"$TAR" != "x"])
536
537
538dnl
539dnl
540dnl
541BUILD_CC="`$CC -v 2>&1 | tail -n 1`"
542BUILD_OS="`uname -s -r -m`"
543BUILD_DATE="`date "+%a %d %b %Y %T"`"
544AC_SUBST(BUILD_CC)
545AC_SUBST(BUILD_OS)
546AC_SUBST(BUILD_DATE)
547
548if test "$GCC" = yes; then
549    dnl
550    dnl Warnings
551    dnl
552    CFLAGS="-Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes $CFLAGS"
553    CFLAGS="-Wnested-externs -Wcast-align $CFLAGS"
554    dnl some combinations of gcc+glibc produce useless warnings on memset
555    dnl when compiling with -Wpointer-arith, so we check for this first
556    AC_MSG_CHECKING(for sane -Wpointer-arith)
557    SAVE_CFLAGS="$CFLAGS"
558    CFLAGS="-O2 -Wpointer-arith -Werror $CFLAGS"
559    AC_TRY_COMPILE([#include <string.h>],[int a; memset(&a, 0, sizeof(int));],
560	[AC_MSG_RESULT(yes); CFLAGS="-Wpointer-arith $SAVE_CFLAGS"],
561	[AC_MSG_RESULT(no);  CFLAGS="$SAVE_CFLAGS"]);
562fi
563
564dnl Flags not supported by all *cc* variants
565AC_TRY_CFLAGS("-Wall", wall="-Wall", wall="")
566AC_TRY_CFLAGS("-fno-strict-aliasing", NO_STRICT_ALIASING="-fno-strict-aliasing")
567AC_SUBST(NO_STRICT_ALIASING)
568
569CFLAGS="$wall -D_FILE_OFFSET_BITS=64 $CFLAGS $ALSA_CFLAGS $ESD_CFLAGS"
570AC_SUBST(CFLAGS)
571
572AC_ARG_ENABLE([debug],
573   AS_HELP_STRING([--enable-debug], [Compile with debug information]))
574
575if test "x$enable_debug" = "xyes"; then
576   CFLAGS="$CFLAGS -DDEBUG -g"
577else
578   CFLAGS="$CFLAGS -DNDEBUG"
579fi
580
581dnl gcc __attribute__ ((aligned ()))
582AC_C_ATTRIBUTE_ALIGNED
583
584dnl
585dnl system function checks (defined _GNU_SOURCE)
586dnl
587AC_DEFINE([_GNU_SOURCE], [], [enable GNU libc extension])
588AC_CHECK_LIB(posix4, nanosleep)
589AC_CHECK_FUNCS([nanosleep])
590AC_REPLACE_FUNCS([getline getsubopt strlcat strlcpy strndup strsep])
591AC_CHECK_HEADERS(string.h strings.h linux/kd.h execinfo.h)
592AC_CHECK_HEADERS(sys/utsname.h)
593
594dnl
595dnl Check for clock_gettime() in librt
596dnl
597AC_MSG_CHECKING(whether librt is needed)
598AC_TRY_COMPILE(
599	[#include <unistd.h>
600	 #include <sys/time.h>],
601	[#if _POSIX_TIMERS > 0
602	 struct timespec ts;
603	 clock_gettime(CLOCK_REALTIME, &ts);
604	 #endif],
605	[AC_MSG_RESULT(no); RT_LIBS=""],
606	[AC_MSG_RESULT(yes); RT_LIBS="-lrt"]);
607AC_SUBST(RT_LIBS)
608
609dnl
610dnl Check for GNU getopt_long()
611dnl
612AC_MSG_CHECKING(for GNU getopt_long)
613AC_TRY_RUN([
614#include <stdio.h>
615#include <stdlib.h>
616#include <getopt.h>
617
618static struct option long_options[] = {
619  {"help"    , no_argument, 0, 1 },
620  {"version" , no_argument, 0, 2 },
621  {0         , no_argument, 0, 0 }
622};
623
624int main(int argc, char **argv) {
625  int option_index = 0;
626  int c;
627
628  opterr = 0;
629  while((c = getopt_long(argc, argv, "?hv",
630			 long_options, &option_index)) != EOF) {
631  }
632  return 0;
633}
634], [AC_MSG_RESULT(yes);
635	ac_getopt_long=yes;
636	AC_DEFINE(HAVE_GETOPT_LONG,,[Define this if you have GNU getopt_long() implemented])],
637   [AC_MSG_RESULT(no); ac_getopt_long=no],
638   [AC_MSG_RESULT(no); ac_getopt_long=no])
639AM_CONDITIONAL(HAVE_GETOPT_LONG, test x"$ac_getopt_long" = "xyes")
640
641dnl
642dnl desktop dir location, pkgconfig told us about this.
643dnl
644makeexpand () {
645  local i
646  local j
647  i="$1"
648  while test "$i" != "$j"; do j="$i"; eval i="$j"; done
649  echo "$i"
650}
651
652if test "x$prefix" = xNONE; then
653   prefix="${ac_default_prefix}"
654fi
655if test "x$exec_prefix" = xNONE; then
656   exec_prefix='${prefix}'
657fi
658
659dnl
660dnl NLS, part II
661dnl
662XITK_LOCALEPATH="`makeexpand ${datadir}/locale`"
663AC_DEFINE_UNQUOTED(XITK_LOCALE, "$XITK_LOCALEPATH", [Location of Xine catalog files])
664
665if test "x$XINE_DOCPATH" = "x"; then
666   XINE_DOCPATH="${datadir}/doc/xine-ui"
667fi
668XINE_DOCDIR="`makeexpand $XINE_DOCPATH`"
669AC_SUBST(XINE_DOCDIR)
670AC_DEFINE_UNQUOTED(XINE_DOCDIR, "$XINE_DOCDIR",[Location of documentation files])
671
672dnl
673dnl skins dir location, pkgconfig told us about this.
674dnl
675XINE_SKINDIR="${datadir}/xine/skins"
676XINE_SKINPATH="`makeexpand ${datadir}/xine/skins`"
677AC_SUBST(XINE_SKINDIR)
678AC_SUBST(XINE_SKINPATH)
679AC_DEFINE_UNQUOTED(XINE_SKINDIR, "$XINE_SKINPATH",[Location of xine skin directory])
680
681dnl
682dnl Use whichever splash & logo happen to be present.
683dnl JPEG is preferred, then PNG then, for the logo, MPV.
684dnl
685SOURCE_SPLASH="${SOURCE_SPLASH:-`cat "${srcdir}${srcdir:+/}misc/splash"`}"
686AC_SUBST([SOURCE_SPLASH])
687
688dnl XINE_LOCATE_MEDIA(variable, extns, pref. extn, leafname, purpose, comment)
689AC_DEFUN([XINE_LOCATE_MEDIA],
690 [AC_MSG_CHECKING([for a $5 image])
691  $1=''
692  for i in $2; do
693    ac_cv_xine_media_file="misc/splash-${SOURCE_SPLASH}/$4.$i"
694    if test -f "${srcdir}${srcdir:+/}$ac_cv_xine_media_file"; then
695      $1="$XINE_SKINDIR/$4.$i"
696      break
697    fi
698  done
699  if test "$[]$1" = ''; then
700    $1="$XINE_SKINDIR/$4.$3"
701    ac_cv_xine_media_file="/misc/splash-default/$4.$3"
702    if ! test -f "${srcdir}${srcdir:+/}$ac_cv_xine_media_file"; then
703      AC_MSG_RESULT([no])
704      AC_MSG_ERROR([Missing $5 image - need $4.* (any of $2)])
705    fi
706  fi
707  AC_MSG_RESULT([$ac_cv_xine_media_file])
708  AC_DEFINE_UNQUOTED([$1], "`makeexpand $[]$1`", [$6])
709  AC_SUBST([$1], [$ac_cv_xine_media_file])
710])
711
712XINE_LOCATE_MEDIA([XINE_LOGO_MRL], [jpg png mpv], [mpv], [xine-ui_logo], [logo], [official logo MRL])
713XINE_LOCATE_MEDIA([XINE_LOGO2_MRL], [mpg], [mpg], [xine-ui_logo], [logo2], [official logo MRL])
714XINE_LOCATE_MEDIA([XINE_SPLASH], [jpg png], [png], [xine_splash], [splash], [splash image filename])
715
716XINE_VISDIR="${datadir}/xine/visuals"
717AC_SUBST(XINE_VISDIR)
718AC_DEFINE_UNQUOTED(XINE_VISDIR, "`makeexpand $XINE_VISDIR`",[Location of xine visual animation streams])
719
720XINE_OXINEDIR="${datadir}/xine/oxine"
721AC_SUBST(XINE_OXINEDIR)
722AC_DEFINE_UNQUOTED(XINE_OXINEDIR, "`makeexpand $XINE_OXINEDIR`",[Location of osd menu (oxine) config files])
723
724DATA_DIR=`makeexpand "$datadir"`
725AC_SUBST(DATA_DIR)
726SYSCONF_DIR=`makeexpand "$sysconfdir"`
727AC_SUBST(SYSCONF_DIR)
728
729dnl
730dnl Some include paths ( !!! DO NOT REMOVE !!! )
731dnl
732AM_CPPFLAGS='-I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/src -I$(top_builddir)/src -I$(top_srcdir)/src/common -I$(top_builddir)/src/common -I$(top_srcdir)/src/xitk/xine-toolkit -I$(top_builddir)/src/xitk/xine-toolkit -I$(prefix)/include $(INTLDIR)'
733AC_SUBST(AM_CPPFLAGS)
734
735AC_DEFINE(NEED_MRLBROWSER,,[Define this to add mrl browser into xitk lib])
736
737dnl Important warnings we _don't_ want to skip
738dnl Don't put these under conditional for optimisations, because these
739dnl need always to be enabled.
740AC_TRY_CFLAGS("-Wformat", wformat="-Wformat")
741AC_TRY_CFLAGS("-Wformat=2", wformat="-Wformat=2")
742if test "x$wformat" != "x"; then
743   AC_TRY_CFLAGS("-Wno-format-zero-length", wformat="$wformat -Wno-format-zero-length")
744fi
745AC_TRY_CFLAGS("-Wmissing-format-attribute", wformat="$wformat -Wmissing-format-attribute")
746CFLAGS="$CFLAGS $wformat"
747
748wbits=''
749AC_TRY_CFLAGS("-Wmissing-noreturn", wbits="$wbits -Wmissing-noreturn")
750AC_TRY_CFLAGS("-Wdisabled-optimization", wbits="$wbits -Wdisabled-optimization")
751AC_TRY_CFLAGS("-Werror-implicit-function-declaration", wbits="$wbits -Werror-implicit-function-declaration")
752CFLAGS="$CFLAGS $wbits"
753
754AC_TRY_CFLAGS("-Wstrict-aliasing", wsa="-Wstrict-aliasing")
755AC_TRY_CFLAGS("-Wstrict-aliasing=2", wsa="-Wstrict-aliasing=2")
756CFLAGS="$CFLAGS $wsa"
757
758dnl
759dnl It seems automake 1.5 don't take care about this script
760dnl
761if test ! -z "$am_depcomp"; then
762	DEPCOMP="depcomp"
763fi
764AC_SUBST(DEPCOMP)
765
766
767dnl
768dnl Newest automake workaround
769dnl
770
771AC_SUBST(mkdir_p)
772if test -n "$ac_aux_dir"; then
773  case "$ac_aux_dir" in
774    /*) MKINSTALLDIRS="$ac_aux_dir/install-sh -d" ;;
775    *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/install-sh -d" ;;
776  esac
777else
778  MKINSTALLDIRS="\$(top_srcdir)/install-sh -d"
779fi
780AC_SUBST(MKINSTALLDIRS)
781
782dnl
783dnl Output configuration files
784dnl
785AC_CONFIG_FILES([
786Makefile
787m4/Makefile
788src/Makefile
789src/common/Makefile
790src/xitk/Makefile
791src/xitk/Imlib-light/Makefile
792src/xitk/xine-toolkit/Makefile
793src/xitk/xine-toolkit/po/Makefile.in
794src/xitk/skins/Makefile
795src/xitk/skins/xinetic/Makefile
796src/xitk/oxine/Makefile
797src/xitk/oxine/data/Makefile
798src/aaui/Makefile
799src/dfb/Makefile
800src/fb/Makefile
801doc/Makefile
802doc/man/Makefile
803doc/man/de/Makefile
804doc/man/de/xine.1
805doc/man/de/aaxine.1
806doc/man/de/xine-check.1
807doc/man/en/Makefile
808doc/man/en/xine.1
809doc/man/en/aaxine.1
810doc/man/en/xine-check.1
811doc/man/fr/Makefile
812doc/man/fr/xine.1
813doc/man/es/Makefile
814doc/man/es/xine.1
815doc/man/es/aaxine.1
816doc/man/es/xine-check.1
817doc/man/pl/Makefile
818doc/man/pl/xine.1
819doc/man/pl/aaxine.1
820misc/Makefile
821misc/build_rpms.sh
822misc/SlackBuild
823misc/xine-ui.spec
824misc/desktops/Makefile
825misc/visuals/Makefile
826po/Makefile.in
827])
828AC_CONFIG_COMMANDS([default],[[chmod +x ./misc/SlackBuild ./misc/build_rpms.sh]],[[]])
829AC_OUTPUT
830