configure (1939B)
1 #!/bin/sh 2 # See LICENSE file for copyright and license details. 3 4 replace_line() 5 { 6 VAR=$1 7 ALIGNMENT=$2 8 VALUE=$3 9 awk "/^${VAR}[ ]*=/ { print \"${VAR}${ALIGNMENT} = ${VALUE}\"; next }; { print; }" config.mk > config.mk.tmp 10 mv config.mk.tmp config.mk 11 } 12 13 case $(uname) in 14 DragonFly|FreeBSD|Linux|MidnightBSD|NetBSD) 15 # the default 16 replace_line 'ANAME' ' ' 'libgrapheme.a' 17 replace_line 'SONAME' ' ' 'libgrapheme.so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)' 18 replace_line 'BINSUFFIX' '' '' 19 replace_line 'SOFLAGS' ' ' '-shared -nostdlib -Wl,--soname=libgrapheme.so.$(VERSION_MAJOR).$(VERSION_MINOR)' 20 replace_line 'SOSYMLINK' '' 'true' 21 replace_line 'LDCONFIG' '' 'ldconfig' 22 ;; 23 OpenBSD) 24 replace_line 'ANAME' ' ' 'libgrapheme.a' 25 replace_line 'SONAME' ' ' 'libgrapheme.so.$(VERSION_MAJOR).$(VERSION_MINOR)' 26 replace_line 'BINSUFFIX' '' '' 27 replace_line 'SOFLAGS' ' ' '-shared -nostdlib' 28 replace_line 'SOSYMLINK' '' 'false' 29 replace_line 'LDCONFIG' '' '' 30 ;; 31 Darwin) 32 replace_line 'ANAME' ' ' 'libgrapheme.a' 33 replace_line 'SONAME' ' ' 'libgrapheme.$(VERSION_MAJOR).dylib' 34 replace_line 'BINSUFFIX' '' '' 35 replace_line 'SOFLAGS' ' ' '-dynamiclib -install_name libgrapheme.$(VERSION_MAJOR).dylib -current_version $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) -compatibility_version $(VERSION_MAJOR).$(VERSION_MINOR).0' 36 replace_line 'SOSYMLINK' '' 'false' 37 replace_line 'LDCONFIG' '' '' 38 ;; 39 CYGWIN*|MSYS*|MINGW*) 40 replace_line 'ANAME' ' ' 'libgrapheme.lib' 41 replace_line 'SONAME' ' ' 'libgrapheme.dll' 42 replace_line 'BINSUFFIX' '' '.exe' 43 replace_line 'SOFLAGS' ' ' '-shared' 44 replace_line 'SOSYMLINK' '' 'false' 45 replace_line 'LDCONFIG' '' '' 46 ;; 47 *) 48 echo "Your system does not have a preset. Edit config.mk and send a patch please! :)" 49 exit 1 50 ;; 51 esac 52 53 exit 0