source: trunk/third/aspell/configure.ac @ 20167

Revision 20167, 8.9 KB checked in by ghudson, 21 years ago (diff)
Merge with aspell 0.50.5.
Line 
1
2AC_INIT
3AM_CONFIG_HEADER(common/settings.h)
4AM_INIT_AUTOMAKE(aspell, 0.50.5)
5
6AM_MAINTAINER_MODE
7
8AC_ARG_ENABLE(docdir,
9[  --enable-docdir=DIR      documentation files in DIR [PREFIX/doc/aspell] ],
10pkgdocdir=$enable_docdir, pkgdocdir=\${prefix}/share/doc/aspell )
11AC_SUBST(pkgdocdir)
12
13dnl pkgdatadir
14
15pkgdatadir=undef
16AC_ARG_ENABLE(pkgdatadir,
17[  --enable-pkgdatadir=DIR   device dependent data files [DATADIR/aspell] ],
18pkgdatadir=$enable_pkgdatadir)
19
20AC_ARG_ENABLE(pkgdata-dir,
21[  --enable-data-dir=DIR    alias for pkgdatadir ],
22pkgdatadir=$enable_dict_dir)
23
24if test "$pkgdatadir" = "undef"
25then
26  pkgdatadir=\${datadir}/aspell
27fi
28
29AC_SUBST(pkgdatadir)
30
31dnl pkglibdir
32
33pkglibdir=undef
34AC_ARG_ENABLE(pkglibdir,
35[  --enable-pkglibdir=DIR   device dependent data files [LIBDIR/aspell] ],
36pkglibdir=$enable_pkglibdir)
37
38AC_ARG_ENABLE(dict-dir,
39[  --enable-dict-dir=DIR    alias for pkglibdir ],
40pkglibdir=$enable_dict_dir)
41
42if test "$pkglibdir" = "undef"
43then
44  pkglibdir=\${libdir}/aspell
45fi
46
47AC_SUBST(pkglibdir)
48
49dnl optional features
50
51AC_ARG_ENABLE(win32-relocatable,
52[  --enable-win32-relocatable])
53
54AC_ARG_ENABLE(curses,           
55[  --enable-curses=LIBFILE])
56
57AC_ARG_ENABLE(curses-include,           
58[  --enable-curses-include=DIR])
59
60AC_PROG_CXX
61AC_LANG([C++])
62
63AC_DISABLE_STATIC
64AC_PROG_LIBTOOL
65
66
67# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
68#                                                                 #
69#                     Platform Specific Tests                     #
70#                                                                 #
71# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
72
73if test "$enable_win32_relocatable" = "yes"
74then
75  AC_DEFINE(ENABLE_WIN32_RELOCATABLE, 1, [Defined if win32 relocation should be used])
76fi
77
78# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
79#                                                                 #
80#                           Posix tests                           #
81#                                                                 #
82# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
83
84AC_MSG_CHECKING(if file locking and truncating is supported)
85AC_TRY_LINK(
86  [#include <fcntl.h>
87   #include <unistd.h>],
88  [int fd;     
89   struct flock fl;
90   fcntl(fd, F_SETLKW, &fl);
91   ftruncate(fd,0);],
92  [AC_MSG_RESULT(yes)
93   AC_DEFINE(USE_FILE_LOCKS, 1,
94             [Defined if file locking and truncating is supported])
95  ],
96  [AC_MSG_RESULT(no)] )
97
98AC_MSG_CHECKING(if mmap and friends is supported)
99AC_TRY_LINK(
100  [#include <fcntl.h>
101   #include <unistd.h>
102   #include <sys/mman.h>],
103  [char * p = (char *)mmap(NULL, 10, PROT_READ, MAP_SHARED, -1, 2);
104   munmap(p,10);],
105  [AC_MSG_RESULT(yes)
106   AC_DEFINE(HAVE_MMAP, 1, [Defined if mmap and friends is supported])],
107  [AC_MSG_RESULT(no)] )
108
109AC_MSG_CHECKING(if file ino is supported)
110touch conftest-f1
111touch conftest-f2
112AC_TRY_RUN(
113  [#include <sys/stat.h>
114   int main() {
115     struct stat s1,s2;
116     if (stat("conftest-f1",&s1) != 0) exit(2);
117     if (stat("conftest-f2",&s2) != 0) exit(2);
118     exit (s1.st_ino != s2.st_ino ? 0 : 1);
119   }
120  ],
121  [AC_MSG_RESULT(yes)
122   AC_DEFINE(USE_FILE_INO, 1, [Defined if file ino is supported])
123  ],
124  [AC_MSG_RESULT(no)],
125  [if test "$MINGW32" = yes
126   then
127     AC_MSG_RESULT(cant run test!, assuming no)
128   else
129     AC_MSG_RESULT(cant run test!, assuming yes)
130     AC_DEFINE(USE_FILE_INO, 1, [Defined if file ino is supported])
131   fi
132  ] )
133
134AC_MSG_CHECKING(if posix locals are supported)
135AC_TRY_COMPILE(
136  [#include <locale.h>],
137  [setlocale (LC_ALL, NULL);
138   setlocale (LC_MESSAGES, NULL);],
139  [AC_MSG_RESULT(yes)
140   AC_DEFINE(USE_LOCALE, 1, [Defined if Posix locales are supported])],
141  [AC_MSG_RESULT(no)] )
142
143# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
144#                                                                 #
145#                     Terminal function tests                     #
146#                                                                 #
147# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
148
149AC_SUBST(CURSES_LIB)
150AC_SUBST(CURSES_INCLUDE)
151
152if test "$enable_curses" != "no"
153then
154  use_curses=t
155  case "$enable_curses" in
156    yes | ""                     )                             ;;
157    /* | *lib* | *.a | -l* | -L* ) CURSES_LIB="$enable_curses" ;;
158    *                            ) CURSES_LIB=-l$enable_curses ;;
159  esac
160  case "$enable_curses_include" in
161    yes | no | "")                                         ;;
162    -I*          ) CURSES_INCLUDE="$enable_curses_include" ;;
163    *            ) CURSES_INCLUDE=-I$enable_curses_include ;;
164  esac
165fi
166
167if test "$use_curses"
168then
169 
170  if test -z "$CURSES_LIB"
171  then
172
173    AC_CHECK_LIB(curses, initscr,
174      [CURSES_LIB=-lcurses],
175      [
176
177    dnl else if
178    AC_CHECK_LIB(ncurses, initscr,
179      [CURSES_LIB=-lncurses])
180    ] )
181   
182  fi
183
184  if test -n "$CURSES_LIB"
185  then
186     AC_MSG_CHECKING(if standard curses include sequence will work)
187     ORIG_LIBS="$LIBS"
188     ORIG_CPPFLAGS="$CPPFLAGS"
189     CPPFLAGS="$CURSES_INCLUDE $CPPFLAGS"
190     LIBS="$CURSES_LIB $LIBS"
191     AC_TRY_LINK(
192       [#include <termios.h>
193        #include <unistd.h>
194        #include <curses.h>
195        #include <term.h>],
196       [tigetstr(const_cast<char *>("cup"));],
197       [AC_MSG_RESULT(yes)
198        AC_DEFINE(HAVE_LIBCURSES, 1,
199                  [Defined if the curses library is available])
200        posix_termios=t
201        AC_DEFINE(CURSES_INCLUDE_STANDARD, 1,
202                  [Defined if no special Workarounds are needed for Curses headers])],
203       [AC_MSG_RESULT(no)
204
205     dnl else if
206     AC_MSG_CHECKING(if curses workaround I will work)
207     AC_TRY_LINK(
208       [#include <termios.h>
209        #include <unistd.h>
210        #include <curses.h>
211        extern "C" {char * tigetstr(char * capname);}],
212       [tigetstr(const_cast<char *>("cup"));],
213       [AC_MSG_RESULT(yes)
214        AC_DEFINE(HAVE_LIBCURSES, 1, [])
215        posix_termios=t
216        AC_DEFINE(CURSES_INCLUDE_WORKAROUND_1, 1,
217                  [Defined if special Wordaround I is need for Curses headers])],
218       [AC_MSG_RESULT(no)
219
220     dnl else if
221     AC_MSG_CHECKING(if curses without Unix stuff will work)
222     AC_TRY_LINK(
223       [#include <curses.h>],
224       [initscr();],
225       [AC_MSG_RESULT(yes)
226        AC_DEFINE(HAVE_LIBCURSES, 1, [])
227        AC_DEFINE(CURSES_ONLY, 1,
228                  [Defined if curses like POSIX Functions should be used])
229        curses_only=t],
230       [AC_MSG_RESULT(no)
231       
232
233     dnl else if
234     use_curses=false
235     CURSES_LIBS=""
236     CURSES_INCLUDE=""
237
238     ]) ]) ])
239
240     CPPFLAGS="$ORIG_CPPFLAGS"
241     LIBS="$ORIG_LIBS"
242  fi
243fi
244
245if test -z "$posix_termios" -a -z "$curses_only"
246then
247  AC_MSG_CHECKING(if posix termios is supported)
248  AC_TRY_LINK(
249    [#include <termios.h>
250     #include <unistd.h>
251     #include <stdlib.h>],
252    [isatty (STDIN_FILENO);
253     atexit(0);
254     termios attrib;
255     tcgetattr (STDIN_FILENO, &attrib);
256     tcsetattr (STDIN_FILENO, TCSAFLUSH, &attrib);],
257    [AC_MSG_RESULT(yes)
258     posix_termios=t],
259    [AC_MSG_RESULT(no)]
260  )
261fi
262
263if test -z "$posix_termios" -a -z "$use_curses"
264then
265  dnl else if
266  AC_MSG_CHECKING(if getch supported)
267  AC_TRY_LINK(
268    [extern "C" {int getch();}],
269    [char c = getch();],
270    [AC_MSG_RESULT(yes)
271     AC_DEFINE(HAVE_GETCH, 1, [Defined if msdos getch is supported])
272    ],
273    [AC_MSG_RESULT(no)]
274  )
275fi
276
277if test "$posix_termios"
278then
279  AC_DEFINE(POSIX_TERMIOS, 1, [Defined if Posix Termios is Supported])
280fi
281
282# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
283#                                                                 #
284#                    Compiler Quirks Tests                        #
285#                                                                 #
286# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
287
288AC_MSG_CHECKING(for STL rel_ops pollution)
289AC_TRY_COMPILE(
290  [#include <utility>
291
292   template <typename T>
293   class C {};
294
295   template <typename T>
296   bool operator== (C<T>, C<T>) {return true;}
297
298   template <typename T>
299   bool operator!= (C<T>, C<T>) {return false;}],
300  [C<int> c1, c2;
301   bool v = c1 != c2;],
302  [AC_MSG_RESULT(no)],
303  [AC_MSG_RESULT(yes)
304   AC_DEFINE(REL_OPS_POLLUTION, 1,
305             [Defined if STL rel_ops polute the global namespace])
306  ]
307)
308
309# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
310#                                                                 #
311#                           Output                                #
312#                                                                 #
313# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
314
315AC_CONFIG_FILES([Makefile common/Makefile lib/Makefile data/Makefile
316                 auto/Makefile modules/Makefile
317                 modules/filter/Makefile modules/tokenizer/Makefile
318                 modules/speller/Makefile modules/speller/default/Makefile
319                 interfaces/Makefile interfaces/cc/Makefile scripts/Makefile
320                 examples/Makefile prog/Makefile manual/Makefile
321                 manual/man-html/Makefile manual/man-text/Makefile
322                 manual/dev-html/Makefile manual/dev-text/Makefile
323                 ])
324AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.