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

dnl TAG CVS WHEN RELEASE VERSION CHANGES !!!
PDP_VERSION=0.12.2
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)

AC_ARG_ENABLE(sdl,    
	[  --enable-sdl            enable SDL support], SDL=yes, SDL=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
	PD_EXECUTABLE=$prefix/bin/pd
	LIBS="$LIBS -L/sw/lib"
	CPPFLAGS="$CPPFLAGS -I/sw/include"
	PDP_EXTRA_CPPFLAGS="-I/sw/include"

dnl if not darwin, assume target is linux
else
	PDP_EXTRA_CFLAGS=-Werror

	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

AC_CHECK_LIB(gslcblas,main)
AC_CHECK_LIB(gsl,main,,
	echo "ERROR: libgsl not found"
	exit)
LIBS="$LIBS -lgslcblas -lgsl"


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_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(png, png_read_image,
	LIBS="$LIBS -lpng"
	AC_DEFINE(HAVE_PDP_PNG, 1, build png support),
	echo "   libpng not found: not building png support")


AC_CHECK_LIB(GL, glXSwapBuffers,
	PDP_OPTMOD="$PDP_OPTMOD pdp_glx.o"
	LIBS="$LIBS -lGL -lGLU"
	AC_DEFINE(HAVE_PDP_GLX, 1, build pdp_glx),
	echo "   libGL not found: not building pdp_glx",
	-L/usr/X11R6/lib -lGLU)


dnl optional sdl stuff
if test $SDL == yes
then
	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")
fi


echo target is $PDP_TARGET


AC_SUBST(PD_CPPFLAGS)
AC_SUBST(PD_EXECUTABLE)
AC_SUBST(PDP_EXTRA_CPPFLAGS)
AC_SUBST(PDP_EXTRA_CFLAGS)
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