summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 084392e1ff946c68705e0d351c450ccfda8c334b (plain)
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
AC_PREREQ([2.71])

AC_INIT([ZUBR],[4.1.0],[Andrey V.Kosteltsev <support@radix-linux.su>],[zubr],[https://radix-linux.su])

AC_ZUBR_REQUIRE_BASH

AC_ZUBR_HEADLINE([zubr], [Parser Generator], [ZUBR_VERSION],dnl
[Copyright (c) 1999-2026 Andrey V.Kosteltsev])dnl

AC_MSG_CFG_PART(Init Automake environment)
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_AUX_DIR([.])
AM_INIT_AUTOMAKE([foreign subdir-objects dist-xz no-dist-gzip])
AC_CONFIG_HEADERS([config.h])

AC_MSG_CFG_PART(Test for GNU Compiler Colection)
AC_PROG_CC
if test $ac_cv_c_compiler_gnu != yes; then
  AC_MSG_ERROR([
********   ${TB}ZUBR should be compiled using the GNU compiler only.${TN}])
fi
AC_PROG_CPP

AC_MSG_CFG_PART(Test for Standard C Headers)
AC_CHECK_HEADERS([stdlib.h unistd.h signal.h])
if test "$ac_cv_header_stdlib_h" != yes; then
  AC_MSG_ERROR([
********   ${TB}The stdlib.h header file is required.${TN}])
fi
if test "$ac_cv_header_unistd_h" != yes; then
  AC_MSG_ERROR([
********   ${TB}The unistd.h header file is required.${TN}])
fi
if test "$ac_cv_header_signal_h" != yes; then
  AC_MSG_ERROR([
********   ${TB}The signal.h header file is required.${TN}])
fi

AC_MSG_CFG_PART(Test for Target Machine Data Types)
AC_MSG_CHECKING([for number of bits in int])
AC_COMPUTE_INT([zubr_bits_per_int], [sizeof(int) * CHAR_BIT],
               [[#include <limits.h>]],
               [AC_MSG_ERROR([cannot determine the number of bits in int])])
AC_MSG_RESULT([$zubr_bits_per_int])
AS_CASE([$zubr_bits_per_int],
        [16|32|64], [],
        [AC_MSG_ERROR([unsupported int width: $zubr_bits_per_int bits])])
ZUBR_BITS_PER_INT=$zubr_bits_per_int
AC_SUBST([ZUBR_BITS_PER_INT])

AC_MSG_CFG_PART(Test for LibMPUIO)
dnl ============================================================
dnl Check for LibMPU
dnl ============================================================
AC_CHECK_LIBMPU(
  [1.0.25],
  [yes],
  [
    AC_DEFINE(
      [HAVE_LIBMPU],
      [1],
      [Define to 1 if LibMPU is available.]
    )
  ],
  [
    AC_MSG_ERROR([LibMPU version 1.0.25 or later is required.])
  ]
)

dnl ============================================================
dnl Check for LibMPUIO
dnl ============================================================
AC_CHECK_LIBMPUIO(
  [1.0.4],
  [yes],
  [
    AC_DEFINE(
      [HAVE_LIBMPUIO],
      [1],
      [Define to 1 if LibMPUIO is available.]
    )
  ],
  [
    AC_MSG_ERROR([LibMPUIO version 1.0.4 or later is required.])
  ]
)

AC_MSG_CFG_PART(OUTPUT Substitutions)
AC_CONFIG_FILES([ Makefile
                  src/Makefile
                  src/defs.h
                  man/Makefile
                  man/ru/Makefile ])
AC_OUTPUT

if test -f "config.h"; then
  echo ""
  echo "Now you can run:"
  echo "  \`${TB}make${TN}'           to compile,"
  echo "  \`${TB}make install${TN}'   to make and install ${TB}ZUBR${TN},"
  echo "  \`${TB}make dist${TN}'      to create distributable tarballs, or"
  echo "  \`${TB}make distclean${TN}' to clean before configure for another target."
  echo "Good luck."
  echo ""
fi