-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfigure.ac.head
More file actions
396 lines (357 loc) · 10.2 KB
/
configure.ac.head
File metadata and controls
396 lines (357 loc) · 10.2 KB
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
384
385
386
387
388
389
390
391
392
393
394
395
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.51)
AC_INIT([FoxEye], 0.12.1,, foxeye, [http://foxeye.sf.net])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE
AC_CANONICAL_HOST
dnl Checks for programs.
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_MKDIR_P
AC_PROG_RANLIB
AC_PROG_LN_S
AC_PATH_PROG(BASENAME, basename)
AC_PATH_PROG(BASH, bash)
AC_PATH_PROGS(XGETTEXT, [gxgettext xgettext])
dnl Define systems for some code specifics
case "$host_os" in
linux* | kfreebsd* | gnu)
AC_DEFINE(_LINUX, 1, [Define to 1 if on Linux.])
;;
freebsd*)
AC_DEFINE(_FREEBSD, 1, [Define to 1 if on FreeBSD.])
;;
openbsd* | netbsd*)
AC_DEFINE(_OPENBSD, 1, [Define to 1 if on OpenBSD.])
;;
hpux)
AC_DEFINE(_HPUX, 1, [Define to 1 if on HP-UX.])
;;
*)
;;
esac
dnl Some non-standard compiler defaults
if test "x$CC" = x; then
case "$host_os" in
bsd*)
if test ! "${host_os}" = bsdi2; then
CC="shlicc"
fi
;;
solaris*)
CC="c99"
AC_PATH_PROG(GMAKE, gmake)
if test -z "$ac_cv_path_GMAKE"; then
AC_MSG_ERROR([gmake required for compilation of FoxEye.])
fi
MAKE="$ac_cv_path_GMAKE"
FORCE_GMAKE="MAKE = $ac_cv_path_GMAKE"
AC_SUBST(FORCE_GMAKE)
;;
*)
;;
esac
fi
if test "x$CC" != x; then
AC_MSG_RESULT(compiler is set to $CC)
fi
dnl Checks for C compiler features
: ${CFLAGS=""}
AC_PROG_CC
AC_PROG_CC_C99
AC_USE_SYSTEM_EXTENSIONS
# AC_PROG_CXX
AC_C_CONST
AC_C_VOLATILE
AC_C_INLINE
dnl Checks for system features to implement optimizations
# AC_C_BIGENDIAN
# AC_CHECK_SIZEOF(int)
ac_default_prefix="${HOME}/${PACKAGE}"
m4_pattern_allow(LIBOBJ)
if test "$ac_cv_c_inline" != no ; then
AC_DEFINE(HAVE_INLINE, 1, [Define to 1 if you have working `inline' modifier.])
AC_SUBST(HAVE_INLINE)
fi
dnl Default linker for the modules
CCLIB="\$(CC)"
dnl Prepare summary
AC_MSG_CACHE_INIT([$PACKAGE_NAME])
dnl Checks for options to CFLAGS
AC_CHECK_LDFLAG(fe_cv_add_wnotrigraphs, -Wno-trigraphs, CPPFLAGS)
AC_CHECK_LDFLAG(fe_cv_add_wnolonglong, -Wno-long-long, CPPFLAGS)
AC_CHECK_LDFLAG(fe_cv_add_wnopointersign, -Wno-pointer-sign, CPPFLAGS)
AC_CHECK_LDFLAG(fe_cv_add_wnounusedparameter, -Wno-unused-parameter, CPPFLAGS)
AC_CHECK_LDFLAG(fe_cv_add_wall, -Wall, CFLAGS)
AC_CHECK_LDFLAG(fe_cv_add_pipe, -pipe, CFLAGS)
AC_CHECK_LDFLAG(fe_cv_add_fshortenums, -fshort-enums, CPPFLAGS)
dnl Do we want debug or optimization?
AC_ARG_ENABLE(debug,
[ --enable-debug[[=info]] creates debugging code],
fe_enable_debug="$enableval", fe_enable_debug="no")
if test x"$fe_enable_debug" = xno; then
dnl enable optimization - this is default
ac_cv_add_optimization=yes
dnl Adding -S (strip debug) to linker
AC_CHECK_LDFLAG(fe_cv_add_s, [-Wl,-S], LDFLAGS)
else
dnl disable optimization and add extra warnings if it's debug compilation
if test x"$fe_enable_debug" = xinfo; then
ac_cv_add_optimization=yes
else
ac_cv_add_optimization=no
fi
AC_CHECK_LDFLAG(fe_cv_add_g, -g, CFLAGS)
AC_CHECK_LDFLAG(fe_cv_add_wextra, -Wextra, CPPFLAGS)
fi
if test $ac_cv_add_optimization = yes; then
dnl Compiler specific options
case "$CC" in
c99*)
AC_CHECK_LDFLAG(fe_cv_add_erroff, -erroff, CPPFLAGS)
AC_CHECK_LDFLAG(fe_cv_add_xipo, -xipo=2, CPPFLAGS)
AC_CHECK_LDFLAG(fe_cv_add_xrestrict, [-xrestrict=%all], CPPFLAGS)
AC_CHECK_LDFLAG(fe_cv_add_xinline, [-xinline=%auto], CPPFLAGS)
;;
*)
AC_CHECK_LDFLAG(fe_cv_add_oo, -O2, CFLAGS)
dnl GCC 3.x guess wrong about strict aliasing
fe_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([struct atest {
char *s; };], [struct atest *a;
void **v = (void **)&a;
*v = (void *)a;
], [CFLAGS="$fe_save_CFLAGS"], [CFLAGS="$fe_save_CFLAGS"
AC_CHECK_LDFLAG(fe_cv_add_fnostrictaliasing, -fno-strict-aliasing, CPPFLAGS)
])
;;
esac
fi
AC_MSG_CACHE_ADD([Debug support], [$fe_enable_debug])
dnl Need to make static code?
AC_ARG_ENABLE(static,
[ --enable-static build static code],
[ unset fe_cv_static
if test $enableval = yes; then
fe_enable_static=yes
fi], [fe_enable_static=no])
AC_CACHE_CHECK([whether you need static compiling], fe_cv_static,
[ fe_cv_static="$fe_enable_static"
if test "$fe_cv_static" = no; then
case "$host_os" in
linux* | kfreebsd* | gnu | freebsd* | openbsd* | netbsd* | darwin*)
;;
bsd*)
AC_MSG_RESULT(BSD/OS, ok)
AC_MSG_CHECKING(again for static)
if test "${host_os}" = bsdi2; then
fe_cv_static=yes
fi
;;
solaris* | sunos* | hpux)
;;
*)
# I don't know how to builf modules on other platforms
# Will try to run, maybe fall on the start...
fe_cv_static=yes
;;
esac
fi ])
ADD_LC=
MOD_LIBS=
SONAME_KEY=soname
SONAME_PREFIX=
if test "$fe_cv_static" = no; then
case "$host_os" in
linux* | kfreebsd* | gnu)
CCLIB="${CCLIB} -shared"
dnl use -fpic on 32 bit systems and -fPIC on 64 bit systems
case "$ac_cv_build" in
*64*)
AC_CHECK_LDFLAG(fe_cv_fpic, [-fPIC], CPPFLAGS)
;;
*)
AC_CHECK_LDFLAG(fe_cv_fpic, [-fpic], CPPFLAGS)
;;
esac
;;
darwin*)
CCLIB="${CCLIB} -shared"
AC_CHECK_LDFLAG(fe_cv_fpic, [-fPIC], CPPFLAGS)
dnl Homebrew installs headers and libs under /usr/local in OS X
CPPFLAGS="-I/usr/local/bin ${CPPFLAGS}"
MOD_LIBS=-L/usr/local/lib
LIBS="${MOD_LIBS} ${LIBS}"
SONAME_KEY=install_name
SONAME_PREFIX="@rpath/"
;;
freebsd*)
CCLIB="${CCLIB} -shared"
CPPFLAGS="-fpic ${CPPFLAGS}"
;;
openbsd* | netbsd*)
CCLIB="${CCLIB} -Wl,-x -Wl,-Bshareable"
CPPFLAGS="-fpic ${CPPFLAGS}"
;;
bsd*)
if test ! "${host_os}" = bsdi2; then
LD="shlicc -r"
fi
;;
solaris*)
# LD="ld -G -z text"
CCLIB="${CCLIB} -G"
CPPFLAGS="-fpic ${CPPFLAGS}"
AC_CHECK_LDFLAG(fe_cv_add_wl_e, [-Wl,-E], LDFLAGS)
case "$CC" in
gcc*)
;;
*)
dnl explicitly add libc to link shared objects
ADD_LC="-lc"
;;
esac
;;
sunos*)
dnl LD="ld"
CPPFLAGS="-fPIC ${CPPFLAGS}"
AC_CHECK_LIB(dl,main)
;;
hpux)
CCLIB="${CCLIB} -Wl,-b, -Wl,-E"
CPPFLAGS="-fPIC ${CPPFLAGS}"
;;
*)
;;
esac
fi
AC_SUBST(ADD_LC)
AC_SUBST(SONAME_KEY)
AC_SUBST(SONAME_PREFIX)
AC_SUBST(MOD_LIBS)
dnl Some substitutions for modules/Makefile.mods
case `eval "${MAKE-make} -v -f NoFile 2>/dev/null"` in
GNU*)
MAKE_IS_GNU=true
;;
*)
esac
AM_CONDITIONAL([MAKE_IS_GNU], [test x$MAKE_IS_GNU = xtrue])
dnl AM_ICONV uses strange variable ac_t in reports so reset it now
ac_t=
AC_CHECK_ICONV
AC_CHECK_IPV6
dnl Be a LFS compatible
AC_SYS_LARGEFILE
AC_MSG_CACHE_ADD([Largefile support], [${enable_largefile:-yes}])
dnl Checks for multithreaded heap managers
AC_SEARCH_LIBS(mallocctl, mtmalloc) dnl Sun's MTmalloc
AC_HAVE_LIBRARY(hoard) dnl Not sure if it works that way
dnl Check for libthr presence (it has thread-safe libc functions on FreeBSD)
AC_HAVE_LIBRARY(thr)
dnl Checks for libraries and extensions
AC_SEARCH_LIBS(socket, socket)
AC_SEARCH_LIBS(connect, nsl)
AC_SEARCH_LIBS(getaddrinfo, [dns nsl])
AC_SEARCH_LIBS(inet_ntop, nsl)
AC_SEARCH_LIBS(clock_gettime, rt)
if test "$fe_cv_static" = no; then
AC_SEARCH_LIBS(dlopen, dl,
[AC_DEFINE(HAVE_DLOPEN, 1, [Define to 1 if you have the `dlopen' function.])],
[AC_MSG_WARN([ Sorry, modules are not available now])
fe_cv_static=yes
])
fi
AC_MSG_CACHE_ADD([Static compiling], [$fe_enable_static])
dnl Checks for threads.
AC_SEARCH_LIBS(pthread_cancel, [c_r pthread], [fe_cv_have_pthreads=yes],
[AC_MSG_ERROR([you cannot compile without threads support.
Install pthreads library and then run configure again.])
])
AC_CHECK_LDFLAG(fe_cv_add_pthread, -pthread, CFLAGS)
dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_HEADERS(unistd.h dlfcn.h crypt.h getopt.h limits.h posix1_lim.h)
AC_CHECK_HEADERS(fcntl.h strings.h stdint.h sys/filio.h thread.h wctype.h)
AC_CHECK_HEADERS(sys/ioctl.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_PID_T
AC_TYPE_UID_T
# AC_CHECK_MEMBERS([struct sigaction.sa_handler],,,[#include <signal.h>])
if test "$fe_cv_static" = yes; then
EXTRA_HDR='${top_srcdir}/core/static.h'
CPPFLAGS="${CPPFLAGS} -DSTATIC"
LD_MODS="../modules/*/*.o"
dnl LD="${CC}"
AC_CHECK_LDFLAG(fe_cv_add_static, [-static], LDFLAGS)
if test $fe_cv_add_static = no; then
AC_CHECK_LDFLAG(fe_cv_add_Bstatic, [-Bstatic], LDFLAGS)
fi
else
dnl Check for -rdynamic option to LDFLAGS
AC_CHECK_LDFLAG(fe_cv_add_rdynamic, -rdynamic, LDFLAGS)
dnl Try to be more strict on dynamic objects
AC_CHECK_LDFLAG(fe_cv_add_O1, [-Wl,-O1], LDFLAGS)
AC_CHECK_LDFLAG(fe_cv_add_z_defs, [-Wl,-z,defs], LDFLAGS)
fi
AM_CONDITIONAL([STATICBUILD], [test x$fe_cv_static = xyes])
dnl Checks for library functions.
AC_CHECK_FUNCS(rename sigaction strncasecmp towlower)
AC_CACHE_CHECK([whether you need libcrypt], ac_cv_need_libcrypt,
[
ac_cv_have_crypt=yes
AC_TRY_LINK([], [crypt ("","");], [ac_cv_need_libcrypt=no],
[save_LIBS="${LIBS}"
LIBS="-lcrypt ${LIBS}"
AC_TRY_LINK([], [crypt ("","");], [ac_cv_need_libcrypt=yes],
[ac_cv_need_libcrypt=no
ac_cv_have_crypt=no
])
LIBS="${save_LIBS}"
])
])
if test "$ac_cv_have_crypt" = no; then
AC_MSG_ERROR([you have no encryption library but need it for password save.])
fi
if test "$ac_cv_need_libcrypt" = yes; then
LIBS="-lcrypt ${LIBS}"
fi
AC_REPLACE_FUNCS(strcasecmp)
AC_CHECK_FUNC(rwlock_init, [AC_DEFINE(HAVE_RWLOCK_INIT)
AC_CHECK_LDFLAG(fe_cv_add_mt, -mt, CFLAGS)],
[AC_CHECK_FUNCS(pthread_rwlock_init)
])
if test "$ac_cv_func_rwlock_init" = no -a "$ac_cv_func_pthread_rwlock_init" = no
then
AC_REPLACE_FUNCS(rwlock_init)
fi
GENDATE="`LC_TIME=C date +'%B %Y'`"
AC_SUBST(GENDATE)
AC_DEFINE_UNQUOTED(COMPILETIME, "`LC_TIME=C date`", [The compilation time string.])
AC_SUBST(CCLIB)
AC_SUBST(LD_MODS)
AC_SUBST(BASENAME)
AC_SUBST(EXTRA_HDR)
AC_SUBST(MODLIBS)
AC_SUBST(STATICLIBS)
AM_GNU_GETTEXT
AC_MSG_CACHE_ADD([Use included libintl], [$USE_INCLUDED_LIBINTL])
AC_SYS_LONG_FILE_NAMES
AC_CHECK_LIBIDN
AC_CONFIG_FILES(Makefile \
doc/Makefile \
help/Makefile \
scripts/Makefile \
tree/Makefile \
modules/Makefile \
modules/Makefile.mods \
core/Makefile \
core/init.h \
intl/Makefile \
ui/Makefile \
po/Makefile.in \
doc/foxeye.1 \
foxeye.pc)