supernets anope source code & configuration https://www.anope.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Config 9.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. #!/bin/sh
  2. #
  3. # Configuration script for Services.
  4. #
  5. # Anope (c) 2003-2017 Anope Team
  6. # Contact us at team@anope.org
  7. #
  8. # This program is free but copyrighted software; see the file COPYING for
  9. # details.
  10. #
  11. # Based on the original code of Epona by PegSoft.
  12. # Based on the original code of Services by Andy Church.
  13. #
  14. ###########################################################################
  15. echo2 () {
  16. $ECHO2 "$*$ECHO2SUF" # these are defined later
  17. }
  18. exists () { # because some shells don't have test -e
  19. if [ -f $1 -o -d $1 -o -p $1 -o -c $1 -o -b $1 ] ; then
  20. return 0
  21. else
  22. return 1
  23. fi
  24. }
  25. Load_Cache () {
  26. if [ -f $SOURCE_DIR/config.cache -a -r $SOURCE_DIR/config.cache -a ! "$IGNORE_CACHE" ] ; then
  27. echo "Using defaults from config.cache. To ignore, $SOURCE_DIR/Config -nocache"
  28. echo ""
  29. . $SOURCE_DIR/config.cache
  30. CAN_QUICK="yes"
  31. else
  32. CAN_QUICK="no"
  33. fi
  34. }
  35. Run_Build_System () {
  36. WITH_INST=""
  37. WITH_RUN=""
  38. WITH_PERM=""
  39. EXTRA_INCLUDE=""
  40. EXTRA_LIBS=""
  41. GEN_TYPE=""
  42. if [ "$INSTDIR" != "" ] ; then
  43. WITH_INST="-DINSTDIR:STRING=$INSTDIR"
  44. fi
  45. if [ "$RUNGROUP" != "" ] ; then
  46. WITH_RUN="-DRUNGROUP:STRING=$RUNGROUP"
  47. fi
  48. if [ "$UMASK" != "" ] ; then
  49. WITH_PERM="-DDEFUMASK:STRING=$UMASK"
  50. fi
  51. if [ "$DEBUG" = "yes" ] ; then
  52. BUILD_TYPE="-DCMAKE_BUILD_TYPE:STRING=DEBUG"
  53. else
  54. BUILD_TYPE="-DCMAKE_BUILD_TYPE:STRING=RELEASE"
  55. fi
  56. if [ "$USE_PCH" = "yes" ] ; then
  57. PCH="-DUSE_PCH:BOOLEAN=ON"
  58. else
  59. PCH="-DUSE_PCH:BOOLEAN=OFF"
  60. fi
  61. if [ "$EXTRA_INCLUDE_DIRS" != "" ] ; then
  62. EXTRA_INCLUDE="-DEXTRA_INCLUDE:STRING=$EXTRA_INCLUDE_DIRS"
  63. fi
  64. if [ "$EXTRA_LIB_DIRS" != "" ] ; then
  65. EXTRA_LIBS="-DEXTRA_LIBS:STRING=$EXTRA_LIB_DIRS"
  66. fi
  67. case `uname -s` in
  68. MINGW*)
  69. GEN_TYPE="-G\"MSYS Makefiles\""
  70. ;;
  71. esac
  72. if [ "$SOURCE_DIR" = "." ] ; then
  73. pwdsave=`pwd`
  74. test -d build || mkdir build
  75. cd "build"
  76. REAL_SOURCE_DIR=".."
  77. else
  78. REAL_SOURCE_DIR="$SOURCE_DIR"
  79. fi
  80. echo "cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $PCH $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR"
  81. cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $PCH $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR
  82. if [ $? -ne 0 ]; then
  83. echo "You should fix these issues and then run ./Config -quick to rerun CMake."
  84. exit 1
  85. fi
  86. echo ""
  87. if [ "$SOURCE_DIR" = "." ] ; then
  88. echo "Now cd build, then run make to build Anope."
  89. cd "$pwdsave"
  90. else
  91. echo "Now run make to build Anope."
  92. fi
  93. }
  94. ECHO2SUF=''
  95. if [ "`echo -n a ; echo -n b`" = "ab" ] ; then
  96. ECHO2='echo -n'
  97. elif [ "`echo 'a\c' ; echo 'b\c'`" = "ab" ] ; then
  98. ECHO2='echo' ; ECHO2SUF='\c'
  99. elif [ "`printf 'a' 2>&1 ; printf 'b' 2>&1`" = "ab" ] ; then
  100. ECHO2='printf "%s"'
  101. else
  102. # oh well...
  103. ECHO2='echo'
  104. fi
  105. export ECHO2 ECHO2SUF
  106. ###########################################################################
  107. # Init values
  108. ###########################################################################
  109. INSTDIR=$HOME/services
  110. RUNGROUP=
  111. UMASK=
  112. DEBUG="no"
  113. USE_PCH="no"
  114. EXTRA_INCLUDE_DIRS=
  115. EXTRA_LIB_DIRS=
  116. EXTRA_CONFIG_ARGS=
  117. CAN_QUICK="no"
  118. SOURCE_DIR=`dirname $0`
  119. ###########################################################################
  120. # Check out the options
  121. ###########################################################################
  122. while [ $# -ge 1 ] ; do
  123. if [ $1 = "--help" ] ; then
  124. echo "Config utility for Anope"
  125. echo "------------------------"
  126. echo "Syntax: ./Config [options]"
  127. echo "-nocache Ignore settings saved in config.cache"
  128. echo "-nointro Skip intro (disclaimer, etc)"
  129. echo "-quick Skip questions, go straight to cmake"
  130. exit 0
  131. elif [ $1 = "-nocache" ] ; then
  132. IGNORE_CACHE="1"
  133. elif [ $1 = "-nointro" ] ; then
  134. NO_INTRO="1"
  135. elif [ $1 = "-quick" -o $1 = "-q" ] ; then
  136. Load_Cache
  137. if [ "$CAN_QUICK" = "yes" ] ; then
  138. Run_Build_System
  139. else
  140. echo ""
  141. echo "Can't find cache file (config.cache), aborting..."
  142. fi
  143. exit 0
  144. fi
  145. shift 1
  146. done
  147. ###########################################################################
  148. # Check for CMake and (optionally) install it
  149. ###########################################################################
  150. cmake --version 2>&1 > /dev/null
  151. if [ $? -ne 0 ] ; then
  152. clear
  153. echo "Anope requires CMake 2.4 or newer, which can be downloaded at http://cmake.org or through your system's package manager."
  154. echo "If you have installed CMake already, ensure it is in your PATH environment variable."
  155. exit 0
  156. fi
  157. ###########################################################################
  158. if [ ! "$NO_INTRO" ] ; then
  159. case `uname -s` in
  160. MINGW*)
  161. PAGER=less
  162. ;;
  163. *)
  164. PAGER=more
  165. clear
  166. ;;
  167. esac
  168. . $SOURCE_DIR/src/version.sh
  169. cat $SOURCE_DIR/.BANNER | sed "s/CURVER/$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH$VERSION_EXTRA/" | sed "s@SOURCE_DIR@$SOURCE_DIR@" | $PAGER
  170. echo ""
  171. else
  172. echo ""
  173. fi
  174. echo "Beginning Services configuration."
  175. echo ""
  176. ###########################################################################
  177. # Load the cache
  178. ###########################################################################
  179. if [ ! "$IGNORE_CACHE" ] ; then
  180. Load_Cache
  181. fi
  182. # Ask the user anything we need to know ahead of time.
  183. export ok INPUT
  184. ####
  185. ok=0
  186. echo "In what directory should Anope be installed?"
  187. while [ $ok -eq 0 ] ; do
  188. echo2 "[$INSTDIR] "
  189. if read INPUT ; then : ; else echo "" ; exit 1 ; fi
  190. if [ ! "$INPUT" ] ; then
  191. INPUT=$INSTDIR
  192. fi
  193. if [ ! -d "$INPUT" ] ; then
  194. if exists "$INPUT" ; then
  195. echo "$INPUT exists, but is not a directory!"
  196. else
  197. echo "$INPUT does not exist. Create it?"
  198. echo2 "[y] "
  199. read YN
  200. if [ "$YN" != "n" ] ; then
  201. if mkdir -p $INPUT ; then
  202. ok=1
  203. fi
  204. fi
  205. fi
  206. elif exists "$INPUT/include/services.h" ; then
  207. echo "You cannot use the Services source directory as a target directory."
  208. else
  209. ok=1
  210. fi
  211. done
  212. INSTDIR=$INPUT
  213. echo ""
  214. ####
  215. OLD_RUNGROUP="$RUNGROUP"
  216. if [ "$RUNGROUP" ] ; then
  217. echo "Which group should all Services data files be owned by? (If Services"
  218. echo "should not force files to be owned by a particular group, type \"none\""
  219. echo "(without the quotes) and press Return.)"
  220. else
  221. echo "Which group should all Services data files be owned by? (If Services"
  222. echo "should not force files to be owned by a particular group, just press"
  223. echo "Return.)"
  224. fi
  225. echo2 "[$RUNGROUP] "
  226. if read INPUT ; then : ; else echo "" ; exit 1 ; fi
  227. if [ "$INPUT" ] ; then
  228. if [ "$INPUT" = "none" ] ; then
  229. RUNGROUP=""
  230. else
  231. RUNGROUP="$INPUT"
  232. fi
  233. fi
  234. echo ""
  235. ####
  236. if [ ! "$UMASK" -o "$RUNGROUP" != "$OLD_RUNGROUP" ] ; then
  237. if [ "$RUNGROUP" ] ; then
  238. UMASK=007
  239. else
  240. UMASK=077
  241. fi
  242. fi
  243. ok=0
  244. echo "What should the default umask for data files be (in octal)?"
  245. echo "(077 = only accessible by owner; 007 = accessible by owner and group)"
  246. while [ $ok -eq 0 ] ; do
  247. echo2 "[$UMASK] "
  248. if read INPUT ; then : ; else echo "" ; exit 1 ; fi
  249. if [ ! "$INPUT" ] ; then
  250. INPUT=$UMASK
  251. fi
  252. if [ `echo "$INPUT" | grep -c '[^0-7]'` -gt 0 ] ; then
  253. echo "$UMASK is not a valid octal number!"
  254. else
  255. if [ "`echo $INPUT | cut -c1`" != "0" ] ; then
  256. INPUT=0$INPUT
  257. fi
  258. ok=1
  259. fi
  260. done
  261. UMASK=$INPUT
  262. echo ""
  263. ####
  264. TEMP_YN="n"
  265. if [ "$DEBUG" = "yes" ] ; then
  266. TEMP_YN="y"
  267. fi
  268. echo "Would you like to build a debug version of Anope?"
  269. echo2 "[$TEMP_YN] "
  270. read YN
  271. if [ "$YN" ] ; then
  272. if [ "$YN" = "y" ] ; then
  273. DEBUG="yes"
  274. else
  275. DEBUG="no"
  276. fi
  277. fi
  278. echo ""
  279. ####
  280. TEMP_YN="n"
  281. if [ "$USE_PCH" = "yes" ] ; then
  282. TEMP_YN="y"
  283. fi
  284. echo "Do you want to build using precompiled headers? This can speed up"
  285. echo "the build, but uses more disk space."
  286. echo2 "[$TEMP_YN] "
  287. read YN
  288. if [ "$YN" ] ; then
  289. if [ "$YN" = "y" ] ; then
  290. USE_PCH="yes"
  291. else
  292. USE_PCH="no"
  293. fi
  294. fi
  295. echo ""
  296. ####
  297. echo "Are there any extra include directories you wish to use?"
  298. echo "You may only need to do this if CMake is unable to locate"
  299. echo "missing dependencies without hints."
  300. echo "Separate directories with semicolons."
  301. echo "If you need no extra include directories, enter NONE in all caps."
  302. echo2 "[$EXTRA_INCLUDE_DIRS] "
  303. if read INPUT ; then : ; else echo "" ; exit 1 ; fi
  304. if [ "$INPUT" ] ; then
  305. if [ "$INPUT" = "NONE" ] ; then
  306. EXTRA_INCLUDE_DIRS=""
  307. else
  308. EXTRA_INCLUDE_DIRS=$INPUT
  309. fi
  310. fi
  311. echo ""
  312. ####
  313. echo "Are there any extra library directories you wish to use?"
  314. echo "You may only need to do this if CMake is unable to locate"
  315. echo "missing dependencies without hints."
  316. echo "Separate directories with semicolons."
  317. echo "If you need no extra library directories, enter NONE in all caps."
  318. echo2 "[$EXTRA_LIB_DIRS] "
  319. if read INPUT ; then : ; else echo "" ; exit 1 ; fi
  320. if [ "$INPUT" ] ; then
  321. if [ "$INPUT" = "NONE" ] ; then
  322. EXTRA_LIB_DIRS=""
  323. else
  324. EXTRA_LIB_DIRS=$INPUT
  325. fi
  326. fi
  327. echo ""
  328. ####
  329. echo "Are there any extra arguments you wish to pass to CMake?"
  330. echo "If you need no extra arguments to CMake, enter NONE in all caps."
  331. echo2 "[$EXTRA_CONFIG_ARGS] "
  332. if read INPUT ; then : ; else echo "" ; exit 1 ; fi
  333. if [ "$INPUT" ] ; then
  334. if [ "$INPUT" = "NONE" ] ; then
  335. EXTRA_CONFIG_ARGS=""
  336. else
  337. EXTRA_CONFIG_ARGS=$INPUT
  338. fi
  339. fi
  340. echo ""
  341. ####
  342. ################################################################################
  343. # Store values
  344. ################################################################################
  345. echo2 "Saving configuration results in config.cache... "
  346. cat <<EOT >$SOURCE_DIR/config.cache
  347. INSTDIR="$INSTDIR"
  348. RUNGROUP="$RUNGROUP"
  349. UMASK=$UMASK
  350. DEBUG="$DEBUG"
  351. USE_PCH="$USE_PCH"
  352. EXTRA_INCLUDE_DIRS="$EXTRA_INCLUDE_DIRS"
  353. EXTRA_LIB_DIRS="$EXTRA_LIB_DIRS"
  354. EXTRA_CONFIG_ARGS="$EXTRA_CONFIG_ARGS"
  355. EOT
  356. echo "done."
  357. ################################################################################
  358. # Build the build system string
  359. ################################################################################
  360. Run_Build_System