]> git.draconx.ca Git - rrace.git/blob - configure.ac
Add timer display.
[rrace.git] / configure.ac
1 dnl Copyright © 2022 Nick Bowler
2 dnl
3 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 dnl This is free software: you are free to do what the fuck you want to.
5 dnl There is NO WARRANTY, to the extent permitted by law.
6
7 dnl remove pointless gnulib warning flag check
8 AC_DEFUN([gl_CC_GNULIB_WARNINGS])
9
10 AC_INIT([rrace], [0], [nbowler@draconx.ca])
11 AC_CONFIG_HEADERS([config.h])
12
13 AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign subdir-objects])
14 AM_SILENT_RULES([yes])
15 DX_AUTOMAKE_COMPAT
16
17 AC_PROG_CC_C99
18 gl_EARLY
19 LT_INIT
20 gl_INIT
21
22 AC_CACHE_SAVE
23 m4_include([lib/gnulib.mk])
24
25 AC_PATH_XTRA
26 AS_IF([test x"$no_x" != x"yes"],
27 [AC_CACHE_CHECK([for Motif], [dx_cv_have_motif],
28 [save_CFLAGS=$CFLAGS save_LIBS=$LIBS
29 dx_cv_motif_cflags="$X_CFLAGS"
30 dx_cv_motif_libs="$X_LIBS $X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS"
31 CFLAGS="$dx_cv_motif_cflags $CFLAGS"
32 LIBS="$dx_cv_motif_libs $LIBS"
33 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <Xm/XmAll.h>],
34   [XmCreateMainWindow(0, 0, 0, 0); XtAppSetExitFlag(0)])],
35   [dx_cv_have_motif=yes], [dx_cv_have_motif=no])
36 CFLAGS=$save_CFLAGS LIBS=$save_LIBS])])
37
38 AS_IF([test x"$with_x" = x"yes" && test "$dx_cv_have_motif" != x"yes"],
39   [AC_MSG_FAILURE([--with-x requested but Motif was not found])])
40
41 AC_SUBST([MOTIF_CFLAGS], [@&t@])
42 AC_SUBST([MOTIF_LIBS], [@&t@])
43 AS_IF([test x"$dx_cv_have_motif" = x"yes"],
44   [MOTIF_CFLAGS=$dx_cv_motif_cflags MOTIF_LIBS=$dx_cv_motif_libs],
45   [AC_DEFINE([X_DISPLAY_MISSING])])
46 AM_CONDITIONAL([HAVE_MOTIF], [test x"$dx_cv_have_motif" = x"yes"])
47 AH_TEMPLATE([X11_RENDER_DEBUG],
48   [Define to 1 to enable visual aids for debugging X11 rendering.])
49
50 AC_CONFIG_TESTDIR([.], [t:.])
51 DX_PROG_AUTOTEST
52 AM_CONDITIONAL([HAVE_AUTOTEST], [test x"$dx_cv_autotest_works" = x"yes"])
53
54 AC_CHECK_PROGS([XPMTOPPM], [xpmtoppm])
55 AC_CHECK_PROGS([PNMTOPNG], [pnmtopng])
56 AC_CHECK_PROGS([CONVERT], [convert])
57 AC_CHECK_PROGS([GM], [gm])
58 AC_CACHE_CHECK([how to convert XPM to PNG], [dx_cv_xpm_to_png],
59 [cat >conftest.xpm <<'EOF'
60 /* XPM */
61 static char *x[] = {
62 "1 1 1 1",
63 "x c #123456",
64 "x"
65 };
66 EOF
67 check_conftest_png () {
68   od conftest.png | $AWK 'BEGIN { success=0; }
69 NR == 1 && $2 == "050211" && $3 == "043516" { success=1; }
70 NR == 1 && $2 == "104520" && $3 == "047107" { success=1; }
71 END { exit(!success); }'
72 }
73 rm -f conftest.png
74 for dx_cv_xpm_to_png in netpbm 'gm convert' convert unknown; do
75 AS_CASE([$dx_cv_xpm_to_png],
76
77 [netpbm],
78 [AS_IF([$XPMTOPPM conftest.xpm >conftest.ppm 2>&AS_MESSAGE_LOG_FD],
79   [], [continue])
80 AS_IF([$PNMTOPNG conftest.ppm >conftest.png 2>&AS_MESSAGE_LOG_FD],
81   [], [continue])
82 AS_IF([check_conftest_png], [break])],
83
84 [*convert],
85 [AS_CASE([$dx_cv_xpm_to_png],
86   [gm*], [test_convert="$GM convert"],
87   [test_convert="$CONVERT"])
88 AS_IF([$test_convert conftest.xpm conftest.png >&AS_MESSAGE_LOG_FD 2>&1],
89   [], [continue])
90 AS_IF([check_conftest_png], [break])])
91 done
92 rm -f conftest.xpm conftest.ppm conftest.png])
93
94 AM_CONDITIONAL([USE_NETPBM], [test x"$dx_cv_xpm_to_png" = x"netpbm"])
95 AM_CONDITIONAL([USE_CONVERT],
96   [AS_CASE([$dx_cv_xpm_to_png], [*convert], [], [false])])
97
98 AS_IF([test x"$dx_cv_xpm_to_png" = x"gm convert"],
99   [CONVERT="$GM convert"])
100
101 AC_CHECK_PROGS([OPTIPNG], [optipng])
102 : "${OPTIPNG:=:}"
103
104 AC_CONFIG_FILES([Makefile])
105 AC_OUTPUT