aboutsummaryrefslogtreecommitdiff
path: root/src/aclocal.m4
blob: b2551828ff515d0de8f4f272daf315caad1685c3 (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
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
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
dnl
dnl
dnl How do we find other scripts needed for configuration?
dnl Scripts like Cygnus configure, config.sub, config.guess are stored
dnl together in one directory.  For now, have the configure.in file
dnl specify it explicitly with AC_CONFIG_AUX.  We'll provide a half-way
dnl acceptable default of ${srcdir}.
dnl
define(AC_CONFIG_AUX,[
  if test -f $1/config.sub ; then
    config_aux=$1
  else
    config_aux=${srcdir}/$1
  fi
  config_sub=${config_aux}/config.sub
  config_guess=${config_aux}/config.guess
])dnl
dnl
define(AC__CONFIG_AUX,[
  if test "z${config_sub}" = "z" ; then
    config_sub=${srcdir}/config.sub
  fi
  if test "z${config_guess}" = "z" ; then
    config_guess=${srcdir}/config.guess
  fi
AC_PROVIDE([$0])dnl
])dnl
dnl
dnl set up buildtop stuff
dnl
define(AC_BUILDTOP,[.])dnl
define(AC_SET_BUILDTOP,
[BUILDTOP=AC_BUILDTOP
AC_SUBST(BUILDTOP)dnl
])dnl
dnl
dnl
dnl Does configure need to be run in immediate subdirectories of this
dnl directory?
dnl
define(CONFIG_DIRS,[
AC_REQUIRE([AC__CONFIG_AUX])dnl
changequote(<<<,>>>)dnl
SUBDIRS="$1"
if [ -z "${norecursion}" ] ; then
	recurse_args=
	recur_state=
	for recur_arg in ${configure_args} ; do
		if test -z "${recur_state}" ; then
			case "${recur_arg}" in
			  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
			    recur_state="skip"
			    ;;
			  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
			    ;;
			*) recurse_args="${recurse_args} ${recur_arg}" ;;
			esac
		else
			recur_state=
		fi
	done
	for configdir in $1 ; do

		if [ -d ${srcdir}/${configdir} ] ; then
			eval echo Configuring ${configdir}... ${redirect}
			case "${srcdir}" in
			".") ;;
			*)
				if [ ! -d ./${configdir} ] ; then
					if mkdir ./${configdir} ; then
						true
					else
						echo '***' "${progname}: could not make `pwd`/${configdir}" 1>&2
						exit 1
					fi
				fi
				;;
			esac

			POPDIR=`pwd`
			cd ${configdir}

### figure out what to do with srcdir
			case "${srcdir}" in
			".") newsrcdir=${srcdir} ;; # no -srcdir option.  We're building in place.
			/*) # absolute path
				newsrcdir=${srcdir}/${configdir}
				srcdiroption="--srcdir=${newsrcdir}"
				;;
			*) # otherwise relative
				newsrcdir=../${srcdir}/${configdir}
				srcdiroption="--srcdir=${newsrcdir}"
				;;
			esac

### check for guested configure, otherwise get Cygnus style configure
### script from ${config_aux}
			if [ -f ${newsrcdir}/configure ] ; then
				recprog=${newsrcdir}/configure
			elif [ -f ${newsrcdir}/configure.in ] ; then
				recprog=${config_aux}/configure
			else
				eval echo No configuration information in ${configdir} ${redirect}
				recprog=
			fi

### The recursion line is here.
			if [ ! -z "${recprog}" ] ; then
				if eval ${config_shell} ${recprog} "${recurse_args}" ${srcdiroption}; then
					true
				else
					echo Configure in `pwd` failed, exiting. 1>&2
					exit 1
				fi
			fi

			cd ${POPDIR}
		fi
	done
fi
changequote([,])dnl
AC_SUBST(SUBDIRS)dnl
])dnl
dnl
dnl append subdir rule -- MAKE_SUBDIRS("making",all)
dnl
define(MAKE_SUBDIRS,[
changequote(<<<,>>>)dnl
divert(9)dnl

$2::<<<
	@case '${MFLAGS}' in *[ik]*) set +e ;; esac; \
	for i in $(SUBDIRS) ;\
	do \
		(cd $$i ; echo>>> $1 <<<"in $(CURRENT_DIR)$$i..."; \
			$(MAKE) $(MFLAGS) CCOPTS="$(CCOPTS)" CC="$(CC)" \
			CURRENT_DIR=$(CURRENT_DIR)$$i/ >>>$2<<<); \
	done>>>
divert(0)dnl
changequote([,])dnl
])dnl
dnl
dnl take saved makefile stuff and put it in the Makeile
dnl
define(EXTRA_RULES,[
cat >> Makefile <<"SUBDIREOF"
undivert(9)
SUBDIREOF
])dnl
dnl
dnl drop in standard configure rebuild rules -- CONFIG_RULES
dnl
define(CONFIG_RULES,[
AC_WITH([cc],
echo CC=$withval
CC=$withval,
if test -z "$CC" ; then CC=cc; fi
echo CC defaults to $CC)dnl
AC_SUBST([CC])dnl
divert(9)dnl
[
Makefile: $(srcdir)/Makefile.in config.status
	$(SHELL) config.status
config.status: $(srcdir)/configure
	$(SHELL) config.status --recheck
configure: $(srcdir)/configure.in
	cd $(srcdir); autoconf
]
divert(0)dnl
])dnl
dnl
dnl check for sys_errlist -- DECLARE_SYS_ERRLIST
dnl
define(DECLARE_SYS_ERRLIST,[
AC_COMPILE_CHECK([sys_errlist declaration],
[#include <stdio.h>
#include <errno.h>], [sys_nerr;], , AC_DEFINE(NEED_SYS_ERRLIST))])dnl
dnl
dnl check for sigmask/sigprocmask -- CHECK_SIGPROCMASK
dnl
define(CHECK_SIGPROCMASK,[
AC_COMPILE_CHECK([sigmask],
[#include <signal.h>], [sigmask(1);], ,
 AC_COMPILE_CHECK([sigprocmask],
 [#include <signal.h>], [sigprocmask(SIG_SETMASK,0,0);],
 AC_DEFINE(USE_SIGPROCMASK),))])dnl
dnl
dnl check for <stdarg.h> -- CHECK_STDARG
dnl (name used for consistency with krb5/config.h)
dnl
define(CHECK_STDARG,[
AC_HEADER_CHECK(stdarg.h,AC_DEFINE(STDARG_PROTOTYPES))])dnl
dnl
define(AC_PROG_ARCHIVE, [AC_PROGRAM_CHECK(ARCHIVE, ar, ar qv, false)])dnl
define(AC_PROG_ARCHIVE_ADD, [AC_PROGRAM_CHECK(ARADD, ar, ar cruv, false)])dnl
dnl
dnl drop in rules for building error tables -- ET_RULES
dnl
define(ET_RULES,[
AC_PROG_AWK dnl
divert(9)dnl
[

SRCTOP=$(srcdir)/$(BUILDTOP)
### /* these are invoked as $(...) foo.et, which works, but could be better */
COMPILE_ET_H= $(AWK) -f $(SRCTOP)/util/et/et_h.awk outfile=$@
COMPILE_ET_C= $(AWK) -f $(SRCTOP)/util/et/et_c.awk outfile=$@
.SUFFIXES:  .h .c .et .ct

.et.h:
	$(AWK) -f $(SRCTOP)/util/et/et_h.awk outfile=$][*.h $<

.et.c:
	$(AWK) -f $(SRCTOP)/util/et/et_c.awk outfile=$][*.c $<

]
divert(0)dnl
])dnl
dnl
dnl drop in rules for building command tables -- SS_RULES
dnl
define(SS_RULES,[
divert(9)dnl
changequote({,})dnl
{

MAKE_COMMANDS= $(BUILDTOP)/util/ss/mk_cmds
.SUFFIXES:  .h .c .et .ct

.ct.c:
	if [ $< != $}{*.ct ]; then \
		(cp $< $}{*.ct && $(MAKE_COMMANDS) $}{*.ct && rm $}{*.ct) || exit 1; \
	else \
		$(MAKE_COMMANDS) $}{*.ct || exit 1; \
	fi

}
changequote([,])dnl
divert(0)dnl
])dnl
dnl
dnl check for <dirent.h> -- CHECK_DIRENT
dnl (may need to be more complex later)
dnl
define(CHECK_DIRENT,[
AC_HEADER_CHECK(dirent.h,AC_DEFINE(USE_DIRENT_H))])dnl
dnl
dnl check if sys/fcntl.h is needed for O_* -- CHECK_FCNTL
dnl
define(CHECK_FCNTL,[
AC_COMPILE_CHECK([O_RDONLY from sys/file.h],
[#include <sys/param.h>
#include <sys/types.h>
#include <sys/file.h>],
[O_RDONLY;], ,AC_COMPILE_CHECK([O_RDONLY from sys/fcntl.h],
[#include <sys/param.h>
#include <sys/types.h>
#include <sys/file.h>
#include <sys/fcntl.h>],
[O_RDONLY;],AC_DEFINE(NEED_SYS_FCNTL_H)))])dnl
dnl
dnl check if union wait is defined, or if WAIT_USES_INT -- CHECK_WAIT_TYPE
dnl
define(CHECK_WAIT_TYPE,[
AC_COMPILE_CHECK([union wait],
[#include <sys/wait.h>], [union wait i;], , AC_DEFINE(WAIT_USES_INT))])dnl
dnl
dnl set $(KRB5ROOT) from --with-krb5-root=value -- WITH_KRB5ROOT
dnl
define(WITH_KRB5ROOT,[
AC_WITH([krb5-root],
echo "krb5-root is $withval"
KRB5ROOT=$withval,
echo "krb5-root defaults to /krb5"
KRB5ROOT=/krb5)dnl
AC_SUBST(KRB5ROOT)])dnl
dnl
dnl set $(KRB4) from --with-krb4=value -- WITH_KRB4
dnl
define(WITH_KRB4,[
AC_WITH([krb4],
echo "krb4 is $withval"
KRB4=$withval,
echo "no krb4 support; use --with-krb4=krb4dir"
KRB4=)dnl
AC_SUBST(KRB4)])dnl
dnl
dnl set $(CCOPTS) from --with-ccopts=value
dnl
define(WITH_CCOPTS,[
AC_WITH([ccopts],
echo "CCOPTS is $withval"
CCOPTS=$withval,
CCOPTS=)dnl
AC_SUBST(CCOPTS)])dnl
dnl
dnl Imake LinkFile rule, so they occur in the right place -- LinkFile(dst,src)
dnl
define(LinkFile,[
AC_LN_S
changequote({,})dnl
divert(9)dnl

$1:: $2{
	$(RM) $}{@
	$(LN) $}{? $}{@

}divert(0)dnl
changequote([,])dnl
])dnl
dnl
dnl explicit append text (for non-general things) -- AppendRule(txt)
dnl
define(AppendRule,[
divert(9)dnl

$1

divert(0)dnl
])dnl
dnl
dnl create DONE file for lib/krb5 -- SubdirLibraryRule(list)
define(SubdirLibraryRule,[
divert(9)dnl

all:: DONE

DONE:: $1
	echo $1 > [$]@

clean::
	$(RM) DONE
divert(0)dnl
])dnl
dnl
dnl copy header file into include dir -- CopyHeader(hfile,hdir)
dnl
define(CopyHeader,[
divert(9)dnl

includes:: $1
	-mkdir $2
	-if cmp $1 $2/$1 >/dev/null 2>&1; then \
		echo ; \
	else \
		[$](RM) $2/$1 ; \
		[$](CP) $1 $2/$1; \
	fi

divert(0)dnl
])dnl
dnl
dnl copy source header file into include dir -- CopySrcHeader(hfile,hdir)
dnl
define(CopySrcHeader,[
divert(9)dnl

includes:: $1
	-mkdir $2
	-if cmp $(srcdir)/$1 $2/$1 >/dev/null 2>&1; then \
		echo ; \
	else \
		[$](RM) $2/$1 ; \
		[$](CP) $(srcdir)/$1 $2/$1; \
	fi

divert(0)dnl
])dnl
dnl
dnl Krb5InstallHeaders(headers,destdir)
define(Krb5InstallHeaders,[
divert(9)dnl
install:: $1
	@set -x; for f in $1 ; \
	do [$](INSTALL) -c [$](INSTDATFLAGS) [$$]f $2/[$$]f ; \
	done
divert(0)dnl
])dnl
dnl
dnl PepsyTarget(basename)
dnl
define(PepsyTarget,[
divert(9)
.SUFFIXES:	.py
$1_defs.h $1_pre_defs.h $1-types.h $1_tables.c: $1-asn.py
	@echo '***Ignore the warning message "Warning: Can'"'"'t find UNIV.ph failed"'
	[$](PEPSY) [$](PSYFLAGS) [$](srcdir)/$1-asn.py

divert(0)dnl
])dnl
dnl
define(UsePepsy,[
echo "using pepsy"
PSYFLAGS="-f -h0 -a -s -C"
PEPSY='$(BUILDTOP)/isode/pepsy/xpepsy'
AC_SUBST(PEPSY)dnl
AC_SUBST(PSYFLAGS)dnl
])dnl
dnl
dnl arbitrary DEFS -- ADD_DEF(value)
dnl
define(ADD_DEF,[
DEFS="[$]DEFS "'$1'
])dnl
dnl
dnl local includes are used -- KRB_INCLUDE
dnl
define(KRB_INCLUDE,[
ADD_DEF([-I${SRCTOP}/include -I${BUILDTOP}/include])dnl
])dnl
dnl
dnl ISODE/pepsy includes are used -- ISODE_INCLUDE
dnl
define(ISODE_INCLUDE,[
ADD_DEF([-I${SRCTOP}/isode/h -I${BUILDTOP}/isode/h])dnl
])dnl
dnl
dnl check for yylineno -- HAVE_YYLINENO
dnl
define(HAVE_YYLINENO,[dnl
AC_REQUIRE_CPP()AC_REQUIRE([AC_PROG_LEX])dnl
AC_CHECKING(for yylineno declaration)
# some systems have yylineno, others don't...
  echo '%%
%%' | ${LEX} -t > conftest.out
  if egrep yylineno conftest.out >/dev/null 2>&1; then
	:
  else
	AC_DEFINE([NO_YYLINENO])
  fi
  rm -f conftest.out
])dnl
dnl
dnl fix AC_PROG_LEX
dnl
undefine([AC_PROG_LEX])dnl
define(AC_PROG_LEX,
[AC_PROVIDE([$0])dnl
LEX="lex"
if test -z "$LEXLIB"
then
   AC_HAVE_LIBRARY(l, LEXLIB="-ll")
fi
AC_VERBOSE(setting LEXLIB to $LEXLIB)
AC_SUBST(LEX)AC_SUBST(LEXLIB)])dnl
dnl