dnl dnl "$Id: configure.in,v 1.67 2003/07/23 21:41:08 mike Exp $" dnl dnl Configuration script for the ESP Package Manager (EPM). dnl dnl Copyright 1999-2003 by Easy Software Products, all rights reserved. dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2, or (at your option) dnl any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl AC_INIT(epm.c) AC_CONFIG_HEADER(config.h) AC_PREFIX_DEFAULT(/usr) dnl Version number... VERSION=3.7.0 VERNUMBER=370 AC_SUBST(VERSION) AC_SUBST(VERNUMBER) AC_DEFINE_UNQUOTED(EPM_VERSION, "ESP Package Manager v$VERSION") dnl Get the operating system... uname=`uname` uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'` if test "$uname" = "IRIX64"; then uname="IRIX" fi dnl Clear default debugging options and set normal optimization by dnl default unless the user asks for debugging specifically. CFLAGS="${CFLAGS:=}" CXXFLAGS="${CXXFLAGS:=}" LDFLAGS="${LDFLAGS:=}" AC_SUBST(LDFLAGS) OPTIM="${OPTIM:=-O}" AC_SUBST(OPTIM) AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]], if eval "test x$enable_debug = xyes"; then OPTIM="-g" else LDFLAGS="$LDFLAGS -s" fi) AC_ARG_WITH(docdir, [ --with-docdir set directory for documentation], docdir="$withval", docdir="\${datadir}/doc/epm") AC_SUBST(docdir) AC_ARG_WITH(softwaredir, [ --with-softwaredir set directory for EPM uninstall files and init scripts], softwaredir="$withval", softwaredir="") dnl Checks for programs... AC_PROG_CC AC_PROG_CXX AC_PATH_PROG(CHMOD,chmod) AC_PATH_PROG(CP,cp) AC_PATH_PROG(GZIP,gzip) if test x$GZIP = x; then AC_MSG_ERROR(GNU zip not found but required!) fi AC_PATH_PROG(HTMLDOC,htmldoc) AC_PATH_PROG(MKDIR,mkdir) AC_PATH_PROG(NROFF,nroff) if test x$NROFF = x; then AC_PATH_PROG(GROFF,groff) if test x$GROFF = x; then NROFF="echo" else NROFF="$GROFF -T ascii" fi fi AC_PATH_PROG(RM,rm) AC_PATH_PROG(RPM,rpm) AC_PATH_PROG(RPMBUILD,rpmbuild) AC_PATH_PROG(STRIP,strip) dnl Architecture checks... AC_C_CONST AC_C_CHAR_UNSIGNED if test "$uname" = "IRIX"; then if test `uname -r` = 6.5; then STRIP="$STRIP -f -s -k -l -h" fi fi dnl Checks for header files. AC_HEADER_STDC AC_HEADER_DIRENT AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H)) AC_CHECK_HEADER(sys/mount.h,AC_DEFINE(HAVE_SYS_MOUNT_H)) AC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H)) AC_CHECK_HEADER(sys/statfs.h,AC_DEFINE(HAVE_SYS_STATFS_H)) AC_CHECK_HEADER(sys/vfs.h,AC_DEFINE(HAVE_SYS_VFS_H)) dnl Checks for string functions. AC_CHECK_FUNCS(strdup) AC_CHECK_FUNCS(strcasecmp) AC_CHECK_FUNCS(strncasecmp) if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then AC_MSG_WARN(Forcing snprintf emulation for HP-UX.) else AC_CHECK_FUNCS(snprintf) AC_CHECK_FUNCS(vsnprintf) fi AC_SEARCH_LIBS(gethostname, socket) AC_PATH_PROG(FLTKCONFIG,fltk-config) if test "x$FLTKCONFIG" = x; then GUIS="" GUILIBS="" INSTALL_GUIS="" INSTALL_OSX="" AC_MSG_WARN([Sorry, setup GUI requires FLTK 1.1.x.]) else CXXFLAGS="`$FLTKCONFIG --cflags` ${CXXFLAGS}" GUIS="setup uninst" GUILIBS="`$FLTKCONFIG --ldstaticflags`" INSTALL_GUIS="install-guis" if test "$uname" = Darwin; then GUILIBS="$GUILIBS -framework Security" INSTALL_OSX="install-osx" else INSTALL_OSX="" fi fi AC_SUBST(INSTALL_GUIS) AC_SUBST(INSTALL_OSX) AC_SUBST(GUIS) AC_SUBST(GUILIBS) dnl Update compiler options... if test -n "$GCC"; then # Starting with GCC 3.0, you must link C++ programs against either # libstdc++ (shared by default), or libsupc++ (always static). If # you care about binary portability between Linux distributions, # you need to either 1) build your own GCC with static C++ libraries # or 2) link using gcc and libsupc++. We choose the latter since # EPM doesn't (currently) use any of the stdc++ library. # # Also, GCC 3.0.x still has problems compiling some code. You may # or may not have success with it. USE 3.0.x WITH EXTREME CAUTION! # # Previous versions of GCC do not have the reliance on the stdc++ # or g++ libraries, so the extra supc++ library is not needed. AC_MSG_CHECKING(if libsupc++ is required) SUPC="`$CXX -print-file-name=libsupc++.a 2>/dev/null`" if test -n "$SUPC" -a "$SUPC" != "libsupc++.a"; then # This is gcc 3.x, and it knows of libsupc++, so we need it LIBS="$LIBS -lsupc++" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi # CXX="$CC" if test -z "$OPTIM"; then OPTIM="-O2 -fforce-mem -fforce-addr -fcaller-saves" fi # CXX="$CC" OPTIM="-Wall -Wno-return-type $OPTIM" # See if GCC supports -fno-rtti... AC_MSG_CHECKING(if GCC supports -fno-rtti) OLDCFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fno-rtti" AC_TRY_COMPILE(,, OPTIM="$OPTIM -fno-rtti" AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) CFLAGS="$OLDCFLAGS" # See if GCC supports -fno-exceptions... AC_MSG_CHECKING(if GCC supports -fno-exceptions) OLDCFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fno-exceptions" AC_TRY_COMPILE(,, OPTIM="$OPTIM -fno-exceptions" AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) CFLAGS="$OLDCFLAGS" # See if we are running HP-UX or Solaris; if so, try the # -fpermissive option... case $uname in SunOS* | HP-UX*) AC_MSG_CHECKING(if GCC supports -fpermissive) OLDCFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fpermissive" AC_TRY_COMPILE(,, OPTIM="$OPTIM -fpermissive" AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) CFLAGS="$OLDCFLAGS" ;; *) ;; esac else case $uname in AIX*) if test -z "$OPTIM"; then OPTIM="-O2" fi ;; HP-UX*) if test -z "$OPTIM"; then OPTIM="+O2" fi OPTIM="$OPTIM +DAportable" ;; IRIX*) if test -z "$OPTIM"; then OPTIM="-O2" fi if test $uversion -ge 62; then OPTIM="$OPTIM -n32 -mips3" OPTIM="$OPTIM -OPT:Olimit=3000" OPTIM="-fullwarn -woff 1209,1506,1692 $OPTIM" else OPTIM="-fullwarn $OPTIM" fi ;; SunOS*) # Solaris if test -z "$OPTIM"; then OPTIM="-xO4" fi ;; *) # Running some other operating system; inform the user they # should contribute the necessary options to # epm@easysw.com... echo "Building EPM with default compiler optimizations; contact" echo "epm@easysw.com with the uname and compiler options needed for" echo "your platform, or set the CFLAGS and CXXFLAGS environment" echo "variable before running configure." ;; esac fi dnl Fix "prefix" variable if it hasn't been specified... if test "$prefix" = "NONE"; then prefix="/usr" fi dnl Fix "exec_prefix" variable if it hasn't been specified... if test "$exec_prefix" = "NONE"; then exec_prefix="$prefix" fi dnl Fix "libdir" variable if it hasn't been specified... if test "$libdir" = "\${exec_prefix}/lib"; then libdir="$exec_prefix/lib" fi dnl Fix "datadir" variable if it hasn't been specified... if test "$datadir" = "\${prefix}/share"; then datadir="$prefix/share" fi dnl Fix "mandir" variable if it hasn't been specified... if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then case "$uname" in *BSD* | Darwin* | Linux*) # BSD, Darwin (MacOS X), and Linux mandir="/usr/share/man" ;; IRIX*) # SGI IRIX mandir="/usr/share/catman/u_man" ;; *) # All others mandir="/usr/man" ;; esac fi dnl More manpage stuff... case "$uname" in *BSD* | Darwin*) # *BSD CAT1EXT="0" MAN1EXT="1" CAT5EXT="0" MAN5EXT="5" ;; *) # All others CAT1EXT="1" MAN1EXT="1" CAT5EXT="5" MAN5EXT="5" ;; esac AC_SUBST(CAT1EXT) AC_SUBST(MAN1EXT) AC_SUBST(CAT5EXT) AC_SUBST(MAN5EXT) dnl EPM_SOFTWARE needs special attention for the default location... if test x$softwaredir = x; then if test "$prefix" = "/usr"; then EPM_SOFTWARE="/etc/software" else EPM_SOFTWARE="$prefix/etc/software" fi else EPM_SOFTWARE="$softwaredir" fi AC_DEFINE_UNQUOTED(EPM_SOFTWARE, "$EPM_SOFTWARE") AC_SUBST(EPM_SOFTWARE) AC_DEFINE_UNQUOTED(EPM_GZIP, "$GZIP") AC_SUBST(EPM_GZIP) AC_DEFINE_UNQUOTED(EPM_STRIP, "$STRIP") AC_SUBST(EPM_STRIP) AC_DEFINE_UNQUOTED(EPM_BINDIR, "$exec_prefix/bin") AC_SUBST(EPM_BINDIR) AC_DEFINE_UNQUOTED(EPM_LIBDIR, "$libdir/epm") AC_SUBST(EPM_LIBDIR) AC_DEFINE_UNQUOTED(EPM_DATADIR, "$datadir/epm") AC_SUBST(EPM_DATADIR) dnl Figure out the right option to use for the RPM build architecture... if test "x$RPM" != x; then # It would be nice if Red Hat could make up its mind... rpmversion="`$RPM --version | awk '{print $3}' | awk -F. '{print $1 * 10000 + $2 * 100 + $3}'`" if test $rpmversion -lt 30000; then AC_DEFINE_UNQUOTED(EPM_RPMARCH, "--buildarch ") else if test $rpmversion -ge 40003; then AC_DEFINE_UNQUOTED(EPM_RPMARCH, "--target ") else AC_DEFINE_UNQUOTED(EPM_RPMARCH, "--target=") fi fi fi if test "x$RPMBUILD" != x; then AC_DEFINE_UNQUOTED(EPM_RPMBUILD, "$RPMBUILD") AC_DEFINE(EPM_RPMTOPDIR) else if test "x$RPM" != x; then AC_DEFINE_UNQUOTED(EPM_RPMBUILD, "$RPM") else AC_DEFINE_UNQUOTED(EPM_RPMBUILD, "rpm") fi fi dnl Output the makefile, list file, and config header... AC_OUTPUT(Makefile epm.list doc/Makefile macosx/setup.plist macosx/uninst.plist) dnl dnl End of "$Id: configure.in,v 1.67 2003/07/23 21:41:08 mike Exp $". dnl