Debian Codegraph @

configure.d/config_os_progs

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 # -*- autoconf -*-
2 #########################################
3 ##
4 # Checks for programs
5 ##
6 #########################################
7
8 ##
9 # Shell checks:
10 ##
11
12 # Check for 'sh' overflow (HP-UX)
13 # (taken from Perl's configure script)
14 #
15 AC_MSG_CHECKING([if I need to feed myself to ksh])
16 if test -f /hp-ux -a -f /bin/ksh; then
17 if (PATH=.; alias -x) >/dev/null 2>&1; then
18 AC_MSG_RESULT(no)
19 else
20 AC_MSG_RESULT(yes)
21 if test "x$1" = "x"; then
22 exec /bin/ksh $0
23 else
24 exec /bin/ksh $0 "$@"
25 fi
26 fi
27 else
28 AC_MSG_RESULT(no)
29 fi
30
31
32 ##
33 # Standard and path program checks:
34 ##
35
36 AC_PROG_EGREP
37 AC_PROG_GREP
38 AC_PROG_INSTALL
39 AC_PROG_LN_S
40 AC_PROG_MAKE_SET
41 AC_PROG_SED
42
43 AC_CHECK_PROGS([FILE], [file])
44 if test x$ac_cv_prog_FILE = x; then
45 # The file program is not included in the default Cygwin setup, although
46 # this program is essential for libtool to work properly. It is nontrivial
47 # to deduce from the message printed by libtool that the 'file' tool is
48 # missing and libtool does not abort when the file program is not found. So
49 # stop now if the file program has not been found.
50 AC_MSG_ERROR([file program not found although it is needed by libtool.], [1])
51 fi
52
53 AC_CHECK_PROGS(FIND, find)
54 AC_CHECK_PROGS(WHOAMI, whoami logname, whoami)
55
56 AC_PATH_PROG(AUTOCONF, autoconf, [:])
57 AC_PATH_PROG(AUTOHEADER, autoheader, [:])
58 AC_PATH_PROG([PERLPROG], perl)
59 AC_PATH_PROG([PSPROG], ps)
60 AC_PATH_PROG([PYTHONPROG],python3)
61
62 AC_PATH_PROG([UNAMEPROG], uname)
63 AC_DEFINE_UNQUOTED(UNAMEPROG,"$UNAMEPROG", [Where is the uname command])
64
65 MAKE=${MAKE-"make"}
66 $MAKE -v -f /dev/null 2>/dev/null | $GREP GNU >/dev/null
67 have_gnu_make=$?
68
69
70 ##
71 # The Perl function system() is used for running the Net-SNMP regression
72 # tests. Find out whether that function invokes a POSIX shell, which is
73 # necessary in order to run the regression tests. When using Windows + MSYS
74 # + ActiveState Perl, Perl's system() function does invoke Windows' cmd.exe
75 # which is not a POSIX shell.
76 ##
77
78 AC_MSG_CHECKING([whether the Perl function system() invokes a POSIX shell])
79 if test "x$PERLPROG" != 'x' && test -x "$PERLPROG" && test "x`$PERLPROG -e 'system('\''echo $OSTYPE'\'');'`" != 'x$OSTYPE'; then
80 PERL_SYSTEM_INVOKES_POSIX_SHELL=yes
81 else
82 PERL_SYSTEM_INVOKES_POSIX_SHELL=no
83 fi
84 AC_MSG_RESULT([$PERL_SYSTEM_INVOKES_POSIX_SHELL])
85 AC_SUBST([PERL_SYSTEM_INVOKES_POSIX_SHELL])
86
87
88 ##
89 # Compilation-related program checks:
90 ##
91
92 AC_LANG([C])
93 AC_PROG_CC
94 AC_PROG_CPP
95 LINKCC=${LINKCC-"$CC"}
96 AC_SUBST(LINKCC)
97
98 AC_C_CONST
99 AC_C_INLINE
100
101 # libtool stuff for shared/static libraries.
102 #
103 LT_PREREQ([2.2.6])
104 LT_INIT([win32-dll])
105 LT_LANG([Windows Resource])
106 AC_SUBST(LIBTOOL_DEPS)
107
108
109 ##
110 # Build environment:
111 ##
112
113 # developer build
114 # (enabled by default when building from SVN checkout)
115 #
116 if test "x$developer" != "xno" -a -f $srcdir/remove-files; then
117 developer="yes"
118 fi
119 if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then
120 AC_MSG_CHECKING([for developer gcc flags])
121 # WWWXXX - strict type checking
122 #
123 netsnmp_save_CFLAGS="$CFLAGS"
124 for opt in -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wcast-qual \
125 -Wimplicit-fallthrough=2 -Wlogical-op -Wundef \
126 -Wno-format-truncation -Wno-missing-field-initializers \
127 -Wno-sign-compare -Wno-unused-parameter -Wcast-function-type
128 do
129 AC_MSG_CHECKING([whether the compiler supports $opt])
130 if test x$opt != x-Wstrict-prototypes; then
131 CFLAGS="-Werror $opt $CFLAGS"
132 else
133 CFLAGS="$opt $CFLAGS"
134 fi
135 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [
136 AC_MSG_RESULT([yes])
137 DEVFLAGS="$DEVFLAGS $opt"
138 ], [
139 AC_MSG_RESULT([no])
140 ])
141 CFLAGS="$netsnmp_save_CFLAGS"
142 done
143 AC_MSG_RESULT($DEVFLAGS)
144
145 for opt in -Werror=declaration-after-statement
146 do
147 AC_MSG_CHECKING([whether the compiler supports $opt])
148 netsnmp_save_CFLAGS="$CFLAGS"
149 if test x$opt != x-Wstrict-prototypes; then
150 CFLAGS="-Werror $opt $CFLAGS"
151 else
152 CFLAGS="$opt $CFLAGS"
153 fi
154 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [
155 AC_MSG_RESULT([yes])
156 CFLAGS="$opt $netsnmp_save_CFLAGS"
157 ], [
158 AC_MSG_RESULT([no])
159 CFLAGS="$netsnmp_save_CFLAGS"
160 ])
161 done
162
163 else
164 DEVFLAGS=""
165 fi
166 AC_SUBST(DEVFLAGS)
167
168
169 # building outside source directory
170 #
171 # a) ensure build include paths are before source
172 # b) ensure GNU make uses 'vpath' instead of 'VPATH'
173 #
174 NON_GNU_VPATH="VPATH ="
175 GNU_vpath="#vpath"
176
177 # define include paths relative to top_srcdir
178 # tweak includes if we're building outside of the source dir
179 #
180 if test "x$srcdir" = "x."; then
181 TOP_INCLUDES=SRC_TOP_INCLUDES
182 SNMPLIB_INCLUDES=SRC_SNMPLIB_INCLUDES
183 AGENT_INCLUDES=SRC_AGENT_INCLUDES
184 HELPER_INCLUDES=SRC_HELPER_INCLUDES
185 MIBGROUP_INCLUDES=SRC_MIBGROUP_INCLUDES
186 else
187 TOP_INCLUDES=BLD_TOP_INCLUDES
188 SNMPLIB_INCLUDES=BLD_SNMPLIB_INCLUDES
189 AGENT_INCLUDES=BLD_AGENT_INCLUDES
190 HELPER_INCLUDES=BLD_HELPER_INCLUDES
191 MIBGROUP_INCLUDES=BLD_MIBGROUP_INCLUDES
192 if test $have_gnu_make -eq 0 ; then
193 NON_GNU_VPATH="#VPATH ="
194 GNU_vpath="vpath"
195 fi
196 fi
197 AC_SUBST(TOP_INCLUDES)
198 AC_SUBST(SNMPLIB_INCLUDES)
199 AC_SUBST(AGENT_INCLUDES)
200 AC_SUBST(HELPER_INCLUDES)
201 AC_SUBST(MIBGROUP_INCLUDES)
202 AC_SUBST(EXTERNAL_MIBGROUP_INCLUDES)
203 AC_SUBST(GNU_vpath)
204 AC_SUBST(NON_GNU_VPATH)
205
206
207 ##
208 # System-related compilation checks:
209 ##
210
211 # What system are we building for
212 #
213 AC_CANONICAL_TARGET
214 changequote(, )
215 PARTIALTARGETOS=`echo $target_os | sed 's/[-._].*//'`
216 changequote([, ])
217 AC_MSG_CACHE_ADD(Building for: $PARTIALTARGETOS)
218
219
220 # Avoid conflicts on Cygwin between <windows.h> and the openssl header files.
221 case x$target_os in
222 xcygwin*|xmingw32*)
223 CPPFLAGS="-DVC_EXTRALEAN -DWIN32_LEAN_AND_MEAN $CPPFLAGS";;
224 esac
225
226
227 #
228 # Whether the linker supports the flag -Wl,-no-undefined. Do not use
229 # -Wl,-no-undefined on OpenBSD because it breaks linking of shared
230 # libraries. Use -Wl,-no-undefined on all other platforms such that
231 # undefined symbols are detected at compile time instead of at runtime.
232 #
233
234 case x$target_os in
235 xopenbsd*)
236 ;;
237 *)
238 if ! echo "$CFLAGS" | grep -q -- -fsanitize=; then
239 saved_LDFLAGS=$LDFLAGS
240 AC_MSG_CHECKING([whether the linker supports -Wl,-no-undefined])
241 LDFLAGS="$saved_LDFLAGS -Wl,-no-undefined"
242 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
243 [AC_MSG_RESULT([yes]); dnl
244 LD_NO_UNDEFINED=-Wl,-no-undefined],
245 [AC_MSG_RESULT([no])])
246 LDFLAGS="$saved_LDFLAGS"
247 AC_SUBST(LD_NO_UNDEFINED)
248 fi
249 ;;
250 esac
251
252
253 #
254 # Socket library: either 'default' (non-MinGW) or 'winsock2' (MinGW).
255 #
256 case x$target_os in
257 xmingw*)
258 with_socklib=winsock2
259 CPPFLAGS="-D_WIN32_WINNT=0xffff -DWIN32 $CPPFLAGS"
260 ;;
261 *)
262 with_socklib=default;;
263 esac
264
265
266 # Check system define behaviour
267 # Does "-Ux -Dx=x" work as expected?
268 #
269 AC_MSG_CHECKING([whether to un-define target system token (before redefining)])
270 OLD_CPPFLAGS="$CPPFLAGS"
271 CPPFLAGS="-U$PARTIALTARGETOS -D$PARTIALTARGETOS=$PARTIALTARGETOS"
272
273 AC_EGREP_CPP(yes,
274 [[
275 #ifdef $PARTIALTARGETOS
276 yes
277 #endif
278 ]],
279 [ PARTIALTARGETFLAGS="-U$PARTIALTARGETOS -D$PARTIALTARGETOS=$PARTIALTARGETOS"
280 AC_MSG_RESULT([yes])],
281 [ PARTIALTARGETFLAGS="-D$PARTIALTARGETOS=$PARTIALTARGETOS"
282 AC_MSG_RESULT([no])])
283 CFLAGS="$CFLAGS $PARTIALTARGETFLAGS"
284 CPPFLAGS="$OLD_CPPFLAGS"
285
286
287 # Determine appropriate <net-snmp/system/{os}.h> include
288 #
289 AC_MSG_CHECKING([for system include file])
290 changequote(, )
291 filebase=$target_os
292 # ignore binary format indication
293 filebase=`echo $filebase | $SED 's/elf//'`
294 filebase=`echo $filebase | $SED 's/aout//'`
295 filebase=`echo $filebase | $SED 's/ecoff//'`
296 filebase=`echo $filebase | $SED 's/coff//'`
297 while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/system/$filebase.h
298 do
299 last=$filebase
300 filebase=`echo $filebase | $SED 's/[-._][^-._]*$//'`
301 if test "x$filebase" = "x$last"; then
302 filebase=`echo $filebase | $SED 's/[0-9]*$//'`
303 fi
304 done
305
306 if test "x$filebase" = "x$last"; then
307 filebase="generic"
308 fi
309 ac_cv_NETSNMP_SYSTEM_INCLUDE_FILE="net-snmp/system/$filebase.h"
310 changequote([, ])
311 AC_MSG_RESULT($ac_cv_NETSNMP_SYSTEM_INCLUDE_FILE)
312 AC_DEFINE_UNQUOTED(NETSNMP_SYSTEM_INCLUDE_FILE, "$ac_cv_NETSNMP_SYSTEM_INCLUDE_FILE")
313
314
315 # Determine appropriate <net-snmp/machine/{cpu}.h> include
316 #
317 AC_MSG_CHECKING([for machine-type include file])
318 changequote(, )
319 filebase=$target_cpu
320 while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/machine/$filebase.h
321 do
322 last=$filebase
323 filebase=`echo $filebase | $SED 's/[-._][^-._]*$//'`
324 done
325
326 if test "x$filebase" = "x$last"; then
327 filebase="generic"
328 fi
329 ac_cv_NETSNMP_MACHINE_INCLUDE_FILE="net-snmp/machine/$filebase.h"
330 changequote([, ])
331 AC_MSG_RESULT([$ac_cv_NETSNMP_MACHINE_INCLUDE_FILE])
332 AC_DEFINE_UNQUOTED(NETSNMP_MACHINE_INCLUDE_FILE, "$ac_cv_NETSNMP_MACHINE_INCLUDE_FILE")
333
334
335 ##
336 # Platform-specific compilation checks:
337 ##
338
339 # Preprocessor checks:
340 #
341
342 # More sensible system identifier (MinGW)
343 #
344 if test "x$PARTIALTARGETOS" = "xmingw32msvc"; then
345 CFLAGS="$CFLAGS -Dmingw32"
346 fi
347
348 # Handle .in file extension (GCC)
349 #
350 AC_MSG_CHECKING([for additional cpp flags])
351 if test "x$GCC" = "xyes" -a "x$CPP" = "x$CC -E"; then
352 EXTRACPPFLAGS="-x c"
353 else
354 EXTRACPPFLAGS=""
355 fi
356
357 # Solaris extra CPP flags (Solaris)
358 #
359 if test "x$GCC" != "xyes"; then
360 case $target_os in
361 solaris*) EXTRACPPFLAGS="$EXTRACPPFLAGS -Xs" ;;
362 esac
363 fi
364
365 AC_SUBST(EXTRACPPFLAGS)
366 AC_MSG_RESULT($EXTRACPPFLAGS)
367
368
369 # Compiler checks:
370 #
371
372 AC_PATH_PROG([CCPATH],$CC)
373 case $target_os in
374 bsdi*)
375 # Check for bundled compiler (BSDi)
376 #
377 if test "x$CCPATH" = "x/usr/ucb/cc" -o "x$CCPATH" = "x/usr/bin/cc"; then
378 AC_MSG_ERROR([
379
380 *** The BSDI /usr/ucb/cc compiler does not work with this package.
381 *** Please run configure with --with-cc=gcc
382 ])
383 fi
384 ;;
385 solaris*)
386 # Check for bundled compiler (Solaris)
387 #
388 if test "x$CCPATH" = "x/usr/ucb/cc"; then
389 AC_MSG_ERROR([
390
391 *** The solaris /usr/ucb/cc compiler does not work with this package.
392 *** Please put a different compiler in your path first or run
393 *** configure with --with-cc=XX, where XX is the compiler you want to use.
394 ])
395 fi
396 ;;
397 esac
398
399
400 # Compiler flags:
401 #
402
403 CFLAGS="-DNETSNMP_REMOVE_U64 $CFLAGS"
404
405 # The Net-SNMP source code is not strict-aliasing safe, so add
406 # -fno-strict-aliasing to $CFLAGS if the compiler supports it.
407 AC_MSG_CHECKING([whether the compiler supports -fno-strict-aliasing])
408 netsnmp_save_CFLAGS="$CFLAGS"
409 CFLAGS="-fno-strict-aliasing $CFLAGS"
410 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [AC_MSG_RESULT([yes])], [
411 AC_MSG_RESULT([no])
412 CFLAGS="$netsnmp_save_CFLAGS"
413 ])
414
415
416 # Linker checks:
417 #
418
419 case $target_os in
420 aix4.2*|aix4.3*|aix5*|aix6*|aix7*)
421 # Runtime linking flags (AIX)
422 #
423 AC_MSG_CHECKING([what linker flags to add to enable runtime linking on AIX])
424 for ld_flag in $LDFLAGS; do
425 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
426 netsnmp_aix_runtimelinking_flags_ok=yes
427 break
428 fi
429 done
430 if test "X$netsnmp_aix_runtimelinking_flags_ok" != "Xyes"; then
431 if test "x$GCC" = "xyes"; then
432 netsnmp_aix_ldflags="-Wl,-brtl"
433 else
434 netsnmp_aix_ldflags="-brtl"
435 fi
436 LDFLAGS="$netsnmp_aix_ldflags $LDFLAGS"
437 AC_MSG_RESULT($netsnmp_aix_ldflags)
438 else
439 AC_MSG_RESULT([none])
440 fi
441 ;;
442
443 darwin*)
444 # Flat Namespace linking (Mac OS/X)
445 #
446 AC_MSG_CHECKING([whether darwin ld might need -flat_namespace])
447 if test -z "$MACOSX_DEPLOYMENT_TARGET"; then
448 saved_LDFLAGS="$LDFLAGS"
449 LDFLAGS="-flat_namespace -framework CoreFoundation -framework CoreServices -framework DiskArbitration -framework IOKit $LDFLAGS"
450 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
451 [AC_MSG_RESULT([yes])],
452 [LDFLAGS="$saved_LDFLAGS"; AC_MSG_RESULT([no])])
453 else
454 AC_MSG_RESULT([no])
455 fi
456 ;;
457
458 *)
459 ;;
460 esac
461
462
463 # dpkg package (swintst_apt)
464 # used in agent only
465 #
466 AC_PATH_PROG([DPKG_QUERY_PATH], dpkg-query)
467 if test x$DPKG_QUERY_PATH != x; then
468 AC_DEFINE(HAVE_DPKG_QUERY, 1, [Set if the dpkg-query command is available])
469 fi
470
471
472 ##
473 # Non-program/compilation checks:
474 ##
475
476 # Substitute version number.
477 #
478 AC_SUBST(VERSION, $PACKAGE_VERSION)
479 AC_MSG_CACHE_ADD(Net-SNMP Version: $PACKAGE_VERSION)
480