Linux: Don't waste autoconf checks on cpp defines
[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 vfs_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_HAVE_KMEM_CACHE_T], [
380   AC_CHECK_LINUX_BUILD([whether kmem_cache_t exists],
381                        [ac_cv_linux_have_kmem_cache_t],
382                        [#include <linux/slab.h>],
383                        [kmem_cache_t *k;],
384                        [HAVE_KMEM_CACHE_T],
385                        [define if kmem_cache_t exists])
386 ])
387
388
389 AC_DEFUN([LINUX_KMEM_CACHE_CREATE_TAKES_DTOR], [
390   AC_CHECK_LINUX_BUILD([whether kmem_cache_create takes a destructor argument],
391                        [ac_cv_linux_kmem_cache_create_takes_dtor],
392                        [#include <linux/slab.h>],
393                        [kmem_cache_create(NULL, 0, 0, 0, NULL, NULL);],
394                        [KMEM_CACHE_TAKES_DTOR],
395                        [define if kmem_cache_create takes a destructor argument])
396 ])
397
398
399 AC_DEFUN([LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID],[
400   AC_CACHE_CHECK([whether kmem_cache_create constructor takes a void pointer],
401                  [ac_cv_linux_kmem_cache_create_ctor_takes_void], [
402     save_CPPFLAGS="$CPPFLAGS"
403     CPPFLAGS="$CPPFLAGS -Werror"
404     AC_TRY_KBUILD([#include <linux/slab.h>],
405                   [void _ctor(void *v) { }; kmem_cache_create(NULL, 0, 0, 0, _ctor);],
406                   ac_cv_linux_kmem_cache_create_ctor_takes_void=yes,
407                   ac_cv_linux_kmem_cache_create_ctor_takes_void=no)
408     CPPFLAGS="$save_CPPFLAGS"
409   ])
410   AS_IF([test "x$ac_cv_linux_kmem_cache_create_ctor_takes_void" = "xyes"],
411         [AC_DEFINE([KMEM_CACHE_CTOR_TAKES_VOID], 1,
412                    [define if kmem_cache_create constructor takes a single void ptr])])
413 ])
414
415
416 dnl This function checks not just the existence of the splice functions,
417 dnl but also that the signature matches (they gained an extra argument
418 dnl around 2.6.17)
419 AC_DEFUN([LINUX_FS_STRUCT_FOP_HAS_SPLICE], [
420   AC_CHECK_LINUX_BUILD([for splice_write and splice_read in struct file_operations],
421                        [ac_cv_linux_fs_struct_fop_has_splice],
422                        [#include <linux/fs.h>],
423                        [struct file_operations _fop;
424                         _fop.splice_write(NULL, NULL, NULL, 0, 0);
425                         _fop.splice_read(NULL, NULL, NULL, 0, 0);],
426                        [STRUCT_FILE_OPERATIONS_HAS_SPLICE],
427                        [define if struct file_operations has splice functions])
428 ])
429
430
431 AC_DEFUN([LINUX_KMEM_CACHE_INIT], [
432   AC_CHECK_LINUX_BUILD([for new kmem_cache init function parameters],
433                        [ac_cv_linux_kmem_cache_init],
434                        [#include <linux/slab.h>],
435                        [extern struct kmem_cache *
436                         kmem_cache_create(const char *, size_t, size_t,
437                                           unsigned long,
438                                           void (*)(struct kmem_cache *, void *));
439                         return;],
440                        [KMEM_CACHE_INIT],
441                        [define for new kmem_cache init function parameters])
442 ])
443
444
445 AC_DEFUN([LINUX_SYSCTL_TABLE_CHECKING], [
446   AC_CHECK_LINUX_BUILD([for sysctl table checking],
447                        [ac_cv_linux_sysctl_table_checking],
448                        [#include <linux/sysctl.h>],
449                        [extern int sysctl_check_table(int) __attribute__((weak));
450                         sysctl_check_table(NULL);],
451                        [SYSCTL_TABLE_CHECKING],
452                        [define if your kernel has sysctl table checking])
453 ])
454
455
456 AC_DEFUN([LINUX_EXPORTS_PROC_ROOT_FS], [
457   AC_CHECK_LINUX_BUILD([if proc_root_fs is defined and exported],
458                        [ac_cv_linux_exports_proc_root_fs],
459                        [#include <linux/proc_fs.h>],
460                        [struct proc_dir_entry *p = proc_root_fs;],
461                        [EXPORTED_PROC_ROOT_FS],
462                        [define if proc_root_fs is exported])
463 ])
464
465
466 AC_DEFUN([LINUX_D_PATH_TAKES_STRUCT_PATH], [
467   AC_CHECK_LINUX_BUILD([if d_path() takes a struct path argument],
468                        [ac_cv_linux_d_path_takes_struct_path],
469                        [#include <linux/dcache.h>],
470                        [struct path *p; d_path(p, NULL, 0);],
471                        [D_PATH_TAKES_STRUCT_PATH],
472                        [define if d_path() takes a struct path argument])
473 ])
474
475
476 AC_DEFUN([LINUX_NEW_EXPORT_OPS], [
477   AC_CHECK_LINUX_BUILD([if kernel uses new export ops],
478                        [ac_cv_linux_new_export_ops],
479                        [#include <linux/exportfs.h>],
480                        [struct export_operations _eops;
481                         eops.fh_to_parent(NULL, NULL, 0, 0);],
482                        [NEW_EXPORT_OPS],
483                        [define if kernel uses new export ops])
484 ])
485
486
487 AC_DEFUN([LINUX_POSIX_TEST_LOCK_RETURNS_CONFLICT], [
488   AC_CHECK_LINUX_BUILD([if posix_test_lock returns a struct file_lock],
489                        [ac_cv_linux_posix_test_lock_returns_conflict],
490                        [#include <linux/fs.h>],
491                        [struct file_lock *lock;
492                         struct file * file;
493                         lock = posix_test_lock(file, lock);],
494                        [POSIX_TEST_LOCK_RETURNS_CONFLICT],
495                        [define if posix_test_lock returns the conflicting lock])
496 ])
497
498
499 AC_DEFUN([LINUX_POSIX_TEST_LOCK_CONFLICT_ARG], [
500   AC_CHECK_LINUX_BUILD([if posix_test_lock takes a conflict argument],
501                        [ac_cv_linux_posix_test_lock_conflict_arg],
502                        [#include <linux/fs.h>],
503                        [struct file_lock *lock;
504                         struct file *file;
505                         posix_test_lock(file, lock, lock);],
506                        [POSIX_TEST_LOCK_CONFLICT_ARG],
507                        [define if posix_test_lock takes a conflict argument])
508 ])
509
510
511 AC_DEFUN([LINUX_EXPORTS_KEY_TYPE_KEYRING], [
512   AC_CHECK_LINUX_BUILD([for exported key_type_keyring],
513                        [ac_cv_linux_exports_key_type_keyring],
514 [
515 #ifdef HAVE_LINUX_KEY_TYPE_H
516 #include <linux/key-type.h>
517 #endif
518 #include <linux/key.h>
519 ],
520                        [printk("%s", key_type_keyring.name);],
521                        [EXPORTED_KEY_TYPE_KEYRING],
522                        [define if key_type_keyring is exported])
523 ])
524
525
526 AC_DEFUN([LINUX_KEYS_HAVE_SESSION_TO_PARENT], [
527   AC_CHECK_LINUX_BUILD([for KEYCTL_SESSION_TO_PARENT],
528                        [ac_cv_linux_have_session_to_parent],
529                        [#include <linux/keyctl.h>],
530                        [int i = KEYCTL_SESSION_TO_PARENT;],
531                        [HAVE_SESSION_TO_PARENT],
532                        [define if keyctl has the KEYCTL_SESSION_TO_PARENT function])
533 ])
534
535
536 AC_DEFUN([LINUX_HAVE_TRY_TO_FREEZE], [
537   AC_CHECK_LINUX_BUILD([for try_to_freeze],
538                        [ac_cv_linux_have_try_to_freeze],
539 [#include <linux/sched.h>
540 #ifdef HAVE_LINUX_FREEZER_H
541 #include <linux/freezer.h>
542 #endif],
543 [#ifdef LINUX_REFRIGERATOR_TAKES_PF_FREEZE
544    try_to_freeze(PF_FREEZE);
545 #else
546    try_to_freeze();
547 #endif],
548                        [HAVE_TRY_TO_FREEZE],
549                        [define if your kernel has the try_to_freeze function])
550 ])
551