~ubuntu-branches/ubuntu/trusty/net-snmp/trusty

« back to all changes in this revision

Viewing changes to configure.in

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-12-08 14:59:50 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20071208145950-u1tykhpw56nyzqik
Tags: 5.4.1~dfsg-4ubuntu1
* Merge from debian unstable.
* Remaining Ubuntu changes:
  - Remove stop links from rc0 and rc6
  - Munge Maintainer field as per spec.
* Ubuntu changes dropped:
  - Symlink common files between the packages, CDBS ought to handle that
    for us automatically.
* The latest Debian changes has dropped history from the changelog. Slot in
  the Ubuntu changes as best I can. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
#
11
11
# Process this file with autoconf to produce a configure script.
12
12
#
13
 
AC_INIT([Net-SNMP], [5.3.1], [net-snmp-coders@lists.sourceforge.net])
 
13
AC_INIT([Net-SNMP], [5.4.1], [net-snmp-coders@lists.sourceforge.net])
14
14
AC_PREREQ([2.59])
15
15
AC_CONFIG_SRCDIR([agent/mibgroup/ucd-snmp/extensible.c])
16
 
AC_REVISION([$Revision: 5.206.2.13 $])
 
16
AC_REVISION([$Revision: 16640 $])
17
17
 
18
18
AC_CONFIG_HEADER(include/net-snmp/net-snmp-config.h)
19
19
 
22
22
#
23
23
# save the configure arguments
24
24
#
25
 
AC_DEFINE_UNQUOTED(CONFIGURE_OPTIONS,"$ac_configure_args")
 
25
AC_DEFINE_UNQUOTED(NETSNMP_CONFIGURE_OPTIONS,"$ac_configure_args")
26
26
CONFIGURE_OPTIONS="\"$ac_configure_args"\"
27
27
AC_SUBST(CONFIGURE_OPTIONS)
28
28
 
34
34
  --with-cc=CC                    use CC to compile (default=gcc).],
35
35
    [CC=$with_cc;export CC])
36
36
 
 
37
AC_ARG_WITH(linkcc, [
 
38
  --with-linkcc=CC                use CC to link (default=gcc).],
 
39
    [LINKCC=$with_linkcc;export LINKCC])
 
40
 
37
41
AC_ARG_WITH(ar,
38
42
[  --with-ar=AR                    use AR as the archiver.],
39
43
    [AR=$with_ar; export AR])
54
58
[  --with-ldflags=LDFLAGS          use LDFLAGS as link time arguments to ld.],
55
59
    [LDFLAGS=$with_ldflags; export LDFLAGS])
56
60
 
 
61
AC_ARG_ENABLE(as-needed,
 
62
[  --enable-as-needed              Link libperl against Net-SNMP libraries 
 
63
                                  rather than applications. We recommend to
 
64
                                  use this option if it works.])
 
65
 
57
66
AC_ARG_WITH(libs,
58
67
[  --with-libs=LIBS                use LIBS as link time arguments to ld.],
59
68
    [LIBS=$with_libs; export LIBS])
162
171
[  --disable-mib-loading           Do not include code that parses and 
163
172
                                  manipulates the mib files.])
164
173
if test "x$enable_mib_loading" = "xno"; then
165
 
  AC_DEFINE([DISABLE_MIB_LOADING], 1, 
 
174
  AC_DEFINE([NETSNMP_DISABLE_MIB_LOADING], 1, 
166
175
            [Define if mib loading and parsing code should not be included])
167
176
fi
168
177
AC_ARG_WITH(mib-loading,,
173
182
AC_ARG_ENABLE(snmpv1,
174
183
[  --disable-snmpv1                Do not include code that implements SNMPv1.])
175
184
if test "x$enable_snmpv1" = "xno"; then
176
 
  AC_DEFINE([DISABLE_SNMPV1], 1, 
 
185
  AC_DEFINE([NETSNMP_DISABLE_SNMPV1], 1, 
177
186
            [Define if SNMPv1 code should not be included])
178
187
else
179
188
  SNMP_VERSIONS="$SNMP_VERSIONS 1"
184
193
AC_ARG_ENABLE(snmpv2c,
185
194
[  --disable-snmpv2c               Do not include code that implements SNMPv2c.])
186
195
if test "x$enable_snmpv2c" = "xno"; then
187
 
  AC_DEFINE([DISABLE_SNMPV2C], 1, 
 
196
  AC_DEFINE([NETSNMP_DISABLE_SNMPV2C], 1, 
188
197
            [Define if SNMPv2c code should not be included])
189
198
else
190
199
  SNMP_VERSIONS="$SNMP_VERSIONS 2c"
198
207
AC_ARG_ENABLE(set-support,
199
208
[  --disable-set-support           Do not allow SNMP set requests.])
200
209
if test "x$enable_set_support" = "xno"; then
201
 
  AC_DEFINE([DISABLE_SET_SUPPORT], 1, 
 
210
  AC_DEFINE([NETSNMP_DISABLE_SET_SUPPORT], 1, 
202
211
            [Define if SNMP SET support should be disabled])
203
212
fi
204
213
AC_ARG_WITH(set-support,,
207
216
AC_ARG_ENABLE(des,
208
217
[  --disable-des                   Do not support DES encryption.])
209
218
if test "x$enable_des" = "xno"; then
210
 
  AC_DEFINE([DISABLE_DES], 1, 
 
219
  AC_DEFINE([NETSNMP_DISABLE_DES], 1, 
211
220
            [Define if DES encryption should not be supported])
212
221
fi
213
222
AC_ARG_WITH(des,,
216
225
AC_ARG_ENABLE(privacy,
217
226
[  --disable-privacy               Don't compile in support for privacy (encryption).])
218
227
if test "x$enable_privacy" != "xno"; then
219
 
  AC_DEFINE(SCAPI_AUTHPRIV)
 
228
  AC_DEFINE(NETSNMP_ENABLE_SCAPI_AUTHPRIV)
220
229
fi
221
230
AC_ARG_WITH(privacy,,
222
231
        AC_MSG_ERROR([ Invalid option. Use --enable-privacy/--disable-privacy instead ]) )
224
233
AC_ARG_ENABLE(md5,
225
234
[  --disable-md5                   Do not support MD5 authentication.])
226
235
if test "x$enable_md5" = "xno"; then
227
 
  AC_DEFINE([DISABLE_MD5], 1, 
 
236
  AC_DEFINE([NETSNMP_DISABLE_MD5], 1, 
228
237
            [Define if MD5 authentication should not be supported])
229
238
fi
230
239
AC_ARG_WITH(md5,,
236
245
  if test "x$enable_md5" = "xno"; then
237
246
    AC_MSG_ERROR(You can not specify both --enable-internal-md5 and --disable-md5)
238
247
  else
239
 
    AC_DEFINE(USE_INTERNAL_MD5)
 
248
    AC_DEFINE(NETSNMP_USE_INTERNAL_MD5)
240
249
  fi
241
250
fi
242
251
AC_ARG_WITH(internal-md5,,
245
254
AC_ARG_ENABLE(ipv6,
246
255
[  --enable-ipv6                   Generate IPv6 ready version.],
247
256
    [if test "x$enable_ipv6" = "xyes"; then
248
 
      AC_DEFINE(INET6)
 
257
      AC_DEFINE(NETSNMP_ENABLE_IPV6)
249
258
    fi])
250
259
AC_ARG_WITH(ipv6,,
251
260
        AC_MSG_ERROR([ Invalid option. Use --enable-ipv6/--disable-ipv6 instead ]) )
253
262
AC_ARG_ENABLE(local-smux,
254
263
[  --enable-local-smux             Restrict SMUX connections to localhost (by default).],
255
264
    [if test "x$enable_local_smux" = "xyes"; then
256
 
      AC_DEFINE(LOCAL_SMUX)
 
265
      AC_DEFINE(NETSNMP_ENABLE_LOCAL_SMUX)
257
266
    fi])
258
267
AC_ARG_WITH(local-smux,,
259
268
        AC_MSG_ERROR([ Invalid option. Use --enable-local-smux/--disable-local-smux instead ]) )
262
271
[  --enable-debugging              Outputs extra debugging information at all
263
272
                                  times.  Normally, you should not enable this,
264
273
                                  but instead use the -D flag of the commands,
265
 
                                  which toggles debbuging output at runtime.
 
274
                                  which toggles debuging output at runtime.
266
275
  --disable-debugging             Disallows debugging code to be built in.
267
276
                                  This might provide some speed benefits.],
268
 
    AC_DEFINE(SNMP_ALWAYS_DEBUG))
 
277
    AC_DEFINE(NETSNMP_ALWAYS_DEBUG))
269
278
AC_ARG_WITH(debugging,,
270
279
        AC_MSG_ERROR([ Invalid option. Use --enable-debugging/--disable-debugging instead ]) )
271
280
 
277
286
        AC_MSG_ERROR([ Invalid option. Use --enable-developer/--disable-developer instead ]) )
278
287
 
279
288
if test "x$enable_debugging" = "xno"; then
280
 
    AC_DEFINE(SNMP_NO_DEBUGGING)
 
289
    AC_DEFINE(NETSNMP_NO_DEBUGGING)
281
290
fi
282
291
 
283
292
AC_ARG_WITH(dmalloc,
375
384
 
376
385
AC_ARG_ENABLE(agentx-dom-sock-only,
377
386
[  --enable-agentx-dom-sock-only   Disable UDP/TCP transports for agentx.],
378
 
AC_DEFINE(AGENTX_DOM_SOCK_ONLY))
 
387
AC_DEFINE(NETSNMP_AGENTX_DOM_SOCK_ONLY))
379
388
AC_ARG_WITH(agentx-dom-sock-only,,
380
389
        AC_MSG_ERROR([ Invalid option. Use --enable-agentx-dom-sock-only/--disable-agentx-dom-sock-only instead ]) )
381
390
 
382
391
AC_ARG_ENABLE(snmptrapd-subagent,
383
392
[  --disable-snmptrapd-subagent    Disable agentx subagent code in snmptrapd.])
384
393
if test "x$enable_snmptrapd_subagent" = "xno"; then
385
 
  AC_DEFINE(SNMPTRAPD_DISABLE_AGENTX)
 
394
  AC_DEFINE(NETSNMP_SNMPTRAPD_DISABLE_AGENTX)
386
395
fi
387
396
AC_ARG_WITH(snmptrapd-subagent,,
388
397
        AC_MSG_ERROR([ Invalid option. Use --enable-snmptrapd-subagent/--disable-snmptrapd-subagent instead ]) )
401
410
AC_ARG_WITH(mibdirs,
402
411
[  --with-mibdirs=\"dir1:dir2:\"   Default directories to look for mibs.
403
412
                                  (Default: \$HOME/.snmp/mibs:DATADIR/snmp/mibs)],
404
 
    [DEFAULT_MIBDIRS="$with_mibdirs"
405
 
    AC_DEFINE_UNQUOTED(DEFAULT_MIBDIRS,"$with_mibdirs")])
 
413
    [NETSNMP_DEFAULT_MIBDIRS="$with_mibdirs"
 
414
    AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_MIBDIRS,"$with_mibdirs")])
406
415
AC_ARG_ENABLE(mibdirs,,
407
416
        AC_MSG_ERROR([ Invalid option. Use --with-mibdirs/--without-mibdirs instead ]) )
408
417
 
413
422
                                  with the addition of any mibs used
414
423
                                  by the mib modules the agent is
415
424
                                  configured with)],
416
 
    DEFAULT_MIBS="$with_mibs")
 
425
    NETSNMP_DEFAULT_MIBS="$with_mibs")
417
426
# enable-mibs is valid too, but means something else
418
427
 
419
428
AC_ARG_WITH(mibfiles,
420
429
[  --with-mibfiles=\"file1:file2\" Default mib files to load.
421
430
                                  (Default:  none.  uses IDs above instead.)],
422
 
    AC_DEFINE_UNQUOTED(DEFAULT_MIBFILES,"$with_mibfiles"))
 
431
    AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_MIBFILES,"$with_mibfiles"))
423
432
AC_ARG_ENABLE(mibfiles,,
424
433
        AC_MSG_ERROR([ Invalid option. Use --with-mibfiles/--without-mibfiles instead ]) )
425
434
 
469
478
                                  only be used for testing of certain
470
479
                                  SNMP functionalities.  This should *not* 
471
480
                                  be turned on for production use.  Ever.],
472
 
    AC_DEFINE(SNMP_TESTING_CODE))
 
481
    AC_DEFINE(NETSNMP_ENABLE_TESTING_CODE))
473
482
AC_ARG_WITH(testing-code,,
474
483
        AC_MSG_ERROR([ Invalid option. Use --enable-testing-code/--disable-testing-code instead ]) )
475
484
 
494
503
 
495
504
AC_ARG_WITH(kmem-usage,
496
505
[  --without-kmem-usage            Do not include any code related to the use
497
 
                                  of kmem. This option can only be used with
498
 
                                  the option --enable-mini-agent.])
 
506
                                  of kmem.])
499
507
AC_ARG_ENABLE(kmem-usage,,
500
508
        AC_MSG_ERROR([ Invalid option. Use --with-kmem-usage/--without-kmem-usage instead ]) )
501
509
 
510
518
 
511
519
AC_ARG_WITH(persistent-directory,
512
520
[  --with-persistent-directory=\"directory\"
513
 
                                  Default directory for persistent data storage.],ac_cv_user_prompt_PERSISTENT_DIRECTORY="$with_persistent_directory")
 
521
                                  Default directory for persistent data storage.],ac_cv_user_prompt_NETSNMP_PERSISTENT_DIRECTORY="$with_persistent_directory")
514
522
AC_ARG_ENABLE(persistent-directory,,
515
523
        AC_MSG_ERROR([ Invalid option. Use --with-persistent-directory/--without-persistent-directory instead ]) )
516
524
 
 
525
default_persistent_mask=077
 
526
AC_ARG_WITH(persistent-mask,
 
527
[  --with-persistent-mask=\"mask\"  Default mask for persistent data storage.
 
528
                                  (Default: 077)],[
 
529
  if test "$withval" = yes; then
 
530
    AC_MSG_ERROR([ Please provide a mask value ]);
 
531
  fi
 
532
  AC_MSG_RESULT(using default persistent mask $withval)
 
533
  AC_DEFINE_UNQUOTED(NETSNMP_PERSISTENT_MASK,$withval)
 
534
],[
 
535
  AC_MSG_RESULT(using default persistent mask $default_persistent_mask)
 
536
  AC_DEFINE_UNQUOTED(NETSNMP_PERSISTENT_MASK,$default_persistent_mask)
 
537
])
 
538
AC_ARG_ENABLE(persistent-mask,,
 
539
        AC_MSG_ERROR([ Invalid option. Use --with-persistent-mask instead ]) )
 
540
 
517
541
AC_ARG_WITH(copy_persistent_files,
518
542
[  --with-copy-persistent-files=\"no\" Don't copy persistent files
519
 
                                       (or use \"yes\" to copy them).
520
 
                                       (Default: yes)],
 
543
                                     (or use \"yes\" to copy them).
 
544
                                     (Default: yes)],
521
545
    ac_cv_user_prompt_COPY_PERSISTENT_FILES="$with_copy_persistent_files")
522
546
AC_ARG_ENABLE(copy_persistent_files,,
523
547
        AC_MSG_ERROR([ Invalid option. Use --with-copy_persistent_files/--without-copy_persistent_files instead ]) )
524
548
 
 
549
default_agentx_socket="/var/agentx/master"
 
550
AC_ARG_WITH(agentx-socket,
 
551
[  --with-agentx-socket=FILE         AgentX socket (Default: /var/agentx/master as specified in RFC2741)],[
 
552
  if test "$withval" = yes; then
 
553
    AC_MSG_ERROR([ Please provide a full path ]);
 
554
  fi
 
555
  AC_MSG_RESULT(using AgentX socket $withval)
 
556
  AC_DEFINE_UNQUOTED(NETSNMP_AGENTX_SOCKET,"$withval",[Unix domain socket for AgentX master-subagent communication])
 
557
],[
 
558
  AC_MSG_RESULT(using default AgentX socket $default_agentx_socket)
 
559
  AC_DEFINE_UNQUOTED(NETSNMP_AGENTX_SOCKET,"$default_agentx_socket",[Unix domain socket for AgentX master-subagent communication])
 
560
])
 
561
AC_ARG_ENABLE(agentx-socket,,
 
562
        AC_MSG_ERROR([ Invalid option. Use --with-agentx-socket instead ]) )
 
563
 
525
564
AC_ARG_WITH(default-snmp-version,
526
565
[  --with-default-snmp-version=\"3\" Default version of SNMP to use.
527
566
                                    (Default: 3)
528
567
                                    Legal values: 1, 2 (for SNMPv2c) or 3.],
529
 
    ac_cv_user_prompt_DEFAULT_SNMP_VERSION="$with_default_snmp_version")
 
568
    ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION="$with_default_snmp_version")
530
569
AC_ARG_ENABLE(default-snmp-version,,
531
570
        AC_MSG_ERROR([ Invalid option. Use --with-default-snmp-version/--without-default-snmp-version instead ]) )
532
571
 
533
572
# we test this now and later as well.  we test it now so configure can die
534
573
# early on with an error rather than waiting till the end of the script.
535
 
if test "x$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "x"; then
536
 
  if test "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "3"; then
 
574
if test "x$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "x"; then
 
575
  if test "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" = "2c"; then
 
576
    ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION="2"
 
577
  fi
 
578
  if test "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "3"; then
537
579
    AC_MSG_ERROR(Illegal version number passed to --with-default-snmp-version)
538
580
  fi
539
581
fi
541
583
AC_ARG_WITH(sys_contact,
542
584
[  --with-sys-contact=\"who@where\"  Default system contact.
543
585
                                    (Default: LOGIN@DOMAINNAME)],
544
 
    ac_cv_user_prompt_SYS_CONTACT="$with_sys_contact")
 
586
    ac_cv_user_prompt_NETSNMP_SYS_CONTACT="$with_sys_contact")
545
587
AC_ARG_ENABLE(sys_contact,,
546
588
        AC_MSG_ERROR([ Invalid option. Use --with-sys-contact/--without-sys-contact instead ]) )
547
589
 
548
590
AC_ARG_WITH(sys_location,
549
591
[  --with-sys-location=\"location\"  Default system location.
550
592
                                    (Default: Unknown)],
551
 
    ac_cv_user_prompt_SYS_LOC="$with_sys_location")
 
593
    ac_cv_user_prompt_NETSNMP_SYS_LOC="$with_sys_location")
552
594
AC_ARG_ENABLE(sys_location,,
553
595
        AC_MSG_ERROR([ Invalid option. Use --with-sys-location/--without-sys-location instead ]) )
554
596
 
555
597
AC_ARG_WITH(logfile,
556
598
[  --with-logfile=\"location\"       Default log file location for snmpd.],
557
 
    ac_cv_user_prompt_LOGFILE="$with_logfile")
 
599
    ac_cv_user_prompt_NETSNMP_LOGFILE="$with_logfile")
558
600
AC_ARG_ENABLE(logfile,,
559
601
        AC_MSG_ERROR([ Invalid option. Use --with-logfile/--without-logfile instead ]) )
560
 
 
561
 
# This can't be within AC_ARG_WITH.  I don't want to read autoconf m4
562
 
# to find out why.
563
 
AC_SUBST(WRAPLIBS)
 
602
if test "$ac_cv_user_prompt_NETSNMP_LOGFILE" = "no"; then
 
603
    ac_cv_user_prompt_NETSNMP_LOGFILE="none"
 
604
fi
564
605
 
565
606
AC_ARG_WITH(transports,
566
607
[  --with-transports=\"t1 t2 ...\"   Compile in the given SNMP transport
575
616
                This transport is always compiled in.
576
617
    UDPIPv6     support for SNMP over UDP/IPv6.
577
618
                This transport is available for Linux, Solaris and
578
 
                FreeBSD.
 
619
                FreeBSD at least.
579
620
                It is never compiled in by default.
580
621
    TCPIPv6     support for SNMP over UDP/IPv6.
581
622
                This transport is available for Linux, Solaris and
582
 
                FreeBSD.
 
623
                FreeBSD at least.
583
624
                It is never compiled in by default.
584
625
    TCP         support for SNMP over TCP/IP.
585
626
                This transport is compiled in by default, but may be omitted.
655
696
    mibII/mta_sendmail     Sendmail statistics monitoring (MTA-MIB)
656
697
    ucd-snmp/diskio        Table of io-devices and how much data they have
657
698
                           read/written.  (only tested on Solaris, Linux)
658
 
    disman/event-mib       previous implementation of the DISMAN-EVENT-MIB
 
699
    disman/old-event-mib   previous implementation of the DISMAN-EVENT-MIB
659
700
 
660
701
  Optional modules for specific platforms
661
702
    Linux
662
703
      ucd-snmp/lmSensors   hardware monitoring (LM-SENSORS-MIB)
 
704
      ip-mib/ipv4InterfaceTable  (experimental)
 
705
      ip-mib/ipv6InterfaceTable  (experimental)
663
706
      tunnel               Linux TUNNEL-MIB support (ifTable extension)
664
707
      mibII/interfaces     (old ifTable implementation)
665
 
      tcp-mib              (experimental) tcpConnectionTable and
666
 
                           tcpListenerTable
667
 
      udp-mib              (experimental) udpEndpointTable
668
 
      ip-mib/ipv4InterfaceTable  (experimental)
669
 
      ip-mib/ipv6InterfaceTable  (experimental)
670
708
      misc/ipfwacc         accounting rules IP firewall information
671
709
      ipfwchains/ipfwchains  firewall chains under ipfw
672
710
                             (See agent/mibgroup/ipfwchains/README)
673
711
 
674
712
    Solaris
675
713
      ucd-snmp/lmSensors   hardware monitoring (LM-SENSORS-MIB)
 
714
      if-mib               IF-MIB rewrite (add --enable-mfd-rewrites)
 
715
      tcp-mib              TCP-MIB rewrite (tcpConnectionTable and
 
716
                             tcpListenerTable; add --enable-mfd-rewrites)
 
717
      udp-mib              UDP-MIB rewrite (udpEndpointTable;
 
718
                             add --enable-mfd-rewrites)
 
719
 
 
720
    FreeBSD/OpenBSD
 
721
      if-mib               IF-MIB rewrite (add --enable-mfd-rewrites)
676
722
 
677
723
  AgentX support:
678
724
    agentx/subagent        allows the agent to run as either a snmp agent
702
748
  if test "$withval" = yes; then
703
749
    AC_MSG_ERROR([ Please provide a value for the enterprise number ]);
704
750
  fi
705
 
  AC_DEFINE_UNQUOTED(ENTERPRISE_OID, $withval)
 
751
  AC_DEFINE_UNQUOTED(NETSNMP_ENTERPRISE_OID, $withval)
706
752
  ent_oid="1,3,6,1,4,1,$withval"
707
 
  AC_DEFINE_UNQUOTED(ENTERPRISE_MIB, $ent_oid)
 
753
  AC_DEFINE_UNQUOTED(NETSNMP_ENTERPRISE_MIB, $ent_oid)
708
754
  ent_dot_oid="1.3.6.1.4.1.$withval"
709
 
  AC_DEFINE_UNQUOTED(ENTERPRISE_DOT_MIB, $ent_dot_oid)
 
755
  AC_DEFINE_UNQUOTED(NETSNMP_ENTERPRISE_DOT_MIB, $ent_dot_oid)
710
756
  AC_MSG_RESULT(using enterprise number $withval)
711
757
],[
712
758
  AC_MSG_RESULT(using default "enterprise.net-snmp")
724
770
    AC_MSG_ERROR([ Please provide a base OID value ]);
725
771
  fi
726
772
  sys_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'`
727
 
  AC_DEFINE_UNQUOTED(SYSTEM_MIB, $sys_oid)
 
773
  AC_DEFINE_UNQUOTED(NETSNMP_SYSTEM_MIB, $sys_oid)
728
774
  sys_dot_oid=`echo "$withval" | sed 's/^\.//'`
729
 
  AC_DEFINE_UNQUOTED(SYSTEM_DOT_MIB, $sys_dot_oid)
 
775
  AC_DEFINE_UNQUOTED(NETSNMP_SYSTEM_DOT_MIB, $sys_dot_oid)
730
776
  sysoid_len=`echo "$withval" | sed 's/[^\.]//g' | awk -F\. '{ print NF }'`
731
 
  AC_DEFINE_UNQUOTED(SYSTEM_DOT_MIB_LENGTH, $sysoid_len)
 
777
  AC_DEFINE_UNQUOTED(NETSNMP_SYSTEM_DOT_MIB_LENGTH, $sysoid_len)
732
778
  AC_MSG_RESULT(using enterprise sysOID $withval ....)
733
779
],[
734
780
  AC_MSG_RESULT(using default enterprise sysOID "NET-SNMP-MIB::netSnmpAgentOIDs...")
746
792
    AC_MSG_ERROR([ Please provide a base OID value ]);
747
793
  fi
748
794
  notification_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'`
749
 
  AC_DEFINE_UNQUOTED(NOTIFICATION_MIB, $notification_oid)
 
795
  AC_DEFINE_UNQUOTED(NETSNMP_NOTIFICATION_MIB, $notification_oid)
750
796
  notification_dot_oid=`echo "$withval" | sed 's/^\.//'`
751
 
  AC_DEFINE_UNQUOTED(NOTIFICATION_DOT_MIB, $notification_dot_oid)
 
797
  AC_DEFINE_UNQUOTED(NETSNMP_NOTIFICATION_DOT_MIB, $notification_dot_oid)
752
798
  notificationoid_len=`echo "$withval" | sed 's/[^\.]//g' | awk -F\. '{ print NF }'`
753
 
  AC_DEFINE_UNQUOTED(NOTIFICATION_DOT_MIB_LENGTH, $notificationoid_len)
 
799
  AC_DEFINE_UNQUOTED(NETSNMP_NOTIFICATION_DOT_MIB_LENGTH, $notificationoid_len)
754
800
  AC_MSG_RESULT(using enterprise notifications $withval)
755
801
],[
756
802
  AC_MSG_RESULT(using default notifications "NET-SNMP-MIB::netSnmpNotifications")
778
824
AC_ARG_WITH(perl-modules,
779
825
[
780
826
Perl:
781
 
  --with-perl-modules[=ARGS]      Install the perl modules along with the rest
 
827
  --with-perl-modules[=ARGS]      Install the Perl modules along with the rest
782
828
                                  of the net-snmp toolkit.  If ARGS is
783
829
                                  specified, they're passed to the
784
830
                                  Makefile.PL script.],[
785
 
    install_perl=yes
786
 
    if test "$withval" = yes; then
787
 
      PERLARGS=""
 
831
    if test "$withval" = "no"; then
 
832
      install_perl="no"
788
833
    else
789
 
      PERLARGS="$withval"
 
834
      install_perl="yes"
 
835
      if test "$withval" != "yes"; then
 
836
        PERLARGS="$withval"
 
837
      fi
790
838
    fi
791
 
])
 
839
], install_perl="try")
792
840
 
793
841
AC_ARG_ENABLE(embedded-perl,
794
 
[  --enable-embedded-perl          Embed perl in the SNMP agent and snmptrapd.
795
 
                                  [forces --with-perl-modules as well.]],
796
 
    embed_perl="$enableval", embed_perl="no")
 
842
[  --disable-embedded-perl         Disable embedded Perl in the SNMP agent and
 
843
                                  snmptrapd. [enabled by default]],
 
844
    embed_perl="$enableval", embed_perl="try")
 
845
 
 
846
AC_ARG_ENABLE(perl-cc-checks,
 
847
[  --disable-perl-cc-checks        Disable configure checks for whether Perl's
 
848
                                  C Compiler is compatible with ours when
 
849
                                  embedded Perl is enabled.])
797
850
 
798
851
# Common perl mistakes
799
852
AC_ARG_ENABLE(perl-modules,,
800
853
        AC_MSG_ERROR([ Invalid option. Use --with-perl-modules/--without-perl-modules instead ]) )
801
854
AC_ARG_WITH(embedded-perl,,
802
 
        AC_MSG_ERROR([ Invalid option. Use --enable-embedded-perl=(yes|no) instead ]) )
 
855
        AC_MSG_ERROR([ Invalid option. Use --enable-embedded-perl/--disable-embedded-perl instead ]) )
 
856
AC_ARG_WITH(perl-cc-checks,,
 
857
        AC_MSG_ERROR([ Invalid option. Use --enable-perl-cc-checks/--disable-perl-cc-checks instead ]) )
 
858
 
 
859
 
 
860
#
 
861
# Python specific
 
862
#
 
863
AC_ARG_WITH(python-modules,
 
864
[
 
865
Python:
 
866
  --with-python-modules[=ARGS]    Install the python bindings along with the
 
867
                                  rest of the net-snmp toolkit.  If ARGS is
 
868
                                  specified, they're passed to the
 
869
                                  setup.py script as arguments.],[
 
870
    install_python="yes"
 
871
    if test "$withval" = "yes"; then
 
872
      PYTHONARGS=""
 
873
    elif test "$withval" = "no"; then
 
874
      PYTHONARGS=""
 
875
      install_python="no"
 
876
    else
 
877
      PYTHONARGS="$withval"
 
878
    fi
 
879
], install_python="no")
 
880
 
 
881
# other flags
803
882
 
804
883
AC_ARG_WITH(server-send-buf,
805
884
[
813
892
   if test "$withval" = yes; then
814
893
    AC_MSG_ERROR([ Please provide a positive number for the server send buffer ])
815
894
   fi
816
 
   AC_DEFINE_UNQUOTED(DEFAULT_SERVER_SEND_BUF, $withval)],
 
895
   AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_SERVER_SEND_BUF, $withval)],
817
896
   AC_MSG_RESULT([using OS default send buffer size for server sockets]) )
818
897
AC_ARG_ENABLE(server-send-buf,,
819
898
        AC_MSG_ERROR([ Invalid option. Use --with-server-send-buf/--without-server-send-buf instead ]) )
823
902
  if test "$withval" = yes; then
824
903
    AC_MSG_ERROR([ Please provide a positive number for the server recv buffer ])
825
904
  fi
826
 
  AC_DEFINE_UNQUOTED(DEFAULT_SERVER_RECV_BUF, $withval)],
 
905
  AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_SERVER_RECV_BUF, $withval)],
827
906
  AC_MSG_RESULT([using OS default recv buffer size for server sockets]) )
828
907
AC_ARG_ENABLE(server-recv-buf,,
829
908
        AC_MSG_ERROR([ Invalid option. Use --with-server-recv-buf/--without-server-recv-buf instead ]) )
834
913
  if test "$withval" = yes; then
835
914
    AC_MSG_ERROR([ Please provide a positive number for the client send buffer ])
836
915
  fi
837
 
  AC_DEFINE_UNQUOTED(DEFAULT_CLIENT_SEND_BUF, $withval)],
 
916
  AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_CLIENT_SEND_BUF, $withval)],
838
917
  AC_MSG_RESULT([using OS default send buffer size for client sockets]) )
839
918
AC_ARG_ENABLE(client-send-buf,,
840
919
        AC_MSG_ERROR([ Invalid option. Use --with-client-send-buf/--without-client-send-buf instead ]) )
844
923
  if test "$withval" = yes; then
845
924
    AC_MSG_ERROR([ Please provide a positive number for the client recv buffer ])
846
925
  fi
847
 
  AC_DEFINE_UNQUOTED(DEFAULT_CLIENT_RECV_BUF, $withval)],
 
926
  AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_CLIENT_RECV_BUF, $withval)],
848
927
  AC_MSG_RESULT([using OS default recv buffer size for client sockets]) )
849
928
AC_ARG_ENABLE(client-recv-buf,,
850
929
        AC_MSG_ERROR([ Invalid option. Use --with-client-recv-buf/--without-client-recv-buf instead ]) )
869
948
#
870
949
# setup install targets
871
950
#
872
 
if test "x$enable_ucd_snmp_compatibility" = "xyes" ; then
 
951
if test "x$enable_ucd_snmp_compatibility" = "xyes" ; then       
873
952
  installucdheaders=installucdheaders
874
953
  installucdlibs=installucdlibs
875
 
  AC_MSG_CACHE_ADD(UCD-SNMP compatibility:     enabled)
 
954
  AC_MSG_CACHE_ADD(UCD-SNMP compatability:     enabled)
876
955
fi
877
956
AC_SUBST(installucdheaders)
878
957
AC_SUBST(installucdlibs)
879
958
 
880
959
# Only define if specifically chosen as --without (i.e., default to true). 
881
960
if test "x$with_root_access" = "xno"; then
882
 
  AC_DEFINE(NO_ROOT_ACCESS)
 
961
  AC_DEFINE(NETSNMP_NO_ROOT_ACCESS)
883
962
fi
884
963
 
885
964
# Only define if specifically chosen as --without (i.e., default to true).
886
965
if test "x$with_kmem_usage" = "xno"; then
887
 
  AC_DEFINE(NO_KMEM_USAGE)
 
966
  AC_DEFINE(NETSNMP_NO_KMEM_USAGE)
888
967
fi
889
968
 
890
969
# Define unless specifically suppressed (i.e., option defaults to false). 
891
970
if test "x$with_dummy_values" != "xyes"; then
892
 
  AC_DEFINE(NO_DUMMY_VALUES)
 
971
  AC_DEFINE(NETSNMP_NO_DUMMY_VALUES)
893
972
fi
894
973
 
895
974
# Only define if specifically chosen as --without (i.e., default to true). 
896
975
if test "x$with_opaque_special_types" != "xno"; then
897
 
  AC_DEFINE(OPAQUE_SPECIAL_TYPES)
 
976
  AC_DEFINE(NETSNMP_WITH_OPAQUE_SPECIAL_TYPES)
898
977
fi
899
978
 
900
979
 
918
997
fi
919
998
 
920
999
if test "x$developer" != "xno" -a -f $srcdir/remove-files; then
921
 
  # turn on the developer flag when taken from a CVS checkout (not a release)
 
1000
  # turn on the developer flag when taken from a SVN checkout (not a release)
922
1001
  developer="yes"
923
1002
fi
924
1003
 
925
 
# disable --enable-shared by default in cvs/developer cases.
926
 
if test "x$developer" = "xyes"; then
927
 
  # don't do anything if option set via cmdline
928
 
  if test "${enable_shared+set}" != set; then
929
 
    enable_shared=no
930
 
  fi
931
 
fi
932
 
 
933
 
# perl requires shared libs
934
 
if test "x$embed_perl" = "xyes"; then
935
 
    if test "x$enable_shared" != "xyes"; then
936
 
      AC_MSG_ERROR(--enable-embedded-perl requires --enable-shared)
937
 
    fi
938
 
fi
939
 
 
 
1004
AC_LANG([C])
940
1005
AC_PROG_CC
941
1006
AC_PROG_CPP
 
1007
LINKCC=${LINKCC-"$CC"}
 
1008
AC_SUBST(LINKCC)
942
1009
AC_AIX
943
 
AC_EXEEXT
 
1010
 
 
1011
# system check
 
1012
AC_CANONICAL_TARGET
 
1013
changequote(, )
 
1014
PARTIALTARGETOS=`echo $target_os | sed 's/[-._].*//'`
 
1015
changequote([, ])
 
1016
 
 
1017
# platform-specific compiler flags
 
1018
if test "x$PARTIALTARGETOS" = "xmingw32msvc"; then
 
1019
        CFLAGS="$CFLAGS -Dmingw32"
 
1020
fi
 
1021
 
 
1022
# platform-specific linker flags
 
1023
case $target_os in
 
1024
    aix4.2*|aix4.3*|aix5*)
 
1025
        AC_MSG_CHECKING([what linker flags to add to enable runtime linking on AIX])
 
1026
        for ld_flag in $LDFLAGS; do
 
1027
            if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
 
1028
                netsnmp_aix_runtimelinking_flags_ok=yes
 
1029
                break
 
1030
            fi
 
1031
        done
 
1032
        if test "X$netsnmp_aix_runtimelinking_flags_ok" != "Xyes"; then
 
1033
            if test "x$GCC" = "xyes"; then
 
1034
                netsnmp_aix_ldflags="-Wl,-brtl"
 
1035
            else
 
1036
                netsnmp_aix_ldflags="-brtl"
 
1037
            fi
 
1038
            LDFLAGS="$netsnmp_aix_ldflags $LDFLAGS"
 
1039
            AC_MSG_RESULT($netsnmp_aix_ldflags)
 
1040
        else
 
1041
            AC_MSG_RESULT([none])
 
1042
        fi
 
1043
        ;;
 
1044
    darwin8*)
 
1045
        AC_MSG_CHECKING([whether darwin ld might need -flat_namespace])
 
1046
        if test -z "$MACOSX_DEPLOYMENT_TARGET"; then
 
1047
                LDFLAGS="-flat_namespace $LDFLAGS"
 
1048
                AC_MSG_RESULT([yes])
 
1049
        else
 
1050
                AC_MSG_RESULT([no])
 
1051
        fi
 
1052
        ;;
 
1053
    *)
 
1054
        ;;
 
1055
esac
944
1056
 
945
1057
# libtool stuff for shared/static libraries.
946
1058
AC_LIBTOOL_DLOPEN
952
1064
AC_PROG_INSTALL
953
1065
AC_PROG_LN_S
954
1066
AC_PROG_MAKE_SET
 
1067
AC_PROG_EGREP
955
1068
AC_PATH_PROG([PSPROG],ps)
956
1069
AC_PATH_PROG([PERLPROG],perl)
 
1070
AC_PATH_PROG([PYTHONPROG],python)
957
1071
AC_CHECK_PROGS(WHOAMI, whoami logname, whoami)
958
1072
AC_CHECK_PROGS(SED,sed gsed)
959
1073
AC_CHECK_PROGS(FIND,find)
977
1091
 
978
1092
# get version number.
979
1093
AC_MSG_CHECKING([for net-snmp version number])
980
 
VERSION=`grep NetSnmpVersionInfo.*= $srcdir/snmplib/snmp_version.c | sed 's/";.*//;s/.*"//;s/pre/0./;'`
 
1094
VERSION=`grep NetSnmpVersionInfo.*= $srcdir/snmplib/snmp_version.c | sed 's/";.*//;s/.*"//;'`
 
1095
 
 
1096
# create the release version number....  I'm not sure this is used
 
1097
# anywhere any longer.
 
1098
_release_version=`echo $VERSION | sed 's/";.*//;s/.*"//;s/pre/0./;'`
981
1099
changequote(, )
982
 
RELEASEVERSION=`echo $VERSION | sed 's/^\([0-9]\)\.\([0-9]\)/\1:\2:0/'`
 
1100
RELEASEVERSION=`echo $_release_version | sed 's/^\([0-9]\)\.\([0-9]\)/\1:\2:0/'`
983
1101
changequote([, ])
 
1102
 
984
1103
AC_SUBST(VERSION)
985
1104
AC_SUBST(RELEASEVERSION)
986
1105
AC_MSG_RESULT($VERSION)
1036
1155
AC_SUBST(NON_GNU_VPATH)
1037
1156
 
1038
1157
 
1039
 
# system check
1040
 
AC_CANONICAL_TARGET
1041
 
changequote(, )
1042
 
PARTIALTARGETOS=`echo $target_os | sed 's/[-._].*//'`
1043
 
if test "x$PARTIALTARGETOS" = "xmingw32msvc"; then
1044
 
        CFLAGS="$CFLAGS -Dmingw32"
1045
 
fi
1046
 
CFLAGS="$CFLAGS -D$PARTIALTARGETOS"
1047
 
changequote([, ])
 
1158
#
 
1159
# Check whether we can use -Ux -Dx=x with the expected behaviour
 
1160
#
 
1161
AC_MSG_CHECKING([whether to un-define target system token (before redefining)])
 
1162
OLD_CPPFLAGS="$CPPFLAGS"
 
1163
CPPFLAGS="-U$PARTIALTARGETOS -D$PARTIALTARGETOS=$PARTIALTARGETOS"
 
1164
 
 
1165
AC_EGREP_CPP(yes,[[
 
1166
#ifdef $PARTIALTARGETOS
 
1167
yes
 
1168
#endif
 
1169
]],
 
1170
[PARTIALTARGETFLAGS="-U$PARTIALTARGETOS -D$PARTIALTARGETOS=$PARTIALTARGETOS"
 
1171
 AC_MSG_RESULT([yes])],
 
1172
[PARTIALTARGETFLAGS="-D$PARTIALTARGETOS=$PARTIALTARGETOS"
 
1173
 AC_MSG_RESULT([no])])
 
1174
CFLAGS="$CFLAGS $PARTIALTARGETFLAGS"
 
1175
CPPFLAGS="$OLD_CPPFLAGS"
1048
1176
AC_MSG_CACHE_ADD(Building for:               $PARTIALTARGETOS)
1049
1177
 
1050
 
# AIX has problems with shared libs
1051
 
case $target_os in
1052
 
    aix*)
1053
 
        AC_MSG_CHECKING([whether using AIX and if we should disable shared libraries])
1054
 
        AC_MSG_RESULT([yes])
1055
 
        enable_shared=no
1056
 
        ;;
1057
 
    darwin8*)
1058
 
        AC_MSG_CHECKING([whether darwin ld might need -flat_namespace])
1059
 
        if test -z "$MACOSX_DEPLOYMENT_TARGET"; then
1060
 
                LDFLAGS="-flat_namespace $LDFLAGS"
1061
 
                AC_MSG_RESULT([yes])
1062
 
        else
1063
 
                AC_MSG_RESULT([no])
1064
 
        fi
1065
 
        ;;
1066
 
    *)
1067
 
        ;;
1068
 
esac
1069
1178
 
1070
1179
#
1071
1180
# check for special includes and pick one
1091
1200
if test "x$filebase" = "x$last"; then
1092
1201
    filebase="generic"
1093
1202
fi
1094
 
ac_cv_SYSTEM_INCLUDE_FILE="net-snmp/system/$filebase.h"
 
1203
ac_cv_NETSNMP_SYSTEM_INCLUDE_FILE="net-snmp/system/$filebase.h"
1095
1204
 
1096
1205
changequote([, ])
1097
 
AC_MSG_RESULT($ac_cv_SYSTEM_INCLUDE_FILE)
1098
 
AC_DEFINE_UNQUOTED(SYSTEM_INCLUDE_FILE, "$ac_cv_SYSTEM_INCLUDE_FILE")
 
1206
AC_MSG_RESULT($ac_cv_NETSNMP_SYSTEM_INCLUDE_FILE)
 
1207
AC_DEFINE_UNQUOTED(NETSNMP_SYSTEM_INCLUDE_FILE, "$ac_cv_NETSNMP_SYSTEM_INCLUDE_FILE")
1099
1208
 
1100
1209
# second part, the CPU type.
1101
1210
 
1111
1220
if test "x$filebase" = "x$last"; then
1112
1221
    filebase="generic"
1113
1222
fi
1114
 
ac_cv_MACHINE_INCLUDE_FILE="net-snmp/machine/$filebase.h"
 
1223
ac_cv_NETSNMP_MACHINE_INCLUDE_FILE="net-snmp/machine/$filebase.h"
1115
1224
changequote([, ])
1116
 
AC_MSG_RESULT([$ac_cv_MACHINE_INCLUDE_FILE])
 
1225
AC_MSG_RESULT([$ac_cv_NETSNMP_MACHINE_INCLUDE_FILE])
1117
1226
 
1118
 
AC_DEFINE_UNQUOTED(MACHINE_INCLUDE_FILE, "$ac_cv_MACHINE_INCLUDE_FILE")
 
1227
AC_DEFINE_UNQUOTED(NETSNMP_MACHINE_INCLUDE_FILE, "$ac_cv_NETSNMP_MACHINE_INCLUDE_FILE")
1119
1228
 
1120
1229
AC_PATH_PROG([CCPATH],$CC)
1121
1230
# watch out for /usr/ucb/cc on solaris, it doesn't work with this package.
1209
1318
AC_DEFINE_UNQUOTED(SNMPSHAREPATH,"$SNMPSHAREPATH")
1210
1319
AC_SUBST(SNMPSHAREPATH)
1211
1320
 
1212
 
if test "x$DEFAULT_MIBDIRS" = "x"; then
1213
 
  DEFAULT_MIBDIRS="\$HOME/.snmp/mibs:$SNMPSHAREPATH/mibs"
1214
 
  AC_DEFINE_UNQUOTED(DEFAULT_MIBDIRS,"$DEFAULT_MIBDIRS")
 
1321
if test "x$NETSNMP_DEFAULT_MIBDIRS" = "x"; then
 
1322
  NETSNMP_DEFAULT_MIBDIRS="\$HOME/.snmp/mibs:$SNMPSHAREPATH/mibs"
 
1323
  AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_MIBDIRS,"$NETSNMP_DEFAULT_MIBDIRS")
1215
1324
fi
1216
 
AC_SUBST(DEFAULT_MIBDIRS)
 
1325
AC_SUBST(NETSNMP_DEFAULT_MIBDIRS)
1217
1326
 
1218
1327
SNMPCONFPATH=""
1219
1328
tmpset="$sysconfdir/snmp"
1228
1337
AC_CHECK_SIZEOF(int)
1229
1338
AC_CHECK_SIZEOF(long)
1230
1339
AC_CHECK_SIZEOF(long long)
 
1340
AC_CHECK_SIZEOF(intmax_t)
 
1341
AC_CHECK_TYPES([int8_t,  uint8_t,  u_int8_t])
 
1342
AC_CHECK_TYPES([int16_t, uint16_t, u_int16_t])
1231
1343
AC_CHECK_TYPES([int32_t, uint32_t, u_int32_t])
1232
1344
AC_CHECK_TYPES([int64_t, uint64_t, u_int64_t])
 
1345
AC_CHECK_TYPES([intmax_t, uintmax_t])
 
1346
AC_CHECK_TYPES([off64_t])
1233
1347
AC_CHECK_TYPES([uintptr_t, intptr_t])
1234
1348
 
 
1349
# solaris specific type
 
1350
AC_CHECK_TYPES([Counter64],,,[#include <inet/mib2.h>])
 
1351
 
1235
1352
# guess IPv6 stack type.
1236
1353
if test "x$enable_ipv6" = "xyes"; then
1237
1354
        v6type=unknown
1239
1356
        v6trylibc=no
1240
1357
 
1241
1358
        AC_MSG_CHECKING([[ipv6 stack type]])
1242
 
        for i in v6d toshiba kame inria zeta linux-glibc linux-inet6; do
 
1359
        for i in v6d toshiba kame inria zeta linux-glibc linux-inet6 generic; do
1243
1360
                case $i in
1244
1361
                v6d)
1245
1362
                        AC_EGREP_CPP(yes, [
1259
1376
#endif],
1260
1377
                                [v6type=$i; v6lib=inet6;
1261
1378
                                v6libdir=/usr/local/v6/lib;
1262
 
                                CFLAGS="-DINET6 $CFLAGS"])
 
1379
                                CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"])
1263
1380
                        ;;
1264
1381
                kame)
1265
1382
                        AC_EGREP_CPP(yes, [
1270
1387
                                [v6type=$i; v6lib=inet6;
1271
1388
                                v6libdir=/usr/local/v6/lib;
1272
1389
                                v6trylibc=yes;
1273
 
                                CFLAGS="-DINET6 $CFLAGS"])
 
1390
                                CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"])
1274
1391
                        ;;
1275
1392
                inria)
1276
1393
                        AC_EGREP_CPP(yes, [
1282
1399
                                v6lib=dummy;
1283
1400
                                v6libdir=none;
1284
1401
                                v6trylibc=yes;
1285
 
                                CFLAGS="-DINET6 $CFLAGS"])
 
1402
                                CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"])
1286
1403
                        ;;
1287
1404
                zeta)
1288
1405
                        AC_EGREP_CPP(yes, [
1293
1410
#endif],
1294
1411
                                [v6type=$i; v6lib=inet6;
1295
1412
                                v6libdir=/usr/local/v6/lib;
1296
 
                                CFLAGS="-DINET6 $CFLAGS"])
 
1413
                                CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"])
1297
1414
                        ;;
1298
1415
                linux-glibc)
1299
1416
                        AC_EGREP_CPP(yes, [
1305
1422
                                v6lib=dummy;
1306
1423
                                v6libdir=none;
1307
1424
                                v6trylibc=yes;
1308
 
                                CFLAGS="-DINET6 $CFLAGS"])
 
1425
                                CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"])
1309
1426
                        ;;
1310
1427
                linux-inet6)
1311
1428
                        if test -d /usr/inet6; then
1312
1429
                                v6type=$i
1313
1430
                                v6lib=inet6
1314
1431
                                v6libdir=/usr/inet6/lib
1315
 
                                CFLAGS="-DINET6 $CFLAGS"
 
1432
                                CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"
1316
1433
                        fi
1317
1434
                        ;;
 
1435
                generic)
 
1436
                        AC_MSG_RESULT([[postponed]])
 
1437
                        AC_CHECK_STRUCT_FOR([
 
1438
#include <sys/types.h>
 
1439
#include <sys/param.h>
 
1440
#include <sys/socket.h>
 
1441
#include <netinet/in.h>
 
1442
], sockaddr_in6, sin6_addr, no)
 
1443
                        AC_MSG_CHECKING([[ipv6 stack type]])
 
1444
                        if test "x$ac_cv_struct_sockaddr_in6_has_sin6_addr" = "xyes"; then
 
1445
                                v6type=$i
 
1446
                                v6lib=dummy
 
1447
                                v6libdir=none
 
1448
                                v6trylibc=yes
 
1449
                                CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"
 
1450
                        fi
 
1451
                        ;;
1318
1452
                esac
1319
1453
                if test "$v6type" != "unknown"; then
1320
1454
                        break
1344
1478
#
1345
1479
 
1346
1480
if test "x$with_res_locks" = "xyes"; then
1347
 
  AC_DEFINE(NS_REENTRANT)
 
1481
  AC_DEFINE(NETSNMP_REENTRANT)
1348
1482
 
1349
1483
    case $target_os in
1350
1484
 
1370
1504
other_trapd_objects=""
1371
1505
 
1372
1506
# Win32 service code
1373
 
if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc" -o "x$PARTIALTARGETOS" = "xcygwin"; then
 
1507
if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc"; then
1374
1508
  other_src_list="$other_src_list winservice.c winservicerc.rc"
1375
1509
  other_objs_list="$other_objs_list winservice.o winservicerc.o"
1376
1510
  other_lobjs_list="$other_lobjs_list winservice.lo winservicerc.lo"
1479
1613
        transport_hdr_list="$transport_hdr $transport_hdr_list"
1480
1614
      fi
1481
1615
      transport_def=`echo $i | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
1482
 
      transport_def_list="SNMP_TRANSPORT_"$transport_def"_DOMAIN $transport_def_list"
 
1616
      transport_def_list="NETSNMP_TRANSPORT_"$transport_def"_DOMAIN $transport_def_list"
1483
1617
    else
1484
1618
      echo
1485
1619
      AC_MSG_ERROR(Cannot find file $srcdir/$rel_transport_src to support SNMP transport domain $i.)
1571
1705
  security_hdr_list="$security_hdr_list $hfile"
1572
1706
  security_obj_list="$security_obj_list snmp"$i".o"      
1573
1707
  security_lobj_list="$security_lobj_list snmp"$i".lo"
1574
 
  def_name="SNMP_SECMOD_"`echo $i | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
 
1708
  def_name="NETSNMP_SECMOD_"`echo $i | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1575
1709
  echo "init_"$i"();" >> $security_init_file
1576
1710
  echo "#include <net-snmp/library/$hfile>" >> $security_incl_file
1577
1711
  AC_DEFINE_UNQUOTED($def_name)
1582
1716
AC_SUBST(security_obj_list)      
1583
1717
AC_SUBST(security_lobj_list)
1584
1718
AC_MSG_RESULT($new_with_security)
1585
 
AC_MSG_CACHE_ADD(SNMPv3 Security Modules:   $new_with_security)
 
1719
AC_MSG_CACHE_ADD(SNMPv3 Security Modules:    $new_with_security)
1586
1720
 
1587
1721
#
1588
1722
# Handle the special case of KSM to see which crypto API we support
1589
1723
#
1590
1724
 
1591
 
ac_cv_MIT_NEW_CRYPTO=no
 
1725
ac_cv_NETSNMP_USE_KERBEROS_MIT=no
1592
1726
rebuilt_new_with_security=
1593
1727
already_checked_krb5=no
1594
1728
 
1646
1780
    )])
1647
1781
    AC_MSG_RESULT($ac_cv_heimdal)
1648
1782
    if test $ac_cv_heimdal = yes; then
1649
 
      AC_DEFINE(HEIMDAL)
 
1783
      AC_DEFINE(NETSNMP_USE_KERBEROS_HEIMDAL)
1650
1784
      if test no = $krb5_config; then
1651
1785
        LIBS="$LIBS -lkrb5 -lasn1 -lcom_err -lroken"
1652
1786
      fi
1656
1790
 
1657
1791
    AC_MSG_CHECKING([to see which crypto API we need to use])
1658
1792
    AC_CHECK_FUNC(krb5_c_encrypt,[
1659
 
    AC_CACHE_VAL(ac_cv_MIT_NEW_CRYPTO,
 
1793
    AC_CACHE_VAL(ac_cv_NETSNMP_USE_KERBEROS_MIT,
1660
1794
      AC_CHECK_LIB(k5crypto, krb5_init_context,
1661
 
        ac_cv_MIT_NEW_CRYPTO=yes, ac_cv_MIT_NEW_CRYPTo=no
 
1795
        ac_cv_NETSNMP_USE_KERBEROS_MIT=yes, ac_cv_MIT_NEW_CRYPTo=no
1662
1796
      )
1663
1797
    )
1664
1798
 
1665
 
    if test yes = $ac_cv_MIT_NEW_CRYPTO; then
 
1799
    if test yes = $ac_cv_NETSNMP_USE_KERBEROS_MIT; then
1666
1800
      AC_MSG_RESULT(new MIT crypto API)
1667
 
      AC_DEFINE(MIT_NEW_CRYPTO)
 
1801
      AC_DEFINE(NETSNMP_USE_KERBEROS_MIT)
1668
1802
      if test no = $krb5_config; then
1669
1803
        LIBS="$LIBS -lk5crypto"
1670
1804
      fi
1703
1837
# Do hairy agent module processing.
1704
1838
#
1705
1839
AC_MSG_CHECKING([for and configuring mib modules to use])
1706
 
changequote(, )
 
1840
 
 
1841
# set up the CPP command
 
1842
MODULECPP="$CPP $PARTIALTARGETFLAGS -I${srcdir}/include -I${srcdir}/agent/mibgroup"
 
1843
if test "x$enable_mfd_rewrites" = "xyes"; then
 
1844
  MODULECPP="$MODULECPP -DNETSNMP_ENABLE_MFD_REWRITES"
 
1845
fi
1707
1846
 
1708
1847
module_list=""
1709
 
module_list_code=""
1710
1848
mib_module_list=""
1711
 
mib_module_list_code=""
1712
1849
agent_module_list=""
1713
 
agent_module_list_code=""
1714
1850
new_with_mib_modules=`echo $with_mib_modules | sed 's/,/ /g;'`
1715
1851
new_with_out_mib_modules=`echo $with_out_mib_modules | sed 's/,/ /g;'`
1716
1852
 
 
1853
# set up initial module list
 
1854
new_module_list="$new_with_mib_modules default_modules"
 
1855
 
 
1856
# minor modifications
1717
1857
if test "x$enable_agent" = "xno"; then
1718
1858
   # minimum mib module list for snmptrapd
1719
1859
   new_module_list="mibII/vacm_vars utilities/execute $new_with_mib_modules"
1720
1860
   default_mibs=SNMPv2-MIB:RFC1213-MIB
1721
1861
   default_mibs_install=" "
1722
1862
elif test "x$mini_agent" = "xyes"; then
1723
 
   new_module_list="snmpv3mibs mibII/snmp_mib mibII/system_mib mibII/sysORTable mibII/vacm_vars utilities/execute $new_with_mib_modules"
1724
 
   default_mibs=SNMPv2-MIB:RFC1213-MIB
1725
 
   default_mibs_install=" "
1726
 
else
1727
 
   new_module_list="mibII ucd_snmp snmpv3mibs notification notification-log-mib target agent_mibs agentx disman/event-mib disman/schedule utilities $new_with_mib_modules"
1728
 
   default_mibs=IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:SNMPv2-MIB:RFC1213-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB
1729
 
 
1730
 
   case $target_os in
1731
 
      linux* | freebsd* | dynix* | solaris2* | hpux* )
1732
 
         new_module_list="$new_module_list host"
1733
 
         ;;
1734
 
      *)
1735
 
         ;;
1736
 
   esac
1737
 
fi
1738
 
 
1739
 
if test "x$transport_callback_disabled" = "xyes"; then
1740
 
        changequote([, ])
1741
 
        AC_MSG_WARN(Disabling Callback transport will disable AgentX support.)
1742
 
        changequote(, )
1743
 
        new_with_out_mib_modules="agentx $new_with_out_mib_modules"
1744
 
fi
1745
 
 
1746
 
if test "x$enable_ipv6" = "xyes"; then
1747
 
        new_module_list="$new_module_list mibII/ipv6"
 
1863
   # define the mini agent flag to reduce our load list from default_mibs.h
 
1864
   MODULECPP="$MODULECPP -DNETSNMP_MINI_AGENT"
1748
1865
fi
1749
1866
 
1750
1867
test_modules="$new_module_list"
1751
1868
new_module_list=""
1752
 
module_list_h=""
1753
1869
 
1754
1870
# remove modules that were explicity excluded
1755
1871
for i in $test_modules
1756
1872
 do
1757
1873
  if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
1758
 
    changequote([, ])
1759
1874
    mib_cfg_msg="mib module '$i' is both included and excluded."
1760
1875
    AC_MSG_WARN([mib module conflict])
1761
1876
    if test "x$with_mib_cfg_checks" = "xyes"; then
1768
1883
      AC_MSG_WARN([$mib_cfg_msg It will be excluded])
1769
1884
      AC_MSG_CACHE_ADD([*** MIB Module warning *** $mib_cfg_msg It has been excluded.])
1770
1885
    fi
1771
 
    changequote(, )
1772
1886
  else
1773
1887
    new_module_list="$new_module_list $i"
1774
1888
  fi
1775
1889
done
1776
1890
 
1777
 
changequote([, ])
1778
1891
AC_MSG_RESULT([$new_module_list.])
1779
 
AC_MSG_CACHE_ADD(Agent MIB code:            $new_module_list)
1780
 
 
1781
 
MODULECPP="$CPP -D$PARTIALTARGETOS -I${srcdir}/include -I${srcdir}/agent/mibgroup"
1782
 
if test "x$enable_mfd_rewrites" = "xyes"; then
1783
 
  MODULECPP="$MODULECPP -DNETSNMP_ENABLE_MFD_REWRITES"
1784
 
fi
1785
 
changequote(, )
1786
1892
 
1787
1893
#---------------------
1788
1894
# loop over module list
1793
1899
else
1794
1900
   module_debug=0
1795
1901
fi
 
1902
first_pass=1
 
1903
output_to=normal
 
1904
 
 
1905
if test ! -d mk ; then
 
1906
  mkdir mk
 
1907
fi
 
1908
 
 
1909
 
 
1910
module_rules=mk/module_rules.mk
 
1911
echo "# contents below built automatically by configure; do not edit by hand" > $module_rules
 
1912
 
 
1913
#
 
1914
# make file sub-pieces
 
1915
#
 
1916
for i in module_list_deps mib_module_list_deps agent_module_list_deps ; do
 
1917
  eval "$i=mk/${i}.mk"
 
1918
  echo "# contents below built automatically by configure; do not edit by hand" > mk/${i}.mk
 
1919
done
 
1920
 
 
1921
#
 
1922
# variable settings sub-pieces
 
1923
#
 
1924
for i in module_list_code mib_module_list_code agent_module_list_code module_list mib_module_list agent_module_list ; do
 
1925
  eval "$i=mk/${i}.mk"
 
1926
  echo "# contents below built automatically by configure; do not edit by hand" > mk/${i}.mk
 
1927
  echo "$i= \\" >> mk/${i}.mk
 
1928
done
 
1929
 
 
1930
echo $ECHO_N "echo " $ECHO_C > mk/MODULE_LIST.mk
 
1931
MODULE_LIST=mk/MODULE_LIST.mk
 
1932
 
 
1933
 
 
1934
#---------------------
 
1935
# until we have an empty module list...
 
1936
#   (modules may add new modules, and until all dependencies are done...)
 
1937
#
1796
1938
while test "x$new_module_list" != "x"; do
1797
 
  if test $module_debug -eq 1; then
1798
 
      echo -e "\n****************************************************************"
1799
 
      echo "nml: $new_module_list"
1800
 
  fi
1801
 
  for i in $new_module_list
 
1939
  AC_MSG_MODULE_DBG(-e,"\n****************************************************************")
 
1940
  AC_MSG_MODULE_DBG("nml: $new_module_list")
 
1941
 
 
1942
  #---------------------
 
1943
  # loop over all the modules in the current list
 
1944
  #
 
1945
  for j in $new_module_list
1802
1946
    do
1803
 
    if test $module_debug -eq 1; then
1804
 
      echo -e "\n================================================================"
1805
 
      echo "testing $i"
 
1947
 
 
1948
    #---------------------
 
1949
    # figure out which sub-blocks to build in parts
 
1950
    if echo "$j" | grep "=" ; then
 
1951
       # build a shared object file
 
1952
       # format: sofilename=module1:module2
 
1953
       # XXX: currently doesn't do this
 
1954
       dl_name=`echo $j | sed 's/=.*//'`
 
1955
       dl_names="$dl_names $dl_name"
 
1956
       dl_objects=`echo $j | sed 's/.*=//'`
 
1957
       module_sublist=`echo $dl_objects | sed 's/:/ /g'`
 
1958
       saved_sublist=""
 
1959
       saved_sublist_code=""
 
1960
       output_to=separate
 
1961
 
 
1962
       # create output files
 
1963
       # these actually get nuked later
 
1964
       output_inits="agent/mibgroup/${dl_name}-dll.c"
 
1965
       output_hdrs="agent/mibgroup/${dl_name}-hdrs.h"
 
1966
    else
 
1967
       # not a special token invocation
 
1968
       module_sublist=$j
 
1969
       output_to=normal
 
1970
       output_t=
1806
1971
    fi
 
1972
 
 
1973
    while test "x$module_sublist" != "x" ; do
 
1974
 
 
1975
    #---------------------
 
1976
    # loop over all the modules in the sub list
 
1977
    for i in $module_sublist
 
1978
    do
 
1979
 
 
1980
    AC_MSG_MODULE_DBG(-e "\n================================================================")
 
1981
    AC_MSG_MODULE_DBG("testing $i")
1807
1982
    need_header=0
 
1983
 
 
1984
    #---------------------
 
1985
    # build a pseudo include header that includes current config and
 
1986
    # system symbols:
 
1987
    AC_LANG_CONFTEST(AC_LANG_SOURCE([[
 
1988
#include NETSNMP_SYSTEM_INCLUDE_FILE
 
1989
#include "$srcdir/$mibdir/$i.h"]]))
 
1990
    mv conftest.$ac_ext module_tmp_header.h
 
1991
 
 
1992
    #---------------------
 
1993
    # macro: config_belongs_in(ARG)
 
1994
    #   ARG: either
 
1995
    #     - mib_module   => libnetsnmpmibs   (default)
 
1996
    #     - agent_module => libnetsnmpagent
 
1997
    #
 
1998
    module_type=mib_module
 
1999
    if test -f $srcdir/$mibdir/$i.h; then
 
2000
      changequote(, )
 
2001
      module_type=`$MODULECPP module_tmp_header.h | grep config_belongs_in | sed 's@.*config_belongs_in(\([^)]*\)).*@\1@'`
 
2002
      changequote([, ])
 
2003
    fi
 
2004
    if test "x$module_type" = "x" ; then
 
2005
      module_type=mib_module
 
2006
    fi
 
2007
    if test "x$output_to" = "xnormal" ; then
 
2008
        output_inits="$mibdir/${module_type}_inits.h"
 
2009
        output_hdrs="$mibdir/${module_type}_includes.h"
 
2010
    fi
 
2011
 
 
2012
    #--------------------
 
2013
    # check for duplicates within the dll system. 
 
2014
    #   - if found in a dll, then remove from the dll and add to main
 
2015
    dblfix=""
 
2016
    for dltest in $dl_names ; do
 
2017
      eval mod_files="\"\$dl_${dltest}_files\""
 
2018
      if echo " $mod_files " | grep " $i " > /dev/null; then
 
2019
        # some dll module has already seen this, unload it from that list
 
2020
        # and include it in the core (again)
 
2021
        AC_MSG_MODULE_DBG("removing $i from $dltest")
 
2022
        mod_files=`echo " $mod_files " | sed "s@ $i @@"`
 
2023
        dblfix="__XXX__"
 
2024
        eval "dl_${dltest}_files=\"$mod_files\""
 
2025
 
 
2026
        module_list="$module_list $i"
 
2027
        echo "read_config.lo: mibgroup/$i.h" >> $module_list_deps
 
2028
        if test $module_type = "agent_module" ; then
 
2029
            echo "snmp_vars.lo: mibgroup/$i.h" >> $agent_module_list_deps
 
2030
        else
 
2031
            echo "mib_modules.lo: mibgroup/$i.h" >> $mib_module_list_deps
 
2032
        fi
 
2033
        eval ${module_type}_list="\"\$${module_type}_list $i\""
 
2034
        echo "  $i \\" >> $module_list_code
 
2035
        echo $ECHO_N " $i" $ECHO_C >> $MODULE_LIST
 
2036
        eval tmpfilevar=\$`echo ${module_type}_list_code`
 
2037
        echo "  $i \\" >> $tmpfilevar
 
2038
 
 
2039
        # XXX: add this to the main init list; this is possible not
 
2040
        # quite in the right spot any longer but we're stuck with it.
 
2041
        # Adding it back to the original ordered spot would be a
 
2042
        # nightmare.  Ok, we're already in nightmare code so that
 
2043
        # wolud have to be a night-terror.
 
2044
        mnm=`echo $i | sed 's/.*\///;s/\.c$//;'`
 
2045
        output_inits_tmp="$mibdir/${module_type}_inits.h"
 
2046
        echo "  if (should_init(\"$mnm\")) init_$mnm();" >> $output_inits_tmp
 
2047
        # XXX: even worse, we loose whether the header is needed or not.
 
2048
        output_hdrs_tmp="$mibdir/${module_type}_includes.h"
 
2049
        echo '#include "'"mibgroup/$i.h"'"' >> $output_hdrs_tmp
 
2050
      fi
 
2051
    done
 
2052
 
1808
2053
    #---------------------
1809
2054
    # make sure module wasn't explicity excluded, or already added
1810
2055
    #
1811
 
    if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
1812
 
      if test $module_debug -eq 1; then
1813
 
        echo "$i was excluded"
1814
 
      fi
 
2056
    if test "x$dblfix" != "x" ; then
 
2057
      AC_MSG_MODULE_DBG("$i was duplicated -- putting into main")
 
2058
    elif echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
 
2059
      AC_MSG_MODULE_DBG("$i was excluded")
1815
2060
    elif echo " $module_list " | grep " $i " > /dev/null; then
1816
 
      if test $module_debug -eq 1; then
1817
 
        echo "$i already tested"
1818
 
      fi
 
2061
      AC_MSG_MODULE_DBG("$i already tested")
1819
2062
    else
 
2063
 
1820
2064
      #---------------------
1821
2065
      # process modules header, checking for config_ pseudo-macros
1822
2066
      #
1823
 
      module_type=mib_module
1824
 
      if test -f $srcdir/$mibdir/$i.h; then
1825
 
        module_type=`$MODULECPP $srcdir/$mibdir/$i.h | grep config_belongs_in | sed 's@.*config_belongs_in(\([^)]*\)).*@\1@'`
1826
 
      fi
1827
 
      if [ "x$module_type" = "x" ]; then
1828
 
        module_type=mib_module
1829
 
      fi
 
2067
 
 
2068
      #---------------------
 
2069
      # does the header file for the module exist?
 
2070
      #   macros are only processed if it does
1830
2071
      if test -f $srcdir/$mibdir/$i.h; then
1831
2072
        new_list=""
 
2073
 
1832
2074
        #---------------------
 
2075
        # macro: config_exclude(modules)
 
2076
        #  - lists conflicts with other modules
 
2077
        #    - EG: new MIB implementations exclude old and vice-versa
 
2078
        #
1833
2079
        # check if $i has any conflicts
1834
2080
        #
1835
 
        new_list_excl="`$MODULECPP $srcdir/$mibdir/$i.h | grep config_exclude | sed 's/.*config_exclude(\(.*\)).*/\1/'`"
 
2081
        new_list_excl=`$MODULECPP module_tmp_header.h | grep config_exclude | sed 's/.*config_exclude(\(.*\)).*/\1/'`
1836
2082
        if test "x$new_list_excl" != "x"; then
1837
 
          if test $module_debug -eq 1; then
1838
 
             echo "$i excludes $new_list_excl"
1839
 
          fi
 
2083
          AC_MSG_MODULE_DBG("$i excludes $new_list_excl")
1840
2084
          for j in $new_list_excl
1841
2085
            do
1842
2086
            if echo " $module_list $new_mib_module_list $new_list_two " | grep " $j " > /dev/null; then
1843
 
              changequote([, ])
1844
2087
              mib_cfg_msg="mib module '$i' excludes module '$j' but another module requires it"
1845
2088
              AC_MSG_WARN([mib module error])
1846
2089
              if test "x$with_mib_cfg_checks" = "xyes"; then
1849
2092
                AC_MSG_WARN([$mib_cfg_msg])
1850
2093
                AC_MSG_CACHE_ADD([*** MIB Module warning *** $mib_cfg_msg])
1851
2094
              fi
1852
 
              changequote(, )
1853
2095
            else
1854
2096
              new_with_out_mib_modules="$j $new_with_out_mib_modules"
1855
 
              if test $module_debug -eq 1; then
1856
 
                echo "$j added to excluded list"
1857
 
              fi
 
2097
              AC_MSG_MODULE_DBG("$j added to excluded list")
1858
2098
            fi
1859
2099
          done
1860
2100
        fi
 
2101
 
1861
2102
        #---------------------
 
2103
        # macro: config_arch_require(ARCH,modules)
 
2104
        #  - lists modules required for a given ARCH
 
2105
        #
1862
2106
        # check if $i has any architecture specific requirements
1863
2107
        #
1864
 
        new_list_arch=`grep config_arch_require $srcdir/$mibdir/$i.h | sed 's/.*config_arch_require(\(.*\), *\(.*\)).*/\1-xarchx-\2/'`
 
2108
        changequote(, )
 
2109
        new_list_arch=`$MODULECPP module_tmp_header.h | grep config_arch_require | sed 's/.*config_arch_require( *\([^ ]*\) *, *\([^ ]*\) *).*/\1-xarchx-\2/'`
 
2110
        changequote([, ])
1865
2111
        if test "x$new_list_arch" != "x"; then
1866
2112
          for j in $new_list_arch
1867
2113
            do
1868
2114
            archtest=`echo $j | sed 's/-xarchx-.*//'`
1869
 
            if test "x$target_os" = "x$archtest" -o "x$PARTIALTARGETOS" = "x$archtest"; then
 
2115
            # target_os may have been changed to a #define of 1...
 
2116
            if test "x$archtest" = "x1" -o "x$target_os" = "x$archtest" -o "x$PARTIALTARGETOS" = "x$archtest"; then
1870
2117
              new_list="$new_list `echo $j | sed 's/.*-xarchx-//'`"
 
2118
              AC_MSG_MODULE_DBG(" $i required adding arch files: `echo $j | sed 's/.*-xarchx-//'`")
1871
2119
            fi
1872
2120
          done
1873
2121
        fi
1874
 
        if test $module_debug -eq 1; then
1875
 
          echo " $i required arch files: $new_list_arch"
1876
 
        fi
 
2122
        AC_MSG_MODULE_DBG(" $i required arch files: $new_list")
 
2123
 
1877
2124
        #---------------------
 
2125
        # macro: config_require(modules)
 
2126
        #  - lists modules required for this module
 
2127
        #
1878
2128
        # check if $i has any other required modules
1879
2129
        #
1880
 
        new_list="$new_list `$MODULECPP $srcdir/$mibdir/$i.h | grep config_require | sed 's/.*config_require(\(.*\)).*/\1/'`"
1881
 
        if test $module_debug -eq 1; then
1882
 
          echo " $i will test: $new_list"
1883
 
        fi
 
2130
        new_list="$new_list `$MODULECPP module_tmp_header.h | grep config_require | sed 's/.*config_require(\(.*\)).*/\1/'`"
 
2131
        AC_MSG_MODULE_DBG(" $i will test: $new_list")
1884
2132
        if test "x$new_list" != "x"; then
1885
2133
          for j in $new_list
1886
2134
            do
1887
 
            if test $module_debug -eq 1; then
1888
 
              echo -n " $i wants to add $j: "
1889
 
            fi
 
2135
            AC_MSG_MODULE_DBG(-n " $i wants to add $j: ")
1890
2136
            if test ! -f $srcdir/$mibdir/$j.h -a ! -f $srcdir/$mibdir/$j.c; then
1891
 
              changequote([, ])
1892
2137
              AC_MSG_WARN([mib module error])
1893
2138
              AC_MSG_ERROR([mib module "$i" requires module "$j" but $j.h or $j.c could not be found in $srcdir/$mibdir])
1894
 
              changequote(, )
1895
2139
            elif echo " $new_with_out_mib_modules " | grep " $j " > /dev/null; then
1896
 
              changequote([, ])
1897
 
              mib_cfg_msg="mib module '$i' requires module '$j' but someone told me to compile without it"
1898
 
              AC_MSG_WARN([mib module error])
1899
 
              if test "x$with_mib_cfg_checks" = "xyes"; then
1900
 
                AC_MSG_ERROR([$mib_cfg_msg])
1901
 
              else
1902
 
                AC_MSG_WARN([$mib_cfg_msg])
1903
 
                AC_MSG_CACHE_ADD([*** MIB Module warning *** $mib_cfg_msg])
1904
 
              fi
1905
 
              changequote(, )
1906
 
            elif echo " $module_list $new_list_two $new_module_list " | grep " $j " > /dev/null; then
1907
 
              if test $module_debug -eq 1; then
1908
 
                echo "  $j included previously"
 
2140
              if test "x$i" != "xdefault_modules" ; then
 
2141
                mib_cfg_msg="mib module '$i' requires module '$j' but someone told me to compile without it"
 
2142
                AC_MSG_WARN([mib module error])
 
2143
                if test "x$with_mib_cfg_checks" = "xyes"; then
 
2144
                  AC_MSG_ERROR([$mib_cfg_msg])
 
2145
                else
 
2146
                  AC_MSG_WARN([$mib_cfg_msg])
 
2147
                  AC_MSG_CACHE_ADD([*** MIB Module warning *** $mib_cfg_msg])
 
2148
                fi
 
2149
#           elif echo " $module_list $new_list_two $new_module_list " | grep " $j " > /dev/null; then
 
2150
#              AC_MSG_MODULE_DBG("  $j included previously")
1909
2151
              fi
1910
2152
            else
1911
2153
              new_list_two="$new_list_two $j"
1912
 
              if test $module_debug -eq 1; then
1913
 
                echo "  $j included"
1914
 
              fi
 
2154
              AC_MSG_MODULE_DBG("  $j included")
1915
2155
            fi
1916
2156
          done
1917
2157
        fi
 
2158
 
1918
2159
        #---------------------
 
2160
        # macro: config_add_mib(SOME-MIB)
 
2161
        #  - lists MIBs to be added to the default to-load list.
 
2162
        #
1919
2163
        # check if $i has any mibs to add
1920
2164
        #
1921
 
        new_mibs=`$MODULECPP $srcdir/$mibdir/$i.h | grep config_add_mib | sed 's/.*config_add_mib(\(.*\)).*/\1/'`
 
2165
        new_mibs=`$MODULECPP module_tmp_header.h | grep config_add_mib | sed 's/.*config_add_mib(\(.*\)).*/\1/'`
1922
2166
        if test "x$new_mibs" != "x"; then
1923
2167
            for j in $new_mibs
1924
2168
                do
1934
2178
                fi
1935
2179
            done
1936
2180
        fi # new mibs
 
2181
 
1937
2182
        #-------------------
 
2183
        # add the current module to the list of stuff to compile, etc.
 
2184
        #
1938
2185
        # add $i to module list
1939
2186
        #
1940
 
        if test $module_debug -eq 1; then 
1941
 
           echo "  $i added (based on $i.h)"
1942
 
        fi
 
2187
        AC_MSG_MODULE_DBG("  $i added (based on $i.h)")
1943
2188
        module_list="$module_list $i"
1944
 
        module_list_h="$module_list_h mibgroup/$i.h"
1945
2189
        eval ${module_type}_list="\"\$${module_type}_list $i\""
1946
 
        eval ${module_type}_list_h="\"\$${module_type}_list_h mibgroup/$i.h\""
 
2190
 
 
2191
        echo "read_config.lo: mibgroup/$i.h" >> $module_list_deps
 
2192
        if test $module_type = "agent_module" ; then
 
2193
            echo "snmp_vars.lo: mibgroup/$i.h" >> $agent_module_list_deps
 
2194
        else
 
2195
            echo "mib_modules.lo: mibgroup/$i.h" >> $mib_module_list_deps
 
2196
        fi
 
2197
 
1947
2198
        #-------------------
1948
2199
        # check for unsupported config_load_mib
1949
2200
        #
1950
 
        if $MODULECPP $srcdir/$mibdir/$i.h | grep config_load_mib > /dev/null 2>&1; then
1951
 
          changequote([, ])
 
2201
        if $MODULECPP module_tmp_header.h | grep config_load_mib > /dev/null 2>&1; then
1952
2202
          AC_MSG_WARN([mib module error])
1953
2203
          AC_MSG_WARN([mib module "$i" uses the "config_load_mib" directive, which is no longer supported.  It probably won't work.])
1954
 
          changequote(, )
1955
2204
        fi # grep config_load_mib
 
2205
 
1956
2206
        #-------------------
1957
2207
        # check for config_parse_dot_conf
 
2208
        #  (generally not used any longer; old auto-load a .conf token)
1958
2209
        #
1959
 
        $MODULECPP $srcdir/$mibdir/$i.h | grep config_parse_dot_conf | sed 's@.*config_parse_dot_conf(\([^)]*\), *\([^),]*\), *\([^),]*\), *\([^),]*\)).*@register_config_handler("snmpd",\1, \2, \3, \4);@' >> $mibdir/mib_module_dot_conf.h
 
2210
        changequote(, )
 
2211
        $MODULECPP module_tmp_header.h | grep config_parse_dot_conf | sed 's@.*config_parse_dot_conf(\([^)]*\), *\([^),]*\), *\([^),]*\), *\([^),]*\)).*@register_config_handler("snmpd",\1, \2, \3, \4);@' >> $mibdir/mib_module_dot_conf.h
 
2212
        changequote([, ])
 
2213
 
1960
2214
        #---------------------
 
2215
        # macro: config_error(error text)
 
2216
        #  - used to signal a configuration error from a module
 
2217
        #
1961
2218
        # check if $i has any errors, or warnings
1962
2219
        #
1963
 
        error=`$MODULECPP $srcdir/$mibdir/$i.h | grep config_error | sed 's/.*config_error(\(.*\)).*/\1/'`
 
2220
        error=`$MODULECPP module_tmp_header.h | grep config_error | sed 's/.*config_error(\(.*\)).*/\1/'`
1964
2221
        if test "x$error" != "x"; then
1965
 
          changequote([, ])
1966
2222
          echo
1967
2223
          echo
1968
2224
          AC_MSG_ERROR([$i: *** $error ***])
1969
 
          changequote(, )
1970
2225
        fi
1971
 
        warning=`$MODULECPP $srcdir/$mibdir/$i.h | grep config_warning | sed 's/.*config_warning(\(.*\)).*/\1/'`
 
2226
 
 
2227
        #---------------------
 
2228
        # macro: config_warning(warning text)
 
2229
        #  - used to signal a configuration "warning" to be printed to the user
 
2230
        #
 
2231
        warning=`$MODULECPP module_tmp_header.h | grep config_warning | sed 's/.*config_warning(\(.*\)).*/\1/'`
1972
2232
        if test "x$warning" != "x"; then
1973
2233
          all_warnings="$all_warnings $warning
1974
2234
"
1975
2235
        fi
 
2236
 
 
2237
      #---------------------
 
2238
      # Check for a .c file if the .h didn't exist
 
2239
      #
1976
2240
      elif test -f $srcdir/$mibdir/$i.c; then
1977
2241
        if echo " $module_list $new_list_two $new_module_list " | grep " $i      " > /dev/null; then
1978
 
           if test $module_debug -eq 1; then 
1979
 
             echo "  $i already included"
1980
 
           fi
 
2242
           AC_MSG_MODULE_DBG("  $i already included")
1981
2243
        else
1982
 
           if test $module_debug -eq 1; then 
1983
 
             echo "  $i added (based on $i.c)"
1984
 
           fi
 
2244
           AC_MSG_MODULE_DBG("  $i added (based on $i.c)")
1985
2245
           module_list="$module_list $i"
1986
2246
           mib_module_list="$mib_module_list $i"
1987
2247
        fi
 
2248
 
 
2249
      #---------------------
 
2250
      # No .h or .c = error!  (typo?)
 
2251
      #
1988
2252
      else # no $i.h or $i.c
1989
 
        changequote([, ])
1990
2253
        AC_MSG_WARN([mib module error])
1991
2254
        AC_MSG_ERROR([module files $i.h or $i.c could not be found in $srcdir/$mibdir])
1992
 
        changequote(, )
1993
2255
      fi # no $i.h
 
2256
 
1994
2257
      #-------------------
1995
2258
      # check for init/shutdown routines too
1996
2259
      #
 
2260
      has_c_code=no
1997
2261
      if test -f $srcdir/$mibdir/$i.c; then
1998
 
        module_list_code="$module_list_code $i"
1999
 
        eval ${module_type}_list_code="\"\$${module_type}_list_code $i\""
 
2262
        if test "x$output_to" = "xnormal" ; then
 
2263
          echo "        $i \\" >> $module_list_code
 
2264
          echo $ECHO_N " $i" $ECHO_C >> $MODULE_LIST
 
2265
          eval tmpfilevar=\$`echo ${module_type}_list_code`
 
2266
          echo "        $i \\" >> $tmpfilevar
 
2267
        else
 
2268
          eval "dl_${dl_name}_files=\"\$dl_${dl_name}_files $i\""
 
2269
          saved_sublist_code="$saved_sublist_code $i"
 
2270
        fi
2000
2271
        mnm=`echo $i | sed 's/.*\///;s/\.c$//;'`
2001
 
        if test $module_debug -eq 1; then
2002
 
          echo -e "\nchecking '$srcdir/$mibdir/$i.c' ($mnm/`basename $i`) C file for init/shutdown"
2003
 
        fi
 
2272
        AC_MSG_MODULE_DBG(-e "\nchecking '$srcdir/$mibdir/$i.c' ($mnm/`basename $i`) C file for init/shutdown")
2004
2273
        if test "x$mnm" != "x`basename $i`"; then
2005
 
           changequote([, ])
2006
2274
           AC_MSG_WARN([mib module error])
2007
2275
           AC_MSG_ERROR([conflicting names: $mnm != `basename $i`])
2008
 
           changequote(, )
2009
2276
        fi
2010
2277
        temp_init=`grep init_$mnm $srcdir/$mibdir/$i.c | grep -v _init_$mnm`
2011
2278
        if test "x$temp_init" != "x"; then
2012
 
            if test $module_debug -eq 1; then
2013
 
              echo -e "adding init_$mnm() to list"
2014
 
            fi
 
2279
            AC_MSG_MODULE_DBG(-e "adding init_$mnm() to list")
2015
2280
            need_header=1
2016
 
            echo "  if (should_init(\"$mnm\")) init_$mnm();" >> $mibdir/${module_type}_inits.h
 
2281
            echo "  if (should_init(\"$mnm\")) init_$mnm();" >> $output_inits
2017
2282
        fi
2018
2283
        grep shutdown_$mnm $srcdir/$mibdir/$i.c > /dev/null
2019
2284
        if test $? -eq 0 ; then
2024
2289
            echo "  if (should_init(\"$mnm\")) shutdown_$mnm();" >> $mibdir/${module_type}_shutdown.h
2025
2290
        fi
2026
2291
      fi # test -f $srcdir/$mibdir/$i.c
 
2292
 
2027
2293
      #-------------------
2028
2294
      # if there is a shutdown/init list,
2029
2295
      #
2030
2296
      if test $need_header -eq 1 ; then
2031
 
           echo '#include "'"mibgroup/$i.h"'"' >> $mibdir/${module_type}_includes.h
2032
 
        else
2033
 
           echo '/*#include "'"mibgroup/$i.h"'"*/' >> $mibdir/${module_type}_includes.h
2034
 
        fi
 
2297
         echo '#include "'"mibgroup/$i.h"'"' >> $output_hdrs
 
2298
      else
 
2299
         echo '/*#include "'"mibgroup/$i.h"'"*/' >> $output_hdrs
 
2300
      fi
 
2301
 
2035
2302
      #-------------------
2036
2303
      # check for output directory (for building outside of source tree
2037
2304
      #
 
2305
      changequote(, )
2038
2306
      if test "x`echo $i | sed 's/\///g;'`" != "x$i"; then
2039
2307
        mnd=`echo $i | sed 's/\/[^/]*$//;'`
2040
2308
        if test ! -d ./$mibdir/$mnd; then
2041
2309
            module_directories="$module_directories ./$mibdir/$mnd"
2042
2310
        fi
2043
2311
      fi # module directory test
 
2312
      changequote([, ])
 
2313
 
2044
2314
      #-------------------
2045
2315
      # define USING_*_MODULE
2046
2316
      #
 
2317
      changequote(, )
2047
2318
      sym="`echo ${i} | sed 's/[^a-zA-Z0-9_]/_/g' | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`"
 
2319
      changequote([, ])
2048
2320
      echo "/* Define if compiling with the ${i} module files.  */" >> include/net-snmp/agent/${module_type}_config.h
2049
2321
      echo "#define USING_${sym}_MODULE 1" >> include/net-snmp/agent/${module_type}_config.h
2050
2322
      echo " " >> include/net-snmp/agent/${module_type}_config.h
 
2323
 
2051
2324
      #-------------------
2052
 
      changequote([, ])
2053
2325
      echo $ECHO_N " $i$ECHO_C"
2054
 
      changequote(, )
2055
2326
    fi #
2056
 
  done # for i in $new_module_list
 
2327
    done # for i in $module_sublist
 
2328
 
 
2329
    if test "$output_to" = "separate" ; then
 
2330
      if test "x$new_list_two" = "x" ; then
 
2331
        # no new sub-modules to add to the current target
 
2332
        output_to="normal"
 
2333
 
 
2334
        dllcleans="$saved_sublist_o $dllcleans"
 
2335
        output_inits=""
 
2336
        module_sublist=""
 
2337
      else
 
2338
        # a module had sub-modules required; keep goin'
 
2339
        saved_sublist="$saved_sublist $module_sublist"
 
2340
        module_sublist="$new_list_two"
 
2341
        new_list_two=""
 
2342
      fi
 
2343
    else
 
2344
      module_sublist=""
 
2345
    fi
 
2346
 
 
2347
    done # while module_sublist
 
2348
  done # for j in $new_module_list
 
2349
 
 
2350
  # remember the top level modules for later reporting
 
2351
  if test $first_pass = 1 ; then
 
2352
    # remember this list for later reporting
 
2353
    top_level_modules="$new_module_list => $new_list_two"
 
2354
    first_pass=0
 
2355
  fi
2057
2356
  #-------------------
2058
 
  # if $i added new modules vis config_*, check those modules for requirements too
2059
 
  #
 
2357
  # if $i added new modules vis config_*,
 
2358
  # check those modules for requirements too
 
2359
  #
 
2360
  # transfer the new module to check list to the normal variable
 
2361
  #
 
2362
  if test "x$new_list_two" ; then
 
2363
    output_to=normal
 
2364
  fi
2060
2365
  new_module_list="$new_list_two"
2061
2366
  new_list_two=""
2062
2367
done # while test "x$new_module_list" != "x"; do
 
2368
echo ""
 
2369
 
 
2370
#--------------------
 
2371
# construct the dll code files and make rules.  This can't be done
 
2372
# until now because dulpicate use of a module means it gets removed
 
2373
# from the dll and put into the main agent.
 
2374
#
 
2375
for i in $dl_names ; do
 
2376
  eval mod_files="\"\$dl_${i}_files\""
 
2377
  echo "components in the $i dll: $mod_files"
 
2378
 
 
2379
  output_inits="agent/mibgroup/${i}-dll.c"
 
2380
  output_hdrs="agent/mibgroup/${i}-hdrs.h"
 
2381
 
 
2382
  AC_MSG_MODULE_DBG("creating dll file: $output_inits")
 
2383
  for ofile in $output_inits $output_hdrs ; do
 
2384
    if test -f $ofile ; then
 
2385
      if grep "this file created automatically by configure" $ofile > /dev/null 2>&1 ; then
 
2386
        :
 
2387
      else
 
2388
        AC_MSG_ERROR([$ofile already existed ; can't build dll object $i])
 
2389
      fi
 
2390
    fi
 
2391
    cat > $ofile << EOFIF
 
2392
/* xDo not edit; this file created automatically by configure */
 
2393
EOFIF
 
2394
  done
 
2395
 
 
2396
  cat >> $output_inits << EOFOC
 
2397
#include <net-snmp/net-snmp-config.h>
 
2398
#include <net-snmp/net-snmp-includes.h>
 
2399
#include <net-snmp/agent/net-snmp-agent-includes.h>
 
2400
#include "${i}-hdrs.h"
 
2401
void
 
2402
init_$i(void) {
 
2403
EOFOC
 
2404
 
 
2405
  # create the .so rule
 
2406
  saved_sublist_o=`echo "$mod_files " | sed 's/^ *//g;s/  */.o /g;'`
 
2407
 
 
2408
  # create the rules for each object
 
2409
  for j in $mod_files ; do
 
2410
    cat >> $module_rules << EOFR
 
2411
$j.o: $j.c
 
2412
        \$(CC) -c \$(CPPFLAGS) \$(CFLAGS) \$(DLFLAGS) -o \$@ \$<
 
2413
 
 
2414
EOFR
 
2415
    mnm=`echo $j | sed 's/.*\///;s/\.c$//;'`
 
2416
    echo "  if (should_init(\"$mnm\")) init_$mnm();" >> $output_inits
 
2417
  done
 
2418
 
 
2419
  # create the rule for the .so and wrapper code
 
2420
  cat >> $module_rules << EOFM
 
2421
${i}-dll.o: ${i}-dll.c
 
2422
        \$(CC) -c \$(CPPFLAGS) \$(CFLAGS) \$(DLFLAGS) -o \$@ \$<
 
2423
 
 
2424
${i}.so: $saved_sublist_o ${i}-dll.o
 
2425
        \$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(DLFLAGS) -o \$@ $saved_sublist_o ${i}-dll.o
 
2426
 
 
2427
EOFM
 
2428
        cat >> $output_inits << EOFOCFIN
 
2429
}
 
2430
EOFOCFIN
 
2431
 
 
2432
done
 
2433
 
 
2434
# cleanup
 
2435
rm -f module_tmp_header.h
2063
2436
 
2064
2437
#-------------------
2065
2438
# build module lists for Makefiles
2066
2439
#
2067
 
module_list_o=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.o /g'`
2068
 
module_list_lo=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.lo /g'`
2069
 
module_list_c=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.c /g'`
2070
 
 
2071
 
mib_module_list_o=`echo "$mib_module_list_code " | sed 's/\([^ ]\) /\1.o /g'`
2072
 
mib_module_list_lo=`echo "$mib_module_list_code " | sed 's/\([^ ]\) /\1.lo /g'`
2073
 
mib_module_list_c=`echo "$mib_module_list_code " | sed 's/\([^ ]\) /\1.c /g'`
2074
 
mibgroup_list_o=`echo " $mib_module_list_o " | sed 's@ \([^ ]*\)\.o@ mibgroup/\1.o @g'`
2075
 
mibgroup_list_lo=`echo " $mib_module_list_lo " | sed 's@ \([^ ]*\)\.lo@ mibgroup/\1.lo @g'`
2076
 
 
2077
 
agent_module_list_o=`echo "$agent_module_list_code " | sed 's/\([^ ]\) /\1.o /g'`
2078
 
agent_module_list_lo=`echo "$agent_module_list_code " | sed 's/\([^ ]\) /\1.lo /g'`
2079
 
agent_module_list_c=`echo "$agent_module_list_code " | sed 's/\([^ ]\) /\1.c /g'`
2080
 
agentgroup_list_o=`echo " $agent_module_list_o " | sed 's@ \([^ ]*\)\.o@ mibgroup/\1.o @g'`
2081
 
agentgroup_list_lo=`echo " $agent_module_list_lo " | sed 's@ \([^ ]*\)\.lo@ mibgroup/\1.lo @g'`
 
2440
changequote(, )
 
2441
 
 
2442
for i in module_list_o module_list_c module_list_lo mib_module_list_o mib_module_list_c mib_module_list_lo mibgroup_list_o mibgroup_list_lo agent_module_list_o agent_module_list_c agent_module_list_lo agentgroup_list_o agentgroup_list_lo ; do
 
2443
  eval "$i=mk/${i}.mk"
 
2444
done
 
2445
 
 
2446
sed 's/^module_list_code/module_list_o/;s/\([^=]\)  *\\/\1.o \\/g'  < $module_list_code  > $module_list_o
 
2447
sed 's/^module_list_code/module_list_c/;s/\([^=]\)  *\\/\1.c \\/g'  < $module_list_code  > $module_list_c
 
2448
sed 's/^module_list_code/module_list_lo/;s/\([^=]\)  *\\/\1.lo \\/g' < $module_list_code  > $module_list_lo
 
2449
 
 
2450
sed 's/^mib_module_list_code/mib_module_list_o/;s/\([^=]\)  *\\/\1.o \\/g'  < $mib_module_list_code  > $mib_module_list_o
 
2451
sed 's/^mib_module_list_code/mib_module_list_c/;s/\([^=]\)  *\\/\1.c \\/g'  < $mib_module_list_code  > $mib_module_list_c
 
2452
sed 's/^mib_module_list_code/mib_module_list_lo/;s/\([^=]\)  *\\/\1.lo \\/g' < $mib_module_list_code  > $mib_module_list_lo
 
2453
 
 
2454
sed 's/^mib_module_list_o/mibgroup_list_o/;s@\([^       ]*\)\.o@mibgroup/\1.o@g' < $mib_module_list_o > $mibgroup_list_o
 
2455
sed 's/^mib_module_list_lo/mibgroup_list_lo/;s@\([^     ]*\)\.lo@mibgroup/\1.lo@g' < $mib_module_list_lo > $mibgroup_list_lo
 
2456
 
 
2457
sed 's/^agent_module_list_code/agent_module_list_o/;s/\([^=]\)  *\\/\1.o \\/g'  < $agent_module_list_code  > $agent_module_list_o
 
2458
sed 's/^agent_module_list_code/agent_module_list_c/;s/\([^=]\)  *\\/\1.c \\/g'  < $agent_module_list_code  > $agent_module_list_c
 
2459
sed 's/^agent_module_list_code/agent_module_list_lo/;s/\([^=]\)  *\\/\1.lo \\/g' < $agent_module_list_code  > $agent_module_list_lo
 
2460
 
 
2461
sed 's/^agent_module_list_o/agentgroup_list_o/;s@\([^   ]*\)\.o@mibgroup/\1.o@g' < $agent_module_list_o > $agentgroup_list_o
 
2462
sed 's/^agent_module_list_lo/agentgroup_list_lo/;s@\([^         ]*\)\.lo@mibgroup/\1.lo@g' < $agent_module_list_lo > $agentgroup_list_lo
 
2463
 
 
2464
for i in module_list_o module_list_c module_list_lo mib_module_list_o mib_module_list_c mib_module_list_lo mibgroup_list_o mibgroup_list_lo agent_module_list_o agent_module_list_c agent_module_list_lo agentgroup_list_o agentgroup_list_lo ; do
 
2465
        # hpux make (at least) doesn't like a trailing \ on the last
 
2466
        # line even when the next line contains nothing but
 
2467
        # whitespace.
 
2468
        lasttoken=`tail -1 mk/$i.mk | awk '{print $1}'`
 
2469
        sed "s#$lasttoken \\\\#$lasttoken#" < mk/$i.mk > mk/$i.mk.tmp
 
2470
        mv mk/$i.mk.tmp mk/$i.mk
 
2471
 
 
2472
        # add a closing comment
 
2473
        echo "" >> mk/$i.mk
 
2474
        echo "# end configure generated code" >> mk/$i.mk
 
2475
done
 
2476
 
 
2477
changequote([, ])
2082
2478
 
2083
2479
if test $module_debug -eq 1; then
2084
2480
   echo -e "\nFinal module list: $module_list_code"
2085
2481
   exit
2086
2482
fi
2087
 
changequote([, ])
2088
2483
if test "x$with_mib_cfg_checks" = "xyes"; then
2089
2484
  AC_MSG_CACHE_ADD([Agent Module list: $module_list_code])
2090
2485
fi
2091
 
MODULE_LIST=$module_list_code
2092
 
AC_SUBST(MODULE_LIST)
2093
 
AC_SUBST(module_list_c)
2094
 
AC_SUBST(module_list_h)
2095
 
AC_SUBST(module_list_o)
2096
 
AC_SUBST(module_list_lo)
2097
 
AC_SUBST(mib_module_list_c)
2098
 
AC_SUBST(mib_module_list_h)
2099
 
AC_SUBST(mib_module_list_o)
2100
 
AC_SUBST(mib_module_list_lo)
2101
 
AC_SUBST(agent_module_list_c)
2102
 
AC_SUBST(agent_module_list_h)
2103
 
AC_SUBST(agent_module_list_o)
2104
 
AC_SUBST(agent_module_list_lo)
2105
 
AC_SUBST(mibgroup_list_o)
2106
 
AC_SUBST(mibgroup_list_lo)
2107
 
AC_SUBST(agentgroup_list_o)
2108
 
AC_SUBST(agentgroup_list_lo)
2109
 
AC_SUBST(module_list)
2110
 
AC_SUBST(mib_module_list)
2111
 
AC_SUBST(agent_module_list)
 
2486
AC_SUBST_FILE(MODULE_LIST)
 
2487
AC_SUBST_FILE(module_list_c)
 
2488
AC_SUBST_FILE(module_list_o)
 
2489
AC_SUBST_FILE(module_list_lo)
 
2490
AC_SUBST_FILE(mib_module_list_c)
 
2491
AC_SUBST_FILE(mib_module_list_o)
 
2492
AC_SUBST_FILE(mib_module_list_lo)
 
2493
AC_SUBST_FILE(agent_module_list_c)
 
2494
AC_SUBST_FILE(agent_module_list_o)
 
2495
AC_SUBST_FILE(agent_module_list_lo)
 
2496
AC_SUBST_FILE(mibgroup_list_o)
 
2497
AC_SUBST_FILE(mibgroup_list_lo)
 
2498
AC_SUBST_FILE(agentgroup_list_o)
 
2499
AC_SUBST_FILE(agentgroup_list_lo)
 
2500
AC_SUBST_FILE(agent_module_list)
 
2501
 
 
2502
#AC_SUBST_FILE(mib_module_list)
 
2503
#AC_SUBST(module_list)
2112
2504
AC_SUBST(default_mibs_install)
 
2505
AC_SUBST(dllcleans)
 
2506
AC_SUBST_FILE(module_rules)
 
2507
AC_SUBST_FILE(module_list_deps)
 
2508
AC_SUBST_FILE(mib_module_list_deps)
 
2509
AC_SUBST_FILE(agent_module_list_deps)
2113
2510
 
2114
2511
AC_MSG_RESULT(.)
2115
2512
 
2116
2513
if test $module_debug -eq 1; then
2117
2514
AC_MSG_CACHE_ADD(Agent MIB code:            $module_list)
2118
2515
fi
 
2516
AC_MSG_CACHE_ADD(Agent MIB code:            $top_level_modules)
2119
2517
 
2120
2518
# end hairy agent module processing
2121
2519
 
2129
2527
# Define default mibs
2130
2528
#
2131
2529
AC_MSG_CHECKING([default mib files to read])
2132
 
if test "x$DEFAULT_MIBS" = "x"; then
2133
 
  DEFAULT_MIBS="$default_mibs"
 
2530
if test "x$NETSNMP_DEFAULT_MIBS" = "x"; then
 
2531
  NETSNMP_DEFAULT_MIBS="$default_mibs"
2134
2532
fi
2135
2533
if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc" -o "x$PARTIALTARGETOS" = "xcygwin"; then
2136
2534
  # mingw32 and cygwin use ';' as the environment variable separator char
2137
2535
  ENV_SEPARATOR=";"
2138
 
  DEFAULT_MIBS=`echo "$DEFAULT_MIBS" | sed 's/:/;/g'`
 
2536
  NETSNMP_DEFAULT_MIBS=`echo "$NETSNMP_DEFAULT_MIBS" | sed 's/:/;/g'`
2139
2537
  default_mibs=`echo "$default_mibs" | sed 's/:/;/g'`
2140
2538
else
2141
2539
  ENV_SEPARATOR=":"
2142
2540
fi
2143
2541
AC_SUBST(ENV_SEPARATOR)
2144
 
AC_DEFINE_UNQUOTED(DEFAULT_MIBS,"$DEFAULT_MIBS")
2145
 
AC_SUBST(DEFAULT_MIBS)
2146
 
AC_MSG_RESULT($DEFAULT_MIBS)
 
2542
AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_MIBS,"$NETSNMP_DEFAULT_MIBS")
 
2543
AC_SUBST(NETSNMP_DEFAULT_MIBS)
 
2544
AC_MSG_RESULT($NETSNMP_DEFAULT_MIBS)
2147
2545
 
2148
2546
AC_MSG_CHECKING([whether we have to build PIC code])
2149
2547
echo " $module_list " | grep " ucd-snmp/dlmod " >/dev/null
2241
2639
 
2242
2640
# Checks for libraries.
2243
2641
# AC_CHECK_LIB(des, main)
2244
 
AC_CHECK_LIB(m, asin)
 
2642
# AC_CHECK_LIB(m, asin)
2245
2643
 
2246
2644
AC_ARG_WITH(elf,
2247
2645
        [AS_HELP_STRING(--without-elf,[use elf libraries])],,
2255
2653
        linux*) ;;
2256
2654
        irix*) # Check for nlist in mld (irix)
2257
2655
                AC_CHECK_LIB(elf, nlist)
 
2656
                AC_CHECK_LIB(elf, nlist64)
2258
2657
                AC_CHECK_LIB(mld, nlist)
2259
2658
                ;;
2260
2659
        *) # default
2274
2673
        AC_CHECK_LIB(socket, gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME)
2275
2674
        LIBS="${LIBS} -lsocket"))
2276
2675
 
2277
 
AC_CHECK_FUNC(getservbyname, AC_DEFINE(HAVE_GETSERVBYNAME),
2278
 
        AC_CHECK_LIB(socket, getservbyname, AC_DEFINE(HAVE_GETSERVBYNAME)
2279
 
        LIBS="${LIBS} -lsocket"))
 
2676
# Solaris kstat
 
2677
AC_CHECK_LIB(kstat, kstat_lookup,
 
2678
        AC_DEFINE(HAVE_LIBKSTAT, 1, [Define to 1 if you have the `kstat' library (-lkstat).])
 
2679
        LNETSNMPLIBS="${LNETSNMPLIBS} -lkstat")
2280
2680
 
2281
 
# Replace `main' with a function in -lkstat:
2282
 
AC_CHECK_LIB(kstat, kstat_lookup)
 
2681
# Check for libraries that the agent needs
 
2682
# saving old libraries
 
2683
NONAGENTLIBS=$LIBS
2283
2684
 
2284
2685
# Check for security related functions
2285
2686
if test "x$tryopenssl" != "xno"; then
2286
2687
    if test "x$askedopenssl" != "xyes" -a "x$askedpkcs" = "xyes"; then
2287
 
      AC_CHECK_LIB(pkcs11, C_Initialize)
 
2688
      AC_CHECK_LIB(pkcs11, C_Initialize, AC_DEFINE(HAVE_LIBPKCS11, 1, [Define to 1 if you have the `pkcs11' library (-lpkcs11).])
 
2689
              LIBPKCS11="-lpkcs11")
2288
2690
    else 
2289
2691
      if test "x$tryrsaref" != "xno"; then
2290
2692
         AC_CHECK_LIB(rsaref, RSAPrivateDecrypt)
2291
2693
         AC_CHECK_LIB(RSAglue, RSA_PKCS1_RSAref)
2292
2694
      fi
2293
2695
 
2294
 
      AC_CHECK_LIB(crypto, EVP_md5)
2295
 
      AC_CHECK_FUNCS(AES_cfb128_encrypt)
 
2696
      AC_CHECK_LIB(crypto, EVP_md5, AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
 
2697
              LIBCRYPTO="-lcrypto")
 
2698
      AC_CHECK_LIB(crypto, AES_cfb128_encrypt, 
 
2699
              AC_DEFINE(HAVE_AES_CFB128_ENCRYPT, 1, [Define to 1 if you have the `AES_cfb128_encrypt' function.]))
2296
2700
    fi
2297
2701
elif test "x$askedpkcs" = "xyes"; then
2298
 
    AC_CHECK_LIB(pkcs11, C_Initialize)
 
2702
    AC_CHECK_LIB(pkcs11, C_Initialize, AC_DEFINE(HAVE_LIBPKCS11)
 
2703
            LIBPKCS11="-lpkcs11")
2299
2704
fi
2300
2705
 
2301
 
# Check for libraries that the agent needs
2302
 
# saving old libraries
2303
 
NONAGENTLIBS=$LIBS
 
2706
LIBS=$NONAGENTLIBS
2304
2707
 
2305
2708
# check for tcp wrapper support
2306
2709
_cppflags="${CPPFLAGS}"
2320
2723
 
2321
2724
    LIBS="$LIBS -lwrap"
2322
2725
        AC_MSG_CHECKING([for TCP wrappers library -lwrap])
 
2726
        # XXX: should check for hosts_ctl
2323
2727
        AC_TRY_LINK([#include <sys/types.h>
2324
2728
                     #include <tcpd.h>
2325
2729
                     int allow_severity = 0;
2327
2731
                    ],[hosts_access((void *)0)],[
2328
2732
 
2329
2733
            AC_MSG_RESULT([yes])
2330
 
            AC_DEFINE(USE_LIBWRAP)
2331
 
            test "$with_libwrap" != no -a "$with_libwrap" != yes && WRAPLIBS="-L$with_libwrap/lib"
2332
 
            WRAPLIBS="$WRAPLIBS -lwrap"],
 
2734
            AC_DEFINE(NETSNMP_USE_LIBWRAP)
 
2735
            test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap/lib"
 
2736
            _wraplibs="$_wraplibs -lwrap"],
2333
2737
        [
2334
2738
            AC_MSG_RESULT([no])
2335
2739
            # Linux RedHat 6.1 won't link libwrap without libnsl
2343
2747
                        ],[hosts_access((void *)0)],
2344
2748
 
2345
2749
                        AC_MSG_RESULT(yes)
2346
 
                        AC_DEFINE(USE_LIBWRAP)
2347
 
                        test "$with_libwrap" != no -a "$with_libwrap" != yes && WRAPLIBS="-L$with_libwrap/lib"
2348
 
                        WRAPLIBS="$WRAPLIBS -lwrap -lnsl",
 
2750
                        AC_DEFINE(NETSNMP_USE_LIBWRAP)
 
2751
                        test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap/lib"
 
2752
                        _wraplibs="$_wraplibs -lwrap -lnsl",
2349
2753
 
2350
2754
                        AC_MSG_RESULT(no)
2351
2755
                        AC_MSG_ERROR(Asked to use libwrap but I couldn't find it.))])
 
2756
    LAGENTLIBS="$_wraplibs"
2352
2757
    CPPFLAGS=${_cppflags}
2353
2758
    LDFLAGS=${_ldflags}
2354
2759
    LIBS=${_libs}
2355
2760
  fi
2356
2761
])
2357
2762
 
 
2763
AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h)
 
2764
 
 
2765
AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no)
 
2766
AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no)
 
2767
 
 
2768
if test "x$rpmheader_h" = "xno" -o "x$rpmlib_h" = "xno" ; then
 
2769
  if test "x$with_rpm" = "xyes" ; then
 
2770
    AC_MSG_ERROR([Could not find either the RPM header files needed and was specifically asked to use RPM support])
 
2771
  else
 
2772
    with_rpm=no
 
2773
  fi
 
2774
fi
 
2775
 
2358
2776
#
2359
2777
# rpm libraries only needed for the host resources mib software
2360
2778
# installed tables (on linux in particular)
2377
2795
    fi
2378
2796
  ])
2379
2797
 
2380
 
 
2381
2798
  # dunno if this is needed for rpm-4.0.x, earlier probably needs.
2382
2799
  AC_CHECK_HEADER(zlib.h,
2383
2800
      AC_CHECK_LIB(z, gzread, , CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
2385
2802
 
2386
2803
  # two variants of bzip2 need checking.
2387
2804
  AC_ARG_WITH(bzip2,
2388
 
  [  --with-bzip2[=DIR]        use libbzip2 in DIR],[
 
2805
  [  --with-bzip2[=DIR]        use libbz2 in DIR],[
2389
2806
    if test -d "$withval"; then
2390
2807
      CPPFLAGS="${CPPFLAGS} -I$withval/include"
2391
2808
      LDFLAGS="${LDFLAGS} -L$withval/lib"
2414
2831
  # now check for rpm using the appropriate libraries.
2415
2832
  AC_CHECK_LIB(rpm, rpmGetFilesystemList,[
2416
2833
    AC_DEFINE(HAVE_LIBRPM)
2417
 
    LIBS="-lrpm $_rpmlibs $LIBS"
 
2834
    LMIBLIBS="-lrpm $_rpmlibs $LMIBLIBS"
2418
2835
    CFLAGS="$CFLAGS -I/usr/include/rpm"
2419
2836
  ],[
2420
2837
    # rpm-4.0.3 librpmdb actually contains what we need.
2421
2838
    AC_CHECK_LIB(rpmdb, rpmdbOpen,[
2422
2839
      AC_DEFINE(HAVE_LIBRPM)
2423
 
      LIBS="-lrpmdb -lrpm $_rpmlibs $LIBS"
 
2840
      LMIBLIBS="-lrpmdb -lrpm $_rpmlibs $LMIBLIBS"
2424
2841
      CFLAGS="$CFLAGS -I/usr/include/rpm"
2425
2842
    ],,-lrpm $_rpmlibs)
2426
2843
  ])
2427
2844
fi
2428
2845
  
2429
 
# Replace `main' with a function in -lkvm:
2430
 
AC_CHECK_LIB(kvm, kvm_read)
 
2846
# libkvm
 
2847
AC_CHECK_LIB(kvm, kvm_read, [_libkvm="-lkvm"])
 
2848
AC_CHECK_FUNC(kvm_openfiles, AC_DEFINE(HAVE_KVM_OPENFILES, 1, [Define to 1 if you have the `kvm_openfiles' function.]),
 
2849
        AC_CHECK_LIB(kvm, kvm_openfiles, AC_DEFINE(HAVE_KVM_OPENFILES, 1, [Define to 1 if you have the `kvm_openfiles' function.])
 
2850
        _libkvm="-lkvm"))
 
2851
AC_CHECK_FUNC(kvm_getprocs, AC_DEFINE(HAVE_KVM_GETPROCS, 1, [Define to 1 if you have the `kvm_getprocs' function.]),
 
2852
        AC_CHECK_LIB(kvm, kvm_getprocs, AC_DEFINE(HAVE_KVM_GETPROCS, 1, [Define to 1 if you have the `kvm_getprocs' function.])
 
2853
        _libkvm="-lkvm"))
 
2854
AC_CHECK_FUNC(kvm_getswapinfo, AC_DEFINE(HAVE_KVM_GETSWAPINFO, 1, [Define to 1 if you have the `kvm_getswapinfo' function.]),
 
2855
        AC_CHECK_LIB(kvm, kvm_getswapinfo, AC_DEFINE(HAVE_KVM_GETSWAPINFO, 1, [Define to 1 if you have the `kvm_getswapinfo' function.])
 
2856
        _libkvm="-lkvm"))
 
2857
if test "x${_libkvm}" != "x"; then
 
2858
        AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the `kvm' library (-lkvm).])
 
2859
        LAGENTLIBS="$LAGENTLIBS ${_libkvm}"
 
2860
fi
 
2861
 
2431
2862
# DYNAMIC MODULE SUPPORT
2432
 
AC_CHECK_LIB(dl, dlopen)
2433
 
AC_CHECK_FUNCS(dlopen)
2434
 
 
2435
 
AC_CHECK_FUNCS(kvm_openfiles nlist knlist kvm_getprocs kvm_getswapinfo)
 
2863
AC_CHECK_FUNC(dlopen, AC_DEFINE(HAVE_DLOPEN, 1, [Define to 1 if you have the `dlopen' function.]),
 
2864
        AC_CHECK_LIB(dl, dlopen, AC_DEFINE(HAVE_DLOPEN, 1, [Define to 1 if you have the `dlopen' function.])
 
2865
        AC_DEFINE(HAVE_LIBDL, 1, [Define to 1 if you have the `dl' library (-ldl).])
 
2866
        LMIBLIBS="${LMIBLIBS} -ldl"))
 
2867
 
 
2868
# nlist
 
2869
AC_CHECK_FUNCS(nlist nlist64 knlist)
 
2870
 
 
2871
# whether we need -ldevstat for diskio MIB
2436
2872
echo " $module_list " | grep " ucd-snmp/diskio " >/dev/null
2437
 
# whether we need -ldevstat for diskio MIB
2438
2873
if test $? -eq 0 ; then
2439
2874
        AC_CHECK_FUNC(getdevs, AC_DEFINE(HAVE_GETDEVS),
2440
2875
                AC_CHECK_LIB(devstat, getdevs, AC_DEFINE(HAVE_GETDEVS)
2441
 
                LIBS="${LIBS} -ldevstat"))
 
2876
                LMIBLIBS="${LMIBLIBS} -ldevstat"))
2442
2877
        AC_CHECK_FUNC(getdevs, AC_DEFINE(HAVE_DEVSTAT_GETDEVS),
2443
2878
                AC_CHECK_LIB(devstat, devstat_getdevs, AC_DEFINE(HAVE_DEVSTAT_GETDEVS)
2444
 
                LIBS="${LIBS} -ldevstat"))
 
2879
                LMIBLIBS="${LMIBLIBS} -ldevstat"))
2445
2880
fi
2446
2881
 
2447
2882
# LM-SENSORS-MIB support
2450
2885
        AC_MSG_CHECKING([for sensors support])
2451
2886
        case $target_os in
2452
2887
          solaris*)
2453
 
            AC_CHECK_HEADER(picl.h,LIBS="${LIBS} -lpicl",)
 
2888
            AC_CHECK_HEADER(picl.h, LMIBLIBS="${LMIBLIBS} -lpicl",)
2454
2889
            AC_CHECK_HEADERS(picl.h)
2455
2890
            ;;
2456
2891
        *)
2457
2892
            AC_CHECK_HEADER(sensors/sensors.h,,
2458
2893
                [AC_MSG_ERROR([asked to use lm_sensors but I couldn't find sensors/sensors.h])])
2459
 
            AC_CHECK_LIB(sensors, sensors_get_detected_chips, LIBS="${LIBS} -lsensors",
 
2894
            AC_CHECK_LIB(sensors, sensors_get_detected_chips, [
 
2895
                   LMIBLIBS="${LMIBLIBS} -lsensors" ;
 
2896
                ],
2460
2897
                [AC_MSG_ERROR([asked to use lm_sensors but I couldn't find -lsensors])])
2461
2898
            ;;
2462
2899
        esac
2463
2900
fi
2464
2901
 
2465
 
#
2466
 
# Install the various perl modules
2467
 
#
2468
 
 
2469
 
if test "x$embed_perl" = "xyes" ; then
2470
 
  if test "x$install_perl" = "xno" -o "x$install_perl" = "x" ; then
2471
 
    install_perl="yes"
2472
 
  fi
2473
 
fi
2474
 
if test "x$install_perl" != "x" -a "x$install_perl" != "xno"; then
2475
 
    PERLTARGS="perlmodules"
2476
 
    PERLINSTALLTARGS="perlinstall"
2477
 
    PERLUNINSTALLTARGS="perluninstall"
2478
 
    AC_SUBST(PERLTARGS)
2479
 
    AC_SUBST(PERLINSTALLTARGS)
2480
 
    AC_SUBST(PERLUNINSTALLTARGS)
2481
 
    AC_SUBST(PERLARGS)
2482
 
    if test "x$embed_perl" = "xyes" ; then
2483
 
      AC_MSG_CACHE_ADD(SNMP Perl modules:          building -- embeddable)
2484
 
    else
2485
 
      AC_MSG_CACHE_ADD(SNMP Perl modules:          building -- not embeddable)
2486
 
    fi
2487
 
else
2488
 
    AC_MSG_CACHE_ADD(SNMP Perl modules:          disabled)
2489
 
fi
 
2902
######################################################################
 
2903
# PERL SUPPORT
 
2904
######################################################################
 
2905
 
 
2906
#
 
2907
# test to see if we can attempt to build embedded Perl so far
 
2908
#
 
2909
if test "x$embed_perl" = "xtry" ; then
 
2910
  if test "x$install_perl" = "xno" ; then
 
2911
    install_perl="try"
 
2912
  fi
 
2913
  if test "x$ac_cv_path_PERLPROG" = "x" -o "x$ac_cv_path_PERLPROG" = "xno" ; then
 
2914
    install_perl="no"
 
2915
    embed_perl="no"
 
2916
  fi
 
2917
fi
 
2918
 
2490
2919
 
2491
2920
#
2492
2921
# Embedded Perl specific stuff
2493
2922
#
2494
 
if test "x$embed_perl" = "xyes"; then
 
2923
 
 
2924
# test perl prog
 
2925
if test "x$install_perl" != "xno" ; then
2495
2926
    myperl=$ac_cv_path_PERLPROG
2496
 
    if test $myperl = "no"; then
2497
 
      AC_MSG_ERROR(--enable-embedded-perl requested but no perl executable found)
2498
 
    fi
2499
 
 
2500
 
    AC_MSG_CHECKING([for perl CFLAGS])
 
2927
    if test $myperl = "no" ; then
 
2928
      if test "x$install_perl" = "xtry" ; then
 
2929
        install_perl="no"
 
2930
      else
 
2931
        AC_MSG_ERROR(--enable-embedded-perl requested but no perl executable found)
 
2932
      fi
 
2933
    fi
 
2934
fi
 
2935
 
 
2936
# test for shared libraries support
 
2937
if test "x$install_perl" != "xno" ; then
 
2938
    # embedded Perl requires shared libraries
 
2939
    if test "x$enable_shared" != "xyes"; then
 
2940
      if test "x$install_perl" = "xtry" ; then
 
2941
        install_perl="no"
 
2942
      else
 
2943
        AC_MSG_ERROR(Perl support requires --enable-shared)
 
2944
      fi
 
2945
    fi
 
2946
fi
 
2947
 
 
2948
if test "x$install_perl" != "xno" ; then
 
2949
  AC_MSG_CHECKING([if we are in the source tree so we can install Perl modules])
 
2950
  if test "x$srcdir" = "x." -o -d perl/agent/default_store ; then
 
2951
    AC_MSG_RESULT([Yes])
 
2952
  else
 
2953
    if test "x$install_perl" = "xtry" ; then
 
2954
      install_perl="no"
 
2955
      AC_MSG_RESULT([No])
 
2956
    else
 
2957
      AC_MSG_ERROR([Perl modules can not be built outside the source directory])
 
2958
    fi
 
2959
  fi
 
2960
fi      
 
2961
 
 
2962
# check the Perl compiler name
 
2963
if test "x$install_perl" != "xno" ; then
 
2964
    #
 
2965
    # Perl cc checks
 
2966
    #
 
2967
    if test "xenable_perl_cc_checks" != "xno" ; then
 
2968
      AC_MSG_CHECKING([for Perl cc])
 
2969
      changequote(, )
 
2970
      PERLCC=`$myperl -V:cc | $myperl -n -e 'print if (s/^\s*cc=.([-\w\s\/]+).;\s*/$1/);'`
 
2971
      changequote([, ])
 
2972
      if test "x$PERLCC" != "x" ; then
 
2973
        AC_MSG_RESULT([$PERLCC])
 
2974
      else
 
2975
        if test "x$install_perl" = "xtry" ; then
 
2976
          install_perl="no"
 
2977
        else
 
2978
          AC_MSG_ERROR([Could not determine the compiler that was used to build $myperl. Either set the environment variable PERLPROG to a different perl binary or use --without-perl-modules to build without Perl.])
 
2979
        fi
 
2980
      fi
 
2981
fi
 
2982
 
 
2983
# check the Perl compiler compatibility
 
2984
if test "x$install_perl" != "xno" ; then
 
2985
      AC_MSG_CHECKING([whether $PERLCC is a GNU C compiler])
 
2986
      OLDCC=$CC
 
2987
      CC="$PERLCC"
 
2988
      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
 
2989
#ifndef __GNUC__
 
2990
  choke me
 
2991
#endif
 
2992
      ]])], [perlcc_is_gnu=yes], [perlcc_is_gnu=no])
 
2993
      AC_MSG_RESULT([$perlcc_is_gnu])
 
2994
      CC=$OLDCC
 
2995
      if test "x$GCC" = "xyes" -a "x$perlcc_is_gnu" = "xno" ; then
 
2996
        if test "x$install_perl" = "xtry" ; then
 
2997
          install_perl="no"
 
2998
        else
 
2999
          AC_MSG_ERROR([This build is using a GNU C compiler ($CC) while Perl has been compiled with a non-GNU (or non-working) compiler ($PERLCC). This likely won't work for building with Perl support. Either specify a different compiler (--with-cc=PATH), disable this check (--disable-perl-cc-checks) or build without Perl (--without-perl-modules).])
 
3000
        fi
 
3001
      fi
 
3002
fi
 
3003
 
 
3004
# check if they're both gnu
 
3005
if test "x$install_perl" != "xno" ; then
 
3006
      if test "x$GCC" != "xyes" -a "x$perlcc_is_gnu" = "xyes" ; then
 
3007
        if test "x$install_perl" = "xtry" ; then
 
3008
          install_perl="no"
 
3009
        else
 
3010
          AC_MSG_ERROR([This build is using a non-GNU C compiler ($CC) while Perl has been compiled with a GNU compiler ($PERLCC). This likely won't work for building with Perl support. Either specify a different compiler (--with-cc=PATH), disable this check (--disable-perl-cc-checks) or build without Perl (--without-perl-modules).])
 
3011
        fi
 
3012
      fi
 
3013
fi
 
3014
 
 
3015
# we have enough support for installing the modules at least.
 
3016
if test "x$install_perl" = "xtry" ; then
 
3017
  install_perl="yes"
 
3018
else
 
3019
  if test "x$install_perl" = "xno" ; then
 
3020
    install_perl="no"
 
3021
    embed_perl="no"
 
3022
  fi
 
3023
fi
 
3024
 
 
3025
####################
 
3026
# on to embedding...
 
3027
 
 
3028
# check the compiler flags for illegal tokens
 
3029
case $target_os in
 
3030
    solaris*)
 
3031
      if test "x$embed_perl" != "xno" ; then
 
3032
          #
 
3033
          # Perl cc checks
 
3034
          #
 
3035
          AC_MSG_CHECKING([for problematic Perl cc flags on Suns])
 
3036
          if $myperl -V:ccflags | grep LARGEFILE > /dev/null ; then
 
3037
            if test "x$embed_perl" = "xtry" ; then
 
3038
              embed_perl="no"
 
3039
            else
 
3040
              AC_MSG_ERROR([Perl was compiled with LARGEFILE support which will break Net-SNMP. Either set the environment variable PERLPROG to a different perl binary or use --disable-embedded-perl to turn off embedded Perl functionality altogether.])
 
3041
            fi
 
3042
          else
 
3043
            AC_MSG_RESULT([none known])
 
3044
          fi
 
3045
      fi
 
3046
    ;;
 
3047
 
 
3048
    *)
 
3049
    ;;
 
3050
esac
 
3051
 
 
3052
 
 
3053
# check the cflags
 
3054
if test "x$embed_perl" != "xno" ; then
 
3055
    AC_MSG_CHECKING([for Perl CFLAGS])
2501
3056
    perlcflags=`$myperl -MExtUtils::Embed -e ccopts`
2502
 
    AC_MSG_RESULT($perlcflags)
2503
 
    CPPFLAGS="$CPPFLAGS $perlcflags"
2504
 
 
2505
 
    AC_MSG_CHECKING([for perl LDFLAGS])
2506
 
    perlldopts=`$myperl -MExtUtils::Embed -e ldopts`
2507
 
    AC_MSG_RESULT($perlldopts)
2508
 
    PERLLDOPTS="$perlldopts"
2509
 
 
 
3057
    if test "x$perlcflags" != "x" ; then
 
3058
      AC_MSG_RESULT([$perlcflags])
 
3059
      CPPFLAGS="$CPPFLAGS $perlcflags"
 
3060
    else
 
3061
      if test "x$embed_perl" = "xtry" ; then
 
3062
        embed_perl="no"
 
3063
      else
 
3064
        AC_MSG_ERROR([Could not determine the C compiler flags that were used to build $myperl. Either set the environment variable PERLPROG to a different Perl binary or use --disable-embedded-perl to turn off embedded Perl functionality altogether.])
 
3065
      fi
 
3066
    fi
 
3067
fi
 
3068
 
 
3069
# check the ldflags
 
3070
if test "x$embed_perl" != "xno" ; then
 
3071
    AC_MSG_CHECKING([for Perl LDFLAGS])
 
3072
    netsnmp_perlldopts=`$myperl -MExtUtils::Embed -e ldopts`
 
3073
    if test "x$netsnmp_perlldopts" != "x" ; then
 
3074
      AC_MSG_RESULT([$netsnmp_perlldopts])
 
3075
    else
 
3076
      if test "x$embed_perl" = "xtry" ; then
 
3077
        embed_perl="no"
 
3078
      else
 
3079
        AC_MSG_ERROR([Could not determine the linker options that were used to build $myperl. Either set the environment variable PERLPROG to a different Perl binary or use --disable-embedded-perl to turn off embedded Perl functionality altogether.])
 
3080
      fi
 
3081
    fi
 
3082
    if test "x$enable_as_needed" = "xyes" ; then
 
3083
      # link *libraries* with libperl
 
3084
      PERLLDOPTS_FOR_LIBS="$netsnmp_perlldopts"
 
3085
      # Perl ccdlflags (RPATH to libperl, hopefully)
 
3086
      AC_MSG_CHECKING([for Perl CCDLFLAGS])
 
3087
      changequote(, )
 
3088
      netsnmp_perlccdlflags=`$myperl -V:ccdlflags | $myperl -n -e 'print $1 '"if (/^\s*ccdlflags='([^']+)';/);"`
 
3089
      changequote([, ])
 
3090
      AC_MSG_RESULT([$netsnmp_perlccdlflags])
 
3091
      PERLLDOPTS_FOR_APPS="$netsnmp_perlccdlflags"
 
3092
    else
 
3093
      # link *applications* against libperl
 
3094
      PERLLDOPTS_FOR_APPS="$netsnmp_perlldopts"
 
3095
    fi
 
3096
fi
 
3097
 
 
3098
# check needed functions
 
3099
if test "x$embed_perl" != "xno" ; then
2510
3100
    OLDLDFLAGS="$LDFLAGS"
2511
 
    LDFLAGS="$LDFLAGS $PERLLDOPTS"
 
3101
    LDFLAGS="$LDFLAGS $netsnmp_perlldopts"
2512
3102
 
2513
3103
    # newer perl vs older perl call functions
2514
 
    AC_CHECK_FUNCS(Perl_eval_pv eval_pv perl_eval_pv)
 
3104
    AC_CHECK_FUNCS(eval_pv)
 
3105
 
 
3106
    # sigh: this has a CAPITAL P in Perl, which ends up being the same
 
3107
    # autoconf define as the lower case so we have to treat them *BOTH*
 
3108
    # specially.  Wonderful.
 
3109
    AC_CHECK_FUNC(perl_eval_pv, AC_DEFINE(HAVE_PERL_EVAL_PV_LC))
 
3110
    AC_CHECK_FUNC(Perl_eval_pv, AC_DEFINE(HAVE_PERL_EVAL_PV_UC))
2515
3111
 
2516
3112
    LDFLAGS="$OLDLDFLAGS"
2517
3113
 
2518
 
    AC_DEFINE(NETSNMP_EMBEDDED_PERL)
2519
 
    OTHERAGENTLIBOBJS="snmp_perl.o"
2520
 
    OTHERAGENTLIBLOBJS="snmp_perl.lo"
2521
 
 
2522
 
    EMBEDPERLINSTALL="embedperlinstall"
2523
 
    EMBEDPERLUNINSTALL="embedperluninstall"
2524
 
    AC_MSG_CACHE_ADD(Embedded perl support:      enabled)
 
3114
 
 
3115
    if test "x$ac_cv_func_perl_eval_pv" != "xyes" -a "x$ac_cv_func_Perl_eval_pv" != "xyes" -a "x$ac_cv_func_eval_pv" != "xyes" ; then
 
3116
      if test "x$embed_perl" = "xtry" ; then
 
3117
        embed_perl="no"
 
3118
      else
 
3119
        AC_MSG_ERROR([Could not find the eval_pv, perl_eval_pv or Perl_eval_pv functions needed for embedded Perl support. Either set the environment variable PERLPROG to a different perl binary or use --disable-embedded-perl to turn off embedded Perl functionality altogether.])
 
3120
      fi
 
3121
    else
 
3122
      AC_DEFINE(NETSNMP_EMBEDDED_PERL)
 
3123
      OTHERAGENTLIBOBJS="snmp_perl.o"
 
3124
      OTHERAGENTLIBLOBJS="snmp_perl.lo"
 
3125
 
 
3126
      EMBEDPERLINSTALL="embedperlinstall"
 
3127
      EMBEDPERLUNINSTALL="embedperluninstall"
 
3128
      # yay, we got here!
 
3129
      embed_perl="yes"
 
3130
    fi
2525
3131
else
2526
 
    EMBEDPERLINSTALL=""
2527
 
    EMBEDPERLUNINSTALL=""
2528
 
    AC_MSG_CACHE_ADD(Embedded perl support:      disabled)
 
3132
      EMBEDPERLINSTALL=""
 
3133
      EMBEDPERLUNINSTALL=""
 
3134
      embed_perl="no"
 
3135
    fi
2529
3136
fi
2530
3137
AC_SUBST(EMBEDPERLINSTALL)
2531
3138
AC_SUBST(EMBEDPERLUNINSTALL)
2532
 
AC_SUBST(PERLLDOPTS)
 
3139
AC_SUBST(PERLLDOPTS_FOR_LIBS)
 
3140
AC_SUBST(PERLLDOPTS_FOR_APPS)
 
3141
 
 
3142
# embedded Perl results
 
3143
AC_MSG_CHECKING([for potential embedded Perl support])
 
3144
if test "x$embed_perl" != "xyes" ; then
 
3145
  AC_MSG_CACHE_ADD(Embedded Perl support:      disabled)
 
3146
  AC_MSG_RESULT([disabled])
 
3147
else
 
3148
  AC_MSG_CACHE_ADD(Embedded Perl support:      enabled)
 
3149
  AC_MSG_RESULT([enabled])
 
3150
fi
 
3151
 
 
3152
# install Perl module results
 
3153
PERLTARGS=""
 
3154
PERLINSTALLTARGS=""
 
3155
PERLUNINSTALLTARGS=""
 
3156
AC_MSG_CHECKING([if we can install the Perl modules])
 
3157
if test "x$install_perl" = "xyes" ; then
 
3158
    PERLTARGS="perlmodules"
 
3159
    PERLINSTALLTARGS="perlinstall"
 
3160
    PERLUNINSTALLTARGS="perluninstall"
 
3161
    if test "x$embed_perl" = "xyes" ; then
 
3162
      AC_MSG_CACHE_ADD(SNMP Perl modules:          building -- embeddable)
 
3163
      AC_MSG_RESULT([yes -- and embeddable])
 
3164
    else
 
3165
      AC_MSG_CACHE_ADD(SNMP Perl modules:          building -- not embeddable)
 
3166
      AC_MSG_RESULT([yes -- not embeddable])
 
3167
    fi
 
3168
else
 
3169
    AC_MSG_RESULT([no])
 
3170
    AC_MSG_CACHE_ADD(SNMP Perl modules:          disabled)
 
3171
fi
 
3172
AC_SUBST(PERLTARGS)
 
3173
AC_SUBST(PERLINSTALLTARGS)
 
3174
AC_SUBST(PERLUNINSTALLTARGS)
 
3175
AC_SUBST(PERLARGS)
 
3176
 
 
3177
 
2533
3178
 
2534
3179
# reset libs
2535
3180
AGENTLIBS=$LIBS
2536
3181
LIBS=$NONAGENTLIBS
2537
3182
 
 
3183
 
 
3184
 
 
3185
# python support
 
3186
PYTHONTARGS=""
 
3187
PYTHONINSTALLTARGS=""
 
3188
PYTHONUNINSTALLTARGS=""
 
3189
PYTHONCLEANTARGS=""
 
3190
AC_MSG_CHECKING([if we should install the python bindings])
 
3191
if test "x$install_python" = "xyes" ; then
 
3192
    PYTHONTARGS="pythonmodules"
 
3193
    PYTHONINSTALLTARGS="pythoninstall"
 
3194
    PYTHONUNINSTALLTARGS="pythonuninstall"
 
3195
    PYTHONCLEANTARGS="pythonclean"
 
3196
    AC_MSG_CACHE_ADD(SNMP Python modules:        building for $PYTHONPROG)
 
3197
    AC_MSG_RESULT([yes])
 
3198
else
 
3199
    AC_MSG_CACHE_ADD(SNMP Python modules:        disabled)
 
3200
    AC_MSG_RESULT([no])
 
3201
fi
 
3202
AC_SUBST(PYTHONTARGS)
 
3203
AC_SUBST(PYTHONINSTALLTARGS)
 
3204
AC_SUBST(PYTHONUNINSTALLTARGS)
 
3205
AC_SUBST(PYTHONCLEANTARGS)
 
3206
AC_SUBST(PYTHONARGS)
 
3207
 
 
3208
 
 
3209
 
2538
3210
# Checks for header files.
2539
3211
AC_HEADER_STDC
2540
3212
AC_HEADER_DIRENT
2541
3213
AC_HEADER_SYS_WAIT
2542
 
AC_CHECK_HEADERS(stdarg.h string.h fcntl.h limits.h sys/file.h sys/ioctl.h syslog.h unistd.h sys/dmap.h machine/pte.h xti.h sys/sockio.h sys/socket.h sys/param.h)
 
3214
AC_CHECK_HEADERS(stdarg.h string.h fcntl.h limits.h sys/file.h sys/ioctl.h syslog.h unistd.h sys/dmap.h machine/pte.h xti.h sys/sockio.h sys/socket.h sys/param.h sys/uio.h)
2543
3215
# at least Solaris 9 needs sys/socket.h to compile sys/socketvar.h
2544
3216
AC_CHECK_HEADERS(sys/socketvar.h,,,
2545
3217
AC_INCLUDES_DEFAULT([])
2617
3289
#endif
2618
3290
]])
2619
3291
# FreeBSD required headers
2620
 
AC_CHECK_HEADERS(malloc.h net/if_dl.h sys/sysctl.h stdlib.h net/if_types.h sys/queue.h osreldate.h machine/types.h sys/user.h sys/proc.h sys/mbuf.h sys/mount.h,,,
 
3292
AC_CHECK_HEADERS(malloc.h net/if_dl.h sys/sysctl.h stdlib.h net/if_types.h sys/queue.h osreldate.h machine/types.h sys/user.h sys/proc.h sys/mbuf.h sys/mount.h sys/dkstat.h sys/conf.h,,,
2621
3293
[[
2622
3294
#if HAVE_SYS_TYPES_H
2623
3295
#include <sys/types.h>
2627
3299
#endif
2628
3300
]])
2629
3301
# Linux
2630
 
AC_CHECK_HEADERS(sys/conf.h netinet/tcp_fsm.h sys/protosw.h nlist.h ioctls.h asm/page.h asm/types.h netipx/ipx.h pci/pci.h)
 
3302
AC_CHECK_HEADERS(netinet/tcp_fsm.h sys/protosw.h nlist.h ioctls.h asm/page.h asm/types.h netipx/ipx.h pci/pci.h)
2631
3303
# Solaris
2632
3304
AC_CHECK_HEADERS(inet/mib2.h)
2633
3305
# NetBSD required headers
2642
3314
# linux ethtool
2643
3315
# requires special hacks to get around various problems on older linux kernels.
2644
3316
# major ugh....
2645
 
AC_CHECK_HEADERS(linux/ethtool.h,,,
 
3317
AC_CHECK_HEADERS([linux/ethtool.h],,,
2646
3318
[[
2647
 
#include <sys/types.h>
2648
 
typedef unsigned long long u64;         /* hack, so we may include kernel's ethtool.h */
2649
 
typedef __uint32_t u32;         /* ditto */
2650
 
typedef __uint16_t u16;         /* ditto */
2651
 
typedef __uint8_t u8;           /* ditto */
 
3319
#include <linux/types.h>
 
3320
typedef __u64 u64;         /* hack, so we may include kernel's ethtool.h */
 
3321
typedef __u32 u32;         /* ditto */
 
3322
typedef __u16 u16;         /* ditto */
 
3323
typedef __u8 u8;           /* ditto */
2652
3324
]])
2653
3325
# BSDi3 headers
2654
3326
AC_CHECK_HEADERS(sys/stat.h)
2672
3344
#endif
2673
3345
])
2674
3346
# more IRIX headers
2675
 
AC_CHECK_HEADERS(sys/tcpipstats.h sys/sysmp.h)
 
3347
AC_CHECK_HEADERS(sys/tcpipstats.h sys/sysmp.h sys/systeminfo.h sys/sysget.h)
 
3348
# AIX system configuration
 
3349
AC_CHECK_HEADERS(sys/systemcfg.h)
2676
3350
# from smux stuff
2677
3351
AC_CHECK_HEADERS(err.h sys/filio.h sgtty.h)
2678
3352
# AIX needs this for statfs func
2682
3356
# for HostRes (Solaris 2.x at least)
2683
3357
AC_CHECK_HEADERS(pkginfo.h,
2684
3358
    AC_CHECK_LIB(adm, pkginfo, AC_DEFINE(HAVE_PKGINFO)
2685
 
    LIBS="${LIBS} -ladm"
2686
 
    AGENTLIBS="${AGENTLIBS} -ladm"))
 
3359
    LMIBLIBS="${LMIBLIBS} -ladm"))
2687
3360
 
2688
3361
case $target_os in
2689
3362
    aix*) # AIX perfstat library, needed for CPU/memory statistics
2690
3363
        AC_CHECK_HEADERS(libperfstat.h,
2691
3364
            AC_CHECK_LIB(perfstat, perfstat_cpu_total, AC_DEFINE(HAVE_PERFSTAT)
2692
 
            AGENTLIBS="${AGENTLIBS} -lperfstat"), AC_MSG_ERROR([
 
3365
            LMIBLIBS="${LMIBLIBS} -lperfstat"), AC_MSG_ERROR([
2693
3366
 
2694
3367
*** To monitor CPU/memory values in AIX you need to install
2695
3368
*** libperfstat which can be found in bos.perf
2697
3370
        ;;
2698
3371
    hpux*) # HP-UX agent needs open_mib
2699
3372
        AC_CHECK_LIB(nm, open_mib, AC_DEFINE(HAVE_LIBNM)
2700
 
            AGENTLIBS="${AGENTLIBS} -lnm")
 
3373
            LMIBLIBS="${LMIBLIBS} -lnm")
2701
3374
        ;;
2702
3375
    *)
2703
3376
        ;;
2822
3495
    else
2823
3496
        encrmodes="[disabled]"
2824
3497
    fi
2825
 
    AC_DEFINE(USE_OPENSSL)
 
3498
    AC_DEFINE(NETSNMP_USE_OPENSSL)
 
3499
    LNETSNMPLIBS="$LNETSNMPLIBS $LIBCRYPTO"
2826
3500
    AC_MSG_RESULT(OpenSSL Support)
2827
3501
elif test "x$usepkcs" != "xno" ; then
2828
3502
    authmodes="MD5 SHA1"
2831
3505
    else
2832
3506
        encrmodes="[disabled]"
2833
3507
    fi
2834
 
    AC_DEFINE(USE_PKCS)
 
3508
    AC_DEFINE(NETSNMP_USE_PKCS11)
 
3509
    LNETSNMPLIBS="$LNETSNMPLIBS $LIBPKCS11"
2835
3510
    AC_MSG_RESULT(PKCS11 Support)
2836
3511
elif test "x$enable_md5" != "xno"; then
2837
3512
    authmodes="MD5"
2838
3513
    encrmodes=""
2839
 
    AC_DEFINE(USE_INTERNAL_MD5)
 
3514
    AC_DEFINE(NETSNMP_USE_INTERNAL_MD5)
2840
3515
    AC_MSG_RESULT(Internal MD5 Support)
2841
3516
fi
2842
3517
if test "x$enable_md5" = "xno"; then
2843
3518
    authmodes=`echo $authmodes | sed 's/MD5 *//;'`
2844
3519
fi
 
3520
AC_SUBST(LNETSNMPLIBS)
 
3521
AC_SUBST(LAGENTLIBS)
2845
3522
 
2846
3523
AC_MSG_CACHE_ADD(Authentication support:     $authmodes)
2847
3524
AC_MSG_CACHE_ADD(Encryption support:         $encrmodes)
2904
3581
 
2905
3582
AC_MSG_RESULT([$ac_cv_type_ssize_t])
2906
3583
if test $ac_cv_type_ssize_t = yes; then
2907
 
  AC_DEFINE(HAVE_SSIZE_T)
 
3584
  AC_DEFINE(HAVE_SSIZE_T, 1, [Define if type ssize_t is available])
2908
3585
fi
2909
3586
 
2910
3587
# Check ps args
2911
3588
AC_CACHE_CHECK([for correct flags to ps], ac_cv_ps_flags,
2912
 
[if test "`($PSPROG -e 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
 
3589
[if test "`($PSPROG -e 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
2913
3590
  ac_cv_ps_flags="-e"
2914
 
elif test "`($PSPROG -el 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
 
3591
elif test "`($PSPROG -el 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
2915
3592
  ac_cv_ps_flags="-el"
2916
 
elif test "`($PSPROG acx 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
 
3593
elif test "`($PSPROG acx 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
2917
3594
  ac_cv_ps_flags="acx"
2918
 
elif test "`($PSPROG -acx 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
 
3595
elif test "`($PSPROG -acx 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
2919
3596
  ac_cv_ps_flags="-acx"
2920
 
elif test "`($PSPROG -o pid,tt,state,time,ucomm 2>&1) | egrep ' ps *$' | awk '{print $NF}'`" = "ps" ; then
 
3597
elif test "`($PSPROG -o pid,tt,state,time,ucomm 2>&1) | $EGREP ' ps *$' | awk '{print $NF}'`" = "ps" ; then
2921
3598
  ac_cv_ps_flags="-o pid,tt,state,time,ucomm"
2922
 
elif test "`($PSPROG ax 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
 
3599
elif test "`($PSPROG ax 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
2923
3600
  ac_cv_ps_flags="ax"
2924
3601
elif test "x$PARTIALTARGETOS" = "xcygwin"; then
2925
3602
  ac_cv_ps_flags="-e"
2955
3632
AC_FUNC_MEMCMP
2956
3633
AC_TYPE_SIGNAL
2957
3634
AC_FUNC_GETMNTENT
2958
 
AC_CHECK_FUNCS(setmntent gethostname uname gettimeofday select socket strtol strtoul strlcpy)
 
3635
AC_CHECK_FUNCS(setmntent hasmntopt gethostname uname gettimeofday select socket strtol strtoul strlcpy)
2959
3636
AC_CHECK_FUNCS(strchr strtok_r strdup memcpy memmove index bcopy strcasestr regcomp)
2960
3637
AC_CHECK_FUNCS(signal setsid sigset sigblock sighold strerror setenv vsnprintf snprintf)
2961
3638
AC_CHECK_FUNCS(sigaction)
2962
3639
AC_CHECK_FUNCS(random lrand48 rand)
2963
3640
AC_CHECK_FUNCS(execv system fork getpid strncasecmp sigalrm)
 
3641
AC_CHECK_FUNCS(lseek64 pread64)
2964
3642
if test "x$with_rpm" != "xno" && \
2965
3643
        echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
2966
3644
  OLDLIBS=$LIBS
2967
 
  LIBS=$AGENTLIBS
 
3645
  LIBS=$LMIBLIBS
2968
3646
  AC_CHECK_FUNCS(rpmGetPath)
2969
3647
  LIBS=$OLDLIBS
2970
3648
fi
2971
3649
 
2972
3650
AC_CHECK_FUNCS(getloadavg)
2973
 
AC_CHECK_FUNCS(getaddrinfo getipnodebyname)
 
3651
AC_CHECK_FUNCS(getaddrinfo getipnodebyname gai_strerror)
2974
3652
# BSDi2 functions differ
2975
3653
AC_CHECK_FUNCS(statvfs statfs)
2976
3654
AC_CHECK_FUNCS(getdtablesize)
2990
3668
AC_CHECK_FUNCS(mktime stime times sysconf)
2991
3669
# missing from hp-ux
2992
3670
AC_CHECK_FUNCS(if_nametoindex)
 
3671
# missing from MinGW
 
3672
AC_CHECK_FUNCS(chown localtime_r)
2993
3673
 
2994
3674
AC_MSG_CHECKING([[for SIOCGIFADDR in sys/ioctl.h]])
2995
3675
AC_CACHE_VAL(cv_sys_ioctl_h_has_SIOCGIFADDR,
3051
3731
# on SCO Unixware 7.1.4 (SCO compiler), "static inline" functions
3052
3732
# are not supported, so this disables the whole inline thing if it
3053
3733
# doesn't work properly. Should have no effect on other platforms.
3054
 
AC_MSG_CHECKING([whether static inline functions are broken (Unixware)])
3055
 
AC_TRY_COMPILE(,[
3056
 
  static inline int nested_inline_function(void) {
3057
 
    return 0;
3058
 
  }
3059
 
  inline int main_inline_function( void ) {
3060
 
    return nested_inline_function();
3061
 
  }
3062
 
],ac_cv_BROKEN_INLINE=no, ac_cv_BROKEN_INLINE=yes)
3063
 
 
3064
 
if test "x$ac_cv_BROKEN_INLINE" = x"yes" ; then
3065
 
  AC_MSG_RESULT(yes)
3066
 
  AC_DEFINE(NETSNMP_BROKEN_INLINE)
3067
 
else
3068
 
  AC_MSG_RESULT(no)
 
3734
AC_CACHE_CHECK([[whether static inline functions are broken (Unixware)]],
 
3735
    [netsnmp_cv_c_broken_inline],
 
3736
AC_COMPILE_IFELSE([[
 
3737
static inline int nested_inline_function(void) {
 
3738
  return 0;
 
3739
}
 
3740
inline int main_inline_function( void ) {
 
3741
  return nested_inline_function();
 
3742
}
 
3743
]], netsnmp_cv_broken_inline=no, netsnmp_cv_broken_inline=yes))
 
3744
 
 
3745
# But, sadly, the usage of inline in NET_SNMP disagrees seriously with at least
 
3746
# solaris2, so disable it for now.
 
3747
case "$target_os" in
 
3748
    solaris*)
 
3749
        netsnmp_cv_broken_inline=yes
 
3750
        ;;
 
3751
    *)
 
3752
        ;;
 
3753
esac
 
3754
 
 
3755
if test "$netsnmp_cv_broken_inline" = yes ; then
 
3756
  AC_DEFINE(NETSNMP_BROKEN_INLINE, 1,
 
3757
        [Define if static inline functions are unsupported])
3069
3758
fi
3070
3759
 
3071
3760
# openbsd seems to have dropped m_clusters and m_clfree from mbstat
3130
3819
], sockaddr, sa_union.sa_generic.sa_family2, no)
3131
3820
 
3132
3821
AC_CHECK_STRUCT_FOR([
 
3822
#if HAVE_SYS_PARAM_H
 
3823
#include <sys/param.h>
 
3824
#endif
 
3825
#if HAVE_SYS_TYPES_H
 
3826
#include <sys/types.h>
 
3827
#endif
 
3828
#if HAVE_SYS_SOCKET_H
 
3829
#include <sys/socket.h>
 
3830
#endif
 
3831
], sockaddr_storage, ss_family, no)
 
3832
 
 
3833
AC_CHECK_STRUCT_FOR([
 
3834
#if HAVE_SYS_PARAM_H
 
3835
#include <sys/param.h>
 
3836
#endif
 
3837
#if HAVE_SYS_TYPES_H
 
3838
#include <sys/types.h>
 
3839
#endif
 
3840
#if HAVE_SYS_SOCKET_H
 
3841
#include <sys/socket.h>
 
3842
#endif
 
3843
], sockaddr_storage, __ss_family, no)
 
3844
 
 
3845
AC_CHECK_STRUCT_FOR([
3133
3846
#ifdef HAVE_SYS_PARAM_H
3134
3847
#include <sys/param.h>
3135
3848
#endif
3251
3964
 
3252
3965
fi
3253
3966
 
 
3967
# Check sin6_scope_id member specified in RFC2553 additionally
 
3968
AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,[
 
3969
AC_INCLUDES_DEFAULT()
 
3970
[#ifdef HAVE_SYS_PARAM_H
 
3971
#include <sys/param.h>
 
3972
#endif
 
3973
#ifdef HAVE_SYS_SOCKET_H
 
3974
#include <sys/socket.h>
 
3975
#endif
 
3976
#ifdef HAVE_NETINET_IN_H
 
3977
#include <netinet/in.h>
 
3978
#endif
 
3979
]])
 
3980
 
3254
3981
# Check struct rtentry for various things.
3255
3982
AC_CHECK_STRUCT_FOR([
3256
3983
#ifdef HAVE_SYS_PARAM_H
3489
4216
],arphd,at_next)
3490
4217
 
3491
4218
AC_CHECK_STRUCT_FOR([
 
4219
#if HAVE_SYS_TYPES_H
 
4220
#include <sys/types.h>
 
4221
#endif
 
4222
#ifdef HAVE_SYS_PARAM_H
 
4223
#include <sys/param.h>
 
4224
#endif
3492
4225
#if HAVE_SYS_CONF_H
3493
4226
#include <sys/conf.h>
3494
4227
#endif
3596
4329
#endif
3597
4330
],nlist,n_value)
3598
4331
 
 
4332
# struct nlist64 (IRIX)
 
4333
AC_CHECK_STRUCT_FOR([
 
4334
#if HAVE_SYS_TYPES_H
 
4335
#include <sys/types.h>
 
4336
#endif
 
4337
#if HAVE_NLIST_H
 
4338
#include <nlist.h>
 
4339
#endif
 
4340
],nlist64, n_value)
 
4341
 
3599
4342
# check struct ipstat for various things
3600
4343
AC_CHECK_STRUCT_FOR([
3601
4344
#include <sys/types.h>
3728
4471
# attempt to figure out if sysctl is usable
3729
4472
 
3730
4473
if test $cross_compiling = yes; then
3731
 
  AC_MSG_WARN([Can't check sysctl, manually define CAN_USE_SYSCTL if platform support available])
 
4474
  AC_MSG_WARN([Can't check sysctl, manually define NETSNMP_CAN_USE_SYSCTL if platform support available])
3732
4475
else
3733
 
  AC_CACHE_CHECK(if sysctl can read kernel information,ac_cv_CAN_USE_SYSCTL,
 
4476
  AC_CACHE_CHECK(if sysctl can read kernel information,ac_cv_NETSNMP_CAN_USE_SYSCTL,
3734
4477
  [AC_TRY_RUN([
3735
4478
#if TIME_WITH_SYS_TIME
3736
4479
# include <sys/time.h>
3765
4508
  else
3766
4509
    exit(1);
3767
4510
}
3768
 
  ], ac_cv_CAN_USE_SYSCTL=yes, ac_cv_CAN_USE_SYSCTL=no, ac_cv_CAN_USE_SYSCTL=no)])
 
4511
  ], ac_cv_NETSNMP_CAN_USE_SYSCTL=yes, ac_cv_NETSNMP_CAN_USE_SYSCTL=no, ac_cv_NETSNMP_CAN_USE_SYSCTL=no)])
3769
4512
fi
3770
4513
 
3771
 
if test "x$ac_cv_CAN_USE_SYSCTL" = "xyes"; then
3772
 
  AC_DEFINE(CAN_USE_SYSCTL)
 
4514
if test "x$ac_cv_NETSNMP_CAN_USE_SYSCTL" = "xyes"; then
 
4515
  AC_DEFINE(NETSNMP_CAN_USE_SYSCTL)
3773
4516
fi
3774
4517
 
3775
4518
#
3789
4532
fi
3790
4533
 
3791
4534
#
3792
 
# define the agent libraries variable
 
4535
# define the agent libraries variables
3793
4536
#
 
4537
AC_SUBST(LMIBLIBS)
3794
4538
AC_SUBST(AGENTLIBS)
3795
4539
AC_SUBST(OTHERAGENTLIBOBJS)
3796
4540
AC_SUBST(OTHERAGENTLIBLOBJS)
3799
4543
# Prompt for various bits of user information
3800
4544
#
3801
4545
 
3802
 
if test "x$ac_cv_user_prompt_LOGFILE" = "x" -o "x$ac_cv_user_prompt_SYS_LOC" = "x" -o "x$ac_cv_user_prompt_SYS_CONTACT" = "x" -o "x$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" = "x"; then
3803
 
AC_CACHE_CHECK(if you have run configure before, ac_cv_have_warned,
 
4546
if test "x$ac_cv_user_prompt_NETSNMP_LOGFILE" = "x" -o "x$ac_cv_user_prompt_NETSNMP_SYS_LOC" = "x" -o "x$ac_cv_user_prompt_NETSNMP_SYS_CONTACT" = "x" -o "x$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" = "x"; then
 
4547
AC_CACHE_CHECK(whether to prompt for values, ac_cv_have_warned,
3804
4548
[
3805
4549
if test "x$defaults" = "xno"; then
3806
4550
cat << EOF
3812
4556
applications are to function.
3813
4557
 
3814
4558
        After the configure script finishes, you can browse the newly
3815
 
created config.h file for further - less important - parameters to
3816
 
modify.  Be careful if you re-run configure though, since config.h will
3817
 
be overwritten.
 
4559
created net-snmp-config.h file for further - less important - parameters to
 
4560
modify.  Be careful if you re-run configure though, since net-snmp-config.h 
 
4561
will be overwritten.
3818
4562
 
3819
4563
-Press return to continue-
3820
4564
EOF
3821
4565
 
3822
4566
read tmpinput
3823
4567
ac_cv_have_warned="yes"
3824
 
echo $ECHO_N "disabling above prompt for future runs...  $ECHO_C"
3825
4568
else
3826
4569
  ac_cv_have_warned="no"
3827
4570
fi
3837
4580
  LOC="@no.where"
3838
4581
fi
3839
4582
 
3840
 
AC_PROMPT_USER(DEFAULT_SNMP_VERSION,[
 
4583
AC_PROMPT_USER(NETSNMP_DEFAULT_SNMP_VERSION,[
3841
4584
 
3842
4585
*** Default SNMP Version:
3843
4586
 
3860
4603
Default version of SNMP to use],3,unquoted)
3861
4604
 
3862
4605
# we tested this above before the prompt, but the prompt may give a new value.
3863
 
if test "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "3"; then
 
4606
if test "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" = "2c"; then
 
4607
  ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION="2"
 
4608
fi
 
4609
if test "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "3"; then
3864
4610
  AC_MSG_ERROR([Illegal version number.  Only 1, 2 (for SNMPv2c) and 3 are supported.])
3865
4611
fi
3866
4612
 
3867
 
AC_PROMPT_USER(SYS_CONTACT,[
 
4613
AC_PROMPT_USER(NETSNMP_SYS_CONTACT,[
3868
4614
 
3869
4615
*** System Contact Information:
3870
4616
 
3877
4623
 
3878
4624
System Contact Information],$ME@$LOC,quoted)
3879
4625
 
3880
 
AC_PROMPT_USER(SYS_LOC,[
 
4626
AC_PROMPT_USER(NETSNMP_SYS_LOC,[
3881
4627
 
3882
4628
*** System Location:
3883
4629
 
3895
4641
  defaultlog="/usr/adm/snmpd.log"
3896
4642
fi
3897
4643
  
3898
 
AC_PROMPT_USER(LOGFILE,[
 
4644
AC_PROMPT_USER(NETSNMP_LOGFILE,[
3899
4645
 
3900
4646
*** Logfile location:
3901
4647
 
3916
4662
  ucddefaultstore="/etc/ucd-snmp"
3917
4663
fi
3918
4664
  
3919
 
AC_PROMPT_USER(PERSISTENT_DIRECTORY,[
 
4665
AC_PROMPT_USER(NETSNMP_PERSISTENT_DIRECTORY,[
3920
4666
 
3921
4667
*** snmpd persistent storage location:
3922
4668
 
3933
4679
 
3934
4680
Location to write persistent information],$defaultstore,quoted)
3935
4681
 
3936
 
PERSISTENT_DIRECTORY=$ac_cv_user_prompt_PERSISTENT_DIRECTORY
 
4682
PERSISTENT_DIRECTORY=$ac_cv_user_prompt_NETSNMP_PERSISTENT_DIRECTORY
3937
4683
AC_SUBST(PERSISTENT_DIRECTORY)
3938
4684
UCDPERSISTENT_DIRECTORY=$ucddefaultstore
3939
4685
AC_SUBST(UCDPERSISTENT_DIRECTORY)
3978
4724
                [chmod +x net-snmp-config])
3979
4725
 
3980
4726
AC_CONFIG_COMMANDS([default], echo timestamp > stamp-h)
 
4727
 
 
4728
#
 
4729
# protect PACKAGE_* variables
 
4730
#
 
4731
AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */
 
4732
#ifndef PACKAGE_BUGREPORT
 
4733
#undef PACKAGE_BUGREPORT
 
4734
#endif])
 
4735
AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */
 
4736
#ifndef PACKAGE_NAME
 
4737
#undef PACKAGE_NAME
 
4738
#endif])
 
4739
AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */
 
4740
#ifndef PACKAGE_STRING
 
4741
#undef PACKAGE_STRING
 
4742
#endif])
 
4743
AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */
 
4744
#ifndef PACKAGE_TARNAME
 
4745
#undef PACKAGE_TARNAME
 
4746
#endif])
 
4747
AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */
 
4748
#ifndef PACKAGE_VERSION
 
4749
#undef PACKAGE_VERSION
 
4750
#endif])
 
4751
 
3981
4752
AC_OUTPUT
3982
4753
 
3983
4754
AC_MSG_CACHE_DISPLAY()