162306a36Sopenharmony_cidnl Process this file with autoconf to produce a configure script.
262306a36Sopenharmony_ci
362306a36Sopenharmony_ciAC_PREREQ(2.59)
462306a36Sopenharmony_ciAC_INIT([usbip-utils], [2.0], [linux-usb@vger.kernel.org])
562306a36Sopenharmony_ciAC_DEFINE([USBIP_VERSION], [0x00000111], [binary-coded decimal version number])
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciCURRENT=0
862306a36Sopenharmony_ciREVISION=1
962306a36Sopenharmony_ciAGE=0
1062306a36Sopenharmony_ciAC_SUBST([LIBUSBIP_VERSION], [$CURRENT:$REVISION:$AGE], [library version])
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciAC_CONFIG_SRCDIR([src/usbipd.c])
1362306a36Sopenharmony_ciAC_CONFIG_HEADERS([config.h])
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciAM_INIT_AUTOMAKE([foreign])
1662306a36Sopenharmony_ciLT_INIT
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci# Silent build for automake >= 1.11
1962306a36Sopenharmony_cim4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ciAC_SUBST([EXTRA_CFLAGS], ["-Wall -Werror -Wextra -std=gnu99"])
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci# Checks for programs.
2462306a36Sopenharmony_ciAC_PROG_CC
2562306a36Sopenharmony_ciAC_PROG_INSTALL
2662306a36Sopenharmony_ciAC_PROG_MAKE_SET
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci# Checks for header files.
2962306a36Sopenharmony_ciAC_HEADER_DIRENT
3062306a36Sopenharmony_ciAC_HEADER_STDC
3162306a36Sopenharmony_ciAC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h dnl
3262306a36Sopenharmony_ci		  string.h sys/socket.h syslog.h unistd.h])
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci# Checks for typedefs, structures, and compiler characteristics.
3562306a36Sopenharmony_ciAC_TYPE_INT32_T
3662306a36Sopenharmony_ciAC_TYPE_SIZE_T
3762306a36Sopenharmony_ciAC_TYPE_SSIZE_T
3862306a36Sopenharmony_ciAC_TYPE_UINT16_T
3962306a36Sopenharmony_ciAC_TYPE_UINT32_T
4062306a36Sopenharmony_ciAC_TYPE_UINT8_T
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci# Checks for library functions.
4362306a36Sopenharmony_ciAC_FUNC_REALLOC
4462306a36Sopenharmony_ciAC_CHECK_FUNCS([memset mkdir regcomp socket strchr strerror strstr dnl
4562306a36Sopenharmony_ci		strtoul])
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ciAC_CHECK_HEADER([libudev.h],
4862306a36Sopenharmony_ci		[AC_CHECK_LIB([udev], [udev_new],
4962306a36Sopenharmony_ci			      [LIBS="$LIBS -ludev"],
5062306a36Sopenharmony_ci			      [AC_MSG_ERROR([Missing udev library!])])],
5162306a36Sopenharmony_ci		[AC_MSG_ERROR([Missing /usr/include/libudev.h])])
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci# Checks for libwrap library.
5462306a36Sopenharmony_ciAC_MSG_CHECKING([whether to use the libwrap (TCP wrappers) library])
5562306a36Sopenharmony_ciAC_ARG_WITH([tcp-wrappers],
5662306a36Sopenharmony_ci	    [AS_HELP_STRING([--with-tcp-wrappers],
5762306a36Sopenharmony_ci			    [use the libwrap (TCP wrappers) library])],
5862306a36Sopenharmony_ci	    dnl [ACTION-IF-GIVEN]
5962306a36Sopenharmony_ci	    [if test "$withval" = "yes"; then
6062306a36Sopenharmony_ci		     AC_MSG_RESULT([yes])
6162306a36Sopenharmony_ci		     AC_MSG_CHECKING([for hosts_access in -lwrap])
6262306a36Sopenharmony_ci		     saved_LIBS="$LIBS"
6362306a36Sopenharmony_ci		     LIBS="-lwrap $saved_LIBS"
6462306a36Sopenharmony_ci		     AC_TRY_LINK(
6562306a36Sopenharmony_ci		       [int hosts_access(); int allow_severity, deny_severity;],
6662306a36Sopenharmony_ci		       [hosts_access()],
6762306a36Sopenharmony_ci		       [AC_MSG_RESULT([yes]);
6862306a36Sopenharmony_ci			AC_DEFINE([HAVE_LIBWRAP], [1],
6962306a36Sopenharmony_ci				  [use tcp wrapper]) wrap_LIB="-lwrap"],
7062306a36Sopenharmony_ci		       [AC_MSG_RESULT([not found]); exit 1])
7162306a36Sopenharmony_ci	     else
7262306a36Sopenharmony_ci		     AC_MSG_RESULT([no]);
7362306a36Sopenharmony_ci	     fi],
7462306a36Sopenharmony_ci	    dnl [ACTION-IF-NOT-GIVEN]
7562306a36Sopenharmony_ci	    [AC_MSG_RESULT([(default)])
7662306a36Sopenharmony_ci	     AC_MSG_CHECKING([for hosts_access in -lwrap])
7762306a36Sopenharmony_ci	     saved_LIBS="$LIBS"
7862306a36Sopenharmony_ci	     LIBS="-lwrap $saved_LIBS"
7962306a36Sopenharmony_ci	     AC_TRY_LINK(
8062306a36Sopenharmony_ci	       [int hosts_access(); int allow_severity, deny_severity;],
8162306a36Sopenharmony_ci	       [hosts_access()],
8262306a36Sopenharmony_ci	       [AC_MSG_RESULT([yes]);
8362306a36Sopenharmony_ci		AC_DEFINE([HAVE_LIBWRAP], [1], [use tcp wrapper])],
8462306a36Sopenharmony_ci	       [AC_MSG_RESULT([no]); LIBS="$saved_LIBS"])])
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci# Sets directory containing usb.ids.
8762306a36Sopenharmony_ciAC_ARG_WITH([usbids-dir],
8862306a36Sopenharmony_ci	    [AS_HELP_STRING([--with-usbids-dir=DIR],
8962306a36Sopenharmony_ci	       [where usb.ids is found (default /usr/share/hwdata/)])],
9062306a36Sopenharmony_ci	    [USBIDS_DIR=$withval], [USBIDS_DIR="/usr/share/hwdata/"])
9162306a36Sopenharmony_ciAC_SUBST([USBIDS_DIR])
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci# use _FORTIFY_SOURCE
9462306a36Sopenharmony_ciAC_MSG_CHECKING([whether to use fortify])
9562306a36Sopenharmony_ciAC_ARG_WITH([fortify],
9662306a36Sopenharmony_ci	    [AS_HELP_STRING([--with-fortify],
9762306a36Sopenharmony_ci			    [use _FORTIFY_SOURCE=2 option when compiling)])],
9862306a36Sopenharmony_ci			    dnl [ACTION-IF-GIVEN]
9962306a36Sopenharmony_ci			    [if test "$withval" = "yes"; then
10062306a36Sopenharmony_ci				AC_MSG_RESULT([yes])
10162306a36Sopenharmony_ci				CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2 -O"
10262306a36Sopenharmony_ci			     else
10362306a36Sopenharmony_ci			     	AC_MSG_RESULT([no])
10462306a36Sopenharmony_ci				CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
10562306a36Sopenharmony_ci			     fi
10662306a36Sopenharmony_ci			    ],
10762306a36Sopenharmony_ci			    dnl [ACTION-IF-NOT-GIVEN]
10862306a36Sopenharmony_ci			    [AC_MSG_RESULT([default])])
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ciAC_CONFIG_FILES([Makefile libsrc/Makefile src/Makefile])
11162306a36Sopenharmony_ciAC_OUTPUT
112