-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
122 lines (96 loc) · 2.41 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# Autoconf requirements
AC_PREREQ([2.68])
# Initialize package
AC_INIT([fmt], [1.5.0], [[email protected]], [fmt], [https://github.com/LeakyAbstractions/fmt/])
# Information on the package
AC_COPYRIGHT([Copyright 2017 Guillermo Calvo])
AC_REVISION([$PACKAGE_VERSION])
AC_MSG_NOTICE([
__ _
/ _| | |
| |_ _ __ ___ | |_
| _| '_ ` _ \| __|
| | | | | | | | |_
|_| |_| |_| |_|\__|
Formatting library
])
# Check if the source folder is correct
AC_CONFIG_SRCDIR([src/fmt.c])
# Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_RANLIB
AM_PROG_AR
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_STDBOOL
AC_CHECK_HEADERS([stdarg.h])
AC_CHECK_HEADERS([stdio.h])
AC_CHECK_HEADERS([stddef.h])
AC_CHECK_HEADERS([stdint.h])
AC_CHECK_HEADERS([string.h])
# Checks for types
AC_TYPE_SIZE_T
# Checks for compiler characteristics
AC_LANG([C])
dnl BEGIN variadic macro support
AC_MSG_CHECKING([for variadic macro support])
AC_COMPILE_IFELSE(AC_LANG_PROGRAM(
[[
#include <stdio.h>
#include <string.h>
#define asprint(buffer, format, args...) asprintf(buffer, format, ## args)
]], [[AC_LANG_SOURCE([
char * buf;
asprint(buf, "testing %s %s\n", "variadic", "macros");
return( strcmp("testing variadic macros", buf) );
])]]),
[ support_macro_varargs=yes ],
[ support_macro_varargs=no ])
if test "x$support_macro_varargs" = xyes; then
AC_DEFINE(HAVE_VARIADIC_MACROS)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl END variadic macro support
dnl BEGIN function name support
AC_MSG_CHECKING([for __func__ support])
AC_COMPILE_IFELSE(AC_LANG_PROGRAM(
[[
#include <stdio.h>
]], [[AC_LANG_SOURCE([
char * name = __func__;
printf("testing function name: %s\n", name);
return( strcmp("main", name) );
])]]),
[ support_function_name=yes ],
[ support_function_name=no ])
if test "x$support_function_name" = xyes; then
AC_DEFINE(HAVE_FUNC)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl END function name support
# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([vfprintf])
AC_CHECK_FUNCS([vsnprintf])
# The config file is generated but not used by the source code
#AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
fmt.pc
Makefile
])
# Automake initialisation
AM_INIT_AUTOMAKE([
-Wall
-Werror
foreign
subdir-objects
no-define
])
AC_OUTPUT