1# 2# "$Id: configure.in 407 2006-11-13 18:54:02Z mike $" 3# 4# Configure script for fldiff, a graphical diff program. 5# 6# Copyright 2005-2006 by Michael Sweet 7# 8# This program is free software; you can redistribute it and/or modify 9# it under the terms of the GNU General Public License v2 as published 10# by the Free Software Foundation. 11# 12# This program is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17 18dnl We need at least autoconf 2.50... 19AC_PREREQ(2.50) 20 21AC_INIT(fldiff.cxx) 22 23dnl Version number... 24VERSION="1.1" 25AC_SUBST(VERSION) 26AC_DEFINE_UNQUOTED(VERSION, "fldiff $VERSION") 27 28dnl Get the operating system and version number... 29uname=`uname` 30uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'` 31if test "x$uname" = xIRIX64; then 32 uname="IRIX" 33fi 34if test "x$uname" = x; then 35 # MingW doesn't provide any output when uname is run, even with "-s"... 36 uname="CYGWIN" 37fi 38 39dnl Clear default debugging options and set normal optimization by 40dnl default unless the user asks for debugging specifically. 41CXXFLAGS="${CXXFLAGS:=}" 42AC_SUBST(CXXFLAGS) 43 44LDFLAGS="${LDFLAGS:=}" 45AC_SUBST(LDFLAGS) 46 47OPTIM="-O" 48AC_SUBST(OPTIM) 49 50AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]], 51if eval "test x$enable_debug = xyes"; then 52 OPTIM="-g" 53else 54 LDFLAGS="$LDFLAGS -s" 55fi) 56 57AC_ARG_WITH(docdir, [ --with-docdir set directory for documentation], 58 docdir="$withval", 59 docdir="NONE") 60AC_SUBST(docdir) 61 62dnl Checks for programs... 63AC_PROG_CC 64AC_PROG_CXX 65AC_PATH_PROG(CP,cp) 66AC_PATH_PROG(MKDIR,mkdir) 67AC_PATH_PROG(RM,rm) 68 69dnl Check for FLTK... 70AC_PATH_PROG(FLTKCONFIG,fltk-config) 71 72if test "x$FLTKCONFIG" = x; then 73 AC_MSG_ERROR([Sorry, fldiff requires FLTK 1.1.x.]) 74else 75 CXXFLAGS="`$FLTKCONFIG --use-images --cflags` $CXXFLAGS" 76 LIBS="`$FLTKCONFIG --use-images --ldflags` $LIBS" 77fi 78 79AC_SUBST(FLTKCONFIG) 80 81dnl Update compiler options... 82if test -n "$GCC"; then 83 # Starting with GCC 3.0, you must link C++ programs against either 84 # libstdc++ (shared by default), or libsupc++ (always static). If 85 # you care about binary portability between Linux distributions, 86 # you need to either 1) build your own GCC with static C++ libraries 87 # or 2) link using gcc and libsupc++. We choose the latter since 88 # fldiff doesn't (currently) use any of the stdc++ library. 89 # 90 # Also, GCC 3.0.x still has problems compiling some code. You may 91 # or may not have success with it. USE 3.0.x WITH EXTREME CAUTION! 92 # 93 # Previous versions of GCC do not have the reliance on the stdc++ 94 # or g++ libraries, so the extra supc++ library is not needed. 95 96 AC_MSG_CHECKING(if libsupc++ is required) 97 98 SUPC="`$CXX -print-file-name=libsupc++.a 2>/dev/null`" 99 if test -n "$SUPC" -a "$SUPC" != "libsupc++.a"; then 100 # This is gcc 3.x, and it knows of libsupc++, so we need it 101 LIBS="$LIBS -lsupc++" 102 AC_MSG_RESULT(yes) 103 else 104 AC_MSG_RESULT(no) 105 fi 106 107 if test "x$uname" != xDarwin; then 108 CXX="$CC" 109 fi 110 111 if test -z "$OPTIM"; then 112 OPTIM="-O2 -fforce-mem -fforce-addr -fcaller-saves" 113 fi 114 115 OPTIM="-Wall -Wno-return-type $OPTIM" 116 117 # See if GCC supports -fno-rtti... 118 AC_MSG_CHECKING(if GCC supports -fno-rtti) 119 OLDCFLAGS="$CFLAGS" 120 CFLAGS="$CFLAGS -fno-rtti" 121 AC_TRY_COMPILE(,, 122 CXXFLAGS="$CXXFLAGS -fno-rtti" 123 AC_MSG_RESULT(yes), 124 AC_MSG_RESULT(no)) 125 CFLAGS="$OLDCFLAGS" 126 127 # See if GCC supports -fno-exceptions... 128 AC_MSG_CHECKING(if GCC supports -fno-exceptions) 129 OLDCFLAGS="$CFLAGS" 130 CFLAGS="$CFLAGS -fno-exceptions" 131 AC_TRY_COMPILE(,, 132 OPTIM="$OPTIM -fno-exceptions" 133 AC_MSG_RESULT(yes), 134 AC_MSG_RESULT(no)) 135 CFLAGS="$OLDCFLAGS" 136 137 # See if we are running HP-UX or Solaris; if so, try the 138 # -fpermissive option... 139 case $uname in 140 SunOS* | HP-UX*) 141 AC_MSG_CHECKING(if GCC supports -fpermissive) 142 143 OLDCFLAGS="$CFLAGS" 144 CFLAGS="$CFLAGS -fpermissive" 145 AC_TRY_COMPILE(,, 146 OPTIM="$OPTIM -fpermissive" 147 AC_MSG_RESULT(yes), 148 AC_MSG_RESULT(no)) 149 CFLAGS="$OLDCFLAGS" 150 ;; 151 *) 152 ;; 153 esac 154else 155 case $uname in 156 AIX*) 157 if test -z "$OPTIM"; then 158 OPTIM="-O2" 159 fi 160 ;; 161 HP-UX*) 162 if test -z "$OPTIM"; then 163 OPTIM="+O2" 164 fi 165 OPTIM="$OPTIM +DAportable" 166 ;; 167 IRIX*) 168 if test -z "$OPTIM"; then 169 OPTIM="-O2" 170 fi 171 if test $uversion -ge 62; then 172 OPTIM="$OPTIM -n32 -mips3" 173 OPTIM="$OPTIM -OPT:Olimit=3000" 174 OPTIM="-fullwarn -woff 1209,1506,1692 $OPTIM" 175 else 176 OPTIM="-fullwarn $OPTIM" 177 fi 178 ;; 179 SunOS*) 180 # Solaris 181 if test -z "$OPTIM"; then 182 OPTIM="-xO4" 183 fi 184 ;; 185 *) 186 # Running some other operating system; inform the user they 187 # should contribute the necessary options to 188 # epm@easysw.com... 189 echo "Building fldiff with default compiler optimizations; contact" 190 echo "fldiff@easysw.com with the uname and compiler options needed for" 191 echo "your platform, or set the CFLAGS and CXXFLAGS environment" 192 echo "variable before running configure." 193 ;; 194 esac 195fi 196 197dnl Fix "prefix" variable if it hasn't been specified... 198if test "$prefix" = "NONE"; then 199 prefix="/usr/local" 200fi 201 202dnl Fix "exec_prefix" variable if it hasn't been specified... 203if test "$exec_prefix" = "NONE"; then 204 exec_prefix="$prefix" 205fi 206 207dnl Fix "datadir" variable if it hasn't been specified... 208if test "$datadir" = "\${prefix}/share"; then 209 datadir="$prefix/share" 210fi 211 212dnl Fix "docdir" variable if it hasn't been specified... 213if test "$docdir" = "NONE"; then 214 docdir="$datadir/doc/fldiff" 215fi 216 217dnl Fix "mandir" variable if it hasn't been specified... 218if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then 219 case "$uname" in 220 *BSD* | Darwin* | Linux*) 221 # BSD, Darwin (MacOS X), and Linux 222 mandir="/usr/share/man" 223 ;; 224 IRIX*) 225 # SGI IRIX 226 mandir="/usr/share/catman/u_man" 227 ;; 228 *) 229 # All others 230 mandir="/usr/man" 231 ;; 232 esac 233fi 234 235dnl See if we have the X11 desktop stuff used by GNOME and KDE... 236AC_MSG_CHECKING(if GNOME/KDE desktop is in use) 237desktopdir="" 238for dir in /usr/share/applnk /etc/X11/applnk; do 239 if test -d $dir; then 240 desktopdir=$dir 241 break 242 fi 243done 244 245if test x$desktopdir = x; then 246 AC_MSG_RESULT(no) 247 INSTALLDESKTOP="" 248 UNINSTALLDESKTOP="" 249else 250 AC_MSG_RESULT(yes) 251 INSTALLDESKTOP="install-desktop" 252 UNINSTALLDESKTOP="uninstall-desktop" 253fi 254 255AC_SUBST(desktopdir) 256AC_SUBST(INSTALLDESKTOP) 257AC_SUBST(UNINSTALLDESKTOP) 258 259dnl Output the makefile and list file... 260AC_OUTPUT(Makefile fldiff.list) 261 262# 263# End of "$Id: configure.in 407 2006-11-13 18:54:02Z mike $". 264# 265