aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
blob: 50f9c1bd940d31aa5c31c8beef2dae42a6be4059 (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
AC_INIT(system/pdp.c)
AC_CONFIG_HEADER(include/pdp_config.h)
AC_PROG_CC
AC_HEADER_STDC

dnl TAG CVS WHEN VERSION CHANGES !!!
PDP_VERSION=0.9
AC_SUBST(PDP_VERSION)

AC_ARG_ENABLE(pwc,    
	[  --enable-pwc            enable additional Philips WebCam support],
	AC_DEFINE(HAVE_PWCV4L, 1,enable pwc v4l support))

AC_ARG_ENABLE(mmx,    
	[  --enable-mmx            enable MMX support], MMX=yes, MMX=no)


if test $prefix == NONE;
then
	prefix=/usr/local
fi


dnl try to locate the pd header in case the setup is nonstandard
dnl check in  $prefix/pd/src then ../pd/src 
dnl if this fails we trust it is in the standard include path
PWD=`pwd`
if test -f $prefix/pd/src/m_pd.h;
then
	PD_CPPFLAGS="-I$prefix/pd/src"

elif test -f $prefix/src/pd/src/m_pd.h;
then
	PD_CPPFLAGS="-I$prefix/src/pd/src"
elif test -f $PWD/../pd/src/m_pd.h;
then
	PD_CPPFLAGS="-I$PWD/../pd/src"
elif test -f $PWD/../src/m_pd.h;
then
	PD_CPPFLAGS="-I$PWD/../src"
fi


CPPFLAGS="$CPPFLAGS $PD_CPPFLAGS"
AC_CHECK_HEADER(m_pd.h,,
	echo "WARNING: m_pd.h not found. Is PD installed?"
	echo "WARNING: if you have changed PD_CPPFLAGS in Makefile.config.in you can ignore this warning." )


AC_CHECK_LIB(m,sin)


ARCH=`uname -s`
if test $ARCH == Linux;
then
	PDP_LIBRARY_NAME=pdp.pd_linux
	if test $MMX == yes;
	then
		PDP_TARGET=linux_mmx
	else
		PDP_TARGET=linux
	fi
elif test $ARCH == Darwin;
then
	PDP_LIBRARY_NAME=pdp.pd_darwin
	PDP_TARGET=darwin
else
	echo WARNING: Architecture `uname -s` not supported.
	exit
fi



dnl Darwin specific stuff: this is still pretty experimental
dnl How to test if frameworks are present ????
if test $ARCH == Darwin
then
	PDP_OPTMOD="$PDP_OPTMOD pdp_sdl.o"
	LIBS="$LIBS -framework SDL"
	PDP_EXTRA_CPPFLAGS="$PDP_EXTRA_INCLUDE -I/Library/Frameworks/SDL.framework/Headers"
	PD_EXECUTABLE=ihavenocluewherethepdbinaryislocated
	AC_DEFINE(HAVE_PDP_SDL, 1, build pdp_sdl)

dnl These are checks for libraries. 
dnl Objects that depend on a lib only get included when the lib is found.
else

	AC_CHECK_LIB(quicktime, lqt_decode_video,
		PDP_OPTMOD="$PDP_OPTMOD pdp_qt.o"
		LIBS="$LIBS -lquicktime"
		AC_DEFINE(HAVE_PDP_QT, 1, build pdp_qt),
		echo "   libquicktime not found: not building pdp_qt")

	AC_CHECK_LIB(SDL, SDL_Init, 
		PDP_OPTMOD="$PDP_OPTMOD pdp_sdl.o"
		LIBS="$LIBS -lSDL"
		AC_DEFINE(HAVE_PDP_SDL, 1, build pdp_sdl),
		echo "   libSDL not found: not building pdp_sdl")

	AC_CHECK_LIB(Xv, XvPutImage,
		PDP_OPTMOD="$PDP_OPTMOD pdp_xv.o"
		LIBS="$LIBS -L/usr/X11R6/lib -lX11 -lXv -lXext"
		AC_DEFINE(HAVE_PDP_XV, 1, build pdp_xv),
		echo "   libXv not found: not building pdp_xv",
		-L/usr/X11R6/lib -lX11 -lXext)

	AC_CHECK_HEADER(linux/videodev.h,
		PDP_OPTMOD="$PDP_OPTMOD pdp_v4l.o"
		AC_DEFINE(HAVE_PDP_V4L, 1, build pdp_v4l),
		echo "   linux/videodev.h not found: not building pdp_v4l")
fi


echo target is $PDP_TARGET


AC_SUBST(PD_CPPFLAGS)
AC_SUBST(PD_EXECUTABLE)
AC_SUBST(PDP_EXTRA_CPPFLAGS)
AC_SUBST(PDP_LIBRARY_NAME)
AC_SUBST(PDP_TARGET)
AC_SUBST(PDP_OPTMOD)
AC_CONFIG_FILES(Makefile.config)
AC_CONFIG_FILES(bin/pdp-config)
AC_OUTPUT