File: configure.in

package info (click to toggle)
darts 0.32-20
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 1,040 kB
  • sloc: sh: 2,458; cpp: 95; makefile: 32; perl: 3
file content (171 lines) | stat: -rw-r--r-- 3,398 bytes parent folder | download | duplicates (6)
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(darts.cpp)
AM_INIT_AUTOMAKE(darts, 0.32)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_MAKE_SET
AC_LANG_CPLUSPLUS

dnl Checks for libraries.

dnl Checks for header files.
AC_HEADER_STDC
# AC_CHECK_HEADERS(string.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)

dnl
dnl check gcc
dnl
if test -n "$GCC"; then
   AM_CFLAGS="-O3 -Wall"
   AM_CXXFLAGS="-O3 -Wall"
fi

dnl check C++ features
dnl
AC_DEFUN([CHECK_CXX_STL], [
  AC_MSG_CHECKING(if ${CXX-c++} supports stl <$1> (required))
  AC_TRY_COMPILE(
	[
	  #include <$1>
	], [
	;
	], [
	  ac_stl_$1=yes
	], [
	  config_error=yes
	  AC_WARN(${CXX-c++} stl <$1> does not work)
        ])
  AC_MSG_RESULT([$ac_stl_$1])
])

CHECK_CXX_STL(vector)
CHECK_CXX_STL(cstdio)
CHECK_CXX_STL(cstring)
CHECK_CXX_STL(string)

# check for namespaces
AC_MSG_CHECKING(if ${CXX-c++} supports namespaces (required) )
AC_TRY_COMPILE(
[
namespace Foo { struct A {}; }
using namespace Foo;
],[
A a;
],[
 ac_namespaces=yes
dnl AC_DEFINE(HAVE_CXX_NAMESPACE)
],[
 config_error=yes
 ac_namespaces=no
])
AC_MSG_RESULT([$ac_namespaces])

# namespace
if test "x$ac_namespaces" = xyes ; then
AC_MSG_CHECKING(if ${CXX-c++} uses std namespace )
AC_TRY_COMPILE(
[
#include <iostream>
namespace std{}
using namespace std;
],[
cout << "test" << endl;
],[
 ac_std_namespace=yes
 AC_DEFINE(HAVE_CXX_STD_NAMESPACE)
],[
 ac_std_namespace=maybe
])

# std namespace
if test "x$ac_std_namespace" = xmaybe ; then
AC_TRY_COMPILE(
[
#include <iostream.h>
namespace std{}
using namespace std;
],[
cout << "test" << endl;
],[
 ac_std_namespace=yes
 AC_DEFINE(HAVE_CXX_STD_NAMESPACE)
],[
 ac_std_namespace=no
])
fi
AC_MSG_RESULT([$ac_std_namespace])
fi

dnl
dnl check C++ features
dnl
AC_DEFUN([CHECK_CXX_STL], [
  AC_MSG_CHECKING(if ${CXX-c++} supports stl <$1> (required))
  AC_TRY_COMPILE(
        [
          #include <$1>
        ], [
        ;
        ], [
          ac_stl_$1=yes
        ], [
          config_error=yes
          AC_WARN(${CXX-c++} stl <$1> does not work)
        ])
  AC_MSG_RESULT([$ac_stl_$1])
])

AC_MSG_CHECKING(if ${CXX-c++} environment provides all required features)
if test "x$config_error" = xyes ; then
  AC_MSG_RESULT([no])
  AC_MSG_ERROR([Your compiler is not powerful enough to compile Darts. \
        If it should be, see config.log for more information of why it failed.])
fi
AC_MSG_RESULT([yes])

DARTS_DEFAULT_ARRAY_SIZE=4
DARTS_DEFAULT_NODE_SIZE=1

DARTS_SIZEOF_CHAR=$ac_cv_sizeof_char
DARTS_SIZEOF_SHORT=$ac_cv_sizeof_short
DARTS_SIZEOF_INT=$ac_cv_sizeof_int
DARTS_SIZEOF_LONG=$ac_cv_sizeof_long
DARTS_SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long

AC_SUBST(DARTS_DEFAULT_ARRAY_SIZE)
AC_SUBST(DARTS_DEFAULT_NODE_SIZE)
AC_SUBST(DARTS_SIZEOF_CHAR)
AC_SUBST(DARTS_SIZEOF_SHORT)
AC_SUBST(DARTS_SIZEOF_INT)
AC_SUBST(DARTS_SIZEOF_LONG)
AC_SUBST(DARTS_SIZEOF_LONG_LONG)

DARTS_HAVE_ZLIB_H=0
AC_ARG_WITH(
  zlib,
  [  --with-zlib use zlib]
)

if test "$with_zlib" != "no"; then
  AC_CHECK_HEADERS(zlib.h)
  AC_CHECK_LIB(z,gzopen)
fi

if test "$ac_cv_header_zlib_h" = "yes"; then
  DARTS_HAVE_ZLIB_H=1
fi
AC_SUBST(DARTS_HAVE_ZLIB_H)

AM_CONFIG_HEADER(config.h)
AC_OUTPUT([Makefile tests/Makefile darts.h darts.spec])