File: configure.in

package info (click to toggle)
gri 2.4.2-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,540 kB
  • ctags: 1,966
  • sloc: cpp: 32,542; lisp: 3,243; perl: 806; makefile: 548; sh: 253
file content (332 lines) | stat: -rw-r--r-- 8,644 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
dnl @(#) configure.in 1.147 (c) 98/07/13 Dan E. Kelley
dnl HINT: to figure out machine name, compile a program (even a dummy
dnl program) with options as
dnl             gcc -E -dM dummy.c
dnl and note defines that look like the machine name.  For example,
dnl on a Silicon Graphics (SGI) machine, you'll see, among other
dnl things, a line like 
dnl         #define sgi 1
dnl To see how this is used, see the "DEK_IS_SGI" code below, in the
dnl present file.

dnl For intro on how to code in this 'configure' (really, 'm4')
dnl language, see the file
dnl     /opt/gnu/share/autoconf/acspecific.m4


dnl AC_REVISION(@(#) configure.in 1.147 (c) 98/07/13 Dan E. Kelley)

AC_PREREQ(2.1)

AC_INIT(gr.hh)

AC_PREFIX_DEFAULT(/opt/gri)

# If didn't do "./configure --prefix=PLACE", then ask question.
if test "$prefix" = NONE; then
cat <<EOF
  You must indicate an install-directory for Gri.  This directory will
  be created if it does not exist.  The install-directory will
  contain subdirectories 'bin' and 'lib' to hold the Gri program
  and various library files, respectively.  Optionally, it may
  also hold other versions of the Gri program.

  For example, the author maintains his own developmental versions, 
  and so he answers
	/users/dek/kelley/share/gri
  to this question on his solaris machine, and
	/home/kelley/share/gri
  on his linux machine.

  Please give the install-directory, noting that carriage-return will
  result in the use of the default value $ac_default_prefix:
EOF
read install_directory
case "$install_directory" in
'')
	;;
*)
	prefix=$install_directory
	;;
esac
fi

AC_PROG_INSTALL

PROGS="gri"

AC_SUBST(PROGS)

dnl     checks for programs.

AC_PROG_CXX
AC_PROG_CXXCPP
AC_LANG_CPLUSPLUS

dnl	See if uses string::remove or string::erase
AC_MSG_CHECKING(for whether uses string::remove or string::erase)
AC_DEFUN(CHECK_OLD_STRING,
AC_MSG_CHECKING(for string::erase() or string::remove())
AC_CACHE_VAL(dek_cv_have_old_string, [
    AC_TRY_COMPILE([
#define _POSIX_SOURCE 1
#include <string>
], [
string s("hi");
s.remove(0,1);
], dek_cv_have_old_string=yes, dek_cv_have_old_string=no)])
    AC_MSG_RESULT($dek_cv_have_old_string)
    if test $dek_cv_have_old_string = yes ; then
        AC_DEFINE(HAVE_OLD_STRING)
    fi
    )dnl
dnl
CHECK_OLD_STRING


define(GCC_TWEAK1,
[AC_BEFORE([$0], [AC_COMPILE_CHECK])AC_BEFORE([$0], [AC_TEST_PROGRAM])AC_BEFORE([$0], [AC_HEADER_EGREP])AC_BEFORE([$0], [AC_TEST_CPP])AC_EGREP_CPP(yes,
[#if defined(__GNUC__)
  yes
#endif
], GCC=1)
if test -n "$GCC"; then
  EXTRA_CFLAGS_TEMPLATE="$EXTRA_CFLAGS -Wall"
  EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall -fno-implicit-templates"
  AC_SUBST(EXTRA_CFLAGS)
  AC_SUBST(EXTRA_CFLAGS_TEMPLATE)
fi
])dnl
AC_MSG_CHECKING(for gcc compiler (tweaking stuff if so))
dnl
GCC_TWEAK1


dnl On DEC computers, with cxx compiler, need something special
AC_MSG_CHECKING(for DEC cxx compiler)
define(DEK_IS_DEC_CXX,
[
AC_BEFORE([$0], [AC_COMPILE_CHECK])AC_BEFORE([$0], [AC_TEST_PROGRAM])AC_BEFORE([$0], [AC_HEADER_EGREP])AC_BEFORE([$0], [AC_TEST_CPP])AC_EGREP_CPP(yes,
[#ifdef __DECCXX
  yes
#endif
], IS_DEC_CXX=1)
if test -n "$IS_DEC_CXX"; then
  echo
  echo "Using a DEC cxx compiler"
  echo
  CXXFLAGS="$CXXFLAGS -D_ANSI_C_SOURCE"
  AC_SUBST(CXXFLAGS)
else
  echo " not a DEC cxx compiler"
fi
])dnl
dnl
DEK_IS_DEC_CXX

dnl	See if DEC alpha
AC_MSG_CHECKING(for DEC alpha computer)
define(DEK_IS_DEC_ALPHA,
[
AC_BEFORE([$0], [AC_COMPILE_CHECK])AC_BEFORE([$0], [AC_TEST_PROGRAM])AC_BEFORE([$0], [AC_HEADER_EGREP])AC_BEFORE([$0], [AC_TEST_CPP])AC_EGREP_CPP(yes,
[#ifdef __alpha__
  yes
#endif
], IS_DEC_ALPHA=1)
if test -n "$IS_DEC_ALPHA"; then
  AC_DEFINE(IS_DEC_ALPHA)
fi
])dnl
dnl
DEK_IS_DEC_ALPHA


dnl See if SGI computer
AC_MSG_CHECKING(for SGI computer)
define(DEK_IS_SGI,
[
AC_BEFORE([$0], [AC_COMPILE_CHECK])AC_BEFORE([$0], [AC_TEST_PROGRAM])AC_BEFORE([$0], [AC_HEADER_EGREP])AC_BEFORE([$0], [AC_TEST_CPP])AC_EGREP_CPP(yes,
[#ifdef sgi
  yes
#endif
], IS_SGI=1)
if test -n "$IS_SGI"; then
  AC_DEFINE(IS_SGI)
fi
])dnl
dnl
DEK_IS_SGI

dnl See if IBM-RS computer
AC_MSG_CHECKING(for IBM-RS computer)
define(DEK_IS_IBMRS,
[
AC_BEFORE([$0], [AC_COMPILE_CHECK])AC_BEFORE([$0], [AC_TEST_PROGRAM])AC_BEFORE([$0], [AC_HEADER_EGREP])AC_BEFORE([$0], [AC_TEST_CPP])AC_EGREP_CPP(yes,
[#ifdef _IBMR2
  yes
#endif
], IS_IBMRS=1)
if test -n "$IS_IBMRS"; then
  AC_DEFINE(IS_IBMRS)
fi
])dnl
dnl
DEK_IS_IBMRS


dnl See if SUN computer
AC_MSG_CHECKING(for sun computer)
define(DEK_IS_SUN,
[
AC_BEFORE([$0], [AC_COMPILE_CHECK])AC_BEFORE([$0], [AC_TEST_PROGRAM])AC_BEFORE([$0], [AC_HEADER_EGREP])AC_BEFORE([$0], [AC_TEST_CPP])AC_EGREP_CPP(yes,
[#ifdef sun
  yes
#endif
], IS_SUN=1)
if test -n "$IS_SUN"; then
  AC_DEFINE(IS_SUN)
fi
])dnl
dnl
DEK_IS_SUN



dnl On HP-UX computers, define the symbol _HPUX_SOURCE,
dnl which forces the hp-ux compiler to read the <sys/timeb.h> file
dnl correctly. 
AC_MSG_CHECKING(for HP computer)
define(DEK_IS_HP,
[
AC_BEFORE([$0], [AC_COMPILE_CHECK])AC_BEFORE([$0], [AC_TEST_PROGRAM])AC_BEFORE([$0], [AC_HEADER_EGREP])AC_BEFORE([$0], [AC_TEST_CPP])AC_EGREP_CPP(yes,
[#ifdef hpux
  yes
#endif
], IS_HP=1)
if test -n "$IS_HP"; then
  AC_DEFINE(IS_HP)
fi
])dnl
dnl
DEK_IS_HP

dnl     See if Linux
AC_DEFUN(DEK_IS_LINUX,
AC_MSG_CHECKING(for for linux computer)
AC_CACHE_VAL(dek_cv_is_linux, [
AC_BEFORE([$0], [AC_COMPILE_CHECK])AC_BEFORE([$0], [AC_TEST_PROGRAM])AC_BEFORE([$0], [AC_HEADER_EGREP])AC_BEFORE([$0], [AC_TEST_CPP])AC_EGREP_CPP(yes,
[#ifdef linux
  yes
#endif
], dek_cv_is_linux=yes, dek_cv_is_linux=no)])
    AC_MSG_RESULT($dek_cv_is_linux)
    if test $dek_cv_is_linux = yes; then
        AC_DEFINE(HAVE_LINUX)
	CFLAGS="$CFLAGS -bi486-linuxaout"
    fi
)dnl
dnl
DEK_IS_LINUX

AC_CHECK_HEADERS(unistd.h)

dnl     Check for netcdf library.  It might be
dnl	in one of several places, so check
dnl	several locations, reporting location
dnl	if found.
AC_MSG_CHECKING(for netcdf library)
define(CHECK_FOR_NETCDF, [
    if test -d /opt/netcdf/include ; then
	#
	# Solaris often has it here
	CXXFLAGS="$CXXFLAGS -I/opt/netcdf/include"
        LIBS="$LIBS -L/opt/netcdf/lib -lnetcdf"
	if test -n "$IS_SUN" ; then
	    LIBS="$LIBS -lnsl"
	fi
	AC_DEFINE(HAVE_LIBNETCDF)
        echo "yes (in /opt/netcdf/include/netcdf.h and /opt/netcdf/lib/libnetcdf.a)"
    else
	if test -f /usr/local/include/netcdf.h ; then
	    CXXFLAGS="$CPPFLAGS -I/usr/local/include"
	    LIBS="$LIBS -L/usr/local/lib -lnetcdf"
	    if test -n "$IS_SUN" ; then
		LIBS="$LIBS -lnsl"
	    fi
	    AC_DEFINE(HAVE_LIBNETCDF)
            echo "yes (in /usr/local/include/netcdf.h and /usr/local/lib/libnetcdf.a)"
	else
	    #
	    # Linux/debian often has it here.
	    if test -f /usr/include/netcdf.h ; then
                CXXFLAGS="$CPPFLAGS -I/usr/include/netcdf"
                LIBS="$LIBS -L/usr/lib/netcdf -lnetcdf"
                if test -n "$IS_SUN" ; then
                    LIBS="$LIBS -lnsl"
                fi
                AC_DEFINE(HAVE_LIBNETCDF)
                echo "yes (in /usr/include/netcdf.h and /usr/lib/libnetcdf.a)"
            else
                echo "no"
            fi
        fi
    fi
])dnl
dnl
CHECK_FOR_NETCDF

dnl     Don't use AC_PROG_AWK, since gets 'mawk' before 'gawk'
define(DEK_PROG_AWK, [AC_CHECK_PROGS(AWK, gawk nawk mawk awk,)])dnl
DEK_PROG_AWK

dnl     checks for UNIX variants that set `DEFS'

dnl     checks for header files
dnl     stdarg.h, stdlib.h
AC_HEADER_STDC

dnl     checks for typedefs
AC_TYPE_PID_T

dnl     Check for POSIX times()
AC_DEFUN(CHECK_FOR_POSIX_TIMES,
AC_MSG_CHECKING(for POSIX times() subroutine)
AC_CACHE_VAL(dek_cv_have_posix_times, [
    AC_TRY_COMPILE([
#define _POSIX_SOURCE 1
#include <unistd.h>
#include <limits.h>
#include <time.h>
#include <sys/times.h>
], [
struct tms buffer; 
clock_t t = times(&buffer);
], dek_cv_have_posix_times=yes, dek_cv_have_posix_times=no)])
    AC_MSG_RESULT($dek_cv_have_posix_times)
    if test $dek_cv_have_posix_times = yes ; then
        AC_DEFINE(HAVE_POSIX_TIMES)
    fi
    )dnl
dnl
CHECK_FOR_POSIX_TIMES


dnl     checks for functions
AC_CHECK_FUNCS(isnan isinf acosh getenv popen drand48 tmpnam tempname gethostname)

dnl     checks for structure members

dnl     checks for compiler characteristics

dnl     checks for operating system services

dnl     other checks for UNIX variants

AC_OUTPUT(Makefile)

echo
echo "*  Note to developers: to get debugging malloc library,"
echo "*  edit the Makefile and follow the directions in lines"
echo "*  enclosed by comments like"
echo "* # <<<--- DEVELOPERS: YOU MAY NEED TO EDIT THIS SECTION ------------------->>>"
echo "* # <<<--- DEVELOPERS: END OF SECTION YOU MIGHT NEED TO EDIT --------------->>>"