summaryrefslogtreecommitdiff
path: root/configure.ac
blob: d76de141faf476444a39671ad85ce502260b63af (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
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
# ============================================================
#  Process this file with autoconf to produce
#  a configure script.
# ============================================================

AC_PREREQ(2.71)           # Minimum Autoconf version required.


AC_INIT([pkgtools], [0.2.2],
  [support@radix.pro], [pkgtools], [https://radix.pro])

# ============================================================
# m4's diversions:
# ---------------
#
# see: /use/share/autoconf/autoconf/general.m4
# ============================================================
m4_divert_push([M4SH-INIT])
DISTRO_NAME=radix
DISTRO_CAPTION=Radix
DISTRO_VERSION=1.1
DISTRO_LICENSE=Radix-1.0
m4_divert_pop([M4SH-INIT])

AC_PKGTOOLS_HEADLINE([pkgtools],
  [Package Tools], [Copyright (c) 2009-2023 Andrey V.Kosteltsev])


# ============================================================
# ============================================================
# ============================================================
# ============================================================
# ============================================================
# $$                                                        $$
# $$ PART: Init Automake environment                        $$
# $$                                                        $$
# ============================================================
# ============================================================
# ============================================================
# ============================================================
# ============================================================
AC_MSG_CFG_PART(Init Automake environment)

AC_CANONICAL_TARGET

AM_INIT_AUTOMAKE([subdir-objects foreign no-dist-gzip dist-xz])

AC_CONFIG_HEADERS([config.h])

AC_PREFIX_DEFAULT(/usr/local)


# ============================================================
# ============================================================
# ============================================================
# ============================================================
# ============================================================
# $$                                                        $$
# $$ PART: Test for Build Tools                             $$
# $$                                                        $$
# ============================================================
# ============================================================
# ============================================================
# ============================================================
# ============================================================
AC_MSG_CFG_PART(Test for build tools)
AC_CHECK_TOOL([GCC], [gcc], [:])


# ============================================================
# ============================================================
# ============================================================
# ============================================================
# ============================================================
# $$                                                        $$
# $$ PART: Test for Libraries                               $$
# $$                                                        $$
# ============================================================
# ============================================================
# ============================================================
# ============================================================
# ============================================================
AC_MSG_CFG_PART(Test for libraries)
AC_CHECK_DIALOG([1.3.20210621],yes,yes,yes,CFLAGS="$CFLAGS -DHAVE_DIALOG")
AM_CONDITIONAL([USE_DIALOG], [test "x$HAVE_DIALOG" = "x1"])


# ============================================================
# ============================================================
# ============================================================
# ============================================================
# ============================================================
# $$                                                        $$
# $$ PART: Test for Runtime Tools                           $$
# $$                                                        $$
# ============================================================
# ============================================================
# ============================================================
# ============================================================
# ============================================================
AC_MSG_CFG_PART(Test for runtime tools)

# ============================================================
# Check for GPG2 utility:
# ----------------------
# Usage:
#   not defined --with-gpg2            - Disable OpenPGP support by default
#   --with-gpg2=no                     - Disable OpenPGP support by --with-gpg2=no option
#   --with-gpg2, --with-gpg2=yes       - Check whether the gpg2 program exists in path on the build machine
#   --with-gpg2=${TARGET_DEST_DIR}/usr - Check whether the gpg2 program already installed on the target rootfs
# ============================================================
AC_ARG_WITH([gpg2], [AS_HELP_STRING([--with-gpg2],
  [support OpenPGP signatures (default=no)])],
  [GPG2=
   AS_IF([test "x$with_gpg2" != "xno"],
     [AS_IF([test "x$with_gpg2" != "xyes"],
       [AC_PATH_PROG([GPG2], [gpg2], [no], [${with_gpg2}/bin])],
       [AC_PATH_PROG([GPG2], [gpg2], [no], [/usr/local/bin:/usr/bin:/bin:$PATH])])
     ],
     [AC_MSG_CHECKING(for gpg2)
      AC_MSG_RESULT([OpenPGP disabled by the --with-gpg2=no option])
      AC_SUBST(GPG2, [no])
     ])
   if test "x$GPG2" != "xno" ; then
     AC_DEFINE([HAVE_GPG2], [1], [Define if you have OpenPGP program])
   else
     if test "x$with_gpg2" != "xno" ; then
       AC_MSG_FAILURE([--with-gpg2 was given, but test for gpg2 program failed], [1])
     fi
   fi
  ],
  [AC_MSG_CHECKING(for gpg2)
   AC_MSG_RESULT([OpenPGP disabled by default])
   AC_SUBST(GPG2, [no])
  ])

# ============================================================
# m4's diversions:
# ---------------
#
# see: /use/share/autoconf/autoconf/general.m4
# ============================================================
m4_divert_push([HELP_WITH])
_ACEOF

  cat <<_ACEOF

Distribution Features:
m4_divert_pop([HELP_WITH])

AC_ARG_WITH([distro-name], [AS_HELP_STRING([--with-distro-name@<:@=NAME@:>@],
  [Distribution Name @<:@default=${DISTRO_NAME}@:>@. Please note that the distribution NAME should not contain spaces],[30],[74])],
  [AS_IF([test "x$with_distro_name" != "x"],
     [DISTRO_NAME=${with_distro_name}
      DISTRO_CAPTION=`echo ${with_distro_name:0:1} | tr '[a-z]' '[A-Z]'`${with_distro_name:1}
      AC_DEFINE_UNQUOTED([DISTRO_NAME], ["$with_distro_name"], [Define the distribution name])
      AC_DEFINE_UNQUOTED([DISTRO_CAPTION], "$DISTRO_CAPTION", [Define the caption of the distribution])
     ],
     [AC_DEFINE_UNQUOTED([DISTRO_NAME], ["$DISTRO_NAME"], [Define the distribution name])
      AC_DEFINE_UNQUOTED([DISTRO_CAPTION], ["$DISTRO_CAPTION"], [Define the caption of the distribution])
     ])
  ],
  [AC_DEFINE_UNQUOTED([DISTRO_NAME], ["$DISTRO_NAME"], [Define the distribution name])
   AC_DEFINE_UNQUOTED([DISTRO_CAPTION], ["$DISTRO_CAPTION"], [Define the caption of the distribution])
  ])

AC_ARG_WITH([distro-version], [AS_HELP_STRING([--with-distro-version@<:@=VERSION@:>@],
  [Distribution Version @<:@default=${DISTRO_VERSION}@:>@],[30],[79])],
  [AS_IF([test "x$with_distro_version" != "x"],
     [AC_DEFINE_UNQUOTED([DISTRO_VERSION], ["$with_distro_version"], [Define the version of distribution])
     ],
     [AC_DEFINE_UNQUOTED([DISTRO_VERSION], ["$DISTRO_VERSION"], [Define the version of distribution])
     ])
  ],
  [AC_DEFINE_UNQUOTED([DISTRO_VERSION], ["$DISTRO_VERSION"], [Define the version of distribution])
  ])

m4_divert_push([HELP_WITH])
_ACEOF

  cat <<\_ACEOF
m4_divert_pop([HELP_WITH])

AC_SUBST(DISTRO_NAME)
AC_SUBST(DISTRO_CAPTION)
AC_SUBST(DISTRO_VERSION)
AC_SUBST(DISTRO_URL,[${PACKAGE_URL}])
AC_SUBST(DISTRO_LICENSE,[${DISTRO_LICENSE}])
AC_SUBST(PROGRAM_VERSION,[${PACKAGE_VERSION}])

AC_DEFINE_UNQUOTED([DISTRO_URL], ["$DISTRO_URL"], [Define the bug report URL])
AC_DEFINE_UNQUOTED([DISTRO_LICENSE], ["$DISTRO_LICENSE"], [Define the bug report URL])
AC_DEFINE_UNQUOTED([PROGRAM_VERSION], ["$PROGRAM_VERSION"], [Define the version of all programs in this package])


# ============================================================
# Environment Variables:
# ---------------------
#  For 'Some influential environment variables:' help section
# ============================================================
AC_ARG_VAR([STRIP], [strip command])


# ============================================================
# ============================================================
# ============================================================
# ============================================================
# ============================================================
# $$                                                        $$
# $$ PART: Test for Auxiliary (my be version sensitive)     $$
# $$       programs                                         $$
# $$                                                        $$
# ============================================================
# ============================================================
# ============================================================
# ============================================================
# ============================================================
AC_MSG_CFG_PART(Test for aux programs)
AC_PATH_PROG_LN_S
AC_PATH_PROG([TAR],       [tar],       [no], [/usr/local/bin:/usr/bin:/bin:$PATH])
AC_PATH_PROG([SED],       [sed],       [no], [/usr/local/bin:/usr/bin:/bin:$PATH])
AC_PATH_PROG([FIND],      [find],      [no], [/usr/local/bin:/usr/bin:/bin:$PATH])
AC_PATH_PROG([CAT],       [cat],       [no], [/usr/local/bin:/usr/bin:/bin:$PATH])
AC_PATH_PROG([CP],        [cp],        [no], [/usr/local/bin:/usr/bin:/bin:$PATH])
AC_PATH_PROG([MV],        [mv],        [no], [/usr/local/bin:/usr/bin:/bin:$PATH])
AC_PATH_PROG([RM],        [rm],        [no], [/usr/local/bin:/usr/bin:/bin:$PATH])
AC_PATH_PROG([CHMOD],     [chmod],     [no], [/usr/local/bin:/usr/bin:/bin:$PATH])
AC_PATH_PROG([SHA256SUM], [sha256sum], [no], [/usr/local/bin:/usr/bin:/bin:$PATH])


# ============================================================
# ============================================================
# ============================================================
# ============================================================
# ============================================================
# $$                                                        $$
# $$ PART: OUTPUT Substitution                              $$
# $$                                                        $$
# ============================================================
# ============================================================
# ============================================================
# ============================================================
# ============================================================
AC_MSG_CFG_PART(OUTPUT)

AC_CONFIG_FILES([
src/Makefile
Makefile
])
AC_OUTPUT