-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
148 lines (117 loc) · 3.79 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
VERSION=`cat src/version.h | grep "#define VERSION " | sed -e 's/^.*\"\(.*\)\"/\1/'`
AC_INIT([meer], m4_esyscmd_s([cat src/version.h | cut -d\" -f2]))
AC_CONFIG_SRCDIR([src])
AC_CANONICAL_SYSTEM
AC_GNU_SOURCE
AM_MAINTAINER_MODE([disable])
# Check OS
AC_MSG_CHECKING([host os])
# If no host OS, try uname
if test -z "$host" ; then
host="`uname`"
fi
echo -n "installation for $host OS... "
case "$host" in
*-*-*freebsd*)
CFLAGS="${CFLAGS} -D__FreeBSD__"
CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet11"
LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/local/lib/libnet11"
;;
*-*-openbsd*)
CFLAGS="${CFLAGS} -D__OpenBSD__"
CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet-1.1"
LDFLAGS="${LDFLAGS} -L/usr/local/lib -I/usr/local/lib/libnet-1.1"
;;
*darwin*|*Darwin*)
CFLAGS="${CFLAGS} -D__Darwin__"
CPPFLAGS="${CPPFLAGS} -I/opt/local/include"
LDFLAGS="${LDFLAGS} -L/opt/local/lib"
;;
*-*-linux*)
CFLAGS="${CFLAGS} -D__Linux__"
#for now do nothing
;;
# *-*-mingw32*)
# CFLAGS="${CFLAGS} -DOS_WIN32"
# LDFLAGS="${LDFLAGS} -lws2_32"
# WINDOWS_PATH="yes"
# ;;
# *-*-cygwin)
# WINDOWS_PATH="yes"
# ;;
# *-*-solaris*)
# AC_MSG_WARN([support for Solaris/Illumos/SunOS is experimental])
# LDFLAGS="${LDFLAGS} -lsocket -lnsl"
# ;;
*)
AC_MSG_WARN([unsupported OS this may or may not work])
;;
esac
AC_MSG_RESULT(ok)
AC_ARG_ENABLE(tcmalloc,
[ --enable-tcmalloc Enable TCMalloc support.],
[ TCMALLOC="$enableval"],
[ TCMALLOC="no" ]
)
AC_ARG_ENABLE(jemalloc,
[ --enable-jemalloc Enable Jemalloc support.],
[ JEMALLOC="$enableval"],
[ JEMALLOC="no" ]
)
AC_SUBST(VERSION)
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_HEADER(config.h)
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_LANG_C
AC_PROG_MAKE_SET
AM_PROG_CC_C_O
PKG_PROG_PKG_CONFIG
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([stdio.h stdlib.h stdint.h inttypes.h errno.h string.h getopt.h stdarg.h stdbool.h arpa/inet.h netinet/in.h])
AC_CHECK_SIZEOF([size_t])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_TIME
# Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STAT
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_FUNC_FORK
AC_FUNC_REALLOC
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
AM_PROG_AS
AC_CHECK_FUNCS([strchr strcmp strlen sizeof snprintf strlcat strlcpy getopt_long htons strspn memset strerror])
if test "$TCMALLOC" = "yes"; then
AC_MSG_RESULT([------- TCMalloc support is enabled -------])
AC_CHECK_LIB(tcmalloc_minimal,main,,AC_MSG_ERROR(The libtcmalloc_minimal library cannot be found.))
fi
if test "$JEMALLOC" = "yes"; then
AC_MSG_RESULT([------- Jemalloc support is enabled -------])
AC_CHECK_LIB(jemalloc,main,,AC_MSG_ERROR(The libjemalloc library cannot be found.))
fi
AC_DEFINE_UNQUOTED(PACKAGE_NAME, "grabip" )
AC_DEFINE_UNQUOTED(PACKAGE_STRING, "grabip $VERSION")
AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "[email protected]" )
AC_DEFINE_UNQUOTED(PACKAGE_TARNAME, "grabip" )
AC_DEFINE_UNQUOTED(PACKAGE_VERSION, "$VERSION" )
CFLAGS="$CFLAGS -fPIC"
LDFLAGS="$LDFLAGS -Wl,--no-relax"
AC_CONFIG_FILES([ \
Makefile \
src/Makefile])
# AC_OUTPUT(Makefile)
AC_OUTPUT
AC_MSG_RESULT([])
AC_MSG_RESULT([Grab-IP is configured! Now type 'make'])
AC_MSG_RESULT([])