aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
blob: a10b72aae6f6b04ae1df10a6177cbd1c25cd3a93 (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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
AC_INIT(system/pdp.c)
AC_CONFIG_HEADER(include/pdp_config.h)
AC_PROG_CC
AC_HEADER_STDC


dnl TAG REPO WHEN RELEASE VERSION CHANGES !!!
dnl After changing version, do "make mrproper ; sh bootstrap"

PDP_VERSION=0.12.7-svn




AC_SUBST(PDP_VERSION)

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

AC_ARG_ENABLE(quicktime,    
	[  --enable-quicktime      enable libquicktime support (yes)], , enable_quicktime=yes)

AC_ARG_ENABLE(v4l,    
	[  --enable-v4l            enable Video4Linux support (yes)], , enable_v4l=yes)

AC_ARG_ENABLE(pwc,    
	[  --enable-pwc            force additional Philips WebCam support (auto)],,enable_pwc=auto)

AC_ARG_ENABLE(x,    
	[  --enable-x              enable X11 support (required by XVideo and GLX) (yes)], , enable_x=yes)

AC_ARG_ENABLE(xv,    
	[  --enable-xv             enable XVideo display support (yes)], , enable_xv=yes)

AC_ARG_ENABLE(sdl,    
	[  --enable-sdl            enable SDL display support (yes)], , enable_sdl=yes)

AC_ARG_ENABLE(glx,    
	[  --enable-glx            enable GLX display support (yes)], , enable_glx=yes)

AC_ARG_ENABLE(gsl,    
	[  --enable-gsl            enable gsl support (for matrix packets) (yes)], , enable_gsl=yes)

AC_ARG_ENABLE(png,    
	[  --enable-png            enable png image load/save support (yes)], , enable_png=yes)

AC_ARG_ENABLE(debug,    
	[  --enable-debug          enable debugging support (no)], , enable_debug=no)


# long double? -Wno-long-double
PDP_CFLAGS="-DPD -Wall -W -Wstrict-prototypes -Wno-unused -Wno-parentheses -Wno-switch -fPIC"
dnl -Werror -Wshadow

dnl the -Wshadow option is way too strict.. gl headers won't compile



dnl setup debugging
if test $enable_debug == yes
then
	AC_DEFINE(PDP_DEBUG, 1, "enable debugging support")
	PDP_CFLAGS="$PDP_CFLAGS -g -Werror"
else
	AC_DEFINE(PDP_DEBUG, 0, "disable debugging support")	
	PDP_CFLAGS="$PDP_CFLAGS -O2 -funroll-loops -fomit-frame-pointer -ffast-math"
fi

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


dnl setup forced pwc support
if test $enable_pwc == yes;
then
	AC_DEFINE(HAVE_PWCV4L, 1,enable forced pwc v4l support)
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"
elif test -f /usr/local/include/pd/m_pd.h;
then
	PD_CPPFLAGS="-I/usr/local/include/pd"
elif test -f /usr/include/pd/m_pd.h;
then
	PD_CPPFLAGS="-I/usr/include/pd"
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 $enable_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
  have_v4l="no"
  have_libv4l="no"
  AC_CHECK_HEADERS([libv4l1-videodev.h], have_v4l="yes")
  AC_CHECK_HEADERS([linux/videodev.h], have_libv4l="yes")

  if test "x$have_libv4l" = "xyes"
  then
    have_v4l="yes"
  fi

  if test "x$enable_v4l" = "xno"
  then
   have_v4l="no"
  fi

  if test "x$have_v4l" = "xyes"
  then
		PDP_OPTMOD="$PDP_OPTMOD pdp_v4l.o"
		AC_DEFINE(HAVE_PDP_V4L, 1, [build pdp_v4l])

    if test "x$have_libv4l" = "xyes"
    then
  		AC_DEFINE(HAVE_PDP_LIBV4L, 1, [build pdp_v4l with libv4l])
      PDP_V4L_CFLAGS="`pkg-config --cflags libv4l`"
      PDP_V4L_LIBS="`pkg-config --libs libv4l`"
    else
      PDP_V4L_CFLAGS=""
      PDP_V4L_LIBS=""
    fi
    PDP_CFLAGS="$PDP_CFLAGS $PDP_V4L_CFLAGS"
    LIBS="$LIBS $PDP_V4L_LIBS"
  else
    AC_MSG_RESULT([not building pdp_v4l])
  fi
fi

dnl optional gsl support
if test $enable_gsl == yes;
then
  AC_CHECK_LIB(gslcblas,main)
  AC_CHECK_LIB(gsl,main,
    PDP_OPTTYPES="$PDP_OPTTYPES pdp_matrix.o"
    PDP_MATRIX_BASIC="$PDP_MATRIX_BASIC pdp_mat_mul.o pdp_mat_lu.o pdp_mat_vec.o"
    PDP_IMAGE_BASIC="$PDP_IMAGE_BASIC pdp_cheby.o"
    PDP_IMAGE_SPECIAL="$PDP_IMAGE_SPECIAL pdp_histo.o"
    AC_DEFINE(HAVE_PDP_GSL, 1, gsl support)
    PDP_GSL_FOUND=1,
    echo "   libgsl not found: not building matrix type support")

  if test -n "$PDP_GSL_FOUND"; then
    if test $ARCH == Darwin
    then
      LIBS="$LIBS -lgslcblas -lgsl"
    else
      dnl if not darwin, assume target is linux
      LIBS="$LIBS `pkg-config --libs gsl`"
    fi
  fi
fi


dnl optional png support
if test $enable_png == yes
then
	AC_CHECK_LIB(png, png_read_image,
		LIBS="$LIBS -lz -lpng"
		AC_DEFINE(HAVE_PDP_PNG, 1, build png support),
		echo "   libpng not found: not building png support")
fi


dnl optional xwindow support
if test $enable_x == yes;
then
	AC_CHECK_LIB(X11, XOpenDisplay,
		PDP_X11MOD="$PDP_X11MOD pdp_xwindow.o"
		AC_DEFINE(HAVE_PDP_X, 1, build X11 support)
		LIBS="$LIBS -L/usr/X11R6/lib -lX11",
		echo "   libX11 not found: not building X11 support",
		-L/usr/X11R6/lib)

else
	dnl no x support -> no xv and glx support
	enable_xv=no
	enable_glx=no

fi

dnl optional xvideo support
if test $enable_xv == yes;
then
	AC_CHECK_LIB(Xv, XvPutImage,
		PDP_X11MOD="$PDP_X11MOD pdp_xvideo.o"
		PDP_OPTMOD="$PDP_OPTMOD pdp_xv.o"
		LIBS="$LIBS -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)
fi

dnl optional libquicktime support
if test $enable_quicktime == yes;
then
	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")
fi


dnl optional glx support
if test $enable_glx == yes
then
	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)
fi


dnl optional sdl support
if test $enable_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

echo "used configure options:"
echo "  --enable-mmx=$enable_mmx"
echo "  --enable-quicktime=$enable_quicktime"
echo "  --enable-v4l=$enable_v4l"
echo "  --enable-pwc=$enable_pwc"
echo "  --enable-sdl=$enable_sdl"
echo "  --enable-x=$enable_x"
echo "  --enable-xv=$enable_xv"
echo "  --enable-glx=$enable_glx"
echo "  --enable-gsl=$enable_gsl"
echo "  --enable-png=$enable_png"
echo "  --enable-debug=$enable_debug"


AC_SUBST(PD_CPPFLAGS)
AC_SUBST(PD_EXECUTABLE)
AC_SUBST(PDP_EXTRA_CPPFLAGS)
AC_SUBST(PDP_CFLAGS)
AC_SUBST(PDP_EXTRA_CFLAGS)
AC_SUBST(PDP_LIBRARY_NAME)
AC_SUBST(PDP_TARGET)

AC_SUBST(PDP_OPTMOD)
AC_SUBST(PDP_X11MOD)
AC_SUBST(PDP_PDMOD)
AC_SUBST(PDP_OPTTYPES)

AC_SUBST(PDP_IMAGE_BASIC)
AC_SUBST(PDP_IMAGE_SPECIAL)
AC_SUBST(PDP_MATRIX_BASIC)


AC_CONFIG_FILES(Makefile.config)
AC_CONFIG_FILES(bin/pdp-config)
AC_OUTPUT