File: configure.ac

package info (click to toggle)
xstow 0.5.1-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 780 kB
  • ctags: 1,023
  • sloc: cpp: 6,097; sh: 720; makefile: 130
file content (329 lines) | stat: -rw-r--r-- 7,730 bytes parent folder | download | duplicates (4)
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
AC_INIT
AC_CONFIG_SRCDIR([src/main.cpp])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(xstow, 0.5.1)

AC_ISC_POSIX
AC_PROG_CXX
AC_LANG(C++)
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AM_PROG_CC_STDC
AC_HEADER_STDC
AC_C_CONST
AC_C_INLINE

AC_CHECK_HEADER(string, 
                echo -n,  
                [AC_MSG_ERROR([this header file is required])])

AC_CHECK_HEADER([vector],      , [AC_MSG_ERROR([Sorry we cannot do anything for you])])
AC_CHECK_HEADER([list],        , [AC_MSG_ERROR([Sorry we can't do anything for you])])
AC_CHECK_HEADER([dirent.h],    , [AC_MSG_ERROR([Sorry we can't do anything for you])])
AC_CHECK_HEADER([iostream],    , [AC_MSG_ERROR([Sorry we can't do anything for you])])
AC_CHECK_HEADER([iomanip],     , [AC_MSG_ERROR([Sorry we can't do anything for you])])
AC_CHECK_HEADER([iterator],    , [AC_MSG_ERROR([Sorry we can't do anything for you])])
AC_CHECK_HEADER([fstream],     , [AC_MSG_ERROR([Sorry we can't do anything for you])])
AC_CHECK_HEADER([exception],   , [AC_MSG_ERROR([Sorry we can't do anything for you])])
AC_CHECK_HEADER([sys/stat.h],  , [AC_MSG_ERROR([Sorry we can't do anything for you])])
AC_CHECK_HEADER([unistd.h],    , [AC_MSG_ERROR([Sorry we can't do anything for you])])
AC_CHECK_HEADER([errno.h],     , [AC_MSG_ERROR([Sorry we can't do anything for you])])
AC_CHECK_HEADER([ctype.h],     , [AC_MSG_ERROR([Sorry we can't do anything for you])])
AC_CHECK_HEADER([cstdio],      , [AC_MSG_ERROR([Sorry we can't do anything for you])])
AC_CHECK_HEADER([string],      , [AC_MSG_ERROR([Sorry we can't do anything for you])])
AC_CHECK_HEADER([sys/types.h], , [AC_MSG_ERROR([Sorry we can't do anything for you])])
AC_CHECK_HEADER([sys/stat.h],  , [AC_MSG_ERROR([Sorry we can't do anything for you])])
AC_CHECK_HEADER([algorithm],   , [AC_MSG_ERROR([Sorry we can't do anything for you])])

AC_MSG_CHECKING(for shell pattern support)
AC_ARG_WITH(fnmatch,
	[  --with-fnmatch      Enable shell pattern matching],
	[
		if test "x$withval" = "xno" ; then
			AC_MSG_RESULT(disabled)
			support_fnmatch=0
		else
			support_fnmatch=1
		fi
	],
	[
		
		AC_MSG_RESULT(enabled)
		AC_CHECK_HEADER([fnmatch.h],   
				[
				  AC_DEFINE(HAVE_FNMATCH_H, 1, [fnmatch is present])
				  support_fnmatch=1
				], 
				[ 
				  support_fnmatch=0
				])
	])
		   
AC_MSG_CHECKING(for regular expressions support)
AC_ARG_WITH(regex,
	[  --with-regex        Enable regular expressions support],
	[
		if test "x$withval" = "xno" ; then
			AC_MSG_RESULT(disabled)
			support_regex=0
		else
			support_regex=1
		fi
	],
	[
			AC_MSG_RESULT(enabled)
			AC_CHECK_HEADER([regex.h],
					[
					  AC_DEFINE(HAVE_REGEX_H, 1, [POSIX regex is present])
					  support_regex=1	
					], 
					[ 
					  support_regex=0 
					])
	])

AC_MSG_CHECKING(for curses support)
AC_ARG_WITH(curses,
	[  --with-curses       Enable using curses library],
	[
		if test "x$withval" = "xno" ; then
			AC_MSG_RESULT(disabled)
			support_curses=0
		else
			support_curses=1
		fi
	],
	[
		AC_MSG_RESULT(enabled)
		AC_CHECK_HEADER([curses.h],
				[
				  # test which libraray to use
				  AC_CHECK_LIB([curses],[initscr],
						[
						  support_curses=1
				  		  AC_SUBST(LDFLAGS_DYNAMIC, "$LDFLAGS -lcurses")
				          AC_DEFINE(HAVE_CURSES_H, 1, [curses library can be used])
						],
						[ support_curses=0 ])
			

				  if test $support_curses -eq 0; then

				  AC_CHECK_LIB([ncurses],[initscr],
						[
						  support_curses=1
				  		  AC_SUBST(LDFLAGS_DYNAMIC, "$LDFLAGS -lncurses")
				                  AC_DEFINE(HAVE_CURSES_H, 1, [curses library can be used])
						],
						[ support_curses=0 ])
			

				  fi	
				],
				[
				  support_curses=0
				])
	])


NO_STL_SSTREAM=0
NO_STL_STRSTREAM=0

AC_CHECK_HEADER([sstream],     [AC_DEFINE(HAVE_STL_SSTREAM, 1, [sstream is present])] , [ NO_STL_SSTREAM=1 ])
AC_CHECK_HEADER([strstream],   [AC_DEFINE(HAVE_STL_STRSTREAM, 1, [old strstream can be used])], [ NO_STL_STRSTREAM=1 ])

if test $NO_STL_SSTREAM -gt 0 ; then
  if test $NO_STL_STRSTREAM -gt 0 ; then

     AC_MSG_ERROR([sstream, or strstream header is required])

  fi
fi

AC_MSG_CHECKING(for ini file support)
AC_ARG_ENABLE(ini,
	[  --disable-ini              Enable ini file support],
	[
	   if test "x$enableval" = "xno" ; then
		AC_MSG_RESULT(disabled)
		no_ini=1
		support_ini=0
	   fi
        ],
	[ 
          no_ini=0 
	  AC_MSG_RESULT(enabled)
        ] )

AC_MSG_CHECKING([for GNU like STL containers])
AC_TRY_COMPILE([ 
#include <list> 
struct Foo { typedef std::list<Foo>::iterator it; }; 
],
		[ Foo foo ],
		[
			AC_MSG_RESULT(yes)

			if test $no_ini -eq 0; then
			   AC_DEFINE(CAN_USE_INI, 1, [the ini class should compile clean])
			   support_ini=1
			fi
		],
		[
			AC_MSG_RESULT(no)
			AC_MSG_WARN([cannot compile with configuration file support])
			support_ini=0
		]
	)

AC_MSG_CHECKING([for debugging support])
AC_ARG_ENABLE(debug,
	[  --enable-debug             Enable extra debugging code],
	[ 
	   AC_MSG_RESULT(enabled)
	   support_debug=1
	],
	[
           CXXFLAGS="$CXXFLAGS -DNDEBUG"
	   AC_MSG_RESULT(disabled)
	   support_debug=0
	] )

AC_MSG_CHECKING([for realease format support])
AC_ARG_ENABLE(release-format,
	[  --enable-realease-format   Enable Format's release code],
	[
	  AC_MSG_RESULT(disabled)
	  support_format=0
	],
	[
	  AC_MSG_RESULT(enabled)
	  support_format=1
	  CXXFLAGS="$CXXFLAGS -DNFORMAT"

	] )

AC_MSG_CHECKING([for new std::ios_base])
AC_TRY_COMPILE([
#include <fstream>
],
	[ std::ifstream in( "foo", std::ios_base::in ); ],
	[
		AC_MSG_RESULT(yes)
		AC_DEFINE(HAVE_IOS_BASE, 1, [ios_base can be used])
	],
	[
		AC_MSG_RESULT(no)
		AC_DEFINE(ios_base, ios, [use old ios instead of ios_base])
	]
)

# maybe a problem on Solaris and FreeBSD
AC_MSG_CHECKING([for foef() and ferror() in namespace std])
AC_TRY_COMPILE([
#include <cstdio>
],
	[ std::feof( 0 ); std::ferror( 0 ); ],
	[AC_MSG_RESULT(yes)],
	[
	  AC_MSG_RESULT(no)
	  AC_DEFINE(NO_STD_FEOF, [1], [fixing compiling problems on Solaris, or FreeBSD])
	 ]
)


CXXFLAGS="$CXXFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"



AC_MSG_CHECKING([for static support])
AC_ARG_ENABLE(static,
	[  --disable-static           Disable xstow-static and xstow-stow targets],
	[ 
	   if test "x$enableval" = "xno" ; then
		AC_MSG_RESULT(disabled)
		support_static=0
		AM_CONDITIONAL(ENABLE_STATIC, false )
	   else
	     AC_MSG_RESULT(enabled)
	     AM_CONDITIONAL(ENABLE_STATIC, true )
	     support_static=1
           fi
	],
	[
	   AC_MSG_RESULT(enabled)
	   AM_CONDITIONAL(ENABLE_STATIC, true )
	   support_static=1
	] )


AC_CONFIG_FILES([
Makefile
src/Makefile
doc/Makefile])

# report features:

if test $support_ini -gt 0 ; then
  support_ini=yes
else
  support_ini=no
fi

if test $support_debug -gt 0 ; then
  support_debug=yes
else
  support_debug=no
fi


if test $support_format -gt 0 ; then
  support_format=yes
else
  support_format=no
fi

if test $support_fnmatch -gt 0 ; then
  support_fnmatch=yes
else
  support_fnmatch=no
fi

if test $support_regex -gt 0 ; then
  support_regex=yes
else
  support_regex=no
fi

if test $support_curses -gt 0 ; then
  support_curses=yes
else
  support_curses=no
fi

if test $support_static -gt 0 ; then
  support_static=yes
else
  support_static=no
fi

AC_OUTPUT

echo
echo

echo "supported features:"


echo "    debugging:                              $support_debug"
echo "    realese version of Format:              $support_format"
echo "    configuration files:                    $support_ini"
echo "    shell pattern matching:                 $support_fnmatch"
echo "    regex pattern matching:                 $support_regex"
echo "    using curses library:                   $support_curses"
echo "    create static versions:                 $support_static"

echo
echo