From c154c6b7b48369ad96a30fd9bcf7b737a1cd9c38 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Thu, 19 Mar 2009 14:24:19 +0000 Subject: [PATCH] easier to compile on windows. git-svn-id: file:///svn/unbound/trunk@1538 be551aaa-1e26-0410-a405-d3ace91eadb9 --- configure | 77 +++++++++++++++++++++++++++++++----------------- configure.ac | 31 ++++++++++++++++--- doc/Changelog | 1 + makedist.sh | 6 ++-- winrc/README.txt | 6 ---- 5 files changed, 80 insertions(+), 41 deletions(-) diff --git a/configure b/configure index 2d468ea48..b09325779 100755 --- a/configure +++ b/configure @@ -2652,10 +2652,18 @@ case "$prefix" in ;; esac +# are we on MinGW? +if uname -s 2>&1 | grep MINGW32 >/dev/null; then on_mingw="yes" +else on_mingw="no"; fi + # # Determine configuration file # the eval is to evaluate shell expansion twice -ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"` +if test $on_mingw = "no"; then + ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"` +else + ub_conf_file="C:\\Program Files\\Unbound\\service.conf" +fi # Check whether --with-conf_file or --without-conf_file was given. if test "${with_conf_file+set}" = set; then @@ -2678,7 +2686,12 @@ if test "${with_run_dir+set}" = set; then withval="$with_run_dir" UNBOUND_RUN_DIR="$withval" else - UNBOUND_RUN_DIR=`dirname "$ub_conf_file"` + if test $on_mingw = no; then + UNBOUND_RUN_DIR=`dirname "$ub_conf_file"` +else + UNBOUND_RUN_DIR="" +fi + fi; hdr_run="`echo $UNBOUND_RUN_DIR | sed -e 's/\\\\/\\\\\\\\/g'`" @@ -2694,7 +2707,12 @@ if test "${with_chroot_dir+set}" = set; then withval="$with_chroot_dir" UNBOUND_CHROOT_DIR="$withval" else - UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR" + if test $on_mingw = no; then + UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR" +else + UNBOUND_CHROOT_DIR="" +fi + fi; hdr_chroot="`echo $UNBOUND_CHROOT_DIR | sed -e 's/\\\\/\\\\\\\\/g'`" @@ -2710,7 +2728,12 @@ if test "${with_pidfile+set}" = set; then withval="$with_pidfile" UNBOUND_PIDFILE="$withval" else - UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid" + if test $on_mingw = no; then + UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid" +else + UNBOUND_PIDFILE="" +fi + fi; hdr_pid="`echo $UNBOUND_PIDFILE | sed -e 's/\\\\/\\\\\\\\/g'`" @@ -5466,7 +5489,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5469 "configure"' > conftest.$ac_ext + echo '#line 5492 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6722,11 +6745,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6725: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6748: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6729: \$? = $ac_status" >&5 + echo "$as_me:6752: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7012,11 +7035,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7015: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7038: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7019: \$? = $ac_status" >&5 + echo "$as_me:7042: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7116,11 +7139,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7119: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7142: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7123: \$? = $ac_status" >&5 + echo "$as_me:7146: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9386,7 +9409,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:11916: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11897: \$? = $ac_status" >&5 + echo "$as_me:11920: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -11994,11 +12017,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11997: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12020: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12001: \$? = $ac_status" >&5 + echo "$as_me:12024: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13558,11 +13581,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13561: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13584: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13565: \$? = $ac_status" >&5 + echo "$as_me:13588: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13662,11 +13685,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13665: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13688: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13669: \$? = $ac_status" >&5 + echo "$as_me:13692: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15834,11 +15857,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15837: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15860: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15841: \$? = $ac_status" >&5 + echo "$as_me:15864: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16124,11 +16147,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16127: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16150: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16131: \$? = $ac_status" >&5 + echo "$as_me:16154: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16228,11 +16251,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16231: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16254: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16235: \$? = $ac_status" >&5 + echo "$as_me:16258: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized diff --git a/configure.ac b/configure.ac index 2b4de86dc..0f8123220 100644 --- a/configure.ac +++ b/configure.ac @@ -50,10 +50,18 @@ case "$prefix" in ;; esac +# are we on MinGW? +if uname -s 2>&1 | grep MINGW32 >/dev/null; then on_mingw="yes" +else on_mingw="no"; fi + # # Determine configuration file # the eval is to evaluate shell expansion twice -ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"` +if test $on_mingw = "no"; then + ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"` +else + ub_conf_file="C:\\Program Files\\Unbound\\service.conf" +fi AC_ARG_WITH([conf_file], AC_HELP_STRING([--with-conf-file=path], [Pathname to the Unbound configuration file]), @@ -68,7 +76,12 @@ AC_ARG_WITH(run-dir, AC_HELP_STRING([--with-run-dir=path], [set default directory to chdir to (by default dir part of cfg file)]), UNBOUND_RUN_DIR="$withval", - UNBOUND_RUN_DIR=`dirname "$ub_conf_file"`) +if test $on_mingw = no; then + UNBOUND_RUN_DIR=`dirname "$ub_conf_file"` +else + UNBOUND_RUN_DIR="" +fi +) AC_SUBST(UNBOUND_RUN_DIR) hdr_run="`echo $UNBOUND_RUN_DIR | sed -e 's/\\\\/\\\\\\\\/g'`" AC_DEFINE_UNQUOTED(RUN_DIR, ["$hdr_run"], [Directory to chdir to]) @@ -77,7 +90,12 @@ AC_ARG_WITH(chroot-dir, AC_HELP_STRING([--with-chroot-dir=path], [set default directory to chroot to (by default same as run-dir)]), UNBOUND_CHROOT_DIR="$withval", - UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR") +if test $on_mingw = no; then + UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR" +else + UNBOUND_CHROOT_DIR="" +fi +) AC_SUBST(UNBOUND_CHROOT_DIR) hdr_chroot="`echo $UNBOUND_CHROOT_DIR | sed -e 's/\\\\/\\\\\\\\/g'`" AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$hdr_chroot"], [Directory to chroot to]) @@ -86,7 +104,12 @@ AC_ARG_WITH(pidfile, AC_HELP_STRING([--with-pidfile=filename], [set default pathname to unbound pidfile (default run-dir/unbound.pid)]), UNBOUND_PIDFILE="$withval", - UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid") +if test $on_mingw = no; then + UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid" +else + UNBOUND_PIDFILE="" +fi +) AC_SUBST(UNBOUND_PIDFILE) hdr_pid="`echo $UNBOUND_PIDFILE | sed -e 's/\\\\/\\\\\\\\/g'`" AC_DEFINE_UNQUOTED(PIDFILE, ["$hdr_pid"], [default pidfile location]) diff --git a/doc/Changelog b/doc/Changelog index d6de1e95e..d858d3d01 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,6 +2,7 @@ - winrc/README.txt dos-format text file. - iana portlist updated. - use _beginthreadex() when available (performs stack alignment). + - defaults for windows baked into configure.ac (used if on mingw). 18 March 2009: Wouter - Added tests, unknown algorithms become insecure. fallback works. diff --git a/makedist.sh b/makedist.sh index 445f78358..cdafaa1c3 100755 --- a/makedist.sh +++ b/makedist.sh @@ -168,10 +168,8 @@ if [ "$DOWIN" = "yes" ]; then # procedure for making unbound installer on mingw. info "Creating windows dist unbound $version" info "Calling configure" - echo './configure --enable-debug --enable-static-exe "--with-conf-file=C:\Program Files\Unbound\service.conf" --with-run-dir="" --with-pidfile="" --with-chroot-dir="" '"$*" - ./configure --enable-debug --enable-static-exe \ - "--with-conf-file=C:\Program Files\Unbound\service.conf" \ - --with-run-dir="" --with-pidfile="" --with-chroot-dir="" $* \ + echo './configure --enable-debug --enable-static-exe '"$*" + ./configure --enable-debug --enable-static-exe $* \ || error_cleanup "Could not configure" info "Calling make" make || error_cleanup "Could not make" diff --git a/winrc/README.txt b/winrc/README.txt index 1b7cb3e10..0aeef8600 100644 --- a/winrc/README.txt +++ b/winrc/README.txt @@ -65,13 +65,7 @@ $ cd /home/user $ tar xzvf unbound-xxx.tar.gz $ cd unbound-xxx $ ./configure --enable-static-exe --with-ldns=../ldns-xxx - "--with-conf-file=C:\Program Files\Unbound\service.conf" - --with-pidfile="" --with-chroot-dir="" -Put the entire command on one line; it is paginated for display here. If you compiled openssl yourself, pass --with-ssl=../openssl-xxx too. -You can set the defaults for the config file and working directory with -options to configure (see ./configure -h). Set chroot and pidfile to "". -If you do not give these to configure you can edit the config file later. The configure options for libevent or threads are not applicable for windows, because builtin alternatives for the windows platform are used. $ make -- 2.47.3