forked from GPSBabel/gpsbabel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
403 lines (359 loc) · 10.6 KB
/
configure.in
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
#PACKAGE_RELEASE=
AC_INIT(GPSBabel, 1.5.2, BUG-REPORT-ADDRESS)
DOCVERSION=1.5.2
# YYYYMMDD, please, if beta, i.e. "-beta20060413"
#DOCVERSION=development
# Increase GBBUILD for a new release (why? Where is this ever used?)
# A: it's used by win32/gpsbabel.rc.in which is used by the setup program,
GBBUILD=27
# PACKAGE_RELEASE="-beta20140216"
AC_DEFINE_UNQUOTED(PACKAGE_RELEASE, "$PACKAGE_RELEASE", [Define to the release name of this package.])
AC_SUBST(PACKAGE_RELEASE)
AC_SUBST(DOCVERSION)
GBMAJOR=`echo $PACKAGE_VERSION | (IFS="."; read major minor micro; echo $major)`
GBMINOR=`echo $PACKAGE_VERSION | (IFS="."; read major minor micro; echo $minor)`
GBMICRO=`echo $PACKAGE_VERSION | (IFS="."; read major minor micro; echo $micro)`
AC_SUBST(GBMAJOR)
AC_SUBST(GBMINOR)
AC_SUBST(GBMICRO)
AC_SUBST(GBBUILD)
# AC_CONFIG_SRCDIR([nmea.c])
AC_CONFIG_HEADER([config.h])
dnl Detect the canonical host and target build environment
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_LANG(C++)
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_EXEEXT
AC_SUBST(EXEEXT)
AC_C_BIGENDIAN
# Checks for libraries.
AC_CHECK_LIB([m], [cos])
AC_ARG_WITH(cet,[ --with-cet=(default,all,minimal)],
cet="$withval", cet="default")
if test $GCC = yes; then
CFLAGS="$CFLAGS -Wall"
CXXFLAGS="$CXXFLAGS -Wall"
fi
if test "$cet" = "all"; then
AC_DEFINE(CET_WANTED, 1, [1 for all character sets])
fi
if test "$cet" = "default"; then
AC_DEFINE(CET_WANTED, 0, [0 for most-used character sets])
fi
AC_MSG_CHECKING(whether to support shapefiles)
AC_ARG_ENABLE(shapefile,
[ --enable-shapefile=[(yes)|no]],
[ enable_shapefile="$enableval"],[enable_shapefile="yes"])
if test "$enable_shapefile" != "no" ; then
AC_DEFINE(SHAPELIB_ENABLED, 1, [1 to enable shapefile support])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(whether to support Palm/OS pdb formats)
AC_ARG_ENABLE(pdb,
[ --enable-pdb=[(yes)|no]],
[ enable_pdb="$enableval"],[enable_pdb="yes"])
if test "$enable_pdb" != "no" ; then
AC_DEFINE(PDBFMTS_ENABLED, 1, [1 to enable Palm PDB support])
AC_MSG_RESULT(yes)
else
PALM_DB_CMT=#
AC_MSG_RESULT(no)
fi
AC_SUBST(PALM_DB_CMT)
AC_MSG_CHECKING(whether to support csv formats)
AC_ARG_ENABLE(csv,
[ --enable-csv=[(yes)|no]],
[ enable_csv="$enableval"],[enable_csv="yes"])
if test "$enable_csv" != "no" ; then
AC_DEFINE(CSVFMTS_ENABLED, 1, [1 to enable the CSV formats support])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(whether to support maximum number of formats)
AC_ARG_ENABLE(most,
[ --enable-most=[(yes)|no]],
[ enable_most="$enableval"],[enable_most="yes"])
if test "$enable_most" != "no" ; then
AC_MSG_RESULT(yes)
AC_DEFINE(MAXIMAL_ENABLED, 1, [1 to enable as many formats as possible])
FMTS='$(ALL_FMTS)'
else
AC_MSG_RESULT(no)
FMTS='$(MINIMAL_FMTS)'
fi
AC_SUBST(FMTS)
AC_MSG_CHECKING(whether to support filters)
AC_ARG_ENABLE(filters,
[ --enable-filters=[(yes)|no]],
[ enable_filters="$enableval"],[enable_filters="yes"])
if test "$enable_filters" != "no" ; then
AC_DEFINE(FILTERS_ENABLED, 1, [1 to enable all the filters.])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(whether to support zlib)
AC_ARG_WITH(zlib, [ --with-zlib=[(included)|system|no]])
case $with_zlib in
"system")
AC_CHECK_LIB([z], [gzopen])
;;
"no")
AC_DEFINE(ZLIB_INHIBITED, 1, [1 to inhibit our use of zlib.])
AC_MSG_RESULT(no)
;;
*) ZLIB="\$(ZLIB)"
AC_MSG_RESULT(using included version);;
esac
case "$target" in
*-*-mingw32*)
FILEINFO=fileinfo.o
if test "$CC" = gcc ; then
RC=windres
else
RC=`echo "$CC" | sed -e 's/gcc$/windres/'`
fi
;;
*)
RC=false
;;
esac
AC_SUBST(FILEINFO)
AC_SUBST(RC)
# On RHEL/OEL/SL/CENTOS/FEDORA qmake is from Qt3, and qmake-qt4 is from Qt4.
# If qmake-qt4 isn't found look for the standard name qmake and assume it is
# from a useful version Qt.
AC_CHECK_TOOLS(QMAKE, [qmake-qt5 qmake-qt4 qmake], "no")
AC_CHECK_TOOLS(LUPDATE, [lupdate-qt5 lupdate-qt4 lupdate])
AC_CHECK_TOOLS(LRELEASE, [lrelease-qt5 lrelease-qt4 lrelease])
if test "$QMAKE" = no ; then
AC_MSG_ERROR([Qt4 or Qt5 is required, but neither was found]);
fi
# guess the name of the Qt Core library.
QT_LIBVER=$($QMAKE -query -query QT_VERSION | sed -e 's/\..*//')
if test "$QT_LIBVER" -ge 5 ; then
QT_LIBS="-L$($QMAKE -query QT_INSTALL_LIBS) -lQt${QT_LIBVER}Core"
else
QT_LIBS="-L$($QMAKE -query QT_INSTALL_LIBS) -lQtCore"
fi
QT_INC=$($QMAKE -query QT_INSTALL_HEADERS)
QT_INC_OPT="-I"
QT_SYSINC_OPT="-isystem"
case "$target" in
*-*-cygwin* | *-*-mingw32*)
GBSER=gbser_win.o
if test "$with_libusb" = no ; then
AC_MSG_RESULT(USB skipped)
OSJEEPS=jeeps/gpsusbstub.o
else
OSJEEPS=jeeps/gpsusbwin.o
USB_LIBS="-lsetupapi -lole32 -lws2_32 -luuid"
AC_MSG_CHECKING(for Windows DDK)
old_LIBS="$LIBS"
LIBS="$LIBS -lhid"
AC_TRY_LINK([#include <windows.h>]
[#include <hidsdi.h>],
[HANDLE HidDeviceObject;
HIDD_ATTRIBUTES Attributes;
PHIDP_PREPARSED_DATA HidPPD;
HidD_GetAttributes(HidDeviceObject, &Attributes);
HidD_GetPreparsedData(HidDeviceObject, &HidPPD);],
[AC_MSG_RESULT(yes)]
[AC_DEFINE(HAVE_WDK, 1, [Defined if you have Windows DDK])]
[USB_LIBS=${USB_LIBS}" -lhid"],
[AC_MSG_RESULT(no)]
)
LIBS="$old_LIBS"
fi
;;
*-*-darwin*)
GBSER=gbser_posix.o
OSJEEPS="jeeps/gpslibusb.o \
mac/libusb/darwin.o \
mac/libusb/descriptors.o \
mac/libusb/error.o \
mac/libusb/usb.o "
USB_LIBS="-framework IOKit -framework CoreFoundation"
AC_DEFINE(HAVE_LIBUSB, 1)
# On Mac, use frameworks for includes and library files.
# Macports uses a non-standard build of Qt with an added
# QT_INSTALL_FRAMEWORKS flag, so look for thier custom
# version first. That will fail on 'normal' Qt so fall
# back to QT_INSTALL_LIBS.
QT_FW_OR_LIBS=$($QMAKE -query QT_INSTALL_FRAMEWORKS)
if test $QT_FW_OR_LIBS = "**Unknown**" ; then
QT_FW_OR_LIBS=$($QMAKE -query QT_INSTALL_LIBS)
fi
QT_LIBS="-F$QT_FW_OR_LIBS -framework QtCore"
QT_INC="$QT_FW_OR_LIBS"
QT_INC_OPT="-F"
QT_SYSINC_OPT="-iframework"
;;
*-*-freebsd*)
GBSER=gbser_posix.o
AC_MSG_CHECKING(for libusb)
if test "$with_libusb" = no ; then
AC_MSG_RESULT(check not done)
OSJEEPS=jeeps/gpsusbstub.o
else
OLDFLAGS=$LDFLAGS
OCFLAGS=$CFLAGS
LDFLAGS="$LDFLAGS -lusb"
CFLAGS="$OCFLAGS"
AC_CHECK_LIB([usb], [usb_interrupt_read],
AC_DEFINE(HAVE_LIBUSB, 1, [Defined if you have libusb])
[USB_CFLAGS=""]
[USB_LIBS="-lusb"]
# ,[AC_MSG_ERROR([libusb is needed])]
)
OSJEEPS=jeeps/gpslibusb.o
CFLAGS="$OCFLAGS"
fi
;;
*)
GBSER=gbser_posix.o
AC_MSG_CHECKING(for libusb)
if test "$with_libusb" = no ; then
AC_MSG_RESULT(check not done)
OSJEEPS=jeeps/gpsusbstub.o
else
AC_CHECK_PROG(LIBUSBCONFIG, libusb-config, true, false)
if test "$LIBUSBCONFIG" = true; then
OLDFLAGS=$LDFLAGS
OCFLAGS=$CFLAGS
LDFLAGS="$LDFLAGS `libusb-config --libs`"
CFLAGS="$OCFLAGS `libusb-config --cflags`"
AC_CHECK_LIB([usb], [usb_interrupt_read],
AC_DEFINE(HAVE_LIBUSB, 1, [Defined if you have libusb])
[USB_CFLAGS="`libusb-config --cflags`"]
[USB_LIBS="`libusb-config --libs`"]
# ,[AC_MSG_ERROR([libusb >= 0.1.8 is needed])]
)
OSJEEPS=jeeps/gpslibusb.o
CFLAGS="$OCFLAGS"
# LIBS="$LIBS `libusb-config --libs`"
else
OSJEEPS=jeeps/gpsusbstub.o
fi
fi
;;
esac
AC_SUBST(USB_LIBS)
AC_SUBST(USB_CFLAGS)
AC_SUBST(OSJEEPS)
AC_SUBST(GBSER)
AC_SUBST(ZLIB)
dnl Linux HID support
case "$target" in
*-linux-*)
AC_MSG_CHECKING(for Linux HID interface)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/hiddev.h>
#include <linux/hidraw.h>
void f(void) {
struct hidraw_devinfo info;
struct hiddev_field_info finfo;
struct hiddev_usage_ref_multi urefm;
struct hiddev_report_info rinfo;
ioctl(0, HIDIOCGRAWINFO, &info);
ioctl(0, HIDIOCGFIELDINFO, &finfo);
ioctl(0, HIDIOCSUSAGES, &urefm);
ioctl(0, HIDIOCSREPORT, &rinfo);
}])],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LINUX_HID, 1, [Defined if you have Linux HID]),
AC_MSG_RESULT(no))
;;
esac
case "$target" in
*-*-darwin*)
;;
*)
AC_MSG_CHECKING(for reduce relocations)
OCPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$QT_INC"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <QtCore/QString>
void f(void) {
}])],
[AC_MSG_RESULT(no)],
[OCXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -fPIC"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <QtCore/QString>
void f(void) {
}])],
[AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -fPIC"],
[AC_MSG_RESULT(unknown)
CXXFLAGS="$OCXXFLAGS"]
)]
)
CPPFLAGS="$OCPPFLAGS"
;;
esac
AC_MSG_CHECKING(for random stuff to make you feel better)
AC_MSG_RESULT(failed)
AC_MSG_CHECKING(for efence)
AC_ARG_ENABLE(efence,
[ --enable-efence=[yes|(no)]],
[ if test "$enable_efence" != "no" ; then
EFENCE_LIB=-lefence
GPSBABEL_DEBUG=gpsbabel-debug
INSTALL_DEBUG=install-debug
fi])
AC_SUBST(EFENCE_LIB)
AC_SUBST(GPSBABEL_DEBUG)
AC_SUBST(INSTALL_DEBUG)
AC_MSG_RESULT($EFENCE_LIB)
AC_MSG_CHECKING(for docdir)
AC_ARG_WITH(doc,[ --with-doc=DIR Path where the documentation will be stored.],
DOCDIR="$withval", DOCDIR="../babelweb/")
AC_SUBST(DOCDIR)
# Checks for header files.
# AC_HEADER_STDC
# AC_CHECK_HEADERS([fcntl.h inttypes.h libintl.h limits.h malloc.h stddef.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/time.h termios.h unistd.h])
# set up HAVE_STDARG_H for zlib.
AC_CHECK_HEADERS([stdarg.h])
# Checks for typedefs, structures, and compiler characteristics.
# AC_C_CONST
# AC_C_INLINE
# AC_TYPE_OFF_T
# AC_TYPE_SIZE_T
# AC_HEADER_TIME
# AC_STRUCT_TM
# AC_STRUCT_TIMEZONE
# Checks for library functions.
# AC_FUNC_MALLOC
# AC_FUNC_MEMCMP
# AC_FUNC_MKTIME
# AC_FUNC_REALLOC
# AC_FUNC_SELECT_ARGTYPES
# AC_FUNC_STRFTIME
# AC_FUNC_STRTOD
# AC_FUNC_VPRINTF
# AC_CHECK_FUNCS([atexit floor localtime_r memmove memset pow select sqrt strchr strcspn strdup strerror strncasecmp strrchr strspn strstr strtol strtoul])
AC_CHECK_FUNCS([nanosleep sleep uname glob])
#
# There's probably some more "autoconfish" way to do this.
#
AC_SUBST(QT_INC)
AC_SUBST(QT_INC_OPT)
AC_SUBST(QT_SYSINC_OPT)
AC_SUBST(QT_LIBS)
AC_CONFIG_FILES([Makefile gbversion.h gui/setup.iss xmldoc/makedoc tools/mkcapabilities win32/gpsbabel.rc jeeps/Makefile shapelib/Makefile zlib/empty])
AC_CONFIG_FILES([gui/makelinuxdist.sh], [chmod +x gui/makelinuxdist.sh])
AC_OUTPUT