Merge pull request #3460 from techee/autoit_mapping
[geany-mirror.git] / m4 / geany-socket.m4
blob389d3d8d2ef69f06f2e3d0961729f6ec2b9606ee
1 dnl _GEANY_CHECK_SOCKET_PREREQ
2 AC_DEFUN([_GEANY_CHECK_SOCKET_PREREQ],
4         AC_ARG_ENABLE([socket],
5                         [AS_HELP_STRING([--enable-socket],
6                                         [enable if you want to detect a running instance [default=yes]])],
7                         [geany_enable_socket="$enableval"],
8                         [geany_enable_socket="auto"])
9 ])
11 dnl GEANY_CHECK_SOCKET([enable])
12 AC_DEFUN([GEANY_CHECK_SOCKET],
14         AC_REQUIRE([_GEANY_CHECK_SOCKET_PREREQ])
16         dnl this way of calling once is a bit ugly, but we need to be able to
17         dnl call this from one or more locations, the first one maybe in a shell
18         dnl conditional.
19         if test "x$_geany_enable_socket_done" = x; then
20                 dnl This one gives precedence for user choice
21                 dnl if test "x$geany_enable_socket" = xauto; then
22                 dnl     if test -n "$1"; then
23                 dnl             geany_enable_socket="$1"
24                 dnl     else
25                 dnl             geany_enable_socket=yes
26                 dnl     fi
27                 dnl fi
28                 if test -n "$1"; then
29                         geany_enable_socket="$1"
30                 elif test "x$geany_enable_socket" = xauto; then
31                         geany_enable_socket=yes
32                 fi
34                 if test "x$geany_enable_socket" = xyes; then
35                         AC_DEFINE([HAVE_SOCKET], [1], [Define if you want to detect a running instance])
36                         # this should bring in libsocket on Solaris:
37                         AC_SEARCH_LIBS([connect],[socket])
38                 fi
40                 GEANY_STATUS_ADD([Use (UNIX domain) socket support], [$geany_enable_socket])
41                 _geany_enable_socket_done=yes
42         fi