1 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT([usbip-utils], [2.0], [linux-usb@vger.kernel.org])
5 AC_DEFINE([USBIP_VERSION], [0x00000111], [binary-coded decimal version number])
10 AC_SUBST([LIBUSBIP_VERSION], [$CURRENT:$REVISION:$AGE], [library version])
12 AC_CONFIG_SRCDIR([src/usbipd.c])
13 AC_CONFIG_HEADERS([config.h])
15 AM_INIT_AUTOMAKE([foreign])
18 # Silent build for automake >= 1.11
19 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
21 AC_SUBST([EXTRA_CFLAGS], ["-Wall -Werror -Wextra -std=gnu99"])
23 # Checks for programs.
28 # Checks for header files.
31 AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h dnl
32 string.h sys/socket.h syslog.h unistd.h])
34 # Checks for typedefs, structures, and compiler characteristics.
42 # Checks for library functions.
44 AC_CHECK_FUNCS([memset mkdir regcomp socket strchr strerror strstr dnl
47 AC_CHECK_HEADER([libudev.h],
48 [AC_CHECK_LIB([udev], [udev_new],
49 [LIBS="$LIBS -ludev"],
50 [AC_MSG_ERROR([Missing udev library!])])],
51 [AC_MSG_ERROR([Missing /usr/include/libudev.h])])
53 # Checks for libwrap library.
54 AC_MSG_CHECKING([whether to use the libwrap (TCP wrappers) library])
55 AC_ARG_WITH([tcp-wrappers],
56 [AS_HELP_STRING([--with-tcp-wrappers],
57 [use the libwrap (TCP wrappers) library])],
59 [if test "$withval" = "yes"; then
61 AC_MSG_CHECKING([for hosts_access in -lwrap])
63 LIBS="-lwrap $saved_LIBS"
65 [int hosts_access(); int allow_severity, deny_severity;],
67 [AC_MSG_RESULT([yes]);
68 AC_DEFINE([HAVE_LIBWRAP], [1],
69 [use tcp wrapper]) wrap_LIB="-lwrap"],
70 [AC_MSG_RESULT([not found]); exit 1])
74 dnl [ACTION-IF-NOT-GIVEN]
75 [AC_MSG_RESULT([(default)])
76 AC_MSG_CHECKING([for hosts_access in -lwrap])
78 LIBS="-lwrap $saved_LIBS"
80 [int hosts_access(); int allow_severity, deny_severity;],
82 [AC_MSG_RESULT([yes]);
83 AC_DEFINE([HAVE_LIBWRAP], [1], [use tcp wrapper])],
84 [AC_MSG_RESULT([no]); LIBS="$saved_LIBS"])])
86 # Sets directory containing usb.ids.
87 AC_ARG_WITH([usbids-dir],
88 [AS_HELP_STRING([--with-usbids-dir=DIR],
89 [where usb.ids is found (default /usr/share/hwdata/)])],
90 [USBIDS_DIR=$withval], [USBIDS_DIR="/usr/share/hwdata/"])
91 AC_SUBST([USBIDS_DIR])
94 AC_MSG_CHECKING([whether to use fortify])
95 AC_ARG_WITH([fortify],
96 [AS_HELP_STRING([--with-fortify],
97 [use _FORTIFY_SROUCE option when compiling)])],
99 [if test "$withval" = "yes"; then
101 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE -O"
104 CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
107 dnl [ACTION-IF-NOT-GIVEN]
108 [AC_MSG_RESULT([default])])
110 AC_CONFIG_FILES([Makefile libsrc/Makefile src/Makefile])