help.m4 revision 443:efd26e051e50
1#
2# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# This code is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 2 only, as
7# published by the Free Software Foundation.  Oracle designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Oracle in the LICENSE file that accompanied this code.
10#
11# This code is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14# version 2 for more details (a copy is included in the LICENSE file that
15# accompanied this code).
16#
17# You should have received a copy of the GNU General Public License version
18# 2 along with this work; if not, write to the Free Software Foundation,
19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22# or visit www.oracle.com if you need additional information or have any
23# questions.
24#
25
26function prepare_help_system {
27    AC_CHECK_PROGS(PKGHANDLER, apt-get yum port pkgutil pkgadd)
28}
29	
30function help_on_build_dependency {
31    # Print a helpful message on how to acquire the necessary build dependency.
32    # $1 is the help tag: freetyp2, cups, pulse, alsa etc
33    MISSING_DEPENDENCY=$1
34    PKGHANDLER_COMMAND=
35
36    case $PKGHANDLER in
37	apt-get)
38                apt_help     $MISSING_DEPENDENCY ;;
39    yum)
40                yum_help     $MISSING_DEPENDENCY ;;
41	port)
42                port_help    $MISSING_DEPENDENCY ;;
43	pkgutil)
44                pkgutil_help $MISSING_DEPENDENCY ;;
45	pkgadd)
46                pkgadd_help  $MISSING_DEPENDENCY ;;
47    * )
48      break ;;
49    esac
50
51    if test "x$PKGHANDLER_COMMAND" != x; then
52        HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
53    fi
54}
55
56function apt_help {
57    case $1 in
58    devkit)
59        PKGHANDLER_COMMAND="sudo apt-get install build-essential" ;;
60    openjdk)
61        PKGHANDLER_COMMAND="sudo apt-get install openjdk-7-jdk" ;;
62    alsa)
63        PKGHANDLER_COMMAND="sudo apt-get install libasound2-dev" ;;
64    cups)
65        PKGHANDLER_COMMAND="sudo apt-get install libcups2-dev" ;;
66    freetype2)
67        PKGHANDLER_COMMAND="sudo apt-get install libfreetype6-dev" ;;
68    pulse)
69        PKGHANDLER_COMMAND="sudo apt-get install libpulse-dev" ;;
70    x11)
71        PKGHANDLER_COMMAND="sudo apt-get install libX11-dev libxext-dev libxrender-dev libxtst-dev" ;;
72    ccache)
73        PKGHANDLER_COMMAND="sudo apt-get install ccache" ;;
74    * )
75       break ;;
76    esac
77}
78
79function yum_help {
80    case $1 in
81    devkit)
82        PKGHANDLER_COMMAND="sudo yum groupinstall \"Development Tools\"" ;;
83    openjdk)
84        PKGHANDLER_COMMAND="sudo yum install java-1.7.0-openjdk" ;;
85    alsa)
86        PKGHANDLER_COMMAND="sudo yum install alsa-lib-devel" ;;
87    cups)
88        PKGHANDLER_COMMAND="sudo yum install cups-devel" ;;
89    freetype2)
90        PKGHANDLER_COMMAND="sudo yum install freetype2-devel" ;;
91    pulse)
92        PKGHANDLER_COMMAND="sudo yum install pulseaudio-libs-devel" ;;
93    x11)
94        PKGHANDLER_COMMAND="sudo yum install libXtst-devel" ;;
95    ccache)
96        PKGHANDLER_COMMAND="sudo yum install ccache" ;;
97    * )
98       break ;;
99    esac
100}
101
102function port_help {
103    PKGHANDLER_COMMAND=""
104}
105
106function pkgutil_help {
107    PKGHANDLER_COMMAND=""
108}
109
110function pkgadd_help {
111    PKGHANDLER_COMMAND=""
112}
113