Linux: fix statfs configure test
[openafs.git] / src / cf / linux-test4.m4
1 AC_DEFUN([LINUX_EXPORTS_TASKLIST_LOCK], [
2   AC_CHECK_LINUX_BUILD([for exported tasklist_lock],
3                        [ac_cv_linux_exports_tasklist_lock],
4 [#include <linux/sched.h>],
5 [
6 extern rwlock_t tasklist_lock __attribute__((weak)); 
7 read_lock(&tasklist_lock);
8 ],
9                        [EXPORTED_TASKLIST_LOCK],
10                        [define if tasklist_lock exported])
11 ])
12
13 AC_DEFUN([LINUX_COMPLETION_H_EXISTS], [
14   AC_CHECK_LINUX_BUILD([for linux/completion.h],
15                        [ac_cv_linux_completion_h_exists],
16 [#include <linux/version.h>
17 #include <linux/completion.h>],
18 [struct completion _c;
19 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,8)
20 lose
21 #endif],
22                        [HAVE_LINUX_COMPLETION_H]
23                        [Define if your kernel has a usable linux/completion.h])
24 ])
25
26
27 AC_DEFUN([LINUX_EXPORTS_INIT_MM], [
28   AC_CHECK_LINUX_BUILD([for exported init_mm],
29                        [ac_cv_linux_exports_init_mm],
30                        [extern struct mm_struct init_mm;],
31                        [void *address = &init_mm; printk("%p\n", address);],
32                        [EXPORTED_INIT_MM],
33                        [define if your kernel exports init_mm])
34   ])
35
36
37 AC_DEFUN([LINUX_EXPORTS_KALLSYMS_ADDRESS], [
38   AC_CHECK_LINUX_BUILD([for exported kallsyms_address_to_symbol],
39                        [ac_cv_linux_exports_kallsyms_address],
40                        [#include <linux/modversions.h>],
41 [#ifndef __ver_kallsyms_address_to_symbol
42 #error kallsyms_address_to_symbol not exported
43 #endif],
44                        [EXPORTED_KALLSYMS_ADDRESS],
45                        [define if your linux kernel exports kallsyms address])
46 ])
47
48
49 AC_DEFUN([LINUX_EXPORTS_KALLSYMS_SYMBOL], [
50   AC_CHECK_LINUX_BUILD([for exported kallsyms_symbol_to_address],
51                        [ac_cv_linux_exports_kallsyms_symbol],
52                        [#include <linux/modversions.h>],
53 [#ifndef __ver_kallsyms_symbol_to_address
54 #error kallsyms_symbol_to_address not exported
55 #endif],
56                        [EXPORTED_KALLSYMS_SYMBOL],
57                        [define if your linux kernel exports kallsyms])
58 ])
59
60
61 AC_DEFUN([LINUX_EXPORTS_SYS_CALL_TABLE], [
62   AC_CHECK_LINUX_BUILD([for exported sys_call_table],
63                        [ac_cv_linux_exports_sys_call_table],
64                        [#include <linux/modversions.h>],
65 [#ifndef __ver_sys_call_table
66 #error sys_call_table not exported
67 #endif],
68                        [EXPORTED_SYS_CALL_TABLE],
69                        [define if your linux kernel exports sys_call_table])
70 ])
71
72
73 AC_DEFUN([LINUX_EXPORTS_IA32_SYS_CALL_TABLE], [
74   AC_CHECK_LINUX_BUILD([for exported ia32_sys_call_table],
75                        [ac_cv_linux_exports_ia32_sys_call_table],
76                        [#include <linux/modversions.h>],
77 [#ifndef __ver_ia32_sys_call_table
78 #error ia32_sys_call_table not exported
79 #endif],
80                        [EXPORTED_IA32_SYS_CALL_TABLE],
81                        [define if your linux kernel exports ia32_sys_call_table])
82 ])
83
84
85 AC_DEFUN([LINUX_EXPORTS_SYS_CHDIR], [
86   AC_CHECK_LINUX_BUILD([for exported sys_chdir],
87                        [ac_cv_linux_exports_sys_chdir],
88                        [extern asmlinkage long sys_chdir(void) __attribute__((weak));],
89                        [void *address = &sys_chdir; printk("%p\n", address);],
90                        [EXPORTED_SYS_CHDIR],
91                        [define if your linux kernel exports sys_chdir])
92 ])
93
94
95 AC_DEFUN([LINUX_EXPORTS_SYS_OPEN], [
96   AC_CHECK_LINUX_BUILD([for exported sys_open],
97                        [ac_cv_linux_exports_sys_open],
98                        [extern asmlinkage long sys_open(void) __attribute__((weak));],
99                        [void *address = &sys_open; printk("%p\n", address);],
100                        [EXPORTED_SYS_OPEN],
101                        [define if your linux kernel exports sys_open])
102 ])
103
104
105 AC_DEFUN([LINUX_RECALC_SIGPENDING_ARG_TYPE], [
106   AC_CHECK_LINUX_BUILD([for recalc_sigpending arg type],
107                        [ac_cv_linux_func_recalc_sigpending_takes_void],
108                        [#include <linux/sched.h>],
109                        [recalc_sigpending();],
110                        [RECALC_SIGPENDING_TAKES_VOID],
111                        [define if your recalc_sigpending takes void])
112 ])
113
114
115 AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM], [
116   AC_CHECK_LINUX_BUILD([for signal->rlim in struct task_struct],
117                        [ac_cv_linux_sched_struct_task_struct_has_signal_rlim],
118                        [#include <linux/sched.h>],
119                        [struct task_struct _tsk; printk("%d\n", _tsk.signal->rlim);],
120                        [STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM],
121                        [define if your struct task_struct has signal->rlim])
122 ])
123
124
125 AC_DEFUN([LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG], [
126   AC_CHECK_LINUX_BUILD([for 3rd argument in posix_lock_file found in new kernels],
127                        [ac_cv_linux_kernel_posix_lock_file_wait_arg],
128                        [#include <linux/fs.h>],
129                        [posix_lock_file(0,0,0);],
130                        [POSIX_LOCK_FILE_WAIT_ARG],
131                        [define if your kernel uses 3 arguments for posix_lock_file])
132 ])
133
134 AC_DEFUN([LINUX_KERNEL_SOCK_CREATE], [
135   AC_CHECK_LINUX_BUILD([for 5th argument in sock_create found in some SELinux kernels],
136                        [ac_cv_linux_kernel_sock_create_v],
137                        [#include <linux/net.h>],
138                        [sock_create(0,0,0,0,0);],
139                        [LINUX_KERNEL_SOCK_CREATE_V],
140                        [define if your linux kernel uses 5 arguments for sock_create])
141 ])
142
143
144 AC_DEFUN([LINUX_INODE_SETATTR_RETURN_TYPE], [
145   AC_CHECK_LINUX_BUILD([for inode_setattr return type],
146                        [ac_cv_linux_func_inode_setattr_returns_int],
147                        [#include <linux/fs.h>],
148                        [struct inode _inode;
149                         struct iattr _iattr;
150                         int i;
151                         i = inode_setattr(&_inode, &_iattr);],
152                        [INODE_SETATTR_NOT_VOID],
153                        [define if your setattr return return non-void])
154 ])
155
156
157
158 AC_DEFUN([LINUX_AOP_WRITEBACK_CONTROL], [
159   AC_CHECK_LINUX_BUILD([whether aop.writepage takes a writeback_control],
160                        [ac_cv_linux_func_a_writepage_takes_writeback_control],
161 [#include <linux/fs.h>
162 #include <linux/mm.h>
163 #include <linux/writeback.h>],
164 [struct address_space_operations _aops;
165 struct page _page;
166 struct writeback_control _writeback_control;
167 (void)_aops.writepage(&_page, &_writeback_control);],
168                        [AOP_WRITEPAGE_TAKES_WRITEBACK_CONTROL],
169                        [define if aops.writepage takes a struct writeback_control])
170 ])
171
172
173 AC_DEFUN([LINUX_REFRIGERATOR], [
174   AC_CHECK_LINUX_BUILD([whether refrigerator takes PF_FREEZE],
175                        [ac_cv_linux_func_refrigerator_takes_pf_freeze],
176 [#include <linux/sched.h>
177 #ifdef HAVE_LINUX_FREEZER_H
178 #include <linux/freezer.h>
179 #endif],
180                        [refrigerator(PF_FREEZE);],
181                        [LINUX_REFRIGERATOR_TAKES_PF_FREEZE],
182                        [define if your refrigerator takes PF_FREEZE])
183 ])
184
185
186 AC_DEFUN([LINUX_IOP_I_CREATE_TAKES_NAMEIDATA], [
187   AC_CHECK_LINUX_BUILD([whether inode_operations.create takes a nameidata],
188                        [ac_cv_linux_func_i_create_takes_nameidata],
189 [#include <linux/fs.h>
190 #include <linux/namei.h>],
191 [struct inode _inode;
192 struct dentry _dentry;
193 struct nameidata _nameidata;
194 (void)_inode.i_op->create(&_inode, &_dentry, 0, &_nameidata);],
195
196                        [IOP_CREATE_TAKES_NAMEIDATA],
197                        [define if your iops.create takes a nameidata argument])
198 ])
199
200
201 AC_DEFUN([LINUX_IOP_I_LOOKUP_TAKES_NAMEIDATA], [
202   AC_CHECK_LINUX_BUILD([whether inode_operations.lookup takes a nameidata],
203                        [ac_cv_linux_func_i_lookup_takes_nameidata],
204 [#include <linux/fs.h>
205 #include <linux/namei.h>],
206 [struct inode _inode;
207 struct dentry _dentry;
208 struct nameidata _nameidata;
209 (void)_inode.i_op->lookup(&_inode, &_dentry, &_nameidata);],
210                        [IOP_LOOKUP_TAKES_NAMEIDATA],
211                        [define if your iops.lookup takes a nameidata argument])
212 ])
213
214
215 AC_DEFUN([LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA], [
216   AC_CHECK_LINUX_BUILD([whether inode_operations.permission takes a nameidata],
217                        [ac_cv_linux_func_i_permission_takes_nameidata],
218 [#include <linux/fs.h>
219 #include <linux/namei.h>],
220 [struct inode _inode;
221 struct dentry _dentry;
222 struct nameidata _nameidata;
223 (void)_inode.i_op->permission(&_inode, 0, &_nameidata);],
224                        [IOP_PERMISSION_TAKES_NAMEIDATA],
225                        [define if your iops.permission takes a nameidata argument])
226 ])
227
228
229 AC_DEFUN([LINUX_IOP_I_PUT_LINK_TAKES_COOKIE], [
230   AC_CHECK_LINUX_BUILD([whether inode_operations.put_link takes an opaque cookie],
231                        [ac_cv_linux_func_i_put_link_takes_cookie],
232 [#include <linux/fs.h>
233 #include <linux/namei.h>],
234 [struct inode _inode;
235 struct dentry _dentry;
236 struct nameidata _nameidata;
237 void *cookie;
238 (void)_inode.i_op->put_link(&_dentry, &_nameidata, cookie);],
239                        [IOP_PUT_LINK_TAKES_COOKIE],
240                        [define if your iops.put_link takes a cookie])
241 ])
242
243
244 AC_DEFUN([LINUX_DOP_D_REVALIDATE_TAKES_NAMEIDATA], [
245   AC_CHECK_LINUX_BUILD([whether dentry_operations.d_revalidate takes a nameidata],
246                        [ac_cv_linux_func_d_revalidate_takes_nameidata],
247 [#include <linux/fs.h>
248 #include <linux/namei.h>],
249 [struct dentry _dentry;
250 struct nameidata _nameidata;
251 (void)_dentry.d_op->d_revalidate(&_dentry, &_nameidata);],
252                        [DOP_REVALIDATE_TAKES_NAMEIDATA],
253                        [define if your dops.d_revalidate takes a nameidata argument])
254 ])
255
256
257 AC_DEFUN([LINUX_GET_SB_HAS_STRUCT_VFSMOUNT], [
258   AC_CHECK_LINUX_BUILD([for struct vfsmount * in get_sb_nodev()],
259                        [ac_cv_linux_get_sb_has_struct_vfsmount],
260                        [#include <linux/fs.h>],
261                        [get_sb_nodev(0,0,0,0,0);],
262                        [GET_SB_HAS_STRUCT_VFSMOUNT],
263                        [define if your get_sb_nodev needs a struct vfsmount argument])
264 ])
265
266
267 AC_DEFUN([LINUX_STATFS_TAKES_DENTRY], [
268   AC_CHECK_LINUX_BUILD([for dentry in statfs],
269                        [ac_cv_linux_statfs_takes_dentry],
270 [#include <linux/fs.h>
271 #include <linux/statfs.h>],
272 [extern int simple_statfs(struct dentry *, struct kstatfs *);],
273                        [STATFS_TAKES_DENTRY],
274                        [define if your statfs takes a dentry argument])
275 ])
276
277
278 AC_DEFUN([LINUX_LINUX_KEYRING_SUPPORT], [
279   AC_CHECK_LINUX_BUILD([for linux kernel keyring support],
280                        [ac_cv_linux_keyring_support],
281 [#include <linux/rwsem.h>
282 #ifdef HAVE_LINUX_KEY_TYPE_H
283 #include <linux/key-type.h>
284 #endif
285 #include <linux/key.h>
286 #include <linux/keyctl.h>],
287 [#ifdef CONFIG_KEYS
288 request_key(NULL, NULL, NULL);
289 #if !defined(KEY_POS_VIEW) || !defined(KEY_POS_SEARCH) || !defined(KEY_POS_SETATTR) 
290 #error "Your linux/key.h does not contain KEY_POS_VIEW or KEY_POS_SEARCH or KEY_POS_SETATTR"
291 #endif
292 #else
293 #error rebuild your kernel with CONFIG_KEYS
294 #endif],
295                        [LINUX_KEYRING_SUPPORT],
296                        [define if your kernel has keyring support])
297 ])
298
299
300 AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK], [
301   AC_CACHE_CHECK([if key_alloc() takes a struct task *],
302                  [ac_cv_key_alloc_needs_struct_task],
303 [
304     save_CPPFLAGS="$CPPFLAGS"
305     CPPFLAGS="$CPPFLAGS -Werror -Wno-pointer-arith"
306     AC_TRY_KBUILD(
307 [#include <linux/rwsem.h>
308 #include <linux/key.h>
309 ],
310 [struct task_struct *t=NULL;
311 (void) key_alloc(NULL, NULL, 0, 0, t, 0, 0);],
312       ac_cv_key_alloc_needs_struct_task=yes,
313       ac_cv_key_alloc_needs_struct_task=no)
314     CPPFLAGS="$save_CPPFLAGS"])
315   AS_IF([test "x$ac_cv_key_alloc_needs_struct_task" = "xyes"],
316         [AC_DEFINE([KEY_ALLOC_NEEDS_STRUCT_TASK], 1,
317                    [define if key_alloc takes a struct task *])])
318 ])
319
320
321 AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_CRED], [
322   AC_CACHE_CHECK([if key_alloc() takes credentials],
323                   [ac_cv_key_alloc_needs_cred],
324 [
325     save_CPPFLAGS="$CPPFLAGS"
326     CPPFLAGS="$CPPFLAGS -Werror -Wno-pointer-arith"
327     AC_TRY_KBUILD(
328 [#include <linux/rwsem.h>
329 #include <linux/key.h>],
330 [struct cred *c = NULL;
331 (void) key_alloc(NULL, NULL, 0, 0, c, 0, 0);],
332       ac_cv_key_alloc_needs_cred=yes,
333       ac_cv_key_alloc_needs_cred=no)
334     CPPFLAGS="$save_CPPFLAGS"])
335   AS_IF([test "x$ac_cv_key_alloc_needs_cred" = "xyes"],
336         [AC_DEFINE([KEY_ALLOC_NEEDS_CRED], 1,
337                    [define if key_alloc takes credentials])])
338 ])
339
340
341 AC_DEFUN([LINUX_INIT_WORK_HAS_DATA], [
342   AC_CHECK_LINUX_BUILD([whether INIT_WORK has a _data argument],
343                        [ac_cv_linux_init_work_has_data],
344 [#include <linux/kernel.h>
345 #include <linux/workqueue.h>],
346
347 void f(struct work_struct *w) {}
348 struct work_struct *w;
349 int *i;
350 INIT_WORK(w,f,i);],
351                        [INIT_WORK_HAS_DATA],
352                        [define if INIT_WORK takes a data (3rd) argument])
353 ])
354
355
356 AC_DEFUN([LINUX_REGISTER_SYSCTL_TABLE_NOFLAG], [
357   AC_CHECK_LINUX_BUILD([whether register_sysctl_table has an insert_at_head argument],
358                        [ac_cv_linux_register_sysctl_table_noflag],
359                        [#include <linux/sysctl.h>],
360                        [ctl_table *t; register_sysctl_table (t);],
361                        [REGISTER_SYSCTL_TABLE_NOFLAG],
362                        [define if register_sysctl_table has no insert_at head flag])
363 ])
364
365
366 AC_DEFUN([LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T], [
367   AC_CHECK_LINUX_BUILD([whether file_operations.flush takes a fl_owner_t],
368                        [ac_cv_linux_func_f_flush_takes_fl_owner_t],
369                        [#include <linux/fs.h>],
370 [struct inode _inode;
371 struct file _file;
372 fl_owner_t id;
373 (void)_inode.i_fop->flush(&_file, &id);],
374                        [FOP_FLUSH_TAKES_FL_OWNER_T],
375                        [define if your fops.flush takes an fl_owner_t argument])
376 ])
377
378
379 AC_DEFUN([LINUX_FOP_F_FSYNC_TAKES_DENTRY], [
380   AC_CHECK_LINUX_BUILD([whether file_operations.fsync takes a dentry argument],
381                        [ac_cv_linux_func_f_fsync_takes_dentry],
382                        [#include <linux/fs.h>],
383 [struct inode _inode;
384 struct file _file;
385 struct dentry _d;
386 (void)_inode.i_fop->fsync(&_file, &_d, 0);],
387                        [FOP_FSYNC_TAKES_DENTRY],
388                        [define if your fops.fsync takes an dentry argument])
389 ])
390
391
392 AC_DEFUN([LINUX_HAVE_KMEM_CACHE_T], [
393   AC_CHECK_LINUX_BUILD([whether kmem_cache_t exists],
394                        [ac_cv_linux_have_kmem_cache_t],
395                        [#include <linux/slab.h>],
396                        [kmem_cache_t *k;],
397                        [HAVE_KMEM_CACHE_T],
398                        [define if kmem_cache_t exists])
399 ])
400
401
402 AC_DEFUN([LINUX_KMEM_CACHE_CREATE_TAKES_DTOR], [
403   AC_CHECK_LINUX_BUILD([whether kmem_cache_create takes a destructor argument],
404                        [ac_cv_linux_kmem_cache_create_takes_dtor],
405                        [#include <linux/slab.h>],
406                        [kmem_cache_create(NULL, 0, 0, 0, NULL, NULL);],
407                        [KMEM_CACHE_TAKES_DTOR],
408                        [define if kmem_cache_create takes a destructor argument])
409 ])
410
411
412 AC_DEFUN([LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID],[
413   AC_CACHE_CHECK([whether kmem_cache_create constructor takes a void pointer],
414                  [ac_cv_linux_kmem_cache_create_ctor_takes_void], [
415     save_CPPFLAGS="$CPPFLAGS"
416     CPPFLAGS="$CPPFLAGS -Werror"
417     AC_TRY_KBUILD([#include <linux/slab.h>],
418                   [void _ctor(void *v) { }; kmem_cache_create(NULL, 0, 0, 0, _ctor);],
419                   ac_cv_linux_kmem_cache_create_ctor_takes_void=yes,
420                   ac_cv_linux_kmem_cache_create_ctor_takes_void=no)
421     CPPFLAGS="$save_CPPFLAGS"
422   ])
423   AS_IF([test "x$ac_cv_linux_kmem_cache_create_ctor_takes_void" = "xyes"],
424         [AC_DEFINE([KMEM_CACHE_CTOR_TAKES_VOID], 1,
425                    [define if kmem_cache_create constructor takes a single void ptr])])
426 ])
427
428
429 dnl This function checks not just the existence of the splice functions,
430 dnl but also that the signature matches (they gained an extra argument
431 dnl around 2.6.17)
432 AC_DEFUN([LINUX_FS_STRUCT_FOP_HAS_SPLICE], [
433   AC_CHECK_LINUX_BUILD([for splice_write and splice_read in struct file_operations],
434                        [ac_cv_linux_fs_struct_fop_has_splice],
435                        [#include <linux/fs.h>],
436                        [struct file_operations _fop;
437                         _fop.splice_write(NULL, NULL, NULL, 0, 0);
438                         _fop.splice_read(NULL, NULL, NULL, 0, 0);],
439                        [STRUCT_FILE_OPERATIONS_HAS_SPLICE],
440                        [define if struct file_operations has splice functions])
441 ])
442
443
444 AC_DEFUN([LINUX_KMEM_CACHE_INIT], [
445   AC_CHECK_LINUX_BUILD([for new kmem_cache init function parameters],
446                        [ac_cv_linux_kmem_cache_init],
447                        [#include <linux/slab.h>],
448                        [extern struct kmem_cache *
449                         kmem_cache_create(const char *, size_t, size_t,
450                                           unsigned long,
451                                           void (*)(struct kmem_cache *, void *));
452                         return;],
453                        [KMEM_CACHE_INIT],
454                        [define for new kmem_cache init function parameters])
455 ])
456
457
458 AC_DEFUN([LINUX_EXPORTS_PROC_ROOT_FS], [
459   AC_CHECK_LINUX_BUILD([if proc_root_fs is defined and exported],
460                        [ac_cv_linux_exports_proc_root_fs],
461                        [#include <linux/proc_fs.h>],
462                        [struct proc_dir_entry *p = proc_root_fs;],
463                        [EXPORTED_PROC_ROOT_FS],
464                        [define if proc_root_fs is exported])
465 ])
466
467
468 AC_DEFUN([LINUX_D_PATH_TAKES_STRUCT_PATH], [
469   AC_CHECK_LINUX_BUILD([if d_path() takes a struct path argument],
470                        [ac_cv_linux_d_path_takes_struct_path],
471                        [#include <linux/dcache.h>],
472                        [struct path *p; d_path(p, NULL, 0);],
473                        [D_PATH_TAKES_STRUCT_PATH],
474                        [define if d_path() takes a struct path argument])
475 ])
476
477
478 AC_DEFUN([LINUX_NEW_EXPORT_OPS], [
479   AC_CHECK_LINUX_BUILD([if kernel uses new export ops],
480                        [ac_cv_linux_new_export_ops],
481                        [#include <linux/exportfs.h>],
482                        [struct export_operations _eops;
483                         _eops.fh_to_parent(NULL, NULL, 0, 0);],
484                        [NEW_EXPORT_OPS],
485                        [define if kernel uses new export ops])
486 ])
487
488
489 AC_DEFUN([LINUX_POSIX_TEST_LOCK_RETURNS_CONFLICT], [
490   AC_CHECK_LINUX_BUILD([if posix_test_lock returns a struct file_lock],
491                        [ac_cv_linux_posix_test_lock_returns_conflict],
492                        [#include <linux/fs.h>],
493                        [struct file_lock *lock;
494                         struct file * file;
495                         lock = posix_test_lock(file, lock);],
496                        [POSIX_TEST_LOCK_RETURNS_CONFLICT],
497                        [define if posix_test_lock returns the conflicting lock])
498 ])
499
500
501 AC_DEFUN([LINUX_POSIX_TEST_LOCK_CONFLICT_ARG], [
502   AC_CHECK_LINUX_BUILD([if posix_test_lock takes a conflict argument],
503                        [ac_cv_linux_posix_test_lock_conflict_arg],
504                        [#include <linux/fs.h>],
505                        [struct file_lock *lock;
506                         struct file *file;
507                         posix_test_lock(file, lock, lock);],
508                        [POSIX_TEST_LOCK_CONFLICT_ARG],
509                        [define if posix_test_lock takes a conflict argument])
510 ])
511
512
513 AC_DEFUN([LINUX_EXPORTS_KEY_TYPE_KEYRING], [
514   AC_CHECK_LINUX_BUILD([for exported key_type_keyring],
515                        [ac_cv_linux_exports_key_type_keyring],
516 [
517 #ifdef HAVE_LINUX_KEY_TYPE_H
518 #include <linux/key-type.h>
519 #endif
520 #include <linux/key.h>
521 ],
522                        [printk("%s", key_type_keyring.name);],
523                        [EXPORTED_KEY_TYPE_KEYRING],
524                        [define if key_type_keyring is exported])
525 ])
526
527
528 AC_DEFUN([LINUX_HAVE_TRY_TO_FREEZE], [
529   AC_CHECK_LINUX_BUILD([for try_to_freeze],
530                        [ac_cv_linux_have_try_to_freeze],
531 [#include <linux/sched.h>
532 #ifdef HAVE_LINUX_FREEZER_H
533 #include <linux/freezer.h>
534 #endif],
535 [#ifdef LINUX_REFRIGERATOR_TAKES_PF_FREEZE
536    try_to_freeze(PF_FREEZE);
537 #else
538    try_to_freeze();
539 #endif],
540                        [HAVE_TRY_TO_FREEZE],
541                        [define if your kernel has the try_to_freeze function])
542 ])
543