annotate configure @ 0:76b593a6265c

starting project with configure script
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 23 Jun 2024 06:40:14 +0000
parents
children 99426da5603d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #!/bin/sh
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 # This configure script is custom and hand-coded;
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 # it is NOT a product of GNU Autoconf or any other such tools!
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 set -e
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 if [ ! -f configure ]
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 then
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 echo "This script needs to be run from the top of the source tree" 1>&2
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 exit 1
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 fi
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 # defaults that can be overridden
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 CC=gcc
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 CFLAGS=-O2
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 prefix=/usr/local
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 exec_prefix=
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 bindir=
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 osmo_prefix=
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 while [ $# != 0 ]
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 do
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 case "$1" in
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 --prefix=*)
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 prefix=`echo $1 | cut -c 10-`
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 ;;
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 --exec-prefix=*)
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 exec_prefix=`echo $1 | cut -c 15-`
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 ;;
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 --bindir=*)
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 bindir=`echo $1 | cut -c 10-`
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 ;;
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 --with-osmo=*)
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 osmo_prefix=`echo $1 | cut -c 13-`
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 ;;
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 CC=*)
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 CC=`echo $1 | cut -c 4-`
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 ;;
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 CFLAGS=*)
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 CFLAGS=`echo $1 | cut -c 8-`
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 ;;
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 *)
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 echo "error: non-understood option $1" 1>&2
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 exit 1;
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 ;;
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 esac
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 shift
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 done
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 # find Osmocom dependencies
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 if [ -n "$osmo_prefix" ]
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 then
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 PKG_CONFIG_PATH="$osmo_prefix/lib/pkgconfig"
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 export PKG_CONFIG_PATH
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 fi
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 osmo_depend="libosmocore libosmo-e1d"
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 OSMO_INCLUDE=`pkg-config --cflags-only-I $osmo_depend`
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 OSMO_LIBS=`pkg-config --libs-only-l $osmo_depend`
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 OSMO_LPATH=`pkg-config --libs-only-L $osmo_depend`
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 OSMO_RPATH=`echo "$OSMO_LPATH" | sed -e s/-L/-Wl,-rpath,/`
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 # inheritance rules for install directories
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 if [ -z "$exec_prefix" ]
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 then
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 exec_prefix="$prefix"
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 fi
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 if [ -z "$bindir" ]
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 then
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 bindir="$exec_prefix/bin"
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 fi
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 # report the final configuration
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 echo "C code will be compiled with:"
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 echo " CC=$CC"
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 echo " CFLAGS=$CFLAGS"
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 echo "Installation directory:"
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 echo " bindir=$bindir"
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 echo "See config.defs output for Osmocom dependencies"
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 # emit the Makefile include fragment
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 echo "CC=$CC" > config.defs
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 echo "CFLAGS=$CFLAGS" >> config.defs
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 echo "OSMO_INCLUDE=$OSMO_INCLUDE" >> config.defs
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 echo "OSMO_LIBS=$OSMO_LIBS" >> config.defs
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 echo "OSMO_LPATH=$OSMO_LPATH" >> config.defs
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 echo "OSMO_RPATH=$OSMO_RPATH" >> config.defs
76b593a6265c starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 echo "bindir=$bindir" >> config.defs