summaryrefslogtreecommitdiffstats
path: root/hw1/configure.ac
blob: 864fb55ecc3bb3618c00f4270e0e7a2528014578 (plain) (blame)
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
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_INIT([cn2013-hw1], [2])
AC_CONFIG_SRCDIR([server-main.c])
AC_CONFIG_HEADERS([config.h])

AM_INIT_AUTOMAKE([foreign])
AM_SILENT_RULES([yes])

AC_CANONICAL_HOST
AC_CANONICAL_BUILD
AH_TEMPLATE([_POSIX_C_SOURCE])
AH_TEMPLATE([_XOPEN_SOURCE])
AH_TEMPLATE([_BSD_SOURCE])
AH_TEMPLATE([_DEFAULT_SOURCE])
AH_TEMPLATE([_WITH_GETLINE])
AH_TEMPLATE([OS_IS_BSD])
case "$host_os" in
    *gnu*)
        AC_DEFINE([_POSIX_C_SOURCE], [200809L])
        AC_DEFINE([_XOPEN_SOURCE], [700])
        AC_DEFINE([_BSD_SOURCE])
        AC_DEFINE([_DEFAULT_SOURCE])
        ;;
    *bsd*)
        AC_DEFINE([_WITH_GETLINE])
        AC_DEFINE([OS_IS_BSD])
        ;;
esac

# Checks for programs.
AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_RANLIB

# Checks for libraries.

# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
AC_C_VOLATILE
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UID_T
AC_TYPE_UINT16_T
AC_TYPE_UINT64_T

# Checks for library functions.
AC_FUNC_FORK
test x"$ac_cv_func_fork_works" != xyes && AC_MSG_ERROR([We need a working fork])
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([setgroups initgroups getdtablesize])

# Misc options.
AC_ARG_WITH([motd],
        [AS_HELP_STRING([--with-motd=FILE],
        [Set FILE as default message of the day @<:@default=/etc/motd@:>@])],
        [with_motd="$withval"], [with_motd="/etc/motd"])
AC_DEFINE_UNQUOTED([ETC_MOTD], ["$with_motd"], [Message of the day])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT