forked from michaelrsweet/epm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
383 lines (330 loc) · 9.27 KB
/
configure.ac
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
dnl
dnl Configuration script for the ESP Package Manager (EPM).
dnl
dnl Copyright 1999-2017 by Michael R Sweet
dnl Copyright 1999-2007 by Easy Software Products, all rights reserved.
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2, or (at your option)
dnl any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
AC_INIT([EPM],[4.4.1],[https://github.com/michaelrsweet/epm/issues],[epm],[https://michaelrsweet.github.io/epm])
AC_CONFIG_HEADER(config.h)
dnl Version number...
VERSION="AC_PACKAGE_VERSION"
VERNUMBER=440
AC_SUBST(VERSION)
AC_SUBST(VERNUMBER)
AC_DEFINE_UNQUOTED(EPM_VERSION, "ESP Package Manager v$VERSION")
dnl Get the operating system...
uname=`uname`
uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
if test "$uname" = "IRIX64"; then
uname="IRIX"
fi
dnl Clear default debugging options and set normal optimization by
dnl default unless the user asks for debugging specifically.
CFLAGS="${CFLAGS:=}"
CXXFLAGS="${CXXFLAGS:=}"
LDFLAGS="${LDFLAGS:=}"
AC_SUBST(LDFLAGS)
AC_ARG_WITH(archflags, [ --with-archflags=flags specify architecture flags [[default=none]]],
ARCHFLAGS="$withval",
ARCHFLAGS="${ARCHFLAGS:=}")
AC_SUBST(ARCHFLAGS)
AC_ARG_WITH(optim, [ --with-optim=flags specify optimization flags [[default=auto]]],
OPTIM="$withval",
OPTIM="${OPTIM:=}")
AC_SUBST(OPTIM)
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [[default=no]]],
if eval "test x$enable_debug = xyes"; then
OPTIM="-g $OPTIM"
else
LDFLAGS="$LDFLAGS -s"
fi)
AC_ARG_ENABLE(gui, [ --enable-gui turn on GUI utilities [[default=auto]]])
AC_ARG_WITH(docdir, [ --with-docdir=/dir set directory for documentation
[[default=${datadir}/doc/epm]]],
docdir="$withval",
docdir="\${datadir}/doc/epm")
AC_SUBST(docdir)
AC_ARG_WITH(softwaredir, [ --with-softwaredir=/dir set directory for EPM uninstall files and init scripts
[[default=/etc/software]]],
softwaredir="$withval",
softwaredir="")
dnl Checks for programs...
AC_PROG_CC(clang cc gcc)
AC_PROG_CXX(clang++ c++ g++)
AC_PROG_RANLIB
AC_PATH_PROG(AR,ar)
AC_PATH_PROG(CHMOD,chmod)
AC_PATH_PROG(CP,cp)
AC_PATH_PROG(GZIP,gzip)
if test x$GZIP = x; then
AC_MSG_ERROR(GNU zip not found but required!)
fi
AC_PATH_PROG(HTMLDOC,htmldoc)
AC_PATH_PROG(MKDIR,mkdir)
AC_PATH_PROG(NROFF,nroff)
if test x$NROFF = x; then
AC_PATH_PROG(GROFF,groff)
if test x$GROFF = x; then
NROFF="echo"
else
NROFF="$GROFF -T ascii"
fi
fi
AC_PATH_PROG(RM,rm)
AC_PATH_PROG(RPM,rpm)
AC_PATH_PROG(RPMBUILD,rpmbuild)
AC_PATH_PROG(STRIP,strip)
dnl Architecture checks...
AC_C_CONST
AC_C_CHAR_UNSIGNED
if test "$uname" = "IRIX"; then
if test `uname -r` = 6.5; then
STRIP="$STRIP -f -s -k -l -h"
fi
fi
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
AC_CHECK_HEADER(sys/mount.h,AC_DEFINE(HAVE_SYS_MOUNT_H))
AC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H))
AC_CHECK_HEADER(sys/statfs.h,AC_DEFINE(HAVE_SYS_STATFS_H))
AC_CHECK_HEADER(sys/vfs.h,AC_DEFINE(HAVE_SYS_VFS_H))
dnl Checks for string functions.
AC_CHECK_FUNCS(strcasecmp strdup strlcat strlcpy strncasecmp)
if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
AC_MSG_WARN(Forcing snprintf emulation for HP-UX.)
else
AC_CHECK_FUNCS(snprintf vsnprintf)
fi
AC_SEARCH_LIBS(gethostname, socket)
if test "x$enable_gui" != xno; then
AC_PATH_PROG(FLTKCONFIG,fltk-config)
else
FLTKCONFIG=""
fi
if test "x$FLTKCONFIG" = x; then
GUIS=""
GUILIBS=""
INSTALL_GUIS=""
INSTALL_OSX=""
AC_MSG_WARN([Sorry, setup GUI requires FLTK 1.1.x.])
else
CXXFLAGS="`$FLTKCONFIG --cflags` ${CXXFLAGS}"
GUIS="setup uninst"
GUILIBS="`$FLTKCONFIG --use-images --ldstaticflags`"
INSTALL_GUIS="install-guis"
if test "$uname" = Darwin; then
GUILIBS="$GUILIBS -framework Security"
INSTALL_OSX="install-macos"
else
INSTALL_OSX=""
fi
fi
AC_SUBST(INSTALL_GUIS)
AC_SUBST(INSTALL_OSX)
AC_SUBST(GUIS)
AC_SUBST(GUILIBS)
dnl Set the default compression value...
case "$uname" in
Darwin* | *BSD | Linux* | SunOS*)
# macOS, *BSD, Linux, and Solaris come with gzip standard
AC_DEFINE(EPM_COMPRESS, 1)
;;
*)
# All other OS's do not.
AC_DEFINE(EPM_COMPRESS, 0)
;;
esac
dnl Update compiler options...
if test -n "$GCC"; then
# Add standard optimization options...
if test -z "$OPTIM"; then
OPTIM="-Os"
fi
# Add useful warning options...
CFLAGS="-Wall -Wformat -Wno-format-y2k -Wunused $CFLAGS"
CXXFLAGS="-Wall -Wformat -Wno-format-y2k -Wunused $CXXFLAGS"
# See if GCC supports -fno-rtti...
AC_MSG_CHECKING(if GCC supports -fno-rtti)
OLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-rtti"
AC_TRY_COMPILE(,,
CXXFLAGS="$CXXFLAGS -fno-rtti"
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
CFLAGS="$OLDCFLAGS"
# See if GCC supports -fno-exceptions...
AC_MSG_CHECKING(if GCC supports -fno-exceptions)
OLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-exceptions"
AC_TRY_COMPILE(,,
CXXFLAGS="$CXXFLAGS -fno-exceptions"
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
CFLAGS="$OLDCFLAGS"
# See if we are running HP-UX or Solaris; if so, try the
# -fpermissive option...
case $uname in
SunOS* | HP-UX*)
AC_MSG_CHECKING(if GCC supports -fpermissive)
OLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fpermissive"
AC_TRY_COMPILE(,,
CXXFLAGS="$CXXFLAGS -fpermissive"
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
CFLAGS="$OLDCFLAGS"
;;
*)
;;
esac
else
case $uname in
AIX*)
if test -z "$OPTIM"; then
OPTIM="-O2"
fi
;;
HP-UX*)
if test -z "$OPTIM"; then
OPTIM="+O2"
fi
OPTIM="$OPTIM +DAportable"
;;
IRIX*)
if test -z "$OPTIM"; then
OPTIM="-O2"
fi
if test $uversion -ge 62; then
OPTIM="$OPTIM -n32 -mips3"
OPTIM="$OPTIM -OPT:Olimit=3000"
OPTIM="-fullwarn -woff 1209,1506,1692 $OPTIM"
else
OPTIM="-fullwarn $OPTIM"
fi
;;
SunOS*)
# Solaris
if test -z "$OPTIM"; then
OPTIM="-xO4"
fi
;;
*)
# Running some other operating system...
echo "Building EPM with default compiler optimizations. Set the CFLAGS and CXXFLAGS"
echo "environment variable before running configure to override them."
;;
esac
fi
dnl Flags for "ar" command...
case $uname in
Darwin* | *BSD*)
ARFLAGS="-rc"
;;
*)
ARFLAGS="crs"
;;
esac
AC_SUBST(ARFLAGS)
#dnl Fix "prefix" variable if it hasn't been specified...
#if test "$prefix" = "NONE"; then
# prefix="/usr"
#fi
dnl Fix "exec_prefix" variable if it hasn't been specified...
if test "$exec_prefix" = "NONE"; then
exec_prefix="$prefix"
fi
dnl Fix "libdir" variable if it hasn't been specified...
if test "$libdir" = "\${exec_prefix}/lib"; then
libdir="$exec_prefix/lib"
fi
dnl Fix "datarootdir" variable if it hasn't been specified...
if test "$datarootdir" = "\${prefix}/share"; then
if test "$prefix" = "/"; then
datarootdir="/usr/share"
else
datarootdir="$prefix/share"
fi
fi
dnl Fix "datadir" variable if it hasn't been specified...
if test "$datadir" = "\${prefix}/share"; then
if test "$prefix" = "/"; then
datadir="/usr/share"
else
datadir="$prefix/share"
fi
elif test "$datadir" = "\${datarootdir}"; then
datadir="$datarootdir"
fi
dnl Fix "mandir" variable if it hasn't been specified...
if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then
case "$uname" in
*BSD* | Darwin* | Linux*)
# BSD, Darwin (macOS), and Linux
mandir="/usr/share/man"
;;
IRIX*)
# SGI IRIX
mandir="/usr/share/catman/u_man"
;;
*)
# All others
mandir="/usr/man"
;;
esac
fi
dnl EPM_SOFTWARE needs special attention for the default location...
if test x$softwaredir = x; then
EPM_SOFTWARE="/etc/software"
else
EPM_SOFTWARE="$softwaredir"
fi
AC_DEFINE_UNQUOTED(EPM_SOFTWARE, "$EPM_SOFTWARE")
AC_SUBST(EPM_SOFTWARE)
AC_DEFINE_UNQUOTED(EPM_GZIP, "$GZIP")
AC_SUBST(EPM_GZIP)
AC_DEFINE_UNQUOTED(EPM_STRIP, "$STRIP")
AC_SUBST(EPM_STRIP)
AC_DEFINE_UNQUOTED(EPM_BINDIR, "$exec_prefix/bin")
AC_SUBST(EPM_BINDIR)
AC_DEFINE_UNQUOTED(EPM_LIBDIR, "$libdir/epm")
AC_SUBST(EPM_LIBDIR)
AC_DEFINE_UNQUOTED(EPM_DATADIR, "$datadir/epm")
AC_SUBST(EPM_DATADIR)
dnl Figure out the right option to use for the RPM build architecture...
if test "x$RPM" != x; then
# It would be nice if Red Hat could make up its mind...
rpmversion="`$RPM --version | awk '{print $3}' | awk -F. '{print $1 * 10000 + $2 * 100 + $3}'`"
if test $rpmversion -lt 30000; then
AC_DEFINE_UNQUOTED(EPM_RPMARCH, "--buildarch ")
else
if test $rpmversion -ge 40003; then
AC_DEFINE_UNQUOTED(EPM_RPMARCH, "--target ")
else
AC_DEFINE_UNQUOTED(EPM_RPMARCH, "--target=")
fi
fi
fi
if test "x$RPMBUILD" != x; then
AC_DEFINE_UNQUOTED(EPM_RPMBUILD, "$RPMBUILD")
AC_DEFINE(EPM_RPMTOPDIR)
else
if test "x$RPM" != x; then
AC_DEFINE_UNQUOTED(EPM_RPMBUILD, "$RPM")
else
AC_DEFINE_UNQUOTED(EPM_RPMBUILD, "rpm")
fi
fi
dnl Output the makefile, list file, and config header...
AC_OUTPUT(Makefile epm.list doc/Makefile)