File: configure

package info (click to toggle)
elvis 2.1i-3
  • links: PTS
  • area: non-free
  • in suites: hamm
  • size: 4,120 kB
  • ctags: 5,838
  • sloc: ansic: 53,854; sh: 811; makefile: 263
file content (693 lines) | stat: -rwxr-xr-x 17,246 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
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
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
#!/bin/sh

# This is a UNIX shell script that generates a custom "Makefile" file and
# a "config.h" file.
#
# usage: configure [[flags] system]
#
# flags: --with-x[=no]		enable/disable support for X-windows interface
#	 --without-x		disable support for X-windows interface
#	 --with-gcc[=no]	enable/disable use of GCC
#	 --without-gcc		disable use of GCC
#	 --x-includes=DIR	add DIR to path for X-windows include files
#	 --x-libraries=DIR	add DIR to path for X-windows libraries
#        --libs=STRING		define the non-X11 part of the LIBS= line
#	 --bindir=DIR		where to install the executables
#	 --datadir=DIR		where to install the supporting data files
#	 --ioctl=VARIETY	type of tty ioctl to use: termios, termio, sgtty
#
# system: *one* of the following...
#	 linux			UNIX clone for IBM clones
#	 sunos			Sun's Ancient SunOS variant of BSD
#	 solaris		Sun's OLDER Solaris systems
#	 solaris2		Sun's NEWER Solaris 2 systems
#	 aix			IBM's variant of POSIX
#	 osf-1			DEC's variant of POSIX
#	 ultrix			DEC's variant of BSD
#	 hp-ux			HP's variant of POSIX
#	 qnx			QNX's POSIXish real-time operating system
#	 irix			SGI's variant of POSIX
#	 xenix			ancient SCO Xenix-386 systems
#	 sco			SCO UNIX or Open Desktop systems
#	 bsd			typical BSD implementations
#	 freebsd		freebsd is a specific BSD implementation
#	 posix			generic POSIX implementations
#        (anything else)	generic UNIX, including SysV
# If no system is specified, this script will attempt to obtain the system
# type by running the "uname" command.  If it can't recognize the system name
# returned by "uname", then it uses generic UNIX settings.  The script also
# inspects the files on your system to refine those settings, so it'll still
# work okay, usually.

# Set some defaults
XINCPATH="/usr/include /usr/include/X11 /usr/X11/include /usr/local/X11/include /usr/openwin/include /usr/X11R6/include"
XLIBPATH="/lib /usr/lib /usr/X11/lib /usr/local/X11/lib /usr/openwin/lib /usr/X11R6/lib "`echo "$LD_LIBRARY_PATH" | tr ':' ' '`
GNUPATH=`echo "$PATH" | tr ':' ' '`
BINDIR=/usr/local/bin
LIBDIR=/usr/local/lib/elvis
SYS=`uname | tr '[A-Z]' '[a-z]'`
DEFAULT_CC="cc -O"
IOCTL=""

# Initialize some variables.  These aren't merely defaults; don't change them!
args=""
XLIBS=""

# Solaris 2 masquerades as SunOS.  Check for that, by examining the
# release number.
if [ "$SYS" = sunos ]
then
	case `uname -r` in
	  [5-9]*)	SYS=solaris2	;;
	esac
fi

# Ultrix has a broken /bin/sh; it doesn't support shell functions.  Try to be
# clever about running bash instead of /bin/sh there.
if [ "$SYS" = ultrix ]
then
	case "$0" in
	  *configure)
		(echo set - "$@"; cat configure) | bash
		exit 0
		;;
	esac
fi

# This function is used to look for a file in a path. $1 is the name of the
# file, and the remaining args are the path.  It write the absolute file file
# to stdout if successful
searchpath()
{
	file=$1
	shift
	for i
	do
		if [ -f $i/$file ]
		then
			echo $i/$file
			return
		fi
	done
}

# This function outputs a usage message, and then exits
usage()
{
	echo "usage: configure [[flags] system]"
	echo "flags: --with-x[=no]      enable/disable support for X-windows interface"
	echo "       --without-x        disable support for X-windows interface"
	echo "       --with-gcc[=no]    enable/disable use of GCC"
	echo "       --without-gcc      disable use of GCC"
	echo "       --x-includes=DIR   add DIR to path for X-windows include files"
	echo "       --x-libraries=DIR  add DIR to path for X-windows libraries"
	echo "       --bindir=DIR       where to install the executables"
	echo "       --datadir=DIR      where to install the supporting data files"
	echo "       --libs=STRING      non-X11 part of the LIBS= string in Makefile"
	echo "       --ioctl=VARIETY    type of tty ioctl to use: termios, termio, or sgtty"
	echo "system: linux, sunos, solaris, solaris2, freebsd, bsd, posix, aix, osf-1,"
	echo "        ultrix, hp-ux, qnx, irix, xenix, sco (meaning SCO Unix or Open Desktop)"
	if [ "$*" ]
	then
		echo "$*"
	fi
	exit
}

# Check the arguments
for i
do
	case "$i" in
	  --with-x=no|--without-x)
		GUI_X11=undef
		args="$args --with-x=no"
		;;
	  --with-x*)
		GUI_X11=define
		args="$args --with-x"
		;;
	  --with-gcc=no|--without-gcc)
		gnu=n
		args="$args --with-gcc=no"
		;;
	  --with-gcc*)
		gnu=y
		args="$args --with-gcc"
		;;
	  --x-includes=*)
		XINCPATH=`echo "$i"|sed 's/^--x-includes=//'`" $XINCPATH"
		args="$args $i"
		;;
	  --x-libraries=*)
		XLIBPATH=`echo "$i"|sed 's/^--x-libraries=//'`" $XLIBPATH"
		args="$args $i"
		;;
	  --bindir=*)
		BINDIR=`echo "$i"|sed 's/^--bindir=//'`
		args="$args $i"
		;;
	  --datadir=*)
		LIBDIR=`echo "$i"|sed 's/^--datadir=//'`
		args="$args $i"
		;;
	  --libs=*)
		LIBS=`echo "$i"|sed 's/^--libs=//'`
		# added to args later
		;;
	  --ioctl=termios|--ioctl=termio|--ioctl=sgtty)
		IOCTL=`echo "$i"|sed 's/^--ioctl=//'`
		args="$args $i"
		;;
	  --ioctl=*)
		usage "bad --ioctl value; must be termios, termio, or sgtty"
		;;
	  --help|-\?)
		usage
		;;
	  --*)
		# Ignore other --symbol flags
		;;
	  -*)
		usage invalid option $i
		;;
	  *)
		SYS="$i"
		;;
	esac
done

# Try to locate some files
inet=`searchpath netinet/in.h $XINCPATH`
xinc=`searchpath X11/Xresource.h $XINCPATH`
xlib=`searchpath libX11.a $XLIBPATH`
if [ "$xlib" = "" ]
then
	xlib = `searchpath libX11.so.* $XLIBPATH`
fi
case "$CC" in
  "")	CC="$DEFAULT_CC"
	case "$gnu" in
	  y|"")	gnu=`searchpath gcc $GNUPATH`
		;;
	esac
	;;
esac
case "$gnu" in
 y|n)	gnu="" ;;
esac

# If X-windows is unspecified, and the X files are present, then assume with-x
if [ "$GUI_X11" = "" -a "$xinc" ]
then
	GUI_X11=define
	args="$args --with-x"
elif [ "$GUI_X11" = "" ]
then
	GUI_X11=undef
	args="$args --with-x=no"
fi

# if network protocols are unspecified, and the network header files are
# present, then assume they should be used.
if [ "$PROTOCOL_HTTP" = "" -a "$inet" ]
then
	PROTOCOL_HTTP=define
elif [ "$PROTOCOL_HTTP" = "" ]
then
	PROTOCOL_HTTP=undef
fi
if [ "$PROTOCOL_FTP" = "" -a "$inet" ]
then
	PROTOCOL_FTP=define
elif [ "$PROTOCOL_FTP" = "" ]
then
	PROTOCOL_FTP=undef
fi

################################################################################


# Check for some known system quirks
if [ -f /usr/include/sys/ptem.h ]
then
	NEED_WINSIZE=define
fi
if [ -f /usr/include/termcap.h ]
then
	NEED_SPEED_T=define
fi
if [ -f /usr/include/sys/wait.h ]
then
	NEED_WAIT_H=define
fi
if [ -f /usr/include/sys/select.h ]
then
	NEED_SELECT_H=define
fi
if [ -f /usr/include/sys/ioctl.h ]
then
	NEED_IOCTL_H=define
fi
if [ -f /usr/include/netinet/in.h ]
then
	NEED_IN_H=define
fi
if [ -f /usr/include/sys/socket.h ]
then
	NEED_SOCKET_H=define
fi
if [ X"$xinc" != X ]
then
	if [ -f `dirname $xinc`/Xos.h ]
	then
		NEED_XOS_H=define
	fi
fi
if fgrep setpgid /usr/include/unistd.h >/dev/null 2>/dev/null
then
	NEED_SETPGID=undef
else
	NEED_SETPGID=define
fi
if fgrep XrmCombineFileDatabase $xinc </dev/null >/dev/null
then
	NEED_XRMCOMBINEFILEDATABASE=undef
else
	NEED_XRMCOMBINEFILEDATABASE=define
fi
if fgrep inet_aton /usr/include/arpa/inet.h </dev/null >/dev/null
then
	NEED_INET_ATON=undef
else
	NEED_INET_ATON=define
fi
if fgrep memmove /usr/include/string*.h </dev/null >/dev/null
then
	NEED_MEMMOVE=undef
else
	NEED_MEMMOVE=define
fi
case "$IOCTL" in
  termios)	USE=			;;
  termio)	USE=" -DUSE_TERMIO"	;;
  sgtty)	USE=" -DUSE_SGTTY"	;;
  *)
	if [ -f /usr/include/termios.h ]
	then
		USE=
		args="$args --ioctl=termios"
	else
		if [ -f /usr/include/termio.h ]
		then
			USE=" -DUSE_TERMIO"
			args="$args --ioctl=termio"
		else
			USE=" -DUSE_SGTTY"
			args="$args --ioctl=sgtty"
		fi
	fi
	;;
esac
case "$SYS" in
  *aix*)
	# Because the termcap database has no entry for xterm
	TLIBS="-lcurses"
	;;
  *linux*)
	if [ ! -f /usr/lib/libtermcap.a -a ! -f /lib/libtermcap.a ]
	then
		if [ -f /usr/lib/libncurses.a -o -f /usr/lib/ncurses.a ]
		then
			TLIBS="-lncurses"
		else
			TLIBS="-lcurses"
		fi
	fi
	;;
  *osf*)
	NEED_TGETENT=define
	#TLIBS="-lucb -lcurses"
	TLIBS="-ltermcap"
	;;
  *ultrix*)
	CC="cc -std"
	NEED_STRDUP=define
	TLIBS="-lcurses -ltermcap"
	if [ "$GUI_X11" = "define" ]
	then
		XLIBS=" -ldnet"
	fi
	;;
  *hp-ux*)
	CC="cc -Ae"
	gnu=""
	NEED_OSPEED=define
	TLIBS="-lcurses -ltermcap"
	;;
  *solaris2*)
	CC="cc -O -Dconst="
	TLIBS="-lcurses"
	if [ "$GUI_X11" = "define" ]
	then
		XLIBS=" -lsocket -lnsl"
		xlibdir=`dirname "$xlib"`
		XLIBS=" -R$xlibdir$XLIBS"
	fi
	;;
  *solaris*)
	# This is only for old solaris systems
	CC="cc -O -Dconst="
	TLIBS="-L/usr/ucblib -lucb -lcurses -ltermcap"
	;;
  *sunos*)
	CC="cc -O -Dconst="
	TLIBS="-ltermcap"
	;;
  *sco*)
	tmp=`searchpath icc $GNUPATH`
	if [ "$tmp" ]
	then
		CC="icc"
		# but it may be overridden by gcc
	fi
	if [ "$GUI_X11" = "define" ]
	then
		XLIBS=" -lsocket"
	fi
	;;
  *xenix*)
	TLIBS="-lx -ltermcap"
	if [ "$GUI_X11" = "define" ]
	then
		XLIBS=" -lsocket"
	fi
	;;
  *freebsd*)
	;;
  *bsd*)
	tmp=`searchpath shlicc2 $GNUPATH`
	if [ "$tmp" ]
	then
		CC="shlicc2"
		gnu=""
	fi
	if [ "$GUI_X11" = "define" ]
	then
		XLIBS=" -lipc"
	fi
	;;
  *irix*)
  	# If "cc" in installed, use it in preference to "gcc"
	tmp=`searchpath cc $GNUPATH`
	if [ "$tmp" ]
	then
		CC="cc"
		gnu=""
	fi
esac
if [ -f /usr/bin/lp ]
then
	LPOUT="!lp -s"
fi

# Add non-X11 libraries to args via the --libs=... flag
if [ "$TLIBS" ]
then
	args="$args --libs='$TLIBS'"
fi

# If "gcc" is available, and CC didn't come from environment variables, then
# use "gcc" instead of plain old "cc"
if [ "$gnu" ]
then
	CC="gcc -O2"
fi

################################################################################

# Save these arguments in a "config.stat" script
echo exec configure $args $SYS >config.stat

# Tell the user what we discovered
echo "System:   $SYS"
echo "Options: $args"
echo "Compiler: $CC"

################################################################################

#Set some options that'll be used in the here-files below
CC="$CC$USE"
if [ "$GUI_X11" = "define" ]
then
	case "$xlib" in
	  /lib/libX11.a|/usr/lib/libX11.a|"")
		XLIBS="-lX11$XLIBS"
		;;
	  *)
		XLIBS="-L`echo $xlib | sed 's/\/libX11.a$//'` -lX11$XLIBS"
		;;
	esac
	case "$xinc" in
	  /usr/include/X11/Xresource.h)
		;;
	  *)
		CC="$CC -I"`echo $xinc | sed 's/X11\/Xresource.h$//'`
		;;
	esac
fi
if [ "$LIBS" = "" ]
then
	LIBS=${TLIBS:--ltermcap}
fi
case "$LIBS" in
  *ncurses*) NEED_BC=undef;;
  *)	     NEED_BC=define;;
esac


################################################################################


# Generate the "config.h" file
cat >config.h <<eof-config
/* config.h */

/* Originally, this file was automatically generated by the "configure"
 * shell script.
 *
 * This file contains C macro definitions which indicate which features
 * are to be supported, and which library functions are to be emulated.
 * In general, #define enables the feature or emulating function, and
 * #undef disables the feature or causes the library function to be used.
 */


/* The following determine which user interfaces are to be supported */
#${GUI_X11:-undef}	GUI_X11		/* simple X-windows interface */
#undef	GUI_CURSES	/* curses interface */
#define	GUI_TERMCAP	/* termcap interface */
#define	GUI_OPEN	/* open-mode only, does nothing fancy */
#undef	GUI_MFC  	/* MS-Windows gui interface */


/* These allow you to selectively disable the display modes, network protocols,
 * and other optional features.  If you disable the markup display modes then
 * the :help command is disabled because it depends on the "html" markup display
 * mode.  #define to enable the mode, #undef to exclude it.
 */
#define	DISPLAY_HEX	/* hex		interactive hex dump */
#define	DISPLAY_MARKUP	/* html/man/tex	formatted text */
#define	DISPLAY_SYNTAX	/* syntax	generic syntax coloring */
#${PROTOCOL_HTTP}	PROTOCOL_HTTP	/* define to enable HTTP; undef to disable */
#${PROTOCOL_FTP}	PROTOCOL_FTP	/* define to enable FTP; undef to disable */
#define	FEATURE_SHOWTAG	/* the showtag option */
#define	FEATURE_LPR	/* the :lpr command */
#define	FEATURE_ALIAS	/* the :alias command */
#define	FEATURE_MKEXRC	/* the :mkexrc command */


/* The following provide custom implementation of some common functions which
 * are either missing or poorly implemented on some systems.
 */
#undef	NEED_ABORT	/* replaces abort() with a simpler macro */
#undef	NEED_ASSERT	/* defines a custom assert() macro */
#${NEED_TGETENT:-undef}	NEED_TGETENT	/* causes tinytcap.c to be used instead of library */
#${NEED_WINSIZE:-undef}	NEED_WINSIZE	/* includes <ptem.h> -- required by SCO */
#${NEED_SPEED_T:-undef}	NEED_SPEED_T	/* includes <termcap.h> -- common on POSIX systems */
#${NEED_STRDUP:-undef}	NEED_STRDUP	/* uses a custom version of strdup() */
#${NEED_MEMMOVE:-undef}	NEED_MEMMOVE	/* uses a custom version of memmove() */
#${NEED_OSPEED:-undef}	NEED_OSPEED	/* causes guitcap.c to supply an ospeed variable */
#${NEED_BC:-undef}	NEED_BC		/* causes guitcap.c to supply a BC variable */
#${NEED_SETPGID:-undef}	NEED_SETPGID	/* use setpgrp() instead of setpgid() */
#define	NEED_CTYPE	/* uses a custom <ctype.h>, driven by :digraph */
#${NEED_WAIT_H:-undef}	NEED_WAIT_H	/* must include <sys/wait.h> */
#${NEED_SELECT_H:-undef}	NEED_SELECT_H	/* must include <sys/select.h> */
#${NEED_IOCTL_H:-undef}	NEED_IOCTL_H	/* must include <sys/ioctl.h> */
#${NEED_XOS_H:-undef}	NEED_XOS_H	/* must include <X11/Xos.h> */
#${NEED_IN_H:-undef}	NEED_IN_H	/* must include <netinet/in.h> */
#${NEED_SOCKET_H:-undef}	NEED_SOCKET_H	/* must include <sys/socket.h> */
#${NEED_XRMCOMBINEFILEDATABASE:-undef}	NEED_XRMCOMBINEFILEDATABASE	/* X11R4 needs this */
#${NEED_INET_ATON:-undef}	NEED_INET_ATON	/* SunOS & Solaris need this */

/* The following control debugging features.  NDEBUG slows elvis down a lot,
 * and the others tend to make it output some confusing messages, so these
 * are all disabled by default.  (Note that NDEBUG is #define'd to disable it)
 */
#define	NDEBUG		/* undef to enable assert() calls; define to disable */
#undef	DEBUG_ALLOC	/* define to debug memory allocations; undef to disable */
#undef	DEBUG_SCAN	/* define to debug character scans; undef to disable */
#undef	DEBUG_SESSION	/* define to debug the block cache; undef to disable */
#undef	DEBUG_EVENT	/* define to trace events; undef to disable */
#undef	DEBUG_MARKUP	/* define to debug markup display modes */



/* The following macros, and their values, are mostly used to determine the
 * default values of some options.
 */
#define	OSLPOUT	"${LPOUT:-!lpr}"	/* default value of lpout option */
#define OSLIBPATH "~/.elvislib:/etc/elvis:${LIBDIR}:/usr/doc/elvis"	/* default elvispath */
eof-config


################################################################################


# Generate a sed script for converting "Makefile.in" to "Makefile"
tmp=mfsed.$$
case "$SYS" in

*sunos*)
cat >$tmp <<eof-sunos
s!^# Makefile.in\$!# Makefile - configured for $SYS!
s!^CC=.*!CC=$CC -DUSE_SGTTY!
eof-sunos
;;

*solaris*)
cat >$tmp <<eof-solaris
s!^# Makefile.in\$!# Makefile - configured for $SYS!
s!^CC=.*!CC=$CC!
eof-solaris
;;

*osf*)
cat >$tmp <<eof-osf
s!^# Makefile.in\$!# Makefile - configured for $SYS!
s!^CC=.*!CC=$CC!
eof-osf
;;

*ultrix*)
cat >$tmp <<eof-ultrix
s!^# Makefile.in\$!# Makefile - configured for $SYS!
s!^CC=.*!CC=$CC!
eof-ultrix
;;

*hp-ux*)
cat >$tmp <<eof-hp-ux
s!^# Makefile.in\$!# Makefile - configured for $SYS!
s!^CC=.*!CC=$CC!
eof-hp-ux
;;

*linux*)
cat >$tmp <<eof-linux
s!^# Makefile.in\$!# Makefile - configured for $SYS!
s!^CC=.*!CC=$CC!
s!^ALL=.*!ALL=elvis\$(EXE) ref\$(EXE) ctags\$(EXE) fmt\$(EXE)!
eof-linux
;;

*sco*)
cat >$tmp <<eof-sco
s!^# Makefile.in\$!# Makefile - configured for $SYS!
s!^CC=.*!CC=$CC!
eof-sco
;;

*xenix*)
cat >$tmp <<eof-xenix
s!^# Makefile.in\$!# Makefile - configured for $SYS!
s!^CC=.*!CC=$CC!
eof-xenix
;;

*bsd*)
cat >$tmp <<eof-bsd
s!^# Makefile.in\$!# Makefile - configured for $SYS!
s!^CC=.*!CC=$CC!
eof-bsd
;;

*qnx*)
cat >$tmp <<eof-qnx
s!^# Makefile.in\$!# Makefile - configured for $SYS!
s!^CC=.*!CC=$CC -D_POSIX_SOURCE!
eof-qnx
;;

*aix*)
cat >$tmp <<eof-aix
s!^# Makefile.in\$!# Makefile - configured for $SYS!
s!^CC=.*!CC=$CC -D_BSD!
eof-aix
;;

*)
cat >$tmp <<eof-generic
s!^# Makefile.in\$!# Makefile - configured for generic Unix!
s!^CC=.*!CC=$CC!
eof-generic
;;

esac
cat >>$tmp <<eof-all
s!^LIBS=.*!LIBS=$XLIBS $LIBS!
s!^BINDIR=.*!BINDIR=$BINDIR!
s!^LIBDIR=.*!LIBDIR=$LIBDIR!
eof-all

# Run "Makefile.in" through that sed script, to produce "Makefile"
sed -f $tmp Makefile.in >Makefile && rm $tmp

# Some parting advice
case "$SYS" in
  *solaris*|*sunos*)
	if [ "$GUI_X11" = "define" ]
	then
		xlibdir=`dirname "$xlib"`
		case "$LD_LIBRARY_PATH" in
		  *X11*|*openwin*)
			# Probably do nothing
			;;
		  "")
			# set path = xlibdir
			echo "You *may* need to..."
			echo
			case "$SHELL" in
			  *csh)
			  	echo "     setenv LD_LIBRARY_PATH=$xlibdir"
				;;
			  *)
				echo "     LD_LIBRARY_PATH=$xlibdir"
				echo "     export LD_LIBRARY_PATH"
				;;
			esac
			echo
			echo "... before you can run elvis, but try running it without doing that first."
			;;
		  *)
			# add xlibdir to path
			echo "You may need to..."
			echo
			echo "     LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:$xlibdir"
			echo "     export LD_LIBRARY_PATH"
			echo
			echo "... before you can run elvis"
			;;
		esac
	fi
	;;
esac