File: configure.in

package info (click to toggle)
gnugo-dv 3.1.27-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 6,724 kB
  • ctags: 3,307
  • sloc: ansic: 46,051; perl: 1,303; sh: 710; makefile: 578; tcl: 401; lisp: 193
file content (482 lines) | stat: -rw-r--r-- 13,554 bytes parent folder | download
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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
dnl Process this file with autoconf to produce a configure script.

dnl this is to determine if the config script is running in the proper place
dnl just give it one file relative to where it should be
AC_INIT
AC_CONFIG_SRCDIR([engine/dragon.c])

AM_CONFIG_HEADER(config.h)
AC_PREREQ(2.50)dnl               dnl Minimum Autoconf version required.

AH_TEMPLATE([PACKAGE],
[Define to the name of the distribution.])

AH_TEMPLATE([GNU_PACKAGE],
[The concatenation of the strings "GNU ", and PACKAGE.])

AH_TEMPLATE([VERSION],
[Define to the version of the distribution.])

dnl this defines VERSION and PACKAGE
AM_INIT_AUTOMAKE([gnugo], [3.1.27])
GNU_PACKAGE="GNU $PACKAGE"
AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE")

AM_MAINTAINER_MODE

dnl See if user has expressed a preference for use of curses and/or color
dnl These set variables $enable_color and $with_curses to "no" if disabled
dnl "yes" if enabled, or undefined if not specified

AC_ARG_WITH(curses,
 [  --with-curses       try to use curses for colored debugging output (default)
  --without-curses    do not use curses for colored debugging output])

AC_ARG_ENABLE(color,
 [  --enable-color        use curses or ansi escape sequences for colored debug output
  --disable-color       do not try to generated colored debug output])

dnl and look to see if they want to disable the grid optimisation

AC_ARG_ENABLE(grid-opt,
 [  --enable-grid-opt           enable the grid optimsation within the pattern matcher (default)
  --enable-grid-opt=distrust  enable the grid optimsation in non-trusting mode
  --disable-grid-opt          disable the grid optimisation])

default_cache_size=16
default_level=10
default_semeai_variations=250

AC_ARG_ENABLE(cache-size,
  [  --enable-cache-size=n     reserve n Mb RAM for caching (16 default)])

AC_ARG_ENABLE(level,
  [  --enable-level=n          n = default level (8 standard, up to 10 supported)])

AC_ARG_ENABLE(semeai-variations,
  [  --enable-semeai-variations=n          n = semeai variations (250 standard)])

AC_ARG_ENABLE(dfa,
 [  --disable-dfa             use old non-dfa pattern matcher],
 [ if test ${enableval} = no; then	
     dfa_c=
   else	
     dfa_c=dfa
   fi] ,
 [ dfa_c=dfa ])

AC_ARG_ENABLE(chinese-rules,
 [  --enable-chinese-rules       tell the Go Modem Protocol to use Chinese Rules
  --disable-chinese-rules       use Japanese rules (default)])

AC_ARG_ENABLE(owl-threats,
 [  --enable-owl-threats        compute owl threats
  --disable-owl-threats        don't compute owl threats (default)])

AC_ARG_ENABLE(experimental-semeai,
 [  --enable-experimental-semeai    use the experimental semeai module
  --disable-experimental-semeai    use standard semeai module (default)])

AC_ARG_ENABLE(experimental-reading,
 [  --enable-experimental-reading    use experimental pattern-based reading
  --disable-experimental-reading    use standard reading (default)])

AC_ARG_ENABLE(experimental-connections,
 [  --enable-experimental-connections    use experimental connection analysis
  --disable-experimental-connections    use standard connection analysis (default)])

AC_ARG_ENABLE(alternate-connections,
 [  --enable-alternate-connections    use alternate experimental connection analysis
  --disable-alternate-connections    use primary experimental connection analysis (default)])

AC_ARG_ENABLE(experimental-influence,
 [  --enable-experimental-influence    use experimental influence module
  --disable-experimental-influence    use standard influence module (default)])

AC_ARG_ENABLE(profile,
 [  --enable-profile       compile gnugo with gprof option ])

dnl expand any instances of @matcher@ in Makefile
AC_SUBST(dfa_c)

AC_PROG_CC

dnl for automake 1.4.x
AC_EXEEXT

dnl add -lm to library list since we use some
dnl math functions such as pow and fabs

AC_SEARCH_LIBS(pow,m)

AC_CACHE_CHECK(
	[for mingw32],
	ac_cv_mingw32,
	AC_TRY_COMPILE(,
		[return __MINGW32__],
		ac_cv_mingw32="yes",
		ac_cv_mingw32="no")
)

if test $ac_cv_mingw32 = yes;then
    LIBS="$LIBS -lwsock32"
fi

AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
AC_PROG_RANLIB

dnl required since we use SUBDIRS in Makefile.am
AC_PROG_MAKE_SET

AC_HEADER_MAJOR
AC_HEADER_TIME

AC_C_CONST

AC_CHECK_HEADERS(unistd.h sys/time.h sys/times.h)
AC_CHECK_HEADERS(curses.h term.h ncurses/curses.h ncurses/term.h)

if test "$ac_cv_header_curses_h" = "yes";then
   curses_header="curses.h"
elif test "$ac_cv_header_ncurses_curses_h" = "yes";then
   curses_header="ncurses/curses.h"
else
   curses_header="no"
fi

if test "$ac_cv_header_term_h" = "yes";then
   term_header="term.h"
elif test "$ac_cv_header_ncurses_term_h" = "yes";then
   term_header="ncurses/term.h"
else
   term_header="no"
fi

AC_PATH_PROG(perl, perl)

AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)

dnl results of setlinebuf test used in interface/play_ascii.c
dnl alarm not available in VC
dnl vsnprintf not universally available
dnl usleep not available in Unicos and mingw32
AC_CHECK_FUNCS(setlinebuf alarm vsnprintf gettimeofday usleep times)

dnl if snprintf not available try to use g_snprintf from glib
if test $ac_cv_func_vsnprintf = no; then
    AC_CHECK_PROG(glibconfig,glib-config,yes,no)
    if test $ac_cv_prog_glibconfig = yes;then
	glib_cflags=`glib-config --cflags`
	glib_libs=`glib-config --libs`
	CPPFLAGS="$CPPFLAGS $glib_cflags"
	LIBS="$LIBS $glib_libs"
	AC_CHECK_FUNCS(g_vsnprintf)
	AC_CHECK_HEADERS(glib.h)
	if test $ac_cv_func_g_vsnprintf = no; then
    	   AC_MSG_WARN([glib installation problem.
	   Continuing without glib ])
        fi
    else
    	   AC_MSG_WARN([Neither vsnprintf nor glib found. Gnugo is
	   compiled but it is safer to get glib at
	   http://www.gtk.org/])
    fi
fi
 
dnl AM_FUNC_ERROR_AT_LINE

AH_TEMPLATE([HAVE___FUNCTION__],
[Define if the preprocessor recognizes __FUNCTION__])

AC_CACHE_CHECK(
	[for __FUNCTION__],
	gnugo_cv_c___function__,
	AC_TRY_COMPILE(,
		[char *s=__FUNCTION__],
		gnugo_cv_c___function__="yes",
		gnugo_cv_c___function__="no")
)
if test "$gnugo_cv_c___function__" = "yes";then
      AC_DEFINE(HAVE___FUNCTION__)
fi
dnl ------ variadic #define -----------------------

AH_TEMPLATE([HAVE_VARIADIC_DEFINE],
[Define if #define can take a variable number of arguments])

AC_CACHE_CHECK(
	[for variadic cpp define],
	gnugo_cv_cpp_variadic_define,
	AC_TRY_COMPILE(
[#include <stdio.h>
#define zz(fmt,arg...) printf(fmt,##arg)],
		[zz("Hello");zz("%s","Hello");zz("%s%s","Hello","World")],
		gnugo_cv_cpp_variadic_define="yes",
		gnugo_cv_cpp_variadic_define="no")
)
if test "$gnugo_cv_cpp_variadic_define" = "yes";then
      AC_DEFINE(HAVE_VARIADIC_DEFINE)
fi

dnl check for a working curses library for use in debugboard

AH_TEMPLATE([CURSES],
[Define to use curses for color debugging])

AH_TEMPLATE([HAVE_CURSES_ARROWS],
[Define if the curses headers defines  KEY_{UP,DOWN,LEFT,RIGHT}])

if test "$curses_header" != "no";then
  AC_SEARCH_LIBS(initscr,ncurses curses pdcurses termcap terminfo termlib)
  if test "$ac_cv_search_initscr" != "no";then
    AC_DEFINE(CURSES)
    AC_CHECK_FUNCS(vwprintw keypad)
    AC_CACHE_CHECK(
	[for KEY_UP],
	gnugo_cv_decl_key_up,
	AC_TRY_COMPILE([#include <$curses_header>],
		[int c=KEY_UP],
		gnugo_cv_decl_key_up="yes",
		gnugo_cv_decl_key_up="no")
    )
    if test "$gnugo_cv_decl_key_up" = "yes";then
      AC_DEFINE(HAVE_CURSES_ARROWS)
    fi
  fi
fi

dnl -------- color debugging support -----------

AH_TEMPLATE([TERMINFO],
[Define to 1 if termcap/terminfo is available.])

AH_TEMPLATE([ANSI_COLOR],
[Define to use ansi escape sequences for color debugging])

tmp_color_result="none"

if test "$with_curses" != no -a "$enable_color" != no ; then
  tmp_color_result="none (curses failed)"

  dnl Do a separate test for curses and termcap
  dnl DJGPP does have pdcurses, but not termcap

  dnl make sure that both curses.h and term.h are available
  dnl FIXME PRE3.0: better to actually figure out here what headers
  dnl are really required
  if test "$term_header" != "no" -a "$curses_header" != "no" ; then

    dnl check for a working termcap library
    AC_SEARCH_LIBS(tparm,ncurses curses pdcurses termcap terminfo termlib)

    if test "$ac_cv_search_tparm" != "no" ; then
      AC_DEFINE(TERMINFO)
    tmp_color_result="curses"
    fi
  fi
fi


if test "$with_curses" = no -a "$enable_color" != no ; then
  dnl we asked for color, but there is no termcap
  AC_DEFINE(ANSI_COLOR)
  tmp_color_result="ANSI color"

fi

AC_MSG_CHECKING(for color support)
AC_MSG_RESULT($tmp_color_result)

dnl ---------- grid optimisation ------------

AH_TEMPLATE([GRID_OPT],
[Define as 1 to use the grid optimisation, or 2 to run it in self-test mode])

if test "$enable_grid_opt" = "distrust" ; then
  AC_DEFINE(GRID_OPT, 2)
else
  if test "$enable_grid_opt" = "no" ; then
    AC_DEFINE(GRID_OPT, 0)
  else
    AC_DEFINE(GRID_OPT, 1)
  fi
fi


dnl ------------ set cache size ----------

AH_TEMPLATE([DEFAULT_MEMORY],
[Default hash table size in megabytes])

if test "$enable_cache_size" ; then
   AC_DEFINE_UNQUOTED(DEFAULT_MEMORY, $enable_cache_size)
else
   AC_DEFINE_UNQUOTED(DEFAULT_MEMORY, $default_cache_size)
fi


dnl ------------ set default level  ----------

AH_TEMPLATE([DEFAULT_LEVEL],
[Default level (strength). Up to 10 supported])

if test "$enable_level" ; then
   AC_DEFINE_UNQUOTED(DEFAULT_LEVEL, $enable_level)
else
   AC_DEFINE_UNQUOTED(DEFAULT_LEVEL, $default_level)
fi

dnl ------------ set semeai variations  ----------

AH_TEMPLATE([DEFAULT_SEMEAI_VARIATIONS],
[Semeai Variations. 250 default])

if test "$enable_semeai_variations" ; then
   AC_DEFINE_UNQUOTED(DEFAULT_SEMEAI_VARIATIONS, $enable_semeai_variations)
else
   AC_DEFINE_UNQUOTED(DEFAULT_SEMEAI_VARIATIONS, $default_semeai_variations)
fi

dnl ------------ dfa -------------------

AM_CONDITIONAL(DFA_ENABLED, test "$enable_dfa" != "no")

dnl FIXME: Is there a more elegant approach for this?
dnl force owl c files rebuild
rm -f \
       patterns/owl_attackpat.c \
       patterns/owl_defendpat.c \
       patterns/owl_vital_apat.c


dnl ------------ gnugo_path -------------------


AH_TEMPLATE([GNUGO_PATH],
[Give the directory where gnugo was compiled])

AC_DEFINE_UNQUOTED(GNUGO_PATH, "`pwd`")

dnl ------------ Chinese Rules -------------------

AH_TEMPLATE([CHINESE_RULES],
[Ruleset. Default Japanese])

if test "$enable_chinese_rules" = "yes" ; then
   AC_DEFINE(CHINESE_RULES, 1)
else
   AC_DEFINE(CHINESE_RULES, 0)
fi

dnl ------------ Semeai -------------------

AH_TEMPLATE([EXPERIMENTAL_SEMEAI],
[Semeai module. Default standard.])

if test "$enable_experimental_semeai" = "yes" ; then
   AC_DEFINE(EXPERIMENTAL_SEMEAI, 1)
else
   AC_DEFINE(EXPERIMENTAL_SEMEAI, 0)
fi

dnl ------------ Reading -------------------

AH_TEMPLATE([EXPERIMENTAL_READING],
[Experimental pattern based reading. Disabled by default.])

if test "$enable_experimental_reading" = "yes" ; then
   AC_DEFINE(EXPERIMENTAL_READING, 1)
else
   AC_DEFINE(EXPERIMENTAL_READING, 0)
fi

dnl ------------ Connections -------------------

AH_TEMPLATE([EXPERIMENTAL_CONNECTIONS],
[Connection module. Default standard.])

if test "$enable_experimental_connections" = "no" ; then
   AC_DEFINE(EXPERIMENTAL_CONNECTIONS, 0)
else
   AC_DEFINE(EXPERIMENTAL_CONNECTIONS, 1)
fi

dnl ------------ Connections -------------------

AH_TEMPLATE([ALTERNATE_CONNECTIONS],
[Connection module. Default standard.])

if test "$enable_alternate_connections" = "no" ; then
   AC_DEFINE(ALTERNATE_CONNECTIONS, 0)
else
   AC_DEFINE(ALTERNATE_CONNECTIONS, 1)
fi

dnl ------------ Owl Threats -------------------

AH_TEMPLATE([OWL_THREATS],
[Owl Threats. 0 standard.])

if test "$enable_owl_threats" = "yes" ; then
   AC_DEFINE(OWL_THREATS, 1)
else
   AC_DEFINE(OWL_THREATS, 0)
fi

dnl ------------ Influence -------------------

AH_TEMPLATE([EXPERIMENTAL_INFLUENCE],
[Influence module. Default standard.])

if test "$enable_experimental_influence" = "no" ; then
   AC_DEFINE(EXPERIMENTAL_INFLUENCE, 0)
else
   AC_DEFINE(EXPERIMENTAL_INFLUENCE, 1)
fi

dnl  ----------- special-case use of gcc ---------

dnl Not sure if we are supposed to be accessing this variable, but...

AC_SUBST(GCC_ONLY)
AC_SUBST(GNUGO_SOME_WARNINGS)
AC_SUBST(GNUGO_ALL_WARNINGS)
AC_SUBST(NO_WARNINGS)

dnl Please add -Wp,-lang-c89 to SOME_WARNINGS soon

NO_WARNINGS="CFLAGS=$CFLAGS"
if test $ac_cv_c_compiler_gnu = yes; then
  GCC_ONLY=''
  GGO_SOME_WARNINGS='-Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wp,-lang-c89'
  GGO_ALL_WARNINGS='-Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wp,-lang-c89'
  GNUGO_SOME_WARNINGS="CFLAGS=$CFLAGS $GGO_SOME_WARNINGS"
  GNUGO_ALL_WARNINGS="CFLAGS=$CFLAGS $GGO_ALL_WARNINGS"
  CFLAGS="$CFLAGS $GGO_SOME_WARNINGS"
  if test "$enable_profile" = "yes" ; then
     CFLAGS="-pg $CFLAGS"
  fi
else
  GCC_ONLY='#'
  GNUGO_SOME_WARNINGS=''
  GNUGO_ALL_WARNINGS=''
fi

dnl Now lines in Makefile.am can be prefixed @GCC_ONLY@, and
dnl we can specify either @GNUGO_SOME_WARNINGS@ or @GNUGO_ALL_WARNINGS@

dnl FIXME POST3.0: please add warnings for other compilers !



#AM_GNU_GETTEXT
#AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)

dnl FIXME:
dnl autoconf 2.50 recommends AC_CONFIG_FILES and AC_OUPUT
dnl This however requires automake 1.4p2 or better

AC_OUTPUT([Makefile interface/Makefile patterns/Makefile sgf/Makefile
utils/Makefile engine/Makefile doc/Makefile regression/Makefile interface/debugboard/Makefile config.vc:config.vcin])