| 1 |
# -*- mode: m4; -*- |
|---|
| 2 |
# -*- Autoconf -*- |
|---|
| 3 |
# Process this file with autoconf to produce a configure script. |
|---|
| 4 |
# $Id$ |
|---|
| 5 |
|
|---|
| 6 |
AC_PREREQ(2.59) |
|---|
| 7 |
AC_INIT([libemu], [0.2.0], [nepenthesdev@gmail.com]) |
|---|
| 8 |
AM_INIT_AUTOMAKE([libemu], [0.2.0]) |
|---|
| 9 |
AC_REVISION([$Id$]) |
|---|
| 10 |
|
|---|
| 11 |
AC_PREFIX_DEFAULT(/opt/libemu) |
|---|
| 12 |
AC_CONFIG_SRCDIR([include/emu/emu.h]) |
|---|
| 13 |
AM_CONFIG_HEADER([config.h]) |
|---|
| 14 |
# AM_MAINTAINER_MODE |
|---|
| 15 |
|
|---|
| 16 |
AC_CANONICAL_HOST |
|---|
| 17 |
AC_C_CONST |
|---|
| 18 |
AC_C_BIGENDIAN |
|---|
| 19 |
|
|---|
| 20 |
dnl Check for some target-specific stuff |
|---|
| 21 |
case "$host" in |
|---|
| 22 |
*-*-freebsd*) |
|---|
| 23 |
CPPFLAGS="$CPPFLAGS -I/usr/local/include -I/usr/src/contrib/file/" |
|---|
| 24 |
LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib" |
|---|
| 25 |
;; |
|---|
| 26 |
*-*-linux*) |
|---|
| 27 |
CPPFLAGS="$CPPFLAGS -D _GNU_SOURCE -I/usr/local/include" |
|---|
| 28 |
LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib" |
|---|
| 29 |
;; |
|---|
| 30 |
*-*-darwin*) |
|---|
| 31 |
CPPFLAGS="$CPPFLAGS -I/opt/local/include" |
|---|
| 32 |
LDFLAGS="$LDFLAGS -L/opt/local/lib" |
|---|
| 33 |
if test "$GCC" = "yes"; then |
|---|
| 34 |
CFLAGS="$CFLAGS -no-cpp-precomp" |
|---|
| 35 |
fi |
|---|
| 36 |
;; |
|---|
| 37 |
esac |
|---|
| 38 |
|
|---|
| 39 |
# Checks for programs. |
|---|
| 40 |
AC_PROG_CC |
|---|
| 41 |
AC_PROG_MAKE_SET |
|---|
| 42 |
AC_PROG_LIBTOOL |
|---|
| 43 |
|
|---|
| 44 |
AC_CHECK_HEADERS([stdint.h stdlib.h string.h strings.h unistd.h]) |
|---|
| 45 |
|
|---|
| 46 |
dnl We ought not to have to worry about getopt.h, getopt{,1}.c, |
|---|
| 47 |
dnl since they can always be unconditionally compiled and linked. See |
|---|
| 48 |
dnl http://mail.gnu.org/archive/html/autoconf/2000-12/msg00049.html |
|---|
| 49 |
dnl and surrounding thread for discussion. However that doesn't |
|---|
| 50 |
dnl appear to work in fact, and the function in getopt_long.c has |
|---|
| 51 |
dnl different magic to avoid getting horribly tangled up. |
|---|
| 52 |
AC_CHECK_FUNCS(getopt) |
|---|
| 53 |
AC_CHECK_DECLS([getopt,getsubopt,getopt_long,setenv,putenv]) |
|---|
| 54 |
AC_REPLACE_FUNCS(getopt_long getsubopt) |
|---|
| 55 |
|
|---|
| 56 |
dnl getopt_long.c uses (and provides a replacement for) |
|---|
| 57 |
dnl this glibc utility function |
|---|
| 58 |
AC_CHECK_FUNCS(__strchrnul) |
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
# Checks for typedefs, structures, and compiler characteristics. |
|---|
| 62 |
AC_C_INLINE |
|---|
| 63 |
AC_TYPE_UID_T |
|---|
| 64 |
AC_STRUCT_TM |
|---|
| 65 |
AC_TYPE_SIZE_T |
|---|
| 66 |
AC_TYPE_SIGNAL |
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
AC_CHECK_SIZEOF(long) |
|---|
| 70 |
AC_CHECK_SIZEOF(off_t) |
|---|
| 71 |
|
|---|
| 72 |
# Checks for library functions. |
|---|
| 73 |
AC_FUNC_ERROR_AT_LINE |
|---|
| 74 |
AC_TYPE_SIGNAL |
|---|
| 75 |
AC_CHECK_FUNCS([strndup inet_ntoa memmove memset strdup strerror]) |
|---|
| 76 |
|
|---|
| 77 |
# library soname |
|---|
| 78 |
# check http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 |
|---|
| 79 |
libemu_current=2 |
|---|
| 80 |
libemu_revision=0 |
|---|
| 81 |
libemu_age=0 |
|---|
| 82 |
libemu_soname=$libemu_current:$libemu_revision:$libemu_age |
|---|
| 83 |
AC_SUBST(libemu_soname) |
|---|
| 84 |
|
|---|
| 85 |
AM_PROG_CC_C_O |
|---|
| 86 |
|
|---|
| 87 |
dnl ************************************************** |
|---|
| 88 |
dnl * large filesystem Support * |
|---|
| 89 |
dnl ************************************************** |
|---|
| 90 |
|
|---|
| 91 |
AC_MSG_CHECKING(for Large File System support) |
|---|
| 92 |
AC_ARG_ENABLE(lfs, |
|---|
| 93 |
AC_HELP_STRING([--enable-lfs],[Turn on Large File System (default)]), |
|---|
| 94 |
[case "$host" in |
|---|
| 95 |
*-*-linux*) |
|---|
| 96 |
case "${enableval}" in |
|---|
| 97 |
yes) CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES" ;; |
|---|
| 98 |
no) ;; |
|---|
| 99 |
*) AC_MSG_ERROR(bad value ${enableval} for --enable-lfs) ;; |
|---|
| 100 |
esac |
|---|
| 101 |
;; |
|---|
| 102 |
esac],[ |
|---|
| 103 |
CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES" |
|---|
| 104 |
enable_lfs=yes] |
|---|
| 105 |
,enable_lfs=no,) |
|---|
| 106 |
AC_MSG_RESULT($enableval) |
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
dnl ************************************************** |
|---|
| 110 |
dnl * debug code & debug messages * |
|---|
| 111 |
dnl ************************************************** |
|---|
| 112 |
|
|---|
| 113 |
AC_MSG_CHECKING(whether debug code generation should be enabled) |
|---|
| 114 |
AC_ARG_ENABLE([debug], |
|---|
| 115 |
[AS_HELP_STRING(--enable-debug, enable debug code generation [[default=yes]])], |
|---|
| 116 |
[enable_debug=${enableval}], [enable_debug="yes"]) |
|---|
| 117 |
if test x"$enable_debug" = "xyes"; then |
|---|
| 118 |
AC_DEFINE([DEBUG], 1, [enable debug code generation]) |
|---|
| 119 |
fi |
|---|
| 120 |
AC_MSG_RESULT($enable_debug) |
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 |
|
|---|
| 124 |
#dnl ************************************************** |
|---|
| 125 |
#dnl * interactive hooks * |
|---|
| 126 |
#dnl ************************************************** |
|---|
| 127 |
# |
|---|
| 128 |
#AC_MSG_CHECKING(if hooks should be interactive) |
|---|
| 129 |
#AC_ARG_ENABLE([interactive-hooks], |
|---|
| 130 |
# [AS_HELP_STRING(--enable-interactive-hooks, enable interactive hooks (dangerous!)[[default=no]])], |
|---|
| 131 |
# [enable_interactive_hooks=${enableval}], [enable_interactive_hooks="yes"]) |
|---|
| 132 |
#if test x"$enable_interactive_hooks" = "xyes"; then |
|---|
| 133 |
# AC_DEFINE([HAVE_INTERACTIVE_HOOKS], 1, [enable interactive hooks]) |
|---|
| 134 |
#fi |
|---|
| 135 |
#AC_MSG_RESULT($enable_interactive_hooks) |
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
dnl ************************************************** |
|---|
| 139 |
dnl * python bindings * |
|---|
| 140 |
dnl ************************************************** |
|---|
| 141 |
|
|---|
| 142 |
AC_ARG_ENABLE([python-bindings], |
|---|
| 143 |
[ --enable-python-bindings Compile bindings for Python], |
|---|
| 144 |
[case "${enableval}" in |
|---|
| 145 |
yes) enable_python=true ;; |
|---|
| 146 |
no) enable_python=false ;; |
|---|
| 147 |
*) AC_MSG_ERROR([bad value ${enableval} for --enable-bython-bindings]) ;; |
|---|
| 148 |
esac], |
|---|
| 149 |
[enable_python=false]) |
|---|
| 150 |
|
|---|
| 151 |
AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS], [test x$enable_python = xtrue]) |
|---|
| 152 |
|
|---|
| 153 |
dnl ************************************************** |
|---|
| 154 |
dnl * libcargos * |
|---|
| 155 |
dnl ************************************************** |
|---|
| 156 |
|
|---|
| 157 |
|
|---|
| 158 |
AC_SUBST([LIB_CARGOS]) |
|---|
| 159 |
AC_SUBST([LIB_CARGOS_LIBDIR]) |
|---|
| 160 |
AC_SUBST([LIB_CARGOS_INCDIR]) |
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
enable_cargos="yes" |
|---|
| 164 |
|
|---|
| 165 |
AC_ARG_ENABLE(cargos, [ --enable-cargos enable support for libcargos], |
|---|
| 166 |
[enable_cargos="$enableval"],[enable_cargos="yes"]) |
|---|
| 167 |
|
|---|
| 168 |
AC_ARG_WITH(cargos-include, |
|---|
| 169 |
[ --with-cargos-include=DIR libcargos include dir], |
|---|
| 170 |
[cargos_inc="$withval"],[cargos_inc=no]) |
|---|
| 171 |
AC_ARG_WITH(cargos-lib, |
|---|
| 172 |
[ --with-cargos-lib=DIR libcargos library dir], |
|---|
| 173 |
[cargos_lib="$withval"],[cargos_lib=no]) |
|---|
| 174 |
|
|---|
| 175 |
|
|---|
| 176 |
if test x$enable_cargos = "xyes" ; then |
|---|
| 177 |
OLD_CPPFLAGS=${CPPFLAGS}; |
|---|
| 178 |
if test x$cargos_inc != "xno"; then |
|---|
| 179 |
CPPFLAGS="${CPPFLAGS} -I${cargos_inc}" |
|---|
| 180 |
fi |
|---|
| 181 |
|
|---|
| 182 |
AC_CHECK_HEADER(cargos-lib.h,[enable_cargos=yes],[enable_cargos=no]) |
|---|
| 183 |
|
|---|
| 184 |
if test x$enable_cargos = "xyes" ; then |
|---|
| 185 |
OLD_LDFLAGS=${LDFLAGS} |
|---|
| 186 |
if test x$cargos_lib != "xno"; then |
|---|
| 187 |
LDFLAGS="${LDFLAGS} -L${cargos_lib}" |
|---|
| 188 |
fi |
|---|
| 189 |
|
|---|
| 190 |
AC_CHECK_LIB([cargos],[cargos_lib_create],enable_cargos="yes", enable_cargos="no") |
|---|
| 191 |
|
|---|
| 192 |
if test x$enable_cargos = "xyes" ; then |
|---|
| 193 |
LIB_CARGOS="-lcargos" |
|---|
| 194 |
LIB_CARGOS_LIBDIR="-L$cargos_lib" |
|---|
| 195 |
LIB_CARGOS_INCDIR="-I$cargos_inc" |
|---|
| 196 |
AC_DEFINE([HAVE_LIBCARGOS], [1], [Define to 1 to compile with cargos support]) |
|---|
| 197 |
fi |
|---|
| 198 |
fi |
|---|
| 199 |
CPPFLAGS=${OLD_CPPFLAGS} |
|---|
| 200 |
LDFLAGS=${OLD_LDFLAGS} |
|---|
| 201 |
fi |
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 |
AC_DEFUN([AC_DEFINE_DIR], [ |
|---|
| 205 |
prefix_NONE= |
|---|
| 206 |
exec_prefix_NONE= |
|---|
| 207 |
test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix |
|---|
| 208 |
test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix |
|---|
| 209 |
dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn |
|---|
| 210 |
dnl refers to ${prefix}. Thus we have to use `eval' twice. |
|---|
| 211 |
eval ac_define_dir="\"[$]$2\"" |
|---|
| 212 |
eval ac_define_dir="\"$ac_define_dir\"" |
|---|
| 213 |
AC_SUBST($1, "$ac_define_dir") |
|---|
| 214 |
AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3]) |
|---|
| 215 |
test "$prefix_NONE" && prefix=NONE |
|---|
| 216 |
test "$exec_prefix_NONE" && exec_prefix=NONE |
|---|
| 217 |
]) |
|---|
| 218 |
|
|---|
| 219 |
AC_DEFINE_DIR(PREFIX, prefix, [default working directory]) |
|---|
| 220 |
AC_DEFINE_DIR(LOCALESTATEDIR, localstatedir, [where to put logs etc]) |
|---|
| 221 |
AC_DEFINE_DIR(LIBDIR, libdir, [where to look for plugins]) |
|---|
| 222 |
AC_DEFINE_DIR(SYSCONFDIR, [sysconfdir], [System configuration dir]) |
|---|
| 223 |
AC_DEFINE_DIR(DATADIR, [datadir], [The directory for installing idiosyncratic read-only architecture-independent data.]) |
|---|
| 224 |
AC_DEFINE_DIR(DATAROOTDIR, [datarootdir], [The root of the directory tree for read-only architecture-independent data files.]) |
|---|
| 225 |
|
|---|
| 226 |
emu_data_dir=$datadir/emu |
|---|
| 227 |
|
|---|
| 228 |
AC_SUBST(emu_data_dir) |
|---|
| 229 |
|
|---|
| 230 |
AC_CONFIG_FILES([Makefile |
|---|
| 231 |
src/Makefile |
|---|
| 232 |
src/functions/Makefile |
|---|
| 233 |
include/Makefile |
|---|
| 234 |
include/emu/Makefile |
|---|
| 235 |
include/emu/environment/Makefile |
|---|
| 236 |
include/emu/environment/win32/Makefile |
|---|
| 237 |
include/emu/environment/linux/Makefile |
|---|
| 238 |
testsuite/Makefile |
|---|
| 239 |
doc/Makefile |
|---|
| 240 |
libemu.pc |
|---|
| 241 |
bindings/Makefile |
|---|
| 242 |
bindings/python/Makefile |
|---|
| 243 |
bindings/python/setup.py |
|---|
| 244 |
tools/Makefile |
|---|
| 245 |
tools/sctest/Makefile]) |
|---|
| 246 |
|
|---|
| 247 |
|
|---|
| 248 |
AC_OUTPUT |
|---|
| 249 |
|
|---|
| 250 |
echo |
|---|
| 251 |
echo "*** libemu configuration ***" |
|---|
| 252 |
echo "" |
|---|
| 253 |
echo "debug : $enable_debug" |
|---|
| 254 |
echo "" |
|---|
| 255 |
echo "bindings" |
|---|
| 256 |
echo " - python : $enable_python" |
|---|
| 257 |
echo "" |
|---|
| 258 |
echo "support" |
|---|
| 259 |
echo " - cargos : $enable_cargos" |
|---|
| 260 |
|
|---|