summaryrefslogtreecommitdiff
path: root/configure
blob: 93f092c7dbf28fe708d01e78bf2b26b5a6129304 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#!/usr/bin/env bash
#
# Copyright 2009-2015 Yorba Foundation
#
# This software is licensed under the GNU LGPL (version 2.1 or later).
# See the COPYING file in this distribution.

CONFIG_IN=configure.mk

configure_help() {
    cat <<- EOT
Usage:
    ./configure [OPTIONS]...

Options:
    -h, --help              Print this help and exit.
    --assume-pkgs           Turn off package version checking.
    --build=DIR             Build secondary files in DIR.
    --debug | --release	    Build executable for debugging or release.
                            [--release]
    --profile               Enable profiling support during C compile & link.
    --prefix=PREFIX         Prepend PREFIX to program installation paths.
                            [/usr/local]
    --lib=LIBNAME           Set system library directory name to LIBNAME
                            (usually 'lib' or 'lib64').
                            [lib]
    --libdir LIBNAME        Equivalent to --lib=LIBNAME
    --libexec=LIBEXECDIR    Set utility executable to LIBEXECDIR
                            (usually 'PREFIX/libexec/shotwell').
                            [PREFIX/libexec/shotwell]
    --libexec LIBEXECDIR    Equivalent to --libexec=LIBEXECDIR

    --define=SYMBOL         Define a symbol for the Vala compiler.


    --disable-schemas-compile
                            Disable compiling the GSettings schema.
    --disable-gsettings-convert-install
                            Disable installing the gsettings-data-convert file.
    --disable-desktop-update
                            Disable desktop database update.
    --disable-desktop-validate
                            Disable validation of .desktop files.
    --disable-icon-update
                            Disable icon cache update.
    --enable-build-for-glade
                            Enable build for Glade-related development.
    --disable-help-install
                            Disable installation of online help.
    --disable-extra-plugins-install
                            Disable installation of extra (non-core) plugins.
    --install-headers
                            Install headers and VAPI files (developers only).
    --unity-support
                            Enable support for progress bars in the Unity launcher.
EOT
}

abort() {
    printf "%s: Invalid argument %s\n" $0 $1
    configure_help
    exit 1
}

while [ $# != 0 ]
do
    option=`echo $1 | sed 's/=.*//'`
    if [ `echo $1 | grep '='` ]
    then
        value=`echo $1 | sed 's/.*=//'`
    fi

    case $option in
        -h | --help)        configure_help
                            exit 0
                            ;;
        
        --prefix)           if [ ! $value ]
                            then
                                shift
                                value=$1
                            fi
                            
                            variables="${variables}PREFIX=$value\n"
                            ;;

        --lib | --libdir)   if [ ! $value ]
                            then
                                shift
                                value=$1
                            fi
                            
                            variables="${variables}LIB=$value\n"
                            ;;

        --libexec)          if [ ! $value ]
                            then
                                shift
                                value=$1
                            fi
                            
                            variables="${variables}LIBEXECDIR=$value\n"
                            ;;

        --assume-pkgs)      variables="${variables}ASSUME_PKGS=1\n"
                            ;;
        
        --build)            if [ ! $value ]
                            then
                                shift
                                value=$1
                            fi
                            
                            variables="${variables}BUILD_DIR=$value\n"
                            ;;
        
        --debug)            variables="${variables}BUILD_RELEASE=\nBUILD_DEBUG=1\n"
                            ;;
        
        --profile)          variables="${variables}PROFILE_FLAGS=-pg\n"
                            ;;
        
        --release)          variables="${variables}BUILD_DEBUG=\nBUILD_RELEASE=1\n"
                            ;;
        
        --define)           variables="${variables}USER_VALAFLAGS+=--define=$value\n"
                            ;;
                            
        --disable-schemas-compile)        variables="${variables}DISABLE_SCHEMAS_COMPILE=1\n"
                                          ;;
        
        --disable-gsettings-convert-install)    variables="${variables}DISABLE_GSETTINGS_CONVERT_INSTALL=1\n"
                                                ;;
        
        --disable-desktop-update)         variables="${variables}DISABLE_DESKTOP_UPDATE=1\n"
                                          ;;

        --disable-desktop-validate)       variables="${variables}DISABLE_DESKTOP_VALIDATE=1\n"
                                          ;;

        --disable-icon-update)            variables="${variables}DISABLE_ICON_UPDATE=1\n"
                                          ;;

        --enable-build-for-glade)         variables="${variables}ENABLE_BUILD_FOR_GLADE=1\n"
                                          ;;
        --disable-help-install)           variables="${variables}DISABLE_HELP_INSTALL=1\n"
                                          ;;
        --disable-extra-plugins-install)  variables="${variables}DISABLE_EXTRA_PLUGINS_INSTALL=1\n"
                                          ;;
        
        --install-headers)                variables="${variables}INSTALL_HEADERS=1\n"
                                          ;;
        
        --unity-support)                  variables="${variables}UNITY_SUPPORT=1\n"
                                          ;;
        
        --enable-* | --disable-*)
        
                            echo WARNING: unrecognized option: $option
                            ;;
        
        *)                  if [ `echo $option | grep '\-\-'` ]
                            then
                                # we've hit a bogus '--' -type argument, don't accept it.
                                abort $option
                            fi
                            
                            # this argument isn't for us; pass it on to the makefile phase.
                            variables="${variables}${option}=${value}\n"
                            ;;
    esac

    value=""
    shift
done

# detect version of libgphoto2 the compilation host has installed
pkg-config --atleast-version 2.5 libgphoto2
if [ $? == 1 ]
then 
    pkg-config --atleast-version 2.4 libgphoto2
    if [ $? == 1 ]
    then
        printf "No compatible libGPhoto installation found. Configuration cannot continue.\n";
        exit 1
    else
        printf "Detected libGPhoto 2.4.x - using default code path.\n";
    fi
else
    printf "Detected libGPhoto 2.5.x - using 2.5-aware code path.\n";
    variables="${variables}WITH_GPHOTO_25=1\n"
fi

rm -f $CONFIG_IN
if [ $variables ]
then
    echo -e -n $variables > $CONFIG_IN
fi
echo "CONFIG_IN=${CONFIG_IN}" >> $CONFIG_IN

printf "Configured.  Type 'make' to build, 'make install' to install.\n"