matt mooney | af8bab0 | 2011-05-14 03:55:13 -0700 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script. |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 2 | |
| 3 | AC_PREREQ(2.59) |
Valentina Manea | 435d948 | 2014-03-08 14:53:31 +0200 | [diff] [blame] | 4 | AC_INIT([usbip-utils], [2.0], [linux-usb@vger.kernel.org]) |
matt mooney | 0aee588 | 2011-07-07 00:31:56 -0700 | [diff] [blame] | 5 | AC_DEFINE([USBIP_VERSION], [0x00000111], [binary-coded decimal version number]) |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 6 | |
matt mooney | d762f5e | 2011-05-14 03:55:15 -0700 | [diff] [blame] | 7 | CURRENT=0 |
| 8 | REVISION=1 |
| 9 | AGE=0 |
| 10 | AC_SUBST([LIBUSBIP_VERSION], [$CURRENT:$REVISION:$AGE], [library version]) |
| 11 | |
matt mooney | af8bab0 | 2011-05-14 03:55:13 -0700 | [diff] [blame] | 12 | AC_CONFIG_SRCDIR([src/usbipd.c]) |
| 13 | AC_CONFIG_HEADERS([config.h]) |
| 14 | |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 15 | AM_INIT_AUTOMAKE([foreign]) |
matt mooney | af8bab0 | 2011-05-14 03:55:13 -0700 | [diff] [blame] | 16 | LT_INIT |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 17 | |
| 18 | # Silent build for automake >= 1.11 |
| 19 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 20 | |
matt mooney | 1c6e79d | 2011-05-14 03:55:19 -0700 | [diff] [blame] | 21 | AC_SUBST([EXTRA_CFLAGS], ["-Wall -Werror -Wextra -std=gnu99"]) |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 22 | |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 23 | # Checks for programs. |
| 24 | AC_PROG_CC |
| 25 | AC_PROG_INSTALL |
matt mooney | af8bab0 | 2011-05-14 03:55:13 -0700 | [diff] [blame] | 26 | AC_PROG_MAKE_SET |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 27 | |
| 28 | # Checks for header files. |
| 29 | AC_HEADER_DIRENT |
| 30 | AC_HEADER_STDC |
matt mooney | af8bab0 | 2011-05-14 03:55:13 -0700 | [diff] [blame] | 31 | AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h dnl |
matt mooney | 950a4cd | 2011-05-27 01:44:10 -0700 | [diff] [blame] | 32 | string.h sys/socket.h syslog.h unistd.h]) |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 33 | |
| 34 | # Checks for typedefs, structures, and compiler characteristics. |
matt mooney | af8bab0 | 2011-05-14 03:55:13 -0700 | [diff] [blame] | 35 | AC_TYPE_INT32_T |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 36 | AC_TYPE_SIZE_T |
matt mooney | af8bab0 | 2011-05-14 03:55:13 -0700 | [diff] [blame] | 37 | AC_TYPE_SSIZE_T |
| 38 | AC_TYPE_UINT16_T |
| 39 | AC_TYPE_UINT32_T |
| 40 | AC_TYPE_UINT8_T |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 41 | |
| 42 | # Checks for library functions. |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 43 | AC_FUNC_REALLOC |
matt mooney | 950a4cd | 2011-05-27 01:44:10 -0700 | [diff] [blame] | 44 | AC_CHECK_FUNCS([memset mkdir regcomp socket strchr strerror strstr dnl |
matt mooney | af8bab0 | 2011-05-14 03:55:13 -0700 | [diff] [blame] | 45 | strtoul]) |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 46 | |
Valentina Manea | 1e94031 | 2014-03-08 14:53:19 +0200 | [diff] [blame] | 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])]) |
| 52 | |
matt mooney | af8bab0 | 2011-05-14 03:55:13 -0700 | [diff] [blame] | 53 | # Checks for libwrap library. |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 54 | AC_MSG_CHECKING([whether to use the libwrap (TCP wrappers) library]) |
matt mooney | af8bab0 | 2011-05-14 03:55:13 -0700 | [diff] [blame] | 55 | AC_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 King | ce591f7 | 2012-08-17 06:47:05 -0400 | [diff] [blame] | 59 | [if test "$withval" = "yes"; then |
matt mooney | af8bab0 | 2011-05-14 03:55:13 -0700 | [diff] [blame] | 60 | AC_MSG_RESULT([yes]) |
| 61 | AC_MSG_CHECKING([for hosts_access in -lwrap]) |
W. Trevor King | ce591f7 | 2012-08-17 06:47:05 -0400 | [diff] [blame] | 62 | saved_LIBS="$LIBS" |
| 63 | LIBS="-lwrap $saved_LIBS" |
matt mooney | af8bab0 | 2011-05-14 03:55:13 -0700 | [diff] [blame] | 64 | 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 King | ce591f7 | 2012-08-17 06:47:05 -0400 | [diff] [blame] | 72 | AC_MSG_RESULT([no]); |
W. Trevor King | ce591f7 | 2012-08-17 06:47:05 -0400 | [diff] [blame] | 73 | fi], |
matt mooney | af8bab0 | 2011-05-14 03:55:13 -0700 | [diff] [blame] | 74 | 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 Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 85 | |
matt mooney | af8bab0 | 2011-05-14 03:55:13 -0700 | [diff] [blame] | 86 | # Sets directory containing usb.ids. |
matt mooney | af8bab0 | 2011-05-14 03:55:13 -0700 | [diff] [blame] | 87 | AC_ARG_WITH([usbids-dir], |
| 88 | [AS_HELP_STRING([--with-usbids-dir=DIR], |
matt mooney | 7ddf1a0 | 2011-06-16 02:24:57 -0700 | [diff] [blame] | 89 | [where usb.ids is found (default /usr/share/hwdata/)])], |
| 90 | [USBIDS_DIR=$withval], [USBIDS_DIR="/usr/share/hwdata/"]) |
matt mooney | af8bab0 | 2011-05-14 03:55:13 -0700 | [diff] [blame] | 91 | AC_SUBST([USBIDS_DIR]) |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 92 | |
Ilija Hadzic | 107fefd | 2012-12-07 16:49:43 -0500 | [diff] [blame] | 93 | # use _FORTIFY_SOURCE |
| 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)])], |
| 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 mooney | f9b9007 | 2011-05-14 03:55:09 -0700 | [diff] [blame] | 110 | AC_CONFIG_FILES([Makefile libsrc/Makefile src/Makefile]) |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 111 | AC_OUTPUT |