blob: 607d05c5ccfd3131ce96f23d107ee44f709f8bb2 [file] [log] [blame]
matt mooneyaf8bab02011-05-14 03:55:13 -07001dnl Process this file with autoconf to produce a configure script.
Takahiro Hirofuchi0945b4f2011-05-14 03:55:07 -07002
3AC_PREREQ(2.59)
Valentina Manea435d9482014-03-08 14:53:31 +02004AC_INIT([usbip-utils], [2.0], [linux-usb@vger.kernel.org])
matt mooney0aee5882011-07-07 00:31:56 -07005AC_DEFINE([USBIP_VERSION], [0x00000111], [binary-coded decimal version number])
Takahiro Hirofuchi0945b4f2011-05-14 03:55:07 -07006
matt mooneyd762f5e2011-05-14 03:55:15 -07007CURRENT=0
8REVISION=1
9AGE=0
10AC_SUBST([LIBUSBIP_VERSION], [$CURRENT:$REVISION:$AGE], [library version])
11
matt mooneyaf8bab02011-05-14 03:55:13 -070012AC_CONFIG_SRCDIR([src/usbipd.c])
13AC_CONFIG_HEADERS([config.h])
14
Takahiro Hirofuchi0945b4f2011-05-14 03:55:07 -070015AM_INIT_AUTOMAKE([foreign])
matt mooneyaf8bab02011-05-14 03:55:13 -070016LT_INIT
Takahiro Hirofuchi0945b4f2011-05-14 03:55:07 -070017
18# Silent build for automake >= 1.11
19m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
20
matt mooney1c6e79d2011-05-14 03:55:19 -070021AC_SUBST([EXTRA_CFLAGS], ["-Wall -Werror -Wextra -std=gnu99"])
Takahiro Hirofuchi0945b4f2011-05-14 03:55:07 -070022
Takahiro Hirofuchi0945b4f2011-05-14 03:55:07 -070023# Checks for programs.
24AC_PROG_CC
25AC_PROG_INSTALL
matt mooneyaf8bab02011-05-14 03:55:13 -070026AC_PROG_MAKE_SET
Takahiro Hirofuchi0945b4f2011-05-14 03:55:07 -070027
28# Checks for header files.
29AC_HEADER_DIRENT
30AC_HEADER_STDC
matt mooneyaf8bab02011-05-14 03:55:13 -070031AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h dnl
matt mooney950a4cd2011-05-27 01:44:10 -070032 string.h sys/socket.h syslog.h unistd.h])
Takahiro Hirofuchi0945b4f2011-05-14 03:55:07 -070033
34# Checks for typedefs, structures, and compiler characteristics.
matt mooneyaf8bab02011-05-14 03:55:13 -070035AC_TYPE_INT32_T
Takahiro Hirofuchi0945b4f2011-05-14 03:55:07 -070036AC_TYPE_SIZE_T
matt mooneyaf8bab02011-05-14 03:55:13 -070037AC_TYPE_SSIZE_T
38AC_TYPE_UINT16_T
39AC_TYPE_UINT32_T
40AC_TYPE_UINT8_T
Takahiro Hirofuchi0945b4f2011-05-14 03:55:07 -070041
42# Checks for library functions.
Takahiro Hirofuchi0945b4f2011-05-14 03:55:07 -070043AC_FUNC_REALLOC
matt mooney950a4cd2011-05-27 01:44:10 -070044AC_CHECK_FUNCS([memset mkdir regcomp socket strchr strerror strstr dnl
matt mooneyaf8bab02011-05-14 03:55:13 -070045 strtoul])
Takahiro Hirofuchi0945b4f2011-05-14 03:55:07 -070046
Valentina Manea1e940312014-03-08 14:53:19 +020047AC_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])])
52
matt mooneyaf8bab02011-05-14 03:55:13 -070053# Checks for libwrap library.
Takahiro Hirofuchi0945b4f2011-05-14 03:55:07 -070054AC_MSG_CHECKING([whether to use the libwrap (TCP wrappers) library])
matt mooneyaf8bab02011-05-14 03:55:13 -070055AC_ARG_WITH([tcp-wrappers],
56 [AS_HELP_STRING([--with-tcp-wrappers],
57 [use the libwrap (TCP wrappers) library])],
58 dnl [ACTION-IF-GIVEN]
W. Trevor Kingce591f72012-08-17 06:47:05 -040059 [if test "$withval" = "yes"; then
matt mooneyaf8bab02011-05-14 03:55:13 -070060 AC_MSG_RESULT([yes])
61 AC_MSG_CHECKING([for hosts_access in -lwrap])
W. Trevor Kingce591f72012-08-17 06:47:05 -040062 saved_LIBS="$LIBS"
63 LIBS="-lwrap $saved_LIBS"
matt mooneyaf8bab02011-05-14 03:55:13 -070064 AC_TRY_LINK(
65 [int hosts_access(); int allow_severity, deny_severity;],
66 [hosts_access()],
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])
71 else
W. Trevor Kingce591f72012-08-17 06:47:05 -040072 AC_MSG_RESULT([no]);
W. Trevor Kingce591f72012-08-17 06:47:05 -040073 fi],
matt mooneyaf8bab02011-05-14 03:55:13 -070074 dnl [ACTION-IF-NOT-GIVEN]
75 [AC_MSG_RESULT([(default)])
76 AC_MSG_CHECKING([for hosts_access in -lwrap])
77 saved_LIBS="$LIBS"
78 LIBS="-lwrap $saved_LIBS"
79 AC_TRY_LINK(
80 [int hosts_access(); int allow_severity, deny_severity;],
81 [hosts_access()],
82 [AC_MSG_RESULT([yes]);
83 AC_DEFINE([HAVE_LIBWRAP], [1], [use tcp wrapper])],
84 [AC_MSG_RESULT([no]); LIBS="$saved_LIBS"])])
Takahiro Hirofuchi0945b4f2011-05-14 03:55:07 -070085
matt mooneyaf8bab02011-05-14 03:55:13 -070086# Sets directory containing usb.ids.
matt mooneyaf8bab02011-05-14 03:55:13 -070087AC_ARG_WITH([usbids-dir],
88 [AS_HELP_STRING([--with-usbids-dir=DIR],
matt mooney7ddf1a02011-06-16 02:24:57 -070089 [where usb.ids is found (default /usr/share/hwdata/)])],
90 [USBIDS_DIR=$withval], [USBIDS_DIR="/usr/share/hwdata/"])
matt mooneyaf8bab02011-05-14 03:55:13 -070091AC_SUBST([USBIDS_DIR])
Takahiro Hirofuchi0945b4f2011-05-14 03:55:07 -070092
Ilija Hadzic107fefd2012-12-07 16:49:43 -050093# use _FORTIFY_SOURCE
94AC_MSG_CHECKING([whether to use fortify])
95AC_ARG_WITH([fortify],
96 [AS_HELP_STRING([--with-fortify],
97 [use _FORTIFY_SROUCE option when compiling)])],
98 dnl [ACTION-IF-GIVEN]
99 [if test "$withval" = "yes"; then
100 AC_MSG_RESULT([yes])
101 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE -O"
102 else
103 AC_MSG_RESULT([no])
104 CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
105 fi
106 ],
107 dnl [ACTION-IF-NOT-GIVEN]
108 [AC_MSG_RESULT([default])])
109
matt mooneyf9b90072011-05-14 03:55:09 -0700110AC_CONFIG_FILES([Makefile libsrc/Makefile src/Makefile])
Takahiro Hirofuchi0945b4f2011-05-14 03:55:07 -0700111AC_OUTPUT