324 mike 1.1 ;;
325 MONTAVISTA*)
326 hostname
327 ;;
328 DARWIN*)
329 hostname
330 ;;
331 *)
332 ##
333 ## Attempt to obtain domain name from /etc/resolve.conf
334 ##
335 if [ -f "/etc/resolv.conf" ]; then
336 domain=`cat /etc/resolv.conf | grep '^domain' | awk '{print $2}'`
337
338 if [ -n "$domain" ]; then
339 echo `hostname`.$domain
340 exit 0
341 fi
342 fi
343
344 ##
345 mike 1.1 ## Attempt to obtain long hostname with 'nslookup' command
346 ##
347 if [ -n "`which nslookup`" ]; then
348 host=`hostname`
349 lhs=`nslookup $host | grep '^Name:' | awk '{print $2}' | grep $host`
350 if [ -n "$lhs" ]; then
351 echo $lhs
352 exit 0
353 fi
354 fi
355
356 ##
357 ## Just print host hostname:
358 ##
359 hostname
360 ;;
361 esac
362
363 exit
364 fi
365
366 mike 1.1 ##==============================================================================
367 ##
368 ## username command:
369 ##
370 ##==============================================================================
371
372 if [ "$arg1" = "username" ]; then
373
374 if [ "$argc" != "1" -o "$opts" != "" ]; then
375 echo "Usage: $0 $arg1"
376 echo
377 exit 1
378 fi
379
380 case "$platform" in
381
382 *)
383 id | cut -f2 -d'(' | cut -f1 -d')'
384 ;;
385 esac
386
387 mike 1.1 exit
388 fi
389
390 ##==============================================================================
391 ##
392 ## arch command:
393 ##
394 ##==============================================================================
395
396 if [ "$arg1" = "arch" ]; then
397
398 if [ "$argc" != "1" -o "$opts" != "" ]; then
399 echo "Usage: $0 $arg1"
400 echo
401 exit 1
402 fi
403
404 echo $arch
405 exit
406 fi
407
408 mike 1.1 ##==============================================================================
409 ##
410 ## compiler command:
411 ##
412 ##==============================================================================
413
414 if [ "$arg1" = "compiler" ]; then
415
416 if [ "$argc" != "1" -o "$opts" != "" ]; then
417 echo "Usage: $0 $arg1"
418 echo
419 exit 1
420 fi
421
422 echo $compiler
423 exit
424 fi
425
426 ##==============================================================================
427 ##
428 ## cc command:
429 mike 1.1 ##
430 ##==============================================================================
431
432 if [ "$arg1" = "cc" ]; then
433
434 if [ "$argc" != "1" -o "$opts" != "" ]; then
435 echo "Usage: $0 $arg1"
436 echo
437 exit 1
438 fi
439
440 case "$platform" in
441
442 LINUX_IX86_GNU|LINUX_X86_64_GNU)
443 echo gcc
444 ;;
445 MONTAVISTA_IX86_GNU)
446 echo 586-gcc
447 ;;
448 SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO)
449 echo cc
450 mike 1.1 ;;
451 AIX_PPC_IBM)
452 echo xlc_r
453 ;;
454 HPUX_IA64_HP|HPUX_PARISC_HP)
455 echo aCC -Ae
456 ;;
457 DARWIN_IX86_GNU)
458 echo gcc
459 ;;
460 esac
461
462 exit
463 fi
464
465 ##==============================================================================
466 ##
467 ## cxx command:
468 ##
469 ##==============================================================================
470
471 mike 1.1 if [ "$arg1" = "cxx" ]; then
472
473 if [ "$argc" != "1" -o "$opts" != "" ]; then
474 echo "Usage: $0 $arg1"
475 echo
476 exit 1
477 fi
478
479 case "$platform" in
480 LINUX_IX86_GNU|LINUX_X86_64_GNU)
481 echo g++
482 ;;
483 MONTAVISTA_IX86_GNU)
484 echo 586-g++
485 ;;
486 SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO)
487 echo CC
488 ;;
489 AIX_PPC_IBM)
490 echo xlC_r
491 ;;
492 mike 1.1 HPUX_IA64_HP|HPUX_PARISC_HP)
493 echo aCC -AA
494 ;;
495 DARWIN_IX86_GNU)
496 echo g++
497 ;;
498 esac
499
500 exit
501 fi
502
503 ##==============================================================================
504 ##
505 ## 'cflags' command:
506 ## 'cxxflags' command:
507 ##
508 ##==============================================================================
509
510 if [ "$arg1" = "cflags" -o "$arg1" = "cxxflags" ]; then
511
512 if [ "$argc" != "1" ]; then
513 mike 1.1 echo "Usage: $0 $arg1"
514 echo
515 exit 1
516 fi
517
518 if [ "$arg1" = "cflags" ]; then
519 c_opt=1
520 else
521 cxx_opt=1
522 fi
523
524 for opt in $opts
525 do
526 case $opt in
527 --debug)
528 debug_opt=1
529 ;;
530 --pic)
531 pic_opt=1
532 ;;
533 --errwarn)
534 mike 1.1 errwarn_opt=1
535 ;;
536 *)
537 echo "$arg1: unknown option: $opt"
538 exit 1
539 ;;
540 esac
541 done
542
543 r=""
544
545 case "$platform" in
546 LINUX_IX86_GNU|LINUX_X86_64_GNU|MONTAVISTA_IX86_GNU)
547 test -n "$debug_opt" && r="$r -g"
548 test -z "$debug_opt" && r="$r -g -O2"
549 test -n "$pic_opt" && r="$r -fPIC"
550 test -n "$errwarn_opt" && r="$r -Werror"
551 r="$r -Wall"
552 r="$r -fvisibility=hidden"
553 #test -n "$cxx_opt" && r="$r -fno-exceptions"
554 #test -n "$cxx_opt" && r="$r -fno-enforce-eh-specs"
555 mike 1.1 #test -n "$cxx_opt" && r="$r -fno-rtti"
556 ;;
557 SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO)
558
559 ## Debugger options.
560 test -n "$debug_opt" && r="$r -g"
561
562 ## Optimization options.
563 if test -z "$debug_opt"; then
564 test -n "$c_opt" && r="$r -g"
565 test -n "$cxx_opt" && r="$r -g -O"
566 fi
567
568 ## Generate position independent code (PIC).
569 test -n "$pic_opt" && r="$r -KPIC"
570
571 ## treat warnings as errors.
572 test -n "$errwarn_opt" && r="$r -errwarn"
573
574 ## multi-threaded support.
575 r="$r -mt"
576 mike 1.1
577 ## avoid optimizations that increase object code size.
578 r="$r -xspace"
579
580 ## specify target system.
581 r="$r -xtarget=generic"
582
583 ## specify target architecture.
584 r="$r -xarch=generic"
585
586 ## hide all library symbols by default.
587 r="$r -xldscope=hidden"
588
589 ## display brief message tag for each warning message.
590 r="$r -errtags=yes"
591
592 ## use standar pthread funciton declarations
593 r="$r -D_POSIX_PTHREAD_SEMANTICS"
594
595 ## suppress all warning messages.
596 #r="$r -erroff=%all"
597 mike 1.1
598 ## suppress this warning message.
599 test -n "$c_opt" && r="$r -erroff=E_WHITE_SPACE_IN_DIRECTIVE"
600
601 ;;
602 AIX_PPC_IBM)
603 test -n "$debug_opt" && r="$r -g"
604 test -n "$debug_opt" && r="$r -qcheck"
605 test -z "$debug_opt" && r="$r -O2"
606 test -z "$debug_opt" && r="$r -qcompact"
607 test -n "$pic_opt" && r="$r -qpic"
608 r="$r -q32"
609 r="$r -Daix"
610
611 ;;
612 HPUX_IA64_HP)
613 test -n "$debug_opt" && r="$r -g"
614 test -z "$debug_opt" && r="$r -s +O1"
615 r="$r +DD32"
616 r="$r -mt"
617 r="$r +Z"
618 mike 1.1 r="$r -Dhpux"
619 r="$r +W4232"
620 r="$r +W4275"
621 r="$r -D_XOPEN_SOURCE=600"
622 r="$r -D__STDC_EXT__"
623 ;;
624 HPUX_PARISC_HP)
625 test -n "$debug_opt" && r="$r -g +noobjdebug"
626 test -z "$debug_opt" && r="$r +O2 -s"
627 r="$r +Z"
628 r="$r +DAportable"
629 r="$r -mt"
630 r="$r -D_PSTAT64"
631 r="$r +W749"
632 r="$r +W740"
633 r="$r -Wl,+s"
634 r="$r -D__STDC_EXT__"
635 r="$r -D_XOPEN_SOURCE_EXTENDED"
636 ;;
637 DARWIN_IX86_GNU)
638 test -n "$debug_opt" && r="$r -g"
639 mike 1.1 test -z "$debug_opt" && r="$r -g -O2"
640 test -n "$pic_opt" && r="$r -fPIC"
641 test -n "$errwarn_opt" && r="$r -Werror"
642 r="$r -Wall"
643 r="$r -fvisibility=hidden"
644 r="$r -bind_at_load"
645 ;;
646 esac
647
648 echo $r
649 exit
650 fi
651
652 ##==============================================================================
653 ##
654 ## 'cshlibflags' command:
655 ## 'cxxshlibflags' command:
656 ##
657 ##==============================================================================
658
659 if [ "$arg1" = "cshlibflags" -o "$arg1" = "cxxshlibflags" ]; then
660 mike 1.1
661 if [ "$argc" != "1" ]; then
662 echo "Usage: $0 $arg1"
663 echo
664 exit 1
665 fi
666
667 if [ "$arg1" = "cshlibflags" ]; then
668 c_opt=1
669 else
670 cxx_opt=1
671 fi
672
673 for opt in $opts
674 do
675 arg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
676 case $opt in
677 --libpath=*)
678 libpath_opt=$arg
679 ;;
680 *)
681 mike 1.1 echo "$arg1: unknown option: $opt"
682 exit 1
683 ;;
684 esac
685 done
686
687 r=""
688
689 case "$platform" in
690 LINUX_IX86_GNU|LINUX_X86_64_GNU)
691 r="$r -shared"
692 test -n "$libpath_opt" && r="$r -Wl,-rpath=$libpath_opt"
693 ;;
694 MONTAVISTA_IX86_GNU)
695 r="$r -shared"
696 test -n "$libpath_opt" && r="$r -Wl,-rpath=$libpath_opt"
697 ;;
698 SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO)
699
700 ## multi-threaded support.
701 r="$r -mt"
702 mike 1.1
703 ## ignore the LD_LIBRARY_PATH variable when linking.
704 r="$r -i"
705
706 ## Build a dynamic shared library (rather than executable file).
707 r="$r -G"
708
709 ## Generate position independent code (PIC).
710 r="$r -KPIC"
711
712 ## Link with the standard C++ library.
713 test -n "$cxx_opt" && r="$r -lCstd"
714
715 ## link time library contains 'nanosleep'
716 r="$r -lrt"
717
718 ## hide all library symbols by default.
719 r="$r -xldscope=hidden"
720
721 ## Add libpath_opt to the dynamic library path.
722 test -n "$libpath_opt" && r="$r -R:$libpath_opt"
723 mike 1.1
724 ;;
725 AIX_PPC_IBM)
726 r="$r -brtl"
727 r="$r -G"
728 r="$r -qmkshrobj"
729 r="$r -q32"
730 if [ -n "$libpath_opt" ]; then
731 r="$r -blibpath:$libpath_opt:/usr/lib:/lib"
732 else
733 r="$r -blibpath:/usr/lib:/lib"
734 fi
735 r="$r -bnolibpath"
736 r="$r -Wl,-bnoautoexp"
737 r="$r -Wl,-bnoexpall"
738 ;;
739 HPUX_IA64_HP)
740 r="$r +DD32"
741 r="$r -mt"
742 r="$r +Z -Dhpux"
743 r="$r +W4232"
744 mike 1.1 r="$r +W4275"
745 r="$r -D_XOPEN_SOURCE=600"
746 r="$r -D__STDC_EXT__"
747 r="$r -lc"
748 r="$r -b"
749 test -n "$libpath_opt" && r="$r +b $libpath_opt"
750 test -n "$cxx_opt" && r="$r -lunwind"
751 test -n "$cxx_opt" && r="$r -lCsup"
752 ;;
753 HPUX_PARISC_HP)
754 r="$r -b"
755 r="$r -Wl,-Bsymbolic"
756 r="$r -Wl,+s"
757 ;;
758 DARWIN_IX86_GNU)
759 r="$r -dynamiclib"
760 test -n "$libpath_opt" && r="$r -R$libpath_opt"
761 r="$r -bind_at_load"
762 ;;
763 esac
764
765 mike 1.1 echo $r
766 exit
767 fi
768
769 ##==============================================================================
770 ##
771 ## 'cprogflags' command:
772 ## 'cxxprogflags' command:
773 ##
774 ##==============================================================================
775
776 if [ "$arg1" = "cprogflags" -o "$arg1" = "cxxprogflags" ]; then
777
778 if [ "$argc" != "1" ]; then
779 echo "Usage: $0 $arg1"
780 echo
781 exit 1
782 fi
783
784 if [ "$arg1" = "cprogflags" ]; then
785 c_opt=1
786 mike 1.1 else
787 cxx_opt=1
788 fi
789
790 for opt in $opts
791 do
792 arg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
793 case $opt in
794 --libpath=*)
795 libpath_opt=$arg
796 ;;
797 *)
798 echo "$arg1: unknown option: $opt"
799 exit 1
800 ;;
801 esac
802 done
803
804 r=""
805
806 case "$platform" in
807 mike 1.1 LINUX_IX86_GNU|LINUX_X86_64_GNU)
808 test -n "$libpath_opt" && r="$r -Wl,-rpath=$libpath_opt"
809 ;;
810 MONTAVISTA_IX86_GNU)
811 test -n "$libpath_opt" && r="$r -Wl,-rpath=$libpath_opt"
812 ;;
813 SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO)
814
815 ## multi-threaded support.
816 r="$r -mt"
817
818 ## ignore the LD_LIBRARY_PATH variable when linking.
819 r="$r -i"
820
821 ## link time library contains 'nanosleep'
822 r="$r -lrt"
823
824 ## hide all library symbols by default.
825 r="$r -xldscope=hidden"
826
827 ## Add libpath_opt to the dynamic library path.
828 mike 1.1 test -n "$libpath_opt" && r="$r -R:$libpath_opt"
829
830 ;;
831
832 AIX_PPC_IBM)
833 r="$r -brtl"
834 r="$r -q32"
835 r="$r -qrtti=dyna"
836 r="$r -qcpluscmt"
837 if [ -n "$libpath_opt" ]; then
838 r="$r -blibpath:$libpath_opt:/usr/lib:/lib"
839 else
840 r="$r -blibpath:/usr/lib:/lib"
841 fi
842 ;;
843 HPUX_IA64_HP)
844 r="$r +DD32"
845 r="$r -mt"
846 r="$r +Z -Dhpux"
847 r="$r +W4232"
848 r="$r +W4275"
849 mike 1.1 r="$r -D_XOPEN_SOURCE=600"
850 r="$r -D__STDC_EXT__"
851 test -n "$libpath_opt" && r="$r +b $libpath_opt"
852 ;;
853 HPUX_PARISC_HP)
854 r="$r +Z"
855 r="$r +DAportable"
856 r="$r -mt"
857 r="$r -D_PSTAT64"
858 ;;
859 DARWIN_IX86_GNU)
860 test -n "$libpath_opt" && r="$r -R$libpath_opt"
861 r="$r -bind_at_load"
862 ;;
863 esac
864
865 echo $r
866 exit
867 fi
868
869 ##==============================================================================
870 mike 1.1 ##
871 ## mkdep command:
872 ##
873 ##==============================================================================
874
875 if [ "$arg1" = "mkdep" ]; then
876
877 if [ "$argc" != "1" -o "$opts" != "" ]; then
878 echo "Usage: $0 $arg1"
879 echo
880 exit 1
881 fi
882
883 r=""
884
885 case "$platform" in
886 LINUX_IX86_GNU|LINUX_X86_64_GNU)
887 r="gcc -M"
888 ;;
889 MONTAVISTA_IX86_GNU)
890 r="586-gcc -M"
891 mike 1.1 ;;
892 SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO)
893 r="CC -xM1"
894 ;;
895 AIX_PPC_IBM)
896 r="xlc++_r -E -qmakedep=gcc"
897 ;;
898 HPUX_IA64_HP|HPUX_PARISC_HP)
899 r="aCC +make -E"
900 ;;
901 DARWIN_IX86_GNU)
902 r="gcc -M"
903 ;;
904 esac
905
906 echo "$r"
907 exit
908 fi
909
910 ##==============================================================================
911 ##
912 mike 1.1 ## syslibs command:
913 ##
914 ##==============================================================================
915
916 if [ "$arg1" = "syslibs" ]; then
917
918 if [ "$argc" != "1" -o "$opts" != "" ]; then
919 echo "Usage: $0 $arg1"
920 echo
921 exit 1
922 fi
923
924 r=""
925
926 case "$platform" in
927 LINUX_IX86_GNU|LINUX_X86_64_GNU)
928 r="-lpthread -ldl -lpam"
929 ;;
930 MONTAVISTA_IX86_GNU)
931 r="-lpthread -ldl -lpam"
932 ;;
933 mike 1.1 SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO)
934 r="-lpthread -lsocket -lnsl -ldl -lpam"
935 ;;
936 AIX_PPC_IBM)
937 r="-lpthread -ldl -lpam"
938 ;;
939 HPUX_IA64_HP)
940 r="-lpthread -ldl -lpam"
941 ;;
942 HPUX_PARISC_HP)
943 r="-lpthread -lpam"
944 ;;
945 DARWIN_IX86_GNU)
946 r="-lpthread -ldl -lpam"
947 ;;
948 esac
949
950 echo "$r"
951 exit
952 fi
953
954 mike 1.1 ##==============================================================================
955 ##
956 ## libpath command:
957 ##
958 ##==============================================================================
959
960 if [ "$arg1" = "libpath" ]; then
961
962 if [ "$argc" -lt "2" -o "$opts" != "" ]; then
963 echo "Usage: $0 $arg1 PATH"
964 echo
965 exit 1
966 fi
967
968 r=""
969 args="$arg2 $arg3 $arg4 $arg5 $arg6 $arg7 $arg8 $arg9"
970
971 case "$platform" in
972 LINUX_IX86_GNU|LINUX_X86_64_GNU)
973 for path in $args
974 do
975 mike 1.1 r="$r -Wl,-rpath=$path"
976 done
977 ;;
978 MONTAVISTA_IX86_GNU)
979 for path in $args
980 do
981 r="$r -Wl,-rpath=$path"
982 done
983 ;;
984 SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO)
985 for path in $args
986 do
987 r="$r -R:$path"
988 done
989 ;;
990 AIX_PPC_IBM)
991 r="-blibpath:/usr/lib:/lib"
992 for path in $args
993 do
994 r="$r:$path"
995 done
996 mike 1.1 ;;
997 HPUX_IA64_HP)
998 r="-Wl,+b,"
999 first=1
1000 for path in $args
1001 do
1002 if [ -n "$first" ]; then
1003 r="$r$path"
1004 first=""
1005 else
1006 r="$r:$path"
1007 fi
1008 done
1009 ;;
1010 HPUX_PARISC_HP)
1011 #r="-Wl,+cdp,"
1012 r="-Wl,+b,"
1013 first=1
1014 for path in $args
1015 do
1016 if [ -n "$first" ]; then
1017 mike 1.1 r="$r$path"
1018 first=""
1019 else
1020 r="$r:$path"
1021 fi
1022 done
1023 ;;
1024 DARWIN_IX86_GNU)
1025 for path in $args
1026 do
1027 r="$r -R$path"
1028 done
1029 ;;
1030 esac
1031
1032 echo "$r"
1033 exit
1034 fi
1035
1036 ##==============================================================================
1037 ##
1038 mike 1.1 ## libname command:
1039 ##
1040 ##==============================================================================
1041
1042 if [ "$arg1" = "libname" ]; then
1043
1044 if [ "$argc" -lt "2" -o "$opts" != "" ]; then
1045 echo "Usage: $0 $arg1 PATH"
1046 echo
1047 exit 1
1048 fi
1049
1050 r=""
1051
1052 case "$platform" in
1053 LINUX_IX86_GNU|LINUX_X86_64_GNU)
1054 ;;
1055 MONTAVISTA_IX86_GNU)
1056 ;;
1057 SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO)
1058 ;;
1059 mike 1.1 AIX_PPC_IBM)
1060 ;;
1061 HPUX_IA64_HP)
1062 ;;
1063 HPUX_PARISC_HP)
1064 ;;
1065 DARWIN_IX86_GNU)
1066 r="$r -Wl,-install_name -Wl,$arg2"
1067 ;;
1068 esac
1069
1070 echo "$r"
1071 exit
1072 fi
1073
1074 ##==============================================================================
1075 ##
1076 ## 'shlibname' command:
1077 ##
1078 ##==============================================================================
1079
1080 mike 1.1 if [ "$arg1" = "shlibname" ]; then
1081
1082 if [ "$argc" != "2" -o "$opts" != "" ]; then
1083 echo "Usage: $0 $arg1 LIBBASENAME"
1084 echo
1085 exit 1
1086 fi
1087
1088 case "$platform" in
1089 LINUX_IX86_GNU|LINUX_X86_64_GNU)
1090 echo "lib$arg2.so"
1091 ;;
1092 MONTAVISTA_IX86_GNU)
1093 echo "lib$arg2.so"
1094 ;;
1095 SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO)
1096 echo "lib$arg2.so"
1097 ;;
1098 AIX_PPC_IBM)
1099 echo "lib$arg2.so"
1100 ;;
1101 mike 1.1 HPUX_IA64_HP)
1102 echo "lib$arg2.so"
1103 ;;
1104 HPUX_PARISC_HP)
1105 echo "lib$arg2.sl"
1106 ;;
1107 DARWIN_IX86_GNU)
1108 echo "lib$arg2.dylib"
1109 ;;
1110 esac
1111
1112 exit
1113 fi
1114
1115 ##==============================================================================
1116 ##
1117 ## 'shlibext' command:
1118 ##
1119 ##==============================================================================
1120
1121 if [ "$arg1" = "shlibext" ]; then
1122 mike 1.1
1123 if [ "$argc" != "1" -o "$opts" != "" ]; then
1124 echo "Usage: $0 $arg1"
1125 echo
1126 exit 1
1127 fi
1128
1129 case "$platform" in
1130 LINUX_IX86_GNU|LINUX_X86_64_GNU)
1131 echo "so"
1132 ;;
1133 MONTAVISTA_IX86_GNU)
1134 echo "so"
1135 ;;
1136 SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO)
1137 echo "so"
1138 ;;
1139 AIX_PPC_IBM)
1140 echo "so"
1141 ;;
1142 HPUX_IA64_HP)
1143 mike 1.1 echo "so"
1144 ;;
1145 HPUX_PARISC_HP)
1146 echo "sl"
1147 ;;
1148 DARWIN_IX86_GNU)
1149 echo "dylib"
1150 ;;
1151 *)
1152 echo "so"
1153 esac
1154
1155 exit
1156 fi
1157
1158 ##==============================================================================
1159 ##
1160 ## 'openssllibdir' command:
1161 ##
1162 ##==============================================================================
1163
1164 mike 1.1 if [ "$arg1" = "openssllibdir" ]; then
1165
1166 if [ "$argc" != "1" -o "$opts" != "" ]; then
1167 echo "Usage: $0 $arg1"
1168 echo
1169 exit 1
1170 fi
1171
1172 ##
1173 ## (1) Locate libdir with pkg-config.
1174 ##
1175
1176 pkgconfig=`which pkg-config 2> /dev/null`
1177
1178 if [ -x "$pkgconfig" ]; then
1179 libdir=`$pkgconfig --variable=libdir openssl`
1180 fi
1181
1182 ##
1183 ## (2) Locate libdir relative to openssl program.
1184 ##
1185 mike 1.1
1186 if [ -z "$libdir" ]; then
1187 openssl=`which openssl 2> /dev/null`
1188
1189 if [ -x "$openssl" ]; then
1190 case "$platform" in
1191 HPUX_PARISC_HP)
1192 shlibext="sl"
1193 ;;
1194 DARWIN_IX86_GNU)
1195 shlibext="dylib"
1196 ;;
1197 *)
1198 shlibext="so"
1199 ;;
1200 esac
1201 dirname=`dirname $openssl`/..
1202 if [ -d "$dirname" ]; then
1203 dirname=`cd "$dirname"; pwd`
1204 if [ -f "$dirname/lib/libssl.$shlibext" ]; then
1205 libdir=$dirname/lib
1206 mike 1.1 elif [ -f "$dirname/ssl/lib/libssl.$shlibext" ]; then
1207 libdir=$dirname/ssl/lib
1208 fi
1209 fi
1210 fi
1211 fi
1212
1213 ##
1214 ## (3) Locate libdir based on platform identifier.
1215 ##
1216
1217 if [ -z "$libdir" ]; then
1218 case "$platform" in
1219 LINUX_IX86_GNU|LINUX_X86_64_GNU)
1220 if [ -f "/usr/lib/libssl.so" ]; then
1221 libdir=/usr/lib
1222 fi
1223 ;;
1224 MONTAVISTA_IX86_GNU)
1225 if [ -f "/usr/lib/libssl.so" ]; then
1226 libdir=/usr/lib
1227 mike 1.1 fi
1228 ;;
1229 SUNOS_I86PC_SUNPRO)
1230 if [ -f "/usr/sfw/lib/libssl.so" ]; then
1231 libdir=/usr/sfw/lib
1232 fi
1233 ;;
1234 SUNOS_SPARC_SUNPRO)
1235 if [ -f "/usr/local/ssl/lib/libssl.so" ]; then
1236 libdir=/usr/local/ssl/lib
1237 fi
1238 ;;
1239 AIX_PPC_IBM)
1240 if [ -f "/usr/lib/libssl.sl" ]; then
1241 libdir=/usr/lib
1242 fi
1243 ;;
1244 HPUX_IA64_HP)
1245 if [ -f "/opt/openssl/lib/libssl.sl" ]; then
1246 libdir=/opt/openssl/lib
1247 fi
1248 mike 1.1 ;;
1249 HPUX_PARISC_HP)
1250 if [ -f "/usr/local/lib/libssl.sl" ]; then
1251 libdir=/usr/local/lib
1252 fi
1253 ;;
1254 DARWIN_IX86_GNU)
1255 if [ -f "/usr/lib/libssl.dylib" ]; then
1256 libdir=/usr/lib
1257 fi
1258 ;;
1259 *)
1260 echo "so"
1261 esac
1262 fi
1263
1264 echo "$libdir"
1265 exit
1266
1267 fi
1268
1269 mike 1.1 ##==============================================================================
1270 ##
1271 ## 'ldlibrarypath' command:
1272 ##
1273 ##==============================================================================
1274
1275 if [ "$arg1" = "ldlibrarypath" ]; then
1276
1277 if [ "$argc" != "1" -o "$opts" != "" ]; then
1278 echo "Usage: $0 $arg1"
1279 echo
1280 exit 1
1281 fi
1282
1283 case "$platform" in
1284 HPUX_IA64_HP|HPUX_PARISC_HP)
1285 echo "SHLIB_PATH"
1286 ;;
1287 DARWIN_IX86_GNU)
1288 echo "DYLD_LIBRARY_PATH"
1289 ;;
1290 mike 1.1 *)
1291 echo "LD_LIBRARY_PATH"
1292 esac
1293
1294 exit
1295 fi
1296
1297 ##==============================================================================
1298 ##
1299 ## Unknown command:
1300 ##
1301 ##==============================================================================
1302
1303 echo "$0: unknown command: $arg1"
1304 exit 1
|