configure.ac 3.2 KB
Newer Older
1
dnl Process this file with autoconf to produce a configure script.
2 3

AC_PREREQ(2.59)
4
AC_INIT([usbip-utils], [2.0], [linux-usb@vger.kernel.org])
5
AC_DEFINE([USBIP_VERSION], [0x00000111], [binary-coded decimal version number])
6

7 8 9 10 11
CURRENT=0
REVISION=1
AGE=0
AC_SUBST([LIBUSBIP_VERSION], [$CURRENT:$REVISION:$AGE], [library version])

12 13
AC_CONFIG_SRCDIR([src/usbipd.c])
AC_CONFIG_HEADERS([config.h])
14 15

AM_INIT_AUTOMAKE([foreign])
16
LT_INIT
17 18 19 20

# Silent build for automake >= 1.11
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

21
AC_SUBST([EXTRA_CFLAGS], ["-Wall -Werror -Wextra -std=gnu99"])
22 23 24 25

# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
26
AC_PROG_MAKE_SET
27 28 29 30

# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
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])
33 34

# Checks for typedefs, structures, and compiler characteristics.
35
AC_TYPE_INT32_T
36
AC_TYPE_SIZE_T
37 38 39 40
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
41 42 43

# Checks for library functions.
AC_FUNC_REALLOC
44
AC_CHECK_FUNCS([memset mkdir regcomp socket strchr strerror strstr dnl
45
		strtoul])
46

47 48 49 50 51 52
AC_CHECK_HEADER([libudev.h],
		[AC_CHECK_LIB([udev], [udev_new],
			      [LIBS="$LIBS -ludev"],
			      [AC_MSG_ERROR([Missing udev library!])])],
		[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 56 57 58
AC_ARG_WITH([tcp-wrappers],
	    [AS_HELP_STRING([--with-tcp-wrappers],
			    [use the libwrap (TCP wrappers) library])],
	    dnl [ACTION-IF-GIVEN]
59
	    [if test "$withval" = "yes"; then
60 61
		     AC_MSG_RESULT([yes])
		     AC_MSG_CHECKING([for hosts_access in -lwrap])
62 63
		     saved_LIBS="$LIBS"
		     LIBS="-lwrap $saved_LIBS"
64 65 66 67 68 69 70 71
		     AC_TRY_LINK(
		       [int hosts_access(); int allow_severity, deny_severity;],
		       [hosts_access()],
		       [AC_MSG_RESULT([yes]);
			AC_DEFINE([HAVE_LIBWRAP], [1],
				  [use tcp wrapper]) wrap_LIB="-lwrap"],
		       [AC_MSG_RESULT([not found]); exit 1])
	     else
72 73
		     AC_MSG_RESULT([no]);
	     fi],
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
	    dnl [ACTION-IF-NOT-GIVEN]
	    [AC_MSG_RESULT([(default)])
	     AC_MSG_CHECKING([for hosts_access in -lwrap])
	     saved_LIBS="$LIBS"
	     LIBS="-lwrap $saved_LIBS"
	     AC_TRY_LINK(
	       [int hosts_access(); int allow_severity, deny_severity;],
	       [hosts_access()],
	       [AC_MSG_RESULT([yes]);
		AC_DEFINE([HAVE_LIBWRAP], [1], [use tcp wrapper])],
	       [AC_MSG_RESULT([no]); LIBS="$saved_LIBS"])])

# Sets directory containing usb.ids.
AC_ARG_WITH([usbids-dir],
	    [AS_HELP_STRING([--with-usbids-dir=DIR],
89 90
	       [where usb.ids is found (default /usr/share/hwdata/)])],
	    [USBIDS_DIR=$withval], [USBIDS_DIR="/usr/share/hwdata/"])
91
AC_SUBST([USBIDS_DIR])
92

93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
# use _FORTIFY_SOURCE
AC_MSG_CHECKING([whether to use fortify])
AC_ARG_WITH([fortify],
	    [AS_HELP_STRING([--with-fortify],
			    [use _FORTIFY_SROUCE option when compiling)])],
			    dnl [ACTION-IF-GIVEN]
			    [if test "$withval" = "yes"; then
				AC_MSG_RESULT([yes])
				CFLAGS="$CFLAGS -D_FORTIFY_SOURCE -O"
			     else
			     	AC_MSG_RESULT([no])
				CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
			     fi
			    ],
			    dnl [ACTION-IF-NOT-GIVEN]
			    [AC_MSG_RESULT([default])])

110
AC_CONFIG_FILES([Makefile libsrc/Makefile src/Makefile])
111
AC_OUTPUT