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
|
dnl# -*- sh -*-
dnl# Process this file with autoconf to produce a configure script.
dnl#
dnl#Copyright (c) 1998 Michal Vitecek <fuf@fuf.sh.cvut.cz>
dnl#Copyright (c) 2001,1998 Sasha Vasko <sasha at aftercode.net>
dnl#Copyright (c) 1998 Juergen Sawinski <Juergen.Sawinski@urz.uni-heidelberg.de>
dnl#Copyright (c) 1997 1998 Guylhem AZNAR <guylhem@oeil.qc.ca>
AC_INIT(libAfterBase,1.14,as-bugs@afterstep.org,libAfterBase.tar)
version=$PACKAGE_VERSION
version_major="1"
lib_name="LIBAFTERBASE"
lib_file_name=$PACKAGE_NAME
AC_CONFIG_HEADER(config.h:config.h.in)
dnl# Setup command-line options
dnl# we need the standard prefixes defined early
test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix="$prefix"
eval "mandir=$mandir"
eval "libdir=$libdir"
eval "includedir=$includedir"
dnl# compile-time switches
AC_ARG_ENABLE(i18n, [ --enable-i18n support I18N [no] ],enable_i18n=$enableval,enable_i18n="no")
AC_ARG_ENABLE(xlocale, [ --enable-xlocale using X_LOCALE [no] ],enable_xlocale=$enableval,enable_xlocale="no")
AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ],with_locale=$withval,with_locale="")
AC_ARG_ENABLE(staticlibs, [ --enable-staticlibs enable linking to libAfterBase statically [yes] ],enable_staticlibs=$enableval,enable_staticlibs="yes")
AC_ARG_ENABLE(sharedlibs, [ --enable-sharedlibs enable linking to libAfterBase dynamically [no] ],enable_sharedlibs=$enableval,enable_sharedlibs="no")
AC_ARG_ENABLE(gdb, [ --enable-gdb add gdb symbols (-g) (for debugging) [no] ],enable_gdb=$enableval,enable_gdb="no")
AC_ARG_ENABLE(warn, [ --enable-warn turn on more compiler warnings (for debugging) [no] ],enable_warn=$enableval,enable_warn="no")
AC_ARG_ENABLE(gprof, [ --enable-gprof add gprof symbols (-pg) (for debugging) [no] ],enable_gprof=$enableval,enable_gprof="no")
AC_ARG_ENABLE(audit, [ --enable-audit memory usage audit (for debugging) [no] ],enable_audit=$enableval,enable_audit="no")
AC_ARG_ENABLE(trace, [ --enable-trace some function calls tracing (see include/trace.h) (for debugging) [no] ],enable_trace=$enableval,enable_trace="no")
AC_ARG_ENABLE(trace-x, [ --enable-trace-x trace X calls (runtime option) (for debugging) [no] ],enable_trace_x=$enableval,enable_trace_x="no")
dnl# Check for compiler tools
AC_PROG_CC
AC_PROG_LN_S
dnl# AC_SUBST(CC)
dnl# AC_SUBST(GCC)
AC_SUBST(CFLAGS)
AC_CYGWIN
if test "x$FROM_AFTERSTEP_CONFIGURE" = "xyes"; then
dnl# AfterSTep already checked everything for us
dnl# AC_PROG_INSTALL
AC_SUBST(INSTALL)
AC_SUBST(INSTALL_PROGRAM)
AC_SUBST(INSTALL_DATA)
AC_SUBST(INSTALL_LIB)
AC_SUBST(RANLIB)
AC_SUBST(RM)
AC_SUBST(MV)
AC_SUBST(CP)
AC_SUBST(MKDIR)
AC_SUBST(PERL)
AC_SUBST(FIND)
AC_SUBST(XARGS)
AC_SUBST(LDCONFIG)
AC_SUBST(LEX)
AC_SUBST(LEXLIB)
AC_SUBST(YACC)
#debian# if test "x$GCC" = "xyes" -a "x$CYGWIN" = "xno" ; then
#debian# if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
#debian# CFLAGS="$CFLAGS -fPIC"
#debian# fi
#debian# LDFLAGS="$LDFLAGS -rdynamic"
#debian# fi
/bin/true
else
dnl# we are alone - have to do all the checks ourselves :
dnl# Add -fPIC for IA64 compilation
if test "x$GCC" = "xyes" -a "x$CYGWIN" = "xno" ; then
if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
CFLAGS="$CFLAGS -fPIC"
fi
LDFLAGS="$LDFLAGS -rdynamic"
fi
dnl# Add -g
if test "x$enable_gdb" = "xyes"; then
if ! test -n "`echo $CFLAGS' ' | grep '\-g ' 2> /dev/null`" ; then
CFLAGS="$CFLAGS -g -w"
fi
else
DIRTY_CFLAGS="$CFLAGS"
CFLAGS="-DNO_DEBUG_OUTPUT"
for f in $DIRTY_CFLAGS; do
if test "x$f" != "x-g"; then
CFLAGS="$CFLAGS $f"
fi
done
fi
dnl# Add -pg
if test "x$enable_gprof" = "xyes"; then
CFLAGS="$CFLAGS -pg"
LDFLAGS="$LDFLAGS -pg"
fi
dnl# Add lots more warnings
if test "x$enable_warn" = "xyes"; then
CFLAGS="$CFLAGS -Wall -Wuninitialized -Wwrite-strings -Wcast-qual -Wbad-function-cast -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wconversion -Wcomment -Wcast-align -Winline -Wshadow -Wredundant-decls"
fi
AC_PROG_INSTALL
dnl# if the path to the install program is relative, make it absolute
currdir=`pwd`
INSTALL=`echo $INSTALL|sed -e "s@\^\.\.@${currdir}@" -e "s@^autoconf@${currdir}/autoconf@"`
INSTALL_PROGRAM=`echo $INSTALL_PROGRAM|sed -e "s@\^\.\.@${currdir}@" -e "s@^autoconf@${currdir}/autoconf@"`
INSTALL_DATA=`echo $INSTALL_DATA|sed -e "s@\^\.\.@${currdir}@" -e "s@^autoconf@${currdir}/autoconf@"`
INSTALL_LIB=`echo $INSTALL_LIB|sed -e "s@\^\.\.@${currdir}@" -e "s@^autoconf@${currdir}/autoconf@"`
AC_PROG_RANLIB
AC_PATH_PROG(RM, rm, rm)
AC_PATH_PROG(MV, mv, mv)
AC_PATH_PROG(CP, cp, cp)
AC_PATH_PROG(MKDIR, mkdir, mkdir)
AC_PATH_PROG(PERL, perl, perl)
AC_PATH_PROG(FIND, find, find)
AC_PATH_PROG(XARGS, xargs, xargs)
AC_PATH_PROG(LDCONFIG, ldconfig, ldconfig, $PATH:/sbin:/usr/local/sbin)
fi
if test "x$enable_gdb" = "xno"; then
DIRTY_CFLAGS="$CFLAGS"
CFLAGS="-O3"
for f in $DIRTY_CFLAGS; do
if test "x$f" != "x-O2" -a "x$f" != "x-O3"; then
CFLAGS="$CFLAGS $f"
fi
done
fi
dnl# some standard checks :
dnl# let's check for endiannes of our box
AC_C_BIGENDIAN
AC_C_INLINE
dnl# Check for X :
dnl# check for X, if top level configure script did not do that yet :
if test "x$PATH_XTRA_CHECKED" != "xyes"; then
AC_PATH_XTRA
else
if test "x$have_x" != "xyes"; then
AC_DEFINE(X_DISPLAY_MISSING,1,"No X Window System libraries available")
fi
fi
user_ldflags=$LDFLAGS
if test "x$have_x" = "xyes"; then
x_libs="$X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS"
if test "x$user_ldflags" = "x"; then
full_x_libs=$x_libs
else
full_x_libs="$user_ldflags $x_libs"
fi
AC_CHECK_LIB(X11, XOpenDisplay, [x_libs="-lX11 $x_libs"],,$full_x_libs)
fi
dnl# Check for headers
AC_HEADER_DIRENT
AC_HEADER_TIME
AC_CHECK_HEADERS(sys/wait.h sys/dirent.h sys/time.h link.h execinfo.h malloc.h stdlib.h)
AC_CHECK_HEADERS(elf.h,[AC_CHECK_DECLS([ElfW],,,[#include <link.h>])
AC_CHECK_MEMBERS([Elf32_Dyn.d_tag, Elf64_Dyn.d_tag],,,[#include <elf.h>])
AC_CHECK_TYPES([Elf64_Addr, Elf32_Addr],,,[#include <elf.h>])])
AC_CHECK_LIB([execinfo], [backtrace], [LIBS="$LIBS -lexecinfo"; lib_execinfo="-lexecinfo"])
dnl# this is needed for self diagnostic code :
AC_CHECK_FUNCS(backtrace_symbols_fd backtrace_symbols backtrace)
AC_CACHE_CHECK(for struct sigcontext, as_cv_struct_sigcontext,
[AC_TRY_COMPILE([#include <signal.h>
#include <asm/sigcontext.h>],
[int main(){struct sigcontext sc; return (int)≻}],
as_cv_struct_sigcontext=yes, as_cv_struct_sigcontext=no)])
if test "$as_cv_struct_sigcontext" = yes; then
AC_DEFINE(HAVE_SIGCONTEXT,1,struct sigcontext is available)
fi
dnl# Checks for functions
AC_CHECK_FUNCS(uname gethostname)
if test "x$enable_staticlibs" = "xyes"; then
LIBPROG='$(LIB_STATIC)'
LIBINSTALL="install.static"
LIBUNINSTALL="uninstall.static"
else
enable_sharedlibs="yes"
fi
if test "x$enable_sharedlibs" = "xyes"; then
if test "x$CYGWIN" = "xyes" ; then
tmp='$(LIB_SHARED_CYG)'
tmp2='install.cyg'
else
tmp='$(LIB_SHARED)'
tmp2='install.dyn'
fi
LIBPROG="$LIBPROG $tmp"
LIBINSTALL="$LIBINSTALL $tmp2"
LIBUNINSTALL="uninstall.static un$tmp2"
fi
dnl# define X_LOCALE. need Linux, NetBSD and etc.
if test "x$enable_xlocale" = "xyes"; then
DEFINE_XLOCALE="-DX_LOCALE"
fi
dnl# Check for safe min/max - there still are some retarded compilers out there :
AC_MSG_CHECKING(if we can use sign safe min/max macros)
AC_TRY_COMPILE([#define MIN(x,y) \
({ const typeof(x) _x = (x); const typeof(y) _y = (y); (void) (&_x == &_y); \
_x < _y ? _x : _y; })],
[char array[MIN(0, 1) == 0 ? 1 : -1];],
[AC_DEFINE(USE_SAFE_MINMAX,1,will use type-safe min/max macros) AC_MSG_RESULT(yes)],AC_MSG_RESULT(no))
dnl# Translate enable_* from "yes/no" to "1/0" (for configure.h)
if test "x$enable_i18n" = "xyes"; then AC_DEFINE(I18N,1,Localisation support) fi
if test "x$enable_audit" = "xyes"; then AC_DEFINE(DEBUG_ALLOCS,1,All memory allocations are traced) fi
if test "x$enable_trace" = "xyes"; then AC_DEFINE(DEBUG_TRACE,1,Select few function calls are traced) fi
if test "x$enable_trace_x" = "xyes"; then AC_DEFINE(DEBUG_TRACE_X,1,Several Xlib calls are traced) fi
dnl# Variable strings declaration
AC_SUBST(version)
AC_SUBST(version_major)
AC_SUBST(lib_name)
AC_SUBST(lib_file_name)
AC_SUBST(with_locale)
AC_SUBST(user_ldflags)
AC_SUBST(x_libs)
AC_SUBST(lib_execinfo)
AC_SUBST(X_CFLAGS)
AC_SUBST(LIBPROG)
AC_SUBST(LIBINSTALL)
AC_SUBST(LIBUNINSTALL)
AC_SUBST(DEFINE_XLOCALE)
AC_SUBST(PERL)
if test "x$enable_audit" = "xyes"; then
DEBUG_ALLOCS_DEF="define"
DEBUG_ALLOCS_VAL=1
else
DEBUG_ALLOCS_DEF="undef"
DEBUG_ALLOCS_VAL=
fi
if test "x$enable_trace" = "xyes"; then
DEBUG_TRACE_DEF="define"
DEBUG_TRACE_VAL=1
else
DEBUG_TRACE_DEF="undef"
DEBUG_TRACE_VAL=
fi
if test "x$enable_trace_x" = "xyes"; then
DEBUG_TRACE_X_DEF="define"
DEBUG_TRACE_X_VAL=1
else
DEBUG_TRACE_X_DEF="undef"
DEBUG_TRACE_X_VAL=
fi
if test "x$have_x" = "xyes"; then
X_DISPLAY_DEF="define"
X_DISPLAY_VAL=1
else
X_DISPLAY_DEF="undef"
X_DISPLAY_VAL=
fi
AC_SUBST(DEBUG_ALLOCS_DEF)
AC_SUBST(DEBUG_ALLOCS_VAL)
AC_SUBST(DEBUG_TRACE_DEF)
AC_SUBST(DEBUG_TRACE_VAL)
AC_SUBST(DEBUG_TRACE_X_DEF)
AC_SUBST(DEBUG_TRACE_X_VAL)
AC_SUBST(X_DISPLAY_DEF)
AC_SUBST(X_DISPLAY_VAL)
dnl# Common parts of the Makefile
AC_OUTPUT(afterbase_config.h Makefile)
|