forked from caml-pkcs11/opkcs11-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
104 lines (83 loc) · 2.63 KB
/
configure.ac
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
define([PACKAGE_VERSION_MAJOR], [0])
define([PACKAGE_VERSION_MINOR], [1])
define([PACKAGE_VERSION_FIX], [0])
AC_INIT(opkcs11-tool, [PACKAGE_VERSION_MAJOR.PACKAGE_VERSION_MINOR.PACKAGE_VERSION_FIX])
#Include autoconf macros (ocaml and version comparisons)
AC_CONFIG_MACRO_DIRS([m4])
#bindings_dir="src/bindings-pkcs11"
AC_ARG_WITH(caml-crush, [ --with-caml-crush indicate caml-crush source directory], [with_caml_crush="$withval"], with_caml_crush=caml-crush)
# Summary helpers
AC_DEFUN([WRITE_TO_FILE],[
printf "%-40s: %s\n" $2 $3 >> $1
])
AC_DEFUN([SHOW_SUMMARY],[
cat $1 && rm -f $1
])
#Try to detect host_type and set variable
if host_type=`${srcdir}/config.guess`; then :; else
echo "Cannot guess host type"
exit 2
fi
# Remove any existing summary file
rm -f ./summary
echo "###########################################" >> ./summary
echo "### SUMMARY ###" >> ./summary
echo "###########################################" >> ./summary
##########
# Pass the host to underlying layers
AC_SUBST(host, $host)
##########
# CHECK Make
case $host_type in
*freebsd*)
AC_CHECK_PROG(MAKEPROG,gmake,gmake,no)
if test "$MAKEPROG" == "no"
then
AC_MSG_ERROR(Cannot find GNU gmake.)
fi
AC_SUBST(MAKEPROG,$MAKEPROG)
;;
*)
AC_CHECK_PROG(MAKEPROG,make,make,no)
if test "$MAKEPROG" == "no"
then
AC_MSG_ERROR(Cannot find GNU make.)
fi
AC_SUBST(MAKEPROG,$MAKEPROG)
;;
esac
##########
AC_PROG_OCAML
if test "$OCAMLC" = "no"; then
AC_MSG_ERROR([You must install the OCaml compiler])
fi
if test "$OCAMLOPT" = "no"; then
AC_MSG_ERROR([You must install the OCaml compiler])
fi
if test "$OCAMLDEP" = "no"; then
AC_MSG_WARN([Cannot find ocamldep.])
fi
AC_PROG_CAMLP4
if test "$CAMLP4" = "no"; then
AC_MSG_ERROR([Cannot find camlp4.])
fi
AC_PROG_FINDLIB
if test "$OCAMLFIND" = "no"; then
AC_MSG_ERROR([You must install OCaml findlib (the ocamlfind command)])
fi
AC_MSG_NOTICE([Caml Crush source location $with_caml_crush])
AC_SUBST(caml_crush_src, $with_caml_crush)
WRITE_TO_FILE(summary, "Caml Crush source location", "$with_caml_crush")
#Compare version of OCaml to provide an alternative to List.iteri when missing
AX_COMPARE_VERSION([$OCAMLVERSION], [lt], [4.00.1], [need_custom_listiteri=yes], [need_custom_listiteri=false])
if test "$need_custom_listiteri" == "yes"
then
AC_MSG_NOTICE([OCaml version does not include List.iteri, providing a custom one])
AC_SUBST(need_custom_listiteri, "-DNEED_CUSTOM_LISTITERI")
WRITE_TO_FILE(summary, "Custom List.iteri needed", "yes")
else
AC_SUBST(need_custom_listiteri, "")
WRITE_TO_FILE(summary, "Custom List.iteri needed", "no")
fi
AC_OUTPUT(Makefile)
SHOW_SUMMARY([summary])