forked from irrtoolset/irrtoolset
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
182 lines (163 loc) · 5.21 KB
/
configure.ac
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
# $Id$
#
# Copyright (c) 2010 Nick Hilliard
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# Author(s): Nick Hilliard <[email protected]>
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.61])
AC_INIT([irrtoolset], [5.1.0], [[email protected]])
AC_CONFIG_SRCDIR([src/rpsl/rpsl.l])
AC_CONFIG_HEADERS([src/config.h])
# Fix up Automake and libtool
AM_INIT_AUTOMAKE([foreign tar-ustar])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AM_PROG_LEX
AC_PROG_YACC
AC_PROG_LIBTOOL
# Checks for libraries.
# Checks for header files.
AC_FUNC_ALLOCA
AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h libintl.h limits.h malloc.h memory.h netdb.h netinet/in.h regex.h stddef.h stdlib.h string.h strings.h sys/param.h sys/socket.h sys/time.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT8_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_REALLOC
AC_FUNC_STRTOD
AC_CHECK_FUNCS([timegm bzero gethostbyaddr gethostbyname gethostname getpagesize gettimeofday inet_ntoa isascii memchr memmove memset regcomp select socket strcasecmp strchr strdup strerror strncasecmp strrchr strstr strtol])
# Libtoolize wants this
AC_CONFIG_MACRO_DIR([m4])
# check for other stuff
dnl Check if accept uses socklen_t is defined
AC_MSG_CHECKING(for whether accept uses type (socklen_t *) as parameter)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
], [
int sock;
struct sockaddr socknew;
int addrlen = 5;
int newsock = accept (sock, &socknew, (socklen_t *) &addrlen);
], [AC_DEFINE([ACCEPT_USES_SOCKLEN_T], [], [accept() uses type (socklen_t *) as parameter])
AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))
dnl Do the readline dance
READLINE_LIBS=""
AC_ARG_ENABLE([readline], [ --enable-readline support fancy command line editing (default: yes)],
if eval "test x$enable_readline = xyes"; then
AC_CHECK_LIB(termcap, main)
AC_CHECK_LIB(readline, main)
AC_CHECK_LIB(history, main)
READLINE_LIBS="$LIBS"
fi
,
AC_CHECK_LIB(termcap, main)
AC_CHECK_LIB(readline, main)
AC_CHECK_LIB(history, main)
READLINE_LIBS="$LIBS"
)
dnl enable debugging
AC_MSG_CHECKING(whether to enable development debugging)
AC_ARG_ENABLE([debug], [ --enable-debug turn on debugging],
if eval "test x$enable_debug = xyes"; then
AC_DEFINE([ENABLE_DEBUG], [1], [enable debugging stuff for development purposes])
CFLAGS=
CXXLAGS=
OPTFLAGS="-fno-inline -g -O"
else
OPTFLAGS=""
fi
,
OPTFLAGS=""
)
AC_MSG_RESULT(${enable_debug})
case "${host_os}" in
# Solaris needs extra libs for its socket api
solaris* )
SOLARIS_LIBS="-lsocket -lnsl"
;;
# Mac OS/X has native support for readline but doesn't contain
# libhistory. We pretend it does.
darwin* )
READLINE_LIBS="-lreadline"
AC_DEFINE([HAVE_LIBHISTORY], [1])
;;
esac
dnl check for yylineno -- HAVE_YYLINENO
dnl
ac_have_yylineno=no
AC_MSG_CHECKING([for yylineno declaration])
# some systems have yylineno, others don't...
echo '
%%
a { ECHO; }
b { REJECT; }
c { yymore (); }
d { yyless (1); }
e { yyless (input () != 0); }
f { unput (yytext[0]); }
. { BEGIN INITIAL; }
%%
int main (void)
{
return ! yylex () + ! yywrap ();
}
' | ${LEX} -t > conftest.out
egrep yylineno conftest.out >/dev/null 2>&1
if test X"$?" = X0 ; then
AC_DEFINE([HAVE_YYLINENO], [1], [check for yylineno declaration in lex output])
ac_have_yylineno=yes
fi
rm -f conftest.out
AC_MSG_RESULT(${ac_have_yylineno})
EXTRA_LIBS="${SOLARIS_LIBS} ${READLINE_LIBS}"
AC_SUBST(EXTRA_LIBS)
CXXFLAGS="${CFLAGS} ${OPTFLAGS}"
CFLAGS="${CFLAGS} ${OPTFLAGS}"
dnl spit out configuration files
AC_CONFIG_FILES([Makefile
src/Makefile
src/rtconfig/Makefile
src/dataset/Makefile
src/irr/Makefile
src/irrutil/Makefile
src/normalform/Makefile
src/peval/Makefile
src/re2dfa/Makefile
src/rpsl/Makefile
src/rpslcheck/Makefile
])
AC_OUTPUT