forked from libyal/libcpath
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathacinclude.m4
More file actions
125 lines (106 loc) · 2.74 KB
/
acinclude.m4
File metadata and controls
125 lines (106 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
dnl Checks for required headers and functions
dnl
dnl Version: 20190308
dnl Function to detect if mkdir is available
dnl Also checks how to use mkdir
AC_DEFUN([AX_LIBCPATH_CHECK_FUNC_MKDIR],
[AC_CHECK_FUNCS([mkdir])
AS_IF(
[test "x$ac_cv_func_mkdir" = xyes],
[AC_MSG_CHECKING(
[how to use mkdir])
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
AC_LANG_PUSH(C)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sys/stat.h>
#include <sys/types.h>]],
[[mkdir( "", 0 )]] )],
[AC_MSG_RESULT(
[with additional mode argument])
ac_cv_cv_mkdir_mode=yes],
[ac_cv_cv_mkdir_mode=no])
AS_IF(
[test "x$ac_cv_cv_mkdir_mode" = xno],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <io.h>]],
[[mkdir( "" )]] )],
[AC_MSG_RESULT(
[with single argument])
ac_cv_cv_mkdir=yes],
[ac_cv_cv_mkdir=no])
])
AC_LANG_POP(C)
CFLAGS="$SAVE_CFLAGS"
AS_IF(
[test "x$ac_cv_cv_mkdir_mode" = xno && test "x$ac_cv_cv_mkdir" = xno],
[AC_MSG_WARN(
[unknown])
ac_cv_func_mkdir=no])
AS_IF(
[test "x$ac_cv_func_mkdir" = xyes],
[AC_DEFINE(
[HAVE_MKDIR],
[1],
[Define to 1 if you have the mkdir function.])
])
AS_IF(
[test "x$ac_cv_cv_mkdir_mode" = xyes],
[AC_DEFINE(
[HAVE_MKDIR_MODE],
[1],
[Define to 1 if you have the mkdir function with a second mode argument.])
])
])
AS_IF(
[test "x$ac_cv_func_mkdir" = xno],
[AC_MSG_FAILURE(
[Missing function: mkdir],
[1])
])
])
dnl Function to detect if libcpath dependencies are available
AC_DEFUN([AX_LIBCPATH_CHECK_LOCAL],
[dnl Headers included in libcpath/libcpath_path.h
AC_CHECK_HEADERS([errno.h sys/stat.h sys/syslimits.h])
dnl Path functions used in libcpath/libcpath_path.h
AC_CHECK_FUNCS([chdir getcwd])
AS_IF(
[test "x$ac_cv_func_chdir" != xyes],
[AC_MSG_FAILURE(
[Missing functions: chdir],
[1])
])
AS_IF(
[test "x$ac_cv_func_getcwd" != xyes],
[AC_MSG_FAILURE(
[Missing functions: getcwd],
[1])
])
AX_LIBCPATH_CHECK_FUNC_MKDIR
])
dnl Function to check if DLL support is needed
AC_DEFUN([AX_LIBCPATH_CHECK_DLL_SUPPORT],
[AS_IF(
[test "x$enable_shared" = xyes],
[AS_CASE(
[$host],
[*cygwin* | *mingw* | *msys*],
[AC_DEFINE(
[HAVE_DLLMAIN],
[1],
[Define to 1 to enable the DllMain function.])
AC_SUBST(
[HAVE_DLLMAIN],
[1])
AC_SUBST(
[LIBCPATH_DLL_EXPORT],
["-DLIBCPATH_DLL_EXPORT"])
AC_SUBST(
[LIBCPATH_DLL_IMPORT],
["-DLIBCPATH_DLL_IMPORT"])
])
])
])