-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.in
223 lines (191 loc) · 7.04 KB
/
configure.in
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
AC_INIT(src/rateup.c)
AC_PREREQ(2.13)
dnl Check for programs.
AC_PROG_CC
AC_PREFIX_DEFAULT( /usr/local/mrtg-2 )
AC_PROG_CPP
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PATH_PROG(PERL, perl, no, $PATH:/usr/bin:/usr/local/bin)
if test $PERL = no; then
echo
echo "** No Perl found in the PATH. A recent copy of Perl"
echo " is required for mrtg to work. Check www.perl.com"
echo
exit 1
fi
AC_PATH_PROGS(NROFF, groff nroff)
dnl Check for long long type (64 bit rateup)
AC_CHECK_HEADERS(inttypes.h)
AC_CHECK_TYPE(unsigned long long)
AC_CHECK_TYPE(long long)
AC_CHECK_FUNCS(strtoll)
# Taken from libIDL-0.8.2
AC_MSG_CHECKING([for printf long long format specifier])
AC_CACHE_VAL(mr_cv_long_long_format_specifier,[
for format in ll l q I64; do
AC_TRY_RUN([#include <stdio.h>
int main()
{
long long b, a = -0x3AFAFAFAFAFAFAFALL;
char buffer[1000];
sprintf (buffer, "%${format}u", a);
sscanf (buffer, "%${format}u", &b);
exit (b!=a);
}
],
mr_cv_long_long_format_specifier="%${format}d"
mr_cv_long_long_format="${format}d"
break)
done])
AC_MSG_RESULT($mr_cv_long_long_format_specifier)
AC_DEFINE_UNQUOTED(LLD, "$mr_cv_long_long_format_specifier",
[How to print a long long])
AC_DEFINE_UNQUOTED(LLD_FORMAT, "$mr_cv_long_long_format",
[long long format without % specifier])
AH_BOTTOM(
#ifndef HAVE_STRTOLL
long long int strtoll(const char *str, char **ptr, int base)
{
long long int ll;
sscanf(str, LLD, &ll);
return ll;
}
#endif
)
dnl Checks for libraries.
AC_CHECK_LIB(m, pow, [ MATHLIBS="-lm" ])
AC_ARG_WITH(gd,[ --with-gd=DIR location of the gd lib/inc],
[LDFLAGS="${LDFLAGS} -L${withval}"
CPPFLAGS="${CPPFLAGS} -I${withval}"
LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"])
AC_ARG_WITH(gd-lib,[ --with-gd-lib=DIR location of the gd library],
[LDFLAGS="${LDFLAGS} -L${withval}"
LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"])
AC_ARG_WITH(gd-inc,[ --with-gd-inc=DIR location of the gd include files],
[CPPFLAGS="${CPPFLAGS} -I${withval}"])
AC_ARG_WITH(z,[ --with-z=DIR location of zlib lib/inc],
[LDFLAGS="${LDFLAGS} -L${withval}"
CPPFLAGS="${CPPFLAGS} -I${withval}"
LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"])
AC_ARG_WITH(z-lib,[ --with-z-lib=DIR location of zlib library],
[LDFLAGS="${LDFLAGS} -L${withval}"
LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"])
AC_ARG_WITH(z-inc,[ --with-z-inc=DIR location of the zlib include files],
[CPPFLAGS="${CPPFLAGS} -I${withval}"])
AC_ARG_WITH(png,[ --with-png=DIR location of png lib/inc],
[LDFLAGS="${LDFLAGS} -L${withval}"
CPPFLAGS="${CPPFLAGS} -I${withval}"
LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"])
AC_ARG_WITH(png-lib,[ --with-png-lib=DIR location of png library],
[LDFLAGS="${LDFLAGS} -L${withval}"
LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"])
AC_ARG_WITH(png-inc,[ --with-png-inc=DIR location of the libpng include files],
[CPPFLAGS="${CPPFLAGS} -I${withval}"])
LIBS="${LIBS} ${MATHLIBS}"
GDEXTRALIB=""
dnl which version of gd do we have here ?
AC_CHECK_LIB(gd,gdImageGif,[
GDFORM_EXT=gif
GLIBS="-lgd"
],:,[-lgd ${MATHLIBS}])
AC_CHECK_LIB(gd,gdImagePng,[
GDFORM_EXT=png
GLIBS="-lgd -lpng -lz"
],:,[-lgd -lpng -lz ${MATHLIBS}])
AC_CHECK_LIB(gd,gdImagePng_jpg,[
GDFORM_EXT=png
GLIBS="-lgd -lpng -lz -ljpeg"
],:,[-lgd -lpng -lz -ljpeg ${MATHLIBS}])
AC_CHECK_LIB(gd,gdImagePng_jpg_ft,[
GDFORM_EXT=png
GLIBS="-lgd -lpng -lz -ljpeg -lfreetype"
],:,[-lgd -lpng -lz -ljpeg -lfreetype ${MATHLIBS}])
if test x$GDFORM_EXT = xgif; then
CPPFLAGS="$CPPFLAGS -DGFORM_GD=gdImageGif"
fi
LIBS="${GLIBS} ${LIBS}"
if test x$LD_RUN_PATH != x; then
SET_LD_RUN_PATH="LD_RUN_PATH=${LD_RUN_PATH}"
fi
dnl Make sure the header is here
AC_CHECK_HEADER( gd.h,:,[ GDFORM_EXT="" ])
if test x$GDFORM_EXT = x; then
echo
echo "** Ooops, one of many bad things happened:"
echo ""
echo " a) You don't have the GD library installed."
echo " Get it from http://www.boutell.com, compile it and"
echo " use either --with-gd-lib=DIR and --with-gd-inc=DIR to specify"
echo " its location. You might also have to use --with-z-inc,"
echo " --with-z-lib and --with-png-inc, --with-png-lib for gd"
echo " versions 1.6 and higher. Check config.log for more"
echo " information on the problem."
echo ""
echo " b) You have the GD library installed, but not the gd.h"
echo " header file. Download the source (see above) and use"
echo " --with-gd-inc=DIR to specify where the file can be found."
echo ""
echo " c) You have the library and the header file installed, but"
echo " you also have a shared GD library in the same directory. "
echo " Remove the shared library files and/or links (e.g. "
echo " libgd.so.2.0.0, libgd.so and libgd.so.2). This is especially"
echo " likely if you're using a recent (post 1.8.4) version of GD"
echo " and didn't configure it with --disable-shared."
echo ""
echo " d) You have gd library installed and also it's headers, but you are"
echo " missing libpng (and headers) or freetype (and headers)"
echo " (mrtg does not use freetype, but if your copy of gd is precompiled"
echo " against it, you have to install it ... "
echo ""
echo " Consider following the instructions in doc/mrtg-unix-guide.txt"
exit 1
fi
AC_MSG_CHECKING(the weather)
AC_MSG_RESULT((cached) it's fine)
dnl Does the compiler like -Wall and
if test "x$GCC" = "xyes"; then
oCFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wcast-align -Wmissing-declarations -Wnested-externs -Winline -W"
AC_CACHE_CHECK(if we can use GCC-specific compiler options, rd_cv_gcc_opt,
[AC_TRY_COMPILE( , return 0 ,
rd_cv_gcc_opt=yes,
rd_cv_gcc_opt=no )
]
)
if test $rd_cv_gcc_opt = no; then
CFLAGS=$oCFLAGS
fi
fi
AC_SUBST(PERL)
AC_SUBST(RRD_PERL)
AC_SUBST(GDFORM_EXT)
AC_SUBST(SET_LD_RUN_PATH)
AC_SUBST(LIBS)
AC_SUBST(CFLAGS)
AC_CONFIG_HEADERS(config.h)
AC_OUTPUT(Makefile)
echo $ECHO_N "ordering CD from http://tobi.oetiker.ch/wish $ECHO_C" 1>&6
sleep 1
echo $ECHO_N ".$ECHO_C" 1>&6
sleep 1
echo $ECHO_N ".$ECHO_C" 1>&6
sleep 1
echo $ECHO_N ".$ECHO_C" 1>&6
sleep 1
echo $ECHO_N ".$ECHO_C" 1>&6
sleep 1
AC_MSG_RESULT([ just kidding ;-)])
sleep 2
echo
echo "----------------------------------------------------------------"
echo "Config is DONE!"
echo
echo "Type 'make' to compile the software"
echo
echo " ... that wishlist mentioned above does really exist. So if"
echo "you feel like showing your appreciation for MRTG, this is the"
echo "place to go. I just love CDs and DVDs"
echo
echo " -- Tobi Oetiker <[email protected]>"
echo "----------------------------------------------------------------"