configure.ac 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. AC_INIT([librtlsdr],
  2. m4_esyscmd([./git-version-gen .tarball-version]),
  3. [osmocom-sdr@lists.osmocom.org])
  4. AM_INIT_AUTOMAKE([dist-bzip2])
  5. dnl kernel style compile messages
  6. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  7. dnl checks for programs
  8. AC_PROG_MAKE_SET
  9. AC_PROG_CC
  10. AC_PROG_INSTALL
  11. LT_INIT
  12. AC_PROG_LIBTOOL
  13. PKG_CHECK_MODULES(LIBUSB, libusb-1.0 >= 1.0)
  14. LIBS="$LIBS $LIBUSB_LIBS"
  15. CFLAGS="$CFLAGS $LIBUSB_CFLAGS"
  16. AC_PATH_PROG(DOXYGEN,doxygen,false)
  17. AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false)
  18. AC_CONFIG_MACRO_DIR([m4])
  19. dnl checks for header files
  20. AC_HEADER_STDC
  21. AC_CHECK_HEADERS(sys/types.h)
  22. AC_CHECK_HEADERS(pthread.h,, [AC_MSG_ERROR([pthread.h required])])
  23. # pc variables
  24. AC_SUBST(RTLSDR_PC_LIBS,["$LIBS"])
  25. AC_SUBST(RTLSDR_PC_CFLAGS,["$CFLAGS"])
  26. dnl checks for required libraries
  27. dnl pthreads
  28. AC_CHECK_LIB(pthread, pthread_create, [LIBS="$LIBS -lpthread"])
  29. dnl libmath (for rtl_fm)
  30. AC_CHECK_LIB(m, atan2, [LIBS="$LIBS -lm"])
  31. dnl libmath (for rtl_adsb)
  32. AC_CHECK_LIB(m, sqrt, [LIBS="$LIBS -lm"])
  33. dnl libmath (for rtl_power)
  34. AC_CHECK_LIB(m, atan2, [LIBS="$LIBS -lm"])
  35. dnl librealtime (for rtl_test)
  36. AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"])
  37. # The following test is taken from WebKit's webkit.m4
  38. saved_CFLAGS="$CFLAGS"
  39. CFLAGS="$CFLAGS -fvisibility=hidden "
  40. AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
  41. AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
  42. [ AC_MSG_RESULT([yes])
  43. SYMBOL_VISIBILITY="-fvisibility=hidden"],
  44. AC_MSG_RESULT([no]))
  45. CFLAGS="$saved_CFLAGS"
  46. AC_SUBST(SYMBOL_VISIBILITY)
  47. AC_MSG_CHECKING(whether compiler understands -Wall)
  48. old_CFLAGS="$CFLAGS"
  49. CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused -Wsign-compare"
  50. AC_TRY_COMPILE([],[],
  51. AC_MSG_RESULT(yes),
  52. AC_MSG_RESULT(no)
  53. CFLAGS="$old_CFLAGS")
  54. AC_ARG_ENABLE(driver-detach,
  55. [ --enable-driver-detach Enable detaching of kernel driver (disabled by default)],
  56. [if test x$enableval = xyes; then
  57. CFLAGS="$CFLAGS -DDETACH_KERNEL_DRIVER"
  58. fi])
  59. dnl Generate the output
  60. AC_CONFIG_HEADER(config.h)
  61. AC_OUTPUT(
  62. librtlsdr.pc
  63. include/Makefile
  64. src/Makefile
  65. Makefile
  66. Doxyfile
  67. )