duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # |
alanb | 0d05823 | 2012-11-02 15:50:11 +0000 | [diff] [blame] | 4 | # Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 5 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 6 | # |
| 7 | # This code is free software; you can redistribute it and/or modify it |
| 8 | # under the terms of the GNU General Public License version 2 only, as |
ohair | 2283b9d | 2010-05-25 15:58:33 -0700 | [diff] [blame] | 9 | # published by the Free Software Foundation. Oracle designates this |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 10 | # particular file as subject to the "Classpath" exception as provided |
ohair | 2283b9d | 2010-05-25 15:58:33 -0700 | [diff] [blame] | 11 | # by Oracle in the LICENSE file that accompanied this code. |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 12 | # |
| 13 | # This code is distributed in the hope that it will be useful, but WITHOUT |
| 14 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 15 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 16 | # version 2 for more details (a copy is included in the LICENSE file that |
| 17 | # accompanied this code). |
| 18 | # |
| 19 | # You should have received a copy of the GNU General Public License version |
| 20 | # 2 along with this work; if not, write to the Free Software Foundation, |
| 21 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 22 | # |
ohair | 2283b9d | 2010-05-25 15:58:33 -0700 | [diff] [blame] | 23 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 24 | # or visit www.oracle.com if you need additional information or have any |
| 25 | # questions. |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 26 | # |
| 27 | |
| 28 | |
| 29 | ############################################################################# |
| 30 | # |
| 31 | # Generic build profile.sh for all platforms, works in bash, sh, and ksh. |
| 32 | # |
| 33 | # Copy this file to your own area, and edit it to suit your needs. |
| 34 | # |
| 35 | # Ideally you either won't need to set the ALT_* variables because the |
| 36 | # build system will find what it needs through system provided paths |
| 37 | # or environment variables, or you have installed the component in the |
| 38 | # recommended default path. |
| 39 | # |
| 40 | # If you find yourself forced to set an ALT_* environment variable and |
| 41 | # suspect we could have figured it out automatically, please let us know. |
| 42 | # |
| 43 | # Most ALT_* directory defaults are based on being in the parent directory in |
| 44 | # ALT_SLASH_JAVA, so it's possible to create for example a "C:/jdk6" |
| 45 | # directory, assign that to ALT_SLASH_JAVA, and place all the components |
| 46 | # in that directory. This could also minimize the ALT_* environment |
| 47 | # variables you need to set. |
| 48 | # |
| 49 | ######## |
| 50 | # |
| 51 | # Assumes basic unix utilities are in the PATH already (uname, hostname, etc.). |
| 52 | # |
ohair | 893fbc6 | 2011-01-14 14:04:54 -0800 | [diff] [blame] | 53 | # On Windows, assumes PROCESSOR_IDENTIFIER, VS100COMNTOOLS, |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 54 | # SYSTEMROOT (or SystemRoot), COMPUTERNAME (or hostname works), and |
| 55 | # USERNAME is defined in the environment. |
| 56 | # This profile does not rely on using vcvars32.bat and 64bit Setup.bat. |
| 57 | # Uses CYGWIN cygpath to make sure paths are space-free. |
| 58 | # |
| 59 | # The JDK Makefiles may change in the future, making some of these |
| 60 | # settings unnecessary or redundant. |
| 61 | # |
| 62 | # This is a working example, but may or may not work on all systems. |
| 63 | # |
| 64 | ############################################################################# |
| 65 | # |
| 66 | # WARNING: This file will clobber the value of some environment variables. |
| 67 | # |
| 68 | # Sets up these environment variables for doing JDK builds: |
| 69 | # USERNAME |
| 70 | # COMPUTERNAME |
| 71 | # PATH |
| 72 | # Windows Only: |
| 73 | # LIB |
| 74 | # INCLUDE |
| 75 | # PS1 |
| 76 | # SHELL |
| 77 | # |
| 78 | # Attempts to set these variables for the JDK builds: |
| 79 | # ALT_COMPILER_PATH |
| 80 | # ALT_BOOTDIR |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 81 | # Windows Only: |
| 82 | # ALT_UNIXCOMMAND_PATH |
ohair | 893fbc6 | 2011-01-14 14:04:54 -0800 | [diff] [blame] | 83 | # ALT_MSVCRNN_DLL_PATH |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 84 | # |
| 85 | ############################################################################# |
| 86 | # |
| 87 | # Keep in mind that at this point, we are running in some kind of shell |
| 88 | # (sh, ksh, or bash). We don't know if it's solaris, linux, or windows |
| 89 | # CYGWIN. We need to figure that out. |
| 90 | |
| 91 | # Find user name |
| 92 | if [ "${USERNAME}" = "" ] ; then |
| 93 | USERNAME="${LOGNAME}" |
| 94 | fi |
| 95 | if [ "${USERNAME}" = "" ] ; then |
| 96 | USERNAME="${USER}" |
| 97 | fi |
| 98 | export USERNAME |
| 99 | |
| 100 | # Find machine name |
| 101 | if [ "${COMPUTERNAME}" = "" ] ; then |
| 102 | COMPUTERNAME="$(hostname)" |
| 103 | fi |
| 104 | export COMPUTERNAME |
| 105 | |
| 106 | # Boot jdk |
| 107 | bootjdk=jdk1.6.0 |
| 108 | importjdk=jdk1.7.0 |
| 109 | |
| 110 | # Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise. |
| 111 | osname=$(uname -s) |
| 112 | if [ "${osname}" = SunOS ] ; then |
| 113 | |
| 114 | # System place where JDK installed images are stored? |
| 115 | jdk_instances=/usr/jdk/instances |
| 116 | |
ohair | 3f08386 | 2008-06-04 09:38:18 -0700 | [diff] [blame] | 117 | # Get the Sun Studio compilers (and latest patches for them too) |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 118 | if [ "${ALT_COMPILER_PATH}" = "" ] ; then |
| 119 | ALT_COMPILER_PATH=/opt/SUNWspro/bin |
| 120 | export ALT_COMPILER_PATH |
| 121 | fi |
| 122 | if [ ! -d ${ALT_COMPILER_PATH} ] ; then |
| 123 | echo "WARNING: Cannot access ALT_COMPILER_PATH=${ALT_COMPILER_PATH}" |
| 124 | fi |
| 125 | |
| 126 | # Place compiler path early in PATH to avoid 'cc' conflicts. |
| 127 | path4sdk=${ALT_COMPILER_PATH}:/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin |
| 128 | |
| 129 | # Make sure these are unset |
| 130 | unset JAVA_HOME |
| 131 | unset LD_LIBRARY_PATH |
| 132 | |
| 133 | # Build in C locale |
| 134 | LANG=C |
| 135 | export LANG |
| 136 | LC_ALL=C |
| 137 | export LC_ALL |
| 138 | |
| 139 | umask 002 |
| 140 | |
| 141 | elif [ "${osname}" = Linux ] ; then |
| 142 | |
| 143 | # System place where JDK installed images are stored? |
| 144 | jdk_instances=/opt/java |
| 145 | |
| 146 | # Use compilers from /usr/bin |
| 147 | path4sdk=/usr/bin:/bin:/usr/sbin:/sbin |
| 148 | |
| 149 | # Make sure these are unset |
| 150 | unset JAVA_HOME |
| 151 | unset LD_LIBRARY_PATH |
| 152 | |
| 153 | # Build in C locale |
| 154 | LANG=C |
| 155 | export LANG |
| 156 | LC_ALL=C |
| 157 | export LC_ALL |
| 158 | |
| 159 | umask 002 |
| 160 | |
| 161 | else |
| 162 | |
| 163 | # System place where JDK installed images are stored? |
| 164 | jdk_instances="C:" |
| 165 | |
| 166 | # Windows: Differs on CYGWIN and the compiler available. |
| 167 | # Also, blanks in pathnames gives make headaches, so anything placed |
| 168 | # in any ALT_* variable should be the short windows DOS names. |
| 169 | |
| 170 | # Check CYGWIN (should have already been done) |
| 171 | # Assumption here is that you are in a shell window via cygwin. |
ohair | e2a87ec | 2010-06-07 12:22:21 -0700 | [diff] [blame] | 172 | proc_arch=`echo "${PROCESSOR_IDENTIFIER}" | expand | cut -d' ' -f1 | sed -e 's@x86@X86@g' -e 's@Intel64@X64@g' -e 's@em64t@X64@g' -e 's@EM64T@X64@g' -e 's@amd64@X64@g' -e 's@AMD64@X64@g' -e 's@ia64@IA64@g'` |
ohair | 1e16de9 | 2009-03-26 16:52:00 -0700 | [diff] [blame] | 173 | if [ "${proc_arch}" = "X64" ] ; then |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 174 | windows_arch=amd64 |
| 175 | else |
| 176 | windows_arch=i586 |
| 177 | fi |
tbell | 02d657c | 2012-10-23 10:10:23 -0700 | [diff] [blame] | 178 | |
| 179 | repo=`hg root | sed -e 's@\\\\@/@g'` |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 180 | # We need to check if we are running a CYGWIN shell |
tbell | 02d657c | 2012-10-23 10:10:23 -0700 | [diff] [blame] | 181 | if [ "$(echo ${osname} | fgrep Cygwin)" != "" -a -f /bin/cygpath ] ; then |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 182 | # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist |
| 183 | # Utility to convert to short pathnames without spaces |
| 184 | cygpath="/usr/bin/cygpath -a -m -s" |
tbell | 02d657c | 2012-10-23 10:10:23 -0700 | [diff] [blame] | 185 | cygpathp="/usr/bin/cygpath -p" |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 186 | # Most unix utilities are in the /usr/bin |
| 187 | unixcommand_path="/usr/bin" |
| 188 | # Make the prompt tell you CYGWIN |
| 189 | export PS1="CYGWIN:${COMPUTERNAME}:${USERNAME}[\!] " |
tbell | 02d657c | 2012-10-23 10:10:23 -0700 | [diff] [blame] | 190 | elif [ "$(echo ${osname} | fgrep MINGW)" != "" ] ; then |
| 191 | # Utility to convert to short pathnames without spaces |
| 192 | cygpath="${repo}/make/tools/msys_build_scripts/dospath.sh" |
| 193 | if [ ! -f ${cygpath} ] ; then |
| 194 | echo "ERROR: Cannot find cygpath or equivalent on this machine" |
| 195 | exit 1 |
| 196 | fi |
| 197 | # Utility to fix a path to MinGW/MSYS format - the equivalent of 'cygpath -p' |
| 198 | for tfile in "${repo}/make/scripts/fixpath.pl" "${repo}/../make/scripts/fixpath.pl"; do |
| 199 | if [ -f ${tfile} ] ; then |
| 200 | cygpathp="/bin/perl ${tfile} -m" |
| 201 | fi |
| 202 | done; |
| 203 | if [ -z "${cygpathp}" ] ; then |
| 204 | echo "ERROR: Cannot find make/scripts/fixpath.pl on this machine" |
| 205 | exit 1 |
| 206 | fi |
| 207 | unixcommand_path="/usr/bin" |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 208 | else |
tbell | 02d657c | 2012-10-23 10:10:23 -0700 | [diff] [blame] | 209 | echo "ERROR: Cannot find CYGWIN or MinGW/MSYS on this machine" |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 210 | exit 1 |
| 211 | fi |
| 212 | if [ "${ALT_UNIXCOMMAND_PATH}" != "" ] ; then |
| 213 | unixcommand_path=${ALT_UNIXCOMMAND_PATH} |
| 214 | fi |
| 215 | |
| 216 | # Default shell |
| 217 | export SHELL="${unixcommand_path}/sh" |
| 218 | |
| 219 | # Setup path system (verify this is right) |
| 220 | if [ "${SystemRoot}" != "" ] ; then |
| 221 | sys_root=$(${cygpath} "${SystemRoot}") |
| 222 | elif [ "${SYSTEMROOT}" != "" ] ; then |
| 223 | sys_root=$(${cygpath} "${SYSTEMROOT}") |
| 224 | else |
| 225 | sys_root=$(${cygpath} "C:/WINNT") |
| 226 | fi |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 227 | if [ ! -d "${sys_root}" ] ; then |
| 228 | echo "WARNING: No system root found at: ${sys_root}" |
| 229 | fi |
| 230 | |
tbell | 02d657c | 2012-10-23 10:10:23 -0700 | [diff] [blame] | 231 | # Build a : separated path making sure each segment is acceptable to ${osname} |
| 232 | path4sdk="${unixcommand_path}:"`${cygpathp} "${sys_root}/system32;${sys_root};${sys_root}/System32/Wbem"` |
| 233 | |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 234 | # Compiler setup (nasty part) |
| 235 | # NOTE: You can use vcvars32.bat to set PATH, LIB, and INCLUDE. |
| 236 | # NOTE: CYGWIN has a link.exe too, make sure the compilers are first |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 237 | |
ohair | 893fbc6 | 2011-01-14 14:04:54 -0800 | [diff] [blame] | 238 | # Use supplied vsvars.sh |
ohair | 893fbc6 | 2011-01-14 14:04:54 -0800 | [diff] [blame] | 239 | if [ -f "${repo}/make/scripts/vsvars.sh" ] ; then |
| 240 | eval `sh ${repo}/make/scripts/vsvars.sh -v10` |
| 241 | elif [ -f "${repo}/../make/scripts/vsvars.sh" ] ; then |
| 242 | eval `sh ${repo}/../make/scripts/vsvars.sh -v10` |
| 243 | else |
| 244 | echo "WARNING: No make/scripts/vsvars.sh file found" |
| 245 | fi |
| 246 | |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 247 | fi |
| 248 | |
| 249 | # Get the previous JDK to be used to bootstrap the build |
| 250 | if [ "${ALT_BOOTDIR}" = "" ] ; then |
| 251 | ALT_BOOTDIR=${jdk_instances}/${bootjdk} |
| 252 | export ALT_BOOTDIR |
| 253 | fi |
| 254 | if [ ! -d ${ALT_BOOTDIR} ] ; then |
| 255 | echo "WARNING: Cannot access ALT_BOOTDIR=${ALT_BOOTDIR}" |
| 256 | fi |
| 257 | |
| 258 | # Get the import JDK to be used to get hotspot VM if not built |
| 259 | if [ "${ALT_JDK_IMPORT_PATH}" = "" -a -d ${jdk_instances}/${importjdk} ] ; then |
| 260 | ALT_JDK_IMPORT_PATH=${jdk_instances}/${importjdk} |
| 261 | export ALT_JDK_IMPORT_PATH |
| 262 | fi |
| 263 | |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 264 | # Export PATH setting |
| 265 | PATH="${path4sdk}" |
| 266 | export PATH |
| 267 | |
gbenson | 24e3a5d | 2009-10-15 13:27:59 +0100 | [diff] [blame] | 268 | # Export variables required for Zero |
gbenson | d05acae | 2010-08-13 22:26:27 +0100 | [diff] [blame] | 269 | if [ "${SHARK_BUILD}" = true ] ; then |
| 270 | ZERO_BUILD=true |
| 271 | export ZERO_BUILD |
| 272 | fi |
gbenson | 24e3a5d | 2009-10-15 13:27:59 +0100 | [diff] [blame] | 273 | if [ "${ZERO_BUILD}" = true ] ; then |
| 274 | # ZERO_LIBARCH is the name of the architecture-specific |
| 275 | # subdirectory under $JAVA_HOME/jre/lib |
| 276 | arch=$(uname -m) |
| 277 | case "${arch}" in |
| 278 | x86_64) ZERO_LIBARCH=amd64 ;; |
| 279 | i?86) ZERO_LIBARCH=i386 ;; |
| 280 | sparc64) ZERO_LIBARCH=sparcv9 ;; |
| 281 | arm*) ZERO_LIBARCH=arm ;; |
| 282 | *) ZERO_LIBARCH="$(arch)" |
| 283 | esac |
| 284 | export ZERO_LIBARCH |
| 285 | |
| 286 | # ARCH_DATA_MODEL is the number of bits in a pointer |
| 287 | case "${ZERO_LIBARCH}" in |
| 288 | i386|ppc|s390|sparc|arm) |
| 289 | ARCH_DATA_MODEL=32 |
| 290 | ;; |
| 291 | amd64|ppc64|s390x|sparcv9|ia64|alpha) |
| 292 | ARCH_DATA_MODEL=64 |
| 293 | ;; |
| 294 | *) |
| 295 | echo "ERROR: Unable to determine ARCH_DATA_MODEL for ${ZERO_LIBARCH}" |
| 296 | exit 1 |
| 297 | esac |
| 298 | export ARCH_DATA_MODEL |
| 299 | |
| 300 | # ZERO_ENDIANNESS is the endianness of the processor |
| 301 | case "${ZERO_LIBARCH}" in |
| 302 | i386|amd64|ia64) |
| 303 | ZERO_ENDIANNESS=little |
| 304 | ;; |
| 305 | ppc*|s390*|sparc*|alpha) |
| 306 | ZERO_ENDIANNESS=big |
| 307 | ;; |
| 308 | *) |
| 309 | echo "ERROR: Unable to determine ZERO_ENDIANNESS for ${ZERO_LIBARCH}" |
| 310 | exit 1 |
| 311 | esac |
| 312 | export ZERO_ENDIANNESS |
| 313 | |
| 314 | # ZERO_ARCHDEF is used to enable architecture-specific code |
| 315 | case "${ZERO_LIBARCH}" in |
| 316 | i386) ZERO_ARCHDEF=IA32 ;; |
| 317 | ppc*) ZERO_ARCHDEF=PPC ;; |
| 318 | s390*) ZERO_ARCHDEF=S390 ;; |
| 319 | sparc*) ZERO_ARCHDEF=SPARC ;; |
| 320 | *) ZERO_ARCHDEF=$(echo "${ZERO_LIBARCH}" | tr a-z A-Z) |
| 321 | esac |
| 322 | export ZERO_ARCHDEF |
| 323 | |
| 324 | # ZERO_ARCHFLAG tells the compiler which mode to build for |
| 325 | case "${ZERO_LIBARCH}" in |
| 326 | s390) |
| 327 | ZERO_ARCHFLAG="-m31" |
| 328 | ;; |
| 329 | *) |
| 330 | ZERO_ARCHFLAG="-m${ARCH_DATA_MODEL}" |
| 331 | esac |
| 332 | export ZERO_ARCHFLAG |
| 333 | |
| 334 | # LIBFFI_CFLAGS and LIBFFI_LIBS tell the compiler how to compile and |
| 335 | # link against libffi |
| 336 | pkgconfig=$(which pkg-config 2>/dev/null) |
| 337 | if [ -x "${pkgconfig}" ] ; then |
| 338 | if [ "${LIBFFI_CFLAGS}" = "" ] ; then |
| 339 | LIBFFI_CFLAGS=$("${pkgconfig}" --cflags libffi) |
| 340 | fi |
| 341 | if [ "${LIBFFI_LIBS}" = "" ] ; then |
| 342 | LIBFFI_LIBS=$("${pkgconfig}" --libs libffi) |
| 343 | fi |
| 344 | fi |
| 345 | if [ "${LIBFFI_LIBS}" = "" ] ; then |
| 346 | LIBFFI_LIBS="-lffi" |
| 347 | fi |
| 348 | export LIBFFI_CFLAGS |
| 349 | export LIBFFI_LIBS |
gbenson | d05acae | 2010-08-13 22:26:27 +0100 | [diff] [blame] | 350 | |
| 351 | # LLVM_CFLAGS, LLVM_LDFLAGS and LLVM_LIBS tell the compiler how to |
| 352 | # compile and link against LLVM |
| 353 | if [ "${SHARK_BUILD}" = true ] ; then |
| 354 | if [ "${LLVM_CONFIG}" = "" ] ; then |
| 355 | LLVM_CONFIG=$(which llvm-config 2>/dev/null) |
| 356 | fi |
| 357 | if [ ! -x "${LLVM_CONFIG}" ] ; then |
| 358 | echo "ERROR: Unable to locate llvm-config" |
| 359 | exit 1 |
| 360 | fi |
| 361 | llvm_components="jit engine nativecodegen" |
| 362 | |
| 363 | unset LLVM_CFLAGS |
| 364 | for flag in $("${LLVM_CONFIG}" --cxxflags $llvm_components); do |
| 365 | if echo "${flag}" | grep -q '^-[ID]'; then |
| 366 | if [ "${flag}" != "-D_DEBUG" ] ; then |
| 367 | if [ "${LLVM_CFLAGS}" != "" ] ; then |
| 368 | LLVM_CFLAGS="${LLVM_CFLAGS} " |
| 369 | fi |
| 370 | LLVM_CFLAGS="${LLVM_CFLAGS}${flag}" |
| 371 | fi |
| 372 | fi |
| 373 | done |
| 374 | llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//') |
| 375 | LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}" |
| 376 | |
| 377 | unset LLVM_LDFLAGS |
| 378 | for flag in $("${LLVM_CONFIG}" --ldflags $llvm_components); do |
| 379 | if echo "${flag}" | grep -q '^-L'; then |
| 380 | if [ "${LLVM_LDFLAGS}" != "" ] ; then |
| 381 | LLVM_LDFLAGS="${LLVM_LDFLAGS} " |
| 382 | fi |
| 383 | LLVM_LDFLAGS="${LLVM_LDFLAGS}${flag}" |
| 384 | fi |
| 385 | done |
| 386 | |
| 387 | unset LLVM_LIBS |
| 388 | for flag in $("${LLVM_CONFIG}" --libs $llvm_components); do |
| 389 | if echo "${flag}" | grep -q '^-l'; then |
| 390 | if [ "${LLVM_LIBS}" != "" ] ; then |
| 391 | LLVM_LIBS="${LLVM_LIBS} " |
| 392 | fi |
| 393 | LLVM_LIBS="${LLVM_LIBS}${flag}" |
| 394 | fi |
| 395 | done |
| 396 | |
| 397 | export LLVM_CFLAGS |
| 398 | export LLVM_LDFLAGS |
| 399 | export LLVM_LIBS |
| 400 | fi |
gbenson | 24e3a5d | 2009-10-15 13:27:59 +0100 | [diff] [blame] | 401 | fi |
andrew | ecc08bc | 2012-08-15 14:35:36 +0100 | [diff] [blame] | 402 | |
| 403 | # Export variables for system zlib |
| 404 | # ZLIB_CFLAGS and ZLIB_LIBS tell the compiler how to compile and |
| 405 | # link against zlib |
| 406 | pkgconfig=$(which pkg-config 2>/dev/null) |
| 407 | if [ -x "${pkgconfig}" ] ; then |
| 408 | if [ "${ZLIB_CFLAGS}" = "" ] ; then |
| 409 | ZLIB_CFLAGS=$("${pkgconfig}" --cflags zlib) |
| 410 | fi |
| 411 | if [ "${ZLIB_LIBS}" = "" ] ; then |
| 412 | ZLIB_LIBS=$("${pkgconfig}" --libs zlib) |
| 413 | fi |
| 414 | fi |
| 415 | if [ "${ZLIB_LIBS}" = "" ] ; then |
| 416 | ZLIB_LIBS="-lz" |
| 417 | fi |
| 418 | export ZLIB_CFLAGS |
| 419 | export ZLIB_LIBS |
| 420 | |