1dnl Checks for required headers and functions
2dnl
3dnl Version: 20200713
4
5dnl Function to detect if libcreg dependencies are available
6AC_DEFUN([AX_LIBCREG_CHECK_LOCAL],
7  [dnl Headers included in libcreg/libcreg_file.h, libcreg/libcreg_key.h
8  dnl libcreg/libcreg_key_item_values.h and libcreg/libcreg_value_item_values.h
9  AC_CHECK_HEADERS([wctype.h])
10
11  dnl Functions used in libcreg/libcreg_file.h, libcreg/libcreg_key.h
12  dnl libcreg/libcreg_key_item_values.h and libcreg/libcreg_value_item_values.h
13  AC_CHECK_FUNCS([towupper])
14
15  AS_IF(
16    [test "x$ac_cv_func_towupper" != xyes],
17    [AC_MSG_FAILURE(
18      [Missing function: towupper],
19      [1])
20  ])
21
22  dnl Check for internationalization functions in libcreg/libcreg_i18n.c
23  AC_CHECK_FUNCS([bindtextdomain])
24])
25
26dnl Function to detect if cregtools dependencies are available
27AC_DEFUN([AX_CREGTOOLS_CHECK_LOCAL],
28  [AC_CHECK_HEADERS([signal.h sys/signal.h unistd.h])
29
30  AC_CHECK_FUNCS([close getopt setvbuf])
31
32  AS_IF(
33   [test "x$ac_cv_func_close" != xyes],
34   [AC_MSG_FAILURE(
35     [Missing function: close],
36     [1])
37  ])
38
39  dnl Headers included in cregtools/log_handle.c
40  AC_CHECK_HEADERS([stdarg.h varargs.h])
41
42  AS_IF(
43    [test "x$ac_cv_header_stdarg_h" != xyes && test "x$ac_cv_header_varargs_h" != xyes],
44    [AC_MSG_FAILURE(
45      [Missing headers: stdarg.h and varargs.h],
46      [1])
47  ])
48
49  dnl Headers included in cregtools/cregmount.c
50  AC_CHECK_HEADERS([errno.h])
51
52  AC_HEADER_TIME
53
54  dnl Functions included in cregtools/mount_file_system.c and cregtools/mount_file_entry.c
55  AS_IF(
56    [test "x$ac_cv_enable_winapi" = xno],
57    [AC_CHECK_FUNCS([clock_gettime getegid geteuid time])
58  ])
59])
60
61dnl Function to check if DLL support is needed
62AC_DEFUN([AX_LIBCREG_CHECK_DLL_SUPPORT],
63  [AS_IF(
64    [test "x$enable_shared" = xyes && test "x$ac_cv_enable_static_executables" = xno],
65    [AS_CASE(
66      [$host],
67      [*cygwin* | *mingw* | *msys*],
68      [AC_DEFINE(
69        [HAVE_DLLMAIN],
70        [1],
71        [Define to 1 to enable the DllMain function.])
72      AC_SUBST(
73        [HAVE_DLLMAIN],
74        [1])
75
76      AC_SUBST(
77        [LIBCREG_DLL_EXPORT],
78        ["-DLIBCREG_DLL_EXPORT"])
79
80      AC_SUBST(
81        [LIBCREG_DLL_IMPORT],
82        ["-DLIBCREG_DLL_IMPORT"])
83      ])
84    ])
85  ])
86
87