File: configure.ac

package info (click to toggle)
leafnode 1.11.11-1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,468 kB
  • sloc: ansic: 10,914; sh: 1,748; xml: 628; makefile: 291; perl: 84; sed: 4
file content (502 lines) | stat: -rw-r--r-- 14,347 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
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
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
dnl autoconf script for leafnode -*- m4 -*- vim: set tw=0:
dnl written by Cornelius Krasel, 1999
dnl enhanced by Matthias Andree, 2000 - 2013
dnl Process this file with autoconf to produce a configure script.
AC_INIT([leafnode],[1.11.11])
AC_PREREQ(2.60)
AC_CONFIG_SRCDIR([leafnode.h])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([config.h])

dnl Checks for programs.
AC_PROG_AWK
AC_PROG_CC_STDC

AC_USE_SYSTEM_EXTENSIONS

dnl figure inline
AC_C_INLINE
dnl kill volatile if not understood:
AC_C_VOLATILE

AC_PROG_RANLIB
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_SED

AC_CHECK_TOOL([AR],ar,ar,$PATH:/usr/sbin:/usr/ccs/bin )
AC_CHECK_TOOL([STRIP],[strip])
AC_PATH_PROG( RPM, rpm )
AC_PATH_PROG([ID], [id], [false], /usr/xpg4/bin:/usr/bin:/bin)

dnl check whether called with --with-ipv6
AC_ARG_WITH(ipv6,
	    AS_HELP_STRING([--without-ipv6],[disable IPv6 support (default enable)]),,[with_ipv6=yes])
if test "$with_ipv6" != "no" ; then
  AC_DEFINE(HAVE_IPV6, 1, [Define to 1 this to compile with IPv6 support.])
fi

AC_CHECK_DECL(AI_ADDRCONFIG,,AC_DEFINE(AI_ADDRCONFIG,0,[define to 0 if your system does not support AI_ADDRCONFIG]),[#define _XOPEN_SOURCE 600
#include <netdb.h>])

dnl check where to put the confdir
AC_ARG_WITH(confdir,
AS_HELP_STRING([--with-confdir],[obsolete option, use --sysconfdir]),
 AC_MSG_ERROR([--with-confdir=D is obsolete. Please use --sysconfdir=D.]))
if test "$sysconfdir" = '${prefix}/etc' && test "x$prefix" = "xNONE" ; then
    CONFDIR='/etc/leafnode'
else
    CONFDIR="$sysconfdir"
fi

if test "$CONFDIR" != "$sysconfdir"; then 
  AC_MSG_WARN([***])
  AC_MSG_WARN([*** overriding sysconfdir to $CONFDIR])
  AC_MSG_WARN([*** use --sysconfdir to fix])
  AC_MSG_WARN([*** use --sysconfdir='\$prefix/etc' to get default autoconf behaviour])
  AC_MSG_WARN([***])
  sleep 1
fi
sysconfdir=$CONFDIR
AC_SUBST(sysconfdir)

if test "$localstatedir" = '${prefix}/var' && test "$prefix" = NONE ; then
  myvar=/var
else
  myvar="$localstatedir"
fi

dnl check where to put the spooldir
AC_MSG_CHECKING(spooldir)
AC_ARG_WITH(spooldir,
	    AS_HELP_STRING([--with-spooldir],[news spool directory (/var/spool/news)]),
  [ case "${withval-}" in 
  /*) ;;
  *)  AC_MSG_ERROR(you must give an absolute path)
      ;;
  esac
  withval=`echo "$withval" | sed 'sx/*$xx;'`]
,
  withval="$myvar/spool/news"
)
SPOOLDIR=$withval
AC_MSG_RESULT($SPOOLDIR)
AC_SUBST(SPOOLDIR)

dnl check where to put the lockfile
AC_MSG_CHECKING(lockfile)
AC_ARG_WITH(lockfile,
	    AS_HELP_STRING([--with-lockfile],[lockfile path (${spooldir}/leaf.node/lock.file)]),
  [ 
  case "${withval-}" in
  /*) ;;
  *)  AC_MSG_ERROR(you must give an absolute path)
      ;;
  esac ]
, 
withval="$SPOOLDIR/leaf.node/lock.file"
)
LOCKFILE=$withval
AC_MSG_RESULT($LOCKFILE)
AC_SUBST(LOCKFILE)

dnl Checks for types.
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_UID_T

dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT

dnl Check whether all necessary include files are there
AC_MSG_CHECKING(for system include files)
AC_CACHE_VAL(cf_cv_sysheaders, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/param.h>]], [[
    return 0; ]])],[ cf_cv_sysheaders="yes" ],[ cf_cv_sysheaders="no" ])
  )
if test "$cf_cv_sysheaders" = "yes"
then
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
  AC_MSG_ERROR(Kernel sources not installed - unable to continue)
fi

AC_HEADER_TIME
AC_CHECK_HEADERS([fcntl.h sys/time.h syslog.h unistd.h sys/socket.h sys/sockio.h strings.h sys/types.h stdlib.h])
AC_CHECK_HEADERS([net/if.h], [], [],
		 [#include <stdio.h>
		  #ifdef HAVE_SYS_TYPES_H
		  # include <sys/types.h>
		  #endif
		  #ifdef STDC_HEADERS
		  # include <stdlib.h>
		  # include <stddef.h>
		  #else
		  # ifdef HAVE_STDLIB_H
		  #  include <stdlib.h>
		  # endif
		  #endif
		  #ifdef HAVE_SYS_SOCKET_H
		  # include <sys/socket.h>
		  #endif
		 ])
AC_CHECK_HEADERS([netinet/in.h], [], [],
		 [#include <stdio.h>
		  #ifdef HAVE_SYS_TYPES_H
		  # include <sys/types.h>
		  #endif
		  #ifdef STDC_HEADERS
		  # include <stdlib.h>
		  # include <stddef.h>
		  #else
		  # ifdef HAVE_STDLIB_H
		  #  include <stdlib.h>
		  # endif
		  #endif
		  #ifdef HAVE_SYS_SOCKET_H
		  # include <sys/socket.h>
		  #endif
		 ])
AC_CHECK_HEADERS([net/if_var.h], [], [],
		 [#include <stdio.h>
		  #ifdef HAVE_SYS_TYPES_H
		  # include <sys/types.h>
		  #endif
		  #ifdef STDC_HEADERS
		  # include <stdlib.h>
		  # include <stddef.h>
		  #else
		  # ifdef HAVE_STDLIB_H
		  #  include <stdlib.h>
		  # endif
		  #endif
		  #ifdef HAVE_SYS_SOCKET_H
		  # include <sys/socket.h>
		  #endif
		  #ifdef HAVE_NET_IF_H
		  # include <net/if.h>
		  #endif
		 ])
AC_CHECK_HEADERS([netinet/in_var.h], [], [],
		 [#include <stdio.h>
		  #ifdef HAVE_SYS_TYPES_H
		  # include <sys/types.h>
		  #endif
		  #ifdef STDC_HEADERS
		  # include <stdlib.h>
		  # include <stddef.h>
		  #else
		  # ifdef HAVE_STDLIB_H
		  #  include <stdlib.h>
		  # endif
		  #endif
		  #ifdef HAVE_SYS_SOCKET_H
		  # include <sys/socket.h>
		  #endif
		  #ifdef HAVE_NET_IF_H
		  # include <net/if.h>
		  #endif
		  #ifdef HAVE_NETINET_IN_H
		  # include <netinet/in.h>
		  #endif
		  #ifdef HAVE_NET_IF_VAR_H
		  # include <net/if_var.h>
		  #endif
		 ])
AC_CHECK_TYPE(socklen_t, [],
	      [AC_DEFINE(socklen_t,int,[Define to 'int' if <sys/socket.h> does not define.])],
[
  #ifdef HAVE_SYS_TYPES_H
  #include <sys/types.h>
  #endif
  #ifdef HAVE_SYS_SOCKET_H
  #include <sys/socket.h>
  #endif
])

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
		  #if TIME_WITH_SYS_TIME
		  # include <sys/time.h>
		  # include <time.h>
		  #else
		  # if HAVE_SYS_TIME_H
		  #  include <sys/time.h>
		  # else
		  #  include <time.h>
		  # endif
		  #endif
		  ])

AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(time_t)

dnl Coerce GLIBC 2.3 to GLIBC 2.2 compatibility.
dnl May not be complete with future extensions, but appears to work
dnl today, 2003-10-02. Matthias Andree
AC_DEFINE(__NO_CTYPE,1,[Define __NO_CTYPE to 1 to avoid GLIBC_2.3-specific ctype.h functions.])

dnl check whether called with --with-newsuser
AC_MSG_CHECKING(user)
AC_ARG_WITH(user,
	    AS_HELP_STRING([--with-user=<userid>],[name of user account to run as (news)]),,
[ withval=news ])
if test "x$withval" = "xyes" ; then
    AC_MSG_ERROR([--with-user=<userid> requires an argument])
fi
if test "x$withval" = "xno" ; then
    AC_MSG_ERROR([--without-user is not supported])
fi
if test "x$withval" = "xroot" ; then
    AC_MSG_ERROR([--with-user=root is not allowed])
fi
AC_DEFINE_UNQUOTED(NEWS_USER, "$withval", [what user ID to run as])
NEWS_USER="$withval"
AC_MSG_RESULT($NEWS_USER)
AC_SUBST(NEWS_USER)
if $ID -u "$withval" >/dev/null 2>/dev/null ; then
    :
else
    AC_MSG_WARN([User "$withval" does not exist.])
    warned=1
fi

dnl check whether called with --with-newsgroup
AC_MSG_CHECKING(group)
AC_ARG_WITH(group,
	    AS_HELP_STRING([--with-group=<group>],[name of news group to run as (news)]),,
[ withval=news ]
)
AC_DEFINE_UNQUOTED(NEWS_GROUP, "$withval", [what group ID to run as.])
if test "x$withval" = "xyes" ; then
    AC_MSG_ERROR([--with-group=<groupid> requires an argument])
fi
if test "x$withval" = "xno" ; then
    AC_MSG_ERROR([--without-group is not supported])
fi
NEWS_GROUP="$withval"
AC_MSG_RESULT($NEWS_GROUP)
AC_SUBST(NEWS_GROUP)
if test "x$withval" = "xroot" || test "x$withval" = "xwheel" ; then
    AC_MSG_WARN([--with-group=root and --with-group=wheel are not recommended])
    warned=1
fi
if find / -prune -group "$withval" >/dev/null 2>/dev/null ; then
    :
else
    AC_MSG_WARN([Group "$withval" does not exist.])
    warned=1
fi

dnl ### Note that pcre-config is somewhat broken:
dnl ### the CFLAGS contain -I which belong into CPPFLAGS
dnl (found by William Hooper, July 2002)
AC_ARG_VAR(PCRECONFIG,where the pcre-config script is installed)
AC_PATH_PROG(PCRECONFIG,pcre-config,no)
ORIG_CFLAGS="$CFLAGS"
ORIG_CPPFLAGS="$CPPFLAGS"
ORIG_LIBS="$LIBS"
ORIG_LDFLAGS="$LDFLAGS"
if test "$PCRECONFIG" != "no" ; then
  PCRE_CFLAGS=`$PCRECONFIG --cflags`
  PCRE_LIBS=`$PCRECONFIG --libs`
else
    AC_MSG_WARN([cannot find pcre-config, this can cause PCRE to not be found.])
fi

dnl check for PCRE
CFLAGS="$CFLAGS $PCRE_CFLAGS"
CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
LDFLAGS="$LDFLAGS $LIBS $PCRE_LIBS"
AC_CHECK_HEADERS(pcre.h)
AC_CHECK_LIB(pcre, pcre_compile,[PCRELIB="-lpcre"])

if test x$ac_cv_header_pcre_h = xno \
    || test x$ac_cv_lib_pcre_pcre_compile = xno ; then
	cat <<EOF
----------------------------------------------------------------
PCRE is not installed in your system or cannot be found.
Please obtain PCRE separately from http://www.pcre.org/,
compile and install it, then retry to install leafnode.
See the PCRE_README file for instructions.
----------------------------------------------------------------
EOF
	AC_MSG_ERROR([PCRE is not installed, cannot continue.])
    fi

AC_SUBST(PCRELIB)
AC_SUBST(PCREDEP)

dnl Check for BSD4.2 syslog
AC_MSG_CHECKING(for BSD4.2 syslog)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <syslog.h>]], [[
       openlog( "configure", LOG_PID|LOG_CONS, LOG_NEWS ); ]])],[ cf_cv_have_bsd42="no" ],[ cf_cv_have_bsd42="yes" ])
if test $cf_cv_have_bsd42 = "yes"
then
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_OLD_SYSLOG, 1,
	[Define to 1 if your openlog(3) takes only two arguments (BSD4.2 style).])
else
  AC_MSG_RESULT(no)
fi

dnl Checks for library functions.
AC_FUNC_STRFTIME
dnl AC_FUNC_UTIME_NULL
dnl The next two aren't needed and just confuse dietlibc:
dnl AC_FUNC_MALLOC
dnl AC_FUNC_REALLOC
AC_CHECK_FUNCS(setgid setuid getifaddrs)
AC_CHECK_FUNC(lstat,,AC_DEFINE(lstat, stat, [Define to stat if you don't have lstat]))
AC_REPLACE_FUNCS(getline strdup mkstemp strlcpy timegm)
AC_FUNC_FORK

dnl Check if system snprintf works
AC_MSG_CHECKING(if your system's snprintf works)
AC_RUN_IFELSE([ AC_LANG_SOURCE([
/* tell xsnprintf.c to not include leafnode.h which depends
 * on config.h, which doesn't exist at this time,
 * and we don't want the overrides just yet. */
#define RUN_FROM_CONFIGURE 1
`cat $srcdir/xsnprintf.c`
])],
result=yes,
result=no,
result="unknown -- cross-compiling -- assuming yes")
AC_MSG_RESULT([$result])
if test "$result" != "no" ; then
    AC_DEFINE(HAVE_WORKING_SNPRINTF, 1, [Define to 1 if you have a _properly working_ 'snprintf' function.])
else
    AC_MSG_WARN([Your system's libc is broken and provides only a faulty snprintf.])
fi

# Whenever both -lsocket and -lnsl are needed, it seems to be always the
# case that gethostbyname requires -lnsl.  So, check -lnsl first, for it
# to be in LIBS before the setsockopt checks are performed.  *However*,
# on SINIX-N 5.43, this is false, and gethostent seems to be a better
# candidate. So, let's use it below instead of gethostbyname, and see.
# Stolen from GNU tar 1.12

AC_SEARCH_LIBS(gethostent, nsl)
AC_SEARCH_LIBS(setsockopt, socket)
AC_SEARCH_LIBS(syslog, bsd socket inet)

AC_MSG_CHECKING(if your sockaddr has sa_len)
AC_CACHE_VAL(cf_cv_have_salen, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
    #include <sys/types.h>
    #include <sys/socket.h>]], [[
    struct sockaddr sa;
    (void)sa.sa_len;]])],[ cf_cv_have_salen="yes" ],[ cf_cv_have_salen="no" ])
)
if test $cf_cv_have_salen = yes
then
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_SALEN, 1, [Define to 1 if your ifreq's if_addr has a
			      sa_len member.])
else
    AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(if your system supports SIOCGIFALIAS)
AC_CACHE_VAL(cf_cv_have_SIOCGIFALIAS, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
    #include <stddef.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #ifdef HAVE_SYS_SOCKIO_H
    #include <sys/sockio.h>
    #endif
    #include <net/if.h>
]], [[
    (void)ioctl(0, SIOCGIFALIAS, NULL);]])],[ cf_cv_have_SIOCGIFALIAS="yes" ],[ cf_cv_have_SIOCGIFALIAS="no" ])
)
if test $cf_cv_have_SIOCGIFALIAS = yes
then
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_SIOCGIFALIAS, 1, [Define to 1 if your system supports ioctl(., SIOCGIFALIAS; .)])
else
    AC_MSG_RESULT(no)
fi

if test "$GCC" = yes ; then
    AC_MSG_CHECKING([if $CC is really Intel C++])
    case "`$CC -V 2>&1`" in
	[[iI][nN][tT][eE][lL]]*)	ICC=yes ;;
	*)				ICC=no ;;
    esac
    AC_MSG_RESULT($ICC)
fi

if test "$GCC" = yes && test "x$GCC_FLAGS" = "x" && test "$ICC" = no
then
    AC_MSG_CHECKING(for some good GCC flags)
    AC_LANG_CONFTEST([AC_LANG_SOURCE([])])
    for i in -Wall -W -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-unused-result
    do
	if $CC $i -c conftest.c
	then
	    GCC_FLAGS="$GCC_FLAGS $i"
	fi
    done
    rm -f conftest.c conftest.o
    AC_MSG_RESULT($GCC_FLAGS)
fi
export GCC_FLAGS
AC_SUBST(GCC_FLAGS)
AC_SUBST(BINDIR)
AC_SUBST(SYSCONFDIR)

dnl check for rpm build dir
AC_MSG_CHECKING(rpm build dir)
dnl avoid checking against /SPECS
d=${RPMSRC:-/usr/src/rpm}
test -d ${d}/SPECS || d=/usr/src/rpm
test -d ${d}/SPECS || d=/usr/src/packages
test -d ${d}/SPECS || d=/usr/src/redhat
test -d ${d}/SPECS || d=none
RPMSRC=${d}
AC_MSG_RESULT(${RPMSRC})
AC_SUBST(RPMSRC)

dnl figure path to some tools
AC_ARG_VAR(TCPSERVER, where tcpserver is installed)
AC_PATH_PROG([TCPSERVER],tcpserver,none,/command /usr/local/bin $PATH)
AC_ARG_VAR(ARGV0, where argv0 is installed)
AC_PATH_PROG([ARGV0],argv0,none,/command /usr/local/bin $PATH)
AC_ARG_VAR(TCPD, where tcpd is installed)
AC_PATH_PROG([TCPD],tcpd,none,/usr/sbin /usr/libexec /usr/lbin /usr/etc /usr/bin /usr/local/sbin /usr/local/bin $PATH)


dnl sysconfdir can still contain unexpanded variables, so we try to
dnl expand them, hopefully safely enough.
tmp="`echo $sysconfdir | sed -f ${srcdir}/sanitize.sed`"
msysconfdir="`(
if test "x$prefix" = xNONE ; then
  prefix=$ac_default_prefix
fi
eval echo \"\\\"$tmp\\\"\" )`"
AC_SUBST(msysconfdir)
AC_CONFIG_FILES([subst leafnode.spec Makefile doc_german/Makefile])
AC_CONFIG_COMMANDS([default],[[echo timestamp >stamp-h]],[[]])
AC_OUTPUT

cat <<EOF
*** leafnode $VERSION is now configured and prepared to be compiled.
*** to compile, type 'make' (without the quotes)
*** to run some tests, type 'make check' (without the quotes)
*** to install, type 'make install' as root (without the quotes)
EOF

if test "x$warned" = "x1" ; then
    AC_MSG_WARN(Review the warnings given above and check if you need to fix)
    AC_MSG_WARN(the situation that caused the warning)
fi