File: config_os_libs2

package info (click to toggle)
net-snmp 5.9+dfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 36,760 kB
  • sloc: ansic: 283,039; perl: 17,712; sh: 11,887; makefile: 2,705; xml: 663; python: 623; pascal: 62; sql: 47
file content (596 lines) | stat: -rw-r--r-- 19,133 bytes parent folder | download
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
# -*- autoconf -*-
#########################################
##
# Checks for libraries that are run
# after the agent module tests.
##
#########################################

#   HAVE_LIB Definitions used in the Net-SNMP code base:
#
#       HAVE_LIBCRYPTO:	apps
#       HAVE_LIBRPM:	agent
#

##
#   Simple checks:
##

#   ELF libraries
#       Typically used for 'nlist'  (needed for uptime)
#
if test "x$with_elf" != "xno"; then
case $target_os in
	linux*) # add hosts which don't use nlist here
                ;;
	irix*) # Check for nlist in mld (irix)
		AC_CHECK_LIB(elf, nlist)
		AC_CHECK_LIB(elf, nlist64)
		AC_CHECK_LIB(mld, nlist)
		;;
	*) # default
		AC_CHECK_LIB(elf, nlist)
		;;
esac
fi
 

#   libsocket
#       Needed for 'socket(2)'                          (Solaris)
#       Possibly also for 'gethostname(3)'              (non-Solaris)
#           (alternatively in libnsl                    (Solaris)
#            or in libws2_32)                           (MinGW)
#
case x$with_socklib in
xwinsock2)
  #   libws2_w32                                        (MinGW)
  #
  netsnmp_save_LIBS="$LIBS"
  LIBS="$LIBS -lws2_32"
  AC_LINK_IFELSE([AC_LANG_PROGRAM([
    #include <winsock2.h>
  ], [
    socket(0, 0, 0);
    gethostbyname(0);
  ])], [
    # Keep LIBS.
    true
  ], [
    # Restore LIBS and complain.
    LIBS="$netsnmp_save_LIBS"
    AC_MSG_ERROR([libws2_32 not found.])
  ])
  ;;
*)
  AC_SEARCH_LIBS(socket, socket,,AC_MSG_ERROR([socket(2) not found.]))
  AC_SEARCH_LIBS(gethostbyname, [nsl socket])
  AC_CHECK_FUNCS(gethostbyname)
  AC_SEARCH_LIBS(gethostbyaddr, [nsl socket])
  AC_CHECK_FUNCS(gethostbyaddr)
  ;;
esac


#   libiphlpapi                                         (Cygwin and MinGW)
#
netsnmp_save_LIBS="$LIBS"
LIBS="$LIBS -liphlpapi"
AC_LINK_IFELSE([AC_LANG_PROGRAM([
  #include <winsock2.h>
  #include <iphlpapi.h>
], [
  IpRenewAddress(0);
])], [
  # Keep LIBS.
  true
], [
  # Restore LIBS and complain.
  LIBS="$netsnmp_save_LIBS"
  case x$with_socklib in
  xwinsock2)
    AC_MSG_ERROR([libiphlpapi not found.])
    ;;
  esac
])

AC_MSG_CHECKING([for MIB_IF_TABLE2])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
  #define _WIN32_WINNT 0xffff
  #include <winsock2.h>
  #include <ws2tcpip.h>
  #include <iphlpapi.h>
],[
  return sizeof(MIB_IF_TABLE2)
])],[
  AC_MSG_RESULT([yes])
  AC_DEFINE([HAVE_MIB_IF_TABLE2], 1,
    [Define if MIB_IF_TABLE2 is available])],
  [AC_MSG_RESULT([no])])


#   libregex                                            (MinGW)
#
netsnmp_save_LIBS="$LIBS"
LIBS="$LIBS -lregex"
AC_LINK_IFELSE([AC_LANG_PROGRAM([
  #include <sys/types.h>
  #include <regex.h>
], [
  regcomp(0, 0, 0);
])], [
  # Keep LIBS.
  true
], [
  # Restore LIBS.
  LIBS="$netsnmp_save_LIBS"
])


#   libsnmpapi                                          (MinGW)
#
netsnmp_save_LIBS="$LIBS"
LIBS="$LIBS -lsnmpapi"
AC_LINK_IFELSE([AC_LANG_PROGRAM([
  #include <snmp.h>
], [
  SnmpUtilMemAlloc(0);
])], [
  # Keep LIBS.
  true
], [
  # Restore LIBS.
  LIBS="$netsnmp_save_LIBS"
])


#   kstat library                                       (Solaris)
#
AC_CHECK_LIB(kstat, kstat_lookup, [LNETSNMPLIBS="$LNETSNMPLIBS -lkstat"])


#   socket library                                      (Solaris)
#
AC_CHECK_LIB(socket, in6addr_any, [LNETSNMPLIBS="$LNETSNMPLIBS -lsocket"])


#
#   librt
#

NETSNMP_SEARCH_LIBS(clock_gettime, rt,
        AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
                [Define to 1 if you have the `clock_gettime' library]),,,
        LNETSNMPLIBS)


##
#   MIB-module-specific checks
##

#   libdevstat
#        (for diskIO MIB)
#
#   Not-Used: HAVE_GETDEVS/HAVE_DEVSTAT_GETDEVS
#
echo " $module_list " | $GREP " ucd-snmp/diskio " >/dev/null
if test $? -eq 0 ; then
	NETSNMP_SEARCH_LIBS(getdevs, devstat,
                AC_DEFINE(HAVE_GETDEVS, 1,
                        [define if you have getdevs()]),,,LMIBLIBS)
	NETSNMP_SEARCH_LIBS(devstat_getdevs, devstat,
                AC_DEFINE(HAVE_DEVSTAT_GETDEVS, 1,
                        [define if you have devstat_getdevs()]),,,LMIBLIBS)
fi

#   libpci
#        (for if-mib description)
#
NETSNMP_SEARCH_LIBS(pci_lookup_name, pci,
	AC_DEFINE(HAVE_PCI_LOOKUP_NAME, 1,
		[define if you have pci_lookup_name()]),,,LMIBLIBS)

#   LM-SENSORS-MIB support
#
echo " $module_list " | $GREP -i "ucd-snmp/lmsensor" > /dev/null
if test $? -eq 0 ; then
        AC_MSG_CHECKING([for sensors support])
        case $target_os in
        solaris*)
            #  Agent:  HAVE_PICL_H
            #
            AC_CHECK_HEADER(picl.h, LMIBLIBS="${LMIBLIBS} -lpicl",)
            AC_CHECK_HEADERS(picl.h)
            ;;
        *)
            #  Not-Used:  HAVE_SENSORS_SENSORS_H
            #
            AC_CHECK_HEADER(sensors/sensors.h,,
                [AC_MSG_ERROR([asked to use lm_sensors but I couldn't find sensors/sensors.h])])
            NETSNMP_SEARCH_LIBS(sensors_get_detected_chips, sensors,,
                [AC_MSG_ERROR([asked to use lm_sensors but I couldn't find -lsensors])],,
                LMIBLIBS)
            ;;
        esac
fi

#
# libnl (netlink)
#

if test "x$with_nl" != "xno"; then
    case $target_os in
    linux*) # Check for libnl (linux)
        # The test below verifies whether the libnl-3 package been installed.
        # This test works as follows:
        # - If pkg-config was not installed at the time autogen.sh was run,
        #   the definition of the PKG_CHECK_EXISTS() macro will not be found by
        #   autogen.sh. Augogen.sh will generate a configure script that prints
        #   a warning about pkg-config and proceeds as if libnl-3 has not been
        #   installed.
        # - If pkg-config was installed at the time autogen.sh was run,
        #   the generated configure script will try to detect the presence of
        #   the libnl-3 library by looking up compile and linker flags in the
        #   file called libnl-3.pc.
        # - pkg-config settings can be overridden via the configure variables
        #   LIBNL3_CFLAGS and LIBNL3_LIBS (added by the pkg-config m4 macro's to
        #   the configure script -- see also ./configure --help).
        # - The LIBNL3_CFLAGS and LIBNL3_LIBS configure variables can be used
        #   even if the pkg-config executable is not present on the system on
        #   which the configure script is run.
        ifdef(
          [PKG_CHECK_EXISTS],
          [PKG_CHECK_EXISTS([libnl-3.0],
            [PKG_CHECK_MODULES([LIBNL3], [libnl-3.0])])
          ],
          AC_MSG_WARN([pkg-config has not been installed or is too old.])
          AC_MSG_WARN([Detection of libnl-3.0 will be skipped.])
        )

        netsnmp_save_CPPFLAGS="$CPPFLAGS"
        CPPFLAGS="${LIBNL3_CFLAGS} $CPPFLAGS"
        NETSNMP_SEARCH_LIBS(nl_connect, nl-3,
            [AC_CHECK_HEADERS(netlink/netlink.h)
            EXTERNAL_MIBGROUP_INCLUDES="$EXTERNAL_MIBGROUP_INCLUDES ${LIBNL3_CFLAGS}"],
            [CPPFLAGS="$netsnmp_save_CPPFLAGS"], [], [LMIBLIBS])
        if test "x$ac_cv_header_netlink_netlink_h" != xyes; then
            NETSNMP_SEARCH_LIBS(nl_connect, nl, [
                AC_CHECK_HEADERS(netlink/netlink.h)], [], [], LMIBLIBS)
        fi
        if test "x$ac_cv_header_netlink_netlink_h" = xyes; then
            AC_EGREP_HEADER([nl_socket_free], [netlink/socket.h],
                            [AC_DEFINE([HAVE_LIBNL3], [1],
                            [Define to 1 if <netlink/netlink.h> provides the
                            libnl3 API])])
        fi
    ;;
    esac
fi



##
#   More complex checks:
##

#   Security related functions
#
NONAGENTLIBS=$LIBS	 # save old libraries
SSHPROG=no
TLSPROG=no
if test "x$tryopenssl" != "xno" -a "x$tryopenssl" != "xinternal"; then
    # check for libpkcs11 if asked
    if test "x$askedopenssl" != "xyes" -a "x$askedpkcs" = "xyes"; then
        AC_CHECK_LIB(pkcs11, C_Initialize,
            AC_DEFINE(HAVE_LIBPKCS11, 1,
                [Define to 1 if you have the `pkcs11' library (-lpkcs11).])
		LIBPKCS11="-lpkcs11")
    else 
        if test "x$tryrsaref" != "xno"; then
            AC_CHECK_LIB(rsaref, RSAPrivateDecrypt)
            AC_CHECK_LIB(RSAglue, RSA_PKCS1_RSAref)
        fi

        AC_MSG_CHECKING([for -leay32])
        netsnmp_save_LIBS="$LIBS"
        LIBS="-leay32"
        AC_LINK_IFELSE([AC_LANG_PROGRAM([
                #include <openssl/evp.h>],
                [return EVP_md5();])],
            [AC_MSG_RESULT(yes); ac_cv_lib_eay32_EVP_md5=yes; CRYPTO="eay32"],
            [AC_MSG_RESULT(no)]
        )
        LIBS="$netsnmp_save_LIBS"

        if test x$CRYPTO = x; then
            AC_CHECK_LIB([crypto], [EVP_md5], [CRYPTO="crypto"])
        fi

        if test x$CRYPTO != x; then
            AC_DEFINE(HAVE_LIBCRYPTO, 1,
                [Define to 1 if you have the OpenSSL library (-lcrypto or -leay32).])
            LIBCRYPTO="-l${CRYPTO}"
            netsnmp_save_LIBS="$LIBS"
            LIBS="$LIBCRYPTO"
            AC_CHECK_FUNCS([AES_cfb128_encrypt]dnl
                           [EVP_sha224        EVP_sha384        ]dnl
                           [EVP_MD_CTX_create EVP_MD_CTX_destroy]dnl
                           [EVP_MD_CTX_new    EVP_MD_CTX_free   ]dnl
                           [DH_set0_pqg DH_get0_pqg DH_get0_key]dnl
                           [ASN1_STRING_get0_data X509_NAME_ENTRY_get_object]dnl
                           [X509_NAME_ENTRY_get_data X509_get_signature_nid])
            AC_MSG_CHECKING([whether 2nd app_verify_cookie_cb() arg is const])
            netsnmp_save_CFLAGS="$CFLAGS"
            CFLAGS="$CFLAGS -Werror"
            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
              #include <openssl/ssl.h>
            ]],[[
              int (*app_verify_cookie_cb)(SSL *ssl,
                                          const unsigned char *cookie,
                                          unsigned int cookie_len) = NULL;
              SSL_CTX_set_cookie_verify_cb(NULL, app_verify_cookie_cb);
            ]])],
            [AC_MSG_RESULT(yes); ac_cv_saccaq=const],
            [AC_MSG_RESULT(no)])
            AC_DEFINE_UNQUOTED([SECOND_APPVERIFY_COOKIE_CB_ARG_QUALIFIER],
                               [$ac_cv_saccaq],
                               [Qualifier for second argument of the appverify_cookie_cb() callback function])
            CFLAGS="$netsnmp_save_CFLAGS"
            LIBS="$netsnmp_save_LIBS"
        fi
        netsnmp_save_LIBS="$LIBS"
        LIBS="-lssl"
        AC_CHECK_FUNCS([TLS_method TLSv1_method DTLS_method DTLSv1_method]dnl
                       [SSL_library_init SSL_load_error_strings]dnl
		       [ERR_get_error_all])
        LIBS="$netsnmp_save_LIBS"
        if echo " $transport_result_list " | $GREP "DTLS" > /dev/null; then
	    if test x$ac_cv_func_DTLSv1_method = xyes -o \
                    x$ac_cv_func_DTLS_method = xyes; then
                AC_DEFINE(HAVE_LIBSSL_DTLS, 1,
                    [Define to 1 if your `ssl' library supports DTLS (-lssl).])
                LIBCRYPTO=" -lssl $LIBCRYPTO"
	    else
		AC_MSG_ERROR([The DTLS based transports require the libssl library from OpenSSL to be available and support DTLS])
            fi
            TLSPROG=yes
        fi
        if echo " $transport_result_list " | $GREP "TLS" > /dev/null; then
	    if test x$ac_cv_func_TLSv1_method = xyes -o \
                    x$ac_cv_func_TLS_method = xyes; then
                AC_DEFINE(HAVE_LIBSSL, 1,
                    [Define to 1 if you have the `ssl' library (-lssl).])
                LIBCRYPTO=" -lssl $LIBCRYPTO"
            else
		AC_MSG_ERROR([The TLS based transports require the libssl library from OpenSSL to be available])
            fi
            TLSPROG=yes
        fi
        if echo " $transport_result_list " | $GREP " SSH " > /dev/null; then
	    AC_CHECK_LIB(ssh2, libssh2_session_startup,
                AC_DEFINE(HAVE_LIBSSH2, 1,
                    [Define to 1 if you have the `ssh2' library (-lssh2).])
                LIBCRYPTO=" -lssh2 $LIBCRYPTO",
                AC_MSG_ERROR([The SSH transport requires the libssh2 library to be available]),)
            SSHPROG=yes
        fi
    fi
elif test "x$askedpkcs" = "xyes"; then
    AC_CHECK_LIB(pkcs11, C_Initialize,
        AC_DEFINE(HAVE_LIBPKCS11)
        LIBPKCS11="-lpkcs11")
fi

LIBS=$NONAGENTLIBS	 # restore old libraries
if test "x$SSHPROG" = "xyes"; then
    NETSNMP_BUILD_SSH_PROG_TRUE=''
    NETSNMP_BUILD_SSH_PROG_FALSE='#'
else
    NETSNMP_BUILD_SSH_PROG_TRUE='#'
    NETSNMP_BUILD_SSH_PROG_FALSE=''
fi
if test "x$TLSPROG" = "xyes" -a "x$enable_read_only" != "xyes" ; then
    NETSNMP_BUILD_TLS_PROG_TRUE=''
    NETSNMP_BUILD_TLS_PROG_FALSE='#'
else
    NETSNMP_BUILD_TLS_PROG_TRUE='#'
    NETSNMP_BUILD_TLS_PROG_FALSE=''
fi
if echo " ${security_mod_list} " | grep ' usm ' ; then
    if test "x$enable_read_only" != "xyes" ; then
    	NETSNMP_BUILD_USM_PROG_TRUE=''
    	NETSNMP_BUILD_USM_PROG_FALSE='#'
    else
    	NETSNMP_BUILD_USM_PROG_TRUE='#'
    	NETSNMP_BUILD_USM_PROG_FALSE=''
    fi
else
    NETSNMP_BUILD_USM_PROG_TRUE='#'
    NETSNMP_BUILD_USM_PROG_FALSE=''
fi
if test "x$enable_read_only" != "xyes" ; then
    NETSNMP_BUILD_SET_PROG_TRUE=""
    NETSNMP_BUILD_SET_PROG_FALSE="#"
else
    NETSNMP_BUILD_SET_PROG_TRUE="#"
    NETSNMP_BUILD_SET_PROG_FALSE=""
fi
AC_SUBST(NETSNMP_BUILD_SSH_PROG_TRUE)
AC_SUBST(NETSNMP_BUILD_SSH_PROG_FALSE)
AC_SUBST(NETSNMP_BUILD_TLS_PROG_TRUE)
AC_SUBST(NETSNMP_BUILD_TLS_PROG_FALSE)
AC_SUBST(NETSNMP_BUILD_USM_PROG_TRUE)
AC_SUBST(NETSNMP_BUILD_USM_PROG_FALSE)
AC_SUBST(NETSNMP_BUILD_SET_PROG_TRUE)
AC_SUBST(NETSNMP_BUILD_SET_PROG_FALSE)

#
# If we're using internal crypto support we need to compile in extra files
#
crypto_files_c=""
crypto_files_o=""
crypto_files_lo=""
if test "x$tryopenssl" != "xno" -a "x$CRYPTO" = "x"; then
   # If we:
   #   1) couldn't find needed openssl support
   #   2) OR were asked to use internal support
   #   3) AND we have the needed files
   # then use it
   CRYPTO="internal"
   crypto_files_c="openssl/openssl_sha1.c openssl/openssl_md5.c openssl/openssl_set_key.c openssl/openssl_des_enc.c openssl/openssl_cbc_enc.c openssl/openssl_aes_cfb.c openssl/openssl_aes_core.c openssl/openssl_cfb128.c"
   crypto_files_o="openssl/openssl_sha1.o openssl/openssl_md5.o openssl/openssl_set_key.o openssl/openssl_des_enc.o openssl/openssl_cbc_enc.o openssl/openssl_aes_cfb.o openssl/openssl_aes_core.oo openssl/openssl_cfb128.o"
   crypto_files_lo="openssl/openssl_sha1.lo openssl/openssl_md5.lo openssl/openssl_set_key.lo openssl/openssl_des_enc.lo openssl/openssl_cbc_enc.lo openssl/openssl_aes_cfb.lo openssl/openssl_aes_core.lo openssl/openssl_cfb128.lo"
   AC_DEFINE(HAVE_AES_CFB128_ENCRYPT)
fi
AC_SUBST(crypto_files_c)
AC_SUBST(crypto_files_o)
AC_SUBST(crypto_files_lo)

#
# if we can do any sort of crypto then note it
#
if test "x$CRYPTO" != "x" ; then
  AC_DEFINE(NETSNMP_CAN_DO_CRYPTO, 1, "Define if crytography support is possible")
fi

#   TCP wrapper support
#
_cppflags="${CPPFLAGS}"
_ldflags="${LDFLAGS}"
if test "$with_libwrap" != "no"; then
  if test "$with_libwrap" != "yes"; then
    CPPFLAGS="${CPPFLAGS} -I$with_libwrap/include"
    LDFLAGS="${LDFLAGS} -L$with_libwrap/lib"
  fi

  _libs=${LIBS}
  AC_CHECK_HEADER(tcpd.h, ,
    AC_MSG_ERROR([Asked to use libwrap but I couldn't find tcpd.h.]))

  LIBS="$LIBS -lwrap"
  AC_MSG_CHECKING([for TCP wrappers library -lwrap])
  # XXX: should check for hosts_ctl
  AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
     #include <tcpd.h>
     int allow_severity = 0;
     int deny_severity  = 0;]],
    [[hosts_access((void *)0)]])],
    [AC_MSG_RESULT([yes])
     AC_DEFINE(NETSNMP_USE_LIBWRAP)
     test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap/lib"
     _wraplibs="$_wraplibs -lwrap"],
    [AC_MSG_RESULT([no])
     # Linux RedHat 6.1 won't link libwrap without libnsl
     AC_CHECK_FUNC(yp_get_default_domain, ,
       AC_CHECK_LIB(nsl, yp_get_default_domain))
     AC_MSG_CHECKING([for TCP wrappers library -lwrap linked with -lnsl])
     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
	#include <tcpd.h>
	int allow_severity = 0;
	int deny_severity  = 0;]],
       [[hosts_access((void *)0)]])],
       [AC_MSG_RESULT(yes)
	AC_DEFINE(NETSNMP_USE_LIBWRAP)
	test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap/lib"
	_wraplibs="$_wraplibs -lwrap -lnsl"],
       [AC_MSG_RESULT(no)
	AC_MSG_ERROR(Asked to use libwrap but I couldn't find it.)])])
  LAGENTLIBS="$LAGENTLIBS $_wraplibs"
  CPPFLAGS=${_cppflags}
  LDFLAGS=${_ldflags}
  LIBS=${_libs}
fi


##
#   mysql
##
AS_IF([test "x$with_mysql" = "xyes"],[
  PKG_CHECK_MODULES([MYSQL],[mysqlclient],[
    MYSQL_INCLUDES="$MYSQL_CFLAGS"
  ],[
    AC_PATH_PROGS(MYSQLCONFIG,mysql_config)
    test -x "$MYSQLCONFIG" \
	|| AC_MSG_ERROR([Could not find mysql_config and was specifically asked to use MySQL support])
    MYSQL_LIBS=`$MYSQLCONFIG --libs`
    MYSQL_INCLUDES=`$MYSQLCONFIG --include`
  ])
  _libs="${LIBS}"
  _cppflags="${CPPFLAGS}"
  LIBS="${LIBS} ${MYSQL_LIBS}"
  CPPFLAGS="${CPPFLAGS} ${MYSQL_INCLUDES}"
  AC_CHECK_HEADER(mysql.h,,
     [AC_MSG_ERROR([Could not find mysql.h and was specifically asked to use MySQL support])])
  AC_CHECK_HEADERS([my_global.h my_sys.h])
  AC_MSG_CHECKING([whether MY_INIT() works])
  AC_LINK_IFELSE([
    AC_LANG_PROGRAM(
      [[#ifdef HAVE_MY_GLOBAL_H
        #include <my_global.h>
        #endif
        #ifdef HAVE_MY_SYS_H
        #include <my_sys.h>
        #endif
        #include <mysql.h>]],
      [[MY_INIT("my_init_test")]])],
      [AC_MSG_RESULT(yes)
       AC_DEFINE([HAVE_MY_INIT], 1,
                 [Define if MY_INIT() is availabe in libmysqlclient])],
      [AC_MSG_RESULT(no)])
  AC_MSG_CHECKING([whether my_load_defaults() exists])
  AC_LINK_IFELSE([
    AC_LANG_PROGRAM(
      [[#ifdef HAVE_MY_GLOBAL_H
        #include <my_global.h>
        #endif
        #ifdef HAVE_MY_SYS_H
        #include <my_sys.h>
        #endif
        #include <mysql.h>]],
      [[my_load_defaults("my_init_test")]])],
      [AC_MSG_RESULT(yes)
       AC_DEFINE([HAVE_MY_LOAD_DEFAULTS], 1,
                 [Define if having my_load_defaults()])],
      [AC_MSG_RESULT(no)])
  AC_CHECK_FUNCS([load_defaults mysql_init mysql_options])
  CPPFLAGS="${_cppflags}"
  LIBS="${_libs}"
  AC_MSG_CACHE_ADD(MYSQL Trap Logging:         enabled)
],[
  AC_MSG_CACHE_ADD(MYSQL Trap Logging:         unavailable)
])
AC_SUBST(MYSQL_LIBS)
AC_SUBST(MYSQL_INCLUDES)

##
#   libpcap
##
NETSNMP_BUILD_PCAP_PROG_TRUE='#'
NETSNMP_BUILD_PCAP_PROG_FALSE=''
AC_CHECK_LIB([pcap], [pcap_create], [
   AC_CHECK_HEADERS([pcap/pcap.h], [
      NETSNMP_BUILD_PCAP_PROG_TRUE=''
      NETSNMP_BUILD_PCAP_PROG_FALSE='#'
       ])
])
AC_SUBST(NETSNMP_BUILD_PCAP_PROG_TRUE)
AC_SUBST(NETSNMP_BUILD_PCAP_PROG_FALSE)

##
#   Non-library checks
##

# nlist
AC_CHECK_FUNCS(nlist nlist64 knlist)

NETSNMP_SEARCH_LIBS([endwin], [curses ncurses], [
  AC_CHECK_HEADERS([curses.h])
  AC_CHECK_HEADERS([ncurses/curses.h])
  HAVE_LIBCURSES=TRUE],
  [HAVE_LIBCURSES=FALSE],,
  [LIBCURSES])
AC_SUBST([HAVE_LIBCURSES])
AC_SUBST([LIBCURSES])

#   libm for ceil
#
NETSNMP_SEARCH_LIBS(ceil, m,,,, LNETSNMPLIBS)