chiark / gitweb /
Fix completion checking in Killer Solo.
[sgt-puzzles.git] / configure.ac
1 dnl Configure script for the Unix GTK build of puzzles.
2
3 AC_INIT([puzzles], [6.66], [anakin@pobox.com])
4 AC_CONFIG_SRCDIR([midend.c])
5 AM_INIT_AUTOMAKE([foreign])
6 AC_PROG_CC
7
8 AC_ARG_WITH([gtk],
9   [AS_HELP_STRING([--with-gtk=VER],
10                   [specify GTK version to use (`2' or `3')])],
11   [gtk_version_desired="$withval"],
12   [gtk_version_desired="any"])
13
14 case "$gtk_version_desired" in
15   2 | 3 | any) ;;
16   yes) gtk_version_desired="any" ;;
17   *) AC_ERROR([Invalid GTK version specified])
18 esac
19
20 gtk=none
21
22 case "$gtk_version_desired:$gtk" in
23   3:none | any:none)
24     ifdef([AM_PATH_GTK_3_0],[
25     AM_PATH_GTK_3_0([3.0.0], [gtk=3], [])
26     ],[AC_WARNING([generating configure script without GTK 3 autodetection])])
27     ;;
28 esac
29
30 case "$gtk_version_desired:$gtk" in
31   2:none | any:none)
32     ifdef([AM_PATH_GTK_2_0],[
33     AM_PATH_GTK_2_0([2.0.0], [gtk=2], [])
34     ],[AC_WARNING([generating configure script without GTK 2 autodetection])])
35     ;;
36 esac
37
38 if test "$gtk" = "none"; then
39    AC_MSG_ERROR([cannot build without GTK 2 or GTK 3])
40 fi
41
42 if test "x$GCC" = "xyes"; then
43   AC_MSG_CHECKING([for usable gcc warning flags])
44   gccwarningflags=
45   for flag in -Wall -Werror -std=c89 -pedantic; do
46     ac_save_CFLAGS="$CFLAGS"
47     ac_save_LIBS="$LIBS"
48     CFLAGS="$CFLAGS$gccwarningflags $flag $GTK_CFLAGS"
49     LIBS="$GTK_LIBS $LIBS"
50     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
51         #include <stdio.h>
52         #include <assert.h>
53         #include <stdlib.h>
54         #include <time.h>
55         #include <stdarg.h>
56         #include <string.h>
57         #include <errno.h>
58         #include <math.h>
59
60         #include <sys/time.h>
61         #include <sys/resource.h>
62
63         #include <gtk/gtk.h>
64         #include <gdk/gdkkeysyms.h>
65
66         #include <gdk-pixbuf/gdk-pixbuf.h>
67
68         #include <gdk/gdkx.h>
69         #include <X11/Xlib.h>
70         #include <X11/Xutil.h>
71         #include <X11/Xatom.h>
72     ],[
73         return 0;
74     ])], [gccwarningflags="$gccwarningflags $flag"], [])
75     CFLAGS="$ac_save_CFLAGS"
76     LIBS="$ac_save_LIBS"
77   done
78   AC_MSG_RESULT($gccwarningflags)
79   CFLAGS="$CFLAGS$gccwarningflags"
80 fi
81
82 AC_PROG_RANLIB
83 AC_PROG_INSTALL
84 AC_CONFIG_FILES([Makefile])
85 AC_OUTPUT