-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
235 lines (196 loc) · 7.02 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
## Process this file with autoconf to produce a configure script.
##
##
## Copyright (C) 1995-2007, Hewlett-Packard Development Company, L.P.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License along
## with this program; if not, write to the Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
##
##
AC_PREREQ([2.29])
AC_INIT([ski],[1.4.0],[[email protected]],[ski],[https://github.com/trofi/ski])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign subdir-objects dist-xz dist-lzip no-dist-gzip])
AM_SILENT_RULES([yes])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_HOST
case $host_os in
linux*) HOST_OS=linux;;
hpux*) HOST_OS=hpux;;
freebsd*) HOST_OS=freebsd;;
*) HOST_OS=unknown;;
esac
AC_SUBST(HOST_OS)
AM_CONDITIONAL(LINUX, test "$HOST_OS" = linux)
AM_CONDITIONAL(HPUX, test "$HOST_OS" = hpux)
AM_CONDITIONAL(FREEBSD, test "$HOST_OS" = freebsd)
# Checks for programs.
AC_PROG_CC
AM_PROG_AS
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_AWK
AC_PROG_SED
PKG_PROG_PKG_CONFIG
AC_C_INLINE
AC_C_CONST
dnl Check for required build tools
AC_CHECK_PROGS([GPERF], [gperf], [$MISSING gperf])
AC_CHECK_PROGS([FLEX], [flex], [$MISSING flex])
AC_CHECK_PROGS([BISON], [bison], [$MISSING bison])
dnl Check for the pager program
AC_CHECK_PROGS([PAGER], [less])
AC_DEFINE_UNQUOTED([PAGER], ["$PAGER"], [Define to the pager program.])
dnl Initialize maintainer mode
AM_MAINTAINER_MODE
dnl See if we build GTK
AC_ARG_WITH([gtk],
AS_HELP_STRING([--with-gtk],
[Enable building the GTK Ski interface default=no]))
AS_IF([test "x$with_gtk" = "xyes"], [
PKG_CHECK_MODULES([GSKI], [libglade-2.0 libgnomeui-2.0 >= 1.110.0])
AC_DEFINE(HAVE_GTK, 1, [define if you have GTK support])
])
AC_SUBST(GSKI_CFLAGS)
AC_SUBST(GSKI_LIBS)
AM_CONDITIONAL(WITH_GTK_INTERFACE, test "x$with_gtk" = "xyes")
dnl Check for host endianness
AC_CACHE_CHECK([whether host byte ordering is defined in sys/param.h],
ski_cv_c_bigendian_compile,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/param.h>
]],[[
#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
#error bogus endian macros
#endif
]])],
[ski_cv_c_bigendian_compile=yes], [ski_cv_c_bigendian_compile=no])])
AS_IF([test "x$ski_cv_c_bigendian_compile" = xyes], [
AC_DEFINE(ENDIANESS_IN_SYS_PARAM_H, 1,
[define if sys/param.h defines the endiness])
])
AC_C_BIGENDIAN
dnl Check for variables & functions
AC_FUNC_ALLOCA
dnl Find libelf.h
AC_CHECK_HEADER(libelf.h,,
[AC_CHECK_HEADER(libelf/libelf.h, have_libelf_libelf_h=yes,
[AC_MSG_ERROR(Required libelf.h header not found.)])])
AS_IF([test "x$have_libelf_libelf_h" = xyes], [
AC_DEFINE(HAVE_LIBELF_LIBELF_H, 1, [define if you have libelf/libelf.h])
])
dnl Check for netdev support
AS_IF([test "$HOST_OS" = linux], [
AC_ARG_ENABLE([netdev],
AS_HELP_STRING([--disable-netdev], [disable netdev support]))
AS_IF([test "x$enable_netdev" != xno], [
AC_DEFINE(SKINET_ENABLE, 1, [define if you want netdev support])
])
])
AS_IF([test "$HOST_OS" = freebsd], [
LDFLAGS="$LDFLAGS -lutil"
])
dnl Check for optional libs
AC_CHECK_LIB(unwind-ia64, _Uia64_get_proc_name, )
# Test for IA-64 libbfd
AC_ARG_WITH([bfd-includes],
AS_HELP_STRING([--with-bfd-includes],[specify location of bfd headers]),[
BFD_CFLAGS="-I$withval"
])
AC_ARG_WITH([bfd-libs],
AS_HELP_STRING([--with-bfd-libs],[specify location of bfd libraries]),[
BFD_LDFLAGS="-L$withval"
])
AC_MSG_CHECKING([for bfd support])
AC_ARG_WITH([bfd], AS_HELP_STRING([--with-bfd],[use the bfd library]))
AS_IF([test "x$with_bfd" = xno], [have_bfd=disabled], [
save_CFLAGS=$CFLAGS
save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS
CFLAGS="$CFLAGS $BFD_CFLAGS"
LDFLAGS="$LDFLAGS $BFD_LDFLAGS"
LIBS="$LIBS -lbfd -liberty"
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <bfd.h>]],[[
bfd_init ();
return bfd_set_default_target ("elf64-ia64-little") == 0;
]])],
[have_bfd=yes], [have_bfd=no],[have_bfd=no])
CFLAGS=$save_CFLAGS
LDFLAGS=$save_LDFLAGS
LIBS=$save_LIBS
])
AS_IF([test "x$have_bfd" = xyes], [
DWARF_CFLAGS="$BFD_CFLAGS"
DWARF_LIBS="$BFD_LDFLAGS -lbfd -liberty"
])
AC_MSG_RESULT([$have_bfd])
AS_IF([test "x$have_bfd" = xyes], [
AC_DEFINE(HAVE_DWARF_SUPPORT, 1, [define if you have dwarf support])
])
AC_SUBST(DWARF_CFLAGS)
AC_SUBST(DWARF_LIBS)
dnl Check for required libs
AC_CHECK_LIB(m, ldexp, [],
[AC_MSG_ERROR(Required library libm not found.)])
AS_IF([test "$HOST_OS" = hpux], [
# HPUX prefers libHcurses.
AC_CHECK_LIB(Hcurses, tgetent,[
AC_DEFINE(__HP_CURSES, 1, [define if you want to use HP curses])
LIBS="-lHcurses $LIBS"
check_curses=no], [])
])
AS_IF([test "x$check_curses" != xno], [
PKG_CHECK_MODULES([NCURSES], [ncurses])
CFLAGS="$CFLAGS $NCURSES_CFLAGS"
LIBS="$LIBS $NCURSES_LIBS"
])
AC_CHECK_LIB(elf, elf_begin, [],
[AC_MSG_ERROR(Required library libelf not found.)])
dnl Add extra flags to CFLAGS depending on os
case $host_os in
linux*) CFLAGS="$CFLAGS -D_GNU_SOURCE";;
hpux9*) CFLAGS="$CFLAGS -DHPUX9";;
hpux10*) CFLAGS="$CFLAGS -DHPUX1020";;
hpux11*) CFLAGS="$CFLAGS -DHPUX1100";;
# __linux__ on freebsd looks scary. Does it work at all?
freebsd*) CFLAGS="$CFLAGS -D__linux__";;
esac
# CPU instructions modify arbitrary memory.
# No chance to maintain aliasing guarantees.
CFLAGS="$CFLAGS -fno-strict-aliasing"
# Macro from autoconf-archive.
# Pull in -Werror= flags to catch obviously wrong code
AX_CHECK_COMPILE_FLAG([-Werror=implicit-int], [CFLAGS="$CFLAGS -Werror=implicit-int"], [], [-Werror])
AX_CHECK_COMPILE_FLAG([-Werror=implicit-function-declaration], [CFLAGS="$CFLAGS -Werror=implicit-function-declaration"], [], [-Werror])
# Useful to catch missing 'static' declarations and missing header
# inclusion to keep header and .c file prototypes in sync.
AX_CHECK_COMPILE_FLAG([-Wmissing-declarations], [CFLAGS="$CFLAGS -Wmissing-declarations"], [], [-Werror])
AX_CHECK_COMPILE_FLAG([-Wunused-function], [CFLAGS="$CFLAGS -Wunused-function"], [], [-Werror])
AX_CHECK_COMPILE_FLAG([-Wunused-variable], [CFLAGS="$CFLAGS -Wunused-variable"], [], [-Werror])
dnl Treat warnings as errors
AC_ARG_ENABLE([werror],
AS_HELP_STRING([--enable-werror],
[Fail on encountered compiler warnings]))
AS_IF([test "x$enable_werror" = "xyes"],
[CFLAGS="$CFLAGS -Werror"])
dnl Configuration files
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([src/fake-xterm/Makefile])
AC_CONFIG_FILES([doc/Makefile])
AC_CONFIG_MACRO_DIRS([m4])
dnl Output the files
AC_OUTPUT