3 # runfg -- front end for setting up the FG_ROOT env variable and launching
6 # Written by Curtis Olson, started September 1997.
8 # Copyright (C) 1997 - 1998 Curtis L. Olson - curt@me.umn.edu
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 # (Log is kept at end of this file)
26 #---------------------------------------------------------------------------
30 # print "-> $prefix\n";
32 # potential names of Flight Gear executable to try
33 @files = ( "fg", "fg.exe" );
35 # potential paths where the executable may be found
36 @paths = ( ".", "Simulator/Main", $prefix );
38 # search for the executable
42 foreach $path (@paths) {
43 foreach $file (@files) {
44 # print "'$savepath'\n";
45 if ( $savepath eq "" ) {
46 # don't search again if we've already found one
47 # print "checking $path" . "bin/$file and $path" . "$file\n";
48 if ( -x "$path/bin/$file" ) {
49 $savepath = "$path/bin";
51 } elsif ( -x "$path/$file" ) {
56 # print "skipping $path/bin/$file and $path/$file\n";
61 die "Cannot locate program.\n" if ( $savepath eq "" );
64 # set the FG_ROOT environment variable if it hasn't already been set.
65 if ( $ENV{FG_ROOT} eq "" ) {
66 $ENV{FG_ROOT} = $prefix;
69 # set the LD_LIBRARY_PATH environment variable if running the
71 if ( $savepath eq "@prefix@/bin" ) {
72 print "(installed version)\n";
73 if ( $ENV{LD_LIBRARY_PATH} eq "" ) {
74 $ENV{LD_LIBRARY_PATH} = "$prefix/lib";
76 $ENV{LD_LIBRARY_PATH} = "$prefix/lib:$ENV{LD_LIBRARY_PATH}";
79 print "(development version)\n";
83 print "Running $savepath/$savefile @ARGV\n";
84 exec("$savepath/$savefile @ARGV");
87 #---------------------------------------------------------------------------
89 # Revision 1.2 1998/04/25 22:06:31 curt
90 # Edited cvs log messages in source files ... bad bad bad!
92 # Revision 1.1 1998/04/09 01:45:31 curt
93 # Moved to Main/ and incorperated with automake
95 # Revision 1.4 1998/03/09 22:52:38 curt
96 # Mod's to better support win32 if perl exists.
98 # Revision 1.3 1998/02/16 16:17:34 curt
101 # Revision 1.2 1998/01/27 00:47:43 curt
102 # Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
103 # system and commandline/config file processing code.
105 # Revision 1.1 1997/10/28 18:47:27 curt