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 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449
|
# -*- mode:sh; sh-basic-offset:2; tab-width:2; indent-tabs-mode:t -*-
AC_INIT()
AC_CONFIG_HEADER(src/bl_config.h)
AC_CONFIG_AUX_DIR(script)
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
# for CFLAGS="..." ./configure ...
AC_SUBST(CFLAGS)
AC_PROG_CC
# if --with-libtool is specified, cpp isn't detected.
AC_PROG_CPP
AC_PROG_INSTALL
#detect glibc
AC_TRY_COMPILE([#include <features.h>],
[
#ifdef __GLIBC__
#else
#error
int boil\[-1\];
#endif
], [CFLAGS="$CFLAGS -D_GNU_SOURCE"])
#
# --- debug ---
#
AC_ARG_ENABLE(debug,
[ --enable-debug debug @<:@default=disabled@:>@],
debug=$enable_debug)
if test "$debug" = yes ; then
DEB_CFLAGS="-DDEBUG -DBL_DEBUG"
fi
AC_SUBST(DEB_CFLAGS)
#
# --- libtool ---
#
AC_LIBTOOL_WIN32_DLL
AC_LIBTOOL_DLOPEN
AC_ARG_WITH(libtool,
[ --with-libtool@<:@=ARG@:>@ libtool path @<:@default=without@:>@],
libtool=$with_libtool)
if test "${libtool}" != "" ; then
LIBTOOL=${libtool}
else
AM_PROG_LIBTOOL
LIBTOOL='${top_builddir}/libtool'
fi
AC_SUBST(LIBTOOL)
#
# --- Checks for header files ---
#
# NOTE: if --with-libtool is specified, stdc header isn't detected.
AC_HEADER_STDC
AC_CHECK_HEADERS(langinfo.h dlfcn.h dl.h stropts.h sys/stropts.h stdint.h windows.h errno.h stdint.h)
#
# --- Checks for library functions ---
#
AC_CHECK_FUNCS(strsep fgetln basename isastream seteuid setegid geteuid getegid setsid snprintf usleep setenv unsetenv flock getuid getgid getpwuid recvmsg setpgid socketpair killpg gettimeofday)
AC_FUNC_ALLOCA
AC_C_INLINE
AC_C_CONST
AC_C_BIGENDIAN
AC_SYS_LARGEFILE
# for OpenServer 6.0.0
AC_CHECK_HEADER(sys/bitypes.h,
[
ac_includes_default="\
$ac_includes_default
#include <sys/bitypes.h>"
HAVE_SYS_BITYPES_H=1
AC_DEFINE(HAVE_SYS_BITYPES_H)
])
AC_CHECK_TYPE(u_char,unsigned char)
AC_CHECK_TYPE(u_short,unsigned short)
AC_CHECK_TYPE(u_int,unsigned int)
AC_CHECK_TYPE(u_long,unsigned long)
AC_CHECK_TYPE(u_int8_t,unsigned char)
AC_CHECK_TYPE(u_int16_t,unsigned short)
AC_CHECK_TYPE(u_int32_t,unsigned int)
AC_CHECK_TYPE(u_int64_t,unsigned long)
AC_CHECK_TYPE(int8_t,char)
AC_CHECK_TYPE(int16_t,short)
AC_CHECK_TYPE(int32_t,int)
AC_CHECK_TYPE(int64_t,long)
AC_CHECK_TYPE(ssize_t,int)
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_UID_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_C_TYPEOF
#
# --- Platform dependent stuff ---
#
bl_cv_cygwin=no
bl_cv_mingw=no
bl_cv_win32=no
case "${host_os}" in
cygwin*)
bl_cv_cygwin=yes
case "${CC} ${CFLAGS}" in
*mno-cygwin* | *-mingw*)
bl_cv_win32=yes
AC_DEFINE(USE_WIN32API,,"USE_WIN32API")
;;
*)
;;
esac
;;
mingw*)
bl_cv_mingw=yes
if test ! -f "/lib/libmsys-1.0.dll.a" ; then
case "${lt_cv_path_LD}" in
*-msys*)
;;
*)
bl_cv_win32=yes
AC_DEFINE(USE_WIN32API,,"USE_WIN32API")
;;
esac
fi
;;
*)
;;
esac
#
# --- socklen_t ---
#
# NOTE: #define _BSDTYPES_DEFINED is necessary because AC_TRY_COMPILE defines
# u_char, u_short and so on before #include <ws2tcpip.h> .
#
AC_CACHE_CHECK(for socklen_t, bl_cv_socklen_ident,
[AC_TRY_COMPILE(
[
#include <stddef.h>
#include <sys/types.h>
#include <sys/socket.h>
],
[
socklen_t len ;
], bl_cv_socklen_ident=yes,
[AC_TRY_COMPILE(
[
#define _BSDTYPES_DEFINED
#include <ws2tcpip.h>
],
[
socklen_t len ;
], bl_cv_socklen_ident=yes, bl_cv_socklen_ident=no)])])
if test "${bl_cv_socklen_ident}" = "no" ; then
AC_DEFINE(socklen_t, unsigned int, "socklen_t")
fi
#
# --- Check if concatenation of string literals with __FUNCTION__ is supported. ---
#
AC_CACHE_CHECK(for __FUNCTION__, bl_cv_func_ident,[
AC_TRY_COMPILE(,
[
char * p = "[" __FUNCTION__ "]" ;
] , bl_cv_func_ident=yes,bl_cv_func_ident=no)])
if test "${bl_cv_func_ident}" = "yes" ; then
AC_DEFINE(CONCATABLE_FUNCTION,,"CONCATABLE_FUNCTION")
fi
#
# --- Check for libxpg4 (for FreeBSD) ---
#
AC_CHECK_FUNCS(setlocale)
if test "x$ac_cv_func_setlocale" = xno ; then
AC_CHECK_LIB(xpg4, setlocale, XPG4_LIBS=-lxpg4)
AC_SUBST(XPG4_LIBS)
fi
#
# --- Checks for dynamic linking loader ---
#
DL_LOADER=none
DL_LIBS=
DL_CFLAGS=
# lt_dlopenext in libltdl
AC_ARG_WITH(libltdl,
[ --with-libltdl@<:@=PREFIX@:>@ load modules with libltdl @<:@default=without@:>@],,
[with_libltdl=no])
if test "x$with_libltdl" != "xno" ; then
if test "x$with_libltdl" != "xyes"; then
DL_CFLAGS="-I$with_libltdl/include"
bl_libltdl_libdir="-L$with_libltdl/lib"
fi
bl_ldflags_save="$LDFLAGS"
LDFLAGS="$LDFLAGS $bl_libltdl_libdir"
AC_CHECK_LIB(ltdl, lt_dlopenext,
[
DL_LOADER=ltdl
DL_LIBS="$bl_libltdl_libdir -lltdl"
],[
echo ""
echo "Could not find libltdl"
echo ""
exit 1])
LDFLAGS="$bl_ldflags_save"
fi
# lt_cv_dlopen is set by AC_LIBTOOL_DLOPEN
if test "$DL_LOADER" = none ; then
case "${lt_cv_dlopen}" in
# LoadLibrary (Windows)
LoadLibrary)
DL_LOADER=win32
;;
# shl_load (HP-UX)
shl_load)
DL_LOADER=dld
;;
# dlopen (UNIX98)
dlopen)
DL_LOADER=dl
;;
# What is dld_link? Does anybody know?
dld_link)
DL_LOADER=none
;;
*)
DL_LOADER=none
;;
esac
DL_LIBS="${DL_LIBS} ${lt_cv_dlopen_libs}"
if test "$DL_LOADER" = none ; then
# NSLinkModule (darwin)
AC_CHECK_FUNC(NSLinkModule,
[
DL_LOADER=dyld
DL_LIBS=
], [])
fi
# cygwin hack
# (AC_LIBTOOL_DLOPEN tell lt_cv_dlopen == dlopen but use bl_dlcfn_win32.c.)
# On msys2, use dlopen because bl_dlfcn_win32 doesn't work correctly.
if test "$bl_cv_cygwin" = "yes"; then
DL_LOADER=win32
fi
fi
AC_SUBST(DL_LOADER)
AC_SUBST(DL_LIBS)
AC_SUBST(DL_CFLAGS)
if test "$DL_LOADER" = none ; then
AC_DEFINE(DLFCN_NONE,,"DLFCN_NONE")
fi
#
# --- check for undefined symbol ---
#
AC_MSG_CHECKING([for undefined symbol])
if test "x$allow_undefined_flag" = "xunsupported" ; then
AC_MSG_RESULT([not supported])
NO_UNDEFINED_FLAG="-no-undefined"
else
AC_MSG_RESULT(supported)
NO_UNDEFINED_FLAG=""
fi
AC_SUBST(NO_UNDEFINED_FLAG)
#
# --- pty check ---
#
AC_MSG_CHECKING(for pty/tty type)
if test "$bl_cv_win32" = "yes" ; then
bl_cv_pty=none
elif test "$bl_cv_mingw" = "yes" ; then
bl_cv_pty=streams
elif test "$host" = "$build" ; then
AC_CHECK_FUNC(posix_openpt,
[
AC_DEFINE(HAVE_POSIX_OPENPT,,"HAVE_POSIX_OPENPT")
bl_cv_pty=streams
],
[bl_cv_pty=bsd])
if test "$bl_cv_pty" = "bsd" ; then
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([#include <sys/stat.h>
#include <fcntl.h>],
[return open( "/dev/ptmx", O_RDWR | O_NOCTTY, 0) == -1;])],
[bl_cv_pty=streams])
fi
else
# cross compiling
AC_CHECK_FUNC(posix_openpt,
[
AC_DEFINE(HAVE_POSIX_OPENPT,,"HAVE_POSIX_OPENPT")
bl_cv_pty=streams
],
[bl_cv_pty=bsd])
fi
AC_ARG_ENABLE(pty_helper,
[ --enable-pty-helper use pty helper @<:@default=disabled@:>@],
pty_helper=$enable_pty_helper)
if test "$pty_helper" = yes ; then
if test "$bl_cv_pty" = streams ; then
bl_cv_pty=helper
else
echo ""
echo "** WARNING **"
echo " pty helper is not supported in bsd-style pty system."
echo ""
fi
fi
AC_MSG_RESULT($bl_cv_pty)
PTY_NAME="${bl_cv_pty}"
AC_SUBST(PTY_NAME)
#
# --- checks for utmp ---
#
AC_ARG_WITH(utmp,
[ --with-utmp@<:@=ARG@:>@ utmp (utempter,sysv,login,bsd,none)],
utmp_type=$with_utmp)
UTMP_NAME=
UTMP_LIBS=
if test "$bl_cv_pty" = helper -o "$bl_cv_mingw" = yes -o "$bl_cv_cygwin" = yes -o "$host_os" = "msys" -o "$host_os" = "haiku"; then
UTMP_NAME=none
UTMP_LIBS=
fi
# libutempter
if test "$utmp_type" = "" -o "$utmp_type" = "utempter"; then
if test -z "$UTMP_NAME"; then
AC_CHECK_LIB(utempter, utempter_add_record,
[
UTMP_NAME=utmper
UTMP_LIBS="-lutempter"
UTMP_CFLAGS="-DUTEMPTER_NEW_API"
], [])
fi
if test -z "$UTMP_NAME"; then
# FreeBSD
AC_CHECK_LIB(ulog, utempter_add_record,
[
UTMP_NAME=utmper
UTMP_LIBS="-lulog"
UTMP_CFLAGS="-DUTEMPTER_NEW_API"
], [])
fi
if test -z "$UTMP_NAME" ; then
AC_CHECK_LIB(utempter, addToUtmp,
[
UTMP_NAME=utmper
UTMP_LIBS="-lutempter -lutil"
])
fi
fi
# setutxent() (SysV)
if test "$utmp_type" = "" -o "$utmp_type" = "sysv"; then
if test -z "$UTMP_NAME"; then
AC_CHECK_FUNC(setutxent,
[
UTMP_NAME=sysv
UTMP_LIBS=
UTMP_CFLAGS=-DUSE_UTMPX
], [])
fi
# setutent() (SysV)
if test -z "$UTMP_NAME"; then
AC_CHECK_FUNC(setutent,
[
UTMP_NAME=sysv
UTMP_LIBS=
], [])
fi
fi
# libutil
if test "$utmp_type" = "" -o "$utmp_type" = "login"; then
if test -z "$UTMP_NAME" ; then
AC_CHECK_LIB(util, logout,
[
UTMP_NAME=login
UTMP_LIBS=-lutil
], [])
fi
fi
# other (BSD)
if test "$utmp_type" = "" -o "$utmp_type" = "bsd"; then
if test -z "$UTMP_NAME" ; then
UTMP_NAME=bsd
UTMP_LIBS=
fi
fi
if test -z "$UTMP_NAME" ; then
UTMP_NAME=none
UTMP_LIBS=
fi
AC_SUBST(UTMP_NAME)
AC_SUBST(UTMP_LIBS)
AC_SUBST(UTMP_CFLAGS)
#
# --- remove functions mlterm doesn't use ---
#
AC_ARG_WITH(funcs-mlterm-unuse,
[ --without-funcs-mlterm-unuse remove functions mlterm does not use @<:@default=with@:>@],
funcs_mlterm_unuse=$with_funcs_mlterm_unuse,funcs_mlterm_unuse="yes")
if test "$funcs_mlterm_unuse" = "no" ; then
AC_DEFINE(REMOVE_FUNCS_MLTERM_UNUSE,,"REMOVE_FUNCS_MLTERM_UNUSE")
fi
#
# --- check for malloc ---
#
if test "$host" = "$build"; then
AC_TRY_RUN(
[
#include <stdlib.h>
#include <stddef.h>
int main() {
return calloc(8, ((1 << (sizeof(size_t) * 8 - 1)) + 1)) ? 1 : 0;
}
],
AC_DEFINE(CALLOC_CHECK_OVERFLOW))
fi
AC_SUBST(pobl_top_srcdir_suffix)
AC_SUBST(pobl_top_builddir_suffix)
AC_OUTPUT(Makefile src/Makefile)
|