forked from pengutronix/genimage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
127 lines (102 loc) · 4.47 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
123
124
125
126
127
AC_PREREQ(2.60)
AC_INIT([genimage],
[9],
[genimage],
[http://www.pengutronix.de/genimage/])
AC_CONFIG_SRCDIR([genimage.c])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects])
AC_PROG_CC_STDC
# If possible, enable extensions to Posix
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
# where to put extension macros
AC_CONFIG_MACRO_DIR([m4])
# default is less output while building the package
AM_SILENT_RULES([yes])
# change if 'usr/local' as the default install path isn't a good choice
#AC_PREFIX_DEFAULT([/usr/local])
AC_CHECK_FUNCS([memset setenv strdup strcasecmp strerror strstr strtoull])
AC_C_INLINE
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MALLOC
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
# ----------- query user's settings ----------------------
AC_MSG_CHECKING([whether to enable debugging])
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug],
[enable debug messages @<:@default=disabled@:>@]),
[],
[enable_debug=no])
AC_MSG_RESULT([${enable_debug}])
# should the executable export all symbols?
AC_MSG_CHECKING([whether to hide internal symbols])
AC_ARG_ENABLE([hide],
[AS_HELP_STRING([--disable-hide],
[do not hide all internal symbols @<:@default=enabled@:>@])],
[],
[enable_hide=yes])
# for debugging purposes we must disable the hiding feature
AS_IF([test "x${enable_debug}" = "xyes"],
[AC_MSG_RESULT([no (due to debug enabled)])
enable_hide=no],
[AC_MSG_RESULT([${enable_hide}])])
# ----------- autodetect some settings -------------------
# add as much warnings and features as possible, but check what the compiler
# is able to understand and use it only if possible
CC_CHECK_CFLAGS_SILENT([-pipe],[AM_CFLAGS="${AM_CFLAGS} -pipe"])
CC_CHECK_CFLAGS_SILENT([-Wall],[AM_CFLAGS="${AM_CFLAGS} -Wall"])
CC_CHECK_CFLAGS_SILENT([-Wextra],[AM_CFLAGS="${AM_CFLAGS} -Wextra"])
CC_CHECK_CFLAGS_SILENT([-Wmissing-declarations],[AM_CFLAGS="${AM_CFLAGS} -Wmissing-declarations"])
CC_CHECK_CFLAGS_SILENT([-Wmissing-prototypes],[AM_CFLAGS="${AM_CFLAGS} -Wmissing-prototypes"])
CC_CHECK_CFLAGS_SILENT([-Wnested-externs],[AM_CFLAGS="${AM_CFLAGS} -Wnested-externs"])
CC_CHECK_CFLAGS_SILENT([-Wpointer-arith],[AM_CFLAGS="${AM_CFLAGS} -Wpointer-arith"])
CC_CHECK_CFLAGS_SILENT([-Wsign-compare],[AM_CFLAGS="${AM_CFLAGS} -Wsign-compare"])
CC_CHECK_CFLAGS_SILENT([-Wchar-subscripts],[AM_CFLAGS="${AM_CFLAGS} -Wchar-subscripts"])
CC_CHECK_CFLAGS_SILENT([-Wstrict-prototypes],[AM_CFLAGS="${AM_CFLAGS} -Wstrict-prototypes"])
CC_CHECK_CFLAGS_SILENT([-Wshadow],[AM_CFLAGS="${AM_CFLAGS} -Wshadow"])
CC_CHECK_CFLAGS_SILENT([-Wformat-security],[AM_CFLAGS="${AM_CFLAGS} -Wformat-security"])
CC_CHECK_CFLAGS_SILENT([-Wtype-limits],[AM_CFLAGS="${AM_CFLAGS} -Wtype-limits"])
CC_CHECK_CFLAGS_SILENT([-Wunused-parameter],[AM_CFLAGS="${AM_CFLAGS} -Wno-unused-parameter"])
CC_CHECK_CFLAGS_SILENT([-ffunction-sections],[AM_CFLAGS="${AM_CFLAGS} -ffunction-sections"])
CC_CHECK_CFLAGS_SILENT([-fdata-sections],[AM_CFLAGS="${AM_CFLAGS} -fdata-sections"])
# Add only those libraries which are really used
CC_CHECK_LDFLAGS([-Wl,--as-needed], [AM_LDFLAGS="${AM_LDFLAGS} -Wl,--as-needed"],[])
CC_CHECK_LDFLAGS([-Wl,--gc-sections], [AM_LDFLAGS="${AM_LDFLAGS} -Wl,--gc-sections"],[])
PKG_CHECK_MODULES(CONFUSE, libconfuse)
# ------- use all the settings ----------------------
AS_IF([test "x$enable_debug" = "xyes"], [
AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
])
# Enable "-fvisibility=hidden" only if the used gcc supports it
AS_IF([test "${enable_hide}" = "yes"],
[AC_MSG_CHECKING([whether the compiler supports -fvisibility=hidden])
CC_CHECK_CFLAGS_SILENT([-fvisibility=hidden], [], [enable_hide=no])
# still enabled?
if test "x${enable_hide}" = "xyes"; then
AC_DEFINE(DSO_HIDDEN, 1, [hide internal library symbols])
AM_CFLAGS="${AM_CFLAGS} -fvisibility=hidden"
fi
AC_MSG_RESULT([${enable_hide}])])
AC_SUBST(AM_CFLAGS)
# be very silent on request
AM_CONDITIONAL(BUILD_SILENTLY, test "x$AM_DEFAULT_VERBOSITY" = x0)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_FILES([
Makefile
])
AC_REQUIRE_AUX_FILE([tap-driver.sh])
AC_OUTPUT
AC_MSG_RESULT([
$PACKAGE $VERSION
=====
prefix: ${prefix}
compiler: ${CC}
cflags: ${CFLAGS} ${AM_CFLAGS}
ldflags: ${LDFLAGS} ${AM_LDFLAGS}
debug: ${enable_debug}
hide symbols: ${enable_hide}
libconfuse: ${CONFUSE_LIBS}
])