Build System

From Net-SNMP Wiki
Jump to: navigation, search


For Users

Unix

 ./configure [options, see "configure --help" for a list]
 make
 make test
 su
 make install

The same procedure applies to builds with Cygwin on Windows.
See README.* for important notes for particular platforms.

Windows

There are several ways to build on Windows:

  • MS Visual C++
  • MinGW / MSYS
  • Cygwin (see "Unix" above)

See Build_System/Windows for the status of compiling with the various Windows environments.

See Build_System/Windows_features for a comparison of the features implemented in each of the Windows build environments.

See README.win32 for further details.

For Coders

See Release_Instructions for information about building binary packages on various systems.

Tool Versions

Versions Autoconf Automake Libtool
5.8.1 and master autoconf 2.69 automake 1.11.6 libtool 2.4.6
5.8 autoconf 2.68 automake 1.11 libtool 2.4 + patch (see below)
5.7 autoconf 2.68 automake 1.11 libtool 2.4 + patch (see below)
5.6 autoconf 2.63 automake 1.11 libtool 2.2.6a
5.5 autoconf 2.63 automake 1.10.1 libtool 2.2.6a
5.4.2+ autoconf 2.59 automake 1.10.1 libtool 1.5.26
5.4/5.4.1 autoconf 2.59 automake (which version ?) libtool 1.5.24
earlier autoconf 2.59 automake (which version ?) libtool 1.4.3

Files

  • configure: auto-generated by autoconf from configure.in and acinclude.m4 (branches) or configure.ac, configure.d/* and m4/* (trunk)
  • configure.in (5.4.x and earlier) or configure.ac and configure.d/* (trunk): major source file to implement configure magic. Run autoconf and autoheader after any change. New definitions may need to be copied to win32/net-snmp/net-snmp-config.h[.in].
  • acconfig.h: autoconf variable definitions, descriptions and default values. Deprecated (for new definitions) in favor of AC_DEFINE() in configure.in / configure.d/*. Run autoheader after any change. New definitions may need to be copied to win32/net-snmp/net-snmp-config.h[.in].
  • acinclude.m4 (branches) or m4/ac* and m4/netsnmp* (trunk): Net-SNMP specific autoconf macros. Run autoconf after any change.
  • include/net-snmp/net-snmp-config.h: auto-generated by autoheader from configure.in/configure.ac and acconfig.h
  • ltmain.sh: copied from libtool (created/updated by libtoolize --copy --force)
  • aclocal.m4: contains includes of all used files in m4/*(created/updated by aclocal)
  • config.guess, config.sub: platform detection shell script (created/updated by libtoolize --copy --force; from GNU config project)
  • win32/net-snmp/net-snmp-config.h.in: used by win32/Configure to create win32/net-snmp/net-snmp-config.h
  • win32/net-snmp/net-snmp-config.h: definitions for Win32 (non-Cygwin) builds
  • win32/lib*/lib*.def: public/exported symbols/functions from Net-SNMP libraries for Win32 builds. If you introduce new public functions, please also add them here!
  • Makefile.in (also in most sub-directories): source for Makefile (the latter being generated by configure by substituting autoconf definitions and concatenating with Makefile.top and Makefile.rules)
  • net-snmp-config.in: source for net-snmp-config (the latter being generated by configure)
  • sedscript.in: source for sedscript (the latter being generated by configure)

Updating

Assuming that you have changed any of the above and have the right tool versions installed - in order to update all the generated files you can do either

 aclocal -I m4
 libtoolize --copy
 autoconf
 autoheader

or

 autoreconf -i

but in the later case you must make sure that the tool versions that autoreconf calls are the correct ones.

Patches

When using libtool 2.4, you will need the following patch (see also [1]):

diff -u -r orig/libtool-2.4/libltdl/config/ltmain.m4sh libtool-2.4/libltdl/config/ltmain.m4sh
--- orig/libtool-2.4/libltdl/config/ltmain.m4sh	2010-09-22 16:45:18.000000000 +0200
+++ libtool-2.4/libltdl/config/ltmain.m4sh	2010-10-22 08:30:21.000000000 +0200
@@ -5045,13 +5045,14 @@
       # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
       # -F/path              path to uninstalled frameworks, gcc on darwin
       # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
+      # -fstack-protector*   stack protector flags for GCC
       # @file                GCC response files
       # -tp=*                Portland pgcc target processor selection
       # --sysroot=*          for sysroot support
       # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
       -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
-      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
+      -O*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*)
         func_quote_for_eval "$arg"
 	arg="$func_quote_for_eval_result"
         func_append compile_command " $arg"
diff -u -r orig/libtool-2.4/libltdl/config/ltmain.sh libtool-2.4/libltdl/config/ltmain.sh
--- orig/libtool-2.4/libltdl/config/ltmain.sh	2010-09-22 16:45:43.000000000 +0200
+++ libtool-2.4/libltdl/config/ltmain.sh	2010-10-22 08:37:07.000000000 +0200
@@ -5834,13 +5834,14 @@
       # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
       # -F/path              path to uninstalled frameworks, gcc on darwin
       # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
+      # -fstack-protector*   stack protector flags for GCC
       # @file                GCC response files
       # -tp=*                Portland pgcc target processor selection
       # --sysroot=*          for sysroot support
       # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
       -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
-      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
+      -O*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*)
         func_quote_for_eval "$arg"
 	arg="$func_quote_for_eval_result"
         func_append compile_command " $arg"