shithub: sox

Download patch

ref: 80688834cfcbcb576a63499423192e02b527dbd6
parent: cb4508bb4878edcb027bfe5dd80b6b108f6eac59
author: robs <robs>
date: Mon Aug 11 16:10:42 EDT 2008

add build info (for bug reports)

--- a/configure.ac
+++ b/configure.ac
@@ -116,6 +116,17 @@
 fi
 AC_SUBST(WARN_CFLAGS)
 
+dnl Get distro name from /etc/issue
+if test -r /etc/issue; then
+  AC_MSG_CHECKING([distro name])
+  DISTRO=`sed -e "s/.[0-9][0-9;]*[mJH]//g" < /etc/issue|tr "\n" " " | sed -e "s/(\\\\?\\\\\\\\.*//" -e "s/  */ /g" -e "s/^ //" -e "s/ $//"`
+  AC_MSG_RESULT("$DISTRO")
+  AC_SUBST(DISTRO)
+  AC_DEFINE(HAVE_DISTRO, 1, [1 if DISTRO is defined])
+  have_distro=yes
+fi
+AM_CONDITIONAL(HAVE_DISTRO, test x$have_distro = xyes)
+
 dnl Check for system dependent features.
 AC_C_BIGENDIAN
 AC_C_INLINE
@@ -122,7 +133,7 @@
 
 dnl Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS(fcntl.h unistd.h byteswap.h sys/time.h sys/timeb.h sys/types.h)
+AC_CHECK_HEADERS(fcntl.h unistd.h byteswap.h sys/time.h sys/timeb.h sys/types.h sys/utsname.h)
 
 dnl Checks for library functions.
 AC_CHECK_FUNCS(strcasecmp strdup popen vsnprintf gettimeofday)
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,6 +19,10 @@
 # Pass flags from --enable-silent-libtool
 LIBTOOL = @LIBTOOL@ @LIBTOOLFLAGS@
 
+if HAVE_DISTRO
+AM_CPPFLAGS += -DDISTRO="\"@DISTRO@\""
+endif
+
 #########################
 # SoX - the application #
 #########################
@@ -363,7 +367,7 @@
 all: sox$(EXEEXT) play rec soxi sox_sample_test$(EXEEXT) example0$(EXEEXT) example1$(EXEEXT) example2$(EXEEXT)
 
 play rec soxi: sox$(EXEEXT)
-	./sox --help > /dev/null
+	./sox -V4 --version
 	test -f .libs/lt-sox && ( $(RM) $@ && $(LN_S) .libs/lt-sox $@ ) || $(LN_S) sox$(EXEEXT) $@
 
 install-exec-hook:
--- a/src/sox.c
+++ b/src/sox.c
@@ -47,6 +47,10 @@
   #include <sys/timeb.h>
 #endif
 
+#ifdef HAVE_SYS_UTSNAME_H
+  #include <sys/utsname.h>
+#endif
+
 #ifdef HAVE_UNISTD_H
   #include <unistd.h>
 #endif
@@ -934,7 +938,33 @@
 
 static void display_SoX_version(FILE * file)
 {
+#if HAVE_SYS_UTSNAME_H
+  struct utsname uts;
+#endif
+
   fprintf(file, "%s: SoX v%s\n", myname, PACKAGE_VERSION);
+
+  if (sox_globals.verbosity > 3) {
+    fprintf(file, "time:  %s %s\n", __DATE__, __TIME__);
+#if 1
+    fprintf(file, "issue: %s\n", DISTRO);
+#endif
+#if HAVE_SYS_UTSNAME_H
+    if (!uname(&uts))
+      fprintf(file, "uname: %s %s %s %s %s\n", uts.sysname, uts.nodename,
+          uts.release, uts.version, uts.machine);
+#endif
+#if defined __GNUC__
+    fprintf(file, "gcc:   %s\n", __VERSION__);
+#elif defined _MSC_VER
+    fprintf(file, "msc:   %u\n", _MSC_VER);
+#elif defined __SUNPRO_C
+    fprintf(file, "sun c: %x\n", __SUNPRO_C);
+#endif
+    fprintf(file, "arch:  %u%u%u%u %u%u %u%u %c\n", sizeof(char), sizeof(short),
+        sizeof(long), sizeof(off_t), sizeof(float), sizeof(double),
+        sizeof(int *), sizeof(int (*)(void)), "LB"[MACHINE_IS_BIGENDIAN]);
+  }
 }
 
 static int strcmp_p(const void *p1, const void *p2)