xref: /OK3568_Linux_fs/kernel/tools/usb/usbip/configure.ac (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyundnl Process this file with autoconf to produce a configure script.
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunAC_PREREQ(2.59)
4*4882a593SmuzhiyunAC_INIT([usbip-utils], [2.0], [linux-usb@vger.kernel.org])
5*4882a593SmuzhiyunAC_DEFINE([USBIP_VERSION], [0x00000111], [binary-coded decimal version number])
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunCURRENT=0
8*4882a593SmuzhiyunREVISION=1
9*4882a593SmuzhiyunAGE=0
10*4882a593SmuzhiyunAC_SUBST([LIBUSBIP_VERSION], [$CURRENT:$REVISION:$AGE], [library version])
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunAC_CONFIG_SRCDIR([src/usbipd.c])
13*4882a593SmuzhiyunAC_CONFIG_HEADERS([config.h])
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunAM_INIT_AUTOMAKE([foreign])
16*4882a593SmuzhiyunLT_INIT
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun# Silent build for automake >= 1.11
19*4882a593Smuzhiyunm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunAC_SUBST([EXTRA_CFLAGS], ["-Wall -Werror -Wextra -std=gnu99"])
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun# Checks for programs.
24*4882a593SmuzhiyunAC_PROG_CC
25*4882a593SmuzhiyunAC_PROG_INSTALL
26*4882a593SmuzhiyunAC_PROG_MAKE_SET
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun# Checks for header files.
29*4882a593SmuzhiyunAC_HEADER_DIRENT
30*4882a593SmuzhiyunAC_HEADER_STDC
31*4882a593SmuzhiyunAC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h dnl
32*4882a593Smuzhiyun		  string.h sys/socket.h syslog.h unistd.h])
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun# Checks for typedefs, structures, and compiler characteristics.
35*4882a593SmuzhiyunAC_TYPE_INT32_T
36*4882a593SmuzhiyunAC_TYPE_SIZE_T
37*4882a593SmuzhiyunAC_TYPE_SSIZE_T
38*4882a593SmuzhiyunAC_TYPE_UINT16_T
39*4882a593SmuzhiyunAC_TYPE_UINT32_T
40*4882a593SmuzhiyunAC_TYPE_UINT8_T
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun# Checks for library functions.
43*4882a593SmuzhiyunAC_FUNC_REALLOC
44*4882a593SmuzhiyunAC_CHECK_FUNCS([memset mkdir regcomp socket strchr strerror strstr dnl
45*4882a593Smuzhiyun		strtoul])
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunAC_CHECK_HEADER([libudev.h],
48*4882a593Smuzhiyun		[AC_CHECK_LIB([udev], [udev_new],
49*4882a593Smuzhiyun			      [LIBS="$LIBS -ludev"],
50*4882a593Smuzhiyun			      [AC_MSG_ERROR([Missing udev library!])])],
51*4882a593Smuzhiyun		[AC_MSG_ERROR([Missing /usr/include/libudev.h])])
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun# Checks for libwrap library.
54*4882a593SmuzhiyunAC_MSG_CHECKING([whether to use the libwrap (TCP wrappers) library])
55*4882a593SmuzhiyunAC_ARG_WITH([tcp-wrappers],
56*4882a593Smuzhiyun	    [AS_HELP_STRING([--with-tcp-wrappers],
57*4882a593Smuzhiyun			    [use the libwrap (TCP wrappers) library])],
58*4882a593Smuzhiyun	    dnl [ACTION-IF-GIVEN]
59*4882a593Smuzhiyun	    [if test "$withval" = "yes"; then
60*4882a593Smuzhiyun		     AC_MSG_RESULT([yes])
61*4882a593Smuzhiyun		     AC_MSG_CHECKING([for hosts_access in -lwrap])
62*4882a593Smuzhiyun		     saved_LIBS="$LIBS"
63*4882a593Smuzhiyun		     LIBS="-lwrap $saved_LIBS"
64*4882a593Smuzhiyun		     AC_TRY_LINK(
65*4882a593Smuzhiyun		       [int hosts_access(); int allow_severity, deny_severity;],
66*4882a593Smuzhiyun		       [hosts_access()],
67*4882a593Smuzhiyun		       [AC_MSG_RESULT([yes]);
68*4882a593Smuzhiyun			AC_DEFINE([HAVE_LIBWRAP], [1],
69*4882a593Smuzhiyun				  [use tcp wrapper]) wrap_LIB="-lwrap"],
70*4882a593Smuzhiyun		       [AC_MSG_RESULT([not found]); exit 1])
71*4882a593Smuzhiyun	     else
72*4882a593Smuzhiyun		     AC_MSG_RESULT([no]);
73*4882a593Smuzhiyun	     fi],
74*4882a593Smuzhiyun	    dnl [ACTION-IF-NOT-GIVEN]
75*4882a593Smuzhiyun	    [AC_MSG_RESULT([(default)])
76*4882a593Smuzhiyun	     AC_MSG_CHECKING([for hosts_access in -lwrap])
77*4882a593Smuzhiyun	     saved_LIBS="$LIBS"
78*4882a593Smuzhiyun	     LIBS="-lwrap $saved_LIBS"
79*4882a593Smuzhiyun	     AC_TRY_LINK(
80*4882a593Smuzhiyun	       [int hosts_access(); int allow_severity, deny_severity;],
81*4882a593Smuzhiyun	       [hosts_access()],
82*4882a593Smuzhiyun	       [AC_MSG_RESULT([yes]);
83*4882a593Smuzhiyun		AC_DEFINE([HAVE_LIBWRAP], [1], [use tcp wrapper])],
84*4882a593Smuzhiyun	       [AC_MSG_RESULT([no]); LIBS="$saved_LIBS"])])
85*4882a593Smuzhiyun
86*4882a593Smuzhiyun# Sets directory containing usb.ids.
87*4882a593SmuzhiyunAC_ARG_WITH([usbids-dir],
88*4882a593Smuzhiyun	    [AS_HELP_STRING([--with-usbids-dir=DIR],
89*4882a593Smuzhiyun	       [where usb.ids is found (default /usr/share/hwdata/)])],
90*4882a593Smuzhiyun	    [USBIDS_DIR=$withval], [USBIDS_DIR="/usr/share/hwdata/"])
91*4882a593SmuzhiyunAC_SUBST([USBIDS_DIR])
92*4882a593Smuzhiyun
93*4882a593Smuzhiyun# use _FORTIFY_SOURCE
94*4882a593SmuzhiyunAC_MSG_CHECKING([whether to use fortify])
95*4882a593SmuzhiyunAC_ARG_WITH([fortify],
96*4882a593Smuzhiyun	    [AS_HELP_STRING([--with-fortify],
97*4882a593Smuzhiyun			    [use _FORTIFY_SROUCE option when compiling)])],
98*4882a593Smuzhiyun			    dnl [ACTION-IF-GIVEN]
99*4882a593Smuzhiyun			    [if test "$withval" = "yes"; then
100*4882a593Smuzhiyun				AC_MSG_RESULT([yes])
101*4882a593Smuzhiyun				CFLAGS="$CFLAGS -D_FORTIFY_SOURCE -O"
102*4882a593Smuzhiyun			     else
103*4882a593Smuzhiyun			     	AC_MSG_RESULT([no])
104*4882a593Smuzhiyun				CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
105*4882a593Smuzhiyun			     fi
106*4882a593Smuzhiyun			    ],
107*4882a593Smuzhiyun			    dnl [ACTION-IF-NOT-GIVEN]
108*4882a593Smuzhiyun			    [AC_MSG_RESULT([default])])
109*4882a593Smuzhiyun
110*4882a593SmuzhiyunAC_CONFIG_FILES([Makefile libsrc/Makefile src/Makefile])
111*4882a593SmuzhiyunAC_OUTPUT
112