File: install.pl

package info (click to toggle)
mnogosearch 3.3.7-3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 17,484 kB
  • ctags: 4,565
  • sloc: ansic: 94,097; xml: 16,864; sh: 8,915; makefile: 1,727; perl: 801; php: 561; sql: 15
file content (939 lines) | stat: -rwxr-xr-x 23,284 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
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
#!/usr/bin/perl
# $Source: /home/bar/cvsroot/mnogosearch33/install.pl,v $
# $Id: install.pl,v 1.7 2006/02/25 16:50:49 bar Exp $

use Cwd 'abs_path';

$prefix="/usr/local/mnogosearch";

$builtin='no';
$auto='yes';
$db='';
$db_string='';

$build_shared='no';
$build_static='yes';

$syslog='yes';
$syslog_facility='default';

$docs='no';
$pthreads='yes';
$parser='yes';
$mp3='yes';
$dmalloc='no';
$zlib='yes';

$file='yes';
$http='yes';
$ftp='yes';
$htdb='yes';
$news='yes';
$ssl='no';
$ssl_dir='';

$conf_file='install.options';

$|=1;

print "mnoGoSeach installation script version 0.4\n\n";

set_layout();
set_db(); print "\n";
set_libs(); print "\n";
set_syslog(); print "\n";
set_shema(); print "\n";
set_other(); print "\n";

configure();

# ---------------------------
# configure
# ---------------------------
sub configure {
	push @arg,"./configure";
	push @arg,"--prefix=$prefix";
        push @arg,"--bindir=$bindir";
	push @arg,"--sbindir=$sbindir";
        push @arg,"--sysconfdir=$sysconfdir";
        push @arg,"--localstatedir=$localstatedir";
        push @arg,"--libdir=$libdir";
	push @arg,"--includedir=$includedir";
        push @arg,"--mandir=$mandir";

        if ($build_shared eq 'yes') {
        	push @arg,"--enable-shared";
        } elsif ($build_shared eq 'no') {
        	push @arg,"--disable-shared";
	}

        if ($build_static eq 'yes') {
        	push @arg,"--enable-static";
        } elsif ($build_shared eq 'no') {
        	push @arg,"--disable-static";
	}


        if ($syslog eq 'yes') {
        	if ($syslog_facility ne 'default') {
        		push @arg,"--enable-syslog=$syslog_facility";
        	} else {
        		push @arg,"--enable-syslog";
        	}
        } elsif ($syslog eq 'no') {
        	push @arg,"--disable-syslog";
	}

        if ($ssl eq 'yes') {
        	if ($ssl_dir ne '') {
        		push @arg,"--with-openssl=$ssl_dir";
        	} else {
        		push @arg,"--with-openssl";
        	}
        }

        if ($docs eq 'yes') {
        	push @arg,"--with-docs";
        } elsif ($docs eq 'no') {
        	push @arg,"--without-docs";
	}

        if ($pthreads eq 'yes') {
        	push @arg,"--enable-pthreads";
        } elsif ($pthreads eq 'no') {
        	push @arg,"--disable-pthreads";
	}

        if ($dmalloc eq 'yes') {
        	push @arg,"--enable-dmalloc";
        } elsif ($dmalloc eq 'no') {
        	push @arg,"--disable-dmalloc";
	}

        if ($parser eq 'yes') {
        	push @arg,"--enable-parser";
        } elsif ($parser eq 'no') {
        	push @arg,"--disable-parser";
	}

        if ($mp3 eq 'yes') {
        	push @arg,"--enable-mp3";
        } elsif ($mp3 eq 'no') {
        	push @arg,"--disable-mp3";
	}

        if ($zlib eq 'no') {
        	push @arg,"--without-zlib";
        }

        if ($file eq 'yes') {
        	push @arg,"--enable-file";
        } elsif ($file eq 'no') {
        	push @arg,"--disable-file";
	}

        if ($http eq 'yes') {
        	push @arg,"--enable-http";
        } elsif ($http eq 'no') {
        	push @arg,"--disable-http";
	}

        if ($ftp eq 'yes') {
        	push @arg,"--enable-ftp";
        } elsif ($ftp eq 'no') {
        	push @arg,"--disable-ftp";
	}

        if ($htdb eq 'yes') {
        	push @arg,"--enable-htdb";
        } elsif ($htdb eq 'no') {
        	push @arg,"--disable-htdb";
	}

        if ($news eq 'yes') {
        	push @arg,"--enable-news";
        } elsif ($news eq 'no') {
        	push @arg,"--disable-news";
	}

	$db_string=~s/^\s+//;
	$db_string=~s/\s+$//;
	@db_string=split(/\s+/,$db_string);
	
        push @arg,@db_string;

        print "@arg\n\n";
	
	open(CONF,">$conf_file") || die "Cannot create $conf_file\n";
	foreach $arg (@arg) {
		print CONF "$arg ";
	}
	print CONF "\n";
	close(CONF);	
	chmod(0755,$conf_file);
	
	system(@arg) == 0 or die "configure failed: $?";
	
	print "mnoGoSearch configured successfully\n";
	print "Now you should run 'make' then 'make install' to finish installation.\n";
	print "To configure package with the same options you can run ./$conf_file\n\n";
}

# ---------------------------
# set_db
# ---------------------------
sub set_db {
	print "Database settings\n";
	print "-----------------\n";
#	while () {
#		print "Include built-in database support? (Use for small sites) (yes/no) [$builtin]: ";
#		$temp=read_in();
#		if (($temp eq '') || ($temp eq $builtin)) {
#			last;			
#		} elsif (($temp eq 'yes') || ($temp eq 'no')) {
#			$builtin=$temp;
#			last;
#		}
#	}	
#	
#	if ($builtin eq 'yes') {
#		$db_string='--with-built-in';
#		return;
#	} else {
#		$db_string='';
#	}
	
	while () {
		print "Try to autodetect databases at known locations? (yes/no) [$auto]: ";
		$temp=read_in();
		if (($temp eq '') || ($temp eq $auto)) {
			last;			
		} elsif (($temp eq 'yes') || ($temp eq 'no')) {
			$auto=$temp;
			last;
		}
	}
	
	if ($auto eq 'yes') {
		print "\n";
		if ((-f "/usr/local/mysql/include/mysql/mysql.h") ||
		    (-f "/usr/include/mysql/mysql.h") ||
		    (-f "/usr/local/include/mysql/mysql.h") ||
		    (-f "/usr/include/mysql.h") ||
		    (-f "/usr/local/include/mysql.h")) {
		    	push @db_found2,1;
			$db{mysql}=1;
			print "MySQL server found\n";
		}
		
		if ((-f "/usr/include/pgsql/libpq-fe.h") ||
		         (-f "/usr/lib/libpq.a") ||
			 (-f "/usr/local/pgsql/include/libpq-fe.h") ||
		         (-f "/usr/local/pgsql/lib/libpq.a") ||
			 (-f "/usr/local/include/libpq-fe.h") ||
		         (-f "/usr/local/lib/libpq.a")) {
			push @db_found2,2;
			$db{pgsql}=1;
			print "PostgreSQL server found\n";
		}
		
		if ((-f "/usr/local/Hughes/include/msql.h") ||		
		         (-f "/usr/Hughes/include/msql.h") ||
			 (-f "/usr/local/include/msql.h") ||		
			 (-f "/usr/include/msql.h")) {
			push @db_found2,3;
			$db{msql}=1;
			print "mSQL server found\n";
		}
		
		if (-f "/opt/sybase/include/ctpublic.h") {
			push @db_found2,4;
			$db{ctlib}=1;
			print "Ct-Lib stuff found\n";
		}
		
		if (-f "/usr/local/include/ctpublic.h") {
			push @db_found2,5;
			$db{freetds}=1;
			print "FreeTDS Ct-Lib stuff found\n";
		}
		
		if ((-f "/usr/interbase/include/ibase.h") ||
			 (-f "/usr/local/interbase/include/ibase.h")) {
			push @db_found2,6;
			$db{ibase}=1;
			print "Interbase server found\n";
		}
		
		if (-f "$ENV{ORA_HOME}/rdbms/demo/ocidfn.h") {
			push @db_found2,7;
			$db{ora7}=1;
			print "Oracle 7.x server found\n";
		}
		
		if (-f "/oracle8/app/oracle/product/8.0.5/rdbms/demo/oci.h") {
			push @db_found2,8;
			$db{ora8}=1;
			print "Oracle 8.0.x server found\n";
		}
		
		if (-f "$ENV{ORA_HOME}/rdbms/demo/oci.h") {
			push @db_found2,9;
			$db{ora8i}=1;
			print "Oracle 8.x server found\n";
		}
		
		if ((-f "/usr/local/include/cli0cli.h") ||
		         (-f "/usr/include/cli0cli.h")) {
			push @db_found3,1; 
			print "Solid server found\n";			
		}
		
		if ((-f "/usr/sapdb/incl/sql.h") ||
			 (-f "/usr/local/sapdb/incl/sql.h")) {
			push @db_found3,2;
			print "SAPDB server found\n";			
		}
		
		if ((-f "/usr/local/include/isql.h") ||
			 (-f "/usr/include/isql.h")) {
			push @db_found,1;
			print "iODBC stuff found\n";
		}
		
		if ((-f "/usr/local/include/sql.h") ||
			 (-f "/usr/include/sql.h")) {
			push @db_found,2;
			print "unixODBC stuff found\n";
		}
		
		if ((-f "/usr/local/virtuoso-ent/odbcsdk/include/isql.h") ||
			 (-f "/usr/virtuoso-ent/odbcsdk/include/isql.h") ||
			 (-f "/usr/local/virtuoso-lite/odbcsdk/include/isql.h") ||
			 (-f "/usr/virtuoso-lite/odbcsdk/include/isql.h") ||
			 (-f "/usr/local/virtuoso/odbcsdk/include/isql.h") ||
			 (-f "/usr/virtuoso/odbcsdk/include/isql.h")) {
			push @db_found,3;
			print "OpenLink stuff found\n";
		}
		
		if ((-f "/usr/local/easysoft/oob/client/include/sql.h") ||
		         (-f "/usr/easysoft/oob/client/include/sql.h")) {
			push @db_found,4;
			print "EasySoft stuff found\n";
		} 

		if ((-f "/usr/local/include/sqlcli1.h") ||
		    (-f "/home/db2/include/sqlcli1.h")) {			 
			push @db_found,5;
			print "IBM DB2 stuff found\n";
		} 
		
		$db_found=@db_found;
		$db_found2=@db_found2;
		$db_found3=@db_found3;
		if (($db_found == 0) && ($db_found2 == 0) && ($db_found3 == 0)) {
			print "Sorry, no SQL servers at known locations was found\n";
		}
	}
	
	while () {
		print "\nWhich ODBC-style database support to include?\n";
		print "Note, that you may choose only one from the following.\n";
		
		print "  1 - Include iODBC support.\n";
		print "  2 - Include unixODBC support.\n";
		print "  3 - Include OpenLink ODBC support.\n";
		print "  4 - Include EasySoft ODBC support.\n";		
		print "  5 - Include IBM DB2 support.\n";		
		print "  6 - None of these.\n";		
		
		if ($db_found == 0) {
			$db='6';
		} else {
			$db=$db_found[0];
		}
		print "\nChoose one from the mentioned ($db): ";
		
		$temp=read_in();
		if ($temp eq '') {
			$temp=$db;
		}
		
		if ($temp eq '1') {
			if ($temp eq $db) {
				print "Enter iODBC base install directory [autodetect]: ";
			} else {
				print "Enter iODBC base install directory [/usr/local]: ";
			}
			
			$temp=read_in_nolc();
			if ($temp eq '') { $db_string .= " --with-iodbc "; } 
			else { $db_string .= " --with-iodbc=$temp "; }
			
			last;
		} elsif ($temp eq '2') {
			if ($temp eq $db) {
				print "Enter unixODBC base install directory [autodetect]: ";
			} else {
				print "Enter unixODBC base install directory [/usr/local]: ";
			}
			
			$temp=read_in_nolc();
			if ($temp eq '') { $db_string .= " --with-unixODBC "; } 
			else { $db_string .= " --with-unixODBC=$temp "; }
			
			last;
		} elsif ($temp eq '3') {
			if ($temp eq $db) {
				print "Enter OpenLink ODBC base install directory [autodetect]: ";
			} else {
				print "Enter OpenLink ODBC base install directory [/usr/local/virtuoso/odbcsdk]: ";
			}
			
			$temp=read_in_nolc();
			if ($temp eq '') { $db_string .= " --with-openlink "; } 
			else { $db_string .= " --with-openlink=$temp "; }
			
			last;
		} elsif ($temp eq '4') {
			if ($temp eq $db) {
				print "Enter EasySoft ODBC base install directory [autodetect]: ";
			} else {
				print "Enter EasySoft ODBC base install directory [/usr/local/easysoft/oob/client]: ";
			}
			
			$temp=read_in_nolc();
			if ($temp eq '') { $db_string .= " --with-easysoft "; } 
			else { $db_string .= " --with-easysoft=$temp "; }
			
			last;
		} elsif ($temp eq '5') {
			if ($temp eq $db) {
				print "Enter IBM DB2 base install directory [autodetect]: ";
			} else {
				print "Enter IBM DB2 base install directory [/home/db2]: ";
			}
			
			$temp=read_in_nolc();
			if ($temp eq '') { $db_string .= " --with-db2 "; } 
			else { $db_string .= " --with-db2=$temp "; }
			
			last;
		} elsif ($temp eq '6') {	
		    last;
		}
	}


	while () {
		print "\nWhich database support to include?\n";
		print "Note, that you can choose only one from these.\n";
		
		print "  1 - Include Solid support.\n";		
		print "  2 - Include SAPDB support.\n";
		print "  3 - None of these.\n";		
		
		if ($db_found3 == 0) {
			$db='3';
		} else {
			$db=$db_found3[0];
		}
		
		print "\nChoose one from the mentioned ($db):";
		
		$temp=read_in();
		if ($temp eq '') {
			$temp=$db;
		}
		
		if ($temp eq '1') {
			if ($temp eq $db) {
				print "Enter Solid base install directory [autodetect]: ";
			} else {
				print "Enter Solid base install directory [/usr/local]: ";
			}
			
			$temp=read_in_nolc();
			if ($temp eq '') { $db_string .= " --with-solid "; } 
			else { $db_string .= " --with-solid=$temp "; }
			
			last;
		} elsif ($temp eq '2') {
			if ($temp eq $db) {
				print "Enter SAPDB base install directory [autodetect]: ";				
			} else {
				print "Enter SAPDB base install directory [/usr/sapdb]: ";
			}
			
			$temp=read_in_nolc();
			if ($temp eq '') { $db_string .= " --with-sapdb "; } 
			else { $db_string .= " --with-sapdb=$temp "; }
			
			last;
		} elsif ($temp eq '3') {	
		    last;
		}
	}

	
        if ($db{mysql}) { $db_auto='yes'; }
	else {  $db_auto='no'; }
	print "Include MySQL support [$db_auto] ? ";	
	$temp=read_in();	
	if (($temp eq 'yes') || (($temp eq '') && ($db_auto eq 'yes'))) {
		if ($db{mysql}) {
			print "Enter MySQL base install directory [autodetect]: ";
		} else {
			print "Enter MySQL base install directory [/usr/local/mysql]: ";
		}
		$temp=read_in_nolc();
		if ($temp eq '') { $db_string .= " --with-mysql "; } 
		else { $db_string .= " --with-mysql=$temp "; }
	}
	
	if ($db{pgsql}) { $db_auto='yes'; }
	else {  $db_auto='no'; }
	print "Include PostgreSQL support [$db_auto] ? ";	
	$temp=read_in();			
	if (($temp eq 'yes') || (($temp eq '') && ($db_auto eq 'yes'))) {
		if ($db{pgsql}) {
			print "Enter PostgreSQL base install directory [autodetect]: ";
		} else {			
			print "Enter PostgreSQL base install directory [/usr/local/pgsql]: ";
		}
			
		$temp=read_in_nolc();
		if ($temp eq '') { $db_string .= " --with-pgsql "; } 
		else { $db_string .= " --with-pgsql=$temp "; }
	}			

	if ($db{msql}) { $db_auto='yes'; }
	else {  $db_auto='no'; }
	print "Include mSQL support [$db_auto] ? ";	
	$temp=read_in();			
	if (($temp eq 'yes') || (($temp eq '') && ($db_auto eq 'yes'))) {
		if ($db{msql}) {
			print "Enter mSQL base install directory [autodetect]: ";
		} else {
			print "Enter mSQL base install directory [/usr/local/Hughes]: ";
		}
			
		$temp=read_in_nolc();
		if ($temp eq '') { $db_string .= " --with-msql "; } 
		else { $db_string .= " --with-msql=$temp "; }
	}
	
	if ($db{ibase}) { $db_auto='yes'; }
	else {  $db_auto='no'; }
	print "Include InterBase support [$db_auto] ? ";	
	$temp=read_in();			
	if (($temp eq 'yes') || (($temp eq '') && ($db_auto eq 'yes'))) {
		if ($db{ibase}) {
			print "Enter InterBase base install directory [autodetect]: ";
		} else {
			print "Enter InterBase base install directory [/usr/interbase]: ";
		}
			
		$temp=read_in_nolc();
		if ($temp eq '') { $db_string .= " --with-ibase "; } 
		else { $db_string .= " --with-ibase=$temp "; }
	}			

	if ($db{ora7}) { $db_auto='yes'; }
	else {  $db_auto='no'; }
	print "Include Oracle7 support [$db_auto] ? ";	
	$temp=read_in();			
	if (($temp eq 'yes') || (($temp eq '') && ($db_auto eq 'yes'))) {
		print "Enter Oracle home directory [\$ORA_HOME]: ";
			
		$temp=read_in_nolc();
		if ($temp eq '') { $db_string .= " --with-oracle7 "; } 
		else { $db_string .= " --with-oracle7=$temp "; }
	}		

	if ($db{ora8}) { $db_auto='yes'; }
	else {  $db_auto='no'; }
	print "Include Oracle8 support [$db_auto] ? ";	
	$temp=read_in();			
	if (($temp eq 'yes') || (($temp eq '') && ($db_auto eq 'yes'))) {
		if ($db{ora8}) {
			print "Enter Oracle home directory [autodetect]: ";
		} else {
			print "Enter Oracle home directory [/oracle8/app/oracle/product/8.0.5]: ";
		}
			
		$temp=read_in_nolc();
		if ($temp eq '') { $db_string .= " --with-oracle8 "; } 
		else { $db_string .= " --with-oracle8=$temp "; }
	}
			
	if ($db{ora8i}) { $db_auto='yes'; }
	else {  $db_auto='no'; }
	print "Include Oracle8i support [$db_auto] ? ";	
	$temp=read_in();			
	if (($temp eq 'yes') || (($temp eq '') && ($db_auto eq 'yes'))) {
		print "Enter Oracle home directory [\$ORA_HOME]: ";
			
		$temp=read_in_nolc();
		if ($temp eq '') { $db_string .= " --with-oracle8i "; } 
		else { $db_string .= " --with-oracle8i=$temp "; }
	} 

	if ($db{ctlib}) { $db_auto='yes'; }
	else {  $db_auto='no'; }
	print "Include Ct-Lib support [$db_auto] ? ";	
	$temp=read_in();			
	if (($temp eq 'yes') || (($temp eq '') && ($db_auto eq 'yes'))) {
		if ($db{ctlib}) {
			print "Enter Ct-Lib home directory [autodetect]: ";
		} else {
			print "Enter Ct-Lib home directory [/opt/sybase]: ";
		}
			
		$temp=read_in_nolc();
		if ($temp eq '') { $db_string .= " --with-ctlib "; } 
		else { $db_string .= " --with-ctlib=$temp "; }
	}

	if ($db{freetds}) { $db_auto='yes'; }
	else {  $db_auto='no'; }
	print "Include FreeTDS Ct-Lib support [$db_auto] ? ";	
	$temp=read_in();			
	if (($temp eq 'yes') || (($temp eq '') && ($db_auto eq 'yes'))) {
		if ($db{freetds}) {
			print "Enter FreeTDS Ct-Lib home directory [autodetect]: ";
		} else {
			print "Enter FreeTDS Ct-Lib home directory [/usr/local]: ";
		}
			
		$temp=read_in_nolc();
		if ($temp eq '') { $db_string .= " --with-freetds "; } 
		else { $db_string .= " --with-freetds=$temp "; }
	}
}

# ---------------------------
# set_syslog
# ---------------------------
sub set_syslog {
	print "Logging settings\n";
	print "----------------\n";

	while () {
		print "Use syslog (yes) or stdout/stderr (no)? (yes/no) [$syslog]: ";
		$temp=read_in();
		if (($temp eq '') || ($temp eq $syslog)) {
			last;			
		} elsif (($temp eq 'yes') || ($temp eq 'no')) {
			$syslog=$temp;
			last;
		}
	}
	
	return if ($syslog eq 'no');
	
	print "Syslog facility (valid name from /usr/include/sys/syslog.h) [$syslog_facility]: ";
	$temp=read_in_nolc();
	if (($temp eq '') || ($temp eq $syslog_facility)) {
		return;
	} else {
		$syslog_facility=$temp;
		return;
	}
}

# ---------------------------
# set_other
# ---------------------------
sub set_other {
	print "Additional features\n";
	print "-------------------\n";
	while () {
		print "Build documentation (docbook required)? (yes/no) [$docs]: ";
		$temp=read_in();
		if (($temp eq '') || ($temp eq $docs)) {
			last;			
		} elsif (($temp eq 'yes') || ($temp eq 'no')) {
			$docs=$temp;
			last;
		}
	}
	
	while () {
		print "Enable Posix pthreads? (yes/no) [$pthreads]: ";
		$temp=read_in();
		if (($temp eq '') || ($temp eq $pthreads)) {
			last;			
		} elsif (($temp eq 'yes') || ($temp eq 'no')) {
			$pthreads=$temp;
			last;
		}
	}
	
	while () {
		print "Enable external parsers support? (yes/no) [$parser]: ";
		$temp=read_in();
		if (($temp eq '') || ($temp eq $parser)) {
			last;			
		} elsif (($temp eq 'yes') || ($temp eq 'no')) {
			$parser=$temp;
			last;
		}
	}

	while () {
		print "Enable MP3 tags support? (yes/no) [$mp3]: ";
		$temp=read_in();
		if (($temp eq '') || ($temp eq $mp3)) {
			last;			
		} elsif (($temp eq 'yes') || ($temp eq 'no')) {
			$mp3=$temp;
			last;
		}
	}

	while () {
		print "Enable HTTP Content-Encoding (zlib) support? (yes/no) [$zlib]: ";
		$temp=read_in();
		if (($temp eq '') || ($temp eq $zlib)) {
			last;			
		} elsif (($temp eq 'yes') || ($temp eq 'no')) {
			$zlib=$temp;
			last;
		}
	}
	
	while () {
		print "Enable DMALLOC support ? (yes/no) [$dmalloc]: ";
		$temp=read_in();
		if (($temp eq '') || ($temp eq $dmalloc)) {
			last;			
		} elsif (($temp eq 'yes') || ($temp eq 'no')) {
			$dmalloc=$temp;
			last;
		}
	}

	while () {
		print "Enable OpenSSL support ? (yes/no) [$ssl]: ";
		$temp=read_in();
		if (($temp eq '') || ($temp eq $ssl)) {
			last;			
		} elsif (($temp eq 'yes') || ($temp eq 'no')){
			$ssl=$temp;
			last;
		}
	}
	
	if ($ssl eq 'yes') {
		print "Enter SSL base install directory: [/usr/local/ssl]: ";
		$temp=read_in_nolc();
		$ssl_dir=$temp;
	}	
}

# ---------------------------
# set_shema()
# ---------------------------
sub set_shema {	
	print "URL parser settings\n";
	print "-------------------\n";

	while () {
		print "Enable file:/ URL scheme support? (yes/no) [$file]: ";
		$temp=read_in();
		if (($temp eq '') || ($temp eq $file)) {
			last;			
		} elsif (($temp eq 'yes') || ($temp eq 'no')){
			$file=$temp;
			last;
		}
	}
	
	while () {
		print "Enable http:// URL scheme support? (yes/no) [$http]: ";
		$temp=read_in();
		if (($temp eq '') || ($temp eq $http)) {
			last;			
		} elsif (($temp eq 'yes') || ($temp eq 'no')){
			$http=$temp;
			last;
		}
	}

	while () {
		print "Enable ftp:// URL scheme support? (yes/no) [$ftp]: ";
		$temp=read_in();
		if (($temp eq '') || ($temp eq $ftp)) {
			last;			
		} elsif (($temp eq 'yes') || ($temp eq 'no')){
			$ftp=$temp;
			last;
		}
	}

	while () {
		print "Enable htdb:/  virtual URL scheme support? (yes/no) [$htdb]: ";
		$temp=read_in();
		if (($temp eq '') || ($temp eq $htdb)) {
			last;			
		} elsif (($temp eq 'yes') || ($temp eq 'no')){
			$htdb=$temp;
			last;
		}
	}

	while () {
		print "Enable news:// URL schema support? (yes/no) [$news]: ";
		$temp=read_in();
		if (($temp eq '') || ($temp eq $news)) {
			last;			
		} elsif (($temp eq 'yes') || ($temp eq 'no')){
			$news=$temp;
			last;
		}
	}
	

}

# ---------------------------
# set_libs
# ---------------------------
sub set_libs {
	print "Compilation settings\n";
	print "--------------------\n";

	while () {
		print "Build shared libraries? (yes/no) [$build_shared]: ";
		$temp=read_in();
		if (($temp eq '') || ($temp eq $build_shared)) {
			last;			
		} elsif (($temp eq 'yes') || ($temp eq 'no')) {
			$build_shared=$temp;
			last;
		}
	}
	
	while () {
		print "build static libraries? (yes/no) [$build_static]: ";
		$temp=read_in();
		if (($temp eq '') || ($temp eq $build_static)) {
			last;			
		} elsif (($temp eq 'yes') || ($temp eq 'no')) {
			$build_static=$temp;
			last;
		}
	}
}

# ---------------------------
# set_layout
# ---------------------------
sub set_layout {
	print "Layout settings\n";
	print "---------------\n";

	while() {
	    print "Please set installation path [$prefix]: ";
	    $temp=read_in_nolc();
	    last if ($temp eq '');
	    if (abs_path($temp) eq abs_path('.')) {
		print "Cannot install in current directory\n";
	    } else {
		$prefix=$temp if ($temp ne '');
		last;
	    }
	}

	update_dirs($prefix);
	while() {
		print_layout();
		print "\nChange layout ? (yes/no) [no]: ";		
		$temp=read_in();
		print "\n";
		if (($temp eq 'no') || ($temp eq '')) {
			last;
		} elsif ($temp eq 'yes') {
			print "Please set User executables DIR [$bindir]: ";
			$temp=read_in_nolc();
			$bindir=$temp if ($temp ne '');
		
			print "System executables DIR [$sbindir]: ";
			$temp=read_in_nolc();
			$sbindir=$temp if ($temp ne '');
			
			print "Configuration data DIR [$sysconfdir]: ";
			$temp=read_in_nolc();
			$sysconfdir=$temp if ($temp ne '');
		
			print "Modifiable data DIR: [$localstatedir]: ";
			$temp=read_in_nolc();
			$localstatedir=$temp if ($temp ne '');
		
			print "Object code libraries DIR [$libdir]:";
			$temp=read_in_nolc();
			$libdir=$temp if ($temp ne '');
		
			print "C header files DIR [$includedir]: ";
			$temp=read_in_nolc();
			$includedir=$temp if ($temp ne '');
		
			print "Man documentation DIR [$mandir]: ";
			$temp=read_in_nolc();
			$mandir=$temp if ($temp ne '');
		} else {
			next;
		}
	}
}

# -------------------------------
# read_in
# -------------------------------
sub read_in {
	my $temp;
	chomp($temp=<STDIN>);
	return lc($temp);
}

# -------------------------------
# read_in_nolc
# -------------------------------
sub read_in_nolc {
	my $temp;
	chomp($temp=<STDIN>);
	return $temp;
}

# -------------------------------
# update_dirs(prefix)
# -------------------------------
sub update_dirs {
	my $prefix=$_[0];
	
	$bindir="$prefix/bin";
	$sbindir="$prefix/sbin";
	$sysconfdir="$prefix/etc";
	$localstatedir="$prefix/var";
	$libdir="$prefix/lib";
	$includedir="$prefix/include";
	$mandir="$prefix/man";
}


# -------------------------------
# print_layout
# -------------------------------
sub print_layout {
	print "\nConfigured layout:\n";
	print " Installation path: $prefix\n";
	print " User executables DIR: $bindir\n";
	print " System executables DIR: $sbindir\n";
	print " Configuration data DIR: $sysconfdir\n";
	print " Modifiable data DIR: $localstatedir\n";
	print " Object code libraries DIR: $libdir\n";
	print " C header files DIR: $includedir\n";
	print " Man documentation DIR: $mandir\n";
}