diff --git a/icn/Makefile.in b/icn/Makefile.in index 1344f74d..b57bfbf1 100644 --- a/icn/Makefile.in +++ b/icn/Makefile.in @@ -6,7 +6,7 @@ # SHELL = /bin/sh CFLAGS = -Wall -O2 -INCLUDES = -I. @DEBUGVAR@ -I@KERNELDIR@drivers/isdn/icn +INCLUDES = -I. @DEBUGVAR@ -I@KERNELDIR@/drivers/isdn/icn DEFS = LDFLAGS = -L../lib @LIBS@ PROGRAM = icnctrl diff --git a/icn/aclocal.m4 b/icn/aclocal.m4 new file mode 100644 index 00000000..0d5b5a65 --- /dev/null +++ b/icn/aclocal.m4 @@ -0,0 +1,40 @@ +dnl +dnl Try finding linux sourcetree +dnl + +AC_DEFUN(AC_FIND_KERNEL, [ + KERNELDIR="" + lxdir="no" + tst_kerneldir="$CONFIG_KERNELDIR" + + AC_ARG_WITH(kernel, + [ --with-kernel=DIR Set kernel source directory [/usr/src/linux]], + DOTEST="y"; tst_kerneldir="${withval}") + + if test "$DOTEST" = "y" || test "$CONFIG_KERNELDIR" = "y" ; then + AC_MSG_CHECKING([for linux kernel source in ${tst_kerneldir}]) + CPPFLAGS="-nostdinc -I${tst_kerneldir}/drivers/isdn" + AC_TRY_CPP([#include ], lxdir=${tst_kerneldir}, + AC_MSG_RESULT("no")) + fi + if test "$lxdir" = "no" ; then + AC_MSG_CHECKING([for linux kernel source in /usr/src/linux]) + CPPFLAGS="-nostdinc -I/usr/src/linux/drivers/isdn" + AC_TRY_CPP([#include ], lxdir=/usr/src/linux) + fi + if test "$lxdir" = "no" ; then + AC_MSG_RESULT("$lxdir") + AC_MSG_CHECKING([for linux kernel source in /usr/local/src/linux]) + CPPFLAGS="-nostdinc -I/usr/local/src/linux/drivers/isdn" + AC_TRY_CPP([#include ], lxdir=/usr/local/src/linux) + fi + if test "$lxdir" != "no" ; then + AC_MSG_RESULT("yes") + else + lxdir="" + AC_MSG_ERROR("Kernel source not found. You MUST specify a correct path to the linux source in the configuration.") + fi + KERNELDIR="$lxdir" + AC_DEFINE_UNQUOTED(KERNELDIR,"$lxdir") + AC_SUBST(KERNELDIR) +]) diff --git a/icn/configure b/icn/configure index bd353317..fc65d84d 100755 --- a/icn/configure +++ b/icn/configure @@ -13,7 +13,9 @@ ac_default_prefix=/usr/local # Any additions from configure.in: ac_default_prefix=/usr ac_help="$ac_help ---enable-dump Enable dump feature for debugging" + --with-kernel=DIR Set kernel source directory [/usr/src/linux]" +ac_help="$ac_help + --enable-dump Enable dump feature for debugging" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -685,7 +687,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:689: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:691: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -739,13 +741,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:749: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:751: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -754,13 +756,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:764: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:766: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -789,11 +791,11 @@ else ac_cv_c_cross=yes else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then ac_cv_c_cross=no else @@ -811,7 +813,7 @@ if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -819,7 +821,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:823: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:825: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -834,7 +836,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -852,7 +854,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -873,7 +875,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -884,7 +886,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -{ (eval echo configure:888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then : else @@ -911,12 +913,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:920: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:922: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -941,7 +943,6 @@ fi done - for ac_hdr in linux/isdn.h do ac_safe=`echo "$ac_hdr" | tr './\055' '___'` @@ -950,12 +951,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:959: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -973,16 +974,97 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then cat >> confdefs.h <&6 -\ - { echo "configure: error: "Missing linux/isdn.h. Kernel source installed?"" 1>&2; exit 1; } fi done + KERNELDIR="" + lxdir="no" + tst_kerneldir="$CONFIG_KERNELDIR" + + # Check whether --with-kernel or --without-kernel was given. +if test "${with_kernel+set}" = set; then + withval="$with_kernel" + DOTEST="y"; tst_kerneldir="${withval}" +fi + + + if test "$DOTEST" = "y" || test "$CONFIG_KERNELDIR" = "y" ; then + echo $ac_n "checking for linux kernel source in ${tst_kerneldir}""... $ac_c" 1>&6 + CPPFLAGS="-nostdinc -I${tst_kerneldir}/drivers/isdn" + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1005: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + lxdir=${tst_kerneldir} +else + echo "$ac_err" >&5 + rm -rf conftest* + echo "$ac_t"""no"" 1>&6 +fi +rm -f conftest* + fi + if test "$lxdir" = "no" ; then + echo $ac_n "checking for linux kernel source in /usr/src/linux""... $ac_c" 1>&6 + CPPFLAGS="-nostdinc -I/usr/src/linux/drivers/isdn" + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1026: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + lxdir=/usr/src/linux +else + echo "$ac_err" >&5 +fi +rm -f conftest* + fi + if test "$lxdir" = "no" ; then + echo "$ac_t"""$lxdir"" 1>&6 + echo $ac_n "checking for linux kernel source in /usr/local/src/linux""... $ac_c" 1>&6 + CPPFLAGS="-nostdinc -I/usr/local/src/linux/drivers/isdn" + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1046: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + lxdir=/usr/local/src/linux +else + echo "$ac_err" >&5 +fi +rm -f conftest* + fi + if test "$lxdir" != "no" ; then + echo "$ac_t"""yes"" 1>&6 + else + lxdir="" + { echo "configure: error: "Kernel source not found. You MUST specify a correct path to the linux source in the configuration."" 1>&2; exit 1; } + fi + KERNELDIR="$lxdir" + cat >> confdefs.h < conftest.$ac_ext < Autoconf TIOCGETP @@ -1010,7 +1092,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -1038,7 +1120,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1148: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1092,7 +1174,7 @@ else ac_cv_func_mmap=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:1247: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then ac_cv_func_mmap=yes else @@ -1193,7 +1275,6 @@ fi - trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -1327,8 +1408,8 @@ s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@CC@%$CC%g s%@CPP@%$CPP%g -s%@INSTALL@%$INSTALL%g s%@KERNELDIR@%$KERNELDIR%g +s%@INSTALL@%$INSTALL%g s%@DEBUGVAR@%$DEBUGVAR%g s%@MANDATE@%$MANDATE%g s%@I4LCONFDIR@%$I4LCONFDIR%g diff --git a/icn/configure.in b/icn/configure.in index 6b0aeea6..f34581ed 100644 --- a/icn/configure.in +++ b/icn/configure.in @@ -16,14 +16,9 @@ dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h) +AC_CHECK_HEADERS(linux/isdn.h) dnl Find current kernel source -dnl done by dereferencing the symbolic link /usr/include/linux -dnl and then stripping off include/linux from the result. - -AC_CHECK_HEADERS(linux/isdn.h,\ - KERNELDIR="/usr/include/`find /usr/include/linux -maxdepth 0 -printf '%l\n' | sed -e s@include/linux@@`", \ - AC_MSG_ERROR("Missing linux/isdn.h. Kernel source installed?")) - +AC_FIND_KERNEL dnl Checks for typedefs, structures, and compiler characteristics. @@ -32,11 +27,10 @@ AC_PROG_GCC_TRADITIONAL AC_FUNC_MMAP dnl Check, if user wants dump option for debugging -AC_ARG_ENABLE(dump,--enable-dump Enable dump feature for debugging,\ +AC_ARG_ENABLE(dump,[ --enable-dump Enable dump feature for debugging],\ DEBUGVAR=-D__DEBUGVAR__) AC_SUBST(INSTALL) -AC_SUBST(KERNELDIR) AC_SUBST(DEBUGVAR) AC_SUBST(MANDATE) AC_SUBST(I4LCONFDIR) diff --git a/loop/aclocal.m4 b/loop/aclocal.m4 new file mode 100644 index 00000000..0d5b5a65 --- /dev/null +++ b/loop/aclocal.m4 @@ -0,0 +1,40 @@ +dnl +dnl Try finding linux sourcetree +dnl + +AC_DEFUN(AC_FIND_KERNEL, [ + KERNELDIR="" + lxdir="no" + tst_kerneldir="$CONFIG_KERNELDIR" + + AC_ARG_WITH(kernel, + [ --with-kernel=DIR Set kernel source directory [/usr/src/linux]], + DOTEST="y"; tst_kerneldir="${withval}") + + if test "$DOTEST" = "y" || test "$CONFIG_KERNELDIR" = "y" ; then + AC_MSG_CHECKING([for linux kernel source in ${tst_kerneldir}]) + CPPFLAGS="-nostdinc -I${tst_kerneldir}/drivers/isdn" + AC_TRY_CPP([#include ], lxdir=${tst_kerneldir}, + AC_MSG_RESULT("no")) + fi + if test "$lxdir" = "no" ; then + AC_MSG_CHECKING([for linux kernel source in /usr/src/linux]) + CPPFLAGS="-nostdinc -I/usr/src/linux/drivers/isdn" + AC_TRY_CPP([#include ], lxdir=/usr/src/linux) + fi + if test "$lxdir" = "no" ; then + AC_MSG_RESULT("$lxdir") + AC_MSG_CHECKING([for linux kernel source in /usr/local/src/linux]) + CPPFLAGS="-nostdinc -I/usr/local/src/linux/drivers/isdn" + AC_TRY_CPP([#include ], lxdir=/usr/local/src/linux) + fi + if test "$lxdir" != "no" ; then + AC_MSG_RESULT("yes") + else + lxdir="" + AC_MSG_ERROR("Kernel source not found. You MUST specify a correct path to the linux source in the configuration.") + fi + KERNELDIR="$lxdir" + AC_DEFINE_UNQUOTED(KERNELDIR,"$lxdir") + AC_SUBST(KERNELDIR) +]) diff --git a/loop/configure b/loop/configure index 59ce466a..319820d3 100755 --- a/loop/configure +++ b/loop/configure @@ -12,6 +12,8 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_default_prefix=/usr +ac_help="$ac_help + --with-kernel=DIR Set kernel source directory [/usr/src/linux]" ac_help="$ac_help --enable-dump Enable dump feature for debugging" @@ -685,7 +687,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:689: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:691: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -739,13 +741,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:749: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:751: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -754,13 +756,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:764: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:766: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -789,11 +791,11 @@ else ac_cv_c_cross=yes else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then ac_cv_c_cross=no else @@ -811,7 +813,7 @@ if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -819,7 +821,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:823: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:825: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -834,7 +836,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -852,7 +854,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -873,7 +875,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -884,7 +886,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -{ (eval echo configure:888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then : else @@ -911,12 +913,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:920: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:922: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -941,7 +943,6 @@ fi done - for ac_hdr in linux/isdn.h do ac_safe=`echo "$ac_hdr" | tr './\055' '___'` @@ -950,12 +951,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:959: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -973,16 +974,97 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then cat >> confdefs.h <&6 -\ - { echo "configure: error: "Missing linux/isdn.h. Kernel source installed?"" 1>&2; exit 1; } fi done + KERNELDIR="" + lxdir="no" + tst_kerneldir="$CONFIG_KERNELDIR" + + # Check whether --with-kernel or --without-kernel was given. +if test "${with_kernel+set}" = set; then + withval="$with_kernel" + DOTEST="y"; tst_kerneldir="${withval}" +fi + + + if test "$DOTEST" = "y" || test "$CONFIG_KERNELDIR" = "y" ; then + echo $ac_n "checking for linux kernel source in ${tst_kerneldir}""... $ac_c" 1>&6 + CPPFLAGS="-nostdinc -I${tst_kerneldir}/drivers/isdn" + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1005: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + lxdir=${tst_kerneldir} +else + echo "$ac_err" >&5 + rm -rf conftest* + echo "$ac_t"""no"" 1>&6 +fi +rm -f conftest* + fi + if test "$lxdir" = "no" ; then + echo $ac_n "checking for linux kernel source in /usr/src/linux""... $ac_c" 1>&6 + CPPFLAGS="-nostdinc -I/usr/src/linux/drivers/isdn" + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1026: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + lxdir=/usr/src/linux +else + echo "$ac_err" >&5 +fi +rm -f conftest* + fi + if test "$lxdir" = "no" ; then + echo "$ac_t"""$lxdir"" 1>&6 + echo $ac_n "checking for linux kernel source in /usr/local/src/linux""... $ac_c" 1>&6 + CPPFLAGS="-nostdinc -I/usr/local/src/linux/drivers/isdn" + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1046: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + lxdir=/usr/local/src/linux +else + echo "$ac_err" >&5 +fi +rm -f conftest* + fi + if test "$lxdir" != "no" ; then + echo "$ac_t"""yes"" 1>&6 + else + lxdir="" + { echo "configure: error: "Kernel source not found. You MUST specify a correct path to the linux source in the configuration."" 1>&2; exit 1; } + fi + KERNELDIR="$lxdir" + cat >> confdefs.h < conftest.$ac_ext < Autoconf TIOCGETP @@ -1010,7 +1092,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -1038,7 +1120,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1148: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1092,7 +1174,7 @@ else ac_cv_func_mmap=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:1247: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then ac_cv_func_mmap=yes else @@ -1193,7 +1275,6 @@ fi - trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -1327,8 +1408,8 @@ s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@CC@%$CC%g s%@CPP@%$CPP%g -s%@INSTALL@%$INSTALL%g s%@KERNELDIR@%$KERNELDIR%g +s%@INSTALL@%$INSTALL%g s%@DEBUGVAR@%$DEBUGVAR%g s%@MANDATE@%$MANDATE%g s%@I4LCONFDIR@%$I4LCONFDIR%g diff --git a/loop/configure.in b/loop/configure.in index 6e1482bb..dbc7667d 100644 --- a/loop/configure.in +++ b/loop/configure.in @@ -16,14 +16,9 @@ dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h) +AC_CHECK_HEADERS(linux/isdn.h) dnl Find current kernel source -dnl done by dereferencing the symbolic link /usr/include/linux -dnl and then stripping off include/linux from the result. - -AC_CHECK_HEADERS(linux/isdn.h,\ - KERNELDIR="/usr/include/`find /usr/include/linux -maxdepth 0 -printf '%l\n' | sed -e s@include/linux@@`", \ - AC_MSG_ERROR("Missing linux/isdn.h. Kernel source installed?")) - +AC_FIND_KERNEL dnl Checks for typedefs, structures, and compiler characteristics. @@ -36,7 +31,6 @@ AC_ARG_ENABLE(dump,--enable-dump Enable dump feature for debugging,\ DEBUGVAR=-D__DEBUGVAR__) AC_SUBST(INSTALL) -AC_SUBST(KERNELDIR) AC_SUBST(DEBUGVAR) AC_SUBST(MANDATE) AC_SUBST(I4LCONFDIR) diff --git a/pcbit/Makefile.in b/pcbit/Makefile.in index 5d759fd0..a894a00b 100644 --- a/pcbit/Makefile.in +++ b/pcbit/Makefile.in @@ -6,7 +6,7 @@ # SHELL = /bin/sh CFLAGS = -Wall -Wstrict-prototypes -O2 -g -INCLUDES = -I. -DDEBUG -I@KERNELDIR@drivers/isdn/pcbit +INCLUDES = -I. -DDEBUG -I@KERNELDIR@/drivers/isdn/pcbit LDFLAGS = -L../lib @LIBS@ PROGRAM = pcbitctl MODULES = pcbitctl.o convhexbin.o diff --git a/pcbit/aclocal.m4 b/pcbit/aclocal.m4 new file mode 100644 index 00000000..0d5b5a65 --- /dev/null +++ b/pcbit/aclocal.m4 @@ -0,0 +1,40 @@ +dnl +dnl Try finding linux sourcetree +dnl + +AC_DEFUN(AC_FIND_KERNEL, [ + KERNELDIR="" + lxdir="no" + tst_kerneldir="$CONFIG_KERNELDIR" + + AC_ARG_WITH(kernel, + [ --with-kernel=DIR Set kernel source directory [/usr/src/linux]], + DOTEST="y"; tst_kerneldir="${withval}") + + if test "$DOTEST" = "y" || test "$CONFIG_KERNELDIR" = "y" ; then + AC_MSG_CHECKING([for linux kernel source in ${tst_kerneldir}]) + CPPFLAGS="-nostdinc -I${tst_kerneldir}/drivers/isdn" + AC_TRY_CPP([#include ], lxdir=${tst_kerneldir}, + AC_MSG_RESULT("no")) + fi + if test "$lxdir" = "no" ; then + AC_MSG_CHECKING([for linux kernel source in /usr/src/linux]) + CPPFLAGS="-nostdinc -I/usr/src/linux/drivers/isdn" + AC_TRY_CPP([#include ], lxdir=/usr/src/linux) + fi + if test "$lxdir" = "no" ; then + AC_MSG_RESULT("$lxdir") + AC_MSG_CHECKING([for linux kernel source in /usr/local/src/linux]) + CPPFLAGS="-nostdinc -I/usr/local/src/linux/drivers/isdn" + AC_TRY_CPP([#include ], lxdir=/usr/local/src/linux) + fi + if test "$lxdir" != "no" ; then + AC_MSG_RESULT("yes") + else + lxdir="" + AC_MSG_ERROR("Kernel source not found. You MUST specify a correct path to the linux source in the configuration.") + fi + KERNELDIR="$lxdir" + AC_DEFINE_UNQUOTED(KERNELDIR,"$lxdir") + AC_SUBST(KERNELDIR) +]) diff --git a/pcbit/configure b/pcbit/configure index 134c3b24..29406d18 100755 --- a/pcbit/configure +++ b/pcbit/configure @@ -12,6 +12,8 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_default_prefix=/usr +ac_help="$ac_help + --with-kernel=DIR Set kernel source directory [/usr/src/linux]" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -601,7 +603,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:605: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:607: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -733,13 +735,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:743: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:745: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -748,13 +750,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:758: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:760: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -783,11 +785,11 @@ else ac_cv_c_cross=yes else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then ac_cv_c_cross=no else @@ -805,7 +807,7 @@ if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -813,7 +815,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:817: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:819: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -828,7 +830,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -846,7 +848,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -867,7 +869,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -878,7 +880,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -{ (eval echo configure:882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then : else @@ -905,12 +907,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:914: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:916: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -935,7 +937,6 @@ fi done - for ac_hdr in linux/isdn.h do ac_safe=`echo "$ac_hdr" | tr './\055' '___'` @@ -944,12 +945,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:953: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:954: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -967,16 +968,98 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then cat >> confdefs.h <&6 -\ - { echo "configure: error: "Missing linux/isdn.h. Kernel source installed?"" 1>&2; exit 1; } fi done + KERNELDIR="" + lxdir="no" + tst_kerneldir="$CONFIG_KERNELDIR" + + # Check whether --with-kernel or --without-kernel was given. +if test "${with_kernel+set}" = set; then + withval="$with_kernel" + DOTEST="y"; tst_kerneldir="${withval}" +fi + + + if test "$DOTEST" = "y" || test "$CONFIG_KERNELDIR" = "y" ; then + echo $ac_n "checking for linux kernel source in ${tst_kerneldir}""... $ac_c" 1>&6 + CPPFLAGS="-nostdinc -I${tst_kerneldir}/drivers/isdn" + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:999: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + lxdir=${tst_kerneldir} +else + echo "$ac_err" >&5 + rm -rf conftest* + echo "$ac_t"""no"" 1>&6 +fi +rm -f conftest* + fi + if test "$lxdir" = "no" ; then + echo $ac_n "checking for linux kernel source in /usr/src/linux""... $ac_c" 1>&6 + CPPFLAGS="-nostdinc -I/usr/src/linux/drivers/isdn" + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1020: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + lxdir=/usr/src/linux +else + echo "$ac_err" >&5 +fi +rm -f conftest* + fi + if test "$lxdir" = "no" ; then + echo "$ac_t"""$lxdir"" 1>&6 + echo $ac_n "checking for linux kernel source in /usr/local/src/linux""... $ac_c" 1>&6 + CPPFLAGS="-nostdinc -I/usr/local/src/linux/drivers/isdn" + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1040: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + lxdir=/usr/local/src/linux +else + echo "$ac_err" >&5 +fi +rm -f conftest* + fi + if test "$lxdir" != "no" ; then + echo "$ac_t"""yes"" 1>&6 + else + lxdir="" + { echo "configure: error: "Kernel source not found. You MUST specify a correct path to the linux source in the configuration."" 1>&2; exit 1; } + fi + KERNELDIR="$lxdir" + cat >> confdefs.h <&6 @@ -985,7 +1068,7 @@ if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext < Autoconf TIOCGETP @@ -1003,7 +1086,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -1031,7 +1114,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1079,7 +1162,6 @@ done - trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -1213,8 +1295,8 @@ s%@CC@%$CC%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@CPP@%$CPP%g -s%@INSTALL@%$INSTALL%g s%@KERNELDIR@%$KERNELDIR%g +s%@INSTALL@%$INSTALL%g CEOF EOF diff --git a/pcbit/configure.in b/pcbit/configure.in index a646ebbf..2c1fb12e 100644 --- a/pcbit/configure.in +++ b/pcbit/configure.in @@ -12,13 +12,9 @@ dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h) +AC_CHECK_HEADERS(linux/isdn.h) dnl Find current kernel source -dnl done by dereferencing the symbolic link /usr/include/linux -dnl and then stripping off include/linux from the result. - -AC_CHECK_HEADERS(linux/isdn.h,\ - KERNELDIR="/usr/include/`find /usr/include/linux -maxdepth 0 -printf '%l\n' | sed -e s@include/linux@@`", \ - AC_MSG_ERROR("Missing linux/isdn.h. Kernel source installed?")) +AC_FIND_KERNEL dnl Checks for typedefs, structures, and compiler characteristics. @@ -27,5 +23,4 @@ AC_PROG_GCC_TRADITIONAL AC_CHECK_FUNCS(strerror) AC_SUBST(INSTALL) -AC_SUBST(KERNELDIR) AC_OUTPUT(Makefile) diff --git a/scripts/config.in b/scripts/config.in index ce4d5b61..2c96234d 100644 --- a/scripts/config.in +++ b/scripts/config.in @@ -20,6 +20,7 @@ mainmenu_option next_comment comment 'General configuration' comment 'Build options' dep_bool 'Build programs which need X11 installed' CONFIG_BUILDX11 $CONFIG_HASX11 +string 'Kernel source directory' CONFIG_KERNELDIR comment 'Destination directories' string 'Directory to install binaries' CONFIG_BINDIR string 'Directory to install admin binaries' CONFIG_SBINDIR diff --git a/scripts/defconfig b/scripts/defconfig index 549741ba..139910df 100644 --- a/scripts/defconfig +++ b/scripts/defconfig @@ -11,6 +11,7 @@ CONFIG_EXPERIMENTAL=n # General configuration # CONFIG_BUILDX11=y +CONFIG_KERNELDIR='/usr/src/linux' CONFIG_BINDIR='/usr/bin' CONFIG_SBINDIR='/sbin' CONFIG_MANDIR='/usr/man'