summaryrefslogtreecommitdiff
path: root/configure.in
blob: 2981a5a4c4bbabf495291415eb8b1b21dbfe41e5 (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
ad
dnl Process this file with autoconf to produce a configure script.
dnl The ONLY thing this is used for is to configure for different
dnl linux architectures and configurations, it is not used to make the
dnl code more portable

dnl You MUST have an environment that has all the POSIX functions and
dnl some of the more populare bsd/sysv ones (like select). You'll also
dnl need a C++ compiler that is semi-standard conformant, exceptions are 
dnl not used but STL is.

dnl 'make -f Makefile startup' will generate the configure file from 
dnl configure.in correctly and can be run at any time

AC_INIT(configure.in)
AC_CONFIG_AUX_DIR(buildlib)
AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/netdb.h:buildlib/netdb.h.in)

dnl -- SET THIS TO THE RELEASE VERSION --
AC_DEFINE_UNQUOTED(VERSION,"0.3.15.1")
AC_DEFINE_UNQUOTED(PACKAGE,"apt")

dnl Check our C compiler
AC_CHECK_TOOL_PREFIX
AC_PROG_CC
AC_ISC_POSIX

dnl Check the host arch (build+target not needed... yet)
AC_CANONICAL_HOST
AC_CHECK_TOOL_PREFIX	dnl recheck, in case the initial guess was wrong

dnl Check for other programs
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_RANLIB
AC_CHECK_TOOL(AR,ar,"ar")

dnl Checks for sockets
SAVE_LIBS="$LIBS"
LIBS=""
AC_SEARCH_LIBS(gethostbyname,nsl)
AC_SEARCH_LIBS(connect,socket)
SOCKETLIBS="$LIBS"
AC_SUBST(SOCKETLIBS)
LIBS="$SAVE_LIBS"

dnl Section Disabled pending removal of deity widget library  -- jgg
if test "yes" != "yes"; then
 dnl Checks for X11
 AC_PATH_X
 AC_PATH_XTRA
 AC_SUBST(X11LIB)
 X11LIB=
 if test "$no_x" != "yes"; then
   X11LIB="-lX11"
   AC_DEFINE(HAVE_X11)
   dnl Checks for ZPM
   AC_CHECK_LIB(Xpm, XpmLibraryVersion,[AC_DEFINE(HAVE_LIBXPM) XPMLIB="-lXpm"],,$X_LIBS $X_PRE_LIBS $X11LIB $X_EXTRA_LIBS)
   AC_SUBST(XPMLIB)
   if test "$XPMLIB" != "-lXpm"; then
      AC_MSG_ERROR(failed: I need xpm if you are building for X)
   fi
 fi
 
 dnl Checks for Slang
 AC_CHECK_LIB(slang, SLang_Version,[AC_DEFINE(HAVE_LIBSLANG) SLANGLIB="-lslang"])
 AC_SUBST(SLANGLIB)
 
 dnl Checks for GPM
 AC_ARG_WITH(gpm,[  --without-gpm		  do not use GPM mouse support])
 if test "$with_gpm" != "no"; then
   AC_CHECK_LIB(gpm, Gpm_Open,[AC_DEFINE(HAVE_LIBGPM) GPMLIB="-lgpm"])
   AC_SUBST(GPMLIB)
 fi
fi

dnl Checks for pthread
#AC_CHECK_LIB(pthread, pthread_create,[AC_DEFINE(HAVE_PTHREAD) PTHREADLIB="-lpthread"])
AC_SUBST(PTHREADLIB)
#if test "$PTHREADLIB" != "-lpthread"; then
#  AC_MSG_ERROR(failed: I need posix threads, pthread)
#fi

dnl Converts the ARCH to be the same as dpkg
AC_MSG_CHECKING(system architecture)
archset="`awk \"{ if(\\\$1 == \\\"$host_cpu\\\") print \\\$2 }\" $srcdir/buildlib/archtable`"
if test "x$archset" = "x"; then
  AC_MSG_ERROR(failed: use --host=)
fi
AC_MSG_RESULT($archset)
AC_DEFINE_UNQUOTED(ARCHITECTURE,"$archset")

dnl We use C9x types if at all possible
AC_CACHE_CHECK([for C9x integer types],c9x_ints,[
    AC_TRY_COMPILE([#include <inttypes.h>],
                   [uint8_t Foo1;uint16_t Foo2;uint32_t Foo3;],
		   c9x_ints=yes,c9x_ints=no)])

dnl Single Unix Spec statvfs
AC_CHECK_FUNC(statvfs,[HAVE_STATVFS=yes])
AC_SUBST(HAVE_STATVFS)

dnl Arg, linux and bsd put their statfs function in different places
if test x"$HAVE_STATVFS" != x"yes"; then
   AC_EGREP_HEADER(statfs,sys/vfs.h,[AC_DEFINE(HAVE_VFS_H)],[
   AC_EGREP_HEADER(statfs,sys/mount.h,[AC_DEFINE(HAVE_MOUNT_H)],[AC_MSG_ERROR(failed: Need statvfs)])
   ])
fi

dnl Check the sizes etc. of the architecture
changequote(,)
if archline="`grep \"^$archset\" $srcdir/buildlib/sizetable | cut -f 2- -d ' '`";then
   changequote([,])
   set $archline
   if test "$1" = "little"; then
      ac_cv_c_bigendian=no
   else
      ac_cv_c_bigendian=yes
   fi
   size_char=$2
   size_int=$3
   size_short=$4
   size_long=$5
fi

if test "$cross_compiling" = "yes" -a "$archline" = ""; then
  AC_MSG_ERROR(When cross compiling, architecture must be present in sizetable)
fi
AC_C_BIGENDIAN
   
dnl We do not need this if we have inttypes..
HAVE_C9X=yes
if test x"$c9x_ints" = x"no"; then
   AC_CHECK_SIZEOF(char,$size_char)
   AC_CHECK_SIZEOF(int,$size_int)
   AC_CHECK_SIZEOF(short,$size_short)
   AC_CHECK_SIZEOF(long,$size_long)
  
   HAVE_C9X=
   AC_SUBST(HAVE_C9X)
fi

AC_MSG_CHECKING(for socklen_t)
AC_EGREP_HEADER(socklen_t, sys/socket.h, [
	AC_DEFINE(HAVE_SYS_SOCKET_H)
	AC_MSG_RESULT(sys/socket.h)
], [
	AC_DEFINE(NEED_SOCKLEN_T_DEFINE)
	AC_MSG_RESULT([socklen_t size_t])
])

AC_MSG_CHECKING(for h_errno)
AC_EGREP_HEADER(h_errno, netdb.h, [AC_DEFINE(HAVE_NETDB_H)
	AC_MSG_RESULT(found)
], [AC_TRY_COMPILE(netdb.h, h_errno foo, [AC_MSG_RESULT(found)
		AC_MSG_RESULT(found)
	], [ah_CFLAGS="$CFLAGS"
		CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
		AC_TRY_COMPILE([netdb.h], [h_errno foo], [AC_DEFINE(NEED_XOPEN_NETDB_H)
			AC_MSG_RESULT([found, needed -D_XOPEN_SOURCE_EXTENDED])
		], [CFLAGS="$ah_CFLAGS"
			AC_MSG_ERROR(["not found."])
		])
	])
])

dnl Check for debiandoc
AC_CHECK_PROG(DEBIANDOC_HTML,debiandoc2html,"yes","")
AC_CHECK_PROG(DEBIANDOC_TEXT,debiandoc2text,"yes","")

dnl Check for YODL
AC_CHECK_PROG(YODL_MAN,yodl2man,"yes","")

ah_NUM_PROCS

AC_OUTPUT(environment.mak:buildlib/environment.mak.in makefile:buildlib/makefile.in,make dirs)