File: configure.in

package info (click to toggle)
rsplib 0.8.0-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,768 kB
  • ctags: 2,128
  • sloc: ansic: 23,624; sh: 11,920; cpp: 789; makefile: 185
file content (431 lines) | stat: -rw-r--r-- 13,280 bytes parent folder | download
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
# without this order in this file, autoconf will not work!
# the argument is a source file out of your sources. But
# acinclude.m4 makes the job for all programs ;-)
AC_INIT(rsplib/rsplib.c)

# enable the following if you want to use autoconf/automake
# framework from a certain directory (like kde-common)
AC_CONFIG_AUX_DIR(admin)

AC_CANONICAL_HOST

AM_INIT_AUTOMAKE(rsplib, 0.8.0)

AC_PREFIX_DEFAULT(/usr/local)
if test "x$prefix" = "xNONE"; then
  prefix=$ac_default_prefix
  ac_configure_args="$ac_configure_args --prefix $prefix"
fi

# without this order in this file, automake will be confused!
#
AM_CONFIG_HEADER(config.h)

# Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_LIBTOOL

AC_ARG_ENABLE([csp],
[  --enable-csp            enable CSP support ],
AC_DEFINE(ENABLE_CSP, 1, "Define to 1 if you want CSP"), )

# ----------------------
# Packages configuration - Blatantly stolen from zebra !
# ----------------------
AC_ARG_ENABLE(ipv6,
[  --disable-ipv6          turn off IPv6 support ])

# ----------
# IPv6 check
# ----------
AC_MSG_CHECKING(whether this OS does have IPv6 stack)
if test "${enable_ipv6}" = "no"; then
   AC_MSG_RESULT(disabled)
else
   # ----------
   # INRIA IPv6
   # ----------
   if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
      cv_ipv6=yes
      AC_DEFINE(HAVE_IPV6, 1, "Define to 1 if IPv6 is supported.")
      AC_DEFINE(INRIA_IPV6, 1, "Define to 1 if it is a INRIA IPv6 stack.")
      LIB_IPV6=""
      AC_MSG_RESULT(INRIA IPv6)
   fi

   # ---------
   # KAME IPv6
   # ---------
   if grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
      cv_ipv6=yes
      AC_DEFINE(HAVE_IPV6, 1, "Define to 1 if IPv6 is supported.")
      AC_DEFINE(KAME, 1, "Define to 1 if the KAME implementation is used.")
      if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
         LIB_IPV6="-L/usr/local/v6/lib -linet6"
      fi
      AC_MSG_RESULT(KAME)
   fi

   # ---------
   # NRL check
   # ---------
   if grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
      cv_ipv6=yes
      AC_DEFINE(HAVE_IPV6, 1, "Define to 1 if IPv6 is supported.")
      AC_DEFINE(NRL, 1, "Define to 1 if NRL is used.")
      if test x"$opsys" = x"bsdi";then
         AC_DEFINE(BSDI_NRL, 1, "Define to 1 if BSDI NRL is used.")
         AC_MSG_RESULT(BSDI_NRL)
      else
          AC_MSG_RESULT(NRL)
      fi
   fi

   # ----------
   # Linux IPv6
   # ----------
   AC_EGREP_CPP(yes, [#
#include <linux/version.h>
/* 2.1.128 or later */
#if LINUX_VERSION_CODE >= 0x020180
yes
#endif],
   [cv_ipv6=yes; cv_linux_ipv6=yes; AC_MSG_RESULT(Linux IPv6)])
   if test "$cv_linux_ipv6" = "yes"; then
      AC_DEFINE(HAVE_IPV6, 1, "Define to 1 if IPv6 is supported.")
      AC_MSG_CHECKING(for GNU libc 2.1)
      AC_EGREP_CPP(yes, [
#include <features.h>
#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
      yes
#endif], [glibc=yes; AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))
      AC_DEFINE(LINUX_IPV6, 1, "Define to 1 if the Linux IPv6 implementation is used.")
      if test "$glibc" != "yes"; then
         INCLUDES="-I/usr/inet6/include"
         if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
            LIB_IPV6="-L/usr/inet6/lib -linet6"
         fi
      fi
   fi
fi

# -----------------------
# Set IPv6 related values
# -----------------------
LIBS="$LIB_IPV6 $LIBS"
AC_SUBST(LIB_IPV6)

# -----------------------------------
# check sin6_scope_id of sockaddr_in6
# -----------------------------------
if test "$cv_ipv6" = yes; then
   AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
   AC_TRY_COMPILE([#include <sys/types.h>
#include <netinet/in.h>
],[static struct sockaddr_in6 ac_i;int ac_j = sizeof(ac_i.sin6_scope_id);],
[AC_MSG_RESULT(yes)
 AC_DEFINE(HAVE_SIN6_SCOPE_ID, 1, "Define to 1 if sin6_scope_id is supported.")],
 AC_MSG_RESULT(no))
fi

# -----------------------------------
# Check for New Socket API (RFC2292BIS)
# -----------------------------------
AC_MSG_CHECKING(for rfc2292bis support)
AC_TRY_COMPILE([#include <sys/types.h>
#include <netinet/in.h>],
         [int x = IPV6_RECVPKTINFO;],
         [AC_DEFINE(USE_RFC2292BIS, 1, "Define to 1 if RFC 2292bis is supported.")
          AC_MSG_RESULT(yes)],
         [AC_MSG_RESULT(no)])


if test x$with_glib = xyes ; then
  AC_MSG_ERROR([
*** Directory must be specified for --with-glib])
fi

if test x$with_glib = x ; then
  # Look for separately installed glib

  AM_PATH_GLIB(1.2.8,,
    AC_MSG_ERROR([
*** GLIB 1.2.8 or better is required. The latest version of GLIB
*** is always available from ftp://ftp.gtk.org/.]),
    gmodule gthread)

  # we do not want to make all gtk progs to link to thread libraries.
  glib_cflags=`$GLIB_CONFIG glib gmodule --cflags`
  glib_thread_cflags="$GLIB_CFLAGS"
  glib_libs=`$GLIB_CONFIG glib gmodule --libs`
  glib_thread_libs="$GLIB_LIBS"
  glib_LIBS="$glib_libs"
  GLIB_LIBS="$glib_libs"
  GLIB_DEPLIBS="$glib_libs"
else
  # Use uninstalled glib (assume they got the version right)

  GLIB_CONFIG=$with_glib/glib-config
  if test -x $GLIB_CONFIG ; then
    :
  else
    AC_MSG_ERROR([GLIB directory ($with_glib) not present or not configured])
  fi

  # For use in gtk-config
  glib_cflags=`$GLIB_CONFIG --cflags gmodule`
  glib_thread_cflags=`$GLIB_CONFIG --cflags gmodule gthread`
  glib_libs=`$GLIB_CONFIG --libs gmodule`
  glib_thread_libs=`$GLIB_CONFIG --libs gmodule gthread`

  glib_release=`$GLIB_CONFIG --version | sed 's%\\.[[0-9]]*$%%'`

  # canonicalize relative paths
  case $with_glib in
    /*)
      glib_dir=$with_glib
      ;;
    *)
      glib_dir="\$(top_builddir)/$with_glib"
      ;;
  esac

  glib_LIBS="$glib_libs"
  GLIB_CFLAGS="-I$glib_dir -I$glib_dir/gmodule"
  GLIB_LIBS="$glib_dir/libglib.la $glib_dir/gmodule/libgmodule.la"
  GLIB_DEPLIBS=

  AC_SUBST(GLIB_CFLAGS)
  AC_SUBST(GLIB_LIBS)
fi

AC_SUBST(glib_cflags)
AC_SUBST(glib_libs)
AC_SUBST(glib_thread_cflags)
AC_SUBST(glib_thread_libs)
AC_SUBST(GLIB_DEPLIBS)
AC_SUBST(glib_LIBS)

CFLAGS="$CFLAGS $GLIB_CFLAGS -DINCLUDE_LEAFLINKEDREDBLACKTREE -DUSE_LEAFLINKEDREDBLACKTREE"
CXXFLAGS="$CXXFLAGS $GLIB_CFLAGS -DINCLUDE_LEAFLINKEDREDBLACKTREE -DUSE_LEAFLINKEDREDBLACKTREE"


# create only shared libtool-libraries (add --enable-shared)
# AC_ENABLE_SHARED(no)
# AM_DISABLE_SHARED

# set the following to yes, if you want to create static
# libtool-libraries, else no
# AC_ENABLE_STATIC(yes)





# add --with-extra-includes and --with-extra-libs switch to ./configure
#
all_libraries="$all_libraries $USER_LDFLAGS"
all_includes="$all_includes $USER_INCLUDES /usr/local/include"
AC_SUBST(all_includes)
AC_SUBST(all_libraries)

AC_SUBST(AUTODIRS)


CFLAGS="$CFLAGS -Wall -g"
CXXFLAGS="$CXXFLAGS -Wall -g"


case $host_os in
bsdi*)
    CFLAGS="$CFLAGS -DBSDI"
    thread_LIBS="-lpthread"
    CFLAGS="$CFLAGS `glib-config --cflags`"
    LDFLAGS="$LDFLAGS `glib-config --libs`"
    ;;
freebsd*)
    CFLAGS="$CFLAGS -DFreeBSD -D_PTHREADS -pthread -I/usr/local/include"
    CXXFLAGS="$CXXFLAGS -DFreeBSD -D_PTHREADS -pthread -I/usr/local/include"
    LDFLAGS="$LDFLAGS -L/usr/local/v6/lib"
    thread_LIBS=""
    # CFLAGS="$CFLAGS `glib12-config --cflags`"
    # LDFLAGS="$LDFLAGS `glib12-config --libs`"
    ;;
hpux*)
    CFLAGS="$CFLAGS -DSNAKE"
    test -z "$GCC" && TRY_CFLAGS="$TRY_CFLAGS -Wp,-H600000"
    thread_LIBS="-lpthread"
    # CFLAGS="$CFLAGS `glib-config --cflags`"
    # LDFLAGS="$LDFLAGS `glib-config --libs`"
   ;;
linux*)
    #CC=gcc-2.96
    #CXX=g++-2.96
    CFLAGS="$CFLAGS -DLINUX -D_BSD_SOURCE -D_REENTRANT -D_THREAD_SAFE -O0 -g"
    CXXFLAGS="$CXXFLAGS -DLINUX -D_BSD_SOURCE -D_REENTRANT -D_THREAD_SAFE -O0 -g"
    LDFLAGS="$LDFLAGS"
    thread_LIBS="-lpthread"
    ;;
openbsd*)
    LIBS="$LIBS -lcompat"
    thread_LIBS="-lpthread"
    # CFLAGS="$CFLAGS `glib-config --cflags`"
    # LDFLAGS="$LDFLAGS `glib-config --libs`"
    ;;
solaris*)
    CFLAGS="$CFLAGS -D_XPG4_2 -D__EXTENSIONS__ -DSOLARIS -D__sun -DSUN -DSUNOS_5"
    CXXFLAGS="$CXXFLAGS -D_XPG4_2 -D__EXTENSIONS__ -DSOLARIS -D__sun -DSUN -DSUNOS_5"
    thread_LIBS="-lpthread"
    LDFLAGS="$LDFLAGS -lsocket -lnsl -lrt -lresolv"
    # CFLAGS="$CFLAGS `glib-config --cflags`"
    # LDFLAGS="$LDFLAGS `glib-config --libs`"
    ;;
sunos4*)
    CFLAGS="$CFLAGS -DSUN -DSUN4"
    thread_LIBS="-lpthread"
    # CFLAGS="$CFLAGS `glib-config --cflags`"
    # LDFLAGS="$LDFLAGS `glib-config --libs`"
    ;;
darwin*)
    CFLAGS="$CFLAGS -DDARWIN"
    CXXFLAGS="$CXXFLAGS -DDARWIN"
    thread_LIBS="-lpthread"
    # CFLAGS="$CFLAGS `glib-config --cflags`"
    # LDFLAGS="$LDFLAGS `glib-config --libs`"
    ;;
esac
AC_SUBST(thread_LIBS)

AC_MSG_CHECKING(for socklen_t)
AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
                #include <sys/types.h>
                #endif
                #include <sys/socket.h>],
               [socklen_t x = 1; return 0;],
               [AC_MSG_RESULT(yes)],
               [AC_MSG_RESULT(int)
                AC_DEFINE(socklen_t, int, [Define a type for socklen_t.])])

AC_MSG_CHECKING(if stderr is a variable of type FILE* and not a macro)
AC_TRY_COMPILE([#include <stdio.h>],
               [FILE** stdlog = &stderr],
               [AC_DEFINE(HAVE_STDERR_FILEPTR, 1, "Define to 1 if stderr is a pointer.")
                AC_MSG_RESULT(yes)],
               [AC_MSG_RESULT(no)])

AC_CHECK_MEMBER(struct sockaddr_in.sin_len,
                AC_DEFINE(HAVE_SIN_LEN, 1, [Define this if your IPv4 has sin_len in sockaddr_in struct.]),,
                [#ifdef HAVE_SYS_TYPES_H
                 #include <sys/types.h>
                 #endif
                 #include <netinet/in.h>])

AC_CHECK_MEMBER(struct sockaddr_in6.sin6_len,
                AC_DEFINE(HAVE_SIN6_LEN, 1, [Define this if your IPv6 has sin6_len in sockaddr_in6 struct.]),,
                [#ifdef HAVE_SYS_TYPES_H
                 #include <sys/types.h>
                 #endif
                 #include <netinet/in.h>])

AC_CHECK_FUNCS(socket, ,        AC_CHECK_LIB(socket, socket))
AC_CHECK_FUNCS(sctp_sendmsg, ,  AC_CHECK_LIB(sctp, sctp_sendmsg))
AC_CHECK_FUNCS(sctp_connectx, , AC_CHECK_LIB(sctp, sctp_connectx))
AC_CHECK_FUNCS(sctp_send, ,     AC_CHECK_LIB(sctp, sctp_send))
AC_CHECK_FUNCS(sctp_sendx, ,    AC_CHECK_LIB(sctp, sctp_sendx))

# Check if kernel SCTP should be used
AC_ARG_ENABLE(kernel-sctp,
[  --enable-kernel-sctp Use kernel SCTP instead of sctplib [default=no]],enable_kernel_sctp=$enableval,enable_kernel_sctp=no)


if test "$enable_kernel_sctp" = "no"; then
   ac_sctplib_includes=NO ac_sctplib_libraries=NO ac_sctplib_bindir=NO
   sctplib_libraries=""
   sctplib_includes=""
   AC_ARG_WITH(sctplib,
      [  --with-sctplib=DIR       where the root of sctplib is installed ],
      [  ac_sctplib_includes="$withval"/include
         ac_sctplib_libraries="$withval"/lib
         ac_sctplib_bindir="$withval"/bin
      ])

   if test "$ac_sctplib_libraries" = "NO"; then
      ac_sctplib_defaultdir="/usr/local"
      ac_sctplib_includes="$ac_sctplib_defaultdir"/include
      ac_sctplib_libraries="$ac_sctplib_defaultdir"/lib
      ac_sctplib_bindir="$ac_sctplib_defaultdir"/bin
   fi

   if test ! -e "$ac_sctplib_includes/sctp.h" ; then
      AC_MSG_ERROR([No sctplib installation found ($ac_sctplib_includes/sctp.h)!])
   fi
   if test ! -e $ac_sctplib_libraries/libsctplib.a ; then
      AC_MSG_ERROR([No sctplib installation found ($ac_sctplib_libraries/libsctplib.a)!])
   fi
fi


ac_socketapi_includes=NO ac_socketapi_libraries=NO ac_socketapi_bindir=NO
socketapi_libraries=""
socketapi_includes=""
AC_ARG_WITH(socketapi,
   [  --with-socketapi=DIR       where the root of socketapi is installed ],
   [  ac_socketapi_includes="$withval"/include
      ac_socketapi_libraries="$withval"/lib
      ac_socketapi_bindir="$withval"/bin
   ])

if test "$ac_socketapi_libraries" = "NO"; then
   ac_socketapi_defaultdir="/usr/local"
   ac_socketapi_includes="$ac_socketapi_defaultdir"/include
   ac_socketapi_libraries="$ac_socketapi_defaultdir"/lib
   ac_socketapi_bindir="$ac_socketapi_defaultdir"/bin
fi

if test "$enable_kernel_sctp" = "no"; then
   if test ! -e $ac_socketapi_libraries/libsctpsocket.a ; then
      AC_MSG_ERROR([No socketapi installation found ($ac_socketapi_libraries/libsctpsocket.a)!])
   fi
   sctplib_LIBS="$ac_sctplib_libraries/libsctplib.a"
   socketapi_LIBS="$ac_socketapi_libraries/libsctpsocket.a -lstdc++"
else
   sctplib_LIBS=""
   socketapi_LIBS=""
   CFLAGS="$CFLAGS -DHAVE_KERNEL_SCTP"
   CXXFLAGS="$CXXFLAGS -DHAVE_KERNEL_SCTP"
fi
AC_SUBST(sctplib_LIBS)
AC_SUBST(socketapi_LIBS)


RSPLIB_CURRENT=0
RSPLIB_REVISION=8
RSPLIB_AGE=0
RSPLIB_RELEASE=800

AC_SUBST(RSPLIB_CURRENT)
AC_SUBST(RSPLIB_REVISION)
AC_SUBST(RSPLIB_AGE)
AC_SUBST(RSPLIB_RELEASE)


# perform program name transformation
# AC_ARG_PROGRAM

# add here all your Makefiles. These will be created by configure
AC_OUTPUT(Makefile rsplib/Makefile )


echo ""
echo "The rsplib package has been configured with the following options:"
echo "   Use kernel SCTP     : $enable_kernel_sctp"
echo "   sctplib libraries   : $sctplib_LIBS"
echo "   socketapi libraries : $socketapi_LIBS"
echo "   thread libraries    : $thread_LIBS"
echo "   CFLAGS              : $CFLAGS"
echo "   CXXFLAGS            : $CXXFLAGS"
echo "   LDFLAGS             : $LDFLAGS"