# Process this file with autoconf to produce a configure script. AC_INIT(Makefile.am) AC_CONFIG_AUX_DIR(config) AM_CONFIG_HEADER(config.h) # Separate device libraries. AM_INIT_AUTOMAKE(sisusb, 1.2-002) # # The variable below should track the # version number above to ensure that # all the .so's get appropriately versioned: # # Checks for parameters: # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. # Checks for programs. AC_PROG_CXX AC_PROG_CC AC_PROG_LIBTOOL AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET # AC_PROG_RANLIB # Checks for libraries. AC_CHECK_LIB([cppunit], [main]) AC_CHECK_LIB([dl], [dlopen]) # AC_CHECK_LIB([usb], [usb_busses]) # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h limits.h stdint.h stdlib.h string.h sys/ioctl.h sys/time.h unistd.h]) AC_CHECK_HEADERS([linux/compiler.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_C_CONST AC_C_INLINE AC_TYPE_MODE_T AC_TYPE_SIZE_T AC_HEADER_TIME # Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_FUNC_MALLOC AC_FUNC_MEMCMP AC_TYPE_SIGNAL AC_FUNC_STAT AC_FUNC_STRTOD AC_CHECK_FUNCS([gettimeofday memset pow rint strchr strerror strrchr strtol strtoul]) # Compute the system type: # We can only build on linux-gnu # We also have restrictions on the versions for the drivers. # AC_MSG_CHECKING([operating system ]) if test "$host_os" == "linux-gnu" then kernel_full_version="$(uname -r)" kernel_version="$(echo $kernel_full_version | cut -f1,2 -d.)" AC_MSG_RESULT([Building on $host_os kernel $kernel_version]) else AC_MSG_ERROR([This software can only be built on linux-gnu not $host_os]) fi # We require an installation of libusb.... we'll # hunt in the following locations: # Headers: /usr/include /usr/local/include --with-usb-headerdir=xxxx # Library: /lib /usr/lib /usr/local/lib --with-usb-libdir=xxxx # # If we don't fail, this will result in # USBSWITCHES # USB_LIBS # # Where USBSWITCHES will be added to STD_DEFINES_AND_INCLUDES. # headerdirs="/usr/include /usr/local/include" libdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib" usbheaderdir="" usblibdir="" AC_MSG_CHECKING([for libusb headers]) AC_ARG_WITH(usb-headerdir, [ --with-usb-headerdir=Path to usb.h], [usbheaderdir=$withval],[]) if test "$usbheaderdir" == "" then for dir in $headerdirs do if test "$usbheaderdir" == "" then AC_CHECK_FILE([$dir/usb.h], [usbheaderdir=$dir]) fi done fi if test "$usbheaderdir" != "" then USBSWITCHES="-I${usbheaderdir}" AC_MSG_RESULT([found in $usbheaderdir]) libusbinstalled="yes" else libusbihnstalled="no" fi AC_MSG_CHECKING([for libusb library]) AC_ARG_WITH(usb-libdir, [ --with-usb-libdir=Path to libusb.a], [usblibdir=$withval],[]) if test "$usblibdir" == "" then for dir in $libdirs do # check for shared lib first: if test "$usblibdir" == "" then AC_CHECK_FILE([$dir/libusb.so], [usblibdir=$dir]) fi # then for static: if test "$usblibdir" == "" then AC_CHECK_FILE([$dir/libusb.a], [usblibdir=$dir]) fi done fi if test "$usblibdir" != "" then USB_LIBS="-L${usblibdir} -lusb" AC_MSG_RESULT([found in $usblibdir]) libusbinstalled="yes" else libusbinstalled="no" fi if test "$libusbinstalled" == "no" then AC_MSG_RESULT([Can't find libusb, installing our own copy (0.1.12)]) (cd libusb-0.1.12; ./configure --prefix=$prefix;make install) USBSWITCHES="-I${prefix}/include" USB_LIBS="-L${prefix}/lib -lusb -Wl\"-rpath=${prefix}/lib\"" fi # We now locate The Tcl development software. # TCL headers: # We know of a few places the headers can live: # /usr/include redhat linux. # /usr/include/tcl debian dude that made link to default tcl. # /usr/include/tcl debian linux # /usr/local/include default for source based install. # Whatever the user specifies. # For now, the versions we look for are determined by the # variable tcl_versions that variable is a list of version # number specifiers. # tcl_versions="8.5 8.4 8.3 8.2 8.1 8.0" tcl_header_dir="" AC_MSG_CHECKING([for tcl headers]) AC_ARG_WITH(tcl-header-dir, [ --with-tcl-header-dir=path Path to tcl headers], [tcl_header_dir="$withval" tcl_headers_found="yes"],[tcl_headers_found="no"]) # /usr/include if test $tcl_headers_found == "no"; then AC_CHECK_FILE([/usr/include/tcl.h], [tcl_header_dir="/usr/include" tcl_headers_found="yes"]) fi # /usr/include/tcl if test $tcl_headers_found == "no"; then AC_CHECK_FILE([/usr/include/tcl/tcl.h], [tcl_header_dir="/usr/include/tcl" tcl_headers_found="yes"]) fi # /usr/include/tcl if test $tcl_headers_found == "no" ; then for version in $tcl_versions; do if test $tcl_headers_found == "no" ; then # stop at first match testdir=/usr/include/tcl$version AC_CHECK_FILE([${testdir}/tcl.h], [tcl_header_dir=${testdir} tcl_headers_found="yes"]) fi done fi # /usr/local/include if test $tcl_headers_found == "no"; then AC_CHECK_FILE([/usr/local/include/tcl.h], [tcl_header_dir="/usr/local/include/tcl" tcl_headers_found="yes"]) fi if test $tcl_headers_found == "yes"; then TCL_FLAGS="-I${tcl_header_dir}" AC_MSG_RESULT([found in $tcl_header_dir]) else AC_MSG_ERROR([can't find tcl.h try using --with-tcl-header-dir to help me]) fi # Tcl libraries: # We look for the following: # /usr/lib/libtcl.a - Usually a link to a default lib. # /usr/lib/libtcl.a - version of tcl from tcl_versions # /usr/local/lib/libtcl.a - As above but installed from source. # /usr/local/lib.a - As Above but installed from source. # If --with-tcl-libdir=dir is supplied, that directory is # searched first. # tcl_libsearchpath="" tcl_libfound="no" AC_MSG_CHECKING([Tcl library to use]) # Does the user want us to look somewhere in particular: AC_ARG_WITH(tcl-libdir, [ --with-tcl-libdir=dir Specify where the tcl libraries live.], [tcl_libsearchpath=$withval]) tcl_libsearchpath="$tcl_libsearchpath /usr/lib /usr/local/lib" tcl_libfiles=libtcl.a for v in ${tcl_versions} do tcl_libfiles="$tcl_libfiles libtcl${v}.a" tcl_libfiles="$tcl_libfiles libtcl${v}.so" done for dir in ${tcl_libsearchpath} do for file in ${tcl_libfiles} do fname=$dir/$file if test $tcl_libfound == "no" then AC_CHECK_FILE($fname, [tcl_libdir=$dir tcl_libname=$file tcl_libfound="yes" ]) fi done done if test $tcl_libfound == "yes" then # Find the lib basename: tcl_libname=$(echo $tcl_libname|cut -c 4- ) # trim off lib # # Use basename to trim of the .a or .so: # tcl_libname=$(basename $(basename $tcl_libname .a) .so) echo tcl libname $tcl_libname TCL_LDFLAGS="-L${tcl_libdir} -l${tcl_libname}" else AC_MSG_ERROR([Unable to find the tcl library, help me out with --with-tcl-libdir]) fi # Given that we check for cppunit with check lib we assume its' all in the # normally findable spots: CPPUNITFLAGS="" CPPUNITLDFLAGS="-lcppunit -ldl" # STD_DEFINES_AND_INCLUDES="$USBSWITCHES" AC_SUBST(STD_DEFINES_AND_INCLUDES) AC_SUBST(USB_LIBS) AC_SUBST(CPPUNITFLAGS) AC_SUBST(CPPUNITLDFLAGS) AC_SUBST(TCL_FLAGS) AC_SUBST(TCL_LDFLAGS) AC_SUBST(TCLSH_CMD) #AC_OUTPUT(Makefile \ # loader/Makefile # loader/apps/Makefile \ # loader/lib/Makefile) AC_CONFIG_FILES([Makefile loader/Makefile loader/apps/Makefile loader/lib/Makefile hotplug/Makefile lib/Makefile tcl/Makefile docs/Makefile]) AC_OUTPUT