configure.ac 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_PREREQ(2.59)
  3. AC_INIT([usbip-utils], [2.0], [linux-usb@vger.kernel.org])
  4. AC_DEFINE([USBIP_VERSION], [0x00000111], [binary-coded decimal version number])
  5. CURRENT=0
  6. REVISION=1
  7. AGE=0
  8. AC_SUBST([LIBUSBIP_VERSION], [$CURRENT:$REVISION:$AGE], [library version])
  9. AC_CONFIG_SRCDIR([src/usbipd.c])
  10. AC_CONFIG_HEADERS([config.h])
  11. AM_INIT_AUTOMAKE([foreign])
  12. LT_INIT
  13. # Silent build for automake >= 1.11
  14. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  15. AC_SUBST([EXTRA_CFLAGS], ["-Wall -Werror -Wextra -std=gnu99"])
  16. # Checks for programs.
  17. AC_PROG_CC
  18. AC_PROG_INSTALL
  19. AC_PROG_MAKE_SET
  20. # Checks for header files.
  21. AC_HEADER_DIRENT
  22. AC_HEADER_STDC
  23. AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h dnl
  24. string.h sys/socket.h syslog.h unistd.h])
  25. # Checks for typedefs, structures, and compiler characteristics.
  26. AC_TYPE_INT32_T
  27. AC_TYPE_SIZE_T
  28. AC_TYPE_SSIZE_T
  29. AC_TYPE_UINT16_T
  30. AC_TYPE_UINT32_T
  31. AC_TYPE_UINT8_T
  32. # Checks for library functions.
  33. AC_FUNC_REALLOC
  34. AC_CHECK_FUNCS([memset mkdir regcomp socket strchr strerror strstr dnl
  35. strtoul])
  36. AC_CHECK_HEADER([libudev.h],
  37. [AC_CHECK_LIB([udev], [udev_new],
  38. [LIBS="$LIBS -ludev"],
  39. [AC_MSG_ERROR([Missing udev library!])])],
  40. [AC_MSG_ERROR([Missing /usr/include/libudev.h])])
  41. # Checks for libwrap library.
  42. AC_MSG_CHECKING([whether to use the libwrap (TCP wrappers) library])
  43. AC_ARG_WITH([tcp-wrappers],
  44. [AS_HELP_STRING([--with-tcp-wrappers],
  45. [use the libwrap (TCP wrappers) library])],
  46. dnl [ACTION-IF-GIVEN]
  47. [if test "$withval" = "yes"; then
  48. AC_MSG_RESULT([yes])
  49. AC_MSG_CHECKING([for hosts_access in -lwrap])
  50. saved_LIBS="$LIBS"
  51. LIBS="-lwrap $saved_LIBS"
  52. AC_TRY_LINK(
  53. [int hosts_access(); int allow_severity, deny_severity;],
  54. [hosts_access()],
  55. [AC_MSG_RESULT([yes]);
  56. AC_DEFINE([HAVE_LIBWRAP], [1],
  57. [use tcp wrapper]) wrap_LIB="-lwrap"],
  58. [AC_MSG_RESULT([not found]); exit 1])
  59. else
  60. AC_MSG_RESULT([no]);
  61. fi],
  62. dnl [ACTION-IF-NOT-GIVEN]
  63. [AC_MSG_RESULT([(default)])
  64. AC_MSG_CHECKING([for hosts_access in -lwrap])
  65. saved_LIBS="$LIBS"
  66. LIBS="-lwrap $saved_LIBS"
  67. AC_TRY_LINK(
  68. [int hosts_access(); int allow_severity, deny_severity;],
  69. [hosts_access()],
  70. [AC_MSG_RESULT([yes]);
  71. AC_DEFINE([HAVE_LIBWRAP], [1], [use tcp wrapper])],
  72. [AC_MSG_RESULT([no]); LIBS="$saved_LIBS"])])
  73. # Sets directory containing usb.ids.
  74. AC_ARG_WITH([usbids-dir],
  75. [AS_HELP_STRING([--with-usbids-dir=DIR],
  76. [where usb.ids is found (default /usr/share/hwdata/)])],
  77. [USBIDS_DIR=$withval], [USBIDS_DIR="/usr/share/hwdata/"])
  78. AC_SUBST([USBIDS_DIR])
  79. # use _FORTIFY_SOURCE
  80. AC_MSG_CHECKING([whether to use fortify])
  81. AC_ARG_WITH([fortify],
  82. [AS_HELP_STRING([--with-fortify],
  83. [use _FORTIFY_SROUCE option when compiling)])],
  84. dnl [ACTION-IF-GIVEN]
  85. [if test "$withval" = "yes"; then
  86. AC_MSG_RESULT([yes])
  87. CFLAGS="$CFLAGS -D_FORTIFY_SOURCE -O"
  88. else
  89. AC_MSG_RESULT([no])
  90. CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
  91. fi
  92. ],
  93. dnl [ACTION-IF-NOT-GIVEN]
  94. [AC_MSG_RESULT([default])])
  95. AC_CONFIG_FILES([Makefile libsrc/Makefile src/Makefile])
  96. AC_OUTPUT