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
|
# -*-Shell-script-*-
# ----------------------------------------
# Initialization
# ----------------------------------------
AC_PREREQ(2.50)
AC_INIT(lush, 1.0)
AC_REVISION($Id: configure.ac,v 1.50 2006/08/17 19:17:13 leonb Exp $)
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_SRCDIR(README)
AC_CONFIG_HEADER(include/lushconf.h)
AC_PREFIX_DEFAULT(/usr/local)
AC_CANONICAL_HOST
AC_ARG_WITH(extra-includes,
AC_HELP_STRING([--with-extra-includes=DIR],
[Define an additional directory for include files]),
[ if test -d "$withval" ; then
CPPFLAGS="$CPPFLAGS -I$withval"
else
AC_MSG_ERROR([Cannot stat directory $withval])
fi ] )
AC_ARG_WITH(extra-libraries,
AC_HELP_STRING([--with-extra-libraries=DIR],
[Define an additional directory for library files]),
[ if test -d "$withval" ; then
LDFLAGS="$LDFLAGS -L$withval"
else
AC_MSG_ERROR([Cannot stat directory $withval])
fi ] )
# Always look into a "gnu" directory.
curwd=`pwd`
if test -d $curwd/gnu/include ; then
CPPFLAGS="$CPPFLAGS -I$curwd/gnu/include"
fi
if test -d $curwd/gnu/lib ; then
LDFLAGS="$LDFLAGS -L$curwd/gnu/lib"
fi
# Check for fink on macs.
case "$host" in
*-darwin* | *-macos10*)
if test -d /opt/local ; then
CPPFLAGS="$CPPFLAGS -I/opt/local/include"
LDFLAGS="$LDFLAGS -L/opt/local/lib"
elif test -d /sw ; then
CPPFLAGS="$CPPFLAGS -I/sw/include"
LDFLAGS="$LDFLAGS -L/sw/lib"
fi
;;
esac
# ----------------------------------------
# Overrides
# ----------------------------------------
ac_have_mpi=no
AC_ARG_WITH(mpi,
AC_HELP_STRING([--with-mpi],
[Force compilation with MPI]),
[ if test $withval != no ; then
ac_have_mpi=yes
fi ] )
if test $ac_have_mpi = yes ; then
AC_PATH_PROG(CC, mpicc, none)
AC_PATH_PROG(CXX, mpiCC, none)
AC_PATH_PROG(F77, mpif77, none)
if test $CC = none || test $CXX = none || test $F77 = none ; then
AC_MSG_ERROR([Cannot locate MPI compiler drivers])
fi
AC_DEFINE(HAVE_MPI,1,[Define if compiling with MPI.])
fi
# ----------------------------------------
# Programs
# ----------------------------------------
AC_PROG_MAKE_SET
AC_PROG_CC
AC_CC_COMPLEX
AC_CC_OPTIMIZE
AC_SUBST(GCC)
AC_PROG_CXX
AC_PROG_F77
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_LN_S
AC_PATH_PROG(MV, mv)
AC_PATH_PROG(CP, cp)
AC_PATH_PROG(RM, rm)
AC_PATH_PROG(AR, ar)
AC_PATH_PROG(TOUCH, touch)
AC_PATH_PROG(INDENT, indent)
if test -x $INDENT ; then
AC_MSG_CHECKING([if $INDENT accepts GNU options])
if $INDENT -gnu </dev/null 2>/dev/null ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
unset INDENT
fi
fi
# ----------------------------------------
# Libraries
# ----------------------------------------
# misc
AC_CHECK_LIB(m,sqrt)
AC_CHECK_LIB(dl,dlopen)
AC_CHECK_LIB(dld,shl_load)
AC_CHECK_LIB(util,openpty)
# NSModule API
require_bfd=yes
AC_CHECK_FUNCS(NSLinkModule,[require_bfd=no])
# bfd
AC_ARG_WITH(bfd,
AC_HELP_STRING([--without-bfd],
[Compile Lush without the BFD library.]),
[require_bfd=$withval])
if test x$require_bfd = xno ; then
BFD_YES='#'
else
BFD_YES=''
has_bfd=yes
AC_CHECK_LIB(iberty, xmalloc)
if test $ac_cv_lib_iberty_xmalloc = no; then
AC_CHECK_LIB(mmalloc, mmalloc)
AC_CHECK_LIB(iberty, xcalloc)
fi
AC_CHECK_HEADER(bfd.h,,has_bfd=no)
AC_CHECK_LIB(bfd, bfd_init,,[has_bfd=no])
fi
AC_SUBST(BFD_YES)
# Check if it compiles
if test x$has_bfd = xyes ; then
n_LIBS=$LIBS
has_intl=
AC_CHECK_LIB(intl, dcgettext, [has_intl=yes],[has_intl=no])
i_LIBS=`echo $n_LIBS | sed -e 's/-liberty/& -lintl/'`
sn_LIBS=`echo $n_LIBS | sed -e 's/-lbfd\( -liberty\)*/-Wl,-Bstatic & -Wl,-Bdynamic/'`
si_LIBS=`echo $i_LIBS | sed -e 's/-lbfd\( -liberty\)*/-Wl,-Bstatic & -Wl,-Bdynamic/'`
LIBS=$sn_LIBS
AC_MSG_CHECKING([whether bfd works with -Bstatic])
AC_TRY_LINK([#include "bfd.h"],
[bfd_openr("junk1","default"); ],
[okay_bfd=yes],[okay_bfd=no]);
AC_MSG_RESULT($okay_bfd)
if test x$okay_bfd = xno ; then
if test x$has_intl = xyes ; then
LIBS=$si_LIBS
AC_MSG_CHECKING([whether bfd works with -Bstatic and -lintl])
AC_TRY_LINK([#include "bfd.h"],
[bfd_openr("junk1","default"); ],
[okay_bfd=yes],[okay_bfd=no]);
AC_MSG_RESULT($okay_bfd)
fi
if test x$okay_bfd = xno ; then
LIBS=$n_LIBS
AC_MSG_CHECKING([whether bfd works alone])
AC_TRY_LINK([#include "bfd.h"],
[bfd_openr("junk1","default"); ],
[okay_bfd=yes],[okay_bfd=no]);
AC_MSG_RESULT($okay_bfd)
if test x$okay_bfd = xno ; then
if test x$has_intl = xyes ; then
LIBS=$i_LIBS
AC_MSG_CHECKING([whether bfd works with -lintl])
AC_TRY_LINK([#include "bfd.h"],
[bfd_openr("junk1","default"); ],
[okay_bfd=yes],
[okay_bfd=no]);
AC_MSG_RESULT($okay_bfd)
fi
if test x$okay_bfd = xno ; then
LIBS=$n_LIBS
fi
fi
fi
fi
if test x$okay_bfd = xyes ; then
AC_MSG_CHECKING([whether bfd_hash_table_init wants two arguments])
AC_TRY_COMPILE([#include "bfd.h"],
[struct bfd_hash_table t; bfd_hash_table_init(&t,(void*)0);],
[bfd_hash_init_2_args=yes],
[bfd_hash_init_2_args=no])
AC_MSG_RESULT($bfd_hash_init_2_args)
if test x$bfd_hash_init_2_args = xyes ; then
AC_DEFINE(HAVE_BFD_HASH_TABLE_INIT_WANTS_2_ARGS,1,
[Define if bfd_hash_table_init() takes two arguments])
fi
fi
if test x$okay_bfd = xno ; then
has_bfd=no
fi
fi
if test x$has_bfd = xno ; then
AC_MSG_ERROR([Unable to locate BFD development files.
-------------------------------------------------------------
We were unable to locate required GNU binutils files.
- Some Linux distributions do not install these by default.
You need to install the 'libbinutils-devel' package.
- On other platforms, get GNU binutils on www.fsf.org.
You can configure Lush to run without these files by using
option "--without-bfd". The dynamic loader/linker/compiler
will not work and Lush will be seriously crippled.
-----------------------------------------------------------------])
fi
# x11
AC_PATH_XTRA
if test "${no_x-no}" != yes ; then
X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
X_YES=''
else
X_YES='#'
fi
AC_PATH_XFT
AC_SUBST(X_LIBS)
AC_SUBST(X_CFLAGS)
AC_SUBST(X_YES)
# threads
AC_PATH_PTHREAD
# readline
AC_CHECK_LIB(curses,tputs)
AC_CHECK_LIB(readline,readline)
AC_CHECK_LIB(iconv,iconv_open)
# ----------------------------------------
# Header Files
# ----------------------------------------
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(wchar.h wctype.h langinfo.h iconv.h)
AC_CHECK_HEADERS(memory.h string.h strings.h limits.h alloca.h)
AC_CHECK_HEADERS(unistd.h sys/mman.h termios.h pty.h util.h)
AC_CHECK_HEADERS(dlfcn.h dl.h ieeefp.h fpu_control.h fenv.h)
AC_CHECK_HEADERS(stropts.h sys/stropts.h sys/select.h sys/types.h sys/ttold.h)
AC_CHECK_HEADERS(sys/time.h sys/timeb.h locale.h readline/readline.h bfd.h)
AC_SYS_LARGEFILE
if test $ac_have_mpi = yes ; then
AC_CHECK_HEADERS(mpi.h)
fi
# ----------------------------------------
# Types
# ----------------------------------------
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_CHECK_TYPES(long long int)
AC_CHECK_TYPES(wchar_t,,,[#include "stddef.h"])
AC_CHECK_TYPES(wint_t,,,[#include "wchar.h"])
AC_CHECK_TYPES(mbstate_t,,,[#include "wchar.h"])
# ----------------------------------------
# Functions
# ----------------------------------------
AC_FUNC_MMAP
AC_FUNC_FORK
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(strchr memcpy sigaction sigvec strerror getcwd)
AC_CHECK_FUNCS(feenableexcept ieee_handler fpsetmask __setfpucw)
AC_CHECK_FUNCS(tanh sincos dlopen sigsetjmp waitpid openpty)
AC_CHECK_FUNCS(mprotect getpagesize gettimeofday ftime cfree)
AC_CHECK_FUNCS(gethostbyname flockfile sysconf fpathconf tcsetattr)
AC_CHECK_FUNCS(setenv putenv fseeko ftello)
AC_FUNC_MBRTOWC
AC_CHECK_FUNCS(setlocale nl_langinfo iconv)
# ----------------------------------------
# Xtra
# ----------------------------------------
LDCC=${CC}
SOEXT=so
CC_EXP_FLAG=
CC_PIC_FLAG=
MAKESO=
if test x${GCC} = xyes ; then
test x${GXX} = xyes && LDCC=${CXX}
CC_PIC_FLAG='-fPIC'
MAKESO="$LDCC -shared -o"
fi
# Tested?
case "$host" in
*-linux*)
CC_EXP_FLAG='-Wl,-export-dynamic'
;;
*-darwin* | *-macos10* | *-rhapsody*)
SOEXT=dylib
MAKESO="$LDCC -dylib -o"
;;
*-freebsd2*)
CC_PIC_FLAG='-fPIC'
MAKESO="$LDCC -Wl,-Bshareable"
test -r /usr/lib/c++rt0.o && MAKESO="$MAKESO,/usr/lib/c++rt0.o"
MAKESO="$MAKESO -o"
;;
*-hpux-*)
SOEXT=sl
test x$GCC != xyes && CC_PIC_FLAG='+Z'
test x$GCC != xyes && CC_EXP_FLAG='-Wl,-E'
test x$GCC != xyes && MAKESO='ld -b +s +b -E -o'
;;
*-irix*)
test x$GCC != xyes && CC_PIC_FLAG='-KPIC'
;;
*-osf*)
text x$GCC = yes && MAKESO="$LDCC -shared -Wl,-expect_unresolved -o"
test x$GCC != xyes && MAKESO="$LDCC -Wl,-shared,-expect_unresolved -o"
;;
*-solaris*|*-sunos5*)
test x$GCC != xyes && CC_PIC_FLAG='-KPIC'
test x$GCC != xyes && MAKESO='$LDCC -Wl,-G -o'
;;
esac
AC_SUBST(LDCC)
AC_SUBST(SOEXT)
AC_SUBST(CC_EXP_FLAG)
AC_SUBST(CC_PIC_FLAG)
AC_SUBST(MAKESO)
UNIX_YES=''
WIN32_YES='#'
AC_SUBST(UNIX_YES)
AC_SUBST(WIN32_YES)
AC_DEFINE_UNQUOTED(EXT_DLL, ".$SOEXT", [Extension for shared libraries])
AC_DEFINE_UNQUOTED(EXT_OBJ, ".$OBJEXT", [Extension for object files])
# ----------------------------------------
# Output
# ----------------------------------------
AC_DEFINE_INSTALL_PATHS
AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(src/Makefile)
AC_CONFIG_FILES(include/lushmake.h)
AC_OUTPUT
# ----------------------------------------
# CONFIG template
# ----------------------------------------
AH_TOP([
#ifndef LUSHCONF_H
#define LUSHCONF_H
/* lushconf.h: begin */
])
AH_BOTTOM([
/* lushconf.h: custom */
# ifndef UNIX
# define UNIX
# endif
# ifndef _GNU_SOURCE
# define _GNU_SOURCE
# endif
/* lushconf.h: end */
#endif
])
|