File: configure.in

package info (click to toggle)
gnokii 0.6.26.dfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 10,780 kB
  • ctags: 6,974
  • sloc: ansic: 62,281; sh: 9,804; makefile: 795; sql: 61
file content (973 lines) | stat: -rw-r--r-- 28,125 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
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
dnl
dnl Makefile for the GNOKII tool suite.
dnl
dnl  Copyright (C) 1999 Hugh Blemings & Pavel Janik ml.
dnl                2000 Karel Zak, Pawel Kot
dnl                2002 BORBELY Zoltan
dnl
dnl  $Id: configure.in,v 1.222 2008/05/30 19:41:12 pkot Exp $
dnl


AC_INIT([gnokii],
	 [0.6.26],
	 [http://www.gnokii.org/])

# Before making a release, the GNOKII_LT_VERSION string should be modified.
# The string is of the form C:R:A.
# - If interfaces have been changed or added, but binary compatibility has
#   been preserved, change to C+1:0:A+1
# - If binary compatibility has been broken (eg removed or changed interfaces)
#   change to C+1:0:0
# - If the interface is the same as the previous version, change to C:R+1:A
GNOKII_LT_VERSION_CURRENT=12
GNOKII_LT_VERSION_REVISION=0
GNOKII_LT_VERSION_AGE=9
AC_SUBST(GNOKII_LT_VERSION_CURRENT)
AC_SUBST(GNOKII_LT_VERSION_REVISION)
AC_SUBST(GNOKII_LT_VERSION_AGE)

dnl xgnokii version
XVERSION=1.0

dnl smsd version
SVERSION=1.4.2

AC_CANONICAL_SYSTEM
AC_GNU_SOURCE

AC_CONFIG_SRCDIR([gnokii/gnokii.c])
dnl gettext doesn't like the config.status being somewhere else :(
dnl AC_CONFIG_AUX_DIR(config)

AM_INIT_AUTOMAKE([1.8 dist-bzip2 no-dist-gzip])

AC_PREFIX_DEFAULT("/usr/local")

dnl ======================== Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_LEX
# If there's no flex/lex utility and there's no generated common/gnvcal.c file, we won't be able to compile
if test "x$LEX" = "x:" && test ! -f common/gnvcal.c; then
	echo "You need one of the following:"
	echo " - installed lex/flex"
	echo " - generated common/gnvcal.c file (included in release tarballs, not included in CVS)"
	exit 1
fi

AC_PATH_PROG(RM, rm, no)
AC_PATH_PROG(FIND, find, no)
AC_CHECK_PROGS(MAKE, gmake make)
AC_CHECK_PROGS(AR, ar)
AC_PROG_INSTALL

dnl ======================= Localisation and i18n

IT_PROG_INTLTOOL([0.35.0])
AM_LANGINFO_CODESET

dnl Add the languages which your application supports to po/LINGUAS
GETTEXT_PACKAGE=gnokii
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], [Define to the Gettext package name])
AC_SUBST(GETTEXT_PACKAGE)
AM_GLIB_GNU_GETTEXT

dnl -----------------------------
dnl Checks for FreeBSD Build
dnl -----------------------------
AC_MSG_CHECKING(if building on FreeBSD)

if test `uname -s` = "FreeBSD" ; then
	AC_MSG_RESULT(yes)
	CPPFLAGS="$CFLAGS -I/usr/local/include"
	LDFLAGS="$LDFLAGS -L/usr/local/lib"
else
	AC_MSG_RESULT(no)
fi

dnl ======================== Libtool versioning
AC_LIBTOOL_WIN32_DLL
define([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL])
AC_PROG_LIBTOOL

#
# Make libtool use --silent when --silent is passed to make
#
changequote(,)dnl
LIBTOOL="${LIBTOOL} \$(shell echo \"\$(MFLAGS)\" | awk '/^[^ ]*s/ { print \"--silent\" }')"
changequote([,])dnl

GNOKII_LT_VERSION=$GNOKII_LT_VERSION_CURRENT:$GNOKII_LT_VERSION_REVISION:$GNOKII_LT_VERSION_AGE
AC_SUBST(GNOKII_LT_VERSION)

# As used in common/gnokii.h
LIBGNOKII_VERSION_MAJOR=`expr $GNOKII_LT_VERSION_CURRENT - $GNOKII_LT_VERSION_AGE`
LIBGNOKII_VERSION_MINOR=$GNOKII_LT_VERSION_AGE
LIBGNOKII_VERSION_RELEASE=$GNOKII_LT_VERSION_REVISION
LIBGNOKII_VERSION_STRING="$LIBGNOKII_VERSION_MAJOR.$LIBGNOKII_VERSION_MINOR.$LIBGNOKII_VERSION_RELEASE"

AC_SUBST(LIBGNOKII_VERSION_MAJOR)
AC_SUBST(LIBGNOKII_VERSION_MINOR)
AC_SUBST(LIBGNOKII_VERSION_RELEASE)
AC_SUBST(LIBGNOKII_VERSION_STRING)
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [The current version])

dnl ======================== Default setting

dnl Let us have $prefix variable available here
test x"$prefix" = xNONE && prefix="$ac_default_prefix"

debug="yes"
xdebug="yes"
rlpdebug="yes"

AC_ARG_ENABLE(fulldebug, 
	[  --enable-fulldebug      compile with full debugging support],
	[ if test x$enable_fulldebug = xyes; then
		if test "x$GCC" = "xyes"; then
			CFLAGS="$CFLAGS -ggdb3 -Wall"
		fi
	  fi ]
)

dnl AC_ARG_ENABLE(debug, 
dnl	[  --enable-debug          compile with debug code],
dnl	[ if test x$enable_debug = xno; then debug="no"; fi ],
dnl	[ debug="yes" ]
dnl )
debug="yes"

AC_ARG_ENABLE(xdebug,
	[  --enable-xdebug         compile with xdebug code],
	[ if test x$enable_xdebug = xno; then xdebug="no"; fi ],
	[ xdebug="yes" ]
)

AC_ARG_ENABLE(rlpdebug,
	[  --enable-rlpdebug       compile with RLP debug code],
	[ if test x$enable_rlpdebug = xno; then rlpdebug="no"; fi ],
	[ rlpdebug="yes" ]
)

if test $debug = "yes"; then
	AC_DEFINE(DEBUG, 1, [Whether debug is turned on])
fi
if test $xdebug = "yes"; then
	AC_DEFINE(XDEBUG, 1, [Whether xdebug is turned on])
fi
if test $rlpdebug = "yes"; then
	AC_DEFINE(RLP_DEBUG, 1, [Whether rlpdebug is turned on])
fi

dnl ======================== Set gcc CFLAGS if we use gcc
if test "x$GCC" = "xyes"; then
	CFLAGS="$CFLAGS -Wall"
fi

dnl ======================== Set some gcc CFLAGS to reduce build warnings
if test "x$GCC" = "xyes"; then
  OLD_CFLAGS="$CFLAGS"

  CFLAGS="-Wno-pointer-sign"
  AC_MSG_CHECKING(if gcc supports $CFLAGS compiler option)
  AC_TRY_COMPILE( [], [ int main() { return 0; } ],
		ac_cv_have_no_pointer_sign=yes,
		ac_cv_have_no_pointer_sign=no)
  AC_MSG_RESULT($ac_cv_have_no_pointer_sign)
  CFLAGS="-fvisibility=hidden"
  AC_MSG_CHECKING(if gcc supports $CFLAGS compiler option)
  AC_TRY_COMPILE( [], [ int main() { return 0; } ],
		ac_cv_have_hidden_visibility=yes,
		ac_cv_have_hidden_visibility=no)
  AC_MSG_RESULT($ac_cv_have_hidden_visibility)
  CFLAGS="-fno-strict-aliasing"
  AC_MSG_CHECKING(if gcc supports $CFLAGS compiler option)
  AC_TRY_COMPILE( [], [ int main() { return 0; } ],
		ac_cv_have_strict_aliasing=yes,
		ac_cv_have_strict_aliasing=no)
  AC_MSG_RESULT($ac_cv_have_strict_aliasing)

  CFLAGS="$OLD_CFLAGS"
  if test $ac_cv_have_no_pointer_sign = yes; then
    CFLAGS="$CFLAGS -Wno-pointer-sign"
  fi
  if test $ac_cv_have_hidden_visibility = yes; then
    CFLAGS="$CFLAGS -fvisibility=hidden"
  fi
  if test $ac_cv_have_strict_aliasing = yes; then
    CFLAGS="$CFLAGS -fno-strict-aliasing"
  fi
fi

dnl ======================== avoid deprecated warnings here
# CFLAGS="$CFLAGS -DGNOKII_DEPRECATED=''"

dnl ======================== Checks for libraries.

AC_ARG_WITH(libpthread,
   [  --with-libpthread=DIR   specifies the base libpthread],
   [ if test x$withval = xyes
     then
      AC_MSG_WARN(Usage is: --with-libpthread=DIR)
     else
      PTHREAD_LIBS="-L$withval/lib/"
      PTHREAD_CFLAGS="-I$withval/include/"
     fi
   ]
)

ACX_PTHREAD
if test "x$PTHREAD_CFLAGS" = "x-pthread"; then
	PTHREAD_LIBS="$PTHREAD_LIBS -pthread"
fi

dnl FIXME: do we really test here if libc contains this function?
if test "x$PTHREAD_LIBS" = xerror; then
   AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="",
      [AC_MSG_WARN(not found library: pthread!!!)
       AC_MSG_WARN(disabling xgnokii and smsd)])
fi

AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_have_tm_gmtoff,
	[AC_TRY_COMPILE([#include <time.h>],
		[struct tm t; t.tm_gmtoff = 0],
		ac_cv_have_tm_gmtoff=yes,
		ac_cv_have_tm_gmtoff=no)])
if test $ac_cv_have_tm_gmtoff = yes; then
	AC_DEFINE(HAVE_TM_GMTON, 1, [Whether tm_gmtoff is available])
fi

AC_CACHE_CHECK(for timer operations, ac_cv_have_timeops,
	[AC_TRY_LINK([#include <sys/time.h>],
		[struct timeval tv; timerisset(&tv); timerclear(&tv); timercmp(&tv, &tv, <); timeradd(&tv, &tv, &tv); timersub(&tv, &tv, &tv); ],
		ac_cv_have_timeops=yes,
		ac_cv_have_timeops=no)])
if test $ac_cv_have_timeops = yes; then
        AC_DEFINE(HAVE_TIMEOPS, 1, [Whether timer operations are available])
fi

have_termios="no"
dnl Checking for setspeed in termios.h
AC_CACHE_CHECK(for cfsetspeed in termios.h, ac_cv_have_cfsetspeed,
	[AC_TRY_LINK([#include <termios.h>],
		[struct termios t; cfsetspeed(&t, B9600);],
		ac_cv_have_cfsetspeed=yes,
		ac_cv_have_cfsetspeed=no)])
if test $ac_cv_have_cfsetspeed = yes; then
        AC_DEFINE(HAVE_CFSETSPEED, 1, [Whether cfsetspeed is available])
        have_termios="yes"
fi

if test $have_termios = "no"; then
	AC_CACHE_CHECK(for cfsetispeed and cfsetospeed in termios.h, ac_cv_have_cfsetiospeed,
		[AC_TRY_LINK([#include <termios.h>],
			[struct termios t; cfsetispeed(&t, B9600);  cfsetospeed(&t, B9600);],
			ac_cv_have_cfsetiospeed=yes,
			ac_cv_have_cfsetiospeed=no)])
	if test $ac_cv_have_cfsetiospeed = yes; then
		AC_DEFINE(HAVE_CFSETISPEED, 1, [Whether cfsetispeed is available])
		AC_DEFINE(HAVE_CFSETOSPEED, 1, [Whether cfsetospeed is available])
		have_termios="yes"
	fi
fi

if test $have_termios = "no"; then
	AC_CACHE_CHECK(for c_ispeed and c_ospeed in struct termios, ac_cv_have_c_iospeed,
		[AC_TRY_COMPILE([#include <termios.h>],
			[struct termios t; t.c_iflag = B9600; t.c_oflag = B9600;],
			ac_cv_have_c_iospeed=yes,
			ac_cv_have_c_iospeed=yes)])
	if test ac_cv_have_c_iospeed = yes; then
		AC_DEFINE(HAVE_TERMIOS_CSPEED, 1, [Whether c_ispeed and c_ospeed are available])
	fi
fi

dnl ======================== Checks for getopt_long support

AC_CHECK_HEADER(getopt.h, ,
      [CFLAGS="$CFLAGS -I../getopt"])

AC_ARG_WITH(gnugetopt,
   [  --with-gnugetopt=DIR    specifies the getopt library location directory],
   [ if test x$withval=xyes; then
        AC_MSG_WARN(Usage is: --with-gnugetopt=DIR)
     else
        GETOPT_LIBS="-L$withval"
     fi
   ]
)

OWN_GETOPT=""
AC_CHECK_FUNC(getopt_long, , [
        SAVE_LIBS="$LIBS $GETOPT_LIBS"
        LIBS="$LIBS $GETOPT_LIBS"
           AC_CHECK_LIB(gnugetopt, getopt_long, GETOPT_LIBS="$GETOPT_LIBS -lgnugetopt",
            OWN_GETOPT="1")
        LIBS=$SAVE_LIBS])

dnl ======================== Check for libical
AC_ARG_WITH(libical,
   [  --with-libical=DIR      specifies the base libical],
   [ if test x$withval = xyes
     then
      AC_MSG_WARN(Usage is: --with-libical=DIR)
     else
      ICAL_LIBS="-L$withval/lib/"
      ICAL_CFLAGS="-I$withval/include/"
     fi
   ]
)

USE_LIBICAL="no"
AC_ARG_ENABLE(libical,
       	      AC_HELP_STRING([--enable-libical],
               	             [enable libical support (default is autodetected)]
                            ),,
       	      [enable_libical=yes])

if test "$enable_libical" == "yes"; then
	OLD_CFLAGS="$CFLAGS"
	LIBS="$LIBS $ICAL_LIBS -lpthread -lical"
	CFLAGS="$CFLAGS $ICAL_CFLAGS"
	AC_MSG_CHECKING(whether libical is installed)
	AC_TRY_LINK([
	   #include <ical.h>
	   ],[
	   int priority;
	   icalcomponent *pIcal=NULL;
	   struct icaltimetype atime = icaltime_from_string("20031231T223000");

	   pIcal = icalcomponent_vanew(
	      ICAL_VCALENDAR_COMPONENT,
	      icalproperty_new_version("2.0"),
	      icalproperty_new_prodid("//Gnokii.org//NONSGML v.0.5.8"),
	      0
	   );
	   atime.is_daylight = 1;
	   priority = icalproperty_get_priority(icalcomponent_get_first_property(pIcal, ICAL_PRIORITY_PROPERTY));
	   ],
	   [
	      AC_MSG_RESULT(yes)
	      USE_LIBICAL="yes"
	      AC_DEFINE([HAVE_LIBICAL],[1],[Use libical])
	   ],
	   [
	      AC_MSG_RESULT(no)
	      LIBS="$OLD_LIBS"
	      CFLAGS="$OLD_CFLAGS"
	   ]
	)
fi

dnl ======================== Check for libusb
USE_LIBUSB="no"
AC_ARG_ENABLE(libusb,
              AC_HELP_STRING([--enable-libusb],
                             [enable libusb support (default is autodetected)]
                            ),,
              [enable_libusb=yes])
if test "$enable_libusb" == "yes"; then
	AC_MSG_CHECKING(whether libusb is installed)
	AC_TRY_COMPILE([#include <usb.h>],
		[struct usb_dev_handle *dev;],
		[
			AC_MSG_RESULT(yes)
			AC_DEFINE([HAVE_LIBUSB],[1],[Use libusb])
			USE_LIBUSB="yes"
			USB_LIBS="-lusb"
			AC_SUBST(USB_LIBS)
		],
		[
			AC_MSG_RESULT(no)
		]
	)
fi

dnl ======================== Checks for gethostbyname support
AC_CHECK_FUNC(gethostbyname, ,
	AC_CHECK_LIB(nsl, gethostbyname, TCP_LIBS="-lnsl"
		     AC_SUBST(TCP_LIBS)))

dnl ======================== Checks for Linux IrDA support
USE_IRDA="no"
AC_ARG_ENABLE(irda,
              AC_HELP_STRING([--enable-irda],
                             [enable irda support (default is autodetected)]
                            ),,
              [enable_irda=yes])
if test "$enable_irda" == "yes"; then
	AC_CHECK_HEADER(linux/irda.h,
		[AC_DEFINE(HAVE_IRDA, 1, [Whether IrDA is available])
		 USE_IRDA="yes"],,
		[#include <sys/socket.h>
		 #include <sys/ioctl.h>
		 #include <linux/types.h>])
fi

dnl ======================== Checks for Linux Bluetooth support
bluetooth="no"
AC_ARG_WITH(bluetooth,
	[  --with-bluetooth=DIR    specifies the base libbluetooth],
	[ if test x$withval = xyes; then
		AC_MSG_WARN(Usage is: --with-bluetooth=DIR)
	  else
		LIBS="$LIBS -L$withval/lib"
		CFLAGS="$CFLAGS -I$withval/net -I$withval/"
	  fi
	]
)

USE_BLUETOOTH="no"
AC_ARG_ENABLE(bluetooth,
              AC_HELP_STRING([--enable-bluetooth],
                             [enable bluetooth support (default is autodetected)]
                            ),,
              [enable_bluetooth=yes])
if test "$enable_bluetooth" == "yes"; then
	AC_MSG_CHECKING([for the bluetooth support])
	AC_CACHE_CHECK(for the struct sockaddr_rc in <bluetooth/rfcomm.h>, ac_cv_have_sockaddr_rc,
		[AC_TRY_COMPILE([#include <sys/socket.h>
				#include <bluetooth/bluetooth.h>
				#include <bluetooth/rfcomm.h>],
			[struct sockaddr_rc rc;],
			ac_cv_have_sockaddr_rc=yes,
			ac_cv_have_sockaddr_rc=no)])
	if test $ac_cv_have_sockaddr_rc = yes; then
		AC_DEFINE(HAVE_BLUETOOTH, 1, [Whether Bluetooth is available])
		AC_DEFINE(HAVE_BLUETOOTH_BLUEZ,[],[Compile on Linux])
		USE_BLUETOOTH="yes"
		BLUETOOTH_LIBS="-lbluetooth"
		AC_SUBST(BLUETOOTH_LIBS)
	fi
fi
dnl ======================== Checks for MacOSX Bluetooth support
if test "$enable_bluetooth" == "yes"; then
	AC_MSG_CHECKING([for the MacOS X bluetooth support])
	AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
	AC_CHECK_HEADERS(IOBluetooth/Bluetooth.h)
	AC_CHECK_HEADERS(IOBluetooth/IOBluetoothUserLib.h)
	AC_TRY_COMPILE([#include <CoreFoundation/CoreFoundation.h>
			#include <IOBluetooth/Bluetooth.h>
			#include <IOBluetooth/IOBluetoothUserLib.h>],

			[CFStringRef strDevice;
			strDevice = CFStringCreateWithCString(NULL, NULL, NULL);
			IOBluetoothNSStringToDeviceAddress(NULL, NULL);],

		ac_cv_have_iobluetooth=yes,
		ac_cv_have_iobluetooth=no)

	if test $ac_cv_have_iobluetooth = yes; then
		AC_DEFINE(HAVE_BLUETOOTH, 1, [Whether Bluetooth is available])
		AC_DEFINE(HAVE_BLUETOOTH_MACOSX,[],[Compile on Darwin / Mac OSX])
		USE_BLUETOOTH="yes"
		BLUETOOTH_LIBS="$PTHREAD_LIBS -framework CoreFoundation -framework IOBluetooth -framework Foundation"
		AC_SUBST(BLUETOOTH_LIBS)
	fi
fi

dnl ======================== Checks for FreeBSD/netgraph Bluetooth support
if test "$enable_bluetooth" == "yes"; then
	AC_MSG_CHECKING([for the FreeBSD/netgraph bluetooth support])
	AC_CACHE_CHECK(for the struct sockaddr_rfcomm in <netgraph/.../ng_btsocket.h>, ac_cv_have_sockaddr_rfcomm,
		[AC_TRY_COMPILE([#include <sys/types.h>
				#include <sys/socket.h>
				#include <bitstring.h>
				#include <netgraph/bluetooth/include/ng_hci.h>
				#include <netgraph/bluetooth/include/ng_l2cap.h>
				#include <netgraph/bluetooth/include/ng_btsocket.h>],
			[struct sockaddr_rfcomm rc;],
			ac_cv_have_sockaddr_rfcomm=yes,
			ac_cv_have_sockaddr_rfcomm=no)])

	if test $ac_cv_have_sockaddr_rfcomm = yes; then
		AC_DEFINE(HAVE_BLUETOOTH, 1, [Whether Bluetooth is available])
		AC_DEFINE(HAVE_BLUETOOTH_NETGRAPH,[],[Compile on FreeBSD])
		USE_BLUETOOTH="yes"
		AC_CHECK_LIB(bluetooth, bt_aton,
			    [BLUETOOTH_LIBS="$LIBS -lbluetooth" AC_DEFINE(HAVE_BT_ATON,[],[Define to 1 if you have the 'bt_aton' function.]) AC_SUBST(BLUETOOTH_LIBS)])
	fi
fi

dnl ======================== Checks for libpcsclite
USE_LIBPCSCLITE="no"
AC_ARG_ENABLE(libpcsclite,
              AC_HELP_STRING([--enable-libpcsclite],
                             [enable libpcsclite support (default is autodetected)]
                            ),,
              [enable_libpcsclite=yes])
if test "$enable_libpcsclite" == "yes"; then
	PKG_CHECK_MODULES(LIBPCSCLITE, libpcsclite >= 1.3.1, USE_LIBPCSCLITE=yes, USE_LIBPCSCLITE=no)
	if test "$USE_LIBPCSCLITE" == yes; then
		OLD_CFLAGS="$CFLAGS"
		CFLAGS="$LIBPCSCLITE_CFLAGS $OLD_CFLAGS"
		AC_MSG_CHECKING([if libpcsclite includes are installed and usable])
		AC_TRY_COMPILE([#include <PCSC/wintypes.h>
				#include <PCSC/winscard.h>],
				[SCARDCONTEXT hContext;
				SCARDHANDLE hCard;
				DWORD dwActiveProtocol;
				SCARD_IO_REQUEST *pioSendPci, pioRecvPci;
				BYTE buf[256];],
				USE_LIBPCSCLITE=yes,
				USE_LIBPCSCLITE=no)
		AC_MSG_RESULT($USE_LIBPCSCLITE)
		CFLAGS="$OLD_CFLAGS"
		if test "$USE_LIBPCSCLITE" == yes; then
			AC_DEFINE([HAVE_PCSC], [1], [Define if you have libpcsclite])
		fi
	fi
fi
if test "$USE_LIBPCSCLITE" == yes; then
	OLD_CFLAGS="$CFLAGS"
	CFLAGS="$LIBPCSCLITE_CFLAGS $OLD_CFLAGS"
	AC_CHECK_TYPE([LPCSTR],
	    [AC_DEFINE([HAVE_LPCSTR], 1, 
	       [Define to 1 if libpcsclite defines the type 'LPCSTR'.])],
	    [], [#include <PCSC/wintypes.h>])
	CFLAGS="$OLD_CFLAGS"
fi

dnl ======================== Checks for X base support

found_gtk=no

if test "$no_x" = yes -o "$with_x" = "no"; then
   x_support="no"
   XPM_CFLAGS=""
   XPM_LIBS=""
   GTK_CFLAGS=""
   GTK_LIBS=""
else
   AC_PATH_X
   if test "x$x_libraries" = "xNONE"; then
      x_support="no"
      XPM_CFLAGS=""
      XPM_LIBS=""
      GTK_CFLAGS=""
      GTK_LIBS=""
      AC_MSG_WARN(Cannot find library libX11.)
      AC_MSG_WARN(Disabling xgnokii.)
   else
      if test "x$x_includes" != "x"; then
         XINCL="-I$x_includes"
      else
         XINCL=""
      fi
      if test "x$x_libraries" != "x"; then
         XLIBS="-L$x_libraries"
      else
         XLIBS=""
      fi
      CPPFLAGS="$CPPFLAGS $XINCL"
      AC_CHECK_HEADERS(X11/xpm.h,
          [ AC_CHECK_LIB(Xpm, XpmWriteFileFromXpmImage,
                [ XPM_CFLAGS="$XINCL"
                  XPM_LIBS="$XLIBS -lXpm -lX11"
                  AC_DEFINE(XPM, 1, [Whether the Xpm library is available]) ],
                AC_MSG_WARN(Cannot found library libXpm - disabling XPM support.),
                [ $XLIBS -lX11 ]
            )
          ]
      )
      if test "x$PTHREAD_LIBS" = xerror; then
         x_support="no"
         GTK_CFLAGS=""
         GTK_LIBS=""
      else
         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.0, found_gtk=yes, found_gtk=no)
         if test "$found_gtk" = no; then
            x_support="no"
            GTK_CFLAGS=""
            GTK_LIBS=""
            AC_MSG_WARN(Cannot find GTK+ 2.0.)
            AC_MSG_WARN(Disabling xgnokii.)
         else
            x_support="yes"
         fi
      fi
   fi
fi

AM_CONDITIONAL(HAVE_GTK, test "x$found_gtk" = "xyes")

dnl ======================== Check for libsocket
AC_CHECK_LIB(socket, socket)

dnl ======================== Checks for glib support for smsd

found_glib=no

AC_ARG_ENABLE(smsd,
	AC_HELP_STRING([--enable-smsd],
		[enable smsd support (default is autodetected)]),,
	[enable_smsd=yes])

if test "$enable_smsd" = yes; then
	PKG_CHECK_MODULES(GLIB, glib-2.0 gmodule-2.0, found_glib=yes, found_glib=no)
	if test "$found_glib" = no; then
		AC_MSG_WARN(Cannot find glib 2.0.)
		AC_MSG_WARN(Disabling smsd.)
		enable_smsd="no"
	fi
fi

AM_CONDITIONAL(SMSD, test "x$enable_smsd" = "xyes")

dnl ======================== Checks for databases support for smsd

have_postgres=no
AC_PATH_PROG(PGCONFIG, pg_config, no)
if test x$PGCONFIG != xno ; then
	have_postgres=yes
	pg_libdir=`$PGCONFIG --libdir`
	POSTGRES_LIBS="-L$pg_libdir -lpq"
	pg_includedir=`$PGCONFIG --includedir`
	POSTGRES_CFLAGS="-I$pg_includedir"
	AC_SUBST(POSTGRES_LIBS)
	AC_SUBST(POSTGRES_CFLAGS)
fi

AM_CONDITIONAL(HAVE_POSTGRES, test "x$have_postgres" = "xyes")

have_mysql=no
AC_PATH_PROG(MYSQLCONFIG, mysql_config, no)
if test x$MYSQLCONFIG != xno ; then
	have_mysql=yes
	MYSQL_LIBS=`$MYSQLCONFIG --libs`
	MYSQL_CFLAGS=`$MYSQLCONFIG --cflags`
	AC_SUBST(MYSQL_LIBS)
	AC_SUBST(MYSQL_CFLAGS)
fi

AM_CONDITIONAL(HAVE_MYSQL, test "x$have_mysql" = "xyes")

dnl ======================== Additional switches

AC_ARG_ENABLE(security,
   [  --enable-security       enable all security features @<:@default=no@:>@],
   [ if test x$enable_security = xyes; then
	AC_DEFINE(SECURITY, 1, [Whether security features are enabled])
     	security="yes"
     else
	security="no"
     fi ],
   [ security="no" ]
)

AC_ARG_ENABLE(win32,
   [  --enable-win32          if you want win32 support ],
   [ if test x$enable_win32 = xyes; then
	AC_DEFINE(WIN32, 1, [Whether compiling on Win32])
	WIN32=1
	if test x$cross_compiling = xyes; then
		AC_DEFINE(WIN32_CROSS, 1, [Define if you cross compile win32.])
		WIN32_CROSS=1
		win32="cross"
	else
 		win32="yes"
	fi
	AC_CHECK_HEADER(af_irda.h, [AC_DEFINE(HAVE_IRDA, 1, [Whether IrDA is available]) USE_IRDA="yes"])
     else
	win32="no"
     fi ],
   [ win32="no"]
)

AM_CONDITIONAL(WIN32, test "x$WIN32" = "x1")

AC_ARG_ENABLE(unix98test,
   [  --enable-unix98test     if you want to disable UNIX98 test and assume to use it
                          default is enabled],
   [ if test x$enable_unix98test = xno; then
	unix98test="no"
     else
	unix98test="yes"
     fi ],
   [ unix98test="yes"]
)

if test x$unix98test = xyes; then

AC_CHECK_FUNC(grantpt,
   [ AC_TRY_RUN([
#define  _XOPEN_SOURCE 500

#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int main()
{
	char *name = NULL;
        int master, err;

        master = open("/dev/ptmx", O_RDWR | O_NOCTTY | O_NONBLOCK);
        if (master >= 0) {
                err = grantpt(master);
                err = err || unlockpt(master);
                if (!err) {
                        name = ptsname(master);
                } else {
                        exit(-1);
                }
        } else {
		exit(-1);
	}
	close(master);
	exit(0);
}
                ],
                have_unix98=yes,
                AC_MSG_WARN("No unix98ptys"),
		have_unix98=yes)
   ]
)

fi

AC_DEFINE(USE_UNIX98PTYS, test x$have_unix98 = xyes, [Whether Unix98 support is available])

AC_TRY_COMPILE( [#define _XOPEN_SOURCE 500
		 #include <sys/types.h>
		 #include <sys/socket.h>],
		[struct msghdr msg; msg.msg_control;],
		AC_DEFINE(HAVE_MSGHDR_MSG_CONTROL, 1, [Whether struct msghdr has a msg_control member])
)

dnl ======================== Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h sys/file.h)
AC_CHECK_HEADERS(string.h strings.h ctype.h stdlib.h stdarg.h stdint.h)
AC_CHECK_HEADERS(stddef.h sys/socket.h sys/modem.h termios.h sys/filio.h)
AC_CHECK_HEADERS(inttypes.h wchar.h direct.h sys/param.h)

dnl ======================== Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_CHECK_TYPE([u_int8_t],
    [AC_DEFINE([HAVE_U_INT8_T], 1, 
       [Define to 1 if the system has the type 'u_int8_t'.])])

dnl we don't check for long double and long long int, only
dnl ancient platforms don't have them
AC_DEFINE(HAVE_LONG_LONG, 1, [Whether the platform has a long long int type])
AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Whether the platform has a long double type])

AC_CACHE_CHECK(for __ptr_t, ac_cv_c___ptr_t,
	[AC_TRY_COMPILE([#include <stdio.h>],
		[__ptr_t foo = NULL;],
		ac_cv_c___ptr_t=yes, ac_cv_c___ptr_t=no)])
if test $ac_cv_c___ptr_t = yes; then
	AC_DEFINE(HAVE_PTR_T, 1, [Whether __ptr_t is available])
fi

dnl ======================== Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(mktime timegm gettimeofday select poll wcrtomb)
AC_CHECK_FUNCS(strchr strdup strndup strstr strtol strtok strsep)
AC_CHECK_FUNCS(asprintf vasprintf snprintf vsnprintf getline)
AC_CACHE_CHECK(for ISO C99 compliant snprintf,ac_cv_func_snprintf_c99,
	[AC_TRY_RUN([
#include <stdio.h>

int main()
{
	char buf[] = {0, 0, 0, 0};

	snprintf(buf, 3, "ABC");
	exit ((buf[2] != 0) || (snprintf(NULL, 0, "%d", 100) != 3));
}],ac_cv_func_snprintf_c99=yes,ac_cv_func_snprintf_c99=no,ac_cv_func_snprintf_c99=no)])
if test $ac_cv_func_snprintf_c99 = yes; then
	AC_DEFINE(HAVE_C99_SNPRINTF, 1, [Whether snprintf is available])
fi
AC_CACHE_CHECK(for ISO C99 compliant vsnprintf,ac_cv_func_vsnprintf_c99,
	[AC_TRY_RUN([
#include <stdio.h>
#include <stdarg.h>

int doit(char *buf, int len, const char *s, ...)
{
	va_list ap;
	int r;

	va_start(ap, s);
	r = vsnprintf(buf, len, s, ap);
	va_end(ap);

	return r;
}

int main()
{
	char buf[] = {0, 0, 0, 0};

	doit(buf, 3, "ABC");
	exit ((buf[2] != 0) || (doit(NULL, 0, "%d", 100) != 3));
}],ac_cv_func_vsnprintf_c99=yes,ac_cv_func_vsnprintf_c99=no,ac_cv_func_vsnprintf_c99=no)])
if test $ac_cv_func_vsnprintf_c99 = yes; then
	AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [Whether vsnprintf is available])
fi

CFLAGS="$CFLAGS $NLS_CFLAGS"
LIBS="$LIBS $NLS_LIBS"

XPACKAGE=xgnokii
AC_DEFINE_UNQUOTED(XVERSION, "$XVERSION", [The current xgnokii version])

HAVE_XGNOKII=$x_support

AC_DEFINE_UNQUOTED(SVERSION, "$SVERSION", [The current SMSD version])

case "$INSTALL" in
  'config/install-sh -c') INSTALL=`pwd`/$INSTALL
   ;;
esac

SHELL=${CONFIG_SHELL-/bin/sh}

AC_SUBST(SHELL)
case "$build_os" in
  solaris*) SHELL=/bin/ksh
   ;;
esac

AC_EXPAND_DIR(mgnokiidev_bindir, "${sbindir}")
AC_DEFINE_UNQUOTED(SBINDIR, "$mgnokiidev_bindir", [Where mgnokiidev gets installed])

AC_EXPAND_DIR(prefix_dir, "${prefix}")
AC_DEFINE_UNQUOTED(PREFIX, "$prefix_dir", [Root dir for gnokii, xgnokii and smsd])

AC_CONFIG_HEADERS([include/config.h])

AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_SUBST(XVERSION)
AC_SUBST(XPACKAGE)

AC_SUBST(exec_prefix)

AC_SUBST(GLDFLAGS)

AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LIBS)

AC_SUBST(OWN_GETOPT)
AC_SUBST(USE_UNIX98PTYS)
AC_SUBST(NEED_LOCALE_CHARSET)

AC_SUBST(LIBS)

AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
AC_SUBST(XPM_CFLAGS)
AC_SUBST(XPM_LIBS)
AC_SUBST(HAVE_XGNOKII)
AC_SUBST(WIN32)
AC_SUBST(WIN32_CROSS)

AC_SUBST(HAVE_LIBICAL)
AC_SUBST(HAVE_LIBUSB)

AC_OUTPUT(
	  Makefile
	  getopt/Makefile
	  Docs/Makefile
	  Docs/man/Makefile
	  Docs/protocol/Makefile
	  Docs/sample/Makefile
	  Docs/sample/logo/Makefile
	  Docs/sample/vCalendar/Makefile
	  Docs/sample/ringtone/Makefile
	  Docs/sample/ppp/Makefile
	  include/Makefile
	  include/gnokii.h
	  include/data/Makefile
	  include/devices/Makefile
	  include/phones/Makefile
	  include/links/Makefile
	  include/gnokii/Makefile
	  common/gnokii.pc
	  common/Makefile
	  common/data/Makefile
	  common/devices/Makefile
	  common/links/Makefile
	  common/phones/Makefile
	  gnokii/Makefile
	  gnokiid/Makefile
	  smsd/Makefile
	  utils/Makefile
	  xgnokii/xgnokii.pc
	  xgnokii/Makefile
	  xgnokii/xpm/Makefile
	  xgnokii/docs/Makefile
	  xgnokii/docs/help/pl_PL/netmon/Makefile
	  xgnokii/docs/help/pl_PL/netmon/gsm/Makefile
	  xgnokii/docs/help/pl_PL/Makefile
	  xgnokii/docs/help/en_US/firmware/Makefile
	  xgnokii/docs/help/en_US/netmon/Makefile
	  xgnokii/docs/help/en_US/Makefile
	  xgnokii/docs/help/Makefile
	  po/Makefile.in
	  patches/Makefile
	  testsuite/Makefile
	  testsuite/data/Makefile
	  win32/Makefile
  )

dnl ======================== Final report

echo "

  G N O K I I

  A toolset and driver for the mobile phones.

  Copyright (C) 1999-2006  The Gnokii Development Team.

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  See file COPYING for more details.

    Host system:        $host_os
    Gnokii version:     $VERSION
    Xgnokii version:    $XVERSION
    X (GTK+) support:   $x_support
    smsd support:       $enable_smsd
    Postgres support:   $have_postgres
    MySQL support:      $have_mysql
    Debug:              $debug
    XDebug:             $xdebug
    RLPDebug:           $rlpdebug
    NLS:                $USE_NLS
    IrDA:               $USE_IRDA
    ical read support:  $USE_LIBICAL
    Bluetooth:          $USE_BLUETOOTH
    libusb support:     $USE_LIBUSB
    libpcsclite support:$USE_LIBPCSCLITE
    Security:           $security
    Build Shared Lib:   $enable_shared
    Build Static Lib:   $enable_static
    Win32:              $win32 
    Prefix:             $prefix

  Type '${MAKE}' for compilation and then '${MAKE} install', to
  install gnokii.
"