summaryrefslogtreecommitdiffstats
path: root/configure.in
blob: a930bfa0eef1d31475011ae62e56fe872b3f28f8 (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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
dnl    This file is part of the KDE libraries/packages
dnl    Copyright (C) 2001 Stephan Kulow (coolo@kde.org)
 
dnl    This file is free software; you can redistribute it and/or
dnl    modify it under the terms of the GNU Library General Public
dnl    License as published by the Free Software Foundation; either
dnl    version 2 of the License, or (at your option) any later version.
 
dnl    This library is distributed in the hope that it will be useful,
dnl    but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dnl    Library General Public License for more details.
 
dnl    You should have received a copy of the GNU Library General Public License
dnl    along with this library; see the file COPYING.LIB.  If not, write to
dnl    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
dnl    Boston, MA 02110-1301, USA.

# Original Author was Kalle@kde.org
# I lifted it in some mater. (Stephan Kulow)
# I used much code from Janos Farkas

dnl Process this file with autoconf to produce a configure script.

AC_INIT(acinclude.m4) dnl a source file from your sub dir

dnl This is so we can use kde-common
AC_CONFIG_AUX_DIR(admin)

dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
unset CDPATH

dnl Checking host/target/build systems, for make, install etc.
AC_CANONICAL_SYSTEM 
dnl Perform program name transformation
AC_ARG_PROGRAM

dnl Automake doc recommends to do this only here. (Janos)
AM_INIT_AUTOMAKE(k9copy, 1.2.4) dnl searches for some needed programs

KDE_SET_PREFIX

dnl generate the config header
AM_CONFIG_HEADER(config.h) dnl at the distribution this done

dnl Checks for programs.
AC_CHECK_COMPILERS
AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
KDE_PROG_LIBTOOL

dnl for NLS support. Call them in this order!
dnl WITH_NLS is for the po files
AM_KDE_WITH_NLS

KDE_USE_QT(3.0.0)
AC_PATH_KDE
#MIN_CONFIG(3.0.0)

dnl PACKAGE set before
AC_C_BIGENDIAN
AC_CHECK_KDEMAXPATHLEN

case "$target" in
    i?86-* | k?-*)
        AC_DEFINE([ARCH_X86],,[x86 architecture])
        AC_DEFINE([ARCH_386],,[386 architecture])
        ARCH_X86=yes
        ARCH_386=yes
        ARCH_X86_64=no
        ;;
    x86_64-*)
        AC_DEFINE([ARCH_X86_64],,[x86_64 architecture])
        ARCH_X86=no
        ARCH_386=no
        ARCH_X86_64=yes
        ;;
    *)
        ARCH_X86=no
        ARCH_386=no
        ARCH_X86_64=no
        ;;
esac

AC_MSG_CHECKING(for X86 architecture)
AC_MSG_RESULT($ARCH_X86)
AM_CONDITIONAL(ARCH_X86, [test "$ARCH_X86" = "yes"])

AC_MSG_CHECKING(for 386 architecture)
AC_MSG_RESULT($ARCH_386)
AM_CONDITIONAL(ARCH_386, [test "$ARCH_386" = "yes"])

AC_MSG_CHECKING(for X86_64 architecture)
AC_MSG_RESULT($ARCH_X86_64)
AM_CONDITIONAL(ARCH_X86_64, [test "$ARCH_X86_64" = "yes"])

have_gl=no
AC_CHECK_HEADER([GL/gl.h], \
[AC_DEFINE(HAVE_OPENGL, 1, [openGL support]) have_gl=yes], \
[AC_DEFINE(NO_OPENGL, 1, [No openGL support])])


AC_CHECK_HEADER([ffmpeg/avcodec.h], \
[AC_DEFINE(OLD_FFMPEG,1, [old ffmpeg])], \
  [AC_CHECK_HEADER([libavcodec/avcodec.h], \
   [AC_DEFINE(NEW_FFMPEG,1, [new ffmpeg])], \
   [AC_MSG_ERROR([libavcodec may be missing]) ])])

AC_LANG_SAVE
AC_LANG_CPLUSPLUS
cxx_flags_safe="$CXXFLAGS"
cflags_safe="$CFLAGS"
CXXFLAGS="$CXXFLAGS -D__STDC_CONSTANT_MACROS"
CFLAGS="$CFLAGS -D__STDC_CONSTANT_MACROS"
AC_MSG_CHECKING([if libavformat/avformat.h provides av_free_packet])
AC_TRY_LINK([#include <libavformat/avformat.h>
],[AVPacket *packet; av_free_packet(packet);],
AC_MSG_RESULT(yes),
[AC_MSG_RESULT(no)
AC_DEFINE(NEEDS_AV_FREE_PACKET,1,[no])])
CXXFLAGS="$cxx_flags_safe"
CFLAGS="$cflags_safe"
AC_LANG_RESTORE

  have_hal=no
  AC_MSG_CHECKING(for the HAL)

  AC_ARG_ENABLE([k3bdevices], 
                AC_HELP_STRING([--enable-k3bdevices], 
                [do not activate hal/dbus support (use k3bdevice instead)]),
                [enable_hal=no], 
                [enable_hal=yes])


  if test x"$enable_hal" = xyes; then
	hal_inc=NOTFOUND
	hal_lib=NOTFOUND
	hal=NOTFOUND
	
	search_incs="$kde_includes /usr/include /usr/include/hal /usr/local/include /usr/local/include/hal"
	AC_FIND_FILE(libhal.h libhal-storage.h, $search_incs, hal_incdir)
	
	if [test -r $hal_incdir/libhal.h] ; then
	HAL_INCS="-I$hal_incdir"
	hal_inc=FOUND
	fi
	
	if test -r $hal_incdir/libhal-storage.h ; then
	hal_storage_version=4
	grep LibHalVolume $hal_incdir/libhal-storage.h \
	> /dev/null 2>&1 && hal_storage_version=5
	if test $hal_storage_version = 4 ; then
	AC_DEFINE(HAL_0_4, , [HAL API version 0.4])
	fi
	fi
	
	search_libs="$kde_libraries /usr/lib64 /usr/lib /usr/local/lib /lib /lib64"
	AC_FIND_FILE(libhal.so, $search_libs, hal_libdir)
	
	if [test -r $hal_libdir/libhal.so] ; then
	HAL_LIBS="-L$hal_libdir -lhal"
	hal_lib=FOUND
	fi
	
	if [test -r $hal_libdir/libhal-storage.so] ; then
	HAL_LIBS_STORAGE="-L$hal_libdir -lhal-storage"
	hal_lib_storage=FOUND
	fi
	
	if [test $hal_inc = FOUND] && [test $hal_lib = FOUND] ; then
	AC_MSG_RESULT(headers $hal_incdir  libraries $hal_libdir)
		hal=FOUND
	else
	AC_MSG_RESULT(searched but not found)
	AC_MSG_ERROR(libhal may be missing) 
	fi
	
	AC_SUBST(HAL_INCS)
	AC_SUBST(HAL_LIBS)
	
	
	########### Check for DBus
	
	AC_MSG_CHECKING(for DBus)
	
	dbus_inc=NOTFOUND
	dbus_lib=NOTFOUND
	dbus=NOTFOUND
	
	search_incs="$kde_includes /usr/include /usr/include/dbus-1.0 /usr/local/include /usr/local/include/dbus-1.0"
	AC_FIND_FILE(dbus/dbus.h, $search_incs, dbus_incdir)
	
	search_incs_arch_deps="$kde_includes /usr/lib64/dbus-1.0/include /usr/lib/dbus-1.0/include /usr/local/lib/dbus-1.0/include"
	AC_FIND_FILE(dbus/dbus-arch-deps.h, $search_incs_arch_deps, dbus_incdir_arch_deps)
	
	if [test -r $dbus_incdir/dbus/dbus.h] && [test -r $dbus_incdir_arch_deps/dbus/dbus-arch-deps.h] ; then
	DBUS_INCS="-I$dbus_incdir -I$dbus_incdir_arch_deps"
	dbus_inc=FOUND
	fi
	
	search_libs="$kde_libraries /usr/lib64 /usr/lib /usr/local/lib /lib /lib64"
	AC_FIND_FILE(libdbus-1.so, $search_libs, dbus_libdir)
	
	if test -r $dbus_libdir/libdbus-1.so ; then
	DBUS_LIBS="-L$dbus_libdir -ldbus-1"
	dbus_lib=FOUND
	fi
	
	if [test $dbus_inc = FOUND] && [test $dbus_lib = FOUND] ; then
	AC_MSG_RESULT(headers $dbus_incdir $dbus_incdir_arch_deps  libraries $dbus_libdir)
	dbus=FOUND
	else
	AC_MSG_RESULT(searched but not found)
	AC_MSG_ERROR(dbus may be missing) 
	fi
	
	AC_SUBST(DBUS_INCS)
	AC_SUBST(DBUS_LIBS)
	
	
	########### Check if media HAL backend should be compiled
	
	HAL_DBUS_LIBS=""
	if [test "x$hal" = "xFOUND"] && [test "x$dbus" = "xFOUND"] &&  [ test $hal_storage_version = 5 ] ; then
	AC_DEFINE(HAVE_HAL, , [compile in HAL support])
	have_hal=yes
	HAL_DBUS_LIBS="$HAL_LIBS $HAL_LIBS_STORAGE $DBUS_LIBS"
	fi
	
	AC_SUBST(HAL_DBUS_LIBS)
else
	search_incs="$kde_includes /usr/include /usr/local/include"
	AC_FIND_FILE(k3bdevice.h, $search_incs, k3b_incdir)
	
	if [test -r $k3b_incdir/k3bdevice.h] ; then
		k3b_inc=FOUND
	fi
		
	search_libs="$kde_libraries /usr/lib64 /usr/lib /usr/local/lib /lib /lib64"
	AC_FIND_FILE(libk3bdevice.so, $search_libs, k3b_libdir)
	
	if [test -r $k3b_libdir/libk3bdevice.so] ; then
		K3B_LIBS="-lk3bdevice"
		k3b_lib=FOUND
	fi
		
	if [test $k3b_inc = FOUND] && [test $k3b_lib = FOUND] ; then
		AC_MSG_RESULT(headers $k3b_incdir  libraries $k3b_libdir)
		k3b=FOUND
	else
		AC_MSG_RESULT(libk3bdevice searched but not found)
		AC_MSG_ERROR(libk3bdevice may be missing) 
	fi
	
	AC_SUBST(K3B_LIBS)
	
fi

KDE_CREATE_SUBDIRSLIST
AC_CONFIG_FILES([ Makefile ])
AC_CONFIG_FILES([ doc/Makefile ])
AC_CONFIG_FILES([ doc/k9copy/Makefile ])
AC_CONFIG_FILES([ dvdread/Makefile ])
AC_CONFIG_FILES([ k9author/Makefile ])
AC_CONFIG_FILES([ k9decmpeg/Makefile ])
AC_CONFIG_FILES([ k9devices/Makefile ])
AC_CONFIG_FILES([ k9Mplayer/Makefile ])
AC_CONFIG_FILES([ k9vamps/Makefile ])
AC_CONFIG_FILES([ libdvdnav/Makefile ])
AC_CONFIG_FILES([ libk9copy/Makefile ])
AC_CONFIG_FILES([ po/Makefile ])
AC_CONFIG_FILES([ src/Makefile ])
AC_CONFIG_FILES([ src/icons/Makefile ])
AC_OUTPUT
if test "$all_tests" = "bad"; then
  if test ! "$cache_file" = "/dev/null"; then
    echo ""    
    echo "Please remove the file $cache_file after changing your setup"
    echo "so that configure will find the changes next time."
    echo ""
  fi
else
  echo ""
  echo "Good - your configure finished. Start make now"
  echo ""
fi