summaryrefslogtreecommitdiff
path: root/configure.ac
blob: ea4d8e1a55a7f5c7ec6f3d9d72770ec1aad82a5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
AC_INIT
AM_INIT_AUTOMAKE(gpsd, 2.20)
AC_PREFIX_PROGRAM(gcc)
AM_CONFIG_HEADER(config.h)
AC_LANG([C])

AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_C_BIGENDIAN
AC_FUNC_ALLOCA

if eval "test x$GCC = xyes"; then
	CFLAGS="$CFLAGS -Wall -Wcast-align -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wreturn-type -W"
	dnl -Wcast-qual
fi

AC_CHECK_HEADERS(termios.h sys/termios.h sys/select.h strings.h sys/filio.h sys/time.h X11/xpm.h xpm.h getopt.h sys/modem.h sys/ipc.h sys/shm.h)

AC_HEADER_TIME
AC_STRUCT_TIMEZONE

AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
        AC_TRY_COMPILE([
#include <time.h>
        ], [
                timezone = 1;
        ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
if test $ac_cv_var_timezone = yes; then
        AC_DEFINE(HAVE_TIMEZONE, [], [Have timezone variable])
else
        AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
                AC_TRY_COMPILE([
#include <time.h>
                        ], [
                        struct tm tm;
                        tm.tm_gmtoff = 1;
                        ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no
))
        if test $ac_cv_struct_tm_gmtoff = yes; then
                AC_DEFINE(HAVE_TM_GMTOFF, [], [struct tm has tm_gmtoff])
        else
                AC_ERROR(unable to find a way to determine timezone)
        fi
fi            
AC_CACHE_CHECK(for daylight external, mb_cv_var_daylight,
[  AC_TRY_LINK([#include <time.h>], [return (int)daylight;],
      mb_cv_var_daylight=yes,
      mb_cv_var_daylight=no)
])
if test $mb_cv_var_daylight = yes; then
   AC_DEFINE([HAVE_DAYLIGHT], 1,
           [Define if you have the external `daylight' variable.])
fi

AC_CHECK_LIB(nsl, gethostbyname, LIBNSL="-lnsl")
AC_SUBST(LIBNSL)
AC_CHECK_LIB(socket, socket, LIBSOCKET="-lsocket")
AC_SUBST(LIBSOCKET)
AC_CHECK_LIB(m, rint, LIBM="-lm")
AC_SUBST(LIBM)
AC_CHECK_LIB(c, open, LIBC="-lc")
AC_SUBST(LIBC)

AH_VERBATIM([_GNU_SOURCE],
          [/* Macro for declaring function arguments unused. */
#if defined(__GNUC__)
#  define UNUSED __attribute__((unused)) /* Flag variable as unused */
#else /* not __GNUC__ */
#  define UNUSED
#endif])

dnl Check for X libraries
AC_PATH_XTRA
LIBS="$LIBS $X_EXTRA_LIBS"
CFLAGS="$CFLAGS $X_CFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
LDFLAGS="$LDFLAGS $X_LIBS"
AC_SUBST(X_LIBS)
AC_SUBST(X11_LIBS)
AC_SUBST(X_PRE_LIBS)

dnl Check for some auxiliary X libraries we'll need
AC_CHECK_LIB(Xt, XtToolkitInitialize, XT_LIBS="-lXt",,
	${X_PRE_LIBS} ${X11_LIBS})
AC_SUBST(XT_LIBS)
AC_CHECK_LIB(Xaw, XawInitializeWidgetSet, XAW_LIBS="-lXaw",,
	${X_PRE_LIBS} ${X11_LIBS})
AC_SUBST(XAW_LIBS)
AC_CHECK_LIB(Xext, XShapeQueryVersion, XEXT_LIBS="-lXext",,
	${X_PRE_LIBS} ${X11_LIBS})
AC_SUBST(XEXT_LIBS)
AC_CHECK_LIB(Xpm, XpmCreatePixmapFromXpmImage,
	XPM_LIBS="-lXpm"
	AC_DEFINE([HAVE_XPM],1,[Xpm available]),,${X_PRE_LIBS} ${X11_LIBS})
AC_SUBST(XPM_LIBS)

dnl Check for Motif widget libraries
XM_LIBS=""
XP_LIBS=""
if test "$motif_includes" != "no" && test "$motif_libraries" != "no"
then
dnl Motif 2.1 wants `-lXp' (X11R6.3 print server)
AC_CHECK_LIB(Xp, XpSelectInput,
	XP_LIBS="-lXp"
	AC_DEFINE([HAVE_XP],1,[Xp available]),,
	${X_PRE_LIBS} ${XPM_LIBS} ${XEXT_LIBS} ${XT_LIBS} ${XEXT_LIBS} ${X11_LIBS} ${LIBGEN})
dnl
AC_CHECK_LIB(Xm, XmCreateOptionMenu, 
	XM_LIBS="-lXm"
	AC_DEFINE([HAVE_MOTIF],1,[Motif available]),,
	${X_PRE_LIBS} ${XP_LIBS} ${XPM_LIBS} ${XEXT_LIBS} ${XT_LIBS} ${XEXT_LIBS} ${X11_LIBS} ${LIBGEN})
fi
AC_SUBST(XP_LIBS)
AC_SUBST(XM_LIBS)
AM_CONDITIONAL([HAVE_MOTIF], [test "$XM_LIBS" != ""])

dnl check for SiRF-II support
AC_ARG_ENABLE(sirfII,
  AC_HELP_STRING([--disable-sirfII],
                 [disable SiRF-II chipset support]),
  [ac_sirfII=$enableval], [ac_sirfII=yes])
AC_MSG_CHECKING([for SiRF-II support])
if test x"$ac_sirfII" = "xyes"; then
    AC_MSG_RESULT([yes])
	AC_DEFINE([SIRFII_ENABLE], 1, [SiRF-II chipset support])
else
  AC_MSG_RESULT([no])
fi

dnl check for FV-18 support
AC_ARG_ENABLE(fv18,
  AC_HELP_STRING([--disable-fv18],
                 [disable San Jose Navigation FV-18 support]),
  [ac_fv18=$enableval], [ac_fv18=yes])
AC_MSG_CHECKING([for FV-18 support])
if test x"$ac_fv18" = "xyes"; then
    AC_MSG_RESULT([yes])
	AC_DEFINE([FV18_ENABLE], 1, [San Jose Navigation FV-18 support])
else
  AC_MSG_RESULT([no])
fi

dnl check for Tripmate support
AC_ARG_ENABLE(tripmate,
  AC_HELP_STRING([--disable-tripmate],
                 [disable DeLorme TripMate support]),
  [ac_tripmate=$enableval], [ac_tripmate=yes])
AC_MSG_CHECKING([for Tripmate support])
if test x"$ac_tripmate" = "xyes"; then
    AC_MSG_RESULT([yes])
	AC_DEFINE([TRIPMATE_ENABLE], 1, [DeLorme TripMate support])
else
  AC_MSG_RESULT([no])
fi

dnl check for EarthMate support
AC_ARG_ENABLE(earthmate,
  AC_HELP_STRING([--disable-earthmate],
                 [disable DeLorme EarthMate Zodiac support]),
  [ac_earthmate=$enableval], [ac_earthmate=yes])
AC_MSG_CHECKING([for EarthMate support])
if test x"$ac_earthmate" = "xyes"; then
    AC_MSG_RESULT([yes])
	AC_DEFINE([EARTHMATE_ENABLE], 1, [DeLorme EarthMate Zodiac support])
else
  AC_MSG_RESULT([no])
fi

dnl check for Garmin support
AC_ARG_ENABLE(garmin,
  AC_HELP_STRING([--disable-garmin],
                 [disable Garmin kernel driver support]),
  [ac_garmin=$enableval], [ac_garmin=yes])
AC_MSG_CHECKING([for Garmin support])
if test x"$ac_garmin" = "xyes"; then
    AC_MSG_RESULT([yes])
	AC_DEFINE([GARMIN_ENABLE], 1, [Garmin support])
else
  AC_MSG_RESULT([no])
fi

dnl check for profiling support
AC_ARG_ENABLE(profiling,
  AC_HELP_STRING([--enable-profiling],
                 [enable profiling support]),
  [ac_profiling=$enableval], [ac_profiling=no])
AC_MSG_CHECKING([for profiling support])
if test x"$ac_profiling" = "xyes"; then
    AC_MSG_RESULT([yes])
	AC_DEFINE([PROFILING], 1, [profiling support])
else
  AC_MSG_RESULT([no])
fi

dnl check for NTP time hinting support
AC_ARG_ENABLE(ntpshm,
  AC_HELP_STRING([--disable-ntpshm],
                 [disable NTP time hinting support]),
  [ac_ntpshm=$enableval], [ac_ntpshm=yes])
AC_MSG_CHECKING([for NTP time hinting support])
if test x"$ac_ntpshm" = "xyes"; then
    AC_MSG_RESULT([yes])
	AC_DEFINE([NTPSHM_ENABLE], 1, [NTP time hinting support])
else
  AC_MSG_RESULT([no])
fi

AC_OUTPUT(Makefile gpsd.spec)

dnl Output the configuration summary
echo ""
echo "=========================================="
echo "$PACKAGE $VERSION"
echo "------------------------------------------"
echo "SiRF-II                 : $ac_sirfII"
echo "Tripmate                : $ac_tripmate"
echo "Earthmate               : $ac_earthmate"
echo "Garmin                  : $ac_garmin"
echo "NTP SHM                 : $ac_ntpshm"
echo "Enable shared libraries : $enable_shared"
echo "------------------------------------------"
echo "Configure finished, type 'make' to build."