configure

changeset 385
a1f4cb076d2f
parent 287
a171da778817
child 453
4586d534f9b5
equal deleted inserted replaced
210:21274e5950af 385:a1f4cb076d2f
55 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] 55 --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
56 --infodir=DIR info documentation [DATAROOTDIR/info] 56 --infodir=DIR info documentation [DATAROOTDIR/info]
57 --mandir=DIR man documentation [DATAROOTDIR/man] 57 --mandir=DIR man documentation [DATAROOTDIR/man]
58 58
59 Optional Features: 59 Optional Features:
60 --enable-pg 60 --enable-postgresql
61 61
62 __EOF__ 62 __EOF__
63 } 63 }
64 64
65 # 65 #
66 # parse arguments 66 # parse arguments
67 # 67 #
68 for ARG in $@ 68 for ARG in $@
69 do 69 do
70 if [[ $ARG == --prefix=* ]]; then 70 case "$ARG" in
71 PREFIX=${ARG:9} 71 "--prefix="*) PREFIX=${ARG#--prefix=} ;;
72 elif [[ $ARG = --exec-prefix=* ]]; then 72 "--exec-prefix="*) EPREFIX=${ARG#--exec-prefix=} ;;
73 EPREFIX=${ARG:14} 73 "--bindir="*) BINDIR=${ARG#----bindir=} ;;
74 elif [[ $ARG = --bindir=* ]]; then 74 "--sbindir="*) SBINDIR=${ARG#--sbindir=} ;;
75 BINDIR=${ARG:9} 75 "--libdir="*) LIBDIR=${ARG#--libdir=} ;;
76 elif [[ $ARG = --sbindir=* ]]; then 76 "--libexecdir="*) LIBEXECDIR=${ARG#--libexecdir=} ;;
77 SBINDIR=${ARG:10} 77 "--datadir="*) DATADIR=${ARG#--datadir=} ;;
78 elif [[ $ARG = --libdir=* ]]; then 78 "--sysconfdir="*) SYSCONFDIR=${ARG#--sysconfdir=} ;;
79 LIBDIR=${ARG:9} 79 "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;;
80 elif [[ $ARG = --libexecdir=* ]]; then 80 "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;;
81 LIBEXECDIR=${ARG:13} 81 "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;;
82 elif [[ $ARG = --datadir=* ]]; then 82 "--infodir="*) INFODIR=${ARG#--infodir=} ;;
83 DATADIR=${ARG:10} 83 "--mandir"*) MANDIR=${ARG#--mandir} ;;
84 elif [[ $ARG = --sysconfdir=* ]]; then 84 "--help"*) printhelp; exit 1 ;;
85 SYSCONFDIR=${ARG:13} 85 "--enable-postgresql") FEATURE_POSTGRESQL=on ;;
86 elif [[ $ARG = --sharedstatedir=* ]]; then 86 "--disable-postgresql") unset FEATURE_POSTGRESQL ;;
87 SHAREDSTATEDIR=${ARG:17} 87 "-"*) echo "unknown option: $ARG"; exit 1 ;;
88 elif [[ $ARG = --localstatedir=* ]]; then 88 esac
89 LOCALSTATEDIR=${ARG:16}
90 elif [[ $ARG = --includedir=* ]]; then
91 INCLUDEDIR=${ARG:12}
92 elif [[ $ARG = --infodir=* ]]; then
93 INFODIR=${ARG:10}
94 elif [[ $ARG = --mandir=* ]]; then
95 MANDIR=${ARG:9}
96 elif [ $ARG = "--help" ]; then
97 printhelp
98 exit 0
99 elif [[ $ARG == --enable-pg ]]; then
100 FEATURE_PG=on
101 elif [[ $ARG == --disable-pg ]]; then
102 unset FEATURE_PG
103 fi
104 done 89 done
105 90
106 # set dir variables 91 # set dir variables
107 if [ -z "$BINDIR" ]; then 92 if [ -z "$BINDIR" ]; then
108 BINDIR=$EPREFIX/bin 93 BINDIR=$EPREFIX/bin
263 if [ $? -ne 0 ] ; then 248 if [ $? -ne 0 ] ; then
264 break 249 break
265 fi 250 fi
266 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags libpq`" 251 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags libpq`"
267 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs libpq`" 252 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs libpq`"
253 cat >> $TEMP_DIR/make.mk << __EOF__
254 # Dependency: libpq
255 CFLAGS += -DENABLE_POSTGRESQL
256 PLUGINS += postgresql
257 TEST_PLUGIN_LDFLAGS += -lwspgtest
258
259 __EOF__
268 echo yes 260 echo yes
269 return 0 261 return 0
270 done 262 done
271 263
272 echo no 264 echo no
289 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs openssl`" 281 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs openssl`"
290 echo yes 282 echo yes
291 return 0 283 return 0
292 done 284 done
293 285
286 # dependency openssl
287 while true
288 do
289 LDFLAGS="$LDFLAGS -lssl -lcrypto"
290 echo yes
291 return 0
292 done
293
294 echo no 294 echo no
295 return 1 295 return 1
296 } 296 }
297 dependency_libxml2() 297 dependency_libxml2()
298 { 298 {
357 break 357 break
358 fi 358 fi
359 while true 359 while true
360 do 360 do
361 361
362 CFLAGS="$CFLAGS -DBSD" 362 CFLAGS="$CFLAGS -DBSD -I/usr/local/include"
363 LDFLAGS="$LDFLAGS -lpthread -lm -lldap" 363 LDFLAGS="$LDFLAGS -lpthread -lm -lldap"
364 cat >> $TEMP_DIR/make.mk << __EOF__ 364 cat >> $TEMP_DIR/make.mk << __EOF__
365 # platform dependend source files 365 # platform dependend source files
366 PLATFORM_DAEMONOBJ = event_bsd.o 366 PLATFORM_DAEMONOBJ = event_bsd.o
367 367
467 if [ $? -ne 0 ]; then 467 if [ $? -ne 0 ]; then
468 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl " 468 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl "
469 ERROR=1 469 ERROR=1
470 fi 470 fi
471 471
472 # Features
473
472 474
473 echo >> $TEMP_DIR/config.mk 475 echo >> $TEMP_DIR/config.mk
474 if [ ! -z "${CFLAGS}" ]; then 476 if [ ! -z "${CFLAGS}" ]; then
475 echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk 477 echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk
476 fi 478 fi
479 fi 481 fi
480 if [ ! -z "${LDFLAGS}" ]; then 482 if [ ! -z "${LDFLAGS}" ]; then
481 echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk 483 echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
482 fi 484 fi
483 485
486 # Target: postgresql
487 CFLAGS=
488 LDFLAGS=
489 CXXFLAGS=
490
491
492 # Features
493 if [ ! -z "$FEATURE_POSTGRESQL" ]; then
494 # check dependency
495 dependency_libpq
496 if [ $? -ne 0 ]; then
497 # "auto" features can fail and are just disabled in this case
498 if [ $FEATURE_POSTGRESQL != "auto" ]; then
499 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq "
500 ERROR=1
501 fi
502 fi
503 fi
504
505
506 echo >> $TEMP_DIR/config.mk
507 if [ ! -z "${CFLAGS}" ]; then
508 echo "POSTGRESQL_CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk
509 fi
510 if [ ! -z "${CXXFLAGS}" ]; then
511 echo "POSTGRESQL_CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
512 fi
513 if [ ! -z "${LDFLAGS}" ]; then
514 echo "POSTGRESQL_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
515 fi
516
484 if [ $ERROR -ne 0 ]; then 517 if [ $ERROR -ne 0 ]; then
485 echo 518 echo
486 echo "Error: Unresolved dependencies" 519 echo "Error: Unresolved dependencies"
487 echo $DEPENCIES_FAILED 520 echo $DEPENDENCIES_FAILED
488 rm -Rf $TEMP_DIR 521 rm -Rf $TEMP_DIR
489 exit 1 522 exit 1
490 fi 523 fi
491 524
492 echo "configure finished" 525 echo "configure finished"

mercurial