1dnl Process this file with autoconf to produce a configure script.
2AC_INIT([lingoteach],[0.3.9],
3	[http://sourceforge.net/tracker/?func=add&group_id=1637])
4AC_PREREQ(2.50)
5dnl AC_CONFIG_SRCDIR([src/ui/gtk/lingoteach.c])
6AC_CANONICAL_SYSTEM
7
8INT_VERSION=Gregor
9AC_SUBST(INT_VERSION)
10
11dnl automake
12AM_CONFIG_HEADER(config.h)
13AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION)
14AM_MAINTAINER_MODE
15
16dnl Checks for programs.
17AC_PROG_CC
18AC_PROG_INSTALL
19AC_PROG_MAKE_SET
20
21AC_DISABLE_STATIC
22AC_PROG_LIBTOOL
23
24dnl Checks for header files.
25AC_HEADER_STDC
26AC_CHECK_HEADERS(intl.h, locale.h)
27
28dnl Checks for typedefs, structures, and compiler characteristics.
29AC_C_CONST
30
31dnl Checks for library functions.
32AC_FUNC_MALLOC
33AC_FUNC_MEMCMP
34AC_CHECK_FUNCS(setlocale strchr strstr strncmp strcmp sprintf strcpy strncpy)
35
36dnl other stuff, which should be checked for
37AC_ISC_POSIX
38
39dnl i18n
40ALL_LINGUAS="de da eo fr hu id pt_BR sv"
41AM_GNU_GETTEXT
42
43dnl xml and liblingoteach stuff
44AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
45if test "$PKG_CONFIG" = "no"; then
46  echo "*** The pkg-config script could not be found. Make sure it is"
47  echo "*** in your path or set the PKG_CONFIG environment variable"
48  echo "*** to the full path to pkg-config."
49  AC_MSG_ERROR([pkg-config could not be found.])
50fi
51PKG_CHECK_MODULES(LING, liblingoteach >= 0.1.0)
52AC_SUBST(LING_CFLAGS)
53AC_SUBST(LING_LIBS)
54
55dnl arguments for gtk2 gui
56GSUBDIRS='gtk'
57AC_ARG_WITH([gtk_gui],AC_HELP_STRING([--without-gtk-gui],
58			[do not build the gtk2 based gui for lingoteach
59			[[default=no]]]))
60if test "$with_gtk_gui" = "no"; then
61    AC_MSG_RESULT([I will not build the GTK2 gui...])
62    GSUBDIRS=''
63else
64    with_gtk_gui=yes
65    AC_MSG_RESULT([I will build the GTK2 gui...])
66    PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.0.1
67                      gobject-2.0 >= 2.0.1
68                      gthread-2.0 >= 2.0.1)
69    PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.0.1)
70    AC_SUBST(GLIB_CFLAGS)
71    AC_SUBST(GLIB_LIBS)
72    AC_SUBST(GTK_CFLAGS)
73    AC_SUBST(GTK_LIBS)
74fi
75AC_SUBST(GSUBDIRS)
76
77dnl arguments for debugging
78AC_ARG_ENABLE([debug],AC_HELP_STRING([--enable-debug],
79			[enable additional debugging messages
80			for lingoteach [[default=no]]]),,
81enable_debug=no)
82if test "$enable_debug" = "yes"; then
83    AC_MSG_RESULT([Enabling additional debugging features...])
84    AC_DEFINE(DEBUG,1,[additional debugging features])
85    DFLAGS="-W -Wall -Wmissing-declarations -Wmissing-prototypes -Wpointer-arith"
86    AC_SUBST(DFLAGS)
87fi
88
89dnl arguments for plugins
90PSUBDIRS='ui'
91AC_ARG_WITH([plugins],AC_HELP_STRING([--with-plugins],
92			[build and install the plugins for lingoteach
93			[[default=no]]]))
94if test "$with_plugins" = "yes"; then
95    AC_MSG_RESULT([I will build the plugins...])
96    PSUBDIRS='ui plugins'
97fi
98
99AM_CONDITIONAL(GTK_PLUGINS,
100	       [test "$with_plugins" = "yes" && test "$with_gtk_gui" = "yes"])
101
102AC_SUBST(PSUBDIRS)
103
104dnl debugging and additional warnings
105
106dnl output
107AC_OUTPUT([Makefile
108	  src/Makefile
109	  src/ui/Makefile
110	  src/ui/gtk/Makefile
111	  src/plugins/Makefile
112	  po/Makefile.in
113	  data/Makefile
114	  doc/Makefile
115	  doc/img/Makefile
116	  intl/Makefile
117	  lingoteach.spec])
118
119echo "
120
121Configuration:
122
123        Source code location:   ${srcdir}
124	Installation prefix :   ${prefix}
125        Compiler	    :   ${CC}
126	Debugging	    :   ${enable_debug}
127	Plugins		    :   ${with_plugins}
128	GTK2 user interface :	${with_gtk_gui}
129"
130