annotate configure @ 0:4277bc14f5bf

starting project with configure script
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 05 Jul 2024 07:36:37 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #!/bin/sh
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 # This configure script is custom and hand-coded;
4277bc14f5bf 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!
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 set -e
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 if [ ! -f configure ]
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 then
4277bc14f5bf 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
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 exit 1
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 fi
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 # defaults that can be overridden
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 CC=gcc
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 CFLAGS=-O2
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 prefix=/usr/local
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 exec_prefix=
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 bindir=
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 includedir=
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 libdir=
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 osmo_prefix=
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 while [ $# != 0 ]
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 do
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 case "$1" in
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 --prefix=*)
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 prefix=`echo $1 | cut -c 10-`
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 ;;
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 --exec-prefix=*)
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 exec_prefix=`echo $1 | cut -c 15-`
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 ;;
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 --bindir=*)
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 bindir=`echo $1 | cut -c 10-`
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 ;;
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 --includedir=*)
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 includedir=`echo $1 | cut -c 14-`
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 ;;
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 --libdir=*)
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 libdir=`echo $1 | cut -c 10-`
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 ;;
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 --with-osmo=*)
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 osmo_prefix=`echo $1 | cut -c 13-`
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 ;;
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 CC=*)
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 CC=`echo $1 | cut -c 4-`
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 ;;
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 CFLAGS=*)
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 CFLAGS=`echo $1 | cut -c 8-`
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 ;;
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 *)
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 echo "error: non-understood option $1" 1>&2
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 exit 1;
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 ;;
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 esac
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 shift
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 done
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 # find Osmocom dependencies
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 if [ -n "$osmo_prefix" ]
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 then
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 PKG_CONFIG_PATH="$osmo_prefix/lib/pkgconfig"
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 export PKG_CONFIG_PATH
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 fi
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 osmo_depend="libosmocore libosmovty"
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 OSMO_INCLUDE=`pkg-config --cflags-only-I $osmo_depend`
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 OSMO_LIBS=`pkg-config --libs-only-l $osmo_depend`
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 OSMO_LPATH=`pkg-config --libs-only-L $osmo_depend`
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 OSMO_RPATH=`echo "$OSMO_LPATH" | sed -e s/-L/-Wl,-rpath,/`
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 # inheritance rules for install directories
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 if [ -z "$exec_prefix" ]
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 then
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 exec_prefix="$prefix"
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 fi
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 if [ -z "$bindir" ]
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 then
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 bindir="$exec_prefix/bin"
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 fi
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 if [ -z "$includedir" ]
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 then
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 includedir="$prefix/include"
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 fi
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 if [ -z "$libdir" ]
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 then
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 libdir="$exec_prefix/lib"
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 fi
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 # report the final configuration
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 echo "C code will be compiled with:"
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 echo " CC=$CC"
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 echo " CFLAGS=$CFLAGS"
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 echo "Installation directories:"
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 echo " bindir=$bindir"
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 echo " includedir=$includedir"
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 echo " libdir=$libdir"
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 echo "See config.defs output for Osmocom dependencies"
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 # emit the Makefile include fragment
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 echo "CC=$CC" > config.defs
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 echo "CFLAGS=$CFLAGS" >> config.defs
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 echo "OSMO_INCLUDE=$OSMO_INCLUDE" >> config.defs
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 echo "OSMO_LIBS=$OSMO_LIBS" >> config.defs
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 echo "OSMO_LPATH=$OSMO_LPATH" >> config.defs
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 echo "OSMO_RPATH=$OSMO_RPATH" >> config.defs
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 echo "bindir=$bindir" >> config.defs
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 echo "includedir=$includedir" >> config.defs
4277bc14f5bf starting project with configure script
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 echo "libdir=$libdir" >> config.defs