dnl -*- shell-script -*- dnl Process this file with autoconf to produce a configure script. dnl we need autoconf >= 2.50 AC_PREREQ(2.50) AC_INIT(kernel/mpio.c) dnl AM_CONFIG_HEADER(src/config.h) AC_CANONICAL_SYSTEM() AC_MSG_RESULT(Building for a ${host} host.) AM_INIT_AUTOMAKE(mpio, 0.7.1-2003101901) dnl Checks for programs. AC_PROG_MAKE_SET AC_PROG_CC AM_PROG_LIBTOOL dnl Check for endianess AC_LANG_C AC_C_BIGENDIAN dnl Checks for header files. AC_CHECK_HEADER(getopt.h,HAVE_GETOPT_H=1,HAVE_GETOPT_H=0) AC_SUBST(HAVE_GETOPT_H) dnl --- checking for readline AC_CHECK_HEADER(readline/readline.h,, AC_ERROR(could not find readline header files)) dnl --- include mplib if not disabled manually AC_DEFUN([TEST_MPLIB], [AC_ARG_WITH([mplib], AC_HELP_STRING([--without-mplib], [disable use of mplib]), [ac_cv_use_mplib=$withval], [ac_cv_use_mplib=yes]) AC_CACHE_CHECK([whether to use mplib], [ac_cv_use_mplib], [ac_cv_use_mplib=yes])]) TEST_MPLIB if test "$ac_cv_use_mplib" = yes; then MPLIB_INCLUDE=-Implib MPLIB_CFLAGS=-DMPLIB fi AC_SUBST(MPLIB_INCLUDE) AC_SUBST(MPLIB_CFLAGS) dnl -- check for libusb dnl -- this is stolen from libgphoto2 AC_PATH_PROG(LIBUSB_CONFIG,libusb-config) if test -n "${LIBUSB_CONFIG}"; then CPPFLAGS_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS `$LIBUSB_CONFIG --cflags`" AC_CHECK_HEADER(usb.h,[ LDFLAGS_orig="$LDFLAGS" LDFLAGS="`$LIBUSB_CONFIG --libs`" AC_CHECK_LIB(usb,usb_busses,[ usb_msg="yes" IOLIB_SUBDIRS="$IOLIB_SUBDIRS usb" USB_LIBS="`$LIBUSB_CONFIG --libs`" USB_CFLAGS="`$LIBUSB_CONFIG --cflags`" LIBUSB_VER="`$LIBUSB_CONFIG --version`"],[ usb_msg="no (available version too old)"]) LDFLAGS="$LDFLAGS_orig"]) CPPFLAGS="$CPPFLAGS_save" fi # This 'test' call uses non-standard syntax and will fail on most # systems, but it's just informational so any warning can be ignored. if test "$LIBUSB_VER" \< "0.1.6"; then AC_MSG_WARN([ *** You need at least version 0.1.6 of the libusb library for USB support *** http://sourceforge.net/projects/libusb/ *** If you cannot find the appropriate version, try CVS ]) fi case "$usb_msg" in yes*) AC_DEFINE(HAVE_USB,1,[Whether you have USB support enabled]);; *) ;; esac AC_SUBST(USB_CFLAGS) AC_SUBST(USB_LIBS) dnl --- check for kernel version kernel_version=`uname -r 2>&1` echo -n "checking for kernel version ... " case "$kernel_version" in '') kernel_version="?.??"; _k_verc_fail=yes;; [0-1].[0-9].[0-9]*|2.[0-1].[0-9]*) _k_verc_fail=no;; esac echo $kernel_version if test "$_k_verc_fail" ; then echo " Your kernel version is too old." echo " Please update your system to a kernel version of 2.2.x or higher." AC_ERROR(too old) fi MODULE_PATH="/lib/modules/${kernel_version}" if test -d "${MODULE_PATH}/kernel/drivers/usb"; then MODULE_PATH="${MODULE_PATH}/kernel/drivers/usb" SPEC_PATH="kernel/drivers/usb" else MODULE_PATH="${MODULE_PATH}/misc" SPEC_PATH="misc" fi AC_MSG_RESULT(Using module path ${MODULE_PATH}.) AC_SUBST(MODULE_PATH) AC_SUBST(SPEC_PATH) KERNEL_INCLUDE= if test -d "/lib/modules/${kernel_version}/build/include"; then KERNEL_INCLUDE="/lib/modules/${kernel_version}/build/include" elif test -d "/usr/src/linux-2.4/include"; then KERNEL_INCLUDE="/usr/src/linux-2.4/include" elif test -d "/usr/include/linux"; then KERNEL_INCLUDE="/usr/include/linux" elif test -d "/usr/src/linux/include"; then KERNEL_INCLUDE="/usr/src/linux/include" fi if test -z ${KERNEL_INCLUDE}; then AC_ERROR(could not find directory of kernel include files) else AC_MSG_RESULT(Using kernel includes from ${KERNEL_INCLUDE}) fi AC_SUBST(KERNEL_INCLUDE) dnl ------------------------------------------------------------ # could not find a way to compile the kernel module correctly # kernel/Makefile AC_OUTPUT( Makefile kernel/Makefile libmpio/Makefile mpiosh/Makefile etc/Makefile tools/Makefile mpio.spec )