File: acinclude.m4

package info (click to toggle)
siag 3.5.1-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 8,076 kB
  • ctags: 8,908
  • sloc: ansic: 67,975; lisp: 5,435; sh: 3,342; cs: 679; makefile: 550; perl: 404
file content (333 lines) | stat: -rw-r--r-- 8,383 bytes parent folder | download
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

AC_DEFUN(AC_CHECK_SIAG,
[
dnl We want to use gmatch where fnmatch is not available
AC_CHECK_FUNC(fnmatch, AC_DEFINE(HAVE_FNMATCH),
	[AC_CHECK_LIB(gen, gmatch)
	AC_CHECK_FUNC(gmatch, AC_DEFINE(HAVE_GMATCH))])

dnl Somehow we must be able to set NDBM even if no libdb exists (Solaris)
dnl Try named lib first, then libdb, then libgdbm, then libndbm
define(siag_CHECK_NDBM,
[AC_CHECK_LIB($MAYBE_LIBNDBM, dbm_open, LIBDB=-l$MAYBE_LIBNDBM,
	AC_CHECK_LIB(db, dbm_open, LIBDB="-ldb",
		AC_CHECK_LIB(gdbm, dbm_open, LIBDB="-lgdbm",
			AC_CHECK_LIB(ndbm, dbm_open, LIBDB="-lndbm"))))
if test "$LIBDB" != ""; then
	echo "Found ndbm in $LIBDB"
	LIBS="$LIBDB $LIBS"
fi
AC_CHECK_FUNC(dbm_dirfno, AC_DEFINE(HAVE_DBM_DIRFNO))
AC_CHECK_FUNC(dbm_pagfno, AC_DEFINE(HAVE_DBM_PAGFNO))
AC_CHECK_FUNC(dbm_rdonly, AC_DEFINE(HAVE_DBM_RDONLY))
AC_CHECK_FUNC(dbm_open, NDBM="-DNDBM")
])

AC_ARG_WITH(ndbm,
	[  --with-ndbm[=libname]     enable (named) ndbm library [default: gdbm]],
	[ case $withval in
	yes)
		MAYBE_LIBNDBM="gdbm"
		;;
	no)
		;;
	*)
		MAYBE_LIBNDBM=$withval
		;;
	esac
	
	if test "$withval" != "no"; then
		siag_CHECK_NDBM
	fi ],
dnl	[ MAYBE_LIBNDBM="gdbm"
dnl	siag_CHECK_NDBM ])
)

AC_SUBST(NDBM)

AC_CHECK_LIB(m, main)

dnl Check what math functions we have
AC_CHECK_FUNC(acosh, AC_DEFINE(HAVE_ACOSH))
AC_CHECK_FUNC(asinh, AC_DEFINE(HAVE_ASINH))
AC_CHECK_FUNC(log1p, AC_DEFINE(HAVE_LOG1P))
AC_CHECK_FUNC(expm1, AC_DEFINE(HAVE_EXPM1))
AC_CHECK_FUNC(cbrt, AC_DEFINE(HAVE_CBRT))
AC_CHECK_FUNC(drem, AC_DEFINE(HAVE_DREM))
AC_CHECK_FUNC(atanh, AC_DEFINE(HAVE_ATANH))

AC_CHECK_LIB(crypt, main, [LIBSYSDEP="-lcrypt"])
if test "$LIBSYSDEP" = ""; then
	AC_CHECK_LIB(posix4, main, [LIBSYSDEP="-lposix4"])
	if test "$LIBSYSDEP" = ""; then
		LIBSYSDEP=""
	fi
fi
AC_SUBST(LIBSYSDEP)

dnl These are necessary for SIOD on Solaris and probably Irix.
AC_CHECK_LIB(nsl, main)
AC_CHECK_LIB(socket, connect)

dnl SIOD
AC_CHECK_HEADERS(sys/mode.h fnmatch.h crypt.h sys/mkdev.h fcntl.h)

AC_CHECK_FUNCS(setpwfile getrlimit getrusage fnmatch \
		usleep lchown strptime putpwent getwd)

dnl Guile, Python, Ruby and Tcl

dnl Empty libdl in case we are making static binaries
dnl LIBDL=""
INTERPRETERS=""

AC_ARG_WITH(guile,
	[  --with-guile            enable guile commands and expressions],
	[ case $withval in
	yes)
		MAYBE_LIBGUILE="guile"
		;;
	no)
		;;
	*)
		MAYBE_LIBGUILE=$withval
		;;
	esac
	if test "$withval" != "no"; then
		AC_CHECK_LIB($MAYBE_LIBGUILE, gh_enter,
			[INTERPRETERS="-l$MAYBE_LIBGUILE `guile-config link` $INTERPRETERS"
			AC_DEFINE(HAVE_LIBGUILE)],
			[echo "$MAYBE_LIBGUILE not found"
			echo "You need to visit http://www.guile.org/"
			exit 1],
			`guile-config link`)
	fi ],
)

AC_ARG_WITH(python,
	[  --with-python           enable python commands and expressions],
	[ case $withval in
	yes)
		MAYBE_LIBPYTHON="python2.2"
		;;
	no)
		;;
	*)
		MAYBE_LIBPYTHON=$withval
		;;
	esac
	if test "$withval" != "no"; then
		AC_CHECK_LIB(dl, main, INTERPRETERS="-ldl $INTERPRETERS", $INTERPRETERS)
		AC_CHECK_LIB(pthread, main, INTERPRETERS="-lpthread $INTERPRETERS", $INTERPRETERS)
		AC_CHECK_LIB(util, main, INTERPRETERS="-lutil $INTERPRETERS", $INTERPRETERS)
		AC_CHECK_LIB($MAYBE_LIBPYTHON, PyFloat_AsDouble,
			[INTERPRETERS="-l$MAYBE_LIBPYTHON $INTERPRETERS"
			AC_DEFINE(HAVE_LIBPYTHON)],
			[echo "$MAYBE_LIBPYTHON not found"
			exit 1],
			$INTERPRETERS)
	fi ])

AC_ARG_WITH(ruby,
	[  --with-ruby             enable ruby commands and expressions],
	[ case $withval in
	yes)
		MAYBE_LIBRUBY="ruby"
		;;
	no)
		;;
	*)
		MAYBE_LIBRUBY=$withval
		;;
	esac
	if test "$withval" != "no"; then
		AC_CHECK_LIB(m, main, INTERPRETERS="-lm $INTERPRETERS", $INTERPRETERS)
		AC_CHECK_LIB(crypt, main, INTERPRETERS="-lcrypt $INTERPRETERS", $INTERPRETERS)
		AC_CHECK_LIB(dl, main, INTERPRETERS="-ldl $INTERPRETERS", $INTERPRETERS)
		AC_CHECK_LIB($MAYBE_LIBRUBY, ruby_init,
			[INTERPRETERS="-l$MAYBE_LIBRUBY $INTERPRETERS"
			AC_DEFINE(HAVE_LIBRUBY)],
			[echo Ruby not found
			exit 1],
			$INTERPRETERS)
	fi ])

AC_ARG_WITH(tcl,
	[  --with-tcl[=libname]      enable (named) tcl library [default: tcl]],
	[ case $withval in 
	yes)
		MAYBE_LIBTCL="tcl"
		;;
	no)
		;;
	*)
		MAYBE_LIBTCL=$withval
		;;
	esac

	if test "$withval" != "no"; then
		AC_CHECK_LIB(dl, main, INTERPRETERS="-ldl $INTERPRETERS", $INTERPRETERS)
		AC_CHECK_LIB(m, main, INTERPRETERS="-lm $INTERPRETERS", $INTERPRETERS)
		AC_CHECK_LIB($MAYBE_LIBTCL, Tcl_Main,
			[INTERPRETERS="-l$MAYBE_LIBTCL $INTERPRETERS"
			AC_DEFINE(HAVE_LIBTCL)],
			[echo "$MAYBE_LIBTCL not found"
			exit 1],
			$INTERPRETERS)
	fi ],
)

AC_SUBST(INTERPRETERS)

AC_SUBST(MY_X_LIBS)
LDFLAGS=$ac_save_LDFLAGS
AC_ARG_WITH(stocks,
	[  --with-stocks           enable libstocks (stock quotes over the Internet)],
	[ if test "$withval" != "no"; then
		AC_CHECK_LIB(stocks, main)
	fi ])

AC_ARG_WITH(gmp,
	[  --with-gmp              enable Gnu arbitrary precision arithmetic],
	[ if test "$withval" != "no"; then
		AC_CHECK_LIB(gmp, main)
	fi ])

AC_ARG_WITH(sdb,
	[  --with-sdb              enable database queries through LibSDB],
	[ if test "$withval" != "no"; then
		CFLAGS="$CFLAGS `sdb-config --cflags`"
		SDBLIBS="`sdb-config --libs`"
		AC_CHECK_LIB(sdb, sdb_init, LDFLAGS="$LDFLAGS $SDBLIBS", exit, $SDBLIBS)
		AC_DEFINE(HAVE_LIBSDB)
	fi ])

dnl ccmath defines variables in ccmath.h, which causes AC_CHECK_LIB to fail
dnl so we roll our own
define(siag_CHECK_CCMATH,
[ac_save_LIBS=$LIBS
LIBS="-lccm $LIBS"
AC_TRY_LINK([#include <ccmath.h>], [main();], LIBCCMATH=-lccm, )
LIBS=$ac_save_LIBS
if test "$LIBCCMATH" != ""; then
	echo "Found ccmath in $LIBCCMATH"
	CCMATH=-DCCMATH
fi ])

AC_ARG_WITH(ccmath,
	[  --with-ccmath           enable the CCMATH mathematics library],
	[ if test "$withval" != "no"; then
		siag_CHECK_CCMATH
	fi ])
AC_SUBST(CCMATH)
AC_SUBST(LIBCCMATH)

dnl No Perl
LIBPERL=""
AC_SUBST(LIBPERL)
AC_SUBST(PERL)
AC_SUBST(PERLINC)

dnl X-specific checks
ac_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $X_LIBS"
AC_CHECK_LIB(Xext, main,
[MY_X_LIBS="-lXext"
AC_DEFINE(HAVE_LIBXEXT)], ,
$X_PRE_LIBS $X_EXTRA_LIBS $X_EXTRA_LIBS -lXt -lX11)

AC_CHECK_LIB(Xmu, main,
[MY_X_LIBS="-lXmu $MY_X_LIBS"], ,
$MY_X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS $X_EXTRA_LIBS -lXt -lX11)
AC_CHECK_LIB(X11, XCreateIC, AC_DEFINE(HAVE_XCREATEIC), , $x_libs)

AC_CHECK_LIB(Xpm, main,
[MY_X_LIBS="-lXpm $MY_X_LIBS"
AC_DEFINE(HAVE_LIBXPM)],
[echo "Xpm library not found"
exit 1],
$MY_X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS $X_EXTRA_LIBS -lXt -lX11)

AC_CHECK_LIB(Mowitz, main,
[MY_X_LIBS="-lMowitz $MY_X_LIBS"
AC_DEFINE(HAVE_LIBMOWITZ)],
[echo "Mowitz library not found"
echo "You need to visit http://siag.nu/mowitz/"
exit 1],
-lXaw $MY_X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS $X_EXTRA_LIBS -lXt -lX11)

AC_SUBST(MY_X_LIBS)
LDFLAGS=$ac_save_LDFLAGS

if test "$GCC" = "yes"; then
	CFLAGS="-Wall $CFLAGS"
fi

AC_ARG_ENABLE(debugging,
	[  --enable-debugging      enable debugging],
	[ if test "$withval" != "no"; then
		CFLAGS="$CFLAGS -g"
	fi ])

AC_ARG_ENABLE(profiling,
	[  --enable-profiling      enable profiling],
	[ if test "$withval" != "no"; then
		CFLAGS="$CFLAGS -pg"
	fi ])

AC_ARG_WITH(xawm,
	[  --with-xawm             choose XawM compatible library (default XawM)],
	[ case $withval in
	yes | no )
		XAWLIB=-lXawM
		XAWHDRS=X11/XawM
		;;
	* )
		XAWLIB=-l$withval
		XAWHDRS=X11/$withval
		;;
	esac ]
)

if test "$XAWLIB" = ""; then
	XAWLIB="-lXawM"
fi
AC_SUBST(XAWLIB)
if test "$XAWHDRS" = ""; then
	XAWHDRS=X11/XawM
fi
AC_SUBST(XAWHDRS)

AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF))

dnl What curses lib is available? Try in this order:
dnl 0. use termcap if available
dnl 1. ncurses
dnl 2. curses
ac_save_LDFLAGS="$LDFLAGS"
AC_CHECK_LIB(termcap, main, LIBTERMCAP="-ltermcap")
AC_CHECK_LIB(ncurses, wgetch, LIBCURSES="-lncurses $LIBTERMCAP",
	AC_CHECK_LIB(curses, wgetch, LIBCURSES="-lcurses $LIBTERMCAP", , $LIBTERMCAP),
	$LIBTERMCAP)
LDFLAGS="$LDFLAGS $LIBCURSES"
AC_CHECK_FUNCS(resizeterm beep immedok keypad)
AC_SUBST(LIBCURSES)
LDFLAGS=$ac_save_LDFLAGS

dnl Look for T1lib including its X part
AC_ARG_WITH(t1lib,
	[  --with-t1lib            enable t1lib],
	[ if test "$withval" != "no"; then
		AC_CHECK_LIB(t1, main, LIBT1="-lt1")
		if test "$LIBT1" != ""; then
			AC_DEFINE(HAVE_LIB_T1)
		fi
		AC_CHECK_LIB(t1x, main, LIBT1X="-lt1x", , $LIBT1 $X_LIBS -lX11)
		if test "$LIBT1X" != ""; then
			AC_DEFINE(HAVE_LIB_T1X)
		fi
	fi ])
AC_SUBST(LIBT1)
AC_SUBST(LIBT1X)
])