summaryrefslogtreecommitdiffstats
path: root/tdecore/configure.in.in
blob: ce957c92b4cf0d83e654e97fad4fd9c157da3f8d (plain)
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
dnl Compile in the exec prefix to help kstddirs in finding dynamic libs
AC_DEFINE_UNQUOTED(__KDE_EXECPREFIX, "$exec_prefix", [execprefix or NONE if not set, for libloading])

dnl Compile in kde_bindir to safely find tdesu_stub.
if test "$exec_prefix" = "NONE"; then
    bindir_str="\"$prefix/bin\""
else
    bindir_str="\"$exec_prefix/bin\""
fi
AC_DEFINE_UNQUOTED(__KDE_BINDIR, $bindir_str, [KDE bindir])

dnl tests for openpty support
AC_MSG_CHECKING(whether we can use openpty)
AC_ARG_ENABLE(openpty,
  [  --disable-openpty       disable openpty (UNIX98 terminals) support [default=enabled]],
  [ac_use_openpty=$enableval], [ac_use_openpty=yes])
if test "$ac_use_openpty" = "yes"; then
	kde_safe_LIBS=$LIBS
	LIBS="$LIBS $LIBUTIL"
	AC_TRY_RUN([
#include <pty.h>

int main(int argc, char* argv) {
	int master_fd, slave_fd;
	int result;

	result = openpty(&master_fd, &slave_fd, 0, 0, 0);

	return 0;
}
], [ac_use_openpty="yes"], [ac_use_openpty="no"])
	LIBS=$kde_safe_LIBS
fi
if test "$ac_use_openpty" = "yes"; then
	AC_DEFINE(HAVE_OPENPTY, 1, [Defines whether we can use the openpty() function])
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
fi

dnl -------
dnl Test for libidn (IDNA support)
dnl -------

AC_ARG_WITH(libidn,
  [AC_HELP_STRING(--with-libidn,
    [enable support for libidn @<:@default=check@:>@])],
  [], with_libidn=check)
LIB_IDN=
if test "x$with_libidn" != xno; then
  AC_CHECK_HEADERS([idna.h punycode.h stringprep.h])
  KDE_CHECK_LIB(idn, idna_to_ascii_4i, [
    AC_DEFINE_UNQUOTED(HAVE_LIBIDN, 1, [Defined if you have libidn in your system])
    LIB_IDN=-lidn
  ])
  if test "x$with_libidn" != xcheck && test -z "$LIB_IDN"; then
    AC_MSG_ERROR([--with-libidn was given, but test for libidn failed])
  fi
fi
AC_SUBST(LIB_IDN)

dnl --------
dnl KNetwork extra configuration
dnl --------

netincludes="#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>"

kde_safe_LIBS="$LIBS"
LIBS="$LIBS $all_libraries $X_EXTRA_LIBS"
AC_CHECK_FUNCS([inet_ntop inet_pton getpeername getsockname getsockopt gethostbyname2_r gethostbyname_r gethostbyname2 if_nametoindex getprotobyname_r getservbyname_r getservbyport_r])
LIBS="$kde_safe_LIBS"

dnl
dnl Some systems, like OpenBSD 3.6, have getservbyname_r but don't declare it
dnl
if test "x$ac_cv_func_getservbyname_r" = "xyes"; then

  AC_CHECK_DECLS([getservbyname_r],,,[$netincludes])

fi

KDE_CHECK_HEADERS([netinet/in.h net/if.h],,,[$netincludes])
KDE_CHECK_HEADERS([sys/filio.h])
AC_CHECK_FUNCS([usleep poll madvise])

dnl Check for struct addrinfo
AC_CHECK_TYPES([struct addrinfo],,,[$netincludes])

kde_safe_LIBS="$LIBS"
LIBS="$LIBS $LIBSOCKET"
AC_CHECK_FUNCS([getaddrinfo],
  [
    dnl Even though we now know that getaddrinfo is there, make sure getnameinfo is there too
    kde_gai_ok=true
    AC_CHECK_FUNCS([freeaddrinfo getnameinfo gai_strerror], : , 
    [
      kde_gai_ok=false
      AC_DEFINE(HAVE_BROKEN_GETADDRINFO, 1, [Define if getaddrinfo is broken and should be replaced])
      AC_DEFINE(GETADDRINFO_RETURNS_UNIX, 1, [Define if getaddrinfo returns AF_UNIX sockets])
      break
    ])

    AC_MSG_CHECKING([if getaddrinfo works using numeric service with null host])
    dnl On AIX (4.3), getaddrinfo returns NULL if the hint
    dnl is AF_INET/SOCK_STREAM/AI_PASSIVE.
    dnl The error code reports "Host not found".
    dnl It only seems to return non-NULL if the port is known (eg. in
    dnl /etc/services).
    AC_TRY_RUN(dnl
    [
      #include <sys/types.h>
      #include <sys/socket.h>
      #include <netdb.h>
      #include <string.h>
      int main()
      {
        struct addrinfo hint, *res;
        int err;
        memset(&hint, 0, sizeof(hint));
        hint.ai_family = AF_INET;
        hint.ai_protocol = 0;
        hint.ai_socktype = SOCK_STREAM;
        hint.ai_flags = AI_PASSIVE;
        err = getaddrinfo(0, "18300", &hint, &res); /* kxmlrpc tries this */
        if (err != 0 || res == 0 || res->ai_family != AF_INET)
          return 1;
        return 0;
      }
    ],
    [
      AC_MSG_RESULT(yes)
    ],
    [
      AC_MSG_RESULT(no)
      AC_DEFINE(HAVE_BROKEN_GETADDRINFO, 1, [Define if getaddrinfo is broken and should be replaced])
    ],
    [
      AC_MSG_RESULT(cross compiling. We hope so)
    ])
  ]
)
LIBS="$kde_safe_LIBS"

AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,[#include <sys/socket.h>])
AC_CHECK_TYPES([struct sockaddr_in6],
  [AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,[#include <netinet/in.h>])],,
  [#include <sys/types.h>
#include <netinet/in.h>])

AC_MSG_CHECKING([for GLIBC function backtrace])
AC_TRY_LINK(dnl
      [
        #include <execinfo.h>
      ],
      [
        void* trace[256];
        backtrace(trace, 256);
      ],
      [
        AC_DEFINE(HAVE_BACKTRACE, 1, [Define if execinfo.h exists and defines backtrace (GLIBC >= 2.1)])
	AC_MSG_RESULT(yes)
      ],
      AC_MSG_RESULT(no)
)

AC_CHECK_HEADERS(sys/mount.h)  

dnl AC_OUTPUT(tdecore/tde-config.cpp)

AM_CONFIG_HEADER(tdecore/kdemacros.h)

SVGICONS=
	
AC_ARG_WITH(libart,
  [AC_HELP_STRING(--with-libart,
    [enable support for libart @<:@default=check@:>@])],
  [], with_libart=check)

if test "x$with_libart" != xno; then
  KDE_FIND_PATH(libart2-config, LIBART_CONFIG, [${prefix}/bin ${exec_prefix}/bin], [
    AC_MSG_WARN([Could not find libart anywhere, check http://www.levien.com/libart/])
  ])

  if test -n "$LIBART_CONFIG"; then
    vers=`$LIBART_CONFIG --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
    if test -n "$vers" && test "$vers" -ge 2003008
    then
      LIBART_LIBS="`$LIBART_CONFIG --libs`"
      LIBART_RPATH=
      for args in $LIBART_LIBS; do
	  case $args in
	    -L/usr/lib) ;;
	    -L*)
  	       LIBART_RPATH="$LIBART_RPATH $args"
 	       ;;
          esac
      done
      LIBART_RPATH=`echo $LIBART_RPATH | sed -e "s/-L/-R/g"`
      LIBART_CFLAGS="`$LIBART_CONFIG --cflags`"
      SVGICONS=svgicons

      AC_DEFINE_UNQUOTED(HAVE_LIBART, 1, [Defines if your system has the libart library])
    else
      AC_MSG_WARN([You need at least libart 2.3.8])
    fi
  fi
  if test "x$with_libart" != xcheck && test -z "$LIBART_LIBS"; then
    AC_MSG_ERROR([--with-libart was given, but test for libart failed])
  fi
fi


AC_SUBST(LIBART_LIBS)
AC_SUBST(LIBART_CFLAGS)
AC_SUBST(LIBART_RPATH)
AM_CONDITIONAL(include_SVGICONS, test -n "$SVGICONS")

AC_CHECK_HEADERS([sys/stropts.h sys/select.h libutil.h util.h termios.h pty.h termio.h])
AC_MSG_CHECKING([for revoke(tty) in unistd.h])
AC_TRY_LINK(dnl
      [
        #include <unistd.h>
      ],
      [
	revoke("/dev/tty");
      ],
      [
        AC_DEFINE(HAVE_REVOKE, 1, [Define if revoke(tty) is present in unistd.h])
        AC_MSG_RESULT(yes)
      ],
      AC_MSG_RESULT(no)
)