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
|
#!/usr/bin/perl -w
use warnings;
use Getopt::Long;
use POSIX qw(uname);
use Cwd 'abs_path';
use File::Basename;
use File::Spec;
print "\nConfiguring Makefiles for your system...\n";
# Set a bunch of variables
my @invoke = @ARGV;
my $ret = 0;
# this should be only the major version without the extra version
# eg. only the first 3 digits
my $required_kernelversion = '2.6.31';
my %options = (
help => \$help,
cc => \$cc,
debug => \$debug,
cflags => \$cflags,
extracflags => \$extracflags,
enable_paranoia_cflags => \$enable_paranoia_cflags,
ldflags => \$ldflags,
extraldflags => \$extraldflags,
objdir => \$objdir,
kernel_build => \$kernel_build,
kernel_src => \$kernel_src,
module_dir => \$module_dir,
gfskincdir => \$gfskincdir,
incdir => \$incdir,
libdir => \$libdir,
ccsincdir => \$ccsincdir,
ccslibdir => \$ccslibdir,
cmanincdir => \$cmanincdir,
cmanlibdir => \$cmanlibdir,
dlmincdir => \$dlmincdir,
dlmlibdir => \$dlmlibdir,
dlmcontrolincdir => \$dlmcontrolincdir,
dlmcontrollibdir => \$dlmcontrollibdir,
fenceincdir => \$fenceincdir,
fencelibdir => \$fencelibdir,
fencedincdir => \$fencedincdir,
fencedlibdir => \$fencedlibdir,
logtincdir => \$logtincdir,
logtlibdir => \$logtlibdir,
ncursesincdir => \$ncursesincdir,
ncurseslibdir => \$ncurseslibdir,
slangincdir => \$slangincdir,
slanglibdir => \$slanglibdir,
corosyncincdir => \$corosyncincdir,
corosynclibdir => \$corosynclibdir,
openaisincdir => \$openaisincdir,
openaislibdir => \$openaislibdir,
corosyncbin => \$corosyncbin,
virtincdir => \$virtincdir,
virtlibdir => \$virtlibdir,
zlibincdir => \$zlibincdir,
zliblibdir => \$zliblibdir,
nssincdir => \$nssincdir,
nsslibdir => \$nsslibdir,
nsprincdir => \$nsprincdir,
nsprlibdir => \$nsprlibdir,
ldapincdir => \$ldapincdir,
ldaplibdir => \$ldaplibdir,
libexecdir => \$libexecdir,
mandir => \$mandir,
prefix => \$prefix,
sbindir => \$sbindir,
initddir => \$initddir,
sharedir => \$sharedir,
docdir => \$docdir,
logdir => \$logdir,
logrotatedir => \$logrotatedir,
syslogfacility => \$syslogfacility,
sysloglevel => \$sysloglevel,
snmpbin => \$snmpbin,
confdir => \$confdir,
conffile => \$conffile,
fence_agents => \$fence_agents,
fenceagentslibdir => \$fenceagentslibdir,
enable_crack_of_the_day => \$enable_crack_of_the_day,
enable_legacy_code => \$enable_legacy_code,
enable_contrib => \$enable_contrib,
enable_pacemaker => \$enable_pacemaker,
somajor => \$somajor,
sominor => \$sominor,
release_version => \$release_version,
without_common => \$without_common,
without_config => \$without_config,
without_cman => \$without_cman,
without_dlm => \$without_dlm,
without_group => \$without_group,
without_fence => \$without_fence,
without_fence_agents => \$without_fence_agents,
enable_gfs => \$enable_gfs,
without_gfs2 => \$without_gfs2,
without_rgmanager => \$without_rgmanager,
without_resource_agents => \$without_resource_agents,
without_bindings => \$without_bindings,
without_kernel_modules => \$without_kernel_modules,
disable_kernel_check => \$disable_kernel_check,
);
my $err = &GetOptions (\%options,
'help',
'cc=s',
'debug',
'cflags=s',
'extracflags=s',
'enable_paranoia_cflags',
'ldflags=s',
'extraldflags=s',
'objdir=s',
'kernel_build=s',
'kernel_src=s',
'module_dir=s',
'gfskincdir=s',
'incdir=s',
'libdir=s',
'ccsincdir=s',
'ccslibdir=s',
'cmanincdir=s',
'cmanlibdir=s',
'dlmincdir=s',
'dlmlibdir=s',
'dlmcontrolincdir=s',
'dlmcontrollibdir=s',
'fenceincdir=s',
'fencelibdir=s',
'fencedincdir=s',
'fencedlibdir=s',
'logtincdir=s',
'logtlibdir=s',
'ncursesincdir=s',
'ncurseslibdir=s',
'slangincdir=s',
'slanglibdir=s',
'corosyncincdir=s',
'corosynclibdir=s',
'openaisincdir=s',
'openaislibdir=s',
'corosyncbin=s',
'virtincdir=s',
'virtlibdir=s',
'zlibincdir=s',
'zliblibdir=s',
'nssincdir=s',
'nsslibdir=s',
'nsprincdir=s',
'nsprlibdir=s',
'ldapincdir=s',
'ldaplibdir=s',
'libexecdir=s',
'mandir=s',
'prefix=s',
'sbindir=s',
'initddir=s',
'sharedir=s',
'docdir=s',
'logdir=s',
'logrotatedir=s',
'syslogfacility=s',
'sysloglevel=s',
'snmpbin=s',
'confdir=s',
'conffile=s',
'somajor=s',
'sominor=s',
'release_version=s',
'fence_agents=s',
'fenceagentslibdir=s',
'enable_crack_of_the_day',
'enable_legacy_code',
'enable_contrib',
'enable_pacemaker',
'without_common',
'without_config',
'without_cman',
'without_dlm',
'without_group',
'without_fence',
'without_fence_agents',
'enable_gfs',
'without_gfs2',
'without_rgmanager',
'without_resource_agents',
'without_bindings',
'without_kernel_modules',
'disable_kernel_check');
if(!$err) {
$ret = 1;
print "*** ERROR: Invalid option detected ***\n";
}
# Check for the --help flag
if ($help || !$err) {
$_ = $0;
s/.*\.\/(.*)/$1/;
print "Usage: $_ [flags]\n";
print "--help\t\tPrints this usage information\n\n";
print "install flags:\n";
print "--prefix=\tthe base directory to install into. (Default: /usr)\n";
print "--sbindir=\tthe base directory for system binaries. (Default: {prefix}/sbin)\n";
print "--initddir=\tthe base directory for init.d scripts. (Default: /etc/init.d)\n";
print "--libdir=\tthe base directory for libraries. (Default: {prefix}/lib)\n";
print "--libexecdir=\tthe base directory for executable components. (Default: {prefix}/libexec)\n";
print "--sharedir=\tthe base directory for misc cluster files. (Default: {prefix}/share/cluster)\n";
print "--docdir=\tthe base directory for misc cluster documentation files. (Default: {prefix}/share/doc/cluster)\n";
print "--logdir=\tthe base directory for cluster logging files. (Default: /var/log/cluster/)\n";
print "--logrotatedir=\tthe base directory for logrorate.d files. (Default: /etc/logrotate.d/)\n";
print "--syslogfacility=\tset the default syslog facility. (Default: LOG_LOCAL4)\n";
print "--sysloglevel=\tset the default syslog level. (Default: LOG_INFO)\n";
print "--snmpbin=\tthe base directory for snmp binaries (Ex: /usr/bin/snmpwalk). (Default: {prefix}/bin)\n";
print "--confdir=\tthe cluster config directory. (Default: /etc/cluster)\n";
print "--conffile=\tthe cluster config file. (Default: cluster.conf)\n";
print "--mandir=\tthe base directory for man pages. (Default: {prefix}/share/man)\n";
print "--module_dir=\tthe base directory for kernel modules. (Default: /lib/modules/`uname -r`/kernel\n";
print "\nbuild flags:\n";
print "--cc=\t\tcompiler to use. (Default: gcc)\n";
print "--debug\t\tEnable debugging build. Changes default optimization CFLAGS to -O0 -DDEBUG -ggdb3\n";
print "--cflags=\toverride default CFLAGS settings.\n";
print "--extracflags=\tadd extra compiler options to default CFLAGS setting. (Default: none)\n";
print "--enable_paranoia_cflags=\tadd paranoia compiler options to default CFLAGS setting. (Default: -Werror)\n";
print "--ldflags=\toverride default LDFLAGS settings. (Default: none)\n";
print "--extraldflags=\tadd extra linking options to default LDFLAGS settings. (Default: none)\n";
print "--objdir=\tspecify directory where to store object files. (Defaults: current build dir)\n";
print "--kernel_build=\tthe directory containing the kernel object tree you wish to\n\t\tcompile against. (Default: /lib/modules/`uname -r`/build\n\t\tif available or /usr/src/linux as fallback)\n";
print "--kernel_src=\tthe directory containing the kernel source you wish to\n\t\tcompile against. (Default: /lib/modules/`uname -r`/source\n\t\tif available or \$kernel_build as fallback)\n";
print "--incdir=\tthe base directory for include files. (Default: {prefix}/include)\n";
print "--ccsincdir=\tthe base directory for ccs include files. (Default: ./config/libs/libccsconfdb)\n";
print "--ccslibdir=\tthe base directory for ccs libraries. (Default: ./config/libs/libccsconfdb)\n";
print "--cmanincdir=\tthe base directory for cman include files. (Default: ./cman/lib)\n";
print "--cmanlibdir=\tthe base directory for cman libraries. (Default: ./cman/lib)\n";
print "--dlmincdir=\tthe base directory for dlm include files. (Default: ./dlm/libdlm)\n";
print "--dlmlibdir=\tthe base directory for dlm libraries. (Default: ./dlm/libdlm)\n";
print "--dlmcontrolincdir=\tthe base directory for dlmcontrol include files. (Default: ./dlm/libdlmcontrol)\n";
print "--dlmcontrollibdir=\tthe base directory for dlmcontrol libraries. (Default: ./dlm/libdlmcontrol)\n";
print "--fenceincdir=\tthe base directory for fence include files. (Default: ./fence/libfence)\n";
print "--fencelibdir=\tthe base directory for fence libraries. (Default: ./fence/libfence)\n";
print "--fencedincdir=\tthe base directory for fence include files. (Default: ./fence/libfenced)\n";
print "--fencedlibdir=\tthe base directory for fence libraries. (Default: ./fence/libfenced)\n";
print "--logtincdir=\tthe base directory for logthread include files. (Default: ./common/liblogthread)\n";
print "--logtlibdir=\tthe base directory for logthread libraries. (Default: ./common/liblogthread)\n";
print "--ncursesincdir=\tthe base directory for ncurses include files. (Default: {incdir})\n";
print "--ncurseslibdir=\tthe base directory for ncurses libraries. (Default: {libdir})\n";
print "--slangincdir=\tthe base directory for S-Lang include files. (Default: {incdir})\n";
print "--slanglibdir=\tthe base directory for S-Lang libraries. (Default: {libdir})\n";
print "--corosyncincdir=\tthe base directory for corosync include files. (Default: {incdir})\n";
print "--corosynclibdir=\tthe base directory for corosync libraries. (Default: {libdir}/corosync)\n";
print "--openaisincdir=\tthe base directory for openais include files. (Default: {incdir})\n";
print "--openaislibdir=\tthe base directory for openais libraries. (Default: {libdir}/openais)\n";
print "--corosyncbin=\tlocation of corosync executable file. (Default: /usr/sbin/corosync)\n";
print "--nssincdir=\tthe base directory for libnss include files. (Default: {incdir}/nss3)\n";
print "--nsslibdir=\tthe base directory for libnss libraries. (Default: {libdir})\n";
print "--nsprincdir=\tthe base directory for libnspr include files. (Default: {incdir}/nspr4)\n";
print "--nsprlibdir=\tthe base directory for libnspr libraries. (Default: {libdir})\n";
print "--virtincdir=\tthe base directory for libvirt include files. (Default: {incdir}/libvirt)\n";
print "--virtlibdir=\tthe base directory for libvirt libraries. (Default: {libdir})\n";
print "--zlibincdir=\tthe base directory for libz include files. (Default: {incdir})\n";
print "--zliblibdir=\tthe base directory for libz libraries. (Default: {libdir})\n";
print "--ldapincdir=\tthe base directory for ldap include files. (Default: {incdir})\n";
print "--ldaplibdir=\tthe base directory for ldap libraries. (Default: {libdir})\n";
print "--fence_agents=\tlist of fence agents to configure. (Default: all)\n";
print "\t\tUse --fence_agents=help for a list\n";
print "--fenceagentslibdir=\tspecify directory where to install common fence python lib. (Default: {prefix}/share/fence)\n";
print "--enable_crack_of_the_day\tEnable build of highly experimental features that rely on code that is not yet available for general use. (Default: no)\n";
print "--enable_contrib\tEnable build of community contributed code/tools. (Default: no)\n";
print "--enable_legacy_code\tEnable build of old/obsolete/unsupported code/tools. (Default: no)\n";
print "--enable_pacemaker\tEnable building of Pacemaker-specific pieces\n";
print "--without_common\tDisable common building (Default: enabled)\n";
print "--without_config\tDisable config building (Default: enabled)\n";
print "--without_cman\tDisable cman building (Default: enabled)\n";
print "--without_dlm\tDisable dlm building (Default: enabled)\n";
print "--without_group\tDisable group building (Default: enabled)\n";
print "--without_fence\tDisable fence building (Default: enabled)\n";
print "--without_fence_agents\tDisable fence_agents building (Default: enabled)\n";
print "--enable_gfs\tEnable gfs building (Default: disabled)\n";
print "--without_gfs2\tDisable gfs2 building (Default: enabled)\n";
print "--without_rgmanager\tDisable rgmanager building (Default: enabled)\n";
print "--without_resource_agents\tDisable resource agents building (Default: enabled)\n";
print "--without_bindings\tDisable perl/python bindings building (Default: enabled)\n";
print "--without_kernel_modules\tDisable kernel modules building (Default: enabled)\n";
print "--disable_kernel_check\tDisable kernel version check (Default: enabled)\n";
exit $ret;
}
sub kernel_version {
my $makefile_path = shift;
my $required_version = shift;
print "\nChecking kernel:\n";
# add autoconf to the path
$makefile_path .= '/Makefile';
my @version = split /\./, $required_version;
if ( -f $makefile_path ) {
# open the toplevel Makefile to feth VERSION, PATCHLEVEL and SUBLEVEL
open MAKEFILE, '<', $makefile_path;
while (<MAKEFILE>) {
$build_version = $1 if /^VERSION = (\d+)/;
$build_patchlevel = $1 if /^PATCHLEVEL = (\d+)/;
$build_sublevel = $1 if /^SUBLEVEL = (\d+)/;
last if (defined $build_version && defined $build_patchlevel && defined $build_sublevel);
}
close MAKEFILE;
# Warn and continue if kernel version was not found
if (!$build_version || !$build_patchlevel || !$build_sublevel) {
print " WARNING: Could not determine kernel version.\n";
print " Build might fail!\n";
return 1;
}
# checking VERSION, PATCHLEVEL and SUBLEVEL for the supplied kernel
if ($build_version >= $version[0] &&
$build_patchlevel >= $version[1] &&
$build_sublevel >= $version[2]) {
print " Current kernel version appears to be OK\n";
return 1;
} else {
print " Current kernel version: ",$build_version, "." , $build_patchlevel, ".", $build_sublevel, "\n Minimum kernel version: ",$required_version,"\n";
print " FAILED!\n";
return 0;
}
} else {
print " Unable to find ($makefile_path)!\n";
print " Make sure that:\n - the above path is correct\n";
print " - your kernel is properly configured and prepared.\n";
print " - kernel_build and kernel_src options to configure are set properly.\n";
return 0;
}
}
sub symlinks {
my $dir = shift;
my $pattern = shift;
@args = "find $dir -type f -name $pattern";
open (IFILE, "@args |");
while (<IFILE>) {
chomp;
s|\./||g;
s|.*make\/defines.mk||g;
$dirname = dirname($_);
$filename = basename($_);
system("mkdir -p $objdir/$dirname");
symlink("${cdir}/$_","$objdir/$dirname/$filename");
}
close IFILE;
return 0;
}
$pwd = `pwd`;
chomp($pwd);
if (!$cc) {
$cc="gcc";
}
if (!$cflags) {
$cflags="";
$cflags="${cflags} -Wall -Wformat=2 -Wshadow -Wmissing-prototypes";
$cflags="${cflags} -Wstrict-prototypes -Wdeclaration-after-statement";
$cflags="${cflags} -Wpointer-arith -Wwrite-strings -Wcast-align";
$cflags="${cflags} -Wbad-function-cast -Wmissing-format-attribute";
$cflags="${cflags} -Wformat-security -Wformat-nonliteral -Wno-long-long";
$cflags="${cflags} -Wno-strict-aliasing -Wmissing-declarations";
if (!$debug) {
$cflags="${cflags} -O2";
} else {
$cflags="${cflags} -O0 -DDEBUG";
}
$cflags="${cflags} -ggdb3 -MMD";
}
if ($extracflags) {
$cflags="${cflags} ${extracflags}";
}
if ($enable_paranoia_cflags) {
$cflags="-Werror ${cflags}";
}
if (!$ldflags) {
$ldflags="";
}
if ($extraldflags) {
$ldflags="${ldflags} ${extraldflags}";
}
if (!$prefix) {
$prefix="/usr";
}
print "\nChecking tree: ";
if (!$objdir) {
$objdir="${pwd}";
}
$objdir = abs_path( $objdir );
$cdir = dirname ( abs_path( $0 ) );
unless ("$cdir" eq "$objdir") {
chdir "$cdir";
}
if (! -d "$objdir/make") {
print "setting up $objdir\n";
mkdir "$objdir";
symlinks(".","Makefile");
symlinks(".","*.mk");
symlinks("gfs-kernel","*.c");
symlinks("gfs-kernel","*.h");
symlinks("bindings","*.bindings");
symlinks("bindings","*.pl");
symlinks("bindings","*.xs");
symlinks("bindings","*.PL");
symlinks("bindings","MANIFEST");
symlinks("bindings","typemap");
} else {
print "nothing to do\n";
}
my @un = POSIX::uname();
if (!$kernel_build) {
if (-d "/lib/modules/$un[2]/build") {
$kernel_build="/lib/modules/$un[2]/build";
} else {
$kernel_build="/usr/src/linux";
}
}
if (!$kernel_src) {
if (-d "/lib/modules/$un[2]/source") {
$kernel_src="/lib/modules/$un[2]/source";
} else {
$kernel_src=$kernel_build;
}
}
if (not $disable_kernel_check and !kernel_version($kernel_src,$required_kernelversion)) {
exit 1;
}
if (!$module_dir) {
$module_dir="/lib/modules/$un[2]/kernel";
}
if (!$gfskincdir) {
$gfskincdir="${cdir}/gfs-kernel/src/gfs";
}
if (!$incdir) {
$incdir="${prefix}/include";
}
if (!$libdir) {
$libdir="${prefix}/lib";
}
if (!$ccsincdir) {
$ccsincdir="${cdir}/config/libs/libccsconfdb";
}
if (!$ccslibdir) {
$ccslibdir="${objdir}/config/libs/libccsconfdb";
}
if (!$cmanincdir) {
$cmanincdir="${cdir}/cman/lib";
}
if (!$cmanlibdir) {
$cmanlibdir="${objdir}/cman/lib";
}
if (!$dlmincdir) {
$dlmincdir="${cdir}/dlm/libdlm";
}
if (!$dlmlibdir) {
$dlmlibdir="${objdir}/dlm/libdlm";
}
if (!$dlmcontrolincdir) {
$dlmcontrolincdir="${cdir}/dlm/libdlmcontrol";
}
if (!$dlmcontrollibdir) {
$dlmcontrollibdir="${objdir}/dlm/libdlmcontrol";
}
if (!$fenceincdir) {
$fenceincdir="${cdir}/fence/libfence";
}
if (!$fencelibdir) {
$fencelibdir="${objdir}/fence/libfence";
}
if (!$fencedincdir) {
$fencedincdir="${cdir}/fence/libfenced";
}
if (!$fencedlibdir) {
$fencedlibdir="${objdir}/fence/libfenced";
}
if (!$logtincdir) {
$logtincdir="${cdir}/common/liblogthread";
}
if (!$logtlibdir) {
$logtlibdir="${objdir}/common/liblogthread";
}
if (!$ncursesincdir) {
$ncursesincdir="${incdir}";
}
if (!$ncurseslibdir) {
$ncurseslibdir="${libdir}";
}
if (!$slangincdir) {
$slangincdir="${incdir}";
if (! -f "$slangincdir/slang.h") {
$slangincdir="${incdir}/slang";
}
}
if (!$slanglibdir) {
$slanglibdir="${libdir}";
}
if (!$corosyncincdir) {
$corosyncincdir="${incdir}";
}
if (!$corosynclibdir) {
$corosynclibdir="${libdir}/corosync";
}
if (!$openaisincdir) {
$openaisincdir="${incdir}";
}
if (!$openaislibdir) {
$openaislibdir="${libdir}/openais";
}
if (!$corosyncbin) {
$corosyncbin="/usr/sbin/corosync";
}
if (!$nssincdir) {
$nssincdir="${incdir}/nss3";
}
if (!$nsslibdir) {
$nsslibdir="${libdir}";
}
if (!$nsprincdir) {
$nsprincdir="${incdir}/nspr4";
}
if (!$nsprlibdir) {
$nsprlibdir="${libdir}";
}
if (!$virtincdir) {
$virtincdir="${incdir}/libvirt";
}
if (!$virtlibdir) {
$virtlibdir="${libdir}";
}
if (!$zlibincdir) {
$zlibincdir="${incdir}";
}
if (!$zliblibdir) {
$zliblibdir="${libdir}";
}
if (!$ldapincdir) {
$ldapincdir="${incdir}";
}
if (!$ldaplibdir) {
$ldaplibdir="${libdir}";
}
if (!$libexecdir) {
$libexecdir="${prefix}/libexec";
}
if (!$mandir) {
$mandir="${prefix}/share/man";
}
if (!$sbindir) {
$sbindir="${prefix}/sbin";
}
$relativesbin=File::Spec->abs2rel("/sbin", $sbindir);
if (!$initddir) {
$initddir="/etc/init.d";
}
if (!$sharedir) {
$sharedir="${prefix}/share/cluster";
}
if (!$docdir) {
$docdir="${prefix}/share/doc/cluster";
}
if (!$logdir) {
$logdir="/var/log/cluster";
}
if (!$logrotatedir) {
$logrotatedir="/etc/logrotate.d";
}
if (!$syslogfacility) {
$syslogfacility="LOG_LOCAL4";
}
if (!$sysloglevel) {
$sysloglevel="LOG_INFO";
}
if (!$snmpbin) {
$snmpbin="${prefix}/bin";
}
if (!$confdir) {
$confdir="/etc/cluster";
}
if (!$conffile) {
$conffile="cluster.conf";
}
if (!$fence_agents) {
$fence_agents="all";
}
if (!$fenceagentslibdir) {
$fenceagentslibdir="${prefix}/share/fence";
}
if (!$enable_crack_of_the_day) {
$enable_crack_of_the_day="";
} else {
print "\n********************************************************************************************\n";
print "WARNING: *you* have explicitly enabled all possible experimental features under development!\n";
print " This code will have no mercy for your data and your machines. You have been warned!\n";
print "\n********************************************************************************************\n";
$cflags="${cflags} -DEXPERIMENTAL_BUILD";
}
if (!$enable_contrib) {
$enable_contrib="";
}
if (!$enable_legacy_code) {
$enable_legacy_code="";
} else {
print "\n********************************************************************************************\n";
print "WARNING: *you* have explicitly enabled the build of old/obsoleted/unsupported code/tools\n";
print " This code is provided *only* for backward compatibility\n";
print "\n********************************************************************************************\n";
$cflags="${cflags} -DLEGACY_CODE";
}
if (!$enable_pacemaker) {
$enable_pacemaker="";
}
if (!$without_common) {
$without_common="";
}
if (!$without_config) {
$without_config="";
}
if (!$without_cman) {
$without_cman="";
}
if (!$without_dlm) {
$without_dlm="";
}
if (!$without_group) {
$without_group="";
}
if (!$without_fence) {
$without_fence="";
}
if (!$without_fence_agents) {
$without_fence_agents="";
} else {
$fence_agents="none";
}
if (!$enable_gfs) {
$enable_gfs="";
}
if (!$without_gfs2) {
$without_gfs2="";
}
if (!$without_rgmanager) {
$without_rgmanager="";
}
if (!$without_resource_agents) {
$without_resource_agents="";
}
if (!$without_bindings) {
$without_bindings="";
}
if (!$without_kernel_modules) {
$enable_gfskernel=$enable_gfs;
} else {
$enable_gfskernel="";
}
if (!$disable_kernel_check) {
$disable_kernel_check=0;
}
if (defined($somajor) && not length $somajor) {
$somajor="";
}
if (defined($sominor) && not length $sominor) {
$sominor="";
}
if (defined($release_version) && not length $release_version) {
$release_version="";
}
if ((!$fence_agents) || ($fence_agents eq "all") || ($fence_agents eq "help")) {
@args = "find fence/agents -mindepth 2 -maxdepth 2 -name Makefile -printf '%h'";
open (IFILE, "@args |");
while (<IFILE>) {
chomp;
s|fence\/agents\/| |g;
s|lib ||g;
s|nss_wrapper ||g;
$all_fence = $_;
}
close IFILE;
}
if ($fence_agents eq "help") {
print "Available fence agents:\n$all_fence\n";
exit 0;
}
if ((!$fence_agents) || ($fence_agents eq "all")) {
print "\nThe following fence agents will be build on this system:\n$all_fence\n";
$fence_agents = $all_fence
}
if ($fence_agents eq "none") {
$fence_agents = "";
}
open IFILE, "<make/defines.mk.input" or die "Can't redirect stdin";
open OFILE, ">${objdir}/make/defines.mk" or die "Can't redirect stdout";
print OFILE "# This file was generated by configure from defines.mk.input\n";
while (<IFILE>) {
chomp;
$_ =~ s/\@SRCDIR\@/$cdir/;
$_ =~ s/\@CC\@/$cc/;
$_ =~ s/\@CFLAGS\@/$cflags/;
$_ =~ s/\@LDFLAGS\@/$ldflags/;
$_ =~ s/\@OBJDIR\@/$objdir/;
$_ =~ s/\@KERNEL_BUILD\@/$kernel_build/;
$_ =~ s/\@KERNEL_SRC\@/$kernel_src/;
$_ =~ s/\@MODULE_DIR\@/$module_dir/;
$_ =~ s/\@GFSKINCDIR\@/$gfskincdir/;
$_ =~ s/\@INCDIR\@/$incdir/;
$_ =~ s/\@LIBDIR\@/$libdir/;
$_ =~ s/\@CCSINCDIR\@/$ccsincdir/;
$_ =~ s/\@CCSLIBDIR\@/$ccslibdir/;
$_ =~ s/\@CMANINCDIR\@/$cmanincdir/;
$_ =~ s/\@CMANLIBDIR\@/$cmanlibdir/;
$_ =~ s/\@DLMINCDIR\@/$dlmincdir/;
$_ =~ s/\@DLMLIBDIR\@/$dlmlibdir/;
$_ =~ s/\@DLMCONTROLINCDIR\@/$dlmcontrolincdir/;
$_ =~ s/\@DLMCONTROLLIBDIR\@/$dlmcontrollibdir/;
$_ =~ s/\@FENCEINCDIR\@/$fenceincdir/;
$_ =~ s/\@FENCELIBDIR\@/$fencelibdir/;
$_ =~ s/\@FENCEDINCDIR\@/$fencedincdir/;
$_ =~ s/\@FENCEDLIBDIR\@/$fencedlibdir/;
$_ =~ s/\@LOGTINCDIR\@/$logtincdir/;
$_ =~ s/\@LOGTLIBDIR\@/$logtlibdir/;
$_ =~ s/\@NCURSESINCDIR\@/$ncursesincdir/;
$_ =~ s/\@NCURSESLIBDIR\@/$ncurseslibdir/;
$_ =~ s/\@SLANGINCDIR\@/$slangincdir/;
$_ =~ s/\@SLANGLIBDIR\@/$slanglibdir/;
$_ =~ s/\@COROSYNCINCDIR\@/$corosyncincdir/;
$_ =~ s/\@COROSYNCLIBDIR\@/$corosynclibdir/;
$_ =~ s/\@OPENAISINCDIR\@/$openaisincdir/;
$_ =~ s/\@OPENAISLIBDIR\@/$openaislibdir/;
$_ =~ s/\@COROSYNCBIN\@/$corosyncbin/;
$_ =~ s/\@LDAPINCDIR\@/$ldapincdir/;
$_ =~ s/\@LDAPLIBDIR\@/$ldaplibdir/;
$_ =~ s/\@NSSINCDIR\@/$nssincdir/;
$_ =~ s/\@NSSLIBDIR\@/$nsslibdir/;
$_ =~ s/\@NSPRINCDIR\@/$nsprincdir/;
$_ =~ s/\@NSPRLIBDIR\@/$nsprlibdir/;
$_ =~ s/\@VIRTINCDIR\@/$virtincdir/;
$_ =~ s/\@VIRTLIBDIR\@/$virtlibdir/;
$_ =~ s/\@ZLIBINCDIR\@/$zlibincdir/;
$_ =~ s/\@ZLIBLIBDIR\@/$zliblibdir/;
$_ =~ s/\@LIBEXECDIR\@/$libexecdir/;
$_ =~ s/\@MANDIR\@/$mandir/;
$_ =~ s/\@SBINDIR\@/$sbindir/;
$_ =~ s/\@RELATIVESBIN\@/$relativesbin/;
$_ =~ s/\@PREFIX\@/$prefix/;
$_ =~ s/\@INITDDIR\@/$initddir/;
$_ =~ s/\@SHAREDIR\@/$sharedir/;
$_ =~ s/\@DOCDIR\@/$docdir/;
$_ =~ s/\@LOGDIR\@/$logdir/;
$_ =~ s/\@LOGROTATEDIR\@/$logrotatedir/;
$_ =~ s/\@SYSLOGFACILITY\@/$syslogfacility/;
$_ =~ s/\@SYSLOGLEVEL\@/$sysloglevel/;
$_ =~ s/\@SNMPBIN\@/$snmpbin/;
$_ =~ s/\@CONFDIR\@/$confdir/;
$_ =~ s/\@CONFFILE\@/$conffile/;
$_ =~ s/\@FENCE_AGENTS\@/$fence_agents/;
$_ =~ s/\@FENCEAGENTSLIBDIR\@/$fenceagentslibdir/;
$_ =~ s/\@ENABLE_CRACK_OF_THE_DAY\@/$enable_crack_of_the_day/;
$_ =~ s/\@ENABLE_LEGACY_CODE\@/$enable_legacy_code/;
$_ =~ s/\@ENABLE_CONTRIB\@/$enable_contrib/;
$_ =~ s/\@ENABLE_PACEMAKER\@/$enable_pacemaker/;
$_ =~ s/\@DISABLE_COMMON\@/$without_common/;
$_ =~ s/\@DISABLE_CONFIG\@/$without_config/;
$_ =~ s/\@DISABLE_CMAN\@/$without_cman/;
$_ =~ s/\@DISABLE_DLM\@/$without_dlm/;
$_ =~ s/\@DISABLE_GROUP\@/$without_group/;
$_ =~ s/\@DISABLE_FENCE\@/$without_fence/;
$_ =~ s/\@ENABLE_GFS\@/$enable_gfs/;
$_ =~ s/\@ENABLE_GFSKERNEL\@/$enable_gfskernel/;
$_ =~ s/\@DISABLE_GFS2\@/$without_gfs2/;
$_ =~ s/\@DISABLE_RGMANAGER\@/$without_rgmanager/;
$_ =~ s/\@DISABLE_RESOURCE_AGENTS\@/$without_resource_agents/;
$_ =~ s/\@DISABLE_BINDINGS\@/$without_bindings/;
print OFILE "$_\n";
}
close IFILE;
if ((not defined($somajor)) || (not defined($sominor)) || (not defined($release_version))) {
my $current_soname;
my $current_version;
if ( -f 'make/official_release_version' ) {
open OFFICIAL_VERSION, '<', "make/official_release_version";
while (<OFFICIAL_VERSION>) {
if ($_ =~ /SONAME/) {
$current_soname = $_;
}
if ($_ =~ /VERSION/) {
$current_version = $_;
}
}
close OFFICIAL_VERSION;
}
if ((not defined($somajor)) || (not defined($sominor))) {
if (not defined($current_soname)) {
print "ERROR: SONAME not defined in make/official_release_version\n";
exit 1;
} else {
$current_soname =~ s/.*"(.*)"\n/$1/;
my @release_soname = split /\./, $current_soname;
$somajor = $release_soname[0];
$sominor = $release_soname[1];
}
}
if (not defined($release_version)) {
if (not defined($current_version)) {
$release_version = `date +%s`;
chomp $release_version;
} else {
$release_version = $current_version;
$release_version =~ s/.*"(.*)"\n/$1/;
}
}
}
print OFILE "ifndef SOMAJOR\n";
print OFILE "SOMAJOR = $somajor\n";
print OFILE "endif\n";
print OFILE "ifndef SOMINOR\n";
print OFILE "SOMINOR = $sominor\n";
print OFILE "endif\n";
print OFILE "RELEASE_VERSION = $release_version\n";
print OFILE "CFLAGS += -DRELEASE_VERSION=\\\"$release_version\\\"\n";
close OFILE;
open OFILE, ">${objdir}/.configure.sh.tmp" or die "Can't redirect stdout";
print OFILE "#!/bin/bash\n";
print OFILE "$0 @invoke \$@\n";
print OFILE "exit \$?\n";
close OFILE;
system("mv ${objdir}/.configure.sh.tmp ${objdir}/.configure.sh");
print "Completed Makefile configuration\n\n";
|