Add packaging
[platform/upstream/openconnect.git] / configure.ac
index d03c9fd..dce1924 100644 (file)
@@ -1,4 +1,4 @@
-AC_INIT(openconnect, 4.05)
+AC_INIT(openconnect, 4.99)
 PKG_PROG_PKG_CONFIG
 AC_LANG_C
 AC_CANONICAL_HOST
@@ -55,6 +55,7 @@ fi
 AC_DEFINE_UNQUOTED(DEFAULT_VPNCSCRIPT, "${with_vpnc_script}")
 AC_SUBST(DEFAULT_VPNCSCRIPT, "${with_vpnc_script}")
 
+use_openbsd_libtool=
 case $host_os in
  *linux* | *gnu*)
     AC_MSG_NOTICE([Applying feature macros for GNU build])
@@ -69,6 +70,10 @@ case $host_os in
     AC_DEFINE(_POSIX_C_SOURCE, 200112L)
     AC_DEFINE(_NETBSD_SOURCE)
     ;;
+ *openbsd*)
+    AC_MSG_NOTICE([Applying feature macros for OpenBSD build])
+    use_openbsd_libtool=true
+    ;;
  *)
     # On FreeBSD the only way to get vsyslog() visible is to define
     #  *nothing*, which makes absolutely everything visible.
@@ -135,6 +140,9 @@ AS_COMPILER_FLAGS(CFLAGS,
          -Wpointer-arith
          -Wwrite-strings")
 
+AC_CHECK_FUNC(socket, [], AC_CHECK_LIB(socket, socket, [], AC_ERROR(Cannot find socket() function)))
+AC_CHECK_FUNC(inet_aton, [], AC_CHECK_LIB(nsl, inet_aton, [], AC_ERROR(Cannot find inet_aton() function)))
+
 AC_ENABLE_SHARED
 AC_DISABLE_STATIC
 
@@ -168,9 +176,18 @@ if test "$USE_NLS" = "yes"; then
       (void)dgettext("openconnect", "foo");])],
       [AC_MSG_RESULT(yes (with -lintl))]
        LIBINTL="-lintl",
-      [AC_MSG_RESULT(no)
-       USE_NLS=no])
-     LIBS="$oldLIBS"])
+      [LIBS="$LIBS -liconv"
+       AC_LINK_IFELSE([AC_LANG_PROGRAM([
+        #include <locale.h>
+        #include <libintl.h>],[
+        setlocale(LC_ALL, "");
+        bindtextdomain("openconnect", "/tmp");
+        (void)dgettext("openconnect", "foo");])],
+        [AC_MSG_RESULT(yes (with -lintl -liconv))]
+         LIBINTL="-lintl",
+        [AC_MSG_RESULT(no)
+         USE_NLS=no])
+     LIBS="$oldLIBS"])])
 fi
 
 if test "$USE_NLS" = "yes"; then
@@ -371,6 +388,11 @@ AM_CONDITIONAL(OPENCONNECT_OPENSSL, [ test "$ssl_library" = "openssl" ])
 
 # Needs to happen after we default to static/shared libraries based on OpenSSL
 AC_PROG_LIBTOOL
+if test "$use_openbsd_libtool" = "true" && test -x /usr/bin/libtool; then
+       echo using OpenBSD libtool
+       LIBTOOL=/usr/bin/libtool
+fi
+AM_CONDITIONAL(OPENBSD_LIBTOOL, [ test "$use_openbsd_libtool" = "true" ])
 
 # Ick. This seems like it's likely to be very fragile, but I can't see a better
 # way. I shall console myself with the observation that the failure mode isn't
@@ -438,6 +460,12 @@ if (test "$libproxy_pkg" = "no"); then
    LIBS="$oldLIBS"
 fi
 
+PKG_CHECK_MODULES(LIBSTOKEN, stoken,
+               [AC_SUBST(LIBSTOKEN_PC, stoken)
+                AC_DEFINE([LIBSTOKEN_HDR], ["stoken.h"])
+                libstoken_pkg=yes],
+                libstoken_pkg=no)
+
 AC_CHECK_HEADER([if_tun.h],
     [AC_DEFINE([IF_TUN_HDR], ["if_tun.h"])],
     [AC_CHECK_HEADER([linux/if_tun.h],