2 dnl Makefile for the GNOKII tool suite.
4 dnl Copyright (C) 1999 Hugh Blemings & Pavel Janík ml.
5 dnl 2000 Karel Zak, Pawe³ Kot
10 AC_INIT(gnokii/gnokii.c)
12 AC_CONFIG_AUX_DIR(config)
15 AC_PREFIX_DEFAULT("/usr/local")
17 dnl ======================== Default setting
19 ALL_LINGUAS="cs de et fi nl sk pl it sl"
21 dnl ======================== Checks for programs.
25 AC_PATH_PROG(RM, rm, no)
26 AC_PATH_PROG(FIND, find, no)
27 AC_CHECK_PROGS(MAKE, gmake make)
30 dnl Let us have $prefix variable aviable here
31 test x"$prefix" = xNONE && prefix="$ac_default_prefix"
34 [ --enable-debug compile with debug code],
35 [ if test "x$GCC" = "xyes"; then
44 [ --enable-xdebug compile with xdebug code],
50 AC_ARG_ENABLE(rlpdebug,
51 [ --enable-rlpdebug compile with RLP debug code],
52 [ AC_DEFINE(RLP_DEBUG)
57 dnl ======================== NLS support
64 [ --with-libintl=DIR specifies the base NLS],
65 [ if test "x$withval" = "xyes"; then
66 AC_MSG_WARN(Usage is --with-libintl=DIR)
68 NLS_LIBS="-L$withval/lib"
69 NLS_CFLAGS="-I$withval/include"
75 [ --disable-nls do not use NLS],
76 [ USE_NLS=$enableval ],
80 if test "$USE_NLS" = "yes"; then
82 AC_CHECK_HEADERS(locale.h)
83 AC_CHECK_FUNCS(setlocale)
84 AC_SUBST(HAVE_LOCALE_H)
86 CPPFLAGS="$CPPFLAGS $NLS_CFLAGS"
87 AC_TRY_CPP([#include <libintl.h>],
88 [ AC_DEFINE(HAVE_LIBINTL_H)
89 AC_MSG_RESULT([checking for libintl.h... yes]) ],
90 [ AC_MSG_WARN(not found header file: libintl.h !!!)
95 if test "$USE_NLS" = "yes"; then
96 AC_CHECK_FUNC(gettext,
97 AC_DEFINE(HAVE_LIBINTL),
98 AC_CHECK_LIB(intl, gettext,
99 [ NLS_LIBS="$NLS_LIBS -lintl"
100 AC_DEFINE(HAVE_LIBINTL) ],
101 [ AC_MSG_WARN(not found library: intl !!!)
108 if test "$USE_NLS" = "yes"; then
110 AC_SUBST(HAVE_LIBINTL_H)
111 AC_SUBST(HAVE_LIBINTL)
114 LOCALEDIR='${prefix}/share/locale'
115 AC_ARG_WITH(locale-dir,
116 [ --with-locale-dir=DIR Location of the locale file(s)
117 [PREFIX/share/locale]],
118 [ if test x$withval = xyes; then
119 AC_MSG_WARN(Usage is: --with-locale-dir=basedir)
121 if test x$withval = xno; then
122 AC_MSG_WARN(Usage is: --with-locale-dir=basedir)
131 AC_PATH_PROG(MSGFMT, msgfmt, $MSGFMT)
132 if test -n "$MSGFMT"; then
133 AC_CHECK_FUNCS(dcgettext)
134 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
135 AC_PATH_PROG(XGETTEXT, xgettext, $XGETTEXT)
136 AC_PATH_PROG(MSGMERGE, msgmerge, $MSGMERGE)
138 dnl Test whether we really found GNU xgettext.
139 if test -n "$XGETTEXT"; then
140 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
143 AC_MSG_RESULT([found xgettext program is not GNU xgettext; ignore it])
148 dnl We add another test for comparing GNU xgettext with openwin xgettext
149 if test -n "$XGETTEXT"; then
150 if $XGETTEXT --help > /dev/null 2> /dev/null; then
153 AC_MSG_RESULT([found xgettext program is not GNU xgettext; ignore it])
158 dnl Test whether we really found GNU msgfmt.
159 if test -n "$MSGFMT"; then
160 if $MSGFMT < /dev/null 2> /dev/null; then
161 AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; NLS will not be installed])
167 [ extern int _nl_msg_cat_cntr;
168 return _nl_msg_cat_cntr],
177 if test -n "$ALL_LINGUAS"; then
178 for lang in $ALL_LINGUAS; do
179 CATALOGS="$CATALOGS $lang$CATOBJEXT"
185 AC_SUBST(DATADIRNAME)
188 dnl don't use NLS, when there is no gettext installed
189 if test x"$MSGFMT" = x; then
193 if test x"$USE_NLS" = xyes; then
197 dnl ======================== Checks for libraries.
199 AC_ARG_WITH(libpthread,
200 [ --with-libpthread=DIR specifies the base libpthread],
201 [ if test x$withval = xyes
203 AC_MSG_WARN(Usage is: --with-libpthread=DIR)
205 PTHREAD_LIBS="-L$withval/lib/"
206 PTHREAD_CFLAGS="-I$withval/include/"
211 dnl Check for libpthread
212 PTHREAD_LIBS_SAVE="$PTHREAD_LIBS"
214 AC_CHECK_LIB(pthread, pthread_attr_init, [
215 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT"
216 PTHREAD_LIBS="$PTHREAD_LIBS_SAVE -lpthread" ])
218 dnl FIXME: test this on *BSD and report results immediatelly to the ml please
219 dnl If it is not found, try to check for c_r (on FreeBSD)
220 if test "x$PTHREAD_LIBS" = xerror; then
221 AC_CHECK_LIB(c_r, pthread_attr_init, [
222 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_THREAD_SAFE"
223 PTHREAD_LIBS="-pthread" ])
226 dnl FIXME: do we really test here if libc contains this function?
227 if test "x$PTHREAD_LIBS" = xerror; then
228 AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="",
229 AC_MSG_ERROR(not found library: pthread !!!))
232 dnl The following is taken from inn sources
233 AC_MSG_CHECKING(for tm_gmtoff in struct tm)
234 AC_TRY_LINK([#include <time.h>],
235 [struct tm t; t.tm_gmtoff = 0],
237 AC_DEFINE(HAVE_TM_GMTON)],
240 dnl The following is taken from inn sources
241 AC_MSG_CHECKING(for timersub)
242 AC_TRY_LINK([#include <sys/time.h>],
243 [timersub(NULL, NULL, NULL)],
244 [AC_DEFINE(HAVE_TIMEOPS)
245 AC_DEFINE(HAVE_TIMEOPS)
250 dnl Checking for setspeed in termios.h
251 AC_MSG_CHECKING(for cfsetspeed in termios.h)
252 AC_TRY_LINK([#include <termios.h>],
253 [struct termios t; cfsetspeed(&t, B9600);],
254 [AC_DEFINE(HAVE_CFSETSPEED)
259 if test $have_termios = "no"; then
260 AC_MSG_CHECKING(for cfsetispeed and cfsetospeed in termios.h)
261 AC_TRY_LINK([#include <termios.h>],
262 [struct termios t; cfsetispeed(&t, B9600); cfsetospeed(&t, B9600);],
263 [AC_DEFINE(HAVE_CFSETISPEED)
264 AC_DEFINE(HAVE_CFSETOSPEED)
269 if test $have_termios = "no"; then
270 AC_MSG_CHECKING(for c_ispeed and c_ospeed in struct termios)
271 AC_TRY_LINK([#include <termios.h>],
272 [struct termios t; t.c_iflag = B9600; t.c_oflag = B9600;],
273 [AC_DEFINE(HAVE_TERMIOS_CSPEED)
279 dnl ======================== Checks for getopt_long support
281 AC_CHECK_HEADER(getopt.h, ,
282 [CFLAGS="$CFLAGS -I../getopt"])
284 AC_ARG_WITH(gnugetopt,
285 [ --with-getopt=DIR specifies the getopt library location directory],
286 [ if test x$withval=yes; then
287 AC_MSG_WARN(Usage is: --with-getopt=DIR)
289 GETOPT_LIBS="-L$withval"
295 AC_CHECK_FUNC(getopt_long, , [
296 LIBS="$LIBS $GETOPT_LIBS"
297 AC_CHECK_LIB(gnugetopt, getopt_long, LIBS="$LIBS -lgnugetopt",
300 dnl ======================== Checks for X base support
302 if test "$no_x" = yes -o "$with_x" = "no"; then
310 CPPFLAGS="$CPPFLAGS -I$x_includes"
311 AC_CHECK_HEADERS(X11/xpm.h,
315 if test "x$XPMINC" = "xno"; then
321 AC_MSG_WARN(Cannot find include X11/xpm.h)
322 AC_MSG_WARN(Disabling xgnokii.)
323 elif test "x$x_libraries" = "xNONE"; then
329 AC_MSG_WARN(Cannot find library libX11.)
330 AC_MSG_WARN(Disabling xgnokii.)
332 AC_CHECK_LIB(Xpm, XpmWriteFileFromXpmImage,
333 [ XPM_CFLAGS="-I$x_includes" XPM_LIBS="-L$x_libraries -lX11 -lXpm"
335 AC_MSG_WARN(Cannot found library libXpm - disabling XPM support.),
336 [ -L$x_libraries -lX11 ]
339 AC_PATH_PROGS(GTK_CONFIG, gtk-config gtk12-config, no)
340 if test "$GTK_CONFIG" = no; then
344 AC_MSG_WARN(Cannot find gtk-config.)
345 AC_MSG_WARN(Disabling xgnokii.)
347 GTK_CFLAGS=`$GTK_CONFIG --cflags`
348 GTK_LIBS=`$GTK_CONFIG --libs`
351 XGNOKIIDIR='${prefix}/share'
352 XGNOKIIPATH=${prefix}/share
353 AC_ARG_WITH(xgnokiidir,
354 [ --with-xgnokiidir=DIR specifies the base for xgnokii],
355 [ if test x$withval = xyes; then
356 AC_MSG_WARN(Usage is: --with-xgnokiilib=DIR)
358 XGNOKIIDIR="$withval"
359 XGNOKIIPATH="$withval"
367 dnl ======================== Check for libsocket
368 AC_CHECK_LIB(socket, socket)
370 dnl ======================== Additional switches
372 AC_ARG_ENABLE(security,
373 [ --enable-security enable all security features ],
374 [ AC_DEFINE(SECURITY)
380 [ --enable-win32 if you want win32 suport ],
386 AC_CHECK_FUNC(grantpt,
388 #define _XOPEN_SOURCE 500
390 #include <features.h>
392 #include <sys/types.h>
393 #include <sys/stat.h>
402 master = open("/dev/ptmx", O_RDWR | O_NOCTTY | O_NONBLOCK);
404 err = grantpt(master);
405 err = err || unlockpt(master);
407 name = ptsname(master);
418 AC_DEFINE(USE_UNIX98PTYS),
419 AC_MSG_WARN("No unix98ptys"),
420 AC_MSG_WARN("Ensure to disable unix98ptys when crosscompiling"))
424 dnl ======================== Checks for header files.
427 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h)
429 dnl ======================== Checks for typedefs, structures, and compiler characteristics.
437 dnl ======================== Checks for library functions.
438 AC_PROG_GCC_TRADITIONAL
442 AC_CHECK_FUNCS(mktime select strdup strstr strtol strtok strsep snprintf vsnprintf asprintf vasprintf)
444 CFLAGS="$CFLAGS $NLS_CFLAGS"
445 LIBS="$LIBS $NLS_LIBS"
449 VERSION=`cat VERSION`
450 XVERSION=`cat xgnokii/VERSION`
451 HAVE_XGNOKII=$x_support
454 'config/install-sh -c') INSTALL=`pwd`/$INSTALL
458 SHELL=${CONFIG_SHELL-/bin/sh}
462 solaris*) SHELL=/bin/ksh
466 AC_CONFIG_HEADER(include/config.h)
473 AC_SUBST(XGNOKIIPATH)
474 AC_SUBST(exec_prefix)
478 AC_SUBST(PTHREAD_CFLAGS)
479 AC_SUBST(PTHREAD_LIBS)
483 AC_SUBST(USE_UNIX98PTYS)
484 AC_SUBST(HAVE_XGNOKII)
490 packaging/RedHat/gnokii.spec
491 packaging/Slackware/SlackBuild,
492 [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile]
496 dnl ======================== Final report
502 A Linux/Unix toolset and driver for Nokia mobile phones.
504 Copyright (C) 1999-2000 The Gnokii Development Team.
506 This program is free software; you can redistribute it and/or modify
507 it under the terms of the GNU General Public License as published by
508 the Free Software Foundation; either version 2 of the License, or
509 (at your option) any later version.
511 See file COPYING for more details.
513 Host system: $host_os
514 Gnokii version: $VERSION
515 Xgnokii version: $XVERSION
516 X (GTK) support: $x_support
525 Type '${MAKE}' for compilation and then '${MAKE} install',
526 '${MAKE} install-suid', '${MAKE} install-strip' or '${MAKE} install-ss' to