18c2ecf20Sopenharmony_cidnl Process this file with autoconf to produce a configure script.
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciAC_PREREQ(2.59)
48c2ecf20Sopenharmony_ciAC_INIT([usbip-utils], [2.0], [linux-usb@vger.kernel.org])
58c2ecf20Sopenharmony_ciAC_DEFINE([USBIP_VERSION], [0x00000111], [binary-coded decimal version number])
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciCURRENT=0
88c2ecf20Sopenharmony_ciREVISION=1
98c2ecf20Sopenharmony_ciAGE=0
108c2ecf20Sopenharmony_ciAC_SUBST([LIBUSBIP_VERSION], [$CURRENT:$REVISION:$AGE], [library version])
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciAC_CONFIG_SRCDIR([src/usbipd.c])
138c2ecf20Sopenharmony_ciAC_CONFIG_HEADERS([config.h])
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciAM_INIT_AUTOMAKE([foreign])
168c2ecf20Sopenharmony_ciLT_INIT
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci# Silent build for automake >= 1.11
198c2ecf20Sopenharmony_cim4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciAC_SUBST([EXTRA_CFLAGS], ["-Wall -Werror -Wextra -std=gnu99"])
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci# Checks for programs.
248c2ecf20Sopenharmony_ciAC_PROG_CC
258c2ecf20Sopenharmony_ciAC_PROG_INSTALL
268c2ecf20Sopenharmony_ciAC_PROG_MAKE_SET
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci# Checks for header files.
298c2ecf20Sopenharmony_ciAC_HEADER_DIRENT
308c2ecf20Sopenharmony_ciAC_HEADER_STDC
318c2ecf20Sopenharmony_ciAC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h dnl
328c2ecf20Sopenharmony_ci		  string.h sys/socket.h syslog.h unistd.h])
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci# Checks for typedefs, structures, and compiler characteristics.
358c2ecf20Sopenharmony_ciAC_TYPE_INT32_T
368c2ecf20Sopenharmony_ciAC_TYPE_SIZE_T
378c2ecf20Sopenharmony_ciAC_TYPE_SSIZE_T
388c2ecf20Sopenharmony_ciAC_TYPE_UINT16_T
398c2ecf20Sopenharmony_ciAC_TYPE_UINT32_T
408c2ecf20Sopenharmony_ciAC_TYPE_UINT8_T
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci# Checks for library functions.
438c2ecf20Sopenharmony_ciAC_FUNC_REALLOC
448c2ecf20Sopenharmony_ciAC_CHECK_FUNCS([memset mkdir regcomp socket strchr strerror strstr dnl
458c2ecf20Sopenharmony_ci		strtoul])
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciAC_CHECK_HEADER([libudev.h],
488c2ecf20Sopenharmony_ci		[AC_CHECK_LIB([udev], [udev_new],
498c2ecf20Sopenharmony_ci			      [LIBS="$LIBS -ludev"],
508c2ecf20Sopenharmony_ci			      [AC_MSG_ERROR([Missing udev library!])])],
518c2ecf20Sopenharmony_ci		[AC_MSG_ERROR([Missing /usr/include/libudev.h])])
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci# Checks for libwrap library.
548c2ecf20Sopenharmony_ciAC_MSG_CHECKING([whether to use the libwrap (TCP wrappers) library])
558c2ecf20Sopenharmony_ciAC_ARG_WITH([tcp-wrappers],
568c2ecf20Sopenharmony_ci	    [AS_HELP_STRING([--with-tcp-wrappers],
578c2ecf20Sopenharmony_ci			    [use the libwrap (TCP wrappers) library])],
588c2ecf20Sopenharmony_ci	    dnl [ACTION-IF-GIVEN]
598c2ecf20Sopenharmony_ci	    [if test "$withval" = "yes"; then
608c2ecf20Sopenharmony_ci		     AC_MSG_RESULT([yes])
618c2ecf20Sopenharmony_ci		     AC_MSG_CHECKING([for hosts_access in -lwrap])
628c2ecf20Sopenharmony_ci		     saved_LIBS="$LIBS"
638c2ecf20Sopenharmony_ci		     LIBS="-lwrap $saved_LIBS"
648c2ecf20Sopenharmony_ci		     AC_TRY_LINK(
658c2ecf20Sopenharmony_ci		       [int hosts_access(); int allow_severity, deny_severity;],
668c2ecf20Sopenharmony_ci		       [hosts_access()],
678c2ecf20Sopenharmony_ci		       [AC_MSG_RESULT([yes]);
688c2ecf20Sopenharmony_ci			AC_DEFINE([HAVE_LIBWRAP], [1],
698c2ecf20Sopenharmony_ci				  [use tcp wrapper]) wrap_LIB="-lwrap"],
708c2ecf20Sopenharmony_ci		       [AC_MSG_RESULT([not found]); exit 1])
718c2ecf20Sopenharmony_ci	     else
728c2ecf20Sopenharmony_ci		     AC_MSG_RESULT([no]);
738c2ecf20Sopenharmony_ci	     fi],
748c2ecf20Sopenharmony_ci	    dnl [ACTION-IF-NOT-GIVEN]
758c2ecf20Sopenharmony_ci	    [AC_MSG_RESULT([(default)])
768c2ecf20Sopenharmony_ci	     AC_MSG_CHECKING([for hosts_access in -lwrap])
778c2ecf20Sopenharmony_ci	     saved_LIBS="$LIBS"
788c2ecf20Sopenharmony_ci	     LIBS="-lwrap $saved_LIBS"
798c2ecf20Sopenharmony_ci	     AC_TRY_LINK(
808c2ecf20Sopenharmony_ci	       [int hosts_access(); int allow_severity, deny_severity;],
818c2ecf20Sopenharmony_ci	       [hosts_access()],
828c2ecf20Sopenharmony_ci	       [AC_MSG_RESULT([yes]);
838c2ecf20Sopenharmony_ci		AC_DEFINE([HAVE_LIBWRAP], [1], [use tcp wrapper])],
848c2ecf20Sopenharmony_ci	       [AC_MSG_RESULT([no]); LIBS="$saved_LIBS"])])
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci# Sets directory containing usb.ids.
878c2ecf20Sopenharmony_ciAC_ARG_WITH([usbids-dir],
888c2ecf20Sopenharmony_ci	    [AS_HELP_STRING([--with-usbids-dir=DIR],
898c2ecf20Sopenharmony_ci	       [where usb.ids is found (default /usr/share/hwdata/)])],
908c2ecf20Sopenharmony_ci	    [USBIDS_DIR=$withval], [USBIDS_DIR="/usr/share/hwdata/"])
918c2ecf20Sopenharmony_ciAC_SUBST([USBIDS_DIR])
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci# use _FORTIFY_SOURCE
948c2ecf20Sopenharmony_ciAC_MSG_CHECKING([whether to use fortify])
958c2ecf20Sopenharmony_ciAC_ARG_WITH([fortify],
968c2ecf20Sopenharmony_ci	    [AS_HELP_STRING([--with-fortify],
978c2ecf20Sopenharmony_ci			    [use _FORTIFY_SROUCE option when compiling)])],
988c2ecf20Sopenharmony_ci			    dnl [ACTION-IF-GIVEN]
998c2ecf20Sopenharmony_ci			    [if test "$withval" = "yes"; then
1008c2ecf20Sopenharmony_ci				AC_MSG_RESULT([yes])
1018c2ecf20Sopenharmony_ci				CFLAGS="$CFLAGS -D_FORTIFY_SOURCE -O"
1028c2ecf20Sopenharmony_ci			     else
1038c2ecf20Sopenharmony_ci			     	AC_MSG_RESULT([no])
1048c2ecf20Sopenharmony_ci				CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
1058c2ecf20Sopenharmony_ci			     fi
1068c2ecf20Sopenharmony_ci			    ],
1078c2ecf20Sopenharmony_ci			    dnl [ACTION-IF-NOT-GIVEN]
1088c2ecf20Sopenharmony_ci			    [AC_MSG_RESULT([default])])
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ciAC_CONFIG_FILES([Makefile libsrc/Makefile src/Makefile])
1118c2ecf20Sopenharmony_ciAC_OUTPUT
112