configure.in 12.3 KB
Newer Older
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
1 2 3 4
dnl Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)

Philippe Gerum's avatar
Philippe Gerum committed
5
AC_INIT([Xenomai simulator],m4_normalize(m4_include([../config/version])),xenomai-help@gna.org,xenosim)
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
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
AC_CONFIG_HEADERS(include/xeno_config.h)
AC_CONFIG_AUX_DIR(../config)
AC_CONFIG_SRCDIR(vm/thread.cc)
AC_PREFIX_DEFAULT(/usr/xenomai)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_PROG_INSTALL

AC_ARG_WITH(CC,
    AS_HELP_STRING([--with-cc=compiler], [use specific C compiler]),
    [
	case "$withval" in
	"" | y | ye | yes | n | no)
	    AC_MSG_ERROR([You must supply an argument to --with-cc.])
	  ;;
	esac
	CC="$withval"
    ])
AC_PROG_CC
CFLAGS="-O2"

AC_ARG_WITH(CXX,
    AS_HELP_STRING([--with-cxx=compiler], [use specific C++ compiler]),
    [ case "$withval" in
	"" | y | ye | yes | n | no)
	    AC_MSG_ERROR([You must supply an argument to --with-cxx.])
	  ;;
	esac
	CXX="$withval" ])
AC_PROG_CXX
CXXFLAGS="-O2"

AC_DEFINE_UNQUOTED(CONFIG_XENO_MVM_BUILD_STRING,"$build",[Build system alias])
MVM_BUILD_STRING="$build"
AC_DEFINE_UNQUOTED(CONFIG_XENO_MVM_HOST_STRING,"$host",[Host system alias])
MVM_HOST_STRING="$host"

AM_INIT_AUTOMAKE([foreign no-exeext dist-bzip2])
AM_MAINTAINER_MODE
AC_PROG_LIBTOOL
AM_PROG_LEX

48
if test \! -r $srcdir/../ksrc/nucleus ; then
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
49 50 51 52 53 54 55 56 57 58 59 60
    AC_MSG_ERROR([Missing Xenomai source tree in parent directory])
fi

AC_MSG_CHECKING(for atomic core mode)
AC_ARG_ENABLE(atomic_core,
	AS_HELP_STRING([--enable-atomic-core], [Enable MVM atomic core mode]),
	[case "$enableval" in
	y | yes) CONFIG_XENO_MVM_ATOMIC_CORE=y ;;
	*) unset CONFIG_XENO_MVM_ATOMIC_CORE ;;
	esac])
AC_MSG_RESULT(${CONFIG_XENO_MVM_ATOMIC_CORE:-no})

61 62 63 64 65 66 67 68 69 70
AC_MSG_CHECKING(for scalable scheduler)
AC_ARG_ENABLE(nucleus-scalable-sched,
	AS_HELP_STRING([--enable-nucleus-scalable-sched], 
                        [Enable scalable scheduler in nucleus]),
	[case "$enableval" in
	y | yes) CONFIG_XENO_OPT_SCALABLE_SCHED=y ;;
	*) unset CONFIG_XENO_OPT_SCALABLE_SCHED ;;
	esac])
AC_MSG_RESULT(${CONFIG_XENO_OPT_SCALABLE_SCHED:-no})

Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
71 72 73 74 75 76 77 78 79
AC_MSG_CHECKING(for debug support)
AC_ARG_ENABLE(debug,
	AS_HELP_STRING([--enable-debug], [Enable debug support]),
	[case "$enableval" in
	y | yes) CONFIG_XENO_OPT_DEBUG=y ;;
	*) unset CONFIG_XENO_OPT_DEBUG ;;
	esac])
AC_MSG_RESULT(${CONFIG_XENO_OPT_DEBUG:-no})

80 81 82 83 84 85 86 87 88
AC_MSG_CHECKING(for watchdog support)
AC_ARG_ENABLE(nucleus-debug,
	AS_HELP_STRING([--enable-nucleus-watchdog], [Enable watchdog support in nucleus]),
	[case "$enableval" in
	y | yes) CONFIG_XENO_OPT_WATCHDOG=y ;;
	*) unset CONFIG_XENO_OPT_WATCHDOG ;;
	esac])
AC_MSG_RESULT(${CONFIG_XENO_OPT_WATCHDOG:-no})

Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
if test x$CONFIG_XENO_OPT_DEBUG = xy; then
   CXXFLAGS="-g"
   CFLAGS="-g"
   defaultwrap=yes
else
   defaultwrap=no
fi

AC_MSG_CHECKING([for GCC tarball])

AC_ARG_WITH(gcc-tarball,
    AS_HELP_STRING([--with-gcc-tarball=<gcc-tarball>], [Host GCC tarball for MVM/GCIC]),
    [
	case "$withval" in
	"" | y | ye | yes | n | no)
	    AC_MSG_ERROR([You must supply an argument to --with-gcc-tarball])
	  ;;
	esac
	CONFIG_XENO_MVM_GCC_TARBALL="$withval"
    ])

110
if test x$CONFIG_XENO_MVM_GCC_TARBALL = x ; then
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
111 112 113
   CONFIG_XENO_MVM_GCC_TARBALL="/tmp/gcc-2.95.3.tar.bz2"
fi

114 115
if test \! -r $prefix/libexec/gcic/.gcic-installed ; then
   if test \! -r "${CONFIG_XENO_MVM_GCC_TARBALL}" ; then
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
116 117
      dnl We are going to need the source GCC tarball to build the
      dnl instrumenter and we cannot find it: this is bad news.
118
      if test x$CONFIG_XENO_MVM_GCC_TARBALL = x ; then
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
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
         AC_MSG_RESULT([unspecified (use --with-gcc-tarball to specify one)])
      else
         AC_MSG_RESULT([not found at $CONFIG_XENO_MVM_GCC_TARBALL])
      fi
      AC_MSG_ERROR([Cannot read GCC tarball])
   else
      AC_MSG_RESULT([$CONFIG_XENO_MVM_GCC_TARBALL])
   fi
else
   AC_MSG_RESULT([not needed (instrumenter already built)])
fi

MVM_GCC_TARBALL=$CONFIG_XENO_MVM_GCC_TARBALL

AC_MSG_CHECKING(Wrap Tcl-scripts in executables)
AC_ARG_ENABLE(tclwrap,
	AS_HELP_STRING([ --enable-tclwrap], [Wrap Tcl scripts in the executable files]),
	[CONFIG_XENO_MVM_TCLWRAP=$enableval],
	[CONFIG_XENO_MVM_TCLWRAP=$defaultwrap])
AC_MSG_RESULT($CONFIG_XENO_MVM_TCLWRAP)

dnl Some programs and libs.

AC_GCC_MVM_MOREFLAGS
AC_PATH_XREQUIRED()
SC_PUBLIC_TCL_HEADERS()
SC_PATH_TCLCONFIG()
SC_LOAD_TCLCONFIG()
SC_PATH_TKCONFIG()
SC_LOAD_TKCONFIG()
SC_PATH_TIX()

dnl Some additional headers.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(limits.h strings.h unistd.h malloc.h fcntl.h sys/time.h elf.h libelf.h libelf/libelf.h)

dnl Some compiler characteristics.
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_FUNC_MMAP
AC_FUNC_VFORK
AC_HEADER_TIME
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
AC_POSIX_SIGHANDLER

dnl Locate some utilities.
AC_PATH_PROG(MVM_PROG_PATCH,patch,/usr/bin/patch,/usr/local/bin:$PATH)
gccas=`$CC --print-prog-name=as`
AC_PATH_PROG(MVM_GCCAS,as,$gccas,$PATH)
gccld=`$CC --print-prog-name=ld`
AC_PATH_PROG(MVM_GCCLD,ld,$gccld,$PATH)

AC_MSG_CHECKING(for infinity)
AC_CACHE_VAL(ac_cv_func_or_macro_infinity,
[AC_TRY_LINK(
[#include <math.h>],
[double inf = infinity();],
[ac_cv_func_or_macro_infinity=yes],
[ac_cv_func_or_macro_infinity=no])])
if [[ $ac_cv_func_or_macro_infinity = yes ]]; then
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_INFINITY,1,[Kconfig])
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(for O_BINARY)
AC_CACHE_VAL(ac_cv_open_binary_mode,
[AC_TRY_COMPILE(
[#include <fcntl.h>],
[int nullfd = open("/dev/null",O_RDONLY|O_BINARY);],
[ac_cv_open_binary_mode=yes],
[ac_cv_open_binary_mode=no])])
if [[ $ac_cv_open_binary_mode = yes ]]; then
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_BINARY_OPEN,1,[Kconfig])
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(for GNU quad_t)
AC_CACHE_VAL(ac_cv_gnu_quad_t,
[AC_TRY_COMPILE(
[#include <sys/types.h>],
[quad_t q = 0;],
[ac_cv_gnu_quad_t=yes],
[ac_cv_gnu_quad_t=no])])
if [[ $ac_cv_gnu_quad_t = yes ]]; then
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_GNU_QUAD_T,1,[Kconfig])
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(for makecontext)
AC_CACHE_VAL(ac_cv_func_makecontext,
[AC_TRY_RUN([
#include <ucontext.h>
void life () {}
int main () {
 ucontext_t context;
 if (!getcontext(&context)) {
     makecontext(&context,(void (*)(void))life,0);
     return 0;
     }
 return 1;
}],
[ac_cv_func_makecontext=yes],
[ac_cv_func_makecontext=no],
[ac_cv_func_makecontext=yes])])
if [[ $ac_cv_func_makecontext = yes ]]; then
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_MAKECONTEXT,1,[Kconfig])
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(for socklen_t)
AC_CACHE_VAL(ac_cv_socklen_t,
[AC_TRY_COMPILE(
[#include <sys/types.h>
 #include <sys/socket.h>],
[socklen_t len = 0;],
[ac_cv_socklen_t=yes],
[ac_cv_socklen_t=no])])
if [[ $ac_cv_socklen_t = yes ]]; then
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_SOCKLEN_T,1,[Kconfig])
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(for glibc2 malloc)
AC_CACHE_VAL(ac_cv_glibc2_malloc,
[AC_TRY_COMPILE(
[#include <malloc.h>],
[int opt = M_MMAP_MAX;],
[ac_cv_glibc2_malloc=yes],
[ac_cv_glibc2_malloc=no])])
if [[ $ac_cv_glibc2_malloc = yes ]]; then
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_GLIBC2_MALLOC,1,[Kconfig])
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(stack direction)
AC_CACHE_VAL(ac_cv_stack_direction,
[AC_TRY_RUN([
int main () {
char c1;
char c2;
return &c1 < &c2;
}],
[ac_cv_stack_direction=downwarding],
[ac_cv_stack_direction=upwarding],
[ac_cv_stack_direction=downwarding])])
if [[ $ac_cv_stack_direction = downwarding ]]; then
  AC_MSG_RESULT(downwarding)
  AC_DEFINE(HAVE_DOWNWARDING_STACK,1,[Kconfig])
else
  AC_MSG_RESULT(upwarding)
  AC_DEFINE(HAVE_UPWARDING_STACK,1,[Kconfig])
fi

AC_CACHE_CHECK(for usleep declaration, ac_cv_header_usleep,
  [AC_EGREP_HEADER(usleep, unistd.h,
  ac_cv_header_usleep=yes, ac_cv_header_usleep=no)])
test $ac_cv_header_usleep = yes && AC_DEFINE(HAVE_USLEEP,1,[Kconfig])

294 295
test x$CONFIG_XENO_OPT_SCALABLE_SCHED = xy && AC_DEFINE(CONFIG_XENO_OPT_SCALABLE_SCHED,1,[config])

Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
296 297 298 299 300
if test x$CONFIG_XENO_OPT_DEBUG = xy; then
  AC_DEFINE(CONFIG_XENO_OPT_DEBUG,1,[config])
  AC_DEFINE(CONFIG_XENO_MVM_DEBUG,1,[config])
fi

301 302
test x$CONFIG_XENO_OPT_WATCHDOG = xy && AC_DEFINE(CONFIG_XENO_OPT_WATCHDOG,1,[config])

Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
dnl Some required routines.
AC_FUNC_ALLOCA
AC_FUNC_FNMATCH
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_TYPE_SIGNAL
AC_FUNC_STRCOLL
AC_FUNC_VFORK
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(gethostname gettimeofday mkdir putenv select socket strcspn strdup strerror strspn strstr strtod strtol strtoul select socket)

AC_CHECK_HEADER(netinet/tcp.h,
	[AC_DEFINE(HAVE_NETINET_TCP,1,[config])]
)
MVM_LDADD=
AC_CHECK_LIB(elf, elf_begin,
319
	[MVM_LDADD="$MVM_LDADD -lelf" ; AC_DEFINE(HAVE_LIBELF,1,[config])],
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
320 321 322
	AC_MSG_ERROR([Cannot find libelf (development version) on this system])
)
AC_CHECK_LIB(dl, dlopen,
323
	[MVM_LDADD="$MVM_LDADD -ldl" ; AC_DEFINE(HAVE_LIBDL,1,[config])]
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
324 325
)
AC_CHECK_LIB(nsl, gethostbyname,
326
	[MVM_LDADD="$MVM_LDADD -lnsl" ; AC_DEFINE(HAVE_LIBNSL,1,[config])]
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
327 328
)
AC_CHECK_LIB(socket, connect,
329
	[MVM_LDADD="$MVM_LDADD -lsocket" ; AC_DEFINE(HAVE_LIBSOCKET,1,[config])]
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
330
)
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
331 332 333 334
AC_CHECK_HEADER(png.h,,
	AC_MSG_ERROR([Cannot find png.h (part of libpng development version) on this system])
)
AC_CHECK_LIB(png, png_get_io_ptr, [LIBPNG_OK=1],
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
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
	AC_MSG_ERROR([Cannot find libpng (development version) on this system])
)
AC_CHECK_LIB(z, deflate, [LIBZ_OK=1],
	AC_MSG_ERROR([Cannot find libz on this system])
)

AH_BOTTOM([#ifndef _XENO_SIM_CONFIG_H
#define  _XENO_SIM_CONFIG_H 1])

AH_BOTTOM([#ifndef HAVE_INFINITY
#define infinity() (HUGE_VAL)
#endif /* !HAVE_INFINITY */])

AH_BOTTOM([#ifndef HAVE_SOCKLEN_T
typedef int socklen_t; 
#endif])

AH_BOTTOM([#ifndef HAVE_USLEEP
#ifdef __cplusplus
extern "C"
#endif
void usleep(unsigned us);
#endif])

AH_BOTTOM([#ifdef HAVE_POSIX_SIGHANDLER
typedef void (*SIGHANDLER_TYPE)(int);
#else
typedef void (*SIGHANDLER_TYPE)();
#endif])

AH_BOTTOM([#ifndef HAVE_BINARY_OPEN
#define O_BINARY 0
#endif /* !HAVE_BINARY_OPEN */])

AH_BOTTOM([#ifndef HAVE_GNU_QUAD_T
/* We absolutely need a compiler supporting the "long long" spec here */
typedef long long int gnuquad_t;
typedef unsigned long long int u_gnuquad_t;
#else
#include <sys/types.h>
typedef quad_t gnuquad_t;
typedef u_quad_t u_gnuquad_t;
#endif /* !HAVE_GNU_QUAD_T */])

AH_BOTTOM([#endif /* !_XENO_SIM_CONFIG_H */])

381 382
dnl Nucleus setup -- set reasonable values.
AC_DEFINE_UNQUOTED(CONFIG_XENO_OPT_TIMING_PERIODIC,1,[config])
Philippe Gerum's avatar
Philippe Gerum committed
383 384
AC_DEFINE_UNQUOTED(CONFIG_XENO_OPT_TIMER_HEAP,1,[config])
AC_DEFINE_UNQUOTED(CONFIG_XENO_OPT_TIMER_HEAP_CAPACITY,256,[config])
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
385
AC_DEFINE_UNQUOTED(CONFIG_XENO_OPT_SYS_HEAPSZ,128,[config])
386 387
AC_DEFINE(CONFIG_XENO_OPT_REGISTRY,1,[config])
AC_DEFINE_UNQUOTED(CONFIG_XENO_OPT_REGISTRY_NRSLOTS,1024,[config])
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
388 389 390 391 392 393 394 395 396 397 398 399 400 401

dnl Native skin options -- force all in.
AC_DEFINE(CONFIG_XENO_OPT_NATIVE_SEM,1,[config])
AC_DEFINE(CONFIG_XENO_OPT_NATIVE_EVENT,1,[config])
AC_DEFINE(CONFIG_XENO_OPT_NATIVE_MUTEX,1,[config])
AC_DEFINE(CONFIG_XENO_OPT_NATIVE_COND,1,[config])
AC_DEFINE(CONFIG_XENO_OPT_NATIVE_QUEUE,1,[config])
AC_DEFINE(CONFIG_XENO_OPT_NATIVE_HEAP,1,[config])
AC_DEFINE(CONFIG_XENO_OPT_NATIVE_ALARM,1,[config])
AC_DEFINE(CONFIG_XENO_OPT_NATIVE_MPS,1,[config])

dnl Compatibility skin options -- force all in.
AC_DEFINE(CONFIG_XENO_OPT_RTAI_SEM,1,[config])

Philippe Gerum's avatar
Philippe Gerum committed
402 403 404 405 406 407 408 409 410 411 412
dnl Periodic timing support -- default to reasonable values
AC_DEFINE(CONFIG_XENO_OPT_NATIVE_PERIOD,0,[config])
AC_DEFINE(CONFIG_XENO_OPT_POSIX_PERIOD,0,[config])
AC_DEFINE(CONFIG_XENO_OPT_RTDM_PERIOD,0,[config])
AC_DEFINE(CONFIG_XENO_OPT_PSOS_PERIOD,1000,[config])
AC_DEFINE(CONFIG_XENO_OPT_VXWORKS_PERIOD,1000,[config])
AC_DEFINE(CONFIG_XENO_OPT_VRTX_PERIOD,1000,[config])
AC_DEFINE(CONFIG_XENO_OPT_UITRON_PERIOD,1000,[config])
AC_DEFINE(CONFIG_XENO_OPT_RTAI_PERIOD,0,[config])


Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430
AC_SUBST(MVM_LDADD)
AC_SUBST(MVM_CFLAGS)
AC_SUBST(MVM_CXXFLAGS)
AC_SUBST(MVM_GCC_TARBALL)
AC_SUBST(MVM_BUILD_STRING)
AC_SUBST(MVM_HOST_STRING)

dnl
dnl Produce automake conditionals.
dnl

AM_CONDITIONAL(CONFIG_XENO_MVM_TCLWRAP,test x$tclwrap = xyes)
AM_CONDITIONAL(CONFIG_XENO_MVM_ATOMIC_CORE,test x$CONFIG_XENO_MVM_ATOMIC_CORE = xy)

dnl
dnl Build the Makefiles
dnl

431 432
base=asm-sim
AC_CONFIG_LINKS([include/asm/xenomai:../include/$base])
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
433 434 435 436 437 438 439 440 441 442

AC_CONFIG_SUBDIRS(tkimg)

AC_CONFIG_FILES([ \
     Makefile \
     vmutils/Makefile \
     vm/Makefile \
     adapter/Makefile \
     skins/Makefile \
     nucleus/Makefile \
Philippe Gerum's avatar
Philippe Gerum committed
443
     include/Makefile \
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
444 445
     skins/psos+/Makefile \
     skins/vxworks/Makefile \
446
     skins/vxworks/testsuite/Makefile \
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
447 448 449 450
     skins/vrtx/Makefile \
     skins/uitron/Makefile \
     skins/posix/Makefile \
     skins/posix/testsuite/Makefile \
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
451
     skins/posix/demos/Makefile \
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
452 453 454 455 456 457 458
     skins/native/Makefile \
     skins/rtai/Makefile \
     gcic/Makefile \
     scope/Makefile \
     ])

AC_OUTPUT()