about summary refs log tree commit diff stats
path: root/configure.ac
diff options
context:
space:
mode:
authorFabian Freyer <fabian.freyer@physik.tu-berlin.de>2014-09-26 04:01:06 +0200
committerFabian Freyer <fabian.freyer@physik.tu-berlin.de>2014-10-29 14:15:11 +0100
commit2c361644d6e26bafd954d08cf31b950b4ac05fba (patch)
treeb36b84b91d522040586a778e381442d04fe0b925 /configure.ac
parent35127321c99cdefc6a1ad31bb930dbd86ede4411 (diff)
downloadprofani-tty-2c361644d6e26bafd954d08cf31b950b4ac05fba.tar.gz
autotools: FreeBSD Support
Added libresolv and openssl checks for freebsd
Added libstrophe pkg-config dependency
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac98
1 files changed, 54 insertions, 44 deletions
diff --git a/configure.ac b/configure.ac
index a1101d2e..706be728 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,6 +15,7 @@ AC_PROG_CC
 AC_CANONICAL_HOST
 PLATFORM="unknown"
 AS_CASE([$host_os],
+    [freebsd*], [PLATFORM="freebsd"]
     [darwin*], [PLATFORM="osx"],
     [cygwin], [PLATFORM="cygwin"],
     [PLATFORM="nix"])
@@ -46,46 +47,55 @@ AC_ARG_WITH([xscreensaver],
 AC_ARG_WITH([themes],
     [AS_HELP_STRING([--with-themes[[=PATH]]], [install themes (default yes)])])
 
-### Select first existing xml library among expat and libxml2
-PARSER=""
-PARSER_LIBS=""
-PARSER_CFLAGS=""
-AS_IF([test "x$with_libxml2" != xyes],
-    [PKG_CHECK_MODULES([expat], [expat],
-        [PARSER_CFLAGS="$expat_CFLAGS"; PARSER_LIBS="$expat_LIBS"; PARSER="expat"],
-        [AC_CHECK_LIB([expat], [XML_ParserCreate],
-            [PARSER_LIBS="-lexpat"; PARSER="expat"],
-            AS_IF([test "x$with_libxml2" = xno],
-                [AC_MSG_ERROR([expat is required but does not exist])]))])
-    ])
-
-AS_IF([test "x$PARSER" = x -a "x$with_libxml2" != xno],
-    [PKG_CHECK_MODULES([libxml2], [libxml-2.0],
-        [PARSER_CFLAGS="$libxml2_CFLAGS"; PARSER_LIBS="$libxml2_LIBS"; PARSER="libxml2"],
-        AS_IF([test "x$with_libxml2" = xyes],
-            [AC_MSG_ERROR([libxml2 is required but does not exist])]))
-    ])
-
-AS_IF([test "x$PARSER" = x],
-    [AC_MSG_ERROR([either expat or libxml2 is required for profanity])])
-AM_CPPFLAGS="$AM_CPPFLAGS $PARSER_CFLAGS"
-LIBS="$LIBS $PARSER_LIBS"
-
-### Check for libstrophe dependencies
-AC_CHECK_LIB([resolv], [res_query], [],
-    [AC_CHECK_LIB([resolv], [__res_query], [],
-        [AC_MSG_ERROR([libresolv is required for profanity])])])
-PKG_CHECK_MODULES([openssl], [openssl], [],
-    [AC_MSG_ERROR([openssl is required for profanity])])
-AM_CPPFLAGS="$AM_CPPFLAGS $openssl_CFLAGS"
-LIBS="$LIBS $openssl_LIBS"
-
-# TODO: autodetect of XML parser libstrophe linked with
-CFLAGS_RESTORE="$CFLAGS"
-CFLAGS="$CFLAGS $AM_CPPFLAGS"
-AC_CHECK_LIB([strophe], [xmpp_ctx_new], [],
-    [AC_MSG_ERROR([libstrophe linked with $PARSER is required for profanity])])
-CFLAGS="$CFLAGS_RESTORE"
+# Use the CFLAGS and libs provided by libstrophe.pc if libstrophe has pkg-config support.
+PKG_CHECK_MODULES([libstrophe], [libstrophe], [LIBS="$libstrophe_LIBS $LIBS"],
+        [
+	 if test "x$PLATFORM" != xfreebsd; then
+		AC_CHECK_LIB([resolv], [res_query], [],
+		    [AC_CHECK_LIB([resolv], [__res_query], [],
+			[AC_MSG_ERROR([libresolv not found; libresolv required for profanity])])])
+	 else
+		AC_MSG_NOTICE([skipping libresolv checks for freebsd])
+	 fi
+
+         ### Check for libstrophe dependencies
+         ### Select first existing xml library among expat and libxml2
+         PARSER=""
+         PARSER_LIBS=""
+         PARSER_CFLAGS=""
+         AS_IF([test "x$with_libxml2" != xyes],
+             [PKG_CHECK_MODULES([expat], [expat],
+                 [PARSER_CFLAGS="$expat_CFLAGS"; PARSER_LIBS="$expat_LIBS"; PARSER="expat"],
+                 [AC_CHECK_LIB([expat], [XML_ParserCreate],
+                     [PARSER_LIBS="-lexpat"; PARSER="expat"],
+                     AS_IF([test "x$with_libxml2" = xno],
+                         [AC_MSG_ERROR([expat is required but does not exist])]))])
+             ])
+
+         AS_IF([test "x$PARSER" = x -a "x$with_libxml2" != xno],
+             [PKG_CHECK_MODULES([libxml2], [libxml-2.0],
+                 [PARSER_CFLAGS="$libxml2_CFLAGS"; PARSER_LIBS="$libxml2_LIBS"; PARSER="libxml2"],
+                 AS_IF([test "x$with_libxml2" = xyes],
+                     [AC_MSG_ERROR([libxml2 is required but does not exist])]))
+             ])
+
+         AS_IF([test "x$PARSER" = x],
+             [AC_MSG_ERROR([either expat or libxml2 is required for profanity])])
+         AM_CPPFLAGS="$AM_CPPFLAGS $PARSER_CFLAGS"
+         LIBS="$PARSER_LIBS $LIBS"
+
+         PKG_CHECK_MODULES([openssl], [openssl], [],
+                 [AC_CHECK_HEADER(openssl/ssl.h, [openssl_LIBS="-lssl -lcrypto"], [AC_MSG_ERROR([openssl not found; openssl required for profanity])])])
+         AM_CPPFLAGS="$AM_CPPFLAGS $openssl_CFLAGS"
+         LIBS="$openssl_LIBS $LIBS"
+
+         CFLAGS_RESTORE="$CFLAGS"
+         CFLAGS="$CFLAGS $AM_CPPFLAGS"
+         AC_CHECK_LIB([strophe], [xmpp_ctx_new], [LIBS="-lstrophe $LIBS"; listrophe_CFLAGS=""],
+                [AC_MSG_ERROR([libstrophe linked with $PARSER is required for profanity])])
+         CFLAGS="$CFLAGS_RESTORE"
+        ])
+CFLAGS="$CFLAGS $libstrophe_CFLAGS"
 
 ### Check for ncurses library
 PKG_CHECK_MODULES([ncursesw], [ncursesw],
@@ -96,8 +106,8 @@ PKG_CHECK_MODULES([ncursesw], [ncursesw],
             [AC_CHECK_LIB([ncurses], [main], [],
             	[AC_MSG_ERROR([ncurses is required for profanity])])])])])
 AM_CPPFLAGS="$AM_CPPFLAGS $NCURSES_CFLAGS"
-LIBS="$LIBS $NCURSES_LIBS"
-AS_IF([test "x$PLATFORM" = xosx], [LIBS="$LIBS -lncurses"])
+LIBS="$NCURSES_LIBS $LIBS"
+AS_IF([test "x$PLATFORM" = xosx], [LIBS="-lncurses $LIBS"])
 
 ### Check wide characters support in ncurses library
 CFLAGS_RESTORE="$CFLAGS"
@@ -124,7 +134,7 @@ PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.26], [],
 PKG_CHECK_MODULES([curl], [libcurl], [],
     [AC_MSG_ERROR([libcurl is required for profanity])])
 
-AS_IF([test "x$PLATFORM" = xosx], [LIBS="$LIBS -lcurl"])
+AS_IF([test "x$PLATFORM" = xosx], [LIBS="-lcurl $LIBS"])
 
 ### Check for desktop notification support
 ### Linux requires libnotify
@@ -220,7 +230,7 @@ AS_IF([test "x$PACKAGE_STATUS" = xdevelopment],
     [AM_CFLAGS="$AM_CFLAGS -Wunused -Werror"])
 AM_CPPFLAGS="$AM_CPPFLAGS $glib_CFLAGS $curl_CFLAGS $libnotify_CFLAGS"
 AM_CPPFLAGS="$AM_CPPFLAGS -DTHEMES_PATH=\"\\\"$THEMES_PATH\\\"\""
-LIBS="$LIBS $glib_LIBS $curl_LIBS $libnotify_LIBS"
+LIBS="$glib_LIBS $curl_LIBS $libnotify_LIBS $LIBS"
 
 AC_SUBST(AM_CFLAGS)
 AC_SUBST(AM_CPPFLAGS)