File: aclocal.m4

package info (click to toggle)
imgvtopgm 2.0-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 876 kB
  • ctags: 270
  • sloc: ansic: 1,670; sh: 449; makefile: 109
file content (400 lines) | stat: -rw-r--r-- 11,499 bytes parent folder | download | duplicates (6)
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
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
dnl aclocal.m4 generated automatically by aclocal 1.4

dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.

dnl
dnl AC_PROG_CC replacement.
dnl
dnl The -DMU_AUTOKLUDGE business is an interesting study in kludging around
dnl code that is trying to be smarter than it really is.  If CFLAGS doesn't
dnl have anything in it, AC_PROG_CC will put things in it for us; in
dnl particular, the dreaded debug flag, -g, will appear under various
dnl circumstances.  I don't want debug information it be around by default,
dnl I want optimizations turned on and debug turned off unless someone asks
dnl for different settings via --disable-optimize and/or --enable-debug.
dnl The problem is that I don't know what compiler optimization flags to
dnl use until the compiler is known; hence, the debug/optimization settings
dnl cannot be dealt with until AC_PROG_CC has done its thing.  To keep
dnl AC_PROG_CC from polluting CFLAGS with debug settings we have to make sure
dnl that something is in CFLAGS before AC_PROG_CC executes.  I have chosen
dnl to slip a -DMU_AUTOKLUDGE into CFLAGS since it should be completely
dnl harmless and it is easy to take out later.  This whole thing is just
dnl a way to let me use -O2, -xO2, or plain -O depending on what works.
dnl
dnl This macro runs AC_PROG_CC (with a little trick) and AC_ISC_POSIX.
dnl After that, we check for --enable-debug and --enable-optimize switches
dnl (and their --disable counterparts of course) to pick up debug and/or
dnl optimization flags for the C compiler.
dnl
AC_DEFUN(MU_PROG_CC, [
	CFLAGS="${CFLAGS:--DMU_AUTOKLUDGE}"
	AC_PROG_CC
	CFLAGS=`echo $CFLAGS | sed 's/-DMU_AUTOKLUDGE//'`

	dnl
	dnl We must call AC_ISC_POSIX before AC_TRY_COMPILE or we
	dnl get some warnings.
	dnl
	AC_ISC_POSIX

	dnl
	dnl Check for debug options.
	dnl
	mu_debug=${DEBUGFLAG:--g}
	AC_ARG_ENABLE(debug,
	[  --enable-debug          turn on debugging [default=no]], [
		if test "x${enable_debug}" != "xyes"; then
			mu_debug=""
		fi
	], [
		mu_debug=""
	])
	if test "x${mu_debug}" != "x"; then
		dnl
		dnl We could end up with multiple -g's in here but I really
		dnl don't care, if the compiler ends up caring then too bad,
		dnl so there!
		dnl
		CFLAGS="$mu_debug $CFLAGS"
	fi

	dnl
	dnl Check for various optimization settings.
	dnl
	mu_opt="yes"
	AC_ARG_ENABLE(optimize,
	[  --enable-optimize       turn on optimization [default=yes]],
		if test "x$enable_optimize" = "xno"; then
			mu_opt="no"
		fi
	)
	if test "x${mu_opt}" != "xyes"; then
		OPTFLAG=""
		mu_opt_works="no"
	elif test "x${OPTFLAG}" != "x"; then
		dnl
		dnl They've specified a specific optimization flag so we'll be
		dnl nice and use it (besides, the docs say we will and matching
		dnl the docs is generally a good idea).
		dnl
		CFLAGS="$OPTFLAG $CFLAGS"
		mu_opt_works="yes"
	else
		dnl
		dnl We try -O2 before -xO2 since -O2 will usually work and gcc
		dnl seems to just warn that "language O2 is unknown" with -xO2
		dnl but the compile doesn't fail, sigh.  Hopefully Sun's
		dnl compiler will fail with -O2 so that we can pick up -xO2.
		dnl
		mu_cflags="$CFLAGS"
		mu_opt_works="no"
		for OPTFLAG in -O2 -xO2 -O ""; do
			if test $mu_opt_works != "yes"; then
				CFLAGS="$OPTFLAG $mu_cflags"
				AC_TRY_COMPILE([],[],
					mu_opt_works=yes,
					mu_opt_works=no
				)
			fi
		done
	fi

	dnl
	dnl If we've got an optimization flag but no debug flag, then
	dnl we want to strip the final binaries.
	dnl
	if test "x${mu_opt_works}" != "x"; then
		if test "x${mu_debug}" = "x"; then
			LDFLAGS="${STRIPFLAG:--s} $LDFLAGS"
		fi
	fi
])

dnl
dnl MU_FIND_PNM
dnl -----------
dnl
dnl Find netpbm libraries and headers
dnl Put include directory in pnm_includes,
dnl put library directory in pnm_libraries,
dnl and add appropriate flags to X_CFLAGS and PNM_LIBS.
dnl
dnl Based on DDD's Motif finding code.
dnl
AC_DEFUN(MU_FIND_PNM, [
	pnm_includes=
	pnm_libraries=
	AC_ARG_WITH(pnm-includes, [  --with-pnm-includes=DIR        netpbm include files are in DIR], pnm_includes="$withval")
	AC_ARG_WITH(pnm-libraries, [  --with-pnm-libraries=DIR       netpbm libraries are in DIR], pnm_libraries="$withval")

	AC_MSG_CHECKING(for netpbm)

	##
	## Headers first.
	##

	if test "$pnm_includes" = ""; then
		AC_CACHE_VAL(mu_cv_pnm_includes, [
			mu_pnm_save_LIBS="$LIBS"
			mu_pnm_save_CFLAGS="$CFLAGS"
			mu_pnm_save_CPPFLAGS="$CPPFLAGS"
			mu_pnm_save_LDFLAGS="$LDFLAGS"

			CFLAGS="$X_CFLAGS $CFLAGS"
			CPPFLAGS="$X_CFLAGS $CPPFLAGS"
			LDFLAGS="$X_LDFLAGS $LDFLAGS"

			AC_TRY_COMPILE([#include <pbm.h>], [int a;], [
				##
				## Headers are in the standard include path.
				##
				mu_cv_pnm_includes=
			], [
				##
				## pbm.h is not in the standard search path.
				## Locate it and put its directory in
				## `pnm_includes'.  We look in all kinds
				## of places.
				##
				for dir in "${prefix}/include" \
						/usr/include \
						/usr/local/include \
						/usr/include/Motif* \
						/usr/include/X11* \
						/usr/dt/include \
						/usr/openwin/include \ \
						/usr/dt/*/include \
						/opt/*/include \
						"${prefix}"/*/include \
						/usr/*/include \
						/usr/local/*/include \
						"${prefix}"/include/* \
						/usr/include/* \
						/usr/local/include/*; do
					if test -f "$dir/pbm.h"; then
						mu_cv_pnm_includes="$dir"
						break
					fi
				done
				if test "$mu_cv_pnm_includes" = ""; then
					mu_cv_pnm_includes=no
				fi
			])

			LIBS="$mu_pnm_save_LIBS"
			CFLAGS="$mu_pnm_save_CFLAGS"
			CPPFLAGS="$mu_pnm_save_CPPFLAGS"
			LDFLAGS="$mu_pnm_save_LDFLAGS"
		])
		pnm_includes="$mu_cv_pnm_includes"
	fi

	##
	## And now for the libraries.
	##
	if test "$pnm_libraries" = ""; then
		AC_CACHE_VAL(mu_cv_pnm_libraries, [
			mu_pnm_save_LIBS="$LIBS"
			mu_pnm_save_CFLAGS="$CFLAGS"
			mu_pnm_save_CPPFLAGS="$CPPFLAGS"
			mu_pnm_save_LDFLAGS="$LDFLAGS"

			LIBS="-lpbm $LIBS"
			CFLAGS="$X_CFLAGS $CFLAGS"
			CPPFLAGS="$X_CFLAGS $CPPFLAGS"
			LDFLAGS="$X_LDFLAGS $LDFLAGS"

			AC_TRY_LINK([
				#include <pbm.h>
			], [pbm_init((int *)0, (char **)0);], [
				##
				## libpbm is in the standard search path.
				##
				mu_cv_pnm_libraries=
			], [
				##
				## libpbm.a is not in the standard search path.
				## Locate it and put its directory in
				## `pnm_libraries'.
				##
				for dir in "${prefix}/lib" \
						/usr/lib \
						/usr/local/lib \
						/usr/lib/Motif* \
						/usr/lib/X11* \
						/usr/dt/lib \
						/usr/openwin/lib \
						/usr/dt/*/lib \
						/opt/*/lib \
						/usr/lesstif*/lib \
						/usr/lib/Lesstif* \
						"${prefix}"/*/lib \
						/usr/*/lib \
						/usr/local/*/lib \
						"${prefix}"/lib/* \
						/usr/lib/* \
						/usr/local/lib/*; do
					if test -d "$dir" \
					&& test "`ls $dir/libpbm.* 2>/dev/null`" != ""; then
						mu_cv_pnm_libraries="$dir"
						break
					fi
				done
				if test "$mu_cv_pnm_libraries" = ""; then
					mu_cv_pnm_libraries=no
				fi
			])
			LIBS="$mu_pnm_save_LIBS"
			CFLAGS="$mu_pnm_save_CFLAGS"
			CPPFLAGS="$mu_pnm_save_CPPFLAGS"
			LDFLAGS="$mu_pnm_save_LDFLAGS"
		])
		pnm_libraries="$mu_cv_pnm_libraries"
	fi

	##
	## Add netpbm definitions to X flags.
	##

	if test "$pnm_includes" != "" \
	&& test "$pnm_includes" != "$x_includes" \
	&& test "$pnm_includes" != "no"; then
		X_CFLAGS="-I$pnm_includes $X_CFLAGS"
	fi

	PNM_LIBS=""
	if test "$pnm_libraries" != "" \
	&& test "$pnm_libraries" != "$x_libraries" \
	&& test "$pnm_libraries" != "no"; then
		PNM_LIBS="-L$pnm_libraries"
	fi

	pnm_libraries_result="$pnm_libraries"
	pnm_includes_result="$pnm_includes"

	if test "$pnm_libraries_result" = ""; then
		pnm_libraries_result="in default path"
	elif test "$pnm_libraries_result" = "no"; then
		pnm_libraries_result="(none)"
	fi
	if test "$pnm_includes_result" = ""; then
		pnm_includes_result="in default path"
	elif test "$pnm_includes_result" = "no"; then
		pnm_includes_result="(none)"
	fi
	AC_MSG_RESULT([libraries $pnm_libraries_result, headers $pnm_includes_result])
])dnl

# Do all the work for Automake.  This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.

# serial 1

dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])

AC_DEFUN(AM_INIT_AUTOMAKE,
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
AC_SUBST(VERSION)
dnl test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
ifelse([$3],,
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])

#
# Check to make sure that the build environment is sane.
#

AC_DEFUN(AM_SANITY_CHECK,
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftestfile
# Do `set' in a subshell so we don't clobber the current shell's
# arguments.  Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
   if test "[$]*" = "X"; then
      # -L didn't work.
      set X `ls -t $srcdir/configure conftestfile`
   fi
   if test "[$]*" != "X $srcdir/configure conftestfile" \
      && test "[$]*" != "X conftestfile $srcdir/configure"; then

      # If neither matched, then we have a broken ls.  This can happen
      # if, for instance, CONFIG_SHELL is bash and it inherits a
      # broken ls alias from the environment.  This has actually
      # happened.  Such a system could not be considered "sane".
      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
alias in your environment])
   fi

   test "[$]2" = conftestfile
   )
then
   # Ok.
   :
else
   AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])

dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN(AM_MISSING_PROG,
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf.  Sigh.
if ($2 --version) < /dev/null > /dev/null 2>&1; then
   $1=$2
   AC_MSG_RESULT(found)
else
   $1="$3/missing $2"
   AC_MSG_RESULT(missing)
fi
AC_SUBST($1)])

# Define a conditional.

AC_DEFUN(AM_CONDITIONAL,
[AC_SUBST($1_TRUE)
AC_SUBST($1_FALSE)
if $2; then
  $1_TRUE=
  $1_FALSE='#'
else
  $1_TRUE='#'
  $1_FALSE=
fi])