dnl Process this file with autoconf to produce a configure script. AC_INIT(mswordview.c) AC_CONFIG_HEADER(config.h) dnl Checks for programs. dnl AC_PROG_CC dnl AC_PROG_CC shoves in -g by default, i *really* hate this so here goes... dnl ill shove in the autoconf def of AC_PROG_CC verbatim and remove the -g dnl stuff dnl autoconf stuff begins here AC_DEFUN(AC_PROG_CC_NO_G, [AC_BEFORE([$0], [AC_PROG_CPP])dnl AC_CHECK_PROG(CC, gcc, gcc) if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) fi AC_PROG_CC_WORKS AC_PROG_CC_GNU if test $ac_cv_prog_gcc = yes; then GCC=yes dnl Check whether -g works, even if CFLAGS is set, in case the package dnl plays around with CFLAGS (such as to build both debugging and dnl normal versions of a library), tasteless as that idea is. ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= dnl C Begin dnl AC_PROG_CC_G dnl C End if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" dnl C Begin dnl elif test $ac_cv_prog_cc_g = yes; then dnl CFLAGS="-g -O2" dnl C End else CFLAGS="-O2" fi else GCC= test "${CFLAGS+set}" = set dnl C Begin dnl || CFLAGS="-g" dnl C End fi ]) dnl autoconf stuff ends here AC_PROG_CC_NO_G AC_PROG_MAKE_SET AC_PROG_INSTALL AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_TYPE_SIGNAL AC_FUNC_WAIT3 AC_CHECK_HEADERS(fcntl.h sys/file.h sys/ioctl.h unistd.h) CFLAGS="$CFLAGS $X_CFLAGS" dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7) AC_DEFUN(BASH_SIGNAL_CHECK, [AC_REQUIRE([AC_TYPE_SIGNAL]) AC_MSG_CHECKING(for type of signal functions) AC_CACHE_VAL(bash_cv_signal_vintage, [ AC_TRY_LINK([#include ],[ sigset_t ss; struct sigaction sa; sigemptyset(&ss); sigsuspend(&ss); sigaction(SIGINT, &sa, (struct sigaction *) 0); sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0); ], bash_cv_signal_vintage=posix, [ AC_TRY_LINK([#include ], [ int mask = sigmask(SIGINT); sigsetmask(mask); sigblock(mask); sigpause(mask); ], bash_cv_signal_vintage=4.2bsd, [ AC_TRY_LINK([ #include RETSIGTYPE foo() { }], [ int mask = sigmask(SIGINT); sigset(SIGINT, foo); sigrelse(SIGINT); sighold(SIGINT); sigpause(SIGINT); ], bash_cv_signal_vintage=svr3, bash_cv_signal_vintage=v7 )] )] ) ]) AC_MSG_RESULT($bash_cv_signal_vintage) if test "$bash_cv_signal_vintage" = posix; then AC_DEFINE(HAVE_POSIX_SIGNALS) elif test "$bash_cv_signal_vintage" = "4.2bsd"; then AC_DEFINE(HAVE_BSD_SIGNALS) elif test "$bash_cv_signal_vintage" = svr3; then AC_DEFINE(HAVE_USG_SIGHOLD) fi ]) AC_DEFUN(BASH_REINSTALL_SIGHANDLERS, [AC_REQUIRE([AC_TYPE_SIGNAL]) AC_REQUIRE([BASH_SIGNAL_CHECK]) AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked]) AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers, [AC_TRY_RUN([ #include #ifdef HAVE_UNISTD_H #include #endif typedef RETSIGTYPE sigfunc(); int nsigint; #ifdef HAVE_POSIX_SIGNALS sigfunc * set_signal_handler(sig, handler) int sig; sigfunc *handler; { struct sigaction act, oact; act.sa_handler = handler; act.sa_flags = 0; sigemptyset (&act.sa_mask); sigemptyset (&oact.sa_mask); sigaction (sig, &act, &oact); return (oact.sa_handler); } #else #define set_signal_handler(s, h) signal(s, h) #endif RETSIGTYPE sigint(s) int s; { nsigint++; } main() { nsigint = 0; set_signal_handler(SIGINT, sigint); kill((int)getpid(), SIGINT); kill((int)getpid(), SIGINT); exit(nsigint != 2); } ], bash_cv_must_reinstall_sighandlers=no, bash_cv_must_reinstall_sighandlers=yes AC_MSG_ERROR(cannot check signal handling if cross compiling))]) AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers) if test $bash_cv_must_reinstall_sighandlers = yes; then AC_DEFINE(MUST_REINSTALL_SIGHANDLERS) fi ]) dnl system ZLIB support, nicked from mozilla source dnl ======================================================== AC_ARG_WITH(zlib, [ --with-zlib=\$dir use system libz in \$dir], ZLIB_DIR=$withval) _SAVE_CFLAGS=$CFLAGS _SAVE_LDFLAGS=$LDFLAGS CFLAGS="-I${ZLIB_DIR}/include $CFLAGS" LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS" if test "$ZLIB_DIR" = no; then SYSTEM_ZLIB= else AC_MSG_CHECKING("for zlib.h") AC_TRY_COMPILE([#include "zlib.h"], [], [result="yes" SYSTEM_ZLIB=1], [result="no, WARNING mswordview will not be able to decompress wmf files" SYSTEM_ZLIB=0]) AC_MSG_RESULT("$result") fi if [ test "$SYSTEM_ZLIB" = 1 ]; then AC_DEFINE(SYSTEM_ZLIB) AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS) fi CFLAGS=$_SAVE_CFLAGS LDFLAGS=$_SAVE_LDFLAGS if [ test -n "${ZLIB_DIR}" && test -d "${ZLIB_DIR}" && test "$SYSTEM_ZLIB" = 1 ]; then ZLIB_CFLAGS="-I${ZLIB_DIR}/include" ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}" fi dnl ======================================================== dnl end of zlib BASH_REINSTALL_SIGHANDLERS dnl check for getopt AC_CHECK_FUNC(getopt_long, , [LIBOBJS="$LIBOBJS getopt1.o getopt.o"]) AC_CHECK_FUNC(strerror, , [LIBOBJS="$LIBOBJS strerror.o"]) AC_SUBST(LIBOBJS) AC_SUBST(ZLIB_CFLAGS) AC_SUBST(ZLIB_LIBS) AC_OUTPUT(Makefile oledecod/Makefile)