File: configure.ac

package info (click to toggle)
amsn 0.98.9-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 34,976 kB
  • ctags: 10,387
  • sloc: tcl: 122,014; ansic: 32,228; cpp: 17,363; xml: 6,681; objc: 1,251; sh: 825; makefile: 498; perl: 215; python: 126
file content (565 lines) | stat: -rw-r--r-- 14,444 bytes parent folder | download
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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
dnl ---------------------------------------------------------------------
dnl Process this file with autoconf to produce a configure script.

AC_INIT(amsn)
AC_CONFIG_HEADER(utils/linux/capture/config.h)


APPNAME=amsn
APPVERSION=0.98.9
APPRELEASE=1
APPSTABLE=yes

AC_SUBST(APPVERSION)
AC_SUBST(APPNAME)
AC_SUBST(APPRELEASE)
AC_SUBST(APPSTABLE)

dnl ---------------------------------------------------------------------
dnl compile time options

AC_ARG_ENABLE(debug,
  [  --enable-debug          enable some debugging information],[enable_debug=$enableval],[enable_debug=no])

if test "$enable_debug" = "yes" ; then
    DEBUG="yes"
else
    DEBUG="no"
fi
AC_SUBST(DEBUG)

AC_ARG_ENABLE(static,
  [  --enable-static         enable static link of libstdc++],[enable_static=$enableval],[enable_static=no])

if test "$enable_static" = "yes" ; then
    STATIC="yes"
else
    STATIC="no"
fi
AC_SUBST(STATIC)

dnl subst configure command
AC_SUBST(CONFIGURE_ARGS)
CONFIGURE_ARGS=`echo $@`

dnl Check for OS
#`uname -s`
case `uname -s` in
	Linux)
		FOUND_OS="linux"
		;;
	*BSD)
		# *BSD has important stuff (from ports)
		# in /usr/local ...
		CFLAGS="$CFLAGS -I/usr/local/include -L/usr/local/lib"
		LDFLAGS="$LDFLAGS -L/usr/local/lib"
		FOUND_OS="bsd"
		;;
	Darwin)
		FOUND_OS="mac"
		CFLAGS="$CFLAGS -DMAC_OSX_TK=1 -I${prefix}/include -L${prefix}/lib"
		CXXFLAGS="$CXXFLAGS -I${prefix}/include -L${prefix}/lib"
		LDFLAGS="$LDFLAGS -I${prefix}/include -L/usr/lib -L${prefix}/lib"
		
		# Directories in which the Tcl core can be found
		TCL_INC_SPEC="-I/Library/Frameworks/Tcl.framework/Headers -DUSE_TCL_STUBS"
		TCL_STUB_LIB_SPEC="-L/Library/Frameworks/Tcl.framework -ltclstub8.5"
		
		# Directories in which the Tk core can be found
		TK_INC_SPEC="-I/Library/Frameworks/Tk.framework/Headers -DUSE_TK_STUBS"
		TK_STUB_LIB_SPEC="-L/Library/Frameworks/Tk.framework -ltkstub8.5"
		;;
	SunOS)
		FOUND_OS=solaris
		;;
	*)
		AC_MSG_CHECKING(if amsn will build on `uname -s`)
		AC_MSG_RESULT(maybe)
		FOUND_OS="unknown"
		;;
esac

dnl ---------------------------------------------------------------------
dnl Checks for TCL and TK.

TCLSH=`which tclsh`
VERSION=`echo "puts $::tcl_version ; exit" | ${TCLSH}`
AC_ARG_ENABLE(version-check, [  --disable-version-check Disable checking that linked tcl/tk version is the same version that bin program tclsh ],    [version_ok=$enableval], [version_ok=yes])

OLDV=`expr $VERSION \< 8.5`

if test "x${version_ok}" = "xyes" -a $OLDV = 1; then
    AC_MSG_ERROR(Your current Tcl/Tk installation has a version number of $VERSION. The minimal version required for aMSN to run is Tcl/Tk 8.5)
fi



dnl ---------------------------------------------------------------------
dnl Checks for programs.

AC_PROG_CC

CC_INSTALLED=`which $CC`
if test "x${CC_INSTALLED}" = "x"; then
    AC_MSG_ERROR(You need a C compiler (gcc) to compiler aMSN. Please install gcc and try again) 
fi

AC_PROG_CXX

CXX_INSTALLED=`which $CXX`
if test "x${CXX_INSTALLED}" = "x"; then
     AC_MSG_ERROR(You need a C++ compiler (g++) to compiler aMSN. Please install g++ and try again) 
fi


BUILD_DIR=`pwd`
cd ${srcdir}
TOP_DIR=`pwd`
cd "${BUILD_DIR}"

AC_SUBST(TCLSH)
AC_SUBST(TOP_DIR)
AC_SUBST(BUILD_DIR)


if test $FOUND_OS != "mac"; then
	#--------------------------------------------------------------------
	#	Read in configuration information generated by Tcl for shared
	#	libraries, and arrange for it to be substituted into our
	#	Makefile.
	#--------------------------------------------------------------------
	
	AC_MSG_CHECKING(tcl build dir)
	TCL_LIB_DIR=$exec_prefix/lib
	dirs="	/usr/lib/tcl8.* \
		/usr/local/lib/tcl8.* \
		/Library/Frameworks/Tcl.framework \
		~/Library/Frameworks/Tcl.framework \
		/Network/Library/Frameworks/Tcl.framework \
		/System/Library/Frameworks/Tcl.framework \
		/usr/local/lib \
		/usr/lib \
		/usr/local/lib64 \
		/usr/lib64 \
		/usr/lib64/tcl8.* \
		/usr/local/lib64/tcl8.* \
		`locate tclConfig.sh`"
	
	for i in $dirs ; do
	
		if test -f "$i"; then
			i=`dirname $i`
		fi
	
		if test -d "$i" -a -f "$i/tclConfig.sh"; then
			file=$i/tclConfig.sh
			. $file
		
			if test "x${version_ok}" != "xyes"; then
			VERSION=${TCL_VERSION}
			fi
		
				if  test "x${TCL_INC_DIR}" != "x" -o "x${TCL_INC_SPEC}" != "x" \
					-o "x${TCL_INCLUDE_DIR}" != "x" -o "x${TCL_INCLUDE_SPEC}" != "x"; then
				if test "x${TCL_VERSION}" = "x${VERSION}" ; then
				TCL_LIB_DIR=`cd $i; pwd`
				break;
				fi
			elif test -f ${TCL_PREFIX}/include/tcl.h; then
				TCL_LIB_DIR=`cd $i; pwd`
				break;
			fi
	
		fi
	
	done
	AC_ARG_WITH(tcl, [  --with-tcl=DIR          use Tcl binaries from DIR], TCL_LIB_DIR=$withval,)
	if test -d $TCL_LIB_DIR; then
		AC_MSG_RESULT([using tcl library in $TCL_LIB_DIR])
	else
		AC_MSG_ERROR(Unable to find Tcl directory or Tcl package is not tcl-dev)
	fi
	
	cd ${TCL_LIB_DIR}/..
	TCL_TOP_DIR=`pwd`
	cd "${BUILD_DIR}"
	
	#--------------------------------------------------------------------
	
	file=$TCL_LIB_DIR/tclConfig.sh
	. $file
	#CC=$TCL_CC
	#CXX=$TCL_CXX
	SHLIB_CFLAGS=`echo "$TCL_SHLIB_CFLAGS" |sed -e "s|PIC|pic|" -e "s|+Z|+z|"`
	SHLIB_LD=$TCL_SHLIB_LD
	SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
	DL_LIBS=$TCL_DL_LIBS
	#LD_FLAGS=$TCL_LD_FLAGS
	
	TCL_BASE=`echo ${TCL_LIB_SPEC} |sed -e "s|^.*-l||"`
	TCL_STUB_BASE=`echo ${TCL_STUB_LIB_SPEC} |sed -e "s|^.*-l||"`
	
	AC_SUBST(TCL_LIB_DIR)
	
	if test "x${TCL_INC_SPEC}" != "x" ; then
	TCL_INC_DIR=$TCL_INC_SPEC
	fi
	
	
	if  test "x${TCL_INCLUDE_SPEC}" != "x"; then
	TCL_INC_DIR=$TCL_INCLUDE_SPEC
	fi
	
	if test "x${TCL_INC_DIR}" = "x"; then
	TCL_INC_DIR=$TCL_INCLUDE_DIR
	fi
	
	if test "x${TCL_INC_DIR}" = "x" -a -f ${TCL_PREFIX}/include/tcl.h; then
	TCL_INC_DIR=${TCL_PREFIX}/include
	fi
	
	if test "x${TCL_INC_DIR}" = "x"; then
	AC_MSG_ERROR(You dot not have a devel package of Tcl)
	fi
	
	case $TCL_INC_DIR in
		-I*) ;;
		*) TCL_INC_DIR=-I$TCL_INC_DIR;;
	esac
	
	TCL_INC_SPEC=$TCL_INC_DIR
	
	framework=`echo "${TCL_BASE}" | grep -- "-framework"`
	if test "x${framework}" = "x"; then
	TCL_LIB_SPEC="-L${TCL_LIB_DIR} -l${TCL_BASE}"
	fi
	TCL_STUB_LIB_SPEC="-L${TCL_LIB_DIR} -l${TCL_STUB_BASE}"
	eval "TCL_UNSHARED_LIB_FILE=lib${TCL_BASE}${TCL_UNSHARED_LIB_SUFFIX}"
	eval "TCL_SHARED_LIB_FILE=lib${TCL_BASE}${TCL_SHARED_LIB_SUFFIX}"
	

	#--------------------------------------------------------------------
	#	Read in configuration information generated by TK, and 
	#	arrange for it to be substituted into our Makefile.
	#--------------------------------------------------------------------
	
	AC_MSG_CHECKING(tk build dir)
	TK_LIB_DIR=$prefix/lib
	if test -f "${TCL_LIB_DIR}/tkConfig.sh"; then
		TK_LIB_DIR=$TCL_LIB_DIR
	else
		TK_LIB_DIR=$prefix/lib
		dirs="/usr/lib/tk8.* \
		/usr/local/lib/tk8.* \
		/Library/Frameworks/Tk.framework \
		~/Library/Frameworks/Tk.framework \
		/Network/Library/Frameworks/Tk.framework \
		/System/Library/Frameworks/Tk.framework \
		/usr/local/lib \
		/usr/lib \
		/usr/local/lib64 \
		/usr/lib64 \
		/usr/lib64/tk8.* \
		/usr/local/lib64/tk8.* \
		`locate tkConfig.sh`"
	
	
		for i in $dirs ; do
	
		if test -f "$i"; then
		i=`dirname $i`
		fi
	
		if test -d "$i" -a -f "$i/tkConfig.sh"; then
		file=$i/tkConfig.sh
		. $file
	
		if test "x${version_ok}" != "xyes"; then
			VERSION=${TK_VERSION}
		fi
	
		if  test "x${TK_INC_DIR}" != "x" -o "x${TK_INC_SPEC}" != "x" \
				-o "x${TK_INCLUDE_DIR}" != "x" -o "x${TK_INCLUDE_SPEC}" != "x"; then
				if test "x${TK_VERSION}" = "x${VERSION}"; then
			TK_LIB_DIR=`cd $i; pwd`
			break;
			fi
		elif test -f ${TK_PREFIX}/include/tk.h; then
			TK_LIB_DIR=`cd $i; pwd`
			break;
		fi
		fi
	
		done
	
	fi
	AC_ARG_WITH(tk, [  --with-tk=DIR           use Tk binaries from DIR], TK_LIB_DIR=$withval,)
	if test -d $TK_LIB_DIR; then
		AC_MSG_RESULT([using tk library in $TK_LIB_DIR])
	else
		AC_MSG_ERROR(Unable to find Tk directory or Tk package is not tk-dev)
	fi
	
	cd ${TK_LIB_DIR}/..
	TK_TOP_DIR=`pwd`
	cd "${BUILD_DIR}"
	
	file=$TK_LIB_DIR/tkConfig.sh
	. $file
	AC_SUBST(TK_VERSION)
	AC_SUBST(TK_LIB)
	AC_SUBST(TK_LIBS)
	
	AC_SUBST(TK_LIB_DIR)
	
	if test "x${TK_INC_SPEC}" != "x" ; then
	TK_INC_DIR=$TK_INC_SPEC
	fi
	
	if  test "x${TK_INCLUDE_SPEC}" != "x"; then
	TK_INC_DIR=$TK_INCLUDE_SPEC
	fi
	
	if test "x${TK_INC_DIR}" = "x"; then
	TK_INC_DIR=$TK_INCLUDE_DIR
	fi
	
	if test "x${TK_INC_DIR}" = "x" -a -f ${TK_PREFIX}/include/tk.h; then
	TK_INC_DIR=${TK_PREFIX}/include
	fi
	
	if test "x${TK_INC_DIR}" = "x"; then
	AC_MSG_ERROR(You dot not have a devel package of Tk)
	fi
	
	case $TK_INC_DIR in
		-I*) ;;
		*) TK_INC_DIR=-I$TK_INC_DIR;;
	esac
	
	TK_INC_SPEC=$TK_INC_DIR
fi

AC_SUBST(TCL_INC_SPEC)
AC_SUBST(TK_INC_SPEC)

AC_SUBST(TCL_STUB_LIB_SPEC)
AC_SUBST(TK_STUB_LIB_SPEC)

AC_SUBST(TCL_VERSION)
AC_SUBST(TK_VERSION)

dnl ---------------------------------------------------------------------
dnl do some OS specific stuff here

dnl Check for libstdc++
AC_CHECK_LIB(stdc++,main,CXX_LIB="-lstdc++", AC_MSG_ERROR(stdc++ library not found) )
AC_SUBST(CXX_LIB)

AC_SUBST(LDLIBS)
AC_SUBST(FOUND_X11)
AC_SUBST(FOUND_OS)
FOUND_X11="no"


dnl Check for X11

AC_PATH_XTRA
if test "$no_x" != "yes"; then
  FOUND_X11="yes"
  X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
else
   AC_MSG_RESULT("Could not find X11 devel package, traydock will not be compiled")
fi

if test "$FOUND_OS" = "solaris"; then
	# If possible, build webcam support.  Otherwise, default to
	# Linux for other goodies.
	AC_CHECK_HEADERS(sys/videodev2.h,FOUND_OS=solaris,FOUND_OS=linux)
fi

#---------------------------------------------------------------------------------------------

dnl ---------------------------------------------------------------------
dnl Check for required libs for TkCxImage

dnl Check for png

AC_CHECK_LIB(png, png_read_info,
       [AC_CHECK_HEADER(png.h,
         ,
         AC_MSG_ERROR([png headers not found]))],
       AC_MSG_ERROR([libpng is required]), -lz -lm)

dnl Check for jpeg

AC_CHECK_LIB(jpeg, jpeg_CreateDecompress,
       [AC_CHECK_HEADER(jpeglib.h,
         [AC_CHECK_HEADER(jerror.h,
           ,
           AC_MSG_ERROR([jerror headers not found]))],
         AC_MSG_ERROR([jpeg headers not found]))],
       AC_MSG_ERROR([libjpeg is required]))


dnl ---------------------------------------------------------------------
dnl Checks for functions

AC_CHECK_FUNCS(ftello fseeko getpt strcasestr memmem dlopen )

AC_CHECK_LIB(pthread,pthread_create,LIBPTHREAD="-lpthread")
if test "$LIBPTHREAD" = ""; then
  AC_CHECK_LIB(c_r,pthread_create,LIBPTHREAD="-lc_r")
fi

AC_SUBST(LIBPTHREAD)


AC_SUBST(X_CFLAGS)
AC_SUBST(X_LIBS)

dnl ---------------------------------------------------------------------
dnl deinterlace plugins
AC_MSG_CHECKING(if mmx should be used)
AC_SUBST(USE_MMX)
if test "$enable_mmx" = "no" -o "$enable_mmx" = "yes"; then
	USE_MMX="$enable_mmx"
else
	case "`uname -m`" in
		i586 | i686)
			USE_MMX="yes"
			;;
		*)
			USE_MMX="no"
			;;
	esac
fi
AC_MSG_RESULT($USE_MMX)

HAVE_FARSIGHT="N/A"
HAVE_FARSTREAM=no
GST_REQUIRED=0.10.22
GST_MAJORMINOR=0.10
FARSIGHT_REQUIRED=0.0.9
FARSTREAM_REQUIRED=0.1
 
dnl Check for pkgconfig first
AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)


dnl Give error and exit if we don't have pkgconfig
if test "x$HAVE_PKGCONFIG" = "xyes"; then
  PKG_CHECK_MODULES(GLIB, \
    glib-2.0 >= 2.14,
    HAVE_GLIB=yes,HAVE_GLIB=no)

  dnl Give error and exit if we don't have gstreamer
  if test "x$HAVE_GLIB" = "xyes"; then
    PKG_CHECK_MODULES(GST, \
      gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED,
      HAVE_GST=yes,HAVE_GST=no)

    PKG_CHECK_MODULES(GST_INTERFACES, \
      gstreamer-interfaces-$GST_MAJORMINOR >= $GST_REQUIRED,
      HAVE_GST_INTERFACES=yes,HAVE_GST_INTERFACES=no)

    dnl Give error and exit if we don't have gstreamer
    if test "x$HAVE_GST" = "xyes"; then
      
      PKG_CHECK_MODULES(FARSTREAM, \
          farstream-$FARSTREAM_REQUIRED,
          HAVE_FARSTREAM=yes,HAVE_FARSTREAM=no)
      if test "x$HAVE_FARSTREAM" = "xno"; then
         PKG_CHECK_MODULES(FARSIGHT2, \
             farsight2-$GST_MAJORMINOR >= $FARSIGHT_REQUIRED,
            HAVE_FARSIGHT=yes,HAVE_FARSIGHT=no)
      fi
    fi
  fi

  AC_ARG_ENABLE([libv4l],
        AC_HELP_STRING([--disable-libv4l], [Disable libv4l support]),
        [case "${enableval}" in
            yes) WANT_V4L=yes ;;
            no)  WANT_V4L=no ;;
            *) AC_MSG_ERROR(bad value ${enableval} for --enable-libv4l) ;;
        esac],
        WANT_V4L=test)

  HAVE_LIBV4L=no
  if test "x$WANT_V4L" != "xno"; then
    dnl Use libv4l if we have it
    PKG_CHECK_MODULES(LIBV4L, \
      libv4l2 >= 0.5.0,
      HAVE_LIBV4L=yes,HAVE_LIBV4L=no)
  fi
  AC_CHECK_HEADERS(linux/videodev.h,HAVE_V4L=yes,HAVE_V4L=no)
  AC_CHECK_HEADERS(linux/videodev2.h,HAVE_V4L2=yes,HAVE_V4L2=no)
  AC_SUBST(HAVE_V4L)
  AC_SUBST(HAVE_V4L2)

  AC_ARG_ENABLE([upnp],
        AC_HELP_STRING([--disable-upnp], [Disable upnp support]),
        [case "${enableval}" in
            yes) WANT_UPNP=yes ;;
            no)  WANT_UPNP=no ;;
            *) AC_MSG_ERROR(bad value ${enableval} for --enable-upnp) ;;
        esac],
        WANT_UPNP=test)
  HAVE_GUPNP=no
  if test "x$WANT_UPNP" != "xno"; then
    PKG_CHECK_MODULES(GUPNP, [ gupnp-igd-1.0 ],
      [ HAVE_GUPNP=yes ],
      [ HAVE_GUPNP=no ])
  fi
  AC_SUBST(HAVE_GUPNP)

fi

AC_SUBST(GST_CFLAGS)
AC_SUBST(GST_LIBS)
AC_SUBST(GST_INTERFACES_CFLAGS)
AC_SUBST(GST_INTERFACES_LIBS)

AC_SUBST(FARSIGHT2_CFLAGS)
AC_SUBST(FARSIGHT2_LIBS)

AC_SUBST(HAVE_FARSIGHT)

AC_SUBST(FARSTREAM_CFLAGS)
AC_SUBST(FARSTREAM_LIBS)

AC_SUBST(HAVE_FARSTREAM)

dnl ---------------------------------------------------------------------
dnl write out stuff
AC_OUTPUT(Makefile)
dnl ---------------------------------------------------------------------
dnl compile time options summary

cat <<EOF

compile time options summary
============================

    X11          : $FOUND_X11
    Tcl		 : $TCL_VERSION
    TK 		 : $TK_VERSION
    DEBUG        : $DEBUG
    STATIC       : $STATIC
    FARSTREAM    : $HAVE_FARSTREAM
    FARSIGHT     : $HAVE_FARSIGHT
    V4L          : $HAVE_V4L
    V4L2         : $HAVE_V4L2
    LIBV4L       : $HAVE_LIBV4L
    GUPNP-IGD    : $HAVE_GUPNP

EOF

if test x"$HAVE_FARSTREAM" != "xyes" -a x"$HAVE_FARSIGHT" != "xyes"; then
   echo "*** You do not seem to have gstreamer and farsight2 or farstream installed."
   echo "*** You will not be able to build the required component for audio conversations."
   echo "*** Read this for more information : http://amsn-project.net/wiki/Farsight"
fi

exit 0