You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure.in 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ(2.59)
  4. #PACKAGE_RELEASE=
  5. AC_INIT(GPSBabel, 1.5.4, BUG-REPORT-ADDRESS)
  6. DOCVERSION=1.5.4
  7. # YYYYMMDD, please, if beta, i.e. "-beta20060413"
  8. #DOCVERSION=development
  9. # Increase GBBUILD for a new release (why? Where is this ever used?)
  10. # A: it's used by win32/gpsbabel.rc.in which is used by the setup program,
  11. GBBUILD=28
  12. # PACKAGE_RELEASE="-beta20140216"
  13. AC_DEFINE_UNQUOTED(PACKAGE_RELEASE, "$PACKAGE_RELEASE", [Define to the release name of this package.])
  14. AC_SUBST(PACKAGE_RELEASE)
  15. AC_SUBST(DOCVERSION)
  16. GBMAJOR=`echo $PACKAGE_VERSION | (IFS="."; read major minor micro; echo $major)`
  17. GBMINOR=`echo $PACKAGE_VERSION | (IFS="."; read major minor micro; echo $minor)`
  18. GBMICRO=`echo $PACKAGE_VERSION | (IFS="."; read major minor micro; echo $micro)`
  19. AC_SUBST(GBMAJOR)
  20. AC_SUBST(GBMINOR)
  21. AC_SUBST(GBMICRO)
  22. AC_SUBST(GBBUILD)
  23. # AC_CONFIG_SRCDIR([nmea.c])
  24. AC_CONFIG_HEADER([config.h])
  25. dnl Detect the canonical host and target build environment
  26. AC_CANONICAL_HOST
  27. AC_CANONICAL_TARGET
  28. # Checks for programs.
  29. AC_PROG_CC
  30. AC_PROG_CXX
  31. m4_include([m4/ax_cxx_compile_stdcxx_11.m4])
  32. AX_CXX_COMPILE_STDCXX_11(, mandatory)
  33. AC_LANG(C++)
  34. AC_PROG_INSTALL
  35. AC_PROG_MAKE_SET
  36. AC_EXEEXT
  37. AC_SUBST(EXEEXT)
  38. AC_C_BIGENDIAN
  39. # Checks for libraries.
  40. AC_CHECK_LIB([m], [cos])
  41. AC_ARG_WITH(cet,[ --with-cet=(default,all,minimal)],
  42. cet="$withval", cet="default")
  43. if test $GCC = yes; then
  44. CFLAGS="$CFLAGS -Wall"
  45. CXXFLAGS="$CXXFLAGS -Wall"
  46. fi
  47. if test "$cet" = "all"; then
  48. AC_DEFINE(CET_WANTED, 1, [1 for all character sets])
  49. fi
  50. if test "$cet" = "default"; then
  51. AC_DEFINE(CET_WANTED, 0, [0 for most-used character sets])
  52. fi
  53. AC_MSG_CHECKING(whether to support shapefiles)
  54. AC_ARG_ENABLE(shapefile,
  55. [ --enable-shapefile=[(yes)|no]],
  56. [ enable_shapefile="$enableval"],[enable_shapefile="yes"])
  57. if test "$enable_shapefile" != "no" ; then
  58. AC_DEFINE(SHAPELIB_ENABLED, 1, [1 to enable shapefile support])
  59. AC_MSG_RESULT(yes)
  60. else
  61. AC_MSG_RESULT(no)
  62. fi
  63. AC_MSG_CHECKING(whether to support Palm/OS pdb formats)
  64. AC_ARG_ENABLE(pdb,
  65. [ --enable-pdb=[(yes)|no]],
  66. [ enable_pdb="$enableval"],[enable_pdb="yes"])
  67. if test "$enable_pdb" != "no" ; then
  68. AC_DEFINE(PDBFMTS_ENABLED, 1, [1 to enable Palm PDB support])
  69. AC_MSG_RESULT(yes)
  70. else
  71. PALM_DB_CMT=#
  72. AC_MSG_RESULT(no)
  73. fi
  74. AC_SUBST(PALM_DB_CMT)
  75. AC_MSG_CHECKING(whether to support csv formats)
  76. AC_ARG_ENABLE(csv,
  77. [ --enable-csv=[(yes)|no]],
  78. [ enable_csv="$enableval"],[enable_csv="yes"])
  79. if test "$enable_csv" != "no" ; then
  80. AC_DEFINE(CSVFMTS_ENABLED, 1, [1 to enable the CSV formats support])
  81. AC_MSG_RESULT(yes)
  82. else
  83. AC_MSG_RESULT(no)
  84. fi
  85. AC_MSG_CHECKING(whether to support maximum number of formats)
  86. AC_ARG_ENABLE(most,
  87. [ --enable-most=[(yes)|no]],
  88. [ enable_most="$enableval"],[enable_most="yes"])
  89. if test "$enable_most" != "no" ; then
  90. AC_MSG_RESULT(yes)
  91. AC_DEFINE(MAXIMAL_ENABLED, 1, [1 to enable as many formats as possible])
  92. FMTS='$(ALL_FMTS)'
  93. else
  94. AC_MSG_RESULT(no)
  95. FMTS='$(MINIMAL_FMTS)'
  96. fi
  97. AC_SUBST(FMTS)
  98. AC_MSG_CHECKING(whether to support filters)
  99. AC_ARG_ENABLE(filters,
  100. [ --enable-filters=[(yes)|no]],
  101. [ enable_filters="$enableval"],[enable_filters="yes"])
  102. if test "$enable_filters" != "no" ; then
  103. AC_DEFINE(FILTERS_ENABLED, 1, [1 to enable all the filters.])
  104. AC_MSG_RESULT(yes)
  105. else
  106. AC_MSG_RESULT(no)
  107. fi
  108. AC_MSG_CHECKING(whether to support zlib)
  109. AC_ARG_WITH(zlib, [ --with-zlib=[(included)|system|no]])
  110. case $with_zlib in
  111. "system")
  112. AC_CHECK_LIB([z], [gzopen])
  113. ;;
  114. "no")
  115. AC_DEFINE(ZLIB_INHIBITED, 1, [1 to inhibit our use of zlib.])
  116. AC_MSG_RESULT(no)
  117. ;;
  118. *) ZLIB="\$(ZLIB)"
  119. AC_MSG_RESULT(using included version);;
  120. esac
  121. case "$target" in
  122. *-*-mingw32*)
  123. FILEINFO=fileinfo.o
  124. if test "$CC" = gcc ; then
  125. RC=windres
  126. else
  127. RC=`echo "$CC" | sed -e 's/gcc$/windres/'`
  128. fi
  129. ;;
  130. *)
  131. RC=false
  132. ;;
  133. esac
  134. AC_SUBST(FILEINFO)
  135. AC_SUBST(RC)
  136. # On RHEL/OEL/SL/CENTOS/FEDORA qmake is from Qt3, and qmake-qt4 is from Qt4.
  137. # If qmake-qt4 isn't found look for the standard name qmake and assume it is
  138. # from a useful version Qt.
  139. # On Ubuntu qmake-qt4 exists, but qmake-qt5 does not.
  140. # If we select qmake-qt4 this will defeat qtchooser.
  141. # we no longer support qt4.
  142. AC_CHECK_TOOLS(QMAKE, [qmake-qt5 qmake], "no")
  143. AC_CHECK_TOOLS(LUPDATE, [lupdate-qt5 lupdate])
  144. AC_CHECK_TOOLS(LRELEASE, [lrelease-qt5 lrelease])
  145. if test "$QMAKE" = no ; then
  146. AC_MSG_ERROR([Qt5.2 or higher is required, but was not found]);
  147. fi
  148. # guess the name of the Qt Core library.
  149. QT_LIBVER=$($QMAKE -query -query QT_VERSION | sed -e 's/\..*//')
  150. if test "$QT_LIBVER" -ge 5 ; then
  151. QT_LIBS="-L$($QMAKE -query QT_INSTALL_LIBS) -lQt${QT_LIBVER}Core"
  152. else
  153. QT_LIBS="-L$($QMAKE -query QT_INSTALL_LIBS) -lQtCore"
  154. fi
  155. QT_INC=$($QMAKE -query QT_INSTALL_HEADERS)
  156. QT_INC_OPT="-I"
  157. QT_SYSINC_OPT="-isystem"
  158. case "$target" in
  159. *-*-cygwin* | *-*-mingw32*)
  160. GBSER=gbser_win.o
  161. if test "$with_libusb" = no ; then
  162. AC_MSG_RESULT(USB skipped)
  163. OSJEEPS=jeeps/gpsusbstub.o
  164. else
  165. OSJEEPS=jeeps/gpsusbwin.o
  166. USB_LIBS="-lsetupapi -lole32 -lws2_32 -luuid"
  167. AC_MSG_CHECKING(for Windows DDK)
  168. old_LIBS="$LIBS"
  169. LIBS="$LIBS -lhid"
  170. AC_TRY_LINK([#include <windows.h>]
  171. [#include <hidsdi.h>],
  172. [HANDLE HidDeviceObject;
  173. HIDD_ATTRIBUTES Attributes;
  174. PHIDP_PREPARSED_DATA HidPPD;
  175. HidD_GetAttributes(HidDeviceObject, &Attributes);
  176. HidD_GetPreparsedData(HidDeviceObject, &HidPPD);],
  177. [AC_MSG_RESULT(yes)]
  178. [AC_DEFINE(HAVE_WDK, 1, [Defined if you have Windows DDK])]
  179. [USB_LIBS=${USB_LIBS}" -lhid"],
  180. [AC_MSG_RESULT(no)]
  181. )
  182. LIBS="$old_LIBS"
  183. fi
  184. ;;
  185. *-*-darwin*)
  186. GBSER=gbser_posix.o
  187. OSJEEPS="jeeps/gpslibusb.o \
  188. mac/libusb/darwin.o \
  189. mac/libusb/descriptors.o \
  190. mac/libusb/error.o \
  191. mac/libusb/usb.o "
  192. USB_LIBS="-framework IOKit -framework CoreFoundation"
  193. AC_DEFINE(HAVE_LIBUSB, 1)
  194. # On Mac, use frameworks for includes and library files.
  195. # Macports uses a non-standard build of Qt with an added
  196. # QT_INSTALL_FRAMEWORKS flag, so look for thier custom
  197. # version first. That will fail on 'normal' Qt so fall
  198. # back to QT_INSTALL_LIBS.
  199. QT_FW_OR_LIBS=$($QMAKE -query QT_INSTALL_FRAMEWORKS)
  200. if test $QT_FW_OR_LIBS = "**Unknown**" ; then
  201. QT_FW_OR_LIBS=$($QMAKE -query QT_INSTALL_LIBS)
  202. fi
  203. QT_LIBS="-Wl,-rpath, $QT_FW_OR_LIBS -F$QT_FW_OR_LIBS -framework QtCore"
  204. QT_INC="$QT_FW_OR_LIBS"
  205. QT_INC_OPT="-F"
  206. QT_SYSINC_OPT="-iframework"
  207. ;;
  208. *-*-freebsd*)
  209. GBSER=gbser_posix.o
  210. AC_MSG_CHECKING(for libusb)
  211. if test "$with_libusb" = no ; then
  212. AC_MSG_RESULT(check not done)
  213. OSJEEPS=jeeps/gpsusbstub.o
  214. else
  215. OLDFLAGS=$LDFLAGS
  216. OCFLAGS=$CFLAGS
  217. LDFLAGS="$LDFLAGS -lusb"
  218. CFLAGS="$OCFLAGS"
  219. AC_CHECK_LIB([usb], [usb_interrupt_read],
  220. AC_DEFINE(HAVE_LIBUSB, 1, [Defined if you have libusb])
  221. [USB_CFLAGS=""]
  222. [USB_LIBS="-lusb"]
  223. # ,[AC_MSG_ERROR([libusb is needed])]
  224. )
  225. OSJEEPS=jeeps/gpslibusb.o
  226. CFLAGS="$OCFLAGS"
  227. fi
  228. ;;
  229. *)
  230. GBSER=gbser_posix.o
  231. AC_MSG_CHECKING(for libusb)
  232. if test "$with_libusb" = no ; then
  233. AC_MSG_RESULT(check not done)
  234. OSJEEPS=jeeps/gpsusbstub.o
  235. else
  236. AC_CHECK_PROG(LIBUSBCONFIG, libusb-config, true, false)
  237. if test "$LIBUSBCONFIG" = true; then
  238. OLDFLAGS=$LDFLAGS
  239. OCFLAGS=$CFLAGS
  240. LDFLAGS="$LDFLAGS `libusb-config --libs`"
  241. CFLAGS="$OCFLAGS `libusb-config --cflags`"
  242. AC_CHECK_LIB([usb], [usb_interrupt_read],
  243. AC_DEFINE(HAVE_LIBUSB, 1, [Defined if you have libusb])
  244. [USB_CFLAGS="`libusb-config --cflags`"]
  245. [USB_LIBS="`libusb-config --libs`"]
  246. # ,[AC_MSG_ERROR([libusb >= 0.1.8 is needed])]
  247. )
  248. OSJEEPS=jeeps/gpslibusb.o
  249. CFLAGS="$OCFLAGS"
  250. # LIBS="$LIBS `libusb-config --libs`"
  251. else
  252. OSJEEPS=jeeps/gpsusbstub.o
  253. fi
  254. fi
  255. ;;
  256. esac
  257. AC_SUBST(USB_LIBS)
  258. AC_SUBST(USB_CFLAGS)
  259. AC_SUBST(OSJEEPS)
  260. AC_SUBST(GBSER)
  261. AC_SUBST(ZLIB)
  262. dnl Linux HID support
  263. case "$target" in
  264. *-linux-*)
  265. AC_MSG_CHECKING(for Linux HID interface)
  266. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  267. #include <sys/ioctl.h>
  268. #include <linux/types.h>
  269. #include <linux/hiddev.h>
  270. #include <linux/hidraw.h>
  271. void f(void) {
  272. struct hidraw_devinfo info;
  273. struct hiddev_field_info finfo;
  274. struct hiddev_usage_ref_multi urefm;
  275. struct hiddev_report_info rinfo;
  276. ioctl(0, HIDIOCGRAWINFO, &info);
  277. ioctl(0, HIDIOCGFIELDINFO, &finfo);
  278. ioctl(0, HIDIOCSUSAGES, &urefm);
  279. ioctl(0, HIDIOCSREPORT, &rinfo);
  280. }])],
  281. AC_MSG_RESULT(yes)
  282. AC_DEFINE(HAVE_LINUX_HID, 1, [Defined if you have Linux HID]),
  283. AC_MSG_RESULT(no))
  284. ;;
  285. esac
  286. case "$target" in
  287. *-*-darwin*)
  288. ;;
  289. *)
  290. AC_MSG_CHECKING(for reduce relocations)
  291. OCPPFLAGS="$CPPFLAGS"
  292. CPPFLAGS="$CPPFLAGS -I$QT_INC"
  293. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  294. #include <QtCore/QString>
  295. void f(void) {
  296. }])],
  297. [AC_MSG_RESULT(no)],
  298. [OCXXFLAGS="$CXXFLAGS"
  299. CXXFLAGS="$CXXFLAGS -fPIC"
  300. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  301. #include <QtCore/QString>
  302. void f(void) {
  303. }])],
  304. [AC_MSG_RESULT(yes)
  305. CFLAGS="$CFLAGS -fPIC"],
  306. [AC_MSG_RESULT(unknown)
  307. CXXFLAGS="$OCXXFLAGS"]
  308. )]
  309. )
  310. CPPFLAGS="$OCPPFLAGS"
  311. ;;
  312. esac
  313. AC_MSG_CHECKING(for random stuff to make you feel better)
  314. AC_MSG_RESULT(failed)
  315. AC_MSG_CHECKING(for efence)
  316. AC_ARG_ENABLE(efence,
  317. [ --enable-efence=[yes|(no)]],
  318. [ if test "$enable_efence" != "no" ; then
  319. EFENCE_LIB=-lefence
  320. GPSBABEL_DEBUG=gpsbabel-debug
  321. INSTALL_DEBUG=install-debug
  322. fi])
  323. AC_SUBST(EFENCE_LIB)
  324. AC_SUBST(GPSBABEL_DEBUG)
  325. AC_SUBST(INSTALL_DEBUG)
  326. AC_MSG_RESULT($EFENCE_LIB)
  327. AC_MSG_CHECKING(for docdir)
  328. AC_ARG_WITH(doc,[ --with-doc=DIR Path where the documentation will be stored.],
  329. DOCDIR="$withval", DOCDIR="../babelweb/")
  330. AC_SUBST(DOCDIR)
  331. # Checks for header files.
  332. # AC_HEADER_STDC
  333. # 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])
  334. # set up HAVE_STDARG_H for zlib.
  335. AC_CHECK_HEADERS([stdarg.h])
  336. # Checks for typedefs, structures, and compiler characteristics.
  337. # AC_C_CONST
  338. # AC_C_INLINE
  339. # AC_TYPE_OFF_T
  340. # AC_TYPE_SIZE_T
  341. # AC_HEADER_TIME
  342. # AC_STRUCT_TM
  343. # AC_STRUCT_TIMEZONE
  344. # Checks for library functions.
  345. # AC_FUNC_MALLOC
  346. # AC_FUNC_MEMCMP
  347. # AC_FUNC_MKTIME
  348. # AC_FUNC_REALLOC
  349. # AC_FUNC_SELECT_ARGTYPES
  350. # AC_FUNC_STRFTIME
  351. # AC_FUNC_STRTOD
  352. # AC_FUNC_VPRINTF
  353. # AC_CHECK_FUNCS([atexit floor localtime_r memmove memset pow select sqrt strchr strcspn strdup strerror strncasecmp strrchr strspn strstr strtol strtoul])
  354. AC_CHECK_FUNCS([nanosleep sleep uname glob])
  355. #
  356. # There's probably some more "autoconfish" way to do this.
  357. #
  358. AC_SUBST(QT_INC)
  359. AC_SUBST(QT_INC_OPT)
  360. AC_SUBST(QT_SYSINC_OPT)
  361. AC_SUBST(QT_LIBS)
  362. AC_CONFIG_FILES([Makefile gbversion.h gui/setup.iss xmldoc/makedoc tools/mkcapabilities win32/gpsbabel.rc jeeps/Makefile shapelib/Makefile zlib/empty])
  363. AC_CONFIG_FILES([gui/makelinuxdist.sh], [chmod +x gui/makelinuxdist.sh])
  364. AC_OUTPUT