File: configure.in

package info (click to toggle)
swi-prolog-packages 5.0.1-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 50,688 kB
  • ctags: 25,904
  • sloc: ansic: 195,096; perl: 91,425; cpp: 7,660; sh: 3,046; makefile: 2,750; yacc: 843; awk: 14; sed: 12
file content (136 lines) | stat: -rw-r--r-- 2,918 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
dnl Process this file with autoconf to produce a configure script.

AC_INIT(install-sh)
AC_CONFIG_HEADER(config.h)

AC_SUBST(NETLIBS)
AC_SUBST(PL)
AC_SUBST(PLLIBS)
AC_SUBST(PLBASE)
AC_SUBST(PLARCH)
AC_SUBST(PLINCL)
AC_SUBST(COFLAGS)
AC_SUBST(CWFLAGS)
AC_SUBST(CMFLAGS)
AC_SUBST(ETAGS)
AC_SUBST(LD)
AC_SUBST(SO)
AC_SUBST(LDSOFLAGS)
AC_SUBST(TARGETS)
AC_SUBST(PLTARGETS)

AC_ARG_ENABLE(mt, [  --enable-mt		  Enable Multi-threading],
	      [case "$enableval" in
		   yes) AC_DEFINE(_REENTRANT)
			;;
		   *)  ;;
	       esac])

if test -z "$PLINCL"; then
plcandidates="pl swipl swi-prolog"
AC_CHECK_PROGS(PL, $plcandidates, "none")
AC_CHECK_PROGS(PLLD, plld, "none")
if test $PLLD = "none"; then
   AC_ERROR("Cannot find SWI-Prolog plld utility. SWI-Prolog must be installed first")
fi
if test $PL = "none"; then
   AC_ERROR("Cannot find SWI-Prolog. SWI-Prolog must be installed first")
else
   AC_CHECKING("Running $PL -dump-runtime-variables")
   eval `$PL -dump-runtime-variables`
fi
PLINCL=$PLBASE/include
AC_MSG_RESULT("		PLBASE=$PLBASE")
AC_MSG_RESULT("		PLARCH=$PLARCH")
AC_MSG_RESULT("		PLLIBS=$PLLIBS")
AC_MSG_RESULT("		PLLDFLAGS=$PLLDFLAGS")
AC_MSG_RESULT("		PLSHARED=$PLSHARED")
AC_MSG_RESULT("		PLSOEXT=$PLSOEXT")
else
PLLD=../../$BUILDDIR/plld
fi

CC=$PLLD
LD=$PLLD
LDSOFLAGS=-shared
CMFLAGS=-fpic

SO="$PLSOEXT"

TARGETS="unix.$SO socket.$SO cgi.$SO memfile.$SO"

AC_CHECK_PROGS(MAKE, gmake make, "make")
AC_CHECK_PROGS(ETAGS, etags ctags, ":")
AC_PROG_INSTALL
AC_ISC_POSIX
AC_HEADER_STDC
CFLAGS="$CMFLAGS"
AC_FUNC_ALLOCA
AC_C_BIGENDIAN

if test ! -z "$GCC"; then
    COFLAGS=-O2
    CWFLAGS=-Wall
else
    COFLAGS=-O
    CWFLAGS=
fi

AC_CHECK_LIB(socket, socket,
	     [NETLIBS="$NETLIBS -lsocket"; LIBS="$LIBS -lsocket"]
	     AC_DEFINE(HAVE_LIBSOCKET))
AC_CHECK_LIB(nsl, t_bind,
	     [NETLIBS="$NETLIBS -lnsl"]
	     AC_DEFINE(HAVE_LIBNSL))
AC_CHECK_LIB(crypt, crypt)
AC_CHECK_LIB(rfc822, rfc822t_alloc)
AC_MSG_CHECKING(for -lrfc2045)
oldlibs="$LIBS"
LIBS="-lrfc2045 $LIBS"
AC_TRY_LINK(
void
rfc2045_error(const char *errmsg)
{ 
},,
  AC_MSG_RESULT(yes)
  have_rfc2045=yes,
  AC_MSG_RESULT(no)
  have_rfc2045=no
  LIBS="$oldlibs")


if test "$ac_cv_lib_crypt_crypt" = yes; then
  TARGETS="$TARGETS crypt.$SO"
else
  echo "WARNING: could not find crypt; dropping crypt.pl from targets"
fi
if test "$ac_cv_lib_rfc822_rfc822t_alloc" = yes &&
   test "$have_rfc2045" = yes; then
  TARGETS="$TARGETS mime.$SO"
else
  echo "WARNING: could not find -lrfc822 and/or -lrfc2045; dropping mime.pl from targets"
fi

PLTARGETS=`echo $TARGETS | sed "s/\.$SO/.pl/g"`

AC_MSG_CHECKING(h_errno)
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
],
[ int x = h_errno;
], AC_DEFINE(HAVE_H_ERRNO)
   AC_MSG_RESULT(yes),
   AC_MSG_RESULT(no))

AC_CHECK_HEADERS(malloc.h alloca.h unistd.h sys/time.h fcntl.h)
AC_CHECK_FUNCS(setsid strerror)

AC_OUTPUT(Makefile)