aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
blob: cef76e00c3c9c5645856dd9bcad44cea63790918 (plain)
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
#                                               -*- Autoconf -*-
# configure script generation for ncblog
#

AC_PREREQ([2.67])
AC_INIT([naskpass], [0], [matzeton@googlemail.com])
AC_CONFIG_AUX_DIR([build])
AM_INIT_AUTOMAKE([1.11 subdir-objects foreign no-define -Wall -Werror])
AM_WITH_DMALLOC
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CONFIG_SRCDIR([src/aconfig.h.in])
AC_CONFIG_HEADER([src/aconfig.h])
AC_CONFIG_MACRO_DIR([m4])
AC_USE_SYSTEM_EXTENSIONS
CFLAGS=""
LDFLAGS=""

# Checks for programs.
AM_PROG_AR
AM_PROG_INSTALL_STRIP
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_C_INLINE
AC_PREFIX_DEFAULT([/usr])
AC_CHECK_TOOL([STRIP],[strip])

# Checks for header files.
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_HEADER_STDBOOL
AC_HEADER_STDC
AC_HEADER_STAT
AC_HEADER_DIRENT
AC_HEADER_ASSERT
AC_CHECK_HEADERS([stdio.h stdlib.h stdbool.h string.h unistd.h errno.h sys/stat.h sys/types.h sys/wait.h fcntl.h semaphore.h time.h mqueue.h syslog.h],[],[AC_MSG_ERROR([*** missing essential header files])])

# Checks for typedefs, structures, and compiler characteristics.
AC_COMPUTE_INT
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT8_T
AX_CHECK_TYPEDEF([size_t], [stdio.h],,[AC_MSG_ERROR([*** Missing size_t typedef in stdio.h])])
AX_CHECK_TYPEDEF([ssize_t], [stdio.h],,[AC_MSG_ERROR([*** Missing size_t typedef in stdio.h])])

# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_FUNC_STRNLEN
AC_FUNC_STAT
AC_FUNC_MKTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([clock_gettime asprintf system printf fprintf mkfifo stat open close fork memmove memcpy memset strdup strndup strerror strstr strlen strnlen strtol openlog vsyslog closelog],,[AC_MSG_ERROR([*** Missing essential functions.])])

AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
               [enable debugging, default: no]),
[case "${enableval}" in
             yes) debug=true ;;
             no)  debug=false ;;
             *)   AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],
[debug=false])
AM_CONDITIONAL(DEBUG, test x"$debug" = x"true")

AC_DEFINE([HAVE_CONFIG], [1], [Do NOT change THIS!])
LDFLAGS="${LDFLAGS} -pthread -lrt -lncurses"
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_LDFLAGS])
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT

echo "Run 'make' to finish the process."
test -d .git && VERSION="git-$(git rev-parse --short HEAD)"
echo "#define VERSION \"${VERSION}\"" >src/version.h