~meebey/smuxi/smuxi-head-mirror-master

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
AC_PREREQ([2.54])
AC_INIT([smuxi], [1.1], [https://smuxi.im/issues/new])
# using the --foreign option makes automake less strict about GNU policy 
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign tar-ustar])
AM_MAINTAINER_MODE

AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test "x$PKG_CONFIG" = "xno"; then
	AC_MSG_ERROR([You need to install pkg-config])
fi

AC_PROG_INSTALL

AC_MSG_CHECKING([whether the shell understands "+="])
shell_append=no
( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
    >/dev/null 2>&1 \
  && shell_append=yes
AC_MSG_RESULT([$shell_append])
if test "x$shell_append" = "xno"; then
	AC_MSG_ERROR([Your shell (/bin/sh) is not supporting += which is required by this configure script. Try CONFIG_SHELL="env bash" ./configure instead.])
fi

# I18N
IT_PROG_INTLTOOL([0.25])

POSUB="
	po
	po-Engine
	po-Engine-MessageBuffer
	po-Engine-Campfire
	po-Engine-IRC
	po-Engine-JabbR
	po-Engine-Twitter
	po-Engine-XMPP
	po-Server
	po-Frontend
	po-Frontend-GNOME
	po-Frontend-GNOME-IRC
	po-Frontend-GNOME-Twitter
	po-Frontend-GNOME-XMPP
	po-Frontend-SWF
"
AC_SUBST(POSUB)
GETTEXT_PACKAGE=smuxi
AC_SUBST(GETTEXT_PACKAGE)

GETTEXT_PACKAGE_ENGINE=smuxi-engine
AC_SUBST(GETTEXT_PACKAGE_ENGINE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_ENGINE, "$GETTEXT_PACKAGE_ENGINE", [Gettext package])

GETTEXT_PACKAGE_ENGINE_IRC=smuxi-engine-irc
AC_SUBST(GETTEXT_PACKAGE_ENGINE_IRC)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_ENGINE_IRC, "$GETTEXT_PACKAGE_ENGINE_IRC", [Gettext package])

GETTEXT_PACKAGE_ENGINE_XMPP=smuxi-engine-xmpp
AC_SUBST(GETTEXT_PACKAGE_ENGINE_XMPP)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_ENGINE_XMPP, "$GETTEXT_PACKAGE_ENGINE_XMPP", [Gettext package])

GETTEXT_PACKAGE_ENGINE_TWITTER=smuxi-engine-twitter
AC_SUBST(GETTEXT_PACKAGE_ENGINE_TWITTER)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_ENGINE_TWITTER, "$GETTEXT_PACKAGE_ENGINE_TWITTER", [Gettext package])

GETTEXT_PACKAGE_ENGINE_CAMPFIRE=smuxi-engine-campfire
AC_SUBST(GETTEXT_PACKAGE_ENGINE_CAMPFIRE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_ENGINE_CAMPFIRE, "$GETTEXT_PACKAGE_ENGINE_CAMPFIRE", [Gettext package])

GETTEXT_PACKAGE_ENGINE_JABBR=smuxi-engine-jabbr
AC_SUBST(GETTEXT_PACKAGE_ENGINE_JABBR)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_ENGINE_JABBR, "$GETTEXT_PACKAGE_ENGINE_JABBR", [Gettext package])

GETTEXT_PACKAGE_MSG_BUFFER=smuxi-message-buffer
AC_SUBST(GETTEXT_PACKAGE_MSG_BUFFER)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_MSG_BUFFER, "$GETTEXT_PACKAGE_MSG_BUFFER", [Gettext package])

GETTEXT_PACKAGE_SERVER=smuxi-server
AC_SUBST(GETTEXT_PACKAGE_SERVER)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_SERVER, "$GETTEXT_PACKAGE_SERVER", [Gettext package])

GETTEXT_PACKAGE_FRONTEND=smuxi-frontend
AC_SUBST(GETTEXT_PACKAGE_FRONTEND)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_FRONTEND, "$GETTEXT_PACKAGE_FRONTEND", [Gettext package])

GETTEXT_PACKAGE_FRONTEND_GNOME=smuxi-frontend-gnome
AC_SUBST(GETTEXT_PACKAGE_FRONTEND_GNOME)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_FRONTEND_GNOME, "$GETTEXT_PACKAGE_FRONTEND_GNOME", [Gettext package])

GETTEXT_PACKAGE_FRONTEND_GNOME_IRC=smuxi-frontend-gnome-irc
AC_SUBST(GETTEXT_PACKAGE_FRONTEND_GNOME_IRC)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_FRONTEND_GNOME_IRC, "$GETTEXT_PACKAGE_FRONTEND_GNOME_IRC", [Gettext package])

GETTEXT_PACKAGE_FRONTEND_GNOME_TWITTER=smuxi-frontend-gnome-twitter
AC_SUBST(GETTEXT_PACKAGE_FRONTEND_GNOME_TWITTER)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_FRONTEND_GNOME_TWITTER, "$GETTEXT_PACKAGE_FRONTEND_GNOME_TWITTER", [Gettext package])

GETTEXT_PACKAGE_FRONTEND_GNOME_XMPP=smuxi-frontend-gnome-xmpp
AC_SUBST(GETTEXT_PACKAGE_FRONTEND_GNOME_XMPP)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_FRONTEND_GNOME_XMPP, "$GETTEXT_PACKAGE_FRONTEND_GNOME_XMPP", [Gettext package])

GETTEXT_PACKAGE_FRONTEND_STFL=smuxi-frontend-stfl
AC_SUBST(GETTEXT_PACKAGE_FRONTEND_STFL)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_FRONTEND_STFL, "$GETTEXT_PACKAGE_FRONTEND_STFL", [Gettext package])

GETTEXT_PACKAGE_FRONTEND_CURSES=smuxi-frontend-curses
AC_SUBST(GETTEXT_PACKAGE_FRONTEND_CURSES)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_FRONTEND_CURSES, "$GETTEXT_PACKAGE_FRONTEND_CURSES", [Gettext package])

GETTEXT_PACKAGE_FRONTEND_SWF=smuxi-frontend-swf
AC_SUBST(GETTEXT_PACKAGE_FRONTEND_SWF)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_FRONTEND_SWF, "$GETTEXT_PACKAGE_FRONTEND_SWF", [Gettext package])

GETTEXT_PACKAGE_FRONTEND_WPF=smuxi-frontend-wpf
AC_SUBST(GETTEXT_PACKAGE_FRONTEND_WPF)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_FRONTEND_WPF, "$GETTEXT_PACKAGE_FRONTEND_WPF", [Gettext package])

AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.17])
# doesn't support multiple po directories :(
#AM_GLIB_GNU_GETTEXT

AC_ARG_WITH([vendor-package-version],
	AC_HELP_STRING([--with-vendor-package-version="DISTRO_NAME PACKAGE_VERSION"],
		[Set the distro name and package version, e.g. "Debian 0.8-1"]),
	[],
	with_vendor_package_version=
)
WITH_VENDOR_PACKAGE_VERSION=$with_vendor_package_version
if test "x$WITH_VENDOR_PACKAGE_VERSION" = "x"; then
	AC_MSG_CHECKING([for git version])
	if git log --oneline 295b37c8ac4939829a3c7f9150943dba8fff07f0 > /dev/null 2>&1; then
		GIT_BRANCH=$(git branch | grep '^\*' | cut -d ' ' -f 2)
		GIT_COMMIT_HASH=$(git log --no-color --first-parent -n1 --pretty=format:%h)
		DIST_VERSION=$GIT_BRANCH/$GIT_COMMIT_HASH
		DEV_VERSION_SUFFIX="-dev"
		AC_MSG_RESULT(yes)
	else
		DIST_VERSION=tarball
		DEV_VERSION_SUFFIX=
		AC_MSG_RESULT(no)
	fi
else
	DIST_VERSION=$WITH_VENDOR_PACKAGE_VERSION
fi
AC_SUBST([git_branch], "$GIT_BRANCH")
AC_SUBST([git_commit_hash], "$GIT_COMMIT_HASH")
AC_SUBST([DEV_VERSION_SUFFIX])
AC_SUBST([dist_version], "$DIST_VERSION")

SHAMROCK_EXPAND_LIBDIR
SHAMROCK_CHECK_MONO_MODULE(2.8)
SHAMROCK_FIND_MONO_RUNTIME
SHAMROCK_FIND_MONO_2_0_COMPILER_OR_HIGHER
SHAMROCK_CHECK_MONO_GAC_ASSEMBLIES([
	System
	System.Core
	System.Data
	System.Runtime.Remoting
	System.Runtime.Serialization
	System.Xml
	Mono.Posix
	Mono.Data.Sqlite
])

PROFILE=debug
# Release builds, that is without log4net and without debug symbol files (.mdb)
# are not supported at this point, as they have no advantage at runtime but
# disadvantages to analyze bugs.
#AC_ARG_ENABLE(release,
#	AC_HELP_STRING([--enable-release],
#		[Use 'RELEASE' Configuration [default=NO]]),
#		enable_release=yes, enable_release=no)
AM_CONDITIONAL(ENABLE_RELEASE, test x$enable_release = xyes)
#if test "x$enable_release" = "xyes" ; then
#	PROFILE=release
#fi
AC_ARG_ENABLE(debug,
	AC_HELP_STRING([--enable-debug],
		[Use 'DEBUG' Configuration [default=YES]]),
		enable_debug=yes, enable_debug=no)
AM_CONDITIONAL(ENABLE_DEBUG, test x$enable_debug = xyes)
if test "x$enable_debug" = "xyes" ; then
	PROFILE=debug
fi
AC_SUBST(PROFILE)

AC_SUBST(CSC, "$MCS")
CSC_FLAGS=
if test "x$PROFILE" = "xdebug"; then
	AM_CONDITIONAL(ENABLE_DEBUG, true)
	CSC_FLAGS+="-define:DEBUG,TRACE,LOG4NET -debug"
else
	AM_CONDITIONAL(ENABLE_RELEASE, true)
fi
AC_SUBST(CSC_FLAGS)

MCS_BASENAME=$(basename $MCS)
CLI_RUNTIME=4.5
if test "$MCS_BASENAME" = "gmcs"; then
	CLI_RUNTIME=3.5
fi
if test "$MCS_BASENAME" = "dmcs"; then
	CLI_RUNTIME=4.0
fi
if test "$MCS_BASENAME" = "mcs"; then
	CLI_RUNTIME=4.5
fi
if test "$CLI_RUNTIME" = "4.5"; then
	if test ! -e "$($PKG_CONFIG --variable=libdir mono)/mono/4.5/mscorlib.dll" -a \
			! -e "$($PKG_CONFIG --variable=prefix mono)/lib/mono/4.5/mscorlib.dll"; then
		# Mono without 4.5 support -> downgrade to 4.0
		CLI_RUNTIME=4.0
	fi
fi
if test "$CLI_RUNTIME" = "4.0"; then
	if test ! -e "$($PKG_CONFIG --variable=libdir mono)/mono/4.0/mscorlib.dll" -a \
		    ! -e "$($PKG_CONFIG --variable=prefix mono)/lib/mono/4.0/mscorlib.dll"; then
		# Mono without 4.0 support -> downgrade to 3.5
		CLI_RUNTIME=3.5
	fi
fi
if test "$CLI_RUNTIME" = "3.5"; then
	XBUILD_FLAGS="/toolsversion:3.5 /p:TargetFrameworkVersion=v3.5 /property:DefineConstants=MONO_3_5"
fi
if test "$CLI_RUNTIME" = "4.0"; then
	XBUILD_FLAGS="/toolsversion:4.0 /p:TargetFrameworkVersion=v4.0 /property:DefineConstants=MONO_4_0"
fi
if test "$CLI_RUNTIME" = "4.5"; then
	XBUILD_FLAGS="/toolsversion:4.0 /p:TargetFrameworkVersion=v4.5 /property:DefineConstants=MONO_4_5"
fi
# Mono's xbuild >= 5.0 no longer defaults to mcs as compiler but csc which will
# generate debug symbol files named .pdb instead of .mdb. Since we are
# installing the debug symbol files, we override the compiler to mcs to ensure
# the files will be avilable for the install during "make install"
AC_MSG_CHECKING([for Mono >= 5.0])
if $PKG_CONFIG 'mono >= 5.0'; then
	AC_MSG_RESULT(yes)
	XBUILD_FLAGS+=" /p:CscToolExe=mcs.exe"
else
	AC_MSG_RESULT(no)
fi
AC_SUBST(XBUILD_FLAGS)

# Required Libraries	
PKG_CHECK_MODULES([LOG4NET], [log4net])

PKG_CHECK_EXISTS([nini-1.1], FOUND_NINI=yes, FOUND_NINI=no)
nini_files=
if test "x$FOUND_NINI" = "xyes"; then
	nini_files=`pkg-config --variable=Libraries nini-1.1`
	if test -z "$nini_files" ; then
		# Debian-based distros place Nini into the GAC
		PKG_CHECK_MODULES([NINI], [nini-1.1])
	else
		# openSUSE has Nini as a private assembly; need to copy it.
		AC_SUBST([NINI_LIBS], "$nini_files")
	fi
else
	PKG_CHECK_MODULES([NINI], [nini >= 1.1])
fi
AM_CONDITIONAL([BUNDLE_NINI], test -n "$nini_files")

AC_ARG_WITH([db4o],
	AC_HELP_STRING([--with-db4o=auto|system|included], [Use system or included db4o @<:@default=auto@:>@]),
	[],
	with_db4o=auto
)
WITH_DB4O=$with_db4o
if test "x$WITH_DB4O" = "xauto"; then
	PKG_CHECK_EXISTS([db4o >= 8.0], FOUND_DB4O=yes, FOUND_DB4O=no)
	if test "x$FOUND_DB4O" = "xyes"; then
		WITH_DB4O=system
	else
		WITH_DB4O=included
	fi
fi
if test "x$WITH_DB4O" = "xsystem"; then
	PKG_CHECK_MODULES([DB4O], [db4o >= 8.0])
	AM_CONDITIONAL([BUNDLE_DB4O], false)
fi
if test "x$WITH_DB4O" = "xincluded"; then
	if test ! -d "$srcdir/lib/db4o-net/Db4objects.Db4o"; then
		AC_MSG_ERROR([lib/db4o-net is empty!])
	fi

	AC_PATH_PROG(XBUILD, xbuild, no)
	if test "x$XBUILD" = "xno"; then
		AC_MSG_ERROR([You need to install xbuild])
	fi

	AM_CONDITIONAL([BUNDLE_DB4O], true)
	#AC_SUBST([DB4O_FILES], "Db4objects.Db4o.dll Db4objects.Db4o.Instrumentation.dll Db4objects.Db4o.NativeQueries.dll")
	AC_SUBST([DB4O_FILES], "Db4objects.Db4o.dll")
fi

# Optional Libraries
AC_ARG_WITH([messaging-menu],
	AC_HELP_STRING([--with-messaging-menu=auto|system|included|no], [Support Messaging Menu (Ubuntu >= 12.10) @<:@default=auto@:>@]),
	[],
	with_messagingmenu=auto
)
WITH_MESSAGINGMENU=$with_messagingmenu
if test "x$WITH_MESSAGINGMENU" = "xauto"; then
	PKG_CHECK_EXISTS([messagingmenu-sharp], FOUND_MESSAGINGMENU_SHARP=yes, FOUND_MESSAGINGMENU_SHARP=no)
	if test "x$FOUND_MESSAGINGMENU_SHARP" = "xyes"; then
		WITH_MESSAGINGMENU=system
	else
		PKG_CHECK_EXISTS([messaging-menu], FOUND_MESSAGING_MENU=yes, FOUND_MESSAGING_MENU=no)
		if test "x$FOUND_MESSAGING_MENU" = "xyes"; then
			WITH_MESSAGINGMENU=included
		else
			WITH_MESSAGINGMENU=no
		fi
	fi
fi
if test "x$WITH_MESSAGINGMENU" = "xsystem"; then
	PKG_CHECK_MODULES([MESSAGINGMENU_SHARP], [messagingmenu-sharp])
fi
if test "x$WITH_MESSAGINGMENU" = "xincluded"; then
	if test ! -f "$srcdir/lib/messagingmenu-sharp/configure.ac"; then
		AC_MSG_ERROR([lib/messagingmenu-sharp is empty!])
	fi

	PKG_CHECK_MODULES([MESSAGING_MENU], [messaging-menu])
	PKG_CHECK_MODULES([GIO_SHARP], [gio-sharp-2.0])
	GIO_SHARP_LIBS=`$PKG_CONFIG --variable=Libraries gio-sharp-2.0`
	AC_SUBST([GIO_SHARP_LIBS])
	GIO_SHARP_FILES="gio-sharp.dll"
	AC_SUBST([GIO_SHARP_FILES])

	ac_configure_args="$ac_configure_args CSC=$MCS"
	AC_CONFIG_SUBDIRS([lib/messagingmenu-sharp])
	AC_SUBST([MESSAGINGMENU_SHARP_FILES], "messagingmenu-sharp.dll")
fi
AM_CONDITIONAL([WITH_MESSAGINGMENU_SHARP_INCLUDED], test "x$WITH_MESSAGINGMENU" = "xincluded")

AC_ARG_WITH([indicate],
	AC_HELP_STRING([--with-indicate], [Support Messaging Menu (Ubuntu <= 12.04) @<:@default=auto@:>@]),
	[],
	with_indicate=auto
)
WITH_INDICATE=$with_indicate
PKG_CHECK_EXISTS([indicate-sharp-0.1], INDICATE_SHARP_SUPPORT=yes, INDICATE_SHARP_SUPPORT=no)
if test "x$WITH_INDICATE" = "xauto" -a "x$WITH_MESSAGINGMENU" != "xno"; then
	WITH_INDICATE=no
fi
if test "x$WITH_INDICATE" = "xauto"; then
	WITH_INDICATE=$INDICATE_SHARP_SUPPORT
fi
if test "x$WITH_INDICATE" = "xyes"; then
	PKG_CHECK_MODULES([INDICATE_SHARP], [indicate-sharp-0.1])
fi

AC_ARG_WITH([notify],
	AC_HELP_STRING([--with-notify], [Support Desktop Notifications @<:@default=auto@:>@]),
	[],
	with_notify=auto
)
WITH_NOTIFY=$with_notify
PKG_CHECK_EXISTS([notify-sharp], NOTIFY_SHARP_SUPPORT=yes, NOTIFY_SHARP_SUPPORT=no)
if test "x$WITH_NOTIFY" = "xauto"; then
	WITH_NOTIFY=$NOTIFY_SHARP_SUPPORT
fi
if test "x$WITH_NOTIFY" = "xyes"; then
	PKG_CHECK_MODULES([NOTIFY_SHARP], [notify-sharp])
fi

AC_ARG_WITH([dbus],
	AC_HELP_STRING([--with-dbus], [Support D-Bus @<:@default=auto@:>@]),
	[],
	with_dbus=auto
)
WITH_DBUS=$with_dbus
PKG_CHECK_EXISTS([dbus-sharp-1.0], DBUS_SHARP1_SUPPORT=yes, DBUS_SHARP1_SUPPORT=no)
PKG_CHECK_EXISTS([dbus-sharp-2.0], DBUS_SHARP2_SUPPORT=yes, DBUS_SHARP2_SUPPORT=no)
PKG_CHECK_EXISTS([ndesk-dbus-1.0], NDESK_DBUS_SUPPORT=yes, NDESK_DBUS_SUPPORT=no)
if test "x$WITH_DBUS" = "xauto"; then
	if test "x$DBUS_SHARP1_SUPPORT" = "xyes"; then
		WITH_DBUS=$DBUS_SHARP1_SUPPORT
	elif test "x$DBUS_SHARP2_SUPPORT" = "xyes"; then
		WITH_DBUS=$DBUS_SHARP2_SUPPORT
	else
		WITH_DBUS=$NDESK_DBUS_SUPPORT
	fi
fi
if test "x$WITH_DBUS" = "xyes"; then
	if test "x$DBUS_SHARP2_SUPPORT" = "xyes"; then
		PKG_CHECK_MODULES([DBUS_SHARP], [dbus-sharp-2.0])
		PKG_CHECK_MODULES([DBUS_SHARP_GLIB], [dbus-sharp-glib-2.0])
		AC_SUBST([DBUS_LIBS], "$DBUS_SHARP_LIBS $DBUS_SHARP_GLIB_LIBS")
		CSC_FLAGS+=" -define:IPC_DBUS -define:DBUS_SHARP"
	elif test "x$DBUS_SHARP1_SUPPORT" = "xyes"; then
		PKG_CHECK_MODULES([DBUS_SHARP], [dbus-sharp-1.0])
		PKG_CHECK_MODULES([DBUS_SHARP_GLIB], [dbus-sharp-glib-1.0])
		AC_SUBST([DBUS_LIBS], "$DBUS_SHARP_LIBS $DBUS_SHARP_GLIB_LIBS")
		CSC_FLAGS+=" -define:IPC_DBUS -define:DBUS_SHARP"
	else
		# fallback to ndesk-dbus
		PKG_CHECK_MODULES([NDESK_DBUS], [ndesk-dbus-1.0])
		PKG_CHECK_MODULES([NDESK_DBUS_GLIB], [ndesk-dbus-glib-1.0])
		AC_SUBST([DBUS_LIBS], "$NDESK_DBUS_LIBS $NDESK_DBUS_GLIB_LIBS")
		CSC_FLAGS+=" -define:IPC_DBUS -define:NDESK_DBUS"
	fi
fi

AC_ARG_WITH([gtkspell],
	AC_HELP_STRING([--with-gtkspell], [Support GTK+ spell checking @<:@default=auto@:>@]),
	[],
	with_gtkspell=auto
)
WITH_GTKSPELL=$with_gtkspell
PKG_CHECK_EXISTS([gtkspell-2.0], GTKSPELL_SUPPORT=yes, GTKSPELL_SUPPORT=no)
if test "x$WITH_GTKSPELL" = "xauto"; then
	WITH_GTKSPELL=$GTKSPELL_SUPPORT
fi
if test "x$WITH_GTKSPELL" = "xyes"; then
	PKG_CHECK_MODULES([GTKSPELL], [gtkspell-2.0 >= 2.0.9])
fi

# Engines
AC_ARG_ENABLE([engine-irc],
	AC_HELP_STRING([--enable-engine-irc], [Enable IRC protocol support (default yes)]),
	ENABLE_ENGINE_IRC=$enableval,
	ENABLE_ENGINE_IRC=yes
)
if test "x$ENABLE_ENGINE_IRC" != "xno"; then
	AC_PATH_PROG(XBUILD, xbuild, no)
	if test "x$XBUILD" = "xno"; then
		AC_MSG_ERROR([You need to install xbuild for irc support])
	fi

	if test ! -f "$srcdir/lib/SmartIrc4net/SmartIrc4net.csproj"; then
		AC_MSG_ERROR([lib/SmartIrc4net is empty!])
	fi
	SHAMROCK_CHECK_MONO_GAC_ASSEMBLIES([
		System
		Mono.Posix
	])
fi
AM_CONDITIONAL(ENABLE_ENGINE_IRC, test "x$ENABLE_ENGINE_IRC" = "xyes")

AC_ARG_ENABLE([engine-campfire],
	AC_HELP_STRING([--enable-engine-campfire], [Enable Campfire protocol support (default yes)]),
	ENABLE_ENGINE_CAMPFIRE=$enableval,
	ENABLE_ENGINE_CAMPFIRE=yes
)
AM_CONDITIONAL(ENABLE_ENGINE_CAMPFIRE, test "x$ENABLE_ENGINE_CAMPFIRE" = "xyes")

AC_ARG_ENABLE([engine-xmpp],
	AC_HELP_STRING([--enable-engine-xmpp], [Enable XMPP (Jabber) protocol support (default yes)]),
	ENABLE_ENGINE_XMPP=$enableval,
	ENABLE_ENGINE_XMPP=yes
)
if test "x$ENABLE_ENGINE_XMPP" != "xno"; then
	AC_PATH_PROG(XBUILD, xbuild, no)
	if test "x$XBUILD" = "xno"; then
		AC_MSG_ERROR([You need to install xbuild for XMPP support])
	fi

	if test ! -f "$srcdir/lib/agsxmpp/agsxmpp/agsxmpp.csproj"; then
		AC_MSG_ERROR([lib/agsxmpp is empty!])
	fi
	SHAMROCK_CHECK_MONO_GAC_ASSEMBLIES([
		System
		System.Core
		Mono.Posix
		System.Xml
	])
fi
AM_CONDITIONAL(ENABLE_ENGINE_XMPP, test "x$ENABLE_ENGINE_XMPP" = "xyes")

if test ! -f "$srcdir/lib/StarkSoftProxy/StarkSoftProxy.csproj"; then
	AC_MSG_ERROR([lib/StarkSoftProxy is empty!])
fi

AC_ARG_ENABLE([engine-twitter],
	AC_HELP_STRING([--enable-engine-twitter], [Enable Twitter support (default yes)]),
	ENABLE_ENGINE_TWITTER=$enableval,
	ENABLE_ENGINE_TWITTER=yes
)
if test "x$ENABLE_ENGINE_TWITTER" != "xno"; then
	AC_PATH_PROG(XBUILD, xbuild, no)
	if test "x$XBUILD" = "xno"; then
		AC_MSG_ERROR([You need to install xbuild for Twitter support])
	fi

	# compiling Json.NET with the C# compiler of Mono 2.4 will result in
	# a endless loop with eating all memory :/
	AC_MSG_CHECKING([for Mono >= 2.6])
	if $PKG_CONFIG 'mono >= 2.6'; then
		AC_MSG_RESULT(yes)
	else
		AC_MSG_RESULT(no)
		AC_MSG_ERROR([You need Mono 2.6 or later for Twitter support])
	fi

	if test ! -f "$srcdir/lib/Newtonsoft.Json/Src/Newtonsoft.Json/Newtonsoft.Json.csproj"; then
		AC_MSG_ERROR([lib/Newtonsoft.Json is empty!])
	fi
	SHAMROCK_CHECK_MONO_GAC_ASSEMBLIES([
		System
		System.Core
		System.Data
		System.Runtime.Serialization
		System.Web
		System.Xml
		System.Xml.Linq
	])

	if test ! -f "$srcdir/lib/Twitterizer/Twitterizer2/Twitterizer2.csproj"; then
		AC_MSG_ERROR([lib/Twitterizer is empty!])
	fi
	SHAMROCK_CHECK_MONO_GAC_ASSEMBLIES([
		System
		System.Configuration
		System.Core
		System.Data
		System.Drawing
		System.Web
		System.Web.Extensions
		System.Xml
		System.Xml.Linq
	])
fi
AM_CONDITIONAL(ENABLE_ENGINE_TWITTER, test "x$ENABLE_ENGINE_TWITTER" = "xyes")
AC_ARG_WITH([twitter-api-key],
	AC_HELP_STRING([--with-twitter-api-key], [Specify custom Twitter API key]),
	[],
	with_twitter_api_key="60QV2qQx9cS7y1BJDbgAA|2VgD6qQKddsF5HYQ0TrRgs3tFTnCwDONBmRlTmG658"
)
AC_SUBST([twitter_api_key], $with_twitter_api_key)

AC_ARG_ENABLE([engine-jabbr],
	AC_HELP_STRING([--enable-engine-jabbr], [Enable JabbR support (default yes)]),
	ENABLE_ENGINE_JABBR=$enableval,
	ENABLE_ENGINE_JABBR=yes
)
if test "x$ENABLE_ENGINE_JABBR" != "xno"; then
	AC_PATH_PROG(XBUILD, xbuild, no)
	if test "x$XBUILD" = "xno"; then
		AC_MSG_ERROR([You need to install xbuild for JabbR support])
	fi

	# compiling Json.NET with the C# compiler of Mono 2.4 will result in
	# a endless loop with eating all memory :/
	# SignalR.Client requires System.Threading.Tasks which is part of .NET 4.0
	# thus Mono 2.10 with dmcs is required!
	AC_MSG_CHECKING([for Mono >= 2.10])
	if $PKG_CONFIG 'mono >= 2.10'; then
		AC_MSG_RESULT(yes)
	else
		AC_MSG_RESULT(no)
		AC_MSG_ERROR([You need Mono 2.10 or later for JabbR support (or use --disable-engine-jabbr)])
	fi

	AC_MSG_CHECKING([for 4.0 compiler])
	if test "x$CLI_RUNTIME" = "x2.0"; then
		AC_MSG_RESULT(no)
		AC_MSG_ERROR([You need to compile with a 4.0 compiler (dmcs) for JabbR support (or use --disable-engine-jabbr)])
	else
		AC_MSG_RESULT(yes)
	fi

	if test ! -f "$srcdir/lib/Newtonsoft.Json/Src/Newtonsoft.Json/Newtonsoft.Json.csproj"; then
		AC_MSG_ERROR([lib/Newtonsoft.Json is empty!])
	fi
	SHAMROCK_CHECK_MONO_GAC_ASSEMBLIES([
		System
		System.Core
		System.Data
		System.Runtime.Serialization
		System.Web
		System.Xml
		System.Xml.Linq
	])

	if test ! -f "$srcdir/lib/SignalR/src/Microsoft.AspNet.SignalR.Client/Microsoft.AspNet.SignalR.Client.csproj"; then
		AC_MSG_ERROR([lib/SignalR is empty!])
	fi
	SHAMROCK_CHECK_MONO_GAC_ASSEMBLIES([
		System
		System.Core
	])

	if test ! -f "$srcdir/lib/JabbR/JabbR.Client/JabbR.Client.csproj"; then
		AC_MSG_ERROR([lib/JabbR is empty!])
	fi
	SHAMROCK_CHECK_MONO_GAC_ASSEMBLIES([
		System
		System.Core
		System.Data
		System.Data.DataSetExtensions
		System.Xml
		System.Xml.Linq
	])
fi
AM_CONDITIONAL(ENABLE_ENGINE_JABBR, test "x$ENABLE_ENGINE_JABBR" = "xyes")

# MessageBuffer tool
if $PKG_CONFIG 'mono >= 2.6'; then
	MSG_BUFFER_COMPILER_FLAGS+=" -platform:x86"
fi
AC_SUBST(MSG_BUFFER_COMPILER_FLAGS)

# Server
if $PKG_CONFIG 'mono >= 2.6'; then
	SERVER_COMPILER_FLAGS+=" -platform:x86"
fi
AC_SUBST(SERVER_COMPILER_FLAGS)

# Frontends
AC_ARG_ENABLE([frontend-gnome],
	AC_HELP_STRING([--enable-frontend-gnome], [Enable GNOME frontend (default yes)]),
	ENABLE_FRONTEND_GNOME=$enableval,
	ENABLE_FRONTEND_GNOME=yes
)
if test "x$ENABLE_FRONTEND_GNOME" != "xno"; then
	PKG_CHECK_MODULES([GLIB_SHARP_20], [glib-sharp-2.0 >= 2.8])
	PKG_CHECK_MODULES([GTK_SHARP_20], [gtk-sharp-2.0 >= 2.12.39])
	PKG_CHECK_MODULES([GLADE_SHARP_20], [glade-sharp-2.0 >= 2.8])
	
	AC_MSG_CHECKING([for gtk-sharp version >= 2.10])
	if $PKG_CONFIG 'gtk-sharp-2.0 >= 2.10'; then
		AC_MSG_RESULT(yes)
		AC_DEFINE(GTK_SHARP_2_10,1,[System has gtk-sharp 2.10 or better])
		FRONTEND_GNOME_COMPILER_FLAGS+=" -define:GTK_SHARP_2_10"
	else
		AC_MSG_RESULT(no)
	fi
	
	SHAMROCK_CHECK_MONO_GAC_ASSEMBLIES([
		System.Drawing
	])
	
	if test "x$WITH_MESSAGINGMENU" = "xsystem"; then
		FRONTEND_GNOME_COMPILER_FLAGS+=" -define:MESSAGING_MENU_SHARP"
	fi
	if test "x$WITH_MESSAGINGMENU" = "xincluded"; then
		FRONTEND_GNOME_COMPILER_FLAGS+=" -define:MESSAGING_MENU_SHARP"
	fi
	if test "x$WITH_INDICATE" = "xyes"; then
		FRONTEND_GNOME_COMPILER_FLAGS+=" -define:INDICATE_SHARP"
	fi
	if test "x$WITH_NOTIFY" = "xyes"; then
		FRONTEND_GNOME_COMPILER_FLAGS+=" -define:NOTIFY_SHARP"
	fi
	if test "x$WITH_GTKSPELL" = "xyes"; then
		FRONTEND_GNOME_COMPILER_FLAGS+=" -define:GTKSPELL"
	fi
	if $PKG_CONFIG 'mono >= 2.6'; then
		FRONTEND_GNOME_COMPILER_FLAGS+=" -platform:x86"
	fi
	AC_SUBST(FRONTEND_GNOME_COMPILER_FLAGS)
	
	ENABLE_FRONTEND_GNOME_IRC=$ENABLE_ENGINE_IRC;
	ENABLE_FRONTEND_GNOME_TWITTER=$ENABLE_ENGINE_TWITTER;
	ENABLE_FRONTEND_GNOME_XMPP=$ENABLE_ENGINE_XMPP;
fi
AM_CONDITIONAL(ENABLE_FRONTEND_GNOME, test "x$ENABLE_FRONTEND_GNOME" = "xyes")
AM_CONDITIONAL(ENABLE_FRONTEND_GNOME_IRC, test "x$ENABLE_FRONTEND_GNOME_IRC" = "xyes")
AM_CONDITIONAL(ENABLE_FRONTEND_GNOME_TWITTER, test "x$ENABLE_FRONTEND_GNOME_TWITTER" = "xyes")
AM_CONDITIONAL(ENABLE_FRONTEND_GNOME_XMPP, test "x$ENABLE_FRONTEND_GNOME_XMPP" = "xyes")

AC_ARG_ENABLE([frontend-stfl],
	AC_HELP_STRING([--enable-frontend-stfl], [Enable STFL frontend (default yes)]),
	ENABLE_FRONTEND_STFL=$enableval,
	ENABLE_FRONTEND_STFL=yes
)
if test "x$ENABLE_FRONTEND_STFL" != "xno"; then
	PKG_CHECK_MODULES([STFL], [stfl >= 0.21])
fi
AM_CONDITIONAL(ENABLE_STATIC_STFL, false)
AM_CONDITIONAL(ENABLE_FRONTEND_STFL, test "x$ENABLE_FRONTEND_STFL" = "xyes")

AC_ARG_ENABLE([frontend-curses],
	AC_HELP_STRING([--enable-frontend-curses], [Enable Ncurses frontend (default no)]),
	ENABLE_FRONTEND_CURSES=$enableval,
	ENABLE_FRONTEND_CURSES=no
)
if test "x$ENABLE_FRONTEND_CURSES" != "xno"; then
	# TODO: check deps
	AC_MSG_ERROR([Ncurses frontend not supported (yet)])
fi
AM_CONDITIONAL(ENABLE_FRONTEND_CURSES, test "x$ENABLE_FRONTEND_CURSES" = "xyes")

AC_ARG_ENABLE([frontend-swf],
	AC_HELP_STRING([--enable-frontend-swf], [Enable SWF (WinForms) frontend (default no)]),
	ENABLE_FRONTEND_SWF=$enableval,
	ENABLE_FRONTEND_SWF=no
)
if test "x$ENABLE_FRONTEND_SWF" != "xno"; then
	SHAMROCK_CHECK_MONO_GAC_ASSEMBLIES([
		System.Windows.Forms
	])
fi
AM_CONDITIONAL(ENABLE_FRONTEND_SWF, test "x$ENABLE_FRONTEND_SWF" = "xyes")

AC_ARG_ENABLE([frontend-wpf],
	AC_HELP_STRING([--enable-frontend-wpf], [Enable WPF (Windows Presentation Foundation) frontend (default no)]),
	ENABLE_FRONTEND_WPF=$enableval,
	ENABLE_FRONTEND_WPF=no
)
if test "x$ENABLE_FRONTEND_WPF" != "xno"; then
	# TODO: check deps
	AC_MSG_ERROR([WPF frontend not supported (yet)])
fi
AM_CONDITIONAL(ENABLE_FRONTEND_WPF, test "x$ENABLE_FRONTEND_WPF" = "xyes")

AC_ARG_ENABLE([frontend-test],
	AC_HELP_STRING([--enable-frontend-test], [Enable Test frontend (default no)]),
	ENABLE_FRONTEND_TEST=$enableval,
	ENABLE_FRONTEND_TEST=no
)
AM_CONDITIONAL(ENABLE_FRONTEND_TEST, test "x$ENABLE_FRONTEND_TEST" = "xyes")

AC_CONFIG_FILES([
	Makefile
	src/Makefile
	src/AssemblyVersion.cs
	src/smuxi-win32.nsis
	src/Common/Makefile
	src/Common/Defines.cs
	src/Common/smuxi-common.pc
	src/Engine/Makefile
	src/Engine/smuxi-engine.pc
	src/Engine-IRC/Makefile
	src/Engine-IRC/smuxi-engine-irc.pc
	src/Engine-JabbR/Makefile
	src/Engine-JabbR/smuxi-engine-jabbr.pc
	src/Engine-Twitter/Makefile
	src/Engine-XMPP/Makefile
	src/Engine-XMPP/smuxi-engine-xmpp.pc
	src/Engine-Campfire/Makefile
	src/Engine-MessageBuffer/Makefile
	src/Engine-MessageBuffer/smuxi-message-buffer
	src/Server/Makefile
	src/Server/smuxi-server
	src/Frontend/Makefile
	src/Frontend/smuxi-frontend.pc
	src/Frontend-GNOME/Makefile
	src/Frontend-GNOME/smuxi-frontend-gnome
	src/Frontend-GNOME-IRC/Makefile
	src/Frontend-GNOME-Twitter/Makefile
	src/Frontend-GNOME-XMPP/Makefile
	src/Frontend-Curses/Makefile
	src/Frontend-Curses/smuxi-frontend-curses
	src/Frontend-STFL/Makefile
	src/Frontend-STFL/smuxi-frontend-stfl
	src/Frontend-STFL/STFL/Makefile
	src/Frontend-SWF/Makefile
	src/Frontend-SWF/smuxi-frontend-swf
	src/Frontend-Test/Makefile
	src/Frontend-Test/smuxi-frontend-test
	lib/Makefile
	lib/osx/Info.plist
	po/Makefile.in
	po-Engine/Makefile.in
	po-Engine-Campfire/Makefile.in
	po-Engine-IRC/Makefile.in
	po-Engine-JabbR/Makefile.in
	po-Engine-Twitter/Makefile.in
	po-Engine-XMPP/Makefile.in
	po-Engine-MessageBuffer/Makefile.in
	po-Server/Makefile.in
	po-Frontend/Makefile.in
	po-Frontend-GNOME/Makefile.in
	po-Frontend-GNOME-IRC/Makefile.in
	po-Frontend-GNOME-Twitter/Makefile.in
	po-Frontend-GNOME-XMPP/Makefile.in
])

AC_OUTPUT

if test "x$CLI_RUNTIME" = "x"; then
	CLI_RUNTIME=default
fi

AC_MSG_RESULT([
	Configuration summary for $PACKAGE_NAME $VERSION ($DIST_VERSION)
	
	* Installation prefix: $prefix
	* Build profile:       $PROFILE
	* Compiler:            $CSC
	* Target CLI runtime:  $CLI_RUNTIME

	* Engines
	  -------
	  Core:                (sqlite: built-in, db4o: $WITH_DB4O)
	  IRC:                 $ENABLE_ENGINE_IRC
	  XMPP:                $ENABLE_ENGINE_XMPP
	  Twitter:             $ENABLE_ENGINE_TWITTER
	  Campfire:            $ENABLE_ENGINE_CAMPFIRE
	  JabbR:               $ENABLE_ENGINE_JABBR

	* Frontends
	  ---------
	  GNOME:               $ENABLE_FRONTEND_GNOME (IRC: $ENABLE_FRONTEND_GNOME_IRC XMPP: $ENABLE_FRONTEND_GNOME_XMPP Twitter: $ENABLE_FRONTEND_GNOME_TWITTER)
	  + Messaging Menu     (indicate: Ubuntu <= 12.04, messaging-menu: Ubuntu >= 12.04)
	    - indicate:        $WITH_INDICATE
	    - messaging-menu:  $WITH_MESSAGINGMENU
	  + Notifications:     $WITH_NOTIFY
	  + Spell Checking:    $WITH_GTKSPELL
	  + D-Bus:             $WITH_DBUS
	  Ncurses:             $ENABLE_FRONTEND_CURSES
	  STFL:                $ENABLE_FRONTEND_STFL
	  SWF (WinForms):      $ENABLE_FRONTEND_SWF
	  WPF:                 $ENABLE_FRONTEND_WPF
	  Test:                $ENABLE_FRONTEND_TEST
])