1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(sid.h)
3
4dnl Use Automake
5AM_INIT_AUTOMAKE(resid, 0.16vice)
6LTVERSION=5:0:0
7
8dnl Use C++ for tests.
9AC_LANG_CPLUSPLUS
10
11AC_CANONICAL_HOST
12
13dnl Enable inlining.
14AC_ARG_ENABLE(inline,
15[  --enable-inline         enable inlining of functions [default=yes]])
16
17if test "$enable_inline" != no; then
18  RESID_INLINING=1
19  RESID_INLINE=inline
20else
21  RESID_INLINING=0
22  RESID_INLINE=
23fi
24
25AC_SUBST(RESID_INLINING)
26AC_SUBST(RESID_INLINE)
27
28dnl Enable experimental 8580 filters.
29AC_ARG_ENABLE([new8580filter],
30  [AC_HELP_STRING([--enable-new8580filter],
31    [enable experimental 8580 filters [default=no]])],
32  [],
33  [])
34
35AS_IF([test x"$enable_new8580filter" = "xyes"],
36  [AC_SUBST([NEW_8580_FILTER], [1])],
37  [AC_SUBST([NEW_8580_FILTER], [0])])
38
39dnl Checks for programs.
40AC_PROG_CXX([g++ clang++])
41
42dnl Set CXXFLAGS for g++. Use -fno-exceptions if supported.
43if test "$GXX" = yes; then
44  if test "$ac_test_CXXFLAGS" != set; then
45    CXXFLAGS="-g -Wall -O2 -funroll-loops -fomit-frame-pointer -fno-exceptions"
46    AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works])
47    AC_TRY_COMPILE([],
48                   [int test;],
49                   [ AC_MSG_RESULT(yes) ],
50                   [ AC_MSG_RESULT(no)
51                     CXXFLAGS="-g -Wall -O2 -funroll-loops -fomit-frame-pointer"
52                     ])
53  fi
54  case $host_os in
55  darwin*)
56    CFLAGS="$CFLAGS -mmacosx-version-min=10.9"
57    OBJCFLAGS="$OBJCFLAGS -mmacosx-version-min=10.9"
58    CXXFLAGS="$CXXFLAGS -mmacosx-version-min=10.9"
59    LDFLAGS="$LDFLAGS -mmacosx-version-min=10.9"
60    ;;
61  *)
62    ;;
63  esac
64fi
65
66
67AC_CHECK_PROG(AR, ar, ar, ar)
68AC_PROG_RANLIB
69
70dnl Libtool
71
72dnl AC_DISABLE_SHARED
73dnl AM_PROG_LIBTOOL
74dnl AC_SUBST(LIBTOOL_DEPS)
75dnl AC_SUBST(LTVERSION)
76
77dnl Checks for libraries.
78
79dnl Checks for header files.
80
81dnl Checks for typedefs, structures, and compiler characteristics.
82AC_CHECK_SIZEOF(int, 4)
83
84if test $ac_cv_sizeof_int -lt 4; then
85  AC_MSG_ERROR([only 32 bit or better CPUs are supported])
86fi
87
88AC_CACHE_CHECK([for working bool], ac_cv_cxx_bool,
89[AC_TRY_COMPILE(,
90[
91bool flag;
92],
93ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no)])
94
95if test $ac_cv_cxx_bool = no; then
96  RESID_HAVE_BOOL=0
97else
98  RESID_HAVE_BOOL=1
99fi
100
101AC_SUBST(RESID_HAVE_BOOL)
102
103AC_MSG_CHECKING([if the mmintrin.h include can be used])
104AC_TRY_COMPILE([#include <mmintrin.h>],
105               [int test;],
106               [ AC_MSG_RESULT(yes)
107                 HAVE_MMINTRIN_H=1
108                 ],
109               [ AC_MSG_RESULT(no)
110                 HAVE_MMINTRIN_H=0
111                 ])
112
113if test $HAVE_MMINTRIN_H = 0; then
114  old_CXXFLAGS=$CXXFLAGS
115  CXXFLAGS="$CXXFLAGS -mmmx"
116  AC_MSG_CHECKING([if -mmmx is needed to activate MMX])
117  AC_TRY_COMPILE([#include <mmintrin.h>],
118                 [int test;],
119                 [ AC_MSG_RESULT(yes)
120                   HAVE_MMINTRIN_H=1
121                   ],
122                 [ AC_MSG_RESULT(no)
123                   HAVE_MMINTRIN_H=0
124                   CXXFLAGS=$old_CXXFLAGS
125                   ])
126fi
127
128AC_SUBST(HAVE_MMINTRIN_H)
129
130dnl Checks for library functions.
131
132AC_OUTPUT(Makefile siddtvdefs.h)
133