aboutsummaryrefslogtreecommitdiffstats
path: root/bs/mkconfig_header.sh
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2006-09-06 09:26:51 +0000
committerEric Wong <normalperson@yhbt.net>2006-09-06 09:26:51 +0000
commit412cb1ee105a74999a3ffac4e60e6602c5f2e541 (patch)
treefc8b9e117fc3ff5eaf0f55113be9dc89418b7a6f /bs/mkconfig_header.sh
parent7b6d45f50fa49f4da56cc4ae29758a01ec958792 (diff)
downloadmpd-412cb1ee105a74999a3ffac4e60e6602c5f2e541.tar.gz
mpd-412cb1ee105a74999a3ffac4e60e6602c5f2e541.tar.xz
mpd-412cb1ee105a74999a3ffac4e60e6602c5f2e541.zip
bs: a work in progress..
git-svn-id: https://svn.musicpd.org/mpd/trunk@4737 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'bs/mkconfig_header.sh')
-rwxr-xr-xbs/mkconfig_header.sh93
1 files changed, 93 insertions, 0 deletions
diff --git a/bs/mkconfig_header.sh b/bs/mkconfig_header.sh
new file mode 100755
index 000000000..0f3f0d0e3
--- /dev/null
+++ b/bs/mkconfig_header.sh
@@ -0,0 +1,93 @@
+#!/bin/sh
+
+# basic package info
+p=mpd
+v=0.12.0
+b=warren.dukes@gmail.com
+
+. bs/bs-lib.sh
+
+cat <<EOF
+#define PACKAGE "$p"
+#define VERSION "$p"
+#define PACKAGE_BUGREPORT "$b"
+#define PACKAGE_NAME "$p"
+#define PACKAGE_STRING "$p $v"
+#define PACKAGE_TARNAME "$p"
+#define PACKAGE_VERSION "$v"
+EOF
+
+# check for common headers:
+ansi_headers='
+assert
+ctype
+errno
+limits
+locale
+math
+signal
+stdarg
+stddef
+stdint
+stdio
+stdlib
+string
+'
+common_headers='
+dlfcn
+inttypes
+memory
+strings
+sys/inttypes
+sys/stat
+sys/types
+unistd
+'
+
+all_ansi=t
+for h in $ansi_headers; do
+ H="HAVE_`echo $h | tr a-z A-Z | tr / _`_H"
+ if test_header $h; then
+ echo "#define $H 1"
+ else
+ echo "/* #undef $H */"
+ all_ansi=
+ fi
+done
+test x$all_ansi = xt && echo "#define STDC_HEADERS 1"
+
+for h in $common_headers; do
+ H="HAVE_`echo $h | tr a-z A-Z | tr / _`_H"
+ if test_header $h; then
+ echo "#define $H 1"
+ else
+ echo "/* #undef $H */"
+ fi
+done
+
+# test for langinfo.h and codeset
+cat > t.c <<EOF
+#include <langinfo.h>
+int main () { char *cs = nl_langinfo(CODESET); return 0; }
+EOF
+run_cc
+test $? -eq 0 && echo '#define HAVE_LANGINFO_CODESET 1'
+
+# the only feature (non-external library) feature we currently have
+if test x$want_ipv6 != xno; then
+ cat > t.c <<EOF
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#ifdef PF_INET6
+#ifdef AF_INET6
+AP_maGiC_VALUE
+#endif
+#endif
+EOF
+ if $CPP t.c 2>&1 | grep AP_maGiC_VALUE >/dev/null 2>&1; then
+ echo '#define HAVE_IPV6 1'
+ fi
+fi
+
+rm -f t.o t.c