^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) dnl Process this file with autoconf to produce a configure script.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) AC_PREREQ(2.59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) AC_INIT([usbip-utils], [2.0], [linux-usb@vger.kernel.org])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) AC_DEFINE([USBIP_VERSION], [0x00000111], [binary-coded decimal version number])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) CURRENT=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) REVISION=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) AGE=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) AC_SUBST([LIBUSBIP_VERSION], [$CURRENT:$REVISION:$AGE], [library version])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) AC_CONFIG_SRCDIR([src/usbipd.c])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) AC_CONFIG_HEADERS([config.h])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) AM_INIT_AUTOMAKE([foreign])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) LT_INIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) # Silent build for automake >= 1.11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) AC_SUBST([EXTRA_CFLAGS], ["-Wall -Werror -Wextra -std=gnu99"])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) # Checks for programs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) AC_PROG_CC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) AC_PROG_INSTALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) AC_PROG_MAKE_SET
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) # Checks for header files.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) AC_HEADER_DIRENT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) AC_HEADER_STDC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h dnl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) string.h sys/socket.h syslog.h unistd.h])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) # Checks for typedefs, structures, and compiler characteristics.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) AC_TYPE_INT32_T
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) AC_TYPE_SIZE_T
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) AC_TYPE_SSIZE_T
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) AC_TYPE_UINT16_T
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) AC_TYPE_UINT32_T
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) AC_TYPE_UINT8_T
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) # Checks for library functions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) AC_FUNC_REALLOC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) AC_CHECK_FUNCS([memset mkdir regcomp socket strchr strerror strstr dnl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) strtoul])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) AC_CHECK_HEADER([libudev.h],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) [AC_CHECK_LIB([udev], [udev_new],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) [LIBS="$LIBS -ludev"],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) [AC_MSG_ERROR([Missing udev library!])])],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) [AC_MSG_ERROR([Missing /usr/include/libudev.h])])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) # Checks for libwrap library.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) AC_MSG_CHECKING([whether to use the libwrap (TCP wrappers) library])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) AC_ARG_WITH([tcp-wrappers],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) [AS_HELP_STRING([--with-tcp-wrappers],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) [use the libwrap (TCP wrappers) library])],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) dnl [ACTION-IF-GIVEN]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) [if test "$withval" = "yes"; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) AC_MSG_RESULT([yes])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) AC_MSG_CHECKING([for hosts_access in -lwrap])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) saved_LIBS="$LIBS"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) LIBS="-lwrap $saved_LIBS"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) AC_TRY_LINK(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) [int hosts_access(); int allow_severity, deny_severity;],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) [hosts_access()],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) [AC_MSG_RESULT([yes]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) AC_DEFINE([HAVE_LIBWRAP], [1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) [use tcp wrapper]) wrap_LIB="-lwrap"],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) [AC_MSG_RESULT([not found]); exit 1])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) AC_MSG_RESULT([no]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) fi],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) dnl [ACTION-IF-NOT-GIVEN]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) [AC_MSG_RESULT([(default)])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) AC_MSG_CHECKING([for hosts_access in -lwrap])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) saved_LIBS="$LIBS"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) LIBS="-lwrap $saved_LIBS"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) AC_TRY_LINK(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) [int hosts_access(); int allow_severity, deny_severity;],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) [hosts_access()],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) [AC_MSG_RESULT([yes]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) AC_DEFINE([HAVE_LIBWRAP], [1], [use tcp wrapper])],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) [AC_MSG_RESULT([no]); LIBS="$saved_LIBS"])])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) # Sets directory containing usb.ids.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) AC_ARG_WITH([usbids-dir],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) [AS_HELP_STRING([--with-usbids-dir=DIR],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) [where usb.ids is found (default /usr/share/hwdata/)])],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) [USBIDS_DIR=$withval], [USBIDS_DIR="/usr/share/hwdata/"])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) AC_SUBST([USBIDS_DIR])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) # use _FORTIFY_SOURCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) AC_MSG_CHECKING([whether to use fortify])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) AC_ARG_WITH([fortify],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) [AS_HELP_STRING([--with-fortify],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) [use _FORTIFY_SROUCE option when compiling)])],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) dnl [ACTION-IF-GIVEN]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) [if test "$withval" = "yes"; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) AC_MSG_RESULT([yes])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) CFLAGS="$CFLAGS -D_FORTIFY_SOURCE -O"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) AC_MSG_RESULT([no])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) ],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) dnl [ACTION-IF-NOT-GIVEN]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) [AC_MSG_RESULT([default])])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) AC_CONFIG_FILES([Makefile libsrc/Makefile src/Makefile])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) AC_OUTPUT