1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/base.c)
dnl libnjb version
LIBNJB_VERSION=1.1
AC_SUBST(LIBNJB_VERSION)
dnl Check for BASH
dnl This is used because otherwise *BSD will try to use the
dnl default shell --- which is almost always CSH.
AC_PATH_PROGS(POSIXSHELL, bash sh, unfound, $PATH:/usr/local/bin:/opt/bin:/opt/sfw/bin)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
dnl Create libtool
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
dnl Check what operating system this is
dnl AC_CANONICAL_HOST
OSFLAGS=""
AC_MSG_CHECKING(for what OS we need to support)
case $host in
*-linux*)
OS_SUPPORT="linux"
AC_MSG_RESULT(Linux)
;;
*-freebsd*|*-openbsd*|*-netbsd*)
OS_SUPPORT="bsd"
AC_MSG_RESULT(FreeBSD, OpenBSD and/or NetBSD)
;;
*-darwin*)
OS_SUPPORT="darwin"
AC_MSG_RESULT(Darwin and/or MacOS 10)
OSFLAGS="-framework IOKit"
;;
esac
dnl OSFLAGS is used further below
AC_SUBST(OSFLAGS)
AC_SUBST(OS_SUPPORT)
dnl Checks for libraries.
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h)
AC_CHECK_HEADER(usb.h, , no_libusb_h=1)
if test "$no_libusb_h" = "1"
then
AC_MSG_ERROR(
[I can't find the libusb header file on your system. You may
need to set the CPPFLAGS environment variable to include the
search path where you have libusb installed before running
configure (e.g. setenv CPPFLAGS=-I/usr/local/include)])
fi
dnl Check specifically for usleep
AC_MSG_CHECKING(for usleep)
AH_TEMPLATE(HAVE_USLEEP)
AC_EGREP_HEADER(usleep, unistd.h, is_usleep=yes, is_usleep=no)
if test $is_usleep = yes; then
AC_DEFINE(HAVE_USLEEP)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_STRUCT_ST_BLKSIZE
AC_HEADER_TIME
AC_C_BIGENDIAN
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_CHECK_FUNCS(select strdup strerror)
CFLAGSOLD="$CFLAGS"
CFLAGS="$CFLAGS $OSFLAGS"
AC_CHECK_LIB(usb, usb_control_msg, , no_libusb=1)
if test "$no_libusb" = "1"
then
AC_MSG_ERROR([I can't find the libusb libraries on your system. You
may need to set the LDFLAGS environment variable to include the
search path where you have libusb installed before running
configure (e.g. setenv LDFLAGS=-L/usr/local/lib)])
fi
CFLAGS="$CFLAGSOLD"
AC_DEFINE(LIBNJB_COMPILED_FOR_LIBUSB)
dnl Check for hotplug support.
AC_ARG_ENABLE(hotplugging, [ --enable-hotplugging enables the installation of hotplugging scripts], hotplugenable=$enableval, hotplugenable="no")
AC_ARG_WITH(hotplug, [ --with-hotplug=<PATH> specify the location of hotplug scripts on Linux systems], hotplugpath=$withval)
AC_ARG_WITH(hotplugowner, [ --with-hotplugowner=<owner> specify the chown permissions for the jukebox when hotplugged], hotplugowner=$withval)
AC_ARG_WITH(hotplugperms, [ --with-hotplugperms=<perms> specify the chmod permissions for the jukebox when hotplugged], hotplugperms=$withval)
if test "$hotplugpath" = ""
then
hotplugpath="/etc/hotplug"
fi
if test "$hotplugowner" = ""
then
dnl this default value will attempt to run as the console user
hotplugowner="CONSOLE"
fi
if test "$hotplugperms" = ""
then
dnl default to default user+group read/write
hotplugperms="0600"
fi
AC_CHECK_FILE($hotplugpath, have_hotplug="yes", have_hotplug="no")
AC_CHECK_FILE("$hotplugpath/usb", have_usbdir="yes", have_usbdir="no")
dnl If both the hotplug and usb directory exists, just overwrite the old
dnl nomad.usermap with the new version (might add new devices for example).
HOTPLUGENABLE="$hotplugenable"
HOTPLUGPATH=""
if test "$have_usbdir" = "yes"
then
HOTPLUGPATH="$hotplugpath"
fi
HOTPLUGOWNER="$hotplugowner"
HOTPLUGPERMS="$hotplugperms"
AC_SUBST(HOTPLUGENABLE)
AC_SUBST(HOTPLUGPATH)
AC_SUBST(HOTPLUGOWNER)
AC_SUBST(HOTPLUGPERMS)
dnl Output files
AC_CONFIG_HEADER(config.h src/libnjb.h)
AC_OUTPUT(Makefile src/Makefile sample/Makefile nomadjukebox hotplug.sh)
|