-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfigure.in
executable file
·192 lines (160 loc) · 5.94 KB
/
configure.in
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
dnl This file is part of reSID, a MOS6581 SID emulator engine.
dnl Copyright (C) 2010 Dag Lem <resid@nimrod.no>
dnl
dnl Process this file with autoconf to produce a configure script.
dnl Use Autoconf
AC_PREREQ([2.56])
AC_INIT([reSID], [1.0-pre2], [resid@nimrod.no])
AC_CONFIG_SRCDIR([sid.h])
dnl Use Automake
AM_INIT_AUTOMAKE([1.7.1])
dnl Avoid "ar: `u' modifier ignored since `D' is the default (see `U')" warning
dnl caused by a longstanding bug in libtool.
dnl See https://github.com/rsyslog/rsyslog/issues/1179 for some details.
: ${ARFLAGS="cr"}
: ${AR_FLAGS="cr"}
AC_SUBST(ARFLAGS)
AC_SUBST(AR_FLAGS)
dnl Use Libtool
dnl LT_PREREQ([2.2.2])
dnl LT_INIT([disable-shared])
dnl AC_SUBST([LTVERSION], [6:0:0])
dnl Use C++ for tests.
AC_LANG([C++])
AC_CANONICAL_HOST
AC_MSG_CHECKING([for debugging])
AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [whether to enable asserts (default is no)])],
[], [enable_debug=no])
AS_IF([test "x$enable_debug" = "xno"],
[AC_MSG_RESULT([build without asserts]); RESID_CPPFLAGS="-DNDEBUG"],
[AC_MSG_RESULT([build with asserts]); RESID_CPPFLAGS=""]
)
AC_SUBST(RESID_CPPFLAGS)
dnl Enable inlining.
AC_ARG_ENABLE([inline],
[AC_HELP_STRING([--enable-inline],
[enable inlining of functions [default=yes]])],
[],
[enable_inline=yes])
AS_IF([test "$enable_inline" != no],
[AC_SUBST([RESID_INLINING], [1])
AC_SUBST([RESID_INLINE], [inline])],
[AC_SUBST([RESID_INLINING], [0])
AC_SUBST([RESID_INLINE], [])])
dnl Enable architecture specific compilation.
AC_ARG_ENABLE([arch],
[AC_HELP_STRING([--enable-arch[[=arch]]],
[enable architecture specific compilation [default=no]])],
[],
[enable_arch=yes])
dnl Enable branch prediction hints.
AC_ARG_ENABLE([branch-hints],
[AC_HELP_STRING([--enable-branch-hints],
[enable static branch prediction hints [default=yes]])],
[],
[enable_branch_hints=yes])
AS_IF([test "$enable_branch_hints" != no],
[AC_SUBST([RESID_BRANCH_HINTS], [1])],
[AC_SUBST([RESID_BRANCH_HINTS], [0])])
dnl Enable experimental 8580 filters.
AC_ARG_ENABLE([new8580filter],
[AS_HELP_STRING([--disable-new8580filter],
[disable new 8580 filter implementation [default=no]])]
)
AM_CONDITIONAL([NEW_8580_FILTER], [test x"$enable_new8580filter" != "xno"])
AS_IF([test x"$enable_new8580filter" != "xno"],
[AC_SUBST([NEW_8580_FILTER], [1])],
[AC_SUBST([NEW_8580_FILTER], [0])]
)
dnl Store CXXFLAGS status.
resid_test_CXXFLAGS=${CXXFLAGS+set}
dnl Checks for programs.
AC_PROG_CXX([c++ g++ clang++])
dnl Set CXXFLAGS for g++.
if test x"$enable_arch" = "xno"; then
march=""
else
if test x"$enable_arch" = "xyes"; then
AC_MSG_CHECKING([if the compiler supports -march=native])
ORIG_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS -march=native"
AC_TRY_COMPILE([],
[int test;],
[ AC_MSG_RESULT(yes)
march="-march=native" ],
[ AC_MSG_RESULT(no)
march="" ])
CXXFLAGS=$ORIG_CXXFLAGS
else
AC_MSG_CHECKING([if the compiler supports -march=$enable_arch])
ORIG_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS -march=$enable_arch"
AC_TRY_COMPILE([],
[int test;],
[ AC_MSG_RESULT(yes)
march="-march=$enable_arch" ],
[ AC_MSG_RESULT(no)
march="" ])
CXXFLAGS=$ORIG_CXXFLAGS
fi
fi
AS_IF([test "$GXX" = yes -a "$resid_test_CXXFLAGS" != set],
[resid_save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="-g -Wall -O3 $march -fno-exceptions"
AC_MSG_CHECKING([whether g++ accepts $CXXFLAGS])
AC_COMPILE_IFELSE([int test;],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
CXXFLAGS="-g -Wall -O3 -fno-exceptions"
AC_MSG_CHECKING([whether g++ accepts $CXXFLAGS])
AC_COMPILE_IFELSE([int test;],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
CXXFLAGS=$resid_save_CXXFLAGS])])])
case $host_os in
darwin*)
dnl Support targeting a specific macOS version
AC_ARG_ENABLE([macos-target-sdk-version],
[AC_HELP_STRING([--enable-macos-target-sdk-version[[=version]]],
[compile for a specific sdk version such as 10.10 [default=no]])],
[],
[enable_macos_target_sdk_version=10.10])
AS_IF([test "$enable_macos_target_sdk_version" != no],
[CFLAGS="$CFLAGS -mmacosx-version-min=$enable_macos_target_sdk_version"
OBJCFLAGS="$OBJCFLAGS -mmacosx-version-min=$enable_macos_target_sdk_version"
CXXFLAGS="$CXXFLAGS -mmacosx-version-min=$enable_macos_target_sdk_version"
LDFLAGS="$LDFLAGS -mmacosx-version-min=$enable_macos_target_sdk_version"])
;;
*)
;;
esac
AC_CHECK_PROG([AR], [ar], [ar], [ar])
AC_PROG_RANLIB
AC_PATH_PROG([PERL], [perl])
dnl Checks for libraries.
dnl Checks for header files.
AC_CHECK_HEADER([math.h], [], AC_MSG_ERROR([missing math.h]))
dnl Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_SIZEOF([int], [4])
AS_IF([test $ac_cv_sizeof_int -lt 4],
AC_MSG_ERROR([only 32 bit or better CPUs are supported]))
AC_CACHE_CHECK([for working bool], [resid_cv_cxx_bool],
[AC_COMPILE_IFELSE([bool flag;],
[resid_cv_cxx_bool=yes], [resid_cv_cxx_bool=no])])
AS_IF([test "$resid_cv_cxx_bool" = no],
[AC_SUBST([HAVE_BOOL], [0])],
[AC_SUBST([HAVE_BOOL], [1])])
AC_CACHE_CHECK([for __builtin_expect], [resid_cv_builtin_expect],
[AC_COMPILE_IFELSE([int main() { __builtin_expect(0, 0); }],
[resid_cv_builtin_expect=yes], [resid_cv_builtin_expect=no])])
AS_IF([test "$resid_cv_builtin_expect" = no],
[AC_SUBST([HAVE_BUILTIN_EXPECT], [0])],
[AC_SUBST([HAVE_BUILTIN_EXPECT], [1])])
AC_CACHE_CHECK([for log1p], [resid_cv_log1p],
[AC_TRY_COMPILE([#include <math.h>], [ log1p(1); ],
resid_cv_log1p=yes, resid_cv_log1p=no)])
AS_IF([test "$resid_cv_log1p" = no],
[AC_SUBST([HAVE_LOG1P], [0])],
[AC_SUBST([HAVE_LOG1P], [1])])
AC_CONFIG_FILES([Makefile siddefs.h])
AC_OUTPUT