Debian Codegraph @

configure.in

raw
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
18 dnl We need at least autoconf 2.50...
19 AC_PREREQ(2.50)
20
21 AC_INIT(fldiff.cxx)
22
23 dnl Version number...
24 VERSION="1.1"
25 AC_SUBST(VERSION)
26 AC_DEFINE_UNQUOTED(VERSION, "fldiff $VERSION")
27
28 dnl Get the operating system and version number...
29 uname=`uname`
30 uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
31 if test "x$uname" = xIRIX64; then
32 uname="IRIX"
33 fi
34 if test "x$uname" = x; then
35 # MingW doesn't provide any output when uname is run, even with "-s"...
36 uname="CYGWIN"
37 fi
38
39 dnl Clear default debugging options and set normal optimization by
40 dnl default unless the user asks for debugging specifically.
41 CXXFLAGS="${CXXFLAGS:=}"
42 AC_SUBST(CXXFLAGS)
43
44 LDFLAGS="${LDFLAGS:=}"
45 AC_SUBST(LDFLAGS)
46
47 OPTIM="-O"
48 AC_SUBST(OPTIM)
49
50 AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],
51 if eval "test x$enable_debug = xyes"; then
52 OPTIM="-g"
53 else
54 LDFLAGS="$LDFLAGS -s"
55 fi)
56
57 AC_ARG_WITH(docdir, [ --with-docdir set directory for documentation],
58 docdir="$withval",
59 docdir="NONE")
60 AC_SUBST(docdir)
61
62 dnl Checks for programs...
63 AC_PROG_CC
64 AC_PROG_CXX
65 AC_PATH_PROG(CP,cp)
66 AC_PATH_PROG(MKDIR,mkdir)
67 AC_PATH_PROG(RM,rm)
68
69 dnl Check for FLTK...
70 AC_PATH_PROG(FLTKCONFIG,fltk-config)
71
72 if test "x$FLTKCONFIG" = x; then
73 AC_MSG_ERROR([Sorry, fldiff requires FLTK 1.1.x.])
74 else
75 CXXFLAGS="`$FLTKCONFIG --use-images --cflags` $CXXFLAGS"
76 LIBS="`$FLTKCONFIG --use-images --ldflags` $LIBS"
77 fi
78
79 AC_SUBST(FLTKCONFIG)
80
81 dnl Update compiler options...
82 if 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
154 else
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 # [email protected]...
189 echo "Building fldiff with default compiler optimizations; contact"
190 echo "[email protected] 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
195 fi
196
197 dnl Fix "prefix" variable if it hasn't been specified...
198 if test "$prefix" = "NONE"; then
199 prefix="/usr/local"
200 fi
201
202 dnl Fix "exec_prefix" variable if it hasn't been specified...
203 if test "$exec_prefix" = "NONE"; then
204 exec_prefix="$prefix"
205 fi
206
207 dnl Fix "datadir" variable if it hasn't been specified...
208 if test "$datadir" = "\${prefix}/share"; then
209 datadir="$prefix/share"
210 fi
211
212 dnl Fix "docdir" variable if it hasn't been specified...
213 if test "$docdir" = "NONE"; then
214 docdir="$datadir/doc/fldiff"
215 fi
216
217 dnl Fix "mandir" variable if it hasn't been specified...
218 if 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
233 fi
234
235 dnl See if we have the X11 desktop stuff used by GNOME and KDE...
236 AC_MSG_CHECKING(if GNOME/KDE desktop is in use)
237 desktopdir=""
238 for dir in /usr/share/applnk /etc/X11/applnk; do
239 if test -d $dir; then
240 desktopdir=$dir
241 break
242 fi
243 done
244
245 if test x$desktopdir = x; then
246 AC_MSG_RESULT(no)
247 INSTALLDESKTOP=""
248 UNINSTALLDESKTOP=""
249 else
250 AC_MSG_RESULT(yes)
251 INSTALLDESKTOP="install-desktop"
252 UNINSTALLDESKTOP="uninstall-desktop"
253 fi
254
255 AC_SUBST(desktopdir)
256 AC_SUBST(INSTALLDESKTOP)
257 AC_SUBST(UNINSTALLDESKTOP)
258
259 dnl Output the makefile and list file...
260 AC_OUTPUT(Makefile fldiff.list)
261
262 #
263 # End of "$Id: configure.in 407 2006-11-13 18:54:02Z mike $".
264 #