Skip to content

Commit

Permalink
Improve compilability on Linux 3.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Jan 15, 2013
1 parent 9d94c88 commit be5aaf1
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 99 deletions.
3 changes: 3 additions & 0 deletions config-linuxmodule.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
/* Define if your Linux kernel has files_lglock. */
#undef HAVE_LINUX_FILES_LGLOCK

/* Define if you have the d_make_root function. */
#undef HAVE_LINUX_D_MAKE_ROOT

/* Define if your Linux kernel has dev_ioctl. */
#undef HAVE_LINUX_DEV_IOCTL

Expand Down
144 changes: 87 additions & 57 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -10861,6 +10861,58 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_aware_system" >&5
$as_echo "$ac_cv_cxx_aware_system" >&6; }

if test $ac_cv_cxx_aware_system = yes; then
DRIVERS="$DRIVERS linuxmodule"
TOOL_TARGETS="$TOOL_TARGETS click-install"
$as_echo "#define HAVE_LINUXMODULE_DRIVER 1" >>confdefs.h

HAVE_LINUXMODULE_DRIVER=1
elif test x$enable_linuxmodule_default = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
=========================================
Your Linux kernel header files cause errors when included by a C++ program,
so I won't try to compile the linuxmodule driver.
Click modifies the Linux kernel's header files to make them work with
C++, using the program 'linuxmodule/fixincludes.pl'. It looks like
your kernel header files have features that 'linuxmodule/fixincludes.pl'
doesn't know how to fix. You can report this error to us on the Click
mailing list, or, even better, try to fix the error. See the config.log
file for more information on the error.
=========================================" >&5
$as_echo "$as_me: WARNING:
=========================================
Your Linux kernel header files cause errors when included by a C++ program,
so I won't try to compile the linuxmodule driver.
Click modifies the Linux kernel's header files to make them work with
C++, using the program 'linuxmodule/fixincludes.pl'. It looks like
your kernel header files have features that 'linuxmodule/fixincludes.pl'
doesn't know how to fix. You can report this error to us on the Click
mailing list, or, even better, try to fix the error. See the config.log
file for more information on the error.
=========================================" >&2;}
else
as_fn_error $? "
=========================================
Your Linux kernel header files cause errors when included by a C++ program.
Click modifies the Linux kernel's header files to make them work with
C++, using the program 'linuxmodule/fixincludes.pl'. It looks like
your kernel header files have features that 'linuxmodule/fixincludes.pl'
doesn't know how to fix. You can report this error to us on the Click
mailing list, or, even better, try to fix the error. See the config.log
file for more information on the error.
=========================================" "$LINENO" 5
fi

if test $ac_cv_cxx_aware_system = yes; then

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether long and int64_t are the same type in the Linux kernel" >&5
$as_echo_n "checking whether long and int64_t are the same type in the Linux kernel... " >&6; }
Expand Down Expand Up @@ -11954,6 +12006,40 @@ $as_echo "#define HAVE_LINUX_ATOMIC_CMPXCHG 1" >>confdefs.h

fi

ac_fn_c_check_decl "$LINENO" "d_make_root" "ac_cv_have_decl_d_make_root" "#if HAVE_LINUXMODULE_2_6
# define KBUILD_STR(s) #s
# define KBUILD_BASENAME KBUILD_STR(click)
# define KBUILD_MODNAME KBUILD_STR(click)
#endif
#define new linux_new
#define this linux_this
#define delete linux_delete
#define class linux_class
#define virtual linux_virtual
#define typename linux_typename
#define private linux_private
#define protected linux_protected
#define public linux_public
#define namespace linux_namespace
#define false linux_false
#define true linux_true
#define CLICK_CXX_PROTECTED 1
$linux_autoconf_include
#include <asm/types.h>
#include <linux/dcache.h>
"
if test "x$ac_cv_have_decl_d_make_root" = xyes; then :
ac_cv_linux_d_make_root=yes
else
ac_cv_linux_d_make_root=no
fi

if test $ac_cv_linux_d_make_root = yes; then

$as_echo "#define HAVE_LINUX_D_MAKE_ROOT 1" >>confdefs.h

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for netdev_rx_handler_register kernel symbol" >&5
$as_echo_n "checking for netdev_rx_handler_register kernel symbol... " >&6; }
if ${ac_cv_linux_netdev_rx_handler_register+:} false; then :
Expand Down Expand Up @@ -12002,69 +12088,13 @@ $as_echo "$ac_cv_linux_getboottime" >&6; }

fi

fi
CC="$save_cc"
CXX="$save_cxx"
CPPFLAGS="$save_cppflags"
CFLAGS="$save_cflags"
CXXFLAGS="$save_cxxflags"
export CFLAGS CPPFLAGS

if test $ac_cv_cxx_aware_system = yes; then
DRIVERS="$DRIVERS linuxmodule"
TOOL_TARGETS="$TOOL_TARGETS click-install"
$as_echo "#define HAVE_LINUXMODULE_DRIVER 1" >>confdefs.h

HAVE_LINUXMODULE_DRIVER=1
elif test x$enable_linuxmodule_default = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
=========================================
Your Linux kernel header files cause errors when included by a C++ program,
so I won't try to compile the linuxmodule driver.
There are two common reasons for this error:
1. You have not applied the Linux kernel patch that comes with this
distribution. Apply the right patch and try again. See the INSTALL
file for more information.
2. Your Linux configuration enables some functionality that is not yet
covered by our patches. Turn off this functionality and try again,
or fix the error and tell us how you did it. See the config.log file
for more detailed information on the error.
=========================================" >&5
$as_echo "$as_me: WARNING:
=========================================
Your Linux kernel header files cause errors when included by a C++ program,
so I won't try to compile the linuxmodule driver.
There are two common reasons for this error:
1. You have not applied the Linux kernel patch that comes with this
distribution. Apply the right patch and try again. See the INSTALL
file for more information.
2. Your Linux configuration enables some functionality that is not yet
covered by our patches. Turn off this functionality and try again,
or fix the error and tell us how you did it. See the config.log file
for more detailed information on the error.
=========================================" >&2;}
else
as_fn_error $? "
=========================================
Your Linux kernel header files cause errors when included by a C++ program.
There are two common reasons for this error:
1. You have not applied the Linux kernel patch that comes with this
distribution. Apply the right patch and try again. See the INSTALL
file for more information.
2. Your Linux configuration enables some functionality that is not yet
covered by our patches. Turn off this functionality and try again,
or fix the error and tell us how you did it. See the config.log file
for more detailed information on the error.
=========================================" "$LINENO" 5
fi
fi


Expand Down
87 changes: 46 additions & 41 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,44 @@ $linux_autoconf_include
#include <linux/skbuff.h>]], [[return 0]])], ac_cv_cxx_aware_system=yes, ac_cv_cxx_aware_system=no)
])

if test $ac_cv_cxx_aware_system = yes; then
DRIVERS="$DRIVERS linuxmodule"
TOOL_TARGETS="$TOOL_TARGETS click-install"
AC_DEFINE(HAVE_LINUXMODULE_DRIVER)
HAVE_LINUXMODULE_DRIVER=1
elif test x$enable_linuxmodule_default = xyes; then
AC_MSG_WARN([
=========================================

Your Linux kernel header files cause errors when included by a C++ program,
so I won't try to compile the linuxmodule driver.

Click modifies the Linux kernel's header files to make them work with
C++, using the program 'linuxmodule/fixincludes.pl'. It looks like
your kernel header files have features that 'linuxmodule/fixincludes.pl'
doesn't know how to fix. You can report this error to us on the Click
mailing list, or, even better, try to fix the error. See the config.log
file for more information on the error.

=========================================])
dnl ' fix syntax highlighting
else
AC_MSG_ERROR([
=========================================

Your Linux kernel header files cause errors when included by a C++ program.

Click modifies the Linux kernel's header files to make them work with
C++, using the program 'linuxmodule/fixincludes.pl'. It looks like
your kernel header files have features that 'linuxmodule/fixincludes.pl'
doesn't know how to fix. You can report this error to us on the Click
mailing list, or, even better, try to fix the error. See the config.log
file for more information on the error.

=========================================])
fi

if test $ac_cv_cxx_aware_system = yes; then

AC_CACHE_CHECK([whether long and int64_t are the same type in the Linux kernel],
ac_cv_long_64_linuxmodule, [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([CLICK_LINUXMODULE_PROLOGUE()[
Expand Down Expand Up @@ -1542,6 +1580,12 @@ CFLAGS="$save_cflags"
AC_DEFINE([HAVE_LINUX_ATOMIC_CMPXCHG], [1], [Define if you have the atomic_cmpxchg function.])
fi

AC_CHECK_DECL([d_make_root], [ac_cv_linux_d_make_root=yes], [ac_cv_linux_d_make_root=no], [CLICK_LINUXMODULE_PROLOGUE()[
#include <linux/dcache.h>]])
if test $ac_cv_linux_d_make_root = yes; then
AC_DEFINE([HAVE_LINUX_D_MAKE_ROOT], [1], [Define if you have the d_make_root function.])
fi

AC_CACHE_CHECK(for netdev_rx_handler_register kernel symbol, ac_cv_linux_netdev_rx_handler_register,
[if grep "__ksymtab_netdev_rx_handler_register" $linux_system_map >/dev/null 2>&1; then
ac_cv_linux_netdev_rx_handler_register=yes
Expand All @@ -1566,53 +1610,14 @@ CFLAGS="$save_cflags"
AC_DEFINE(HAVE_LINUX_GETBOOTTIME)
fi

fi dnl ac_cv_cxx_aware_system

CC="$save_cc"
CXX="$save_cxx"
CPPFLAGS="$save_cppflags"
CFLAGS="$save_cflags"
CXXFLAGS="$save_cxxflags"
export CFLAGS CPPFLAGS

if test $ac_cv_cxx_aware_system = yes; then
DRIVERS="$DRIVERS linuxmodule"
TOOL_TARGETS="$TOOL_TARGETS click-install"
AC_DEFINE(HAVE_LINUXMODULE_DRIVER)
HAVE_LINUXMODULE_DRIVER=1
elif test x$enable_linuxmodule_default = xyes; then
AC_MSG_WARN([
=========================================

Your Linux kernel header files cause errors when included by a C++ program,
so I won't try to compile the linuxmodule driver.

There are two common reasons for this error:
1. You have not applied the Linux kernel patch that comes with this
distribution. Apply the right patch and try again. See the INSTALL
file for more information.
2. Your Linux configuration enables some functionality that is not yet
covered by our patches. Turn off this functionality and try again,
or fix the error and tell us how you did it. See the config.log file
for more detailed information on the error.

=========================================])
dnl ' fix syntax highlighting
else
AC_MSG_ERROR([
=========================================

Your Linux kernel header files cause errors when included by a C++ program.

There are two common reasons for this error:
1. You have not applied the Linux kernel patch that comes with this
distribution. Apply the right patch and try again. See the INSTALL
file for more information.
2. Your Linux configuration enables some functionality that is not yet
covered by our patches. Turn off this functionality and try again,
or fix the error and tell us how you did it. See the config.log file
for more detailed information on the error.

=========================================])
fi
fi


Expand Down
4 changes: 4 additions & 0 deletions linuxmodule/clickfs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,11 @@ click_read_super(struct super_block *sb, void * /* data */, int)
UNLOCK_CONFIG_READ();
if (!root_inode)
goto out_no_root;
#if HAVE_LINUX_D_MAKE_ROOT
sb->s_root = d_make_root(root_inode);
#else
sb->s_root = d_alloc_root(root_inode);
#endif
MDEBUG("got root inode %p:%p", root_inode, root_inode->i_op);
if (!sb->s_root)
goto out_no_root;
Expand Down
1 change: 0 additions & 1 deletion linuxmodule/read-pmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <click/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <asm/system.h>
#if __i386__ || __x86_64__
# include <asm/msr.h>
#endif
Expand Down

0 comments on commit be5aaf1

Please sign in to comment.