]> git.mxchange.org Git - flightgear.git/blob - Main/runfg.in
Edited cvs log messages in source files ... bad bad bad!
[flightgear.git] / Main / runfg.in
1 #!/usr/bin/perl
2 #
3 # runfg -- front end for setting up the FG_ROOT env variable and launching 
4 #          the fg executable.
5 #
6 # Written by Curtis Olson, started September 1997.
7 #
8 # Copyright (C) 1997 - 1998  Curtis L. Olson  - curt@me.umn.edu
9 #
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.
14 #
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.
19 #
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.
23 #
24 # $Id$
25 # (Log is kept at end of this file)
26 #---------------------------------------------------------------------------
27
28
29 $prefix = "@prefix@";
30 # print "-> $prefix\n";
31
32 # potential names of Flight Gear executable to try
33 @files = ( "fg", "fg.exe" );
34
35 # potential paths where the executable may be found
36 @paths = ( ".", "Simulator/Main", $prefix );
37
38 # search for the executable
39 $savepath = "";
40 $savefile = "";
41
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";
50                 $savefile = "$file";
51             } elsif ( -x "$path/$file" ) {
52                 $savepath = "$path";
53                 $savefile = "$file";
54             }
55         } else {
56             # print "skipping $path/bin/$file and $path/$file\n";
57         }
58     }
59 }
60
61 die "Cannot locate program.\n" if ( $savepath eq "" );
62
63
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;
67 }
68
69 # set the LD_LIBRARY_PATH environment variable if running the
70 # installed version
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";
75     } else {
76         $ENV{LD_LIBRARY_PATH} = "$prefix/lib:$ENV{LD_LIBRARY_PATH}";
77     }
78 } else {
79     print "(development version)\n";
80 }
81
82 # run Flight Gear
83 print "Running $savepath/$savefile @ARGV\n";
84 exec("$savepath/$savefile @ARGV");
85
86
87 #---------------------------------------------------------------------------
88 # $Log$
89 # Revision 1.2  1998/04/25 22:06:31  curt
90 # Edited cvs log messages in source files ... bad bad bad!
91 #
92 # Revision 1.1  1998/04/09 01:45:31  curt
93 # Moved to Main/ and incorperated with automake
94 #
95 # Revision 1.4  1998/03/09 22:52:38  curt
96 # Mod's to better support win32 if perl exists.
97 #
98 # Revision 1.3  1998/02/16 16:17:34  curt
99 # Minor tweaks.
100 #
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.
104 #
105 # Revision 1.1  1997/10/28 18:47:27  curt
106 # Initial revision.
107 #