~ubuntu-branches/ubuntu/trusty/presage/trusty-proposed

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: Bazaar Package Importer
  • Author(s): Matteo Vescovi
  • Date: 2011-08-06 09:26:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110806092615-0wvhajaht9974ncx
Tags: upstream-0.8.6
ImportĀ upstreamĀ versionĀ 0.8.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl configure.ac for Presage
 
2
 
 
3
dnl Presage, an extensible predictive text entry system
 
4
dnl ---------------------------------------------------
 
5
dnl
 
6
dnl Copyright (C) 2008  Matteo Vescovi <matteo.vescovi\@yahoo.co.uk>
 
7
dnl
 
8
dnl This program is free software; you can redistribute it and/or modify
 
9
dnl it under the terms of the GNU General Public License as published by
 
10
dnl the Free Software Foundation; either version 2 of the License, or
 
11
dnl (at your option) any later version.
 
12
dnl
 
13
dnl This program is distributed in the hope that it will be useful,
 
14
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
dnl GNU General Public License for more details.
 
17
dnl
 
18
dnl You should have received a copy of the GNU General Public License along
 
19
dnl with this program; if not, write to the Free Software Foundation, Inc.,
 
20
dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
21
 
 
22
dnl Process this file with autoconf to produce a configure script.
 
23
 
 
24
 
 
25
AC_INIT([presage],
 
26
        [0.8.6],
 
27
        [matteo.vescovi@yahoo.co.uk])
 
28
AM_INIT_AUTOMAKE([-Wall -Werror])
 
29
 
 
30
AC_CONFIG_SRCDIR([src/lib/presage.cpp])
 
31
AC_CONFIG_HEADERS([config.h:config.hin])
 
32
AC_CONFIG_MACRO_DIR([m4])
 
33
 
 
34
dnl Checks for programs.
 
35
AC_PROG_INSTALL
 
36
AC_PROG_CXX
 
37
AC_PROG_CXXCPP
 
38
AC_PROG_CC
 
39
AC_PROG_CPP
 
40
AM_PROG_CC_C_O
 
41
 
 
42
AC_LANG([C++])
 
43
 
 
44
AM_CONDITIONAL([USE_GCC], [test "x$GCC" = "xyes"])
 
45
 
 
46
dnl ==================
 
47
dnl Checks for libtool
 
48
dnl ==================
 
49
############################
 
50
# Temporarily disabling this
 
51
#AC_LIB_LTDL
 
52
#AC_LIBLTDL_CONVENIENCE
 
53
#AC_SUBST(LTDLINCL)
 
54
#AC_SUBST(LIBLTDL)
 
55
AC_LIBTOOL_WIN32_DLL
 
56
#AC_LIBTOOL_DLOPEN
 
57
AC_PROG_LIBTOOL
 
58
 
 
59
 
 
60
dnl ============================
 
61
dnl Checks for ld version script
 
62
dnl ============================
 
63
AC_MSG_CHECKING([whether linker supports version scripts])
 
64
cat > conftest.map <<EOF
 
65
VERSION_1 {
 
66
global:
 
67
        main;
 
68
local:
 
69
        *;
 
70
};
 
71
 
 
72
VERSION_2 {
 
73
global:
 
74
        main;
 
75
        hello_world;
 
76
} VERSION_1;
 
77
EOF
 
78
 
 
79
save_ldflags="$LDFLAGS"
 
80
LDFLAGS="$LDFLAGS -Wl,--version-script,conftest.map"
 
81
AC_LINK_IFELSE(
 
82
        [AC_LANG_PROGRAM(
 
83
                [[const char hello_world[] = "Hello, World\n";]],
 
84
                [[]])],
 
85
        [have_ld_with_version_script=yes],
 
86
        [have_ld_with_version_script=no]
 
87
)
 
88
LDFLAGS="$save_ldflags"
 
89
 
 
90
if test "x$have_ld_with_version_script" = "xyes"
 
91
then
 
92
        AC_MSG_RESULT([yes])
 
93
else
 
94
        AC_MSG_RESULT([no])
 
95
        AC_MSG_WARN([Linker does not support version scripts.])
 
96
fi
 
97
AM_CONDITIONAL([HAVE_LD_WITH_VERSION_SCRIPT],
 
98
               [test "x$have_ld_with_version_script" = "xyes"])
 
99
 
 
100
 
 
101
dnl Cygwin windows specific flag
 
102
LDFLAGS="-L/usr/local/lib $LDFLAGS"
 
103
 
 
104
dnl ====================
 
105
dnl Checks for libraries
 
106
dnl ====================
 
107
 
 
108
dnl =======================
 
109
dnl Checks for header files
 
110
dnl =======================
 
111
AC_STDC_HEADERS
 
112
AC_HEADER_DIRENT
 
113
AC_CHECK_HEADERS([pwd.h])
 
114
 
 
115
dnl ==================
 
116
dnl Checks for ncurses
 
117
dnl ==================
 
118
AC_CHECK_LIB([curses],
 
119
             [initscr],
 
120
             [have_curses_library=true],
 
121
             [AC_MSG_WARN([curses library not found. curses demo programs will not be built.])])
 
122
AC_CHECK_HEADERS([curses.h],
 
123
                 [have_curses_header=true],
 
124
                 [AC_MSG_WARN([curses header file not found. curses demo programs will not be built.])],
 
125
                 [])
 
126
AM_CONDITIONAL([HAVE_CURSES], [test "x$have_curses_library" = "xtrue" -a "x$have_curses_header" = "xtrue"])
 
127
 
 
128
 
 
129
dnl ==================
 
130
dnl Checks for tinyxml
 
131
dnl ==================
 
132
AC_CHECK_LIB([tinyxml],
 
133
             [main],
 
134
             [have_tinyxml_library=true],
 
135
             [AC_MSG_WARN([tinyxml library not found. Embedded tinyxml library will be built.])])
 
136
AC_CHECK_HEADERS([tinyxml.h],
 
137
                 [have_tinyxml_header=true],
 
138
                 [AC_MSG_WARN([tinyxml library not found. Embedded tinyxml library will be built.])],
 
139
                 [])
 
140
if test "x$have_tinyxml_library" != "xtrue" -o "x$have_tinyxml_header" != "xtrue"
 
141
then
 
142
    build_tinyxml=yes
 
143
else
 
144
    build_tinyxml=no
 
145
    AC_DEFINE([TIXML_USE_STL], [1], [Define to 1 to use STL string in TinyXML])
 
146
fi
 
147
AM_CONDITIONAL([BUILD_TINYXML], [test "x$build_tinyxml" = "xyes"])
 
148
 
 
149
 
 
150
dnl =================
 
151
dnl Checks for SQLite
 
152
dnl =================
 
153
AC_ARG_ENABLE([sqlite],
 
154
        AS_HELP_STRING([--disable-sqlite],[disable use of SQLite (default: enabled)]),
 
155
        [enable_sqlite=$enableval],
 
156
        [enable_sqlite=yes])
 
157
 
 
158
dnl check for libsqlite3
 
159
dnl if (libsqlite3 found) {
 
160
dnl     set SQLITE_LIBS to -lsqlite3
 
161
dnl     check for sqlite3.h
 
162
dnl     if (sqlite3.h found) {
 
163
dnl         using sqlite3
 
164
dnl     } else {
 
165
dnl         error
 
166
dnl     }
 
167
dnl } else {
 
168
dnl     check for libsqlite2
 
169
dnl     if (libsqlite2 found) {
 
170
dnl         set SQLITE_LIBS to -lsqlite
 
171
dnl         check for sqlite2.h
 
172
dnl         if (sqlite2.h found) {
 
173
dnl             using sqlite2
 
174
dnl         } else
 
175
dnl             error
 
176
dnl         }
 
177
dnl     } else {
 
178
dnl         error
 
179
dnl     }
 
180
dnl }
 
181
if test "x$enable_sqlite" = "xyes"
 
182
then
 
183
AC_CHECK_LIB([sqlite3],
 
184
             [sqlite3_open],
 
185
             [SQLITE_LIBS="-lsqlite3" && \
 
186
              AC_CHECK_HEADERS([sqlite3.h],
 
187
                               [have_sqlite=yes && AC_MSG_NOTICE([using sqlite 3])],
 
188
                               [AC_MSG_ERROR([Found sqlite3 library, but cannot find matching sqlite3.h header.])],
 
189
                               [])],
 
190
             [AC_CHECK_LIB([sqlite],
 
191
                           [sqlite_open],
 
192
                           [SQLITE_LIBS="-lsqlite" && \
 
193
                            AC_CHECK_HEADERS([sqlite.h],
 
194
                                             [have_sqlite=yes && AC_MSG_NOTICE([using sqlite 2])],
 
195
                                             [AC_MSG_ERROR([Found sqlite 2 library, but cannot find matching sqlite.h header.])],
 
196
                                             [])],
 
197
                           [SQLITE_LIBS= && \
 
198
                            have_sqlite=no && \
 
199
                            AC_MSG_ERROR([SQLite library not found. SQLite can be obtained from http://sqlite.org.])])])
 
200
AC_SUBST([SQLITE_LIBS], ["$SQLITE_LIBS"])
 
201
fi
 
202
 
 
203
if test "x$enable_sqlite" = "xyes" -a "x$have_sqlite" = "xyes"
 
204
then
 
205
    use_sqlite=yes
 
206
    AC_DEFINE([USE_SQLITE], [1], [Define to 1 if you want to use SQLite])
 
207
else
 
208
    use_sqlite=no
 
209
fi
 
210
AM_CONDITIONAL([USE_SQLITE], [test "x$use_sqlite" = "xyes"])
 
211
 
 
212
 
 
213
dnl ==================
 
214
dnl Checks for CppUnit
 
215
dnl ==================
 
216
AM_PATH_CPPUNIT([1.9.6],
 
217
                [],
 
218
                [AC_MSG_WARN([CppUnit not found. Unit tests will not be built. CppUnit can be obtained from http://cppunit.sourceforge.net.])])
 
219
AM_CONDITIONAL([HAVE_CPPUNIT], [test "$CPPUNIT_LIBS"])
 
220
 
 
221
 
 
222
dnl ============================
 
223
dnl Bindings for other languages
 
224
dnl ==
 
225
 
 
226
dnl ===============
 
227
dnl Checks for SWIG
 
228
dnl ===============
 
229
AC_PATH_PROG([SWIG], [swig])
 
230
if test ! "$SWIG"
 
231
then
 
232
    AC_PATH_PROG([SWIG], [swig2.0])
 
233
fi
 
234
AM_CONDITIONAL([HAVE_SWIG], [test "$SWIG"])
 
235
 
 
236
 
 
237
dnl =================
 
238
dnl Checks for Python
 
239
dnl =================
 
240
AM_PATH_PYTHON([2.0],
 
241
               [],
 
242
               [AC_MSG_WARN([Python not found. Python is required to build presage python binding. Python can be obtained from http://www.python.org])])
 
243
if test "$PYTHON"
 
244
then
 
245
    python_include_path=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_python_inc();"`
 
246
    AC_CHECK_HEADERS([${python_include_path}/Python.h],
 
247
                     [have_python_header=true],
 
248
                     [AC_MSG_WARN([Python.h header file not found. Python development files are required to build presage python binding. Python can be obtained from http://www.python.org])],
 
249
                     [])
 
250
fi
 
251
AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" -a "x$have_python_header" = "xtrue"])
 
252
 
 
253
 
 
254
AC_ARG_ENABLE([python-binding],
 
255
              AS_HELP_STRING([--disable-python-binding],
 
256
                             [build python binding (default=enabled)]),
 
257
              [ac_enable_python_binding=$enableval],
 
258
              [ac_enable_python_binding=yes])
 
259
if test "x$ac_enable_python_binding" = "xyes"
 
260
then
 
261
    if test ! "$SWIG" -o ! "$PYTHON" -o ! "x$have_python_header" = "xtrue"
 
262
    then
 
263
        AC_MSG_WARN([Python binding for presage cannot be built. Ensure that SWIG and Python packages are available.])
 
264
    fi
 
265
else
 
266
    AC_MSG_NOTICE([Python binding for presage will not be built.])
 
267
    AC_MSG_NOTICE([Enable Python binding module building with --enable-python-binding])
 
268
fi
 
269
AM_CONDITIONAL([ENABLE_PYTHON_BINDING], [test "x$ac_enable_python_binding" = "xyes"])
 
270
 
 
271
 
 
272
dnl ========================
 
273
dnl Checks for documentation
 
274
dnl ========================
 
275
AC_ARG_ENABLE([documentation],
 
276
        AS_HELP_STRING([--disable-documentation],[disable documentation generation  (default: enabled)]),
 
277
        [enable_documentation=$enableval],
 
278
        [enable_documentation=yes])
 
279
AM_CONDITIONAL([BUILD_DOCUMENTATION], [test "x$enable_documentation" = "xyes"])
 
280
 
 
281
 
 
282
dnl ==================
 
283
dnl Checks for Doxygen
 
284
dnl ==================
 
285
AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [yes], [no])
 
286
if test "x$HAVE_DOXYGEN" = "xno"
 
287
then
 
288
    AC_MSG_NOTICE([Doxygen not found. API documentation will not be built.])
 
289
fi
 
290
AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$HAVE_DOXYGEN" = "xyes"])
 
291
if test "x$enable_documentation" = "xyes" -a "x$HAVE_DOXYGEN" = "xyes"
 
292
then
 
293
    build_documentation=yes
 
294
else
 
295
    build_documentation=no
 
296
fi
 
297
 
 
298
dnl ==============
 
299
dnl Checks for dot
 
300
dnl ==============
 
301
AC_CHECK_PROG([HAVE_DOT], [dot], [yes], [no])
 
302
if test "x$HAVE_DOT" = "xno"
 
303
then
 
304
    AC_MSG_NOTICE([dot not found. Documentation graphs and diagrams will not be generated.])
 
305
fi
 
306
AC_SUBST([HAVE_DOT], ["$HAVE_DOT"])
 
307
if test "x$enable_documentation" = "xyes" -a "x$HAVE_DOXYGEN" = "xyes" -a "x$HAVE_DOT" = "xyes"
 
308
then
 
309
    build_documentation_diagrams=yes
 
310
else
 
311
    build_documentation_diagrams=no
 
312
fi
 
313
 
 
314
 
 
315
dnl ===================
 
316
dnl Checks for help2man
 
317
dnl ===================
 
318
AC_CHECK_PROG([HAVE_HELP2MAN], [help2man], [yes], [no])
 
319
if test "x$HAVE_HELP2MAN" = "xno"
 
320
then
 
321
    AC_MSG_NOTICE([help2man not found. Man documentation pages will not be built.])
 
322
fi
 
323
AM_CONDITIONAL([HAVE_HELP2MAN], [test "x$HAVE_HELP2MAN" = "xyes"])
 
324
 
 
325
 
 
326
dnl ====================
 
327
dnl Checks for GTK tools
 
328
dnl ====================
 
329
AC_ARG_ENABLE([gpresagemate],
 
330
        AS_HELP_STRING([--disable-gpresagemate],[build gpresagemate (default: enabled)]),
 
331
        [enable_gpresagemate=$enableval],
 
332
        [enable_gpresagemate=yes])
 
333
 
 
334
AC_ARG_ENABLE([gprompter],
 
335
        AS_HELP_STRING([--disable-gprompter],[build gprompter (default: enabled)]),
 
336
        [enable_gprompter=$enableval],
 
337
        [enable_gprompter=yes])
 
338
 
 
339
if test "x$enable_gpresagemate" = "xyes"
 
340
then
 
341
        AC_CHECK_HEADERS([X11/Xlib.h X11/Xproto.h X11/X.h X11/Xutil.h X11/keysymdef.h pthread.h],
 
342
                         [have_x11_headers=yes],
 
343
                         [have_x11_headers=no],
 
344
                         [])
 
345
        AC_CHECK_HEADERS([X11/extensions/Xevie.h],
 
346
                         [have_x11_extension_xevie=yes],
 
347
                         [have_x11_extension_xevie=no],
 
348
                         [[#if HAVE_X11_XLIB_H
 
349
                           # include <X11/Xlib.h>
 
350
                           #endif]])
 
351
fi
 
352
 
 
353
if test "x$enable_gpresagemate" = "xyes" -o "x$enable_gprompter" = "xyes"
 
354
then
 
355
        PKG_CHECK_MODULES([GNOME],
 
356
                          [gtk+-2.0],
 
357
                          [have_gtk=yes],
 
358
                          [have_gtk=no])
 
359
        AC_SUBST([GNOME_CFLAGS])
 
360
        AC_SUBST([GNOME_LIBS])
 
361
        PKG_CHECK_MODULES([GTHREAD],
 
362
                          [gthread-2.0],
 
363
                          [have_gthread=yes],
 
364
                          [have_gthread=no])
 
365
        AC_SUBST([GTHREAD_CFLAGS])
 
366
        AC_SUBST([GTHREAD_LIBS])
 
367
fi
 
368
 
 
369
if test "x$enable_gpresagemate" = "xyes" -a \
 
370
        "x$have_x11_headers" = "xyes" -a \
 
371
        "x$have_x11_extension_xevie" = "xyes" -a \
 
372
        "x$have_gtk" = "xyes" -a \
 
373
        "x$have_gthread" = "xyes"
 
374
then
 
375
        build_gtk_presage_mate=yes
 
376
else
 
377
        build_gtk_presage_mate=no
 
378
fi
 
379
AM_CONDITIONAL([BUILD_GTK_PRESAGE_MATE], [test "x$build_gtk_presage_mate" = "xyes"])
 
380
 
 
381
if test "x$enable_gprompter" = "xyes" -a \
 
382
        "x$have_gtk" = "xyes" -a \
 
383
        "x$have_gthread" = "xyes"
 
384
then
 
385
        build_gtk_prompter=yes
 
386
else
 
387
        build_gtk_prompter=no
 
388
fi
 
389
AM_CONDITIONAL([BUILD_GTK_PROMPTER], [test "x$build_gtk_prompter" = "xyes"])
 
390
 
 
391
dnl ===================================================
 
392
dnl Checks for CMU-Statistical Language Modelling tools
 
393
dnl ===================================================
 
394
AC_PATH_PROG([TEXT2WFREQ], [text2wfreq])
 
395
AC_PATH_PROG([TEXT2IDNGRAM], [text2idngram])
 
396
AC_PATH_PROG([WFREQ2VOCAB], [wfreq2vocab])
 
397
AC_PATH_PROG([IDNGRAM2LM], [idngram2lm])
 
398
if test "$TEXT2WFREQ" -a \
 
399
        "$WFREQ2VOCAB" -a \
 
400
        "$IDNGRAM2LM" -a \
 
401
        "$TEXT2IDNGRAM" 
 
402
then
 
403
    build_arpa_ngram_resources=yes
 
404
else
 
405
    build_arpa_ngram_resources=no
 
406
    AC_MSG_NOTICE([CMU-Cambridge SLM tools not found. ARPA ngram language model will not be built.])
 
407
fi
 
408
AM_CONDITIONAL([BUILD_ARPA_NGRAM], [test "x$build_arpa_ngram_resources" = "xyes"])
 
409
 
 
410
 
 
411
############################
 
412
# Temporarily disabling this
 
413
#AC_CONFIG_SUBDIRS(src/plump)
 
414
 
 
415
 
 
416
dnl ======================
 
417
dnl Checks for dbus python
 
418
dnl ======================
 
419
PKG_CHECK_EXISTS([dbus-python], [have_dbus_python=yes], [have_dbus_python=no])
 
420
AM_CONDITIONAL([HAVE_DBUS_PYTHON], [test "x$have_dbus_python" = "xyes"])
 
421
 
 
422
 
 
423
AC_OUTPUT([
 
424
        Makefile
 
425
        src/Makefile
 
426
        src/lib/Makefile
 
427
        src/lib/core/Makefile
 
428
        src/lib/core/tokenizer/Makefile
 
429
        src/lib/core/context_tracker/Makefile
 
430
        src/lib/simulator/Makefile
 
431
        src/lib/tinyxml/Makefile
 
432
        src/lib/predictors/Makefile
 
433
        src/lib/predictors/dbconnector/Makefile
 
434
        src/tools/Makefile
 
435
        test/Makefile
 
436
        test/lib/Makefile
 
437
        test/lib/common/Makefile
 
438
        test/lib/core/Makefile
 
439
        test/lib/core/tokenizer/Makefile
 
440
        test/lib/core/context_tracker/Makefile
 
441
        test/lib/predictors/Makefile
 
442
        test/lib/predictors/dbconnector/Makefile
 
443
        test/lib/simulator/Makefile
 
444
        test/tools/Makefile
 
445
        test/integration/Makefile
 
446
        resources/Makefile
 
447
        resources/arpa/Makefile
 
448
        resources/profiles/Makefile
 
449
        bindings/Makefile
 
450
        bindings/c/Makefile
 
451
        bindings/python/setup.py
 
452
        bindings/python/Makefile
 
453
        apps/Makefile
 
454
        apps/gtk/Makefile
 
455
        apps/gtk/gpresagemate/Makefile
 
456
        apps/gtk/gprompter/Makefile
 
457
        apps/python/Makefile
 
458
        apps/python/pyprompter
 
459
        apps/python/pypresagemate
 
460
        apps/python/setup.py
 
461
        apps/dbus/Makefile
 
462
        apps/dbus/presage_dbus_python_demo
 
463
        doc/Doxyfile
 
464
        doc/Makefile
 
465
        setup.py
 
466
        bindings/python/presage_python_demo
 
467
])
 
468
 
 
469
if test "x$have_curses_library" = "xtrue" -a "x$have_curses_header" = "xtrue"
 
470
then
 
471
    build_demo_application="yes"
 
472
else
 
473
    build_demo_application="no"
 
474
fi
 
475
if test "$CPPUNIT_LIBS"
 
476
then
 
477
    build_unit_tests="yes"
 
478
else
 
479
    build_unit_tests="no"
 
480
fi
 
481
if test "$SWIG" -a "$PYTHON" -a "x$have_python_header" = "xtrue" -a "x$ac_enable_python_binding" = "xyes"
 
482
then
 
483
    build_python_binding="yes"
 
484
else
 
485
    build_python_binding="no"
 
486
fi
 
487
AC_MSG_RESULT([
 
488
  $PACKAGE $VERSION configured successfully.
 
489
 
 
490
  General configuration:
 
491
 
 
492
    Compiler: ................... ${CXX}
 
493
    Curses demo application: .... ${build_demo_application}
 
494
    Unit tests: ................. ${build_unit_tests}
 
495
    Python binding: ............. ${build_python_binding}
 
496
    Man pages: .................. ${HAVE_HELP2MAN}
 
497
    API documentation: .......... ${build_documentation}
 
498
    API documentation diagrams: . ${build_documentation_diagrams}
 
499
 
 
500
 
 
501
  Predictors:
 
502
 
 
503
    Smoothed n-gram: ............ ${use_sqlite}
 
504
    Recency promotion: .......... yes
 
505
    Abbreviation expansion: ..... yes
 
506
    Smoothed count: ............. ${use_sqlite}
 
507
    Dictionary: ................. yes
 
508
    Deja-vu: .................... yes
 
509
    ARPA: ....................... yes
 
510
 
 
511
 
 
512
  Additional applications:
 
513
 
 
514
    wxPython prompter: .......... ${build_python_binding}
 
515
    GTK+ presage mate: .......... ${build_gtk_presage_mate}
 
516
    GTK+ prompter: .............. ${build_gtk_prompter}
 
517
    D-BUS presage service: ...... ${have_dbus_python}
 
518
 
 
519
 
 
520
  Additional resources:
 
521
    ARPA format ngram: .......... ${build_arpa_ngram_resources}
 
522
 
 
523
 
 
524
  Building:
 
525
 
 
526
    Type `make' to build $PACKAGE.
 
527
    Type `make check' to test $PACKAGE.
 
528
    Type `make install' to install $PACKAGE.
 
529
])