-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.in
More file actions
111 lines (89 loc) · 3.58 KB
/
configure.in
File metadata and controls
111 lines (89 loc) · 3.58 KB
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
# This whole script was taken and modified from a sample available on
# one of the libsdl web pages.. I'd give more definite credit, except
# that I've lost the links.. if someone knows where this all came from,
# please alert me at whiterabbit@users.sourceforge.net, and I'll provide
# proper attribution and a link. I'm heavily indebted to this sample
# script for helping me begin to get autoconf working!
# This first line initializes autoconf and gives it a file that it can
# look for to make sure the source distribution is complete.
AC_INIT(README)
# The AM_INIT_AUTOMAKE macro tells automake the name and version number
# of the software package so it can generate rules for building a source
# archive.
AM_INIT_AUTOMAKE(hacknet, 0.0.7)
# We now have a list of macros which tell autoconf what tools we need to
# build our software, in this case "make", a C++ compiler, and "install".
# If we were creating a C program, we would use AC_PROC_CC instead of CXX.
AC_PROG_MAKE_SET
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_RANLIB
# This is a trick I learned at Loki - the current compiler for the alpha
# architecture doesn't produce code that works on all versions of the
# alpha processor. This bit detects the current compile architecture
# and sets the compiler flags to produce portable binary code.
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
case "$target" in
alpha*-*-linux*)
CXXFLAGS="$CXXFLAGS -mcpu=ev4 -Wa,-mall"
;;
esac
dnl Checks for curses headers and functions. (Does generic 'curses' ever have a color_set function?)
AC_CHECK_LIB(ncurses, initscr,
[ AC_DEFINE(HAVE_LIBNCURSES)
AC_CHECK_LIB( ncurses, color_set, AC_DEFINE(HAS_COLOR_SET) )
CURSESLIB='-lncurses'; ], [
AC_CHECK_LIB(curses, initscr,
[ AC_DEFINE(HAVE_LIBCURSES)
AC_CHECK_LIB( curses, color_set, AC_DEFINE(HAS_COLOR_SET) )
CURSESLIB='-lcurses'; ])
])
dnl AC_SUBST(CURSESINC)
AC_SUBST(CURSESLIB)
dnl *BSD puts threads into libc_r. We can tell gcc/c++/g++/etc. to link
dnl libc_r instead of libc by passing the argument -pthread.
AC_CHECK_LIB(c_r, pthread_create,THREADLIB='-pthread', [
AC_CHECK_LIB(pthread, pthread_create,THREADLIB='-lpthread')
])
AC_SUBST(THREADLIB)
dnl Solaris (and others?) put socket code into libsocket instead of in
dnl libc. So if it's not in libc, check libsocket.
AC_CHECK_LIB(socket,socket)
dnl Solaris (and others?) put hostname lookup into libnsl instead of
dnl libc. So if it's not in libc, check nsl.
AC_CHECK_LIB(nsl,gethostbyname)
AC_CHECK_FUNCS(herror)
AC_HEADER_STDC
dnl AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h netinet/in.h)
# Bleah. If we don't have a socklen_t, switch it to an int for the sake of
# Cygwin, which seems to have decided that they might want to receive a
# packet with a negative number of bytes in it.
AC_MSG_CHECKING(whether 'socklen_t' is defined)
AC_TRY_COMPILE(
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
,
[
socklen_t sin_size = sizeof(int);
],AC_MSG_RESULT(yes), AC_DEFINE(socklen_t,int) AC_MSG_RESULT(no))
AC_MSG_CHECKING(whether we use u_int or uint)
AC_TRY_COMPILE(
#include <sys/types.h>
,
[
u_int8_t size = sizeof(int);
],[AC_MSG_RESULT(u_int)], [ AC_DEFINE(NO_U_INT_T) AC_MSG_RESULT(uint)])
# Finally create all the generated files
# The configure script takes "file.in" and substitutes variables to produce
# "file". In this case we are just generating the Makefiles, but this could
# be used to generate any number of automatically generated files.
AC_OUTPUT([
Makefile
server/Makefile
client/Makefile
ttyclient/Makefile
common/Makefile
doc/Makefile
])