Revision 5d6dc930

View differences:

aclocal.m4
1 1
dnl ** Additional Autoconf tests for BIRD configure script
2 2
dnl ** (c) 1999 Martin Mares <mj@ucw.cz>
3 3

  
4
AC_DEFUN([BIRD_CHECK_INTEGERS],
5
[AC_CHECK_SIZEOF(char, 0)
6
AC_CHECK_SIZEOF(short int, 0)
7
AC_CHECK_SIZEOF(int, 0)
8
AC_CHECK_SIZEOF(long int, 0)
9
AC_CHECK_SIZEOF(long long int, 0)
10
AH_TEMPLATE([INTEGER_8],  [8-bit integer type])
11
AH_TEMPLATE([INTEGER_16], [16-bit integer type])
12
AH_TEMPLATE([INTEGER_32], [32-bit integer type])
13
AH_TEMPLATE([INTEGER_64], [64-bit integer type])
14

  
15
for size in 1 2 4 8; do
16
	bits=`expr $size "*" 8`
17
	AC_MSG_CHECKING([for $bits-bit type])
18
	if test $ac_cv_sizeof_int = $size ; then
19
		res=int
20
	elif test $ac_cv_sizeof_char = $size ; then
21
		res=char
22
	elif test $ac_cv_sizeof_short_int = $size ; then
23
		res="short int"
24
	elif test $ac_cv_sizeof_long_int = $size ; then
25
		res="long int"
26
	elif test $ac_cv_sizeof_long_long_int = $size ; then
27
		res="long long int"
28
	else
29
		AC_MSG_RESULT([not found])
30
		AC_MSG_ERROR([Cannot find $bits-bit integer type.])
31
	fi
32
	AC_MSG_RESULT($res)
33
	AC_DEFINE_UNQUOTED(INTEGER_$bits, $res)
34
	done
35
])
36

  
37
dnl BIRD_CHECK_ENDIAN is unused and obsolete
38
AC_DEFUN([BIRD_CHECK_ENDIAN],
39
[AC_CACHE_CHECK([CPU endianity], bird_cv_c_endian,[
40
AC_TRY_RUN([
41
#include <stdio.h>
42

  
43
unsigned int x = 0x12345678;
44
unsigned char *z = (unsigned char *) &x;
45

  
46
int main(void)
47
{
48
  FILE *f = fopen("conftestresult", "w");
49
  if (!f) return 10;
50
  fprintf(f, "%02x %02x %02x %02x", *z, *(z+1), *(z+2), *(z+3));
51
  fclose(f);
52
  exit(0);
53
}
54
],[
55
	endian=`cat conftestresult`
56
	if test "$endian" = "12 34 56 78" ; then
57
		bird_cv_c_endian=big-endian
58
	elif test "$endian" = "78 56 34 12" ; then
59
		bird_cv_c_endian=little-endian
60
	fi
61
],[endian="test program failed"],[endian="not available, we're cross compiling"])
62
if test -z "$bird_cv_c_endian" ; then
63
	AC_MSG_RESULT($endian)
64
	AC_MSG_ERROR([Cannot determine CPU endianity.])
65
	fi
66
])
67
case $bird_cv_c_endian in
68
	big-endian)	AC_DEFINE(CPU_BIG_ENDIAN) ;;
69
	little-endian)	AC_DEFINE(CPU_LITTLE_ENDIAN) ;;
70
	esac
71
])
72

  
73 4
AC_DEFUN([BIRD_CHECK_STRUCT_ALIGN],
74 5
[AC_CACHE_CHECK([usual alignment of structures],bird_cv_c_struct_align,[
75 6
AC_TRY_RUN([
......
126 57
	esac
127 58
])
128 59

  
129
AC_DEFUN([BIRD_CHECK_STRUCT_IP_MREQN],
130
[AC_CACHE_CHECK([for struct ip_mreqn], bird_cv_struct_ip_mreqn,[
131
AC_TRY_COMPILE([#include <netinet/in.h>
132
],[struct ip_mreqn x;
133
],[bird_cv_struct_ip_mreqn=yes
134
],[bird_cv_struct_ip_mreqn=no
135
])])
136
if test "$bird_cv_struct_ip_mreqn" = yes ; then
137
	AC_DEFINE([HAVE_STRUCT_IP_MREQN], [1], [Define to 1 if you have struct ip_mreqn])
138
fi
139
])
140

  
141 60
AC_DEFUN([BIRD_CHECK_PTHREADS],
142 61
[
143 62
  bird_tmp_cflags="$CFLAGS"
......
170 89

  
171 90
# BIRD_CHECK_PROG_FLAVOR_GNU(PROGRAM-PATH, IF-SUCCESS, [IF-FAILURE])
172 91
# copied autoconf internal _AC_PATH_PROG_FLAVOR_GNU
173
m4_define([BIRD_CHECK_PROG_FLAVOR_GNU],
92
AC_DEFUN([BIRD_CHECK_PROG_FLAVOR_GNU],
174 93
[# Check for GNU $1
175 94
case `"$1" --version 2>&1` in
176 95
*GNU*)
......
179 98
[*)
180 99
  $3;;
181 100
])esac
182
])#
101
])
configure.ac
69 69
AC_SUBST(CONFIG_FILE)
70 70
AC_SUBST(CONTROL_SOCKET)
71 71

  
72
AC_SEARCH_LIBS(clock_gettime, [c rt posix4], ,
72
AC_SEARCH_LIBS(clock_gettime, [rt posix4], ,
73 73
	AC_MSG_ERROR([[Function clock_gettime not available.]]))
74 74

  
75 75
AC_CANONICAL_HOST
......
84 84
	AC_MSG_ERROR([This program requires the GNU C Compiler.])
85 85
fi
86 86

  
87
# Enable threads by default just in Linux and FreeBSD
88
#if test "$enable_pthreads" = try ; then
89
#	case "$host_os" in
90
#		(linux* | freebsd* | openbsd* | netbsd* )	enable_pthreads=try ;;
91
#		(*)				enable_pthreads=no ;;
92
#	esac
93
#fi
94

  
95 87
if test "$enable_pthreads" != no ; then
96 88
	BIRD_CHECK_PTHREADS
97 89

  
......
248 240
		;;
249 241
esac
250 242

  
251
AC_CHECK_HEADER(syslog.h, [AC_DEFINE([HAVE_SYSLOG], [1], [Define to 1 if you have the <syslog.h> header file])])
252
AC_CHECK_HEADER(alloca.h, [AC_DEFINE([HAVE_ALLOCA_H], [1], [Define to 1 if you have the <alloca.h> header file])])
243
AC_CHECK_HEADERS_ONCE([alloca.h syslog.h])
244

  
253 245
AC_MSG_CHECKING(whether 'struct sockaddr' has sa_len)
254 246
AC_COMPILE_IFELSE([
255 247
  AC_LANG_PROGRAM(
......
275 267
  [AC_MSG_ERROR([Cannot determine CPU endianity.])]
276 268
)
277 269

  
278
BIRD_CHECK_INTEGERS
279 270
BIRD_CHECK_STRUCT_ALIGN
280 271
BIRD_CHECK_TIME_T
281
BIRD_CHECK_STRUCT_IP_MREQN
282 272

  
283 273
if test "$enable_debug" = yes ; then
284 274
	AC_DEFINE([DEBUGGING], [1], [Define to 1 if debugging is enabled])
sysdep/config.h
24 24
#include "sysdep/paths.h"
25 25

  
26 26
/* Types */
27
typedef signed INTEGER_8 s8;
28
typedef unsigned INTEGER_8 u8;
29
typedef INTEGER_16 s16;
30
typedef unsigned INTEGER_16 u16;
31
typedef INTEGER_32 s32;
32
typedef unsigned INTEGER_32 u32;
33
typedef INTEGER_64 s64;
34
typedef unsigned INTEGER_64 u64;
35
typedef u8 byte;
36
typedef u16 word;
27

  
28
#include <stdint.h>
29
typedef int8_t s8;
30
typedef uint8_t u8;
31
typedef int16_t s16;
32
typedef uint16_t u16;
33
typedef int32_t s32;
34
typedef uint32_t u32;
35
typedef int64_t s64;
36
typedef uint64_t u64;
37
typedef uint8_t byte;
38
typedef uint16_t word;
37 39
typedef unsigned int uint;
38 40

  
39 41
#endif
sysdep/linux/sysio.h
7 7
 */
8 8

  
9 9

  
10
#ifndef HAVE_STRUCT_IP_MREQN
11
/* Several versions of glibc don't define this structure, so we have to do it ourselves */
12
struct ip_mreqn
13
{
14
  struct in_addr imr_multiaddr;			/* IP multicast address of group */
15
  struct in_addr imr_address;			/* local IP address of interface */
16
  int		 imr_ifindex;			/* Interface index */
17
};
18
#endif
19

  
20 10
#ifndef IP_MINTTL
21 11
#define IP_MINTTL 21
22 12
#endif
sysdep/unix/log.c
56 56
#endif
57 57

  
58 58

  
59
#ifdef HAVE_SYSLOG
59
#ifdef HAVE_SYSLOG_H
60 60
#include <sys/syslog.h>
61 61

  
62 62
static int syslog_priorities[] = {
......
127 127
	  fputc('\n', l->fh);
128 128
	  fflush(l->fh);
129 129
	}
130
#ifdef HAVE_SYSLOG
130
#ifdef HAVE_SYSLOG_H
131 131
      else
132 132
	syslog(syslog_priorities[class], "%s", buf->start);
133 133
#endif
......
262 262
  init_list(&init_log_list);
263 263
  *syslog_name = NULL;
264 264

  
265
#ifdef HAVE_SYSLOG
265
#ifdef HAVE_SYSLOG_H
266 266
  if (!debug)
267 267
    {
268 268
      static struct log_config lc_syslog = { .mask = ~0 };
......
287 287

  
288 288
  current_log_list = l;
289 289

  
290
#ifdef HAVE_SYSLOG
290
#ifdef HAVE_SYSLOG_H
291 291
  if (current_syslog_name && new_syslog_name &&
292 292
      !strcmp(current_syslog_name, new_syslog_name))
293 293
    return;

Also available in: Unified diff