File: configure.ac

package info (click to toggle)
freecell-solver 2.8.10-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, sarge
  • size: 2,864 kB
  • ctags: 1,215
  • sloc: ansic: 14,713; sh: 10,555; perl: 451; python: 349; makefile: 99
file content (348 lines) | stat: -rw-r--r-- 11,577 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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(pqueue.c)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_RANLIB

AM_INIT_AUTOMAKE(freecell-solver, [`cat ./ver.txt`])

AM_PROG_LIBTOOL

AM_CONFIG_HEADER(config.h)


dnl Checks for libraries.
dnl Replace `main' with a function in -ldb:
dnl AC_CHECK_LIB(db, main)
dnl Replace `main' with a function in -ldl:
dnl AC_CHECK_LIB(dl, main)
dnl Replace `main' with a function in -lglib:
dnl AC_CHECK_LIB(glib, g_hash_table_new)
dnl Replace `main' with a function in -lm:
AC_CHECK_LIB(m, pow)

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(limits.h)

state_storage=internal_hash
stack_storage=internal_hash
max_num_freecells=4
max_num_stacks=10
states_type=indirect
max_num_initial_cards_per_stack=8
max_num_decks=2
card_debug_pres=no

AC_ARG_ENABLE(state-storage,
 [  --enable-state-storage[=storage type] Specify a storage types for the state collection:
                      glib_hash: Glib's hash 
                      glib_tree: Glib's binary tree 
                      indirect: By means of a sorted array with a sort margin
                      internal_hash: Internal Hash Storage (Default)
                      libavl_avl: libavl's AVL tree 
                      libavl_redblack: libavl's Red-Black tree
                      libredblack: The libredblack tree],
 [ if   test "x$enableval" = "xglib_hash" ; then
      state_storage=glib_hash
   elif test "x$enableval" = "xglib_tree" ; then
      state_storage=glib_tree
   elif test "x$enableval" = "xindirect" ; then
      state_storage=indirect      
   elif test "x$enableval" = "xinternal_hash" ; then
      state_storage=internal_hash
   elif test "x$enableval" = "xlibavl_avl" ; then
      state_storage=libavl_avl
   elif test "x$enableval" = "xlibavl_redblack" ; then
      state_storage=libavl_redblack
   elif test "x$enableval" = "xlibredblack" ; then
      state_storage=libredblack      
   else
      echo
      echo "Error!"
      echo "Unknown state storage"
      exit -1
   fi
 ])

AC_ARG_ENABLE(stack-storage,
 [  --enable-stack-storage[=storage type] Specify a storage types for the state collection:
                      glib_hash: Glib's hash 
                      glib_tree: Glib's binary tree 
                      internal_hash: Internal Hash Storage (Default)
                      libavl_avl: libavl's AVL tree 
                      libavl_redblack: libavl's Red-Black tree
                      libredblack: The libredblack tree],
 [ if   test "x$enableval" = "xglib_hash" ; then
      stack_storage=glib_hash
   elif test "x$enableval" = "xglib_tree" ; then
      stack_storage=glib_tree
   elif test "x$enableval" = "xinternal_hash" ; then
      stack_storage=internal_hash
   elif test "x$enableval" = "xlibavl_avl" ; then
      stack_storage=libavl_avl
   elif test "x$enableval" = "xlibavl_redblack" ; then
      stack_storage=libavl_redblack
   elif test "x$enableval" = "xlibredblack" ; then
      stack_storage=libredblack      
   else
      echo
      echo "Error!"
      echo "Unknown state storage"
      exit -1
   fi
 ])

AC_ARG_ENABLE(states-type,
 [  --enable-states-type[=state type] Specify the states type:
                      compact: Compact States
                      debug: Debug States (very slow)
                      indirect [default]: Indirect Stack States],
 [ if   test "x$enableval" = "xcompact" ; then
      states_type=compact
   elif test "x$enableval" = "xdebug" ; then
      states_type=debug
   elif test "x$enableval" = "xindirect" ; then
      states_type=indirect      
   else
      echo 
      echo "Error!"
      echo "Unknown states' type"
      exit -1
   fi
 ])


AC_ARG_ENABLE(max-num-freecells,
 [  --enable-max-num-freecells[=freecells num] Set the maximal number of Freecells],
 [ if   test "x$enableval" = "x" ; then
      max_num_freecells=4
   else
       # Check if it's indeed a number
       changequote(, )
       if echo "0$enableval" | grep '[^0-9]' > /dev/null ; then  
           echo 
           echo "Error!"       
           echo "max-num-freecells should be a number!"
           exit -1
       elif expr $enableval \< 4 > /dev/null ; then
           echo
           echo "Error!"
           echo "max-num-freecells cannot be lower than 4!"
           exit -1
       elif expr $enableval \> 20 > /dev/null ; then
           echo 
           echo "Error!"
           echo "max-num-freeecells cannot be greater than 20!"
           exit -1
       else           
           max_num_freecells="$enableval"
       fi       
       changequote([, ])
   fi])

AC_ARG_ENABLE(max-num-stacks,
 [  --enable-max-num-stacks[=stacks num] Set the maximal number of Stacks],
 [ if   test "x$enableval" = "x" ; then
      max_num_stacks=8
   else
       changequote(, )
       # Check if it's indeed a number
       if echo "0$enableval" | grep '[^0-9]' > /dev/null ; then  
           echo 
           echo "Error!"       
           echo "max-num-stacks should be a number!"
           exit -1
       elif expr $enableval \< 8 > /dev/null ; then 
           echo
           echo "Error!"
           echo "max-num-stacks cannot be lower than 8"
           exit -1
       elif expr $enableval \> 20 > /dev/null ; then
           echo 
           echo "Error!"
           echo "max-num-stacks cannot be greater than 20"
           exit -1
       else
           max_num_stacks="$enableval"
       fi       
       changequote([, ])
   fi])

AC_ARG_ENABLE(max-num-initial-cards-per-stack,
 [  --enable-max-num-initial-cards-per-stack[=number] Set the maximal number of Cards that can appear in a stack],
 [ if   test "x$enableval" = "x" ; then
      max_num_initial_cards_per_stack=7
   else
       changequote(, )
       # Check if it's indeed a number
       if echo "0$enableval" | grep '[^0-9]' > /dev/null ; then  
           echo 
           echo "Error!"
           echo "max-num-initial-cards-per-stack should be a number!"
           exit -1
       elif expr $enableval \< 7 > /dev/null ; then
           echo
           echo "Error!"
           echo "max-num-initial-cards-per-stack cannot be lower than 7"
           exit -1
       elif expr $enableval \> 104 > /dev/null ; then
           echo
           echo "Error!"
           echo "max-num-initial-cards-per-stack cannot be greater than 104"
           echo "(the number of cards in two decks"
           exit -1
       else
           max_num_initial_cards_per_stack="$enableval"
       fi
       changequote([, ])
   fi])   

AC_ARG_ENABLE(max-num-decks,
 [  --enable-max-num-decks[=decks num] Set the maximal number of Decks],
 [ if   test "x$enableval" = "x1" ; then
       max_num_decks=1
   elif test "x$enableval" = "x2" ; then
       max_num_decks=2
   else
       echo 
       echo "Error!"   
       echo "Wrong value for max-num-decks. Can be 1 or 2."
       exit -1
   fi])

AC_ARG_ENABLE(card-debug-pres,
 [  --enable-card-debug-pres  Enable Card-Debug Presentation. This is a debugging feature which should not be usually enabled],
 [ card_debug_pres=yes
 ])

 
if   test "x$state_storage" = "xglib_hash" ; then
    AC_DEFINE(FCS_STATE_STORAGE,FCS_STATE_STORAGE_GLIB_HASH)
    requires_glib=yes
elif test "x$state_storage" = "xglib_tree" ; then
    AC_DEFINE(FCS_STATE_STORAGE,FCS_STATE_STORAGE_GLIB_TREE)
    requires_glib=yes
elif test "x$state_storage" = "xindirect" ; then
    AC_DEFINE(FCS_STATE_STORAGE,FCS_STATE_STORAGE_INDIRECT)
elif test "x$state_storage" = "xinternal_hash" ; then
    AC_DEFINE(FCS_STATE_STORAGE,FCS_STATE_STORAGE_INTERNAL_HASH)
elif test "x$state_storage" = "xlibavl_avl" ; then
    AC_DEFINE(FCS_STATE_STORAGE,FCS_STATE_STORAGE_LIBAVL_AVL_TREE)
    requires_libavl=yes
elif test "x$state_storage" = "xlibavl_redblack" ; then
    AC_DEFINE(FCS_STATE_STORAGE,FCS_STATE_STORAGE_LIBAVL_REDBLACK_TREE)
    requires_libavl=yes
elif test "x$state_storage" = "xlibredblack" ; then
    AC_DEFINE(FCS_STATE_STORAGE,FCS_STATE_STORAGE_LIBREDBLACK_TREE)
    requires_libredblack=yes
fi

if test "x$states_type" = "xindirect" ; then
    if   test "x$stack_storage" = "xglib_hash" ; then
        AC_DEFINE(FCS_STACK_STORAGE,FCS_STACK_STORAGE_GLIB_HASH)
        requires_glib=yes
    elif test "x$stack_storage" = "xglib_tree" ; then
        AC_DEFINE(FCS_STACK_STORAGE,FCS_STACK_STORAGE_GLIB_TREE)
        requires_glib=yes
    elif test "x$stack_storage" = "xinternal_hash" ; then
        AC_DEFINE(FCS_STACK_STORAGE,FCS_STACK_STORAGE_INTERNAL_HASH)
    elif test "x$stack_storage" = "xlibavl_avl" ; then
        AC_DEFINE(FCS_STACK_STORAGE,FCS_STACK_STORAGE_LIBAVL_AVL_TREE)
        requires_libavl=yes
    elif test "x$stack_storage" = "xlibavl_redblack" ; then
        AC_DEFINE(FCS_STACK_STORAGE,FCS_STACK_STORAGE_LIBAVL_REDBLACK_TREE)
        requires_libavl=yes
    elif test "x$stack_storage" = "xlibredblack" ; then
        AC_DEFINE(FCS_STACK_STORAGE,FCS_STACK_STORAGE_LIBREDBLACK_TREE)
        requires_libredblack=yes
    fi
fi

if test "x$requires_libavl" = "xyes" ; then
    AC_CHECK_LIB(avl, avl_create, [], [
        echo "Error! You need to have libavl around."
        exit -1
        ])
fi

if test "x$requires_libredblack" = "xyes" ; then
    AC_CHECK_LIB(redblack, rbsearch, [], [
        echo "Error! You need to have libredblack around."
        exit -1
        ])
fi

if test "x$requires_glib" = "xyes" ; then
    AC_CHECK_LIB(glib, g_hash_table_new)
    if test "x$ac_cv_lib_glib_g_hash_table_new" = "xno" ; then
        echo 
        echo "Error!"
        echo "You need to have glib around."
        exit -1
    fi

    
    if false ; then
        GTK_CFLAGS=`gtk-config --cflags`
        dnl Evil stuff to extract GLIB stuff from gtk-config output
        dnl (we want to make sure it matches with the gtk we're using)
        GTK_TEMP_CFLAGS=`echo $GTK_CFLAGS | sed 's/^\(-I[^ ]*\).*$/\1/'`
        if echo $GTK_TEMP_CFLAGS | grep 'glib/include$' > /dev/null; then
          GTK_TEMP_CFLAGS="$GTK_CFLAGS"
        else
          GTK_TEMP_CFLAGS=`echo $GTK_CFLAGS | sed 's/^-I[^ ]* \(.*\)$/\1/'`
        fi
        GLIB_CFLAGS=`echo $GTK_TEMP_CFLAGS | sed 's/^\(-I[^ ]*glib[^ ]*  *-I[^ ]*\).*/\1/'`
    fi
    GLIB_CFLAGS=`glib-config --cflags`
    # Append them to the compiler flags
    CFLAGS="$CFLAGS $GLIB_CFLAGS"
fi

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_C_INLINE

if test "x$ac_cv_inline" != "xno" ; then
    AC_DEFINE(HAVE_C_INLINE)
fi

dnl Checks for library functions.
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(strdup)

# Define COMPACT_STATES, DEBUG_STATES or INDIRECT_STACK_STATES
if   test "x$states_type" = "xcompact" ; then
    AC_DEFINE(COMPACT_STATES)
elif test "x$states_type" = "xdebug" ; then
    AC_DEFINE(DEBUG_STATES)
else
    AC_DEFINE(INDIRECT_STACK_STATES)
fi

if test "x$card_debug_pres" = "xyes" ; then
    AC_DEFINE(CARD_DEBUG_PRES)
fi

AC_DEFINE(PREV_STATES_SORT_MARGIN,32)
AC_DEFINE(PREV_STATES_GROW_BY,128)
AC_DEFINE(IA_STATE_PACKS_GROW_BY,32)
AC_DEFINE_UNQUOTED(MAX_NUM_FREECELLS,$max_num_freecells)
AC_DEFINE_UNQUOTED(MAX_NUM_STACKS,$max_num_stacks)
AC_DEFINE_UNQUOTED(MAX_NUM_INITIAL_CARDS_IN_A_STACK,$max_num_initial_cards_per_stack)
AC_DEFINE_UNQUOTED(MAX_NUM_DECKS,$max_num_decks)

AC_CONFIG_SUBDIRS([board_gen])

AC_OUTPUT([Makefile man/Makefile freecell-solver-config freecell-solver.spec prefix.h.proto Presets/Makefile Presets/presetrc.proto Presets/presets/Makefile], [chmod +x freecell-solver-config])

for I in prefix.h Presets/presetrc ; do
    cat $I.proto | sed s@'${prefix}'@"$prefix"@g > $I
done