Source

yate / configure.in

  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
# Process this file with autoconf to produce a configure script.
AC_INIT(YATE, 0.8.7)
AC_CONFIG_SRCDIR([README])
AC_PREREQ(2.52)

PACKAGE_VERSION_MAJOR="${PACKAGE_VERSION%%.*}"
PACKAGE_VERSION_MINOR="${PACKAGE_VERSION#*.}"
PACKAGE_VERSION_MINOR="${PACKAGE_VERSION_MINOR%.*}"
PACKAGE_VERSION_BUILD="${PACKAGE_VERSION##*.}"
AC_SUBST(PACKAGE_VERSION_MAJOR)
AC_SUBST(PACKAGE_VERSION_MINOR)
AC_SUBST(PACKAGE_VERSION_BUILD)

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_AWK

# Check if gcc style printf argument check is supported
HAVE_GCC_FORMAT_CHECK=""
AC_MSG_CHECKING([for gcc printf format typechecks])
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
AC_TRY_COMPILE([],[void f(void*x,const char*f,...) __attribute__((format(printf,2,3))); ],[ac_cv_format_checks=yes],[ac_cv_format_checks=no])
CFLAGS="$SAVE_CFLAGS"
if [[ "x$ac_cv_format_checks" = "xyes" ]]; then
    HAVE_GCC_FORMAT_CHECK="-DHAVE_GCC_FORMAT_CHECK"
fi
AC_MSG_RESULT([$ac_cv_format_checks])

# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h arpa/inet.h netdb.h netinet/in.h sys/ioctl.h sys/socket.h sys/time.h], , [AC_MSG_ERROR([This header file is required.])])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_HEADER_TIME

# Checks for library functions.
AC_FUNC_MALLOC
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([gettimeofday inet_ntoa memmove regcomp strerror], , [AC_MSG_ERROR([This function is required.])])

AC_CACHE_SAVE

# Checks for required libraries.
AC_CHECK_LIB([dl], [dlopen], , [AC_MSG_ERROR([This library is required.])])
AC_CHECK_LIB([pthread], [pthread_mutexattr_settype], , [AC_MSG_ERROR([This library is required.])])

MUTEX_HACK=""
AC_MSG_CHECKING([for pthread_mutexattr_settype declaration])
AC_LANG_SAVE
AC_LANG_C
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
AC_TRY_COMPILE([
#include <unistd.h>
#include <pthread.h>
],[
pthread_mutexattr_t attr;
pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_RECURSIVE_NP);
],
have_mutex_settype="yes",
have_mutex_settype="no"
)
CFLAGS="$SAVE_CFLAGS"
AC_LANG_RESTORE
if [[ "$have_mutex_settype" = "no" ]]; then
MUTEX_HACK="-DMUTEX_HACK"
fi
AC_MSG_RESULT([$have_mutex_settype])
AC_SUBST(MUTEX_HACK)

THREAD_KILL=""
AC_MSG_CHECKING([for pthread_kill_other_threads_np declaration])
AC_LANG_SAVE
AC_LANG_C
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
AC_TRY_COMPILE([
#include <unistd.h>
#include <pthread.h>
],[
pthread_kill_other_threads_np();
],
have_pthread_kill="yes",
have_pthread_kill="no"
)
CFLAGS="$SAVE_CFLAGS"
AC_LANG_RESTORE
if [[ "$have_pthread_kill" = "yes" ]]; then
THREAD_KILL="-DTHREAD_KILL"
fi
AC_MSG_RESULT([$have_pthread_kill])
AC_SUBST(THREAD_KILL)

# Check for compile options
INLINE_FLAGS=""
AC_ARG_ENABLE(inline,AC_HELP_STRING([--enable-inline],[Enable inlining of functions]),want_inline=$enableval,want_inline=auto)
AC_MSG_CHECKING([whether to use inline functions])
case "x$want_inline" in
    xyes)
	INLINE_FLAGS="-finline -Winline"
	;;
    xno)
	INLINE_FLAGS="-fno-inline"
	;;
    xauto)
	;;
    *)
	AC_ERROR([Invalid argument passed to --enable-inline])
	;;
esac
AC_MSG_RESULT([$want_inline])
AC_SUBST(INLINE_FLAGS)

# Checks for optional libraries.

HAVE_PGSQL=no
PGSQL_INC=""
AC_ARG_WITH(libpq,AC_HELP_STRING([--with-libpq=DIR],[use Postgress SQL from DIR (default /usr)]),[ac_cv_use_libpq=$withval],[ac_cv_use_libpq=/usr])
if [[ "x$ac_cv_use_libpq" != "xno" ]]; then
AC_MSG_CHECKING([for Postgress SQL in $ac_cv_use_libpq])
libpq="$ac_cv_use_libpq/lib/libpq.so"
for i in include include/pgsql pgsql/include include/postgresql; do
    incpq="$ac_cv_use_libpq/$i"
    test -f "$incpq/libpq-fe.h" && break
done
if [[ ! -f "$incpq/libpq-fe.h" ]]; then
    incpq="$incpq/pgsql"
fi
if [[ -f "$incpq/libpq-fe.h" -a -f "$libpq" ]]; then
    HAVE_PGSQL=yes
    PGSQL_INC="-I$incpq"
fi
AC_MSG_RESULT([$HAVE_PGSQL])
fi
AC_SUBST(HAVE_PGSQL)
AC_SUBST(PGSQL_INC)

HAVE_PRI=no
AC_ARG_WITH(libpri,AC_HELP_STRING([--with-libpri],[use ISDN PRI if available (default)]),[ac_cv_use_libpri=$withval],[ac_cv_use_libpri=yes])
if [[ "x$ac_cv_use_libpri" != "xno" ]]; then
AC_CHECK_HEADER(libpri.h, , [ac_cv_use_libpri=no])
fi
if [[ "x$ac_cv_use_libpri" != "xno" ]]; then
AC_CHECK_LIB([pri], [pri_new], [HAVE_PRI=yes])
fi
AC_SUBST(HAVE_PRI)

HAVE_GSM=no
GSM_INC=""
AC_ARG_WITH(libgsm,AC_HELP_STRING([--with-libgsm],[use GSM codec if available (default)]),[ac_cv_use_libgsm=$withval],[ac_cv_use_libgsm=yes])
if [[ "x$ac_cv_use_libgsm" = "xyes" ]]; then
for i in /usr/include /usr/include/gsm; do
    ac_cv_use_libgsm="$i"
    test -f "$ac_cv_use_libgsm/gsm.h" && break
done
fi
if [[ "x$ac_cv_use_libgsm" != "xno" ]]; then
AC_MSG_CHECKING([for gsm.h in $ac_cv_use_libgsm])
if [[ -f "$ac_cv_use_libgsm/gsm.h" ]]; then
    HAVE_GSM=yes
    GSM_INC="-I$ac_cv_use_libgsm"
fi
AC_MSG_RESULT([$HAVE_GSM])
fi
AC_SUBST(HAVE_GSM)
AC_SUBST(GSM_INC)

HAVE_PWLIB=no
PWLIB_RTTI=none
PWLIB_INC=""
PWLIB_LIB=""
PWLIB_RUN=""
AC_ARG_WITH(pwlib,AC_HELP_STRING([--with-pwlib=DIR],[use Pwlib from DIR (default /usr)]),[ac_cv_use_pwlib=$withval],[ac_cv_use_pwlib=/usr])

if [[ "x$ac_cv_use_pwlib" != "xno" ]]; then
AC_MSG_CHECKING([for Pwlib in $ac_cv_use_pwlib])
verpw=`ptlib-config --version 2>/dev/null`
prtti=`ptlib-config --ccflags 2>/dev/null | sed -n 's/^.*\(-f[[^ ]]*rtti\).*$/\1/p'`
# try first installed directory
incpw="$ac_cv_use_pwlib/include/ptlib.h"
libpw="$ac_cv_use_pwlib/lib/libpt.so"
PWLIB_INC="-I$ac_cv_use_pwlib/include/ptlib"
if [[ "$verpw" '<' "1.6.0" ]]; then
    PWLIB_INC="-I$ac_cv_use_pwlib/include/ptlib/unix/ptlib -I$ac_cv_use_pwlib/include/ptlib/unix $PWLIB_INC"
fi
if [[ -f "$incpw" -a -f "$libpw" ]]; then
    HAVE_PWLIB=installed
    PWLIB_LIB="-L$ac_cv_use_pwlib/lib -lpt"
    case "x$prtti" in
	x-frtti)
	    PWLIB_RTTI=yes
	    ;;
	x-fno-rtti)
	    PWLIB_RTTI=no
	    ;;
    esac
else
# try source directory style
    libpw=`echo "$ac_cv_use_pwlib/lib/"libpt*r.so`
    if [[ -f "$incpw" -a -f "$libpw" ]]; then
	prtti=`"$ac_cv_use_pwlib/make/ptlib-config" --ccflags 2>/dev/null | sed -n 's/^.*\(-f[[^ ]]*rtti\).*$/\1/p'`
        HAVE_PWLIB=sources
        PWLIB_LIB="-L$ac_cv_use_pwlib/lib -l`echo "$libpw"|sed 's,^.*/lib,,; s,\.so$,,'`"
        PWLIB_RUN=":$ac_cv_use_pwlib/lib"
	case "x$prtti" in
	    x-frtti)
		PWLIB_RTTI=yes
		;;
	    x-fno-rtti)
		PWLIB_RTTI=no
		;;
	esac
    fi
fi
AC_MSG_RESULT([$HAVE_PWLIB $verpw RTTI: $PWLIB_RTTI])
fi

HAVE_H323=no
H323_INC=""
H323_LIB=""
H323_RUN=""
AC_ARG_WITH(openh323,AC_HELP_STRING([--with-openh323=DIR],[use OpenH323 from DIR (default /usr)]),[ac_cv_use_openh323=$withval],[ac_cv_use_openh323=/usr])

if [[ "x$HAVE_PWLIB" != "xno" -a "x$ac_cv_use_openh323" != "xno" ]]; then
AC_MSG_CHECKING([for OpenH323 in $ac_cv_use_openh323])
# try first installed directory
inc323="$ac_cv_use_openh323/include/openh323/h323.h"
lib323="$ac_cv_use_openh323/lib/libopenh323.so"
if [[ -f "$inc323" -a -f "$lib323" ]]; then
    HAVE_H323=installed
    H323_INC="-I$ac_cv_use_openh323/include/openh323"
    H323_LIB="-L$ac_cv_use_openh323/lib -lopenh323"
else
# try source directory style
    inc323="$ac_cv_use_openh323/include/h323.h"
    lib323=`echo "$ac_cv_use_openh323/lib/"libh323*r.so`
    if [[ -f "$inc323" -a -f "$lib323" ]]; then
        HAVE_H323=sources
        H323_INC="-I$ac_cv_use_openh323/include"
        H323_LIB="-L$ac_cv_use_openh323/lib -l`echo "$lib323"|sed 's,^.*/lib,,; s,\.so$,,'`"
        H323_RUN=":$ac_cv_use_openh323/lib"
    fi
fi
AC_MSG_RESULT([$HAVE_H323])
fi

if [[ "x$HAVE_H323" != "xno" ]]; then
    H323_INC="$PWLIB_INC $H323_INC"
    H323_LIB="$PWLIB_LIB $H323_LIB"
    H323_RUN="$PWLIB_RUN$H323_RUN"
fi
AC_SUBST(HAVE_H323)
AC_SUBST(H323_INC)
AC_SUBST(H323_LIB)
AC_SUBST(H323_RUN)

HAVE_ORTP=no
ORTP_INC=""
ORTP_LIB=""
AC_ARG_WITH(libortp,AC_HELP_STRING([--with-libortp=DIR],[use oRTP from DIR (default /usr)]),[ac_cv_use_libortp=$withval],[ac_cv_use_libortp=/usr])
if [[ "x$ac_cv_use_libortp" != "xno" ]]; then
AC_MSG_CHECKING([for oRTP in $ac_cv_use_libortp])
incor="$ac_cv_use_libortp/include/ortp"
libor="$ac_cv_use_libortp/lib/libortp.so"
if [[ -f "$incor/ortp.h" -a -f "$libor" ]]; then
    HAVE_ORTP=yes
    ORTP_INC="-I$incor"
    ORTP_LIB="-L$ac_cv_use_libortp/lib -lortp"
fi
AC_MSG_RESULT([$HAVE_ORTP])
fi
AC_SUBST(HAVE_ORTP)
AC_SUBST(ORTP_INC)
AC_SUBST(ORTP_LIB)

HAVE_GLIB1=no
GLIB1_INC=""
GLIB1_LIB=""
AC_ARG_WITH(libglib,AC_HELP_STRING([--with-libglib=DIR],[use Glib 1.2 from DIR (default /usr)]),[ac_cv_use_libglib=$withval],[ac_cv_use_libglib=yes])
if [[ "x$ac_cv_use_libglib" = "xyes" ]]; then
    AC_MSG_CHECKING([for Glib 1.2 using pkg-config])
    verg=`pkg-config --modversion glib 2>/dev/null`
    incg=`pkg-config --cflags-only-I glib 2>/dev/null`
    libg=`pkg-config --libs glib 2>/dev/null`
    if [[ "x$incg" != "x" -a "x$libg" != "x" ]]; then
	HAVE_GLIB1=yes
	GLIB1_INC="$incg"
	GLIB1_LIB="$libg"
	ac_cv_use_libglib="no"
    else
	ac_cv_use_libglib="/usr"
	verg="no"
    fi
    AC_MSG_RESULT([$verg])
fi
if [[ "x$ac_cv_use_libglib" != "xno" ]]; then
AC_MSG_CHECKING([for Glib 1.2 in $ac_cv_use_libglib])
incg="$ac_cv_use_libglib"
libg="$ac_cv_use_libglib/lib"
if [[ -f "$incg/include/glib-1.2/glib.h" -a -f "$libg2/libglib-1.2.so" ]]; then
    HAVE_GLIB1=yes
    GLIB1_INC="-I$incg/include/glib-1.2 -I$libg/glib-1.2/include"
    GLIB1_LIB="-L$libg -lglib-1.2"
fi
AC_MSG_RESULT([$HAVE_GLIB1])
fi
AC_SUBST(HAVE_GLIB1)
AC_SUBST(GLIB1_INC)
AC_SUBST(GLIB1_LIB)

HAVE_GLIB="$HAVE_GLIB1"
GLIB_INC="$GLIB1_INC"
GLIB_LIB="$GLIB1_LIB"

HAVE_GLIB2=no
GLIB2_INC=""
GLIB2_LIB=""
AC_ARG_WITH(libglib2,AC_HELP_STRING([--with-libglib2=DIR],[use Glib 2.0 from DIR (default /usr)]),[ac_cv_use_libglib2=$withval],[ac_cv_use_libglib2=yes])
if [[ "x$ac_cv_use_libglib2" = "xyes" ]]; then
    AC_MSG_CHECKING([for Glib 2.0 using pkg-config])
    verg2=`pkg-config --modversion glib-2.0 2>/dev/null`
    incg2=`pkg-config --cflags-only-I glib-2.0 2>/dev/null`
    libg2=`pkg-config --libs glib-2.0 2>/dev/null`
    if [[ "x$incg2" != "x" -a "x$libg2" != "x" ]]; then
	HAVE_GLIB2=yes
	GLIB2_INC="$incg2"
	GLIB2_LIB="$libg2"
	ac_cv_use_libglib2="no"
	HAVE_GLIB=yes
	GLIB_INC="$GLIB2_INC"
	GLIB_LIB="$GLIB2_LIB"
    else
	ac_cv_use_libglib2="/usr"
	verg2="no"
    fi
    AC_MSG_RESULT([$verg2])
fi
if [[ "x$ac_cv_use_libglib2" != "xno" ]]; then
AC_MSG_CHECKING([for Glib 2.0 in $ac_cv_use_libglib2])
incg2="$ac_cv_use_libglib2"
libg2="$ac_cv_use_libglib2/lib"
if [[ -f "$incg2/include/glib-2.0/glib.h" -a -f "$libg2/libglib-2.0.so" ]]; then
    HAVE_GLIB2=yes
    GLIB2_INC="-I$incg2/include/glib-2.0 -I$libg2/glib-2.0/include"
    GLIB2_LIB="-L$libg2 -lglib-2.0"
    HAVE_GLIB=yes
    GLIB_INC="$GLIB2_INC"
    GLIB_LIB="$GLIB2_LIB"
fi
AC_MSG_RESULT([$HAVE_GLIB2])
fi
AC_SUBST(HAVE_GLIB2)
AC_SUBST(GLIB2_INC)
AC_SUBST(GLIB2_LIB)

AC_SUBST(HAVE_GLIB)
AC_SUBST(GLIB_INC)
AC_SUBST(GLIB_LIB)

HAVE_IAX2=no
IAX2_INC=""
IAX2_LIB=""
IAX2_DEP=""
AC_ARG_WITH(libIAX2,AC_HELP_STRING([--with-libiax2=DIR],[use IAX 2 from DIR (default: included)]),[ac_cv_use_libiax2=$withval],[ac_cv_use_libiax2=included])
if [[ "x$ac_cv_use_libiax2" = "xincluded" ]]; then
    ac_cv_use_libiax2="no"
    basedir=`cd "$srcdir" && pwd`
    AC_MSG_CHECKING([for IAX 2 in contrib])
    inci2="contrib/iax"
    if [[ -f "$basedir/$inci2/iax2.h" ]]; then
	HAVE_IAX2=yes
	IAX2_INC="-I$basedir/$inci2"
	IAX2_DEP="../$inci2/libiax.a"
    fi
    AC_MSG_RESULT([$HAVE_IAX2])
fi
if [[ "x$ac_cv_use_libiax2" = "xyes" ]]; then
    AC_MSG_CHECKING([for IAX 2 using iax-config])
    veri2=`iax-config --version 2>/dev/null`
    inci2=`iax-config --cflags 2>/dev/null`
    libi2=`iax-config --libs 2>/dev/null`
    if [[ "x$inci2" != "x" -a "x$libi2" != "x" ]]; then
	HAVE_IAX2=yes
	IAX2_INC="$inci2"
	IAX2_LIB="$libi2"
	ac_cv_use_libiax2="no"
    else
	ac_cv_use_libiax2="/usr"
	verg2="no"
    fi
    AC_MSG_RESULT([$veri2])
fi
if [[ "x$ac_cv_use_libiax2" != "xno" ]]; then
AC_MSG_CHECKING([for IAX 2 in $ac_cv_use_libiax2])
inci2="$ac_cv_use_libiax2"
libi2="$ac_cv_use_libiax2/lib"
if [[ -f "$inci2/include/iax/iax2.h" -a -f "$libi2/libiax.so" ]]; then
    HAVE_IAX2=yes
    IAX2_INC="-I$inci2/include/iax"
    IAX2_LIB="-L$libi2 -liax"
fi
AC_MSG_RESULT([$HAVE_IAX2])
fi
AC_SUBST(HAVE_IAX2)
AC_SUBST(IAX2_INC)
AC_SUBST(IAX2_LIB)
AC_SUBST(IAX2_DEP)

HAVE_SPANDSP=no
SPANDSP_INC=""
SPANDSP_LIB=""
AC_ARG_WITH(spandsp,AC_HELP_STRING([--with-spandsp=DIR],[use spandsp from DIR (default /usr)]),[ac_cv_use_spandsp=$withval],[ac_cv_use_spandsp=/usr])
if [[ "x$ac_cv_use_spandsp" != "xno" ]]; then
AC_MSG_CHECKING([for spandsp in $ac_cv_use_spandsp])
incdsp="$ac_cv_use_spandsp/include"
libdsp="$ac_cv_use_spandsp/lib/libspandsp.so"
if [[ -f "$incdsp/spandsp/t30.h" -a -f "$libdsp" ]]; then
    HAVE_SPANDSP=yes
    SPANDSP_INC="-I$incdsp/spandsp -I$incdsp"
    SPANDSP_LIB="-L$ac_cv_use_spandsp/lib -lspandsp -ltiff"
fi
AC_MSG_RESULT([$HAVE_SPANDSP])
fi
AC_SUBST(HAVE_SPANDSP)
AC_SUBST(SPANDSP_INC)
AC_SUBST(SPANDSP_LIB)

HAVE_GTK=no
GTK_INC=""
GTK_LIB=""
AC_ARG_WITH(libgtk,AC_HELP_STRING([--with-libgtk],[use Gtk for graphical clients (default)]),[ac_cv_use_libgtk=$withval],[ac_cv_use_libgtk=yes])
if [[ "x$ac_cv_use_libgtk" = "xyes" ]]; then
    AC_MSG_CHECKING([for Gtk using gtk-config])
    vergt=`gtk-config --version gtk 2>/dev/null`
    incgt=`gtk-config --cflags gthread 2>/dev/null`
    libgt=`gtk-config --libs gthread 2>/dev/null`
    if [[ "x$incgt" != "x" -a "x$libgt" != "x" ]]; then
	HAVE_GTK=yes
	GTK_INC="$incgt"
	GTK_LIB="$libgt"
	ac_cv_use_libgtk="no"
    fi
    AC_MSG_RESULT([$vergt])
fi
AC_SUBST(HAVE_GTK)
AC_SUBST(GTK_INC)
AC_SUBST(GTK_LIB)

HAVE_QT=no
QT_DIR=""
QT_INC=""
AC_ARG_WITH(libqt,AC_HELP_STRING([--with-libqt],[use Qt for graphical clients (default)]),[ac_cv_use_libqt=$withval],[ac_cv_use_libqt=yes])
if [[ "x$ac_cv_use_libqt" != "xno" ]]; then
    qtdir="$ac_cv_use_libqt"
    if [[ "x$ac_cv_use_libqt" = "xyes" ]]; then
	qtdir="$QTDIR"
	if [[ "x$qtdir" = "x" ]]; then
	    qtdir=`ls -d -1 /opt/qt-3* /usr/share/qt3* /usr/lib/qt-3* /usr/lib/qt3* 2>/dev/null | tail -1`
	fi
    fi
    if [[ "x$qtdir" != "x" ]]; then
	AC_MSG_CHECKING([for multithreaded Qt3 in $qtdir])
	if [[ -x "$qtdir/bin/moc" -a -f "$qtdir/lib/libqt-mt.so" ]]; then
	    for i in "$qtdir/include" "$qtdir/include/qt3" "/usr/include/qt3"; do
		if [[ -f "$i/qkeysequence.h" ]]; then
		    QT_INC="$i"
		    break;
		fi
	    done
	    if [[ "x$QT_INC" != "x" ]]; then
		HAVE_QT=yes
		QT_DIR="$qtdir"
	    fi
	fi
	AC_MSG_RESULT([$HAVE_QT])
    fi
fi
AC_SUBST(HAVE_QT)
AC_SUBST(QT_DIR)
AC_SUBST(QT_INC)

RTTI_OPT=""
AC_ARG_ENABLE(rtti,AC_HELP_STRING([--enable-rtti],[Enable RTTI support (default: like pwlib)]),want_rtti=$enableval,want_rtti=auto)
AC_MSG_CHECKING([whether to enable RTTI support])
USE_RTTI="$want_rtti"
case "x$want_rtti" in
    xyes|xno|xnone)
	;;
    xauto)
	USE_RTTI="$PWLIB_RTTI"
	;;
    *)
	AC_ERROR([Invalid argument passed to --enable-rtti])
	;;
esac
case "$USE_RTTI" in
    yes)
	RTTI_OPT="-frtti"
	;;
    no)
	RTTI_OPT="-fno-rtti"
	;;
esac
AC_MSG_RESULT([$USE_RTTI])
AC_SUBST(USE_RTTI)
AC_SUBST(RTTI_OPT)

if [[ "x$HAVE_H323" != "xno" ]]; then
if [[ "x$USE_RTTI" != "x$PWLIB_RTTI" ]]; then
AC_MSG_WARN([Mismatched RTTI setting between Yate ($USE_RTTI) and pwlib ($PWLIB_RTTI)])
fi
fi

MODULE_CFLAGS="-fno-exceptions -fno-check-new -fPIC $RTTI_OPT $HAVE_GCC_FORMAT_CHECK"
MODULE_LDFLAGS="-export-dynamic -shared"
MODULE_SYMBOLS="-Wl,--retain-symbols-file,/dev/null"
AC_SUBST(MODULE_CFLAGS)
AC_SUBST(MODULE_LDFLAGS)
AC_SUBST(MODULE_SYMBOLS)

AC_CONFIG_FILES([yate.spec
                 yate.pc
		 yateversn.h
                 Makefile
                 modules/Makefile
                 scripts/Makefile
                 conf.d/Makefile
                 contrib/iax/Makefile
                 contrib/ysip/Makefile
                 contrib/qt/Makefile
                 test/Makefile])
AC_CONFIG_FILES([yate-config],[chmod +x yate-config])
AC_CONFIG_FILES([run],[chmod +x run])
CONFIGURE_FILES=`echo "$ac_config_files config.status config.log" | sed 's/yate\.spec *//'`
AC_SUBST(CONFIGURE_FILES)
AC_OUTPUT