File: configure.ac

package info (click to toggle)
tucnak 4.67-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 32,932 kB
  • sloc: ansic: 87,491; sh: 8,857; perl: 516; makefile: 416; xml: 21
file content (567 lines) | stat: -rw-r--r-- 19,426 bytes parent folder | download | duplicates (2)
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
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
AC_INIT([libzia],[4.67])
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_SRCDIR(src/eprintf.c)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_PROG_RANLIB
if test -f "/etc/debian_version"; then
    echo "TIP: If following test fails, try to run: apt-get install libc6-dev"
fi
if test -f "/etc/SuSE-release"; then
    echo "TIP: If following test fails, try to run: yast -i gcc"
fi
LT_INIT([dlopen])
AC_CONFIG_MACRO_DIR([m4])

dnl Determine default prefix
test x$prefix = "xNONE" && prefix="$ac_default_prefix"
                                        
dnl Locate required external software
AC_PROG_CC
app_cc_ver=$($CC -dumpversion)

# --disable-opt
opt='-O2'
AC_ARG_ENABLE(opt, [  --disable-opt           Disable compiling optimisation (-O0)], disable_opt=yes,disable_opt=no )
if test x"$disable_opt" = x"yes"; then        
    CFLAGS=$(echo "$CFLAGS"|sed 's/-O2/-O0/')
    opt='-O0'
fi



# check for platform type
case "$host_os" in
mingw*)
    PLATFORM="mingw"
    ;;
*)    
    PLATFORM=$(uname -s | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')
    if test $? != 0 ; then 
        PLATFORM="unix"
    fi
    ;;
esac    
AC_DEFINE_UNQUOTED([PLATFORM], ["$PLATFORM"], [Platform type])



# check for machine type
case "$host_os" in
mingw*)
    MACHINE="i386"
    ;;
*)    
    if test x"$MACHINE" = x"" ; then
        MACHINE=$(uname -m)
    fi
    ;;
esac    
AC_DEFINE_UNQUOTED([MACHINE], ["$MACHINE"], [Machine type])


REQPRIVATE=""

AC_MSG_CHECKING([whether linker supports -Wl,-map])
app_ld_wlmap=unchecked
case "$host_os" in
mingw*)
    ;;
*)    
    OLDLDFLAGS=$LDFLAGS
    LDFLAGS="$LDFLAGS -Wl,-Map,libzia.so.map"
    AC_LINK_IFELSE(
        [AC_LANG_PROGRAM([],[])],
        [app_ld_wlmap=yes],
        [app_ld_wlmap=no])
    LDFLAGS=$OLDLDFLAGS
    rm -f libzia.so.map
    ;;
esac    
AC_MSG_RESULT([$app_ld_wlmap])
AM_CONDITIONAL([USE_WLMAP], [test "$app_ld_wlmap" = "yes"])

dnl Check for system header files
AC_HEADER_STDC
AC_CHECK_HEADERS(arpa/inet.h bfd.h cygwin/in.h ctype.h dbghelp.h dirent.h dlfcn.h errno.h execinfo.h fcntl.h getopt.h ifaddrs.h linux/i2c-dev.h linux/input.h linux/spi/spidev.h math.h netdb.h netinet/in.h psapi.h pty.h shlobj.h signal.h stdarg.h stdio.h string.h sys/ioctl.h sys/prctl.h sys/select.h sys/socket.h sys/time.h sys/types.h sys/wait.h termios.h time.h unistd.h win32api/ws2tcpip.h windows.h winsock2.h ws2tcpip.h)
AC_CHECK_HEADERS([linux/wireless.h], [], [], [
   #include <sys/types.h>
   #include <sys/socket.h>
])
AC_HEADER_TIME

app_libc_ver="cross"
if test "$cross_compiling" = yes; then
    xyz=""
else
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <features.h>
#ifdef __GLIBC__
#include <gnu/libc-version.h>
#endif
#include <stdio.h>
#ifdef __CYGWIN__
#include <cygwin/version.h>
#endif
FILE *f;
int main(void){
    f=fopen("conftest.libc.out", "wt");
    if (!f) return -1;
#ifdef __GLIBC__
    fprintf(f, "glibc %d.%d (%s)\n", __GLIBC__, __GLIBC_MINOR__, gnu_get_libc_version());
#endif
#ifdef __CYGWIN__
    fprintf(f, "cygwin %d.%d.%d, api %d.%d\n", 
    CYGWIN_VERSION_DLL_MAJOR/1000,
    CYGWIN_VERSION_DLL_MAJOR%1000,
    CYGWIN_VERSION_DLL_MINOR,
    CYGWIN_VERSION_API_MAJOR,
    CYGWIN_VERSION_API_MINOR);
#endif    
    fclose(f);
    return 0;
}                                                                
]])],[ app_libc_ver="yes $(cat conftest.libc.out)"],[],[]) 
rm -f conftest.libc.out
fi

dnl AC_CHECK_LIB(m, sin,   LIBM="-lm")
dnl AC_CHECK_LIB(m, cos,   LIBM="-lm")
dnl AC_CHECK_LIB(m, tan,   LIBM="-lm")
dnl AC_CHECK_LIB(m, acos,  LIBM="-lm")
dnl AC_CHECK_LIB(m, round, LIBM="-lm")
dnl LIBS="$LIBS $LIBM"

AC_CHECK_FUNCS(strncmpi)
AC_CHECK_FUNCS(getaddrinfo)

app_mlibs=""
app_mdebs=""
app_mrpms=""
app_olibs=""
app_odebs=""
app_orpms=""

# check for make
AC_CHECK_PROG(HAVE_MAKE, make, [yes], [no])
if test x"$HAVE_MAKE" = x"no"; then
    app_mlibs="$app_mlibs make"
    app_mdebs="$app_mdebs make"
    app_mrpms="$app_mrpms make"
fi

# check for pkg-config
AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, [yes], [no])
if test x"$HAVE_PKGCONFIG" = x"no"; then
    app_mlibs="$app_mlibs pkg-config"
    app_mdebs="$app_mdebs pkg-config"
    app_mrpms="$app_mrpms pkg-config"
fi
    


# check for glib and gthreads
app_glib_ver=""
HAVE_GLIB="0"
PKG_CHECK_MODULES(GLIB, 
            glib-2.0 > 2.30.0, 
            [ AC_DEFINE([HAVE_GLIB], [], [glib])
              app_glib="yes" 
              app_glib_ver=$($PKG_CONFIG --modversion 'glib-2.0 > 2.30.0')
              HAVE_GLIB="1"
              REQPRIVATE="$REQPRIVATE glib-2.0"],
            [ app_mlibs="$app_mlibs libglib2"
              app_mdebs="$app_mdebs libglib2.0-dev"
              app_mrpms="$app_mrpms glib2-devel"
              app_glib="no"])
AC_SUBST(HAVE_GLIB)


#
# check for forkpty
#
HAVE_FORKPTY="0"
AC_CHECK_LIB(util, forkpty,
            [ AC_DEFINE([HAVE_FORKPTY], [], [forkpty])
              HAVE_FORKPTY="1" ])
AC_SUBST([HAVE_FORKPTY])

LIBS="$LIBS -lutil"


#
# check for gtk
#
AC_ARG_WITH([gtk], AS_HELP_STRING([--without-gtk], [Build without gtk library for mingw (default: test)]))
app_gtk="disabled"
app_gtk_ver=""
HAVE_GTK="0"
if test "x$with_gtk" != "xno"; then
PKG_CHECK_MODULES(GTK, 
            gtk+-3.0 > 3.0.0, 
            [ AC_DEFINE([HAVE_GTK], [], [gtk])
              app_gtk="yes" 
              app_gtk_ver=$($PKG_CONFIG --modversion 'gtk+-3.0 > 3.0.0')
              HAVE_GTK="1"
              REQPRIVATE="$REQPRIVATE gtk+-3.0"],
            [ app_olibs="$app_mlibs libgtk-3-0"
              app_odebs="$app_mdebs libgtk-3-dev"
              app_orpms="$app_mrpms gtk3-devel"
              app_gtk="no"])
fi
AC_SUBST(HAVE_GTK)


AC_ARG_WITH([sdl], AS_HELP_STRING([--without-sdl], [Build without sdl library for graphics support (default: test)]))
app_sdl="disabled"

if test "x$with_sdl" != "xno"; then
# check for SDL
app_sdl_ver=""
HAVE_SDL="0"

PKG_CHECK_MODULES(SDL, sdl2 >= 2.0.5,   #not tested on older, version from 2016
            [ AC_DEFINE([HAVE_SDL], [1], [libSDL2])
              AC_DEFINE([HAVE_SDL2], [1], [libSDL2])
              app_sdl="yes"
              app_sdl_ver=$($PKG_CONFIG --modversion sdl2)
              HAVE_SDL="2"
              REQPRIVATE="$REQPRIVATE sdl2"],
            [ 

             PKG_CHECK_MODULES(SDL, sdl > 1.2.10,
                [ AC_DEFINE([HAVE_SDL], [1], [libSDL1])
                  AC_DEFINE([HAVE_SDL1], [1], [libSDL1])
                  app_sdl="yes"
                  app_sdl_ver=$(sdl-config --version)
                  HAVE_SDL="1"
                  REQPRIVATE="$REQPRIVATE sdl"],
                [ app_olibs="$app_olibs libsdl"
                  app_odebs="$app_odebs libsdl-dev" 
                  app_orpms="$app_orpms libSDL-devel" 
                  app_sdl="no"]
                )
            ])
fi
AC_SUBST(HAVE_SDL)

AC_ARG_WITH([SDL_ttf], AS_HELP_STRING([--without-sdl_ttf], [Build without SDL_ttf support (default: test)]))
app_libsdlttf="disabled"
if test "x$with_SDL_ttf" != "xno"; then
# check for libSDL_ttf
app_libsdlttf_ver=""
HAVE_SDL_TTF="0"

if test "x$HAVE_SDL" = "x2"; then
  PKG_CHECK_MODULES(SDL_TTF, SDL2_ttf >= 2.0.12,
              [ AC_DEFINE([HAVE_SDL_TTF], [1], [libSDL2_ttf]) 
                app_libsdlttf="yes"
                app_libsdlttf_ver=$(pkg-config --modversion 'SDL2_ttf >= 2.0.12')
                HAVE_SDL_TTF="2"
                REQPRIVATE="$REQPRIVATE SDL2_ttf" ], 
              [ app_olibs="$app_olibs libsdl2_ttf"
                app_odebs="$app_odebs libsdl2-ttf-dev"
                app_orpms="$app_orpms SDL2_ttf-devel"
                app_libsdlttf="no"]
              )
else 
  PKG_CHECK_MODULES(SDL_TTF, SDL_ttf >= 2.0.11,
              [ AC_DEFINE([HAVE_SDL_TTF], [1], [libSDL_ttf]) 
                app_libsdlttf="yes"
                app_libsdlttf_ver=$(pkg-config --modversion 'SDL_ttf >= 2.0.11')
                HAVE_SDL_TTF="1"
                REQPRIVATE="$REQPRIVATE SDL_ttf" ], 
              [ app_olibs="$app_olibs libsdl_ttf"
                app_odebs="$app_odebs libsdl-ttf2.0-dev"
                app_orpms="$app_orpms SDL_ttf-devel"
                app_libsdlttf="no"]
              )
fi
fi
AC_SUBST(HAVE_SDL_TTF)



AC_ARG_WITH([png], AS_HELP_STRING([--without-png], [Build without PNG support (default: test)]))
app_libpng="disabled"
if test "x$with_png" != "xno"; then
# check for libpng
app_libpng_ver=""
HAVE_LIBPNG="0"
PKG_CHECK_MODULES(LIBPNG, libpng > 1.2.0,
            [ AC_DEFINE([HAVE_LIBPNG], [1], [libpng]) 
              app_libpng="yes"
              app_libpng_ver=$(pkg-config --modversion 'libpng > 1.2.0')
              HAVE_LIBPNG="1"
              REQPRIVATE="$REQPRIVATE libpng" ], 
            [ app_olibs="$app_olibs libpng"
              app_odebs="$app_odebs libpng-dev"
              app_orpms="$app_orpms libpng12-devel"
              app_libpng="no"]
            )
fi
AC_SUBST(HAVE_LIBPNG)




#if test x"$app_glib" = x"yes"; then
#    PKG_CHECK_MODULES(GTHREAD, 
#                      gthread-2.0 > 2.0.0, 
#                      AC_DEFINE([HAVE_GTHREAD2], [], [gthread2]), 
#                      AC_MSG_ERROR([glib is installed but gthread not ?]))
#fi    



#
# check for libftdi
#
AC_ARG_WITH([ftdi], AS_HELP_STRING([--without-ftdi], [Build without FTDI support for usb to serial converter (default: test)]))
app_ftdi="disabled"

if test "x$with_ftdi" != "xno"; then
# check for libftdi
app_ftdi_ver=""
HAVE_LIBFTDI="0"
HAVE_LIBFTDI1="0"
PKG_CHECK_MODULES(LIBFTDI, libftdi1 >= 1.00, 
    [ AC_DEFINE([HAVE_LIBFTDI], [1], [libftdi installed])
      AC_DEFINE([HAVE_LIBFTDI1], [1], [libftdi1 installed])
      app_ftdi_ver=$($PKG_CONFIG --modversion 'libftdi1 >= 1.00')
      echo "libftdi version $app_ftdi_ver"
      app_ftdi="yes" 
      HAVE_LIBFTDI="1"
      HAVE_LIBFTDI1="1"
      REQPRIVATE="$REQPRIVATE libftdi1"
      CFLAGS="$CFLAGS $LIBFTDI_CFLAGS"
      LIBS="$LIBS $LIBFTDI_LIBS"
    ], 
    [PKG_CHECK_MODULES(LIBFTDI, libftdi >= 0.11, 
            [ AC_DEFINE([HAVE_LIBFTDI], [1], [libftdi installed])
              app_ftdi_ver=$($PKG_CONFIG --modversion 'libftdi >= 0.11')
              echo "libftdi version $app_ftdi_ver"
              app_ftdi="yes" 
              LIBS="$LIBS -lusb"
              HAVE_LIBFTDI="1"
              REQPRIVATE="$REQPRIVATE libftdi" 
              ], 
            [ app_ftdi="no" 
              app_olibs="$app_olibs libftdi1"
              app_odebs="$app_odebs libftdi-dev" 
              app_orpms="$app_orpms libftdi1-devel"])
    ])
fi
AC_SUBST(HAVE_LIBFTDI)
AC_SUBST(HAVE_LIBFTDI1)

AC_CHECK_LIB(ftdi, ftdi_new, 
            [ AC_DEFINE([HAVE_FTDI_NEW], [], [ftdi_new]) ]) 

AC_CHECK_LIB(ftdi, ftdi_usb_get_strings, [ AC_DEFINE(HAVE_FTDI_USB_GET_STRINGS, [1], [libftdi contains ftdi_usb_get_strings()])])


#
# check for libbfd
#
AC_ARG_WITH([bfd], AS_HELP_STRING([--without-bfd], [Build without libbfd support for debug symbols in backtrace (default: test)]))
app_bfd="disabled"
app_bfd_ver=""
HAVE_LIBBFD="0"
HAVE_LIBIBERTY="0"
HAVE_LIBEXECINFO="0"
if test "x$with_bfd" != "xno"; then
AC_CHECK_LIB(bfd, bfd_init,
    [ AC_DEFINE([HAVE_LIBBFD], [1], [libbfd installed])
      if test -z "$target" ; then
          AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
      fi
      AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
      #app_bfd_ver="not detected"
      app_bfd="yes"
      LIBS="$LIBS -lbfd" 
      AC_CHECK_LIB(iberty, [dyn_string_append], 
          [ LIBS="$LIBS -liberty" 
            HAVE_LIBIBERTY="1"
          ])
      HAVE_LIBBFD="1" ],
    [ app_bfd="no"
      app_olibs="$aqp_olibs libbfd"
      app_odebs="$aqp_odebs binutils-dev"  
      app_orpms="$app_orpms binutils-devel"]) 
fi
AC_SUBST([HAVE_LIBBFD])
AC_SUBST([HAVE_LIBICERTY])
                   

# in FreeBSD the backtrace is in libexecinfo
AC_CHECK_LIB([execinfo], [backtrace], 
          [ LIBS="$LIBS -lexecinfo" 
            HAVE_LIBEXECINFO="1"
          ])
AC_SUBST([HAVE_LIBEXECINFO])

AC_CHECK_FUNCS(backtrace_symbols, 
            [ AC_DEFINE([HAVE_BACKTRACE_SYMBOLS], [1], [backtrace_symbols]) ]) 


HAVE_GNUTLS="0"
app_gnutls_ver=""
PKG_CHECK_MODULES(GNUTLS,  
        gnutls >= 3.5.8, 
        [ AC_DEFINE([HAVE_GNUTLS], [1], [gnutls])
          app_gnutls="yes" 
          HAVE_GNUTLS="1"
          app_gnutls_ver=$($PKG_CONFIG --modversion 'gnutls') ], 
        [ app_olibs="$app_olibs libgnutls"
          app_odebs="$app_odebs libgnutls28-dev" 
          app_gnutls="no" ])
AC_SUBST([HAVE_GNUTLS])


#
# check for library errors
#
if test -n "$app_mlibs$app_olibs"; then
    echo ""
    echo ""
    echo "********"
    if test -n "$app_mlibs"; then
        echo "Missing mandatory libraries: $app_mlibs"
    fi
    if test -n "$app_olibs"; then
        echo "Missing optional libraries:  $app_olibs"
    fi
    if test -f "/etc/debian_version"; then
        echo "Try to run: apt-get install $app_mdebs $app_odebs"
    fi
    if test -f "/etc/SuSE-release"; then
        echo "Try to run: yast -i $app_mrpms $app_orpms"
    fi
    echo "********"
    if test -n "$app_mlibs"; then
        AC_MSG_ERROR([missing mandatory library/libraries])
    fi
    
fi

if test x"$app_ld_wlmap" = x"yes"; then
    LIBS="$LIBS -Wl,-Map,libzia.so.map"
fi    

CFLAGS="$CFLAGS $GLIB_CFLAGS $GTK_CFLAGS $SDL_CFLAGS $SDL_TTF_CFLAGS $LIBPNG_FLAGS -I../include -I../include/unix $GNUTLS_CFLAGS"
#CFLAGS="-I/usr/include $CFLAGS $GLIB_CFLAGS $GTK_CFLAGS $SDL_CFLAGS $LIBPNG_FLAGS"
LIBS="$LIBS $GLIB_LIBS $GTK_LIBS $SDL_LIBS $SDL_TTF_LIBS $LIBPNG_LIBS $LIBFTDI_LIBS $GNUTLS_LIBS "

AC_CHECK_LIB(glib-2.0, g_thread_try_new, 
            [ AC_DEFINE([HAVE_G_THREAD_TRY_NEW], [], [g_thread_try_new]) ]) 
AC_CHECK_LIB(pthread, pthread_setname_np, 
            [ AC_DEFINE([HAVE_PTHREAD_SETNAME_NP], [], [pthread_setname_np]) ])

AC_CHECK_LIB(glib-2.0, g_string_append_vprintf, 
            [ AC_DEFINE([HAVE_G_STRING_APPEND_VPRINTF], [], [g_string_append_vprintf]) ]) 
AC_CHECK_LIB(glib-2.0, g_hash_table_remove_all, 
            [ AC_DEFINE([HAVE_G_HASH_TABLE_REMOVE_ALL], [], [g_hash_table_remove_all]) ]) 



AC_C_BIGENDIAN([app_endian="big"],[app_endian="little"],[app_endian="unknown"])
AC_MSG_CHECKING([for long long])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[unsigned long long a;]])],[have_long_long=yes],[have_long_long=no])
AC_MSG_RESULT($have_long_long)
test "$have_long_long" = yes && AC_DEFINE([HAVE_LONG_LONG], [1], [long long])

AC_MSG_CHECKING([for uint32_t])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[                                                                                                        
#include <sys/types.h>                                                                                                  
#ifdef HAVE_STDINT_H                                                                                                    
#include <stdint.h>                                                                                                     
#endif                                                                                                                  
#ifdef HAVE_INTTYPES_H                                                                                                  
#include <inttypes.h>                                                                                                   
#endif                                                                                                                  
]], [[uint32_t a;]])],[have_uint32_t=yes],[have_uint32_t=no])                                                                  
AC_MSG_RESULT($have_uint32_t)                                                                                           
test "$have_uint32_t" = yes && AC_DEFINE([HAVE_UINT32_T], [], [uinf32_t])                                                                 
              
AC_MSG_CHECKING([for typeof])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int a;
typeof(a) b;]])],[have_typeof=yes],[have_typeof=no])
AC_MSG_RESULT($have_typeof)
test "$have_typeof" = yes && AC_DEFINE([HAVE_TYPEOF], [], [have operator typeof])

AC_CHECK_SIZEOF(char)                                                                                                
AC_CHECK_SIZEOF(short)                                                                                               
AC_CHECK_SIZEOF(int)                                                                                                 
AC_CHECK_SIZEOF(long)                                                                                                
test "$have_long_long" = yes && AC_CHECK_SIZEOF(long long, 8)      
AC_CHECK_SIZEOF(void *)

# --enable-pedantic
AC_ARG_ENABLE(pedantic, [  --enable-pedantic       Enable pedantic gcc checking(-Wall etc.)], enable_pedantic=yes,enable_pedantic=no )
dnl echo "pedantic=$enable_pedantic"
if test x"$enable_pedantic" = x"yes"; then
    #CFLAGS="$CFLAGS -Wall -Wpedantic"
    CFLAGS="$CFLAGS -Wall -Werror -Wpointer-arith -Wstrict-prototypes -Wunused -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wformat -Wno-format-extra-args -Wformat-security -Wdeprecated-declarations"
    #CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wstrict-prototypes -Wunused -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wformat -Wno-format-extra-args -Wformat-security"
fi



OLDCFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]], [[ int i = strerror_r(1, NULL, 1);]])],[ AC_DEFINE([Z_STRERROR_R_RETURNS_INT], [], [strerror_r returns int not char*])],[]) 
CFLAGS=$OLDCFLAGS               



CFLAGS=$(echo $CFLAGS | sed 's/ \+/ /g')
LDFLAGS=$(echo $LDFLAGS | sed 's/ \+/ /g')
LIBS=$(echo $LIBS | sed 's/ \+/ /g')

AC_SUBST([CFLAGS])
AC_SUBST([LDFLAGS])
AC_SUBST([LIBS])
AC_SUBST([REQPRIVATE])

sharedir="$prefix/share/$PACKAGE_NAME"
AC_DEFINE_UNQUOTED([SHAREDIR], ["$sharedir"], [Shared directory])
AC_CONFIG_FILES([Makefile android-old/Makefile bin/Makefile bin/zia-config data/Makefile include/Makefile include/android/Makefile include/android/zconfig.h include/msvc/Makefile include/msvc/zconfig.h include/unix/Makefile libzia.pc m4/Makefile src/Makefile])
AC_OUTPUT

echo ""
(echo "------ Libzia settings: --------";
echo "   version: $PACKAGE_NAME-$PACKAGE_VERSION"; 
echo "    prefix: $prefix"; 
#echo "  sharedir: $sharedir"; 
echo "  platform: $PLATFORM";
echo "   machine: $MACHINE";
echo "    target: $target";
echo "  compiler: $CC $app_cc_ver";      
echo "     sizes: int=$ac_cv_sizeof_int, long=$ac_cv_sizeof_long, long long=$ac_cv_sizeof_long_long, void*=$ac_cv_sizeof_void_p"
echo " endianity: $app_endian";
echo "    CFLAGS: $CFLAGS";
echo "   LDFLAGS: $LDFLAGS";
echo "      LIBS: $LIBS";
echo "      libc: $app_libc_ver"; 
echo "   libglib: $app_glib $app_glib_ver"; 
echo "    libgtk: $app_gtk $app_gtk_ver"; 
echo "    libsdl: $app_sdl $app_sdl_ver";
echo "libsdl_ttf: $app_libsdlttf $app_libsdlttf_ver";
echo "    libpng: $app_libpng $app_libpng_ver";
echo "   libftdi: $app_ftdi $app_ftdi_ver";
echo "    libbfd: $app_bfd $app_bfd_ver";
echo "    gnutls: $app_gnutls $app_gnutls_ver";
echo "  pedantic: $enable_pedantic";
echo "      opts: $opt") | tee settings 
echo ""

(echo "char *z_settings[]=";
cat settings | sed 's/\(.*\)/"\1\\n"/';
echo ";") > src/settings.c

cat config.h |grep '^#define' | sed 's/#define \(.*\)/#define Z_\1/' > include/unix/zconfig.h

chmod +x svnver.sh bin/zia-config