diff --git a/README.md b/README.md index 7b0380d13..ca8afec2f 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,9 @@ Provides HTTPS TLS / X.509 / etc. - **zlib** or **lz4** or **snappy** (Compression library): Provides compression for the database, etc. +- **libmagic** (Optional) +Content MIME type recognition. + - **GNU C++ compiler**, **automake**, **autoconf**, **autoconf2.13**, **autoconf-archive**, **libtool**, **shtool** diff --git a/configure.ac b/configure.ac index 67c1e5ed5..069ae75ab 100644 --- a/configure.ac +++ b/configure.ac @@ -1200,6 +1200,26 @@ AM_CONDITIONAL([PCRE], [test "x$have_pcre" = "xyes"]) +dnl +dnl libmagic support +dnl + +RB_CHK_SYSHEADER(magic.h, [MAGIC_H]) +AC_CHECK_LIB(magic, magic_version, +[ + have_magic="yes" + AC_SUBST(MAGIC_CPPFLAGS, []) + AC_SUBST(MAGIC_LDFLAGS, []) + AC_SUBST(MAGIC_LIBS, ["-lmagic"]) + AC_DEFINE(HAVE_MAGIC, 1, [Define to 1 if libmagic (-lmagic) is available.]) +], [ + have_magic="no" +]) + +AM_CONDITIONAL([MAGIC], [test "x$have_magic" = "xyes"]) + + + dnl dnl Additional linkages dnl @@ -1389,6 +1409,7 @@ echo "Building JS (SpiderMonkey) ........ $with_included_js" echo "GNU MP support .................... $have_gmp" echo "Sodium support .................... $have_sodium" echo "SSL support........................ $SSL_TYPE" +echo "Magic support...................... $have_magic" echo "Precompiled headers ............... $build_pch" echo "Developer debug ................... $debug" echo "IPv6 support ...................... $ipv6" diff --git a/ircd/Makefile.am b/ircd/Makefile.am index d44910419..4be12e18e 100644 --- a/ircd/Makefile.am +++ b/ircd/Makefile.am @@ -14,6 +14,7 @@ AM_CPPFLAGS = \ -DBOOST_COROUTINE_NO_DEPRECATION_WARNING=1 \ @BOOST_CPPFLAGS@ \ @SODIUM_CPPFLAGS@ \ + @MAGIC_CPPFLAGS@ \ -include ircd/ircd.h \ ### @@ -46,6 +47,7 @@ libircd_la_LDFLAGS = \ @JS_LDFLAGS@ \ @BOOST_LDFLAGS@ \ @SODIUM_LDFLAGS@ \ + @MAGIC_LDFLAGS@ \ ### libircd_la_LIBADD = \ @@ -53,6 +55,7 @@ libircd_la_LIBADD = \ @JS_LIBS@ \ @BOOST_LIBS@ \ @SODIUM_LIBS@ \ + @MAGIC_LIBS@ \ -lcrypto \ -lssl \ -lz \