-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathconfigure.ac
More file actions
95 lines (81 loc) · 3.66 KB
/
Copy pathconfigure.ac
File metadata and controls
95 lines (81 loc) · 3.66 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
AC_INIT([myanon], [0.8.4], [pierre.pomes@gmail.com])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CC
AC_PROG_YACC
AC_PROG_LEX(noyywrap)
AC_PROG_INSTALL
AM_PROG_AR
AC_PROG_RANLIB
# Arguments
AC_ARG_WITH([python],
[AS_HELP_STRING([--with-python@<:@=DIR@:>@],
[enable Python support @<:@default=no@:>@, optionally specify python install prefix])],
[with_python=$withval],
[with_python="no"])
# Legacy jq option (deprecated)
AC_ARG_ENABLE([jq],
[AS_HELP_STRING([--enable-jq],
[Deprecated - JSON support is now built-in])],
[AC_MSG_WARN([--enable-jq is deprecated and has no effect. JSON support is now built-in without external dependencies.])])
AC_ARG_WITH([openssl],
[AS_HELP_STRING([--with-openssl@<:@=DIR@:>@],
[use OpenSSL for HMAC-SHA256 instead of bundled implementation, optionally specify install prefix])],
[with_openssl=$withval],
[with_openssl="no"])
if test "$with_openssl" != "no"; then
if test "$with_openssl" != "yes"; then
export PKG_CONFIG_PATH="$with_openssl/lib/pkgconfig:$PKG_CONFIG_PATH"
fi
PKG_CHECK_MODULES([OPENSSL], [libcrypto], [],
[AC_MSG_ERROR([OpenSSL libcrypto not found])])
AC_DEFINE([HAVE_OPENSSL], [1], [Define to 1 if using OpenSSL for HMAC.])
fi
AM_CONDITIONAL([USE_OPENSSL], [test "$with_openssl" != "no"])
# Checks flex/bison version
AC_PATH_PROG([FLEX],[flex])
AX_PROG_FLEX_VERSION([2.6.0],,AC_MSG_ERROR([GNU flex 2.6+ is required]))
AC_PATH_PROG([BISON],[bison])
AX_PROG_BISON_VERSION([3.0.0],,AC_MSG_ERROR([GNU bison v3+ is required]))
# Checks for header files.
AC_CHECK_HEADERS(stdio.h, ,[AC_MSG_ERROR([Cannot find stdio.h header])])
AC_CHECK_HEADERS(stddef.h, ,[AC_MSG_ERROR([Cannot find stddef.h header])])
AC_CHECK_HEADERS(stdlib.h, ,[AC_MSG_ERROR([Cannot find stdlib.h header])])
AC_CHECK_HEADERS(stdbool.h, ,[AC_MSG_ERROR([Cannot find stdbool.h header])])
AC_CHECK_HEADERS(stdint.h, ,[AC_MSG_ERROR([Cannot find stdint.h header])])
AC_CHECK_HEADERS(strings.h, ,[AC_MSG_ERROR([Cannot find string.h header])])
AC_CHECK_HEADERS(errno.h, ,[AC_MSG_ERROR([Cannot find errno.h header])])
AC_CHECK_HEADERS(getopt.h, ,[AC_MSG_ERROR([Cannot find getopt.h header])])
AC_CHECK_HEADERS(sys/time.h, ,[AC_MSG_ERROR([Cannot find sys/time.h header])])
# Check python dependencies
if test "$with_python" != "no"; then
if test "$with_python" != "yes"; then
export PATH="$with_python/bin:$PATH"
fi
AM_PATH_PYTHON([3])
AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing python-config])
AC_ARG_VAR([PYTHON_LIBS], [ldflags flags for python, bypassing python-config])
AC_PATH_PROGS([PYTHON_CONFIG],
[python$PYTHON_VERSION-config python-config],
[no],
[`dirname $PYTHON`])
AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON.])])
AC_MSG_CHECKING([python include flags])
PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
AC_MSG_RESULT([$PYTHON_INCLUDE])
AC_MSG_CHECKING([python ldflags flags])
PYTHON_LIBS=`$PYTHON_CONFIG --embed --ldflags`
AC_MSG_RESULT([$PYTHON_LIBS])
AC_SUBST([PYTHON_LIBS])
CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDE"
LDFLAGS="$LDFLAGS $PYTHON_LIBS"
AC_DEFINE([HAVE_PYTHON], ["yes"], [Define to "yes" if Python support is enabled.])
AC_SUBST([PYTHON_SUPPORT], [yes])
fi
AC_CONFIG_FILES([Makefile
hmac/Makefile
main/Makefile])
AC_OUTPUT