dnl Process this file with autoconf to produce a configure script. AC_INIT(src/main.c) AC_CONFIG_HEADER(src/config.h) AC_CANONICAL_HOST dnl dnl set up CFLAGS dnl CFLAGS="${CFLAGS} -Wall" dnl LDFLAGS="${LDFLAGS}" dnl dnl check for programs dnl AC_PROG_INSTALL AC_PROG_YACC AC_PROG_CC AC_PROG_LEX AC_PROG_MAKE_SET dnl dnl some systems have dlopen in -ldl dnl AC_CHECK_FUNC(dlopen,, AC_CHECK_LIB(dl,dlopen,[DL_LIB="-ldl"], AC_MSG_ERROR([dlopen wasn't found]))) LIBS="${LIBS} ${DL_LIB}" dnl dnl some $host based configuration dnl EXPORT_FLAG="" case "$host_os" in freebsd*|linux*|netbsd*) EXPORT_FLAG="-export-dynamic" ;; esac AC_SUBST(EXPORT_FLAG) SHARED_FLAG="-shared" case "$host_os" in solaris*) SHARED_FLAG="-Wl,-G" ;; openbsd*) SHARED_FLAG="-shared -fpic" ;; esac AC_SUBST(SHARED_FLAG) dnl dnl On a few systems (OpenBSD for one) dlsym needs an underscore dnl before the function name. dnl AC_CACHE_CHECK(for underscore prefix on symbols, golem_cv_dlsym_underscore_prefix, [echo failed > conftestval && cat > conftest.c << EOF void hobo() {} EOF AC_TRY_COMMAND($CC $SHARED_FLAG -o conftest.so conftest.c 1>&AC_FD_CC) && AC_TRY_RUN([ #include #include int main() { FILE *fp = fopen("./conftestval", "w"); void *hnd, *sym; if (!fp) exit(1); hnd = dlopen("./conftest.so", RTLD_LAZY); if (!hnd) exit(1); sym = dlsym(hnd, "hobo"); if (!sym) { if ((sym = dlsym(hnd, "_hobo")) == NULL) exit(1); fprintf(fp, "yes"); } else fprintf(fp, "no"); exit(0); } ], [golem_cv_dlsym_underscore_prefix=`cat conftestval`], [AC_MSG_ERROR([dlsym doesn't work with or without underscore prefix])], golem_cv_dlsym_underscore_prefix=no) rm -f conftest.c conftest.so conftestval ]) if test $golem_cv_dlsym_underscore_prefix = yes ; then AC_DEFINE_UNQUOTED(SYM_PREFIX, "_") else AC_DEFINE_UNQUOTED(SYM_PREFIX, "") fi dnl dnl get X libs and includes dnl AC_PATH_XTRA dnl dnl header stuff dnl AC_HEADER_STDC AC_CHECK_HEADERS(paths.h) AC_CHECK_HEADERS(err.h) dnl dnl signal return types dnl AC_TYPE_SIGNAL dnl dnl bsd-style u_ unsigned shorthands dnl AC_CHECK_TYPE(u_long, unsigned long) AC_CHECK_TYPE(u_int, unsigned int) AC_CHECK_TYPE(u_short, unsigned short) AC_CHECK_TYPE(u_char, unsigned char) dnl dnl set up a build information define dnl build_information="`whoami`@`uname -n` -- `date`" AC_DEFINE_UNQUOTED(BUILD_INFO, "${build_information}") dnl dnl can be compiled with dmalloc for malloc debugging dnl AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc compile with libdmalloc, a malloc debugger. http://dmalloc.com ], [if test x"$enableval" = x"yes" ; then AC_CHECK_LIB(dmalloc, malloc, [DMALLOC_LIB="-ldmalloc"], AC_MSG_ERROR([-ldmalloc not found: can't use dmalloc])) LIBS="${LIBS} ${DMALLOC_LIB}" AC_DEFINE(USE_DMALLOC) fi]) dnl dnl optional Xinerama support dnl AC_ARG_ENABLE(xinerama, [ --enable-xinerama enable Xinerama extension support ], [if test x"$enableval" = x"yes" ; then X_LIBS="${X_LIBS} -lXinerama" AC_DEFINE(USE_XINERAMA) fi]) dnl dnl optionally build a sound effects plugin; this requires EsounD dnl so it isn't built by default dnl BUILD_SOUND_PLUGIN="" AC_ARG_ENABLE(sound, [ --enable-sound build sound plugin (requires EsounD) ], [if test x"$enableval" = x"yes" ; then BUILD_SOUND_PLUGIN="sound" fi]) AC_SUBST(BUILD_SOUND_PLUGIN) dnl dnl can be configured not to build plugins dnl BUILD_PLUGINS="plugins" INSTALL_PLUGINS="install-plugins" AC_ARG_ENABLE(plugins, [ --disable-plugins disable compilation of golem plugins ], [if test x"$enableval" = x"no" ; then BUILD_PLUGINS="" INSTALL_PLUGINS="" fi]) AC_SUBST(BUILD_PLUGINS) AC_SUBST(INSTALL_PLUGINS) dnl dnl optional I18N support dnl AC_ARG_ENABLE(i18n, [ --enable-i18n enable I18N support ], [if test x"$enableval" = x"yes" ; then AC_DEFINE(I18N) fi]) AC_OUTPUT(util/Makefile src/Makefile Makefile doc/Makefile plugins/Makefile plugins/Makefile.plugin)