#!/usr/bin/perl

#
#
#
#
die "This is really old and needs updating before using!!!";
#
#
#
#


$LaxkitVersion="0.0.8.1";
#$prefix="/usr/local/lib";
$prefix="/usr/local/";
$iprefix="/interfaces";

$imlibflags=`imlib2-config --libs`;
$ldsoflags  ="-L/usr/X11R6/lib -lX11 -lm -lXpm -lpng -lcups $imlibflags -llaxinterfaces -llaxkit\n";
$ldflags="-L/usr/X11R6/lib -lX11 -lm -lXpm -lpng -lcups $imlibflags $prefix$iprefix/liblaxinterfaces.a $prefix/liblaxkit.a\n";
$cppflags = "";


$usage = <<"END_OF_USAGE";
A C++ X window toolkit by Tom Lechner

Syntax: lax-config --make-laxrc --cppflags --ldflags --libs --ldstaticflags 
           --version --help --use* --cpp --make-laxrc
Options:
   -h, --help             Output this help then exit
   -v, --version          Output the laxkit version, then exit
   -m, --make-laxrc       Output a generic laxrc to stdout
   -c, --cppflags         Output cpp compiler flags
   -l, --libs             Output linker flags assuming shared lax libraries
   -s, --staticlibs       Output linker flags assuming static lax libraries
   -i, --with-interfaces  Include liblaxinterfaces libraries
   --with-cairo           Unimplemented
   --with-antigrain       Unimplemented
END_OF_USAGE

$usage="Laxkit Version $LaxkitVersion\n$usage";

$doc=0;
$dolibs=0;

$numargs=@ARGV;
foreach $arg (@ARGV) {
	if ($arg eq "--help" || $arg eq "-h") {
		#------------------------- Help ------------------------
		die $usage;
		
	} elsif ($arg eq "--version" || $arg eq "-v") {
		#------------------------- Version ------------------------
		die "Laxkit Version $LaxkitVersion\n";
		
	} elsif ($arg eq "--cppflags" || $arg eq "-c") {
		#------------------------- cppflags ------------------------
		$doc=1;
		
	} elsif ($arg eq "--libs" || $arg eq "-l") {
		#------------------------- libs ------------------------
		$dolibs=1;
		
	} elsif ($arg eq "--staticlibs" || $arg eq "-s") {
		#------------------------- static libs ------------------------
		$dolibs=2;
		
	} elsif ($arg eq "--make-laxrc" || $arg eq "-m") {
		#------------------------- Make Laxrc ------------------------
	die << "EOF"
directories
	profiledirpath  /usr/local/profiles:/blah/blah
	opendir

bookmarks
	"text label" "path" "mask" "icon path"

field value
field value

[profilename]
	field value
	...
# this is a comment
 # these times are in milliseconds
firstclk       142  # <-- 1/7 of second
dblclk         200  # <-- 1/5 of second
idleclick      67   # <-- 1/15 of second
tooltips       500
padx           5
pady           5
bevel          2
control_border 1

# file bookmarks have "text label" "bookmark path" "mask" "icon path"
bookmarks
    Home /home/tom "" /home/tom/images/icons/blah.png
    Blah /blah/blah AFCXBFBAB3423bBFAS....  #<-- embedded icon

directories
    colorprofiles /usr/local/colorprofiles
    imagedir      /blah/images

profile default
    color_fg            255 0 0 
    color_bg            31 31 31 
    color_text          255 0 0
    color_textbg        0 0 0
    color_htext         255 0 255
    color_htextbg       127 127 127
    color_border        0 0 200
    color_aborder       0 0 255
    color_menutext      255 0 0
    color_menuhtext     255 0 0
    color_menuhbg       127 127 127
    color_menuofftext   127 0 0
    color_button        160 160 160
    color_buttontext    0 0 0
    color_buttonmo      144 144 144
    color_pad           64 64 64
    color_tooltipbg     128 128 255
    color_tooltiptext 0 0 0

profile light
    color_fg          32 32 32 
    color_bg          192 192 192 
    color_text        64 64 64
    color_textbg      255 255 255
    color_htext       0 0 0
    color_htextbg     127 127 127
    color_border      128 128 128
    color_aborder     0 0 0
    color_menutext    0 0 0
    color_menuhtext   255 0 0
    color_menuhbg     127 127 127
    color_menuofftext 127 0 0
    color_button      192 192 192
    color_buttontext  0 0 0
    color_buttonmo    164 164 164
    color_pad         128 128 128
    color_tooltipbg   128 128 255
    color_tooltiptext 0 0 0

program laidout
    bookmarks
        blah blah "*.laidout" icon.png
    tooltips  500
EOF
	} 
}

if ($doc==1) {
	if ($cppflags eq "") { exit 0; }
	print "$cppflags";
	exit 0;
}
if ($dolibs==1) {
	print $ldsoflags;
	exit 0;
}
if ($dolibs==2) {
	print $ldflags;
	exit 0;
}

die $usage
