1dnl Process this file with autoconf to produce a configure script.
2
3dnl
4dnl Require autoconf version 2.59
5dnl
6AC_PREREQ(2.59)
7
8m4_define([_PACKAGE], [xine-plugin])
9m4_define([_VERSION], [1.0.2])
10
11AC_INIT(_PACKAGE, _VERSION)
12AC_CONFIG_SRCDIR([src/plugin.c])
13
14PACKAGE=_PACKAGE
15VERSION=_VERSION
16AC_SUBST(PACKAGE)
17AC_SUBST(VERSION)
18
19AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
20
21AM_CONFIG_HEADER(config.h)
22
23AC_PROG_CC
24AC_PROG_INSTALL
25
26AM_DISABLE_STATIC
27AM_PROG_LIBTOOL
28AC_SUBST(LIBTOOL_DEPS)
29
30dnl
31dnl Checks for X11
32dnl
33PKG_CHECK_MODULES([X], [x11], , [AC_PATH_XTRA])
34if test x"$no_x" != x"yes"; then
35  AC_DEFINE(HAVE_X11,,[Define this if you have X11R6 installed])
36fi
37
38
39dnl
40dnl Check for xine-lib
41dnl
42AM_PATH_XINE(1.1.0,, AC_MSG_ERROR(*** You should install xine-lib first ***))
43
44
45dnl
46dnl threads: xine-config tell us what should be used, but
47dnl          xitk need to be linked to thread lib, so the follow AC_SUBST()
48dnl          are only used in src/xitk/xine-toolkit/Makefile.am
49dnl
50case "$host" in
51  *-*-freebsd*)
52    THREAD_LIBS="-L/usr/local/lib -pthread"
53    THREAD_CFLAGS="-I/usr/local/include -D_THREAD_SAFE"
54    CFLAGS="$CFLAGS -L/usr/local/lib $THREAD_CFLAGS"
55    CPPFLAGS="$CPPFLAGS -I/usr/local/include -L/usr/local/lib"
56    ;;
57
58  *-*-hpux11*)
59    THREAD_LIBS=" -pthread"
60    THREAD_CFLAGS="-D_REENTRANT"
61    CFLAGS="$THREAD_CFLAGS $CFLAGS"
62    ;;
63
64  *)
65    AC_CHECK_LIB(pthread, pthread_create,
66             THREAD_LIBS="-lpthread",
67             AC_MSG_ERROR(pthread needed))
68    ;;
69esac
70AC_SUBST(THREAD_LIBS)
71AC_SUBST(THREAD_CFLAGS)
72
73
74CFLAGS="$CFLAGS -DXP_UNIX -Wall $XINE_CFLAGS"
75AC_SUBST(CFLAGS)
76DEBUG_CFLAGS="$CFLAGS -DLOG -O -g3 -finstrument-functions"
77AC_SUBST(DEBUG_CFLAGS)
78
79dnl AC_TRY_LDFLAGS([-Wl,-z,defs], [LDFLAGS="$LDFLAGS -Wl,-z,defs"])
80
81dnl
82dnl Whether to enable scriptability
83dnl
84AC_ARG_ENABLE(scripting,
85  AC_HELP_STRING(--disable-scripting,[disable scripting support (i.e. JavaScript)]),
86  scripting="$enableval", scripting="yes")
87
88if test "x$scripting" != "xno"; then
89  AC_DEFINE(ENABLE_SCRIPTING,1,[Define to 1 to enable scripting support])
90fi
91
92dnl
93dnl Whether to enable builtin playlist parser
94dnl
95AC_ARG_ENABLE(playlist-parser,
96  AC_HELP_STRING(--disable-playlist-parser,[disable builtin playlist parser]),
97  playlist="$enableval", playlist="yes")
98
99if test "x$playlist" != "xno"; then
100  AC_DEFINE(ENABLE_PLAYLIST,1,[Define to 1 to enable builtin playlist parser])
101fi
102
103dnl
104dnl Where plugin will be installed
105dnl
106AC_ARG_WITH(plugindir,
107  AS_HELP_STRING(--with-plugindir=<dir>,[specify plugin directory [[default=~/.mozilla/plugins]]]),
108  PLUGIN_DIR="$withval", PLUGIN_DIR="")
109
110if test x"$PLUGIN_DIR" = x; then
111  PLUGIN_DIR="`echo $HOME`/.mozilla/plugins"
112fi
113
114AC_SUBST(PLUGIN_DIR)
115
116dnl
117dnl Logo format to use
118dnl
119AC_ARG_WITH(logo,
120  AS_HELP_STRING(--with-logo=<format>,[choose the logo format (ogg or png) [[default=ogg]]]),
121  logo_format="$withval", logo_format="ogg")
122
123case "$logo_format" in
124  png)
125    PLUGIN_LOGO="xine-logo.png"
126    ;;
127  *)
128    PLUGIN_LOGO="xine-logo.ogg"
129    ;;
130esac
131
132AC_SUBST(PLUGIN_LOGO)
133AC_DEFINE_UNQUOTED(LOGO_PATH,"$PLUGIN_DIR/$PLUGIN_LOGO",[Plugin logo path])
134
135dnl
136dnl It seems automake 1.5 don't take care about this script
137dnl
138if test ! -z "$am_depcomp"; then
139  DEPCOMP="depcomp"
140fi
141AC_SUBST(DEPCOMP)
142
143AC_CONFIG_FILES([
144Makefile
145include/Makefile
146include/obsolete/Makefile
147m4/Makefile
148src/Makefile
149demo/Makefile
150misc/Makefile
151misc/xine-plugin.spec
152misc/build_rpms.sh
153])
154AC_CONFIG_COMMANDS([default],[[chmod +x ./misc/build_rpms.sh]],[[]])
155AC_OUTPUT
156
157echo "----------------------------------------------------------------------"
158echo "The plugin will be installed in: $PLUGIN_DIR"
159echo "----------------------------------------------------------------------"
160