File: configure.ac

package info (click to toggle)
dmucs 0.6.1-3
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 3,220 kB
  • sloc: ansic: 5,053; sh: 3,557; cpp: 2,472; makefile: 63; perl: 26
file content (139 lines) | stat: -rw-r--r-- 4,203 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.58)
AC_INIT(dmucs, 0.5, vic.norman@gmail.com)
AC_CONFIG_SRCDIR([dmucs_msg.h])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC

# Checks for libraries.
AC_CHECK_LIB([nsl], [gethostbyname])
AC_CHECK_LIB([nsl], [gethostbyaddr_r])
AC_CHECK_LIB([socket], [socket])
AC_CHECK_LIB([pthread], [pthread_mutex_lock])

# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h sys/socket.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE

# Checks for library functions.
AC_FUNC_FORK
AC_HEADER_STDC
AC_CHECK_FUNCS([gethostbyaddr gethostbyaddr_r gethostbyname gethostname inet_ntoa putenv strerror])

dnl =================================================================
dnl Support for thread-safe versions of gethostbyaddr, gethostbyname,
dnl gmtime and localtime
dnl =================================================================

dnl Next line needed to find the gethost*_r functions on Solaris
AC_CHECK_LIB(nsl, gethostbyname)

AC_CHECK_FUNC(gethostbyaddr_r, [
  AC_MSG_CHECKING([signature of gethostbyaddr_r])
  AC_TRY_COMPILE([
#   include <netdb.h>
  ], [
    struct hostent *h, *hp;
    char *a, *b;
    int l, bl, t, e;
    (void) gethostbyaddr_r(a, l, t, h, b, bl, &hp, &e)
  ], [
    AC_DEFINE(HAVE_GETHOSTBYADDR_R_8_ARGS,1,
      [Define if gethostbyaddr_r() exists and takes 8 arguments])
    AC_MSG_RESULT([8 args])
  ], [
    AC_TRY_COMPILE([
#     include <netdb.h>
    ], [
      struct hostent *h;
      char *a, *b;
      int l, bl, t, e;
      (void) gethostbyaddr_r(a, l, t, h, b, bl, &e)
    ], [
      AC_DEFINE(HAVE_GETHOSTBYADDR_R_7_ARGS,1,
      [Define if gethostbyaddr_r() exists and takes 7 arguments])
      AC_MSG_RESULT([7 args])
    ], [
      AC_TRY_COMPILE([
#       include <netdb.h>
      ], [
        struct hostent_data *d;
        struct hostent *h;
        char a,
        int l, t;
        (void) gethostbyaddr_r(a, l, t, h, d)
      ], [
        AC_DEFINE(HAVE_GETHOSTBYADDR_R_5_ARGS,1,
      [Define if gethostbyaddr_r() exists and takes 5 arguments])
        AC_MSG_RESULT([5 args])
      ], [
        AC_MSG_RESULT(unrecognised)
      ])
    ])
  ])
], [
  AC_MSG_RESULT(no)
])

dnl FreeBSD -pthread check - Jonathan McDowell
AC_DEFUN([AC_PTHREAD_FREEBSD],
 [AC_MSG_CHECKING([if we need -pthread for threads])
          AC_CACHE_VAL(ac_ldflag_pthread,
                       [ac_save_LDFLAGS="$LDFLAGS"
                        LDFLAGS="-pthread $LDFLAGS"
                        AC_TRY_LINK([char pthread_create();],
                                    pthread_create();,
                                    eval "ac_ldflag_pthread=yes",
                                    eval "ac_ldflag_pthread=no"),
                                    LIBS="$ac_save_LDFLAGS"
                       ])
          if eval "test \"`echo $ac_ldflag_pthread`\" = yes"; then
             AC_MSG_RESULT(yes)
          else
            AC_MSG_RESULT(no)
          fi
        ])

AC_PTHREAD_FREEBSD


dnl @synopsis LIB_SOCKET_NSL
dnl
dnl This macro figures out what libraries are required on this platform
dnl to link sockets programs.
dnl
dnl The common cases are not to need any extra libraries, or to need
dnl -lsocket and -lnsl. We need to avoid linking with libnsl unless we
dnl need it, though, since on some OSes where it isn't necessary it
dnl will totally break networking. Unisys also includes gethostbyname()
dnl in libsocket but needs libnsl for socket().
dnl
dnl @category Misc
dnl @author Russ Allbery <rra@stanford.edu>
dnl @author Stepan Kasal <kasal@ucw.cz>
dnl @author Warren Young <warren@etr-usa.com>
dnl @version 2005-09-06
dnl @license AllPermissive
dnl (Got this code from autoconf-archive.cryp.to.)
AC_DEFUN([LIB_SOCKET_NSL],
[
      AC_SEARCH_LIBS([gethostbyname], [nsl])
      AC_SEARCH_LIBS([socket], [socket], [], [
              AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
              [], [-lnsl])])
])

LIB_SOCKET_NSL

AC_CONFIG_FILES([Makefile])
AC_OUTPUT