configure 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. #! /bin/sh -
  2. #
  3. # Simple `configure' script for Qi.
  4. #
  5. # Copyright (c) 2016-2018 Matias Fonzo, <selk@dragora.org>.
  6. #
  7. # Licensed under the Apache License, Version 2.0 (the "License");
  8. # you may not use this file except in compliance with the License.
  9. # You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS,
  15. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. # See the License for the specific language governing permissions and
  17. # limitations under the License.
  18. usage() {
  19. printf "%s\n" \
  20. "Usage: configure [options]" \
  21. "" \
  22. "Defaults for the options are specified in brackets." \
  23. "" \
  24. "Options:" \
  25. " --prefix=DIR install files in DIR [${prefix}]" \
  26. " --exec-prefix=DIR base DIR for arch-dependent files [${exec_prefix}]" \
  27. " --bindir=DIR user executables [${bindir}]" \
  28. " --sbindir=DIR system admin executables [${sbindir}]" \
  29. " --libexecdir=DIR program executables [${libexecdir}]" \
  30. " --sysconfdir=DIR read-only single-machine data [${sysconfdir}]" \
  31. " --localstatedir=DIR modifiable single-machine data [${localstatedir}]" \
  32. " --datarootdir=DIR read-only arch-independent data root [${datarootdir}]" \
  33. " --infodir=DIR info documentation [${infodir}]" \
  34. " --mandir=DIR man documentation [${mandir}]" \
  35. " --docdir=DIR documentation root [${docdir}]" \
  36. " --packagedir=DIR package installation directory [${packagedir}]" \
  37. " --targetdir=DIR target directory for linking [${targetdir}]" \
  38. ""
  39. }
  40. # Defaults
  41. prefix=/usr/local
  42. exec_prefix='$(prefix)'
  43. bindir='$(exec_prefix)/bin'
  44. sbindir='$(exec_prefix)/sbin'
  45. libexecdir='$(exec_prefix)/libexec'
  46. sysconfdir='$(prefix)/etc'
  47. localstatedir='$(prefix)/var'
  48. datarootdir='$(prefix)/share'
  49. infodir='$(datarootdir)/info'
  50. mandir='$(datarootdir)/man'
  51. docdir='$(datarootdir)/doc'
  52. packagedir='$(prefix)/pkg'
  53. targetdir='/'
  54. return_variables() {
  55. printf "%s\n" \
  56. "prefix = $prefix" \
  57. "exec_prefix = $exec_prefix" \
  58. "bindir = $bindir" \
  59. "sbindir = $sbindir" \
  60. "libexecdir = $libexecdir" \
  61. "sysconfdir = $sysconfdir" \
  62. "localstatedir = $localstatedir" \
  63. "datarootdir = $datarootdir" \
  64. "infodir = $infodir" \
  65. "mandir = $mandir" \
  66. "docdir = $docdir" \
  67. "packagedir = $packagedir" \
  68. "targetdir = $targetdir" \
  69. ""
  70. }
  71. # Handle options
  72. while test $# -gt 0
  73. do
  74. case $1 in
  75. --prefix)
  76. prefix="$2"
  77. shift
  78. ;;
  79. --prefix=*)
  80. prefix="${1#*=}"
  81. ;;
  82. --exec-prefix)
  83. exec_prefix="$2"
  84. shift
  85. ;;
  86. --exec-prefix=*)
  87. exec_prefix="${1#*=}"
  88. ;;
  89. --bindir)
  90. bindir="$2"
  91. shift
  92. ;;
  93. --bindir=*)
  94. bindir="${1#*=}"
  95. ;;
  96. --sbindir)
  97. sbindir="$2"
  98. shift
  99. ;;
  100. --sbindir=*)
  101. sbindir="${1#*=}"
  102. ;;
  103. --libexecdir)
  104. libexecdir="$2"
  105. shift
  106. ;;
  107. --libexecdir=*)
  108. libexecdir="${1#*=}"
  109. ;;
  110. --sysconfdir)
  111. sysconfdir="$2"
  112. shift
  113. ;;
  114. --sysconfdir=*)
  115. sysconfdir="${1#*=}"
  116. ;;
  117. --localstatedir)
  118. localstatedir="$2"
  119. shift
  120. ;;
  121. --localstatedir=*)
  122. localstatedir="${1#*=}"
  123. ;;
  124. --datarootdir)
  125. datarootdir="$2"
  126. shift
  127. ;;
  128. --datarootdir=*)
  129. datarootdir="${1#*=}"
  130. ;;
  131. --infodir)
  132. infodir="$2"
  133. shift
  134. ;;
  135. --infodir=*)
  136. infodir="${1#*=}"
  137. ;;
  138. --mandir)
  139. mandir="$2"
  140. shift
  141. ;;
  142. --mandir=*)
  143. mandir="${1#*=}"
  144. ;;
  145. --docdir)
  146. docdir="$2"
  147. shift
  148. ;;
  149. --docdir=*)
  150. docdir="${1#*=}"
  151. ;;
  152. --packagedir)
  153. packagedir="$2"
  154. shift
  155. ;;
  156. --packagedir=*)
  157. packagedir="${1#*=}"
  158. ;;
  159. --targetdir)
  160. targetdir="$2"
  161. shift
  162. ;;
  163. --targetdir=*)
  164. targetdir="${1#*=}"
  165. ;;
  166. -h | --help)
  167. usage
  168. exit
  169. ;;
  170. --) # End of options
  171. shift
  172. break
  173. ;;
  174. -*)
  175. echo "configure: WARNING: unrecognized option '${1}'" 1>&2
  176. ;;
  177. *)
  178. break
  179. ;;
  180. esac
  181. shift
  182. done
  183. echo "Creating config.mak ..."
  184. # Show variales and clean up the config.mak file
  185. return_variables; : > config.mak
  186. # To populate config.mak
  187. return_variables > config.mak
  188. echo "OK, now you can run \`make'"