1 dnl This file is Copyright (c)2010 by the GPSD project
2 dnl BSD terms apply: see the file COPYING in the distribution root for details.
5 AM_INIT_AUTOMAKE(gpsd, 2.95)
6 dnl AC_PREFIX_PROGRAM(gcc)
7 AM_CONFIG_HEADER(gpsd_config.h)
12 # Due to a longstanding Autoconf bug (Autoconf 2.50 to at least 2.63),
13 # any macro that is AC_REQUIREd at any point must be AC_REQUIREd
14 # *before* it is directly expanded. The macros below were being
15 # directly expanded before being AC_REQUIREd, so we AC_REQUIRE them
16 # early to prevent out-of-order expansion problems. See the threads
18 # http://lists.gnu.org/archive/html/bug-autoconf/2008-12/msg00039.html
19 # http://lists.gnu.org/archive/html/autoconf-patches/2008-12/msg00058.html
20 # http://lists.gnu.org/archive/html/bug-autoconf/2009-01/msg00019.html
21 # http://lists.gnu.org/archive/html/bug-gnulib/2009-01/msg00247.html
22 AC_DEFUN_ONCE([ACREQUIRE_BUGFIX],
24 AC_REQUIRE([AC_PROG_CPP])
25 AC_REQUIRE([AC_PROG_EGREP])
26 AC_REQUIRE([AC_PROG_CC])
29 # ACREQUIRE_BUGFIX done
31 dnl AM_PATH_PYTHON provided with automake can be too old. Look
32 dnl for newer python first, and include 2.6 on the list.
33 m4_define([_AM_PYTHON_INTERPRETER_LIST],
34 [python2.6 python2.5 python2.4 python])
37 if test "x$PYTHON" = "x"; then
38 AC_PATH_PROG(PYTHON, python, none)
41 if test "x$PYTHON" = "xnone"; then
42 AC_MSG_WARN([*** Python interpreter not found, Python support disabled.])
46 if test "x$ac_python" = "xyes"; then
47 AC_MSG_CHECKING(Python version and location)
48 PYTHON_PREFIX=`$PYTHON -c "import sys; print(sys.prefix)"`
49 PYTHON_VERSION_MAJOR=[`$PYTHON -c "import sys; print('%d' % (sys.version_info[0]));"`]
50 PYTHON_VERSION_MINOR=[`$PYTHON -c "import sys; print('%d' % (sys.version_info[1]));"`]
51 PYTHON_VERSION="${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}"
52 AC_MSG_RESULT([$PYTHON, $PYTHON_VERSION, $PYTHON_PREFIX])
54 PYTHON_CFLAGS="-DHAVE_PYTHON -I$PYTHON_PREFIX/include/python$PYTHON_VERSION"
56 # Define the directories we ask setup.py to install the
57 # modules/extensions and scripts to. The way chosen here reproduces
58 # the internal behaviour of distutils. Unfortunately distutils does
59 # not export the pre-defined/configured directories, so we have to
60 # define them on our own. For default installations of distutils the
61 # chosen values here will match what distutils uses.
62 # See Makefile.am to see how they're used with setup.py.
63 PYTHON_DISTUTILS_LIBDIR=[`$PYTHON -c 'import distutils.util; import sys; print ("build/lib.%s-%s" %(distutils.util.get_platform(), sys.version[0:3]))'`]
64 PYTHON_DISTUTILS_SCRIPTDIR=[`$PYTHON -c 'import sys; print ("build/scripts-%s" %(sys.version[0:3], ))'`]
66 OLD_CPPFLAGS="$CPPFLAGS"
67 OLD_CXXFLAGS="$CXXFLAGS"
68 CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
69 CXXFLAGS="$CXXFLAGS $PYTHON_CFLAGS"
71 AC_CHECK_HEADERS([Python.h],
73 [AC_MSG_WARN([*** Python include files not found! You should install the Python development package. Python support disabled]); ac_python=no])
74 CPPFLAGS="$OLD_CPPFLAGS"
75 CXXFLAGS="$OLD_CXXFLAGS"
77 if test "x$ac_python" = "xyes"; then
78 AC_SUBST([PYTHON_CFLAGS])
79 AC_SUBST([PYTHON_DISTUTILS_LIBDIR])
80 AC_SUBST([PYTHON_DISTUTILS_SCRIPTDIR])
83 for pylibpath in '/usr/lib' $PYTHON_PREFIX/lib $PYTHON_PREFIX/lib/python$PYTHON_VERSION/config; do
84 eval `echo unset ac_cv_lib_python$PYTHON_VERSION'___'Py_Finalize | tr '.' '_'`
87 LIBS="$LIBS -L$pylibpath $PYTHON_LIBS"
88 AC_CHECK_LIB(python$PYTHON_VERSION, Py_Finalize, PYTHON_LIBS="-L$pylibpath -lpython$PYTHON_VERSION $PYTHON_DEPS"; ac_python=yes,,$PYTHON_DEPS)
90 if test "x$ac_python" = "xyes"; then
95 if test "x$ac_python" != "xyes"; then
96 AC_MSG_WARN(*** Python development libraries required, Python support disabled)
98 AC_SUBST([PYTHON_LIBS])
100 AC_SUBST(pkgpythondir)
101 if test "x$python_install" = "xyes"; then
102 pkgpythondir=$PYTHON_PREFIX"/lib/python"$PYTHON_VERSION"/site-packages/gpsd"
106 AM_CONDITIONAL([HAVE_PYTHON], [test x"$ac_python" = xyes])
115 AC_CHECK_SIZEOF([char])
116 AC_CHECK_SIZEOF([short])
117 AC_CHECK_SIZEOF([int])
118 AC_CHECK_SIZEOF([long])
119 AC_CHECK_SIZEOF([long long])
120 AC_CHECK_SIZEOF([float])
121 AC_CHECK_SIZEOF([double])
122 if test x"$ac_cv_sizeof_char" != "x1" ; then
123 AC_MSG_WARN(gpsd requires sizeof(char)==1);
126 if test x"$ac_cv_sizeof_short" != "x2" ; then
127 AC_MSG_WARN(gpsd requires sizeof(short)==2);
130 if test x"$ac_cv_sizeof_int" != "x4" ; then
131 AC_MSG_WARN(gpsd requires sizeof(int)==4);
134 if test x"$ac_cv_sizeof_long_long" != "x8" ; then
135 AC_MSG_WARN(gpsd requires sizeof(long long)==8);
138 if test x"$ac_cv_sizeof_float" != "x4" ; then
139 AC_MSG_WARN(gpsd requires sizeof(float)==4);
142 if test x"$ac_cv_sizeof_double" != "x8" ; then
143 AC_MSG_WARN(gpsd requires sizeof(double)==8);
146 if test x"$type_error" = "xyes" ; then
147 AC_ERROR(Your system does not provide all required data types);
154 AC_MSG_CHECKING([for properly working floating point implementation])
155 if test "x$build" = "x$host"; then
156 if eval "$CC $CFLAGS -o test_float ${srcdir}/test_float.c"; then
157 if ./test_float > /dev/null; then
161 AC_MSG_WARN([We strongly recommend you manually examine the test_float results])
164 AC_MSG_RESULT([failure compiling test_float])
167 AC_MSG_RESULT([skipped test (cross-compiling)])
168 AC_MSG_WARN([We are cross-compiling, and thus cannot run the floating point test now.
169 We strongly recommend running test_float on the target platform.])
173 if eval "test x$GCC = xyes"; then
174 CFLAGS="$CFLAGS -Wall -Wcast-align -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wreturn-type -D_GNU_SOURCE"
178 AC_CHECK_HEADERS(sys/termios.h sys/select.h sys/time.h sys/modem.h sys/ipc.h sys/shm.h sys/stat.h sys/socket.h sys/ioctl.h sys/un.h)
179 AC_CHECK_HEADERS(arpa/inet.h netinet/in_systm.h netinet/in.h netinet/tcp.h)
180 AC_CHECK_HEADERS([netinet/ip.h], [], [],
181 [[#if HAVE_NETINET_IN_SYSTM_H && HAVE_NETINET_IN_H
182 #include netinet/ip.h
185 AC_CHECK_HEADERS(termios.h strings.h getopt.h netdb.h syslog.h pwd.h grp.h)
187 AC_CHECK_FUNCS(round, roundf)
188 AC_CHECK_FUNCS(strlcpy)
189 AC_CHECK_FUNCS(strlcat)
190 AC_CHECK_FUNCS(strtonum)
191 AC_CHECK_FUNCS(setlocale)
192 AC_CHECK_FUNCS(vsnprintf)
197 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
202 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
203 if test $ac_cv_var_timezone = yes; then
204 AC_DEFINE(HAVE_TIMEZONE, [], [Have timezone variable])
206 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
212 ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no
214 if test $ac_cv_struct_tm_gmtoff = yes; then
215 AC_DEFINE(HAVE_TM_GMTOFF, [], [struct tm has tm_gmtoff])
217 AC_ERROR(unable to find a way to determine timezone)
220 AC_CACHE_CHECK(for daylight external, mb_cv_var_daylight,
221 [ AC_TRY_LINK([#include <time.h>], [return (int)daylight;],
222 mb_cv_var_daylight=yes,
223 mb_cv_var_daylight=no)
225 if test $mb_cv_var_daylight = yes; then
226 AC_DEFINE([HAVE_DAYLIGHT], 1,
227 [Define if you have the external 'daylight' variable.])
230 AC_CHECK_LIB(nsl, gethostbyname, LIBNSL="-lnsl")
232 AC_CHECK_LIB(socket, socket, LIBSOCKET="-lsocket")
234 AC_CHECK_LIB(m, rint, LIBM="-lm")
236 AC_CHECK_LIB(c, open, LIBC="-lc")
238 AC_CHECK_LIB(pthread, pthread_setcancelstate,
239 [LIBPTHREAD="-lpthread"
240 AC_DEFINE([HAVE_LIBPTHREAD], [], [pthread libraries are present])])
243 PKG_CHECK_MODULES(LIBUSB, libusb-1.0 >= 1.0.0, [ac_libusb=yes], [ac_libusb=no])
244 AC_SUBST(LIBUSB_LIBS)
245 AC_SUBST(LIBUSB_CFLAGS)
246 if test x"$ac_libusb" = x"yes" ; then
247 AC_DEFINE([HAVE_LIBUSB], 1, [libusb support])
250 AH_VERBATIM([_GNU_SOURCE],
251 [/* Some libc's don't have strlcat/strlcpy. Local copies are provided */
256 size_t strlcat(/*@out@*/char *dst, /*@in@*/const char *src, size_t size);
265 size_t strlcpy(/*@out@*/char *dst, /*@in@*/const char *src, size_t size);
271 #define GPSD_CONFIG_H])
275 dnl Check for curses headers and libraries. The presence of the
276 dnl library is used to decide whether or not to build some programs.
277 dnl Those programs use ncurses.h if found, and otherwise use curses.h.
278 dnl TODO: give an example of what system uses curses.h with
279 dnl libncurses. We define our own variables to reduce the risk of
280 dnl breaking if autoconf changes (private) variable names.
281 AC_CHECK_HEADERS(ncurses.h)
282 AC_CHECK_LIB(ncurses, initscr, NCURSES_LIBS="-lncurses")
283 AC_SUBST(NCURSES_LIBS)
284 if test x"$NCURSES_LIBS" = x"" ; then
285 AC_MSG_WARN([Not including curses support])
286 AM_CONDITIONAL([HAVE_NCURSES],false)
289 AM_CONDITIONAL([HAVE_NCURSES],true)
293 dnl check for NMEA support
295 AC_HELP_STRING([--disable-nmea],
296 [disable NMEA support]),
297 [ac_nmea=$enableval], [ac_nmea=yes])
298 AC_MSG_CHECKING([for NMEA support])
299 if test x"$ac_nmea" = "xyes"; then
301 AC_DEFINE([NMEA_ENABLE], 1, [NMEA chipset support])
306 dnl check for OnCore support
307 AC_ARG_ENABLE(oncore,
308 AC_HELP_STRING([--disable-oncore],
309 [disable Motorola OnCore chipset support]),
310 [ac_oncore=$enableval], [ac_oncore=yes])
311 AC_MSG_CHECKING([for Motorola OnCore support])
312 if test x"$ac_oncore" = "xyes"; then
314 AC_DEFINE([ONCORE_ENABLE], 1, [Motorola OnCore chipset support])
319 dnl check for SiRF support
321 AC_HELP_STRING([--disable-sirf],
322 [disable SiRF chipset support]),
323 [ac_sirf=$enableval], [ac_sirf=yes])
324 AC_MSG_CHECKING([for SiRF support])
325 if test x"$ac_sirf" = "xyes"; then
327 AC_DEFINE([SIRF_ENABLE], 1, [SiRF chipset support])
332 dnl check for Novatel SuperStarII support
333 AC_ARG_ENABLE(superstar2,
334 AC_HELP_STRING([--disable-superstar2],
335 [disable SuperStarII chipset support]),
336 [ac_superstar2=$enableval], [ac_superstar2=yes])
337 AC_MSG_CHECKING([for SuperStarII support])
338 if test x"$ac_superstar2" = "xyes"; then
340 AC_DEFINE([SUPERSTAR2_ENABLE], 1, [SuperStarII chipset support])
345 dnl check for Trimble TSIP support
347 AC_HELP_STRING([--disable-tsip],
348 [disable Trimble TSIP support]),
349 [ac_tsip=$enableval], [ac_tsip=yes])
350 AC_MSG_CHECKING([for Trimble TSIP support])
351 if test x"$ac_tsip" = "xyes"; then
353 AC_DEFINE([TSIP_ENABLE], 1, [Trimble TSIP support])
358 dnl check for FV-18 support
360 AC_HELP_STRING([--disable-fv18],
361 [disable San Jose Navigation FV-18 support]),
362 [ac_fv18=$enableval], [ac_fv18=yes])
363 AC_MSG_CHECKING([for FV-18 support])
364 if test x"$ac_fv18" = "xyes"; then
367 AC_DEFINE([FV18_ENABLE], 1, [San Jose Navigation FV-18 support])
368 AC_DEFINE([NMEA_ENABLE], 1, [San Jose Navigation FV-18 requires NMEA support])
373 dnl check for Tripmate support
374 AC_ARG_ENABLE(tripmate,
375 AC_HELP_STRING([--disable-tripmate],
376 [disable DeLorme TripMate support]),
377 [ac_tripmate=$enableval], [ac_tripmate=yes])
378 AC_MSG_CHECKING([for Tripmate support])
379 if test x"$ac_tripmate" = "xyes"; then
381 AC_DEFINE([TRIPMATE_ENABLE], 1, [DeLorme TripMate support])
386 dnl check for EarthMate support
387 AC_ARG_ENABLE(earthmate,
388 AC_HELP_STRING([--disable-earthmate],
389 [disable DeLorme EarthMate Zodiac support]),
390 [ac_earthmate=$enableval], [ac_earthmate=yes])
391 AC_MSG_CHECKING([for EarthMate support])
392 if test x"$ac_earthmate" = "xyes"; then
394 AC_DEFINE([EARTHMATE_ENABLE], 1, [DeLorme EarthMate Zodiac support])
399 dnl check for iTrax support
401 AC_HELP_STRING([--disable-itrax],
402 [disable iTrax hardware support]),
403 [ac_itrax=$enableval], [ac_itrax=yes])
404 AC_MSG_CHECKING([for iTrax support])
405 if test x"$ac_itrax" = "xyes"; then
407 AC_DEFINE([ITRAX_ENABLE], 1, [iTrax chipset support])
412 dnl check for Ashtech support
413 AC_ARG_ENABLE(ashtech,
414 AC_HELP_STRING([--disable-ashtech],
415 [disable Ashtech support]),
416 [ac_ashtech=$enableval], [ac_ashtech=yes])
417 AC_MSG_CHECKING([for Ashtech support])
418 if test x"$ac_ashtech" = "xyes"; then
420 AC_DEFINE([ASHTECH_ENABLE], 1, [Ashtech chipset support])
425 dnl check for Navcom support
426 AC_ARG_ENABLE(navcom,
427 AC_HELP_STRING([--disable-navcom],
428 [disable Navcom support]),
429 [ac_navcom=$enableval], [ac_navcom=yes])
430 AC_MSG_CHECKING([for Navcom support])
431 if test x"$ac_navcom" = "xyes"; then
433 AC_DEFINE([NAVCOM_ENABLE], 1, [Navcom support])
438 dnl check for Garmin support
439 AC_ARG_ENABLE(garmin,
440 AC_HELP_STRING([--disable-garmin],
441 [disable Garmin kernel driver support]),
442 [ac_garmin=$enableval], [ac_garmin=yes])
443 AC_MSG_CHECKING([for Garmin support])
444 if test x"$ac_garmin" = "xyes"; then
446 AC_DEFINE([GARMIN_ENABLE], 1, [Garmin support])
451 dnl check for Garmin Simple Text support
452 AC_ARG_ENABLE(garmintxt,
453 AC_HELP_STRING([--enable-garmintxt],
454 [enable Garmin Simple Text support]),
455 [ac_garmintxt=$enableval], [ac_garmintxt=yes])
456 AC_MSG_CHECKING([for Garmin Simple Text support])
457 if test x"$ac_garmintxt" = "xyes"; then
459 AC_DEFINE([GARMINTXT_ENABLE], 1, [Garmin Simple Text support])
464 dnl check for True North support
466 AC_HELP_STRING([--enable-tnt],
467 [disable True North Technologies support]),
468 [ac_tnt=$enableval], [ac_tnt=yes])
469 AC_MSG_CHECKING([for True North support])
470 if test x"$ac_tnt" = "xyes"; then
473 AC_DEFINE([TNT_ENABLE], 1, [True North Technologies support])
474 AC_DEFINE([NMEA_ENABLE], 1, [True North requires NMEA support])
479 dnl check for OceanServer support
480 AC_ARG_ENABLE(oceanserver,
481 AC_HELP_STRING([--disable-oceanserver],
482 [disable OceanServer support]),
483 [ac_oceanserver=$enableval], [ac_oceanserver=yes])
484 AC_MSG_CHECKING([for OceanServer support])
485 if test x"$ac_oceanserver" = "xyes"; then
488 AC_DEFINE([OCEANSERVER_ENABLE], 1, [OceanServer support])
489 AC_DEFINE([NMEA_ENABLE], 1, [OceanServer requires NMEA support])
494 dnl check for UBX support
496 AC_HELP_STRING([--disable-ubx],
497 [disable UBX Protocol support]),
498 [ac_ubx=$enableval], [ac_ubx=yes])
499 AC_MSG_CHECKING([for UBX support])
500 if test x"$ac_ubx" = "xyes"; then
502 AC_DEFINE([UBX_ENABLE], 1, [UBX Protocol support])
507 dnl check for EverMore support
508 AC_ARG_ENABLE(evermore,
509 AC_HELP_STRING([--disable-evermore],
510 [disable EverMore binary support]),
511 [ac_evermore=$enableval], [ac_evermore=yes])
512 AC_MSG_CHECKING([for EverMore support])
513 if test x"$ac_evermore" = "xyes"; then
515 AC_DEFINE([EVERMORE_ENABLE], 1, [EverMore binary support])
520 dnl check for MTK-3301 support
521 AC_ARG_ENABLE(mtk3301,
522 AC_HELP_STRING([--disable-mtk3301],
523 [disable MTK-3301 support]),
524 [ac_mtk3301=$enableval], [ac_mtk3301=yes])
525 AC_MSG_CHECKING([for MTK-3301 support])
526 if test x"$ac_mtk3301" = "xyes"; then
529 AC_DEFINE([MTK3301_ENABLE], 1, [MTK-3301 support])
530 AC_DEFINE([NMEA_ENABLE], 1, [MTK-3301 requires NMEA support])
535 dnl check for GPSClock support
536 AC_ARG_ENABLE(gpsclock,
537 AC_HELP_STRING([--disable-gpsclock],
538 [disable GPSClock support]),
539 [ac_gpsclock=$enableval], [ac_gpsclock=yes])
540 AC_MSG_CHECKING([for GPSClock support])
541 if test x"$ac_gpsclock" = "xyes"; then
543 AC_DEFINE([GPSCLOCK_ENABLE], 1, [GPSclock chipset support])
548 dnl check for RTCM104V2 support
549 AC_ARG_ENABLE(rtcm104v2,
550 AC_HELP_STRING([--disable-rtcm104v2],
551 [disable rtcm104v2 support]),
552 [ac_rtcm104v2=$enableval], [ac_rtcm104v2=yes])
553 AC_MSG_CHECKING([for rtcm104v2 support])
554 if test x"$ac_earthmate" = "xno" -a x"$ac_evermore" = "xno" -a x"$ac_garmin" = "xno" -a x"$ac_itrax" = "xno" -a x"$ac_sirf" = "xno" -a x"$ac_superstar2" = "xno" -a x"$ac_tsip" = "xno" -a x"$ac_navcom" = "xno"; then
557 if test x"$ac_rtcm104v2" = "xyes"; then
559 AC_DEFINE([RTCM104V2_ENABLE], 1, [rtcm104v2 binary support])
564 AM_CONDITIONAL([HAVE_RTCM104V2], [test "$ac_rtcm104v2" = "yes"])
566 dnl check for RTCM104V3 support
567 AC_ARG_ENABLE(rtcm104v3,
568 AC_HELP_STRING([--disable-rtcm104v3],
569 [disable rtcm104v3 support]),
570 [ac_rtcm104v3=$enableval], [ac_rtcm104v3=yes])
571 AC_MSG_CHECKING([for rtcm104v3 support])
572 if test x"$ac_earthmate" = "xno" -a x"$ac_evermore" = "xno" -a x"$ac_garmin" = "xno" -a x"$ac_itrax" = "xno" -a x"$ac_sirf" = "xno" -a x"$ac_tsip" = "xno" -a x"$ac_navcom" = "xno"; then
575 if test x"$ac_rtcm104v3" = "xyes"; then
577 AC_DEFINE([RTCM104V3_ENABLE], 1, [rtcm104v3 binary support])
582 AM_CONDITIONAL([HAVE_RTCM104V3], [test "$ac_rtcm104v3" = "yes"])
584 dnl check for NTRIP support
586 AC_HELP_STRING([--disable-ntrip],
587 [disable NTRIP support]),
588 [ac_ntrip=$enableval], [ac_ntrip=yes])
589 AC_MSG_CHECKING([for NTRIP support])
590 if test x"$ac_ntrip" = "xyes"; then
592 AC_DEFINE([NTRIP_ENABLE], 1, [NTRIP support])
597 AM_CONDITIONAL([HAVE_NTRIP], [test "$ac_ntrip" = "yes"])
599 dnl check for AIVDM support
601 AC_HELP_STRING([--disable-aivdm],
602 [disable Aivdm support]),
603 [ac_aivdm=$enableval], [ac_aivdm=yes])
604 AC_MSG_CHECKING([for AIVDM support])
605 if test x"$ac_aivdm" = "xyes"; then
607 AC_DEFINE([AIVDM_ENABLE], 1, [AIVDM protocol support)])
611 AM_CONDITIONAL([HAVE_AIVDM], [test "$ac_aivdm" = "yes"])
613 dnl check for latency timing support
614 AC_ARG_ENABLE(timing,
615 AC_HELP_STRING([--disable-timing],
616 [disable latency timing support]),
617 [ac_timing=$enableval], [ac_timing=yes])
618 AC_MSG_CHECKING([for latency timing support])
619 if test x"$ac_timing" = "xyes"; then
621 AC_DEFINE([TIMING_ENABLE], 1, [latency timing support)])
626 dnl check for client debugging support
627 AC_ARG_ENABLE(clientdebug,
628 AC_HELP_STRING([--disable-clientdebug],
629 [disable client debugging support]),
630 [ac_clientdebug=$enableval], [ac_clientdebug=yes])
631 AC_MSG_CHECKING([for client debugging support])
632 if test x"$ac_clientdebug" = "xyes"; then
634 AC_DEFINE([CLIENTDEBUG_ENABLE], 1, [client debugging support)])
639 AM_CONDITIONAL([CLIENTDEBUG_ENABLE], [test x"$ac_clientdebug" = x"yes"])
641 dnl check for support for oldstyle protocol
642 AC_ARG_ENABLE(oldstyle,
643 AC_HELP_STRING([--disable-oldstyle],
644 [disable oldstyle (pre-JSON) protocol support]),
645 [ac_oldstyle=$enableval], [ac_oldstyle=yes])
646 AC_MSG_CHECKING([for oldstyle support])
647 if test x"$ac_oldstyle" = "xyes"; then
649 AC_DEFINE([OLDSTYLE_ENABLE], 1, [oldstyle (pre-JSON) protocol support])
654 dnl check for profiling support
655 AC_ARG_ENABLE(profiling,
656 AC_HELP_STRING([--enable-profiling],
657 [enable profiling support]),
658 [ac_profiling=$enableval], [ac_profiling=no])
659 AC_MSG_CHECKING([for profiling support])
660 if test x"$ac_profiling" = "xyes"; then
662 AC_DEFINE([PROFILING], 1, [profiling support])
667 dnl check for NTP time hinting support
668 AC_ARG_ENABLE(ntpshm,
669 AC_HELP_STRING([--disable-ntpshm],
670 [disable NTP time hinting support]),
671 [ac_ntpshm=$enableval], [ac_ntpshm=yes])
672 AC_MSG_CHECKING([for NTP time hinting support])
673 if test x"$ac_ntpshm" = "xyes"; then
675 AC_DEFINE([NTPSHM_ENABLE], 1, [NTP time hinting support])
680 dnl check for PPS time syncing support
682 AC_HELP_STRING([--disable-pps],
683 [disable PPS time syncing support]),
684 [ac_pps=$enableval], [ac_pps=yes])
685 AC_MSG_CHECKING([for PPS time syncing support])
686 if test x"$ac_pps" = "xyes"; then
688 AC_DEFINE([PPS_ENABLE], 1, [PPS time syncing support])
693 dnl check for PPS input on CTS line
694 AC_ARG_ENABLE(pps-on-cts,
695 AC_HELP_STRING([--enable-pps-on-cts],
696 [Enable PPS pulse on CTS rather than DCD]),
697 [ac_ppsoncts=$enableval], [ac_ppsoncts=no])
698 AC_MSG_CHECKING([for PPS pulse on CTS rather than DCD])
699 if test x"$ac_ppsoncts" = "xyes"; then
701 AC_DEFINE([PPS_ON_CTS], 1, [PPS on CTS rather than DCD])
706 dnl check for privilege revocation user at compile-time
707 AC_ARG_ENABLE(gpsd-user,
708 AC_HELP_STRING([--enable-gpsd-user=username],
709 [GPSD privilege revocation user]),
710 [ac_user=$enableval], [ac_user=nobody])
711 AC_MSG_CHECKING([privilege revocation user])
712 if test x"$ac_user" != "xnobody"; then
713 AC_MSG_RESULT([$ac_user])
714 AC_DEFINE_UNQUOTED([GPSD_USER], "$ac_user", [GPSD privilege revocation user])
716 AC_MSG_RESULT([nobody])
719 dnl check for privilege revocation group at compile-time
720 AC_ARG_ENABLE(gpsd-group,
721 AC_HELP_STRING([--enable-gpsd-group=groupname],
722 [GPSD privilege revocation group, use if /dev/ttyS0 not found]),
723 [ac_group=$enableval])
724 AC_MSG_CHECKING([privilege revokation group])
725 if test x"$ac_user" != "xnobody"; then
726 AC_MSG_RESULT([$ac_group])
727 AC_DEFINE_UNQUOTED([GPSD_GROUP], "$ac_group", [GPSD privilege revokation group])
730 dnl check for port speed fixed at compile-time
731 AC_ARG_ENABLE(fixed-port-speed,
732 AC_HELP_STRING([--enable-fixed-port-speed=nnn],
733 [compile with fixed serial port speed]),
734 [ac_baud=$enableval], [ac_baud=no])
735 AC_MSG_CHECKING([for fixed port speed])
736 if test x"$ac_baud" != "xno"; then
737 AC_MSG_RESULT([$ac_baud])
738 AC_DEFINE_UNQUOTED([FIXED_PORT_SPEED], $ac_baud, [Fixed port speed])
739 FIXED_PORT_SPEED="-DSPEEDFLAGS=$ac_baud"
744 dnl Check for BlueZ support
745 AC_ARG_ENABLE(bluetooth, AC_HELP_STRING([--enable-bluetooth], [Enable support for Bluetooth GPS devices via BlueZ (experimental)]),
746 [ac_bluetooth=$enableval], [ac_bluetooth=no])
747 AC_MSG_CHECKING([for BlueZ support])
748 if test x"$ac_bluetooth" = x"yes"; then
750 AC_DEFINE(HAVE_BLUEZ,1,[Define if we have Bluez])
751 # Older versions of autotools barf and die on this.
752 #PKG_CHECK_MODULES(BLUEZ, bluez )
753 BLUEZ_CFLAGS=`pkg-config --cflags bluez`
754 BLUEZ_LIBS=`pkg-config --libs bluez`
755 AC_SUBST(BLUEZ_CFLAGS)
763 dnl Manually configure DBUS until we figure out a
764 dnl distro-independent was to check for both libraries and headers
766 AC_HELP_STRING([--enable-dbus],
767 [enable DBUS support]),
768 [ac_dbus=$enableval], [ac_dbus=no])
769 AC_MSG_CHECKING([for DBUS support])
770 if test x"$ac_dbus" = "xyes"; then
772 AC_DEFINE([DBUS_ENABLE], 1, [DBUS support])
773 # Older versions of autotools barf and die on this.
774 #PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.23.4 )
775 DBUS_CFLAGS=`pkg-config --cflags dbus-glib-1`
776 DBUS_LIBS=`pkg-config --libs dbus-1`
777 AC_SUBST(DBUS_CFLAGS)
779 #PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= 0.22 )
780 DBUS_GLIB_LIBS=`pkg-config --libs dbus-glib-1`
781 AC_SUBST(DBUS_GLIB_CFLAGS)
782 AC_SUBST(DBUS_GLIB_LIBS)
787 dnl check for limited maximum clients
788 AC_ARG_ENABLE(max-clients,
789 AC_HELP_STRING([--enable-max-clients=nnn],
790 [compile with limited maximum clients]),
791 [ac_maxclients=$enableval], [ac_maxclients=no])
792 AC_MSG_CHECKING([for limited max clients])
793 if test x"$ac_maxclients" != "xno"; then
794 AC_MSG_RESULT([$ac_maxclients])
795 AC_DEFINE_UNQUOTED([LIMITED_MAX_CLIENTS], $ac_maxclients, [Limited maximum clients])
796 LIMITED_MAX_CLIENTS="-DLIMITED_MAX_CLIENTS=$ac_maxclients"
801 dnl check for max number of GPS devices
802 AC_ARG_ENABLE(max-devices,
803 AC_HELP_STRING([--enable-max-devices=nnn],
804 [compile with maximum allowed devices]),
805 [ac_maxdevices=$enableval], [ac_maxdevices=no])
806 AC_MSG_CHECKING([for max devices])
807 if test x"$ac_maxdevices" != "xno"; then
808 AC_MSG_RESULT([$ac_maxdevices])
809 AC_DEFINE_UNQUOTED([LIMITED_MAX_DEVICES], $ac_maxdevices, [Maximum gps devices])
810 LIMITED_MAX_DEVICES="-DLIMITED_MAX_DEVICES=$ac_maxdevices"
815 dnl allow gpsd to reconfigure gps receiver
816 AC_ARG_ENABLE(reconfigure,
817 AC_HELP_STRING([--disable-reconfigure],
818 [do not allow gpsd to change device settings]),
819 [ac_reconfigure=$enableval], [ac_reconfigure=yes])
820 AC_MSG_CHECKING([if device reconfiguration is allowed])
821 if test x"$ac_reconfigure" != "xno"; then
822 AC_MSG_RESULT([$ac_reconfigure])
823 AC_DEFINE([ALLOW_RECONFIGURE], 1, [Allow gpsd to reconfigure device])
828 dnl allow tools to use control_send method
829 AC_ARG_ENABLE(controlsend,
830 AC_HELP_STRING([--disable-controlsend],
831 [do not allow gpsctl/gpsmon to change device settings]),
832 [ac_controlsend=$enableval], [ac_controlsend=yes])
833 AC_MSG_CHECKING([if control sending is allowed])
834 if test x"$ac_controlsend" != "xno"; then
835 AC_MSG_RESULT([$ac_controlsend])
836 AC_DEFINE([ALLOW_CONTROLSEND], 1, [Allow gpsd to controlsend device])
841 dnl enable raw measurements
843 AC_HELP_STRING([--enable-raw],
844 [enable raw measurement processing]),
845 [ac_raw=$enableval], [ac_raw=yes])
846 AC_MSG_CHECKING([for Raw Measurement support])
847 if test x"$ac_raw" = "xyes"; then
849 AC_DEFINE([RAW_ENABLE], 1, [Raw Measurement support])
854 dnl Automatic check for DBUS.
855 dnl It's broken -- leads to bad compiles on systems with DBUS libraies
856 dnl but no DBUS headers.
858 dnl AC_CHECK_LIB(dbus-1, dbus_bus_get, [true], [false]) # do not update $LIBS
859 dnl if test x"yes" = x"$ac_cv_lib_dbus_1_dbus_bus_get" ; then
860 dnl # Found dbus library, check for required versions and enable it
862 dnl AC_MSG_CHECKING([for DBUS support])
863 dnl PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.23.4,
864 dnl [ac_dbus=yes],[ac_dbus=no])
865 dnl AC_MSG_RESULT([$ac_dbus])
866 dnl AC_SUBST(DBUS_CFLAGS)
867 dnl AC_SUBST(DBUS_LIBS)
869 dnl if test x"ac_dbus" = x"yes" ; then
870 dnl AC_DEFINE([DBUS_ENABLE],1,[Found DBUS libraries])
873 dnl # Check for glib and dbus-glib, used by gpxlogger
874 dnl PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.2.0 )
875 dnl AC_SUBST(GLIB_CFLAGS)
876 dnl AC_SUBST(GLIB_LIBS)
878 dnl PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= 0.22)
879 dnl AC_SUBST(DBUS_GLIB_CFLAGS)
880 dnl AC_SUBST(DBUS_GLIB_LIBS)
882 AM_CONDITIONAL([HAVE_DBUS], [test x"$ac_dbus" = x"yes"])
883 AM_CONDITIONAL([HAVE_BLUEZ], [test x"$ac_bluetooth" = x"yes"])
885 dnl mute logging functions?
886 AC_ARG_ENABLE(squelch,
887 AC_HELP_STRING([--enable-squelch],
888 [squelch gpsd_report and gpsd_hexdump to save cpu]),
889 [ac_squelch=$enableval], [ac_squelch=no])
890 AC_MSG_CHECKING([for disabled logging])
891 if test x"$ac_squelch" = "xyes"; then
893 AC_DEFINE([SQUELCH_ENABLE], 1, [Squelch logging and hexdumps])
899 if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
900 ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
901 (test "X$CXX" != "Xg++"))) ; then
907 AC_ARG_ENABLE(libgpsmm,
908 AC_HELP_STRING([--disable-libgpsmm],
909 [don't build C++ bindings]),
910 [ac_libgpsmm=$enableval], [ac_libgpsmm=$ISCXX])
911 AC_MSG_CHECKING([for C++ support])
912 if test x"$ac_libgpsmm" = "xyes"; then
914 AC_DEFINE([LIBGPSMM_ENABLE], 1, [C++ support])
919 AM_CONDITIONAL([LIBGPSMM_ENABLE], [test x"$ac_libgpsmm" = x"yes"])
923 dnl Check for QtNetwork library and qmake. Both are necessary
924 dnl to build libQgpsmm. We use pkgconfig to check for the library
925 dnl and AC_CHECK_PROGS to search for qmake. As it is possible to
926 dnl install qmake from qt and qt4 in parallel, check for qmake-qt4
927 dnl first as this ensures we're using qmake for qt4.
928 AC_ARG_ENABLE(libQgpsmm,
929 AC_HELP_STRING([--disable-libQgpsmm],
930 [don't build QT bindings]),
931 [ac_libQgpsmm=$enableval], [ac_libQgpsmm=$ISCXX])
932 AC_MSG_CHECKING([for QT support])
933 if test x"$ac_libQgpsmm" = "xyes"; then
934 PKG_CHECK_MODULES(QtNetwork, [QtNetwork >= 4.4], ac_qt="yes", ac_qt="no")
935 if test x"$ac_qt" != "xyes"; then
936 AC_MSG_WARN([QtNetwork library not found. Not including QT support])
938 AM_CONDITIONAL([LIB_Q_GPSMM_ENABLE], false)
941 AC_CHECK_PROGS(QMAKE, [qmake-qt4 qmake], [no])
942 if test x"$QMAKE" != "xno"; then
943 AM_CONDITIONAL([LIB_Q_GPSMM_ENABLE], true)
946 AC_MSG_WARN([qmake not found. Not including QT support])
948 AM_CONDITIONAL([LIB_Q_GPSMM_ENABLE], false)
954 AM_CONDITIONAL([LIB_Q_GPSMM_ENABLE], false)
960 AC_HELP_STRING([--disable-ipv6],
961 [don't build IPv6 support]),
962 [ac_ipv6=$enableval], [ac_ipv6=$ISCXX])
963 AC_MSG_CHECKING([for IPv6 support])
964 if test x"$ac_ipv6" = "xyes"; then
966 AC_DEFINE([IPV6_ENABLE], 1, [IPv6 support])
971 AM_CONDITIONAL([IPV6_ENABLE], [test x"$ac_ipv6" = x"yes"])
973 dnl Test for XSLT processor (xsltproc or xmlto)
974 AC_CHECK_PROG(WITH_XSLTPROC,[xsltproc],[yes],[no])
978 if test "x$WITH_XSLTPROC" = "xyes"; then
979 AC_MSG_CHECKING([whether xsltproc knows about docbook xsl])
980 DOCBOOK_MAN_URI='http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
981 DOCBOOK_HTML_URI='http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl'
982 cat >conftest.xml <<_EOF
983 <refentry id="foo.1">
985 <refentrytitle>foo</refentrytitle>
986 <manvolnum>1</manvolnum>
987 <refmiscinfo class='date'>9 Aug 2004</refmiscinfo>
989 <refnamediv id='name'>
990 <refname>foo</refname>
991 <refpurpose>check man page generation from docbook source</refpurpose>
995 if xsltproc --nonet --noout "$DOCBOOK_MAN_URI" conftest.xml >/dev/null 2>&1; then
997 MANTARGET="$DOCBOOK_MAN_URI"
998 HTMLTARGET="$DOCBOOK_HTML_URI"
999 XMLPROCFLAGS="--nonet"
1000 AC_MSG_RESULT([yes])
1004 rm -f conftest.xml foo.1
1006 if test x"$XMLPROC" = x; then
1007 AC_CHECK_PROG(WITH_XMLTO,[xmlto],[yes],[no])
1008 if test "x$WITH_XMLTO" = "xyes"; then
1011 HTMLTARGET=xhtml-nochunks
1014 AC_MSG_WARN([Neither xsltproc nor xmlto works: I will not build man pages.])
1015 AC_MSG_WARN([To build man pages, install xsltproc/xsltlib or xmlto and run autogen.sh again.])
1018 AM_CONDITIONAL([HAVE_XSLT_PROCESSOR],
1019 [test x"$XMLPROC" != x])
1020 AM_CONDITIONAL([XMLTOSTDOUT], [test x"$XMLPROC" = x"xsltproc"])
1023 AC_SUBST(HTMLTARGET)
1024 AC_SUBST(XMLPROCFLAGS)
1026 dnl Gentoo systems can have a problem with the Python path
1027 if test -e /etc/gentoo-release; then
1028 AC_MSG_WARN([This is a Gentoo system.])
1029 AC_MSG_WARN([Adjust your PYTHONPATH to see library directories under /usr/local/lib])
1032 dnl Output the configuration summary
1034 echo "=========================================="
1035 echo "$PACKAGE $VERSION"
1036 echo "------------------------------------------"
1037 dnl When you add a protocol here, don't forget the null-set check below
1040 echo "Ashtech : $ac_ashtech"
1041 echo "Earthmate : $ac_earthmate"
1042 echo "EverMore : $ac_evermore"
1043 echo "FV-18 : $ac_fv18"
1044 echo "Garmin : $ac_garmin"
1045 echo "Garmin Simple Text : $ac_garmintxt"
1046 echo "iTrax : $ac_itrax"
1047 echo "NMEA : $ac_nmea"
1048 echo "NTRIP : $ac_ntrip"
1049 echo "Navcom : $ac_navcom"
1050 echo "OnCore : $ac_oncore"
1051 echo "RTCM104V2 : $ac_rtcm104v2"
1052 echo "RTCM104V3 : $ac_rtcm104v3"
1053 echo "SiRF : $ac_sirf"
1054 echo "SuperStarII : $ac_superstar2"
1055 echo "Trimble TSIP : $ac_tsip"
1056 echo "Tripmate : $ac_tripmate"
1057 echo "True North : $ac_tnt"
1058 echo "OceanServer : $ac_oceanserver"
1059 echo "UBX : $ac_ubx"
1060 echo "GPSclock : $ac_gpsclock"
1061 echo "AIVDM support : $ac_aivdm"
1062 echo "Timing support : $ac_timing"
1063 echo "Client debugging support: $ac_clientdebug"
1064 echo "MTK-3301 : $ac_mtk3301"
1065 dnl Below this line are non-protocol switches
1066 echo " Daemon Features"
1067 echo " ---------------"
1068 echo "NTP SHM : $ac_ntpshm"
1069 echo "NTP PPS : $ac_pps"
1070 echo -n "PPS input on : " ; case $ac_ppsoncts in yes) echo "CTS" ;; no) echo "DCD" ;; *) echo "Not defined" ;; esac
1071 echo "Fixed port speed : $ac_baud"
1072 echo "Priv-drop user : $ac_user"
1073 echo "Enable shared libraries : $enable_shared"
1074 echo "Enable DBUS support : $ac_dbus"
1075 echo "Enable BlueZ support : $ac_bluetooth"
1076 echo "Enable IPv6 support : $ac_ipv6"
1077 echo "Limited max clients : $ac_maxclients"
1078 echo "Limited max devices : $ac_maxdevices"
1079 echo "Allow device reconfig : $ac_reconfigure"
1080 echo "Allow control send : $ac_controlsend"
1081 echo "Squelch logging/hexdump : $ac_squelch"
1082 echo "Raw Measurements : $ac_raw"
1083 echo "libusb device discovery : $ac_libusb"
1084 echo " Client Features"
1085 echo " ---------------"
1086 echo "Old protocol in libgps : $ac_oldstyle"
1087 echo "Build ncurses programs : $ac_ncurses"
1088 echo "Enable Python support : $ac_python"
1089 echo "Enable C++ support : $ac_libgpsmm"
1090 echo "Enable Qt support : $ac_libQgpsmm"
1091 echo "------------------------------------------"
1094 if test "xdummy" = "xdummy" -a \
1095 x"$ac_earthmate" = "xno" -a \
1096 x"$ac_evermore" = "xno" -a \
1097 x"$ac_fv18" = "xno" -a \
1098 x"$ac_garmin" = "xno" -a \
1099 x"$ac_garmintxt" = "xno" -a \
1100 x"$ac_itrax" = "xno" -a \
1101 x"$ac_navcom" = "xno" -a \
1102 x"$ac_nmea" = "xno" -a \
1103 x"$ac_ntrip" = "xno" -a \
1104 x"$ac_oncore" = "xno" -a \
1105 x"$ac_rtcm104v2" = "xno" -a \
1106 x"$ac_sirf" = "xno" -a \
1107 x"$ac_superstar2" = "xno" -a \
1108 x"$ac_tnt" = "xno" -a \
1109 x"$ac_oceanserver" = "xno" -a \
1110 x"$ac_tripmate" = "xno" -a \
1111 x"$ac_tsip" = "xno" -a \
1112 x"$ac_ubx" = "xno"; then
1113 AC_MSG_ERROR(Can't build gpsd with no protocols enabled)
1115 AC_OUTPUT(Makefile packaging/rpm/gpsd.spec libgps.pc libgpsd.pc
1116 jsongen.py maskaudit.py
1118 [chmod +x jsongen.py maskaudit.py gpscat gpsfake gpsprof xgps valgrind-audit])
1119 echo "Configure finished, type 'make' to build."