On Fri, Jun 01, 2007 at 11:34:16AM -0500, Matthew Chambers wrote:

>Yeah, I noticed that after I sent the email.  I had already done a "file" on
>both binaries and it said they were both dynamically linked, but I didn't do
>anything else to discover between fully dynamically linked or not.  I looked
>at your command history and saw that you did manual gcc commands to compile
>it statically because your configure line wasn't different than mine (other
>than the debug stuff).  How do I do a static build with just configure?  And

I'm usually using the attached patch to build all programs statically.
The default with this patch is still to build dynamic programs.

A number of feasable use cases come to mind, which this configure options
helps with:
1) easy debugging
2) no dependencies
3) may be faster to start (no dlopening)

Tobi, please apply if you think it's useful.

- add configure option to build static binaries
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 1100)
+++ src/Makefile.am	(working copy)
@@ -7,6 +7,10 @@
 fontsdir =  $(datadir)/rrdtool/fonts
 fonts_DATA = DejaVuSansMono-Roman.ttf
 
+if STATIC_PROGRAMS
+AM_LDFLAGS = -all-static
+endif
+
 #INCLUDES = $(FREETYPE_INCLUDES) $(ART_INCLUDES) \
 #           $(PNG_INCLUDES) $(ZLIB_INCLUDES)
 [EMAIL PROTECTED]@
Index: configure.ac
===================================================================
--- configure.ac	(revision 1100)
+++ configure.ac	(working copy)
@@ -305,9 +305,17 @@ AC_ARG_ENABLE([direct-io],
 [enable_direct_io=yes],
 [])
 
- AC_ARG_ENABLE(pthread,[  --disable-pthread       disable multithread support],
+AC_ARG_ENABLE(pthread,[  --disable-pthread       disable multithread support],
 [],[enable_pthread=yes])
 
+AC_ARG_ENABLE(static-programs,
+     [  --enable-static-programs  Build static programs],
+     [case "${enableval}" in
+       yes) staticprogs=yes ;;
+       no)  staticprogs=no ;;
+       *) AC_MSG_ERROR(bad value ${enableval} for --enable-static-programs) ;;
+     esac],[staticprogs=no])
+AM_CONDITIONAL(STATIC_PROGRAMS,[test "x$staticprogs" = "xyes"])
 
 
 CONFIGURE_PART(Audit Compilation Environment)
@@ -853,6 +861,7 @@ echo "Config is DONE!"
 echo
 echo "          With MMAP IO: $enable_mmap"
 echo "          Use O_DIRECT: $enable_direct_io"
+echo "       Static programs: $staticprogs"
 echo "          Perl Modules: $COMP_PERL"
 echo "           Perl Binary: $PERL"
 echo "          Perl Version: $PERL_VERSION"
_______________________________________________
rrd-developers mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Reply via email to