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"
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],
42 [ --enable-xdebug compile with xdebug code],
48 AC_ARG_ENABLE(rlpdebug,
49 [ --enable-rlpdebug compile with RLP debug code],
50 [ AC_DEFINE(RLP_DEBUG)
55 dnl ======================== NLS support
62 [ --with-libintl=DIR specifies the base NLS],
63 [ if test "x$withval" = "xyes"; then
64 AC_MSG_WARN(Usage is --with-libintl=DIR)
66 NLS_LIBS="-L$withval/lib"
67 NLS_CFLAGS="-I$withval/include"
73 [ --disable-nls do not use NLS],
74 [ USE_NLS=$enableval ],
78 if test "$USE_NLS" = "yes"; then
80 AC_CHECK_HEADERS(locale.h)
81 AC_CHECK_FUNCS(setlocale)
82 AC_SUBST(HAVE_LOCALE_H)
84 CPPFLAGS="$CPPFLAGS $NLS_CFLAGS"
85 AC_TRY_CPP([#include <libintl.h>],
86 [ AC_DEFINE(HAVE_LIBINTL_H)
87 AC_MSG_RESULT([checking for libintl.h... yes]) ],
88 [ AC_MSG_WARN(not found header file: libintl.h !!!)
93 if test "$USE_NLS" = "yes"; then
94 AC_CHECK_FUNC(gettext,
95 AC_DEFINE(HAVE_LIBINTL),
96 AC_CHECK_LIB(intl, gettext,
97 [ NLS_LIBS="$NLS_LIBS -lintl"
98 AC_DEFINE(HAVE_LIBINTL) ],
99 [ AC_MSG_WARN(not found library: intl !!!)
106 if test "$USE_NLS" = "yes"; then
108 AC_SUBST(HAVE_LIBINTL_H)
109 AC_SUBST(HAVE_LIBINTL)
112 LOCALEDIR='${prefix}/share/locale'
113 AC_ARG_WITH(locale-dir,
114 [ --with-locale-dir=DIR Location of the locale file(s)
115 [PREFIX/share/locale]],
116 [ if test x$withval = xyes; then
117 AC_MSG_WARN(Usage is: --with-locale-dir=basedir)
119 if test x$withval = xno; then
120 AC_MSG_WARN(Usage is: --with-locale-dir=basedir)
129 AC_PATH_PROG(MSGFMT, msgfmt, $MSGFMT)
130 if test -n "$MSGFMT"; then
131 AC_CHECK_FUNCS(dcgettext)
132 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
133 AC_PATH_PROG(XGETTEXT, xgettext, $XGETTEXT)
134 AC_PATH_PROG(MSGMERGE, msgmerge, $MSGMERGE)
136 dnl Test whether we really found GNU xgettext.
137 if test -n "$XGETTEXT"; then
138 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
141 AC_MSG_RESULT([found xgettext program is not GNU xgettext; ignore it])
146 dnl We add another test for comparing GNU xgettext with openwin xgettext
147 if test -n "$XGETTEXT"; then
148 if $XGETTEXT --help > /dev/null 2> /dev/null; then
151 AC_MSG_RESULT([found xgettext program is not GNU xgettext; ignore it])
156 dnl Test whether we really found GNU msgfmt.
157 if test -n "$MSGFMT"; then
158 if $MSGFMT < /dev/null 2> /dev/null; then
159 AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; NLS will not be installed])
165 [ extern int _nl_msg_cat_cntr;
166 return _nl_msg_cat_cntr],
175 if test -n "$ALL_LINGUAS"; then
176 for lang in $ALL_LINGUAS; do
177 CATALOGS="$CATALOGS $lang$CATOBJEXT"
183 AC_SUBST(DATADIRNAME)
186 dnl don't use NLS, when there is no gettext installed
187 if test x"$MSGFMT" = x; then
191 if test x"$USE_NLS" = xyes; then
195 dnl ======================== Checks for libraries.
197 AC_ARG_WITH(libpthread,
198 [ --with-libpthread=DIR specifies the base libpthread],
199 [ if test x$withval = xyes
201 AC_MSG_WARN(Usage is: --with-libpthread=DIR)
203 PTHREAD_LIBS="-L$withval/lib/"
204 PTHREAD_CFLAGS="-I$withval/include/"
209 dnl Check for libpthread
210 PTHREAD_LIBS_SAVE="$PTHREAD_LIBS"
212 AC_CHECK_LIB(pthread, pthread_attr_init, [
213 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT"
214 PTHREAD_LIBS="$PTHREAD_LIBS_SAVE -lpthread" ])
216 dnl FIXME: test this on *BSD and report results immediatelly to the ml please
217 dnl If it is not found, try to check for c_r (on FreeBSD)
218 if test "x$PTHREAD_LIBS" = xerror; then
219 AC_CHECK_LIB(c_r, pthread_attr_init, [
220 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_THREAD_SAFE"
221 PTHREAD_LIBS="-pthread" ])
224 dnl FIXME: do we really test here if libc contains this function?
225 if test "x$PTHREAD_LIBS" = xerror; then
226 AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="",
227 AC_MSG_ERROR(not found library: pthread !!!))
230 dnl The following is taken from inn sources
231 AC_MSG_CHECKING(for tm_gmtoff in struct tm)
232 AC_TRY_LINK([#include <time.h>],
233 [struct tm t; t.tm_gmtoff = 0],
235 AC_DEFINE(HAVE_TM_GMTON)],
238 dnl The following is taken from inn sources
239 AC_MSG_CHECKING(for timersub)
240 AC_TRY_LINK([#include <sys/time.h>],
241 [timersub(NULL, NULL, NULL)],
242 [AC_DEFINE(HAVE_TIMEOPS)
243 AC_DEFINE(HAVE_TIMEOPS)
248 dnl Checking for setspeed in termios.h
249 AC_MSG_CHECKING(for cfsetspeed in termios.h)
250 AC_TRY_LINK([#include <termios.h>],
251 [struct termios t; cfsetspeed(&t, B9600);],
252 [AC_DEFINE(HAVE_CFSETSPEED)
257 if test $have_termios = "no"; then
258 AC_MSG_CHECKING(for cfsetispeed and cfsetospeed in termios.h)
259 AC_TRY_LINK([#include <termios.h>],
260 [struct termios t; cfsetispeed(&t, B9600); cfsetospeed(&t, B9600);],
261 [AC_DEFINE(HAVE_CFSETISPEED)
262 AC_DEFINE(HAVE_CFSETOSPEED)
267 if test $have_termios = "no"; then
268 AC_MSG_CHECKING(for c_ispeed and c_ospeed in struct termios)
269 AC_TRY_LINK([#include <termios.h>],
270 [struct termios t; t.c_iflag = B9600; t.c_oflag = B9600;],
271 [AC_DEFINE(HAVE_TERMIOS_CSPEED)
277 dnl ======================== Checks for getopt_long support
279 AC_CHECK_HEADER(getopt.h, ,
280 [CFLAGS="$CFLAGS -I../getopt"])
282 AC_ARG_WITH(gnugetopt,
283 [ --with-getopt=DIR specifies the getopt library location directory],
284 [ if test x$withval=yes; then
285 AC_MSG_WARN(Usage is: --with-getopt=DIR)
287 GETOPT_LIBS="-L$withval"
293 AC_CHECK_FUNC(getopt_long, , [
294 LIBS="$LIBS $GETOPT_LIBS"
295 AC_CHECK_LIB(gnugetopt, getopt_long, LIBS="$LIBS -lgnugetopt",
298 dnl ======================== Checks for X base support
300 if test "$no_x" = yes -o "$with_x" = "no"; then
308 CPPFLAGS="$CPPFLAGS -I$x_includes"
309 AC_CHECK_HEADERS(X11/xpm.h,
313 if test "x$XPMINC" = "xno"; then
319 AC_MSG_WARN(Cannot find include X11/xpm.h)
320 AC_MSG_WARN(Disabling xgnokii.)
321 elif test "x$x_libraries" = "xNONE"; then
327 AC_MSG_WARN(Cannot find library libX11.)
328 AC_MSG_WARN(Disabling xgnokii.)
330 AC_CHECK_LIB(Xpm, XpmWriteFileFromXpmImage,
331 [ XPM_CFLAGS="-I$x_includes" XPM_LIBS="-L$x_libraries -lXpm -lX11"
333 AC_MSG_WARN(Cannot found library libXpm - disabling XPM support.),
334 [ -L$x_libraries -lX11 ]
337 AC_PATH_PROGS(GTK_CONFIG, gtk-config gtk12-config, no)
338 if test "$GTK_CONFIG" = no; then
342 AC_MSG_WARN(Cannot find gtk-config.)
343 AC_MSG_WARN(Disabling xgnokii.)
345 GTK_CFLAGS=`$GTK_CONFIG --cflags`
346 GTK_LIBS=`$GTK_CONFIG --libs`
349 XGNOKIIDIR='${prefix}/share'
350 XGNOKIIPATH=${prefix}/share
351 AC_ARG_WITH(xgnokiidir,
352 [ --with-xgnokiidir=DIR specifies the base for xgnokii],
353 [ if test x$withval = xyes; then
354 AC_MSG_WARN(Usage is: --with-xgnokiilib=DIR)
356 XGNOKIIDIR="$withval"
357 XGNOKIIPATH="$withval"
365 dnl ======================== Check for libsocket
366 AC_CHECK_LIB(socket, socket)
368 dnl ======================== Additional switches
370 AC_ARG_ENABLE(security,
371 [ --enable-security enable all security features ],
372 [ AC_DEFINE(SECURITY)
378 [ --enable-win32 if you want win32 suport ],
384 AC_CHECK_FUNC(grantpt,
386 #define _XOPEN_SOURCE 500
388 #include <features.h>
390 #include <sys/types.h>
391 #include <sys/stat.h>
400 master = open("/dev/ptmx", O_RDWR | O_NOCTTY | O_NONBLOCK);
402 err = grantpt(master);
403 err = err || unlockpt(master);
405 name = ptsname(master);
416 AC_DEFINE(USE_UNIX98PTYS),
417 AC_MSG_WARN("No unix98ptys"),
418 AC_MSG_WARN("Ensure to disable unix98ptys when crosscompiling"))
422 dnl ======================== Checks for header files.
425 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h)
427 dnl ======================== Checks for typedefs, structures, and compiler characteristics.
435 dnl ======================== Checks for library functions.
436 AC_PROG_GCC_TRADITIONAL
440 AC_CHECK_FUNCS(mktime select strdup strstr strtol strtok strsep snprintf)
442 CFLAGS="$CFLAGS $NLS_CFLAGS"
443 LIBS="$LIBS $NLS_LIBS"
447 VERSION=`cat VERSION`
448 XVERSION=`cat xgnokii/VERSION`
449 HAVE_XGNOKII=$x_support
452 'config/install-sh -c') INSTALL=`pwd`/$INSTALL
456 SHELL=${CONFIG_SHELL-/bin/sh}
460 solaris*) SHELL=/bin/ksh
464 AC_CONFIG_HEADER(include/config.h)
471 AC_SUBST(XGNOKIIPATH)
472 AC_SUBST(exec_prefix)
476 AC_SUBST(PTHREAD_CFLAGS)
477 AC_SUBST(PTHREAD_LIBS)
481 AC_SUBST(USE_UNIX98PTYS)
482 AC_SUBST(HAVE_XGNOKII)
488 packaging/RedHat/gnokii.spec
489 packaging/Slackware/SlackBuild,
490 [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile]
494 dnl ======================== Final report
500 A Linux/Unix toolset and driver for Nokia mobile phones.
502 Copyright (C) 1999-2000 The Gnokii Development Team.
504 This program is free software; you can redistribute it and/or modify
505 it under the terms of the GNU General Public License as published by
506 the Free Software Foundation; either version 2 of the License, or
507 (at your option) any later version.
509 See file COPYING for more details.
511 Host system: $host_os
512 Gnokii version: $VERSION
513 Xgnokii version: $XVERSION
514 X (GTK) support: $x_support
523 Type '${MAKE}' for compilation or '${MAKE} makelib' when want to compile
524 all binaries with one shared library
526 After it '${MAKE} install', '${MAKE} install-suid', '${MAKE} install-strip'
527 or '${MAKE} install-ss' to install gnokii.