File: configure.ac

package info (click to toggle)
anjuta 2%3A3.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 71,204 kB
  • ctags: 32,060
  • sloc: ansic: 207,358; sh: 54,640; cpp: 11,461; makefile: 3,528; yacc: 2,821; perl: 2,092; lex: 1,546; xml: 904; python: 149; sql: 99; java: 10
file content (1023 lines) | stat: -rw-r--r-- 31,940 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
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
dnl Process this file with autoconf to produce a configure script.

AC_PREREQ(2.65)

m4_define(anjuta_major_version,   3)
m4_define(anjuta_minor_version,  14)
m4_define(anjuta_micro_version,  0)
m4_define(anjuta_version, anjuta_major_version.anjuta_minor_version.anjuta_micro_version)
m4_define(bugzilla_version, anjuta_major_version.anjuta_minor_version.anjuta_micro_version)

AC_INIT([Anjuta],[anjuta_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=anjuta],[anjuta],[http://www.anjuta.org/])

AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_MACRO_DIR([m4])


AC_DEFINE(ANJUTA_MAJOR_VERSION, anjuta_major_version, [Anjuta major version])
AC_SUBST(ANJUTA_MAJOR_VERSION, anjuta_major_version)
AC_DEFINE(ANJUTA_MINOR_VERSION, anjuta_minor_version, [Anjuta minor version])
AC_SUBST(ANJUTA_MINOR_VERSION, anjuta_minor_version)
AC_DEFINE(ANJUTA_MICRO_VERSION, anjuta_micro_version, [Anjuta micro version])
AC_SUBST(ANJUTA_MICRO_VERSION, anjuta_micro_version)
AC_DEFINE(ANJUTA_VERSION, anjuta_version, [Anjuta version])
AC_SUBST(ANJUTA_VERSION)

ANJUTA_VERSION=anjuta_version
AC_SUBST(ANJUTA_VERSION)

BUGZILLA_VERSION=bugzilla_version
AC_SUBST(BUGZILLA_VERSION)

dnl Anjuta core
GLIB_REQUIRED=2.34.0
GTK_REQUIRED=3.10.0
GTHREAD_REQUIRED=2.22.0
GDK_PIXBUF_REQUIRED=2.0.0
GDA4_REQUIRED=4.2.0
GDA5_REQUIRED=5.0.0
LIBXML_REQUIRED=2.4.23
GDL_REQUIRED=3.5.5
LIBWNCK_REQUIRED=2.12

dnl GtkSourceView
GTKSOURCEVIEW_REQUIRED=3.0.0

dnl Terminal
VTE_REQUIRED=0.27.6

dnl Devhelp
LIBDEVHELP_REQUIRED=3.7.4

dnl Glade
GLADEUI_REQUIRED=3.12.0

dnl Introspection
GI_REQUIRED=0.9.5

dnl Subversion plugin
NEON_REQUIRED=0.28.2
SERF_REQUIRED=1.2.0
SVN_MAJOR=1
SVN_MINOR=5
SVN_PATCH=0
SUBVERSION_REQUIRED=$SVN_MAJOR.$SVN_MINOR.$SVN_PATCH

AM_INIT_AUTOMAKE([1.10 dist-xz no-dist-gzip tar-ustar])
AM_MAINTAINER_MODE([enable])

m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

dnl Check for C Compiler
AC_PROG_CC
AC_PROG_CPP
AC_PROG_LEX
if test "$LEX" != "flex"; then
	AC_MSG_ERROR(flex is required)
fi
AC_PROG_YACC
if test "$YACC" != "bison -y"; then
	AC_MSG_ERROR(bison is required)
fi
AC_LANG([C])
AC_LANG([C++])
AC_PROG_CXX
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],,
   AC_MSG_ERROR([C++ Compiler required to compile Anjuta]))
AM_PROG_CC_C_O

GNOME_COMPILE_WARNINGS([maximum])
AM_CFLAGS="$AM_CFLAGS $WARN_CFLAGS"
AM_CXXFLAGS="$AM_CXXFLAGS $WARN_CXXFLAGS"

dnl Enable debugging mode
AC_ARG_ENABLE(debug,
  AS_HELP_STRING([--enable-debug],[Enable debug messages]),
  [if test "x$enableval" = "xyes"; then
      AM_CFLAGS="$AM_CFLAGS -DDEBUG"
  fi]
  AM_CXXFLAGS="$AM_CXXFLAGS -DDEBUG")
AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_CXXFLAGS)

ANJUTA_LDFLAGS="-no-undefined"
ANJUTA_PLUGIN_LDFLAGS="-module -avoid-version -no-undefined"
AC_SUBST(ANJUTA_LDFLAGS)
AC_SUBST(ANJUTA_PLUGIN_LDFLAGS)

dnl GSettings
GLIB_GSETTINGS

dnl Disable deprecated APIs
dnl if test x$MAINT = x; then
dnl 	DEPRECATED_FLAGS="-DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
dnl	AC_SUBST(DEPRECATED_FLAGS)
dnl fi

dnl Check for pkg-config
PKG_PROG_PKG_CONFIG([0.22])

dnl Enable versioned user preferences directory
AC_ARG_WITH(pref-suffix,
  AS_HELP_STRING([--with-pref-suffix=VALUE],[Suffix to add to user preferences dir.]),
  PREF_SUFFIX="$withval")

AC_SUBST(PREF_SUFFIX)
AC_DEFINE_UNQUOTED(PREF_SUFFIX,
      "${PREF_SUFFIX}",
	  [Suffix to add to preferences directory])

# Initialize libtool
LT_PREREQ([2.2])
LT_INIT([disable-static])

dnl ***************************************************************************
dnl Check for GObject-Introspection
dnl ***************************************************************************
m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [GOBJECT_INTROSPECTION_CHECK([0.6.7])],
[AM_CONDITIONAL(HAVE_INTROSPECTION, false)])

dnl ***************************************************************************
dnl Set gjsdir
dnl ***************************************************************************
gjsdir=`pkg-config --variable=jsdir gjs-1.0`
AC_SUBST(gjsdir)

dnl Check base modules

PKG_CHECK_MODULES([ANJUTA],
   [gthread-2.0 >= $GTHREAD_REQUIRED
	glib-2.0 >= $GLIB_REQUIRED
	gio-2.0 >= $GLIB_REQUIRED
	gmodule-2.0 >= $GLIB_REQUIRED
	gtk+-3.0 >= $GTK_REQUIRED
	gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED])

PKG_CHECK_MODULES([XML],
   [libxml-2.0 >= $LIBXML_REQUIRED])

PKG_CHECK_MODULES([GDL],
   [gdl-3.0 >= $GDL_REQUIRED])

PKG_CHECK_MODULES([GDA],
   [libgda-5.0 >= $GDA5_REQUIRED],,
   [PKG_CHECK_MODULES([GDA],
      [libgda-4.0 >= $GDA4_REQUIRED])])

dnl Check for autogen
dnl -----------------
AC_PATH_PROG(AUTOGEN_PATH, autogen,no)
if test x$AUTOGEN_PATH = xno; then
   AC_MSG_WARN([Couldn't find autogen. You will be able to build anjuta without autogen \
                but several things won't work. You can get it from http://autogen.sourceforge.net/])
fi

dnl Check for Terminal
dnl ---------------------

AC_ARG_ENABLE(plugin-terminal,
  AS_HELP_STRING([--disable-plugin-terminal],[Disable terminal plugin support in Anjuta.]),
  [ if test "$enableval" = "no"; then
       user_disabled_terminal=1
    fi ],
  [ user_disabled_terminal=0 ] )

AC_MSG_CHECKING(if terminal plugin is disabled)
if test "$user_disabled_terminal" = 1; then
	AC_MSG_RESULT(yes)
	terminal_enabled="no"
else
	AC_MSG_RESULT(no)
	PKG_CHECK_EXISTS([vte-2.91 >= $VTE_REQUIRED],
		 [vte_2_91_enabled=yes],
		 [vte_2_91_enabled=no])
	if test $vte_2_91_enabled = yes; then
		PKG_CHECK_MODULES(PLUGIN_TERMINAL, [vte-2.91 >= $VTE_REQUIRED],
	    		[terminal_enabled=yes],
			[terminal_enabled=no])
		AC_DEFINE(HAVE_VTE_2_91,1,[libvte 2.91 support])
	else
		PKG_CHECK_MODULES(PLUGIN_TERMINAL, [vte-2.90 >= $VTE_REQUIRED],
	    		[terminal_enabled=yes],
			[terminal_enabled=no])
		AC_DEFINE(HAVE_VTE_2_90,1,[libvte 2.90 support])
	fi
fi

AM_CONDITIONAL(HAVE_PLUGIN_TERMINAL, [test x$terminal_enabled = xyes])

dnl Check for Devhelp
dnl -----------------

AC_ARG_ENABLE(plugin-devhelp,
  AS_HELP_STRING([--disable-plugin-devhelp],[Disable devhelp plugin support in Anjuta.]),
  [ if test "$enableval" = "no"; then
       user_disabled_devhelp=1
    fi ],
  [ user_disabled_devhelp=0 ] )

AC_MSG_CHECKING(if devhelp plugin is disabled)
if test "$user_disabled_devhelp" = 1; then
	AC_MSG_RESULT(yes)
	devhelp_enabled="no"
else
	AC_MSG_RESULT(no)
	PKG_CHECK_MODULES(PLUGIN_DEVHELP,
				[libdevhelp-3.0 >= $LIBDEVHELP_REQUIRED],
				[
				    devhelp_enabled=yes
				], [
				    devhelp_enabled=no
				])
fi

if test "x$devhelp_enabled" = "xyes"; then
	case "$PLUGIN_DEVHELP_LIBS" in
		*webkit2gtk-3.0*)
			AC_DEFINE([HAVE_WEBKIT2], [1], [Defined if devhelp is built against webkitgtk2])
			;;
		*webkit2gtk-4.0*)
			AC_DEFINE([HAVE_WEBKIT2], [1], [Defined if devhelp is built against webkitgtk2])
			;;
		esac
fi
AM_CONDITIONAL(HAVE_PLUGIN_DEVHELP, [test x$devhelp_enabled = xyes])

dnl Check for Glade3
dnl ---------------------

AC_ARG_ENABLE(plugin-glade,
  AS_HELP_STRING([--disable-plugin-glade],[Disable glade plugin support in Anjuta.]),
  [ if test "$enableval" = "no"; then
       user_disabled_glade=1
    fi ],
  [ user_disabled_glade=0 ] )

AC_MSG_CHECKING(if glade plugin is disabled)
if test "$user_disabled_glade" = 1; then
	AC_MSG_RESULT(yes)
	gladeui_found="no"
else
	AC_MSG_RESULT(no)
	gladeui_version=0
	PKG_CHECK_MODULES(PLUGIN_GLADE, gladeui-2.0 >= $GLADEUI_REQUIRED,
	    [
		gladeui_found=yes
	    ], [
		gladeui_found=no
	    ])
fi

AM_CONDITIONAL(HAVE_PLUGIN_GLADE, [test x$gladeui_found = xyes])

dnl Glade catalog
dnl ---------------------

AC_ARG_ENABLE(glade-catalog,
  AS_HELP_STRING([--enable-glade-catalog], [Enable glade catalog. Glade UI libraries must be installed]),
  [ user_enabled_glade_catalog=1 ],
  [ user_enabled_glade_catalog=0 ])

glade_catalog_enabled="no"

AC_MSG_CHECKING(if glade catalog is enabled)
if test "$gladeui_found" = "yes"; then
  if test "$user_enabled_glade_catalog" = 1; then
    AC_MSG_RESULT(yes)
    glade_catalog_enabled="yes"
    GLADE_CATALOG_PATH=`pkg-config --variable=catalogdir gladeui-2.0`
    GLADE_PLUGINS_PATH=`pkg-config --variable=moduledir gladeui-2.0`

    AC_SUBST(GLADE_CATALOG_PATH)
    AC_SUBST(GLADE_PLUGINS_PATH)
  else
    AC_MSG_RESULT(no) 
  fi
else
  AC_MSG_RESULT(no)
fi

AM_CONDITIONAL(ENABLE_GLADE_CATALOG, [test x$glade_catalog_enabled = xyes])

dnl Check for gtksourceview
dnl -------------------------------------------------------------
PKG_CHECK_MODULES(SOURCEVIEW,
		[gtksourceview-3.0 >= $GTKSOURCEVIEW_REQUIRED])


dnl Check for libsqlite3 used in symbol-db benchmarks
dnl -------------------------------------------------------------
PKG_CHECK_MODULES(SQLITE, sqlite3, sqlite3_found=yes, sqlite3_found=no)
AM_CONDITIONAL(HAVE_SQLITE, [test x$sqlite3_found = xyes])


dnl Check for vala
dnl -------------------------------------------------------------

AC_ARG_ENABLE(vala,
	AS_HELP_STRING([--disable-vala],[Disable vala support]),
	[ if test "$enableval" = "no"; then
		user_disabled_vala=1
	  fi ],
	[ user_disabled_vala=0 ])

AC_MSG_CHECKING(if vala support is disabled)
if test "$user_disabled_vala" = 1; then
        AC_MSG_RESULT(yes)
	enable_vala="no"
else
        AC_MSG_RESULT(no)
	AC_MSG_CHECKING(if libvala is available)
	m4_foreach([VERSION], [[0.18], [0.20], [0.22], [0.24], [0.26]],
		[PKG_CHECK_EXISTS([ libvala-VERSION ],
			 [ valaver="-VERSION" ])
			 ])
	if test "x$valaver" != "x"; then
		AC_MSG_RESULT(yes)
		enable_vala="yes"
		LIBVALA="libvala${valaver}"
		PKG_CHECK_MODULES([VALA], ${LIBVALA})
	else
		AC_MSG_RESULT(no)
		enable_vala="no"
		VALA_REQUIRED=0.18.0
	fi
	AC_SUBST(LIBVALA)
fi

if test x$enable_vala = xyes; then
	AC_PATH_PROGS(VALAC, [valac${valaver} valac], valac)
	AC_SUBST(VALAC)
fi

AM_CONDITIONAL(ENABLE_VALA, [test x$enable_vala = xyes])

dnl Check for Python
dnl -------------------------------------------------------------

AM_PATH_PYTHON([],
	[have_python="yes"],
	[have_python="no"])

if test x$have_python = xyes; then
	if test -x $PYTHON-config; then
		PYTHON_CFLAGS=`unset CFLAGS; $PYTHON-config --cflags`
		PYTHON_LIBS=`$PYTHON-config --libs`
		AC_SUBST(PYTHON_CFLAGS)
		AC_SUBST(PYTHON_LIBS)
	elif test -x $PYTHON$PYTHON_VERSION-config; then
		PYTHON_CFLAGS=`$PYTHON$PYTHON_VERSION-config --cflags`
		PYTHON_LIBS=`$PYTHON$PYTHON_VERSION-config --libs`
		AC_SUBST(PYTHON_CFLAGS)
		AC_SUBST(PYTHON_LIBS)		
	else
		have_python="no"
		echo "$PYTHON-config or $PYTHON$PYTHON_VERSION-config not found - disabling python"
	fi
fi

AM_CONDITIONAL(HAVE_PYTHON, [test x$have_python = xyes])

dnl Disable packagekit support
dnl -----------------------------------
AC_ARG_ENABLE(packagekit,
  [AC_HELP_STRING([--disable-packagekit],[build without PackageKit support])],,
  [enable_packagekit=yes])
if test "x$enable_packagekit" != "xno"; then
  AC_DEFINE(ENABLE_PACKAGEKIT, 1, [define to enable PackageKit installer])
fi

dnl Setup Anjuta Library flags
dnl --------------------------
LIBANJUTA_CFLAGS='$(ANJUTA_CFLAGS) $(GDL_CFLAGS) $(DEPRECATED_FLAGS) -I$(top_srcdir) -I$(top_builddir)/libanjuta -DPACKAGE_PIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)"\" -DPACKAGE_LIB_DIR=\""$(pkglibdir)"\" -DPACKAGE_DATA_DIR=\""$(datadir)/$(PACKAGE)"\"'
LIBANJUTA_LIBS='$(top_builddir)/libanjuta/libanjuta-3.la'
AC_SUBST(LIBANJUTA_CFLAGS)
AC_SUBST(LIBANJUTA_LIBS)

dnl Setup FooCanvas Library flags
dnl --------------------------
LIBFOOCANVAS_CFLAGS='-I$(top_srcdir)'
LIBFOOCANVAS_LIBS='$(top_builddir)/libfoocanvas/libanjuta-foocanvas.la'
AC_SUBST(LIBFOOCANVAS_CFLAGS)
AC_SUBST(LIBFOOCANVAS_LIBS)

dnl Checks for Xft/XRender for foocanvas
dnl
AC_CHECK_LIB(Xrender, XRenderFindFormat,
	[AC_SUBST(RENDER_LIBS, "-lXrender -lXext")
	 AC_DEFINE(HAVE_RENDER, 1, [Define if libXrender is available.])],
	[AC_SUBST(RENDER_LIBS, "")],
	[-lXext])

dnl Setup Plugin directories
dnl ------------------------
anjuta_plugin_dir='$(libdir)/anjuta'
anjuta_data_dir='$(datadir)/anjuta'
anjuta_ui_dir='$(datadir)/anjuta/ui'
anjuta_glade_dir='$(datadir)/anjuta/glade'
anjuta_image_dir='$(datadir)/pixmaps/anjuta'
AC_SUBST(anjuta_plugin_dir)
AC_SUBST(anjuta_data_dir)
AC_SUBST(anjuta_ui_dir)
AC_SUBST(anjuta_glade_dir)
AC_SUBST(anjuta_image_dir)

dnl ***************************************************************************
dnl Check for marshal and enum generators
dnl ***************************************************************************
GLIB_GENMARSHAL="`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`"
AC_SUBST(GLIB_GENMARSHAL)
GLIB_MKENUMS="`$PKG_CONFIG --variable=glib_mkenums glib-2.0`"
AC_SUBST(GLIB_MKENUMS)

dnl ***************************************************************************
dnl Internatinalization
dnl ***************************************************************************
IT_PROG_INTLTOOL([0.40.1])

GETTEXT_PACKAGE=anjuta
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])

BISON_I18N

dnl ***************************************************************************
dnl Check for gtk-doc.
dnl ***************************************************************************
GTK_DOC_CHECK([1.4])

dnl ***************************************************************************
dnl User manual
dnl ***************************************************************************
YELP_HELP_INIT

dnl Define convenience macros
dnl -------------------------
dnl CHECK_HEADER_DEFINE(LABEL, HEADER [,ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ] ])
AC_DEFUN([CHECK_HEADER_DEFINE],
[
	AC_MSG_CHECKING("if $1 is defined in $2")
	AC_EGREP_CPP(yes,
[#include <$2>
#ifdef $1
  yes
#endif
], [
	AC_MSG_RESULT(yes)
	$3
], [
	AC_MSG_RESULT(no)
	$4
]) ])

dnl Checks for header files.
AC_CHECK_HEADERS(dirent.h fcntl.h fnmatch.h stat.h stdlib.h string.h stdint.h)
AC_CHECK_HEADERS(time.h types.h unistd.h)
AC_CHECK_HEADERS(sys/dir.h sys/stat.h sys/times.h sys/types.h)

dnl Checks for typedefs, structures, and compiler characteristics.

AC_CANONICAL_HOST
CYGWIN=no
MINGW32=no
case $host_os in
  *cygwin* ) CYGWIN=yes;;
  *mingw32* ) MINGW32=yes;;
esac


dnl Check for bind in libsocket (needed on Solaris)
AC_CHECK_LIB(socket, bind)

dnl Check for function forkpty and related headers
AC_SEARCH_LIBS(forkpty, util, , AC_DEFINE(EMULATE_FORKPTY, [], [Need  to implement our own forkpty()]))
AC_CHECK_HEADERS(libutil.h util.h pty.h)

dnl Checks for library functions.
AC_CHECK_FUNCS(fnmatch)
AC_CHECK_FUNCS(strstr)
AC_CHECK_FUNCS(stricmp)
AC_CHECK_FUNCS(strnicmp)
AC_CHECK_FUNCS(getline)

dnl for libegg/egg-recent-model.c
AC_CHECK_DECLS([lockf])
AC_CHECK_FUNCS([lockf])

AC_CHECK_FUNCS(fgetpos, have_fgetpos=yes)

dnl SEEK_SET should be in stdio.h, but may be in unistd.h on SunOS 4.1.x
if test "$have_fgetpos" != yes ; then
    CHECK_HEADER_DEFINE(SEEK_SET, stdio.h,,
        CHECK_HEADER_DEFINE(SEEK_SET, unistd.h,,
            AC_DEFINE(SEEK_SET, 0, [Seek set 0])))
fi

AC_CHECK_FUNCS(mkstemp, have_mkstemp=yes)
if test "$have_mkstemp" != yes ; then
    AC_CHECK_FUNCS(chmod)
    if test "$tmpdir_specified" = yes ; then
        AC_MSG_RESULT(use of tmpnam overrides temporary directory selection)
    fi
else
    AC_MSG_CHECKING(directory to use for temporary files)
    if test -z "$enable_tmpdir" -o "$enable_tmpdir" = no -o "$enable_tmpdir" = yes ;
        then tmpdir=/tmp
        else tmpdir="$enable_tmpdir"
    fi
    if test -d $tmpdir ; then
        AC_MSG_RESULT($tmpdir)
        AC_DEFINE_UNQUOTED(TMPDIR, "$tmpdir", [Directory for temporary files])
    else
        AC_MSG_WARN($tmpdir does not exist)
    fi
fi

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

if test `uname -s` = "FreeBSD" ; then
        AC_MSG_RESULT(yes)
        FREEBSD_BUILD=-DFREEBSD
        AC_SUBST(FREEBSD_BUILD)
	AC_PATH_PROG(GMAKE, gmake, no)
	if test "x$GMAKE" = "xno"; then
		AC_MSG_ERROR(You need gmake installed to build Anjuta!)
	fi
else
        AC_MSG_RESULT(no)
	GMAKE="make"
fi

AC_SUBST(GMAKE)

dnl Checks for missing prototypes
dnl -----------------------------
AC_MSG_NOTICE([checking for missing prototypes...])

AC_DEFUN([CHECK_PROTO], [AC_EGREP_HEADER([[^A-Za-z0-9_]$1([   ]+[A-Za-z0-9_]*)?\(], $2,, AC_DEFINE(patsubst([NEED_PROTO_NAME], [NAME], translit($1, [a-z], [A-Z])),,[Do not know]) AC_MSG_RESULT(adding prototype for $1))])

if test "$have_remove" = yes ; then
    CHECK_PROTO(remove, stdio.h)
else
    CHECK_PROTO(unlink, unistd.h)
fi
CHECK_PROTO(malloc, stdlib.h)
CHECK_PROTO(getenv, stdlib.h)
CHECK_PROTO(stat,   sys/stat.h)
CHECK_PROTO(lstat,  sys/stat.h)
if test "$have_fgetpos" = yes ; then
    CHECK_PROTO(fgetpos, stdio.h)
fi
if test "$have_truncate" = yes ; then
    CHECK_PROTO(truncate, unistd.h)
fi
if test "$have_ftruncate" = yes ; then
    CHECK_PROTO(ftruncate, unistd.h)
fi

dnl  **********************************************************
dnl  check if we have svn libraries to build subversion plugin
dnl  (stolen from kdevelop ;-)
dnl  **********************************************************

AC_MSG_CHECKING(for Subversion svn-config)
AC_ARG_WITH(subversion-dir,
		AS_HELP_STRING([--with-subversion-dir=DIR],[Where Subversion is installed ]),
		[
				SVNCONFIG="$withval/bin/svn-config"
		])

if test -z "$SVNCONFIG"; then
		_SVNCONFIG="`svn-config --prefix 2> /dev/null`"
		if test -n "$_SVNCONFIG"; then
				SVNCONFIG="$_SVNCONFIG/bin/svn-config"
		fi
fi

AC_SUBST(SVNCONFIG)
if test -x "$SVNCONFIG"; then
		SVNLD="`$SVNCONFIG --ldflags 2> /dev/null`"
		SVN_LIB="`$SVNCONFIG --libs --cflags 2> /dev/null` -lsvn_client-1 -lsvn_subr-1"
		dnl ugly hack for subversion svn-config problems in 0.14.x, to be removed when svn-config is fixed
		SVN_INCLUDE="`$SVNCONFIG --includes 2> /dev/null` -I$_SVNCONFIG/include/subversion-1/"
		AC_MSG_RESULT(yes)
else
		AC_MSG_RESULT(not found)

		dnl just a fallback to debian's config so that it works for me :)
		AC_ARG_WITH(svn-include,
								[[  --with-svn-include=DIR   Use the given path to the subversion headers.]],
								[
								if test "$withval" != "yes" -a "$withval" != ""; then
										SVN_INCLUDES=$withval
								fi
								])
		if test -z "$SVN_INCLUDES"; then
			SVN_INCLUDES="/usr/local/include /usr/include"
		fi
		AC_MSG_CHECKING([for Subversion headers])
		SVN_INCLUDE=""
		for VALUE in $SVN_INCLUDES ; do
				if test -f $VALUE/subversion-1/svn_types.h ; then
						SVN_INCLUDE=$VALUE/subversion-1
						break
				fi
				if test -f $VALUE/svn_types.h ; then
						SVN_INCLUDE=$VALUE
						break
				fi
		done
		if test $SVN_INCLUDE ; then
				AC_MSG_RESULT([found])
		else
				AC_MSG_RESULT([not found])
		fi
		SVN_LIBS="/usr/local/lib64 /usr/local/lib /usr/lib64 /usr/lib"
		AC_ARG_WITH(svn-lib,
						[[  --with-svn-lib=DIR  Use the given path to the subversion libraries.]],
						[
							if test "$withval" != "yes" -a "$withval" != ""; then
								SVN_LIBS=$withval
							fi
						])
		AC_MSG_CHECKING([for Subversion libraries])
		SVN_LIB=""
		for VALUE in $SVN_LIBS ; do
				if ls $VALUE/libsvn_client-1.* 1>/dev/null 2>&1; then
						SVN_LIB=$VALUE
						break
				fi
		done
		if test $SVN_LIB ; then
				AC_MSG_RESULT([found])
		else
				AC_MSG_RESULT([not found])
		fi
fi

dnl ******************************************************************
dnl Check for extra libs required by subversion.
dnl FIXME: This should actually be done by subversion and not by us.
dnl        See http://subversion.tigris.org/issues/show_bug.cgi?id=4435
dnl ******************************************************************

AC_ARG_ENABLE(plugin-subversion,
  AS_HELP_STRING([--disable-plugin-subversion],[Disable subversion support in Anjuta.]),
  [ if test "$enableval" = "no"; then
        user_disabled_subversion=1
    fi ],
  [ user_disabled_subversion=0 ] )

AC_ARG_ENABLE(neon,
	AS_HELP_STRING([--disable-neon],[Disable neon support in Subversion plugin]),
	[ if test "$enableval" = "no"; then
		user_disabled_neon=1
	  fi ],
	[ user_disabled_neon=0 ])

AC_ARG_ENABLE(serf,
	AS_HELP_STRING([--disable-serf],[Disable serf support in Subversion plugin]),
	[ if test "$enableval" = "no"; then
		user_disabled_serf=1
	  fi ],
	[ user_disabled_serf=0 ])

AC_MSG_CHECKING(if subversion support is disabled)
if test "$user_disabled_subversion" = 1; then
	AC_MSG_RESULT(yes)
	SVN_INCLUDE=""
	SVN_LIB=""
else
	AC_MSG_RESULT(no)
fi

if test -n "$SVN_INCLUDE" ; then
	dnl ------------------------------------
	dnl APR. Required by subversion (devel)
	dnl ------------------------------------
	have_atr=no
	PKG_CHECK_MODULES(APR,                            \
		apr-1, have_apr=yes, have_apr=no)
	if test x"$have_apr" = "xno"; then
		SVN_INCLUDE=""
	fi

	dnl -----------------------------------------
	dnl APR util. Required by subversion (devel)
	dnl------------------------------------------
	have_atr_util=no
	PKG_CHECK_MODULES(APR_UTILS,                            \
		apr-util-1, have_apr_util=yes, have_apr_util=no)
	if test x"$have_apr_util" = "xno"; then
		SVN_INCLUDE=""
	fi

	dnl ----------------------------------------------------------
	dnl NEON/SERF. Required by subversion (devel) for HTTP support
	dnl-----------------------------------------------------------
	# Subversion <= 1.7 relies on neon (recommended) or serf.
	# Subversion 1.8 dropped neon support and uses serf to talk
	# to HTTP servers.
	#
	# Subversion can be built without HTTP client support so neon and
	# serf aren't hard requirements. But if present on the system
	# it is reasonable to assume that Subversion is linked to them.
	if test "$user_disabled_neon" = 0; then
		have_neon=no
		PKG_CHECK_MODULES(NEON,                            \
			neon, have_neon=yes, have_neon=no)
	fi
	if test "$user_disabled_serf" = 0; then
		have_serf=no
		PKG_CHECK_MODULES(SERF,                            \
			serf-1, have_serf=yes, have_serf=no)
	fi

	dnl Make sure our SVN version is high enough
	dnl Eww, eww, eww, this is dirty
	AC_MSG_CHECKING([for subversion >= $SUBVERSION_REQUIRED])
	AC_LANG([C])
	dnl Temporarily set CFLAGS so that include dirs are found
	CFLAGS_TMP=$CFLAGS
	CFLAGS="-I$SVN_INCLUDE $APR_CFLAGS"
	AC_COMPILE_IFELSE(
		[AC_LANG_PROGRAM([[#include <svn_version.h>]],
			[[
				#if (SVN_VER_MAJOR < $SVN_MAJOR) || (SVN_VER_MINOR < $SVN_MINOR) || (SVN_VER_PATCH < $SVN_PATCH)
				#	error "Version too low"
				#endif
			]])], AC_MSG_RESULT(yes), have_svn_version=no)
	if test x"$have_svn_version" = "xno"; then
		AC_MSG_RESULT(no)
		SVN_INCLUDE=""
	fi
	CFLAGS=$CFLAGS_TMP
fi

dnl ------------------------------------------
dnl Finally prepare subversion build flags
dnl ------------------------------------------

if test -n "$SVN_INCLUDE" ; then
	SVN_INCLUDE="-I$SVN_INCLUDE"
	if test x != "x$SVN_LIB" ; then
	    SVN_LIB="-L$SVN_LIB $APR_LIBS $APR_UTILS_LIBS $NEON_LIBS $SERF_LIBS -lsvn_client-1 -lsvn_subr-1"
	else
	    SVN_LIB="$APR_LIBS $APR_UTILS_LIBS $NEON_LIBS $SERF_LIBS -lsvn_client-1 -lsvn_subr-1"
	fi
	SVN_CFLAGS="$APR_CFLAGS $APR_UTILS_CFLAGS $NEON_CFLAGS $SERF_CFLAGS"
fi

AM_CONDITIONAL(BUILD_SVN, [test -n "$SVN_INCLUDE"])
AC_SUBST(SVN_INCLUDE)
AC_SUBST(SVN_LIB)
AC_SUBST(SVN_CFLAGS)

dnl ------------------------------------------
dnl Symbol-db shared memory checks
dnl ------------------------------------------

SYMBOL_DB_SHM="/dev/shm"
user_specified_shm=0
AC_MSG_CHECKING(for symbol-db shared memory)
AC_ARG_WITH(symbol-db-shm,
		AS_HELP_STRING([--with-symbol-db-shm=DIR],[Where shared memory is placed ]),
		[
				user_specified_shm=1
				SYMBOL_DB_SHM="$withval"
		])
if test "$user_specified_shm" = 1; then
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
fi

AC_SUBST(SYMBOL_DB_SHM)

dnl On Linux, need librt for shm_open/shm_unlink
bck_LIBS="$LIBS"
AC_SEARCH_LIBS(shm_open, rt, [SHM_LIBS="$LIBS"], [AC_MSG_ERROR([Failed to find library with shm_open()])])
AC_SUBST(SHM_LIBS)
LIBS="$bck_LIBS"

dnl Test using autotest
dnl -----------------------------
AC_CONFIG_TESTDIR(plugins/am-project/tests)
AM_MISSING_PROG([AUTOM4TE], [autom4te])

AC_CONFIG_FILES([
Makefile
po/Makefile.in
libanjuta/Makefile
libanjuta/tests/Makefile
libanjuta/interfaces/Makefile
libanjuta/libanjuta-3.0.pc
libanjuta/anjuta-version.h
src/Makefile
pixmaps/Makefile
pixmaps/hicolor/Makefile
pixmaps/hicolor/16x16/Makefile
pixmaps/hicolor/22x22/Makefile
pixmaps/hicolor/24x24/Makefile
pixmaps/hicolor/32x32/Makefile
pixmaps/hicolor/48x48/Makefile
pixmaps/hicolor/scalable/Makefile
pixmaps/HighContrast/Makefile
pixmaps/HighContrast/16x16/Makefile
pixmaps/HighContrast/22x22/Makefile
pixmaps/HighContrast/24x24/Makefile
pixmaps/HighContrast/32x32/Makefile
pixmaps/HighContrast/48x48/Makefile
pixmaps/HighContrast/256x256/Makefile
data/Makefile
data/welcome.txt
data/templates/Makefile
doc/anjuta.1
doc/anjuta-launcher.1
doc/Makefile
scripts/Makefile
launcher/Makefile
plugins/Makefile
plugins/class-gen/Makefile
plugins/class-gen/templates/Makefile
plugins/patch/Makefile
plugins/document-manager/Makefile
plugins/document-manager/images/Makefile
plugins/message-view/Makefile
plugins/gdb/Makefile
plugins/gdb/images/Makefile
plugins/debug-manager/Makefile
plugins/debug-manager/images/Makefile
plugins/devhelp/Makefile
plugins/devhelp/images/Makefile
plugins/glade/Makefile
plugins/glade/images/Makefile
plugins/js-debugger/Makefile
plugins/file-manager/Makefile
plugins/file-loader/Makefile
plugins/file-wizard/Makefile
plugins/build-basic-autotools/Makefile
plugins/project-manager/Makefile
plugins/symbol-db/benchmark/Makefile
plugins/symbol-db/benchmark/symbol-db/Makefile
plugins/symbol-db/benchmark/libgda/Makefile
plugins/symbol-db/benchmark/sqlite/Makefile
plugins/symbol-db/images/Makefile
plugins/symbol-db/Makefile
plugins/symbol-db/anjuta-tags/Makefile
plugins/project-wizard/Makefile
plugins/snippets-manager/Makefile
plugins/cvs-plugin/Makefile
plugins/subversion/Makefile
plugins/git/Makefile
plugins/git/images/Makefile
plugins/git/tests/Makefile
plugins/sourceview/Makefile
plugins/terminal/Makefile
plugins/tools/Makefile
plugins/tools/scripts/Makefile
plugins/language-manager/Makefile
plugins/project-import/Makefile
plugins/project-wizard/templates/Makefile
plugins/project-wizard/templates/mkfile/Makefile
plugins/project-wizard/templates/mkfile/src/Makefile
plugins/project-wizard/templates/mkfile/po/Makefile
plugins/project-wizard/templates/minimal/Makefile
plugins/project-wizard/templates/js_minimal/Makefile
plugins/project-wizard/templates/js_minimal/src/Makefile
plugins/project-wizard/templates/terminal/Makefile
plugins/project-wizard/templates/terminal/src/Makefile
plugins/project-wizard/templates/terminal/po/Makefile
plugins/project-wizard/templates/cpp/Makefile
plugins/project-wizard/templates/cpp/src/Makefile
plugins/project-wizard/templates/cpp/po/Makefile
plugins/project-wizard/templates/gtk/Makefile
plugins/project-wizard/templates/gtk/src/Makefile
plugins/project-wizard/templates/gtk/po/Makefile
plugins/project-wizard/templates/gtkapplication/Makefile
plugins/project-wizard/templates/gtkapplication/src/Makefile
plugins/project-wizard/templates/gtkapplication/po/Makefile
plugins/project-wizard/templates/anjuta-plugin/Makefile
plugins/project-wizard/templates/anjuta-plugin/src/Makefile
plugins/project-wizard/templates/anjuta-plugin/po/Makefile
plugins/project-wizard/templates/gtkmm/Makefile
plugins/project-wizard/templates/gtkmm/src/Makefile
plugins/project-wizard/templates/gtkmm/po/Makefile
plugins/project-wizard/templates/gcj/Makefile
plugins/project-wizard/templates/gcj/src/Makefile
plugins/project-wizard/templates/java/Makefile
plugins/project-wizard/templates/java/src/Makefile
plugins/project-wizard/templates/java/po/Makefile
plugins/project-wizard/templates/python/Makefile
plugins/project-wizard/templates/python/src/Makefile
plugins/project-wizard/templates/python/po/Makefile
plugins/project-wizard/templates/pygtk/Makefile
plugins/project-wizard/templates/pygtk/src/Makefile
plugins/project-wizard/templates/pygtk/po/Makefile
plugins/project-wizard/templates/vala-gtk/Makefile
plugins/project-wizard/templates/vala-gtk/src/Makefile
plugins/project-wizard/templates/wxwin/Makefile
plugins/project-wizard/templates/wxwin/src/Makefile
plugins/project-wizard/templates/wxwin/po/Makefile
plugins/project-wizard/templates/xlib/Makefile
plugins/project-wizard/templates/xlib/src/Makefile
plugins/project-wizard/templates/xlib/po/Makefile
plugins/project-wizard/templates/xlib-dock/Makefile
plugins/project-wizard/templates/xlib-dock/src/Makefile
plugins/project-wizard/templates/xlib-dock/po/Makefile
plugins/project-wizard/templates/sdl/Makefile
plugins/project-wizard/templates/sdl/src/Makefile
plugins/project-wizard/templates/sdl/po/Makefile
plugins/project-wizard/templates/library/Makefile
plugins/project-wizard/templates/library/src/Makefile
plugins/project-wizard/templates/library/po/Makefile
plugins/project-wizard/templates/directory/Makefile
plugins/project-wizard/templates/m4/Makefile
plugins/project-wizard/templates/gnome-shell-extension/Makefile
plugins/project-wizard/templates/gnome-shell-extension/src/Makefile
plugins/project-wizard/templates/vala-library/Makefile
plugins/project-wizard/templates/vala-library/src/Makefile
plugins/project-wizard/templates/vala-library/po/Makefile
plugins/am-project/Makefile
plugins/am-project/tests/atlocal
plugins/am-project/tests/Makefile
plugins/mk-project/Makefile
plugins/dir-project/Makefile
plugins/language-support-cpp-java/Makefile
plugins/run-program/Makefile
plugins/starter/Makefile
plugins/indentation-c-style/Makefile
plugins/indentation-python-style/Makefile
plugins/language-support-js/Makefile
plugins/language-support-vala/Makefile
plugins/language-support-python/Makefile
plugins/parser-cxx/Makefile
plugins/parser-cxx/cxxparser/Makefile
plugins/python-loader/Makefile
plugins/jhbuild/Makefile
plugins/quick-open/Makefile
anjuta.desktop.in
manuals/Makefile
manuals/reference/Makefile
manuals/reference/libanjuta/Makefile
manuals/reference/libanjuta/version.xml
manuals/anjuta-manual/Makefile
manuals/anjuta-faqs/Makefile
manuals/anjuta-build-tutorial/Makefile
mime/Makefile
])
AC_OUTPUT
echo " "
echo "-------------------------------------------------------------------"
echo "Conditionally built plugins:"
echo "-------------------------------------------------------------------"
if [ test -n "$SVN_INCLUDE" ]; then
        echo "Building subversion plugin: ............................YES"
else
        echo "Building subversion plugin: ............................NO"
		echo "        Requires apr (>= 0.9.4); http://subversion.org"
		echo "        Requires apr-util (>= 0.9.4); http://subversion.org"
		echo "        Requires neon (>= 0.28.2); http://subversion.org"
		echo "        Requires subversion (>= 1.5); http://subversion.org"
fi

if [ test x$gladeui_found = xyes ]; then
       echo "Building glade plugin: .................................YES"
else
       echo "Building glade plugin: .................................NO"
       echo "        Requires glade-3 (>= $GLADEUI_REQUIRED)"
fi

if [ test x$devhelp_enabled = xyes ]; then
       echo "Building devhelp plugin: ...............................YES"
else
       echo "Building devhelp plugin: ...............................NO"
       echo "        Requires libdevhelp-3.0 (>= $LIBDEVHELP_REQUIRED)"
fi

if [ test x$terminal_enabled = xyes ]; then
       echo "Building terminal plugin: ..............................YES"
else
       echo "Building terminal plugin: ..............................NO"
       echo "        Requires vte-2.91 (>= $VTE_REQUIRED)"
fi

if [ test x$enable_vala = xyes ]; then
        echo "Building Vala support: .................................YES"
else
        echo "Building Vala support: .................................NO"
        echo "        Requires libvala (>= $VALA_REQUIRED)"
fi
if [ test x$have_python = xyes]; then
        echo "Building python plugin loaeder: ........................YES"
else
        echo "Building python plugin loaeder: ........................NO"
        echo "        Requires python"
fi
echo "-------------------------------------------------------------------"
echo "AM_CFLAGS = $AM_CFLAGS"
echo "AM_CXXFLAGS = $AM_CXXFLAGS"