1# BAREOS® - Backup Archiving REcovery Open Sourced 2# 3# Copyright (C) 2017-2019 Bareos GmbH & Co. KG 4# 5# This program is Free Software; you can redistribute it and/or 6# modify it under the terms of version three of the GNU Affero General Public 7# License as published by the Free Software Foundation and included 8# in the file LICENSE. 9# 10# This program is distributed in the hope that it will be useful, but 11# WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13# Affero General Public License for more details. 14# 15# You should have received a copy of the GNU Affero General Public License 16# along with this program; if not, write to the Free Software 17# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18# 02110-1301, USA. 19 20 21# check if variables are set via cmdline else set them to default values 22 23## configure variables 24## 25## strings - directories 26 27# prefix 28IF(NOT DEFINED prefix) 29 set (prefix ${CMAKE_DEFAULT_PREFIX}) 30ENDIF() 31 32 33IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 34 35 # libdir 36 IF(NOT DEFINED libdir) 37 set(libdir ${CMAKE_INSTALL_LIBDIR}/${CMAKE_PROJECT_NAME}) 38 ENDIF() 39 40 # includedir 41 IF(NOT DEFINED includedir) 42 set(includedir ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}) 43 ENDIF() 44 45 # bindir 46 IF(NOT DEFINED bindir) 47 set(bindir ${CMAKE_INSTALL_BINDIR}) 48 MESSAGE(STATUS "set bindir to default ${bindir}") 49 ENDIF() 50 51 52 # sbindir 53 IF(NOT DEFINED sbindir) 54 set(sbindir ${CMAKE_INSTALL_SBINDIR}) 55 MESSAGE(STATUS "set sbindir to default ${sbindir}") 56 ENDIF() 57 58 # sysconfdir 59 IF(NOT DEFINED sysconfdir) 60 set(sysconfdir ${CMAKE_INSTALL_SYSCONFDIR}) 61 ENDIF() 62 set(SYSCONFDIR "\"${sysconfdir}\"") 63 64 # confdir 65 IF(NOT DEFINED confdir) 66 set(confdir "${sysconfdir}/${CMAKE_PROJECT_NAME}") 67 ENDIF() 68 69 # configtemplatedir 70 IF(NOT DEFINED configtemplatedir) 71 set(configtemplatedir "lib/${CMAKE_PROJECT_NAME}/defaultconfigs") 72 ENDIF() 73 74 # mandir 75 IF(NOT DEFINED mandir) 76 set(mandir ${CMAKE_INSTALL_MANDIR}) 77 ENDIF() 78 79 # docdir 80 IF(NOT DEFINED docdir) 81 SET(docdir default_for_docdir) 82 ENDIF() 83 84 # htmldir 85 IF(NOT DEFINED htmldir) 86 SET(htmldir default_for_htmldir) 87 ENDIF() 88 89 # archivedir 90 IF(NOT DEFINED archivedir) 91 set(archivedir "/${CMAKE_INSTALL_LOCALSTATEDIR}/lib/${CMAKE_PROJECT_NAME}/storage") 92 ENDIF() 93 94 # backenddir 95 IF(NOT DEFINED backenddir) 96 set(backenddir ${CMAKE_INSTALL_LIBDIR}/${CMAKE_PROJECT_NAME}/backends) 97 ENDIF() 98 99 # scriptdir 100 IF(NOT DEFINED scriptdir) 101 set(scriptdir "lib/${CMAKE_PROJECT_NAME}/scripts") 102 ENDIF() 103 104 # workingdir 105 IF(NOT DEFINED workingdir) 106 set(workingdir "${CMAKE_INSTALL_LOCALSTATEDIR}/lib/${CMAKE_PROJECT_NAME}") 107 ENDIF() 108 set(working_dir "${workingdir}") 109 110 # plugindir 111 IF(NOT DEFINED plugindir) 112 set(plugindir ${CMAKE_INSTALL_LIBDIR}/${CMAKE_PROJECT_NAME}/plugins) 113 ENDIF() 114 115 # piddir 116 IF(NOT DEFINED piddir) 117 SET(piddir ${workingdir}) 118 ENDIF() 119 120 # bsrdir 121 IF(NOT DEFINED bsrdir) 122 SET(bsrdir ${workingdir}) 123 ENDIF() 124 125 # logdir 126 IF(NOT DEFINED logdir) 127 set(logdir "${CMAKE_INSTALL_LOCALSTATEDIR}/log/${CMAKE_PROJECT_NAME}") 128 ENDIF() 129 130 # datarootdir 131 IF(NOT DEFINED datarootdir) 132 set(datarootdir "${CMAKE_INSTALL_DATAROOTDIR}") 133 ENDIF() 134 135 # subsysdir 136 IF(NOT DEFINED subsysdir) 137 set(subsysdir "${workingdir}") 138 ENDIF() 139 140ELSE() # IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 141 142 # libdir 143 IF(NOT DEFINED libdir) 144 set(libdir ${CMAKE_INSTALL_FULL_LIBDIR}/${CMAKE_PROJECT_NAME}) 145 ENDIF() 146 147 # includedir 148 IF(NOT DEFINED includedir) 149 set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}) 150 ENDIF() 151 152 # bindir 153 IF(NOT DEFINED bindir) 154 set(bindir ${CMAKE_INSTALL_FULL_BINDIR}) 155 MESSAGE(STATUS "set bindir to default ${bindir}") 156 ENDIF() 157 158 159 # sbindir 160 IF(NOT DEFINED sbindir) 161 set(sbindir ${CMAKE_INSTALL_FULL_SBINDIR}) 162 MESSAGE(STATUS "set sbindir to default ${sbindir}") 163 ENDIF() 164 165 # sysconfdir 166 IF(NOT DEFINED sysconfdir) 167 set(sysconfdir ${CMAKE_INSTALL_FULL_SYSCONFDIR}) 168 ENDIF() 169 set(SYSCONFDIR "\"${sysconfdir}\"") 170 171 # confdir 172 IF(NOT DEFINED confdir) 173 set(confdir "${sysconfdir}/${CMAKE_PROJECT_NAME}") 174 ENDIF() 175 176 # configtemplatedir 177 IF(NOT DEFINED configtemplatedir) 178 set(configtemplatedir "${confdir}") 179 ENDIF() 180 181 # mandir 182 IF(NOT DEFINED mandir) 183 set(mandir ${CMAKE_INSTALL_FULL_MANDIR}) 184 ENDIF() 185 186 # docdir 187 IF(NOT DEFINED docdir) 188 SET(docdir default_for_docdir) 189 ENDIF() 190 191 # htmldir 192 IF(NOT DEFINED htmldir) 193 SET(htmldir default_for_htmldir) 194 ENDIF() 195 196 # archivedir 197 IF(NOT DEFINED archivedir) 198 set(archivedir "/${CMAKE_INSTALL_LOCALSTATEDIR}/lib/${CMAKE_PROJECT_NAME}/storage") 199 ENDIF() 200 201 # backenddir 202 IF(NOT DEFINED backenddir) 203 set(backenddir ${CMAKE_INSTALL_FULL_LIBDIR}/${CMAKE_PROJECT_NAME}/backends) 204 ENDIF() 205 206 # scriptdir 207 IF(NOT DEFINED scriptdir) 208 set(scriptdir "${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_PROJECT_NAME}/scripts") 209 ENDIF() 210 211 # workingdir 212 IF(NOT DEFINED workingdir) 213 set(workingdir "/${CMAKE_INSTALL_LOCALSTATEDIR}/lib/${CMAKE_PROJECT_NAME}") 214 ENDIF() 215 set(working_dir "${workingdir}") 216 217 # plugindir 218 IF(NOT DEFINED plugindir) 219 set(plugindir ${CMAKE_INSTALL_FULL_LIBDIR}/${CMAKE_PROJECT_NAME}/plugins) 220 ENDIF() 221 222 # piddir 223 IF(NOT DEFINED piddir) 224 SET(piddir ${workingdir}) 225 ENDIF() 226 227 # bsrdir 228 IF(NOT DEFINED bsrdir) 229 SET(bsrdir ${workingdir}) 230 ENDIF() 231 232 # logdir 233 IF(NOT DEFINED logdir) 234 set(logdir "${CMAKE_INSTALL_LOCALSTATEDIR}/log/${CMAKE_PROJECT_NAME}") 235 ENDIF() 236 237 # datarootdir 238 IF(NOT DEFINED datarootdir) 239 set(datarootdir "${CMAKE_INSTALL_FULL_DATAROOTDIR}") 240 ENDIF() 241 242 # subsysdir 243 IF(NOT DEFINED subsysdir) 244 set(subsysdir "${workingdir}") 245 ENDIF() 246 247ENDIF() # IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 248 249 250# db_name 251IF(NOT DEFINED db_name) 252 SET(db_name "bareos") 253ENDIF() 254 255# db_user 256IF(NOT DEFINED db_user) 257 SET(db_user "bareos") 258ENDIF() 259 260# db_password 261IF(NOT DEFINED db_password) 262 SET(db_password "") 263ENDIF() 264 265# dir-user 266IF(NOT DEFINED dir-user) 267 SET(dir-user "") 268ENDIF() 269SET(dir_user "${dir-user}") 270 271# dir-group 272IF(NOT DEFINED dir-group) 273 SET(dir-group "") 274ENDIF() 275set(dir_group ${dir-group}) 276 277# sd-user 278IF(NOT DEFINED sd-user) 279 SET(sd-user "") 280ENDIF() 281SET(sd_user ${sd-user}) 282 283# sd-group 284IF(NOT DEFINED sd-group) 285 SET(sd-group "") 286ENDIF() 287SET(sd_group ${sd-group}) 288 289# fd-user 290IF(NOT DEFINED fd-user) 291 SET(fd-user "") 292ENDIF() 293SET(fd_user ${fd-user}) 294 295# fd-group 296IF(NOT DEFINED fd-group) 297 SET(fd-group "") 298ENDIF() 299SET(fd_group ${fd-group}) 300 301 302# dir-password 303IF(NOT DEFINED dir-password) 304 SET(dir-password "bareos") 305ENDIF() 306SET(dir_password ${dir-password}) 307 308# fd-password 309IF(NOT DEFINED fd-password) 310 SET(fd-password "") 311ENDIF() 312SET(fd_password ${fd-password}) 313 314# sd-password 315IF(NOT DEFINED sd-password) 316 SET(sd-password "") 317ENDIF() 318SET(sd_password ${sd-password}) 319 320# mon-dir-password 321IF(NOT DEFINED mon-dir-password) 322 SET(mon-dir-password "") 323ENDIF() 324SET(mon_dir_password ${mon-dir-password}) 325 326# mon-fd-password 327IF(NOT DEFINED mon-fd-password) 328 SET(mon-fd-password "") 329ENDIF() 330SET(mon_fd_password ${mon-fd-password}) 331 332# mon-sd-password 333IF(NOT DEFINED mon-sd-password) 334 SET(mon-sd-password "") 335ENDIF() 336SET(mon_sd_password ${mon-sd-password} ) 337 338# basename 339IF(NOT DEFINED basename) 340 SET(basename localhost) 341ENDIF() 342 343# hostname 344IF(NOT DEFINED hostname) 345 SET(hostname localhost) 346ENDIF() 347 348########## 349## rights 350########## 351# sbin-perm 352IF(NOT DEFINED sbin-perm) 353 SET(sbin-perm 755) 354ENDIF() 355 356 357 358########### 359## bool 360########### 361# python 362IF(NOT DEFINED python) 363 SET(python ON) 364ENDIF() 365 366# lockmgr 367IF(NOT DEFINED lockmgr) 368 SET(lockmgr OFF) 369 set(LOCKMGR 0) 370ENDIF() 371 372# smartalloc 373IF(NOT DEFINED smartalloc) 374 SET(smartalloc ON) 375 set(SMARTALLOC 1) 376ENDIF() 377 378# smartalloc 379IF(NOT smartalloc) 380 SET(smartalloc OFF) 381 set(SMARTALLOC 0) 382ELSE() 383 SET(smartalloc ON) 384 set(SMARTALLOC 1) 385ENDIF() 386 387# readline 388IF(NOT DEFINED readline) 389 SET(readline ON) 390ENDIF() 391 392# batch-insert 393IF((NOT DEFINED batch-insert) OR (${batch-insert})) 394 SET(batch-insert ON) 395 SET(HAVE_POSTGRESQL_BATCH_FILE_INSERT 1) 396 SET(USE_BATCH_FILE_INSERT 1) 397ENDIF() 398 399# dynamic-cats-backends 400IF(NOT DEFINED dynamic-cats-backends) 401 SET(dynamic-cats-backends ON) 402 SET(HAVE_DYNAMIC_CATS_BACKENDS 1) 403ELSE() 404 IF (${dynamic-cats-backends}) 405 SET(HAVE_DYNAMIC_CATS_BACKENDS 1) 406 ELSE() 407 SET(HAVE_DYNAMIC_CATS_BACKENDS 0) 408 ENDIF() 409ENDIF() 410 411# dynamic-storage-backends 412IF(NOT DEFINED dynamic-storage-backends) 413 SET(dynamic-storage-backends ON) 414 SET(HAVE_DYNAMIC_SD_BACKENDS 1) 415ELSE() 416 IF (${dynamic-storage-backends}) 417 SET(HAVE_DYNAMIC_SD_BACKENDS 1) 418 ELSE() 419 SET(HAVE_DYNAMIC_SD_BACKENDS 0) 420 ENDIF() 421ENDIF() 422 423# scsi-crypto 424IF(NOT DEFINED scsi-crypto) 425 SET(scsi-crypto OFF) 426ENDIF() 427 428# lmdb 429IF(NOT DEFINED lmdb) 430 SET(lmdb ON) 431ENDIF() 432 433# ndmp 434IF(NOT DEFINED ndmp) 435 SET(ndmp ON) 436ENDIF() 437 438# ipv6 439IF((NOT DEFINED ipv6) OR (${ipv6})) 440 SET(ipv6 ON) 441 SET(HAVE_IPV6 1) 442ENDIF() 443 444# acl 445IF(NOT DEFINED acl) 446 SET(acl ON) 447ENDIF() 448 449# xattr 450IF(NOT DEFINED xattr) 451 SET(xattr ON) 452ENDIF() 453 454# build_ndmjob 455IF(NOT DEFINED build_ndmjob) 456 SET(build_ndmjob OFF) 457ENDIF() 458 459# bat 460IF(NOT DEFINED bat) 461 SET(bat OFF) 462ENDIF() 463 464# traymonitor 465IF(NOT DEFINED traymonitor) 466 SET(HAVE_TRAYMONITOR 0) 467ENDIF() 468 469# client-only 470IF(NOT DEFINED client-only) 471 SET(client-only OFF) 472 SET(build_client_only OFF) 473ELSE() 474 SET(client-only ON) 475 SET(build_client_only ON) 476ENDIF() 477 478# postgresql 479IF(NOT DEFINED postgresql) 480 SET(postgresql OFF) 481ENDIF() 482 483# mysql 484IF(NOT DEFINED mysql) 485 SET(mysql OFF) 486ENDIF() 487 488# sqlite3 489IF(NOT DEFINED sqlite3) 490 SET(sqlite3 OFF) 491ENDIF() 492 493 494IF(NOT sqlite3) 495 IF(NOT mysql) 496 IF(NOT postgresql) 497 IF(NOT client-only) 498 MESSAGE(FATAL_ERROR "No database backend was chosen, please choose at least one from \n" 499 " - postgresql (-Dpostgresql=yes)\n" 500 " - mysqli (-Dmysql=yes) \n" 501 " - sqlite3 (-Dsqlite3=yes) \n" 502 " or select client only build (-Dclient-only=yes) \n" 503 ) 504 ENDIF() 505 ENDIF() 506 ENDIF() 507ENDIF() 508 509IF(NOT mysql) 510 set(MYSQL_INCLUDE_DIR "") 511endif() 512 513IF(NOT postgresql) 514 set(PostgreSQL_INCLUDE_DIR "") 515endif() 516 517if(NOT Readline_LIBRARY) 518 set(Readline_LIBRARY "") 519endif() 520 521if(NOT LIBZ_FOUND) 522 set(ZLIB_LIBRARY "") 523endif() 524 525set(db_backends "") 526 527IF(NOT client-only) 528 if(${sqlite3}) 529 set(HAVE_SQLITE3 1) 530 list(APPEND db_backends sqlite3) 531 endif() 532 533 if(${postgresql}) 534 set(HAVE_POSTGRESQL 1) 535 list(APPEND db_backends postgresql) 536 endif() 537 538 if(${mysql}) 539 set(HAVE_MYSQL 1) 540 list(APPEND db_backends mysql) 541 endif() 542 543 # set first entry as default db backend 544 LIST(GET db_backends 0 default_db_backend) 545endif() 546 547# tcp-wrappers 548IF(NOT DEFINED tcp-wrappers) 549 SET(tcp-wrappers OFF) 550ENDIF() 551 552# systemd 553IF(NOT DEFINED systemd) 554 SET(systemd OFF) 555ENDIF() 556 557# includes 558IF(NOT DEFINED includes) 559 SET(includes ON) 560ENDIF() 561 562# openssl 563IF(NOT DEFINED openssl) 564 SET(openssl ON) 565ENDIF() 566 567 568 569# ports 570IF(NOT DEFINED dir_port) 571 SET(dir_port "9101") 572ENDIF() 573 574IF(NOT DEFINED fd_port) 575 SET(fd_port "9102") 576ENDIF() 577 578IF(NOT DEFINED sd_port) 579 SET(sd_port "9103") 580ENDIF() 581 582IF(DEFINED baseport) 583 MATH(EXPR dir_port "${baseport}+0") 584 MATH(EXPR fd_port "${baseport}+1") 585 MATH(EXPR sd_port "${baseport}+2") 586ENDIF() 587 588 589IF(NOT DEFINED job_email) 590 SET(job_email "root@localhost") 591ENDIF() 592 593IF(NOT DEFINED dump_email) 594 SET(dump_email "root@localhost") 595ENDIF() 596 597IF(NOT DEFINED smtp_host) 598 SET(smtp_host "root@localhost") 599ENDIF() 600 601IF(DEFINED traymonitor) 602 SET(HAVE_TRAYMONITOR 1) 603ENDIF() 604 605IF(DEFINED test-plugin) 606 SET(HAVE_TEST_PLUGIN 1) 607ENDIF() 608 609IF(NOT DEFINED developer) 610 SET(developer OFF) 611ENDIF() 612 613IF(DEFINED dynamic-debian-package-list) 614 SET(GENERATE_DEBIAN_CONTROL ON) 615ELSE() 616 SET(GENERATE_DEBIAN_CONTROL OFF) 617ENDIF() 618 619IF(NOT DEFINED coverage) 620 set (coverage OFF) 621ENDIF() 622 623# do not destroy bareos-config-lib.sh 624SET(DB_NAME "@DB_NAME@") 625SET(DB_USER "@DB_USER@") 626SET(DB_PASS "@DB_PASS@") 627SET(DB_VERSION "@DB_VERSION@") 628 629 630IF (${CMAKE_COMPILER_IS_GNUCC}) 631 SET(HAVE_GCC 1) 632ENDIF() 633 634 635 636 637set(lld "\"lld\"") 638set(llu "\"llu\"") 639 640SET(HAVE_MYSQL_THREAD_SAFE 1) 641SET(HAVE_POSIX_SIGNALS 1) 642SET(HAVE_SHA2 1) 643SET(HAVE_PQISTHREADSAFE 1) 644SET(HAVE_PQ_COPY 1) 645 646SET(PROTOTYPES 1) 647SET(RETSIGTYPE void) 648SET(SETPGRP_VOID 1) 649SET(SSTDC_HEADERS 1) 650 651 652SET(_LARGEFILE_SOURCE 1) 653SET(_LARGE_FILES 1) 654SET(_FILE_OFFSET_BITS 64) 655SET(HAVE_COMPRESS_BOUND 1) 656SET(STDC_HEADERS 1) 657SET(HAVE_SQLITE3_THREADSAFE 1) 658SET(FSTYPE_MNTENT 1) 659 660SET(PACKAGE_BUGREPORT "\"\"") 661SET(PACKAGE_NAME "\"${CMAKE_PROJECT_NAME}\"") 662SET(PACKAGE_STRING "\"${CMAKE_PROJECT_NAME} ${BAREOS_NUMERIC_VERSION}\"") 663SET(PACKAGE_TARNAME "\"\"" ) 664SET(PACKAGE_URL "\"\"") 665SET(PACKAGE_VERSION "\"${BAREOS_NUMERIC_VERSION}\"") 666 667set(ENABLE_NLS 1) 668 669 670IF(HAVE_WIN32) 671 672 IF(NOT DEFINED WINDOWS_VERSION) 673 SET(WINDOWS_VERSION 0x600) 674 ENDIF() 675 676 IF(NOT DEFINED WINDOWS_BITS) 677 SET(WINDOWS_BITS 64) 678 ENDIF() 679 680ENDIF() 681